@stnd/styles 0.5.1 → 0.5.3

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.
@@ -1,5 +1,42 @@
1
1
  @use "standard-00-variables" as *;
2
2
 
3
+ /**
4
+ * @component Color System
5
+ * @category Foundation
6
+ * @description Seed-first OKLCH color engine. Set one thing — your light
7
+ * foreground color — and a full light/dark palette, ten semantic hues, and
8
+ * a shadow/elevation scale all derive from it via `oklch(from <seed> ...)`
9
+ * relative color syntax. Override at three depths: set `--color-light-foreground`
10
+ * alone (everything else follows); set individual `--color-light-*` /
11
+ * `--color-dark-*` tokens for per-scheme control; or theme fully via
12
+ * `[data-theme]` selectors, which re-resolve the whole token set at any
13
+ * element, not just `:root`.
14
+ *
15
+ * @property --color-light-foreground The primary light foreground seed. Change this alone and dark mode, all ten chromatic hues, and derived surfaces/borders/shadows follow.
16
+ * @property --color-light-background The root light background seed (default `white`).
17
+ * @property --color-dark-foreground Derived dark reading foreground (default ~85% lightness matching foreground hue).
18
+ * @property --color-dark-background Derived dark background (default ~20% lightness matching foreground hue).
19
+ * @property --color-background Active scheme background token.
20
+ * @property --color-foreground Active scheme foreground token.
21
+ * @property --color-accent Active accent color token (defaults to triadic +120°).
22
+ * @property --color-border Active border color token.
23
+ * @property --color-surface Active elevated surface background.
24
+ * @property --color-muted Active muted text color (~60% opacity).
25
+ * @property --color-subtle Active subtle UI text color (~40% opacity).
26
+ * @property --color-link Semantic link color token.
27
+ * @property --color-success Semantic success status color (`--color-green`).
28
+ * @property --color-warning Semantic warning status color (`--color-orange`).
29
+ * @property --color-error Semantic error status color (`--color-red`).
30
+ * @property --color-info Semantic info status color (`--color-blue`).
31
+ * @property --color-light Polarity alias resolving to the lighter tone of the active scheme.
32
+ * @property --color-dark Polarity alias resolving to the darker tone of the active scheme.
33
+ * @property --shadow Primary ambient shadow preset.
34
+ * @property .theme-light Forces light token set and color scheme on any subtree.
35
+ * @property .theme-dark Forces dark token set and color scheme on any subtree.
36
+ * @property .inverse Flips scheme to whichever mode is not currently active.
37
+ * @property [data-color-mode] Attribute forcing `"light"` or `"dark"` scheme mode.
38
+ */
39
+
3
40
  /* ==========================================================================
4
41
  STANDARD COLOR SYSTEM — Seed-First Architecture
5
42
 
@@ -42,18 +79,15 @@
42
79
  /* Tell browser we support both color schemes */
43
80
  color-scheme: light dark;
44
81
 
45
- /* ===================================================================
46
- STAGE 1: DARK SEED DERIVATION
47
- The ink's soul carries into darkness.
48
- Both dark seeds inherit hue from the light foreground — warm brown
49
- ink begets a warm dark background and a warm soft foreground.
50
- Themes override --color-dark-background / --color-dark-foreground
51
- at [data-theme] specificity for a distinct dark mood.
52
-
53
- Light fg #442f1c → oklch(0.30, 0.07, H≈60) warm brown ink
54
- Dark bg derived → oklch(0.20, 0.02, H≈60) same hue, very dark, muted
55
- Dark fg derived → oklch(0.85, 0.04, H≈60) same hue, soft reading brightness
56
- =================================================================== */
82
+ /**
83
+ * @component Dark Seed Derivation
84
+ * @category Foundation
85
+ * @description Both dark seeds inherit hue from the light foreground seed.
86
+ * Warm ink begets a warm dark background and a warm soft reading foreground.
87
+ *
88
+ * @property --color-dark-background Dark background matching foreground hue at ~20% lightness and muted chroma.
89
+ * @property --color-dark-foreground Dark foreground matching foreground hue at ~85% lightness for soft reading brightness.
90
+ */
57
91
 
58
92
  /* Dark background: foreground's hue at very low lightness, muted chroma */
59
93
  --color-dark-background: oklch(
@@ -71,17 +105,27 @@
71
105
  /* same hue — the vibe persists */
72
106
  );
73
107
 
