@eluan/tokens 0.4.0 → 0.6.0

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/dist/modes.css CHANGED
@@ -2,6 +2,28 @@
2
2
  * LAYER 2: Modes
3
3
  * Semantic color tokens that adapt to Light, Dim, and Dark modes
4
4
  * These reference primitive tokens from Layer 1
5
+ *
6
+ * Each mode places the same five surfaces and five text levels on the
7
+ * theme's grey ramp (--color-neutral-*, set in themes.css):
8
+ *
9
+ * backgrounds primary the surface: cards, fields, raised controls
10
+ * secondary the ground the page is made of
11
+ * tertiary hairline fills: wells, hover, the selected nav
12
+ * item (in dark: the raised control)
13
+ * quaternary a stronger fill
14
+ * quinary the strongest fill
15
+ * foregrounds primary ink
16
+ * secondary secondary text
17
+ * tertiary muted text; still meets 4.5:1 on the surface
18
+ * quaternary captions and icons; 3:1, not for body text
19
+ * quinary disabled
20
+ * borders primary the hairline around flat surfaces
21
+ * secondary the border of a field
22
+ *
23
+ * In light the surface is white and the ground is paper, a step darker. In
24
+ * dark the ground is the darkest step and surfaces rise from it. Dim is
25
+ * light, a step down: it mixes neighbouring steps of the same ramp, so it
26
+ * keeps the theme's own tint instead of bringing a colour of its own.
5
27
  * ============================================ */
6
28
 
7
29
  /* ----------------------------------------
@@ -12,21 +34,60 @@
12
34
  [data-mode="Light"],
13
35
  [data-mode="light"] {
14
36
  --backgrounds-primary: var(--color-neutral-0);
15
- --backgrounds-secondary: var(--color-neutral-100);
16
- --backgrounds-tertiary: var(--color-neutral-200);
17
- --backgrounds-quaternary: var(--color-neutral-300);
18
- --backgrounds-quinary: var(--color-neutral-400);
19
- --foregrounds-primary: var(--color-neutral-950);
20
- --foregrounds-secondary: var(--color-neutral-800);
21
- --foregrounds-tertiary: var(--color-neutral-600);
22
- --foregrounds-quaternary: var(--color-neutral-500);
37
+ --backgrounds-secondary: var(--color-neutral-50);
38
+ --backgrounds-tertiary: var(--color-neutral-100);
39
+ --backgrounds-quaternary: var(--color-neutral-200);
40
+ --backgrounds-quinary: var(--color-neutral-300);
41
+ --foregrounds-primary: var(--color-neutral-800);
42
+ --foregrounds-secondary: var(--color-neutral-700);
43
+ /* Muted text and captions sit between steps, a third of the way to the next
44
+ * one down. Muted text then clears 4.5:1, and captions 3:1, on the white
45
+ * surface and on the paper ground, with room to spare whatever hue a theme
46
+ * tints its greys. @eluan/theme-generator checks contrast against these
47
+ * same mixes (semanticMap.ts), so keep the two in step. */
48
+ --foregrounds-tertiary: color-mix(in oklch, var(--color-neutral-600) 65%, var(--color-neutral-700));
49
+ --foregrounds-quaternary: color-mix(in oklch, var(--color-neutral-500) 65%, var(--color-neutral-600));
23
50
  --foregrounds-quinary: var(--color-neutral-400);
51
+ --borders-primary: var(--color-neutral-100);
52
+ --borders-secondary: var(--color-neutral-200);
24
53
  /* Tooltip surface — mode-aware because the tooltip loses its border in dark
25
54
  * mode, where the background and --container-border are the same value.
26
55
  * Declared here rather than in themes.css: theme tokens are mode-agnostic
27
56
  * aliases, and modes.css is imported first, so a theme-layer declaration
28
57
  * would win the cascade over any mode override. */
29
58
  --tooltip-bg: var(--backgrounds-primary);
