@zazz-ui/core 0.1.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 (260) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +21 -0
  3. package/README.md +61 -0
  4. package/dist/sri.json +75 -0
  5. package/dist/zazz.css +1 -0
  6. package/dist/zazz.js +1 -0
  7. package/examples/about.html +590 -0
  8. package/examples/components.html +1040 -0
  9. package/examples/forms.html +511 -0
  10. package/examples/index.html +268 -0
  11. package/examples/layout.html +320 -0
  12. package/examples/products.html +846 -0
  13. package/examples/responsive.html +339 -0
  14. package/package.json +85 -0
  15. package/src/base/_layers.css +12 -0
  16. package/src/base/_layout.css +568 -0
  17. package/src/base/_reset.css +515 -0
  18. package/src/base/_typography.css +495 -0
  19. package/src/base/_utilities.css +6628 -0
  20. package/src/base/_variables.css +682 -0
  21. package/src/base/_view-transitions.css +103 -0
  22. package/src/base/command-score.d.ts +12 -0
  23. package/src/base/command-score.d.ts.map +1 -0
  24. package/src/base/command-score.js +151 -0
  25. package/src/base/command-score.ts +192 -0
  26. package/src/base/dialog-lifecycle.d.ts +11 -0
  27. package/src/base/dialog-lifecycle.d.ts.map +1 -0
  28. package/src/base/dialog-lifecycle.js +65 -0
  29. package/src/base/dialog-lifecycle.ts +80 -0
  30. package/src/base/embla.d.ts +90 -0
  31. package/src/base/embla.d.ts.map +1 -0
  32. package/src/base/embla.js +643 -0
  33. package/src/base/embla.ts +791 -0
  34. package/src/base/hotkeys.d.ts +82 -0
  35. package/src/base/hotkeys.d.ts.map +1 -0
  36. package/src/base/hotkeys.js +141 -0
  37. package/src/base/hotkeys.ts +195 -0
  38. package/src/base/navigation.d.ts +2 -0
  39. package/src/base/navigation.d.ts.map +1 -0
  40. package/src/base/navigation.js +136 -0
  41. package/src/base/navigation.ts +151 -0
  42. package/src/base/reveal.d.ts +80 -0
  43. package/src/base/reveal.d.ts.map +1 -0
  44. package/src/base/reveal.js +305 -0
  45. package/src/base/reveal.ts +379 -0
  46. package/src/base/signals.d.ts +89 -0
  47. package/src/base/signals.d.ts.map +1 -0
  48. package/src/base/signals.js +134 -0
  49. package/src/base/signals.ts +164 -0
  50. package/src/base/typeahead.d.ts +105 -0
  51. package/src/base/typeahead.d.ts.map +1 -0
  52. package/src/base/typeahead.js +411 -0
  53. package/src/base/typeahead.ts +500 -0
  54. package/src/base/utils.d.ts +56 -0
  55. package/src/base/utils.d.ts.map +1 -0
  56. package/src/base/utils.js +88 -0
  57. package/src/base/utils.ts +98 -0
  58. package/src/base/zazz-element.d.ts +44 -0
  59. package/src/base/zazz-element.d.ts.map +1 -0
  60. package/src/base/zazz-element.js +59 -0
  61. package/src/base/zazz-element.ts +73 -0
  62. package/src/globals.d.ts +148 -0
  63. package/src/head.d.ts +95 -0
  64. package/src/head.d.ts.map +1 -0
  65. package/src/head.js +311 -0
  66. package/src/head.ts +433 -0
  67. package/src/index.css +71 -0
  68. package/src/index.d.ts +36 -0
  69. package/src/index.d.ts.map +1 -0
  70. package/src/index.js +35 -0
  71. package/src/index.ts +36 -0
  72. package/src/manifest.d.ts +90 -0
  73. package/src/manifest.d.ts.map +1 -0
  74. package/src/manifest.js +614 -0
  75. package/src/manifest.ts +667 -0
  76. package/src/primitives/accordion/accordion.css +104 -0
  77. package/src/primitives/accordion/accordion.html +69 -0
  78. package/src/primitives/alert-dialog/alert-dialog.css +38 -0
  79. package/src/primitives/alert-dialog/alert-dialog.html +53 -0
  80. package/src/primitives/autocomplete/autocomplete-groups.html +77 -0
  81. package/src/primitives/autocomplete/autocomplete.css +114 -0
  82. package/src/primitives/autocomplete/autocomplete.d.ts +30 -0
  83. package/src/primitives/autocomplete/autocomplete.d.ts.map +1 -0
  84. package/src/primitives/autocomplete/autocomplete.html +66 -0
  85. package/src/primitives/autocomplete/autocomplete.js +41 -0
  86. package/src/primitives/autocomplete/autocomplete.ts +46 -0
  87. package/src/primitives/avatar/avatar.html +44 -0
  88. package/src/primitives/badge/badge-icon.html +36 -0
  89. package/src/primitives/badge/badge.css +251 -0
  90. package/src/primitives/badge/badge.html +7 -0
  91. package/src/primitives/breadcrumbs/breadcrumbs.html +9 -0
  92. package/src/primitives/button/button-icon-only.html +84 -0
  93. package/src/primitives/button/button-icon.html +82 -0
  94. package/src/primitives/button/button.css +319 -0
  95. package/src/primitives/button/button.html +8 -0
  96. package/src/primitives/button-group/button-group-vertical.html +6 -0
  97. package/src/primitives/button-group/button-group.css +94 -0
  98. package/src/primitives/button-group/button-group.html +64 -0
  99. package/src/primitives/card/card-subgrid.html +118 -0
  100. package/src/primitives/card/card.html +53 -0
  101. package/src/primitives/carousel/carousel.css +61 -0
  102. package/src/primitives/carousel/carousel.d.ts +16 -0
  103. package/src/primitives/carousel/carousel.d.ts.map +1 -0
  104. package/src/primitives/carousel/carousel.html +315 -0
  105. package/src/primitives/carousel/carousel.js +73 -0
  106. package/src/primitives/carousel/carousel.ts +84 -0
  107. package/src/primitives/checkbox/checkbox-tasklist.html +71 -0
  108. package/src/primitives/checkbox/checkbox.css +82 -0
  109. package/src/primitives/checkbox/checkbox.d.ts +21 -0
  110. package/src/primitives/checkbox/checkbox.d.ts.map +1 -0
  111. package/src/primitives/checkbox/checkbox.html +17 -0
  112. package/src/primitives/checkbox/checkbox.js +190 -0
  113. package/src/primitives/checkbox/checkbox.ts +219 -0
  114. package/src/primitives/combobox/combobox-multiselect.html +91 -0
  115. package/src/primitives/combobox/combobox.css +307 -0
  116. package/src/primitives/combobox/combobox.d.ts +100 -0
  117. package/src/primitives/combobox/combobox.d.ts.map +1 -0
  118. package/src/primitives/combobox/combobox.html +73 -0
  119. package/src/primitives/combobox/combobox.js +503 -0
  120. package/src/primitives/combobox/combobox.ts +559 -0
  121. package/src/primitives/command/command-actions.d.ts +31 -0
  122. package/src/primitives/command/command-actions.d.ts.map +1 -0
  123. package/src/primitives/command/command-actions.html +89 -0
  124. package/src/primitives/command/command-actions.js +70 -0
  125. package/src/primitives/command/command-actions.ts +77 -0
  126. package/src/primitives/command/command-dialog.html +77 -0
  127. package/src/primitives/command/command.css +151 -0
  128. package/src/primitives/command/command.d.ts +52 -0
  129. package/src/primitives/command/command.d.ts.map +1 -0
  130. package/src/primitives/command/command.html +119 -0
  131. package/src/primitives/command/command.js +146 -0
  132. package/src/primitives/command/command.ts +157 -0
  133. package/src/primitives/dialog/dialog-with-form.html +200 -0
  134. package/src/primitives/dialog/dialog.css +229 -0
  135. package/src/primitives/dialog/dialog.html +90 -0
  136. package/src/primitives/fields/fields.css +278 -0
  137. package/src/primitives/input/input-icon-leading.html +19 -0
  138. package/src/primitives/input/input-icon-trailing.html +18 -0
  139. package/src/primitives/input/input.css +114 -0
  140. package/src/primitives/input/input.html +61 -0
  141. package/src/primitives/input-group/input-group-password-group.html +108 -0
  142. package/src/primitives/input-group/input-group.css +215 -0
  143. package/src/primitives/input-group/input-group.html +132 -0
  144. package/src/primitives/kbd/kbd-group.html +18 -0
  145. package/src/primitives/kbd/kbd.css +87 -0
  146. package/src/primitives/kbd/kbd.html +7 -0
  147. package/src/primitives/lightbox/lightbox.css +459 -0
  148. package/src/primitives/lightbox/lightbox.d.ts +7 -0
  149. package/src/primitives/lightbox/lightbox.d.ts.map +1 -0
  150. package/src/primitives/lightbox/lightbox.html +665 -0
  151. package/src/primitives/lightbox/lightbox.js +96 -0
  152. package/src/primitives/lightbox/lightbox.ts +113 -0
  153. package/src/primitives/menu/menu-interest.html +52 -0
  154. package/src/primitives/menu/menu.css +55 -0
  155. package/src/primitives/menu/menu.d.ts +38 -0
  156. package/src/primitives/menu/menu.d.ts.map +1 -0
  157. package/src/primitives/menu/menu.html +70 -0
  158. package/src/primitives/menu/menu.js +117 -0
  159. package/src/primitives/menu/menu.ts +131 -0
  160. package/src/primitives/menubar/menubar-help-search.html +103 -0
  161. package/src/primitives/menubar/menubar.html +166 -0
  162. package/src/primitives/meter/meter.css +178 -0
  163. package/src/primitives/meter/meter.html +38 -0
  164. package/src/primitives/mobile-menu/mobile-menu.css +145 -0
  165. package/src/primitives/mobile-menu/mobile-menu.html +614 -0
  166. package/src/primitives/navigation-menu/navigation-menu-featured.html +76 -0
  167. package/src/primitives/navigation-menu/navigation-menu-icon-grid.html +158 -0
  168. package/src/primitives/navigation-menu/navigation-menu-interest.html +103 -0
  169. package/src/primitives/navigation-menu/navigation-menu-megamenu.html +141 -0
  170. package/src/primitives/navigation-menu/navigation-menu-simple.html +96 -0
  171. package/src/primitives/navigation-menu/navigation-menu.css +295 -0
  172. package/src/primitives/navigation-menu/navigation-menu.html +576 -0
  173. package/src/primitives/otp/otp.css +126 -0
  174. package/src/primitives/otp/otp.d.ts +89 -0
  175. package/src/primitives/otp/otp.d.ts.map +1 -0
  176. package/src/primitives/otp/otp.html +22 -0
  177. package/src/primitives/otp/otp.js +226 -0
  178. package/src/primitives/otp/otp.ts +279 -0
  179. package/src/primitives/password-group/password-group.css +238 -0
  180. package/src/primitives/password-group/password-group.d.ts +25 -0
  181. package/src/primitives/password-group/password-group.d.ts.map +1 -0
  182. package/src/primitives/password-group/password-group.html +109 -0
  183. package/src/primitives/password-group/password-group.js +76 -0
  184. package/src/primitives/password-group/password-group.ts +95 -0
  185. package/src/primitives/popover/popover.css +233 -0
  186. package/src/primitives/progress/progress-indeterminate.html +1 -0
  187. package/src/primitives/progress/progress.css +105 -0
  188. package/src/primitives/progress/progress.html +7 -0
  189. package/src/primitives/prose/prose.html +65 -0
  190. package/src/primitives/radio/radio.css +84 -0
  191. package/src/primitives/radio/radio.html +17 -0
  192. package/src/primitives/reveal/reveal.css +167 -0
  193. package/src/primitives/select/multiselect.d.ts +43 -0
  194. package/src/primitives/select/multiselect.d.ts.map +1 -0
  195. package/src/primitives/select/multiselect.js +147 -0
  196. package/src/primitives/select/multiselect.ts +188 -0
  197. package/src/primitives/select/select-align.html +49 -0
  198. package/src/primitives/select/select-multiple.html +12 -0
  199. package/src/primitives/select/select-sides.html +65 -0
  200. package/src/primitives/select/select.css +481 -0
  201. package/src/primitives/select/select.html +16 -0
  202. package/src/primitives/separator/separator.css +49 -0
  203. package/src/primitives/separator/separator.html +16 -0
  204. package/src/primitives/slider/slider.css +122 -0
  205. package/src/primitives/slider/slider.html +1 -0
  206. package/src/primitives/switch/switch.css +126 -0
  207. package/src/primitives/switch/switch.html +13 -0
  208. package/src/primitives/table/table-alternating.html +36 -0
  209. package/src/primitives/table/table-grid.html +30 -0
  210. package/src/primitives/table/table-size-sm.html +26 -0
  211. package/src/primitives/table/table.css +158 -0
  212. package/src/primitives/table/table.html +45 -0
  213. package/src/primitives/tabs/tabs.css +328 -0
  214. package/src/primitives/tabs/tabs.d.ts +35 -0
  215. package/src/primitives/tabs/tabs.d.ts.map +1 -0
  216. package/src/primitives/tabs/tabs.html +75 -0
  217. package/src/primitives/tabs/tabs.js +84 -0
  218. package/src/primitives/tabs/tabs.ts +93 -0
  219. package/src/primitives/textarea/textarea.css +78 -0
  220. package/src/primitives/textarea/textarea.html +10 -0
  221. package/src/primitives/toaster/toaster.css +309 -0
  222. package/src/primitives/toaster/toaster.d.ts +138 -0
  223. package/src/primitives/toaster/toaster.d.ts.map +1 -0
  224. package/src/primitives/toaster/toaster.html +77 -0
  225. package/src/primitives/toaster/toaster.js +736 -0
  226. package/src/primitives/toaster/toaster.ts +823 -0
  227. package/src/primitives/toggle/toggle.css +295 -0
  228. package/src/primitives/toggle/toggle.html +68 -0
  229. package/src/primitives/toggle-group/toggle-group-multiple.html +14 -0
  230. package/src/primitives/toggle-group/toggle-group-vertical.html +14 -0
  231. package/src/primitives/toggle-group/toggle-group.css +73 -0
  232. package/src/primitives/toggle-group/toggle-group.html +53 -0
  233. package/src/primitives/toolbar/toolbar.html +45 -0
  234. package/src/primitives/tooltip/tooltip-disabled.html +19 -0
  235. package/src/primitives/tooltip/tooltip-sides.html +57 -0
  236. package/src/primitives/tooltip/tooltip-with-kbd.html +31 -0
  237. package/src/primitives/tooltip/tooltip.css +235 -0
  238. package/src/primitives/tooltip/tooltip.html +12 -0
  239. package/src/primitives/utilities/aspect-ratio.html +17 -0
  240. package/src/primitives/utilities/basis.html +27 -0
  241. package/src/primitives/utilities/col-span.html +23 -0
  242. package/src/primitives/utilities/compose.html +19 -0
  243. package/src/primitives/utilities/flex-align.html +26 -0
  244. package/src/primitives/utilities/flex-direction.html +36 -0
  245. package/src/primitives/utilities/flex-grow.html +17 -0
  246. package/src/primitives/utilities/gap.html +62 -0
  247. package/src/primitives/utilities/grid-cols.html +20 -0
  248. package/src/primitives/utilities/grid-pile.html +5 -0
  249. package/src/primitives/utilities/grid-responsive.html +31 -0
  250. package/src/primitives/utilities/margin-auto.html +13 -0
  251. package/src/primitives/utilities/object-fit.html +41 -0
  252. package/src/primitives/utilities/order.html +17 -0
  253. package/src/primitives/utilities/overflow.html +26 -0
  254. package/src/primitives/utilities/padding-compose.html +23 -0
  255. package/src/primitives/utilities/padding.html +30 -0
  256. package/src/primitives/utilities/position.html +13 -0
  257. package/src/primitives/utilities/responsive-flex.html +22 -0
  258. package/src/primitives/utilities/responsive-grid.html +31 -0
  259. package/src/primitives/utilities/size.html +22 -0
  260. package/src/primitives/utilities/width.html +22 -0
