@zazz-ui/core 0.4.1 → 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 +331 -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 +43 -39
  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 +145 -122
  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 +88 -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 +297 -186
  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
@@ -1,12 +1,31 @@
1
- <div class="ui-field">
2
- <label data-slot="field-label" for="f-sort">Sort by</label>
3
- <select class="ui-select" id="f-sort" name="sort">
1
+ <div data-ui="field">
2
+ <label data-field-slot="label" for="f-sort">Sort by</label>
3
+ <select data-ui="select" id="f-sort" name="sort">
4
4
  <button>
5
5
  <selectedcontent></selectedcontent>
6
6
  </button>
7
7
  <!-- Keep label in optgroup as a fallback -->
8
- <optgroup class="grid gap-px" label="Sort by">
9
- <legend class="text-eyebrow text-muted-foreground p-xs">Sort by</legend>
8
+ <optgroup
9
+ label="Sort by"
10
+ style="
11
+ --display: grid;
12
+ --gap: 1px;
13
+ "
14
+ >
15
+ <legend
16
+ style="
17
+ --display: inline-flex;
18
+ --p: 2;
19
+ --font-size: var(--font-size-eyebrow);
20
+ --font-weight: var(--font-weight-eyebrow);
21
+ --leading: var(--leading-eyebrow);
22
+ --tracking: var(--tracking-eyebrow);
23
+ --text-transform: uppercase;
24
+ --text: var(--color-muted-foreground);
25
+ "
26
+ >
27
+ Sort by
28
+ </legend>
10
29
  <option value="recent" selected>Most recent</option>
11
30
  <option value="popular">Most popular</option>
12
31
  <option value="price-asc">Price: low to high</option>
@@ -1,44 +1,41 @@
1
1
  /**
2
- * separator.css: Separator (.ui-separator on native <hr>)
2
+ * separator.css: Separator ([data-ui~="separator"] on native <hr>)
3
3
  *
4
4
  * @layer variables, components
5
- * @requires layers.css, _variables.css, _reset.css
6
- * @uses <hr>: the platform's separator (implicit role="separator");
7
- * no div reconstruction needed
8
- * @uses data-orientation="vertical": flips to a stretching column rule
9
- * for flex/grid rows; pair with aria-orientation="vertical" when
10
- * the separator is meaningful, or role="presentation" when purely
11
- * decorative
12
- * @tokens --ui-separator-* (@layer variables)
5
+ * @requires _layers.css, _variables.css, _reset.css, _properties.css (--_bg-resolved)
6
+ * @uses <hr>: the platform's separator (implicit role="separator")
7
+ * @uses data-separator-orientation="vertical": flips to a stretching
8
+ * column rule for flex/grid rows; pair with aria-orientation="vertical"
9
+ * when the separator is meaningful, or role="presentation" when
10
+ * purely decorative
11
+ * @tokens --ui-separator-* (@layer variables; --ui-separator-bg backs the --bg utility)
13
12
  */
14
13
 
15
14
  @layer variables {
16
15
  :root {
17
- --ui-separator-color: var(--border);
18
- --ui-separator-thickness: var(--step-px);
16
+ --ui-separator-bg: var(--color-border);
17
+ --ui-separator-thickness: 1px;
19
18
  }
20
19
  }
21
20
 