59
+ /* Scrim behind Dialog and Sheet (applied at 0.8 opacity) — mode-aware for
60
+ * the same reason as --tooltip-bg. It must stay dark in every mode: the
61
+ * --container-fg it used to borrow is near-white in dark mode, which washed
62
+ * the page out behind a dark dialog. */
63
+ --overlay-bg: var(--color-neutral-950);
64
+ /* Elevation. Shadows are cast in the theme's own darkest neutral, so a
65
+ * generated theme's tint carries into them; nothing here names a hue. */
66
+ --elevation-shade: var(--foregrounds-primary);
67
+ --elevation-ring: color-mix(in oklch, var(--elevation-shade) 8%, transparent);
68
+ --elevation-ring-strong: color-mix(in oklch, var(--elevation-shade) 13%, transparent);
69
+ --elevation-key: color-mix(in oklch, var(--elevation-shade) 7%, transparent);
70
+ --elevation-ambient: color-mix(in oklch, var(--elevation-shade) 5%, transparent);
71
+ --elevation-highlight: transparent;
72
+ /* Controls sit closer to the eye than panels, so their shadows are a touch
73
+ * stronger: a contact shadow, a soft drop, and the inset shade of a well. */
74
+ --elevation-control-key: color-mix(in oklch, var(--elevation-shade) 10%, transparent);
75
+ --elevation-control-ambient: color-mix(in oklch, var(--elevation-shade) 7%, transparent);
76
+ --elevation-thumb-key: color-mix(in oklch, var(--elevation-shade) 24%, transparent);
77
+ --elevation-thumb-ambient: color-mix(in oklch, var(--elevation-shade) 13%, transparent);
78
+ --elevation-well-shade: color-mix(in oklch, var(--elevation-shade) 10%, transparent);
79
+ --elevation-well-ring: transparent;
80
+ --elevation-field-shade: color-mix(in oklch, var(--elevation-shade) 6%, transparent);
81
+ /* Keyboard focus outline — mode-aware for the same reason as --tooltip-bg.
82
+ * The mid-ramp step that clears 3:1 (WCAG 1.4.11) on every page and panel
83
+ * ground while staying distinct from the near-black pressed fill
84
+ * (--interactive-bg-active), so focus never reads as pressed. */
85
+ --focus-ring: var(--foregrounds-quaternary);
86
+ /* Outline and Ghost button text (and Toast cancel) — mode-aware for the
87
+ * same reason as --tooltip-bg: dim needs a deeper step than
88
+ * --mono-background gives it. */
89
+ --action-secondary-fg: var(--foregrounds-primary);
90
+ --action-tertiary-fg: var(--foregrounds-primary);
30
91
  --maitai-main: var(--color-maitai-500);
31
92
  --maitai-background: var(--color-maitai-50);
32
93
  --maitai-tint: var(--color-maitai-100);
@@ -95,7 +156,7 @@
95
156
  --seagreen-main: var(--color-seagreen-400);
96
157
  --seagreen-background: var(--color-seagreen-50);
97
158
  --seagreen-tint: var(--color-seagreen-100);
98
- --seagreen-foreground: var(--color-seagreen-600);
159
+ --seagreen-foreground: var(--color-seagreen-700);
99
160
  --seagreen-shade: var(--color-seagreen-800);
100
161
  --forestgreen-main: var(--color-seagreen-400);
101
162
  --forestgreen-background: var(--color-seagreen-50);
@@ -114,7 +175,7 @@
114
175
  --torchred-main: var(--color-torchred-500);
115
176
  --torchred-background: var(--color-torchred-50);
116
177
  --torchred-tint: var(--color-torchred-100);
117
- --torchred-foreground: var(--color-torchred-600);
178
+ --torchred-foreground: var(--color-torchred-700);
118
179
  --torchred-shade: var(--color-torchred-800);
119
180
  --blazeorange-main: var(--color-blazeorange-500);
120
181
  --blazeorange-background: var(--color-blazeorange-50);
@@ -124,17 +185,40 @@
124
185
  }
125
186
 
