@funstack/ui 0.1.0-alpha.15 → 0.1.0-alpha.17

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 (588) hide show
  1. package/README.md +22 -1
  2. package/dist/accordion/accordion-item.d.mts +19 -0
  3. package/dist/accordion/accordion-item.d.mts.map +1 -1
  4. package/dist/accordion/accordion-item.mjs +2 -0
  5. package/dist/accordion/accordion-item.mjs.map +1 -1
  6. package/dist/accordion/accordion-panel.d.mts +16 -0
  7. package/dist/accordion/accordion-panel.d.mts.map +1 -1
  8. package/dist/accordion/accordion-panel.mjs +2 -0
  9. package/dist/accordion/accordion-panel.mjs.map +1 -1
  10. package/dist/accordion/accordion-root.d.mts +36 -2
  11. package/dist/accordion/accordion-root.d.mts.map +1 -1
  12. package/dist/accordion/accordion-root.mjs +3 -1
  13. package/dist/accordion/accordion-root.mjs.map +1 -1
  14. package/dist/accordion/accordion-trigger.d.mts +9 -0
  15. package/dist/accordion/accordion-trigger.d.mts.map +1 -1
  16. package/dist/accordion/accordion-trigger.mjs +2 -0
  17. package/dist/accordion/accordion-trigger.mjs.map +1 -1
  18. package/dist/accordion/index.d.mts +2 -0
  19. package/dist/accordion/index.d.mts.map +1 -1
  20. package/dist/accordion/index.mjs +2 -0
  21. package/dist/accordion/index.mjs.map +1 -1
  22. package/dist/bin/skill-installer.d.mts +1 -0
  23. package/dist/bin/skill-installer.mjs +12 -0
  24. package/dist/bin/skill-installer.mjs.map +1 -0
  25. package/dist/button/button.d.mts +46 -15
  26. package/dist/button/button.d.mts.map +1 -1
  27. package/dist/button/button.mjs +10 -6
  28. package/dist/button/button.mjs.map +1 -1
  29. package/dist/checkbox/checkbox.d.mts +25 -3
  30. package/dist/checkbox/checkbox.d.mts.map +1 -1
  31. package/dist/checkbox/checkbox.mjs +2 -0
  32. package/dist/checkbox/checkbox.mjs.map +1 -1
  33. package/dist/checkbox-group/checkbox-group-item.d.mts +15 -0
  34. package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
  35. package/dist/checkbox-group/checkbox-group-item.mjs +2 -0
  36. package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
  37. package/dist/checkbox-group/checkbox-group-label.d.mts +10 -0
  38. package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -1
  39. package/dist/checkbox-group/checkbox-group-label.mjs +2 -0
  40. package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
  41. package/dist/checkbox-group/checkbox-group-parent.d.mts +19 -1
  42. package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
  43. package/dist/checkbox-group/checkbox-group-parent.mjs +2 -0
  44. package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
  45. package/dist/checkbox-group/checkbox-group-root.d.mts +31 -4
  46. package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
  47. package/dist/checkbox-group/checkbox-group-root.mjs +7 -1
  48. package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
  49. package/dist/checkbox-group/index.d.mts +2 -0
  50. package/dist/checkbox-group/index.d.mts.map +1 -1
  51. package/dist/checkbox-group/index.mjs +2 -0
  52. package/dist/checkbox-group/index.mjs.map +1 -1
  53. package/dist/combobox/combobox-clear.d.mts +18 -0
  54. package/dist/combobox/combobox-clear.d.mts.map +1 -1
  55. package/dist/combobox/combobox-clear.mjs +2 -0
  56. package/dist/combobox/combobox-clear.mjs.map +1 -1
  57. package/dist/combobox/combobox-group.d.mts +49 -1
  58. package/dist/combobox/combobox-group.d.mts.map +1 -1
  59. package/dist/combobox/combobox-group.mjs +11 -1
  60. package/dist/combobox/combobox-group.mjs.map +1 -1
  61. package/dist/combobox/combobox-input.d.mts +11 -0
  62. package/dist/combobox/combobox-input.d.mts.map +1 -1
  63. package/dist/combobox/combobox-input.mjs +2 -0
  64. package/dist/combobox/combobox-input.mjs.map +1 -1
  65. package/dist/combobox/combobox-label.d.mts +16 -0
  66. package/dist/combobox/combobox-label.d.mts.map +1 -1
  67. package/dist/combobox/combobox-label.mjs +2 -0
  68. package/dist/combobox/combobox-label.mjs.map +1 -1
  69. package/dist/combobox/combobox-list.d.mts +14 -0
  70. package/dist/combobox/combobox-list.d.mts.map +1 -1
  71. package/dist/combobox/combobox-list.mjs +2 -0
  72. package/dist/combobox/combobox-list.mjs.map +1 -1
  73. package/dist/combobox/combobox-option.d.mts +25 -3
  74. package/dist/combobox/combobox-option.d.mts.map +1 -1
  75. package/dist/combobox/combobox-option.mjs +2 -0
  76. package/dist/combobox/combobox-option.mjs.map +1 -1
  77. package/dist/combobox/combobox-popup.d.mts +20 -1
  78. package/dist/combobox/combobox-popup.d.mts.map +1 -1
  79. package/dist/combobox/combobox-popup.mjs +2 -0
  80. package/dist/combobox/combobox-popup.mjs.map +1 -1
  81. package/dist/combobox/combobox-root.d.mts +64 -17
  82. package/dist/combobox/combobox-root.d.mts.map +1 -1
  83. package/dist/combobox/combobox-root.mjs +11 -11
  84. package/dist/combobox/combobox-root.mjs.map +1 -1
  85. package/dist/combobox/combobox-trigger.d.mts +16 -0
  86. package/dist/combobox/combobox-trigger.d.mts.map +1 -1
  87. package/dist/combobox/combobox-trigger.mjs +9 -2
  88. package/dist/combobox/combobox-trigger.mjs.map +1 -1
  89. package/dist/combobox/index.d.mts +2 -0
  90. package/dist/combobox/index.d.mts.map +1 -1
  91. package/dist/combobox/index.mjs +2 -0
  92. package/dist/combobox/index.mjs.map +1 -1
  93. package/dist/csp/csp-provider.d.mts +8 -0
  94. package/dist/csp/csp-provider.d.mts.map +1 -1
  95. package/dist/csp/csp-provider.mjs +2 -0
  96. package/dist/csp/csp-provider.mjs.map +1 -1
  97. package/dist/csp/style-hashes.d.mts +2 -0
  98. package/dist/csp/style-hashes.d.mts.map +1 -1
  99. package/dist/csp/style-hashes.mjs +2 -0
  100. package/dist/csp/style-hashes.mjs.map +1 -1
  101. package/dist/dialog/dialog-close.d.mts +31 -3
  102. package/dist/dialog/dialog-close.d.mts.map +1 -1
  103. package/dist/dialog/dialog-close.mjs +5 -2
  104. package/dist/dialog/dialog-close.mjs.map +1 -1
  105. package/dist/dialog/dialog-context.mjs.map +1 -1
  106. package/dist/dialog/dialog-description.d.mts +12 -0
  107. package/dist/dialog/dialog-description.d.mts.map +1 -1
  108. package/dist/dialog/dialog-description.mjs +2 -0
  109. package/dist/dialog/dialog-description.mjs.map +1 -1
  110. package/dist/dialog/dialog-form.d.mts +20 -2
  111. package/dist/dialog/dialog-form.d.mts.map +1 -1
  112. package/dist/dialog/dialog-form.mjs +2 -0
  113. package/dist/dialog/dialog-form.mjs.map +1 -1
  114. package/dist/dialog/dialog-popup.d.mts +34 -8
  115. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  116. package/dist/dialog/dialog-popup.mjs +14 -20
  117. package/dist/dialog/dialog-popup.mjs.map +1 -1
  118. package/dist/dialog/dialog-root.d.mts +53 -25
  119. package/dist/dialog/dialog-root.d.mts.map +1 -1
  120. package/dist/dialog/dialog-root.mjs +12 -8
  121. package/dist/dialog/dialog-root.mjs.map +1 -1
  122. package/dist/dialog/dialog-title.d.mts +11 -0
  123. package/dist/dialog/dialog-title.d.mts.map +1 -1
  124. package/dist/dialog/dialog-title.mjs +2 -0
  125. package/dist/dialog/dialog-title.mjs.map +1 -1
  126. package/dist/dialog/dialog-trigger.d.mts +19 -3
  127. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  128. package/dist/dialog/dialog-trigger.mjs +2 -0
  129. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  130. package/dist/dialog/index.d.mts +7 -5
  131. package/dist/dialog/index.d.mts.map +1 -1
  132. package/dist/dialog/index.mjs +7 -5
  133. package/dist/dialog/index.mjs.map +1 -1
  134. package/dist/docs/components/accordion.md +426 -0
  135. package/dist/docs/components/button.md +508 -0
  136. package/dist/docs/components/checkbox-group.md +483 -0
  137. package/dist/docs/components/checkbox.md +373 -0
  138. package/dist/docs/components/combobox.md +698 -0
  139. package/dist/docs/components/context-menu.md +524 -0
  140. package/dist/docs/components/dialog.md +692 -0
  141. package/dist/docs/components/field.md +587 -0
  142. package/dist/docs/components/menu.md +670 -0
  143. package/dist/docs/components/meter.md +313 -0
  144. package/dist/docs/components/number-field.md +528 -0
  145. package/dist/docs/components/popover.md +656 -0
  146. package/dist/docs/components/progress.md +450 -0
  147. package/dist/docs/components/radio-group.md +457 -0
  148. package/dist/docs/components/select.md +662 -0
  149. package/dist/docs/components/slider.md +558 -0
  150. package/dist/docs/components/switch.md +311 -0
  151. package/dist/docs/components/tabs.md +473 -0
  152. package/dist/docs/components/toast.md +599 -0
  153. package/dist/docs/components/toggle-group.md +341 -0
  154. package/dist/docs/components/toggle.md +245 -0
  155. package/dist/docs/components/toolbar.md +390 -0
  156. package/dist/docs/components/tooltip.md +494 -0
  157. package/dist/docs/concepts/action-props.md +281 -0
  158. package/dist/docs/concepts/ai-agents.md +56 -0
  159. package/dist/docs/concepts/browser-owned-state.md +133 -0
  160. package/dist/docs/concepts/content-security-policy.md +69 -0
  161. package/dist/docs/concepts/experimental.md +36 -0
  162. package/dist/docs/concepts/pending-and-optimistic.md +263 -0
  163. package/dist/docs/concepts/render.md +23 -0
  164. package/dist/docs/concepts/server-components.md +132 -0
  165. package/dist/docs/concepts/suspense.md +129 -0
  166. package/dist/docs/concepts/transitions.md +112 -0
  167. package/dist/docs/getting-started.md +102 -0
  168. package/dist/docs/index.md +182 -0
  169. package/dist/docs/roadmap.md +128 -0
  170. package/dist/docs/why.md +104 -0
  171. package/dist/field/field-control.d.mts +26 -3
  172. package/dist/field/field-control.d.mts.map +1 -1
  173. package/dist/field/field-control.mjs +2 -0
  174. package/dist/field/field-control.mjs.map +1 -1
  175. package/dist/field/field-description.d.mts +11 -0
  176. package/dist/field/field-description.d.mts.map +1 -1
  177. package/dist/field/field-description.mjs +2 -0
  178. package/dist/field/field-description.mjs.map +1 -1
  179. package/dist/field/field-error.d.mts +14 -2
  180. package/dist/field/field-error.d.mts.map +1 -1
  181. package/dist/field/field-error.mjs +2 -0
  182. package/dist/field/field-error.mjs.map +1 -1
  183. package/dist/field/field-label.d.mts +10 -0
  184. package/dist/field/field-label.d.mts.map +1 -1
  185. package/dist/field/field-label.mjs +2 -0
  186. package/dist/field/field-label.mjs.map +1 -1
  187. package/dist/field/field-root.d.mts +21 -2
  188. package/dist/field/field-root.d.mts.map +1 -1
  189. package/dist/field/field-root.mjs +2 -0
  190. package/dist/field/field-root.mjs.map +1 -1
  191. package/dist/field/index.d.mts +9 -0
  192. package/dist/field/index.d.mts.map +1 -1
  193. package/dist/field/index.mjs +9 -0
  194. package/dist/field/index.mjs.map +1 -1
  195. package/dist/form/form-root.d.mts +17 -1
  196. package/dist/form/form-root.d.mts.map +1 -1
  197. package/dist/form/form-root.mjs +2 -0
  198. package/dist/form/form-root.mjs.map +1 -1
  199. package/dist/form/form-submit.d.mts +18 -0
  200. package/dist/form/form-submit.d.mts.map +1 -1
  201. package/dist/form/form-submit.mjs +2 -0
  202. package/dist/form/form-submit.mjs.map +1 -1
  203. package/dist/form/index.d.mts +7 -0
  204. package/dist/form/index.d.mts.map +1 -1
  205. package/dist/form/index.mjs +7 -0
  206. package/dist/form/index.mjs.map +1 -1
  207. package/dist/index.d.mts +3 -2
  208. package/dist/internal/call-urgent-handler.mjs +37 -0
  209. package/dist/internal/call-urgent-handler.mjs.map +1 -0
  210. package/dist/internal/css-transition-cut.mjs +66 -0
  211. package/dist/internal/css-transition-cut.mjs.map +1 -0
  212. package/dist/internal/overlay-popup.mjs.map +1 -1
  213. package/dist/internal/report-dropped.mjs +45 -0
  214. package/dist/internal/report-dropped.mjs.map +1 -0
  215. package/dist/internal/types.d.mts +36 -7
  216. package/dist/internal/types.d.mts.map +1 -1
  217. package/dist/internal/use-action-trigger.mjs +32 -17
  218. package/dist/internal/use-action-trigger.mjs.map +1 -1
  219. package/dist/internal/use-controllable-action.mjs +52 -16
  220. package/dist/internal/use-controllable-action.mjs.map +1 -1
  221. package/dist/internal/use-exit-animation.mjs +1 -1
  222. package/dist/internal/use-exit-animation.mjs.map +1 -1
  223. package/dist/internal/use-native-group-reconciliation.mjs +4 -2
  224. package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
  225. package/dist/internal/use-overlay-close.mjs +10 -4
  226. package/dist/internal/use-overlay-close.mjs.map +1 -1
  227. package/dist/internal/use-overlay-root.mjs +40 -7
  228. package/dist/internal/use-overlay-root.mjs.map +1 -1
  229. package/dist/internal/use-popover-popup.mjs +22 -7
  230. package/dist/internal/use-popover-popup.mjs.map +1 -1
  231. package/dist/internal/use-popover-trigger.d.mts +2 -1
  232. package/dist/internal/use-popover-trigger.d.mts.map +1 -1
  233. package/dist/internal/use-popover-trigger.mjs +11 -3
  234. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  235. package/dist/internal/validity.d.mts +11 -0
  236. package/dist/internal/validity.d.mts.map +1 -1
  237. package/dist/internal/validity.mjs.map +1 -1
  238. package/dist/menu/index.d.mts +2 -0
  239. package/dist/menu/index.d.mts.map +1 -1
  240. package/dist/menu/index.mjs +2 -0
  241. package/dist/menu/index.mjs.map +1 -1
  242. package/dist/menu/menu-checkbox-item.d.mts +27 -3
  243. package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
  244. package/dist/menu/menu-checkbox-item.mjs +2 -0
  245. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  246. package/dist/menu/menu-context-trigger.d.mts +24 -2
  247. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  248. package/dist/menu/menu-context-trigger.mjs +2 -0
  249. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  250. package/dist/menu/menu-group.d.mts +36 -1
  251. package/dist/menu/menu-group.d.mts.map +1 -1
  252. package/dist/menu/menu-group.mjs +9 -1
  253. package/dist/menu/menu-group.mjs.map +1 -1
  254. package/dist/menu/menu-item.d.mts +38 -5
  255. package/dist/menu/menu-item.d.mts.map +1 -1
  256. package/dist/menu/menu-item.mjs +12 -5
  257. package/dist/menu/menu-item.mjs.map +1 -1
  258. package/dist/menu/menu-outside.mjs +2 -2
  259. package/dist/menu/menu-outside.mjs.map +1 -1
  260. package/dist/menu/menu-popup.d.mts +36 -8
  261. package/dist/menu/menu-popup.d.mts.map +1 -1
  262. package/dist/menu/menu-popup.mjs +2 -0
  263. package/dist/menu/menu-popup.mjs.map +1 -1
  264. package/dist/menu/menu-radio-group.d.mts +20 -1
  265. package/dist/menu/menu-radio-group.d.mts.map +1 -1
  266. package/dist/menu/menu-radio-group.mjs +2 -0
  267. package/dist/menu/menu-radio-group.mjs.map +1 -1
  268. package/dist/menu/menu-radio-item.d.mts +16 -0
  269. package/dist/menu/menu-radio-item.d.mts.map +1 -1
  270. package/dist/menu/menu-radio-item.mjs +2 -0
  271. package/dist/menu/menu-radio-item.mjs.map +1 -1
  272. package/dist/menu/menu-root.d.mts +49 -15
  273. package/dist/menu/menu-root.d.mts.map +1 -1
  274. package/dist/menu/menu-root.mjs +7 -4
  275. package/dist/menu/menu-root.mjs.map +1 -1
  276. package/dist/menu/menu-submenu-trigger.d.mts +13 -0
  277. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  278. package/dist/menu/menu-submenu-trigger.mjs +2 -0
  279. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  280. package/dist/menu/menu-trigger.d.mts +15 -0
  281. package/dist/menu/menu-trigger.d.mts.map +1 -1
  282. package/dist/menu/menu-trigger.mjs +2 -0
  283. package/dist/menu/menu-trigger.mjs.map +1 -1
  284. package/dist/meter/index.d.mts +2 -0
  285. package/dist/meter/index.d.mts.map +1 -1
  286. package/dist/meter/index.mjs +2 -0
  287. package/dist/meter/index.mjs.map +1 -1
  288. package/dist/meter/meter-indicator.d.mts +11 -0
  289. package/dist/meter/meter-indicator.d.mts.map +1 -1
  290. package/dist/meter/meter-indicator.mjs +2 -0
  291. package/dist/meter/meter-indicator.mjs.map +1 -1
  292. package/dist/meter/meter-label.d.mts +11 -0
  293. package/dist/meter/meter-label.d.mts.map +1 -1
  294. package/dist/meter/meter-label.mjs +2 -0
  295. package/dist/meter/meter-label.mjs.map +1 -1
  296. package/dist/meter/meter-region.d.mts +5 -0
  297. package/dist/meter/meter-region.d.mts.map +1 -1
  298. package/dist/meter/meter-region.mjs.map +1 -1
  299. package/dist/meter/meter-root.d.mts +52 -10
  300. package/dist/meter/meter-root.d.mts.map +1 -1
  301. package/dist/meter/meter-root.mjs +2 -0
  302. package/dist/meter/meter-root.mjs.map +1 -1
  303. package/dist/meter/meter-track.d.mts +11 -0
  304. package/dist/meter/meter-track.d.mts.map +1 -1
  305. package/dist/meter/meter-track.mjs +2 -0
  306. package/dist/meter/meter-track.mjs.map +1 -1
  307. package/dist/meter/meter-value.d.mts +15 -1
  308. package/dist/meter/meter-value.d.mts.map +1 -1
  309. package/dist/meter/meter-value.mjs +2 -0
  310. package/dist/meter/meter-value.mjs.map +1 -1
  311. package/dist/number-field/index.d.mts +2 -0
  312. package/dist/number-field/index.d.mts.map +1 -1
  313. package/dist/number-field/index.mjs +2 -0
  314. package/dist/number-field/index.mjs.map +1 -1
  315. package/dist/number-field/number-field-decrement.d.mts +2 -0
  316. package/dist/number-field/number-field-decrement.d.mts.map +1 -1
  317. package/dist/number-field/number-field-decrement.mjs +2 -0
  318. package/dist/number-field/number-field-decrement.mjs.map +1 -1
  319. package/dist/number-field/number-field-increment.d.mts +2 -0
  320. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  321. package/dist/number-field/number-field-increment.mjs +2 -0
  322. package/dist/number-field/number-field-increment.mjs.map +1 -1
  323. package/dist/number-field/number-field-input.d.mts +9 -0
  324. package/dist/number-field/number-field-input.d.mts.map +1 -1
  325. package/dist/number-field/number-field-input.mjs +2 -0
  326. package/dist/number-field/number-field-input.mjs.map +1 -1
  327. package/dist/number-field/number-field-label.d.mts +10 -0
  328. package/dist/number-field/number-field-label.d.mts.map +1 -1
  329. package/dist/number-field/number-field-label.mjs +2 -0
  330. package/dist/number-field/number-field-label.mjs.map +1 -1
  331. package/dist/number-field/number-field-root.d.mts +62 -14
  332. package/dist/number-field/number-field-root.d.mts.map +1 -1
  333. package/dist/number-field/number-field-root.mjs +4 -8
  334. package/dist/number-field/number-field-root.mjs.map +1 -1
  335. package/dist/number-field/use-step-button.d.mts +20 -0
  336. package/dist/number-field/use-step-button.d.mts.map +1 -1
  337. package/dist/number-field/use-step-button.mjs.map +1 -1
  338. package/dist/popover/index.d.mts +5 -3
  339. package/dist/popover/index.d.mts.map +1 -1
  340. package/dist/popover/index.mjs +5 -3
  341. package/dist/popover/index.mjs.map +1 -1
  342. package/dist/popover/popover-close.d.mts +32 -3
  343. package/dist/popover/popover-close.d.mts.map +1 -1
  344. package/dist/popover/popover-close.mjs +6 -2
  345. package/dist/popover/popover-close.mjs.map +1 -1
  346. package/dist/popover/popover-description.d.mts +12 -0
  347. package/dist/popover/popover-description.d.mts.map +1 -1
  348. package/dist/popover/popover-description.mjs +2 -0
  349. package/dist/popover/popover-description.mjs.map +1 -1
  350. package/dist/popover/popover-popup.d.mts +36 -7
  351. package/dist/popover/popover-popup.d.mts.map +1 -1
  352. package/dist/popover/popover-popup.mjs +5 -2
  353. package/dist/popover/popover-popup.mjs.map +1 -1
  354. package/dist/popover/popover-root.d.mts +40 -18
  355. package/dist/popover/popover-root.d.mts.map +1 -1
  356. package/dist/popover/popover-root.mjs +11 -7
  357. package/dist/popover/popover-root.mjs.map +1 -1
  358. package/dist/popover/popover-title.d.mts +11 -0
  359. package/dist/popover/popover-title.d.mts.map +1 -1
  360. package/dist/popover/popover-title.mjs +2 -0
  361. package/dist/popover/popover-title.mjs.map +1 -1
  362. package/dist/popover/popover-trigger.d.mts +15 -0
  363. package/dist/popover/popover-trigger.d.mts.map +1 -1
  364. package/dist/popover/popover-trigger.mjs +2 -0
  365. package/dist/popover/popover-trigger.mjs.map +1 -1
  366. package/dist/progress/index.d.mts +2 -0
  367. package/dist/progress/index.d.mts.map +1 -1
  368. package/dist/progress/index.mjs +2 -0
  369. package/dist/progress/index.mjs.map +1 -1
  370. package/dist/progress/progress-indicator.d.mts +11 -0
  371. package/dist/progress/progress-indicator.d.mts.map +1 -1
  372. package/dist/progress/progress-indicator.mjs +2 -0
  373. package/dist/progress/progress-indicator.mjs.map +1 -1
  374. package/dist/progress/progress-label.d.mts +11 -0
  375. package/dist/progress/progress-label.d.mts.map +1 -1
  376. package/dist/progress/progress-label.mjs +2 -0
  377. package/dist/progress/progress-label.mjs.map +1 -1
  378. package/dist/progress/progress-root.d.mts +36 -8
  379. package/dist/progress/progress-root.d.mts.map +1 -1
  380. package/dist/progress/progress-root.mjs +2 -0
  381. package/dist/progress/progress-root.mjs.map +1 -1
  382. package/dist/progress/progress-track.d.mts +11 -0
  383. package/dist/progress/progress-track.d.mts.map +1 -1
  384. package/dist/progress/progress-track.mjs +2 -0
  385. package/dist/progress/progress-track.mjs.map +1 -1
  386. package/dist/progress/progress-value.d.mts +15 -1
  387. package/dist/progress/progress-value.d.mts.map +1 -1
  388. package/dist/progress/progress-value.mjs +2 -0
  389. package/dist/progress/progress-value.mjs.map +1 -1
  390. package/dist/radio-group/index.d.mts +2 -0
  391. package/dist/radio-group/index.d.mts.map +1 -1
  392. package/dist/radio-group/index.mjs +2 -0
  393. package/dist/radio-group/index.mjs.map +1 -1
  394. package/dist/radio-group/radio-group-item.d.mts +18 -1
  395. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  396. package/dist/radio-group/radio-group-item.mjs +2 -0
  397. package/dist/radio-group/radio-group-item.mjs.map +1 -1
  398. package/dist/radio-group/radio-group-label.d.mts +10 -0
  399. package/dist/radio-group/radio-group-label.d.mts.map +1 -1
  400. package/dist/radio-group/radio-group-label.mjs +2 -0
  401. package/dist/radio-group/radio-group-label.mjs.map +1 -1
  402. package/dist/radio-group/radio-group-root.d.mts +29 -5
  403. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  404. package/dist/radio-group/radio-group-root.mjs +2 -0
  405. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  406. package/dist/select/index.d.mts +2 -0
  407. package/dist/select/index.d.mts.map +1 -1
  408. package/dist/select/index.mjs +2 -0
  409. package/dist/select/index.mjs.map +1 -1
  410. package/dist/select/select-group-label.d.mts +10 -0
  411. package/dist/select/select-group-label.d.mts.map +1 -1
  412. package/dist/select/select-group-label.mjs +2 -0
  413. package/dist/select/select-group-label.mjs.map +1 -1
  414. package/dist/select/select-group.d.mts +15 -1
  415. package/dist/select/select-group.d.mts.map +1 -1
  416. package/dist/select/select-group.mjs +2 -0
  417. package/dist/select/select-group.mjs.map +1 -1
  418. package/dist/select/select-option.d.mts +19 -1
  419. package/dist/select/select-option.d.mts.map +1 -1
  420. package/dist/select/select-option.mjs +2 -0
  421. package/dist/select/select-option.mjs.map +1 -1
  422. package/dist/select/select-root.d.mts +24 -1
  423. package/dist/select/select-root.d.mts.map +1 -1
  424. package/dist/select/select-root.mjs +2 -0
  425. package/dist/select/select-root.mjs.map +1 -1
  426. package/dist/select/select-separator.d.mts +9 -0
  427. package/dist/select/select-separator.d.mts.map +1 -1
  428. package/dist/select/select-separator.mjs +2 -0
  429. package/dist/select/select-separator.mjs.map +1 -1
  430. package/dist/select/select-trigger.d.mts +9 -0
  431. package/dist/select/select-trigger.d.mts.map +1 -1
  432. package/dist/select/select-trigger.mjs +2 -0
  433. package/dist/select/select-trigger.mjs.map +1 -1
  434. package/dist/select/select-value.d.mts +9 -0
  435. package/dist/select/select-value.d.mts.map +1 -1
  436. package/dist/select/select-value.mjs +2 -0
  437. package/dist/select/select-value.mjs.map +1 -1
  438. package/dist/slider/index.d.mts +2 -0
  439. package/dist/slider/index.d.mts.map +1 -1
  440. package/dist/slider/index.mjs +2 -0
  441. package/dist/slider/index.mjs.map +1 -1
  442. package/dist/slider/slider-indicator.d.mts +12 -0
  443. package/dist/slider/slider-indicator.d.mts.map +1 -1
  444. package/dist/slider/slider-indicator.mjs +2 -0
  445. package/dist/slider/slider-indicator.mjs.map +1 -1
  446. package/dist/slider/slider-label.d.mts +11 -1
  447. package/dist/slider/slider-label.d.mts.map +1 -1
  448. package/dist/slider/slider-label.mjs +2 -0
  449. package/dist/slider/slider-label.mjs.map +1 -1
  450. package/dist/slider/slider-root.d.mts +53 -9
  451. package/dist/slider/slider-root.d.mts.map +1 -1
  452. package/dist/slider/slider-root.mjs +4 -8
  453. package/dist/slider/slider-root.mjs.map +1 -1
  454. package/dist/slider/slider-thumb.d.mts +32 -3
  455. package/dist/slider/slider-thumb.d.mts.map +1 -1
  456. package/dist/slider/slider-thumb.mjs +2 -0
  457. package/dist/slider/slider-thumb.mjs.map +1 -1
  458. package/dist/slider/slider-track.d.mts +17 -0
  459. package/dist/slider/slider-track.d.mts.map +1 -1
  460. package/dist/slider/slider-track.mjs +2 -0
  461. package/dist/slider/slider-track.mjs.map +1 -1
  462. package/dist/slider/slider-value.d.mts +11 -0
  463. package/dist/slider/slider-value.d.mts.map +1 -1
  464. package/dist/slider/slider-value.mjs +2 -0
  465. package/dist/slider/slider-value.mjs.map +1 -1
  466. package/dist/switch/switch.d.mts +23 -3
  467. package/dist/switch/switch.d.mts.map +1 -1
  468. package/dist/switch/switch.mjs +2 -0
  469. package/dist/switch/switch.mjs.map +1 -1
  470. package/dist/tabs/index.d.mts +2 -0
  471. package/dist/tabs/index.d.mts.map +1 -1
  472. package/dist/tabs/index.mjs +2 -0
  473. package/dist/tabs/index.mjs.map +1 -1
  474. package/dist/tabs/tabs-context.d.mts +5 -0
  475. package/dist/tabs/tabs-context.d.mts.map +1 -1
  476. package/dist/tabs/tabs-context.mjs.map +1 -1
  477. package/dist/tabs/tabs-indicator.d.mts +17 -0
  478. package/dist/tabs/tabs-indicator.d.mts.map +1 -1
  479. package/dist/tabs/tabs-indicator.mjs +2 -0
  480. package/dist/tabs/tabs-indicator.mjs.map +1 -1
  481. package/dist/tabs/tabs-list.d.mts +19 -1
  482. package/dist/tabs/tabs-list.d.mts.map +1 -1
  483. package/dist/tabs/tabs-list.mjs +2 -0
  484. package/dist/tabs/tabs-list.mjs.map +1 -1
  485. package/dist/tabs/tabs-panel.d.mts +19 -0
  486. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  487. package/dist/tabs/tabs-panel.mjs +2 -0
  488. package/dist/tabs/tabs-panel.mjs.map +1 -1
  489. package/dist/tabs/tabs-root.d.mts +39 -5
  490. package/dist/tabs/tabs-root.d.mts.map +1 -1
  491. package/dist/tabs/tabs-root.mjs +2 -0
  492. package/dist/tabs/tabs-root.mjs.map +1 -1
  493. package/dist/tabs/tabs-tab.d.mts +22 -1
  494. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  495. package/dist/tabs/tabs-tab.mjs +2 -0
  496. package/dist/tabs/tabs-tab.mjs.map +1 -1
  497. package/dist/toast/index.d.mts +2 -0
  498. package/dist/toast/index.d.mts.map +1 -1
  499. package/dist/toast/index.mjs +2 -0
  500. package/dist/toast/index.mjs.map +1 -1
  501. package/dist/toast/toast-action.d.mts +42 -6
  502. package/dist/toast/toast-action.d.mts.map +1 -1
  503. package/dist/toast/toast-action.mjs +8 -4
  504. package/dist/toast/toast-action.mjs.map +1 -1
  505. package/dist/toast/toast-close.d.mts +16 -0
  506. package/dist/toast/toast-close.d.mts.map +1 -1
  507. package/dist/toast/toast-close.mjs +2 -0
  508. package/dist/toast/toast-close.mjs.map +1 -1
  509. package/dist/toast/toast-context.mjs.map +1 -1
  510. package/dist/toast/toast-description.d.mts +16 -1
  511. package/dist/toast/toast-description.d.mts.map +1 -1
  512. package/dist/toast/toast-description.mjs +2 -0
  513. package/dist/toast/toast-description.mjs.map +1 -1
  514. package/dist/toast/toast-queue.mjs.map +1 -1
  515. package/dist/toast/toast-root.d.mts +20 -0
  516. package/dist/toast/toast-root.d.mts.map +1 -1
  517. package/dist/toast/toast-root.mjs +2 -0
  518. package/dist/toast/toast-root.mjs.map +1 -1
  519. package/dist/toast/toast-title.d.mts +15 -1
  520. package/dist/toast/toast-title.d.mts.map +1 -1
  521. package/dist/toast/toast-title.mjs +2 -0
  522. package/dist/toast/toast-title.mjs.map +1 -1
  523. package/dist/toast/toast-viewport.d.mts +34 -5
  524. package/dist/toast/toast-viewport.d.mts.map +1 -1
  525. package/dist/toast/toast-viewport.mjs +17 -15
  526. package/dist/toast/toast-viewport.mjs.map +1 -1
  527. package/dist/toast/toast.d.mts +56 -13
  528. package/dist/toast/toast.d.mts.map +1 -1
  529. package/dist/toast/toast.mjs +4 -0
  530. package/dist/toast/toast.mjs.map +1 -1
  531. package/dist/toggle/toggle.d.mts +20 -2
  532. package/dist/toggle/toggle.d.mts.map +1 -1
  533. package/dist/toggle/toggle.mjs +2 -0
  534. package/dist/toggle/toggle.mjs.map +1 -1
  535. package/dist/toggle-group/index.d.mts +2 -0
  536. package/dist/toggle-group/index.d.mts.map +1 -1
  537. package/dist/toggle-group/index.mjs +2 -0
  538. package/dist/toggle-group/index.mjs.map +1 -1
  539. package/dist/toggle-group/toggle-group-context.d.mts +1 -0
  540. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  541. package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
  542. package/dist/toggle-group/toggle-group-item.d.mts +16 -0
  543. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  544. package/dist/toggle-group/toggle-group-item.mjs +2 -0
  545. package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
  546. package/dist/toggle-group/toggle-group-root.d.mts +73 -12
  547. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  548. package/dist/toggle-group/toggle-group-root.mjs +3 -1
  549. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  550. package/dist/toolbar/index.d.mts +2 -0
  551. package/dist/toolbar/index.d.mts.map +1 -1
  552. package/dist/toolbar/index.mjs +2 -0
  553. package/dist/toolbar/index.mjs.map +1 -1
  554. package/dist/toolbar/toolbar-root.d.mts +30 -3
  555. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  556. package/dist/toolbar/toolbar-root.mjs +2 -0
  557. package/dist/toolbar/toolbar-root.mjs.map +1 -1
  558. package/dist/toolbar/toolbar-separator.d.mts +13 -0
  559. package/dist/toolbar/toolbar-separator.d.mts.map +1 -1
  560. package/dist/toolbar/toolbar-separator.mjs +2 -0
  561. package/dist/toolbar/toolbar-separator.mjs.map +1 -1
  562. package/dist/tooltip/index.d.mts +2 -0
  563. package/dist/tooltip/index.d.mts.map +1 -1
  564. package/dist/tooltip/index.mjs +2 -0
  565. package/dist/tooltip/index.mjs.map +1 -1
  566. package/dist/tooltip/tooltip-arrow.d.mts +16 -0
  567. package/dist/tooltip/tooltip-arrow.d.mts.map +1 -1
  568. package/dist/tooltip/tooltip-arrow.mjs +2 -0
  569. package/dist/tooltip/tooltip-arrow.mjs.map +1 -1
  570. package/dist/tooltip/tooltip-context.d.mts +4 -0
  571. package/dist/tooltip/tooltip-context.d.mts.map +1 -1
  572. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  573. package/dist/tooltip/tooltip-popup.d.mts +24 -3
  574. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  575. package/dist/tooltip/tooltip-popup.mjs +2 -0
  576. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  577. package/dist/tooltip/tooltip-root.d.mts +24 -2
  578. package/dist/tooltip/tooltip-root.d.mts.map +1 -1
  579. package/dist/tooltip/tooltip-root.mjs +2 -0
  580. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  581. package/dist/tooltip/tooltip-trigger.d.mts +18 -1
  582. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  583. package/dist/tooltip/tooltip-trigger.mjs +2 -0
  584. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  585. package/package.json +9 -1
  586. package/skills/funstack-ui-knowledge/SKILL.md +75 -0
  587. package/dist/internal/use-superseded-rejection.mjs +0 -47
  588. package/dist/internal/use-superseded-rejection.mjs.map +0 -1