22
- @layer zazz.components {
21
+ @layer ui.components {
23
22
  /* ===========================================================================
24
23
  SEPARATOR: a themed <hr>, horizontal or vertical
25
- - The bare-hr baseline lives in _reset.css; this class adds the token hooks
26
- and the vertical form. Spacing is composition (my-xs / mx-xs utilities),
27
- like every other recipe.
24
+ - Spacing is composition (--my / --mx utilities).
28
25
  - Meaningful separators keep hr's implicit separator role (add
29
26
  aria-orientation="vertical" for the vertical form: AT assumes
30
27
  horizontal); decorative ones take role="presentation".
31
28
  =========================================================================== */
32
29
 
33
- .ui-separator {
30
+ :where([data-ui~="separator"]) {
34
31
  border: none;
35
- background-color: var(--ui-separator-color);
32
+ background-color: var(--_bg-resolved, var(--ui-separator-bg));
36
33
  block-size: var(--ui-separator-thickness);
37
34
  inline-size: auto;
38
35
  flex-shrink: 0;
39
36
  }
40
37
 
41
- .ui-separator[data-orientation="vertical"] {
38
+ :where([data-ui~="separator"][data-separator-orientation="vertical"]) {
42
39
  inline-size: var(--ui-separator-thickness);
43
40
  block-size: auto;
44
41
  /* Stretches to the row height as a flex/grid item; the fallback keeps it
@@ -1,16 +1,43 @@
1
- <div class="flex flex-col gap-sm max-w-xl">
1
+ <div
2
+ style="
3
+ --display: flex-col;
4
+ --gap: 4;
5
+ --max-w: 96;
6
+ "
7
+ >
2
8
  <div>
3
- <p class="text-sm font-strong">Zazz Design Framework</p>
4
- <p class="text-sm text-muted-foreground">Web-native primitives.</p>
9
+ <p
10
+ style="
11
+ --font-size: var(--font-size-sm);
12
+ --font-weight: strong;
13
+ "
14
+ >
15
+ Zazz Design Framework
16
+ </p>
17
+ <p
18
+ style="
19
+ --font-size: var(--font-size-sm);
20
+ --text: var(--color-muted-foreground);
21
+ "
22
+ >
23
+ Web-native primitives.
24
+ </p>
5
25
  </div>
6
26
 
7
- <hr class="ui-separator" />
27
+ <hr data-ui="separator" />
8
28
 
9
- <div class="flex flex-row items-center gap-xs text-sm">
10
- <a href="#" class="ui-button" data-variant="link">Docs</a>
11
- <hr class="ui-separator" data-orientation="vertical" aria-orientation="vertical" />
12
- <a href="#" class="ui-button" data-variant="link">Components</a>
13
- <hr class="ui-separator" data-orientation="vertical" aria-orientation="vertical" />
14
- <a href="#" class="ui-button" data-variant="link">Themes</a>
29
+ <div
30
+ style="
31
+ --display: flex;
32
+ --items: center;
33
+ --gap: 2;
34
+ --font-size: var(--font-size-sm);
35
+ "
36
+ >
37
+ <a href="#" data-ui="button" data-button-variant="link">Docs</a>
38
+ <hr data-ui="separator" data-separator-orientation="vertical" aria-orientation="vertical" />
39
+ <a href="#" data-ui="button" data-button-variant="link">Components</a>
40
+ <hr data-ui="separator" data-separator-orientation="vertical" aria-orientation="vertical" />
41
+ <a href="#" data-ui="button" data-button-variant="link">Themes</a>
15
42
  </div>
16
43
  </div>
@@ -1,38 +1,44 @@
1
1
  /**
2
2
  * slider.css — Range input (input[type="range"])
3
3
  *
4
- * @layer reset
5
- * @requires layers.css, _variables.css
4
+ * @layer variables, reset
5
+ * @requires _layers.css, _variables.css
6
6
  * @uses appearance: none — redraws track + thumb from theme tokens
7
- * @tokens --ui-slider-* (track height, background, border, radius; thumb size, bg, border, radius)
7
+ * @tokens --ui-slider-* (@layer variables, on :root so subtree hooks work)
8
8
  *
9
9
  * Note: The active region is NOT filled (parity across engines); add a paint
10
10
  * via JS if a filled track is needed. The thumb is centered on the track with a
11
11
  * calc'd negative margin so retuning either size keeps it aligned.
12
12
  */
13
13
 
14
- @layer reset {
15
- :where(input[type="range"]) {
16
- --ui-slider-ring-color: var(--ring-color);
14
+ @layer variables {
15
+ :root {
16
+ --ui-slider-ring-color: var(--color-ring);
17
17
 
18
- --ui-slider-track-block-size: var(--step-1_5);
19
- --ui-slider-track-background: var(--muted);
20
- --ui-slider-track-border: 1px solid var(--muted);
21
- --ui-slider-track-radius: var(--radius-full);
22
- --ui-slider-thumb-size: var(--step-4);
23
- --ui-slider-thumb-background: var(--background);
18
+ --ui-slider-track-h: calc(var(--spacing) * 1.5);
19
+ --ui-slider-track-bg: var(--color-muted);
20
+ --ui-slider-track-border: 1px solid var(--color-muted);
21
+ --ui-slider-track-rounded: var(--radius-full);
22
+ --ui-slider-thumb-size: calc(var(--spacing) * 4);
23
+ --ui-slider-thumb-bg: var(--color-background);
24
24
 
25
25
  --ui-slider-thumb-shadow: var(--shadow-xs);
26
- --ui-slider-thumb-border: 1px solid var(--border);
27
- --ui-slider-thumb-radius: var(--radius-full);
28
- --ui-slider-thumb-offset: calc(var(--ui-slider-track-block-size) * -1);
26
+ --ui-slider-thumb-border: 1px solid var(--color-border);
27
+ --ui-slider-thumb-rounded: var(--radius-full);
28
+ }
29
+ }
30
+
31
+ @layer reset {
32
+ :where(input[type="range"]) {
33
+ /* derived on the element so a subtree --ui-slider-track-h keeps the thumb centered */
34
+ --ui-slider-thumb-offset: calc(var(--ui-slider-track-h) * -1);
29
35
 
30
36
  -webkit-appearance: none;
31
37
  appearance: none;
32
38
  inline-size: 100%;
33
39
  background: transparent;
34
40
  cursor: grab;
35
- border-radius: var(--ui-slider-track-radius);
41
+ border-radius: var(--ui-slider-track-rounded);
36
42
 
37
43
  /* transparent outline keeps focus visible in forced-colors / high-contrast
38
44
  modes; the visible focus ring lives on the thumb via --shadow-ring */
@@ -41,30 +47,31 @@
41
47
  }
42
48
 
43
49
  :where(input[type="range"])::-webkit-slider-runnable-track {
44
- block-size: var(--ui-slider-track-block-size);
50
+ block-size: var(--ui-slider-track-h);
45
51
  inline-size: 100%;
46
- background: var(--ui-slider-track-background);
52
+ background: var(--ui-slider-track-bg);
47
53
  border: var(--ui-slider-track-border);
48
- border-radius: var(--ui-slider-track-radius);
54
+ border-radius: var(--ui-slider-track-rounded);
49
55
  }
50
56
 
51
57
  :where(input[type="range"])::-moz-range-track {
52
- block-size: var(--ui-slider-track-block-size);
58
+ block-size: var(--ui-slider-track-h);
53
59
  inline-size: 100%;
54
- background: var(--ui-slider-track-background);
60
+ background: var(--ui-slider-track-bg);
55
61
  border: var(--ui-slider-track-border);
56
- border-radius: var(--ui-slider-track-radius);
62
+ border-radius: var(--ui-slider-track-rounded);
57
63
  }
58
64
 
59
65
  :where(input[type="range"])::-webkit-slider-thumb {
60
- /* ring renders as box-shadow so it composes with --ui-slider-thumb-shadow; the
61
- ring widths animate from 0 so the ring grows in smoothly on focus */
66
+ /* the ring is a box-shadow so it composes with --ui-slider-thumb-shadow;
67
+ widths animate from 0 so it grows in on focus */
62
68
  --_ring-offset-width: 0px;
63
69
  --_ring-width: 0px;
64
- --_ring: color-mix(in oklch, var(--ui-slider-ring-color) var(--ring-opacity), transparent);
70
+ --_ring-fill: color-mix(in oklch, var(--ui-slider-ring-color) var(--ring-opacity), transparent);
65
71
  box-shadow:
66
- 0 0 0 var(--_ring-offset-width) var(--ring-offset-color),
67
- 0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width)) var(--_ring, var(--ring)),
72
+ 0 0 0 var(--_ring-offset-width) var(--ring-offset-shadow-color),
73
+ 0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width))
74
+ var(--_ring-fill, var(--ring-shadow-color)),
68
75
  var(--ui-slider-thumb-shadow);
69
76
 
70
77
  -webkit-appearance: none;
@@ -72,37 +79,40 @@
72
79
  margin-block-start: var(--ui-slider-thumb-offset);
73
80
  inline-size: var(--ui-slider-thumb-size);
74
81
  block-size: var(--ui-slider-thumb-size);
75
- background-color: var(--ui-slider-thumb-background);
82
+ background-color: var(--ui-slider-thumb-bg);
76
83
  border: var(--ui-slider-thumb-border);
77
- border-radius: var(--ui-slider-thumb-radius);
84
+ border-radius: var(--ui-slider-thumb-rounded);
78
85
 
79
86
  transition: var(--default-transition);
80
87
  }
81
88
 
82
89
  :where(input[type="range"])::-moz-range-thumb {
83
- /* ring renders as box-shadow so it composes with --ui-slider-thumb-shadow; the
84
- ring widths animate from 0 so the ring grows in smoothly on focus */
90
+ /* the ring is a box-shadow so it composes with --ui-slider-thumb-shadow;
91
+ widths animate from 0 so it grows in on focus */
85
92
  --_ring-offset-width: 0px;
86
93
  --_ring-width: 0px;
87
- --_ring: color-mix(in oklch, var(--ui-slider-ring-color) var(--ring-opacity), transparent);
94
+ --_ring-fill: color-mix(in oklch, var(--ui-slider-ring-color) var(--ring-opacity), transparent);
88
95
 
89
96
  appearance: none;
90
97
  inline-size: var(--ui-slider-thumb-size);
91
98
  block-size: var(--ui-slider-thumb-size);
92
- background-color: var(--ui-slider-thumb-background);
99
+ background-color: var(--ui-slider-thumb-bg);
93
100
  border: var(--ui-slider-thumb-border);
94
- border-radius: var(--ui-slider-thumb-radius);
101
+ border-radius: var(--ui-slider-thumb-rounded);
95
102
 
96
103
  box-shadow:
97
- 0 0 0 var(--_ring-offset-width) var(--ring-offset-color),
98
- 0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width)) var(--_ring, var(--ring)),
104
+ 0 0 0 var(--_ring-offset-width) var(--ring-offset-shadow-color),
105
+ 0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width))
106
+ var(--_ring-fill, var(--ring-shadow-color)),
99
107
  var(--ui-slider-thumb-shadow);
100
108
 
101
109
  transition: var(--default-transition);
102
110
  }