126
187
  [data-mode="Dim"], [data-mode="dim"] {
127
- --backgrounds-primary: var(--color-teak-100);
128
- --backgrounds-secondary: var(--color-teak-200);
129
- --backgrounds-tertiary: var(--color-teak-300);
130
- --backgrounds-quaternary: var(--color-teak-400);
131
- --backgrounds-quinary: var(--color-teak-500);
132
- --foregrounds-primary: var(--color-teak-950);
133
- --foregrounds-secondary: var(--color-teak-900);
134
- --foregrounds-tertiary: var(--color-teak-800);
135
- --foregrounds-quaternary: var(--color-teak-700);
136
- --foregrounds-quinary: var(--color-teak-600);
188
+ /* Light, a step down, on the theme's own ramp. */
189
+ --backgrounds-primary: color-mix(in oklch, var(--color-neutral-50), var(--color-neutral-100));
190
+ --backgrounds-secondary: color-mix(in oklch, var(--color-neutral-100) 60%, var(--color-neutral-200));
191
+ --backgrounds-tertiary: color-mix(in oklch, var(--color-neutral-100) 25%, var(--color-neutral-200));
192
+ --backgrounds-quaternary: color-mix(in oklch, var(--color-neutral-200), var(--color-neutral-300));
193
+ --backgrounds-quinary: var(--color-neutral-400);
194
+ --foregrounds-primary: var(--color-neutral-900);
195
+ --foregrounds-secondary: var(--color-neutral-800);
196
+ --foregrounds-tertiary: var(--color-neutral-700);
197
+ --foregrounds-quaternary: var(--color-neutral-600);
198
+ --borders-primary: var(--backgrounds-tertiary);
199
+ --borders-secondary: var(--backgrounds-quaternary);
200
+ /* Elevation: as in light mode. */
201
+ --elevation-shade: var(--foregrounds-primary);
202
+ --elevation-ring: color-mix(in oklch, var(--elevation-shade) 8%, transparent);
203
+ --elevation-ring-strong: color-mix(in oklch, var(--elevation-shade) 13%, transparent);
204
+ --elevation-key: color-mix(in oklch, var(--elevation-shade) 7%, transparent);
205
+ --elevation-ambient: color-mix(in oklch, var(--elevation-shade) 5%, transparent);
206
+ --elevation-highlight: transparent;
207
+ /* Controls sit closer to the eye than panels, so their shadows are a touch
208
+ * stronger: a contact shadow, a soft drop, and the inset shade of a well. */
209
+ --elevation-control-key: color-mix(in oklch, var(--elevation-shade) 10%, transparent);
210
+ --elevation-control-ambient: color-mix(in oklch, var(--elevation-shade) 7%, transparent);
211
+ --elevation-thumb-key: color-mix(in oklch, var(--elevation-shade) 24%, transparent);
212
+ --elevation-thumb-ambient: color-mix(in oklch, var(--elevation-shade) 13%, transparent);
213
+ --elevation-well-shade: color-mix(in oklch, var(--elevation-shade) 10%, transparent);
214
+ --elevation-well-ring: transparent;
215
+ --elevation-field-shade: color-mix(in oklch, var(--elevation-shade) 6%, transparent);
216
+ --foregrounds-quinary: var(--color-neutral-500);
137
217
  --tooltip-bg: var(--backgrounds-primary);
218
+ --overlay-bg: var(--color-neutral-950);
219
+ --focus-ring: var(--foregrounds-quaternary);
220
+ --action-secondary-fg: var(--foregrounds-primary);
221
+ --action-tertiary-fg: var(--foregrounds-primary);
138
222
  --maitai-main: var(--color-maitai-600);
139
223
  --maitai-background: var(--color-maitai-100);
140
224
  --maitai-tint: var(--color-maitai-200);
@@ -203,7 +287,7 @@
203
287
  --seagreen-main: var(--color-seagreen-500);
204
288
  --seagreen-background: var(--color-seagreen-100);
205
289
  --seagreen-tint: var(--color-seagreen-200);
206
- --seagreen-foreground: var(--color-seagreen-700);
290
+ --seagreen-foreground: var(--color-seagreen-800);
207
291
  --seagreen-shade: var(--color-seagreen-900);
208
292
  --forestgreen-main: var(--color-seagreen-500);
209
293
  --forestgreen-background: var(--color-seagreen-100);
@@ -215,14 +299,14 @@
215
299
  --electriclime-tint: var(--color-electriclime-200);
216
300
  --electriclime-foreground: var(--color-electriclime-700);
217
301
  --electriclime-shade: var(--color-electriclime-900);
218
- --mono-background: var(--color-teak-700);
219
- --mono-tint: var(--color-teak-100);
220
- --mono-foreground: var(--color-teak-50);
221
- --mono-shade: var(--color-teak-800);
302
+ --mono-background: var(--color-mono-900);
303
+ --mono-tint: var(--color-mono-200);
304
+ --mono-foreground: var(--color-mono-50);
305
+ --mono-shade: var(--color-mono-700);
222
306
  --torchred-main: var(--color-torchred-700);
223
307
  --torchred-background: var(--color-torchred-100);
224
308
  --torchred-tint: var(--color-torchred-200);
225
- --torchred-foreground: var(--color-torchred-700);
309
+ --torchred-foreground: var(--color-torchred-800);
226
310
  --torchred-shade: var(--color-torchred-900);
227
311
  --blazeorange-main: var(--color-blazeorange-600);
228
312
  --blazeorange-background: var(--color-blazeorange-100);
@@ -232,97 +316,128 @@
232
316
  }
233
317
 
