@zazz-ui/core 0.1.0 → 0.3.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +167 -0
  2. package/README.md +53 -7
  3. package/dist/sri.json +40 -40
  4. package/dist/zazz.css +1 -1
  5. package/examples/components.html +1 -6
  6. package/package.json +1 -1
  7. package/src/base/_layers.css +14 -4
  8. package/src/base/_layout.css +5 -2
  9. package/src/base/_typography.css +24 -6
  10. package/src/base/_utilities.css +525 -395
  11. package/src/base/_variables.css +22 -81
  12. package/src/base/_view-transitions.css +1 -1
  13. package/src/base/embla.d.ts +1 -0
  14. package/src/base/embla.d.ts.map +1 -1
  15. package/src/base/embla.ts +3 -3
  16. package/src/base/utils.d.ts +1 -1
  17. package/src/base/utils.js +1 -1
  18. package/src/base/utils.ts +1 -1
  19. package/src/globals.d.ts +3 -3
  20. package/src/index.css +13 -5
  21. package/src/manifest.ts +6 -6
  22. package/src/primitives/accordion/accordion.css +2 -2
  23. package/src/primitives/alert-dialog/alert-dialog.css +2 -2
  24. package/src/primitives/badge/badge.css +30 -26
  25. package/src/primitives/button/button.css +44 -38
  26. package/src/primitives/carousel/carousel.css +2 -2
  27. package/src/primitives/carousel/carousel.d.ts +32 -0
  28. package/src/primitives/carousel/carousel.d.ts.map +1 -1
  29. package/src/primitives/carousel/carousel.html +1 -1
  30. package/src/primitives/carousel/carousel.js +0 -31
  31. package/src/primitives/carousel/carousel.ts +1 -0
  32. package/src/primitives/checkbox/checkbox.css +21 -12
  33. package/src/primitives/combobox/combobox.css +17 -15
  34. package/src/primitives/command/command.css +1 -1
  35. package/src/primitives/dialog/dialog.css +18 -20
  36. package/src/primitives/fields/fields.css +14 -10
  37. package/src/primitives/input/input.css +10 -8
  38. package/src/primitives/input-group/input-group.css +18 -18
  39. package/src/primitives/kbd/kbd.css +2 -2
  40. package/src/primitives/lightbox/lightbox.css +7 -13
  41. package/src/primitives/meter/meter.css +2 -2
  42. package/src/primitives/mobile-menu/mobile-menu.css +6 -6
  43. package/src/primitives/otp/otp.css +9 -6
  44. package/src/primitives/password-group/password-group.css +18 -18
  45. package/src/primitives/popover/popover.css +2 -2
  46. package/src/primitives/progress/progress.css +2 -2
  47. package/src/primitives/radio/radio.css +12 -8
  48. package/src/primitives/select/select.css +27 -20
  49. package/src/primitives/slider/slider.css +4 -4
  50. package/src/primitives/switch/switch.css +8 -8
  51. package/src/primitives/table/table.css +3 -3
  52. package/src/primitives/tabs/tabs.css +13 -9
  53. package/src/primitives/textarea/textarea.css +10 -7
  54. package/src/primitives/toaster/toaster.css +7 -7
  55. package/src/primitives/toggle/toggle.css +35 -32
  56. package/src/primitives/tooltip/tooltip-disabled.html +1 -6
  57. package/src/primitives/tooltip/tooltip-sides.html +3 -22
  58. package/src/primitives/tooltip/tooltip-with-kbd.html +1 -6
  59. package/src/primitives/tooltip/tooltip.css +6 -4
  60. package/src/primitives/tooltip/tooltip.html +1 -6
@@ -2,8 +2,9 @@
2
2
  * _variables.css — Global design tokens (Tier 1).
3
3
  *
4
4
  * @layer variables
5
- * @requires layers.css, _properties.css
6
- * @uses light-dark() — theme roles follow color-scheme / .dark overrides
5
+ * @requires layers.css
6
+ * @uses light-dark() — theme roles re-resolve per color-scheme (system,
7
+ * .dark/.light, [data-theme]); tokens stay unregistered on purpose
7
8
  * @uses oklch(from …) — shade/tint scales and shadow alphas
