@zazz-ui/core 0.4.1 → 0.5.1

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 +345 -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 +61 -31
  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 +76 -26
  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
@@ -54,42 +54,35 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
54
54
  /**
55
55
  * @fileoverview `<ui-toaster>`: HTML web component for stacked toast notifications.
56
56
  * @description Light-DOM custom element that hosts a top-layer toast stack, plus
57
- * the `window.Toaster` imperative API. The stacking model (newest toast in front,
58
- * older toasts peeking behind, expand on hover, timer pause on hover/hidden tab)
59
- * is adapted from Sonner by Emil Kowalski (https://sonner.emilkowal.ski, MIT).
57
+ * the `window.Toaster` imperative API. Timers pause on hover and in hidden tabs.
60
58
  *
61
59
  * The region is a `popover="manual"` element: it enters the top layer via
62
60
  * `showPopover()` when the first toast arrives and leaves it after the last
63
61
  * toast's exit transition. Toasts are plain `<li>` children, so the collapsed
64
- * stack offsets in `_toaster.css` work with normal CSS transforms.
62
+ * stack offsets in `toaster.css` work with normal CSS transforms.
65
63
  *
66
64
  * Fire toasts two ways:
67
65
  * - Declaratively, from any button, via a custom Invoker Command:
68
66
  * `command="--toast"` (or `--toast-success|info|warning|destructive`) with
69
67
  * `commandfor="<region id>"`. Toast content comes from the button's
70
- * `data-title`, `data-description`, `data-variant`, `data-duration`, and
71
- * `data-close-button` attributes.
68
+ * `data-toaster-title`, `data-toaster-description`, `data-toaster-variant`,
69
+ * `data-toaster-duration`, and `data-toaster-close-button` attributes.
72
70
  * - Imperatively: `window.Toaster.toast({ title, description, variant, … })`
73
71
  * and the `.success()/.info()/.warning()/.error()` shorthands.
74
72
  *
75
73
  * Region attributes:
76
- * - `data-position`: `top-start | top-center | top-end | bottom-start |
74
+ * - `data-toaster-position`: `top-start | top-center | top-end | bottom-start |
77
75
  * bottom-center | bottom-end` (logical; default `bottom-end`).
78
76
  *
79
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Popover_API
80
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API
81
- *
82
77
  * @example
83
- * <ui-toaster class="ui-toaster" id="toaster" popover="manual"></ui-toaster>
84
- * <button commandfor="toaster" command="--toast" data-title="Saved">Save</button>
78
+ * <ui-toaster id="toaster" popover="manual"></ui-toaster>
79
+ * <button commandfor="toaster" command="--toast" data-toaster-title="Saved">Save</button>
85
80
  */
86
81
  import { computed, effect, state } from "../../base/signals.js";
87
82
  import { ZazzElement, defineZazzElement } from "../../base/zazz-element.js";
88
- // `using` compiles (target ES2022) to try/finally helpers that read this
89
- // well-known symbol at runtime; engines without native Explicit Resource
90
- // Management (Safari) don't define it, so give them a local stand-in.
83
+ // compiled `using` reads Symbol.dispose, which engines without native Explicit
84
+ // Resource Management (Safari) lack
91
85
  Symbol.dispose ??= Symbol("Symbol.dispose");
92
- // --- Constants ---
93
86
  /** Default toast lifetime in milliseconds. */
94
87
  const TOAST_LIFETIME = 4000;
95
88
  /** Maximum number of toasts shown in the collapsed stack. */
@@ -97,7 +90,6 @@ const VISIBLE_TOASTS = 3;
97
90
  /** Safety net for node removal when no exit `transitionend` fires. */
98
91
  const EXIT_FALLBACK_MS = 600;
99
92
  const VARIANTS = ["success", "info", "warning", "destructive"];