234
318
  [data-mode="Dark"], [data-mode="dark"] {
235
- --backgrounds-primary: var(--color-neutral-800);
236
- --backgrounds-secondary: var(--color-neutral-900);
237
- --backgrounds-tertiary: var(--color-neutral-950);
319
+ /* The ground is the darkest step; cards rise one step from it and raised
320
+ * controls two. */
321
+ --backgrounds-primary: var(--color-neutral-900);
322
+ --backgrounds-secondary: var(--color-neutral-950);
323
+ --backgrounds-tertiary: var(--color-neutral-800);
238
324
  --backgrounds-quaternary: var(--color-neutral-700);
239
325
  --backgrounds-quinary: var(--color-neutral-600);
240
- --foregrounds-primary: var(--color-neutral-0);
241
- --foregrounds-secondary: var(--color-neutral-100);
242
- --foregrounds-tertiary: var(--color-neutral-200);
243
- --foregrounds-quaternary: var(--color-neutral-300);
244
- --foregrounds-quinary: var(--color-neutral-400);
245
- /* Same value as --container-border, so the tooltip border disappears. */
326
+ --foregrounds-primary: var(--color-neutral-100);
327
+ --foregrounds-secondary: var(--color-neutral-300);
328
+ --foregrounds-tertiary: var(--color-neutral-400);
329
+ --foregrounds-quaternary: var(--color-neutral-500);
330
+ --foregrounds-quinary: var(--color-neutral-600);
331
+ /* Hairlines sit between the card and the raised control, so they hold on
332
+ * both; a field's border is a step stronger again. */
333
+ --borders-primary: color-mix(in oklch, var(--color-neutral-900), var(--color-neutral-800));
334
+ --borders-secondary: color-mix(in oklch, var(--color-neutral-800), var(--color-neutral-700));
335
+ /* A tooltip is a raised surface. */
246
336
  --tooltip-bg: var(--backgrounds-tertiary);
337
+ /* Near black, so the scrim dims the page rather than lifting it. */
338
+ --overlay-bg: color-mix(in oklch, var(--color-neutral-950) 40%, black);
339
+ /* Elevation. A shadow barely reads on a dark page, so depth comes from a
340
+ * hairline in the foreground colour and a faint light on the top edge, over
341
+ * a deeper shadow in the ramp's darkest step. */
342
+ --elevation-shade: color-mix(in oklch, var(--color-neutral-950) 30%, black);
343
+ --elevation-ring: color-mix(in oklch, var(--foregrounds-primary) 9%, transparent);
344
+ --elevation-ring-strong: color-mix(in oklch, var(--foregrounds-primary) 14%, transparent);
345
+ --elevation-key: color-mix(in oklch, var(--elevation-shade) 45%, transparent);
346
+ --elevation-ambient: color-mix(in oklch, var(--elevation-shade) 30%, transparent);
347
+ --elevation-highlight: color-mix(in oklch, var(--foregrounds-primary) 8%, transparent);
348
+ /* On a dark ground a shadow only reads if it is near black, and a well has
349
+ * to be clearly darker than the page it is cut into. */
350
+ --elevation-control-key: color-mix(in oklch, black 40%, transparent);
351
+ --elevation-control-ambient: color-mix(in oklch, black 25%, transparent);
352
+ --elevation-thumb-key: color-mix(in oklch, black 50%, transparent);
353
+ --elevation-thumb-ambient: color-mix(in oklch, black 30%, transparent);
354
+ --elevation-well-shade: color-mix(in oklch, black 45%, transparent);
355
+ --elevation-well-ring: var(--elevation-ring);
356
+ --elevation-field-shade: color-mix(in oklch, black 45%, transparent);
357
+ /* One step lighter than in light mode: --foregrounds-quaternary is too
358
+ * close to the white pressed fill here, quinary still clears 3:1. */
359
+ --focus-ring: var(--foregrounds-quinary);
360
+ --action-secondary-fg: var(--foregrounds-primary);
361
+ --action-tertiary-fg: var(--foregrounds-primary);
247
362
  --maitai-main: var(--color-maitai-500);
248
363
  --maitai-background: var(--color-maitai-950);
249
364
  --maitai-tint: var(--color-maitai-900);
250
- --maitai-foreground: var(--color-maitai-50);
365
+ --maitai-foreground: var(--color-maitai-200);
251
366
  --maitai-shade: var(--color-maitai-300);
252
367
  --rockspray-main: var(--color-rockspray-500);
253
368
  --rockspray-background: var(--color-rockspray-950);
254
369
  --rockspray-tint: var(--color-rockspray-900);
255
- --rockspray-foreground: var(--color-rockspray-50);
370
+ --rockspray-foreground: var(--color-rockspray-200);
256
371
  --rockspray-shade: var(--color-rockspray-100);
257
372
  --crimson-main: var(--color-crimson-500);
258
373
  --crimson-background: var(--color-crimson-950);
259
374
  --crimson-tint: var(--color-crimson-900);
260
- --crimson-foreground: var(--color-crimson-50);
375
+ --crimson-foreground: var(--color-crimson-200);
261
376
  --crimson-shade: var(--color-crimson-100);
262
377
  --cerise-main: var(--color-cerise-500);
263
378
  --cerise-background: var(--color-cerise-950);
264
379
  --cerise-tint: var(--color-cerise-900);
265
- --cerise-foreground: var(--color-cerise-50);
380
+ --cerise-foreground: var(--color-cerise-200);
266
381
  --cerise-shade: var(--color-cerise-100);
267
382
  --redviolet-main: var(--color-redviolet-500);
268
383
  --redviolet-background: var(--color-redviolet-950);
269
384
  --redviolet-tint: var(--color-redviolet-900);
270
- --redviolet-foreground: var(--color-redviolet-50);
385
+ --redviolet-foreground: var(--color-redviolet-200);
271
386
  --redviolet-shade: var(--color-redviolet-100);
272
387
  --violeteggplant-main: var(--color-violeteggplant-500);
273
388
  --violeteggplant-background: var(--color-violeteggplant-950);
274
389
  --violeteggplant-tint: var(--color-violeteggplant-900);
275
- --violeteggplant-foreground: var(--color-violeteggplant-50);
390
+ --violeteggplant-foreground: var(--color-violeteggplant-200);
276
391
  --violeteggplant-shade: var(--color-violeteggplant-100);
277
392
  --electricviolet-main: var(--color-electricviolet-400);
278
393
  --electricviolet-background: var(--color-electricviolet-950);
279
394
  --electricviolet-tint: var(--color-electricviolet-900);
280
- --electricviolet-foreground: var(--color-electricviolet-50);
395
+ --electricviolet-foreground: var(--color-electricviolet-200);
281
396
  --electricviolet-shade: var(--color-electricviolet-100);
282
397
  --purpleheart-main: var(--color-purpleheart-500);
283
398
  --purpleheart-background: var(--color-purpleheart-950);
284
399
  --purpleheart-tint: var(--color-purpleheart-900);
285
- --purpleheart-foreground: var(--color-purpleheart-50);
400
+ --purpleheart-foreground: var(--color-purpleheart-200);
286
401
  --purpleheart-shade: var(--color-purpleheart-100);
287
402
  --blueribbon-main: var(--color-blueribbon-500);
288
403
  --blueribbon-background: var(--color-blueribbon-950);
289
404
  --blueribbon-tint: var(--color-blueribbon-900);
290
- --blueribbon-foreground: var(--color-blueribbon-50);
405
+ --blueribbon-foreground: var(--color-blueribbon-200);
291
406
  --blueribbon-shade: var(--color-blueribbon-100);
292
407
  --lochmara-main: var(--color-lochmara-500);
293
408
  --lochmara-background: var(--color-lochmara-950);
294
409
  --lochmara-tint: var(--color-lochmara-900);
295
- --lochmara-foreground: var(--color-lochmara-50);
410
+ --lochmara-foreground: var(--color-lochmara-200);
296
411
  --lochmara-shade: var(--color-lochmara-100);
297
412
  --bostonblue-main: var(--color-bostonblue-500);
298
413
  --bostonblue-background: var(--color-bostonblue-950);
299
414
  --bostonblue-tint: var(--color-bostonblue-900);
300
- --bostonblue-foreground: var(--color-bostonblue-50);
415
+ --bostonblue-foreground: var(--color-bostonblue-200);
301
416
  --bostonblue-shade: var(--color-bostonblue-100);
302
417
  --bluechill-main: var(--color-bluechill-400);
303
418
  --bluechill-background: var(--color-bluechill-950);
304
419
  --bluechill-tint: var(--color-bluechill-900);
305
- --bluechill-foreground: var(--color-bluechill-50);
420
+ --bluechill-foreground: var(--color-bluechill-200);
306
421
  --bluechill-shade: var(--color-bluechill-100);
307
422
  --gossamer-main: var(--color-gossamer-400);
308
423
  --gossamer-background: var(--color-gossamer-950);
309
424
  --gossamer-tint: var(--color-gossamer-900);
310
- --gossamer-foreground: var(--color-gossamer-50);
425
+ --gossamer-foreground: var(--color-gossamer-200);
311
426
  --gossamer-shade: var(--color-gossamer-100);
312
427
  --seagreen-main: var(--color-seagreen-400);
313
428
  --seagreen-background: var(--color-seagreen-950);
314
429
  --seagreen-tint: var(--color-seagreen-900);
315
- --seagreen-foreground: var(--color-seagreen-50);
430
+ --seagreen-foreground: var(--color-seagreen-200);
316
431
  --seagreen-shade: var(--color-seagreen-100);
317
432
  --forestgreen-main: var(--color-seagreen-400);
318
433
  --forestgreen-background: var(--color-seagreen-950);
319
434
  --forestgreen-tint: var(--color-seagreen-900);
320
- --forestgreen-foreground: var(--color-seagreen-50);
435
+ --forestgreen-foreground: var(--color-seagreen-200);
321
436
  --forestgreen-shade: var(--color-seagreen-100);
322
437
  --electriclime-main: var(--color-electriclime-400);
323
438
  --electriclime-background: var(--color-electriclime-950);
324
439
  --electriclime-tint: var(--color-electriclime-900);
325
- --electriclime-foreground: var(--color-electriclime-50);
440
+ --electriclime-foreground: var(--color-electriclime-200);
326
441
  --electriclime-shade: var(--color-electriclime-100);
327
442
  --mono-background: var(--color-mono-50);
328
443
  --mono-tint: var(--color-mono-700);
@@ -331,11 +446,77 @@
331
446
  --torchred-main: var(--color-torchred-400);
332
447
  --torchred-background: var(--color-torchred-950);
333
448
  --torchred-tint: var(--color-torchred-900);
334
- --torchred-foreground: var(--color-torchred-50);
449
+ --torchred-foreground: var(--color-torchred-200);
335
450
  --torchred-shade: var(--color-torchred-200);
336
451
  --blazeorange-main: var(--color-blazeorange-500);
337
452
  --blazeorange-background: var(--color-blazeorange-950);
338
453
  --blazeorange-tint: var(--color-blazeorange-900);
339
- --blazeorange-foreground: var(--color-blazeorange-50);
454
+ --blazeorange-foreground: var(--color-blazeorange-200);
340
455
  --blazeorange-shade: var(--color-blazeorange-100);
341
456
  }
