@hugocxl/design-system 0.1.0 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/system/ds.css ADDED
@@ -0,0 +1,282 @@
1
+ /* Design system — the only stylesheet a page built with the system loads. Values mirror the DESIGN.md front matter. */
2
+ @font-face {
3
+ font-family: "Geist Sans";
4
+ src: url("fonts/Geist-Variable.woff2") format("woff2");
5
+ font-weight: 100 900;
6
+ font-display: swap;
7
+ }
8
+ @font-face {
9
+ font-family: "Geist Mono";
10
+ src: url("fonts/GeistMono-Variable.woff2") format("woff2");
11
+ font-weight: 100 900;
12
+ font-display: swap;
13
+ }
14
+
15
+ /* ─── Tokens ─────────────────────────────────────────────────────────── */
16
+ :root {
17
+ /* Palette: Superlogical paper and orange with neutral greys. Muted meets WCAG AA. */
18
+ --ds-canvas: #f5f5f4;
19
+ --ds-ink: #171717;
20
+ --ds-muted: #6e6e6e;
21
+ --ds-faint: #b3b3b3;
22
+ --ds-rule: #1717171f;
23
+ --ds-surface: #ebebea;
24
+ --ds-accent: #fe9369;
25
+ --ds-accent-text: #ce7755;
26
+
27
+ /* Hues: marks only (colored icons and status dots), never text or fills. Each reaches 3:1 on canvas and surface. */
28
+ --ds-red: #c43d3d;
29
+ --ds-orange: #bb702f;
30
+ --ds-yellow: #a08005;
31
+ --ds-green: #419445;
32
+ --ds-teal: #378f99;
33
+ --ds-sky: #388cb0;
34
+ --ds-blue: #3f83ce;
35
+ --ds-violet: #633cc7;
36
+ --ds-purple: #993ab8;
37
+ --ds-pink: #c23b62;
38
+ --ds-brown: #8f6d53;
39
+
40
+ /* Status roles: what a hue means. Always paired with words. */
41
+ --ds-success: var(--ds-green);
42
+ --ds-warning: var(--ds-yellow);
43
+ --ds-error: var(--ds-red);
44
+ --ds-info: var(--ds-blue);
45
+ --ds-neutral: var(--ds-muted);
46
+
47
+ --ds-sans: "Geist Sans", Helvetica, Arial, sans-serif;
48
+ --ds-mono: "Geist Mono", ui-monospace, Menlo, monospace;
49
+
50
+ --ds-size-reading: min(calc(1rem + .36vw), 1.54rem);
51
+ --ds-size-title: calc(var(--ds-size-reading) * 1.4);
52
+ --ds-size-small: calc(var(--ds-size-reading) * .8);
53
+ --ds-size-control: 1rem;
54
+ --ds-size-mono: .9375rem;
55
+ --ds-size-label: .8125rem;
56
+
57
+ --ds-space-1: .25rem;
58
+ --ds-space-2: .5rem;
59
+ --ds-space-3: .75rem;
60
+ --ds-space-4: 1rem;
61
+ --ds-space-5: 1.25rem;
62
+ --ds-space-6: 2rem;
63
+ --ds-space-7: 2.5rem;
64
+ --ds-space-8: 3.5rem;
65
+ --ds-space-9: 5rem;
66
+ --ds-space-10: 8rem;
67
+
68
+ --ds-radius-control: 6px;
69
+ --ds-radius-media: 12px;
70
+ --ds-radius-pill: 999px;
71
+ --ds-target: 44px;
72
+ --ds-measure: 30em;
73
+ --ds-wide: 80rem;
74
+ --ds-ease: 120ms ease-out;
75
+
76
+
77
+ accent-color: var(--ds-ink);
78
+ color-scheme: light;
79
+ }
80
+ :root[data-theme=dark] {
81
+ --ds-canvas: #111111;
82
+ --ds-ink: #ededed;
83
+ --ds-muted: #7d7d7d;
84
+ --ds-faint: #737373;
85
+ --ds-rule: #ededed24;
86
+ --ds-surface: #1c1c1c;
87
+ --ds-accent-text: #fe9369;
88
+ --ds-orange: #c77b3b;
89
+ --ds-yellow: #ceab3c;
90
+ --ds-green: #4b9d4e;
91
+ --ds-teal: #4da3ad;
92
+ --ds-sky: #4c9fc3;
93
+ --ds-violet: #7350dc;
94
+ --ds-purple: #9e3fbd;
95
+ color-scheme: dark;
96
+ }
97
+
98
+ /* ─── Shell and layout ───────────────────────────────────────────────── */
99
+ .ds {
100
+ --ds-gutter: clamp(1.25rem, 4.5vw, 4rem);
101
+ --ds-field: 0px;
102
+ box-sizing: border-box;
103
+ margin: 0;
104
+ padding: 0 calc(var(--ds-field) + var(--ds-gutter)) 0 var(--ds-gutter);
105
+ color: var(--ds-ink);
106
+ background: var(--ds-canvas);
107
+ font: 300 var(--ds-size-reading)/1.3 var(--ds-sans);
108
+ letter-spacing: -.01em;
109
+ -webkit-font-smoothing: antialiased;
110
+ }
111
+ .ds *, .ds *::before, .ds *::after { box-sizing: border-box }
112
+ .ds main { container-type: inline-size }
113
+ .ds :where(h1, h2, h3, p, ol, ul, figure, pre, table) { margin: 0 }
114
+ .ds[data-layout=field] { --ds-field: clamp(30vw, calc(100vw - 2 * var(--ds-gutter) - 47.6rem), 40vw) }
115
+ .ds[data-layout=field]::after {
116
+ content: "";
117
+ position: fixed;
118
+ inset: 12px 12px 12px auto;
119
+ width: calc(var(--ds-field) - 12px);
120
+ border-radius: var(--ds-radius-media);
121
+ background: #777 url("images/gray-folds.png") center / cover;
122
+ pointer-events: none;
123
+ }
124
+ .ds-column { max-width: var(--ds-measure); margin-inline: auto }
125
+ .ds[data-layout=field] .ds-column { margin-inline: 0 }
126
+ .ds-opening { padding-top: clamp(var(--ds-space-9), 8vw, var(--ds-space-10)) }
127
+ .ds-wide {
128
+ width: min(100cqw, var(--ds-wide));
129
+ margin-block: var(--ds-space-8);
130
+ margin-inline: calc((100% - min(100cqw, var(--ds-wide))) / 2);
131
+ }
132
+ .ds[data-layout=field] .ds-wide { margin-inline: 0 }
133
+ @media (max-width: 760px) {
134
+ .ds[data-layout=field] { --ds-field: 20px }
135
+ .ds[data-layout=field]::after { inset: 6px 5px 6px auto; width: 12px; border-radius: 5px }
136
+ }
137
+
138
+ /* ─── Text ───────────────────────────────────────────────────────────── */
139
+ .ds :where(h1, h2, h3) { font: inherit; letter-spacing: inherit }
140
+ .ds :where(p, ul, ol, .ds-code, .ds-table, .ds-table-scroll) + :where(p, ul, ol, .ds-code, .ds-table, .ds-table-scroll) { margin-top: var(--ds-space-5) }
141
+ .ds p { text-wrap: pretty }
142
+ .ds-section :where(ul:not([class]), ol:not([class])) { padding-left: 1.2em }
143
+ .ds-section :where(ul:not([class]), ol:not([class])) > li + li { margin-top: var(--ds-space-2) }
144
+ .ds strong { font-weight: 500 }
145
+ .ds a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: .2em }
146
+ .ds a:hover { text-decoration-color: currentColor }
147
+ .ds :where(code, kbd, samp) { font-family: var(--ds-mono); font-size: .85em; font-weight: 400; letter-spacing: 0 }
148
+ .ds :focus-visible { outline: 2px solid var(--ds-ink); outline-offset: 3px }
149
+ .ds-muted { color: var(--ds-muted) }
150
+ .ds-accent { color: var(--ds-accent-text) }
151
+ .ds-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0 }
152
+
153
+ .ds-title { font-size: var(--ds-size-title); font-weight: 500; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance }
154
+ .ds-title > * { display: block }
155
+ .ds-title > :not(:first-child) { color: var(--ds-muted) }
156
+ .ds-statement { font-size: var(--ds-size-title); font-weight: 500; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance }
157
+
158
+ .ds-section { margin-top: var(--ds-space-7); scroll-margin-top: var(--ds-space-6) }
159
+ .ds-section > h2 { margin-bottom: var(--ds-space-4); color: var(--ds-muted); font-weight: 400 }
160
+ .ds-section h3 { font-weight: 400 }
161
+
162
+ .ds-label { font: 400 var(--ds-size-label)/1.5 var(--ds-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ds-muted) }
163
+ .ds-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-2) var(--ds-space-5); margin-top: var(--ds-space-6); list-style: none; padding: 0 }
164
+ .ds-meta + * { margin-top: var(--ds-space-8) }
165
+ .ds-dot, .ds-feedback[data-status]::before { display: inline-block; width: .5rem; height: .5rem; margin-right: var(--ds-space-2); border-radius: 50%; background: var(--ds-status, var(--ds-accent)); vertical-align: .05em }
166
+ .ds-feedback[data-status]::before { content: "" }
167
+
168
+ /* Status: a dot or an icon in the status color, always before the words that name the status. */
169
+ [data-status=success] { --ds-status: var(--ds-success) }
170
+ [data-status=warning] { --ds-status: var(--ds-warning) }
171
+ [data-status=error] { --ds-status: var(--ds-error) }
172
+ [data-status=info] { --ds-status: var(--ds-info) }
173
+ [data-status=neutral] { --ds-status: var(--ds-neutral) }
174
+
175
+ /* ─── Masthead and footer ────────────────────────────────────────────── */
176
+ .ds-masthead { display: flex; align-items: center; gap: var(--ds-space-5); padding-top: var(--ds-space-6); font-size: var(--ds-size-small) }
177
+ .ds-masthead a { display: inline-flex; align-items: center; min-height: var(--ds-target); text-decoration: none }
178
+ .ds-masthead a:hover { text-decoration: underline }
179
+ .ds-wordmark { margin-right: auto; font-size: 1.125rem; font-weight: 600; letter-spacing: -.055em }
180
+ .ds-masthead .ds-wordmark:hover { text-decoration: none }
181
+ @media (max-width: 480px) { .ds-masthead { flex-wrap: wrap; gap: 0 var(--ds-space-3) } .ds-wordmark { flex-basis: 100% } }
182
+ .ds-theme { flex: none; width: var(--ds-target); height: var(--ds-target); border: 1px solid var(--ds-rule); border-radius: 50%; color: inherit; background: transparent; font: inherit; cursor: pointer }
183
+
184
+ .ds-footer { display: flex; align-items: center; gap: var(--ds-space-5); margin-top: var(--ds-space-9); padding-bottom: var(--ds-space-7); font: 400 var(--ds-size-mono)/1.4 var(--ds-mono); letter-spacing: 0 }
185
+ .ds-footer::before { content: ""; order: 1; flex: 1; min-width: var(--ds-space-6); border-top: 1px solid var(--ds-rule) }
186
+ .ds-footer ul { display: flex; flex-wrap: wrap; gap: var(--ds-space-2) var(--ds-space-5); margin: 0; padding: 0; list-style: none }
187
+ .ds-footer ul:last-child { order: 2 }
188
+ .ds-footer li + li { margin-top: 0 }
189
+ .ds-footer a { text-decoration: none }
190
+ .ds-footer a:hover { text-decoration: underline }
191
+
192
+ /* ─── Figures (vectors from @hugocxl/vectors) ────────────────────────────────────────────────────────── */
193
+ .ds-media { display: grid; place-items: center; aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--ds-radius-media); background: var(--ds-surface) }
194
+ .ds-media > img { width: 100%; height: 100%; object-fit: cover }
195
+ .ds-caption { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-4); min-height: var(--ds-target); margin-top: var(--ds-space-3) }
196
+
197
+ .ds-grid { display: grid; grid-template-columns: repeat(var(--ds-cols, 3), minmax(0, 1fr)); list-style: none; padding: 0 }
198
+ .ds-grid[data-columns="2"] { --ds-cols: 2 }
199
+ .ds-grid[data-columns="4"] { --ds-cols: 4 }
200
+ .ds-grid > li { display: flex; flex-direction: column; padding: 0 var(--ds-space-6) }
201
+ .ds-grid > li:first-child { padding-left: 0 }
202
+ .ds-grid > li:last-child { padding-right: 0 }
203
+ .ds-grid > li + li { border-left: 1px solid var(--ds-rule) }
204
+ .ds-grid h3 { margin-top: auto; font-weight: 400 }
205
+ .ds-grid p { margin-top: var(--ds-space-2); font-size: var(--ds-size-small); line-height: 1.4; color: var(--ds-muted) }
206
+ @container (max-width: 34rem) {
207
+ .ds-grid { grid-template-columns: minmax(0, 1fr) }
208
+ .ds-grid > li { padding: var(--ds-space-5) 0 }
209
+ .ds-grid > li + li { border-left: 0; border-top: 1px solid var(--ds-rule) }
210
+ }
211
+
212
+ /* ─── Index list and table ───────────────────────────────────────────── */
213
+ .ds-index { list-style: none; padding: 0; border-bottom: 1px solid var(--ds-rule) }
214
+ .ds-index > li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--ds-space-2) var(--ds-space-5); padding-block: var(--ds-space-5); border-top: 1px solid var(--ds-rule) }
215
+ .ds-index .ds-label { padding-top: .35em }
216
+ .ds-index h3 { font-weight: 400 }
217
+ .ds-index p { margin-top: var(--ds-space-2); color: var(--ds-muted) }
218
+ @container (max-width: 30rem) { .ds-index > li { grid-template-columns: minmax(0, 1fr) } }
219
+
220
+ .ds-table { width: 100%; border-collapse: collapse; font-size: var(--ds-size-small); font-variant-numeric: tabular-nums }
221
+ .ds-table th { font: 400 var(--ds-size-label)/1.5 var(--ds-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ds-muted); text-align: left }
222
+ .ds-table :where(th, td) { padding: var(--ds-space-3) var(--ds-space-4) var(--ds-space-3) 0; border-bottom: 1px solid var(--ds-rule); vertical-align: top }
223
+ .ds-table tbody th { font: inherit; letter-spacing: inherit; text-transform: none; color: var(--ds-ink) }
224
+ .ds-table-scroll { overflow-x: auto }
225
+
226
+ /* ─── Controls ───────────────────────────────────────────────────────── */
227
+ .ds-button { display: inline-flex; align-items: center; gap: var(--ds-space-3); min-height: var(--ds-target); padding: 0 var(--ds-space-5); border: 0; border-radius: var(--ds-radius-control); color: var(--ds-canvas); background: var(--ds-ink); font: 400 var(--ds-size-control)/1 var(--ds-sans); letter-spacing: -.01em; text-decoration: none; cursor: pointer }
228
+ .ds a.ds-button { color: var(--ds-canvas); text-decoration: none }
229
+ .ds-button:hover { opacity: .84 }
230
+
231
+ .ds-form { margin-top: var(--ds-space-7) }
232
+ .ds-form label { display: block }
233
+ .ds-input { display: flex; align-items: center; max-width: 20em; margin-top: var(--ds-space-4); border-bottom: 1px solid var(--ds-rule) }
234
+ .ds-input:hover, .ds-input:focus-within { border-color: color-mix(in srgb, var(--ds-ink) 40%, transparent) }
235
+ .ds-input input { flex: 1; min-width: 0; min-height: var(--ds-target); padding: 0; border: 0; border-radius: 0; color: inherit; background: transparent; font: inherit; letter-spacing: inherit; appearance: none }
236
+ .ds-input input::placeholder { color: var(--ds-faint) }
237
+ .ds-input input:focus-visible { outline: none }
238
+ .ds-input:has(input:focus-visible) { outline: 2px solid var(--ds-ink); outline-offset: 3px }
239
+ .ds-input input[aria-invalid=true] { text-decoration: underline wavy var(--ds-error) 1px; text-underline-offset: .25em }
240
+ .ds-input button { flex: none; width: var(--ds-target); height: var(--ds-target); padding: 0; border: 0; color: var(--ds-muted); background: transparent; font: inherit; cursor: pointer }
241
+ .ds-input button:hover { color: var(--ds-ink) }
242
+ .ds-help { margin-top: var(--ds-space-5); color: var(--ds-muted) }
243
+ .ds-feedback { display: block; margin-top: var(--ds-space-3); font-size: var(--ds-size-small) }
244
+ .ds-feedback:empty { display: none }
245
+
246
+ .ds-code { position: relative; border-radius: var(--ds-radius-control); background: var(--ds-surface) }
247
+ .ds-code pre { padding: var(--ds-space-4) var(--ds-space-5); overflow-x: auto; font: 400 .8125rem/1.6 var(--ds-mono); letter-spacing: 0 }
248
+ .ds-code pre code { font-size: inherit }
249
+ .ds-code button { position: absolute; top: 0; right: 0; min-width: var(--ds-target); min-height: var(--ds-target); padding: 0 var(--ds-space-3); border: 0; border-radius: var(--ds-radius-control); color: var(--ds-ink); background: var(--ds-surface); font: 400 var(--ds-size-label)/1 var(--ds-mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer }
250
+ .ds-code button:hover { text-decoration: underline }
251
+
252
+ .ds-pager { display: inline-flex; padding: 2px; border: 1px solid var(--ds-rule); border-radius: var(--ds-radius-pill); background: var(--ds-canvas) }
253
+ .ds-pager button { width: var(--ds-target); height: var(--ds-target); padding: 0; border: 0; border-radius: 50%; color: inherit; background: transparent; font: 400 1.1rem/1 var(--ds-sans); cursor: pointer }
254
+ .ds-pager button:hover { background: var(--ds-surface) }
255
+
256
+ @media (prefers-reduced-motion: no-preference) {
257
+ .ds-button, .ds-pager button, .ds-input { transition: transform var(--ds-ease), background-color var(--ds-ease), border-color var(--ds-ease), opacity var(--ds-ease) }
258
+ .ds-button:active, .ds-pager button:active { transform: scale(.96) }
259
+ }
260
+
261
+ /* Icons from @hugocxl/icons (Stroke): before the words of a link, button or label, or alone in an icon button. */
262
+ .ds-icon { display: inline-block; width: 1em; height: 1em; margin-inline-end: var(--ds-space-2); vertical-align: -.125em; flex: none }
263
+ :is(.ds-theme, .ds-pager button, .ds-input button) > .ds-icon { margin: 0 }
264
+ /* Colored icons: a hue names a kind of thing (a language, a file type, a brand), a status names a state. */
265
+ .ds-icon[data-status] { color: var(--ds-status) }
266
+ .ds-icon[data-color=red] { color: var(--ds-red) }
267
+ .ds-icon[data-color=orange] { color: var(--ds-orange) }
268
+ .ds-icon[data-color=yellow] { color: var(--ds-yellow) }
269
+ .ds-icon[data-color=green] { color: var(--ds-green) }
270
+ .ds-icon[data-color=teal] { color: var(--ds-teal) }
271
+ .ds-icon[data-color=sky] { color: var(--ds-sky) }
272
+ .ds-icon[data-color=blue] { color: var(--ds-blue) }
273
+ .ds-icon[data-color=violet] { color: var(--ds-violet) }
274
+ .ds-icon[data-color=purple] { color: var(--ds-purple) }
275
+ .ds-icon[data-color=pink] { color: var(--ds-pink) }
276
+ .ds-icon[data-color=brown] { color: var(--ds-brown) }
277
+
278
+ /* Vectors from @hugocxl/vectors: a 4:3 line illustration in place of a drawing, in ink. */
279
+ .ds-vector { display: block; color: var(--ds-ink) }
280
+ .ds-vector[hidden] { display: none }
281
+ .ds-media > .ds-vector { width: auto; height: 82%; max-width: 92%; aspect-ratio: 4 / 3 }
282
+ .ds-grid .ds-vector { width: 100%; height: auto; aspect-ratio: 4 / 3; margin-block: var(--ds-space-5) }
package/system/ds.js ADDED
@@ -0,0 +1,12 @@
1
+ // Design system runtime: wires .ds-code copy buttons.
2
+ document.addEventListener('click', async event => {
3
+ const button = event.target.closest('.ds-code button');
4
+ if (!button) return;
5
+ try {
6
+ await navigator.clipboard.writeText(button.closest('.ds-code').querySelector('pre').textContent);
7
+ button.textContent = 'Copied';
8
+ } catch {
9
+ button.textContent = 'Select to copy';
10
+ }
11
+ setTimeout(() => { button.textContent = 'Copy' }, 1600);
12
+ });
@@ -16,7 +16,7 @@
16
16
  "blocks": { "type": "array", "minItems": 3, "items": { "$ref": "#/$defs/block" } }
17
17
  },