103
111
 
104
- :where(input[type="range"]:hover) {
105
- --ui-slider-thumb-border: 1px solid var(--primary);
112
+ @media (hover: hover) {
113
+ :where(input[type="range"]:hover) {
114
+ --ui-slider-thumb-border: 1px solid var(--color-primary);
115
+ }
106
116
  }
107
117
 
108
118
  :where(input[type="range"]:active) {
@@ -1 +1,9 @@
1
- <input class="max-w-xl" type="range" min="0" max="100" step="10" value="50" aria-label="Volume" />
1
+ <input
2
+ type="range"
3
+ min="0"
4
+ max="100"
5
+ step="10"
6
+ value="50"
7
+ aria-label="Volume"
8
+ style="--max-w: 96"
9
+ />
@@ -0,0 +1,19 @@
1
+ type Styled = Element & ElementCSSInlineStyle;
2
+ /**
3
+ * @namespace StyleGuard
4
+ * @property {Function} start - Guards `root` (default `document.body`); idempotent for the same root, re-roots otherwise.
5
+ * @property {Function} stop - Disconnects the guard.
6
+ * @property {Function} restore - Re-applies `el`'s snapshot by hand.
7
+ */
8
+ declare const StyleGuard: {
9
+ start(root?: Element): void;
10
+ stop(): void;
11
+ restore(el: Styled): void;
12
+ };
13
+ declare global {
14
+ interface Window {
15
+ StyleGuard: typeof StyleGuard;
16
+ }
17
+ }
18
+ export { StyleGuard };
19
+ //# sourceMappingURL=style-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-guard.d.ts","sourceRoot":"","sources":["style-guard.ts"],"names":[],"mappings":"AAuBA,KAAK,MAAM,GAAG,OAAO,GAAG,qBAAqB,CAAC;AA6E9C;;;;;GAKG;AACH,QAAA,MAAM,UAAU;IACd,KAAK,QAAO,OAAO,GAAmB,IAAI;IAe1C,IAAI,IAAI,IAAI;IAKZ,OAAO,KAAK,MAAM,GAAG,IAAI;CAK1B,CAAC;AAWF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,EAAE,OAAO,UAAU,CAAC;KAC/B;CACF;AAKD,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ const snapshots = new WeakMap();
3
+ function utilitiesOf(el) {
4
+ const utilities = new Map();
5
+ const style = el.style;
6
+ for (let i = 0; i < style.length; i++) {
7
+ const name = style.item(i);
8
+ if (name.startsWith("--")) {
9
+ utilities.set(name, [style.getPropertyValue(name), style.getPropertyPriority(name)]);
10
+ }
11
+ }
12
+ return utilities;
13
+ }
14
+ /** Parses the `--` declarations out of a raw `style` attribute value. */
15
+ function utilitiesIn(text) {
16
+ const utilities = new Map();
17
+ if (!text)
18
+ return utilities;
19
+ for (const declaration of text.split(";")) {
20
+ const colon = declaration.indexOf(":");
21
+ if (colon === -1)
22
+ continue;
23
+ const name = declaration.slice(0, colon).trim();
24
+ if (!name.startsWith("--"))
25
+ continue;
26
+ let value = declaration.slice(colon + 1).trim();
27
+ let priority = "";
28
+ if (/!\s*important$/i.test(value)) {
29
+ value = value.replace(/!\s*important$/i, "").trim();
30
+ priority = "important";
31
+ }
32
+ utilities.set(name, [value, priority]);
33
+ }
34
+ return utilities;
35
+ }
36
+ /** The non-utility declarations of a `style` text, normalized, for telling a rewrite from a removal. */
37
+ function rawOf(text) {
38
+ return (text ?? "")
39
+ .split(";")
40
+ .map((declaration) => declaration.trim())
41
+ .filter((declaration) => declaration && !declaration.startsWith("--"))
42
+ .sort()
43
+ .join(";");
44
+ }
45
+ function isGuarded(el) {
46
+ return el instanceof Element && "style" in el && el.getAttribute("data-ui-guard") !== "off";
47
+ }
48
+ let observer = null;
49
+ let guardedRoot = null;
50
+ /**
51
+ * Reconciles one element after a `style` write: a write that drops every utility at
52
+ * once is restored; anything else (a targeted removal, new utilities) becomes the new
53
+ * snapshot.
54
+ */
55
+ function reconcile(el, previous, oldValue) {
56
+ const current = utilitiesOf(el);
57
+ const droppedAll = previous !== undefined && previous.size > 0 && current.size === 0;
58
+ // one utility removed on its own leaves every other declaration untouched: a choice, not a rewrite
59
+ const singleRemoval = droppedAll && previous.size === 1 && rawOf(oldValue) === rawOf(el.getAttribute("style"));
60
+ if (droppedAll && !singleRemoval) {
61
+ for (const [name, [value, priority]] of previous)
62
+ el.style.setProperty(name, value, priority);
63
+ return;
64
+ }
65
+ snapshots.set(el, current);
66
+ }
67
+ function onMutations(records) {
68
+ for (const record of records) {
69
+ const el = record.target;
70
+ if (!isGuarded(el))
71
+ continue;
72
+ reconcile(el, snapshots.get(el) ?? utilitiesIn(record.oldValue), record.oldValue);
73
+ }
74
+ }
75
+ /**
76
+ * @namespace StyleGuard
77
+ * @property {Function} start - Guards `root` (default `document.body`); idempotent for the same root, re-roots otherwise.
78
+ * @property {Function} stop - Disconnects the guard.
79
+ * @property {Function} restore - Re-applies `el`'s snapshot by hand.
80
+ */
81
+ const StyleGuard = {
82
+ start(root = document.body) {
83
+ if (observer && guardedRoot === root)
84
+ return;
85
+ if (observer)
86
+ StyleGuard.stop();
87
+ guardedRoot = root;
88
+ for (const el of root.querySelectorAll('[style*="--"]')) {
89
+ if (isGuarded(el))
90
+ snapshots.set(el, utilitiesOf(el));
91
+ }
92
+ observer = new MutationObserver(onMutations);
93
+ observer.observe(root, {
94
+ attributes: true,
95
+ attributeFilter: ["style"],
96
+ attributeOldValue: true,
97
+ subtree: true,
98
+ });
99
+ },
100
+ stop() {
101
+ observer?.disconnect();
102
+ observer = null;
103
+ guardedRoot = null;
104
+ },
105
+ restore(el) {
106
+ const previous = snapshots.get(el);
107
+ if (!previous)
108
+ return;
109
+ for (const [name, [value, priority]] of previous)
110
+ el.style.setProperty(name, value, priority);
111
+ },
112
+ };
113
+ // Auto-initialize in the browser once the DOM is ready
114
+ if (typeof window !== "undefined" && typeof document !== "undefined") {
115
+ if (document.readyState === "loading") {
116
+ document.addEventListener("DOMContentLoaded", () => StyleGuard.start());
117
+ }
118
+ else {
119
+ StyleGuard.start();
120
+ }
121
+ }
122
+ if (typeof window !== "undefined") {
123
+ window.StyleGuard = StyleGuard;
124
+ }
125
+ export { StyleGuard };
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * @fileoverview Style guard: keeps utilities alive when scripts rewrite the whole `style` attribute.
5
+ * @description Optional, production. A `MutationObserver` on `style` snapshots each
6
+ * element's `--` declarations on first sight and re-applies them only when one
7
+ * write drops every one of them at once — the `el.style.cssText = …` and
8
+ * jQuery `.attr('style', …)` signature. A single `removeProperty('--p')` is a
9
+ * choice and stays removed (with a single utility, "all" and "one" coincide: the guard
10
+ * tells them apart by whether the other declarations survived the write).
11
+ * `data-ui-guard="off"` opts an element out. A template
12
+ * that emits two `style` attributes cannot be repaired (the parser keeps the
13
+ * first); that is an authoring error.
14
+ * @example
15
+ * <script type="module" src="/zazz/primitives/style-guard/style-guard.js"></script>
16
+ * <!-- guards document.body once the DOM is ready -->
17
+ */
18
+
19
+ /** name → [value, priority] for every `--` declaration on the element. */
20
+ type Utilities = Map<string, [string, string]>;
21
+
22
+ const snapshots = new WeakMap<Element, Utilities>();
23
+
24
+ type Styled = Element & ElementCSSInlineStyle;
25
+
26
+ function utilitiesOf(el: Styled): Utilities {
27
+ const utilities: Utilities = new Map();
28
+ const style = el.style;
29
+ for (let i = 0; i < style.length; i++) {
30
+ const name = style.item(i);
31
+ if (name.startsWith("--")) {
32
+ utilities.set(name, [style.getPropertyValue(name), style.getPropertyPriority(name)]);
33
+ }
34
+ }
35
+ return utilities;
36
+ }
37
+
38
+ /** Parses the `--` declarations out of a raw `style` attribute value. */
39
+ function utilitiesIn(text: string | null): Utilities {
40
+ const utilities: Utilities = new Map();
41
+ if (!text) return utilities;
42
+ for (const declaration of text.split(";")) {
43
+ const colon = declaration.indexOf(":");
44
+ if (colon === -1) continue;
45
+ const name = declaration.slice(0, colon).trim();
46
+ if (!name.startsWith("--")) continue;
47
+ let value = declaration.slice(colon + 1).trim();
48
+ let priority = "";
49
+ if (/!\s*important$/i.test(value)) {
50
+ value = value.replace(/!\s*important$/i, "").trim();
51
+ priority = "important";
52
+ }
53
+ utilities.set(name, [value, priority]);
54
+ }
55
+ return utilities;
56
+ }
57
+
58
+ /** The non-utility declarations of a `style` text, normalized, for telling a rewrite from a removal. */
59
+ function rawOf(text: string | null): string {
60
+ return (text ?? "")
61
+ .split(";")
62
+ .map((declaration) => declaration.trim())
63
+ .filter((declaration) => declaration && !declaration.startsWith("--"))
64
+ .sort()
65
+ .join(";");
66
+ }
67
+
68
+ function isGuarded(el: Node): el is Styled {
69
+ return el instanceof Element && "style" in el && el.getAttribute("data-ui-guard") !== "off";
70
+ }
71
+
72
+ let observer: MutationObserver | null = null;
73
+ let guardedRoot: Element | null = null;
74
+
75
+ /**
76
+ * Reconciles one element after a `style` write: a write that drops every utility at
77
+ * once is restored; anything else (a targeted removal, new utilities) becomes the new
78
+ * snapshot.
79
+ */
80
+ function reconcile(el: Styled, previous: Utilities | undefined, oldValue: string | null): void {
81
+ const current = utilitiesOf(el);
82
+ const droppedAll = previous !== undefined && previous.size > 0 && current.size === 0;
83
+ // one utility removed on its own leaves every other declaration untouched: a choice, not a rewrite
84
+ const singleRemoval =
85
+ droppedAll && previous.size === 1 && rawOf(oldValue) === rawOf(el.getAttribute("style"));
86
+ if (droppedAll && !singleRemoval) {
87
+ for (const [name, [value, priority]] of previous) el.style.setProperty(name, value, priority);
88
+ return;
89
+ }
90
+ snapshots.set(el, current);
91
+ }
92
+
93
+ function onMutations(records: MutationRecord[]): void {
94
+ for (const record of records) {
95
+ const el = record.target;
96
+ if (!isGuarded(el)) continue;
97
+ reconcile(el, snapshots.get(el) ?? utilitiesIn(record.oldValue), record.oldValue);
98
+ }
99
+ }
100
+
101
+ /**
102
+ * @namespace StyleGuard
103
+ * @property {Function} start - Guards `root` (default `document.body`); idempotent for the same root, re-roots otherwise.
104
+ * @property {Function} stop - Disconnects the guard.
105
+ * @property {Function} restore - Re-applies `el`'s snapshot by hand.
106
+ */
107
+ const StyleGuard = {
108
+ start(root: Element = document.body): void {
109
+ if (observer && guardedRoot === root) return;
110
+ if (observer) StyleGuard.stop();
111
+ guardedRoot = root;
112
+ for (const el of root.querySelectorAll('[style*="--"]')) {
113
+ if (isGuarded(el)) snapshots.set(el, utilitiesOf(el));
114
+ }
115
+ observer = new MutationObserver(onMutations);
116
+ observer.observe(root, {
117
+ attributes: true,
118
+ attributeFilter: ["style"],
119
+ attributeOldValue: true,
120
+ subtree: true,
121
+ });
122
+ },
123
+ stop(): void {
124
+ observer?.disconnect();
125
+ observer = null;
126
+ guardedRoot = null;
127
+ },
128
+ restore(el: Styled): void {
129
+ const previous = snapshots.get(el);
130
+ if (!previous) return;
131
+ for (const [name, [value, priority]] of previous) el.style.setProperty(name, value, priority);
132
+ },
133
+ };
134
+
135
+ // Auto-initialize in the browser once the DOM is ready
136
+ if (typeof window !== "undefined" && typeof document !== "undefined") {
137
+ if (document.readyState === "loading") {
138
+ document.addEventListener("DOMContentLoaded", () => StyleGuard.start());
139
+ } else {
140
+ StyleGuard.start();
141
+ }
142
+ }
143
+
144
+ declare global {
145
+ interface Window {
146
+ StyleGuard: typeof StyleGuard;
147
+ }
148
+ }
149
+ if (typeof window !== "undefined") {
150
+ window.StyleGuard = StyleGuard;
151
+ }
152
+
153
+ export { StyleGuard };