457
+
458
+ /* ============================================
459
+ * Elevation levels
460
+ * One light, from above. Each level is a hairline ring (the edge), a tight
461
+ * shadow under the surface (contact) and wider, softer ones as it lifts.
462
+ * Blur grows faster than offset and every layer pulls in with a negative
463
+ * spread, so the shadows stay soft at the edges instead of drawing a line.
464
+ *
465
+ * 1 a panel or card on the page
466
+ * 2 a card inside a panel
467
+ * 3 a card inside a card; menus and popovers
468
+ * 4 dialogs, sheets and anything over a scrim
469
+ *
470
+ * control a raised control: buttons, select triggers, the selected
471
+ * segment. A ring, a contact shadow and a soft drop.
472
+ * control-solid the same on a filled control, with a light on its top edge
473
+ * thumb the knob of a switch or slider: small, so a tighter drop
474
+ * well a sunken track: segmented control, slider, switch
475
+ * field a sunken field you type into: lighter than a well, because
476
+ * the field keeps its border
477
+ *
478
+ * Declared on [data-mode] so each level resolves against that scope's own
479
+ * mode and theme, including a theme scoped to part of the page.
480
+ * ============================================ */
481
+ [data-mode] {
482
+ --elevation-1:
483
+ 0 0 0 1px var(--elevation-ring),
484
+ inset 0 1px 0 var(--elevation-highlight),
485
+ 0 1px 2px -1px var(--elevation-key),
486
+ 0 2px 6px -2px var(--elevation-ambient);
487
+ --elevation-2:
488
+ 0 0 0 1px var(--elevation-ring),
489
+ inset 0 1px 0 var(--elevation-highlight),
490
+ 0 1px 2px -1px var(--elevation-key),
491
+ 0 4px 8px -3px var(--elevation-key),
492
+ 0 12px 24px -8px var(--elevation-ambient);
493
+ --elevation-3:
494
+ 0 0 0 1px var(--elevation-ring),
495
+ inset 0 1px 0 var(--elevation-highlight),
496
+ 0 2px 4px -2px var(--elevation-key),
497
+ 0 8px 16px -6px var(--elevation-key),
498
+ 0 24px 40px -12px var(--elevation-key);
499
+ --elevation-4:
500
+ 0 0 0 1px var(--elevation-ring),
501
+ inset 0 1px 0 var(--elevation-highlight),
502
+ 0 4px 8px -4px var(--elevation-key),
503
+ 0 16px 32px -10px var(--elevation-key),
504
+ 0 40px 72px -20px color-mix(in oklch, var(--elevation-shade) 14%, transparent);
505
+ --elevation-control:
506
+ 0 0 0 1px var(--elevation-ring),
507
+ inset 0 1px 0 var(--elevation-highlight),
508
+ 0 1px 2px var(--elevation-control-key),
509
+ 0 4px 10px var(--elevation-control-ambient);
510
+ --elevation-control-solid:
511
+ inset 0 1px 0 color-mix(in oklch, white 22%, transparent),
512
+ 0 1px 2px var(--elevation-control-key),
513
+ 0 4px 10px var(--elevation-control-ambient);
514
+ --elevation-thumb:
515
+ 0 0 0 1px var(--elevation-ring),
516
+ 0 1px 2px var(--elevation-thumb-key),
517
+ 0 3px 6px var(--elevation-thumb-ambient);
518
+ --elevation-well:
519
+ inset 0 0 0 1px var(--elevation-well-ring),
520
+ inset 0 1px 2px var(--elevation-well-shade);
521
+ --elevation-field: inset 0 1px 2px var(--elevation-field-shade);
522
+ }
@@ -294,8 +294,11 @@
294
294
  --radius-radius-1: 0.0625rem;