8
9
  * @uses color-mix() — focus ring (--ring)
9
10
  * @uses interpolate-size: allow-keywords — discrete block-size animations (details, etc.)
@@ -13,14 +14,6 @@
13
14
  * whole system; see CONVENTIONS.md.
14
15
  */
15
16
 
16
- /* Inverted menu */
17
-
18
- @property --use-inverted-popovers {
19
- syntax: "*";
20
- inherits: false;
21
- initial-value: false;
22
- }
23
-
24
17
  /* Animations */
25
18
 
26
19
  @property --default-transition-duration {
@@ -76,10 +69,11 @@
76
69
  initial-value: false;
77
70
  }
78
71
 
79
- /* Token values — @property registrations live in _properties.css (style() queries). */
72
+ /* Token values — the few typed @property registrations (style() queries) live above. */
80
73
  @layer variables {
81
74
  :root {
82
- /* Enable light/dark mode - make sure to redeclare dark mode tokens on .dark at the bottom of the file */
75
+ /* Enable light/dark mode — theme scopes at the bottom of the file pin
76
+ * color-scheme; light-dark() tokens re-resolve there automatically. */
83
77
  color-scheme: light dark;
84
78
 
85
79
  /* Enable discrete value animations, e.g. block-size: auto; */
@@ -98,11 +92,11 @@
98
92
  --card-foreground: light-dark(var(--neutral-900), var(--white));
99
93
  --popover: light-dark(var(--white), var(--neutral-950));
100
94
  --popover-foreground: light-dark(var(--neutral-900), var(--white));
101
- --input: light-dark(var(--neutral-50), var(--tint-50));
95
+ --input: light-dark(var(--neutral-50), var(--tint-100));
102
96
  --input-foreground: light-dark(var(--neutral-900), var(--white));
103
97
 
104
98
  /* overlay */
105
- --muted: light-dark(var(--shade-50), var(--tint-50));
99
+ --muted: light-dark(var(--shade-50), var(--tint-100));
106
100
  --muted-foreground: light-dark(var(--shade-600), var(--tint-600));
107
101
  --faded: light-dark(var(--tint-400), var(--shade-100));
108
102
  --faded-foreground: light-dark(var(--tint-600), var(--shade-600));
@@ -566,7 +560,7 @@
566
560
  * resolves it identically, no matter which container it reads from (the
567
561
  * .container element is intentionally container-type: normal).
568
562
  * Mobile-first: --is-breakpoint-X becomes true once width reaches X.
569
- * Registered as typed @property (false default) in _properties.css.
563
+ * Registered as typed @property (false default) at the top of this file.
570
564
  * Literal rem required — var() is invalid in a container-query prelude.
571
565
  * ========================================================================== */
572
566
  @container (width >=40rem) {
@@ -607,76 +601,23 @@
607
601
  }
608
602
 
609
603
  /*
610
- * Manual dark mode — re-declare dark theme tokens so light-dark() resolves
611
- * with color-scheme: dark. Tokens defined only on :root inherit as computed
612
- * light values; setting color-scheme on descendants alone does not flip them.
604
+ * Theme scopes — theme role tokens are intentionally unregistered, so their
605
+ * light-dark() expressions stay live in the token stream and re-resolve
606
+ * against each element's inherited color-scheme. Pinning color-scheme is all
607
+ * a scope needs; nesting works (.light inside .dark re-lightens its subtree).
608
+ * Built-in inherited color properties (color, accent-color, …) resolve at
609
+ * the ancestor, so re-assert them at each scope boundary.
613
610
  */
614
611
 
615
- @container style(--use-inverted-popovers: true) {
616
- :where([popover]:not([data-use-inverted-menu="false"])) {
617
- color-scheme: dark;
618
-
619
- --background: var(--neutral-900);
620
- --foreground: var(--white);
621
- --border: var(--tint-200);
622
- --border-foreground: var(--shade-500);
623
- --card: var(--neutral-950);
624
- --card-foreground: var(--white);
625
- --input: var(--tint-50);
626
- --input-foreground: var(--white);
627
- --popover: var(--shade-950);
628
- --popover-foreground: var(--white);
629
- --muted: var(--tint-50);
630
- --muted-foreground: var(--tint-600);
631
- --faded: var(--shade-100);
632
- --faded-foreground: var(--shade-600);
633
- --primary: var(--primary-500);
634
- --primary-foreground: var(--white);
635
- --secondary: var(--secondary-500);
636
- --secondary-foreground: var(--white);
637
- --tertiary: var(--tertiary-400);
638
- --tertiary-foreground: var(--white);
639
- --info: oklch(0.5 0.1193 242.75);
640
- --info-foreground: var(--white);
641
- --success: oklch(0.5081 0.1049 165.61);
642
- --success-foreground: var(--white);
643
- --warning: oklch(0.5553 0.1455 49);
644
- --warning-foreground: var(--white);
645
- --destructive: oklch(0.5054 0.1905 27.52);
646
- --destructive-foreground: var(--white);
647
- }
648
- }
649
-
612
+ [data-theme="dark"],
650
613
  .dark {
651
614
  color-scheme: dark;
615
+ color: var(--foreground);
616
+ }
652
617
 
653
- --background: var(--neutral-900);
654
- --foreground: var(--white);
655
- --border: var(--tint-200);
656
- --border-foreground: var(--shade-500);
657
- --card: var(--neutral-950);
658
- --card-foreground: var(--white);
659
- --input: var(--tint-50);
660
- --input-foreground: var(--white);
661
- --popover: var(--shade-950);
662
- --popover-foreground: var(--white);
663
- --muted: var(--tint-50);
664
- --muted-foreground: var(--tint-600);
665
- --faded: var(--shade-100);
666
- --faded-foreground: var(--shade-600);
667
- --primary: var(--primary-500);
668
- --primary-foreground: var(--white);
669
- --secondary: var(--secondary-500);
670
- --secondary-foreground: var(--white);
671
- --tertiary: var(--tertiary-400);
672
- --tertiary-foreground: var(--white);
673
- --info: oklch(0.5 0.1193 242.75);
674
- --info-foreground: var(--white);
675
- --success: oklch(0.5081 0.1049 165.61);
676
- --success-foreground: var(--white);
677
- --warning: oklch(0.5553 0.1455 49);
678
- --warning-foreground: var(--white);
679
- --destructive: oklch(0.5054 0.1905 27.52);
680
- --destructive-foreground: var(--white);
618
+ [data-theme="light"],
619
+ .light {
620
+ color-scheme: light;
621
+ color: var(--foreground);
681
622
  }
682
623
  }
@@ -79,7 +79,7 @@
79
79
 
80
80
  @keyframes global-view-transition--old {
81
81
  to {
82
- opacity: var(--view-transition-opacity--new);
82
+ opacity: var(--view-transition-opacity--old);
83
83
  transform: scale(var(--view-transition-scale--old))
84
84
  translate3d(var(--view-transition-translate--old));
85
85
  }
@@ -1,3 +1,4 @@
1
+ import type { EmblaCarouselType } from "embla-carousel";
1
2
  /**
2
3
  * @description Parses a space-separated `data-carousel-plugins` value into
3
4
  * plugin slug tokens. Empty / null / whitespace-only values yield `[]`.
@@ -1 +1 @@
1
- {"version":3,"file":"embla.d.ts","sourceRoot":"","sources":["embla.ts"],"names":[],"mappings":"AA2FA;;;;;;GAMG;AACH,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,EAAE,CAG5D;AAyCD;;;;;;;;;;;GAWG;AACH,iBAAS,cAAc,CACrB,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACtC,IAAI,CAWN;AAID;;;;;;;GAOG;AACH,QAAA,MAAM,0BAA0B,aACpB,iBAAiB,YACjB,OAAO,WACR,WAAW,KACnB,CAAC,MAAM,IAAI,CAAC,GAAG,SAqDjB,CAAC;AAIF;;;;;;GAMG;AACH,QAAA,MAAM,qBAAqB,iBACX,iBAAiB,iBAChB,iBAAiB,WACvB,WAAW,SAOrB,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,qBAAqB,iBACX,iBAAiB,iBAChB,iBAAiB,SAiBjC,CAAC;AAmJF;;;;;;;;;;;;GAYG;AACH,iBAAS,aAAa,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CA8H/C;AAED;;;;;;;;GAQG;AACH,iBAAS,kBAAkB,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,CAW5D;AAuGD;;;;;;;;;GASG;AACH,QAAA,MAAM,SAAS;;;;;;CAMd,CAAC;AA6EF,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"embla.d.ts","sourceRoot":"","sources":["embla.ts"],"names":[],"mappings":"AA8EA,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,gBAAgB,CAAC;AAa3F;;;;;;GAMG;AACH,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,EAAE,CAG5D;AAyCD;;;;;;;;;;;GAWG;AACH,iBAAS,cAAc,CACrB,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACtC,IAAI,CAWN;AAID;;;;;;;GAOG;AACH,QAAA,MAAM,0BAA0B,aACpB,iBAAiB,YACjB,OAAO,WACR,WAAW,KACnB,CAAC,MAAM,IAAI,CAAC,GAAG,SAqDjB,CAAC;AAIF;;;;;;GAMG;AACH,QAAA,MAAM,qBAAqB,iBACX,iBAAiB,iBAChB,iBAAiB,WACvB,WAAW,SAOrB,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,qBAAqB,iBACX,iBAAiB,iBAChB,iBAAiB,SAiBjC,CAAC;AAmJF;;;;;;;;;;;;GAYG;AACH,iBAAS,aAAa,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CA8H/C;AAED;;;;;;;;GAQG;AACH,iBAAS,kBAAkB,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,CAW5D;AAuGD;;;;;;;;;GASG;AACH,QAAA,MAAM,SAAS;;;;;;CAMd,CAAC;AA6EF,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,CAAC"}
package/src/base/embla.ts CHANGED
@@ -76,7 +76,7 @@ import { registerRefresh } from "./zazz-element.ts";
76
76
  // import map in browsers (pinned jsDelivr URLs; see `head.ts`) and through
77
77
  // node_modules in tests/bundlers. No more UMD globals, no tag-order contract.
78
78
  import EmblaCarousel from "embla-carousel";
79
- import type { EmblaOptionsType } from "embla-carousel";
79
+ import type { EmblaCarouselType, EmblaOptionsType, EmblaPluginType } from "embla-carousel";
80
80
  import EmblaCarouselAutoplay from "embla-carousel-autoplay";
81
81
  import type { AutoplayOptionsType } from "embla-carousel-autoplay";
82
82
  import EmblaCarouselAutoScroll from "embla-carousel-auto-scroll";
@@ -105,7 +105,7 @@ function parseCarouselPlugins(value: string | null): string[] {
105
105
  * Map of plugin slug → Embla factory. Slugs match Embla package names
106
106
  * (`embla-carousel-auto-scroll`, etc.).
107
107
  */
108
- const PLUGIN_BY_SLUG: Record<CarouselPluginSlug, (node: Element) => EmblaPlugin> = {
108
+ const PLUGIN_BY_SLUG: Record<CarouselPluginSlug, (node: Element) => EmblaPluginType> = {
109
109
  autoplay: (node) =>
110
110
  EmblaCarouselAutoplay(
111
111
  readCarouselOptions<AutoplayOptionsType>(node, "data-carousel-autoplay-"),
@@ -495,7 +495,7 @@ function initEmblaRoot(emblaNode: Element): void {
495
495
 
496
496
  // Plugins load only when listed in data-carousel-plugins; option attrs alone
497
497
  // do not enable them. Unknown slugs are ignored.
498
- const plugins: EmblaPlugin[] = [];
498
+ const plugins: EmblaPluginType[] = [];
499
499
  for (const slug of parseCarouselPlugins(emblaNode.getAttribute("data-carousel-plugins"))) {
500
500
  const create = PLUGIN_BY_SLUG[slug as CarouselPluginSlug];
501
501
  if (!create) continue;
@@ -4,7 +4,7 @@
4
4
  * typed JavaScript values.
5
5
  *
6
6
  * This is a **public, consumer-facing** surface (`window.Utils`, documented at
7
- * /docs/components/utils), not just kit plumbing: data-attribute configuration
7
+ * /docs/scripts/utils), not just kit plumbing: data-attribute configuration
8
8
  * is the kit's documented pattern for authoring a component
9
9
  * (CONVENTIONS.scripts.md), so anyone writing a component in the Zazz idiom
10
10
  * needs this exact parser to match kit behaviour. Keep it here rather than
package/src/base/utils.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * typed JavaScript values.
6
6
  *
7
7
  * This is a **public, consumer-facing** surface (`window.Utils`, documented at
8
- * /docs/components/utils), not just kit plumbing: data-attribute configuration
8
+ * /docs/scripts/utils), not just kit plumbing: data-attribute configuration
9
9
  * is the kit's documented pattern for authoring a component
10
10
  * (CONVENTIONS.scripts.md), so anyone writing a component in the Zazz idiom
11
11
  * needs this exact parser to match kit behaviour. Keep it here rather than
package/src/base/utils.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * typed JavaScript values.
7
7
  *
8
8
  * This is a **public, consumer-facing** surface (`window.Utils`, documented at
9
- * /docs/components/utils), not just kit plumbing: data-attribute configuration
9
+ * /docs/scripts/utils), not just kit plumbing: data-attribute configuration
10
10
  * is the kit's documented pattern for authoring a component
11
11
  * (CONVENTIONS.scripts.md), so anyone writing a component in the Zazz idiom
12
12
  * needs this exact parser to match kit behaviour. Keep it here rather than
package/src/globals.d.ts CHANGED
@@ -4,10 +4,10 @@
4
4
  * checkJs can validate files that reference them across module boundaries.
5
5
  */
6
6
 
7
- // Embla loads as real ES modules (see base/embla.ts imports); these aliases
8
- // keep the shared names other scripts reference pointing at the real types.
7
+ // Scripts import Embla types directly from "embla-carousel" (so emitted .d.ts
8
+ // files stay self-contained for consumers); this alias exists only for the
9
+ // ambient interface merges below, which cannot use top-level imports.
9
10
  type EmblaCarouselType = import("embla-carousel").EmblaCarouselType;
10
- type EmblaPlugin = import("embla-carousel").EmblaPluginType;
11
11
 
12
12
  interface UtilsNamespace {
13
13
  parseValue(value: string): boolean | number | unknown[] | string;
package/src/index.css CHANGED
@@ -21,11 +21,19 @@
21
21
  @import "./base/_typography.css";
22
22
  @import "./base/_view-transitions.css";
23
23
 
24
- /* Legacy layer — import legacy stylesheets here, into the legacy layer */
25
- /* @import "./your-legacy.css" layer(legacy); */
24
+ /* Vendors layer — third-party CSS that does not build on Zazz */
25
+ /* @import "./some-library.css" layer(vendors); */
26
+
27
+ /* Legacy layer — import whole legacy stylesheets into legacy.imports.
28
+ Never bare layer(legacy): un-sublayered rules would beat the migration
29
+ shims in legacy.migrations. */
30
+ /* @import "./your-legacy.css" layer(legacy.imports); */
26
31
 
27
32
  /* Zazz primitives - UI omponents. */
28
33
  @import "./primitives/separator/separator.css";
34
+ /* fields.css owns the shared --ui-field-* family; it registers before its
35
+ consumers (badge, button, toggle, tabs, checkbox, radio, inputs, …) */
36
+ @import "./primitives/fields/fields.css";
29
37
  @import "./primitives/badge/badge.css";
30
38
  @import "./primitives/kbd/kbd.css";
31
39
  @import "./primitives/button/button.css";
@@ -43,7 +51,6 @@
43
51
  @import "./primitives/menu/menu.css";
44
52
  @import "./primitives/navigation-menu/navigation-menu.css";
45
53
  @import "./primitives/mobile-menu/mobile-menu.css";
46
- @import "./primitives/fields/fields.css";
47
54
  @import "./primitives/input/input.css";
48
55
  @import "./primitives/textarea/textarea.css";
49
56
  @import "./primitives/select/select.css";
@@ -67,5 +74,6 @@
67
74
  @import "./base/_utilities.css";
68
75
  @import "./base/_layout.css";
69
76
 
70
- /* Migrations layer - for legacy css overrides */
71
- /* @import "./migrations.css"; */
77
+ /* Migration shims — translate legacy classes while markup is rewritten.
78
+ Beats all other legacy sublayers; Zazz still wins on migrated markup. */
79
+ /* @import "./migrations.css" layer(legacy.migrations); */
package/src/manifest.ts CHANGED
@@ -116,7 +116,7 @@ export const PRIMITIVES: Record<string, PrimitiveEntry> = {
116
116
  css: ["primitives/badge/badge.css"],
117
117
  js: [],
118
118
  base: [],
119
- primitives: [],
119
+ primitives: ["fields"],
120
120
  bare: [],
121
121
  examples: ["primitives/badge/badge.html", "primitives/badge/badge-icon.html"],
122
122
  },
@@ -132,7 +132,7 @@ export const PRIMITIVES: Record<string, PrimitiveEntry> = {
132
132
  css: ["primitives/button/button.css"],
133
133
  js: [],
134
134
  base: [],
135
- primitives: ["kbd"],
135
+ primitives: ["kbd", "fields"],
136
136
  bare: [],
137
137
  examples: [
138
138
  "primitives/button/button.html",
@@ -171,7 +171,7 @@ export const PRIMITIVES: Record<string, PrimitiveEntry> = {
171
171
  css: ["primitives/checkbox/checkbox.css"],
172
172
  js: ["primitives/checkbox/checkbox.js"],
173
173
  base: [],
174
- primitives: [],
174
+ primitives: ["fields"],
175
175
  bare: SIGNALS_BARE,
176
176
  examples: ["primitives/checkbox/checkbox.html", "primitives/checkbox/checkbox-tasklist.html"],
177
177
  },
@@ -413,7 +413,7 @@ export const PRIMITIVES: Record<string, PrimitiveEntry> = {
413
413
  css: ["primitives/tabs/tabs.css"],
414
414
  js: ["primitives/tabs/tabs.js"],
415
415
  base: [],
416
- primitives: [],
416
+ primitives: ["fields"],
417
417
  bare: [],
418
418
  examples: ["primitives/tabs/tabs.html"],
419
419
  },
@@ -526,6 +526,7 @@ export const PRIMITIVES: Record<string, PrimitiveEntry> = {
526
526
  */
527
527
  export const CSS_CASCADE_ORDER: string[] = [
528
528
  "separator",
529
+ "fields",
529
530
  "badge",
530
531
  "kbd",
531
532
  "button",
@@ -543,7 +544,6 @@ export const CSS_CASCADE_ORDER: string[] = [
543
544
  "menu",
544
545
  "navigation-menu",
545
546
  "mobile-menu",
546
- "fields",
547
547
  "input",
548
548
  "textarea",
549
549
  "select",
@@ -577,7 +577,7 @@ export const CSS_CASCADE_ORDER: string[] = [
577
577
  * @throws {Error} On an unknown primitive name.
578
578
  * @example
579
579
  * resolveClosure(["combobox"]);
580
- * // ["kbd", "button", "popover", "fields", "input", "select", "badge", "combobox"]
580
+ * // ["fields", "badge", "kbd", "button", "popover", "select", "combobox"]
581
581
  */
582
582
  export function resolveClosure(names: string[]): string[] {
583
583
  const closure = new Set<string>();
@@ -12,7 +12,7 @@
12
12
  @layer variables {
13
13
  :root {
14
14
  --ui-accordion-icon-size: var(--step-4);
15
- --ui-accordion-icon-transform-open: rotate(-180deg);
15
+ --ui-accordion-icon-transform--open: rotate(-180deg);
16
16
  }
17
17
  }
18
18
 
@@ -99,6 +99,6 @@
99
99
  }
100
100
 
101
101
  :where(ui-accordion, .ui-accordion) > details[open] > summary > svg {
102
- transform: var(--ui-accordion-icon-transform-open);
102
+ transform: var(--ui-accordion-icon-transform--open);
103
103
  }
104
104
  }
@@ -12,7 +12,7 @@
12
12
  @layer variables {
13
13
  :root {
14
14
  /* Narrower than the base dialog: an alert is a single question, not a form */
15
- --ui-alert-dialog-width: min(45ch, 100% - var(--gap-md) * 2);
15
+ --ui-alert-dialog-inline-size: min(45ch, 100% - var(--gap-md) * 2);
16
16
  --ui-alert-dialog-accent: var(--destructive);
17
17
  --ui-alert-dialog-shadow: var(--ui-dialog-shadow);
18
18
  }
@@ -28,7 +28,7 @@
28
28
  =========================================================================== */
29
29
 
30
30
  .ui-alert-dialog {
31
- --ui-dialog-width: var(--ui-alert-dialog-width);
31
+ --ui-dialog-inline-size: var(--ui-alert-dialog-inline-size);
32
32
  --ui-dialog-shadow: var(--ui-alert-dialog-shadow);
33
33
  }
34
34
 
@@ -2,7 +2,7 @@
2
2
  * badge.css: Badge (.ui-badge)
3
3
  *
4
4
  * @layer variables, components
5
- * @requires layers.css, _variables.css, _reset.css
5
+ * @requires layers.css, _variables.css, _reset.css, fields.css (--ui-field-* border/ring)
6
6
  * @uses color-mix(), oklch(from …): variant hover/active tints
7
7
  * @uses text-box: vertical trim (patchy browser support)
8
8
  * @tokens --ui-badge-* (@layer variables)
@@ -11,7 +11,10 @@
11
11
 
12
12
  @layer variables {
13
13
  :root {
14
- --ui-badge-ring-color: var(--ring-color);
14
+ /* Border + ring default to the shared --ui-field-* family (owned in fields.css)
15
+ so a badge sitting beside fields and buttons reads as one family; metrics stay
16
+ independent — a badge is deliberately a smaller scale. */
17
+ --ui-badge-ring-color: var(--ui-field-ring-color);
15
18
 
16
19
  --ui-badge-font-family: var(--font-family-body);
17
20
  --ui-badge-font-size: var(--font-size-xs);
@@ -26,13 +29,15 @@
26
29
  --ui-badge-foreground--hover: var(--foreground);
27
30
  --ui-badge-foreground--active: var(--foreground);
28
31
 
29
- --ui-badge-border: 1px solid var(--border);
30
- --ui-badge-border--hover: 1px solid var(--border);
31
- --ui-badge-border--active: 1px solid var(--border);
32
+ --ui-badge-border-width: var(--ui-field-border-width);
33
+ --ui-badge-border-style: var(--ui-field-border-style);
34
+ --ui-badge-border-color: var(--ui-field-border-color);
35
+ --ui-badge-border-color--hover: var(--ui-field-border-color);
36
+ --ui-badge-border-color--active: var(--ui-field-border-color);
32
37
 
33
38
  --ui-badge-gap: var(--step-1);
34
39
  --ui-badge-padding: var(--step-1_5);
35
- --ui-badge-height: var(--step-5_5);
40
+ --ui-badge-block-size: var(--step-5_5);
36
41
  --ui-badge-radius: var(--radius-sm);
37
42
 
38
43
  --ui-badge-icon-size: var(--step-3);
@@ -60,15 +65,16 @@
60
65
  gap: var(--ui-badge-gap);
61
66
  flex-shrink: 0;
62
67
 
63
- block-size: var(--ui-badge-height);
64
- min-width: max-content;
68
+ block-size: var(--ui-badge-block-size);
69
+ min-inline-size: max-content;
65
70
  padding-inline: var(--ui-badge-padding);
66
71
 
67
- border: var(--ui-badge-border);
72
+ border: var(--ui-badge-border-width) var(--ui-badge-border-style) var(--ui-badge-border-color);
68
73
  border-radius: var(--ui-badge-radius);
69
74
 
70
75
  color: var(--ui-badge-foreground);
71
76
  background-color: var(--ui-badge-background);
77
+ background-clip: padding-box;
72
78
 
73
79
  /* ring renders as box-shadow so it composes with --ui-badge-shadow; the
74
80
  ring widths animate from 0 so the ring grows in smoothly on focus */
@@ -106,14 +112,14 @@
106
112
  a[href].ui-badge:hover:not(:disabled, [aria-disabled="true"]) {
107
113
  color: var(--ui-badge-foreground--hover);
108
114
  background-color: var(--ui-badge-background--hover);
109
- border: var(--ui-badge-border--hover);
115
+ border-color: var(--ui-badge-border-color--hover);
110
116
  }
111
117
 
112
118
  button.ui-badge:active:not(:disabled, [aria-disabled="true"]),
113
119
  a[href].ui-badge:active:not(:disabled, [aria-disabled="true"]) {
114
120
  color: var(--ui-badge-foreground--active);
115
121
  background-color: var(--ui-badge-background--active);
116
- border: var(--ui-badge-border--active);
122
+ border-color: var(--ui-badge-border-color--active);
117
123
  }
118
124
 
119
125
  button.ui-badge:focus-visible:hover:not(:disabled, [aria-disabled="true"]),
@@ -167,9 +173,9 @@
167
173
  --ui-badge-foreground--hover: var(--primary-foreground);
168
174
  --ui-badge-foreground--active: var(--primary-foreground);
169
175
 
170
- --ui-badge-border: 1px solid transparent;
171
- --ui-badge-border--hover: 1px solid transparent;
172
- --ui-badge-border--active: 1px solid transparent;
176
+ --ui-badge-border-color: var(--ui-badge-background);
177
+ --ui-badge-border-color--hover: var(--ui-badge-background--hover);
178
+ --ui-badge-border-color--active: var(--ui-badge-background--active);
173
179
  }
174
180
 
175
181
  .ui-badge[data-variant="muted"] {
@@ -181,9 +187,9 @@
181
187
  --ui-badge-foreground--hover: var(--foreground);
182
188
  --ui-badge-foreground--active: var(--foreground);
183
189
 
184
- --ui-badge-border: 1px solid transparent;
185
- --ui-badge-border--hover: 1px solid transparent;
186
- --ui-badge-border--active: 1px solid transparent;
190
+ --ui-badge-border-color: var(--ui-badge-background);
191
+ --ui-badge-border-color--hover: var(--ui-badge-background--hover);
192
+ --ui-badge-border-color--active: var(--ui-badge-background--active);
187
193
  }
188
194
 
189
195
  .ui-badge[data-variant="ghost"] {
@@ -195,9 +201,9 @@
195
201
  --ui-badge-foreground--hover: var(--foreground);
196
202
  --ui-badge-foreground--active: var(--foreground);
197
203
 
198
- --ui-badge-border: 1px solid transparent;
199
- --ui-badge-border--hover: 1px solid transparent;
200
- --ui-badge-border--active: 1px solid transparent;
204
+ --ui-badge-border-color: var(--ui-badge-background);
205
+ --ui-badge-border-color--hover: var(--ui-badge-background--hover);
206
+ --ui-badge-border-color--active: var(--ui-badge-background--active);
201
207
  }
202
208
 
203
209
  .ui-badge[data-variant="link"] {
@@ -209,11 +215,9 @@
209
215
  --ui-badge-foreground--hover: var(--primary);
210
216
  --ui-badge-foreground--active: oklch(from var(--primary) l c h / 0.8);
211
217
 
212
- --ui-badge-border: none;
213
- --ui-badge-border--hover: none;
214
- --ui-badge-border--active: none;
218
+ --ui-badge-border-style: none;
215
219
 
216
- --ui-badge-height: fit-content;
220
+ --ui-badge-block-size: fit-content;
217
221
  --ui-badge-padding: 0;
218
222
  --ui-badge-radius: 0;
219
223
 
@@ -243,8 +247,8 @@
243
247
  =========================================================================== */
244
248
 
245
249
  .ui-badge[data-size="icon"] {
246
- block-size: var(--ui-badge-height);
247
- inline-size: var(--ui-badge-height);
250
+ block-size: var(--ui-badge-block-size);
251
+ inline-size: var(--ui-badge-block-size);
248
252
  padding: 0;
249
253
  aspect-ratio: 1 / 1;
250
254
  }