@@ -0,0 +1,667 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * @fileoverview The kit's distribution manifest: machine-readable facts about
5
+ * every primitive — its files, its dependencies on other primitives and base
6
+ * scripts, its bare npm imports, and its example fragments.
7
+ * @description This is the single data source for anything that assembles a
8
+ * subset of the kit: the `zazz-ui` CLI (`add` resolves the dependency closure
9
+ * from `PRIMITIVES`), the docs site (install blocks and previews), and the
10
+ * head builder's granular CDN mode. Presentation metadata for the docs
11
+ * previews (iframe heights, placement) is docs-site state and lives in the
12
+ * docs app (`apps/docs/lib/preview-manifest.ts`), not in the published kit.
13
+ *
14
+ * Paths are tarball-relative to the package `src/` root. Script fields list
15
+ * the emitted `.js` files (the published, browser-runnable form); consumers
16
+ * that want `.ts` sources or `.d.ts` types swap the extension. `manifest.test.ts`
17
+ * guards this file against drift: every primitive directory must have an
18
+ * entry, every listed file must exist, and every bare specifier must be
19
+ * pinned in `head.ts`'s import map.
20
+ */
21
+
22
+ // --- Manifest version ---
23
+
24
+ /**
25
+ * Compatibility version of this manifest's shape. Consumers (the CLI) declare
26
+ * the range they understand and fail gracefully on a newer value. Bumping it
27
+ * is by definition a breaking kit change (ADR-0010).
28
+ */
29
+ export const MANIFEST_VERSION = 1;
30
+
31
+ // --- Primitive entries ---
32
+
33
+ /** One primitive's distribution facts. All paths are `src/`-relative. */
34
+ export interface PrimitiveEntry {
35
+ /** Stylesheets owned by the primitive (usually one; empty = markup-only). */
36
+ css: string[];
37
+ /** Scripts owned by the primitive, in load order. */
38
+ js: string[];
39
+ /**
40
+ * Non-core `base/` scripts its behavior needs, in load order. The core
41
+ * runtime (`utils`, `signals`, `zazz-element`, `dialog-lifecycle`) is
42
+ * assumed present (vendored by `init`, bundled in `dist/zazz.js`) and is
43
+ * never listed here.
44
+ */
45
+ base: string[];
46
+ /** Other primitives whose css/markup contract this primitive requires. */
47
+ primitives: string[];
48
+ /**
49
+ * Bare npm specifiers reachable from this primitive's script chain (its own
50
+ * `js` plus `base` plus the core runtime they import). Every value must have
51
+ * an import-map pin in `head.ts`; a page loading this primitive's scripts
52
+ * granularly needs these mapped.
53
+ */
54
+ bare: string[];
55
+ /** Example fragments (`--examples`, docs previews). */
56
+ examples: string[];
57
+ }
58
+
59
+ /** Bare specifiers pulled in by `base/signals.ts` (core runtime). */
60
+ const SIGNALS_BARE = ["signal-polyfill"];
61
+
62
+ /** Bare specifiers pulled in by `base/embla.ts`. */
63
+ const EMBLA_BARE = [
64
+ "embla-carousel",
65
+ "embla-carousel-autoplay",
66
+ "embla-carousel-auto-scroll",
67
+ "embla-carousel-class-names",
68
+ ];
69
+
70
+ /** The typeahead engine stack shared by autocomplete, combobox, and command. */
71
+ const TYPEAHEAD_BASE = ["base/command-score.js", "base/hotkeys.js", "base/typeahead.js"];
72
+
73
+ /**
74
+ * Every primitive in the kit, keyed by directory name under `src/primitives/`.
75
+ * `primitives` dependencies mirror each stylesheet's `@requires` header (the
76
+ * authoritative record of cross-primitive contracts); markup-only primitives
77
+ * list the primitives their canonical example composes.
78
+ */
79
+ export const PRIMITIVES: Record<string, PrimitiveEntry> = {
80
+ accordion: {
81
+ css: ["primitives/accordion/accordion.css"],
82
+ js: [],
83
+ base: [],
84
+ primitives: [],
85
+ bare: [],
86
+ examples: ["primitives/accordion/accordion.html"],
87
+ },
88
+ "alert-dialog": {
89
+ css: ["primitives/alert-dialog/alert-dialog.css"],
90
+ js: [],
91
+ base: [],
92
+ primitives: ["dialog"],
93
+ bare: [],
94
+ examples: ["primitives/alert-dialog/alert-dialog.html"],
95
+ },
96
+ autocomplete: {
97
+ css: ["primitives/autocomplete/autocomplete.css"],
98
+ js: ["primitives/autocomplete/autocomplete.js"],
99
+ base: TYPEAHEAD_BASE,
100
+ primitives: ["popover", "button", "fields", "select", "input"],
101
+ bare: SIGNALS_BARE,
102
+ examples: [
103
+ "primitives/autocomplete/autocomplete.html",
104
+ "primitives/autocomplete/autocomplete-groups.html",
105
+ ],
106
+ },
107
+ avatar: {
108
+ css: [],
109
+ js: [],
110
+ base: [],
111
+ primitives: [],
112
+ bare: [],
113
+ examples: ["primitives/avatar/avatar.html"],
114
+ },
115
+ badge: {
116
+ css: ["primitives/badge/badge.css"],
117
+ js: [],
118
+ base: [],
119
+ primitives: [],
120
+ bare: [],
121
+ examples: ["primitives/badge/badge.html", "primitives/badge/badge-icon.html"],
122
+ },
123
+ breadcrumbs: {
124
+ css: [],
125
+ js: [],
126
+ base: [],
127
+ primitives: ["button"],
128
+ bare: [],
129
+ examples: ["primitives/breadcrumbs/breadcrumbs.html"],
130
+ },
131
+ button: {
132
+ css: ["primitives/button/button.css"],
133
+ js: [],
134
+ base: [],
135
+ primitives: ["kbd"],
136
+ bare: [],
137
+ examples: [
138
+ "primitives/button/button.html",
139
+ "primitives/button/button-icon.html",
140
+ "primitives/button/button-icon-only.html",
141
+ ],
142
+ },
143
+ "button-group": {
144
+ css: ["primitives/button-group/button-group.css"],
145
+ js: [],
146
+ base: [],
147
+ primitives: ["button"],
148
+ bare: [],
149
+ examples: [
150
+ "primitives/button-group/button-group.html",
151
+ "primitives/button-group/button-group-vertical.html",
152
+ ],
153
+ },
154
+ card: {
155
+ css: [],
156
+ js: [],
157
+ base: [],
158
+ primitives: [],
159
+ bare: [],
160
+ examples: ["primitives/card/card.html", "primitives/card/card-subgrid.html"],
161
+ },
162
+ carousel: {
163
+ css: ["primitives/carousel/carousel.css"],
164
+ js: ["primitives/carousel/carousel.js"],
165
+ base: ["base/embla.js"],
166
+ primitives: [],
167
+ bare: EMBLA_BARE,
168
+ examples: ["primitives/carousel/carousel.html"],
169
+ },
170
+ checkbox: {
171
+ css: ["primitives/checkbox/checkbox.css"],
172
+ js: ["primitives/checkbox/checkbox.js"],
173
+ base: [],
174
+ primitives: [],
175
+ bare: SIGNALS_BARE,
176
+ examples: ["primitives/checkbox/checkbox.html", "primitives/checkbox/checkbox-tasklist.html"],
177
+ },
178
+ combobox: {
179
+ css: ["primitives/combobox/combobox.css"],
180
+ js: ["primitives/combobox/combobox.js"],
181
+ base: TYPEAHEAD_BASE,
182
+ primitives: ["popover", "button", "fields", "badge", "select"],
183
+ bare: SIGNALS_BARE,
184
+ examples: [
185
+ "primitives/combobox/combobox.html",
186
+ "primitives/combobox/combobox-multiselect.html",
187
+ ],
188
+ },
189
+ command: {
190
+ css: ["primitives/command/command.css"],
191
+ js: ["primitives/command/command.js", "primitives/command/command-actions.js"],
192
+ base: TYPEAHEAD_BASE,
193
+ primitives: ["popover", "button", "fields", "dialog", "menu", "select", "kbd"],
194
+ bare: SIGNALS_BARE,
195
+ examples: [
196
+ "primitives/command/command.html",
197
+ "primitives/command/command-dialog.html",
198
+ "primitives/command/command-actions.html",
199
+ ],
200
+ },
201
+ dialog: {
202
+ css: ["primitives/dialog/dialog.css"],
203
+ js: [],
204
+ base: [],
205
+ primitives: [],
206
+ bare: [],
207
+ examples: ["primitives/dialog/dialog.html", "primitives/dialog/dialog-with-form.html"],
208
+ },
209
+ fields: {
210
+ css: ["primitives/fields/fields.css"],
211
+ js: [],
212
+ base: [],
213
+ primitives: [],
214
+ bare: [],
215
+ examples: [],
216
+ },
217
+ input: {
218
+ css: ["primitives/input/input.css"],
219
+ js: [],
220
+ base: [],
221
+ primitives: ["fields"],
222
+ bare: [],
223
+ examples: [
224
+ "primitives/input/input.html",
225
+ "primitives/input/input-icon-leading.html",
226
+ "primitives/input/input-icon-trailing.html",
227
+ ],
228
+ },
229
+ "input-group": {
230
+ css: ["primitives/input-group/input-group.css"],
231
+ js: [],
232
+ base: [],
233
+ primitives: ["fields", "input", "textarea", "button"],
234
+ bare: [],
235
+ examples: [
236
+ "primitives/input-group/input-group.html",
237
+ "primitives/input-group/input-group-password-group.html",
238
+ ],
239
+ },
240
+ kbd: {
241
+ css: ["primitives/kbd/kbd.css"],
242
+ js: [],
243
+ base: [],
244
+ primitives: [],
245
+ bare: [],
246
+ examples: ["primitives/kbd/kbd.html", "primitives/kbd/kbd-group.html"],
247
+ },
248
+ lightbox: {
249
+ css: ["primitives/lightbox/lightbox.css"],
250
+ js: ["primitives/lightbox/lightbox.js"],
251
+ base: ["base/embla.js"],
252
+ primitives: ["dialog", "carousel", "button"],
253
+ bare: EMBLA_BARE,
254
+ examples: ["primitives/lightbox/lightbox.html"],
255
+ },
256
+ menu: {
257
+ css: ["primitives/menu/menu.css"],
258
+ js: ["primitives/menu/menu.js"],
259
+ base: [],
260
+ primitives: ["popover", "button"],
261
+ bare: [],
262
+ examples: ["primitives/menu/menu.html", "primitives/menu/menu-interest.html"],
263
+ },
264
+ menubar: {
265
+ css: [],
266
+ js: [],
267
+ base: [],
268
+ primitives: ["menu", "button", "separator"],
269
+ bare: [],
270
+ examples: ["primitives/menubar/menubar.html", "primitives/menubar/menubar-help-search.html"],
271
+ },
272
+ meter: {
273
+ css: ["primitives/meter/meter.css"],
274
+ js: [],
275
+ base: [],
276
+ primitives: ["progress"],
277
+ bare: [],
278
+ examples: ["primitives/meter/meter.html"],
279
+ },
280
+ "mobile-menu": {
281
+ css: ["primitives/mobile-menu/mobile-menu.css"],
282
+ js: [],
283
+ base: [],
284
+ primitives: ["dialog", "accordion"],
285
+ bare: [],
286
+ examples: ["primitives/mobile-menu/mobile-menu.html"],
287
+ },
288
+ "navigation-menu": {
289
+ css: ["primitives/navigation-menu/navigation-menu.css"],
290
+ js: [],
291
+ base: [],
292
+ primitives: ["popover", "button"],
293
+ bare: [],
294
+ examples: [
295
+ "primitives/navigation-menu/navigation-menu.html",
296
+ "primitives/navigation-menu/navigation-menu-simple.html",
297
+ "primitives/navigation-menu/navigation-menu-interest.html",
298
+ "primitives/navigation-menu/navigation-menu-featured.html",
299
+ "primitives/navigation-menu/navigation-menu-icon-grid.html",
300
+ "primitives/navigation-menu/navigation-menu-megamenu.html",
301
+ ],
302
+ },
303
+ otp: {
304
+ css: ["primitives/otp/otp.css"],
305
+ js: ["primitives/otp/otp.js"],
306
+ base: [],
307
+ primitives: ["fields", "input"],
308
+ bare: SIGNALS_BARE,
309
+ examples: ["primitives/otp/otp.html"],
310
+ },
311
+ "password-group": {
312
+ css: ["primitives/password-group/password-group.css"],
313
+ js: ["primitives/password-group/password-group.js"],
314
+ base: [],
315
+ primitives: ["fields", "input", "button"],
316
+ bare: SIGNALS_BARE,
317
+ examples: ["primitives/password-group/password-group.html"],
318
+ },
319
+ popover: {
320
+ css: ["primitives/popover/popover.css"],
321
+ js: [],
322
+ base: [],
323
+ primitives: [],
324
+ bare: [],
325
+ examples: [],
326
+ },
327
+ progress: {
328
+ css: ["primitives/progress/progress.css"],
329
+ js: [],
330
+ base: [],
331
+ primitives: [],
332
+ bare: [],
333
+ examples: [
334
+ "primitives/progress/progress.html",
335
+ "primitives/progress/progress-indeterminate.html",
336
+ ],
337
+ },
338
+ prose: {
339
+ css: [],
340
+ js: [],
341
+ base: [],
342
+ primitives: [],
343
+ bare: [],
344
+ examples: ["primitives/prose/prose.html"],
345
+ },
346
+ radio: {
347
+ css: ["primitives/radio/radio.css"],
348
+ js: [],
349
+ base: [],
350
+ primitives: ["fields"],
351
+ bare: [],
352
+ examples: ["primitives/radio/radio.html"],
353
+ },
354
+ reveal: {
355
+ css: ["primitives/reveal/reveal.css"],
356
+ js: [],
357
+ base: ["base/reveal.js"],
358
+ primitives: [],
359
+ bare: [],
360
+ examples: [],
361
+ },
362
+ select: {
363
+ css: ["primitives/select/select.css"],
364
+ js: ["primitives/select/multiselect.js"],
365
+ base: [],
366
+ primitives: ["fields", "popover", "button"],
367
+ bare: SIGNALS_BARE,
368
+ examples: [
369
+ "primitives/select/select.html",
370
+ "primitives/select/select-align.html",
371
+ "primitives/select/select-sides.html",
372
+ "primitives/select/select-multiple.html",
373
+ ],
374
+ },
375
+ separator: {
376
+ css: ["primitives/separator/separator.css"],
377
+ js: [],
378
+ base: [],
379
+ primitives: [],
380
+ bare: [],
381
+ examples: ["primitives/separator/separator.html"],
382
+ },
383
+ slider: {
384
+ css: ["primitives/slider/slider.css"],
385
+ js: [],
386
+ base: [],
387
+ primitives: [],
388
+ bare: [],
389
+ examples: ["primitives/slider/slider.html"],
390
+ },
391
+ switch: {
392
+ css: ["primitives/switch/switch.css"],
393
+ js: [],
394
+ base: [],
395
+ primitives: [],
396
+ bare: [],
397
+ examples: ["primitives/switch/switch.html"],
398
+ },
399
+ table: {
400
+ css: ["primitives/table/table.css"],
401
+ js: [],
402
+ base: [],
403
+ primitives: [],
404
+ bare: [],
405
+ examples: [
406
+ "primitives/table/table.html",
407
+ "primitives/table/table-grid.html",
408
+ "primitives/table/table-alternating.html",
409
+ "primitives/table/table-size-sm.html",
410
+ ],
411
+ },
412
+ tabs: {
413
+ css: ["primitives/tabs/tabs.css"],
414
+ js: ["primitives/tabs/tabs.js"],
415
+ base: [],
416
+ primitives: [],
417
+ bare: [],
418
+ examples: ["primitives/tabs/tabs.html"],
419
+ },
420
+ textarea: {
421
+ css: ["primitives/textarea/textarea.css"],
422
+ js: [],
423
+ base: [],
424
+ primitives: ["fields"],
425
+ bare: [],
426
+ examples: ["primitives/textarea/textarea.html"],
427
+ },
428
+ toaster: {
429
+ css: ["primitives/toaster/toaster.css"],
430
+ js: ["primitives/toaster/toaster.js"],
431
+ base: [],
432
+ primitives: ["popover", "button"],
433
+ bare: SIGNALS_BARE,
434
+ examples: ["primitives/toaster/toaster.html"],
435
+ },
436
+ toggle: {
437
+ css: ["primitives/toggle/toggle.css"],
438
+ js: [],
439
+ base: [],
440
+ primitives: ["button"],
441
+ bare: [],
442
+ examples: ["primitives/toggle/toggle.html"],
443
+ },
444
+ "toggle-group": {
445
+ css: ["primitives/toggle-group/toggle-group.css"],
446
+ js: [],
447
+ base: [],
448
+ primitives: ["toggle"],
449
+ bare: [],
450
+ examples: [
451
+ "primitives/toggle-group/toggle-group.html",
452
+ "primitives/toggle-group/toggle-group-multiple.html",
453
+ "primitives/toggle-group/toggle-group-vertical.html",
454
+ ],
455
+ },
456
+ toolbar: {
457
+ css: [],
458
+ js: [],
459
+ base: [],
460
+ primitives: [
461
+ "button",
462
+ "button-group",
463
+ "input",
464
+ "select",
465
+ "separator",
466
+ "toggle",
467
+ "toggle-group",
468
+ ],
469
+ bare: [],
470
+ examples: ["primitives/toolbar/toolbar.html"],
471
+ },
472
+ tooltip: {
473
+ css: ["primitives/tooltip/tooltip.css"],
474
+ js: [],
475
+ base: [],
476
+ primitives: ["popover", "kbd"],
477
+ bare: [],
478
+ examples: [
479
+ "primitives/tooltip/tooltip.html",
480
+ "primitives/tooltip/tooltip-with-kbd.html",
481
+ "primitives/tooltip/tooltip-sides.html",
482
+ "primitives/tooltip/tooltip-disabled.html",
483
+ ],
484
+ },
485
+ utilities: {
486
+ css: [],
487
+ js: [],
488
+ base: [],
489
+ primitives: [],
490
+ bare: [],
491
+ examples: [
492
+ "primitives/utilities/aspect-ratio.html",
493
+ "primitives/utilities/basis.html",
494
+ "primitives/utilities/col-span.html",
495
+ "primitives/utilities/compose.html",
496
+ "primitives/utilities/flex-align.html",
497
+ "primitives/utilities/flex-direction.html",
498
+ "primitives/utilities/flex-grow.html",
499
+ "primitives/utilities/gap.html",
500
+ "primitives/utilities/grid-cols.html",
501
+ "primitives/utilities/grid-pile.html",
502
+ "primitives/utilities/grid-responsive.html",
503
+ "primitives/utilities/margin-auto.html",
504
+ "primitives/utilities/object-fit.html",
505
+ "primitives/utilities/order.html",
506
+ "primitives/utilities/overflow.html",
507
+ "primitives/utilities/padding-compose.html",
508
+ "primitives/utilities/padding.html",
509
+ "primitives/utilities/position.html",
510
+ "primitives/utilities/responsive-flex.html",
511
+ "primitives/utilities/responsive-grid.html",
512
+ "primitives/utilities/size.html",
513
+ "primitives/utilities/width.html",
514
+ ],
515
+ },
516
+ };
517
+
518
+ // --- Canonical cascade order ---
519
+
520
+ /**
521
+ * Primitive names in the exact `@import` order of `src/index.css`. Anything
522
+ * assembling a stylesheet subset (the CLI's `add`, the granular CDN head)
523
+ * must emit primitive css in this order so component scopes cascade the way
524
+ * the kit was designed and tested. Markup-only primitives (no css) do not
525
+ * appear. `manifest.test.ts` asserts this list matches `index.css` exactly.
526
+ */
527
+ export const CSS_CASCADE_ORDER: string[] = [
528
+ "separator",
529
+ "badge",
530
+ "kbd",
531
+ "button",
532
+ "button-group",
533
+ "toggle",
534
+ "toggle-group",
535
+ "accordion",
536
+ "table",
537
+ "progress",
538
+ "meter",
539
+ "popover",
540
+ "tooltip",
541
+ "dialog",
542
+ "alert-dialog",
543
+ "menu",
544
+ "navigation-menu",
545
+ "mobile-menu",
546
+ "fields",
547
+ "input",
548
+ "textarea",
549
+ "select",
550
+ "autocomplete",
551
+ "combobox",
552
+ "command",
553
+ "checkbox",
554
+ "slider",
555
+ "switch",
556
+ "input-group",
557
+ "password-group",
558
+ "otp",
559
+ "radio",
560
+ "tabs",
561
+ "carousel",
562
+ "lightbox",
563
+ "toaster",
564
+ "reveal",
565
+ ];
566
+
567
+ // --- Dependency resolution ---
568
+
569
+ /**
570
+ * @description Resolves a set of primitive names to its full dependency
571
+ * closure — every primitive the requested ones require, transitively. This is
572
+ * the resolution the CLI's `add` and the granular CDN head share.
573
+ *
574
+ * @param names - Primitive names to resolve (keys of `PRIMITIVES`).
575
+ * @returns The closure in canonical cascade order (markup-only members, which
576
+ * have no cascade position, sort last in name order).
577
+ * @throws {Error} On an unknown primitive name.
578
+ * @example
579
+ * resolveClosure(["combobox"]);
580
+ * // ["kbd", "button", "popover", "fields", "input", "select", "badge", "combobox"]
581
+ */
582
+ export function resolveClosure(names: string[]): string[] {
583
+ const closure = new Set<string>();
584
+ const visit = (name: string): void => {
585
+ const entry = PRIMITIVES[name];
586
+ if (!entry) throw new Error(`unknown primitive "${name}"`);
587
+ if (closure.has(name)) return;
588
+ closure.add(name);
589
+ for (const dep of entry.primitives) visit(dep);
590
+ };
591
+ for (const name of names) visit(name);
592
+
593
+ const position = new Map(CSS_CASCADE_ORDER.map((name, index) => [name, index]));
594
+ return [...closure].sort((a, b) => {
595
+ const pa = position.get(a);
596
+ const pb = position.get(b);
597
+ if (pa !== undefined && pb !== undefined) return pa - pb;
598
+ if (pa !== undefined) return -1;
599
+ if (pb !== undefined) return 1;
600
+ return a.localeCompare(b);
601
+ });
602
+ }
603
+
604
+ // --- Web-component script map (docs previews) ---
605
+
606
+ export type ExampleScript =
607
+ | "autocomplete"
608
+ | "combobox"
609
+ | "command"
610
+ | "command-actions"
611
+ | "embla"
612
+ | "reveal"
613
+ | "carousel"
614
+ | "checkbox"
615
+ | "lightbox"
616
+ | "menu"
617
+ | "multiselect"
618
+ | "otp"
619
+ | "password"
620
+ | "tabs"
621
+ | "toaster";
622
+
623
+ /**
624
+ * Emitted script files (relative to the package `src/` root) that implement each
625
+ * web-component script id. This is the single mapping from script ids to files
626
+ * on disk: consumers (like the docs "JS" tab) resolve these against the
627
+ * package's `src/` directory. Entries list dependencies first (`lightbox` needs
628
+ * `carousel.js` loaded before `lightbox.js`). Script ids are example-level and
629
+ * finer-grained than `PRIMITIVES` (e.g. `command-actions`); every file listed
630
+ * here must also be reachable from a `PRIMITIVES` entry (`manifest.test.ts`).
631
+ */
632
+ export const WEB_COMPONENT_SCRIPT_FILES: Partial<Record<ExampleScript, string[]>> = {
633
+ autocomplete: [
634
+ "base/command-score.js",
635
+ "base/hotkeys.js",
636
+ "base/typeahead.js",
637
+ "primitives/autocomplete/autocomplete.js",
638
+ ],
639
+ combobox: [
640
+ "base/command-score.js",
641
+ "base/hotkeys.js",
642
+ "base/typeahead.js",
643
+ "primitives/combobox/combobox.js",
644
+ ],
645
+ command: [
646
+ "base/command-score.js",
647
+ "base/hotkeys.js",
648
+ "base/typeahead.js",
649
+ "primitives/command/command.js",
650
+ ],
651
+ "command-actions": [
652
+ "base/command-score.js",
653
+ "base/hotkeys.js",
654
+ "base/typeahead.js",
655
+ "primitives/command/command.js",
656
+ "primitives/command/command-actions.js",
657
+ ],
658
+ carousel: ["primitives/carousel/carousel.js"],
659
+ checkbox: ["primitives/checkbox/checkbox.js"],
660
+ lightbox: ["primitives/carousel/carousel.js", "primitives/lightbox/lightbox.js"],
661
+ menu: ["primitives/menu/menu.js"],
662
+ multiselect: ["primitives/select/multiselect.js"],
663
+ otp: ["primitives/otp/otp.js"],
664
+ password: ["primitives/password-group/password-group.js"],
665
+ tabs: ["primitives/tabs/tabs.js"],
666
+ toaster: ["primitives/toaster/toaster.js"],
667
+ };