295
295
  --radius-radius-2: 0.125rem;
296
296
  --radius-radius-4: 0.25rem;
297
+ --radius-radius-6: 0.375rem;
297
298
  --radius-radius-8: 0.5rem;
299
+ --radius-radius-10: 0.625rem;
298
300
  --radius-radius-12: 0.75rem;
301
+ --radius-radius-14: 0.875rem;
299
302
  --radius-radius-16: 1rem;
300
303
  --radius-radius-20: 1.25rem;
301
304
  --radius-radius-24: 1.5rem;
package/dist/spacing.css CHANGED
@@ -1,59 +1,54 @@
1
1
  /* ============================================
2
- * Spacing Scales
3
- * Semantic spacing tokens that adapt to Compact, Standard, and Wide
2
+ * Density
3
+ * <html data-spacing="compact | standard | wide"> sets how much room an
4
+ * interface takes: the spacing ladder (--spacing-*) and the size ladder
5
+ * (--size-*: control heights, row heights, icon boxes).
4
6
  *
5
- * --spacing-* and --size-* reference primitive rungs from Layer 1, and each
6
- * density shifts the whole ladder by one rung. Standard sits on half-step
7
- * rungs (spacing 2/4/6/10/14/18/20/32/64, sizes 14/18/22/28/36/44/56/80/120)
8
- * so it lands visibly between compact and wide rather than hugging compact.
7
+ * Density does not change text. Font size, line height and tracking belong to
8
+ * the typeset axis (typeset.css), so 13px body text is 13px in every density
9
+ * and a dense table stays readable. Only the room around the text moves.
9
10
  *
10
- * --font-size-* works the same way, but the rungs it picks are typeset steps
11
- * (typeset.css), not static primitives: each density selects a step and the
12
- * step's value is itself viewport-fluid. So `--font-size-base` is one step
13
- * lower in compact and one step higher in wide, and whichever step is chosen
14
- * still interpolates between its small/medium/large anchors as the viewport
15
- * changes. Wide saturates at the top of the ladder (4xl and 5xl both land on
16
- * step-6), mirroring compact, where xs and sm have always shared a rung.
11
+ * What each density gives the common parts, in px (compact / standard / wide):
17
12
  *
18
- * Per-step line-height and letter-spacing live alongside the sizes as
19
- * --line-height-step-* / --letter-spacing-step-*; components that opt into a
20
- * step (see the Typography component) should take all three together.
13
+ * control height --size-lg 28 / 36 / 44
14
+ * small control, row --size-md 22 / 28 / 36
15
+ * button inline padding --spacing-lg 10 / 14 / 20
16
+ * card padding --spacing-xl 14 / 18 / 24
17
+ * gap between cards --spacing-2xl 16 / 20 / 32
18
+ * page padding --spacing-3xl 24 / 32 / 40
19
+ *
20
+ * --density-step (-1, 0, 1) lets other axes react to density without knowing
21
+ * its name: curves.css uses it to step the surface radius down in compact and
22
+ * up in wide.
21
23
  * ============================================ */