18
18
  "allOf": [
19
- { "if": { "properties": { "recipe": { "const": "home" } } }, "then": { "properties": { "layout": { "const": "field" } } }, "else": { "properties": { "layout": { "const": "plain" } } } }
19
+ { "if": { "properties": { "recipe": { "const": "home" } } }, "then": { "properties": { "layout": { "description": "plain by default; field only on a personal home page." } } }, "else": { "properties": { "layout": { "const": "plain" } } } }
20
20
  ],
21
21
  "$defs": {
22
22
  "text": { "type": "string", "minLength": 1 },
@@ -24,11 +24,8 @@
24
24
  "type": "object", "required": ["label", "href"], "additionalProperties": false,
25
25
  "properties": { "label": { "$ref": "#/$defs/text" }, "href": { "$ref": "#/$defs/text" }, "icon": { "$ref": "#/$defs/icon" } }
26
26
  },
27
- "icon": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "description": "A Stroke icon from @hugocxl/icons, rendered before the words with class p9-icon." },
28
- "vector": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "description": "An illustration from @hugocxl/vectors, inlined with class p9-vector." },
29
- "figure": {
30
- "enum": ["basket", "branches", "cabinet", "dish", "drawer", "elevator", "exploded", "format", "hub", "keyboard", "laptop", "lockers", "loupe", "padlock", "patch", "phone", "phosphor", "plot", "plug", "query", "rail", "rebuild", "relay", "riffle", "router", "settle", "sieve", "slow", "stack", "terminal", "terrain", "turntable", "vault"]
31
- },
27
+ "icon": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "description": "A Stroke icon from @hugocxl/icons, rendered before the words with class ds-icon." },
28
+ "vector": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "description": "An illustration from @hugocxl/vectors, inlined with class ds-vector." },
32
29
  "paragraph": {
33
30
  "type": "object", "required": ["text"], "additionalProperties": false,
34
31
  "description": "Inline links use Markdown [label](href). 'muted' is appended in the muted color after 'text'.",
@@ -103,13 +100,11 @@
103
100
  "type": "object", "required": ["component", "caption"], "additionalProperties": false,
104
101
  "properties": {
105
102
  "component": { "const": "figure-wide" },
106
- "figure": { "$ref": "#/$defs/figure" },
107
103
  "vector": { "$ref": "#/$defs/vector" },
108
104
  "image": { "type": "object", "required": ["src", "alt"], "additionalProperties": false, "properties": { "src": { "$ref": "#/$defs/text" }, "alt": { "$ref": "#/$defs/text" } } },
109
- "label": { "type": "string", "description": "aria-label for a drawing or vector." },
110
- "caption": { "type": "string", "pattern": "^Fig\\. [0-9]{2} / .+$" }
105
+ "caption": { "type": "string", "pattern": "^Fig\\. [0-9]{2} / .+$" }
111
106
  },
112
- "oneOf": [{ "required": ["figure", "label"] }, { "required": ["vector"] }, { "required": ["image"] }]
107
+ "oneOf": [{ "required": ["vector"] }, { "required": ["image"] }]
113
108
  },
