@funstack/ui 0.1.0-alpha.11 → 0.1.0-alpha.13

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 (416) hide show
  1. package/dist/accordion/accordion-context.mjs.map +1 -1
  2. package/dist/accordion/accordion-item.d.mts +3 -4
  3. package/dist/accordion/accordion-item.d.mts.map +1 -1
  4. package/dist/accordion/accordion-item.mjs +10 -4
  5. package/dist/accordion/accordion-item.mjs.map +1 -1
  6. package/dist/accordion/accordion-panel.d.mts +3 -4
  7. package/dist/accordion/accordion-panel.d.mts.map +1 -1
  8. package/dist/accordion/accordion-panel.mjs +2 -1
  9. package/dist/accordion/accordion-panel.mjs.map +1 -1
  10. package/dist/accordion/accordion-root.d.mts +3 -3
  11. package/dist/accordion/accordion-root.d.mts.map +1 -1
  12. package/dist/accordion/accordion-root.mjs +8 -19
  13. package/dist/accordion/accordion-root.mjs.map +1 -1
  14. package/dist/accordion/accordion-trigger.d.mts +3 -4
  15. package/dist/accordion/accordion-trigger.d.mts.map +1 -1
  16. package/dist/accordion/accordion-trigger.mjs +5 -3
  17. package/dist/accordion/accordion-trigger.mjs.map +1 -1
  18. package/dist/button/button.d.mts +4 -2
  19. package/dist/button/button.d.mts.map +1 -1
  20. package/dist/button/button.mjs +3 -2
  21. package/dist/button/button.mjs.map +1 -1
  22. package/dist/checkbox/checkbox.d.mts +4 -5
  23. package/dist/checkbox/checkbox.d.mts.map +1 -1
  24. package/dist/checkbox/checkbox.mjs +16 -59
  25. package/dist/checkbox/checkbox.mjs.map +1 -1
  26. package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -1
  27. package/dist/checkbox-group/checkbox-group-item.d.mts +3 -4
  28. package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
  29. package/dist/checkbox-group/checkbox-group-item.mjs +21 -27
  30. package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
  31. package/dist/checkbox-group/checkbox-group-label.mjs +1 -6
  32. package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
  33. package/dist/checkbox-group/checkbox-group-parent.d.mts +3 -4
  34. package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
  35. package/dist/checkbox-group/checkbox-group-parent.mjs +12 -10
  36. package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
  37. package/dist/checkbox-group/checkbox-group-root.d.mts +1 -1
  38. package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
  39. package/dist/checkbox-group/checkbox-group-root.mjs +74 -101
  40. package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
  41. package/dist/combobox/combobox-clear.d.mts.map +1 -1
  42. package/dist/combobox/combobox-clear.mjs +5 -6
  43. package/dist/combobox/combobox-clear.mjs.map +1 -1
  44. package/dist/combobox/combobox-context.mjs.map +1 -1
  45. package/dist/combobox/combobox-group.d.mts.map +1 -1
  46. package/dist/combobox/combobox-group.mjs +2 -1
  47. package/dist/combobox/combobox-group.mjs.map +1 -1
  48. package/dist/combobox/combobox-input.d.mts +6 -5
  49. package/dist/combobox/combobox-input.d.mts.map +1 -1
  50. package/dist/combobox/combobox-input.mjs +29 -14
  51. package/dist/combobox/combobox-input.mjs.map +1 -1
  52. package/dist/combobox/combobox-list.d.mts.map +1 -1
  53. package/dist/combobox/combobox-list.mjs +6 -10
  54. package/dist/combobox/combobox-list.mjs.map +1 -1
  55. package/dist/combobox/combobox-option.d.mts.map +1 -1
  56. package/dist/combobox/combobox-option.mjs +2 -1
  57. package/dist/combobox/combobox-option.mjs.map +1 -1
  58. package/dist/combobox/combobox-popup.d.mts.map +1 -1
  59. package/dist/combobox/combobox-popup.mjs +9 -25
  60. package/dist/combobox/combobox-popup.mjs.map +1 -1
  61. package/dist/combobox/combobox-root.d.mts.map +1 -1
  62. package/dist/combobox/combobox-root.mjs +101 -106
  63. package/dist/combobox/combobox-root.mjs.map +1 -1
  64. package/dist/combobox/combobox-trigger.d.mts +9 -6
  65. package/dist/combobox/combobox-trigger.d.mts.map +1 -1
  66. package/dist/combobox/combobox-trigger.mjs +36 -43
  67. package/dist/combobox/combobox-trigger.mjs.map +1 -1
  68. package/dist/combobox/index.mjs +1 -1
  69. package/dist/combobox/use-combobox-form.mjs +56 -0
  70. package/dist/combobox/use-combobox-form.mjs.map +1 -0
  71. package/dist/combobox/use-option-registry.mjs +62 -0
  72. package/dist/combobox/use-option-registry.mjs.map +1 -0
  73. package/dist/dialog/dialog-close.d.mts.map +1 -1
  74. package/dist/dialog/dialog-close.mjs +29 -62
  75. package/dist/dialog/dialog-close.mjs.map +1 -1
  76. package/dist/dialog/dialog-context.mjs.map +1 -1
  77. package/dist/dialog/dialog-form.d.mts.map +1 -1
  78. package/dist/dialog/dialog-form.mjs +5 -4
  79. package/dist/dialog/dialog-form.mjs.map +1 -1
  80. package/dist/dialog/dialog-popup.d.mts +5 -5
  81. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  82. package/dist/dialog/dialog-popup.mjs +39 -103
  83. package/dist/dialog/dialog-popup.mjs.map +1 -1
  84. package/dist/dialog/dialog-root.d.mts.map +1 -1
  85. package/dist/dialog/dialog-root.mjs +30 -118
  86. package/dist/dialog/dialog-root.mjs.map +1 -1
  87. package/dist/dialog/dialog-trigger.d.mts +2 -1
  88. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  89. package/dist/dialog/dialog-trigger.mjs +27 -23
  90. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  91. package/dist/field/field-control.mjs +6 -13
  92. package/dist/field/field-control.mjs.map +1 -1
  93. package/dist/field/field-description.d.mts.map +1 -1
  94. package/dist/field/field-description.mjs +1 -2
  95. package/dist/field/field-description.mjs.map +1 -1
  96. package/dist/field/field-error.d.mts.map +1 -1
  97. package/dist/field/field-error.mjs +1 -2
  98. package/dist/field/field-error.mjs.map +1 -1
  99. package/dist/field/field-label.d.mts.map +1 -1
  100. package/dist/field/field-label.mjs +3 -11
  101. package/dist/field/field-label.mjs.map +1 -1
  102. package/dist/field/field-root.mjs +22 -42
  103. package/dist/field/field-root.mjs.map +1 -1
  104. package/dist/field/index.mjs +1 -1
  105. package/dist/field/use-server-error-visibility.mjs +44 -0
  106. package/dist/field/use-server-error-visibility.mjs.map +1 -0
  107. package/dist/form/form-root.d.mts.map +1 -1
  108. package/dist/form/form-root.mjs +6 -7
  109. package/dist/form/form-root.mjs.map +1 -1
  110. package/dist/form/form-submit.d.mts +1 -1
  111. package/dist/form/form-submit.mjs +4 -10
  112. package/dist/form/form-submit.mjs.map +1 -1
  113. package/dist/index.d.mts +2 -2
  114. package/dist/internal/anchor-position.mjs +1 -59
  115. package/dist/internal/anchor-position.mjs.map +1 -1
  116. package/dist/internal/announce.mjs +4 -42
  117. package/dist/internal/announce.mjs.map +1 -1
  118. package/dist/internal/arrow-keys.mjs +21 -0
  119. package/dist/internal/arrow-keys.mjs.map +1 -0
  120. package/dist/internal/decimal.mjs +7 -1
  121. package/dist/internal/decimal.mjs.map +1 -1
  122. package/dist/internal/dom-order.mjs +17 -0
  123. package/dist/internal/dom-order.mjs.map +1 -0
  124. package/dist/internal/field-context.d.mts.map +1 -1
  125. package/dist/internal/field-context.mjs +11 -1
  126. package/dist/internal/field-context.mjs.map +1 -1
  127. package/dist/internal/focus-first-invalid.mjs +16 -7
  128. package/dist/internal/focus-first-invalid.mjs.map +1 -1
  129. package/dist/internal/group-member.mjs +37 -0
  130. package/dist/internal/group-member.mjs.map +1 -0
  131. package/dist/internal/overlay-popup.mjs +103 -0
  132. package/dist/internal/overlay-popup.mjs.map +1 -0
  133. package/dist/internal/pointer-capture.mjs +20 -0
  134. package/dist/internal/pointer-capture.mjs.map +1 -0
  135. package/dist/internal/popover-open.mjs +18 -0
  136. package/dist/internal/popover-open.mjs.map +1 -0
  137. package/dist/internal/render-element.d.mts +2 -0
  138. package/dist/internal/render-element.mjs +20 -2
  139. package/dist/internal/render-element.mjs.map +1 -1
  140. package/dist/internal/shipped-styles.mjs +14 -0
  141. package/dist/internal/shipped-styles.mjs.map +1 -0
  142. package/dist/internal/sync-presence.mjs +5 -1
  143. package/dist/internal/sync-presence.mjs.map +1 -1
  144. package/dist/internal/toolbar-context.mjs.map +1 -1
  145. package/dist/internal/tooltip-warm.mjs +1 -1
  146. package/dist/internal/tooltip-warm.mjs.map +1 -1
  147. package/dist/internal/transition-boundary.mjs +1 -1
  148. package/dist/internal/transition-boundary.mjs.map +1 -1
  149. package/dist/internal/trigger-ref.mjs +26 -0
  150. package/dist/internal/trigger-ref.mjs.map +1 -0
  151. package/dist/internal/types.d.mts +2 -0
  152. package/dist/internal/types.d.mts.map +1 -1
  153. package/dist/internal/use-action-trigger.mjs +5 -23
  154. package/dist/internal/use-action-trigger.mjs.map +1 -1
  155. package/dist/internal/use-checkable-input.mjs +79 -0
  156. package/dist/internal/use-checkable-input.mjs.map +1 -0
  157. package/dist/internal/use-controllable-action.mjs +16 -24
  158. package/dist/internal/use-controllable-action.mjs.map +1 -1
  159. package/dist/internal/use-dev-warning.mjs +8 -4
  160. package/dist/internal/use-dev-warning.mjs.map +1 -1
  161. package/dist/internal/use-element-check.mjs +39 -0
  162. package/dist/internal/use-element-check.mjs.map +1 -0
  163. package/dist/internal/use-exit-animation.mjs +1 -1
  164. package/dist/internal/use-exit-animation.mjs.map +1 -1
  165. package/dist/internal/use-field-control.mjs +28 -12
  166. package/dist/internal/use-field-control.mjs.map +1 -1
  167. package/dist/internal/use-fieldset-group.mjs +46 -0
  168. package/dist/internal/use-fieldset-group.mjs.map +1 -0
  169. package/dist/internal/use-form-reset.mjs +1 -5
  170. package/dist/internal/use-form-reset.mjs.map +1 -1
  171. package/dist/internal/use-item-order.mjs +42 -0
  172. package/dist/internal/use-item-order.mjs.map +1 -0
  173. package/dist/internal/use-latest.mjs +4 -8
  174. package/dist/internal/use-latest.mjs.map +1 -1
  175. package/dist/internal/use-merged-refs.mjs +19 -0
  176. package/dist/internal/use-merged-refs.mjs.map +1 -0
  177. package/dist/internal/use-name-warning.mjs +84 -0
  178. package/dist/internal/use-name-warning.mjs.map +1 -0
  179. package/dist/internal/use-native-checked.mjs +4 -6
  180. package/dist/internal/use-native-checked.mjs.map +1 -1
  181. package/dist/internal/use-native-focusgroup.mjs +19 -0
  182. package/dist/internal/use-native-focusgroup.mjs.map +1 -0
  183. package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
  184. package/dist/internal/use-overlay-close.mjs +63 -0
  185. package/dist/internal/use-overlay-close.mjs.map +1 -0
  186. package/dist/internal/{use-popover-root.mjs → use-overlay-root.mjs} +32 -39
  187. package/dist/internal/use-overlay-root.mjs.map +1 -0
  188. package/dist/internal/use-popover-popup.mjs +38 -80
  189. package/dist/internal/use-popover-popup.mjs.map +1 -1
  190. package/dist/internal/use-popover-trigger.d.mts +15 -0
  191. package/dist/internal/use-popover-trigger.d.mts.map +1 -0
  192. package/dist/internal/use-popover-trigger.mjs +28 -24
  193. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  194. package/dist/internal/use-register-count.mjs +24 -0
  195. package/dist/internal/use-register-count.mjs.map +1 -0
  196. package/dist/internal/use-render.d.mts +2 -0
  197. package/dist/internal/use-render.mjs +2 -2
  198. package/dist/internal/use-render.mjs.map +1 -1
  199. package/dist/internal/use-resolved-placement.mjs +38 -22
  200. package/dist/internal/use-resolved-placement.mjs.map +1 -1
  201. package/dist/internal/use-roving-focus.mjs +5 -18
  202. package/dist/internal/use-roving-focus.mjs.map +1 -1
  203. package/dist/internal/use-superseded-rejection.mjs +47 -0
  204. package/dist/internal/use-superseded-rejection.mjs.map +1 -0
  205. package/dist/internal/validity.mjs +1 -13
  206. package/dist/internal/validity.mjs.map +1 -1
  207. package/dist/internal/value-set.mjs +41 -0
  208. package/dist/internal/value-set.mjs.map +1 -0
  209. package/dist/menu/index.d.mts +1 -1
  210. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  211. package/dist/menu/menu-context-trigger.d.mts +2 -7
  212. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  213. package/dist/menu/menu-context-trigger.mjs +11 -187
  214. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  215. package/dist/menu/menu-context.d.mts +1 -1
  216. package/dist/menu/menu-context.mjs +1 -1
  217. package/dist/menu/menu-context.mjs.map +1 -1
  218. package/dist/menu/menu-dom.mjs +2 -17
  219. package/dist/menu/menu-dom.mjs.map +1 -1
  220. package/dist/menu/menu-gestures.mjs +166 -0
  221. package/dist/menu/menu-gestures.mjs.map +1 -0
  222. package/dist/menu/menu-group.d.mts.map +1 -1
  223. package/dist/menu/menu-group.mjs +2 -1
  224. package/dist/menu/menu-group.mjs.map +1 -1
  225. package/dist/menu/menu-hover.mjs +0 -1
  226. package/dist/menu/menu-hover.mjs.map +1 -1
  227. package/dist/menu/menu-item.mjs.map +1 -1
  228. package/dist/menu/menu-outside.mjs +101 -0
  229. package/dist/menu/menu-outside.mjs.map +1 -0
  230. package/dist/menu/menu-point.mjs +85 -0
  231. package/dist/menu/menu-point.mjs.map +1 -0
  232. package/dist/menu/menu-popup.d.mts +6 -7
  233. package/dist/menu/menu-popup.d.mts.map +1 -1
  234. package/dist/menu/menu-popup.mjs +38 -248
  235. package/dist/menu/menu-popup.mjs.map +1 -1
  236. package/dist/menu/menu-radio-group.mjs.map +1 -1
  237. package/dist/menu/menu-radio-item.d.mts +2 -0
  238. package/dist/menu/menu-radio-item.d.mts.map +1 -1
  239. package/dist/menu/menu-radio-item.mjs +1 -0
  240. package/dist/menu/menu-radio-item.mjs.map +1 -1
  241. package/dist/menu/menu-root.d.mts +10 -0
  242. package/dist/menu/menu-root.d.mts.map +1 -1
  243. package/dist/menu/menu-root.mjs +10 -8
  244. package/dist/menu/menu-root.mjs.map +1 -1
  245. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  246. package/dist/menu/menu-submenu-trigger.mjs +12 -9
  247. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  248. package/dist/menu/menu-trigger.d.mts +10 -11
  249. package/dist/menu/menu-trigger.d.mts.map +1 -1
  250. package/dist/menu/menu-trigger.mjs +14 -7
  251. package/dist/menu/menu-trigger.mjs.map +1 -1
  252. package/dist/menu/use-menu-item.mjs +14 -16
  253. package/dist/menu/use-menu-item.mjs.map +1 -1
  254. package/dist/menu/use-menu-keyboard.mjs +88 -0
  255. package/dist/menu/use-menu-keyboard.mjs.map +1 -0
  256. package/dist/meter/meter-root.mjs +1 -1
  257. package/dist/number-field/index.d.mts +2 -1
  258. package/dist/number-field/index.d.mts.map +1 -1
  259. package/dist/number-field/index.mjs +2 -2
  260. package/dist/number-field/index.mjs.map +1 -1
  261. package/dist/number-field/number-field-arithmetic.mjs +30 -11
  262. package/dist/number-field/number-field-arithmetic.mjs.map +1 -1
  263. package/dist/number-field/number-field-context.d.mts +6 -1
  264. package/dist/number-field/number-field-context.d.mts.map +1 -0
  265. package/dist/number-field/number-field-context.mjs.map +1 -1
  266. package/dist/number-field/number-field-decrement.d.mts +1 -1
  267. package/dist/number-field/number-field-decrement.mjs +1 -1
  268. package/dist/number-field/number-field-decrement.mjs.map +1 -1
  269. package/dist/number-field/number-field-increment.d.mts +2 -22
  270. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  271. package/dist/number-field/number-field-increment.mjs +2 -53
  272. package/dist/number-field/number-field-increment.mjs.map +1 -1
  273. package/dist/number-field/number-field-input.d.mts.map +1 -1
  274. package/dist/number-field/number-field-input.mjs +18 -22
  275. package/dist/number-field/number-field-input.mjs.map +1 -1
  276. package/dist/number-field/number-field-label.d.mts.map +1 -1
  277. package/dist/number-field/number-field-label.mjs +3 -9
  278. package/dist/number-field/number-field-label.mjs.map +1 -1
  279. package/dist/number-field/number-field-root.d.mts +3 -2
  280. package/dist/number-field/number-field-root.d.mts.map +1 -1
  281. package/dist/number-field/number-field-root.mjs +81 -91
  282. package/dist/number-field/number-field-root.mjs.map +1 -1
  283. package/dist/number-field/use-number-field-dev-warnings.mjs +28 -0
  284. package/dist/number-field/use-number-field-dev-warnings.mjs.map +1 -0
  285. package/dist/number-field/use-step-button.d.mts +24 -0
  286. package/dist/number-field/use-step-button.d.mts.map +1 -0
  287. package/dist/number-field/use-step-button.mjs +57 -3
  288. package/dist/number-field/use-step-button.mjs.map +1 -1
  289. package/dist/popover/popover-close.d.mts.map +1 -1
  290. package/dist/popover/popover-close.mjs +28 -67
  291. package/dist/popover/popover-close.mjs.map +1 -1
  292. package/dist/popover/popover-context.mjs.map +1 -1
  293. package/dist/popover/popover-popup.d.mts +9 -6
  294. package/dist/popover/popover-popup.d.mts.map +1 -1
  295. package/dist/popover/popover-popup.mjs +13 -36
  296. package/dist/popover/popover-popup.mjs.map +1 -1
  297. package/dist/popover/popover-root.mjs +4 -3
  298. package/dist/popover/popover-root.mjs.map +1 -1
  299. package/dist/popover/popover-trigger.d.mts +10 -10
  300. package/dist/popover/popover-trigger.d.mts.map +1 -1
  301. package/dist/popover/popover-trigger.mjs +4 -2
  302. package/dist/popover/popover-trigger.mjs.map +1 -1
  303. package/dist/progress/progress-root.mjs +1 -1
  304. package/dist/radio-group/radio-group-context.mjs.map +1 -1
  305. package/dist/radio-group/radio-group-item.d.mts +3 -4
  306. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  307. package/dist/radio-group/radio-group-item.mjs +20 -25
  308. package/dist/radio-group/radio-group-item.mjs.map +1 -1
  309. package/dist/radio-group/radio-group-label.mjs +1 -6
  310. package/dist/radio-group/radio-group-label.mjs.map +1 -1
  311. package/dist/radio-group/radio-group-root.d.mts +1 -1
  312. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  313. package/dist/radio-group/radio-group-root.mjs +21 -40
  314. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  315. package/dist/select/select-dom.mjs +9 -18
  316. package/dist/select/select-dom.mjs.map +1 -1
  317. package/dist/select/select-option.mjs +1 -1
  318. package/dist/select/select-root.mjs +3 -2
  319. package/dist/select/select-root.mjs.map +1 -1
  320. package/dist/slider/slider-arithmetic.mjs +74 -13
  321. package/dist/slider/slider-arithmetic.mjs.map +1 -1
  322. package/dist/slider/slider-context.mjs.map +1 -1
  323. package/dist/slider/slider-label.d.mts.map +1 -1
  324. package/dist/slider/slider-label.mjs +3 -9
  325. package/dist/slider/slider-label.mjs.map +1 -1
  326. package/dist/slider/slider-root.d.mts +2 -2
  327. package/dist/slider/slider-root.d.mts.map +1 -1
  328. package/dist/slider/slider-root.mjs +36 -116
  329. package/dist/slider/slider-root.mjs.map +1 -1
  330. package/dist/slider/slider-thumb.d.mts.map +1 -1
  331. package/dist/slider/slider-thumb.mjs +8 -6
  332. package/dist/slider/slider-thumb.mjs.map +1 -1
  333. package/dist/slider/slider-value.d.mts.map +1 -1
  334. package/dist/slider/slider-value.mjs +2 -1
  335. package/dist/slider/slider-value.mjs.map +1 -1
  336. package/dist/slider/use-slider-dev-warnings.mjs +29 -0
  337. package/dist/slider/use-slider-dev-warnings.mjs.map +1 -0
  338. package/dist/slider/use-thumb-registry.mjs +51 -0
  339. package/dist/slider/use-thumb-registry.mjs.map +1 -0
  340. package/dist/switch/switch.d.mts +4 -5
  341. package/dist/switch/switch.d.mts.map +1 -1
  342. package/dist/switch/switch.mjs +15 -55
  343. package/dist/switch/switch.mjs.map +1 -1
  344. package/dist/tabs/tabs-context.d.mts +2 -3
  345. package/dist/tabs/tabs-context.d.mts.map +1 -1
  346. package/dist/tabs/tabs-context.mjs.map +1 -1
  347. package/dist/tabs/tabs-list.d.mts.map +1 -1
  348. package/dist/tabs/tabs-list.mjs +9 -22
  349. package/dist/tabs/tabs-list.mjs.map +1 -1
  350. package/dist/tabs/tabs-panel.d.mts +3 -4
  351. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  352. package/dist/tabs/tabs-panel.mjs.map +1 -1
  353. package/dist/tabs/tabs-root.d.mts +4 -3
  354. package/dist/tabs/tabs-root.d.mts.map +1 -1
  355. package/dist/tabs/tabs-root.mjs +2 -1
  356. package/dist/tabs/tabs-root.mjs.map +1 -1
  357. package/dist/tabs/tabs-tab.d.mts +3 -4
  358. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  359. package/dist/tabs/tabs-tab.mjs.map +1 -1
  360. package/dist/toast/toast-action.mjs.map +1 -1
  361. package/dist/toast/toast-close.d.mts.map +1 -1
  362. package/dist/toast/toast-close.mjs +2 -8
  363. package/dist/toast/toast-close.mjs.map +1 -1
  364. package/dist/toast/toast-context.mjs.map +1 -1
  365. package/dist/toast/toast-hotkey.mjs +27 -0
  366. package/dist/toast/toast-hotkey.mjs.map +1 -0
  367. package/dist/toast/toast-queue.mjs +137 -0
  368. package/dist/toast/toast-queue.mjs.map +1 -0
  369. package/dist/toast/toast-root.d.mts.map +1 -1
  370. package/dist/toast/toast-root.mjs +2 -0
  371. package/dist/toast/toast-root.mjs.map +1 -1
  372. package/dist/toast/toast-timers.mjs +65 -0
  373. package/dist/toast/toast-timers.mjs.map +1 -0
  374. package/dist/toast/toast-viewport.d.mts.map +1 -1
  375. package/dist/toast/toast-viewport.mjs +30 -235
  376. package/dist/toast/toast-viewport.mjs.map +1 -1
  377. package/dist/toast/toast.mjs +1 -1
  378. package/dist/toast/toast.mjs.map +1 -1
  379. package/dist/toast/use-modal-portal-host.mjs +52 -0
  380. package/dist/toast/use-modal-portal-host.mjs.map +1 -0
  381. package/dist/toggle/toggle.d.mts +3 -4
  382. package/dist/toggle/toggle.d.mts.map +1 -1
  383. package/dist/toggle/toggle.mjs +7 -10
  384. package/dist/toggle/toggle.mjs.map +1 -1
  385. package/dist/toggle-group/toggle-group-context.d.mts +2 -1
  386. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  387. package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
  388. package/dist/toggle-group/toggle-group-item.d.mts +7 -3
  389. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  390. package/dist/toggle-group/toggle-group-item.mjs +6 -7
  391. package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
  392. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  393. package/dist/toggle-group/toggle-group-root.mjs +29 -64
  394. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  395. package/dist/toolbar/toolbar-root.d.mts +2 -2
  396. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  397. package/dist/toolbar/toolbar-root.mjs +3 -4
  398. package/dist/toolbar/toolbar-root.mjs.map +1 -1
  399. package/dist/tooltip/tooltip-context.d.mts +1 -1
  400. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  401. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  402. package/dist/tooltip/tooltip-popup.mjs +6 -15
  403. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  404. package/dist/tooltip/tooltip-root.mjs +2 -2
  405. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  406. package/dist/tooltip/tooltip-trigger.d.mts +2 -1
  407. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  408. package/dist/tooltip/tooltip-trigger.mjs +3 -2
  409. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  410. package/dist/tooltip/use-tooltip-interaction.mjs +4 -3
  411. package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
  412. package/package.json +3 -2
  413. package/dist/accordion/accordion-context.d.mts +0 -5
  414. package/dist/accordion/accordion-context.d.mts.map +0 -1
  415. package/dist/internal/use-popover-root.mjs.map +0 -1
  416. /package/dist/internal/{use-popover-root.d.mts → use-overlay-root.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"tabs-root.mjs","names":[],"sources":["../../src/tabs/tabs-root.tsx"],"sourcesContent":["\"use client\";\nimport { useId, useMemo, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type { ActionDetails, ChangeAction, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { TabsContext } from \"./tabs-context.js\";\nimport type {\n TabsActivationMode,\n TabsChangeReason,\n TabsContextValue,\n TabsOrientation,\n} from \"./tabs-context.js\";\nimport { tabId } from \"./tabs-ids.js\";\n\nexport type { TabsActivationMode, TabsOrientation } from \"./tabs-context.js\";\n\n/** Details passed as the second argument of `valueChangeAction`. */\nexport interface TabsValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user selected the tab (click, Enter/Space, or focus in automatic mode).\n * `\"platform\"`: the browser revealed a `keepMounted=\"until-found\"` panel through find-in-page or a\n * text fragment (`details.event` is the `beforematch` event).\n */\n readonly reason: TabsChangeReason;\n}\n\nexport interface TabsRootState {\n /** Optimistic selected value, or `null`. Content rendered from it must not suspend. */\n readonly value: string | null;\n /** An action dispatched through this Tabs is in flight. */\n readonly pending: boolean;\n readonly orientation: TabsOrientation;\n readonly disabled: boolean;\n}\n\nexport interface TabsRootProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"className\" | \"style\" | \"children\" | \"defaultValue\"\n> {\n /** Controlled selected value. `null` selects nothing; `undefined` means uncontrolled. */\n value?: string | null;\n /** Initial value in uncontrolled mode. Defaults to `null` (no panel shown). */\n defaultValue?: string | null;\n /**\n * Runs inside the Root's transition whenever the user selects a tab. May be sync or async;\n * rejections reach the nearest Error Boundary and roll the selection back.\n *\n * With `activationMode=\"automatic\"` every arrow key press calls it; prefer `\"manual\"` when the\n * action awaits a server round trip. A `setState` placed after your own `await` is not a\n * Transition update; wrap it in `startTransition` (React limitation).\n */\n valueChangeAction?: ChangeAction<string, TabsValueChangeDetails>;\n /** Layout and arrow-key axis. Default `\"horizontal\"`. */\n orientation?: TabsOrientation;\n /**\n * `\"automatic\"`: selection follows focus. `\"manual\"`: Enter, Space or click selects.\n * Default `\"automatic\"`.\n */\n activationMode?: TabsActivationMode;\n /** Whether arrow keys wrap from the last tab to the first. Default `true`. */\n loop?: boolean;\n /** Disables every Tab (focusable, never dispatches). */\n disabled?: boolean;\n className?: StateValue<string | undefined, TabsRootState>;\n style?: StateValue<CSSProperties | undefined, TabsRootState>;\n children?: StateValue<ReactNode, TabsRootState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, TabsRootState>;\n}\n\n/** Looks up an element by id in the tree that contains `node` (document or shadow root). */\nfunction findById(node: Node | null, id: string): Element | null {\n const root = node?.getRootNode() ?? (typeof document === \"undefined\" ? null : document);\n if (root !== null && \"getElementById\" in root) {\n return (root as Document | ShadowRoot).getElementById(id);\n }\n return null;\n}\n\n/**\n * Owns the Tabs state (`value`), the transition, the ids and the context. Renders a `div` with\n * `data-pending` while a selection is in flight (including a suspending panel's wait).\n *\n * Owned keys (conventions 1.2): `data-pending`, `data-orientation`, `data-disabled`.\n */\nexport function TabsRoot({\n value,\n defaultValue,\n valueChangeAction,\n orientation = \"horizontal\",\n activationMode = \"automatic\",\n loop = true,\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: TabsRootProps) {\n const rootId = useId();\n const rootRef = useRef<HTMLElement | null>(null);\n\n const { committed, optimistic, pending, dispatch } = useControllableAction<\n string | null,\n TabsValueChangeDetails\n >({\n controlled: value,\n defaultValue,\n initialValue: null,\n // Only ever dispatched with a string: the Tabs UI cannot deselect.\n action:\n valueChangeAction === undefined\n ? undefined\n : (next, details) => valueChangeAction(next as string, details),\n transitionTypes: (next, prev) => {\n // Direction is relative to the committed tab (design 10.2), by DOM order of the two tabs.\n if (next === null || prev === null || next === prev) return transitionTypes(\"tabs\");\n const prevTab = findById(rootRef.current, tabId(rootId, prev));\n const nextTab = findById(rootRef.current, tabId(rootId, next));\n if (prevTab === null || nextTab === null) return transitionTypes(\"tabs\");\n const following = prevTab.compareDocumentPosition(nextTab) & Node.DOCUMENT_POSITION_FOLLOWING;\n return transitionTypes(\"tabs\", following ? \"next\" : \"prev\");\n },\n warn: { component: \"Tabs.Root\", prop: \"value\" },\n });\n // `null` is a legitimate default (no panel), but forgetting both props is the likelier cause\n // of an empty Tabs (design open question 2, product owner decision).\n useDevWarning(\n value === undefined && defaultValue === undefined,\n \"Tabs.Root: neither `value` nor `defaultValue` was passed, so no tab is selected and no \" +\n \"panel is shown. Pass `defaultValue`, or `defaultValue={null}` to start with no selection.\",\n );\n\n // Memoised (#48): `dispatch` is stable, so this changes only with the state and the props below.\n const context = useMemo<TabsContextValue>(\n () => ({\n rootId,\n committed,\n optimistic,\n pending,\n orientation,\n activationMode,\n loop,\n disabled,\n select: (next, event, reason) => {\n // No-op rule against the optimistic value (conventions 2.3 item 7, design section 9.4).\n if (next === optimistic) return;\n dispatch(next, createActionDetails(event, { reason }));\n },\n }),\n [rootId, committed, optimistic, pending, orientation, activationMode, loop, disabled, dispatch],\n );\n\n const state: TabsRootState = { value: optimistic, pending, orientation, disabled };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, TabsRootState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n \"data-pending\": dataAttr(pending),\n \"data-orientation\": orientation,\n \"data-disabled\": dataAttr(disabled),\n },\n ref: rootRef,\n });\n\n return <TabsContext value={context}>{element}</TabsContext>;\n}\n\nTabsRoot.displayName = \"TabsRoot\";\n"],"mappings":";;;;;;;;;;;;;AA2EA,SAAS,SAAS,MAAmB,IAA4B;CAC/D,MAAM,OAAO,MAAM,YAAY,MAAM,OAAO,aAAa,cAAc,OAAO;CAC9E,IAAI,SAAS,QAAQ,oBAAoB,MACvC,OAAQ,KAA+B,eAAe,EAAE;CAE1D,OAAO;AACT;;;;;;;AAQA,SAAgB,SAAS,EACvB,OACA,cACA,mBACA,cAAc,cACd,iBAAiB,aACjB,OAAO,MACP,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACa;CAChB,MAAM,SAAS,MAAM;CACrB,MAAM,UAAU,OAA2B,IAAI;CAE/C,MAAM,EAAE,WAAW,YAAY,SAAS,aAAa,sBAGnD;EACA,YAAY;EACZ;EACA,cAAc;EAEd,QACE,sBAAs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ef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type {\n ActionDetails,\n ChangeAction,\n ChangeReason,\n RenderProp,\n StateValue,\n} from \"../internal/types.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { TabsContext } from \"./tabs-context.js\";\nimport type { TabsActivationMode, TabsContextValue, TabsOrientation } from \"./tabs-context.js\";\nimport { tabId } from \"./tabs-ids.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport type { TabsActivationMode, TabsOrientation } from \"./tabs-context.js\";\n\n/** Details passed as the second argument of `valueChangeAction`. */\nexport interface TabsValueChangeDetails extends ActionDetails {\n /**\n * The shared vocabulary (conventions 2.2); Tabs dispatches two of its values.\n * `\"activate\"`: the user selected the tab (click, Enter/Space, or focus in automatic mode).\n * `\"platform\"`: the browser revealed a `keepMounted=\"until-found\"` panel through find-in-page or a\n * text fragment (`details.event` is the `beforematch` event).\n */\n readonly reason: ChangeReason;\n}\n\nexport interface TabsRootState {\n /** Optimistic selected value, or `null`. Content rendered from it must not suspend. */\n readonly value: string | null;\n /** An action dispatched through this Tabs is in flight. */\n readonly pending: boolean;\n readonly orientation: TabsOrientation;\n readonly disabled: boolean;\n}\n\nexport interface TabsRootProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"className\" | \"style\" | \"children\" | \"defaultValue\"\n> {\n /** Controlled selected value. `null` selects nothing; `undefined` means uncontrolled. */\n value?: string | null;\n /** Initial value in uncontrolled mode. Defaults to `null` (no panel shown). */\n defaultValue?: string | null;\n /**\n * Runs inside the Root's transition whenever the user selects a tab. May be sync or async;\n * rejections reach the nearest Error Boundary and roll the selection back.\n *\n * With `activationMode=\"automatic\"` every arrow key press calls it; prefer `\"manual\"` when the\n * action awaits a server round trip. A `setState` placed after your own `await` is not a\n * Transition update; wrap it in `startTransition` (React limitation).\n */\n valueChangeAction?: ChangeAction<string, TabsValueChangeDetails>;\n /** Layout and arrow-key axis. Default `\"horizontal\"`. */\n orientation?: TabsOrientation;\n /**\n * `\"automatic\"`: selection follows focus. `\"manual\"`: Enter, Space or click selects.\n * Default `\"automatic\"`.\n */\n activationMode?: TabsActivationMode;\n /** Whether arrow keys wrap from the last tab to the first. Default `true`. */\n loop?: boolean;\n /** Disables every Tab (focusable, never dispatches). */\n disabled?: boolean;\n className?: StateValue<string | undefined, TabsRootState>;\n style?: StateValue<CSSProperties | undefined, TabsRootState>;\n children?: StateValue<ReactNode, TabsRootState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, TabsRootState>;\n}\n\n/** Looks up an element by id in the tree that contains `node` (document or shadow root). */\nfunction findById(node: Node | null, id: string): Element | null {\n const root = node?.getRootNode() ?? (typeof document === \"undefined\" ? null : document);\n if (root !== null && \"getElementById\" in root) {\n return (root as Document | ShadowRoot).getElementById(id);\n }\n return null;\n}\n\n/**\n * Owns the Tabs state (`value`), the transition, the ids and the context. Renders a `div` with\n * `data-pending` while a selection is in flight (including a suspending panel's wait).\n *\n * Owned keys (conventions 1.2): `data-pending`, `data-orientation`, `data-disabled`.\n */\nexport function TabsRoot({\n value,\n defaultValue,\n valueChangeAction,\n orientation = \"horizontal\",\n activationMode = \"automatic\",\n loop = true,\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: TabsRootProps) {\n const rootId = useId();\n const rootRef = useRef<HTMLElement | null>(null);\n\n const { committed, optimistic, pending, dispatch } = useControllableAction<\n string | null,\n TabsValueChangeDetails\n >({\n controlled: value,\n defaultValue,\n initialValue: null,\n // Only ever dispatched with a string: the Tabs UI cannot deselect.\n action:\n valueChangeAction === undefined\n ? undefined\n : (next, details) => valueChangeAction(next as string, details),\n transitionTypes: (next, prev) => {\n // Direction is relative to the committed tab (design 10.2), by DOM order of the two tabs.\n if (next === null || prev === null || next === prev) return transitionTypes(\"tabs\");\n const prevTab = findById(rootRef.current, tabId(rootId, prev));\n const nextTab = findById(rootRef.current, tabId(rootId, next));\n if (prevTab === null || nextTab === null) return transitionTypes(\"tabs\");\n const following = prevTab.compareDocumentPosition(nextTab) & Node.DOCUMENT_POSITION_FOLLOWING;\n return transitionTypes(\"tabs\", following ? \"next\" : \"prev\");\n },\n warn: { component: \"Tabs.Root\", prop: \"value\" },\n });\n // `null` is a legitimate default (no panel), but forgetting both props is the likelier cause\n // of an empty Tabs (design/components/tabs.md, resolved question 2).\n useDevWarning(\n value === undefined && defaultValue === undefined,\n isDev &&\n \"Tabs.Root: neither `value` nor `defaultValue` was passed, so no tab is selected and no \" +\n \"panel is shown. Pass `defaultValue`, or `defaultValue={null}` to start with no selection.\",\n );\n\n // Memoised: `dispatch` is stable, so this changes only with the state and the props below.\n const context = useMemo<TabsContextValue>(\n () => ({\n rootId,\n committed,\n optimistic,\n pending,\n orientation,\n activationMode,\n loop,\n disabled,\n select: (next, event, reason) => {\n // No-op rule against the optimistic value (conventions 2.3 item 7, design section 9.4).\n if (next === optimistic) return;\n dispatch(next, createActionDetails(event, { reason }));\n },\n }),\n [rootId, committed, optimistic, pending, orientation, activationMode, loop, disabled, dispatch],\n );\n\n const state: TabsRootState = { value: optimistic, pending, orientation, disabled };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, TabsRootState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n \"data-pending\": dataAttr(pending),\n \"data-orientation\": orientation,\n \"data-disabled\": dataAttr(disabled),\n },\n ref: rootRef,\n });\n\n return <TabsContext value={context}>{element}</TabsContext>;\n}\n\nTabsRoot.displayName = \"TabsRoot\";\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;AA2DvC,SAAS,SAAS,MAAmB,IAA4B;CAC/D,MAAM,OAAO,MAAM,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UAAU,UAAuD;EACrE,gBAAgB;EAChB;EACA,OAAA;GAL6B,OAAO;GAAY;GAAS;GAAa;EAKlE;EACJ;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,gBAAgB,SAAS,OAAO;GAChC,oBAAoB;GACpB,iBAAiB,SAAS,QAAQ;EACpC;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,aAAD;EAAa,OAAO;EAAU,UAAA;CAAqB,CAAA;AAC5D;AAEA,SAAS,cAAc"}