22
24
 
23
25
  [data-spacing="compact"] {
26
+ --density-step: -1;
27
+
24
28
  --spacing-xxs: var(--spacing-space-0);
25
29
  --spacing-xs: var(--spacing-space-2);
26
30
  --spacing-sm: var(--spacing-space-4);
27
31
  --spacing-md: var(--spacing-space-8);
28
- --spacing-lg: var(--spacing-space-12);
29
- --spacing-xl: var(--spacing-space-16);
30
- --spacing-2xl: var(--spacing-space-20);
32
+ --spacing-lg: var(--spacing-space-10);
33
+ --spacing-xl: var(--spacing-space-14);
34
+ --spacing-2xl: var(--spacing-space-16);
31
35
  --spacing-3xl: var(--spacing-space-24);
32
36
  --spacing-4xl: var(--spacing-space-32);
33
37
 
34
38
  --size-xxs: var(--sizing-size-12);
35
39
  --size-xs: var(--sizing-size-16);
36
- --size-sm: var(--sizing-size-20);
37
- --size-md: var(--sizing-size-24);
38
- --size-lg: var(--sizing-size-32);
39
- --size-xl: var(--sizing-size-40);
40
- --size-2xl: var(--sizing-size-48);
40
+ --size-sm: var(--sizing-size-18);
41
+ --size-md: var(--sizing-size-22);
42
+ --size-lg: var(--sizing-size-28);
43
+ --size-xl: var(--sizing-size-36);
44
+ --size-2xl: var(--sizing-size-44);
41
45
  --size-3xl: var(--sizing-size-64);
42
46
  --size-4xl: var(--sizing-size-96);
43
-
44
- /* One typeset step down from standard */
45
- --font-size-xs: var(--font-size-step-neg3);
46
- --font-size-sm: var(--font-size-step-neg2);
47
- --font-size-base: var(--font-size-step-neg1);
48
- --font-size-lg: var(--font-size-step-0);
49
- --font-size-xl: var(--font-size-step-1);
50
- --font-size-2xl: var(--font-size-step-2);
51
- --font-size-3xl: var(--font-size-step-3);
52
- --font-size-4xl: var(--font-size-step-4);
53
- --font-size-5xl: var(--font-size-step-5);
54
47
  }