74
- /* ===================================================================
75
- STAGE 2: LIGHT PALETTE
76
- Full spectrum generated from light foreground seed via inline
77
- relative color syntax. Each color is a self-contained transform:
78
- oklch(from <seed> <safe-L> <safe-C> calc(h + offset))
79
-
80
- Channel keywords l, c, h resolve inside the function scope.
81
- No extraction into intermediate custom properties needed.
82
- Safety: clamp(0.65, l, 0.70) for bright vibrant tones, max(0.12, c) for saturation.
83
- Achromatic seeds (h = none) → none treated as 0 in calc() per spec.
84
- =================================================================== */
108
+ /**
109
+ * @component Light Palette
110
+ * @category Foundation
111
+ * @description Full 10-hue chromatic spectrum generated from light foreground seed via inline relative color syntax.
112
+ *
113
+ * @property --color-light-red Error / Red (+25° hue offset).
114
+ * @property --color-light-orange Attention / Orange (+55° hue offset).
115
+ * @property --color-light-yellow Warning / Yellow (+85° hue offset).
116
+ * @property --color-light-green Success / Green (+145° hue offset).
117
+ * @property --color-light-cyan Info / Cyan (+190° hue offset).
118
+ * @property --color-light-blue Link / Blue (+240° hue offset).
119
+ * @property --color-light-magenta Magic / Magenta (+300° hue offset).
120
+ * @property --color-light-purple Purple (+270° hue offset).
121
+ * @property --color-light-pink Pink (+350° hue offset).
122
+ * @property --color-light-brown Brown (+60° hue offset).
123
+ * @property --color-light-accent-complementary Complementary accent (+180°).
124
+ * @property --color-light-accent-analogous Analogous accent (+30°).
125
+ * @property --color-light-accent-triadic Triadic accent (+120°).
126
+ * @property --color-light-accent-auto Default accent strategy (triadic).
127
+ * @property --color-light-accent Active light mode accent color.
128
+ */
85
129
 
86
130
  /* Error / Red — foreground hue + 25° */