114
109
  "figure-grid": {
115
110
  "type": "object", "required": ["component", "items"], "additionalProperties": false,
@@ -118,12 +113,10 @@
118
113
  "items": {
119
114
  "type": "array", "minItems": 2, "maxItems": 4,
120
115
  "items": {
121
- "type": "object", "required": ["label", "title", "text"], "additionalProperties": false,
122
- "oneOf": [{ "required": ["figure"] }, { "required": ["vector"] }],
116
+ "type": "object", "required": ["vector", "label", "title", "text"], "additionalProperties": false,
123
117
  "properties": {
124
- "figure": { "$ref": "#/$defs/figure" },
125
118
  "vector": { "$ref": "#/$defs/vector" },
126
- "label": { "type": "string", "description": "aria-label for the drawing or vector." },
119
+ "label": { "type": "string", "pattern": "^Fig 0\\.[1-4]$", "description": "Figure label, Fig 0.N." },
127
120
  "title": { "type": "string", "maxLength": 32 },
128
121
  "text": { "type": "string", "maxLength": 90 }
129
122
  }
package/system/theme.js CHANGED
@@ -1,13 +1,13 @@
1
- // Follow the system appearance until the visitor picks one with a [data-p9-theme] button.
1
+ // Follow the system appearance until the visitor picks one with a [data-ds-theme] button.
2
2
  const preference = window.matchMedia('(prefers-color-scheme: dark)');
3
3
  function applyTheme() {
4
- document.documentElement.dataset.theme = localStorage.getItem('p9-theme') || (preference.matches ? 'dark' : 'light');
4
+ document.documentElement.dataset.theme = localStorage.getItem('ds-theme') || (preference.matches ? 'dark' : 'light');
5
5
  }
6
6
  applyTheme();
7
7
  preference.addEventListener('change', applyTheme);
8
8
 
9
9
  document.addEventListener('click', event => {
10
- if (!event.target.closest('[data-p9-theme]')) return;
11
- localStorage.setItem('p9-theme', document.documentElement.dataset.theme === 'light' ? 'dark' : 'light');
10
+ if (!event.target.closest('[data-ds-theme]')) return;
11
+ localStorage.setItem('ds-theme', document.documentElement.dataset.theme === 'light' ? 'dark' : 'light');
12
12
  applyTheme();
13
13
  });
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Lucas Marques
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.