55
48
 
56
49
  [data-spacing="standard"] {
50
+ --density-step: 0;
51
+
57
52
  --spacing-xxs: var(--spacing-space-2);
58
53
  --spacing-xs: var(--spacing-space-4);
59
54
  --spacing-sm: var(--spacing-space-6);
@@ -73,20 +68,11 @@
73
68
  --size-2xl: var(--sizing-size-56);
74
69
  --size-3xl: var(--sizing-size-80);
75
70
  --size-4xl: var(--sizing-size-120);
76
-
77
- /* The reference mapping — base sits on step-0 */
78
- --font-size-xs: var(--font-size-step-neg2);
79
- --font-size-sm: var(--font-size-step-neg1);
80
- --font-size-base: var(--font-size-step-0);
81
- --font-size-lg: var(--font-size-step-1);
82
- --font-size-xl: var(--font-size-step-2);
83
- --font-size-2xl: var(--font-size-step-3);
84
- --font-size-3xl: var(--font-size-step-4);
85
- --font-size-4xl: var(--font-size-step-5);
86
- --font-size-5xl: var(--font-size-step-6);
87
71
  }
88
72
 
89
73
  [data-spacing="wide"] {
74
+ --density-step: 1;
75
+
90
76
  --spacing-xxs: var(--spacing-space-4);
91
77
  --spacing-xs: var(--spacing-space-8);
92
78
  --spacing-sm: var(--spacing-space-12);
@@ -94,27 +80,16 @@
94
80
  --spacing-lg: var(--spacing-space-20);
95
81
  --spacing-xl: var(--spacing-space-24);
96
82
  --spacing-2xl: var(--spacing-space-32);
97
- --spacing-3xl: var(--spacing-space-80);
98
- --spacing-4xl: var(--spacing-space-160);
83
+ --spacing-3xl: var(--spacing-space-40);
84
+ --spacing-4xl: var(--spacing-space-80);
99
85
 
100
- --size-xxs: var(--sizing-size-20);
101
- --size-xs: var(--sizing-size-24);
102
- --size-sm: var(--sizing-size-32);
103
- --size-md: var(--sizing-size-40);
104
- --size-lg: var(--sizing-size-48);
86
+ --size-xxs: var(--sizing-size-16);
87
+ --size-xs: var(--sizing-size-20);
88
+ --size-sm: var(--sizing-size-28);
89
+ --size-md: var(--sizing-size-36);
90
+ --size-lg: var(--sizing-size-44);
105
91
  --size-xl: var(--sizing-size-56);
106
- --size-2xl: var(--sizing-size-80);
107
- --size-3xl: var(--sizing-size-120);
108
- --size-4xl: var(--sizing-size-240);
109
-
110
- /* One typeset step up from standard; 4xl/5xl saturate at the ladder top */
111
- --font-size-xs: var(--font-size-step-neg1);
112
- --font-size-sm: var(--font-size-step-0);
113
- --font-size-base: var(--font-size-step-1);
114
- --font-size-lg: var(--font-size-step-2);
115
- --font-size-xl: var(--font-size-step-3);
116
- --font-size-2xl: var(--font-size-step-4);
117
- --font-size-3xl: var(--font-size-step-5);
118
- --font-size-4xl: var(--font-size-step-6);
119
- --font-size-5xl: var(--font-size-step-6);
92
+ --size-2xl: var(--sizing-size-64);
93
+ --size-3xl: var(--sizing-size-96);
94
+ --size-4xl: var(--sizing-size-160);
120
95
  }