87
131
  --color-light-red: oklch(
@@ -162,14 +206,27 @@
162
206
  --color-light-accent-auto: var(--color-light-accent-triadic);
163
207
  --color-light-accent: var(--color-light-accent-auto);
164
208
 
165
- /* ===================================================================
166
- STAGE 2B: DARK PALETTE
167
- Full spectrum generated from dark foreground seed.
168
- NOT a simple lightening of the light palette — independent vibe.
169
- A warm dark-foreground seed gives warm darks. A cool one gives
170
- cool darks. Two different seeds, two different moods.
171
- Safety: clamp(0.55, l, 0.70) for softer tones on dark surfaces.
172
- =================================================================== */
209
+ /**
210
+ * @component Dark Palette
211
+ * @category Foundation
212
+ * @description Full 10-hue chromatic spectrum generated from dark foreground seed for comfortable dark surfaces.
213
+ *
214
+ * @property --color-dark-red Dark mode red (+25° hue offset).
215
+ * @property --color-dark-orange Dark mode orange (+55° hue offset).
216
+ * @property --color-dark-yellow Dark mode yellow (+85° hue offset).
217
+ * @property --color-dark-green Dark mode green (+145° hue offset).
218
+ * @property --color-dark-cyan Dark mode cyan (+190° hue offset).
219
+ * @property --color-dark-blue Dark mode blue (+240° hue offset).
220
+ * @property --color-dark-magenta Dark mode magenta (+300° hue offset).
221
+ * @property --color-dark-purple Dark mode purple (+270° hue offset).
222
+ * @property --color-dark-pink Dark mode pink (+350° hue offset).
223
+ * @property --color-dark-brown Dark mode brown (+60° hue offset).
224
+ * @property --color-dark-accent-complementary Dark complementary accent (+180°).
225
+ * @property --color-dark-accent-analogous Dark analogous accent (+30°).
226
+ * @property --color-dark-accent-triadic Dark triadic accent (+120°).
227
+ * @property --color-dark-accent-auto Default dark accent strategy.
228
+ * @property --color-dark-accent Active dark mode accent color.
229
+ */
173
230
 
174
231
  /* Error / Red — dark foreground hue + 25° */
175
232
  --color-dark-red: oklch(
@@ -246,10 +303,25 @@
246
303
  /* On-accent (text drawn on accent surfaces) */
247
304
  --color-dark-on-accent: var(--color-dark-background);
248
305
 
249
- /* ===================================================================
250
- STAGE 2C: COMPUTED PALETTES
251
- Always available for explicit "light-in-dark" or "dark-in-light" UI.
252
- =================================================================== */
306
+ /**
307
+ * @component Computed Palettes
308
+ * @category Foundation
309
+ * @description Computed scheme-specific tints for muted text, subtle UI elements, borders, and shadows.
310
+ *
311
+ * @property --color-light-muted Light muted text color (~60% opacity).
312
+ * @property --color-light-subtle Light subtle text color (~40% opacity).
313
+ * @property --color-light-border Light border color (~10% opacity).
314
+ * @property --color-light-surface Light surface background (3% foreground mixed with background).
315
+ * @property --color-light-on-accent Text color drawn on light accent backgrounds.
316
+ * @property --color-dark-muted Dark muted text color (~65% opacity).
317
+ * @property --color-dark-subtle Dark subtle text color (~45% opacity).
318
+ * @property --color-dark-border Dark border color.
319
+ * @property --color-dark-surface Dark surface background.
320
+ * @property --color-light-shadow-base Base shadow seed for light mode.
321
+ * @property --color-light-highlight Base specular highlight for light mode.
322
+ * @property --color-dark-shadow-base Base shadow seed for dark mode.
323
+ * @property --color-dark-highlight Base specular highlight for dark mode.
324
+ */
253
325
 
254
326
  /* Light Computed Palette */
255
327
  --color-light-muted: oklch(from var(--color-light-foreground) l c h / 0.6);
@@ -293,12 +365,32 @@
293
365
  from var(--color-dark-foreground) min(1, calc(l + 0.05)) c h / 0.11
294
366
  );
295
367
 
296
- /* ===================================================================
297
- STAGE 3: SEMANTIC TOKENS (Default → Light Palette)
298
- These are the tokens components actually consume.
299
- Never reference --color-light-* or --color-dark-* in components.
300
- Always use --color-red, --color-background, etc.
301
- =================================================================== */
368
+ /**
369
+ * @component Semantic Tokens
370
+ * @category Foundation
371
+ * @description Semantic color tokens consumed across all components and styles.
372
+ *
373
+ * @property --color-background Active scheme root background.
374
+ * @property --color-foreground Active scheme text foreground.
375
+ * @property --color-accent Active scheme primary accent color.
376
+ * @property --color-header Heading text color.
377
+ * @property --color-red Semantic red hue.
378
+ * @property --color-orange Semantic orange hue.
379
+ * @property --color-yellow Semantic yellow hue.
380
+ * @property --color-green Semantic green hue.
381
+ * @property --color-cyan Semantic cyan hue.
382
+ * @property --color-blue Semantic blue hue.
383
+ * @property --color-magenta Semantic magenta hue.
384
+ * @property --color-purple Semantic purple hue.
385
+ * @property --color-pink Semantic pink hue.
386
+ * @property --color-brown Semantic brown hue.
387
+ * @property --color-success Status color for success states (`--color-green`).
388
+ * @property --color-warning Status color for warnings (`--color-orange`).
389
+ * @property --color-error Status color for errors (`--color-red`).
390
+ * @property --color-info Status color for informative notices (`--color-blue`).
391
+ * @property --color-link Active scheme link color.
392
+ * @property --color-on-accent Text color for elements over accent backgrounds.
393
+ */
302
394
  --color-background: var(--color-light-background);
303
395
  --color-foreground: var(--color-light-foreground);
304
396
  --color-accent: var(--color-light-accent);
@@ -327,11 +419,24 @@
327
419
  --color-bold: var(--color-light-bold, var(--color-foreground));
328
420
  --color-on-accent: var(--color-background);
329
421
 
330
- /* ===================================================================
331
- STAGE 4: COMPUTED SEMANTIC COLORS
332
- Derived from the scheme-aware --color-foreground/--color-background.
333
- auto-adapt when the scheme switches.
334
- =================================================================== */
422
+ /* Fixed 2026-07-14 — purple/pink/brown now correctly switch to dark
423
+ variants in all three dark-mode contexts, plus added missing
424
+ non-OKLCH fallbacks. */
425
+
426
+ /**
427
+ * @component Computed Semantics
428
+ * @category Foundation
429
+ * @description Scheme-aware computed colors derived from active foreground and background seeds.
430
+ *
431
+ * @property --color-muted Secondary text color (~60% alpha).
432
+ * @property --color-subtle Tertiary text and decorative icon color (~40% alpha).
433
+ * @property --color-border Standard structural border color (~10% alpha).
434
+ * @property --color-surface Elevated surface and card background.
435
+ * @property --color-light Polarity alias resolving to lighter color of active scheme.
436
+ * @property --color-dark Polarity alias resolving to darker color of active scheme.
437
+ * @property --color-darker Dark overlay tint.
438
+ * @property --color-glass Frosted glassmorphism background color (~80% alpha).
439
+ */
335
440
  --color-muted: var(--color-light-muted);
336
441
  --color-subtle: var(--color-light-subtle);
337
442
  --color-border: var(--color-light-border);
@@ -344,42 +449,25 @@
344
449
 
345
450
  --color-glass: oklch(from var(--color-background) l c h / 0.8);
346
451
 
347
- /* ===================================================================
348
- STAGE 5: SHADOWS & SURFACES
349
- OKLCH-based for perceptually uniform elevation.
350
- All derived from semantic pointers — auto-adapt to dark mode.
351
- =================================================================== */
452
+ /**
453
+ * @component Surfaces & Elevation Colors
454
+ * @category Foundation
455
+ * @description Semantic elevation color seeds and surface hierarchy using perceptual OKLCH color spaces.
456
+ *
457
+ * @property --color-shadow Active base shadow color.
458
+ * @property --color-highlight Active specular highlight color.
459
+ * @property --color-surface-lowest Deepest recessed surface step.
460
+ * @property --color-surface-lower Sub-surface step mixed with transparency.
461
+ * @property --color-surface-low Low elevation surface step.
462
+ * @property --color-surface Base surface color.
463
+ * @property --color-surface-high Elevated surface step.
464
+ * @property --color-surface-highest Highest surface elevation step.
465
+ */
352
466
 
353
467
  /* Semantic Shadow Seeds */
354
468
  --color-shadow: var(--color-light-shadow-base);
355
469
  --color-highlight: var(--color-light-highlight);
356
470
 
357
- /* Shadow building blocks — compose freely */
358
- --shadow-ambient: 0 1px 1px var(--color-shadow); /* Felt more than seen */
359
-
360
- /* This one pop a bit */
361
- --shadow-lift:
362
- 0 4px 6px -1px var(--color-shadow), 0 2px 4px -2px var(--color-shadow);
363
- /* Organicaly grows */
364
- --shadow-glow: 0 4px var(--space) oklch(from var(--color-shadow) l c h / 0.15);
365
- --shadow-inset:
366
- inset 0 1px 3px var(--color-shadow), inset 0 -1px 0 0 var(--color-highlight);
367
- --shadow-ring:
368
- inset 0px 1px 1px var(--color-border),
369
- inset 1px 0px 1px var(--color-border),
370
- inset -1px 0px 1px var(--color-border),
371
- inset 0px -1px 1px var(--color-border);
372
-
373
- /* shadcn-style raised effect: inner highlight + border + shadow */
374
- --shadow-raised:
375
- inset 0 1px 0 0 var(--color-highlight), 0 0 0 1px var(--color-border),
376
- var(--shadow-ambient);
377
-
378
- /* Composed presets */
379
- --shadow: var(--shadow-ambient), var(--shadow-ambient);
380
- --shadow-lg: var(--shadow-ambient), var(--shadow-lift);
381
- --shadow-xl: var(--shadow-ambient), var(--shadow-lift), var(--shadow-glow);
382
-
383
471
  /* Surface elevation scale */
384
472
  --color-surface-low: color-mix(
385
473
  in srgb,
@@ -404,14 +492,23 @@
404
492
  var(--color-surface-high)
405
493
  );
406
494
  --color-surface-higher: color-mix(in srgb, white 50%, transparent);
407
- /* ===================================================================
408
- STAGE 6: DESIGN TOKENS (Border Shorthands)
409
- =================================================================== */
410
- --border: 0 solid transparent;
495
+ /**
496
+ * @component Border Shorthands
497
+ * @category Foundation
498
+ * @description Pre-composed border shorthand tokens for clean layout boundaries.
499
+ *
500
+ * @property --border Standard border shorthand (`var(--stroke-width) solid var(--color-border)`).
501
+ * @property --border-accent Tinted accent border shorthand (`var(--stroke-width) solid oklch(...)`).
502
+ * @property --border-transparent Transparent layout placeholder border.
503
+ */
411
504
  --border-transparent: var(--stroke-width) solid transparent;
412
505
  --border-accent: var(--stroke-width) solid
413
506
  oklch(from var(--color-accent) l c h / 0.07);
414
- --border: none;
507
+ /* Regressed to `0 solid transparent` at some point, then a prior audit
508
+ correctly flagged it as dead code but "fixed" it to `none` instead of
509
+ restoring the real value. Git history confirms the intended value —
510
+ unchanged across many commits before the regression — was this. */
511
+ --border: var(--stroke-width) solid var(--color-border);
415
512
  }
