···1+/**
2+ * Typography & Layout Section
3+ * Demonstrates Volt CSS typography features including Tufte-style sidenotes
4+ */
5+6+import * as dom from "../utils";
7+8+export function createTypographySection(): HTMLElement {
9+ return dom.article(
10+ { id: "typography" },
11+ dom.h2(null, "Typography & Layout"),
12+ dom.section(
13+ null,
14+ dom.h3(null, "Headings & Hierarchy"),
15+ dom.p(
16+ null,
17+ "Volt CSS provides a harmonious type scale based on a 1.25 ratio (major third).",
18+ dom.small(
19+ null,
20+ "The modular scale creates visual hierarchy without requiring any CSS classes. Font sizes range from 0.889rem to 2.566rem.",
21+ ),
22+ " All headings automatically receive appropriate sizing, spacing, and weight.",
23+ ),
24+ dom.h4(null, "Level 4 Heading"),
25+ dom.p(null, "Demonstrates the fourth level of hierarchy."),
26+ dom.h5(null, "Level 5 Heading"),
27+ dom.p(null, "Even smaller, but still distinct and readable."),
28+ dom.h6(null, "Level 6 Heading"),
29+ dom.p(null, "The smallest heading level in the hierarchy."),
30+ ),
31+ dom.section(
32+ null,
33+ dom.h3(null, "Tufte-Style Sidenotes"),
34+ dom.p(
35+ null,
36+ "One of the signature features of Volt CSS is Tufte-style sidenotes.",
37+ dom.small(
38+ null,
39+ "Edward Tufte is renowned for his work on information design and data visualization. His books feature extensive use of margin notes that provide context without interrupting the main narrative flow.",
40+ ),
41+ " These appear in the margin on desktop and inline on mobile devices.",
42+ ),
43+ dom.p(
44+ null,
45+ "Sidenotes are created using the semantic ",
46+ dom.code(null, "<small>"),
47+ " element.",
48+ dom.small(
49+ null,
50+ "The <small> element represents side comments and fine print, making it semantically appropriate for sidenotes. No custom attributes needed!",
51+ ),
52+ " This keeps markup clean and portable while maintaining semantic meaning.",
53+ ),
54+ dom.p(
55+ null,
56+ "The responsive behavior ensures readability across all devices.",
57+ dom.small(
58+ null,
59+ "On narrow screens, sidenotes appear inline with subtle styling. On wider screens (≥1200px), they float into the right margin.",
60+ ),
61+ " Try resizing your browser to see the effect.",
62+ ),
63+ ),
64+ dom.section(
65+ null,
66+ dom.h3(null, "Lists"),
67+ dom.p(null, "Both ordered and unordered lists are styled with appropriate spacing:"),
68+ dom.h4(null, "Unordered List"),
69+ dom.ul(
70+ null,
71+ ...dom.repeat(dom.li, [
72+ "Reactive signals for state management",
73+ "Computed values derived from signals",
74+ "Effect system for side effects",
75+ "Declarative data binding via attributes",
76+ ]),
77+ ),
78+ dom.h4(null, "Ordered List"),
79+ dom.ol(
80+ null,
81+ ...dom.repeat(dom.li, [
82+ "Define your signals and computed values",
83+ "Write semantic HTML markup",
84+ "Add data-volt-* attributes for reactivity",
85+ "Mount the scope and watch the magic happen",
86+ ]),
87+ ),
88+ dom.h4(null, "Description List"),
89+ dom.dl(
90+ null,
91+ ...dom.kv([["Signal", "A reactive primitive that holds a value and notifies subscribers of changes."], [
92+ "Computed",
93+ "A derived value that automatically updates when its dependencies change.",
94+ ], ["Effect", "A side effect that runs when its reactive dependencies change."]]),
95+ ),
96+ ),
97+ dom.section(
98+ null,
99+ dom.h3(null, "Blockquotes & Citations"),
100+ dom.blockquote(
101+ null,
102+ dom.p(
103+ null,
104+ "Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.",
105+ ),
106+ dom.cite(null, "Antoine de Saint-Exupéry"),
107+ ),
108+ dom.blockquote(
109+ null,
110+ dom.p(
111+ null,
112+ "The best programs are written so that computing machines can perform them quickly and so that human beings can understand them clearly.",
113+ ),
114+ dom.cite(null, "Donald Knuth"),
115+ ),
116+ ),
117+ dom.section(
118+ null,
119+ dom.h3(null, "Code & Preformatted Text"),
120+ dom.p(null, "Inline code uses ", dom.code(null, "monospace font"), " for clarity."),
121+ dom.p(null, "Code blocks preserve formatting and provide syntax-appropriate styling:"),
122+ dom.pre(
123+ null,
124+ dom.code(
125+ null,
126+ `import { signal, computed, mount } from 'volt';
127+128+const count = signal(0);
129+const doubled = computed(() => count.get() * 2);
130+131+mount(document.querySelector('#app'), {
132+ count,
133+ doubled,
134+ increment: () => count.set(count.get() + 1)
135+});`,
136+ ),
137+ ),
138+ ),
139+ dom.section(
140+ null,
141+ dom.h3(null, "Tables"),
142+ dom.p(
143+ null,
144+ "Tables receive zebra striping and responsive styling automatically.",
145+ dom.small(
146+ null,
147+ "Tables use alternating row colors for improved scannability. On mobile, they remain scrollable horizontally if needed.",
148+ ),
149+ ),
150+ dom.table(
151+ null,
152+ dom.thead(null, dom.tr(null, ...dom.repeat(dom.th, ["Feature", "Volt.js", "Framework X", "Framework Y"]))),
153+ dom.tbody(
154+ null,
155+ dom.tr(null, ...dom.repeat(dom.td, ["Bundle Size", "< 15KB gzipped", "~40KB", "~30KB"])),
156+ dom.tr(null, dom.td(null, "Virtual DOM"), dom.td(null, "No"), dom.td(null, "Yes"), dom.td(null, "Yes")),
157+ dom.tr(null, ...dom.repeat(dom.td, ["Reactive System", "Signals", "Proxy-based", "Observable"])),
158+ dom.tr(null, ...dom.repeat(dom.td, ["Learning Curve", "Gentle", "Moderate", "Steep"])),
159+ ),
160+ ),
161+ ),
162+ );
163+}