100
- // --- Icons (adapted from Sonner's assets.tsx (MIT, Emil Kowalski)) ---
101
93
  const ICONS = {
102
94
  success: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/></svg>',
103
95
  info: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"/></svg>',
@@ -105,7 +97,6 @@ const ICONS = {
105
97
  destructive: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"/></svg>',
106
98
  close: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',
107
99
  };
108
- // --- Measurement ---
109
100
  /**
110
101
  * @description Unclamps every toast's block-size for a batch measurement (the
111
102
  * inline style beats the collapsed block-size rule) and returns a disposer
@@ -126,7 +117,6 @@ function unclampForMeasure(toasts) {
126
117
  },
127
118
  };
128
119
  }
129
- // --- Stack math (pure) ---
130
120
  /**
131
121
  * @description Computes the collapsed-stack placement for every toast from the
132
122
  * measured heights alone (oldest first, matching DOM order). Pure: the
@@ -153,13 +143,28 @@ function computeStackLayout(heights) {
153
143
  }
154
144
  return { toasts, frontToastHeightPx: count > 0 ? heights[count - 1] : null };
155
145
  }
156
- // --- <ui-toaster> element ---
157
146
  /**
158
147
  * @class
159
148
  * @description Hosts the toast stack: builds toast markup, maintains the
160
149
  * collapsed-stack CSS custom properties, runs auto-dismiss timers, and shows or
161
150
  * hides the `popover="manual"` region as toasts come and go.
162
151
  */
152
+ /**
153
+ * @description Adds or removes one token of an element's `data-toaster-state`
154
+ * list: `expanded` on the region; `front`, `visible`, `removed` on a toast.
155
+ */
156
+ function setToasterState(node, token, on) {
157
+ const tokens = (node.getAttribute("data-toaster-state") ?? "").split(/\s+/).filter(Boolean);
158
+ const next = on ? [...new Set([...tokens, token])] : tokens.filter((t) => t !== token);
159
+ if (next.length)
160
+ node.setAttribute("data-toaster-state", next.join(" "));
161
+ else
162
+ node.removeAttribute("data-toaster-state");
163
+ }
164
+ /** @description Whether a toast has been dismissed and is animating out. */
165
+ function isRemoved(toast) {
166
+ return toast.matches('[data-toaster-state~="removed"]');
167
+ }
163
168
  class UiToaster extends ZazzElement {
164
169
  #timers = new Map();
165
170
  #counter = 0;
@@ -189,9 +194,9 @@ class UiToaster extends ZazzElement {
189
194
  if (!this.hasAttribute("tabindex"))
190
195
  this.setAttribute("tabindex", "-1");
191
196
  // The live region must exist before toasts are inserted so additions announce.
192
- if (!this.querySelector('[data-slot~="toaster-list"]')) {
197
+ if (!this.querySelector('[data-toaster-slot~="list"]')) {
193
198
  const list = document.createElement("ol");
194
- list.setAttribute("data-slot", "toaster-list");
199
+ list.setAttribute("data-toaster-slot", "list");
195
200
  list.setAttribute("aria-live", "polite");
196
201
  list.setAttribute("aria-relevant", "additions text");
197
202
  list.setAttribute("aria-atomic", "false");
@@ -218,7 +223,7 @@ class UiToaster extends ZazzElement {
218
223
  // one owns the expanded attribute, one owns pausing/resuming the timers,
219
224
  // one writes the computed stack placement to the DOM.
220
225
  effect(() => {
221
- this.dataset.expanded = String(this.#expanded.get());
226
+ setToasterState(this, "expanded", this.#expanded.get());
222
227
  }, { signal });
223
228
  effect(() => {
224
229
  if (this.#paused.get()) {
@@ -234,8 +239,8 @@ class UiToaster extends ZazzElement {
234
239
  for (let i = 0; i < entries.length; i++) {
235
240
  const { node, height } = entries[i];
236
241
  const layout = toasts[i];
237
- node.dataset.front = String(layout.front);
238
- node.dataset.visible = String(layout.visible);
242
+ setToasterState(node, "front", layout.front);
243
+ setToasterState(node, "visible", layout.visible);
239
244
  node.style.zIndex = String(layout.zIndex);
240
245
  node.style.setProperty("--toasts-before", String(layout.stackIndex));
241
246
  node.style.setProperty("--initial-height", `${height}px`);
@@ -253,7 +258,6 @@ class UiToaster extends ZazzElement {
253
258
  clearTimeout(timer.timeoutId);
254
259
  this.#timers.clear();
255
260
  }
256
- // --- Public API ---
257
261
  /**
258
262
  * @description Adds a toast to this region and shows the region if needed.
259
263
  *
@@ -281,14 +285,14 @@ class UiToaster extends ZazzElement {
281
285
  this.dismissAll();
282
286
  return;
283
287
  }
284
- const toast = this.#list().querySelector(`[data-toast-id="${CSS.escape(id)}"]`);
285
- if (!(toast instanceof HTMLElement) || toast.dataset.removed === "true")
288
+ const toast = this.#list().querySelector(`[data-toaster-id="${CSS.escape(id)}"]`);
289
+ if (!(toast instanceof HTMLElement) || isRemoved(toast))
286
290
  return;
287
291
  const timer = this.#timers.get(id);
288
292
  if (timer)
289
293
  clearTimeout(timer.timeoutId);
290
294
  this.#timers.delete(id);
291
- toast.dataset.removed = "true";
295
+ setToasterState(toast, "removed", true);
292
296
  // Keyboard users keep their place: hand focus to the next toast before this
293
297
  // one goes. A mouse click's incidental focus is left to drop to <body>;
294
298
  // holding it would pin the stack expanded after the pointer leaves, and
@@ -298,7 +302,7 @@ class UiToaster extends ZazzElement {
298
302
  toast.contains(active) &&
299
303
  active.matches(":focus-visible")) {
300
304
  this.#toasts()
301
- .filter((t) => t.dataset.removed !== "true")
305
+ .filter((t) => !isRemoved(t))
302
306
  .at(-1)
303
307
  ?.focus({ preventScroll: true });
304
308
  }
@@ -310,16 +314,15 @@ class UiToaster extends ZazzElement {
310
314
  */
311
315
  dismissAll() {
312
316
  for (const toast of this.#toasts()) {
313
- const toastId = toast.dataset.toastId;
317
+ const toastId = toast.dataset.toasterId;
314
318
  if (toastId)
315
319
  this.dismiss(toastId);
316
320
  }
317
321
  }
318
- // --- Invoker Commands ---
319
322
  /**
320
323
  * @description Handles the custom `--toast` Invoker Command fired by buttons
321
324
  * with `commandfor` pointing at this region. `--toast-success` (etc.) sets the
322
- * variant; everything else comes from the invoker's `data-*` attributes.
325
+ * variant; everything else comes from the invoker's `data-toaster-*` attributes.
323
326
  *
324
327
  * @param event - The command event.
325
328
  */
@@ -344,7 +347,7 @@ class UiToaster extends ZazzElement {
344
347
  options.variant = suffix;
345
348
  }
346
349
  if (source instanceof HTMLElement) {
347
- const { title, description, variant, duration, closeButton } = source.dataset;
350
+ const { toasterTitle: title, toasterDescription: description, toasterVariant: variant, toasterDuration: duration, toasterCloseButton: closeButton, } = source.dataset;
348
351
  if (title)
349
352
  options.title = title;
350
353
  if (description)
@@ -367,7 +370,6 @@ class UiToaster extends ZazzElement {
367
370
  }
368
371
  this.addToast(options);
369
372
  }
370
- // --- Toast construction ---
371
373
  /**
372
374
  * @description Builds a toast `<li>`: status icon, title/description, and the
373
375
  * optional action and close buttons. Text is set via `textContent`.
@@ -378,29 +380,29 @@ class UiToaster extends ZazzElement {
378
380
  */
379
381
  #buildToast(options, id) {
380
382
  const toast = document.createElement("li");
381
- toast.setAttribute("data-slot", "toaster-toast");
382
- toast.dataset.toastId = id;
383
+ toast.setAttribute("data-toaster-slot", "toast");
384
+ toast.dataset.toasterId = id;
383
385
  toast.tabIndex = 0;
384
386
  if (options.variant)
385
- toast.dataset.variant = options.variant;
387
+ toast.dataset.toasterVariant = options.variant;
386
388
  if (options.variant) {
387
389
  const icon = document.createElement("span");
388
- icon.setAttribute("data-slot", "toaster-icon");
390
+ icon.setAttribute("data-toaster-slot", "icon");
389
391
  icon.setAttribute("aria-hidden", "true");
390
392
  icon.innerHTML = ICONS[options.variant];
391
393
  toast.append(icon);
392
394
  }
393
395
  const content = document.createElement("div");
394
- content.setAttribute("data-slot", "toaster-content");
396
+ content.setAttribute("data-toaster-slot", "content");
395
397
  if (options.title) {
396
398
  const title = document.createElement("div");
397
- title.setAttribute("data-slot", "toaster-title");
399
+ title.setAttribute("data-toaster-slot", "title");
398
400
  title.textContent = options.title;
399
401
  content.append(title);
400
402
  }
401
403
  if (options.description) {
402
404
  const description = document.createElement("div");
403
- description.setAttribute("data-slot", "toaster-description");
405
+ description.setAttribute("data-toaster-slot", "description");
404
406
  description.textContent = options.description;
405
407
  content.append(description);
406
408
  }
@@ -409,9 +411,9 @@ class UiToaster extends ZazzElement {
409
411
  if (action) {
410
412
  const button = document.createElement("button");
411
413
  button.type = "button";
412
- button.className = "ui-button";
413
- button.setAttribute("data-slot", "toaster-action");
414
- button.dataset.size = "sm";
414
+ button.dataset.ui = "button";
415
+ button.setAttribute("data-toaster-slot", "action");
416
+ button.dataset.buttonSize = "sm";
415
417
  button.textContent = action.label;
416
418
  button.addEventListener("click", (event) => {
417
419
  action.onClick?.(event);
@@ -423,10 +425,10 @@ class UiToaster extends ZazzElement {
423
425
  if (options.closeButton !== false) {
424
426
  const close = document.createElement("button");
425
427
  close.type = "button";
426
- close.className = "ui-button";
427
- close.setAttribute("data-slot", "toaster-close");
428
- close.dataset.variant = "ghost";
429
- close.dataset.size = "icon-sm";
428
+ close.dataset.ui = "button";
429
+ close.setAttribute("data-toaster-slot", "close");
430
+ close.dataset.buttonVariant = "ghost";
431
+ close.dataset.buttonSize = "icon-sm";
430
432
  close.setAttribute("aria-label", "Close notification");
431
433
  close.innerHTML = ICONS.close;
432
434
  close.addEventListener("click", () => this.dismiss(id));
@@ -434,21 +436,20 @@ class UiToaster extends ZazzElement {
434
436
  }
435
437
  return toast;
436
438
  }
437
- // --- Stack math ---
438
439
  /**
439
440
  * @description Remeasures the stack: the measure half of the stacking
440
441
  * model. Batch-reads every live toast's natural height and writes the
441
442
  * result into `#stack`; `#layout` derives the placement purely
442
443
  * (`computeStackLayout`) and the stack effect writes the CSS custom
443
- * properties `_toaster.css` reads (`--toasts-before`, `--offset`,
444
- * `--initial-height`, `--front-toast-height`) plus `data-front`,
445
- * `data-visible`, and z-index. DOM order is chronological; the last child
444
+ * properties `toaster.css` reads (`--toasts-before`, `--offset`,
445
+ * `--initial-height`, `--front-toast-height`) plus `data-toaster-state~="front"`,
446
+ * `data-toaster-state~="visible"`, and z-index. DOM order is chronological; the last child
446
447
  * is the front (newest) toast.
447
448
  */
448
449
  #reindex() {
449
450
  const env_1 = { stack: [], error: void 0, hasError: false };
450
451
  try {
451
- const toasts = this.#toasts().filter((toast) => toast.dataset.removed !== "true");
452
+ const toasts = this.#toasts().filter((toast) => !isRemoved(toast));
452
453
  // Batch-measure with heights unclamped, restored at scope exit: one
453
454
  // layout pass, no visible change (the stack effect is microtask-batched,
454
455
  // so its DOM writes land after the restore).
@@ -468,10 +469,10 @@ class UiToaster extends ZazzElement {
468
469
  * @returns The toast list (created in `connectedCallback`).
469
470
  */
470
471
  #list() {
471
- let list = this.querySelector('[data-slot~="toaster-list"]');
472
+ let list = this.querySelector('[data-toaster-slot~="list"]');
472
473
  if (!(list instanceof HTMLOListElement)) {
473
474
  list = document.createElement("ol");
474
- list.setAttribute("data-slot", "toaster-list");
475
+ list.setAttribute("data-toaster-slot", "list");
475
476
  this.append(list);
476
477
  }
477
478
  return list;
@@ -482,12 +483,11 @@ class UiToaster extends ZazzElement {
482
483
  #toasts() {
483
484
  return Array.from(this.#list().children)
484
485
  .filter((child) => child instanceof HTMLElement)
485
- .filter((child) => child.matches('[data-slot~="toaster-toast"]'));
486
+ .filter((child) => child.matches('[data-toaster-slot~="toast"]'));
486
487
  }
487
- // --- Expand / collapse ---
488
488
  /**
489
489
  * @description Expands or collapses the stack by writing the signal state.
490
- * The attribute write and the timer pause/resume (matching Sonner) are owned
490
+ * The attribute write and the timer pause/resume are owned
491
491
  * by the effects in `connectedCallback`: no caller has to remember them.
492
492
  *
493
493
  * @param expanded - Whether the stack is expanded.
@@ -512,7 +512,6 @@ class UiToaster extends ZazzElement {
512
512
  this.#setExpanded(false);
513
513
  }, 100);
514
514
  }
515
- // --- Timers ---
516
515
  /**
517
516
  * @description Registers a toast's auto-dismiss timer and schedules it unless
518
517
  * the stack is currently paused (expanded or hidden tab).
@@ -561,7 +560,6 @@ class UiToaster extends ZazzElement {
561
560
  this.#schedule(id, timer);
562
561
  }
563
562
  }
564
- // --- Region show/hide ---
565
563
  /**
566
564
  * @description Puts the region on the top layer if it isn't already.
567
565
  */
@@ -571,8 +569,7 @@ class UiToaster extends ZazzElement {
571
569
  this.showPopover();
572
570
  }
573
571
  catch {
574
- // Older engines without the Popover API: the region stays a fixed-position
575
- // element, which still renders (just not on the top layer).
572
+ // without the Popover API the region stays a fixed-position element
576
573
  }
577
574
  }
578
575
  /**
@@ -591,7 +588,7 @@ class UiToaster extends ZazzElement {
591
588
  * @description Removes a dismissed toast after its exit transition (with a
592
589
  * timeout safety net), then hides the region once the stack is empty.
593
590
  *
594
- * @param toast - The toast marked `data-removed="true"`.
591
+ * @param toast - The toast marked `data-toaster-state~="removed"`.
595
592
  */
596
593
  #finalizeRemoval(toast) {
597
594
  let done = false;
@@ -618,7 +615,6 @@ class UiToaster extends ZazzElement {
618
615
  window.setTimeout(remove, Math.max(EXIT_FALLBACK_MS, duration * 1000 + 100));
619
616
  }
620
617
  }
621
- // --- Imperative API ---
622
618
  /**
623
619
  * @description Resolves a target region from an id, element, or the document.
624
620
  *
@@ -631,10 +627,10 @@ function resolveRegion(region) {
631
627
  ? region
632
628
  : typeof region === "string"
633
629
  ? document.getElementById(region)
634
- : document.querySelector("ui-toaster");
630
+ : document.querySelector('ui-toaster, [data-ui~="toaster"]');
635
631
  if (node instanceof UiToaster)
636
632
  return node;
637
- console.warn('Toaster: no <ui-toaster> found. Add `<ui-toaster class="ui-toaster" popover="manual"></ui-toaster>` to the page.');
633
+ console.warn('Toaster: no <ui-toaster> found. Add `<ui-toaster popover="manual"></ui-toaster>` to the page.');
638
634
  return null;
639
635
  }
640
636
  /**
@@ -719,18 +715,14 @@ const Toaster = {
719
715
  * @param id - Toast id returned by `toast()`.
720
716
  */
721
717
  dismiss(id) {
722
- for (const region of document.querySelectorAll("ui-toaster")) {
718
+ for (const region of document.querySelectorAll('ui-toaster, [data-ui~="toaster"]')) {
723
719
  if (region instanceof UiToaster)
724
720
  region.dismiss(id);
725
721
  }
726
722
  },
727
723
  };
728
724
  defineZazzElement("ui-toaster", UiToaster);
729
- // Attach the imperative toast API to window (the documented public surface app
730
- // authors call), then export for module consumers.
731
725
  if (typeof window !== "undefined") {
732
726
  window.Toaster = Toaster;
733
727
  }
734
- // computeStackLayout is exported for unit tests only; not part of the
735
- // documented public API (window.Toaster is the surface app authors use).
736
728
  export { Toaster, UiToaster, computeStackLayout };