416
513
 
417
514
  /* =====================================================================
@@ -443,6 +540,9 @@
443
540
  --color-cyan: var(--color-dark-cyan);
444
541
  --color-blue: var(--color-dark-blue);
445
542
  --color-magenta: var(--color-dark-magenta);
543
+ --color-purple: var(--color-dark-purple);
544
+ --color-pink: var(--color-dark-pink);
545
+ --color-brown: var(--color-dark-brown);
446
546
 
447
547
  --color-link: var(--color-dark-link);
448
548
  --color-italic: var(--color-dark-italic, var(--color-foreground));
@@ -487,10 +587,19 @@
487
587
  }
488
588
  }
489
589
 
490
- /* =====================================================================
491
- STAGE 7B: THEME UTILITIES (.inverse, .theme-dark, .theme-light)
492
- Provides explicit control and local context switching.
493
- ===================================================================== */
590
+ /**
591
+ * @component Theme Classes & Mixins
592
+ * @category Foundation
593
+ * @description Utilities and classes for forcing color modes and contextual inversion on subtrees.
594
+ *
595
+ * @property .theme-light Forces light color scheme and tokens on the applied container.
596
+ * @property .theme-dark Forces dark color scheme and tokens on the applied container.
597
+ * @property .inverse Contextually inverts color scheme relative to current background mode.
598
+ * @property [data-theme] Scoped theme attribute allowing local theme switching on cards or panels.
599
+ * @property [data-color-mode] Attribute setting explicit `"light"` or `"dark"` mode.
600
+ * @property @mixin theme-light-tokens Mixin stamping active light palette tokens into a selector.
601
+ * @property @mixin theme-dark-tokens Mixin stamping active dark palette tokens into a selector.
602
+ */
494
603
 