@@ -4,6 +4,15 @@ import { FieldError } from "./field-error.mjs";
4
4
  import { FieldLabel } from "./field-label.mjs";
5
5
  import { FieldRoot } from "./field-root.mjs";
6
6
  //#region src/field/index.ts
7
+ /**
8
+ * Field (labelled, described, validated form control): `Root` (`div`, owns the ids and the field's
9
+ * state) > `Label` (`label[for]`), `Control` (`input`, or any FUNSTACK form control in its place),
10
+ * `Description` (`p`), `Error` (`div`, rendered only while invalid). The browser's constraint
11
+ * validation and `:user-invalid` decide when an error shows; the library adds the ARIA wiring, a
12
+ * styleable error, and server errors from `Form.Root`.
13
+ *
14
+ * @see https://ui.funstack.work/components/field
15
+ */
7
16
  const Field = {
8
17
  Root: FieldRoot,
9
18
  Label: FieldLabel,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/field/index.ts"],"sourcesContent":["import { FieldControl } from \"./field-control.js\";\nimport { FieldDescription } from \"./field-description.js\";\nimport { FieldError } from \"./field-error.js\";\nimport { FieldLabel } from \"./field-label.js\";\nimport { FieldRoot } from \"./field-root.js\";\n\nexport const Field = {\n Root: FieldRoot,\n Label: FieldLabel,\n Control: FieldControl,\n Description: FieldDescription,\n Error: FieldError,\n} as const;\n\nexport type { FieldRootProps, FieldState, FieldValidity, FieldValidate } from \"./field-root.js\";\nexport type { FieldLabelProps } from \"./field-label.js\";\nexport type { FieldControlProps } from \"./field-control.js\";\nexport type { FieldDescriptionProps } from \"./field-description.js\";\nexport type { FieldErrorProps } from \"./field-error.js\";\n"],"mappings":";;;;;;AAMA,MAAa,QAAQ;CACnB,MAAM;CACN,OAAO;CACP,SAAS;CACT,aAAa;CACb,OAAO;AACT"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/field/index.ts"],"sourcesContent":["import { FieldControl } from \"./field-control.js\";\nimport { FieldDescription } from \"./field-description.js\";\nimport { FieldError } from \"./field-error.js\";\nimport { FieldLabel } from \"./field-label.js\";\nimport { FieldRoot } from \"./field-root.js\";\n\n/**\n * Field (labelled, described, validated form control): `Root` (`div`, owns the ids and the field's\n * state) > `Label` (`label[for]`), `Control` (`input`, or any FUNSTACK form control in its place),\n * `Description` (`p`), `Error` (`div`, rendered only while invalid). The browser's constraint\n * validation and `:user-invalid` decide when an error shows; the library adds the ARIA wiring, a\n * styleable error, and server errors from `Form.Root`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport const Field = {\n Root: FieldRoot,\n Label: FieldLabel,\n Control: FieldControl,\n Description: FieldDescription,\n Error: FieldError,\n} as const;\n\nexport type { FieldRootProps, FieldState, FieldValidity, FieldValidate } from \"./field-root.js\";\nexport type { FieldLabelProps } from \"./field-label.js\";\nexport type { FieldControlProps } from \"./field-control.js\";\nexport type { FieldDescriptionProps } from \"./field-description.js\";\nexport type { FieldErrorProps } from \"./field-error.js\";\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,QAAQ;CACnB,MAAM;CACN,OAAO;CACP,SAAS;CACT,aAAa;CACb,OAAO;AACT"}
