@zazz-ui/core 0.4.0 → 0.5.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 (331) hide show
  1. package/AUTHORING.md +158 -0
  2. package/CHANGELOG.md +341 -0
  3. package/README.md +55 -23
  4. package/dist/scroll-state-C8mA5gq6.js +1 -0
  5. package/dist/sri.json +124 -72
  6. package/dist/zazz.css +1 -1
  7. package/dist/zazz.js +1 -1
  8. package/editor/zazz.css-data.json +116794 -0
  9. package/editor/zazz.html-data.json +1683 -0
  10. package/editor/zazz.language-data.json +5001 -0
  11. package/editor/zazz.lint-data.json +152 -0
  12. package/package.json +12 -5
  13. package/src/base/_breakpoints.css +12 -0
  14. package/src/base/_layers.css +8 -9
  15. package/src/base/_properties-2xl.css +171 -0
  16. package/src/base/_properties-active.css +107 -0
  17. package/src/base/_properties-checked.css +107 -0
  18. package/src/base/_properties-current.css +107 -0
  19. package/src/base/_properties-disabled.css +107 -0
  20. package/src/base/_properties-focus-visible.css +107 -0
  21. package/src/base/_properties-focus-within.css +107 -0
  22. package/src/base/_properties-hover.css +107 -0
  23. package/src/base/_properties-lg.css +171 -0
  24. package/src/base/_properties-md.css +171 -0
  25. package/src/base/_properties-open.css +107 -0
  26. package/src/base/_properties-sm.css +171 -0
  27. package/src/base/_properties-starting.css +55 -0
  28. package/src/base/_properties-stuck.css +55 -0
  29. package/src/base/_properties-xl.css +171 -0
  30. package/src/base/_properties.css +555 -0
  31. package/src/base/_reset.css +67 -75
  32. package/src/base/_switches.css +145 -0
  33. package/src/base/_typography.css +437 -370
  34. package/src/base/_utilities-box.css +142 -0
  35. package/src/base/_utilities-color.css +290 -0
  36. package/src/base/_utilities-effects.css +235 -0
  37. package/src/base/_utilities-flow.css +312 -0
  38. package/src/base/_utilities-grid.css +143 -0
  39. package/src/base/_utilities-margin.css +376 -0
  40. package/src/base/_utilities-pseudo.css +426 -0
  41. package/src/base/_utilities-sizing.css +259 -0
  42. package/src/base/_utilities-spacing.css +190 -0
  43. package/src/base/_utilities-tier-2xl.css +93 -0
  44. package/src/base/_utilities-tier-active.css +61 -0
  45. package/src/base/_utilities-tier-checked.css +61 -0
  46. package/src/base/_utilities-tier-current.css +61 -0
  47. package/src/base/_utilities-tier-disabled.css +61 -0
  48. package/src/base/_utilities-tier-focus-visible.css +61 -0
  49. package/src/base/_utilities-tier-focus-within.css +61 -0
  50. package/src/base/_utilities-tier-hover.css +63 -0
  51. package/src/base/_utilities-tier-lg.css +93 -0
  52. package/src/base/_utilities-tier-md.css +93 -0
  53. package/src/base/_utilities-tier-open.css +61 -0
  54. package/src/base/_utilities-tier-sm.css +93 -0
  55. package/src/base/_utilities-tier-starting.css +35 -0
  56. package/src/base/_utilities-tier-stuck.css +114 -0
  57. package/src/base/_utilities-tier-xl.css +93 -0
  58. package/src/base/_utilities-typography.css +141 -0
  59. package/src/base/_variables.css +323 -372
  60. package/src/base/_view-transitions.css +10 -12
  61. package/src/base/command-score.d.ts.map +1 -1
  62. package/src/base/command-score.js +1 -2
  63. package/src/base/command-score.ts +1 -2
  64. package/src/base/dialog-lifecycle.js +1 -1
  65. package/src/base/dialog-lifecycle.ts +1 -1
  66. package/src/base/embla.d.ts +6 -7
  67. package/src/base/embla.d.ts.map +1 -1
  68. package/src/base/embla.js +89 -55
  69. package/src/base/embla.ts +89 -55
  70. package/src/base/hotkeys.d.ts +0 -5
  71. package/src/base/hotkeys.d.ts.map +1 -1
  72. package/src/base/hotkeys.ts +0 -5
  73. package/src/base/navigation.d.ts +12 -1
  74. package/src/base/navigation.d.ts.map +1 -1
  75. package/src/base/navigation.js +229 -86
  76. package/src/base/navigation.ts +224 -92
  77. package/src/base/reveal.js +14 -14
  78. package/src/base/reveal.ts +14 -14
  79. package/src/base/scroll-state.d.ts +21 -0
  80. package/src/base/scroll-state.d.ts.map +1 -0
  81. package/src/base/scroll-state.js +177 -0
  82. package/src/base/scroll-state.ts +188 -0
  83. package/src/base/signals.d.ts +1 -2
  84. package/src/base/signals.d.ts.map +1 -1
  85. package/src/base/signals.js +4 -6
  86. package/src/base/signals.ts +4 -6
  87. package/src/base/style-format.d.ts +33 -0
  88. package/src/base/style-format.d.ts.map +1 -0
  89. package/src/base/style-format.js +160 -0
  90. package/src/base/style-format.ts +180 -0
  91. package/src/base/typeahead.d.ts +19 -4
  92. package/src/base/typeahead.d.ts.map +1 -1
  93. package/src/base/typeahead.js +68 -21
  94. package/src/base/typeahead.ts +73 -23
  95. package/src/base/utilities.d.ts +188 -0
  96. package/src/base/utilities.d.ts.map +1 -0
  97. package/src/base/utilities.js +750 -0
  98. package/src/base/utilities.ts +865 -0
  99. package/src/base/utils.d.ts +3 -7
  100. package/src/base/utils.d.ts.map +1 -1
  101. package/src/base/utils.js +4 -8
  102. package/src/base/utils.ts +4 -8
  103. package/src/base/zazz-element.d.ts +14 -8
  104. package/src/base/zazz-element.d.ts.map +1 -1
  105. package/src/base/zazz-element.js +14 -8
  106. package/src/base/zazz-element.ts +15 -8
  107. package/src/globals.d.ts +1 -1
  108. package/src/head.d.ts +50 -4
  109. package/src/head.d.ts.map +1 -1
  110. package/src/head.js +119 -38
  111. package/src/head.ts +172 -41
  112. package/src/index.css +57 -14
  113. package/src/index.js +5 -0
  114. package/src/index.ts +6 -0
  115. package/src/manifest.d.ts +36 -5
  116. package/src/manifest.d.ts.map +1 -1
  117. package/src/manifest.js +150 -6
  118. package/src/manifest.ts +167 -9
  119. package/src/primitives/accordion/accordion.css +18 -17
  120. package/src/primitives/accordion/accordion.html +42 -9
  121. package/src/primitives/alert-dialog/alert-dialog.css +13 -13
  122. package/src/primitives/alert-dialog/alert-dialog.html +26 -12
  123. package/src/primitives/autocomplete/autocomplete-groups.html +64 -33
  124. package/src/primitives/autocomplete/autocomplete.css +45 -43
  125. package/src/primitives/autocomplete/autocomplete.d.ts +6 -5
  126. package/src/primitives/autocomplete/autocomplete.d.ts.map +1 -1
  127. package/src/primitives/autocomplete/autocomplete.html +38 -26
  128. package/src/primitives/autocomplete/autocomplete.js +6 -5
  129. package/src/primitives/autocomplete/autocomplete.ts +6 -5
  130. package/src/primitives/avatar/avatar.html +110 -15
  131. package/src/primitives/badge/badge-icon.html +22 -8
  132. package/src/primitives/badge/badge.css +401 -128
  133. package/src/primitives/badge/badge.html +12 -6
  134. package/src/primitives/breadcrumbs/breadcrumbs.html +25 -5
  135. package/src/primitives/button/button-icon-only.html +17 -11
  136. package/src/primitives/button/button-icon.html +9 -3
  137. package/src/primitives/button/button.css +408 -164
  138. package/src/primitives/button/button.html +14 -7
  139. package/src/primitives/button-group/button-group-vertical.html +5 -5
  140. package/src/primitives/button-group/button-group.css +53 -25
  141. package/src/primitives/button-group/button-group.html +18 -12
  142. package/src/primitives/callout/callout.css +114 -0
  143. package/src/primitives/callout/callout.html +188 -0
  144. package/src/primitives/card/card-subgrid.html +249 -34
  145. package/src/primitives/card/card.css +125 -0
  146. package/src/primitives/card/card.html +141 -20
  147. package/src/primitives/carousel/carousel.css +30 -20
  148. package/src/primitives/carousel/carousel.d.ts +7 -10
  149. package/src/primitives/carousel/carousel.d.ts.map +1 -1
  150. package/src/primitives/carousel/carousel.html +420 -84
  151. package/src/primitives/carousel/carousel.js +1 -1
  152. package/src/primitives/carousel/carousel.ts +8 -11
  153. package/src/primitives/checkbox/checkbox-tasklist.html +6 -6
  154. package/src/primitives/checkbox/checkbox.css +98 -40
  155. package/src/primitives/checkbox/checkbox.d.ts.map +1 -1
  156. package/src/primitives/checkbox/checkbox.html +13 -8
  157. package/src/primitives/checkbox/checkbox.js +7 -9
  158. package/src/primitives/checkbox/checkbox.ts +7 -15
  159. package/src/primitives/combobox/combobox-multiselect.html +53 -33
  160. package/src/primitives/combobox/combobox.css +147 -126
  161. package/src/primitives/combobox/combobox.d.ts +12 -11
  162. package/src/primitives/combobox/combobox.d.ts.map +1 -1
  163. package/src/primitives/combobox/combobox.html +48 -28
  164. package/src/primitives/combobox/combobox.js +46 -51
  165. package/src/primitives/combobox/combobox.ts +48 -55
  166. package/src/primitives/command/command-actions.d.ts +2 -3
  167. package/src/primitives/command/command-actions.d.ts.map +1 -1
  168. package/src/primitives/command/command-actions.html +48 -33
  169. package/src/primitives/command/command-actions.js +12 -10
  170. package/src/primitives/command/command-actions.ts +12 -13
  171. package/src/primitives/command/command-dialog.html +49 -25
  172. package/src/primitives/command/command.css +52 -42
  173. package/src/primitives/command/command.d.ts +10 -7
  174. package/src/primitives/command/command.d.ts.map +1 -1
  175. package/src/primitives/command/command.html +95 -46
  176. package/src/primitives/command/command.js +30 -13
  177. package/src/primitives/command/command.ts +30 -12
  178. package/src/primitives/debug/audit-core.d.ts +64 -0
  179. package/src/primitives/debug/audit-core.d.ts.map +1 -0
  180. package/src/primitives/debug/audit-core.js +356 -0
  181. package/src/primitives/debug/audit-core.ts +535 -0
  182. package/src/primitives/debug/debug.d.ts +50 -0
  183. package/src/primitives/debug/debug.d.ts.map +1 -0
  184. package/src/primitives/debug/debug.js +168 -0
  185. package/src/primitives/debug/debug.ts +211 -0
  186. package/src/primitives/dialog/dialog-with-form.html +67 -45
  187. package/src/primitives/dialog/dialog.css +87 -61
  188. package/src/primitives/dialog/dialog.html +25 -17
  189. package/src/primitives/fields/fields.css +108 -134
  190. package/src/primitives/fields/fields.html +39 -0
  191. package/src/primitives/input/input-icon-leading.html +3 -3
  192. package/src/primitives/input/input-icon-trailing.html +3 -3
  193. package/src/primitives/input/input.css +87 -49
  194. package/src/primitives/input/input.html +15 -15
  195. package/src/primitives/input-group/input-group-password-group.html +15 -15
  196. package/src/primitives/input-group/input-group.css +118 -75
  197. package/src/primitives/input-group/input-group.html +42 -30
  198. package/src/primitives/kbd/kbd-group.html +15 -2
  199. package/src/primitives/kbd/kbd.css +44 -31
  200. package/src/primitives/kbd/kbd.html +7 -1
  201. package/src/primitives/layout/layout.css +159 -0
  202. package/src/primitives/layout/layout.html +35 -0
  203. package/src/primitives/lightbox/lightbox.css +178 -105
  204. package/src/primitives/lightbox/lightbox.d.ts.map +1 -1
  205. package/src/primitives/lightbox/lightbox.html +138 -166
  206. package/src/primitives/lightbox/lightbox.js +10 -13
  207. package/src/primitives/lightbox/lightbox.ts +12 -13
  208. package/src/primitives/menu/menu-interest.html +60 -18
  209. package/src/primitives/menu/menu.css +22 -17
  210. package/src/primitives/menu/menu.d.ts +5 -5
  211. package/src/primitives/menu/menu.html +195 -40
  212. package/src/primitives/menu/menu.js +8 -8
  213. package/src/primitives/menu/menu.ts +8 -8
  214. package/src/primitives/menubar/menubar-help-search.html +78 -32
  215. package/src/primitives/menubar/menubar.html +166 -38
  216. package/src/primitives/meter/meter.css +41 -38
  217. package/src/primitives/meter/meter.html +44 -9
  218. package/src/primitives/mobile-menu/mobile-menu.css +47 -40
  219. package/src/primitives/mobile-menu/mobile-menu.html +1460 -179
  220. package/src/primitives/navigation-menu/navigation-menu-featured.html +155 -33
  221. package/src/primitives/navigation-menu/navigation-menu-icon-grid.html +222 -47
  222. package/src/primitives/navigation-menu/navigation-menu-interest.html +130 -38
  223. package/src/primitives/navigation-menu/navigation-menu-megamenu.html +402 -72
  224. package/src/primitives/navigation-menu/navigation-menu-simple.html +90 -40
  225. package/src/primitives/navigation-menu/navigation-menu.css +104 -106
  226. package/src/primitives/navigation-menu/navigation-menu.html +554 -158
  227. package/src/primitives/otp/otp.css +43 -44
  228. package/src/primitives/otp/otp.d.ts +4 -5
  229. package/src/primitives/otp/otp.d.ts.map +1 -1
  230. package/src/primitives/otp/otp.html +7 -6
  231. package/src/primitives/otp/otp.js +13 -18
  232. package/src/primitives/otp/otp.ts +12 -19
  233. package/src/primitives/password-group/password-group.css +132 -107
  234. package/src/primitives/password-group/password-group.d.ts.map +1 -1
  235. package/src/primitives/password-group/password-group.html +23 -16
  236. package/src/primitives/password-group/password-group.js +11 -12
  237. package/src/primitives/password-group/password-group.ts +11 -12
  238. package/src/primitives/popover/popover.css +89 -95
  239. package/src/primitives/popover/popover.html +18 -0
  240. package/src/primitives/progress/progress-indeterminate.html +1 -1
  241. package/src/primitives/progress/progress.css +34 -35
  242. package/src/primitives/progress/progress.html +18 -4
  243. package/src/primitives/prose/prose.html +19 -12
  244. package/src/primitives/radio/radio.css +83 -46
  245. package/src/primitives/radio/radio.html +16 -11
  246. package/src/primitives/reveal/reveal.css +37 -46
  247. package/src/primitives/reveal/reveal.html +15 -0
  248. package/src/primitives/scroll-fade/scroll-fade.css +115 -0
  249. package/src/primitives/scroll-fade/scroll-fade.html +69 -0
  250. package/src/primitives/select/multiselect.d.ts +8 -10
  251. package/src/primitives/select/multiselect.d.ts.map +1 -1
  252. package/src/primitives/select/multiselect.js +23 -27
  253. package/src/primitives/select/multiselect.ts +23 -29
  254. package/src/primitives/select/select-align.html +79 -16
  255. package/src/primitives/select/select-multiple.html +8 -4
  256. package/src/primitives/select/select-sides.html +104 -21
  257. package/src/primitives/select/select.css +299 -191
  258. package/src/primitives/select/select.html +24 -5
  259. package/src/primitives/separator/separator.css +15 -18
  260. package/src/primitives/separator/separator.html +37 -10
  261. package/src/primitives/slider/slider.css +48 -38
  262. package/src/primitives/slider/slider.html +9 -1
  263. package/src/primitives/style-guard/style-guard.d.ts +19 -0
  264. package/src/primitives/style-guard/style-guard.d.ts.map +1 -0
  265. package/src/primitives/style-guard/style-guard.js +125 -0
  266. package/src/primitives/style-guard/style-guard.ts +153 -0
  267. package/src/primitives/switch/switch.css +42 -33
  268. package/src/primitives/switch/switch.html +11 -6
  269. package/src/primitives/table/table-alternating.html +1 -1
  270. package/src/primitives/table/table-grid.html +5 -5
  271. package/src/primitives/table/table-size-sm.html +1 -1
  272. package/src/primitives/table/table.css +64 -61
  273. package/src/primitives/table/table.html +7 -7
  274. package/src/primitives/tabs/tabs.css +167 -166
  275. package/src/primitives/tabs/tabs.d.ts +10 -11
  276. package/src/primitives/tabs/tabs.d.ts.map +1 -1
  277. package/src/primitives/tabs/tabs.html +192 -36
  278. package/src/primitives/tabs/tabs.js +14 -15
  279. package/src/primitives/tabs/tabs.ts +14 -15
  280. package/src/primitives/textarea/textarea.css +69 -44
  281. package/src/primitives/textarea/textarea.html +3 -3
  282. package/src/primitives/toaster/toaster.css +90 -92
  283. package/src/primitives/toaster/toaster.d.ts +0 -6
  284. package/src/primitives/toaster/toaster.d.ts.map +1 -1
  285. package/src/primitives/toaster/toaster.html +22 -18
  286. package/src/primitives/toaster/toaster.js +64 -72
  287. package/src/primitives/toaster/toaster.ts +71 -87
  288. package/src/primitives/toggle/toggle.css +368 -153
  289. package/src/primitives/toggle/toggle.html +27 -9
  290. package/src/primitives/toggle-group/toggle-group-multiple.html +3 -3
  291. package/src/primitives/toggle-group/toggle-group-vertical.html +4 -4
  292. package/src/primitives/toggle-group/toggle-group.css +71 -23
  293. package/src/primitives/toggle-group/toggle-group.html +3 -3
  294. package/src/primitives/toolbar/toolbar.html +35 -13
  295. package/src/primitives/tooltip/tooltip-disabled.html +3 -3
  296. package/src/primitives/tooltip/tooltip-sides.html +36 -14
  297. package/src/primitives/tooltip/tooltip-with-kbd.html +5 -5
  298. package/src/primitives/tooltip/tooltip.css +111 -80
  299. package/src/primitives/tooltip/tooltip.html +3 -3
  300. package/src/primitives/utilities/aspect-ratio.html +51 -7
  301. package/src/primitives/utilities/basis.html +64 -11
  302. package/src/primitives/utilities/col-span.html +65 -9
  303. package/src/primitives/utilities/compose.html +48 -10
  304. package/src/primitives/utilities/flex-align.html +89 -19
  305. package/src/primitives/utilities/flex-direction.html +111 -13
  306. package/src/primitives/utilities/flex-grow.html +41 -7
  307. package/src/primitives/utilities/gap.html +158 -19
  308. package/src/primitives/utilities/grid-cols.html +75 -7
  309. package/src/primitives/utilities/grid-responsive.html +111 -12
  310. package/src/primitives/utilities/margin-auto.html +38 -7
  311. package/src/primitives/utilities/object-fit.html +75 -13
  312. package/src/primitives/utilities/order.html +40 -4
  313. package/src/primitives/utilities/overflow.html +74 -20
  314. package/src/primitives/utilities/padding-compose.html +67 -10
  315. package/src/primitives/utilities/padding.html +84 -13
  316. package/src/primitives/utilities/pile.html +29 -0
  317. package/src/primitives/utilities/position.html +65 -8
  318. package/src/primitives/utilities/responsive-flex.html +54 -7
  319. package/src/primitives/utilities/responsive-grid.html +115 -12
  320. package/src/primitives/utilities/size.html +120 -16
  321. package/src/primitives/utilities/width.html +123 -16
  322. package/examples/about.html +0 -583
  323. package/examples/components.html +0 -1028
  324. package/examples/forms.html +0 -504
  325. package/examples/index.html +0 -261
  326. package/examples/layout.html +0 -313
  327. package/examples/products.html +0 -839
  328. package/examples/responsive.html +0 -332
  329. package/src/base/_layout.css +0 -571
  330. package/src/base/_utilities.css +0 -6758
  331. package/src/primitives/utilities/grid-pile.html +0 -5
