@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
@@ -4,94 +4,20 @@ import { dataAttr } from "../internal/data-attr.mjs";
4
4
  import { useDevWarning } from "../internal/use-dev-warning.mjs";
5
5
  import { useRender } from "../internal/use-render.mjs";
6
6
  import { useLatest } from "../internal/use-latest.mjs";
7
+ import { isPopoverOpen } from "../internal/popover-open.mjs";
7
8
  import { DialogContext } from "../dialog/dialog-context.mjs";
8
9
  import { animationBaseline } from "../internal/use-exit-animation.mjs";
9
- import { getServerTopmostModal, getTopmostModal, subscribeModals } from "../internal/modal-registry.mjs";
10
10
  import { ToastViewportContext } from "./toast-context.mjs";
11
11
  import { toast, toastManagerInternals } from "./toast.mjs";
12
- import { use, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
12
+ import { DEFAULT_HOTKEY, matchesHotkey, regionLabel } from "./toast-hotkey.mjs";
13
+ import { clearToastTimers, syncToastTimers } from "./toast-timers.mjs";
14
+ import { useModalPortalHost } from "./use-modal-portal-host.mjs";
15
+ import { applyCommands, makeEntry, partition, plainText, withFlags } from "./toast-queue.mjs";
16
+ import { use, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, useTransition } from "react";
13
17
  import { createPortal } from "react-dom";
14
18
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
19
  //#region src/toast/toast-viewport.tsx
16
20
  const isDev = process.env.NODE_ENV !== "production";
17
- const DEFAULT_HOTKEY = ["F8"];
18
- const MODIFIER_NAMES = {
19
- altKey: "Alt",
20
- ctrlKey: "Ctrl",
21
- metaKey: "Meta",
22
- shiftKey: "Shift"
23
- };
24
- /** `["altKey", "KeyT"]` → `"Alt+T"`, `["F8"]` → `"F8"`. */
25
- function hotkeyLabel(hotkey) {
26
- return hotkey.map((key) => MODIFIER_NAMES[key] ?? key.replace(/^Key(?=[A-Z]$)/, "").replace(/^Digit/, "")).join("+");
27
- }
28
- /** The region's built-in accessible name (conventions 11): `"Notifications (F8)"`. */
29
- function regionLabel(hotkey) {
30
- if (hotkey === null || hotkey.length === 0) return "Notifications";
31
- return `Notifications (${hotkeyLabel(hotkey)})`;
32
- }
33
- /** The listed keys and modifiers, and no unlisted modifier (Ctrl+F8 is not F8). */
34
- function matchesHotkey(hotkey, event) {
35
- const flags = event;
36
- for (const modifier of Object.keys(MODIFIER_NAMES)) if (flags[modifier] === true !== hotkey.includes(modifier)) return false;
37
- return hotkey.every((key) => key in MODIFIER_NAMES || event.code === key);
38
- }
39
- /** No store: `useSyncExternalStore` only tells the hydration render from a client render. */
40
- const subscribeNothing = () => () => {};
41
- const onClient = () => true;
42
- const onServerOrHydrating = () => false;
43
- /**
44
- * The element the region is portalled into for its whole client life. The library moves this
45
- * element (between its inline anchor and the topmost modal dialog); React never sees the move, so
46
- * the toasts keep their state (an Undo in flight stays pending). `display: contents`: no box.
47
- */
48
- function createHost() {
49
- if (typeof document === "undefined") return null;
50
- const host = document.createElement("div");
51
- host.style.display = "contents";
52
- return host;
53
- }
54
- function makeEntry(options, flags) {
55
- return {
56
- options,
57
- ...flags,
58
- item: {
59
- ...options,
60
- id: options.id,
61
- pending: flags.promisePending || flags.actionPending,
62
- ending: flags.ending
63
- }
64
- };
65
- }
66
- function withFlags(entry, flags) {
67
- return makeEntry(entry.options, {
68
- promisePending: flags.promisePending ?? entry.promisePending,
69
- actionPending: flags.actionPending ?? entry.actionPending,
70
- ending: flags.ending ?? entry.ending
71
- });
72
- }
73
- /** Rendered entries (the first `limit` open ones plus every ending one) and the queued count. */
74
- function partition(entries, limit) {
75
- const visible = [];
76
- const queued = [];
77
- let open = 0;
78
- for (const entry of entries) if (entry.ending) visible.push(entry);
79
- else if (open < limit) {
80
- visible.push(entry);
81
- open++;
82
- } else queued.push(entry);
83
- return {
84
- visible,
85
- queued
86
- };
87
- }
88
- /** Plain text of a `ReactNode` that is text (queued toasts have no DOM to read yet). */
89
- function plainText(node) {
90
- if (typeof node === "string") return node;
91
- if (typeof node === "number" || typeof node === "bigint") return String(node);
92
- if (Array.isArray(node)) return node.map(plainText).join("");
93
- return "";
94
- }
95
21
  /** Document order. */
96
22
  function byDocumentPosition(a, b) {
97
23
  if (a === b) return 0;
@@ -145,59 +71,17 @@ function ToastViewport({ manager = toast, limit = 3, duration = 5e3, hotkey = DE
145
71
  hotkey,
146
72
  announce
147
73
  });
148
- const container = useSyncExternalStore(subscribeModals, getTopmostModal, getServerTopmostModal);
149
74
  const write = (next) => {
150
75
  entriesRef.current = next;
151
76
  setEntries(next);
152
77
  };
153
- const effectiveDuration = (entry) => {
154
- const own = entry.options.duration;
155
- if (own !== void 0) return own;
156
- return entry.options.action !== void 0 ? null : latest.current.duration;
157
- };
158
78
  const syncTimers = () => {
159
- const map = timers.current;
160
- const { visible } = partition(entriesRef.current, latest.current.limit);
161
- const now = Date.now();
162
- const live = /* @__PURE__ */ new Set();
163
- const halted = !mounted.current || anyPause(pauses.current);
164
- for (const entry of visible) {
165
- if (entry.ending) continue;
166
- const id = entry.options.id;
167
- const ms = effectiveDuration(entry);
168
- if (ms === null) continue;
169
- live.add(id);
170
- let timer = map.get(id);
171
- if (timer === void 0 || timer.duration !== ms) {
172
- if (timer?.handle != null) clearTimeout(timer.handle);
173
- timer = {
174
- duration: ms,
175
- remaining: ms,
176
- startedAt: 0,
177
- handle: null
178
- };
179
- map.set(id, timer);
180
- }
181
- const run = !halted && !entry.item.pending && !suspended.current.has(id);
182
- if (run && timer.handle === null) {
183
- const current = timer;
184
- current.startedAt = now;
185
- current.handle = setTimeout(() => {
186
- current.handle = null;
187
- current.remaining = 0;
188
- close([id], "timeout", void 0);
189
- }, Math.max(0, current.remaining));
190
- } else if (!run && timer.handle !== null) {
191
- clearTimeout(timer.handle);
192
- timer.handle = null;
193
- timer.remaining -= now - timer.startedAt;
194
- }
195
- }
196
- for (const [id, timer] of map) {
197
- if (live.has(id)) continue;
198
- if (timer.handle !== null) clearTimeout(timer.handle);
199
- map.delete(id);
200
- }
79
+ syncToastTimers(timers.current, partition(entriesRef.current, latest.current.limit).visible, {
80
+ halted: !mounted.current || anyPause(pauses.current),
81
+ suspended: suspended.current,
82
+ defaultDuration: latest.current.duration,
83
+ expire: (id) => close([id], "timeout", void 0)
84
+ });
201
85
  };
202
86
  const setPause = (source, value) => {
203
87
  if (pauses.current[source] === value) return;
@@ -254,11 +138,6 @@ function ToastViewport({ manager = toast, limit = 3, duration = 5e3, hotkey = DE
254
138
  exitBaselines.current.set(id, animationBaseline(element));
255
139
  }
256
140
  };
257
- const clearTimer = (id) => {
258
- const timer = timers.current.get(id);
259
- if (timer?.handle != null) clearTimeout(timer.handle);
260
- timers.current.delete(id);
261
- };
262
141
  const scheduleCloseActions = (closed, reason, event) => {
263
142
  for (const entry of closed) {
264
143
  const closeAction = entry.options.closeAction;
@@ -294,86 +173,23 @@ function ToastViewport({ manager = toast, limit = 3, duration = 5e3, hotkey = DE
294
173
  write(next);
295
174
  };
296
175
  const apply = (commands) => {
297
- const next = [...entriesRef.current];
298
- const dismissed = [];
299
- for (const command of commands) {
300
- if (command.kind === "dismiss") {
301
- for (let i = 0; i < next.length; i++) {
302
- const entry = next[i];
303
- if (entry.ending) continue;
304
- const id = entry.options.id;
305
- if (command.id !== void 0 && id !== command.id) continue;
306
- dismissed.push(entry);
307
- if (roots.current.has(id)) next[i] = withFlags(entry, { ending: true });
308
- else {
309
- next.splice(i--, 1);
310
- lastAnnounced.current.delete(id);
311
- exitBaselines.current.delete(id);
312
- }
313
- }
314
- continue;
315
- }
316
- const index = next.findIndex((e) => e.options.id === command.id);
317
- const existing = index === -1 ? void 0 : next[index];
318
- if (command.kind === "add") {
319
- const options = {
320
- ...command.options,
321
- id: command.id
322
- };
323
- if (existing !== void 0 && !existing.ending) {
324
- next[index] = makeEntry({
325
- ...existing.options,
326
- ...options
327
- }, {
328
- promisePending: command.pending || existing.promisePending,
329
- actionPending: existing.actionPending,
330
- ending: false
331
- });
332
- continue;
333
- }
334
- if (existing !== void 0) {
335
- next.splice(index, 1);
336
- clearTimer(command.id);
337
- lastAnnounced.current.delete(command.id);
338
- exitBaselines.current.delete(command.id);
339
- }
340
- next.push(makeEntry(options, {
341
- promisePending: command.pending,
342
- actionPending: false,
343
- ending: false
344
- }));
345
- addedSinceEffect.current = true;
346
- } else {
347
- if (existing === void 0) {
348
- if (isDev && !command.settle) console.error(`toast.update: no toast with id "${command.id}"; the update is ignored.`);
349
- continue;
350
- }
351
- if (existing.ending) continue;
352
- next[index] = makeEntry(command.settle ? {
353
- ...command.options,
354
- id: command.id
355
- } : {
356
- ...existing.options,
357
- ...command.options,
358
- id: command.id
359
- }, {
360
- promisePending: command.settle ? false : existing.promisePending,
361
- actionPending: existing.actionPending,
362
- ending: false
363
- });
364
- }
176
+ const result = applyCommands(entriesRef.current, commands, (id) => roots.current.has(id));
177
+ for (const id of result.replaced) clearToastTimers(timers.current, id);
178
+ for (const id of result.forgotten) {
179
+ lastAnnounced.current.delete(id);
180
+ exitBaselines.current.delete(id);
365
181
  }
366
- if (dismissed.length === 0) {
367
- write(next);
182
+ if (result.added) addedSinceEffect.current = true;
183
+ if (isDev) for (const id of result.missing) console.error(`toast.update: no toast with id "${id}"; the update is ignored.`);
184
+ if (result.dismissed.length === 0) {
185
+ write(result.next);
368
186
  return;
369
187
  }
370
- const stays = new Set(next.filter((e) => !e.ending).map((e) => e.options.id));
371
- const leaving = new Set(dismissed.map((e) => e.options.id).filter((id) => !stays.has(id)));
372
- moveFocusOut(leaving);
373
- snapshotExitBaselines(leaving);
374
- write(next);
188
+ moveFocusOut(result.leaving);
189
+ snapshotExitBaselines(result.leaving);
190
+ write(result.next);
375
191
  syncTimers();
376
- scheduleCloseActions(dismissed, "dismiss", void 0);
192
+ scheduleCloseActions(result.dismissed, "dismiss", void 0);
377
193
  };
378
194
  const setActionPending = (id, pending) => {
379
195
  const index = entriesRef.current.findIndex((e) => e.options.id === id);
@@ -425,8 +241,7 @@ function ToastViewport({ manager = toast, limit = 3, duration = 5e3, hotkey = DE
425
241
  /** Forgets the queue of the previous manager (its own copy is retained by that manager). */
426
242
  const reset = () => {
427
243
  moveFocusOut(new Set(entriesRef.current.filter((e) => !e.ending).map((e) => e.options.id)));
428
- for (const timer of timers.current.values()) if (timer.handle !== null) clearTimeout(timer.handle);
429
- timers.current.clear();
244
+ clearToastTimers(timers.current);
430
245
  lastAnnounced.current.clear();
431
246
  exitBaselines.current.clear();
432
247
  write([]);
@@ -503,8 +318,7 @@ function ToastViewport({ manager = toast, limit = 3, duration = 5e3, hotkey = DE
503
318
  doc.removeEventListener("visibilitychange", onVisibility);
504
319
  view.removeEventListener("blur", onWindowBlur);
505
320
  view.removeEventListener("focus", onWindowFocus);
506
- for (const timer of map.values()) if (timer.handle !== null) clearTimeout(timer.handle);
507
- map.clear();
321
+ clearToastTimers(map);
508
322
  };
509
323
  }, [handlers, rejected]);
510
324
  const hotkeyKey = hotkey === null ? null : hotkey.join("\0");
@@ -524,21 +338,7 @@ function ToastViewport({ manager = toast, limit = 3, duration = 5e3, hotkey = DE
524
338
  doc.addEventListener("keydown", onKeyDown);
525
339
  return () => doc.removeEventListener("keydown", onKeyDown);
526
340
  }, [hotkeyKey, rejected]);
527
- const portalled = useSyncExternalStore(subscribeNothing, onClient, onServerOrHydrating);
528
- const [host] = useState(createHost);
529
- const anchorRef = useRef(null);
530
- useLayoutEffect(() => {
531
- if (host === null) return;
532
- return () => host.remove();
533
- }, [host]);
534
- useLayoutEffect(() => {
535
- if (host === null || !portalled) return;
536
- const target = container ?? anchorRef.current;
537
- if (target === null || host.parentNode === target) return;
538
- const moved = host.parentNode !== null;
539
- target.append(host);
540
- if (moved) setPause("hover", false);
541
- });
341
+ const { portalled, host, anchorRef } = useModalPortalHost(() => setPause("hover", false));
542
342
  useLayoutEffect(() => {
543
343
  const region = regionRef.current;
544
344
  const current = entriesRef.current;
@@ -547,12 +347,7 @@ function ToastViewport({ manager = toast, limit = 3, duration = 5e3, hotkey = DE
547
347
  setPause("focus", false);
548
348
  }
549
349
  if (region !== null && region.isConnected && region.hasAttribute("popover")) {
550
- let open = false;
551
- try {
552
- open = region.matches(":popover-open");
553
- } catch {
554
- open = false;
555
- }
350
+ const open = isPopoverOpen(region);
556
351
  try {
557
352
  if (current.length > 0) {
558
353
  if (!open) region.showPopover();
@@ -577,7 +372,7 @@ function ToastViewport({ manager = toast, limit = 3, duration = 5e3, hotkey = DE
577
372
  syncTimers();
578
373
  });
579
374
  const insideDialog = use(DialogContext) !== null;
580
- useDevWarning(insideDialog, "Toast.Viewport: rendered inside a Dialog. The region would close with the dialog; render the Viewport once near the root of the app (it moves into open modal Dialogs by itself).");
375
+ useDevWarning(insideDialog, isDev && "Toast.Viewport: rendered inside a Dialog. The region would close with the dialog; render the Viewport once near the root of the app (it moves into open modal Dialogs by itself).");
581
376
  const { visible, queued } = partition(entries, limit);
582
377
  const state = {
583
378
  toasts: visible.map((e) => e.item),
@@ -1 +1 @@
1
- {"version":3,"file":"toast-viewport.mjs","names":["defaultManager"],"sources":["../../src/toast/toast-viewport.tsx"],"sourcesContent":["\"use client\";\nimport {\n use,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n useTransition,\n} from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, FocusEvent, ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { DialogContext } from \"../dialog/dialog-context.js\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport {\n getServerTopmostModal,\n getTopmostModal,\n subscribeModals,\n} from \"../internal/modal-registry.js\";\nimport type { ChangeReason, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { animationBaseline } from \"../internal/use-exit-animation.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { toast as defaultManager, toastManagerInternals } from \"./toast.js\";\nimport type {\n RetainedToast,\n ToastCommand,\n ToastItem,\n ToastListener,\n ToastManager,\n ToastOptions,\n ToastPriority,\n} from \"./toast.js\";\nimport { ToastViewportContext } from \"./toast-context.js\";\nimport type { ToastViewportContextValue } from \"./toast-context.js\";\n\nexport interface ToastViewportState {\n /** Rendered toasts, chronological (oldest first), exiting ones included. */\n readonly toasts: readonly ToastItem[];\n /** Toasts waiting beyond `limit`. */\n readonly queued: number;\n /** A viewport-wide pause holds (pointer over the region, focus inside, hidden document, blurred window). */\n readonly paused: boolean;\n}\n\nexport interface ToastViewportProps extends Omit<\n ComponentPropsWithRef<\"section\">,\n | \"popover\"\n | \"className\"\n | \"style\"\n | \"children\"\n | \"onPointerEnter\"\n | \"onPointerLeave\"\n | \"onFocus\"\n | \"onBlur\"\n | \"onKeyDown\"\n> {\n /** The queue to render. Default: the module-level `toast`. */\n manager?: ToastManager;\n /** Toasts rendered at once; further ones wait in order (never dropped). Default `3`. */\n limit?: number;\n /** Default `duration` of a toast in milliseconds; `null` for persistent. Default `5000`. */\n duration?: number | null;\n /**\n * Keys that focus the newest toast: `event.code` values and modifier names (`\"altKey\"`,\n * `\"ctrlKey\"`, `\"metaKey\"`, `\"shiftKey\"`), all of which must match, with no other modifier\n * held. Default `[\"F8\"]`; `null` installs no listener.\n */\n hotkey?: readonly string[] | null;\n /**\n * The text `document.ariaNotify()` speaks for a toast (localisation); `null` announces nothing.\n * A toast's own `announce` wins. Default: the text of its Title and Description.\n */\n announce?: (toast: ToastItem) => string | null;\n /** Usually a function of the state mapping `state.toasts` to `Toast.Root`s. */\n children?: StateValue<ReactNode, ToastViewportState>;\n className?: StateValue<string | undefined, ToastViewportState>;\n style?: StateValue<CSSProperties | undefined, ToastViewportState>;\n /** Must render an element that can carry `popover` (a `<section>` by default). */\n render?: RenderProp<ComponentPropsWithRef<\"section\">, ToastViewportState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nconst 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)\"`. */\nfunction 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). */\nfunction 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\n/** No store: `useSyncExternalStore` only tells the hydration render from a client render. */\nconst subscribeNothing = (): (() => void) => () => {};\nconst onClient = (): boolean => true;\nconst onServerOrHydrating = (): boolean => false;\n\n/**\n * The element the region is portalled into for its whole client life. The library moves this\n * element (between its inline anchor and the topmost modal dialog); React never sees the move, so\n * the toasts keep their state (an Undo in flight stays pending). `display: contents`: no box.\n */\nfunction createHost(): HTMLElement | null {\n if (typeof document === \"undefined\") return null;\n const host = document.createElement(\"div\");\n host.style.display = \"contents\";\n return host;\n}\n\n/** One queue entry: the toast's options and the flags its `ToastItem` is built from. */\ninterface 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\nfunction 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\nfunction 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. */\nfunction 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). */\nfunction 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\n/** Document order. */\nfunction byDocumentPosition(a: Element, b: Element): number {\n if (a === b) return 0;\n return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;\n}\n\ninterface Timer {\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\ninterface PauseSources {\n hover: boolean;\n focus: boolean;\n hidden: boolean;\n blurred: boolean;\n}\n\nfunction anyPause(sources: PauseSources): boolean {\n return sources.hover || sources.focus || sources.hidden || sources.blurred;\n}\n\ntype DocumentWithAriaNotify = Document & {\n ariaNotify?: (announcement: string, options?: { priority?: ToastPriority }) => void;\n};\n\n/**\n * The toast region: a `<section popover=\"manual\">` named \"Notifications (F8)\", shown in the top\n * layer while it has toasts. Owns the queue (urgent state fed by `toast()`), the timers and their\n * pausing, the hotkey, focus return, announcements through `document.ariaNotify()`, and the move\n * into the topmost open modal `Dialog` (a region outside it would be inert).\n *\n * Owned keys (conventions 1.2): `popover`, `aria-label` (the consumer's own `aria-label` wins\n * verbatim), `data-paused`, `data-empty`, and the pointer / focus handlers.\n */\nexport function ToastViewport({\n manager = defaultManager,\n limit = 3,\n duration = 5000,\n hotkey = DEFAULT_HOTKEY,\n announce,\n children,\n className,\n style,\n render,\n ...rest\n}: ToastViewportProps) {\n // --- The queue: urgent state, written only from handlers, microtasks and effects -----------\n const [entries, setEntries] = useState<readonly Entry[]>([]);\n // The latest queue, written together with every `setEntries`: the dispatchers read and write\n // it synchronously so a burst of commands composes (and side effects stay out of updaters).\n const entriesRef = useRef<readonly Entry[]>(entries);\n const listener = useRef<ToastListener | null>(null);\n listener.current ??= {\n restore: (toasts: readonly RetainedToast[]) => handlers.current.restore(toasts),\n apply: (commands: readonly ToastCommand[]) => handlers.current.apply(commands),\n retain: () => handlers.current.retain(),\n };\n // A second Viewport on a taken manager renders nothing from its first render on (the effect\n // below confirms or clears it once the subscription is attempted).\n const [rejected, setRejected] = useState(() =>\n toastManagerInternals(manager).isTaken(listener.current!),\n );\n const [, startCloseTransition] = useTransition();\n\n const regionRef = useRef<HTMLElement | null>(null);\n const roots = useRef(new Map<string, HTMLElement>());\n const suspended = useRef(new Set<string>());\n const timers = useRef(new Map<string, Timer>());\n const pauses = useRef<PauseSources>({\n hover: false,\n focus: false,\n hidden: false,\n blurred: false,\n });\n const [paused, setPaused] = useState(false);\n /** Where focus goes back to once the last toast holding it leaves (design 7). */\n const returnTarget = useRef<HTMLElement | null>(null);\n const lastAnnounced = useRef(new Map<string, string | null>());\n /** Per closing toast: the animations already running before `data-ending` applied. */\n const exitBaselines = useRef(new Map<string, ReadonlySet<Animation>>());\n const announceBatch = useRef<{ text: string; priority: ToastPriority }[]>([]);\n const addedSinceEffect = useRef(false);\n const mounted = useRef(false);\n\n const latest = useLatest({ limit, duration, hotkey, announce });\n\n const container = useSyncExternalStore(subscribeModals, getTopmostModal, getServerTopmostModal);\n\n const write = (next: readonly Entry[]): void => {\n entriesRef.current = next;\n setEntries(next);\n };\n\n // --- Timers (design 6) ----------------------------------------------------------------------\n\n const effectiveDuration = (entry: Entry): number | null => {\n const own = entry.options.duration;\n if (own !== undefined) return own;\n return entry.options.action !== undefined ? null : latest.current.duration;\n };\n\n const syncTimers = (): void => {\n const map = timers.current;\n const { visible } = partition(entriesRef.current, latest.current.limit);\n const now = Date.now();\n const live = new Set<string>();\n const halted = !mounted.current || anyPause(pauses.current);\n for (const entry of visible) {\n if (entry.ending) continue;\n const id = entry.options.id;\n const ms = effectiveDuration(entry);\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 = !halted && !entry.item.pending && !suspended.current.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 close([id], \"timeout\", undefined);\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 const setPause = (source: keyof PauseSources, value: boolean): void => {\n if (pauses.current[source] === value) return;\n pauses.current[source] = value;\n // Applied synchronously in the event, before any timer callback can run (design 14 item 9).\n syncTimers();\n setPaused(anyPause(pauses.current));\n };\n\n // --- Focus ----------------------------------------------------------------------------------\n\n /** Open toasts' Root elements in document order. */\n const sortedRoots = (exclude?: ReadonlySet<string>): { id: string; element: HTMLElement }[] => {\n const open = new Set(entriesRef.current.filter((e) => !e.ending).map((e) => e.options.id));\n const list: { id: string; element: HTMLElement }[] = [];\n for (const [id, element] of roots.current) {\n if (!open.has(id) || exclude?.has(id) || !element.isConnected) continue;\n list.push({ id, element });\n }\n return list.sort((a, b) => byDocumentPosition(a.element, b.element));\n };\n\n /**\n * Before toasts close: if focus is inside one of them, move it to the next toast, else the\n * previous one, else where it was before the region was entered, else the body (design 7).\n */\n const moveFocusOut = (closing: ReadonlySet<string>): void => {\n const doc = regionRef.current?.ownerDocument ?? document;\n const active = doc.activeElement;\n if (!(active instanceof HTMLElement)) return;\n const all = sortedRoots();\n const index = all.findIndex(({ element }) => element.contains(active));\n if (index === -1 || !closing.has(all[index]!.id)) return;\n const after = all.slice(index + 1).find(({ id }) => !closing.has(id));\n const before = all\n .slice(0, index)\n .reverse()\n .find(({ id }) => !closing.has(id));\n const target = after ?? before;\n if (target !== undefined) {\n target.element.focus();\n return;\n }\n const stored = returnTarget.current;\n if (stored !== null && stored.isConnected && !regionRef.current?.contains(stored)) {\n stored.focus();\n if (doc.activeElement === stored) return;\n }\n active.blur();\n };\n\n // --- Queue writes ---------------------------------------------------------------------------\n\n /**\n * Records the animations running in each closing toast before `data-ending` applies: the exit\n * waits only for the ones the ending state started, not for a running progress bar.\n */\n const snapshotExitBaselines = (ids: Iterable<string>): void => {\n for (const id of ids) {\n const element = roots.current.get(id);\n if (element === undefined) continue;\n exitBaselines.current.set(id, animationBaseline(element));\n }\n };\n\n const clearTimer = (id: string): void => {\n const timer = timers.current.get(id);\n if (timer?.handle != null) clearTimeout(timer.handle);\n timers.current.delete(id);\n };\n\n const scheduleCloseActions = (\n closed: readonly Entry[],\n reason: ChangeReason,\n event: Event | undefined,\n ): void => {\n for (const entry of closed) {\n const closeAction = entry.options.closeAction;\n if (closeAction === undefined) continue;\n const details = createActionDetails(event, { id: entry.options.id, reason });\n // Not in the closing handler itself: the toast is gone first, then the action runs in the\n // Viewport's own transition (its rejection reaches the boundary above the Viewport).\n queueMicrotask(() => {\n if (!mounted.current) return;\n startCloseTransition(async () => {\n await closeAction(details);\n });\n });\n }\n };\n\n const close = (ids: readonly string[], reason: ChangeReason, event: Event | undefined): void => {\n const wanted = new Set(ids);\n const closing = entriesRef.current.filter((e) => !e.ending && wanted.has(e.options.id));\n if (closing.length === 0) return;\n const closingIds = new Set(closing.map((e) => e.options.id));\n moveFocusOut(closingIds);\n snapshotExitBaselines(closingIds);\n write(\n entriesRef.current.map((e) =>\n closingIds.has(e.options.id) ? withFlags(e, { ending: true }) : e,\n ),\n );\n syncTimers();\n scheduleCloseActions(closing, reason, event);\n };\n\n const drop = (id: string): void => {\n const next = entriesRef.current.filter((e) => !(e.ending && e.options.id === id));\n if (next.length === entriesRef.current.length) return;\n lastAnnounced.current.delete(id);\n exitBaselines.current.delete(id);\n write(next);\n };\n\n const apply = (commands: readonly ToastCommand[]): void => {\n const next = [...entriesRef.current];\n // Dismissals apply in order: each closes the toasts open at that point of the batch, never\n // one added after it in the same tick. Their side effects run after the loop.\n const dismissed: Entry[] = [];\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 (roots.current.has(id)) {\n next[i] = withFlags(entry, { ending: true });\n } else {\n // Never rendered (queued beyond `limit`, or added in this tick): nothing to\n // animate, so it leaves at once instead of mounting once as an ending Root.\n next.splice(i--, 1);\n lastAnnounced.current.delete(id);\n exitBaselines.current.delete(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 // An explicit existing id is an update (\"one toast per key\").\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 // An ending toast replaced by a new one with its id (the keyed Root may be reused):\n // a fresh timer, a fresh announcement, no exit.\n next.splice(index, 1);\n clearTimer(command.id);\n lastAnnounced.current.delete(command.id);\n exitBaselines.current.delete(command.id);\n }\n next.push(\n makeEntry(options, {\n promisePending: command.pending,\n actionPending: false,\n ending: false,\n }),\n );\n addedSinceEffect.current = true;\n } else {\n if (existing === undefined) {\n if (isDev && !command.settle) {\n console.error(`toast.update: no toast with id \"${command.id}\"; the update is ignored.`);\n }\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 if (dismissed.length === 0) {\n write(next);\n return;\n }\n // Toasts that leave the DOM: not one replaced by a later add with its id in this batch.\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 moveFocusOut(leaving);\n snapshotExitBaselines(leaving);\n write(next);\n syncTimers();\n scheduleCloseActions(dismissed, \"dismiss\", undefined);\n };\n\n const setActionPending = (id: string, pending: boolean): void => {\n const index = entriesRef.current.findIndex((e) => e.options.id === id);\n if (index === -1) return;\n const entry = entriesRef.current[index]!;\n if (entry.actionPending === pending) return;\n const next = [...entriesRef.current];\n next[index] = withFlags(entry, { actionPending: pending });\n write(next);\n };\n\n // --- Announcements (design 5) ---------------------------------------------------------------\n\n const flushAnnouncements = (): void => {\n const batch = announceBatch.current;\n announceBatch.current = [];\n if (batch.length === 0) return;\n const doc = (regionRef.current?.ownerDocument ?? document) as DocumentWithAriaNotify;\n if (typeof doc.ariaNotify !== \"function\") return;\n const priority = batch.some((a) => a.priority === \"high\") ? \"high\" : \"normal\";\n doc.ariaNotify(batch.map((a) => a.text).join(\" \"), { priority });\n };\n\n const queueAnnouncement = (id: string, text: string | null, priority: ToastPriority): void => {\n const map = lastAnnounced.current;\n if (map.has(id) && map.get(id) === text) return;\n map.set(id, text);\n if (text === null || text.trim() === \"\") return;\n if (announceBatch.current.length === 0) queueMicrotask(flushAnnouncements);\n announceBatch.current.push({ text, priority });\n };\n\n // The callbacks below read only refs, so one context value serves the Viewport's whole life.\n const restore = (toasts: readonly RetainedToast[]): void => {\n if (entriesRef.current.length > 0) return;\n // Already announced by the previous Viewport: not again on every remount.\n for (const t of toasts) {\n if (t.announced !== undefined) lastAnnounced.current.set(t.options.id, t.announced);\n }\n write(\n toasts.map((t) =>\n makeEntry(t.options, { promisePending: t.pending, actionPending: false, ending: false }),\n ),\n );\n addedSinceEffect.current = true;\n };\n\n const retain = (): readonly RetainedToast[] => {\n const announced = lastAnnounced.current;\n return entriesRef.current\n .filter((e) => !e.ending)\n .map((e) => ({\n options: e.options,\n pending: e.promisePending,\n announced: announced.has(e.options.id) ? announced.get(e.options.id) : undefined,\n }));\n };\n\n /** Forgets the queue of the previous manager (its own copy is retained by that manager). */\n const reset = (): void => {\n moveFocusOut(new Set(entriesRef.current.filter((e) => !e.ending).map((e) => e.options.id)));\n for (const timer of timers.current.values()) {\n if (timer.handle !== null) clearTimeout(timer.handle);\n }\n timers.current.clear();\n lastAnnounced.current.clear();\n exitBaselines.current.clear();\n write([]);\n };\n\n const handlers = useLatest({\n apply,\n restore,\n retain,\n reset,\n close,\n drop,\n setActionPending,\n queueAnnouncement,\n setPause,\n syncTimers,\n });\n\n const context = useMemo<ToastViewportContextValue>(\n () => ({\n close: (ids, reason, event) => handlers.current.close(ids, reason, event),\n drop: (id) => handlers.current.drop(id),\n setActionPending: (id, pending) => handlers.current.setActionPending(id, pending),\n setSuspended: (id, value) => {\n if (value) suspended.current.add(id);\n else suspended.current.delete(id);\n handlers.current.syncTimers();\n },\n registerRoot: (id, element) => {\n if (element === null) roots.current.delete(id);\n else roots.current.set(id, element);\n },\n focusSibling: (id, direction) => {\n const all = sortedRoots();\n const index = all.findIndex((r) => r.id === id);\n if (index === -1) return;\n all[index + direction]?.element.focus();\n },\n announce: (id, text, priority) => handlers.current.queueAnnouncement(id, text, priority),\n exitBaseline: (id) => exitBaselines.current.get(id),\n announcer: () => latest.current.announce,\n }),\n // oxlint-disable-next-line react-hooks/exhaustive-deps -- refs only (`sortedRoots` reads refs)\n [handlers, latest],\n );\n\n // --- Subscription ---------------------------------------------------------------------------\n\n const subscribedManager = useRef<ToastManager | null>(null);\n useEffect(() => {\n // A new `manager`: the previous one kept its toasts on unsubscribe (the previous run's\n // cleanup); start empty so the new one's retained toasts are restored and no command of\n // one queue reaches the other's toasts. The same manager again (StrictMode, Activity) keeps\n // the entries.\n if (subscribedManager.current !== null && subscribedManager.current !== manager) {\n handlers.current.reset();\n }\n subscribedManager.current = manager;\n const unsubscribe = toastManagerInternals(manager).subscribe(listener.current!);\n if (unsubscribe === null) {\n setRejected(true);\n if (isDev) {\n console.error(\n \"Toast.Viewport: another Toast.Viewport already renders this manager; this one renders \" +\n \"nothing. Use one Viewport per manager, or `createToastManager()` for a second queue.\",\n );\n }\n return;\n }\n setRejected(false);\n return unsubscribe;\n }, [manager, handlers]);\n\n // --- Lifecycle, pause sources, hotkey --------------------------------------------------------\n\n useEffect(() => {\n if (rejected) return;\n mounted.current = true;\n const doc = regionRef.current?.ownerDocument ?? document;\n const view = doc.defaultView ?? window;\n pauses.current.hidden = doc.visibilityState === \"hidden\";\n const onVisibility = (): void =>\n handlers.current.setPause(\"hidden\", doc.visibilityState === \"hidden\");\n // The window's own focus and blur; an element's (which do not bubble) never reach here.\n const onWindowBlur = (event: Event): void => {\n if (!(event.target instanceof Node)) handlers.current.setPause(\"blurred\", true);\n };\n const onWindowFocus = (event: Event): void => {\n if (!(event.target instanceof Node)) handlers.current.setPause(\"blurred\", false);\n };\n doc.addEventListener(\"visibilitychange\", onVisibility);\n view.addEventListener(\"blur\", onWindowBlur);\n view.addEventListener(\"focus\", onWindowFocus);\n handlers.current.syncTimers();\n setPaused(anyPause(pauses.current));\n const map = timers.current;\n return () => {\n mounted.current = false;\n doc.removeEventListener(\"visibilitychange\", onVisibility);\n view.removeEventListener(\"blur\", onWindowBlur);\n view.removeEventListener(\"focus\", onWindowFocus);\n // Unmounting stops the timers; the queue itself is retained by the manager.\n for (const timer of map.values()) if (timer.handle !== null) clearTimeout(timer.handle);\n map.clear();\n };\n }, [handlers, rejected]);\n\n const hotkeyKey = hotkey === null ? null : hotkey.join(\"\\u0000\");\n useEffect(() => {\n if (hotkeyKey === null || rejected) return;\n const keys = hotkeyKey.split(\"\\u0000\");\n const doc = regionRef.current?.ownerDocument ?? document;\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented || !matchesHotkey(keys, event)) return;\n const all = sortedRoots();\n const newest = all.at(-1);\n if (newest === undefined) return;\n event.preventDefault();\n const active = doc.activeElement;\n if (active instanceof HTMLElement && !regionRef.current?.contains(active)) {\n returnTarget.current = active;\n }\n newest.element.focus();\n };\n doc.addEventListener(\"keydown\", onKeyDown);\n return () => doc.removeEventListener(\"keydown\", onKeyDown);\n // oxlint-disable-next-line react-hooks/exhaustive-deps -- `sortedRoots` reads refs only\n }, [hotkeyKey, rejected]);\n\n // --- The portal host (design 4.3) ------------------------------------------------------------\n\n // The hydration render matches the server's inline region; every later render portals into\n // `host`, whose place the library changes without React noticing.\n const portalled = useSyncExternalStore(subscribeNothing, onClient, onServerOrHydrating);\n const [host] = useState(createHost);\n const anchorRef = useRef<HTMLDivElement | null>(null);\n\n useLayoutEffect(() => {\n if (host === null) return;\n return () => host.remove();\n }, [host]);\n\n // Before the region effect below: a move hides the popover (removal steps), which that effect\n // shows again in the same commit.\n useLayoutEffect(() => {\n if (host === null || !portalled) return;\n const target = container ?? anchorRef.current;\n if (target === null || host.parentNode === target) return;\n const moved = host.parentNode !== null;\n target.append(host);\n // A moved region gets no `pointerleave` (review L3): drop the hover pause; a pointer still\n // over it enters it again on its next move.\n if (moved) setPause(\"hover\", false);\n });\n\n // --- After every commit: region, timers, queued announcements, orphan exits ----------------\n\n useLayoutEffect(() => {\n const region = regionRef.current;\n const current = entriesRef.current;\n // Focus that left with a remount (a move into or out of a dialog) fires no `focusout`.\n if (\n pauses.current.focus &&\n (region === null || !region.contains(region.ownerDocument.activeElement))\n ) {\n returnTarget.current = null;\n setPause(\"focus\", false);\n }\n if (region !== null && region.isConnected && region.hasAttribute(\"popover\")) {\n let open = false;\n try {\n open = region.matches(\":popover-open\");\n } catch {\n open = false;\n }\n try {\n if (current.length > 0) {\n if (!open) region.showPopover();\n else if (addedSinceEffect.current) {\n // Re-raise to the top of the top layer, above a menu or popover opened since\n // (design 4.2). No style flush in between, so nothing is re-created.\n region.hidePopover();\n region.showPopover();\n }\n } else if (open) {\n region.hidePopover();\n }\n } catch {\n // A render element without popover support; nothing to show.\n }\n }\n // An emptied region is hidden, often right under the pointer (its last toast's Close), and\n // a hidden element gets no `pointerleave` (review L3): the next toast must not start paused.\n if (current.length === 0 && pauses.current.hover) setPause(\"hover\", false);\n addedSinceEffect.current = false;\n\n const { visible, queued } = partition(current, latest.current.limit);\n // Queued toasts are announced on add (design 5): from their plain-text fields, since they\n // have no DOM yet. Visible ones announce from their Root once their content committed.\n for (const entry of queued) {\n const id = entry.options.id;\n if (lastAnnounced.current.has(id)) continue;\n const resolver = entry.options.announce ?? latest.current.announce;\n const text = resolver\n ? resolver(entry.item)\n : [plainText(entry.options.title), plainText(entry.options.description)]\n .filter((t) => t !== \"\")\n .join(\" \");\n queueAnnouncement(id, text, entry.options.priority ?? \"normal\");\n }\n // An ending toast without a Root (the consumer did not render one) has nothing to animate.\n for (const entry of visible) {\n if (entry.ending && !roots.current.has(entry.options.id)) drop(entry.options.id);\n }\n syncTimers();\n });\n\n // --- Development checks ---------------------------------------------------------------------\n\n // A Viewport inside a library Dialog would close (and unmount) with it.\n const insideDialog = use(DialogContext) !== null;\n useDevWarning(\n insideDialog,\n \"Toast.Viewport: rendered inside a Dialog. The region would close with the dialog; render \" +\n \"the Viewport once near the root of the app (it moves into open modal Dialogs by itself).\",\n );\n\n // --- Render ---------------------------------------------------------------------------------\n\n const { visible, queued } = partition(entries, limit);\n const state: ToastViewportState = {\n toasts: visible.map((e) => e.item),\n queued: queued.length,\n paused,\n };\n\n const regionCallbackRef = useCallback((element: HTMLElement) => {\n regionRef.current = element;\n return () => {\n if (regionRef.current === element) regionRef.current = null;\n };\n }, []);\n\n // Touch lifts the pointer at once (`pointerleave` follows `pointerup`), so a tap never sticks.\n const onPointerEnter = (): void => setPause(\"hover\", true);\n const onPointerLeave = (): void => setPause(\"hover\", false);\n const onFocus = (event: FocusEvent<HTMLElement>): void => {\n const region = event.currentTarget;\n const from = event.relatedTarget;\n if (!(from instanceof Node) || !region.contains(from)) {\n returnTarget.current ??= from instanceof HTMLElement ? from : null;\n }\n setPause(\"focus\", true);\n };\n const onBlur = (event: FocusEvent<HTMLElement>): void => {\n const to = event.relatedTarget;\n if (to instanceof Node && event.currentTarget.contains(to)) return;\n returnTarget.current = null;\n setPause(\"focus\", false);\n };\n\n const libraryProps: ComponentPropsWithRef<\"section\"> & DataAttributes = {\n popover: \"manual\",\n \"aria-label\": rest[\"aria-label\"] ?? regionLabel(hotkey),\n \"data-paused\": dataAttr(paused),\n \"data-empty\": dataAttr(state.toasts.length === 0),\n onPointerEnter,\n onPointerLeave,\n onFocus,\n onBlur,\n };\n\n const region = useRender<ComponentPropsWithRef<\"section\">, ToastViewportState>({\n defaultElement: \"section\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: regionCallbackRef,\n });\n\n if (rejected) return null;\n const content = <ToastViewportContext value={context}>{region}</ToastViewportContext>;\n if (!portalled || host === null) return content;\n return (\n <>\n <div ref={anchorRef} style={ANCHOR_STYLE} />\n {createPortal(content, host)}\n </>\n );\n}\n\nconst ANCHOR_STYLE: CSSProperties = { display: \"contents\" };\n\nToastViewport.displayName = \"ToastViewport\";\n"],"mappings":";;;;;;;;;;;;;;;AAuFA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,MAAM,iBAAoC,CAAC,IAAI;AAE/C,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,SAAS,YAAY,QAA0C;CAC7D,IAAI,WAAW,QAAQ,OAAO,WAAW,GAAG,OAAO;CACnD,OAAO,kBAAkB,YAAY,MAAM,EAAE;AAC/C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AAS,IAAI;CACxB;CACA,MAAM,UAAU,UAAyC;EACvD,MAAM,KAAK,MAAM;EACjB,IAAI,cAAc,QAAQ,MAAM,cAAc,SAAS,EAAE,GAAG;EAC5D,aAAa,UAAU;EACvB,SAAS,SAAS,KAAK;CACzB;CAEA,MAAM,eAAkE;EACtE,SAAS;EACT,cAAc,KAAK,iBAAiB,YAAY,MAAM;EACtD,eAAe,SAAS,MAAM;EAC9B,cAAc,SAAS,MAAM,OAAO,WAAW,CAAC;EAChD;EACA;EACA;EACA;CACF;CAEA,MAAM,SAAS,UAAgE;EAC7E,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;CAED,IAAI,UAAU,OAAO;CACrB,MAAM,UAAU,oBAAC,sBAAD;EAAsB,OAAO;EAAU,UAAA;CAA6B,CAAA;CACpF,IAAI,CAAC,aAAa,SAAS,MAAM,OAAO;CACxC,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,OAAD;EAAK,KAAK;EAAW,OAAO;CAAe,CAAA,GAC1C,aAAa,SAAS,IAAI,CAC3B,EAAA,CAAA;AAEN;AAEA,MAAM,eAA8B,EAAE,SAAS,WAAW;AAE1D,cAAc,cAAc"}
1
+ {"version":3,"file":"toast-viewport.mjs","names":["defaultManager"],"sources":["../../src/toast/toast-viewport.tsx"],"sourcesContent":["\"use client\";\nimport {\n use,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useTransition,\n} from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, FocusEvent, ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { DialogContext } from \"../dialog/dialog-context.js\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport type { AriaNotifyTarget } from \"../internal/announce.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { isPopoverOpen } from \"../internal/popover-open.js\";\nimport type { ChangeReason, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { animationBaseline } from \"../internal/use-exit-animation.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { toast as defaultManager, toastManagerInternals } from \"./toast.js\";\nimport type {\n RetainedToast,\n ToastCommand,\n ToastItem,\n ToastListener,\n ToastManager,\n ToastPriority,\n} from \"./toast.js\";\nimport { ToastViewportContext } from \"./toast-context.js\";\nimport type { ToastViewportContextValue } from \"./toast-context.js\";\nimport { DEFAULT_HOTKEY, matchesHotkey, regionLabel } from \"./toast-hotkey.js\";\nimport { clearToastTimers, syncToastTimers } from \"./toast-timers.js\";\nimport type { ToastTimer } from \"./toast-timers.js\";\nimport { useModalPortalHost } from \"./use-modal-portal-host.js\";\nimport { applyCommands, makeEntry, partition, plainText, withFlags } from \"./toast-queue.js\";\nimport type { Entry } from \"./toast-queue.js\";\n\nexport interface ToastViewportState {\n /** Rendered toasts, chronological (oldest first), exiting ones included. */\n readonly toasts: readonly ToastItem[];\n /** Toasts waiting beyond `limit`. */\n readonly queued: number;\n /** A viewport-wide pause holds (pointer over the region, focus inside, hidden document, blurred window). */\n readonly paused: boolean;\n}\n\nexport interface ToastViewportProps extends Omit<\n ComponentPropsWithRef<\"section\">,\n | \"popover\"\n | \"className\"\n | \"style\"\n | \"children\"\n | \"onPointerEnter\"\n | \"onPointerLeave\"\n | \"onFocus\"\n | \"onBlur\"\n | \"onKeyDown\"\n> {\n /** The queue to render. Default: the module-level `toast`. */\n manager?: ToastManager;\n /** Toasts rendered at once; further ones wait in order (never dropped). Default `3`. */\n limit?: number;\n /** Default `duration` of a toast in milliseconds; `null` for persistent. Default `5000`. */\n duration?: number | null;\n /**\n * Keys that focus the newest toast: `event.code` values and modifier names (`\"altKey\"`,\n * `\"ctrlKey\"`, `\"metaKey\"`, `\"shiftKey\"`), all of which must match, with no other modifier\n * held. Default `[\"F8\"]`; `null` installs no listener.\n */\n hotkey?: readonly string[] | null;\n /**\n * The text `document.ariaNotify()` speaks for a toast (localisation); `null` announces nothing.\n * A toast's own `announce` wins. Default: the text of its Title and Description.\n */\n announce?: (toast: ToastItem) => string | null;\n /** Usually a function of the state mapping `state.toasts` to `Toast.Root`s. */\n children?: StateValue<ReactNode, ToastViewportState>;\n className?: StateValue<string | undefined, ToastViewportState>;\n style?: StateValue<CSSProperties | undefined, ToastViewportState>;\n /** Must render an element that can carry `popover` (a `<section>` by default). */\n render?: RenderProp<ComponentPropsWithRef<\"section\">, ToastViewportState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** Document order. */\nfunction byDocumentPosition(a: Element, b: Element): number {\n if (a === b) return 0;\n return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;\n}\n\ninterface PauseSources {\n hover: boolean;\n focus: boolean;\n hidden: boolean;\n blurred: boolean;\n}\n\nfunction anyPause(sources: PauseSources): boolean {\n return sources.hover || sources.focus || sources.hidden || sources.blurred;\n}\n\ntype DocumentWithAriaNotify = Document & AriaNotifyTarget;\n\n/**\n * The toast region: a `<section popover=\"manual\">` named \"Notifications (F8)\", shown in the top\n * layer while it has toasts. Owns the queue (urgent state fed by `toast()`), the timers and their\n * pausing, the hotkey, focus return, announcements through `document.ariaNotify()`, and the move\n * into the topmost open modal `Dialog` (a region outside it would be inert).\n *\n * Owned keys (conventions 1.2): `popover`, `aria-label` (the consumer's own `aria-label` wins\n * verbatim), `data-paused`, `data-empty`, and the pointer / focus handlers.\n */\nexport function ToastViewport({\n manager = defaultManager,\n limit = 3,\n duration = 5000,\n hotkey = DEFAULT_HOTKEY,\n announce,\n children,\n className,\n style,\n render,\n ...rest\n}: ToastViewportProps) {\n // --- The queue: urgent state, written only from handlers, microtasks and effects -----------\n const [entries, setEntries] = useState<readonly Entry[]>([]);\n // The latest queue, written together with every `setEntries`: the dispatchers read and write\n // it synchronously so a burst of commands composes (and side effects stay out of updaters).\n const entriesRef = useRef<readonly Entry[]>(entries);\n const listener = useRef<ToastListener | null>(null);\n listener.current ??= {\n restore: (toasts: readonly RetainedToast[]) => handlers.current.restore(toasts),\n apply: (commands: readonly ToastCommand[]) => handlers.current.apply(commands),\n retain: () => handlers.current.retain(),\n };\n // A second Viewport on a taken manager renders nothing from its first render on (the effect\n // below confirms or clears it once the subscription is attempted).\n const [rejected, setRejected] = useState(() =>\n toastManagerInternals(manager).isTaken(listener.current!),\n );\n const [, startCloseTransition] = useTransition();\n\n const regionRef = useRef<HTMLElement | null>(null);\n const roots = useRef(new Map<string, HTMLElement>());\n const suspended = useRef(new Set<string>());\n const timers = useRef(new Map<string, ToastTimer>());\n const pauses = useRef<PauseSources>({\n hover: false,\n focus: false,\n hidden: false,\n blurred: false,\n });\n const [paused, setPaused] = useState(false);\n /** Where focus goes back to once the last toast holding it leaves (design 7). */\n const returnTarget = useRef<HTMLElement | null>(null);\n const lastAnnounced = useRef(new Map<string, string | null>());\n /** Per closing toast: the animations already running before `data-ending` applied. */\n const exitBaselines = useRef(new Map<string, ReadonlySet<Animation>>());\n const announceBatch = useRef<{ text: string; priority: ToastPriority }[]>([]);\n const addedSinceEffect = useRef(false);\n const mounted = useRef(false);\n\n const latest = useLatest({ limit, duration, hotkey, announce });\n\n const write = (next: readonly Entry[]): void => {\n entriesRef.current = next;\n setEntries(next);\n };\n\n // --- Timers (design 6) ----------------------------------------------------------------------\n\n const syncTimers = (): void => {\n syncToastTimers(timers.current, partition(entriesRef.current, latest.current.limit).visible, {\n halted: !mounted.current || anyPause(pauses.current),\n suspended: suspended.current,\n defaultDuration: latest.current.duration,\n expire: (id) => close([id], \"timeout\", undefined),\n });\n };\n\n const setPause = (source: keyof PauseSources, value: boolean): void => {\n if (pauses.current[source] === value) return;\n pauses.current[source] = value;\n // Applied synchronously in the event, before any timer callback can run (design 14 item 9).\n syncTimers();\n setPaused(anyPause(pauses.current));\n };\n\n // --- Focus ----------------------------------------------------------------------------------\n\n /** Open toasts' Root elements in document order. */\n const sortedRoots = (exclude?: ReadonlySet<string>): { id: string; element: HTMLElement }[] => {\n const open = new Set(entriesRef.current.filter((e) => !e.ending).map((e) => e.options.id));\n const list: { id: string; element: HTMLElement }[] = [];\n for (const [id, element] of roots.current) {\n if (!open.has(id) || exclude?.has(id) || !element.isConnected) continue;\n list.push({ id, element });\n }\n return list.sort((a, b) => byDocumentPosition(a.element, b.element));\n };\n\n /**\n * Before toasts close: if focus is inside one of them, move it to the next toast, else the\n * previous one, else where it was before the region was entered, else the body (design 7).\n */\n const moveFocusOut = (closing: ReadonlySet<string>): void => {\n const doc = regionRef.current?.ownerDocument ?? document;\n const active = doc.activeElement;\n if (!(active instanceof HTMLElement)) return;\n const all = sortedRoots();\n const index = all.findIndex(({ element }) => element.contains(active));\n if (index === -1 || !closing.has(all[index]!.id)) return;\n const after = all.slice(index + 1).find(({ id }) => !closing.has(id));\n const before = all\n .slice(0, index)\n .reverse()\n .find(({ id }) => !closing.has(id));\n const target = after ?? before;\n if (target !== undefined) {\n target.element.focus();\n return;\n }\n const stored = returnTarget.current;\n if (stored !== null && stored.isConnected && !regionRef.current?.contains(stored)) {\n stored.focus();\n if (doc.activeElement === stored) return;\n }\n active.blur();\n };\n\n // --- Queue writes ---------------------------------------------------------------------------\n\n /**\n * Records the animations running in each closing toast before `data-ending` applies: the exit\n * waits only for the ones the ending state started, not for a running progress bar.\n */\n const snapshotExitBaselines = (ids: Iterable<string>): void => {\n for (const id of ids) {\n const element = roots.current.get(id);\n if (element === undefined) continue;\n exitBaselines.current.set(id, animationBaseline(element));\n }\n };\n\n const scheduleCloseActions = (\n closed: readonly Entry[],\n reason: ChangeReason,\n event: Event | undefined,\n ): void => {\n for (const entry of closed) {\n const closeAction = entry.options.closeAction;\n if (closeAction === undefined) continue;\n const details = createActionDetails(event, { id: entry.options.id, reason });\n // Not in the closing handler itself: the toast is gone first, then the action runs in the\n // Viewport's own transition (its rejection reaches the boundary above the Viewport).\n queueMicrotask(() => {\n if (!mounted.current) return;\n startCloseTransition(async () => {\n await closeAction(details);\n });\n });\n }\n };\n\n const close = (ids: readonly string[], reason: ChangeReason, event: Event | undefined): void => {\n const wanted = new Set(ids);\n const closing = entriesRef.current.filter((e) => !e.ending && wanted.has(e.options.id));\n if (closing.length === 0) return;\n const closingIds = new Set(closing.map((e) => e.options.id));\n moveFocusOut(closingIds);\n snapshotExitBaselines(closingIds);\n write(\n entriesRef.current.map((e) =>\n closingIds.has(e.options.id) ? withFlags(e, { ending: true }) : e,\n ),\n );\n syncTimers();\n scheduleCloseActions(closing, reason, event);\n };\n\n const drop = (id: string): void => {\n const next = entriesRef.current.filter((e) => !(e.ending && e.options.id === id));\n if (next.length === entriesRef.current.length) return;\n lastAnnounced.current.delete(id);\n exitBaselines.current.delete(id);\n write(next);\n };\n\n const apply = (commands: readonly ToastCommand[]): void => {\n const result = applyCommands(entriesRef.current, commands, (id) => roots.current.has(id));\n for (const id of result.replaced) clearToastTimers(timers.current, id);\n for (const id of result.forgotten) {\n lastAnnounced.current.delete(id);\n exitBaselines.current.delete(id);\n }\n if (result.added) addedSinceEffect.current = true;\n if (isDev) {\n for (const id of result.missing) {\n console.error(`toast.update: no toast with id \"${id}\"; the update is ignored.`);\n }\n }\n if (result.dismissed.length === 0) {\n write(result.next);\n return;\n }\n moveFocusOut(result.leaving);\n snapshotExitBaselines(result.leaving);\n write(result.next);\n syncTimers();\n scheduleCloseActions(result.dismissed, \"dismiss\", undefined);\n };\n\n const setActionPending = (id: string, pending: boolean): void => {\n const index = entriesRef.current.findIndex((e) => e.options.id === id);\n if (index === -1) return;\n const entry = entriesRef.current[index]!;\n if (entry.actionPending === pending) return;\n const next = [...entriesRef.current];\n next[index] = withFlags(entry, { actionPending: pending });\n write(next);\n };\n\n // --- Announcements (design 5) ---------------------------------------------------------------\n\n const flushAnnouncements = (): void => {\n const batch = announceBatch.current;\n announceBatch.current = [];\n if (batch.length === 0) return;\n const doc = (regionRef.current?.ownerDocument ?? document) as DocumentWithAriaNotify;\n if (typeof doc.ariaNotify !== \"function\") return;\n const priority = batch.some((a) => a.priority === \"high\") ? \"high\" : \"normal\";\n doc.ariaNotify(batch.map((a) => a.text).join(\" \"), { priority });\n };\n\n const queueAnnouncement = (id: string, text: string | null, priority: ToastPriority): void => {\n const map = lastAnnounced.current;\n if (map.has(id) && map.get(id) === text) return;\n map.set(id, text);\n if (text === null || text.trim() === \"\") return;\n if (announceBatch.current.length === 0) queueMicrotask(flushAnnouncements);\n announceBatch.current.push({ text, priority });\n };\n\n // The callbacks below read only refs, so one context value serves the Viewport's whole life.\n const restore = (toasts: readonly RetainedToast[]): void => {\n if (entriesRef.current.length > 0) return;\n // Already announced by the previous Viewport: not again on every remount.\n for (const t of toasts) {\n if (t.announced !== undefined) lastAnnounced.current.set(t.options.id, t.announced);\n }\n write(\n toasts.map((t) =>\n makeEntry(t.options, { promisePending: t.pending, actionPending: false, ending: false }),\n ),\n );\n addedSinceEffect.current = true;\n };\n\n const retain = (): readonly RetainedToast[] => {\n const announced = lastAnnounced.current;\n return entriesRef.current\n .filter((e) => !e.ending)\n .map((e) => ({\n options: e.options,\n pending: e.promisePending,\n announced: announced.has(e.options.id) ? announced.get(e.options.id) : undefined,\n }));\n };\n\n /** Forgets the queue of the previous manager (its own copy is retained by that manager). */\n const reset = (): void => {\n moveFocusOut(new Set(entriesRef.current.filter((e) => !e.ending).map((e) => e.options.id)));\n clearToastTimers(timers.current);\n lastAnnounced.current.clear();\n exitBaselines.current.clear();\n write([]);\n };\n\n const handlers = useLatest({\n apply,\n restore,\n retain,\n reset,\n close,\n drop,\n setActionPending,\n queueAnnouncement,\n setPause,\n syncTimers,\n });\n\n const context = useMemo<ToastViewportContextValue>(\n () => ({\n close: (ids, reason, event) => handlers.current.close(ids, reason, event),\n drop: (id) => handlers.current.drop(id),\n setActionPending: (id, pending) => handlers.current.setActionPending(id, pending),\n setSuspended: (id, value) => {\n if (value) suspended.current.add(id);\n else suspended.current.delete(id);\n handlers.current.syncTimers();\n },\n registerRoot: (id, element) => {\n if (element === null) roots.current.delete(id);\n else roots.current.set(id, element);\n },\n focusSibling: (id, direction) => {\n const all = sortedRoots();\n const index = all.findIndex((r) => r.id === id);\n if (index === -1) return;\n all[index + direction]?.element.focus();\n },\n announce: (id, text, priority) => handlers.current.queueAnnouncement(id, text, priority),\n exitBaseline: (id) => exitBaselines.current.get(id),\n announcer: () => latest.current.announce,\n }),\n // oxlint-disable-next-line react-hooks/exhaustive-deps -- refs only (`sortedRoots` reads refs)\n [handlers, latest],\n );\n\n // --- Subscription ---------------------------------------------------------------------------\n\n const subscribedManager = useRef<ToastManager | null>(null);\n useEffect(() => {\n // A new `manager`: the previous one kept its toasts on unsubscribe (the previous run's\n // cleanup); start empty so the new one's retained toasts are restored and no command of\n // one queue reaches the other's toasts. The same manager again (StrictMode, Activity) keeps\n // the entries.\n if (subscribedManager.current !== null && subscribedManager.current !== manager) {\n handlers.current.reset();\n }\n subscribedManager.current = manager;\n const unsubscribe = toastManagerInternals(manager).subscribe(listener.current!);\n if (unsubscribe === null) {\n setRejected(true);\n if (isDev) {\n console.error(\n \"Toast.Viewport: another Toast.Viewport already renders this manager; this one renders \" +\n \"nothing. Use one Viewport per manager, or `createToastManager()` for a second queue.\",\n );\n }\n return;\n }\n setRejected(false);\n return unsubscribe;\n }, [manager, handlers]);\n\n // --- Lifecycle, pause sources, hotkey --------------------------------------------------------\n\n useEffect(() => {\n if (rejected) return;\n mounted.current = true;\n const doc = regionRef.current?.ownerDocument ?? document;\n const view = doc.defaultView ?? window;\n pauses.current.hidden = doc.visibilityState === \"hidden\";\n const onVisibility = (): void =>\n handlers.current.setPause(\"hidden\", doc.visibilityState === \"hidden\");\n // The window's own focus and blur; an element's (which do not bubble) never reach here.\n const onWindowBlur = (event: Event): void => {\n if (!(event.target instanceof Node)) handlers.current.setPause(\"blurred\", true);\n };\n const onWindowFocus = (event: Event): void => {\n if (!(event.target instanceof Node)) handlers.current.setPause(\"blurred\", false);\n };\n doc.addEventListener(\"visibilitychange\", onVisibility);\n view.addEventListener(\"blur\", onWindowBlur);\n view.addEventListener(\"focus\", onWindowFocus);\n handlers.current.syncTimers();\n setPaused(anyPause(pauses.current));\n const map = timers.current;\n return () => {\n mounted.current = false;\n doc.removeEventListener(\"visibilitychange\", onVisibility);\n view.removeEventListener(\"blur\", onWindowBlur);\n view.removeEventListener(\"focus\", onWindowFocus);\n // Unmounting stops the timers; the queue itself is retained by the manager.\n clearToastTimers(map);\n };\n }, [handlers, rejected]);\n\n const hotkeyKey = hotkey === null ? null : hotkey.join(\"\\u0000\");\n useEffect(() => {\n if (hotkeyKey === null || rejected) return;\n const keys = hotkeyKey.split(\"\\u0000\");\n const doc = regionRef.current?.ownerDocument ?? document;\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented || !matchesHotkey(keys, event)) return;\n const all = sortedRoots();\n const newest = all.at(-1);\n if (newest === undefined) return;\n event.preventDefault();\n const active = doc.activeElement;\n if (active instanceof HTMLElement && !regionRef.current?.contains(active)) {\n returnTarget.current = active;\n }\n newest.element.focus();\n };\n doc.addEventListener(\"keydown\", onKeyDown);\n return () => doc.removeEventListener(\"keydown\", onKeyDown);\n // oxlint-disable-next-line react-hooks/exhaustive-deps -- `sortedRoots` reads refs only\n }, [hotkeyKey, rejected]);\n\n // --- The portal host (design 4.3) ------------------------------------------------------------\n\n // Keep this call before the region layout effect below: the host's move hides the popover\n // (removal steps), which that effect shows again in the same commit. A moved region gets no\n // `pointerleave`: drop the hover pause; a pointer still over it enters it again on its next move.\n const { portalled, host, anchorRef } = useModalPortalHost(() => setPause(\"hover\", false));\n\n // --- After every commit: region, timers, queued announcements, orphan exits ----------------\n\n useLayoutEffect(() => {\n const region = regionRef.current;\n const current = entriesRef.current;\n // Focus that left with a remount (a move into or out of a dialog) fires no `focusout`.\n if (\n pauses.current.focus &&\n (region === null || !region.contains(region.ownerDocument.activeElement))\n ) {\n returnTarget.current = null;\n setPause(\"focus\", false);\n }\n if (region !== null && region.isConnected && region.hasAttribute(\"popover\")) {\n const open = isPopoverOpen(region);\n try {\n if (current.length > 0) {\n if (!open) region.showPopover();\n else if (addedSinceEffect.current) {\n // Re-raise to the top of the top layer, above a menu or popover opened since\n // (design 4.2). No style flush in between, so nothing is re-created.\n region.hidePopover();\n region.showPopover();\n }\n } else if (open) {\n region.hidePopover();\n }\n } catch {\n // A render element without popover support; nothing to show.\n }\n }\n // An emptied region is hidden, often right under the pointer (its last toast's Close), and\n // a hidden element gets no `pointerleave`: the next toast must not start paused.\n if (current.length === 0 && pauses.current.hover) setPause(\"hover\", false);\n addedSinceEffect.current = false;\n\n const { visible, queued } = partition(current, latest.current.limit);\n // Queued toasts are announced on add (design 5): from their plain-text fields, since they\n // have no DOM yet. Visible ones announce from their Root once their content committed.\n for (const entry of queued) {\n const id = entry.options.id;\n if (lastAnnounced.current.has(id)) continue;\n const resolver = entry.options.announce ?? latest.current.announce;\n const text = resolver\n ? resolver(entry.item)\n : [plainText(entry.options.title), plainText(entry.options.description)]\n .filter((t) => t !== \"\")\n .join(\" \");\n queueAnnouncement(id, text, entry.options.priority ?? \"normal\");\n }\n // An ending toast without a Root (the consumer did not render one) has nothing to animate.\n for (const entry of visible) {\n if (entry.ending && !roots.current.has(entry.options.id)) drop(entry.options.id);\n }\n syncTimers();\n });\n\n // --- Development checks ---------------------------------------------------------------------\n\n // A Viewport inside a library Dialog would close (and unmount) with it.\n const insideDialog = use(DialogContext) !== null;\n useDevWarning(\n insideDialog,\n isDev &&\n \"Toast.Viewport: rendered inside a Dialog. The region would close with the dialog; render \" +\n \"the Viewport once near the root of the app (it moves into open modal Dialogs by itself).\",\n );\n\n // --- Render ---------------------------------------------------------------------------------\n\n const { visible, queued } = partition(entries, limit);\n const state: ToastViewportState = {\n toasts: visible.map((e) => e.item),\n queued: queued.length,\n paused,\n };\n\n const regionCallbackRef = useCallback((element: HTMLElement) => {\n regionRef.current = element;\n return () => {\n if (regionRef.current === element) regionRef.current = null;\n };\n }, []);\n\n // Touch lifts the pointer at once (`pointerleave` follows `pointerup`), so a tap never sticks.\n const onPointerEnter = (): void => setPause(\"hover\", true);\n const onPointerLeave = (): void => setPause(\"hover\", false);\n const onFocus = (event: FocusEvent<HTMLElement>): void => {\n const region = event.currentTarget;\n const from = event.relatedTarget;\n if (!(from instanceof Node) || !region.contains(from)) {\n returnTarget.current ??= from instanceof HTMLElement ? from : null;\n }\n setPause(\"focus\", true);\n };\n const onBlur = (event: FocusEvent<HTMLElement>): void => {\n const to = event.relatedTarget;\n if (to instanceof Node && event.currentTarget.contains(to)) return;\n returnTarget.current = null;\n setPause(\"focus\", false);\n };\n\n const libraryProps: ComponentPropsWithRef<\"section\"> & DataAttributes = {\n popover: \"manual\",\n \"aria-label\": rest[\"aria-label\"] ?? regionLabel(hotkey),\n \"data-paused\": dataAttr(paused),\n \"data-empty\": dataAttr(state.toasts.length === 0),\n onPointerEnter,\n onPointerLeave,\n onFocus,\n onBlur,\n };\n\n const region = useRender<ComponentPropsWithRef<\"section\">, ToastViewportState>({\n defaultElement: \"section\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: regionCallbackRef,\n });\n\n if (rejected) return null;\n const content = <ToastViewportContext value={context}>{region}</ToastViewportContext>;\n if (!portalled || host === null) return content;\n return (\n <>\n <div ref={anchorRef} style={ANCHOR_STYLE} />\n {createPortal(content, host)}\n </>\n );\n}\n\nconst ANCHOR_STYLE: CSSProperties = { display: \"contents\" };\n\nToastViewport.displayName = \"ToastViewport\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwFA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;AAGvC,SAAS,mBAAmB,GAAY,GAAoB;CAC1D,IAAI,MAAM,GAAG,OAAO;CACpB,OAAO,EAAE,wBAAwB,CAAC,IAAI,KAAK,8BAA8B,KAAK;AAChF;AASA,SAAS,SAAS,SAAgC;CAChD,OAAO,QAAQ,SAAS,QAAQ,SAAS,QAAQ,UAAU,QAAQ;AACrE;;;;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C;EACvD,MAAM,KAAK,MAAM;EACjB,IAAI,cAAc,QAAQ,MAAM,cAAc,SAAS,EAAE,GAAG;EAC5D,aAAa,UAAU;EACvB,SAAS,SAAS,KAAK;CACzB;CAEA,MAAM,eAAkE;EACtE,SAAS;EACT,cAAc,KAAK,iBAAiB,YAAY,MAAM;EACtD,eAAe,SAAS,MAAM;EAC9B,cAAc,SAAS,MAAM,OAAO,WAAW,CAAC;EAChD;EACA;EACA;EACA;CACF;CAEA,MAAM,SAAS,UAAgE;EAC7E,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;CAED,IAAI,UAAU,OAAO;CACrB,MAAM,UAAU,oBAAC,sBAAD;EAAsB,OAAO;EAAU,UAAA;CAA6B,CAAA;CACpF,IAAI,CAAC,aAAa,SAAS,MAAM,OAAO;CACxC,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,OAAD;EAAK,KAAK;EAAW,OAAO;CAAe,CAAA,GAC1C,aAAa,SAAS,IAAI,CAC3B,EAAA,CAAA;AAEN;AAEA,MAAM,eAA8B,EAAE,SAAS,WAAW;AAE1D,cAAc,cAAc"}
@@ -13,7 +13,7 @@ let warnedServer = false;
13
13
  * mistakes a late close from the old queue (an Undo settling) for one of the new queue's toasts.
14
14
  */
15
15
  let nextId = 0;
16
- /** On the server every method is a no-op, never buffered (design 13, product-owner amendment). */
16
+ /** On the server every method is a no-op, never buffered (design 13). */
17
17
  function onServer() {
18
18
  if (typeof document !== "undefined") return false;
19
19
  if (isDev && !warnedServer) {