@@ -2,10 +2,19 @@ import { RenderProp, StateValue } from "../internal/types.mjs";
2
2
  import { FieldErrorValue, FormErrors } from "../internal/validity.mjs";
3
3
  import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
4
4
  //#region src/form/form-root.d.ts
5
+ /**
6
+ * State of `Form.Root`, passed to the function forms of `className`, `style`, `children` and
7
+ * `render`.
8
+ */
5
9
  export interface FormRootState {
6
10
  /** A submission is in flight: the Form's own transition, or the form's status (`useFormStatus`), including the Suspense wait of the result. */
7
11
  readonly pending: boolean;
8
12
  }
13
+ /**
14
+ * Props of `Form.Root`.
15
+ *
16
+ * @see https://ui.funstack.work/components/field
17
+ */
9
18
  export interface FormRootProps extends Omit<ComponentPropsWithRef<"form">, "onSubmit" | "method" | "action" | "className" | "style" | "children"> {
10
19
  /**
11
20
  * React form action (`(formData) => unknown`: a Server Function, a `useActionState` dispatch,
@@ -24,14 +33,19 @@ export interface FormRootProps extends Omit<ComponentPropsWithRef<"form">, "onSu
24
33
  errors?: FormErrors;
25
34
  /**
26
35
  * Reset the form (`form.reset()`) when a submission the Form ran settles with no non-empty
27
- * entry in `errors`. Default `true`. A submission that reports errors never resets, so the
36
+ * entry in `errors`. A submission that reports errors never resets, so the
28
37
  * user's input, `:user-invalid` and custom validity stay. `false`: never reset.
38
+ *
39
+ * @defaultValue `true`
29
40
  */
30
41
  autoReset?: boolean;
31
42
  /** Only with a string `action`. Owned otherwise (React's own with a function action). */
32
43
  method?: ComponentPropsWithRef<"form">["method"];
44
+ /** Class name, or a function of the part's state that returns one. */
33
45
  className?: StateValue<string | undefined, FormRootState>;
46
+ /** Inline style, or a function of the part's state that returns one. */
34
47
  style?: StateValue<CSSProperties | undefined, FormRootState>;
48
+ /** Content, or a function of the part's state. */
35
49
  children?: StateValue<ReactNode, FormRootState>;
36
50
  /** Must render a `<form>`. */
37
51
  render?: RenderProp<ComponentPropsWithRef<"form">, FormRootState>;
@@ -48,6 +62,8 @@ export interface FormRootProps extends Omit<ComponentPropsWithRef<"form">, "onSu
48
62
  *
49
63
  * Owned keys (conventions 1.2): `action`, `method` (except with a string `action`), `onSubmit`,
50
64
  * `data-pending`.
65
+ *
66
+ * @see https://ui.funstack.work/components/field
51
67
  */
52
68
  export declare function FormRoot({ action, errors, autoReset, method, className, style, children, render, ...rest }: FormRootProps): import("react").JSX.Element;
53
69
  export declare namespace FormRoot {
@@ -1 +1 @@
1
- {"version":3,"file":"form-root.d.mts","names":[],"sources":["../../src/form/form-root.tsx"],"mappings":";;;;iBAoBiB;;WAEN;;iBAGM,sBAAsB,KACrC;;;;;;;;EAUA,oBAAoB,UAAU;;;;;;;EAO9B,SAAS;;;;;;EAMT;;EAEA,SAAS;EACT,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,+BAA+B;;;;;;;;;;;;;;;wBAsBrC,WACd,QACA,QACA,WACA,QACA,WACA,OACA,UACA,WACG,QACF,gCAAa,IAAA;yBAVA"}
1
+ {"version":3,"file":"form-root.d.mts","names":[],"sources":["../../src/form/form-root.tsx"],"mappings":";;;;;;;;iBAwBiB;;WAEN;;;;;;;iBAQM,sBAAsB,KACrC;;;;;;;;EAUA,oBAAoB,UAAU;;;;;;;EAO9B,SAAS;;;;;;;;EAQT;;EAEA,SAAS;;EAET,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,+BAA+B;;;;;;;;;;;;;;;;;wBAwBrC,WACd,QACA,QACA,WACA,QACA,WACA,OACA,UACA,WACG,QACF,gCAAa,IAAA;yBAVA"}
@@ -25,6 +25,8 @@ const isDev = process.env.NODE_ENV !== "production";
25
25
  *
26
26
  * Owned keys (conventions 1.2): `action`, `method` (except with a string `action`), `onSubmit`,
27
27
  * `data-pending`.
28
+ *
29
+ * @see https://ui.funstack.work/components/field
28
30
  */
29
31
  function FormRoot({ action, errors, autoReset = true, method, className, style, children, render, ...rest }) {
30
32
  const [isPending, startTransition] = useTransition();
@@ -1 +1 @@
1
- {"version":3,"file":"form-root.mjs","names":[],"sources":["../../src/form/form-root.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useMemo, useRef, useState, useTransition } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, FormEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { sortByDocumentOrder } from \"../internal/dom-order.js\";\nimport { FormContext } from \"../internal/field-context.js\";\nimport type { FormContextValue, FormFieldRegistration } from \"../internal/field-context.js\";\nimport { announce } from \"../internal/announce.js\";\nimport { FormStatusWatcher } from \"../internal/form-status-watcher.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport { hasAnyError } from \"../internal/validity.js\";\nimport type { FormErrors } from \"../internal/validity.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport type { FieldErrorValue, FormErrors } from \"../internal/validity.js\";\n\nexport interface FormRootState {\n /** A submission is in flight: the Form's own transition, or the form's status (`useFormStatus`), including the Suspense wait of the result. */\n readonly pending: boolean;\n}\n\nexport interface FormRootProps extends Omit<\n ComponentPropsWithRef<\"form\">,\n \"onSubmit\" | \"method\" | \"action\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * React form action (`(formData) => unknown`: a Server Function, a `useActionState` dispatch,\n * or a client function), rendered on the form unwrapped so React's progressive enhancement is\n * kept, and run by the Form inside its own transition after hydration (no automatic reset; see\n * `autoReset`). A string is a navigating form. A submitter with its own `formAction` is left to\n * React (automatic reset applies to it).\n */\n action?: string | ((formData: FormData) => unknown);\n /**\n * Field errors keyed by field `name` (usually `state.errors` from `useActionState`). Each\n * `Field.Root` with that name shows its entry, writes it into the control's custom validity,\n * and clears it on the user's next edit; the next settled submission shows the new entries.\n * Errors present at mount are shown without moving focus.\n */\n errors?: FormErrors;\n /**\n * Reset the form (`form.reset()`) when a submission the Form ran settles with no non-empty\n * entry in `errors`. Default `true`. A submission that reports errors never resets, so the\n * user's input, `:user-invalid` and custom validity stay. `false`: never reset.\n */\n autoReset?: boolean;\n /** Only with a string `action`. Owned otherwise (React's own with a function action). */\n method?: ComponentPropsWithRef<\"form\">[\"method\"];\n className?: StateValue<string | undefined, FormRootState>;\n style?: StateValue<CSSProperties | undefined, FormRootState>;\n children?: StateValue<ReactNode, FormRootState>;\n /** Must render a `<form>`. */\n render?: RenderProp<ComponentPropsWithRef<\"form\">, FormRootState>;\n}\n\ninterface Submission {\n /** The Form ran the action itself (`onSubmit` + its own transition). */\n readonly intercepted: boolean;\n readonly formData: FormData | null;\n}\n\n/**\n * A `<form>` that runs its function `action` itself after hydration (design/components/field-form.md\n * 3): `onSubmit` cancels the native submission, so react-dom neither runs the action nor schedules\n * its automatic reset, and the Form awaits `action(formData)` inside its own transition, which\n * still starts the form's status (`useFormStatus`). The action stays rendered unwrapped on the\n * element, so a Server Function posts before hydration.\n *\n * When a submission settles, the Form focuses the first Field that shows a server error (from\n * `errors`), or, when `errors` has no entry and `autoReset` is on, resets the form.\n *\n * Owned keys (conventions 1.2): `action`, `method` (except with a string `action`), `onSubmit`,\n * `data-pending`.\n */\nexport function FormRoot({\n action,\n errors,\n autoReset = true,\n method,\n className,\n style,\n children,\n render,\n ...rest\n}: FormRootProps) {\n const [isPending, startTransition] = useTransition();\n const [statusPending, setStatusPending] = useState(false);\n const pending = isPending || statusPending;\n\n const formRef = useRef<HTMLFormElement | null>(null);\n const submission = useRef<Submission | null>(null);\n const fields = useRef(new Set<FormFieldRegistration>());\n const latest = useLatest({ errors, autoReset });\n const isFunction = typeof action === \"function\";\n\n // A native capture listener sees every submission, React's path included (a submitter with its\n // own `formAction`), before React's `onSubmit` runs and marks it intercepted.\n const checkElement = useElementCheck<HTMLFormElement>(\n isDev &&\n ((form) =>\n form.tagName !== \"FORM\"\n ? `Form.Root: expected to render a <form> element but got <${form.tagName.toLowerCase()}>.`\n : null),\n );\n const libraryRef = useCallback(\n (form: HTMLFormElement) => {\n formRef.current = form;\n checkElement?.(form);\n const onSubmit = (event: Event) => {\n if (event.target !== form) return;\n submission.current = { intercepted: false, formData: null };\n };\n form.addEventListener(\"submit\", onSubmit, true);\n return () => {\n form.removeEventListener(\"submit\", onSubmit, true);\n if (formRef.current === form) formRef.current = null;\n };\n },\n [checkElement],\n );\n\n const onSubmit = (event: FormEvent<HTMLFormElement>) => {\n if (typeof action !== \"function\") return; // a navigating form: the browser's\n // A `render` element's own `onSubmit` (merged, it runs first) vetoed the submission\n // (conventions: a `preventDefault()` in the consumer's handler cancels the library's work).\n if (event.defaultPrevented) {\n submission.current = null;\n return;\n }\n const native = event.nativeEvent as SubmitEvent;\n const submitter = native.submitter;\n // A per-button action: React's own path (and its automatic reset).\n if (submitter?.hasAttribute(\"formaction\") === true) return;\n // react-dom now skips its action run and its reset, and still starts the form's status.\n event.preventDefault();\n const formData = new FormData(event.currentTarget, submitter);\n submission.current = { intercepted: true, formData };\n startTransition(async () => {\n await action(formData);\n });\n };\n\n const registerField = useCallback((registration: FormFieldRegistration) => {\n fields.current.add(registration);\n return () => {\n fields.current.delete(registration);\n };\n }, []);\n\n // The settle (design 3.2): the form's status went `true → false`. The Fields rendered the\n // result's errors in that commit; this effect runs after it.\n const onSettled = useCallback(() => {\n const settled = submission.current;\n submission.current = null;\n const form = formRef.current;\n if (form === null) return;\n const shown = [...fields.current]\n .filter((field) => field.showsServerError())\n .map((field) => ({ field, target: field.getFocusTarget() }))\n .filter(\n (entry): entry is { field: FormFieldRegistration; target: HTMLElement } =>\n entry.target !== null && entry.target.isConnected,\n );\n if (shown.length > 0) {\n const first = sortByDocumentOrder(shown, (entry) => entry.target)[0]!;\n // Focus already there (the user pressed Enter in that field): `focus()` does nothing and\n // nothing reads the new description, so the message is announced instead (design 5.3).\n if (first.target.ownerDocument.activeElement === first.target) {\n announce(first.target, first.field.serverMessages().join(\" \"));\n } else {\n first.target.focus();\n }\n return;\n }\n const { errors, autoReset } = latest.current;\n if (autoReset && settled?.intercepted === true && !hasAnyError(errors)) form.reset();\n }, [latest]);\n\n const submittedData = useCallback(() => {\n const current = submission.current;\n return current?.intercepted === true ? current.formData : null;\n }, []);\n\n const refreshFields = useCallback((source: FormFieldRegistration | null) => {\n for (const field of fields.current) if (field !== source) field.refresh();\n }, []);\n\n const context = useMemo<FormContextValue>(\n () => ({ errors, registerField, submittedData, refreshFields }),\n [errors, registerField, submittedData, refreshFields],\n );\n\n const state: FormRootState = { pending };\n\n const element = useRender<ComponentPropsWithRef<\"form\">, FormRootState>({\n defaultElement: \"form\",\n render,\n state,\n className,\n style,\n children: (s) => (\n <>\n {resolveStateValue(children, s)}\n {isFunction && (\n <FormStatusWatcher onPendingChange={setStatusPending} onSettled={onSettled} />\n )}\n </>\n ),\n props: rest,\n libraryProps: {\n method: typeof action === \"string\" ? method : undefined,\n // React's own type wants `void | Promise<void>`; the library's actions return `unknown`\n // (conventions 2.2) and React ignores the result.\n action: action as ComponentPropsWithRef<\"form\">[\"action\"],\n onSubmit: isFunction ? onSubmit : undefined,\n \"data-pending\": dataAttr(pending),\n },\n ref: libraryRef,\n });\n\n return <FormContext value={context}>{element}</FormContext>;\n}\n\nFormRoot.displayName = \"FormRoot\";\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;AA8DvC,SAAgB,SAAS,EACvB,QACA,QACA,YAAY,MACZ,QACA,WACA,OACA,UACA,QACA,GAAG,QACa;CAChB,MAAM,CAAC,WAAW,mBAAmB,cAAc;CACnD,MAAM,CAAC,eAAe,oBAAoB,SAAS,KAAK;CACxD,MAAM,UAAU,aAAa;CAE7B,MAAM,UAAU,OAA+B,IAAI;CACnD,MAAM,aAAa,OAA0B,IAAI;CACjD,MAAM,SAAS,uBAAO,IAAI,IAA2B,CAAC;CACtD,MAAM,SAAS,UAAU;EAAE;EAAQ;CAAU,CAAC;CAC9C,MAAM,aAAa,OAAO,WAAW;CAIrC,MAAM,eAAe,gBACnB,WACI,SACA,KAAK,YAAY,SACb,2DAA2D,KAAK,QAAQ,YAAY,EAAE,MACtF,KACV;CACA,MAAM,aAAa,aAChB,SAA0B;EACzB,QAAQ,UAAU;EAClB,eAAe,IAAI;EACnB,MAAM,YAAY,UAAiB;GACjC,IAAI,MAAM,WAAW,MAAM;GAC3B,WAAW,UAAU;IAAE,aAAa;IAAO,UAAU;GAAK;EAC5D;EACA,KAAK,iBAAiB,UAAU,UAAU,IAAI;EAC9C,aAAa;GACX,KAAK,oBAAoB,UAAU,UAAU,IAAI;GACjD,IAAI,QAAQ,YAAY,MAAM,QAAQ,UAAU;EAClD;CACF,GACA,CAAC,YAAY,CACf;CAEA,MAAM,YAAY,UAAsC;EACtD,IAAI,OAAO,WAAW,YAAY;EAGlC,IAAI,MAAM,kBAAkB;GAC1B,WAAW,UAAU;GACrB;EACF;EAEA,MAAM,YADS,MAAM,YACI;EAEzB,IAAI,WAAW,aAAa,YAAY,MAAM,MAAM;EAEpD,MAAM,eAAe;EACrB,MAAM,WAAW,IAAI,SAAS,MAAM,eAAe,SAAS;EAC5D,WAAW,UAAU;GAAE,aAAa;GAAM;EAAS;EACnD,gBAAgB,YAAY;GAC1B,MAAM,OAAO,QAAQ;EACvB,CAAC;CACH;CAEA,MAAM,gBAAgB,aAAa,iBAAwC;EACzE,OAAO,QAAQ,IAAI,YAAY;EAC/B,aAAa;GACX,OAAO,QAAQ,OAAO,YAAY;EACpC;CACF,GAAG,CAAC,CAAC;CAIL,MAAM,YAAY,kBAAkB;EAClC,MAAM,UAAU,WAAW;EAC3B,WAAW,UAAU;EACrB,MAAM,OAAO,QAAQ;EACrB,IAAI,SAAS,MAAM;EACnB,MAAM,QAAQ,CAAC,GAAG,OAAO,OAAO,CAAC,CAC9B,QAAQ,UAAU,MAAM,iBAAiB,CAAC,CAAC,CAC3C,KAAK,WAAW;GAAE;GAAO,QAAQ,MAAM,eAAe;EAAE,EAAE,CAAC,CAC3D,QACE,UACC,MAAM,WAAW,QAAQ,MAAM,OAAO,WAC1C;EACF,IAAI,MAAM,SAAS,GAAG;GACpB,MAAM,QAAQ,oBAAoB,QAAQ,UAAU,MAAM,MAAM,CAAC,CAAC;GAGlE,IAAI,MAAM,OAAO,cAAc,kBAAkB,MAAM,QACrD,SAAS,MAAM,QAAQ,MAAM,MAAM,eAAe,CAAC,CAAC,KAAK,GAAG,CAAC;QAE7D,MAAM,OAAO,MAAM;GAErB;EACF;EACA,MAAM,EAAE,QAAQ,cAAc,OAAO;EACrC,IAAI,aAAa,SAAS,gBAAgB,QAAQ,CAAC,YAAY,MAAM,GAAG,KAAK,MAAM;CACrF,GAAG,CAAC,MAAM,CAAC;CAEX,MAAM,gBAAgB,kBAAkB;EACtC,MAAM,UAAU,WAAW;EAC3B,OAAO,SAAS,gBAAgB,OAAO,QAAQ,WAAW;CAC5D,GAAG,CAAC,CAAC;CAEL,MAAM,gBAAgB,aAAa,WAAyC;EAC1E,KAAK,MAAM,SAAS,OAAO,SAAS,IAAI,UAAU,QAAQ,MAAM,QAAQ;CAC1E,GAAG,CAAC,CAAC;CAEL,MAAM,UAAU,eACP;EAAE;EAAQ;EAAe;EAAe;CAAc,IAC7D;EAAC;EAAQ;EAAe;EAAe;CAAa,CACtD;CAIA,MAAM,UAAU,UAAwD;EACtE,gBAAgB;EAChB;EACA,OAAA,EAL6B,QAKzB;EACJ;EACA;EACA,WAAW,MACT,qBAAA,UAAA,EAAA,UAAA,CACG,kBAAkB,UAAU,CAAC,GAC7B,cACC,oBAAC,mBAAD;GAAmB,iBAAiB;GAA6B;EAAY,CAAA,CAE/E,EAAA,CAAA;EAEJ,OAAO;EACP,cAAc;GACZ,QAAQ,OAAO,WAAW,WAAW,SAAS,KAAA;GAGtC;GACR,UAAU,aAAa,WAAW,KAAA;GAClC,gBAAgB,SAAS,OAAO;EAClC;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,aAAD;EAAa,OAAO;EAAU,UAAA;CAAqB,CAAA;AAC5D;AAEA,SAAS,cAAc"}
1
+ {"version":3,"file":"form-root.mjs","names":[],"sources":["../../src/form/form-root.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useMemo, useRef, useState, useTransition } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, FormEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { sortByDocumentOrder } from \"../internal/dom-order.js\";\nimport { FormContext } from \"../internal/field-context.js\";\nimport type { FormContextValue, FormFieldRegistration } from \"../internal/field-context.js\";\nimport { announce } from \"../internal/announce.js\";\nimport { FormStatusWatcher } from \"../internal/form-status-watcher.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport { hasAnyError } from \"../internal/validity.js\";\nimport type { FormErrors } from \"../internal/validity.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport type { FieldErrorValue, FormErrors } from \"../internal/validity.js\";\n\n/**\n * State of `Form.Root`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface FormRootState {\n /** A submission is in flight: the Form's own transition, or the form's status (`useFormStatus`), including the Suspense wait of the result. */\n readonly pending: boolean;\n}\n\n/**\n * Props of `Form.Root`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport interface FormRootProps extends Omit<\n ComponentPropsWithRef<\"form\">,\n \"onSubmit\" | \"method\" | \"action\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * React form action (`(formData) => unknown`: a Server Function, a `useActionState` dispatch,\n * or a client function), rendered on the form unwrapped so React's progressive enhancement is\n * kept, and run by the Form inside its own transition after hydration (no automatic reset; see\n * `autoReset`). A string is a navigating form. A submitter with its own `formAction` is left to\n * React (automatic reset applies to it).\n */\n action?: string | ((formData: FormData) => unknown);\n /**\n * Field errors keyed by field `name` (usually `state.errors` from `useActionState`). Each\n * `Field.Root` with that name shows its entry, writes it into the control's custom validity,\n * and clears it on the user's next edit; the next settled submission shows the new entries.\n * Errors present at mount are shown without moving focus.\n */\n errors?: FormErrors;\n /**\n * Reset the form (`form.reset()`) when a submission the Form ran settles with no non-empty\n * entry in `errors`. A submission that reports errors never resets, so the\n * user's input, `:user-invalid` and custom validity stay. `false`: never reset.\n *\n * @defaultValue `true`\n */\n autoReset?: boolean;\n /** Only with a string `action`. Owned otherwise (React's own with a function action). */\n method?: ComponentPropsWithRef<\"form\">[\"method\"];\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, FormRootState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, FormRootState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, FormRootState>;\n /** Must render a `<form>`. */\n render?: RenderProp<ComponentPropsWithRef<\"form\">, FormRootState>;\n}\n\ninterface Submission {\n /** The Form ran the action itself (`onSubmit` + its own transition). */\n readonly intercepted: boolean;\n readonly formData: FormData | null;\n}\n\n/**\n * A `<form>` that runs its function `action` itself after hydration (design/components/field-form.md\n * 3): `onSubmit` cancels the native submission, so react-dom neither runs the action nor schedules\n * its automatic reset, and the Form awaits `action(formData)` inside its own transition, which\n * still starts the form's status (`useFormStatus`). The action stays rendered unwrapped on the\n * element, so a Server Function posts before hydration.\n *\n * When a submission settles, the Form focuses the first Field that shows a server error (from\n * `errors`), or, when `errors` has no entry and `autoReset` is on, resets the form.\n *\n * Owned keys (conventions 1.2): `action`, `method` (except with a string `action`), `onSubmit`,\n * `data-pending`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport function FormRoot({\n action,\n errors,\n autoReset = true,\n method,\n className,\n style,\n children,\n render,\n ...rest\n}: FormRootProps) {\n const [isPending, startTransition] = useTransition();\n const [statusPending, setStatusPending] = useState(false);\n const pending = isPending || statusPending;\n\n const formRef = useRef<HTMLFormElement | null>(null);\n const submission = useRef<Submission | null>(null);\n const fields = useRef(new Set<FormFieldRegistration>());\n const latest = useLatest({ errors, autoReset });\n const isFunction = typeof action === \"function\";\n\n // A native capture listener sees every submission, React's path included (a submitter with its\n // own `formAction`), before React's `onSubmit` runs and marks it intercepted.\n const checkElement = useElementCheck<HTMLFormElement>(\n isDev &&\n ((form) =>\n form.tagName !== \"FORM\"\n ? `Form.Root: expected to render a <form> element but got <${form.tagName.toLowerCase()}>.`\n : null),\n );\n const libraryRef = useCallback(\n (form: HTMLFormElement) => {\n formRef.current = form;\n checkElement?.(form);\n const onSubmit = (event: Event) => {\n if (event.target !== form) return;\n submission.current = { intercepted: false, formData: null };\n };\n form.addEventListener(\"submit\", onSubmit, true);\n return () => {\n form.removeEventListener(\"submit\", onSubmit, true);\n if (formRef.current === form) formRef.current = null;\n };\n },\n [checkElement],\n );\n\n const onSubmit = (event: FormEvent<HTMLFormElement>) => {\n if (typeof action !== \"function\") return; // a navigating form: the browser's\n // A `render` element's own `onSubmit` (merged, it runs first) vetoed the submission\n // (conventions: a `preventDefault()` in the consumer's handler cancels the library's work).\n if (event.defaultPrevented) {\n submission.current = null;\n return;\n }\n const native = event.nativeEvent as SubmitEvent;\n const submitter = native.submitter;\n // A per-button action: React's own path (and its automatic reset).\n if (submitter?.hasAttribute(\"formaction\") === true) return;\n // react-dom now skips its action run and its reset, and still starts the form's status.\n event.preventDefault();\n const formData = new FormData(event.currentTarget, submitter);\n submission.current = { intercepted: true, formData };\n startTransition(async () => {\n await action(formData);\n });\n };\n\n const registerField = useCallback((registration: FormFieldRegistration) => {\n fields.current.add(registration);\n return () => {\n fields.current.delete(registration);\n };\n }, []);\n\n // The settle (design 3.2): the form's status went `true → false`. The Fields rendered the\n // result's errors in that commit; this effect runs after it.\n const onSettled = useCallback(() => {\n const settled = submission.current;\n submission.current = null;\n const form = formRef.current;\n if (form === null) return;\n const shown = [...fields.current]\n .filter((field) => field.showsServerError())\n .map((field) => ({ field, target: field.getFocusTarget() }))\n .filter(\n (entry): entry is { field: FormFieldRegistration; target: HTMLElement } =>\n entry.target !== null && entry.target.isConnected,\n );\n if (shown.length > 0) {\n const first = sortByDocumentOrder(shown, (entry) => entry.target)[0]!;\n // Focus already there (the user pressed Enter in that field): `focus()` does nothing and\n // nothing reads the new description, so the message is announced instead (design 5.3).\n if (first.target.ownerDocument.activeElement === first.target) {\n announce(first.target, first.field.serverMessages().join(\" \"));\n } else {\n first.target.focus();\n }\n return;\n }\n const { errors, autoReset } = latest.current;\n if (autoReset && settled?.intercepted === true && !hasAnyError(errors)) form.reset();\n }, [latest]);\n\n const submittedData = useCallback(() => {\n const current = submission.current;\n return current?.intercepted === true ? current.formData : null;\n }, []);\n\n const refreshFields = useCallback((source: FormFieldRegistration | null) => {\n for (const field of fields.current) if (field !== source) field.refresh();\n }, []);\n\n const context = useMemo<FormContextValue>(\n () => ({ errors, registerField, submittedData, refreshFields }),\n [errors, registerField, submittedData, refreshFields],\n );\n\n const state: FormRootState = { pending };\n\n const element = useRender<ComponentPropsWithRef<\"form\">, FormRootState>({\n defaultElement: \"form\",\n render,\n state,\n className,\n style,\n children: (s) => (\n <>\n {resolveStateValue(children, s)}\n {isFunction && (\n <FormStatusWatcher onPendingChange={setStatusPending} onSettled={onSettled} />\n )}\n </>\n ),\n props: rest,\n libraryProps: {\n method: typeof action === \"string\" ? method : undefined,\n // React's own type wants `void | Promise<void>`; the library's actions return `unknown`\n // (conventions 2.2) and React ignores the result.\n action: action as ComponentPropsWithRef<\"form\">[\"action\"],\n onSubmit: isFunction ? onSubmit : undefined,\n \"data-pending\": dataAttr(pending),\n },\n ref: libraryRef,\n });\n\n return <FormContext value={context}>{element}</FormContext>;\n}\n\nFormRoot.displayName = \"FormRoot\";\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;;;AA8EvC,SAAgB,SAAS,EACvB,QACA,QACA,YAAY,MACZ,QACA,WACA,OACA,UACA,QACA,GAAG,QACa;CAChB,MAAM,CAAC,WAAW,mBAAmB,cAAc;CACnD,MAAM,CAAC,eAAe,oBAAoB,SAAS,KAAK;CACxD,MAAM,UAAU,aAAa;CAE7B,MAAM,UAAU,OAA+B,IAAI;CACnD,MAAM,aAAa,OAA0B,IAAI;CACjD,MAAM,SAAS,uBAAO,IAAI,IAA2B,CAAC;CACtD,MAAM,SAAS,UAAU;EAAE;EAAQ;CAAU,CAAC;CAC9C,MAAM,aAAa,OAAO,WAAW;CAIrC,MAAM,eAAe,gBACnB,WACI,SACA,KAAK,YAAY,SACb,2DAA2D,KAAK,QAAQ,YAAY,EAAE,MACtF,KACV;CACA,MAAM,aAAa,aAChB,SAA0B;EACzB,QAAQ,UAAU;EAClB,eAAe,IAAI;EACnB,MAAM,YAAY,UAAiB;GACjC,IAAI,MAAM,WAAW,MAAM;GAC3B,WAAW,UAAU;IAAE,aAAa;IAAO,UAAU;GAAK;EAC5D;EACA,KAAK,iBAAiB,UAAU,UAAU,IAAI;EAC9C,aAAa;GACX,KAAK,oBAAoB,UAAU,UAAU,IAAI;GACjD,IAAI,QAAQ,YAAY,MAAM,QAAQ,UAAU;EAClD;CACF,GACA,CAAC,YAAY,CACf;CAEA,MAAM,YAAY,UAAsC;EACtD,IAAI,OAAO,WAAW,YAAY;EAGlC,IAAI,MAAM,kBAAkB;GAC1B,WAAW,UAAU;GACrB;EACF;EAEA,MAAM,YADS,MAAM,YACI;EAEzB,IAAI,WAAW,aAAa,YAAY,MAAM,MAAM;EAEpD,MAAM,eAAe;EACrB,MAAM,WAAW,IAAI,SAAS,MAAM,eAAe,SAAS;EAC5D,WAAW,UAAU;GAAE,aAAa;GAAM;EAAS;EACnD,gBAAgB,YAAY;GAC1B,MAAM,OAAO,QAAQ;EACvB,CAAC;CACH;CAEA,MAAM,gBAAgB,aAAa,iBAAwC;EACzE,OAAO,QAAQ,IAAI,YAAY;EAC/B,aAAa;GACX,OAAO,QAAQ,OAAO,YAAY;EACpC;CACF,GAAG,CAAC,CAAC;CAIL,MAAM,YAAY,kBAAkB;EAClC,MAAM,UAAU,WAAW;EAC3B,WAAW,UAAU;EACrB,MAAM,OAAO,QAAQ;EACrB,IAAI,SAAS,MAAM;EACnB,MAAM,QAAQ,CAAC,GAAG,OAAO,OAAO,CAAC,CAC9B,QAAQ,UAAU,MAAM,iBAAiB,CAAC,CAAC,CAC3C,KAAK,WAAW;GAAE;GAAO,QAAQ,MAAM,eAAe;EAAE,EAAE,CAAC,CAC3D,QACE,UACC,MAAM,WAAW,QAAQ,MAAM,OAAO,WAC1C;EACF,IAAI,MAAM,SAAS,GAAG;GACpB,MAAM,QAAQ,oBAAoB,QAAQ,UAAU,MAAM,MAAM,CAAC,CAAC;GAGlE,IAAI,MAAM,OAAO,cAAc,kBAAkB,MAAM,QACrD,SAAS,MAAM,QAAQ,MAAM,MAAM,eAAe,CAAC,CAAC,KAAK,GAAG,CAAC;QAE7D,MAAM,OAAO,MAAM;GAErB;EACF;EACA,MAAM,EAAE,QAAQ,cAAc,OAAO;EACrC,IAAI,aAAa,SAAS,gBAAgB,QAAQ,CAAC,YAAY,MAAM,GAAG,KAAK,MAAM;CACrF,GAAG,CAAC,MAAM,CAAC;CAEX,MAAM,gBAAgB,kBAAkB;EACtC,MAAM,UAAU,WAAW;EAC3B,OAAO,SAAS,gBAAgB,OAAO,QAAQ,WAAW;CAC5D,GAAG,CAAC,CAAC;CAEL,MAAM,gBAAgB,aAAa,WAAyC;EAC1E,KAAK,MAAM,SAAS,OAAO,SAAS,IAAI,UAAU,QAAQ,MAAM,QAAQ;CAC1E,GAAG,CAAC,CAAC;CAEL,MAAM,UAAU,eACP;EAAE;EAAQ;EAAe;EAAe;CAAc,IAC7D;EAAC;EAAQ;EAAe;EAAe;CAAa,CACtD;CAIA,MAAM,UAAU,UAAwD;EACtE,gBAAgB;EAChB;EACA,OAAA,EAL6B,QAKzB;EACJ;EACA;EACA,WAAW,MACT,qBAAA,UAAA,EAAA,UAAA,CACG,kBAAkB,UAAU,CAAC,GAC7B,cACC,oBAAC,mBAAD;GAAmB,iBAAiB;GAA6B;EAAY,CAAA,CAE/E,EAAA,CAAA;EAEJ,OAAO;EACP,cAAc;GACZ,QAAQ,OAAO,WAAW,WAAW,SAAS,KAAA;GAGtC;GACR,UAAU,aAAa,WAAW,KAAA;GAClC,gBAAgB,SAAS,OAAO;EAClC;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,aAAD;EAAa,OAAO;EAAU,UAAA;CAAqB,CAAA;AAC5D;AAEA,SAAS,cAAc"}
@@ -1,20 +1,36 @@
1
1
  import { RenderProp, StateValue } from "../internal/types.mjs";
2
2
  import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
3
3
  //#region src/form/form-submit.d.ts
4
+ /**
5
+ * State of `Form.Submit`, passed to the function forms of `className`, `style`, `children` and
6
+ * `render`.
7
+ */
4
8
  export interface FormSubmitState {
5
9
  /** The enclosing form's submission is in flight (`useFormStatus().pending`). */
6
10
  readonly pending: boolean;
11
+ /** The `disabled` prop (never set by the library while pending). */
7
12
  readonly disabled: boolean;
8
13
  }
14
+ /**
15
+ * Props of `Form.Submit`.
16
+ *
17
+ * @see https://ui.funstack.work/components/field
18
+ */
9
19
  export interface FormSubmitProps extends Omit<ComponentPropsWithRef<"button">, "type" | "className" | "style" | "children"> {
10
20
  /**
11
21
  * Native `disabled`; owned. Never set by the library (conventions 3.6). Always native, also
12
22
  * with a component `render`: a submitter has no handler to honour `aria-disabled`.
23
+ *
24
+ * @defaultValue `false`
13
25
  */
14
26
  disabled?: boolean;
27
+ /** Class name, or a function of the part's state that returns one. */
15
28
  className?: StateValue<string | undefined, FormSubmitState>;
29
+ /** Inline style, or a function of the part's state that returns one. */
16
30
  style?: StateValue<CSSProperties | undefined, FormSubmitState>;
31
+ /** Content, or a function of the part's state. */
17
32
  children?: StateValue<ReactNode, FormSubmitState>;
33
+ /** Replace the default `<button>` (element form) or take over rendering (function form). */
18
34
  render?: RenderProp<ComponentPropsWithRef<"button">, FormSubmitState>;
19
35
  }
20
36
  /**
@@ -25,6 +41,8 @@ export interface FormSubmitProps extends Omit<ComponentPropsWithRef<"button">, "
25
41
  *
26
42
  * Owned keys (conventions 1.2): `type` (on a `<button>`), `disabled`, `data-pending`,
27
43
  * `data-disabled`.
44
+ *
45
+ * @see https://ui.funstack.work/components/field
28
46
  */
29
47
  export declare function FormSubmit({ disabled, className, style, children, render, ...rest }: FormSubmitProps): ReactNode;
30
48
  export declare namespace FormSubmit {
@@ -1 +1 @@
1
- {"version":3,"file":"form-submit.d.mts","names":[],"sources":["../../src/form/form-submit.tsx"],"mappings":";;;iBAUiB;;WAEN;WACA;;iBAGM,wBAAwB,KACvC;;;;;EAOA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;wBAYvC,aACd,UACA,WACA,OACA,UACA,WACG,QACF,kBAAe;yBAPF"}
1
+ {"version":3,"file":"form-submit.d.mts","names":[],"sources":["../../src/form/form-submit.tsx"],"mappings":";;;;;;;iBAciB;;WAEN;;WAEA;;;;;;;iBAQM,wBAAwB,KACvC;;;;;;;EASA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;wBAcvC,aACd,UACA,WACA,OACA,UACA,WACG,QACF,kBAAe;yBAPF"}
@@ -14,6 +14,8 @@ const isDev = process.env.NODE_ENV !== "production";
14
14
  *
15
15
  * Owned keys (conventions 1.2): `type` (on a `<button>`), `disabled`, `data-pending`,
16
16
  * `data-disabled`.
17
+ *
18
+ * @see https://ui.funstack.work/components/field
17
19
  */
18
20
  function FormSubmit({ disabled = false, className, style, children, render, ...rest }) {
19
21
  const { pending } = useFormStatus();
@@ -1 +1 @@
1
- {"version":3,"file":"form-submit.mjs","names":[],"sources":["../../src/form/form-submit.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { useFormStatus } from \"react-dom\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface FormSubmitState {\n /** The enclosing form's submission is in flight (`useFormStatus().pending`). */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface FormSubmitProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"type\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Native `disabled`; owned. Never set by the library (conventions 3.6). Always native, also\n * with a component `render`: a submitter has no handler to honour `aria-disabled`.\n */\n disabled?: boolean;\n className?: StateValue<string | undefined, FormSubmitState>;\n style?: StateValue<CSSProperties | undefined, FormSubmitState>;\n children?: StateValue<ReactNode, FormSubmitState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, FormSubmitState>;\n}\n\n/**\n * The form's submit button: `<button type=\"submit\">` with `data-pending` while the enclosing\n * form's submission is in flight (`useFormStatus`). Works in any React-rendered form\n * (`Form.Root`, `Dialog.Form`, a plain `<form action>`). Never disabled while pending: block\n * repeat clicks with CSS on `[data-pending]` if you need to.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>`), `disabled`, `data-pending`,\n * `data-disabled`.\n */\nexport function FormSubmit({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: FormSubmitProps) {\n const { pending } = useFormStatus();\n const ref = useElementCheck(\n isDev &&\n ((el) => {\n const submitter =\n el.tagName === \"BUTTON\" ||\n (el.tagName === \"INPUT\" && [\"submit\", \"image\"].includes((el as HTMLInputElement).type));\n return submitter\n ? null\n : `Form.Submit: expected to render a <button> (or <input type=\"submit\">) but got ` +\n `<${el.tagName.toLowerCase()}>. Only a submit button submits the form natively.`;\n }),\n );\n const state: FormSubmitState = { pending, disabled };\n return useRender<ComponentPropsWithRef<\"button\">, FormSubmitState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n ...(rendersButton(render) && { type: \"submit\" as const }),\n disabled,\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n },\n ref,\n });\n}\n\nFormSubmit.displayName = \"FormSubmit\";\n"],"mappings":";;;;;;;AAQA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;AAgCvC,SAAgB,WAAW,EACzB,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACe;CAClB,MAAM,EAAE,YAAY,cAAc;CAClC,MAAM,MAAM,gBACV,WACI,OAAO;EAIP,OAFE,GAAG,YAAY,YACd,GAAG,YAAY,WAAW,CAAC,UAAU,OAAO,CAAC,CAAC,SAAU,GAAwB,IAAI,IAEnF,OACA,kFACM,GAAG,QAAQ,YAAY,EAAE;CACrC,EACJ;CAEA,OAAO,UAA4D;EACjE,gBAAgB;EAChB;EACA,OAAA;GAJ+B;GAAS;EAIpC;EACJ;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;GACvD;GACA,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;EACpC;EACA;CACF,CAAC;AACH;AAEA,WAAW,cAAc"}
1
+ {"version":3,"file":"form-submit.mjs","names":[],"sources":["../../src/form/form-submit.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { useFormStatus } from \"react-dom\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * State of `Form.Submit`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface FormSubmitState {\n /** The enclosing form's submission is in flight (`useFormStatus().pending`). */\n readonly pending: boolean;\n /** The `disabled` prop (never set by the library while pending). */\n readonly disabled: boolean;\n}\n\n/**\n * Props of `Form.Submit`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport interface FormSubmitProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"type\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Native `disabled`; owned. Never set by the library (conventions 3.6). Always native, also\n * with a component `render`: a submitter has no handler to honour `aria-disabled`.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, FormSubmitState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, FormSubmitState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, FormSubmitState>;\n /** Replace the default `<button>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, FormSubmitState>;\n}\n\n/**\n * The form's submit button: `<button type=\"submit\">` with `data-pending` while the enclosing\n * form's submission is in flight (`useFormStatus`). Works in any React-rendered form\n * (`Form.Root`, `Dialog.Form`, a plain `<form action>`). Never disabled while pending: block\n * repeat clicks with CSS on `[data-pending]` if you need to.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>`), `disabled`, `data-pending`,\n * `data-disabled`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport function FormSubmit({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: FormSubmitProps) {\n const { pending } = useFormStatus();\n const ref = useElementCheck(\n isDev &&\n ((el) => {\n const submitter =\n el.tagName === \"BUTTON\" ||\n (el.tagName === \"INPUT\" && [\"submit\", \"image\"].includes((el as HTMLInputElement).type));\n return submitter\n ? null\n : `Form.Submit: expected to render a <button> (or <input type=\"submit\">) but got ` +\n `<${el.tagName.toLowerCase()}>. Only a submit button submits the form natively.`;\n }),\n );\n const state: FormSubmitState = { pending, disabled };\n return useRender<ComponentPropsWithRef<\"button\">, FormSubmitState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n ...(rendersButton(render) && { type: \"submit\" as const }),\n disabled,\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n },\n ref,\n });\n}\n\nFormSubmit.displayName = \"FormSubmit\";\n"],"mappings":";;;;;;;AAQA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;AAkDvC,SAAgB,WAAW,EACzB,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACe;CAClB,MAAM,EAAE,YAAY,cAAc;CAClC,MAAM,MAAM,gBACV,WACI,OAAO;EAIP,OAFE,GAAG,YAAY,YACd,GAAG,YAAY,WAAW,CAAC,UAAU,OAAO,CAAC,CAAC,SAAU,GAAwB,IAAI,IAEnF,OACA,kFACM,GAAG,QAAQ,YAAY,EAAE;CACrC,EACJ;CAEA,OAAO,UAA4D;EACjE,gBAAgB;EAChB;EACA,OAAA;GAJ+B;GAAS;EAIpC;EACJ;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;GACvD;GACA,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;EACpC;EACA;CACF,CAAC;AACH;AAEA,WAAW,cAAc"}
@@ -2,6 +2,13 @@ import { FieldErrorValue, FormErrors } from "../internal/validity.mjs";
2
2
  import { FormRoot, FormRootProps, FormRootState } from "./form-root.mjs";
3
3
  import { FormSubmit, FormSubmitProps, FormSubmitState } from "./form-submit.mjs";
4
4
  //#region src/form/index.d.ts
5
+ /**
6
+ * Form: `Root` (`form`) runs its `action` in a transition with `data-pending`, routes server
7
+ * `errors` to the matching `Field.Root`s, focuses the first invalid field and resets only when the
8
+ * action reported no errors; `Submit` (`button[type=submit]`) shows the form's pending state.
9
+ *
10
+ * @see https://ui.funstack.work/components/field
11
+ */
5
12
  export declare const Form: {
6
13
  readonly Root: typeof FormRoot;
7
14
  readonly Submit: typeof FormSubmit;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/form/index.ts"],"mappings":";;;;qBAGa;WAAS,aAAI;WAAY,eAAM"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/form/index.ts"],"mappings":";;;;;;;;;;;qBAUa;WAAS,aAAI;WAAY,eAAM"}
@@ -1,6 +1,13 @@
1
1
  import { FormRoot } from "./form-root.mjs";
2
2
  import { FormSubmit } from "./form-submit.mjs";
3
3
  //#region src/form/index.ts
4
+ /**
5
+ * Form: `Root` (`form`) runs its `action` in a transition with `data-pending`, routes server
6
+ * `errors` to the matching `Field.Root`s, focuses the first invalid field and resets only when the
7
+ * action reported no errors; `Submit` (`button[type=submit]`) shows the form's pending state.
8
+ *
9
+ * @see https://ui.funstack.work/components/field
10
+ */
4
11
  const Form = {
5
12
  Root: FormRoot,
6
13
  Submit: FormSubmit
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/form/index.ts"],"sourcesContent":["import { FormRoot } from \"./form-root.js\";\nimport { FormSubmit } from \"./form-submit.js\";\n\nexport const Form = { Root: FormRoot, Submit: FormSubmit } as const;\n\nexport type { FormRootProps, FormRootState, FormErrors, FieldErrorValue } from \"./form-root.js\";\nexport type { FormSubmitProps, FormSubmitState } from \"./form-submit.js\";\n"],"mappings":";;;AAGA,MAAa,OAAO;CAAE,MAAM;CAAU,QAAQ;AAAW"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/form/index.ts"],"sourcesContent":["import { FormRoot } from \"./form-root.js\";\nimport { FormSubmit } from \"./form-submit.js\";\n\n/**\n * Form: `Root` (`form`) runs its `action` in a transition with `data-pending`, routes server\n * `errors` to the matching `Field.Root`s, focuses the first invalid field and resets only when the\n * action reported no errors; `Submit` (`button[type=submit]`) shows the form's pending state.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport const Form = { Root: FormRoot, Submit: FormSubmit } as const;\n\nexport type { FormRootProps, FormRootState, FormErrors, FieldErrorValue } from \"./form-root.js\";\nexport type { FormSubmitProps, FormSubmitState } from \"./form-submit.js\";\n"],"mappings":";;;;;;;;;;AAUA,MAAa,OAAO;CAAE,MAAM;CAAU,QAAQ;AAAW"}
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./internal/platform-attributes.mjs";
2
- import { Action, ActionDetails, ChangeAction, ChangeReason, RenderProp, StateValue, UrgentChangeHandler } from "./internal/types.mjs";
2
+ import { Action, ActionDetails, ChangeAction, ChangeReason, RenderProp, StateValue, UrgentChangeHandler, UrgentHandler, WhilePending } from "./internal/types.mjs";
3
3
  import { AccordionItemProps, AccordionItemState } from "./accordion/accordion-item.mjs";
4
4
  import { AccordionPanelProps, AccordionPanelState } from "./accordion/accordion-panel.mjs";
5
5
  import { AccordionRootExclusiveProps, AccordionRootMultipleProps, AccordionRootProps, AccordionRootState, AccordionValueChangeDetails } from "./accordion/accordion-root.mjs";
@@ -80,6 +80,7 @@ import { Popover } from "./popover/index.mjs";
80
80
  import { MenuItemDetails, MenuItemProps, MenuItemState } from "./menu/menu-item.mjs";
81
81
  import { MenuCheckboxItemProps, MenuCheckboxItemState } from "./menu/menu-checkbox-item.mjs";
82
82
  import { MenuTriggerProps, MenuTriggerState } from "./menu/menu-trigger.mjs";
83
+ import { MenuContextTriggerProps, MenuContextTriggerState } from "./menu/menu-context-trigger.mjs";
83
84
  import { MenuGroupLabelProps, MenuGroupLabelState, MenuGroupProps, MenuGroupState, MenuSeparatorProps, MenuSeparatorState } from "./menu/menu-group.mjs";
84
85
  import { MenuAlign, MenuPopupProps, MenuPopupState, MenuSide } from "./menu/menu-popup.mjs";
85
86
  import { MenuRadioGroupProps, MenuRadioGroupState } from "./menu/menu-radio-group.mjs";
@@ -132,4 +133,4 @@ import { MeterLabelProps } from "./meter/meter-label.mjs";
132
133
  import { MeterTrackProps } from "./meter/meter-track.mjs";
133
134
  import { MeterValueProps } from "./meter/meter-value.mjs";
134
135
  import { Meter } from "./meter/index.mjs";
135
- export { Accordion, type AccordionItemProps, type AccordionItemState, type AccordionPanelProps, type AccordionPanelState, type AccordionRootExclusiveProps, type AccordionRootMultipleProps, type AccordionRootProps, type AccordionRootState, type AccordionTriggerProps, type AccordionTriggerState, type AccordionValueChangeDetails, type Action, type ActionDetails, Button, type ButtonActionDetails, type ButtonProps, type ButtonState, CSPProvider, type CSPProviderProps, type ChangeAction, type ChangeReason, Checkbox, type CheckboxCheckedChangeDetails, CheckboxGroup, type CheckboxGroupItemProps, type CheckboxGroupItemState, type CheckboxGroupLabelProps, type CheckboxGroupParentProps, type CheckboxGroupParentState, type CheckboxGroupRootProps, type CheckboxGroupRootState, type CheckboxGroupValueChangeDetails, type CheckboxProps, type CheckboxState, Combobox, type ComboboxClearProps, type ComboboxClearState, type ComboboxEmptyProps, type ComboboxEmptyState, type ComboboxGroupLabelProps, type ComboboxGroupLabelState, type ComboboxGroupProps, type ComboboxGroupState, type ComboboxInputProps, type ComboboxInputState, type ComboboxInputValueChangeDetails, type ComboboxLabelProps, type ComboboxLabelState, type ComboboxListProps, type ComboboxListState, type ComboboxOpenChangeDetails, type ComboboxOptionProps, type ComboboxOptionState, type ComboboxPopupProps, type ComboboxPopupState, type ComboboxRootProps, type ComboboxRootState, type ComboboxStatusProps, type ComboboxStatusState, type ComboboxTriggerProps, type ComboboxTriggerState, type ComboboxValueChangeDetails, Dialog, type DialogCloseDetails, type DialogCloseProps, type DialogCloseState, type DialogDescriptionProps, type DialogDescriptionState, type DialogFormProps, type DialogFormState, type DialogOpenChangeDetails, type DialogPopupProps, type DialogPopupState, type DialogRootProps, type DialogRootState, type DialogTitleProps, type DialogTitleState, type DialogTriggerProps, type DialogTriggerState, Field, type FieldControlProps, type FieldDescriptionProps, type FieldErrorProps, type FieldErrorValue, type FieldLabelProps, type FieldRootProps, type FieldState, type FieldValidate, type FieldValidity, Form, type FormErrors, type FormRootProps, type FormRootState, type FormSubmitProps, type FormSubmitState, Menu, type MenuAlign, type MenuCheckboxItemProps, type MenuCheckboxItemState, type MenuGroupLabelProps, type MenuGroupLabelState, type MenuGroupProps, type MenuGroupState, type MenuItemDetails, type MenuItemProps, type MenuItemState, type MenuOpenChangeDetails, type MenuPopupProps, type MenuPopupState, type MenuRadioGroupProps, type MenuRadioGroupState, type MenuRadioItemProps, type MenuRadioItemState, type MenuRootProps, type MenuRootState, type MenuSeparatorProps, type MenuSeparatorState, type MenuSide, type MenuSubmenuTriggerProps, type MenuSubmenuTriggerState, type MenuTriggerProps, type MenuTriggerState, Meter, type MeterIndicatorProps, type MeterLabelProps, type MeterRegion, type MeterRootProps, type MeterState, type MeterTrackProps, type MeterValueProps, NumberField, type NumberFieldButtonState, type NumberFieldDecrementProps, type NumberFieldIncrementProps, type NumberFieldInputProps, type NumberFieldLabelProps, type NumberFieldRootProps, type NumberFieldState, type NumberFieldValueChangeDetails, Popover, type PopoverAlign, type PopoverCloseProps, type PopoverCloseState, type PopoverDescriptionProps, type PopoverDescriptionState, type PopoverOpenChangeDetails, type PopoverPopupProps, type PopoverPopupState, type PopoverRootProps, type PopoverRootState, type PopoverSide, type PopoverTitleProps, type PopoverTitleState, type PopoverTriggerProps, type PopoverTriggerState, Progress, type ProgressIndicatorProps, type ProgressLabelProps, type ProgressRootProps, type ProgressState, type ProgressTrackProps, type ProgressValueProps, RadioGroup, type RadioGroupItemProps, type RadioGroupItemState, type RadioGroupLabelProps, type RadioGroupRootProps, type RadioGroupRootState, type RadioGroupValueChangeDetails, type RenderProp, STYLE_SHA256, Select, type SelectGroupLabelProps, type SelectGroupProps, type SelectOptionProps, type SelectOptionState, type SelectRootProps, type SelectRootState, type SelectSeparatorProps, type SelectTriggerProps, type SelectValueChangeDetails, type SelectValueProps, Slider, type SliderIndicatorProps, type SliderIndicatorState, type SliderLabelProps, type SliderOrientation, type SliderRootProps, type SliderRootState, type SliderThumbProps, type SliderThumbState, type SliderTrackProps, type SliderTrackState, type SliderValue, type SliderValueChangeDetails, type SliderValueCommitDetails, type SliderValueProps, type SliderValueState, type StateValue, Switch, type SwitchCheckedChangeDetails, type SwitchProps, type SwitchState, Tabs, type TabsActivationMode, type TabsIndicatorProps, type TabsIndicatorState, type TabsListProps, type TabsListState, type TabsOrientation, type TabsPanelProps, type TabsPanelState, type TabsRootProps, type TabsRootState, type TabsTabProps, type TabsTabState, type TabsValueChangeDetails, Toast, type ToastActionDetails, type ToastActionOptions, type ToastActionProps, type ToastActionState, type ToastCloseDetails, type ToastCloseProps, type ToastCloseState, type ToastDescriptionProps, type ToastItem, type ToastManager, type ToastOptions, type ToastPriority, type ToastPromiseOptions, type ToastRootProps, type ToastRootState, type ToastTitleProps, type ToastViewportProps, type ToastViewportState, Toggle, ToggleGroup, type ToggleGroupExclusiveProps, type ToggleGroupItemProps, type ToggleGroupItemState, type ToggleGroupMultipleProps, type ToggleGroupOrientation, type ToggleGroupRootProps, type ToggleGroupRootState, type ToggleGroupValueChangeDetails, type TogglePressedChangeDetails, type ToggleProps, type ToggleState, Toolbar, type ToolbarOrientation, type ToolbarRootProps, type ToolbarRootState, type ToolbarSeparatorProps, type ToolbarSeparatorState, Tooltip, type TooltipAlign, type TooltipArrowProps, type TooltipArrowState, type TooltipPopupProps, type TooltipPopupState, type TooltipProvides, type TooltipRootProps, type TooltipRootState, type TooltipSide, type TooltipTriggerProps, type TooltipTriggerState, type UrgentChangeHandler, createToastManager, toast };
136
+ export { Accordion, type AccordionItemProps, type AccordionItemState, type AccordionPanelProps, type AccordionPanelState, type AccordionRootExclusiveProps, type AccordionRootMultipleProps, type AccordionRootProps, type AccordionRootState, type AccordionTriggerProps, type AccordionTriggerState, type AccordionValueChangeDetails, type Action, type ActionDetails, Button, type ButtonActionDetails, type ButtonProps, type ButtonState, CSPProvider, type CSPProviderProps, type ChangeAction, type ChangeReason, Checkbox, type CheckboxCheckedChangeDetails, CheckboxGroup, type CheckboxGroupItemProps, type CheckboxGroupItemState, type CheckboxGroupLabelProps, type CheckboxGroupParentProps, type CheckboxGroupParentState, type CheckboxGroupRootProps, type CheckboxGroupRootState, type CheckboxGroupValueChangeDetails, type CheckboxProps, type CheckboxState, Combobox, type ComboboxClearProps, type ComboboxClearState, type ComboboxEmptyProps, type ComboboxEmptyState, type ComboboxGroupLabelProps, type ComboboxGroupLabelState, type ComboboxGroupProps, type ComboboxGroupState, type ComboboxInputProps, type ComboboxInputState, type ComboboxInputValueChangeDetails, type ComboboxLabelProps, type ComboboxLabelState, type ComboboxListProps, type ComboboxListState, type ComboboxOpenChangeDetails, type ComboboxOptionProps, type ComboboxOptionState, type ComboboxPopupProps, type ComboboxPopupState, type ComboboxRootProps, type ComboboxRootState, type ComboboxStatusProps, type ComboboxStatusState, type ComboboxTriggerProps, type ComboboxTriggerState, type ComboboxValueChangeDetails, Dialog, type DialogCloseDetails, type DialogCloseProps, type DialogCloseState, type DialogDescriptionProps, type DialogDescriptionState, type DialogFormProps, type DialogFormState, type DialogOpenChangeDetails, type DialogPopupProps, type DialogPopupState, type DialogRootProps, type DialogRootState, type DialogTitleProps, type DialogTitleState, type DialogTriggerProps, type DialogTriggerState, Field, type FieldControlProps, type FieldDescriptionProps, type FieldErrorProps, type FieldErrorValue, type FieldLabelProps, type FieldRootProps, type FieldState, type FieldValidate, type FieldValidity, Form, type FormErrors, type FormRootProps, type FormRootState, type FormSubmitProps, type FormSubmitState, Menu, type MenuAlign, type MenuCheckboxItemProps, type MenuCheckboxItemState, type MenuContextTriggerProps, type MenuContextTriggerState, type MenuGroupLabelProps, type MenuGroupLabelState, type MenuGroupProps, type MenuGroupState, type MenuItemDetails, type MenuItemProps, type MenuItemState, type MenuOpenChangeDetails, type MenuPopupProps, type MenuPopupState, type MenuRadioGroupProps, type MenuRadioGroupState, type MenuRadioItemProps, type MenuRadioItemState, type MenuRootProps, type MenuRootState, type MenuSeparatorProps, type MenuSeparatorState, type MenuSide, type MenuSubmenuTriggerProps, type MenuSubmenuTriggerState, type MenuTriggerProps, type MenuTriggerState, Meter, type MeterIndicatorProps, type MeterLabelProps, type MeterRegion, type MeterRootProps, type MeterState, type MeterTrackProps, type MeterValueProps, NumberField, type NumberFieldButtonState, type NumberFieldDecrementProps, type NumberFieldIncrementProps, type NumberFieldInputProps, type NumberFieldLabelProps, type NumberFieldRootProps, type NumberFieldState, type NumberFieldValueChangeDetails, Popover, type PopoverAlign, type PopoverCloseProps, type PopoverCloseState, type PopoverDescriptionProps, type PopoverDescriptionState, type PopoverOpenChangeDetails, type PopoverPopupProps, type PopoverPopupState, type PopoverRootProps, type PopoverRootState, type PopoverSide, type PopoverTitleProps, type PopoverTitleState, type PopoverTriggerProps, type PopoverTriggerState, Progress, type ProgressIndicatorProps, type ProgressLabelProps, type ProgressRootProps, type ProgressState, type ProgressTrackProps, type ProgressValueProps, RadioGroup, type RadioGroupItemProps, type RadioGroupItemState, type RadioGroupLabelProps, type RadioGroupRootProps, type RadioGroupRootState, type RadioGroupValueChangeDetails, type RenderProp, STYLE_SHA256, Select, type SelectGroupLabelProps, type SelectGroupProps, type SelectOptionProps, type SelectOptionState, type SelectRootProps, type SelectRootState, type SelectSeparatorProps, type SelectTriggerProps, type SelectValueChangeDetails, type SelectValueProps, Slider, type SliderIndicatorProps, type SliderIndicatorState, type SliderLabelProps, type SliderOrientation, type SliderRootProps, type SliderRootState, type SliderThumbProps, type SliderThumbState, type SliderTrackProps, type SliderTrackState, type SliderValue, type SliderValueChangeDetails, type SliderValueCommitDetails, type SliderValueProps, type SliderValueState, type StateValue, Switch, type SwitchCheckedChangeDetails, type SwitchProps, type SwitchState, Tabs, type TabsActivationMode, type TabsIndicatorProps, type TabsIndicatorState, type TabsListProps, type TabsListState, type TabsOrientation, type TabsPanelProps, type TabsPanelState, type TabsRootProps, type TabsRootState, type TabsTabProps, type TabsTabState, type TabsValueChangeDetails, Toast, type ToastActionDetails, type ToastActionOptions, type ToastActionProps, type ToastActionState, type ToastCloseDetails, type ToastCloseProps, type ToastCloseState, type ToastDescriptionProps, type ToastItem, type ToastManager, type ToastOptions, type ToastPriority, type ToastPromiseOptions, type ToastRootProps, type ToastRootState, type ToastTitleProps, type ToastViewportProps, type ToastViewportState, Toggle, ToggleGroup, type ToggleGroupExclusiveProps, type ToggleGroupItemProps, type ToggleGroupItemState, type ToggleGroupMultipleProps, type ToggleGroupOrientation, type ToggleGroupRootProps, type ToggleGroupRootState, type ToggleGroupValueChangeDetails, type TogglePressedChangeDetails, type ToggleProps, type ToggleState, Toolbar, type ToolbarOrientation, type ToolbarRootProps, type ToolbarRootState, type ToolbarSeparatorProps, type ToolbarSeparatorState, Tooltip, type TooltipAlign, type TooltipArrowProps, type TooltipArrowState, type TooltipPopupProps, type TooltipPopupState, type TooltipProvides, type TooltipRootProps, type TooltipRootState, type TooltipSide, type TooltipTriggerProps, type TooltipTriggerState, type UrgentChangeHandler, type UrgentHandler, type WhilePending, createToastManager, toast };
@@ -0,0 +1,37 @@
1
+ //#region src/internal/call-urgent-handler.ts
2
+ /** Whether `value` is a thenable (a promise, or anything with a callable `then`). */
3
+ function isThenable(value) {
4
+ return (typeof value === "object" || typeof value === "function") && value !== null && typeof value.then === "function";
5
+ }
6
+ /**
7
+ * Calls an `on*` handler under the rule every handler the library defines follows (conventions
8
+ * 2.1, #148): synchronously, in the caller's event, not awaited and with no pending state. A
9
+ * synchronous throw is caught and passed to `reportError`, so the library's own bookkeeping after
10
+ * the call still runs; a returned thenable gets a rejection handler that passes the reason to
11
+ * `reportError`. Nothing reaches an Error Boundary, and a returned promise is never a warning.
12
+ * Used by `onOpenChange` (the overlay Roots), a toast's `onClose` and Combobox's
13
+ * `onInputValueChange`. A missing handler is a no-op.
14
+ *
15
+ * Directive-free: no client-only API (it does not import `report-dropped.ts`, a client module,
16
+ * and repeats its two-line `reportError` fallback instead).
17
+ */
18
+ function callUrgentHandler(handler, ...args) {
19
+ if (handler === void 0) return;
20
+ let result;
21
+ try {
22
+ result = handler(...args);
23
+ } catch (error) {
24
+ report(error);
25
+ return;
26
+ }
27
+ if (isThenable(result)) result.then(void 0, report);
28
+ }
29
+ /** `reportError`, or `console.error` where it does not exist (jsdom), as `reportDropped`. */
30
+ function report(error) {
31
+ if (typeof reportError === "function") reportError(error);
32
+ else console.error(error);
33
+ }
34
+ //#endregion
35
+ export { callUrgentHandler };
36
+
37
+ //# sourceMappingURL=call-urgent-handler.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-urgent-handler.mjs","names":[],"sources":["../../src/internal/call-urgent-handler.ts"],"sourcesContent":["/** Whether `value` is a thenable (a promise, or anything with a callable `then`). */\nfunction isThenable(value: unknown): value is PromiseLike<unknown> {\n return (\n (typeof value === \"object\" || typeof value === \"function\") &&\n value !== null &&\n typeof (value as { then?: unknown }).then === \"function\"\n );\n}\n\n/**\n * Calls an `on*` handler under the rule every handler the library defines follows (conventions\n * 2.1, #148): synchronously, in the caller's event, not awaited and with no pending state. A\n * synchronous throw is caught and passed to `reportError`, so the library's own bookkeeping after\n * the call still runs; a returned thenable gets a rejection handler that passes the reason to\n * `reportError`. Nothing reaches an Error Boundary, and a returned promise is never a warning.\n * Used by `onOpenChange` (the overlay Roots), a toast's `onClose` and Combobox's\n * `onInputValueChange`. A missing handler is a no-op.\n *\n * Directive-free: no client-only API (it does not import `report-dropped.ts`, a client module,\n * and repeats its two-line `reportError` fallback instead).\n */\nexport function callUrgentHandler<Args extends readonly unknown[]>(\n handler: ((...args: Args) => unknown) | undefined,\n ...args: Args\n): void {\n if (handler === undefined) return;\n let result: unknown;\n try {\n result = handler(...args);\n } catch (error) {\n report(error);\n return;\n }\n if (isThenable(result)) result.then(undefined, report);\n}\n\n/** `reportError`, or `console.error` where it does not exist (jsdom), as `reportDropped`. */\nfunction report(error: unknown): void {\n if (typeof reportError === \"function\") reportError(error);\n else console.error(error);\n}\n"],"mappings":";;AACA,SAAS,WAAW,OAA+C;CACjE,QACG,OAAO,UAAU,YAAY,OAAO,UAAU,eAC/C,UAAU,QACV,OAAQ,MAA6B,SAAS;AAElD;;;;;;;;;;;;;AAcA,SAAgB,kBACd,SACA,GAAG,MACG;CACN,IAAI,YAAY,KAAA,GAAW;CAC3B,IAAI;CACJ,IAAI;EACF,SAAS,QAAQ,GAAG,IAAI;CAC1B,SAAS,OAAO;EACd,OAAO,KAAK;EACZ;CACF;CACA,IAAI,WAAW,MAAM,GAAG,OAAO,KAAK,KAAA,GAAW,MAAM;AACvD;;AAGA,SAAS,OAAO,OAAsB;CACpC,IAAI,OAAO,gBAAgB,YAAY,YAAY,KAAK;MACnD,QAAQ,MAAM,KAAK;AAC1B"}
@@ -0,0 +1,66 @@
1
+ //#region src/internal/css-transition-cut.ts
2
+ /** What `transition: none` sets, each restored on its own. */
3
+ const LONGHANDS = [
4
+ "transition-property",
5
+ "transition-duration",
6
+ "transition-timing-function",
7
+ "transition-delay",
8
+ "transition-behavior"
9
+ ];
10
+ /** Elements inside a cut right now: a nested call (Menu's `reshow`) runs inside the outer one. */
11
+ const cutting = /* @__PURE__ */ new WeakSet();
12
+ /** Whether a document view transition is running (`html:active-view-transition`). */
13
+ function viewTransitionActive(element) {
14
+ try {
15
+ return element.ownerDocument.documentElement.matches(":active-view-transition");
16
+ } catch {
17
+ return false;
18
+ }
19
+ }
20
+ /**
21
+ * Runs the library's own show or hide of a popup (`showPopover()`, `hidePopover()`,
22
+ * `showModal()`, `show()`, `close()`) with the popup's CSS transitions cut, when the Popup has a
23
+ * `transition` prop and a view transition is running (conventions 5.1, issue #147). The view
24
+ * transition animates that show or hide; a CSS `transition` on the popup would run next to it
25
+ * (the open's `@starting-style` enter under the view transition's enter; in Chromium the close's
26
+ * `display` / `overlay` fade keeps the hidden box in the new snapshot, a double image).
27
+ *
28
+ * One synchronous step: an inline `transition: none !important`, the call, a forced style
29
+ * recalculation (without it Chromium sees the restored value and the fade runs), and the inline
30
+ * `transition` longhands restored as they were, so nothing is left for React's `style` diffing.
31
+ * Everything goes through CSSOM, never the `style` attribute: a CSP without `'unsafe-inline'`
32
+ * for styles blocks an attribute write (React's `style` prop is CSSOM too). Only CSS
33
+ * transitions are cut, not a `@keyframes` animation. Dismissals (Escape, light dismiss) never
34
+ * come here: their CSS exit plays.
35
+ */
36
+ function withCssTransitionCut(element, hasTransition, run) {
37
+ if (!hasTransition || cutting.has(element) || !viewTransitionActive(element)) return run();
38
+ const { style } = element;
39
+ const hadAttribute = element.hasAttribute("style");
40
+ const shorthand = style.getPropertyValue("transition");
41
+ const shorthandPriority = style.getPropertyPriority("transition");
42
+ const longhands = LONGHANDS.map((name) => [
43
+ name,
44
+ style.getPropertyValue(name),
45
+ style.getPropertyPriority(name)
46
+ ]);
47
+ cutting.add(element);
48
+ style.setProperty("transition", "none", "important");
49
+ try {
50
+ return run();
51
+ } finally {
52
+ getComputedStyle(element).opacity;
53
+ const ours = (name) => style.getPropertyValue(name) === "none" && style.getPropertyPriority(name) === "important";
54
+ if (ours("transition-property") || ours("transition")) {
55
+ style.removeProperty("transition");
56
+ if (shorthand !== "") style.setProperty("transition", shorthand, shorthandPriority);
57
+ else for (const [name, value, priority] of longhands) if (value !== "") style.setProperty(name, value, priority);
58
+ }
59
+ if (!hadAttribute && style.length === 0) element.removeAttribute("style");
60
+ cutting.delete(element);
61
+ }
62
+ }
63
+ //#endregion
64
+ export { withCssTransitionCut };
65
+
66
+ //# sourceMappingURL=css-transition-cut.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-transition-cut.mjs","names":[],"sources":["../../src/internal/css-transition-cut.ts"],"sourcesContent":["// No directive: a DOM helper (conventions 7.1).\n\n/** What `transition: none` sets, each restored on its own. */\nconst LONGHANDS = [\n \"transition-property\",\n \"transition-duration\",\n \"transition-timing-function\",\n \"transition-delay\",\n \"transition-behavior\",\n] as const;\n\n/** Elements inside a cut right now: a nested call (Menu's `reshow`) runs inside the outer one. */\nconst cutting = new WeakSet<HTMLElement>();\n\n/** Whether a document view transition is running (`html:active-view-transition`). */\nfunction viewTransitionActive(element: HTMLElement): boolean {\n try {\n return element.ownerDocument.documentElement.matches(\":active-view-transition\");\n } catch {\n // An engine (or jsdom) that does not know the pseudo-class has no view transition to avoid.\n return false;\n }\n}\n\n/**\n * Runs the library's own show or hide of a popup (`showPopover()`, `hidePopover()`,\n * `showModal()`, `show()`, `close()`) with the popup's CSS transitions cut, when the Popup has a\n * `transition` prop and a view transition is running (conventions 5.1, issue #147). The view\n * transition animates that show or hide; a CSS `transition` on the popup would run next to it\n * (the open's `@starting-style` enter under the view transition's enter; in Chromium the close's\n * `display` / `overlay` fade keeps the hidden box in the new snapshot, a double image).\n *\n * One synchronous step: an inline `transition: none !important`, the call, a forced style\n * recalculation (without it Chromium sees the restored value and the fade runs), and the inline\n * `transition` longhands restored as they were, so nothing is left for React's `style` diffing.\n * Everything goes through CSSOM, never the `style` attribute: a CSP without `'unsafe-inline'`\n * for styles blocks an attribute write (React's `style` prop is CSSOM too). Only CSS\n * transitions are cut, not a `@keyframes` animation. Dismissals (Escape, light dismiss) never\n * come here: their CSS exit plays.\n */\nexport function withCssTransitionCut<T>(\n element: HTMLElement,\n hasTransition: boolean,\n run: () => T,\n): T {\n if (!hasTransition || cutting.has(element) || !viewTransitionActive(element)) return run();\n const { style } = element;\n const hadAttribute = element.hasAttribute(\"style\");\n // The shorthand, and the longhands for a consumer who set only some of them (the shorthand\n // then reads as \"\").\n const shorthand = style.getPropertyValue(\"transition\");\n const shorthandPriority = style.getPropertyPriority(\"transition\");\n const longhands = LONGHANDS.map(\n (name) => [name, style.getPropertyValue(name), style.getPropertyPriority(name)] as const,\n );\n cutting.add(element);\n style.setProperty(\"transition\", \"none\", \"important\");\n try {\n return run();\n } finally {\n // The show or hide's style change is processed while the cut is in place.\n void getComputedStyle(element).opacity;\n // Only while the cut is still ours: a listener inside the call that wrote its own\n // `transition` keeps it.\n const ours = (name: string) =>\n style.getPropertyValue(name) === \"none\" && style.getPropertyPriority(name) === \"important\";\n if (ours(\"transition-property\") || ours(\"transition\")) {\n style.removeProperty(\"transition\");\n if (shorthand !== \"\") {\n style.setProperty(\"transition\", shorthand, shorthandPriority);\n } else {\n for (const [name, value, priority] of longhands) {\n if (value !== \"\") style.setProperty(name, value, priority);\n }\n }\n }\n // `removeAttribute` parses nothing, so CSP does not block it.\n if (!hadAttribute && style.length === 0) element.removeAttribute(\"style\");\n cutting.delete(element);\n }\n}\n"],"mappings":";;AAGA,MAAM,YAAY;CAChB;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAM,0BAAU,IAAI,QAAqB;;AAGzC,SAAS,qBAAqB,SAA+B;CAC3D,IAAI;EACF,OAAO,QAAQ,cAAc,gBAAgB,QAAQ,yBAAyB;CAChF,QAAQ;EAEN,OAAO;CACT;AACF;;;;;;;;;;;;;;;;;AAkBA,SAAgB,qBACd,SACA,eACA,KACG;CACH,IAAI,CAAC,iBAAiB,QAAQ,IAAI,OAAO,KAAK,CAAC,qBAAqB,OAAO,GAAG,OAAO,IAAI;CACzF,MAAM,EAAE,UAAU;CAClB,MAAM,eAAe,QAAQ,aAAa,OAAO;CAGjD,MAAM,YAAY,MAAM,iBAAiB,YAAY;CACrD,MAAM,oBAAoB,MAAM,oBAAoB,YAAY;CAChE,MAAM,YAAY,UAAU,KACzB,SAAS;EAAC;EAAM,MAAM,iBAAiB,IAAI;EAAG,MAAM,oBAAoB,IAAI;CAAC,CAChF;CACA,QAAQ,IAAI,OAAO;CACnB,MAAM,YAAY,cAAc,QAAQ,WAAW;CACnD,IAAI;EACF,OAAO,IAAI;CACb,UAAU;EAER,iBAAsB,OAAO,CAAC,CAAC;EAG/B,MAAM,QAAQ,SACZ,MAAM,iBAAiB,IAAI,MAAM,UAAU,MAAM,oBAAoB,IAAI,MAAM;EACjF,IAAI,KAAK,qBAAqB,KAAK,KAAK,YAAY,GAAG;GACrD,MAAM,eAAe,YAAY;GACjC,IAAI,cAAc,IAChB,MAAM,YAAY,cAAc,WAAW,iBAAiB;QAE5D,KAAK,MAAM,CAAC,MAAM,OAAO,aAAa,WACpC,IAAI,UAAU,IAAI,MAAM,YAAY,MAAM,OAAO,QAAQ;EAG/D;EAEA,IAAI,CAAC,gBAAgB,MAAM,WAAW,GAAG,QAAQ,gBAAgB,OAAO;EACxE,QAAQ,OAAO,OAAO;CACxB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"overlay-popup.mjs","names":[],"sources":["../../src/internal/overlay-popup.tsx"],"sourcesContent":["\"use client\";\n// The pieces Dialog.Popup shares with usePopoverPopup (Popover, Menu, Combobox). The two stay\n// separate: Dialog has showModal / show, `close` / `cancel` / `submit` and light dismiss.\nimport { Activity, useRef, useState } from \"react\";\nimport type { ReactNode, RefObject, ViewTransitionClass } from \"react\";\nimport { ToolbarContext } from \"./toolbar-context.js\";\nimport { useDevWarning } from \"./use-dev-warning.js\";\nimport { useExitAnimation } from \"./use-exit-animation.js\";\nimport type { ExitAnimation } from \"./use-exit-animation.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface OverlayContentOptions {\n readonly isLibrary: boolean;\n readonly keepMounted: boolean | undefined;\n /** Committed open, or held while the exit animates (design/components/popover.md 4.4). */\n readonly visible: boolean;\n readonly wrapContent: (children: ReactNode) => ReactNode;\n}\n\n/**\n * The children of a popup (Popover, Dialog, Menu, Combobox). JS-free mode: always rendered.\n * Library mode: rendered while `visible`, or with `keepMounted` inside an `<Activity>` whose mode\n * changes with committed state, inside the Root's transition (conventions 5.5). The content is\n * not part of an enclosing Toolbar's sequence (the engine excludes `[popover]` and `dialog`), so\n * parts inside it see no Toolbar. `children` is called only when rendered.\n */\nexport function renderOverlayContent(\n { isLibrary, keepMounted, visible, wrapContent }: OverlayContentOptions,\n children: () => ReactNode,\n): ReactNode {\n let node: ReactNode;\n if (!isLibrary) {\n node = children();\n } else if (keepMounted === true) {\n node = <Activity mode={visible ? \"visible\" : \"hidden\"}>{wrapContent(children())}</Activity>;\n } else {\n node = visible ? wrapContent(children()) : null;\n }\n return <ToolbarContext value={null}>{node}</ToolbarContext>;\n}\n\nexport interface CloseHold extends ExitAnimation {\n /**\n * The close's native event (`toggle` / `close`) arrived: hold the content until the exit\n * animations settle, or release a hold now when nothing animates (Firefox, or no CSS exit: the\n * popup is already `display: none`, the commit is invisible). Call before the notification, so\n * its commit keeps the children. Nothing for the library's own close (`echo`) with\n * `transition`: the close commit's view transition carried the content out.\n */\n readonly afterClose: (popup: Element, echo: boolean) => void;\n /**\n * The apply effect's release rule: a hold the close commit set (or a dismissal's notification\n * commit) that no exit animation is going to release, the popup being hidden and its close\n * event handled.\n */\n readonly releaseIfIdle: (committed: boolean, awaitingClose: boolean, shown: boolean) => void;\n}\n\n/**\n * `held` for a popup (design/components/popover.md 4.4): the children stay mounted while the\n * close animates. A library-driven close commits `false` first and hides in the layout effect,\n * so without `transition` the children are held through the close commit (\"previous value in\n * state\"). With `transition` the close commit unmounts them inside the view transition, whose old\n * snapshot carries the content out.\n */\nexport function useCloseHold(\n committed: boolean,\n isLibrary: boolean,\n transition: ViewTransitionClass | undefined,\n): CloseHold {\n const exit = useExitAnimation();\n const [prevCommitted, setPrevCommitted] = useState(committed);\n if (prevCommitted !== committed) {\n setPrevCommitted(committed);\n if (isLibrary && prevCommitted && transition === undefined) exit.holdDuringRender();\n }\n return {\n ...exit,\n afterClose: (popup, echo) => {\n if (echo && transition !== undefined) return;\n const animations = exit.exitAnimations(popup);\n if (animations.length > 0) exit.holdUntil(animations);\n else exit.release();\n },\n releaseIfIdle: (isCommitted, awaitingClose, shown) => {\n if (exit.held && !isCommitted && !exit.waiting() && !awaitingClose && !shown) {\n exit.release();\n }\n },\n };\n}\n\n/** The lower-cased `command` of a `command` event. */\nexport function commandOf(event: Event): string {\n return String((event as Event & { command?: string }).command ?? \"\").toLowerCase();\n}\n\n/** Resolves `initialFocus` against the popup (a ref, or a selector inside the popup). */\nexport function resolveInitialFocus(\n popup: HTMLElement,\n initialFocus: RefObject<HTMLElement | null> | string,\n): HTMLElement | null {\n if (typeof initialFocus === \"string\") return popup.querySelector<HTMLElement>(initialFocus);\n return initialFocus.current;\n}\n\nexport type InitialFocusTarget = (\n popup: HTMLElement,\n initialFocus: RefObject<HTMLElement | null> | string | undefined,\n) => HTMLElement | null;\n\n/**\n * `initialFocus` resolved right before a library open (design 6.1): the target, or `null` (the\n * platform picks) without one, or when it resolves to nothing or outside the popup; those two\n * warn once per instance in development. `noun` names the popup in the warning.\n */\nexport function useInitialFocusTarget(part: string, noun: string): InitialFocusTarget {\n const warned = useRef(false);\n return (popup, initialFocus) => {\n if (initialFocus === undefined) return null;\n const target = resolveInitialFocus(popup, initialFocus);\n if (target !== null && popup.contains(target)) return target;\n if (isDev && !warned.current) {\n warned.current = true;\n console.error(\n target === null\n ? `${part}: \\`initialFocus\\` resolved to no element; the platform picks the focus target.`\n : `${part}: \\`initialFocus\\` is outside the ${noun}; the platform picks the focus target.`,\n );\n }\n return null;\n };\n}\n\n/**\n * Design 6.2 rule 2, after a close that began with focus inside (or whose commit unmounted the\n * focused content): when focus is now on `<body>` or still inside the hidden popup, focus the\n * Trigger (connected, and `canFocus` when given), else blur what holds focus.\n */\nexport function returnFocusToTrigger(\n popup: HTMLElement,\n trigger: HTMLElement | null,\n canFocus?: (trigger: HTMLElement) => boolean,\n): void {\n const doc = popup.ownerDocument;\n const active = doc.activeElement;\n if (active !== null && active !== doc.body && !popup.contains(active)) return;\n if (trigger !== null && trigger.isConnected && (canFocus === undefined || canFocus(trigger))) {\n trigger.focus();\n } else if (active instanceof HTMLElement && active !== doc.body) {\n active.blur();\n }\n}\n\n/** The development warnings for a Popup's library-only props in JS-free mode. */\nexport function useJsFreePropWarnings(\n part: string,\n noun: string,\n isLibrary: boolean,\n transition: ViewTransitionClass | undefined,\n keepMounted: boolean | undefined,\n): void {\n useDevWarning(\n !isLibrary && transition !== undefined,\n isDev &&\n `${part}: \\`transition\\` has no effect in JS-free mode; the browser opens and closes the ` +\n `${noun} outside any React transition. Animate it with CSS (\\`@starting-style\\`).`,\n );\n useDevWarning(\n !isLibrary && keepMounted === false,\n isDev &&\n `${part}: \\`keepMounted={false}\\` cannot be honoured in JS-free mode; the content is ` +\n \"always mounted so that the server HTML is complete.\",\n );\n}\n"],"mappings":";;;;;;;AAUA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;AAiBvC,SAAgB,qBACd,EAAE,WAAW,aAAa,SAAS,eACnC,UACW;CACX,IAAI;CACJ,IAAI,CAAC,WACH,OAAO,SAAS;MACX,IAAI,gBAAgB,MACzB,OAAO,oBAAC,UAAD;EAAU,MAAM,UAAU,YAAY;EAAW,UAAA,YAAY,SAAS,CAAC;CAAY,CAAA;MAE1F,OAAO,UAAU,YAAY,SAAS,CAAC,IAAI;CAE7C,OAAO,oBAAC,gBAAD;EAAgB,OAAO;EAAO,UAAA;CAAqB,CAAA;AAC5D;;;;;;;;AA0BA,SAAgB,aACd,WACA,WACA,YACW;CACX,MAAM,OAAO,iBAAiB;CAC9B,MAAM,CAAC,eAAe,oBAAoB,SAAS,SAAS;CAC5D,IAAI,kBAAkB,WAAW;EAC/B,iBAAiB,SAAS;EAC1B,IAAI,aAAa,iBAAiB,eAAe,KAAA,GAAW,KAAK,iBAAiB;CACpF;CACA,OAAO;EACL,GAAG;EACH,aAAa,OAAO,SAAS;GAC3B,IAAI,QAAQ,eAAe,KAAA,GAAW;GACtC,MAAM,aAAa,KAAK,eAAe,KAAK;GAC5C,IAAI,WAAW,SAAS,GAAG,KAAK,UAAU,UAAU;QAC/C,KAAK,QAAQ;EACpB;EACA,gBAAgB,aAAa,eAAe,UAAU;GACpD,IAAI,KAAK,QAAQ,CAAC,eAAe,CAAC,KAAK,QAAQ,KAAK,CAAC,iBAAiB,CAAC,OACrE,KAAK,QAAQ;EAEjB;CACF;AACF;;AAGA,SAAgB,UAAU,OAAsB;CAC9C,OAAO,OAAQ,MAAuC,WAAW,EAAE,CAAC,CAAC,YAAY;AACnF;;AAGA,SAAgB,oBACd,OACA,cACoB;CACpB,IAAI,OAAO,iBAAiB,UAAU,OAAO,MAAM,cAA2B,YAAY;CAC1F,OAAO,aAAa;AACtB;;;;;;AAYA,SAAgB,sBAAsB,MAAc,MAAkC;CACpF,MAAM,SAAS,OAAO,KAAK;CAC3B,QAAQ,OAAO,iBAAiB;EAC9B,IAAI,iBAAiB,KAAA,GAAW,OAAO;EACvC,MAAM,SAAS,oBAAoB,OAAO,YAAY;EACtD,IAAI,WAAW,QAAQ,MAAM,SAAS,MAAM,GAAG,OAAO;EACtD,IAAI,SAAS,CAAC,OAAO,SAAS;GAC5B,OAAO,UAAU;GACjB,QAAQ,MACN,WAAW,OACP,GAAG,KAAK,mFACR,GAAG,KAAK,oCAAoC,KAAK,uCACvD;EACF;EACA,OAAO;CACT;AACF;;;;;;AAOA,SAAgB,qBACd,OACA,SACA,UACM;CACN,MAAM,MAAM,MAAM;CAClB,MAAM,SAAS,IAAI;CACnB,IAAI,WAAW,QAAQ,WAAW,IAAI,QAAQ,CAAC,MAAM,SAAS,MAAM,GAAG;CACvE,IAAI,YAAY,QAAQ,QAAQ,gBAAgB,aAAa,KAAA,KAAa,SAAS,OAAO,IACxF,QAAQ,MAAM;MACT,IAAI,kBAAkB,eAAe,WAAW,IAAI,MACzD,OAAO,KAAK;AAEhB;;AAGA,SAAgB,sBACd,MACA,MACA,WACA,YACA,aACM;CACN,cACE,CAAC,aAAa,eAAe,KAAA,GAC7B,SACE,GAAG,KAAK,mFACH,KAAK,0EACd;CACA,cACE,CAAC,aAAa,gBAAgB,OAC9B,SACE,GAAG,KAAK,iIAEZ;AACF"}
1
+ {"version":3,"file":"overlay-popup.mjs","names":[],"sources":["../../src/internal/overlay-popup.tsx"],"sourcesContent":["\"use client\";\n// The pieces Dialog.Popup shares with usePopoverPopup (Popover, Menu, Combobox). The two stay\n// separate: Dialog has showModal / show, `close` / `cancel` / `submit` and light dismiss.\nimport { Activity, useRef, useState } from \"react\";\nimport type { ReactNode, RefObject, ViewTransitionClass } from \"react\";\nimport { ToolbarContext } from \"./toolbar-context.js\";\nimport { useDevWarning } from \"./use-dev-warning.js\";\nimport { useExitAnimation } from \"./use-exit-animation.js\";\nimport type { ExitAnimation } from \"./use-exit-animation.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface OverlayContentOptions {\n readonly isLibrary: boolean;\n readonly keepMounted: boolean | undefined;\n /** Committed open, or held while the exit animates (design/components/popover.md 4.4). */\n readonly visible: boolean;\n readonly wrapContent: (children: ReactNode) => ReactNode;\n}\n\n/**\n * The children of a popup (Popover, Dialog, Menu, Combobox). JS-free mode: always rendered.\n * Library mode: rendered while `visible`, or with `keepMounted` inside an `<Activity>` whose mode\n * changes with committed state, inside the Root's transition (conventions 5.5). The content is\n * not part of an enclosing Toolbar's sequence (the engine excludes `[popover]` and `dialog`), so\n * parts inside it see no Toolbar. `children` is called only when rendered.\n */\nexport function renderOverlayContent(\n { isLibrary, keepMounted, visible, wrapContent }: OverlayContentOptions,\n children: () => ReactNode,\n): ReactNode {\n let node: ReactNode;\n if (!isLibrary) {\n node = children();\n } else if (keepMounted === true) {\n node = <Activity mode={visible ? \"visible\" : \"hidden\"}>{wrapContent(children())}</Activity>;\n } else {\n node = visible ? wrapContent(children()) : null;\n }\n return <ToolbarContext value={null}>{node}</ToolbarContext>;\n}\n\nexport interface CloseHold extends ExitAnimation {\n /**\n * The close's native event (`toggle` / `close`) arrived: hold the content until the exit\n * animations settle, or release a hold now when nothing animates (Firefox, or no CSS exit: the\n * popup is already `display: none`, the commit is invisible). Call before reporting the fact,\n * so its commit keeps the children. Nothing for the library's own close (`echo`) with\n * `transition`: the close commit's view transition carried the content out.\n */\n readonly afterClose: (popup: Element, echo: boolean) => void;\n /**\n * The apply effect's release rule: a hold the close commit set (or a fact's commit) that no\n * exit animation is going to release, the popup being hidden and its close event handled.\n */\n readonly releaseIfIdle: (committed: boolean, awaitingClose: boolean, shown: boolean) => void;\n}\n\n/**\n * `held` for a popup (design/components/popover.md 4.4): the children stay mounted while the\n * close animates. A library-driven close commits `false` first and hides in the layout effect,\n * so without `transition` the children are held through the close commit (\"previous value in\n * state\"). With `transition` the close commit unmounts them inside the view transition, whose old\n * snapshot carries the content out.\n */\nexport function useCloseHold(\n committed: boolean,\n isLibrary: boolean,\n transition: ViewTransitionClass | undefined,\n): CloseHold {\n const exit = useExitAnimation();\n const [prevCommitted, setPrevCommitted] = useState(committed);\n if (prevCommitted !== committed) {\n setPrevCommitted(committed);\n if (isLibrary && prevCommitted && transition === undefined) exit.holdDuringRender();\n }\n return {\n ...exit,\n afterClose: (popup, echo) => {\n if (echo && transition !== undefined) return;\n const animations = exit.exitAnimations(popup);\n if (animations.length > 0) exit.holdUntil(animations);\n else exit.release();\n },\n releaseIfIdle: (isCommitted, awaitingClose, shown) => {\n if (exit.held && !isCommitted && !exit.waiting() && !awaitingClose && !shown) {\n exit.release();\n }\n },\n };\n}\n\n/** The lower-cased `command` of a `command` event. */\nexport function commandOf(event: Event): string {\n return String((event as Event & { command?: string }).command ?? \"\").toLowerCase();\n}\n\n/** Resolves `initialFocus` against the popup (a ref, or a selector inside the popup). */\nexport function resolveInitialFocus(\n popup: HTMLElement,\n initialFocus: RefObject<HTMLElement | null> | string,\n): HTMLElement | null {\n if (typeof initialFocus === \"string\") return popup.querySelector<HTMLElement>(initialFocus);\n return initialFocus.current;\n}\n\nexport type InitialFocusTarget = (\n popup: HTMLElement,\n initialFocus: RefObject<HTMLElement | null> | string | undefined,\n) => HTMLElement | null;\n\n/**\n * `initialFocus` resolved right before a library open (design 6.1): the target, or `null` (the\n * platform picks) without one, or when it resolves to nothing or outside the popup; those two\n * warn once per instance in development. `noun` names the popup in the warning.\n */\nexport function useInitialFocusTarget(part: string, noun: string): InitialFocusTarget {\n const warned = useRef(false);\n return (popup, initialFocus) => {\n if (initialFocus === undefined) return null;\n const target = resolveInitialFocus(popup, initialFocus);\n if (target !== null && popup.contains(target)) return target;\n if (isDev && !warned.current) {\n warned.current = true;\n console.error(\n target === null\n ? `${part}: \\`initialFocus\\` resolved to no element; the platform picks the focus target.`\n : `${part}: \\`initialFocus\\` is outside the ${noun}; the platform picks the focus target.`,\n );\n }\n return null;\n };\n}\n\n/**\n * Design 6.2 rule 2, after a close that began with focus inside (or whose commit unmounted the\n * focused content): when focus is now on `<body>` or still inside the hidden popup, focus the\n * Trigger (connected, and `canFocus` when given), else blur what holds focus.\n */\nexport function returnFocusToTrigger(\n popup: HTMLElement,\n trigger: HTMLElement | null,\n canFocus?: (trigger: HTMLElement) => boolean,\n): void {\n const doc = popup.ownerDocument;\n const active = doc.activeElement;\n if (active !== null && active !== doc.body && !popup.contains(active)) return;\n if (trigger !== null && trigger.isConnected && (canFocus === undefined || canFocus(trigger))) {\n trigger.focus();\n } else if (active instanceof HTMLElement && active !== doc.body) {\n active.blur();\n }\n}\n\n/** The development warnings for a Popup's library-only props in JS-free mode. */\nexport function useJsFreePropWarnings(\n part: string,\n noun: string,\n isLibrary: boolean,\n transition: ViewTransitionClass | undefined,\n keepMounted: boolean | undefined,\n): void {\n useDevWarning(\n !isLibrary && transition !== undefined,\n isDev &&\n `${part}: \\`transition\\` has no effect in JS-free mode; the browser opens and closes the ` +\n `${noun} outside any React transition. Animate it with CSS (\\`@starting-style\\`).`,\n );\n useDevWarning(\n !isLibrary && keepMounted === false,\n isDev &&\n `${part}: \\`keepMounted={false}\\` cannot be honoured in JS-free mode; the content is ` +\n \"always mounted so that the server HTML is complete.\",\n );\n}\n"],"mappings":";;;;;;;AAUA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;AAiBvC,SAAgB,qBACd,EAAE,WAAW,aAAa,SAAS,eACnC,UACW;CACX,IAAI;CACJ,IAAI,CAAC,WACH,OAAO,SAAS;MACX,IAAI,gBAAgB,MACzB,OAAO,oBAAC,UAAD;EAAU,MAAM,UAAU,YAAY;EAAW,UAAA,YAAY,SAAS,CAAC;CAAY,CAAA;MAE1F,OAAO,UAAU,YAAY,SAAS,CAAC,IAAI;CAE7C,OAAO,oBAAC,gBAAD;EAAgB,OAAO;EAAO,UAAA;CAAqB,CAAA;AAC5D;;;;;;;;AAyBA,SAAgB,aACd,WACA,WACA,YACW;CACX,MAAM,OAAO,iBAAiB;CAC9B,MAAM,CAAC,eAAe,oBAAoB,SAAS,SAAS;CAC5D,IAAI,kBAAkB,WAAW;EAC/B,iBAAiB,SAAS;EAC1B,IAAI,aAAa,iBAAiB,eAAe,KAAA,GAAW,KAAK,iBAAiB;CACpF;CACA,OAAO;EACL,GAAG;EACH,aAAa,OAAO,SAAS;GAC3B,IAAI,QAAQ,eAAe,KAAA,GAAW;GACtC,MAAM,aAAa,KAAK,eAAe,KAAK;GAC5C,IAAI,WAAW,SAAS,GAAG,KAAK,UAAU,UAAU;QAC/C,KAAK,QAAQ;EACpB;EACA,gBAAgB,aAAa,eAAe,UAAU;GACpD,IAAI,KAAK,QAAQ,CAAC,eAAe,CAAC,KAAK,QAAQ,KAAK,CAAC,iBAAiB,CAAC,OACrE,KAAK,QAAQ;EAEjB;CACF;AACF;;AAGA,SAAgB,UAAU,OAAsB;CAC9C,OAAO,OAAQ,MAAuC,WAAW,EAAE,CAAC,CAAC,YAAY;AACnF;;AAGA,SAAgB,oBACd,OACA,cACoB;CACpB,IAAI,OAAO,iBAAiB,UAAU,OAAO,MAAM,cAA2B,YAAY;CAC1F,OAAO,aAAa;AACtB;;;;;;AAYA,SAAgB,sBAAsB,MAAc,MAAkC;CACpF,MAAM,SAAS,OAAO,KAAK;CAC3B,QAAQ,OAAO,iBAAiB;EAC9B,IAAI,iBAAiB,KAAA,GAAW,OAAO;EACvC,MAAM,SAAS,oBAAoB,OAAO,YAAY;EACtD,IAAI,WAAW,QAAQ,MAAM,SAAS,MAAM,GAAG,OAAO;EACtD,IAAI,SAAS,CAAC,OAAO,SAAS;GAC5B,OAAO,UAAU;GACjB,QAAQ,MACN,WAAW,OACP,GAAG,KAAK,mFACR,GAAG,KAAK,oCAAoC,KAAK,uCACvD;EACF;EACA,OAAO;CACT;AACF;;;;;;AAOA,SAAgB,qBACd,OACA,SACA,UACM;CACN,MAAM,MAAM,MAAM;CAClB,MAAM,SAAS,IAAI;CACnB,IAAI,WAAW,QAAQ,WAAW,IAAI,QAAQ,CAAC,MAAM,SAAS,MAAM,GAAG;CACvE,IAAI,YAAY,QAAQ,QAAQ,gBAAgB,aAAa,KAAA,KAAa,SAAS,OAAO,IACxF,QAAQ,MAAM;MACT,IAAI,kBAAkB,eAAe,WAAW,IAAI,MACzD,OAAO,KAAK;AAEhB;;AAGA,SAAgB,sBACd,MACA,MACA,WACA,YACA,aACM;CACN,cACE,CAAC,aAAa,eAAe,KAAA,GAC7B,SACE,GAAG,KAAK,mFACH,KAAK,0EACd;CACA,cACE,CAAC,aAAa,gBAAgB,OAC9B,SACE,GAAG,KAAK,iIAEZ;AACF"}
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { useLayoutEffect, useRef } from "react";
3
+ //#region src/internal/report-dropped.ts
4
+ /**
5
+ * Reports an action rejection that React would drop (conventions 2.4), for `useControllableAction`
6
+ * and `useActionTrigger`. React routes a transition's rejection only by unwrapping the newest
7
+ * thenable of a `useTransition` in a render of the component that owns it, so two rejections reach
8
+ * no Error Boundary:
9
+ *
10
+ * - a **superseded** run's (a later run of the same hook replaced its thenable), and
11
+ * - the **latest** run's once the owner is **gone**: unmounted, or hidden (a consumer's
12
+ * `<Activity>`, the library's `keepMounted` overlays in `overlay-popup.tsx`, Toast's Suspense
13
+ * guard, any Suspense boundary showing its fallback): no render reads it (#152). Hidden counts
14
+ * as gone: the rejection is reported once and does not reach the boundary on re-show, where
15
+ * React would deliver it (a deliberate deviation, conventions resolved question 43).
16
+ *
17
+ * The library passes them to the global `reportError` instead, as React's standalone
18
+ * `startTransition` does with every rejection: a window `error` event, seen by monitoring tools
19
+ * and by test runners, while the UI stays up. `console.error` where there is no `reportError`.
20
+ */
21
+ function reportDropped(error) {
22
+ if (typeof reportError === "function") reportError(error);
23
+ else console.error(error);
24
+ }
25
+ /**
26
+ * Whether the calling component's effects are connected: `true` from its mount layout effect until
27
+ * that effect is cleaned up, which happens on unmount, when an `<Activity>` hides it (`keepMounted`
28
+ * included) and when a Suspense boundary above it re-suspends and shows its fallback. Read from
29
+ * action continuations only, to decide between rethrowing a latest rejection (React routes it to
30
+ * the boundary) and `reportDropped`.
31
+ */
32
+ function useConnected() {
33
+ const connected = useRef(false);
34
+ useLayoutEffect(() => {
35
+ connected.current = true;
36
+ return () => {
37
+ connected.current = false;
38
+ };
39
+ }, []);
40
+ return connected;
41
+ }
42
+ //#endregion
43
+ export { reportDropped, useConnected };
44
+
45
+ //# sourceMappingURL=report-dropped.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-dropped.mjs","names":[],"sources":["../../src/internal/report-dropped.ts"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect, useRef } from \"react\";\nimport type { RefObject } from \"react\";\n\n/**\n * Reports an action rejection that React would drop (conventions 2.4), for `useControllableAction`\n * and `useActionTrigger`. React routes a transition's rejection only by unwrapping the newest\n * thenable of a `useTransition` in a render of the component that owns it, so two rejections reach\n * no Error Boundary:\n *\n * - a **superseded** run's (a later run of the same hook replaced its thenable), and\n * - the **latest** run's once the owner is **gone**: unmounted, or hidden (a consumer's\n * `<Activity>`, the library's `keepMounted` overlays in `overlay-popup.tsx`, Toast's Suspense\n * guard, any Suspense boundary showing its fallback): no render reads it (#152). Hidden counts\n * as gone: the rejection is reported once and does not reach the boundary on re-show, where\n * React would deliver it (a deliberate deviation, conventions resolved question 43).\n *\n * The library passes them to the global `reportError` instead, as React's standalone\n * `startTransition` does with every rejection: a window `error` event, seen by monitoring tools\n * and by test runners, while the UI stays up. `console.error` where there is no `reportError`.\n */\nexport function reportDropped(error: unknown): void {\n if (typeof reportError === \"function\") reportError(error);\n else console.error(error);\n}\n\n/**\n * Whether the calling component's effects are connected: `true` from its mount layout effect until\n * that effect is cleaned up, which happens on unmount, when an `<Activity>` hides it (`keepMounted`\n * included) and when a Suspense boundary above it re-suspends and shows its fallback. Read from\n * action continuations only, to decide between rethrowing a latest rejection (React routes it to\n * the boundary) and `reportDropped`.\n */\nexport function useConnected(): RefObject<boolean> {\n const connected = useRef(false);\n useLayoutEffect(() => {\n connected.current = true;\n return () => {\n connected.current = false;\n };\n }, []);\n return connected;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,cAAc,OAAsB;CAClD,IAAI,OAAO,gBAAgB,YAAY,YAAY,KAAK;MACnD,QAAQ,MAAM,KAAK;AAC1B;;;;;;;;AASA,SAAgB,eAAmC;CACjD,MAAM,YAAY,OAAO,KAAK;CAC9B,sBAAsB;EACpB,UAAU,UAAU;EACpB,aAAa;GACX,UAAU,UAAU;EACtB;CACF,GAAG,CAAC,CAAC;CACL,OAAO;AACT"}