@@ -21,10 +21,9 @@ export interface TabsTabProps extends Omit<ComponentPropsWithRef<"button">, "onC
21
21
  * that settles the action (or rolls it back), never on the optimistic selection; animate the
22
22
  * selection itself with a CSS `transition` on `[data-selected]`.
23
23
  *
24
- * Static: without `transition` the part renders no `<ViewTransition>`; changing it between
25
- * `undefined` and a value remounts the element. Any value, `"none"` included, makes a mount or
26
- * `<Activity>` reveal of this part inside a transition start a document view transition: the
27
- * page cross-fades for about 250 ms and the next transition commit waits for it (issue #35).
24
+ * Static: setting or unsetting it remounts the element. Any value, `"none"` included, makes a
25
+ * mount or `<Activity>` reveal inside a transition start a document view transition (a ~250 ms
26
+ * page cross-fade that the next transition waits for).
28
27
  */
29
28
  transition?: ViewTransitionClass;
30
29
  className?: StateValue<string | undefined, TabsTabState>;
@@ -1 +1 @@
1
- {"version":3,"file":"tabs-tab.d.mts","names":[],"sources":["../../src/tabs/tabs-tab.tsx"],"mappings":";;;;iBAmBiB;WACN;;WAEA;;WAEA;WACA;WACA,aAAa;;iBAGP,qBAAqB,KACpC;;EAIA;;EAEA;;;;;;;;;;;EAWA,aAAa;EACb,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,iCAAiC;;;;;;;;;;wBA2BvC,UACd,OACA,UAAU,cACV,YACA,WACA,OACA,UACA,WACG,QACF,eAAY;yBATC"}
1
+ {"version":3,"file":"tabs-tab.d.mts","names":[],"sources":["../../src/tabs/tabs-tab.tsx"],"mappings":";;;;iBAmBiB;WACN;;WAEA;;WAEA;WACA;WACA,aAAa;;iBAGP,qBAAqB,KACpC;;EAIA;;EAEA;;;;;;;;;;EAUA,aAAa;EACb,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,iCAAiC;;;;;;;;;;wBA2BvC,UACd,OACA,UAAU,cACV,YACA,WACA,OACA,UACA,WACG,QACF,eAAY;yBATC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tabs-tab.mjs","names":[],"sources":["../../src/tabs/tabs-tab.tsx"],"sourcesContent":["\"use client\";\nimport { use } from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n ViewTransitionClass,\n} from \"react\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { rendersButton, resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport { TabsListContext, useTabsContext } from \"./tabs-context.js\";\nimport type { TabsOrientation } from \"./tabs-context.js\";\nimport { anchorName, panelId, tabId } from \"./tabs-ids.js\";\n\nexport interface TabsTabState {\n readonly value: string;\n /** Optimistic: true as soon as the user selects this tab, before the action settles. */\n readonly selected: boolean;\n /** The Root is pending and this tab is the optimistic target. */\n readonly pending: boolean;\n readonly disabled: boolean;\n readonly orientation: TabsOrientation;\n}\n\nexport interface TabsTabProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"onKeyDown\" | \"onFocus\" | \"id\" | \"value\" | \"className\" | \"style\" | \"children\"\n> {\n /** The value this tab selects. Must be unique within the Root. */\n value: string;\n /** Focusable but inert: `aria-disabled=\"true\"`, never dispatches. */\n disabled?: boolean;\n /**\n * Forwarded to the Tab's `<ViewTransition default>`. Default: no boundary. Fires only on the commit\n * that settles the action (or rolls it back), never on the optimistic selection; animate the\n * selection itself with a CSS `transition` on `[data-selected]`.\n *\n * Static: without `transition` the part renders no `<ViewTransition>`; changing it between\n * `undefined` and a value remounts the element. Any value, `\"none\"` included, makes a mount or\n * `<Activity>` reveal of this part inside a transition start a document view transition: the\n * page cross-fades for about 250 ms and the next transition commit waits for it (issue #35).\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, TabsTabState>;\n style?: StateValue<CSSProperties | undefined, TabsTabState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, TabsTabState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, TabsTabState>;\n}\n\nfunction isActivationKey(event: KeyboardEvent): boolean {\n return (\n (event.key === \"Enter\" || event.key === \" \") &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey\n );\n}\n\n/** Focus came from another element inside the tab's own tablist (not from the list itself). */\nfunction movedWithinList(event: FocusEvent<HTMLElement>): boolean {\n const list = event.currentTarget.closest('[role=\"tablist\"]');\n const from = event.relatedTarget;\n return list !== null && from instanceof Node && from !== list && list.contains(from);\n}\n\n/**\n * A `button[role=tab]`. Renders the optimistic selection (`aria-selected`, `data-selected`,\n * roving `tabindex`) and carries `anchor-name` for the Indicator.\n *\n * Owned keys (conventions 1.2): `role`, `id`, `aria-selected`, `aria-controls` (token-merged),\n * `aria-disabled`, `tabIndex`, `focusgroupstart` (with `experimental_focusgroup`), `data-selected`, `data-pending`, `data-disabled`,\n * `data-orientation`, `onClick`, `onKeyDown`, `onFocus`.\n */\nexport function TabsTab({\n value,\n disabled: disabledProp = false,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: TabsTabProps) {\n const ctx = useTabsContext(\"Tabs.Tab\");\n const listCtx = use(TabsListContext);\n const selected = ctx.optimistic === value;\n const pending = ctx.pending && selected;\n const disabled = ctx.disabled || disabledProp;\n const anchor = anchorName(ctx.rootId, value);\n\n const state: TabsTabState = {\n value,\n selected,\n pending,\n disabled,\n orientation: ctx.orientation,\n };\n\n const element = useRender<ComponentPropsWithRef<\"button\">, TabsTabState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n // `anchor-name` sits under the consumer's style: the consumer wins (design 13.5).\n style: (s) => ({ anchorName: anchor, ...resolveStateValue(style, s) }),\n children,\n // `type=\"button\"` only on a real button (no form submission); an `<a>` must not get it.\n props: rendersButton(render) ? { ...rest, type: \"button\" } : rest,\n libraryProps: {\n role: \"tab\",\n id: tabId(ctx.rootId, value),\n \"aria-selected\": selected,\n \"aria-controls\": panelId(ctx.rootId, value),\n \"aria-disabled\": disabled ? true : undefined,\n // Roving tabindex, except on the native `focusgroup` path, where the browser owns the tab\n // stop and a negative tabindex would take the Tab out of the group (TabsListContextValue).\n tabIndex: selected ? 0 : listCtx?.nativeFocusgroup ? undefined : -1,\n // Always rendered with the flag (inert where unsupported), so markup is stable.\n ...(listCtx?.focusgroup === true && { focusgroupstart: selected ? \"\" : undefined }),\n \"data-selected\": dataAttr(selected),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n \"data-orientation\": ctx.orientation,\n onClick: (event: MouseEvent<HTMLButtonElement>) => {\n if (disabled) return;\n ctx.select(value, event.nativeEvent, \"activate\");\n },\n // Enter and Space are handled on keydown so a `render`ed non-button element (a link)\n // behaves the same; `preventDefault` also stops the native click / navigation.\n onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => {\n if (!isActivationKey(event)) return;\n event.preventDefault();\n if (disabled) return;\n ctx.select(value, event.nativeEvent, \"activate\");\n },\n // Automatic activation is selection-follows-focus (design 4.1), but only for focus that\n // moves between tabs inside this list (the arrow-key path, the native `focusgroup` path,\n // programmatic movement). Focus entering from outside never selects: the Tab key, window\n // re-activation, focus restore, `autoFocus`, and the List's own redirect when no tab is the\n // tab stop. A click still selects through `onClick`.\n onFocus: (event: FocusEvent<HTMLButtonElement>) => {\n if (ctx.activationMode !== \"automatic\" || disabled || selected) return;\n if (!movedWithinList(event)) return;\n ctx.select(value, event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W,KAAK,KAAA,EAAU;GACjF,iBAAiB,SAAS,QAAQ;GAClC,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;GAClC,oBAAoB,IAAI;GACxB,UAAU,UAAyC;IACjD,IAAI,UAAU;IACd,IAAI,OAAO,OAAO,MAAM,aAAa,UAAU;GACjD;GAGA,YAAY,UAA4C;IACtD,IAAI,CAAC,gBAAgB,KAAK,GAAG;IAC7B,MAAM,eAAe;IACrB,IAAI,UAAU;IACd,IAAI,OAAO,OAAO,MAAM,aAAa,UAAU;GACjD;GAMA,UAAU,UAAyC;IACjD,IAAI,IAAI,mBAAmB,eAAe,YAAY,UAAU;IAChE,IAAI,CAAC,gBAAgB,KAAK,GAAG;IAC7B,IAAI,OAAO,OAAO,MAAM,aAAa,UAAU;GACjD;EACF;CACF,CAAC;CAED,OAAO,sBAAsB,YAAY,YAAY,OAAO;AAC9D;AAEA,QAAQ,cAAc"}
1
+ {"version":3,"file":"tabs-tab.mjs","names":[],"sources":["../../src/tabs/tabs-tab.tsx"],"sourcesContent":["\"use client\";\nimport { use } from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n ViewTransitionClass,\n} from \"react\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { rendersButton, resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport { TabsListContext, useTabsContext } from \"./tabs-context.js\";\nimport type { TabsOrientation } from \"./tabs-context.js\";\nimport { anchorName, panelId, tabId } from \"./tabs-ids.js\";\n\nexport interface TabsTabState {\n readonly value: string;\n /** Optimistic: true as soon as the user selects this tab, before the action settles. */\n readonly selected: boolean;\n /** The Root is pending and this tab is the optimistic target. */\n readonly pending: boolean;\n readonly disabled: boolean;\n readonly orientation: TabsOrientation;\n}\n\nexport interface TabsTabProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"onKeyDown\" | \"onFocus\" | \"id\" | \"value\" | \"className\" | \"style\" | \"children\"\n> {\n /** The value this tab selects. Must be unique within the Root. */\n value: string;\n /** Focusable but inert: `aria-disabled=\"true\"`, never dispatches. */\n disabled?: boolean;\n /**\n * Forwarded to the Tab's `<ViewTransition default>`. Default: no boundary. Fires only on the commit\n * that settles the action (or rolls it back), never on the optimistic selection; animate the\n * selection itself with a CSS `transition` on `[data-selected]`.\n *\n * Static: setting or unsetting it remounts the element. Any value, `\"none\"` included, makes a\n * mount or `<Activity>` reveal inside a transition start a document view transition (a ~250 ms\n * page cross-fade that the next transition waits for).\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, TabsTabState>;\n style?: StateValue<CSSProperties | undefined, TabsTabState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, TabsTabState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, TabsTabState>;\n}\n\nfunction isActivationKey(event: KeyboardEvent): boolean {\n return (\n (event.key === \"Enter\" || event.key === \" \") &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey\n );\n}\n\n/** Focus came from another element inside the tab's own tablist (not from the list itself). */\nfunction movedWithinList(event: FocusEvent<HTMLElement>): boolean {\n const list = event.currentTarget.closest('[role=\"tablist\"]');\n const from = event.relatedTarget;\n return list !== null && from instanceof Node && from !== list && list.contains(from);\n}\n\n/**\n * A `button[role=tab]`. Renders the optimistic selection (`aria-selected`, `data-selected`,\n * roving `tabindex`) and carries `anchor-name` for the Indicator.\n *\n * Owned keys (conventions 1.2): `role`, `id`, `aria-selected`, `aria-controls` (token-merged),\n * `aria-disabled`, `tabIndex`, `focusgroupstart` (with `experimental_focusgroup`), `data-selected`, `data-pending`, `data-disabled`,\n * `data-orientation`, `onClick`, `onKeyDown`, `onFocus`.\n */\nexport function TabsTab({\n value,\n disabled: disabledProp = false,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: TabsTabProps) {\n const ctx = useTabsContext(\"Tabs.Tab\");\n const listCtx = use(TabsListContext);\n const selected = ctx.optimistic === value;\n const pending = ctx.pending && selected;\n const disabled = ctx.disabled || disabledProp;\n const anchor = anchorName(ctx.rootId, value);\n\n const state: TabsTabState = {\n value,\n selected,\n pending,\n disabled,\n orientation: ctx.orientation,\n };\n\n const element = useRender<ComponentPropsWithRef<\"button\">, TabsTabState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n // `anchor-name` sits under the consumer's style: the consumer wins (design 13.5).\n style: (s) => ({ anchorName: anchor, ...resolveStateValue(style, s) }),\n children,\n // `type=\"button\"` only on a real button (no form submission); an `<a>` must not get it.\n props: rendersButton(render) ? { ...rest, type: \"button\" } : rest,\n libraryProps: {\n role: \"tab\",\n id: tabId(ctx.rootId, value),\n \"aria-selected\": selected,\n \"aria-controls\": panelId(ctx.rootId, value),\n \"aria-disabled\": disabled ? true : undefined,\n // Roving tabindex, except on the native `focusgroup` path, where the browser owns the tab\n // stop and a negative tabindex would take the Tab out of the group (TabsListContextValue).\n tabIndex: selected ? 0 : listCtx?.nativeFocusgroup ? undefined : -1,\n // Always rendered with the flag (inert where unsupported), so markup is stable.\n ...(listCtx?.focusgroup === true && { focusgroupstart: selected ? \"\" : undefined }),\n \"data-selected\": dataAttr(selected),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n \"data-orientation\": ctx.orientation,\n onClick: (event: MouseEvent<HTMLButtonElement>) => {\n if (disabled) return;\n ctx.select(value, event.nativeEvent, \"activate\");\n },\n // Enter and Space are handled on keydown so a `render`ed non-button element (a link)\n // behaves the same; `preventDefault` also stops the native click / navigation.\n onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => {\n if (!isActivationKey(event)) return;\n event.preventDefault();\n if (disabled) return;\n ctx.select(value, event.nativeEvent, \"activate\");\n },\n // Automatic activation is selection-follows-focus (design 4.1), but only for focus that\n // moves between tabs inside this list (the arrow-key path, the native `focusgroup` path,\n // programmatic movement). Focus entering from outside never selects: the Tab key, window\n // re-activation, focus restore, `autoFocus`, and the List's own redirect when no tab is the\n // tab stop. A click still selects through `onClick`.\n onFocus: (event: FocusEvent<HTMLButtonElement>) => {\n if (ctx.activationMode !== \"automatic\" || disabled || selected) return;\n if (!movedWithinList(event)) return;\n ctx.select(value, event.nativeEvent, \"activate\");\n },\n },\n });\n\n return useTransitionBoundary(\"Tabs.Tab\", transition, element);\n}\n\nTabsTab.displayName = \"TabsTab\";\n"],"mappings":";;;;;;;;;AAsDA,SAAS,gBAAgB,OAA+B;CACtD,QACG,MAAM,QAAQ,WAAW,MAAM,QAAQ,QACxC,CAAC,MAAM,UACP,CAAC,MAAM,WACP,CAAC,MAAM;AAEX;;AAGA,SAAS,gBAAgB,OAAyC;CAChE,MAAM,OAAO,MAAM,cAAc,QAAQ,oBAAkB;CAC3D,MAAM,OAAO,MAAM;CACnB,OAAO,SAAS,QAAQ,gBAAgB,QAAQ,SAAS,QAAQ,KAAK,SAAS,IAAI;AACrF;;;;;;;;;AAUA,SAAgB,QAAQ,EACtB,OACA,UAAU,eAAe,OACzB,YACA,WACA,OACA,UACA,QACA,GAAG,QACY;CACf,MAAM,MAAM,eAAe,UAAU;CACrC,MAAM,UAAU,IAAI,eAAe;CACnC,MAAM,WAAW,IAAI,eAAe;CACpC,MAAM,UAAU,IAAI,WAAW;CAC/B,MAAM,WAAW,IAAI,YAAY;CACjC,MAAM,SAAS,WAAW,IAAI,QAAQ,KAAK;CAE3C,MAAM,QAAsB;EAC1B;EACA;EACA;EACA;EACA,aAAa,IAAI;CACnB;CAEA,MAAM,UAAU,UAAyD;EACvE,gBAAgB;EAChB;EACA;EACA;EAEA,QAAQ,OAAO;GAAE,YAAY;GAAQ,GAAG,kBAAkB,OAAO,CAAC;EAAE;EACpE;EAEA,OAAO,cAAc,MAAM,IAAI;GAAE,GAAG;GAAM,MAAM;EAAS,IAAI;EAC7D,cAAc;GACZ,MAAM;GACN,IAAI,MAAM,IAAI,QAAQ,KAAK;GAC3B,iBAAiB;GACjB,iBAAiB,QAAQ,IAAI,QAAQ,KAAK;GAC1C,iBAAiB,WAAW,OAAO,KAAA;GAGnC,UAAU,WAAW,IAAI,SAAS,mBAAmB,KAAA,IAAY;GAEjE,GAAI,SAAS,eAAe,QAAQ,EAAE,iBAAiB,WAAW,KAAK,KAAA,EAAU;GACjF,iBAAiB,SAAS,QAAQ;GAClC,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;GAClC,oBAAoB,IAAI;GACxB,UAAU,UAAyC;IACjD,IAAI,UAAU;IACd,IAAI,OAAO,OAAO,MAAM,aAAa,UAAU;GACjD;GAGA,YAAY,UAA4C;IACtD,IAAI,CAAC,gBAAgB,KAAK,GAAG;IAC7B,MAAM,eAAe;IACrB,IAAI,UAAU;IACd,IAAI,OAAO,OAAO,MAAM,aAAa,UAAU;GACjD;GAMA,UAAU,UAAyC;IACjD,IAAI,IAAI,mBAAmB,eAAe,YAAY,UAAU;IAChE,IAAI,CAAC,gBAAgB,KAAK,GAAG;IAC7B,IAAI,OAAO,OAAO,MAAM,aAAa,UAAU;GACjD;EACF;CACF,CAAC;CAED,OAAO,sBAAsB,YAAY,YAAY,OAAO;AAC9D;AAEA,QAAQ,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"toast-action.mjs","names":[],"sources":["../../src/toast/toast-action.tsx"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { Action, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport type { ToastActionDetails, ToastItem } from \"./toast.js\";\nimport { useToastRootContext } from \"./toast-context.js\";\n\nexport interface ToastActionState {\n /** This part's action is in flight. */\n readonly pending: boolean;\n readonly toast: ToastItem;\n}\n\nexport interface ToastActionProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Runs in this part's own transition: `data-pending` on the Action and the Root, the toast's\n * timer paused. When it resolves the toast closes with `reason: \"activate\"` (unless\n * `closeOnSettle` is `false`); a rejection keeps the toast and reaches the nearest Error\n * Boundary above the Viewport. A caught error counts as success and closes the toast: rethrow\n * after `toast.update`, or use `closeOnSettle={false}`. Default: the toast's `action.action`.\n */\n action?: Action<[details: ToastActionDetails]>;\n /** Close the toast when the action resolves. Default `true`. */\n closeOnSettle?: boolean;\n /** Default: the toast's `action.label`. */\n children?: StateValue<ReactNode, ToastActionState>;\n className?: StateValue<string | undefined, ToastActionState>;\n style?: StateValue<CSSProperties | undefined, ToastActionState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, ToastActionState>;\n}\n\n/**\n * The toast's action button (Undo, Retry, View): a `button type=\"button\"` whose `action` runs as\n * a transition. Renders nothing when neither the part nor the toast has an action. Never natively\n * disabled while pending: a second click meanwhile is ignored and the Action is `aria-disabled`.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`, `aria-disabled`,\n * `data-pending`.\n */\nexport function ToastAction({\n action,\n closeOnSettle = true,\n children,\n className,\n style,\n render,\n ...rest\n}: ToastActionProps) {\n const root = useToastRootContext(\"Toast.Action\");\n const { pending, run } = useActionTrigger();\n const [token] = useState(() => ({}));\n const effective = action ?? root.toast.action?.action;\n const { setActionPending } = root;\n\n // The Root (and through it the Viewport's timer) sees this part's pending state.\n useLayoutEffect(() => {\n if (!pending) return;\n setActionPending(token, true);\n return () => setActionPending(token, false);\n }, [pending, setActionPending, token]);\n\n const state: ToastActionState = { pending, toast: root.toast };\n\n const onClick = (event: MouseEvent<HTMLElement>): void => {\n if (effective === undefined || rest.disabled === true) return;\n const native = event.nativeEvent;\n const details = createActionDetails(native, { id: root.toast.id });\n // A second click while this Action's own run is in flight starts nothing and is cancelled\n // (the hook's guard, #81): one Undo, one Retry.\n const started = run(\n () => effective(details),\n () => {\n // Closing is idempotent: a dismissal meanwhile already closed it.\n if (closeOnSettle) root.close(\"activate\", native);\n },\n );\n if (!started) event.preventDefault();\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n onClick,\n // Exactly while `data-pending` (#81). Owned, so an idle Action removes a render element's own.\n \"aria-disabled\": pending ? true : undefined,\n \"data-pending\": dataAttr(pending),\n };\n\n const element = useRender<ComponentPropsWithRef<\"button\">, ToastActionState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children: children ?? root.toast.action?.label,\n props: rest,\n libraryProps,\n });\n return effective === undefined ? null : element;\n}\n\nToastAction.displayName = \"ToastAction\";\n"],"mappings":";;;;;;;;;;;;;;;;;AA+CA,SAAgB,YAAY,EAC1B,QACA,gBAAgB,MAChB,UACA,WACA,OACA,QACA,GAAG,QACgB;CACnB,MAAM,OAAO,oBAAoB,cAAc;CAC/C,MAAM,EAAE,SAAS,QAAQ,iBAAiB;CAC1C,MAAM,CAAC,SAAS,gBAAgB,CAAC,EAAE;CACnC,MAAM,YAAY,UAAU,KAAK,MAAM,QAAQ;CAC/C,MAAM,EAAE,qBAAqB;CAG7B,sBAAsB;EACpB,IAAI,CAAC,SAAS;EACd,iBAAiB,OAAO,IAAI;EAC5B,aAAa,iBAAiB,OAAO,KAAK;CAC5C,GAAG;EAAC;EAAS;EAAkB;CAAK,CAAC;CAErC,MAAM,QAA0B;EAAE;EAAS,OAAO,KAAK;CAAM;CAE7D,MAAM,WAAW,UAAyC;EACxD,IAAI,cAAc,KAAA,KAAa,KAAK,aAAa,MAAM;EACvD,MAAM,SAAS,MAAM;EACrB,MAAM,UAAU,oBAAoB,QAAQ,EAAE,IAAI,KAAK,MAAM,GAAG,CAAC;EAUjE,IAAI,CAPY,UACR,UAAU,OAAO,SACjB;GAEJ,IAAI,eAAe,KAAK,MAAM,YAAY,MAAM;EAClD,CAES,GAAG,MAAM,eAAe;CACrC;CAEA,MAAM,eAAiE;EACrE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EACvD;EAEA,iBAAiB,UAAU,OAAO,KAAA;EAClC,gBAAgB,SAAS,OAAO;CAClC;CAEA,MAAM,UAAU,UAA6D;EAC3E,gBAAgB;EAChB;EACA;EACA;EACA;EACA,UAAU,YAAY,KAAK,MAAM,QAAQ;EACzC,OAAO;EACP;CACF,CAAC;CACD,OAAO,cAAc,KAAA,IAAY,OAAO;AAC1C;AAEA,YAAY,cAAc"}
1
+ {"version":3,"file":"toast-action.mjs","names":[],"sources":["../../src/toast/toast-action.tsx"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { Action, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport type { ToastActionDetails, ToastItem } from \"./toast.js\";\nimport { useToastRootContext } from \"./toast-context.js\";\n\nexport interface ToastActionState {\n /** This part's action is in flight. */\n readonly pending: boolean;\n readonly toast: ToastItem;\n}\n\nexport interface ToastActionProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Runs in this part's own transition: `data-pending` on the Action and the Root, the toast's\n * timer paused. When it resolves the toast closes with `reason: \"activate\"` (unless\n * `closeOnSettle` is `false`); a rejection keeps the toast and reaches the nearest Error\n * Boundary above the Viewport. A caught error counts as success and closes the toast: rethrow\n * after `toast.update`, or use `closeOnSettle={false}`. Default: the toast's `action.action`.\n */\n action?: Action<[details: ToastActionDetails]>;\n /** Close the toast when the action resolves. Default `true`. */\n closeOnSettle?: boolean;\n /** Default: the toast's `action.label`. */\n children?: StateValue<ReactNode, ToastActionState>;\n className?: StateValue<string | undefined, ToastActionState>;\n style?: StateValue<CSSProperties | undefined, ToastActionState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, ToastActionState>;\n}\n\n/**\n * The toast's action button (Undo, Retry, View): a `button type=\"button\"` whose `action` runs as\n * a transition. Renders nothing when neither the part nor the toast has an action. Never natively\n * disabled while pending: a second click meanwhile is ignored and the Action is `aria-disabled`.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`, `aria-disabled`,\n * `data-pending`.\n */\nexport function ToastAction({\n action,\n closeOnSettle = true,\n children,\n className,\n style,\n render,\n ...rest\n}: ToastActionProps) {\n const root = useToastRootContext(\"Toast.Action\");\n const { pending, run } = useActionTrigger();\n const [token] = useState(() => ({}));\n const effective = action ?? root.toast.action?.action;\n const { setActionPending } = root;\n\n // The Root (and through it the Viewport's timer) sees this part's pending state.\n useLayoutEffect(() => {\n if (!pending) return;\n setActionPending(token, true);\n return () => setActionPending(token, false);\n }, [pending, setActionPending, token]);\n\n const state: ToastActionState = { pending, toast: root.toast };\n\n const onClick = (event: MouseEvent<HTMLElement>): void => {\n if (effective === undefined || rest.disabled === true) return;\n const native = event.nativeEvent;\n const details = createActionDetails(native, { id: root.toast.id });\n // A second click while this Action's own run is in flight starts nothing and is cancelled\n // (the hook's guard): one Undo, one Retry.\n const started = run(\n () => effective(details),\n () => {\n // Closing is idempotent: a dismissal meanwhile already closed it.\n if (closeOnSettle) root.close(\"activate\", native);\n },\n );\n if (!started) event.preventDefault();\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n onClick,\n // Exactly while `data-pending`. Owned, so an idle Action removes a render element's own.\n \"aria-disabled\": pending ? true : undefined,\n \"data-pending\": dataAttr(pending),\n };\n\n const element = useRender<ComponentPropsWithRef<\"button\">, ToastActionState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children: children ?? root.toast.action?.label,\n props: rest,\n libraryProps,\n });\n return effective === undefined ? null : element;\n}\n\nToastAction.displayName = \"ToastAction\";\n"],"mappings":";;;;;;;;;;;;;;;;;AA+CA,SAAgB,YAAY,EAC1B,QACA,gBAAgB,MAChB,UACA,WACA,OACA,QACA,GAAG,QACgB;CACnB,MAAM,OAAO,oBAAoB,cAAc;CAC/C,MAAM,EAAE,SAAS,QAAQ,iBAAiB;CAC1C,MAAM,CAAC,SAAS,gBAAgB,CAAC,EAAE;CACnC,MAAM,YAAY,UAAU,KAAK,MAAM,QAAQ;CAC/C,MAAM,EAAE,qBAAqB;CAG7B,sBAAsB;EACpB,IAAI,CAAC,SAAS;EACd,iBAAiB,OAAO,IAAI;EAC5B,aAAa,iBAAiB,OAAO,KAAK;CAC5C,GAAG;EAAC;EAAS;EAAkB;CAAK,CAAC;CAErC,MAAM,QAA0B;EAAE;EAAS,OAAO,KAAK;CAAM;CAE7D,MAAM,WAAW,UAAyC;EACxD,IAAI,cAAc,KAAA,KAAa,KAAK,aAAa,MAAM;EACvD,MAAM,SAAS,MAAM;EACrB,MAAM,UAAU,oBAAoB,QAAQ,EAAE,IAAI,KAAK,MAAM,GAAG,CAAC;EAUjE,IAAI,CAPY,UACR,UAAU,OAAO,SACjB;GAEJ,IAAI,eAAe,KAAK,MAAM,YAAY,MAAM;EAClD,CAES,GAAG,MAAM,eAAe;CACrC;CAEA,MAAM,eAAiE;EACrE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EACvD;EAEA,iBAAiB,UAAU,OAAO,KAAA;EAClC,gBAAgB,SAAS,OAAO;CAClC;CAEA,MAAM,UAAU,UAA6D;EAC3E,gBAAgB;EAChB;EACA;EACA;EACA;EACA,UAAU,YAAY,KAAK,MAAM,QAAQ;EACzC,OAAO;EACP;CACF,CAAC;CACD,OAAO,cAAc,KAAA,IAAY,OAAO;AAC1C;AAEA,YAAY,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"toast-close.d.mts","names":[],"sources":["../../src/toast/toast-close.tsx"],"mappings":";;;;iBASiB;WACN,OAAO;;iBAGD,wBAAwB,KACvC;EAGA,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,iCAAiC;;;;;;;;wBAWvC,aAAa,UAAU,WAAW,OAAO,WAAW,QAAQ,kBAAe;yBAA3E"}
1
+ {"version":3,"file":"toast-close.d.mts","names":[],"sources":["../../src/toast/toast-close.tsx"],"mappings":";;;;iBAWiB;WACN,OAAO;;iBAGD,wBAAwB,KACvC;EAGA,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,iCAAiC;;;;;;;;wBASvC,aAAa,UAAU,WAAW,OAAO,WAAW,QAAQ,kBAAe;yBAA3E"}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { rendersButton } from "../internal/render-element.mjs";
3
3
  import { useRender } from "../internal/use-render.mjs";
4
+ import { TEXT_NAME, useNameWarning } from "../internal/use-name-warning.mjs";
4
5
  import { useToastRootContext } from "./toast-context.mjs";
5
- import { useCallback } from "react";
6
6
  //#region src/toast/toast-close.tsx
7
7
  const isDev = process.env.NODE_ENV !== "production";
8
8
  /**
@@ -13,13 +13,7 @@ const isDev = process.env.NODE_ENV !== "production";
13
13
  */
14
14
  function ToastClose({ children, className, style, render, ...rest }) {
15
15
  const root = useToastRootContext("Toast.Close");
16
- const devRef = useCallback((element) => {
17
- if (isDev) queueMicrotask(() => {
18
- if (!element.isConnected) return;
19
- if (!(element.hasAttribute("aria-label") || element.hasAttribute("aria-labelledby") || (element.textContent ?? "").trim() !== "")) console.error("Toast.Close: the button has no accessible name. Give it text or an `aria-label`.");
20
- });
21
- return () => {};
22
- }, []);
16
+ const devRef = useNameWarning(isDev && "Toast.Close: the button has no accessible name. Give it text or an `aria-label`.", TEXT_NAME);
23
17
  const onClick = (event) => {
24
18
  if (rest.disabled === true) return;
25
19
  root.close("dismiss", event.nativeEvent);
@@ -1 +1 @@
1
- {"version":3,"file":"toast-close.mjs","names":[],"sources":["../../src/toast/toast-close.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport type { ToastItem } from \"./toast.js\";\nimport { useToastRootContext } from \"./toast-context.js\";\n\nexport interface ToastCloseState {\n readonly toast: ToastItem;\n}\n\nexport interface ToastCloseProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n children?: StateValue<ReactNode, ToastCloseState>;\n className?: StateValue<string | undefined, ToastCloseState>;\n style?: StateValue<CSSProperties | undefined, ToastCloseState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, ToastCloseState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * Dismisses the toast (`reason: \"dismiss\"`, the same as Escape). Label it yourself (`aria-label`\n * or text). No Invoker Command: `hide-popover` would hide the whole region.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`.\n */\nexport function ToastClose({ children, className, style, render, ...rest }: ToastCloseProps) {\n const root = useToastRootContext(\"Toast.Close\");\n\n const devRef = useCallback((element: HTMLElement) => {\n if (isDev) {\n // After the commit: the text may come from children rendered in the same commit.\n queueMicrotask(() => {\n if (!element.isConnected) return;\n const named =\n element.hasAttribute(\"aria-label\") ||\n element.hasAttribute(\"aria-labelledby\") ||\n (element.textContent ?? \"\").trim() !== \"\";\n if (!named) {\n console.error(\n \"Toast.Close: the button has no accessible name. Give it text or an `aria-label`.\",\n );\n }\n });\n }\n return () => {};\n }, []);\n\n const onClick = (event: MouseEvent<HTMLElement>): void => {\n if (rest.disabled === true) return;\n root.close(\"dismiss\", event.nativeEvent);\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n onClick,\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, ToastCloseState>({\n defaultElement: \"button\",\n render,\n state: { toast: root.toast },\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: devRef,\n });\n}\n\nToastClose.displayName = \"ToastClose\";\n"],"mappings":";;;;;;AAuBA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;AAQvC,SAAgB,WAAW,EAAE,UAAU,WAAW,OAAO,QAAQ,GAAG,QAAyB;CAC3F,MAAM,OAAO,oBAAoB,aAAa;CAE9C,MAAM,SAAS,aAAa,YAAyB;EACnD,IAAI,OAEF,qBAAqB;GACnB,IAAI,CAAC,QAAQ,aAAa;GAK1B,IAAI,EAHF,QAAQ,aAAa,YAAY,KACjC,QAAQ,aAAa,iBAAiB,MACrC,QAAQ,eAAe,GAAA,CAAI,KAAK,MAAM,KAEvC,QAAQ,MACN,kFACF;EAEJ,CAAC;EAEH,aAAa,CAAC;CAChB,GAAG,CAAC,CAAC;CAEL,MAAM,WAAW,UAAyC;EACxD,IAAI,KAAK,aAAa,MAAM;EAC5B,KAAK,MAAM,WAAW,MAAM,WAAW;CACzC;CAEA,MAAM,eAAiE;EACrE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EACvD;CACF;CAEA,OAAO,UAA4D;EACjE,gBAAgB;EAChB;EACA,OAAO,EAAE,OAAO,KAAK,MAAM;EAC3B;EACA;EACA;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;AACH;AAEA,WAAW,cAAc"}
1
+ {"version":3,"file":"toast-close.mjs","names":[],"sources":["../../src/toast/toast-close.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { TEXT_NAME, useNameWarning } from \"../internal/use-name-warning.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport type { ToastItem } from \"./toast.js\";\nimport { useToastRootContext } from \"./toast-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface ToastCloseState {\n readonly toast: ToastItem;\n}\n\nexport interface ToastCloseProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n children?: StateValue<ReactNode, ToastCloseState>;\n className?: StateValue<string | undefined, ToastCloseState>;\n style?: StateValue<CSSProperties | undefined, ToastCloseState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, ToastCloseState>;\n}\n\n/**\n * Dismisses the toast (`reason: \"dismiss\"`, the same as Escape). Label it yourself (`aria-label`\n * or text). No Invoker Command: `hide-popover` would hide the whole region.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`.\n */\nexport function ToastClose({ children, className, style, render, ...rest }: ToastCloseProps) {\n const root = useToastRootContext(\"Toast.Close\");\n\n const devRef = useNameWarning(\n isDev && \"Toast.Close: the button has no accessible name. Give it text or an `aria-label`.\",\n TEXT_NAME,\n );\n\n const onClick = (event: MouseEvent<HTMLElement>): void => {\n if (rest.disabled === true) return;\n root.close(\"dismiss\", event.nativeEvent);\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n onClick,\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, ToastCloseState>({\n defaultElement: \"button\",\n render,\n state: { toast: root.toast },\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: devRef,\n });\n}\n\nToastClose.displayName = \"ToastClose\";\n"],"mappings":";;;;;;AASA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;AAsBvC,SAAgB,WAAW,EAAE,UAAU,WAAW,OAAO,QAAQ,GAAG,QAAyB;CAC3F,MAAM,OAAO,oBAAoB,aAAa;CAE9C,MAAM,SAAS,eACb,SAAS,oFACT,SACF;CAEA,MAAM,WAAW,UAAyC;EACxD,IAAI,KAAK,aAAa,MAAM;EAC5B,KAAK,MAAM,WAAW,MAAM,WAAW;CACzC;CAEA,MAAM,eAAiE;EACrE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EACvD;CACF;CAEA,OAAO,UAA4D;EACjE,gBAAgB;EAChB;EACA,OAAO,EAAE,OAAO,KAAK,MAAM;EAC3B;EACA;EACA;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;AACH;AAEA,WAAW,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"toast-context.mjs","names":[],"sources":["../../src/toast/toast-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { ChangeReason } from \"../internal/types.js\";\nimport type { ToastItem, ToastPriority } from \"./toast.js\";\n\n/** What a Root (and the parts under it) need from the Viewport. Stable for the Viewport's life. */\nexport interface ToastViewportContextValue {\n /** Close toasts (`ending: true`), moving focus out first and scheduling `closeAction`. */\n readonly close: (ids: readonly string[], reason: ChangeReason, event: Event | undefined) => void;\n /** Remove an ending toast once its exit animations finished. */\n readonly drop: (id: string) => void;\n /** An action dispatched through the toast's Action part is (no longer) in flight. */\n readonly setActionPending: (id: string, pending: boolean) => void;\n /** The toast's content is (no longer) suspended behind the Root's guard. */\n readonly setSuspended: (id: string, suspended: boolean) => void;\n /** The Root's element, for arrow keys, the hotkey and focus moves; `null` to unregister. */\n readonly registerRoot: (id: string, element: HTMLElement | null) => void;\n /** Focus the next (`1`) or previous (`-1`) toast's Root, without wrapping. */\n readonly focusSibling: (id: string, direction: 1 | -1) => void;\n /** Queue an announcement; skipped when `text` equals the last one announced for `id`. */\n readonly announce: (id: string, text: string | null, priority: ToastPriority) => void;\n /** The Viewport's `announce` prop, read at announcement time. */\n readonly announcer: () => ((toast: ToastItem) => string | null) | undefined;\n /**\n * The animations that ran in the toast before it was marked ending (kept until it is dropped\n * or replaced): its exit waits only for the others.\n */\n readonly exitBaseline: (id: string) => ReadonlySet<Animation> | undefined;\n}\n\nexport const ToastViewportContext = createContext<ToastViewportContextValue | null>(null);\n\nexport function useToastViewportContext(part: string): ToastViewportContextValue {\n const context = use(ToastViewportContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Toast.Viewport.`);\n }\n return context;\n}\n\n/** What the parts inside a Root need. */\nexport interface ToastRootContextValue {\n readonly toast: ToastItem;\n readonly ids: { readonly title: string; readonly description: string };\n /** Root state, so Title and Description can resolve their function props against it. */\n readonly state: ToastRootStateShape;\n readonly registerTitle: (element: HTMLElement | null) => void;\n readonly registerDescription: (element: HTMLElement | null) => void;\n /** An Action part's run is (no longer) in flight; `token` identifies the part. */\n readonly setActionPending: (token: object, pending: boolean) => void;\n /**\n * A Title or Description committed: mounted, or shown again by a Suspense boundary inside the\n * Root (the consumer's skeleton), so the Root announces the text that now exists.\n */\n readonly contentCommitted: () => void;\n /** The Suspense guard mounted (`true`) or unmounted (`false`). */\n readonly setSuspended: (suspended: boolean) => void;\n /** Close this toast. */\n readonly close: (reason: ChangeReason, event: Event | undefined) => void;\n}\n\n/** Same shape as `ToastRootState` (declared in toast-root.tsx). */\nexport interface ToastRootStateShape {\n readonly toast: ToastItem;\n readonly pending: boolean;\n readonly ending: boolean;\n readonly type: string | undefined;\n readonly priority: ToastPriority;\n}\n\nexport const ToastRootContext = createContext<ToastRootContextValue | null>(null);\n\nexport function useToastRootContext(part: string): ToastRootContextValue {\n const context = use(ToastRootContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Toast.Root.`);\n }\n return context;\n}\n"],"mappings":";;;AA8BA,MAAa,uBAAuB,cAAgD,IAAI;AAExF,SAAgB,wBAAwB,MAAyC;CAC/E,MAAM,UAAU,IAAI,oBAAoB;CACxC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,2CAA2C;CAErE,OAAO;AACT;AAgCA,MAAa,mBAAmB,cAA4C,IAAI;AAEhF,SAAgB,oBAAoB,MAAqC;CACvE,MAAM,UAAU,IAAI,gBAAgB;CACpC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,uCAAuC;CAEjE,OAAO;AACT"}
1
+ {"version":3,"file":"toast-context.mjs","names":[],"sources":["../../src/toast/toast-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { ChangeReason } from \"../internal/types.js\";\nimport type { ToastRootState } from \"./toast-root.js\";\nimport type { ToastItem, ToastPriority } from \"./toast.js\";\n\n/** What a Root (and the parts under it) need from the Viewport. Stable for the Viewport's life. */\nexport interface ToastViewportContextValue {\n /** Close toasts (`ending: true`), moving focus out first and scheduling `closeAction`. */\n readonly close: (ids: readonly string[], reason: ChangeReason, event: Event | undefined) => void;\n /** Remove an ending toast once its exit animations finished. */\n readonly drop: (id: string) => void;\n /** An action dispatched through the toast's Action part is (no longer) in flight. */\n readonly setActionPending: (id: string, pending: boolean) => void;\n /** The toast's content is (no longer) suspended behind the Root's guard. */\n readonly setSuspended: (id: string, suspended: boolean) => void;\n /** The Root's element, for arrow keys, the hotkey and focus moves; `null` to unregister. */\n readonly registerRoot: (id: string, element: HTMLElement | null) => void;\n /** Focus the next (`1`) or previous (`-1`) toast's Root, without wrapping. */\n readonly focusSibling: (id: string, direction: 1 | -1) => void;\n /** Queue an announcement; skipped when `text` equals the last one announced for `id`. */\n readonly announce: (id: string, text: string | null, priority: ToastPriority) => void;\n /** The Viewport's `announce` prop, read at announcement time. */\n readonly announcer: () => ((toast: ToastItem) => string | null) | undefined;\n /**\n * The animations that ran in the toast before it was marked ending (kept until it is dropped\n * or replaced): its exit waits only for the others.\n */\n readonly exitBaseline: (id: string) => ReadonlySet<Animation> | undefined;\n}\n\nexport const ToastViewportContext = createContext<ToastViewportContextValue | null>(null);\n\nexport function useToastViewportContext(part: string): ToastViewportContextValue {\n const context = use(ToastViewportContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Toast.Viewport.`);\n }\n return context;\n}\n\n/** What the parts inside a Root need. */\nexport interface ToastRootContextValue {\n readonly toast: ToastItem;\n readonly ids: { readonly title: string; readonly description: string };\n /** Root state, so Title and Description can resolve their function props against it. */\n readonly state: ToastRootState;\n readonly registerTitle: (element: HTMLElement | null) => void;\n readonly registerDescription: (element: HTMLElement | null) => void;\n /** An Action part's run is (no longer) in flight; `token` identifies the part. */\n readonly setActionPending: (token: object, pending: boolean) => void;\n /**\n * A Title or Description committed: mounted, or shown again by a Suspense boundary inside the\n * Root (the consumer's skeleton), so the Root announces the text that now exists.\n */\n readonly contentCommitted: () => void;\n /** The Suspense guard mounted (`true`) or unmounted (`false`). */\n readonly setSuspended: (suspended: boolean) => void;\n /** Close this toast. */\n readonly close: (reason: ChangeReason, event: Event | undefined) => void;\n}\n\nexport const ToastRootContext = createContext<ToastRootContextValue | null>(null);\n\nexport function useToastRootContext(part: string): ToastRootContextValue {\n const context = use(ToastRootContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Toast.Root.`);\n }\n return context;\n}\n"],"mappings":";;;AA+BA,MAAa,uBAAuB,cAAgD,IAAI;AAExF,SAAgB,wBAAwB,MAAyC;CAC/E,MAAM,UAAU,IAAI,oBAAoB;CACxC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,2CAA2C;CAErE,OAAO;AACT;AAuBA,MAAa,mBAAmB,cAA4C,IAAI;AAEhF,SAAgB,oBAAoB,MAAqC;CACvE,MAAM,UAAU,IAAI,gBAAgB;CACpC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,uCAAuC;CAEjE,OAAO;AACT"}
@@ -0,0 +1,27 @@
1
+ //#region src/toast/toast-hotkey.ts
2
+ const DEFAULT_HOTKEY = ["F8"];
3
+ const MODIFIER_NAMES = {
4
+ altKey: "Alt",
5
+ ctrlKey: "Ctrl",
6
+ metaKey: "Meta",
7
+ shiftKey: "Shift"
8
+ };
9
+ /** `["altKey", "KeyT"]` → `"Alt+T"`, `["F8"]` → `"F8"`. */
10
+ function hotkeyLabel(hotkey) {
11
+ return hotkey.map((key) => MODIFIER_NAMES[key] ?? key.replace(/^Key(?=[A-Z]$)/, "").replace(/^Digit/, "")).join("+");
12
+ }
13
+ /** The region's built-in accessible name (conventions 11): `"Notifications (F8)"`. */
14
+ function regionLabel(hotkey) {
15
+ if (hotkey === null || hotkey.length === 0) return "Notifications";
16
+ return `Notifications (${hotkeyLabel(hotkey)})`;
17
+ }
18
+ /** The listed keys and modifiers, and no unlisted modifier (Ctrl+F8 is not F8). */
19
+ function matchesHotkey(hotkey, event) {
20
+ const flags = event;
21
+ for (const modifier of Object.keys(MODIFIER_NAMES)) if (flags[modifier] === true !== hotkey.includes(modifier)) return false;
22
+ return hotkey.every((key) => key in MODIFIER_NAMES || event.code === key);
23
+ }
24
+ //#endregion
25
+ export { DEFAULT_HOTKEY, matchesHotkey, regionLabel };
26
+
27
+ //# sourceMappingURL=toast-hotkey.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast-hotkey.mjs","names":[],"sources":["../../src/toast/toast-hotkey.ts"],"sourcesContent":["// The Viewport's hotkey (design/components/toast.md 7) and the region name built from it. No\n// \"use client\" directive: pure (conventions 7.1).\n\nexport const DEFAULT_HOTKEY: readonly string[] = [\"F8\"];\n\nconst MODIFIER_NAMES: Readonly<Record<string, string>> = {\n altKey: \"Alt\",\n ctrlKey: \"Ctrl\",\n metaKey: \"Meta\",\n shiftKey: \"Shift\",\n};\n\n/** `[\"altKey\", \"KeyT\"]` → `\"Alt+T\"`, `[\"F8\"]` → `\"F8\"`. */\nfunction hotkeyLabel(hotkey: readonly string[]): string {\n return hotkey\n .map((key) => MODIFIER_NAMES[key] ?? key.replace(/^Key(?=[A-Z]$)/, \"\").replace(/^Digit/, \"\"))\n .join(\"+\");\n}\n\n/** The region's built-in accessible name (conventions 11): `\"Notifications (F8)\"`. */\nexport function regionLabel(hotkey: readonly string[] | null): string {\n if (hotkey === null || hotkey.length === 0) return \"Notifications\";\n return `Notifications (${hotkeyLabel(hotkey)})`;\n}\n\n/** The listed keys and modifiers, and no unlisted modifier (Ctrl+F8 is not F8). */\nexport function matchesHotkey(hotkey: readonly string[], event: KeyboardEvent): boolean {\n const flags = event as unknown as Record<string, unknown>;\n for (const modifier of Object.keys(MODIFIER_NAMES)) {\n if ((flags[modifier] === true) !== hotkey.includes(modifier)) return false;\n }\n return hotkey.every((key) => key in MODIFIER_NAMES || event.code === key);\n}\n"],"mappings":";AAGA,MAAa,iBAAoC,CAAC,IAAI;AAEtD,MAAM,iBAAmD;CACvD,QAAQ;CACR,SAAS;CACT,SAAS;CACT,UAAU;AACZ;;AAGA,SAAS,YAAY,QAAmC;CACtD,OAAO,OACJ,KAAK,QAAQ,eAAe,QAAQ,IAAI,QAAQ,kBAAkB,EAAE,CAAC,CAAC,QAAQ,UAAU,EAAE,CAAC,CAAC,CAC5F,KAAK,GAAG;AACb;;AAGA,SAAgB,YAAY,QAA0C;CACpE,IAAI,WAAW,QAAQ,OAAO,WAAW,GAAG,OAAO;CACnD,OAAO,kBAAkB,YAAY,MAAM,EAAE;AAC/C;;AAGA,SAAgB,cAAc,QAA2B,OAA+B;CACtF,MAAM,QAAQ;CACd,KAAK,MAAM,YAAY,OAAO,KAAK,cAAc,GAC/C,IAAK,MAAM,cAAc,SAAU,OAAO,SAAS,QAAQ,GAAG,OAAO;CAEvE,OAAO,OAAO,OAAO,QAAQ,OAAO,kBAAkB,MAAM,SAAS,GAAG;AAC1E"}
@@ -0,0 +1,137 @@
1
+ //#region src/toast/toast-queue.ts
2
+ function makeEntry(options, flags) {
3
+ return {
4
+ options,
5
+ ...flags,
6
+ item: {
7
+ ...options,
8
+ id: options.id,
9
+ pending: flags.promisePending || flags.actionPending,
10
+ ending: flags.ending
11
+ }
12
+ };
13
+ }
14
+ function withFlags(entry, flags) {
15
+ return makeEntry(entry.options, {
16
+ promisePending: flags.promisePending ?? entry.promisePending,
17
+ actionPending: flags.actionPending ?? entry.actionPending,
18
+ ending: flags.ending ?? entry.ending
19
+ });
20
+ }
21
+ /** Rendered entries (the first `limit` open ones plus every ending one) and the queued count. */
22
+ function partition(entries, limit) {
23
+ const visible = [];
24
+ const queued = [];
25
+ let open = 0;
26
+ for (const entry of entries) if (entry.ending) visible.push(entry);
27
+ else if (open < limit) {
28
+ visible.push(entry);
29
+ open++;
30
+ } else queued.push(entry);
31
+ return {
32
+ visible,
33
+ queued
34
+ };
35
+ }
36
+ /** Plain text of a `ReactNode` that is text (queued toasts have no DOM to read yet). */
37
+ function plainText(node) {
38
+ if (typeof node === "string") return node;
39
+ if (typeof node === "number" || typeof node === "bigint") return String(node);
40
+ if (Array.isArray(node)) return node.map(plainText).join("");
41
+ return "";
42
+ }
43
+ /**
44
+ * Applies a batch of manager commands to the queue. Dismissals apply in order: each closes the
45
+ * toasts open at that point of the batch, never one added after it. A dismissed toast with a
46
+ * rendered Root (`isRendered`) turns ending; one never rendered (queued beyond `limit`, or added
47
+ * in this tick) leaves at once instead of mounting once as an ending Root. An add with the id of
48
+ * an open toast updates it ("one toast per key"); with the id of an ending one it replaces it
49
+ * (the keyed Root may be reused): a fresh timer, a fresh announcement, no exit.
50
+ */
51
+ function applyCommands(entries, commands, isRendered) {
52
+ const next = [...entries];
53
+ const dismissed = [];
54
+ const forgotten = [];
55
+ const replaced = [];
56
+ const missing = [];
57
+ let added = false;
58
+ for (const command of commands) {
59
+ if (command.kind === "dismiss") {
60
+ for (let i = 0; i < next.length; i++) {
61
+ const entry = next[i];
62
+ if (entry.ending) continue;
63
+ const id = entry.options.id;
64
+ if (command.id !== void 0 && id !== command.id) continue;
65
+ dismissed.push(entry);
66
+ if (isRendered(id)) next[i] = withFlags(entry, { ending: true });
67
+ else {
68
+ next.splice(i--, 1);
69
+ forgotten.push(id);
70
+ }
71
+ }
72
+ continue;
73
+ }
74
+ const index = next.findIndex((e) => e.options.id === command.id);
75
+ const existing = index === -1 ? void 0 : next[index];
76
+ if (command.kind === "add") {
77
+ const options = {
78
+ ...command.options,
79
+ id: command.id
80
+ };
81
+ if (existing !== void 0 && !existing.ending) {
82
+ next[index] = makeEntry({
83
+ ...existing.options,
84
+ ...options
85
+ }, {
86
+ promisePending: command.pending || existing.promisePending,
87
+ actionPending: existing.actionPending,
88
+ ending: false
89
+ });
90
+ continue;
91
+ }
92
+ if (existing !== void 0) {
93
+ next.splice(index, 1);
94
+ replaced.push(command.id);
95
+ forgotten.push(command.id);
96
+ }
97
+ next.push(makeEntry(options, {
98
+ promisePending: command.pending,
99
+ actionPending: false,
100
+ ending: false
101
+ }));
102
+ added = true;
103
+ } else {
104
+ if (existing === void 0) {
105
+ if (!command.settle) missing.push(command.id);
106
+ continue;
107
+ }
108
+ if (existing.ending) continue;
109
+ next[index] = makeEntry(command.settle ? {
110
+ ...command.options,
111
+ id: command.id
112
+ } : {
113
+ ...existing.options,
114
+ ...command.options,
115
+ id: command.id
116
+ }, {
117
+ promisePending: command.settle ? false : existing.promisePending,
118
+ actionPending: existing.actionPending,
119
+ ending: false
120
+ });
121
+ }
122
+ }
123
+ const stays = new Set(next.filter((e) => !e.ending).map((e) => e.options.id));
124
+ return {
125
+ next,
126
+ dismissed,
127
+ leaving: new Set(dismissed.map((e) => e.options.id).filter((id) => !stays.has(id))),
128
+ forgotten,
129
+ replaced,
130
+ added,
131
+ missing
132
+ };
133
+ }
134
+ //#endregion
135
+ export { applyCommands, makeEntry, partition, plainText, withFlags };
136
+
137
+ //# sourceMappingURL=toast-queue.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast-queue.mjs","names":[],"sources":["../../src/toast/toast-queue.ts"],"sourcesContent":["// The Viewport's queue model (design/components/toast.md 8, 12): entries, their public items, and\n// which of them render. No \"use client\" directive: pure (conventions 7.1).\nimport type { ToastCommand, ToastItem, ToastOptions } from \"./toast.js\";\n\n/** One queue entry: the toast's options and the flags its `ToastItem` is built from. */\nexport interface Entry {\n readonly options: ToastOptions & { readonly id: string };\n readonly promisePending: boolean;\n readonly actionPending: boolean;\n readonly ending: boolean;\n /** The public item, rebuilt whenever any of the above changes (stable identity otherwise). */\n readonly item: ToastItem;\n}\n\nexport function makeEntry(\n options: ToastOptions & { readonly id: string },\n flags: { promisePending: boolean; actionPending: boolean; ending: boolean },\n): Entry {\n return {\n options,\n ...flags,\n item: {\n ...options,\n id: options.id,\n pending: flags.promisePending || flags.actionPending,\n ending: flags.ending,\n },\n };\n}\n\nexport function withFlags(\n entry: Entry,\n flags: Partial<{ promisePending: boolean; actionPending: boolean; ending: boolean }>,\n): Entry {\n return makeEntry(entry.options, {\n promisePending: flags.promisePending ?? entry.promisePending,\n actionPending: flags.actionPending ?? entry.actionPending,\n ending: flags.ending ?? entry.ending,\n });\n}\n\n/** Rendered entries (the first `limit` open ones plus every ending one) and the queued count. */\nexport function partition(\n entries: readonly Entry[],\n limit: number,\n): { visible: Entry[]; queued: Entry[] } {\n const visible: Entry[] = [];\n const queued: Entry[] = [];\n let open = 0;\n for (const entry of entries) {\n if (entry.ending) visible.push(entry);\n else if (open < limit) {\n visible.push(entry);\n open++;\n } else queued.push(entry);\n }\n return { visible, queued };\n}\n\n/** Plain text of a `ReactNode` that is text (queued toasts have no DOM to read yet). */\nexport function plainText(node: unknown): string {\n if (typeof node === \"string\") return node;\n if (typeof node === \"number\" || typeof node === \"bigint\") return String(node);\n if (Array.isArray(node)) return node.map(plainText).join(\"\");\n return \"\";\n}\n\nexport interface AppliedCommands {\n readonly next: readonly Entry[];\n /** The open toasts the batch dismissed, in order (their `closeAction`s run). */\n readonly dismissed: readonly Entry[];\n /** Dismissed ids that leave the DOM: not those replaced by a later add with the id. */\n readonly leaving: ReadonlySet<string>;\n /**\n * Ids whose announcement and exit baseline start over: dismissed before they rendered, or an\n * ending toast replaced by a new one with its id (listed in `replaced` too).\n */\n readonly forgotten: readonly string[];\n /** Ending toasts replaced by a new add with their id: their timer starts over. */\n readonly replaced: readonly string[];\n /** The batch added a toast (the region re-raises). */\n readonly added: boolean;\n /** Ids of updates that found no toast (a promise settle excepted). */\n readonly missing: readonly string[];\n}\n\n/**\n * Applies a batch of manager commands to the queue. Dismissals apply in order: each closes the\n * toasts open at that point of the batch, never one added after it. A dismissed toast with a\n * rendered Root (`isRendered`) turns ending; one never rendered (queued beyond `limit`, or added\n * in this tick) leaves at once instead of mounting once as an ending Root. An add with the id of\n * an open toast updates it (\"one toast per key\"); with the id of an ending one it replaces it\n * (the keyed Root may be reused): a fresh timer, a fresh announcement, no exit.\n */\nexport function applyCommands(\n entries: readonly Entry[],\n commands: readonly ToastCommand[],\n isRendered: (id: string) => boolean,\n): AppliedCommands {\n const next = [...entries];\n const dismissed: Entry[] = [];\n const forgotten: string[] = [];\n const replaced: string[] = [];\n const missing: string[] = [];\n let added = false;\n for (const command of commands) {\n if (command.kind === \"dismiss\") {\n for (let i = 0; i < next.length; i++) {\n const entry = next[i]!;\n if (entry.ending) continue;\n const id = entry.options.id;\n if (command.id !== undefined && id !== command.id) continue;\n dismissed.push(entry);\n if (isRendered(id)) {\n next[i] = withFlags(entry, { ending: true });\n } else {\n next.splice(i--, 1);\n forgotten.push(id);\n }\n }\n continue;\n }\n const index = next.findIndex((e) => e.options.id === command.id);\n const existing = index === -1 ? undefined : next[index]!;\n if (command.kind === \"add\") {\n const options = { ...command.options, id: command.id };\n if (existing !== undefined && !existing.ending) {\n next[index] = makeEntry(\n { ...existing.options, ...options },\n {\n promisePending: command.pending || existing.promisePending,\n actionPending: existing.actionPending,\n ending: false,\n },\n );\n continue;\n }\n if (existing !== undefined) {\n next.splice(index, 1);\n replaced.push(command.id);\n forgotten.push(command.id);\n }\n next.push(\n makeEntry(options, {\n promisePending: command.pending,\n actionPending: false,\n ending: false,\n }),\n );\n added = true;\n } else {\n if (existing === undefined) {\n if (!command.settle) missing.push(command.id);\n continue;\n }\n if (existing.ending) continue;\n const options = command.settle\n ? { ...command.options, id: command.id }\n : { ...existing.options, ...command.options, id: command.id };\n next[index] = makeEntry(options, {\n promisePending: command.settle ? false : existing.promisePending,\n actionPending: existing.actionPending,\n ending: false,\n });\n }\n }\n const stays = new Set(next.filter((e) => !e.ending).map((e) => e.options.id));\n const leaving = new Set(dismissed.map((e) => e.options.id).filter((id) => !stays.has(id)));\n return { next, dismissed, leaving, forgotten, replaced, added, missing };\n}\n"],"mappings":";AAcA,SAAgB,UACd,SACA,OACO;CACP,OAAO;EACL;EACA,GAAG;EACH,MAAM;GACJ,GAAG;GACH,IAAI,QAAQ;GACZ,SAAS,MAAM,kBAAkB,MAAM;GACvC,QAAQ,MAAM;EAChB;CACF;AACF;AAEA,SAAgB,UACd,OACA,OACO;CACP,OAAO,UAAU,MAAM,SAAS;EAC9B,gBAAgB,MAAM,kBAAkB,MAAM;EAC9C,eAAe,MAAM,iBAAiB,MAAM;EAC5C,QAAQ,MAAM,UAAU,MAAM;CAChC,CAAC;AACH;;AAGA,SAAgB,UACd,SACA,OACuC;CACvC,MAAM,UAAmB,CAAC;CAC1B,MAAM,SAAkB,CAAC;CACzB,IAAI,OAAO;CACX,KAAK,MAAM,SAAS,SAClB,IAAI,MAAM,QAAQ,QAAQ,KAAK,KAAK;MAC/B,IAAI,OAAO,OAAO;EACrB,QAAQ,KAAK,KAAK;EAClB;CACF,OAAO,OAAO,KAAK,KAAK;CAE1B,OAAO;EAAE;EAAS;CAAO;AAC3B;;AAGA,SAAgB,UAAU,MAAuB;CAC/C,IAAI,OAAO,SAAS,UAAU,OAAO;CACrC,IAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU,OAAO,OAAO,IAAI;CAC5E,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,KAAK,IAAI,SAAS,CAAC,CAAC,KAAK,EAAE;CAC3D,OAAO;AACT;;;;;;;;;AA6BA,SAAgB,cACd,SACA,UACA,YACiB;CACjB,MAAM,OAAO,CAAC,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;GACL,IAAI,aAAa,KAAA,GAAW;IAC1B,IAAI,CAAC,QAAQ,QAAQ,QAAQ,KAAK,QAAQ,EAAE;IAC5C;GACF;GACA,IAAI,SAAS,QAAQ;GAIrB,KAAK,SAAS,UAHE,QAAQ,SACpB;IAAE,GAAG,QAAQ;IAAS,IAAI,QAAQ;GAAG,IACrC;IAAE,GAAG,SAAS;IAAS,GAAG,QAAQ;IAAS,IAAI,QAAQ;GAAG,GAC7B;IAC/B,gBAAgB,QAAQ,SAAS,QAAQ,SAAS;IAClD,eAAe,SAAS;IACxB,QAAQ;GACV,CAAC;EACH;CACF;CACA,MAAM,QAAQ,IAAI,IAAI,KAAK,QAAQ,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,MAAM,EAAE,QAAQ,EAAE,CAAC;CAE5E,OAAO;EAAE;EAAM;EAAW,SAAA,IADN,IAAI,UAAU,KAAK,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CACxD;EAAG;EAAW;EAAU;EAAO;CAAQ;AACzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"toast-root.d.mts","names":[],"sources":["../../src/toast/toast-root.tsx"],"mappings":";;;;iBAaiB;WACN,OAAO;;WAEP;;WAEA;WACA;WACA,UAAU;;iBAGJ,uBAAuB,KACtC;;EAIA,OAAO;EACP,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,8BAA8B;;;;;;EAMlD,WAAW;;;;;;;;;;;;wBA2BG,YACd,OAAO,MACP,UACA,WACA,OACA,QACA,aACG,QACF,iCAAc,IAAA;yBARD"}
1
+ {"version":3,"file":"toast-root.d.mts","names":[],"sources":["../../src/toast/toast-root.tsx"],"mappings":";;;;iBAciB;WACN,OAAO;;WAEP;;WAEA;WACA;WACA,UAAU;;iBAGJ,uBAAuB,KACtC;;EAIA,OAAO;EACP,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,8BAA8B;;;;;;EAMlD,WAAW;;;;;;;;;;;;wBA2BG,YACd,OAAO,MACP,UACA,WACA,OACA,QACA,aACG,QACF,iCAAc,IAAA;yBARD"}
@@ -3,6 +3,7 @@ import { dataAttr } from "../internal/data-attr.mjs";
3
3
  import { resolveStateValue } from "../internal/render-element.mjs";
4
4
  import { useRender } from "../internal/use-render.mjs";
5
5
  import { useLatest } from "../internal/use-latest.mjs";
6
+ import { ownsArrows } from "../internal/use-roving-focus.mjs";
6
7
  import { exitAnimations } from "../internal/use-exit-animation.mjs";
7
8
  import { ToastRootContext, useToastRootContext, useToastViewportContext } from "./toast-context.mjs";
8
9
  import { Suspense, useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
@@ -164,6 +165,7 @@ function ToastRoot({ toast: item, children, className, style, render, fallback =
164
165
  event.preventDefault();
165
166
  close("dismiss", event.nativeEvent);
166
167
  } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
168
+ if (ownsArrows(event.target)) return;
167
169
  event.preventDefault();
168
170
  viewport.focusSibling(id, event.key === "ArrowDown" ? 1 : -1);
169
171
  }
@@ -1 +1 @@
1
- {"version":3,"file":"toast-root.mjs","names":[],"sources":["../../src/toast/toast-root.tsx"],"sourcesContent":["\"use client\";\nimport { Suspense, useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, KeyboardEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { exitAnimations } from \"../internal/use-exit-animation.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport type { ToastItem, ToastPriority } from \"./toast.js\";\nimport { ToastRootContext, useToastRootContext, useToastViewportContext } from \"./toast-context.js\";\nimport type { ToastRootContextValue } from \"./toast-context.js\";\n\nexport interface ToastRootState {\n readonly toast: ToastItem;\n /** `toast.pending`: its promise is unsettled or its Action runs. */\n readonly pending: boolean;\n /** `toast.ending`: closed, kept for its exit animation. */\n readonly ending: boolean;\n readonly type: string | undefined;\n readonly priority: ToastPriority;\n}\n\nexport interface ToastRootProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"role\" | \"className\" | \"style\" | \"children\" | \"onKeyDown\"\n> {\n /** The toast to render: an item of the Viewport's `state.toasts`. */\n toast: ToastItem;\n children?: StateValue<ReactNode, ToastRootState>;\n className?: StateValue<string | undefined, ToastRootState>;\n style?: StateValue<CSSProperties | undefined, ToastRootState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, ToastRootState>;\n /**\n * Rendered by the Root's own Suspense guard while `children` suspend, in place of the\n * invisible default. The toast's timer and announcement wait for the reveal either way.\n * Parts inside it (a visually hidden `<Toast.Title>` giving the toast a name) gate nothing.\n */\n fallback?: ReactNode;\n}\n\n/**\n * The Suspense guard's fallback: renders the Root's `fallback` (nothing by default) and tells\n * the Root its content is suspended, so the timer and the announcement wait for the reveal\n * (design 3.5, 21).\n */\nfunction SuspenseGuard({ children }: { children: ReactNode }) {\n const { setSuspended } = useToastRootContext(\"Toast.Root\");\n useLayoutEffect(() => {\n setSuspended(true);\n return () => setSuspended(false);\n }, [setSuspended]);\n return children;\n}\n\n/**\n * One toast: a focusable `div[role=dialog]` (`alertdialog` for `priority: \"high\"`) named by its\n * Title and described by its Description. Escape dismisses it, ArrowDown / ArrowUp move to the\n * next / previous toast. Its children render inside a Suspense guard whose fallback is the\n * `fallback` prop (invisible by default), so a toast whose content suspends does not pull the whole Viewport into a boundary above it.\n * When the toast closes it stays with `data-ending` (and `inert`) until its exit animations end.\n *\n * Owned keys (conventions 1.2): `role`, `tabIndex`, `aria-labelledby`, `aria-describedby`,\n * `inert`, `data-type`, `data-pending`, `data-ending`, `onKeyDown`.\n */\nexport function ToastRoot({\n toast: item,\n children,\n className,\n style,\n render,\n fallback = null,\n ...rest\n}: ToastRootProps) {\n const viewport = useToastViewportContext(\"Toast.Root\");\n const id = item.id;\n const baseId = useId();\n const ids = useMemo(\n () => ({ title: `${baseId}title`, description: `${baseId}description` }),\n [baseId],\n );\n const elementRef = useRef<HTMLElement | null>(null);\n const titleRef = useRef<HTMLElement | null>(null);\n const descriptionRef = useRef<HTMLElement | null>(null);\n\n // Action pending, aggregated over the Action parts inside (normally one).\n const pendingTokens = useRef(new Set<object>());\n const [actionPending, setActionPendingState] = useState(false);\n // Suspended content behind the guard: a ref for effects of the same commit, state to re-run\n // the announcement once it reveals.\n const suspendedRef = useRef(false);\n const [suspended, setSuspendedState] = useState(false);\n\n const idRef = useLatest(id);\n // The Root's announcement effect has run once: later Title / Description commits are reveals.\n const announcedOnce = useRef(false);\n const revealQueued = useRef(false);\n\n const setActionPending = useCallback(\n (token: object, pending: boolean) => {\n const tokens = pendingTokens.current;\n if (pending) tokens.add(token);\n else tokens.delete(token);\n const any = tokens.size > 0;\n setActionPendingState(any);\n viewport.setActionPending(idRef.current, any);\n },\n [viewport, idRef],\n );\n\n const setSuspended = useCallback(\n (value: boolean) => {\n suspendedRef.current = value;\n setSuspendedState(value);\n viewport.setSuspended(idRef.current, value);\n },\n [viewport, idRef],\n );\n\n const close = useCallback(\n (reason: Parameters<ToastRootContextValue[\"close\"]>[0], event: Event | undefined) =>\n viewport.close([idRef.current], reason, event),\n [viewport, idRef],\n );\n\n const registerTitle = useCallback((element: HTMLElement | null) => {\n titleRef.current = element;\n }, []);\n const registerDescription = useCallback((element: HTMLElement | null) => {\n descriptionRef.current = element;\n }, []);\n\n const pending = item.pending || actionPending;\n const priority = item.priority ?? \"normal\";\n\n // Announce once the content has committed un-suspended (design 5): the Title and Description\n // text exists now. The Viewport skips text it already announced for this toast and speaks the\n // batch a microtask later.\n const announceNow = (): void => {\n if (item.ending || suspendedRef.current) return;\n const resolver = item.announce ?? viewport.announcer();\n let text: string | null;\n if (resolver !== undefined) text = resolver(item);\n else {\n text = [titleRef.current?.textContent, descriptionRef.current?.textContent]\n .map((t) => (t ?? \"\").trim())\n .filter((t) => t !== \"\")\n .join(\" \");\n }\n viewport.announce(item.id, text, priority);\n };\n const announceRef = useLatest(announceNow);\n\n // A Title or Description inside the consumer's own `<Suspense>` commits after the Root (the\n // boundary's retry does not re-run the Root's effect). Read once the whole reveal committed,\n // so a Title and a Description revealed together are announced as one text.\n const contentCommitted = useCallback(() => {\n if (!announcedOnce.current || revealQueued.current) return;\n revealQueued.current = true;\n queueMicrotask(() => {\n revealQueued.current = false;\n announceRef.current();\n });\n }, [announceRef]);\n const state = useMemo<ToastRootState>(\n () => ({ toast: item, pending, ending: item.ending, type: item.type, priority }),\n [item, pending, priority],\n );\n\n const context = useMemo<ToastRootContextValue>(\n () => ({\n toast: item,\n ids,\n state,\n registerTitle,\n registerDescription,\n contentCommitted,\n setActionPending,\n setSuspended,\n close,\n }),\n [\n item,\n ids,\n state,\n registerTitle,\n registerDescription,\n contentCommitted,\n setActionPending,\n setSuspended,\n close,\n ],\n );\n\n const rootRef = useCallback(\n (element: HTMLElement) => {\n elementRef.current = element;\n viewport.registerRoot(id, element);\n return () => {\n if (elementRef.current === element) elementRef.current = null;\n viewport.registerRoot(id, null);\n };\n },\n [viewport, id],\n );\n\n // A layout effect, so toasts announce in queue order (before the Viewport's own effect\n // announces the queued ones).\n useLayoutEffect(() => {\n announcedOnce.current = true;\n announceRef.current();\n }, [item, suspended, priority, announceRef]);\n\n // Exit (design 10.2): keep the ending toast until the animations the ending state started\n // settle, then drop it. Animations that ran before (a progress bar, paused with the region or\n // not) are not waited for: the Viewport recorded them just before marking the toast ending.\n useLayoutEffect(() => {\n if (!item.ending) return;\n const element = elementRef.current;\n const baseline = viewport.exitBaseline(item.id);\n const animations = element === null ? [] : exitAnimations(element, baseline);\n if (animations.length === 0) {\n viewport.drop(item.id);\n return;\n }\n let cancelled = false;\n void Promise.allSettled(animations.map((animation) => animation.finished)).then(() => {\n if (!cancelled) viewport.drop(item.id);\n });\n return () => {\n cancelled = true;\n };\n }, [item.ending, item.id, viewport]);\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>): void => {\n if (event.defaultPrevented || item.ending) return;\n if (event.key === \"Escape\") {\n event.preventDefault();\n close(\"dismiss\", event.nativeEvent);\n } else if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n viewport.focusSibling(id, event.key === \"ArrowDown\" ? 1 : -1);\n }\n };\n\n const libraryProps: ComponentPropsWithRef<\"div\"> & DataAttributes = {\n role: priority === \"high\" ? \"alertdialog\" : \"dialog\",\n tabIndex: 0,\n \"aria-labelledby\": ids.title,\n \"aria-describedby\": ids.description,\n inert: item.ending || undefined,\n \"data-type\": item.type,\n \"data-pending\": dataAttr(pending),\n \"data-ending\": dataAttr(item.ending),\n onKeyDown,\n };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, ToastRootState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children: (s: ToastRootState) => (\n <Suspense fallback={<SuspenseGuard>{fallback}</SuspenseGuard>}>\n {resolveStateValue(children, s)}\n </Suspense>\n ),\n props: rest,\n libraryProps,\n ref: rootRef,\n });\n\n return <ToastRootContext value={context}>{element}</ToastRootContext>;\n}\n\nToastRoot.displayName = \"ToastRoot\";\n"],"mappings":";;;;;;;;;;;;;;;AA8CA,SAAS,cAAc,EAAE,YAAqC;CAC5D,MAAM,EAAE,iBAAiB,oBAAoB,YAAY;CACzD,sBAAsB;EACpB,aAAa,IAAI;EACjB,aAAa,aAAa,KAAK;CACjC,GAAG,CAAC,YAAY,CAAC;CACjB,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,UAAU,EACxB,OAAO,MACP,UACA,WACA,OACA,QACA,WAAW,MACX,GAAG,QACc;CACjB,MAAM,WAAW,wBAAwB,YAAY;CACrD,MAAM,KAAK,KAAK;CAChB,MAAM,SAAS,MAAM;CACr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toast/toast-root.tsx"],"sourcesContent":["\"use client\";\nimport { Suspense, useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, KeyboardEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { exitAnimations } from \"../internal/use-exit-animation.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { ownsArrows } from \"../internal/use-roving-focus.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport type { ToastItem, ToastPriority } from \"./toast.js\";\nimport { ToastRootContext, useToastRootContext, useToastViewportContext } from \"./toast-context.js\";\nimport type { ToastRootContextValue } from \"./toast-context.js\";\n\nexport interface ToastRootState {\n readonly toast: ToastItem;\n /** `toast.pending`: its promise is unsettled or its Action runs. */\n readonly pending: boolean;\n /** `toast.ending`: closed, kept for its exit animation. */\n readonly ending: boolean;\n readonly type: string | undefined;\n readonly priority: ToastPriority;\n}\n\nexport interface ToastRootProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"role\" | \"className\" | \"style\" | \"children\" | \"onKeyDown\"\n> {\n /** The toast to render: an item of the Viewport's `state.toasts`. */\n toast: ToastItem;\n children?: StateValue<ReactNode, ToastRootState>;\n className?: StateValue<string | undefined, ToastRootState>;\n style?: StateValue<CSSProperties | undefined, ToastRootState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, ToastRootState>;\n /**\n * Rendered by the Root's own Suspense guard while `children` suspend, in place of the\n * invisible default. The toast's timer and announcement wait for the reveal either way.\n * Parts inside it (a visually hidden `<Toast.Title>` giving the toast a name) gate nothing.\n */\n fallback?: ReactNode;\n}\n\n/**\n * The Suspense guard's fallback: renders the Root's `fallback` (nothing by default) and tells\n * the Root its content is suspended, so the timer and the announcement wait for the reveal\n * (design 3.5, 21).\n */\nfunction SuspenseGuard({ children }: { children: ReactNode }) {\n const { setSuspended } = useToastRootContext(\"Toast.Root\");\n useLayoutEffect(() => {\n setSuspended(true);\n return () => setSuspended(false);\n }, [setSuspended]);\n return children;\n}\n\n/**\n * One toast: a focusable `div[role=dialog]` (`alertdialog` for `priority: \"high\"`) named by its\n * Title and described by its Description. Escape dismisses it, ArrowDown / ArrowUp move to the\n * next / previous toast. Its children render inside a Suspense guard whose fallback is the\n * `fallback` prop (invisible by default), so a toast whose content suspends does not pull the whole Viewport into a boundary above it.\n * When the toast closes it stays with `data-ending` (and `inert`) until its exit animations end.\n *\n * Owned keys (conventions 1.2): `role`, `tabIndex`, `aria-labelledby`, `aria-describedby`,\n * `inert`, `data-type`, `data-pending`, `data-ending`, `onKeyDown`.\n */\nexport function ToastRoot({\n toast: item,\n children,\n className,\n style,\n render,\n fallback = null,\n ...rest\n}: ToastRootProps) {\n const viewport = useToastViewportContext(\"Toast.Root\");\n const id = item.id;\n const baseId = useId();\n const ids = useMemo(\n () => ({ title: `${baseId}title`, description: `${baseId}description` }),\n [baseId],\n );\n const elementRef = useRef<HTMLElement | null>(null);\n const titleRef = useRef<HTMLElement | null>(null);\n const descriptionRef = useRef<HTMLElement | null>(null);\n\n // Action pending, aggregated over the Action parts inside (normally one).\n const pendingTokens = useRef(new Set<object>());\n const [actionPending, setActionPendingState] = useState(false);\n // Suspended content behind the guard: a ref for effects of the same commit, state to re-run\n // the announcement once it reveals.\n const suspendedRef = useRef(false);\n const [suspended, setSuspendedState] = useState(false);\n\n const idRef = useLatest(id);\n // The Root's announcement effect has run once: later Title / Description commits are reveals.\n const announcedOnce = useRef(false);\n const revealQueued = useRef(false);\n\n const setActionPending = useCallback(\n (token: object, pending: boolean) => {\n const tokens = pendingTokens.current;\n if (pending) tokens.add(token);\n else tokens.delete(token);\n const any = tokens.size > 0;\n setActionPendingState(any);\n viewport.setActionPending(idRef.current, any);\n },\n [viewport, idRef],\n );\n\n const setSuspended = useCallback(\n (value: boolean) => {\n suspendedRef.current = value;\n setSuspendedState(value);\n viewport.setSuspended(idRef.current, value);\n },\n [viewport, idRef],\n );\n\n const close = useCallback(\n (reason: Parameters<ToastRootContextValue[\"close\"]>[0], event: Event | undefined) =>\n viewport.close([idRef.current], reason, event),\n [viewport, idRef],\n );\n\n const registerTitle = useCallback((element: HTMLElement | null) => {\n titleRef.current = element;\n }, []);\n const registerDescription = useCallback((element: HTMLElement | null) => {\n descriptionRef.current = element;\n }, []);\n\n const pending = item.pending || actionPending;\n const priority = item.priority ?? \"normal\";\n\n // Announce once the content has committed un-suspended (design 5): the Title and Description\n // text exists now. The Viewport skips text it already announced for this toast and speaks the\n // batch a microtask later.\n const announceNow = (): void => {\n if (item.ending || suspendedRef.current) return;\n const resolver = item.announce ?? viewport.announcer();\n let text: string | null;\n if (resolver !== undefined) text = resolver(item);\n else {\n text = [titleRef.current?.textContent, descriptionRef.current?.textContent]\n .map((t) => (t ?? \"\").trim())\n .filter((t) => t !== \"\")\n .join(\" \");\n }\n viewport.announce(item.id, text, priority);\n };\n const announceRef = useLatest(announceNow);\n\n // A Title or Description inside the consumer's own `<Suspense>` commits after the Root (the\n // boundary's retry does not re-run the Root's effect). Read once the whole reveal committed,\n // so a Title and a Description revealed together are announced as one text.\n const contentCommitted = useCallback(() => {\n if (!announcedOnce.current || revealQueued.current) return;\n revealQueued.current = true;\n queueMicrotask(() => {\n revealQueued.current = false;\n announceRef.current();\n });\n }, [announceRef]);\n const state = useMemo<ToastRootState>(\n () => ({ toast: item, pending, ending: item.ending, type: item.type, priority }),\n [item, pending, priority],\n );\n\n const context = useMemo<ToastRootContextValue>(\n () => ({\n toast: item,\n ids,\n state,\n registerTitle,\n registerDescription,\n contentCommitted,\n setActionPending,\n setSuspended,\n close,\n }),\n [\n item,\n ids,\n state,\n registerTitle,\n registerDescription,\n contentCommitted,\n setActionPending,\n setSuspended,\n close,\n ],\n );\n\n const rootRef = useCallback(\n (element: HTMLElement) => {\n elementRef.current = element;\n viewport.registerRoot(id, element);\n return () => {\n if (elementRef.current === element) elementRef.current = null;\n viewport.registerRoot(id, null);\n };\n },\n [viewport, id],\n );\n\n // A layout effect, so toasts announce in queue order (before the Viewport's own effect\n // announces the queued ones).\n useLayoutEffect(() => {\n announcedOnce.current = true;\n announceRef.current();\n }, [item, suspended, priority, announceRef]);\n\n // Exit (design 10.2): keep the ending toast until the animations the ending state started\n // settle, then drop it. Animations that ran before (a progress bar, paused with the region or\n // not) are not waited for: the Viewport recorded them just before marking the toast ending.\n useLayoutEffect(() => {\n if (!item.ending) return;\n const element = elementRef.current;\n const baseline = viewport.exitBaseline(item.id);\n const animations = element === null ? [] : exitAnimations(element, baseline);\n if (animations.length === 0) {\n viewport.drop(item.id);\n return;\n }\n let cancelled = false;\n void Promise.allSettled(animations.map((animation) => animation.finished)).then(() => {\n if (!cancelled) viewport.drop(item.id);\n });\n return () => {\n cancelled = true;\n };\n }, [item.ending, item.id, viewport]);\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>): void => {\n if (event.defaultPrevented || item.ending) return;\n if (event.key === \"Escape\") {\n event.preventDefault();\n close(\"dismiss\", event.nativeEvent);\n } else if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n // A text field, select or slider inside the toast keeps its arrows (#113 A3).\n if (ownsArrows(event.target as Element)) return;\n event.preventDefault();\n viewport.focusSibling(id, event.key === \"ArrowDown\" ? 1 : -1);\n }\n };\n\n const libraryProps: ComponentPropsWithRef<\"div\"> & DataAttributes = {\n role: priority === \"high\" ? \"alertdialog\" : \"dialog\",\n tabIndex: 0,\n \"aria-labelledby\": ids.title,\n \"aria-describedby\": ids.description,\n inert: item.ending || undefined,\n \"data-type\": item.type,\n \"data-pending\": dataAttr(pending),\n \"data-ending\": dataAttr(item.ending),\n onKeyDown,\n };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, ToastRootState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children: (s: ToastRootState) => (\n <Suspense fallback={<SuspenseGuard>{fallback}</SuspenseGuard>}>\n {resolveStateValue(children, s)}\n </Suspense>\n ),\n props: rest,\n libraryProps,\n ref: rootRef,\n });\n\n return <ToastRootContext value={context}>{element}</ToastRootContext>;\n}\n\nToastRoot.displayName = \"ToastRoot\";\n"],"mappings":";;;;;;;;;;;;;;;;AA+CA,SAAS,cAAc,EAAE,YAAqC;CAC5D,MAAM,EAAE,iBAAiB,oBAAoB,YAAY;CACzD,sBAAsB;EACpB,aAAa,IAAI;EACjB,aAAa,aAAa,KAAK;CACjC,GAAG,CAAC,YAAY,CAAC;CACjB,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,UAAU,EACxB,OAAO,MACP,UACA,WACA,OACA,QACA,WAAW,MACX,GAAG,QACc;CACjB,MAAM,WAAW,wBAAwB,YAAY;CACrD,MAAM,KAAK,KAAK;CAChB,MAAM,SAAS,MAAM;CACrB,MAAM,MAAM,eACH;EAAE,OAAO,GAAG,OAAO;EAAQ,aAAa,GAAG,OAAO;CAAa,IACtE,CAAC,MAAM,CACT;CACA,MAAM,aAAa,OAA2B,IAAI;CAClD,MAAM,WAAW,OAA2B,IAAI;CAChD,MAAM,iBAAiB,OAA2B,IAAI;CAGtD,MAAM,gBAAgB,uBAAO,IAAI,IAAY,CAAC;CAC9C,MAAM,CAAC,eAAe,yBAAyB,SAAS,KAAK;CAG7D,MAAM,eAAe,OAAO,KAAK;CACjC,MAAM,CAAC,WAAW,qBAAqB,SAAS,KAAK;CAErD,MAAM,QAAQ,UAAU,EAAE;CAE1B,MAAM,gBAAgB,OAAO,KAAK;CAClC,MAAM,eAAe,OAAO,KAAK;CAEjC,MAAM,mBAAmB,aACtB,OAAe,YAAqB;EACnC,MAAM,SAAS,cAAc;EAC7B,IAAI,SAAS,OAAO,IAAI,KAAK;OACxB,OAAO,OAAO,KAAK;EACxB,MAAM,MAAM,OAAO,OAAO;EAC1B,sBAAsB,GAAG;EACzB,SAAS,iBAAiB,MAAM,SAAS,GAAG;CAC9C,GACA,CAAC,UAAU,KAAK,CAClB;CAEA,MAAM,e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aAAa,SAAS,gBAAgB;EAC5C,UAAU;EACV,mBAAmB,IAAI;EACvB,oBAAoB,IAAI;EACxB,OAAO,KAAK,UAAU,KAAA;EACtB,aAAa,KAAK;EAClB,gBAAgB,SAAS,OAAO;EAChC,eAAe,SAAS,KAAK,MAAM;EACnC;CACF;CAEA,MAAM,UAAU,UAAwD;EACtE,gBAAgB;EAChB;EACA;EACA;EACA;EACA,WAAW,MACT,oBAAC,UAAD;GAAU,UAAU,oBAAC,eAAD,EAAA,UAAgB,SAAwB,CAAA;GACzD,UAAA,kBAAkB,UAAU,CAAC;EACtB,CAAA;EAEZ,OAAO;EACP;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,kBAAD;EAAkB,OAAO;EAAU,UAAA;CAA0B,CAAA;AACtE;AAEA,UAAU,cAAc"}
@@ -0,0 +1,65 @@
1
+ //#region src/toast/toast-timers.ts
2
+ /** A toast's own `duration`, else none with an action (it waits for the user), else the default. */
3
+ function effectiveDuration(entry, defaultDuration) {
4
+ const own = entry.options.duration;
5
+ if (own !== void 0) return own;
6
+ return entry.options.action !== void 0 ? null : defaultDuration;
7
+ }
8
+ /**
9
+ * Matches the timers to the rendered entries: starts or resumes the timer of each open, timed
10
+ * toast that is not pending, suspended or halted, pauses the others keeping their remaining
11
+ * time, and drops the timers of toasts no longer rendered (or no longer timed).
12
+ */
13
+ function syncToastTimers(map, visible, sync) {
14
+ const now = Date.now();
15
+ const live = /* @__PURE__ */ new Set();
16
+ for (const entry of visible) {
17
+ if (entry.ending) continue;
18
+ const id = entry.options.id;
19
+ const ms = effectiveDuration(entry, sync.defaultDuration);
20
+ if (ms === null) continue;
21
+ live.add(id);
22
+ let timer = map.get(id);
23
+ if (timer === void 0 || timer.duration !== ms) {
24
+ if (timer?.handle != null) clearTimeout(timer.handle);
25
+ timer = {
26
+ duration: ms,
27
+ remaining: ms,
28
+ startedAt: 0,
29
+ handle: null
30
+ };
31
+ map.set(id, timer);
32
+ }
33
+ const run = !sync.halted && !entry.item.pending && !sync.suspended.has(id);
34
+ if (run && timer.handle === null) {
35
+ const current = timer;
36
+ current.startedAt = now;
37
+ current.handle = setTimeout(() => {
38
+ current.handle = null;
39
+ current.remaining = 0;
40
+ sync.expire(id);
41
+ }, Math.max(0, current.remaining));
42
+ } else if (!run && timer.handle !== null) {
43
+ clearTimeout(timer.handle);
44
+ timer.handle = null;
45
+ timer.remaining -= now - timer.startedAt;
46
+ }
47
+ }
48
+ for (const [id, timer] of map) {
49
+ if (live.has(id)) continue;
50
+ if (timer.handle !== null) clearTimeout(timer.handle);
51
+ map.delete(id);
52
+ }
53
+ }
54
+ /** Stops and forgets the timer of `id`, or every timer. */
55
+ function clearToastTimers(map, id) {
56
+ for (const [key, timer] of map) {
57
+ if (id !== void 0 && key !== id) continue;
58
+ if (timer.handle !== null) clearTimeout(timer.handle);
59
+ map.delete(key);
60
+ }
61
+ }
62
+ //#endregion
63
+ export { clearToastTimers, syncToastTimers };
64
+
65
+ //# sourceMappingURL=toast-timers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast-timers.mjs","names":[],"sources":["../../src/toast/toast-timers.ts"],"sourcesContent":["// The Viewport's per-toast timers (design/components/toast.md 6). No \"use client\" directive: pure\n// (conventions 7.1); the Viewport keeps the map in a ref.\nimport type { Entry } from \"./toast-queue.js\";\n\nexport interface ToastTimer {\n /** The duration the timer was started with; a different effective duration restarts it. */\n readonly duration: number;\n remaining: number;\n startedAt: number;\n handle: ReturnType<typeof setTimeout> | null;\n}\n\nexport interface TimerSync {\n /** A viewport-wide pause holds, or the Viewport is not mounted: no timer runs. */\n readonly halted: boolean;\n /** Toasts whose content suspends: their timer waits. */\n readonly suspended: ReadonlySet<string>;\n /** The Viewport's `duration`. */\n readonly defaultDuration: number | null;\n /** A timer ran out. */\n readonly expire: (id: string) => void;\n}\n\n/** A toast's own `duration`, else none with an action (it waits for the user), else the default. */\nfunction effectiveDuration(entry: Entry, defaultDuration: number | null): number | null {\n const own = entry.options.duration;\n if (own !== undefined) return own;\n return entry.options.action !== undefined ? null : defaultDuration;\n}\n\n/**\n * Matches the timers to the rendered entries: starts or resumes the timer of each open, timed\n * toast that is not pending, suspended or halted, pauses the others keeping their remaining\n * time, and drops the timers of toasts no longer rendered (or no longer timed).\n */\nexport function syncToastTimers(\n map: Map<string, ToastTimer>,\n visible: readonly Entry[],\n sync: TimerSync,\n): void {\n const now = Date.now();\n const live = new Set<string>();\n for (const entry of visible) {\n if (entry.ending) continue;\n const id = entry.options.id;\n const ms = effectiveDuration(entry, sync.defaultDuration);\n if (ms === null) continue;\n live.add(id);\n let timer = map.get(id);\n if (timer === undefined || timer.duration !== ms) {\n if (timer?.handle != null) clearTimeout(timer.handle);\n timer = { duration: ms, remaining: ms, startedAt: 0, handle: null };\n map.set(id, timer);\n }\n const run = !sync.halted && !entry.item.pending && !sync.suspended.has(id);\n if (run && timer.handle === null) {\n const current = timer;\n current.startedAt = now;\n current.handle = setTimeout(\n () => {\n current.handle = null;\n current.remaining = 0;\n sync.expire(id);\n },\n Math.max(0, current.remaining),\n );\n } else if (!run && timer.handle !== null) {\n clearTimeout(timer.handle);\n timer.handle = null;\n timer.remaining -= now - timer.startedAt;\n }\n }\n for (const [id, timer] of map) {\n if (live.has(id)) continue;\n if (timer.handle !== null) clearTimeout(timer.handle);\n map.delete(id);\n }\n}\n\n/** Stops and forgets the timer of `id`, or every timer. */\nexport function clearToastTimers(map: Map<string, ToastTimer>, id?: string): void {\n for (const [key, timer] of map) {\n if (id !== undefined && key !== id) continue;\n if (timer.handle !== null) clearTimeout(timer.handle);\n map.delete(key);\n }\n}\n"],"mappings":";;AAwBA,SAAS,kBAAkB,OAAc,iBAA+C;CACtF,MAAM,MAAM,MAAM,QAAQ;CAC1B,IAAI,QAAQ,KAAA,GAAW,OAAO;CAC9B,OAAO,MAAM,QAAQ,WAAW,KAAA,IAAY,OAAO;AACrD;;;;;;AAOA,SAAgB,gBACd,KACA,SACA,MACM;CACN,MAAM,MAAM,KAAK,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O,GAAG;CAChB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"toast-viewport.d.mts","names":[],"sources":["../../src/toast/toast-viewport.tsx"],"mappings":";;;;iBAyCiB;;WAEN,iBAAiB;;WAEjB;;WAEA;;iBAGM,2BAA2B,KAC1C;;EAYA,UAAU;;EAEV;;EAEA;;;;;;EAMA;;;;;EAKA,YAAY,OAAO;;EAEnB,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,SAAS,WAAW,kCAAkC;;;;;;;;;;;wBA0JxC,gBACd,SACA,OACA,UACA,QACA,UACA,UACA,WACA,OACA,WACG,QACF,qCAAkB,IAAA;yBAXL"}
1
+ {"version":3,"file":"toast-viewport.d.mts","names":[],"sources":["../../src/toast/toast-viewport.tsx"],"mappings":";;;;iBA0CiB;;WAEN,iBAAiB;;WAEjB;;WAEA;;iBAGM,2BAA2B,KAC1C;;EAYA,UAAU;;EAEV;;EAEA;;;;;;EAMA;;;;;EAKA,YAAY,OAAO;;EAEnB,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,SAAS,WAAW,kCAAkC;;;;;;;;;;;wBAiCxC,gBACd,SACA,OACA,UACA,QACA,UACA,UACA,WACA,OACA,WACG,QACF,qCAAkB,IAAA;yBAXL"}