@@ -0,0 +1,750 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview The utility table: the single source the utilities generator,
4
+ * the editor custom data, and `<ui-debug>` read. Data only — no imports, no
5
+ * CSS text.
6
+ */
7
+ /** Breakpoints, ascending: Tailwind's five names. */
8
+ export const BREAKPOINTS = ["sm", "md", "lg", "xl", "2xl"];
9
+ /**
10
+ * Breakpoint thresholds, in `ch` of the nearest inline-size container's font,
11
+ * chosen for legibility: each answers "what text layout fits here?". sm: the
12
+ * narrowest comfortable line; md: one full reading measure (`--article-md`);
13
+ * lg: two 45ch columns; xl: three 40ch columns; 2xl: two full 75ch measures.
14
+ * ≈ 404 / 656 / 909 / 1210 / 1515px with the system font at 16px.
15
+ */
16
+ export const BREAKPOINT_CH = {
17
+ sm: 40,
18
+ md: 65,
19
+ lg: 90,
20
+ xl: 120,
21
+ "2xl": 150,
22
+ };
23
+ /**
24
+ * Layout band and component widths (`--layout-*`), in rem for predictable
25
+ * geometry: Tailwind's scale. Decoupled from the query thresholds above.
26
+ */
27
+ export const LAYOUT_REM = {
28
+ sm: 40,
29
+ md: 48,
30
+ lg: 64,
31
+ xl: 80,
32
+ "2xl": 96,
33
+ };
34
+ /** Interaction states, highest precedence first. */
35
+ export const STATES = [
36
+ "starting",
37
+ "disabled",
38
+ "active",
39
+ "focus-visible",
40
+ "focus-within",
41
+ "hover",
42
+ "checked",
43
+ "current",
44
+ "open",
45
+ "stuck",
46
+ ];
47
+ /**
48
+ * How each state is selected: a pseudo-class (or `:is()` list) on the element,
49
+ * with an optional media guard; for `stuck`, the nearest sticky scroll-state
50
+ * container (see `STUCK_STATE`); for `starting`, the element's
51
+ * `@starting-style` (the style it transitions from when it first renders or
52
+ * leaves `display: none`). Pseudo states have a `--group-*` form; the stuck
53
+ * and starting states do not (the trigger is the container, or the element's
54
+ * own first style).
55
+ */
56
+ export const STATE_SELECTORS = {
57
+ starting: { pseudo: "", starting: true },
58
+ disabled: { pseudo: ':is(:disabled, [aria-disabled="true"])' },
59
+ active: { pseudo: ":active" },
60
+ "focus-visible": { pseudo: ":focus-visible" },
61
+ "focus-within": { pseudo: ":focus-within" },
62
+ hover: { pseudo: ":hover", media: "(hover: hover)" },
63
+ checked: { pseudo: ':is(:checked, [aria-checked="true"])' },
64
+ current: { pseudo: ':is([aria-current]:not([aria-current="false"]))' },
65
+ open: { pseudo: ':is([open], :popover-open, [aria-expanded="true"])' },
66
+ stuck: { pseudo: "", stuck: true },
67
+ };
68
+ /**
69
+ * The experimental `stuck` state: `scroll-state(stuck: <side>)` where container
70
+ * scroll-state queries are supported, `base/scroll-state.ts` elsewhere. Any
71
+ * sticky element (a `style` holding `: sticky`, so `--position: sticky`, its
72
+ * tiers, or raw `position: sticky`) or one that sets `--stuck-state` becomes
73
+ * the container; a container query never matches the container itself, so
74
+ * `--<utility>--stuck` applies to its *descendants* while it is stuck to the
75
+ * side its `--stuck-state` names (`fallback` when unset). `--stuck-state` has
76
+ * no emission or tiers of its own: switch `--position` off at a breakpoint to
77
+ * drop the state there.
78
+ */
79
+ export const STUCK_STATE = {
80
+ modifier: "stuck-state",
81
+ supports: "(container-type: scroll-state)",
82
+ /** Where unsupported, `base/scroll-state.ts` writes the stuck sides here, on the container. */
83
+ polyfill: "data-ui-stuck",
84
+ fallback: "top",
85
+ /** Sticky elements: `--position: sticky`, its tiers, or raw `position: sticky`. */
86
+ sticky: '[style*=": sticky"]',
87
+ sides: [
88
+ "top",
89
+ "right",
90
+ "bottom",
91
+ "left",
92
+ "block-start",
93
+ "block-end",
94
+ "inline-start",
95
+ "inline-end",
96
+ ],
97
+ };
98
+ /** True when `--group-<utility>--<state>` exists for the state. */
99
+ export function hasGroup(state) {
100
+ return !STATE_SELECTORS[state].stuck && !STATE_SELECTORS[state].starting;
101
+ }
102
+ export function isState(tier) {
103
+ return STATES.includes(tier);
104
+ }
105
+ export const FAMILY_TIERS = {
106
+ flow: "breakpoints",
107
+ grid: "breakpoints",
108
+ spacing: "breakpoints",
109
+ margin: "breakpoints",
110
+ sizing: "breakpoints",
111
+ typography: "breakpoints",
112
+ color: "both",
113
+ effects: "states",
114
+ box: "none",
115
+ };
116
+ /** Gradient types: `--bg-<type>` emits `<type>-gradient(<prelude>, <--bg-stops>)`. */
117
+ export const GRADIENT_TYPES = ["linear", "radial", "conic"];
118
+ /** The size scale shared by the token keywords (`--shadow: md`). */
119
+ export const SIZE_KEYWORDS = ["2xs", "xs", "sm", "md", "lg", "xl", "2xl"];
120
+ /** `--shadow: md` → `var(--shadow-md)`. */
121
+ const SHADOWS = Object.fromEntries(SIZE_KEYWORDS.map((size) => [size, `var(--shadow-${size})`]));
122
+ /**
123
+ * `--font-weight: strong` → `var(--font-weight-strong)`: the role weights, so a
124
+ * theme's weights reach utilities. Standard names (`medium`) are not keywords:
125
+ * write the number (`500`); `<ui-debug>` says so.
126
+ */
127
+ const FONT_WEIGHTS = {
128
+ heading: "var(--font-weight-heading)",
129
+ body: "var(--font-weight-body)",
130
+ strong: "var(--font-weight-strong)",
131
+ };
132
+ /** Standard weight names and the number to write instead (`normal` and `bold` are CSS). */
133
+ export const FONT_WEIGHT_NAMES = {
134
+ thin: 100,
135
+ hairline: 100,
136
+ extralight: 200,
137
+ "extra-light": 200,
138
+ ultralight: 200,
139
+ light: 300,
140
+ regular: 400,
141
+ medium: 500,
142
+ semibold: 600,
143
+ "semi-bold": 600,
144
+ demibold: 600,
145
+ extrabold: 800,
146
+ "extra-bold": 800,
147
+ ultrabold: 800,
148
+ black: 900,
149
+ heavy: 900,
150
+ };
151
+ /**
152
+ * `--display` shorthands that set the flex direction with the display (there
153
+ * is no `--flex-direction` utility): `[display, flex-direction]`. Plain `flex`
154
+ * or `inline-flex` at a tier resets the direction to row. A keyword that is a
155
+ * prefix of another comes first.
156
+ */
157
+ export const DISPLAY_SHORTHANDS = {
158
+ "flex-row": ["flex", "row"],
159
+ "flex-row-reverse": ["flex", "row-reverse"],
160
+ "flex-col": ["flex", "column"],
161
+ "flex-col-reverse": ["flex", "column-reverse"],
162
+ "inline-flex-row": ["inline-flex", "row"],
163
+ "inline-flex-row-reverse": ["inline-flex", "row-reverse"],
164
+ "inline-flex-col": ["inline-flex", "column"],
165
+ "inline-flex-col-reverse": ["inline-flex", "column-reverse"],
166
+ };
167
+ /** The border shorthands, all sides first. */
168
+ export const BORDER_SHORTHANDS = [
169
+ "border",
170
+ "border-x",
171
+ "border-y",
172
+ "border-l",
173
+ "border-t",
174
+ "border-r",
175
+ "border-b",
176
+ ];
177
+ /**
178
+ * Each physical side of the border shorthand, the logical property prefix it
179
+ * sets, and the shorthands that cover it, most specific first.
180
+ */
181
+ export const BORDER_SIDES = [
182
+ { side: "l", property: "border-inline-start", shorthands: ["border-l", "border-x", "border"] },
183
+ { side: "t", property: "border-block-start", shorthands: ["border-t", "border-y", "border"] },
184
+ { side: "r", property: "border-inline-end", shorthands: ["border-r", "border-x", "border"] },
185
+ { side: "b", property: "border-block-end", shorthands: ["border-b", "border-y", "border"] },
186
+ ];
187
+ /** The four sizing keywords. Margin takes only `auto`. */
188
+ export const SIZING_KEYWORDS = ["auto", "fit-content", "min-content", "max-content"];
189
+ export const MARGIN_KEYWORDS = ["auto"];
190
+ /** A layout places its children; a tier-only column utility there keeps the band below the tier. */
191
+ const LAYOUT_CHILDREN = ["ui-layout > *", '[data-ui~="layout"] > *'];
192
+ /**
193
+ * Track-list keywords `--grid-cols` / `--grid-rows` take besides a count. `none`
194
+ * is not one: `--template-cols: none` says the same, and every keyword
195
+ * costs a rule per breakpoint (SPEC claim 16).
196
+ */
197
+ export const GRID_TEMPLATE_KEYWORDS = ["subgrid"];
198
+ /** The utility table. Order within a family is emission order (shorthands first). */
199
+ export const UTILITIES = [
200
+ // flow: keywords and raw values; most are on the no-base allowlist
201
+ { name: "display", pseudo: true, properties: ["display"], mode: "keyword", family: "flow" },
202
+ // breakpoint tiers so sticky (and the stuck state) can switch off per breakpoint
203
+ {
204
+ name: "position",
205
+ pseudo: true,
206
+ properties: ["position"],
207
+ mode: "keyword",
208
+ family: "flow",
209
+ noBase: "static",
210
+ },
211
+ {
212
+ name: "flex-wrap",
213
+ properties: ["flex-wrap"],
214
+ mode: "keyword",
215
+ family: "flow",
216
+ noBase: "nowrap",
217
+ },
218
+ { name: "shrink", properties: ["flex-shrink"], mode: "raw", family: "flow", noBase: "1" },
219
+ {
220
+ name: "grid-flow",
221
+ properties: ["grid-auto-flow"],
222
+ mode: "keyword",
223
+ family: "flow",
224
+ noBase: "row",
225
+ },
226
+ {
227
+ name: "auto-cols",
228
+ properties: ["grid-auto-columns"],
229
+ mode: "raw",
230
+ family: "flow",
231
+ noBase: "auto",
232
+ },
233
+ {
234
+ name: "auto-rows",
235
+ properties: ["grid-auto-rows"],
236
+ mode: "raw",
237
+ family: "flow",
238
+ noBase: "auto",
239
+ },
240
+ { name: "items", properties: ["align-items"], mode: "keyword", family: "flow", noBase: "normal" },
241
+ {
242
+ name: "justify",
243
+ properties: ["justify-content"],
244
+ mode: "keyword",
245
+ family: "flow",
246
+ noBase: "normal",
247
+ },
248
+ // Grid alignment shorthands: the CSS alignment keywords only (`center`, `safe end`, `space-between`).
249
+ {
250
+ name: "place-items",
251
+ properties: ["place-items"],
252
+ mode: "keyword",
253
+ family: "flow",
254
+ noBase: "normal",
255
+ },
256
+ {
257
+ name: "place-content",
258
+ properties: ["place-content"],
259
+ mode: "keyword",
260
+ family: "flow",
261
+ noBase: "normal",
262
+ },
263
+ { name: "self", properties: ["align-self"], mode: "keyword", family: "flow", noBase: "auto" },
264
+ { name: "flex", properties: ["flex"], mode: "raw", family: "flow", noBase: "0 1 auto" },
265
+ { name: "basis", properties: ["flex-basis"], mode: "raw", family: "flow", noBase: "auto" },
266
+ { name: "order", properties: ["order"], mode: "raw", family: "flow", noBase: "0" },
267
+ // a layout child's band (`layout-md`); any grid-column value works
268
+ {
269
+ name: "band",
270
+ properties: ["grid-column"],
271
+ mode: "raw",
272
+ family: "flow",
273
+ noBase: "auto",
274
+ noBaseExclude: LAYOUT_CHILDREN,
275
+ },
276
+ // Tailwind's col-span / col-start / col-end (and row-*): span is a count,
277
+ // start and end are line numbers; start and end follow span so they combine
278
+ {
279
+ name: "col-span",
280
+ properties: ["grid-column"],
281
+ mode: "integer",
282
+ family: "flow",
283
+ emit: "span",
284
+ noBase: "1",
285
+ noBaseExclude: LAYOUT_CHILDREN,
286
+ },
287
+ {
288
+ name: "col-start",
289
+ properties: ["grid-column-start"],
290
+ mode: "raw",
291
+ family: "flow",
292
+ noBase: "auto",
293
+ noBaseExclude: LAYOUT_CHILDREN,
294
+ },
295
+ {
296
+ name: "col-end",
297
+ properties: ["grid-column-end"],
298
+ mode: "raw",
299
+ family: "flow",
300
+ noBase: "auto",
301
+ noBaseExclude: LAYOUT_CHILDREN,
302
+ },
303
+ {
304
+ name: "row-span",
305
+ properties: ["grid-row"],
306
+ mode: "integer",
307
+ family: "flow",
308
+ emit: "span",
309
+ noBase: "1",
310
+ },
311
+ {
312
+ name: "row-start",
313
+ properties: ["grid-row-start"],
314
+ mode: "raw",
315
+ family: "flow",
316
+ noBase: "auto",
317
+ },
318
+ { name: "row-end", properties: ["grid-row-end"], mode: "raw", family: "flow", noBase: "auto" },
319
+ // grid: integers become repeat() (plus subgrid); templates are raw;
320
+ // grid-fit packs auto-fit columns
321
+ {
322
+ name: "grid-cols",
323
+ properties: ["grid-template-columns"],
324
+ mode: "integer",
325
+ family: "grid",
326
+ emit: "repeat",
327
+ noBase: "1",
328
+ keywords: GRID_TEMPLATE_KEYWORDS,
329
+ },
330
+ {
331
+ name: "grid-rows",
332
+ properties: ["grid-template-rows"],
333
+ mode: "integer",
334
+ family: "grid",
335
+ emit: "repeat",
336
+ noBase: "1",
337
+ keywords: GRID_TEMPLATE_KEYWORDS,
338
+ },
339
+ // raw track lists take states too, for the 0fr → 1fr expand (`--template-rows--open: 1fr`)
340
+ {
341
+ name: "template-cols",
342
+ properties: ["grid-template-columns"],
343
+ mode: "raw",
344
+ family: "grid",
345
+ tiers: "both",
346
+ noBase: "none",
347
+ },
348
+ {
349
+ name: "template-rows",
350
+ properties: ["grid-template-rows"],
351
+ mode: "raw",
352
+ family: "grid",
353
+ tiers: "both",
354
+ noBase: "none",
355
+ },
356
+ {
357
+ name: "grid-fit",
358
+ properties: ["grid-template-columns"],
359
+ mode: "raw",
360
+ family: "grid",
361
+ emit: "grid-fit",
362
+ },
363
+ // spacing: dual mode; gap is on the no-base allowlist
364
+ { name: "p", pseudo: true, properties: ["padding"], mode: "dual", family: "spacing" },
365
+ { name: "px", pseudo: true, properties: ["padding-inline"], mode: "dual", family: "spacing" },
366
+ { name: "py", pseudo: true, properties: ["padding-block"], mode: "dual", family: "spacing" },
367
+ {
368
+ name: "pt",
369
+ pseudo: true,
370
+ properties: ["padding-block-start"],
371
+ mode: "dual",
372
+ family: "spacing",
373
+ },
374
+ { name: "pb", pseudo: true, properties: ["padding-block-end"], mode: "dual", family: "spacing" },
375
+ {
376
+ name: "pl",
377
+ pseudo: true,
378
+ properties: ["padding-inline-start"],
379
+ mode: "dual",
380
+ family: "spacing",
381
+ },
382
+ { name: "pr", pseudo: true, properties: ["padding-inline-end"], mode: "dual", family: "spacing" },
383
+ { name: "gap", properties: ["gap"], mode: "dual", family: "spacing", noBase: "0" },
384
+ { name: "gap-x", properties: ["column-gap"], mode: "dual", family: "spacing", noBase: "0" },
385
+ { name: "gap-y", properties: ["row-gap"], mode: "dual", family: "spacing", noBase: "0" },
386
+ { name: "inset", pseudo: true, properties: ["inset"], mode: "dual", family: "spacing" },
387
+ // axis insets: left + right and top + bottom (logical, like the sides)
388
+ { name: "inset-x", pseudo: true, properties: ["inset-inline"], mode: "dual", family: "spacing" },
389
+ { name: "inset-y", pseudo: true, properties: ["inset-block"], mode: "dual", family: "spacing" },
390
+ { name: "top", pseudo: true, properties: ["inset-block-start"], mode: "dual", family: "spacing" },
391
+ {
392
+ name: "bottom",
393
+ pseudo: true,
394
+ properties: ["inset-block-end"],
395
+ mode: "dual",
396
+ family: "spacing",
397
+ },
398
+ {
399
+ name: "left",
400
+ pseudo: true,
401
+ properties: ["inset-inline-start"],
402
+ mode: "dual",
403
+ family: "spacing",
404
+ },
405
+ {
406
+ name: "right",
407
+ pseudo: true,
408
+ properties: ["inset-inline-end"],
409
+ mode: "dual",
410
+ family: "spacing",
411
+ },
412
+ // margin: dual mode plus `auto`
413
+ { name: "m", properties: ["margin"], mode: "dual", family: "margin", keywords: MARGIN_KEYWORDS },
414
+ {
415
+ name: "mx",
416
+ properties: ["margin-inline"],
417
+ mode: "dual",
418
+ family: "margin",
419
+ keywords: MARGIN_KEYWORDS,
420
+ },
421
+ {
422
+ name: "my",
423
+ properties: ["margin-block"],
424
+ mode: "dual",
425
+ family: "margin",
426
+ keywords: MARGIN_KEYWORDS,
427
+ },
428
+ {
429
+ name: "mt",
430
+ properties: ["margin-block-start"],
431
+ mode: "dual",
432
+ family: "margin",
433
+ keywords: MARGIN_KEYWORDS,
434
+ },
435
+ {
436
+ name: "mb",
437
+ properties: ["margin-block-end"],
438
+ mode: "dual",
439
+ family: "margin",
440
+ keywords: MARGIN_KEYWORDS,
441
+ },
442
+ {
443
+ name: "ml",
444
+ properties: ["margin-inline-start"],
445
+ mode: "dual",
446
+ family: "margin",
447
+ keywords: MARGIN_KEYWORDS,
448
+ },
449
+ {
450
+ name: "mr",
451
+ properties: ["margin-inline-end"],
452
+ mode: "dual",
453
+ family: "margin",
454
+ keywords: MARGIN_KEYWORDS,
455
+ },
456
+ // sizing: dual mode; the four keywords only where they are used (`--w`, `--h`,
457
+ // `--min-w`, `--max-w`): each keyword-bearing utility costs a base rule and two
458
+ // rules per breakpoint (SPEC claim 16). `--size: fit-content` is `--w` + `--h`;
459
+ // a hero that must not squish is `--min-h: 100svh`, not `--h: 100svh; --min-h: fit-content`
460
+ {
461
+ name: "w",
462
+ properties: ["inline-size"],
463
+ mode: "dual",
464
+ family: "sizing",
465
+ keywords: SIZING_KEYWORDS,
466
+ pseudo: true,
467
+ },
468
+ {
469
+ name: "h",
470
+ properties: ["block-size"],
471
+ mode: "dual",
472
+ family: "sizing",
473
+ keywords: SIZING_KEYWORDS,
474
+ pseudo: true,
475
+ },
476
+ {
477
+ name: "size",
478
+ properties: ["inline-size", "block-size"],
479
+ mode: "dual",
480
+ family: "sizing",
481
+ pseudo: true,
482
+ },
483
+ {
484
+ name: "min-w",
485
+ properties: ["min-inline-size"],
486
+ mode: "dual",
487
+ family: "sizing",
488
+ keywords: SIZING_KEYWORDS,
489
+ pseudo: true,
490
+ },
491
+ {
492
+ name: "max-w",
493
+ properties: ["max-inline-size"],
494
+ mode: "dual",
495
+ family: "sizing",
496
+ keywords: SIZING_KEYWORDS,
497
+ pseudo: true,
498
+ },
499
+ {
500
+ name: "min-h",
501
+ properties: ["min-block-size"],
502
+ mode: "dual",
503
+ family: "sizing",
504
+ pseudo: true,
505
+ },
506
+ {
507
+ name: "max-h",
508
+ properties: ["max-block-size"],
509
+ mode: "dual",
510
+ family: "sizing",
511
+ pseudo: true,
512
+ },
513
+ {
514
+ name: "aspect",
515
+ pseudo: true,
516
+ properties: ["aspect-ratio"],
517
+ mode: "raw",
518
+ family: "sizing",
519
+ noBase: "auto",
520
+ },
521
+ // typography: one utility per property; roles live in _typography.css
522
+ { name: "font-size", pseudo: true, properties: ["font-size"], mode: "raw", family: "typography" },
523
+ {
524
+ name: "font-weight",
525
+ pseudo: true,
526
+ properties: ["font-weight"],
527
+ mode: "raw",
528
+ family: "typography",
529
+ aliases: FONT_WEIGHTS,
530
+ },
531
+ { name: "font-family", properties: ["font-family"], mode: "raw", family: "typography" },
532
+ { name: "font-style", properties: ["font-style"], mode: "keyword", family: "typography" },
533
+ { name: "leading", properties: ["line-height"], mode: "raw", family: "typography" },
534
+ { name: "tracking", properties: ["letter-spacing"], mode: "raw", family: "typography" },
535
+ {
536
+ name: "text-align",
537
+ properties: ["text-align"],
538
+ mode: "keyword",
539
+ family: "typography",
540
+ noBase: "start",
541
+ },
542
+ { name: "text-transform", properties: ["text-transform"], mode: "keyword", family: "typography" },
543
+ {
544
+ name: "text-wrap",
545
+ properties: ["text-wrap"],
546
+ mode: "keyword",
547
+ family: "typography",
548
+ noBase: "wrap",
549
+ },
550
+ {
551
+ name: "line-clamp",
552
+ properties: ["-webkit-line-clamp"],
553
+ mode: "integer",
554
+ family: "typography",
555
+ emit: "line-clamp",
556
+ },
557
+ // states too, for the link pattern `--text-decoration--hover: underline`
558
+ {
559
+ name: "text-decoration",
560
+ properties: ["text-decoration-line"],
561
+ mode: "raw",
562
+ family: "typography",
563
+ tiers: "both",
564
+ noBase: "none",
565
+ },
566
+ { name: "whitespace", properties: ["white-space"], mode: "keyword", family: "typography" },
567
+ // color: states; bg-alpha feeds the bg emission
568
+ { name: "text", properties: ["color"], mode: "raw", family: "color", pseudo: true },
569
+ {
570
+ name: "bg",
571
+ properties: ["background-color"],
572
+ mode: "raw",
573
+ family: "color",
574
+ emit: "bg",
575
+ pseudo: true,
576
+ },
577
+ { name: "bg-alpha", properties: [], mode: "raw", family: "color", emit: "none" },
578
+ // gradients: the type utility carries the prelude (direction, shape, position,
579
+ // `in <color-space> [<hue> hue]`), --bg-stops the color stops; they compose
580
+ // into background-image. `--bg: none` also clears background-image.
581
+ // No tiers: a gradient rarely changes per state or breakpoint, and every tier
582
+ // of four utilities cost 1 KB; `--bg--<tier>: none` still clears one.
583
+ ...GRADIENT_TYPES.map((type) => ({
584
+ name: `bg-${type}`,
585
+ properties: [],
586
+ mode: "raw",
587
+ family: "color",
588
+ emit: "none",
589
+ tiers: "none",
590
+ })),
591
+ { name: "bg-stops", properties: [], mode: "raw", family: "color", emit: "none", tiers: "none" },
592
+ {
593
+ name: "border-color",
594
+ properties: ["border-color"],
595
+ mode: "raw",
596
+ family: "color",
597
+ pseudo: true,
598
+ },
599
+ {
600
+ name: "border-width",
601
+ properties: ["border-width"],
602
+ mode: "raw",
603
+ family: "color",
604
+ pseudo: true,
605
+ },
606
+ {
607
+ name: "border-style",
608
+ properties: ["border-style"],
609
+ mode: "raw",
610
+ family: "color",
611
+ pseudo: true,
612
+ },
613
+ // border shorthands: a color, a number (px), or a length; the side rules
614
+ // read them after the all-sides longhands, so --border-color beats --border.
615
+ // A side takes only the shorthand (`--border-b: 1`, `--border-t: red`):
616
+ // per-side width and color longhands were dropped as too rare for their cost
617
+ ...BORDER_SHORTHANDS.map((name) => ({ name, properties: [], mode: "raw", family: "color", emit: "border" })),
618
+ // effects: states; ring* and shadow compose into one box-shadow
619
+ {
620
+ name: "opacity",
621
+ pseudo: true,
622
+ properties: ["opacity"],
623
+ mode: "raw",
624
+ family: "effects",
625
+ noBase: "1",
626
+ },
627
+ {
628
+ name: "shadow",
629
+ properties: [],
630
+ mode: "raw",
631
+ family: "effects",
632
+ emit: "none",
633
+ aliases: SHADOWS,
634
+ },
635
+ // the shadow color for an element and its subtree: _variables.css re-declares the
636
+ // --shadow-* tokens wherever this is set, so keyword, var(), and primitive shadows follow
637
+ { name: "shadow-hue", properties: [], mode: "raw", family: "box", emit: "none" },
638
+ { name: "ring", properties: [], mode: "raw", family: "effects", emit: "none" },
639
+ { name: "ring-color", properties: [], mode: "raw", family: "effects", emit: "none" },
640
+ { name: "ring-offset", properties: [], mode: "raw", family: "effects", emit: "none" },
641
+ { name: "ring-offset-color", properties: [], mode: "raw", family: "effects", emit: "none" },
642
+ {
643
+ name: "scale",
644
+ pseudo: true,
645
+ properties: ["scale"],
646
+ mode: "raw",
647
+ family: "effects",
648
+ noBase: "none",
649
+ },
650
+ {
651
+ name: "translate",
652
+ pseudo: true,
653
+ properties: ["translate"],
654
+ mode: "raw",
655
+ family: "effects",
656
+ noBase: "none",
657
+ },
658
+ {
659
+ name: "rotate",
660
+ pseudo: true,
661
+ properties: ["rotate"],
662
+ mode: "raw",
663
+ family: "effects",
664
+ noBase: "none",
665
+ },
666
+ { name: "transition", pseudo: true, properties: ["transition"], mode: "raw", family: "effects" },
667
+ // box: no tiers
668
+ {
669
+ name: "rounded",
670
+ properties: ["border-radius"],
671
+ mode: "raw",
672
+ family: "box",
673
+ pseudo: true,
674
+ noBase: "0",
675
+ },
676
+ { name: "overflow", properties: ["overflow"], mode: "keyword", family: "box", noBase: "visible" },
677
+ {
678
+ name: "overflow-x",
679
+ properties: ["overflow-x"],
680
+ mode: "keyword",
681
+ family: "box",
682
+ noBase: "visible",
683
+ },
684
+ {
685
+ name: "overflow-y",
686
+ properties: ["overflow-y"],
687
+ mode: "keyword",
688
+ family: "box",
689
+ noBase: "visible",
690
+ },
691
+ { name: "outline", pseudo: true, properties: ["outline"], mode: "raw", family: "box" },
692
+ { name: "cursor", properties: ["cursor"], mode: "keyword", family: "box" },
693
+ {
694
+ name: "pointer-events",
695
+ pseudo: true,
696
+ properties: ["pointer-events"],
697
+ mode: "keyword",
698
+ family: "box",
699
+ },
700
+ { name: "visibility", pseudo: true, properties: ["visibility"], mode: "keyword", family: "box" },
701
+ { name: "z", pseudo: true, properties: ["z-index"], mode: "raw", family: "box", noBase: "auto" },
702
+ { name: "object-fit", properties: ["object-fit"], mode: "keyword", family: "box" },
703
+ // the divider between children for the divide-x / divide-y switches: the
704
+ // border shorthand's grammar, emitting only its (inherited) width and color channels
705
+ { name: "divide", properties: [], mode: "raw", family: "box", emit: "border", inherits: true },
706
+ ];
707
+ /** Utilities that exist only on pseudo-elements. */
708
+ export const PSEUDO_ONLY = [
709
+ { name: "content", properties: ["content"], mode: "raw", family: "box", pseudo: true },
710
+ ];
711
+ export const PSEUDO_SIDES = ["before", "after"];
712
+ /** Tier names a utility's family allows, in setter order. */
713
+ export function tiersOf(utility) {
714
+ const kind = utility.tiers ?? FAMILY_TIERS[utility.family];
715
+ if (kind === "breakpoints")
716
+ return BREAKPOINTS;
717
+ if (kind === "states")
718
+ return STATES;
719
+ if (kind === "both")
720
+ return [...STATES, ...BREAKPOINTS];
721
+ return [];
722
+ }
723
+ const TIER_NAMES = new Set([...BREAKPOINTS, ...STATES]);
724
+ /** `--before-w--md` → { side: "before", name: "w", tier: "md" }; `--group-bg--hover` sets `group`. */
725
+ export function parseUtilityName(raw) {
726
+ let body = raw.slice(2);
727
+ let group;
728
+ if (body.startsWith("group-")) {
729
+ group = true;
730
+ body = body.slice("group-".length);
731
+ }
732
+ let side;
733
+ for (const candidate of PSEUDO_SIDES) {
734
+ if (body.startsWith(`${candidate}-`)) {
735
+ side = candidate;
736
+ body = body.slice(candidate.length + 1);
737
+ break;
738
+ }
739
+ }
740
+ const split = body.lastIndexOf("--");
741
+ if (split > 0 && TIER_NAMES.has(body.slice(split + 2))) {
742
+ return {
743
+ name: body.slice(0, split),
744
+ tier: body.slice(split + 2),
745
+ side,
746
+ ...(group ? { group } : {}),
747
+ };
748
+ }
749
+ return { name: body, side, ...(group ? { group } : {}) };
750
+ }