495
604
  @mixin theme-light-tokens {
496
605
  --color-background: var(--color-light-background);
@@ -570,6 +679,9 @@
570
679
  --color-cyan: var(--color-dark-cyan);
571
680
  --color-blue: var(--color-dark-blue);
572
681
  --color-magenta: var(--color-dark-magenta);
682
+ --color-purple: var(--color-dark-purple);
683
+ --color-pink: var(--color-dark-pink);
684
+ --color-brown: var(--color-dark-brown);
573
685
  --color-link: var(--color-dark-link);
574
686
  --color-italic: var(--color-dark-italic, var(--color-foreground));
575
687
  --color-bold: var(--color-dark-bold, var(--color-foreground));
@@ -588,6 +700,9 @@
588
700
  --color-cyan: var(--color-dark-cyan);
589
701
  --color-blue: var(--color-dark-blue);
590
702
  --color-magenta: var(--color-dark-magenta);
703
+ --color-purple: var(--color-dark-purple);
704
+ --color-pink: var(--color-dark-pink);
705
+ --color-brown: var(--color-dark-brown);
591
706
  --color-link: var(--color-dark-link);
592
707
  --color-italic: var(--color-dark-italic, var(--color-foreground));
593
708
  --color-bold: var(--color-dark-bold, var(--color-foreground));
@@ -614,6 +729,9 @@
614
729
  STAGE 8: FALLBACKS — Graceful Degradation
615
730
  Browsers without OKLCH support (Safari <16.4, Chrome <111, FF <113)
616
731
  get concrete color values so the UI remains usable.
732
+
733
+ Fixed 2026-07-14 — added missing light/dark purple & pink fallbacks
734
+ below.
617
735
  ===================================================================== */
618
736
  @supports not (color: oklch(50% 0.2 180)) {
619
737
  #{$stnd-theme-scope} {
@@ -629,6 +747,8 @@
629
747
  --color-light-cyan: #2a8a8a;
630
748
  --color-light-blue: #3a60b0;
631
749
  --color-light-magenta: #9040a0;
750
+ --color-light-purple: #8050b0;
751
+ --color-light-pink: #c05090;
632
752
  --color-light-accent: #2a8a8a;
633
753
 
634
754
  /* Dark palette fallbacks */
@@ -639,6 +759,8 @@
639
759
  --color-dark-cyan: #50b0b0;
640
760
  --color-dark-blue: #6080d0;
641
761
  --color-dark-magenta: #b060c0;
762
+ --color-dark-purple: #a070d0;
763
+ --color-dark-pink: #d070a0;
642
764
  --color-dark-accent: #50b0b0;
643
765
 
644
766
  /* Computed fallbacks */