@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
@@ -0,0 +1,281 @@
1
+ # Action props
2
+
3
+ FUNSTACK UI has no `onClick`, `onChange` or `onValueChange`. Interactive props are _actions_: callbacks that the component runs inside its own transition and awaits. A change that had already happened when the library heard of it, and that it could not hold, is reported to an [`on*` handler](#handlers) instead.
4
+
5
+ An <a id="action"></a>action is a function prop that the component calls when the user (or the browser) asks for something, inside a React transition the component starts for it. To dispatch is to start that transition and call the action once; every click, key press or platform change that asks for a change is one dispatch. A transition is React's way to mark an update as non-urgent, so it can keep the current UI on screen while the update is prepared (see [Transitions & ViewTransition](transitions.md)).
6
+
7
+ ## Terms
8
+
9
+ - **Settle**: An action settles when its promise resolves or rejects (a synchronous action settles when it returns). `data-pending` stays on until the settle and the render it causes have committed.
10
+ - **<a id="adopt"></a>Adopt**: A controlled parent adopts a dispatched value by setting its controlled prop to it (in the synchronous part of the action, or inside `startTransition` after an `await`).
11
+ - **Veto**: A controlled parent refuses a change by not adopting the value: when the action settles, the optimistic value snaps back to the committed one. Only a [request](#request) can be vetoed; a [dismissal](browser-owned-state.md#dismissal) is a [fact](#fact) and cannot.
12
+ - **<a id="urgent-update"></a>Urgent update**: A state update outside any transition. React renders it at once, in the event that caused it, and does not hold it back for a pending transition. A `setState` in an event handler is urgent unless it is wrapped in `startTransition`.
13
+ - **<a id="form-channel"></a>Form channel**: React's own form machinery: `<form action>`, `useFormStatus`, `useActionState` and the automatic reset after a successful action. Independent of a control's change action; see [Form actions are a separate channel](#form-actions).
14
+
15
+ ## Naming
16
+
17
+ A controllable state `x` always comes as a triple: `x` (controlled), `defaultX` (uncontrolled initial value) and `xChangeAction`.
18
+
19
+ Example: [Toggle](../components/toggle.md)
20
+
21
+ A Toggle's state is `pressed`, so its props are `pressed`, `defaultPressed` and `pressedChangeAction`. Each component page lists its own triple in its props table.
22
+
23
+ A part that performs one task rather than changing a state (a [pure trigger](pending-and-optimistic.md#pure-trigger)) takes a plain `action` (`Dialog.Close action`: run this, then close). A state that the consumer derives and the library only mirrors is a controlled-only prop with no default and no action (`Checkbox indeterminate`).
24
+
25
+ `undefined` always means "uncontrolled"; "nothing selected" is `null`. Switching between controlled and uncontrolled after mount is not supported (development warning).
26
+
27
+ ## Signature
28
+
29
+ ```typescript
30
+ type Action<Args extends readonly unknown[] = []> = (...args: Args) => unknown;
31
+
32
+ interface ActionDetails {
33
+ /** The DOM event that caused the action, or undefined. */
34
+ readonly event: Event | undefined;
35
+ }
36
+
37
+ type ChangeAction<T, Details extends ActionDetails = ActionDetails> =
38
+ Action<[next: T, details: Details]>;
39
+ ```
40
+
41
+ The first argument is the next value, so the common case stays short. The second is a `details` object with the native DOM event (not React's synthetic one) and any component-specific fields, such as `reason` (below) or Dialog's `returnValue`. The return type is `unknown`: return a promise and the component awaits it, return anything else and it is ignored. That means a function that returns data (a Server Function, a `fetch`) type-checks without wrapping.
42
+
43
+ Example: [Toggle](../components/toggle.md)
44
+
45
+ A change action that returns data, and (on [Tabs](../components/tabs.md)) one that returns nothing:
46
+
47
+ ```tsx
48
+ <Toggle pressedChangeAction={(pressed) => api.setFavorite(id, pressed)}>Favorite</Toggle>
49
+ <Tabs.Root defaultValue="general" valueChangeAction={(tab) => analytics.track(tab)}>...</Tabs.Root>
50
+ ```
51
+
52
+ ## <a id="handlers"></a>Requests and facts: `on*` handlers
53
+
54
+ The name of a callback prop is a contract. A prop named `action` or `fooAction` receives a <a id="request"></a>request: the component calls it before the change is committed, inside a transition, and awaits it; a rejection, or a controlled parent that does not adopt the value, rolls the UI back. A prop named `onFoo` is an <a id="on-handler"></a>`on*` handler: it reports a <a id="fact"></a>fact, a change that had already happened when the library heard of it and that the library could not hold.
55
+
56
+ The test: if the callback rejects, or the parent ignores it, can the library put the UI back without the user noticing? If yes, the change is a request. A form reset or a click before hydration on a checkbox passes the test (the DOM is the optimistic state, and the library restores it on a refusal), so it is a request even though the browser changed the DOM first. A popup the user dismissed with Escape fails it: the user saw it go away.
57
+
58
+ Most state has only an action. Where both kinds of change exist, a component offers both props, and each component page documents its own handlers. Every `on*` handler the library defines follows one rule:
59
+
60
+ - Called **synchronously**, in the event that reports the fact, outside any transition: a `setState` in the body is an [urgent update](#urgent-update).
61
+ - **Not awaited**, with no pending or optimistic state: the change has already happened.
62
+ - It **may return a promise** (an `async` function, a Server Function). A rejection, like a synchronous throw, goes to `reportError`, never to an Error Boundary; a throw does not stop the library from updating the component. Nothing warns about a returned promise.
63
+
64
+ ```typescript
65
+ /** Called synchronously, outside any Transition, and not awaited. */
66
+ type UrgentChangeHandler<T, Details extends ActionDetails = ActionDetails> =
67
+ (next: T, details: Details) => void;
68
+ /** The same for a fact that carries no next value. */
69
+ type UrgentHandler<Details extends ActionDetails = ActionDetails> = (details: Details) => void;
70
+ ```
71
+
72
+ Set state directly in a handler, not inside `startTransition` and not after an `await`. The advice for actions ([wrap a state update after an await](#after-await)) does not apply: a handler is not in a transition, and a late update leaves the UI showing the old value for a while.
73
+
74
+ Example: [Popover](../components/popover.md)
75
+
76
+ An overlay's open state has both kinds of change. Opening, and a close the user asks one of its parts for (a Close button), are requests: `openChangeAction`. Escape or a click outside is a fact: the browser has already hidden the popup when `onOpenChange(false, details)` is called from its event. A controlled Root adopts both, with the same setter:
77
+
78
+ ```tsx
79
+ const [open, setOpen] = useState(false);
80
+ <Popover.Root open={open} openChangeAction={setOpen} onOpenChange={setOpen}>
81
+ ```
82
+
83
+ See [Requests and facts](browser-owned-state.md#requests-and-facts) for what each one does to the popup.
84
+
85
+ Example: [Combobox](../components/combobox.md)
86
+
87
+ ### The text of a controlled input
88
+
89
+ React requires a controlled text input to update in the same event as the keystroke, so typed text is a fact: when the library hears of it, the DOM already holds it. Combobox keeps the usual pair, `inputValue` / `defaultInputValue`, but its callback is a handler, `onInputValueChange`, not an action. `(next) => setText(next)` is the whole controlled pattern. What the text drives (a deferred query, an open, a selection) goes back to transitions at once; a fetch whose results should render belongs there, through `useDeferredValue` of the text.
90
+
91
+ ## `details.reason`
92
+
93
+ Components that can change for more than one reason say why, with one library-wide vocabulary (the public type `ChangeReason`):
94
+
95
+ | reason | Meaning | details.event |
96
+ | - | - | - |
97
+ | `"activate"` | The user acted on one of the component's parts: a click, Enter or Space, focus in automatic activation, a Close button or a form submit. | The native `click`, `keydown` or `focusin` event. For checkboxes and radios always the `click`, including Space and arrow keys. |
98
+ | `"platform"` | The browser changed the state by itself: find-in-page, a form reset, or an interaction before hydration found on mount. Never a direct user interaction (a click, key press or touch). | The platform event (`beforematch`, `toggle`, `reset`), or `undefined` on mount. |
99
+ | `"dismiss"` | The user closed the component without one of its parts: Escape, Android back, an assistive-technology dismiss, a click outside; also a close nobody caused through the component (script, another top-layer element, focus leaving). On an overlay most of these are [facts](#fact), reported to `onOpenChange`. Also a [Toast](../components/toast.md)'s Close part, which only means "go away". | The platform's `close` or `toggle` event; for Toast the click or keydown. |
100
+ | `"timeout"` | The library's own timer closed the component: a [Toast](../components/toast.md) whose `duration` elapsed. No user interaction, no platform event. | `undefined` |
101
+
102
+ A component uses only the reasons that can happen to it; its page lists them in the description of its change action and of its `on*` handler. A `"platform"` dispatch goes through the same action as a user one, so a controlled parent hears about a form reset and decides whether to adopt it. See [Browser-owned state](browser-owned-state.md).
103
+
104
+ ## What happens on a click
105
+
106
+ In one transition of its own, the component tags the transition with its [transition types](transitions.md#transition-types), sets the [optimistic value](pending-and-optimistic.md#optimistic), awaits your action, and, when it is uncontrolled and this is still the latest dispatch, commits the new value.
107
+
108
+ Example: [Toggle](../components/toggle.md)
109
+
110
+ ```typescript
111
+ startTransition(async () => {
112
+ addTransitionType("fsui-toggle"); // plus fsui-toggle-press / -release
113
+ setOptimistic(next); // the button flips immediately
114
+ await pressedChangeAction?.(next, details);
115
+ // uncontrolled: commit `next` now, if this is still the latest dispatch
116
+ });
117
+ ```
118
+
119
+ What you can rely on:
120
+
121
+ - **Sync or async.** The action is awaited; `data-pending` stays on until the promise settles _and_ the resulting render has committed (including a Suspense wait).
122
+ - **The synchronous part runs during the event.** `details.event.preventDefault()` works there, and a `setState` there is a transition update.
123
+ - **Disabled parts never dispatch** for user interaction, and no-op interactions (clicking the tab that is already selected) do not dispatch either. A form reset is not a user interaction with the control: `form.reset()` resets disabled inputs too, so a disabled control still follows it, with `reason: "platform"`.
124
+ - **Parts are never natively disabled while pending.** A trigger that changes state sets `data-pending` and takes every click: a second click is a new intent (below). What a [pure trigger](pending-and-optimistic.md#pure-trigger) does with a second activation while its own action is pending is its `whilePending` prop: `"run"` runs it again (the default of a `Button`), `"ignore"` drops it and makes the part `aria-disabled="true"` meanwhile (the default of a Close part; use it on a Save that must not run twice). See [A second click while pending](pending-and-optimistic.md#second-click).
125
+
126
+ ## <a id="after-await"></a>After an `await`, wrap state updates yourself
127
+
128
+ This is a React rule, and the library cannot hide it: a `setState` that runs after your own `await` is no longer part of the transition. Wrap it in `startTransition`.
129
+
130
+ Example: [Tabs](../components/tabs.md)
131
+
132
+ ```tsx
133
+ // Controlled, local state: set it in the synchronous part.
134
+ <Tabs.Root value={tab} valueChangeAction={(next) => { setTab(next); }}>
135
+
136
+ // Controlled, server-backed: adopt the value on success, re-wrapped after the await.
137
+ <Tabs.Root
138
+ value={tab}
139
+ valueChangeAction={async (next) => {
140
+ await saveTab(next);
141
+ startTransition(() => setTab(next));
142
+ }}
143
+ >
144
+ ```
145
+
146
+ ## <a id="await-only"></a>Await only what the UI must wait for
147
+
148
+ While an async action is pending, React holds _every_ transition in the app that started meanwhile and commits them together. A two-second awaited save in one Toggle also delays a router navigation. Background work that the UI need not wait for should not be returned:
149
+
150
+ Example: [Tabs](../components/tabs.md)
151
+
152
+ ```tsx
153
+ // The panel switches immediately; the save runs in the background.
154
+ valueChangeAction={(next) => { void saveSelection(next); }}
155
+
156
+ // The panel switches when the save succeeds; the tab shows pending meanwhile.
157
+ valueChangeAction={async (next) => { await saveSelection(next); }}
158
+ ```
159
+
160
+ ## Errors go to Error Boundaries
161
+
162
+ An action that throws or rejects reaches the nearest Error Boundary above the component that owns the transition (the [state owner](pending-and-optimistic.md#state-owner): usually the `Root`, or a single-element component such as a Toggle). The library never swallows an error: the rejection of an older action that a newer one superseded goes to `reportError` instead (see [Overlapping actions](action-props.md#overlapping-actions)), and so does a rejection that arrives after the component unmounted (a toast or menu closed while its action ran) or while it is hidden (an `<Activity>`, a closed overlay with `keepMounted`, or a Suspense boundary showing its fallback), since React has no render left to deliver it through. A hidden component's error is reported once and does not show the Error Boundary when the component reappears. The optimistic state reverts automatically, and uncontrolled state is only written after success, so a failed action leaves it untouched.
163
+
164
+ For inline error UI instead, catch inside the action. A caught error makes the action resolve, which counts as success: in uncontrolled mode the new value is committed. Use controlled mode when the parent must be able to veto.
165
+
166
+ Example: [Toggle](../components/toggle.md)
167
+
168
+ The left Toggle catches its errors inline; the right one lets them reach a boundary.
169
+
170
+ ```tsx title="ToggleErrors.tsx"
171
+ "use client";
172
+ import { startTransition, useRef, useState } from "react";
173
+ import { Toggle } from "@funstack/ui/toggle";
174
+ import { DemoErrorBoundary } from "./DemoErrorBoundary.js";
175
+ import { fakeSave } from "./fake-api.js";
176
+
177
+ // Two ways to handle a failing action.
178
+ export function ToggleErrors() {
179
+ return (
180
+ <div className="demo-row">
181
+ <ControlledWithInlineError />
182
+ <DemoErrorBoundary>
183
+ <Toggle
184
+ className="demo-toggle"
185
+ pressedChangeAction={(next) => fakeSave(`notify=${next}`, { fail: true })}
186
+ >
187
+ {({ pending }) => (
188
+ <>{pending && <span className="demo-spinner" aria-hidden />}Notify me</>
189
+ )}
190
+ </Toggle>
191
+ </DemoErrorBoundary>
192
+ </div>
193
+ );
194
+ }
195
+
196
+ // Controlled, "update on success": the parent adopts the value only after the save succeeds.
197
+ // Every second save fails; the error is caught inside the action, so the Toggle snaps back.
198
+ function ControlledWithInlineError() {
199
+ const [pinned, setPinned] = useState(false);
200
+ const [error, setError] = useState<string | null>(null);
201
+ const saves = useRef(0);
202
+ return (
203
+ <span>
204
+ <Toggle
205
+ className="demo-toggle"
206
+ pressed={pinned}
207
+ pressedChangeAction={async (next) => {
208
+ setError(null); // sync prefix: already a Transition update
209
+ try {
210
+ await fakeSave(`pinned=${next}`, { fail: ++saves.current % 2 === 0 });
211
+ // After an await, wrap state updates in startTransition yourself.
212
+ startTransition(() => setPinned(next));
213
+ } catch (e) {
214
+ startTransition(() => setError(e instanceof Error ? e.message : String(e)));
215
+ }
216
+ }}
217
+ >
218
+ {({ pending }) => <>{pending && <span className="demo-spinner" aria-hidden />}Pin</>}
219
+ </Toggle>
220
+ {error && <span className="demo-inline-error"> {error}</span>}
221
+ </span>
222
+ );
223
+ }
224
+ ```
225
+
226
+ ## <a id="overlapping-actions"></a>Overlapping actions: the latest intent wins
227
+
228
+ React neither cancels nor orders overlapping transitions: two actions started one after the other run at the same time, and either may finish first. The components handle this: the optimistic state always shows the most recent click, and uncontrolled state is committed only for the most recently dispatched action, even if an older one resolves later. The components have no queue and no abort signal; if you need to cancel a request, keep an `AbortController` in a ref inside your action.
229
+
230
+ Components whose value is a set of items (CheckboxGroup, and ToggleGroup and Accordion without `exclusive`) commit each change on its own instead: once every overlapping action has settled, the changes whose actions resolved are applied in the order they were made, and a change whose action rejected is left out. Check A, then B: if saving A fails and saving B succeeds, the uncontrolled group ends with only B checked. B's action still received `["A", "B"]` as `next`, because A was pending when B was clicked, so save `details.added` and `details.removed` rather than the whole `next`.
231
+
232
+ If your actions must run in order, one after another, or each must build on the result of the one before (reducer-style accumulation), use React's [`useActionState`](https://react.dev/reference/react/useActionState) and call its dispatch function from the component's action. React queues those calls and runs them sequentially, passing each the state the previous one returned. Drive the component in controlled mode from that state:
233
+
234
+ Example: [Toggle](../components/toggle.md)
235
+
236
+ ```tsx
237
+ const [pressed, dispatch] = useActionState(async (_previous: boolean, next: boolean) => {
238
+ await api.setFavorite(id, next); // runs only after the previous call has finished
239
+ return next;
240
+ }, initial);
241
+
242
+ <Toggle pressed={pressed} pressedChangeAction={(next) => dispatch(next)}>Favorite</Toggle>
243
+ ```
244
+
245
+ The component stays pending and keeps showing the latest optimistic value until the queue has drained. React's rules for the queue apply: when one call throws, React skips the calls still queued behind it and the error goes to the nearest Error Boundary above the component that called `useActionState`.
246
+
247
+ When an older action rejects after a newer one has started, React does not send the error to an Error Boundary: only the latest action's failure is thrown, and the UI keeps showing the latest intent. The library does the same, and also passes the older rejection to the global `reportError`, as React's standalone `startTransition` does with a rejection it has nowhere else to send. The error is not lost: it fires the window `error` event, so error monitoring sees it, and a test runner reports it as an uncaught error.
248
+
249
+ ## Server Functions work directly
250
+
251
+ A Server Function (`"use server"`) can be passed straight to any action prop, from a Server Component or a Client Component, without a client wrapper. The server receives the same arguments, `(next, details)`, with one difference: a DOM event cannot be sent to the server, so `details.event` is `undefined` there. Every other field of `details` (`reason`, for example) arrives intact.
252
+
253
+ Example: [Toggle](../components/toggle.md)
254
+
255
+ ```tsx
256
+ // app/post.tsx: a Server Component
257
+ import { Toggle } from "@funstack/ui/toggle";
258
+ import { setFavorite } from "./actions"; // "use server"
259
+
260
+ <Toggle defaultPressed={post.favorited} pressedChangeAction={setFavorite.bind(null, post.id)}>
261
+ Favorite
262
+ </Toggle>
263
+ ```
264
+
265
+ > **details.event is not an ordinary field**
266
+ >
267
+ > To keep `details` serialisable, `event` is not an own property of the object, so some operations do not see it. `Object.keys(details)`, spreading and `JSON.stringify` do not include `event`; `"event" in details` and `details.event` do. `structuredClone(details)` throws. In tests, assert `details.event` directly rather than `toEqual({ event })`.
268
+
269
+ ## <a id="form-actions"></a>Form actions are a separate channel
270
+
271
+ `<form action>`, `useFormStatus` and React's automatic form reset are React's form channel. A control's change action is per control and runs in the control's own transition. The two are independent:
272
+
273
+ - A native form control (a Switch, for example) inside `<form action={serverFn}>` needs no change action: with a `name` it posts its value like any native input, and `useFormStatus().pending` covers the submit.
274
+ - A control never folds `useFormStatus` into its own `pending`: that would mark every control in the form pending during a submit. Read `useFormStatus` in your own `className` function, or style `form:has(...)`.
275
+ - "Autosave on change" is `checkedChangeAction={saveSetting}`; "submit on change" is `checkedChangeAction={() => formRef.current?.requestSubmit()}`.
276
+ - A part may observe the form channel for a platform side effect: `Dialog.Form` closes its dialog once the form action has settled. It watches the form's status and passes your action to `<form action>` unchanged, instead of wrapping it in a function of its own. That matters for a Server Function: React can only [submit a form before JavaScript loads](https://react.dev/reference/react-dom/components/form#handle-form-submission-with-a-server-function) when the `action` is the Server Function itself; a client wrapper around it would need JavaScript to run.
277
+ - While a form action is pending, a control's transition waits for it, and the reverse: React commits them together.
278
+
279
+ ## What about native handlers?
280
+
281
+ DOM event props that a part does not use itself pass through to the element (an `onPointerEnter` on a Tab, an `onClick` on a Tooltip trigger). They are the platform's API, not the library's. Handlers the part does install (for example `onClick` on a Toggle) are removed from its props type so they cannot be clobbered by accident.
@@ -0,0 +1,56 @@
1
+ # Using with AI agents
2
+
3
+ FUNSTACK UI's API differs from other headless libraries: action props instead of `onChange`, `render` instead of `asChild`, transitions you do not start yourself. An agent that guesses from other libraries gets these wrong. Give it the documentation instead.
4
+
5
+ ## Install the agent skill
6
+
7
+ An [agent skill](https://agentskills.io) is a Markdown file that an agent loads when a task needs it. `@funstack/ui` ships one, named `funstack-ui-knowledge`, and an installer that copies it into your project. Run it in your project's root, with `@funstack/ui` installed:
8
+
9
+ ```bash
10
+ npx -p @funstack/ui@alpha funstack-ui-skill-installer
11
+ # or
12
+ pnpm dlx --package @funstack/ui@alpha funstack-ui-skill-installer
13
+ # or
14
+ yarn dlx -p @funstack/ui@alpha funstack-ui-skill-installer
15
+ ```
16
+
17
+ The installer asks which agent you use (Claude Code, Codex, GitHub Copilot, Cursor and others, or a custom path) and copies the skill into that agent's skills directory, for example `.claude/skills/funstack-ui-knowledge/`. In a script or CI, where there is no terminal to ask in, it reads the target directory from `SKILL_INSTALL_PATH` instead:
18
+
19
+ ```bash
20
+ SKILL_INSTALL_PATH=./.claude/skills npx -p @funstack/ui@alpha funstack-ui-skill-installer
21
+ ```
22
+
23
+ In an interactive terminal the variable is ignored and the prompt appears; add `< /dev/null` to the command to use the variable there.
24
+
25
+ The skill is short, so the agent can load it whole. It contains:
26
+
27
+ - The mental model: action props, optimistic and pending state, Suspense, transitions.
28
+ - The mistakes agents make most often, such as writing `onValueChange` or wrapping actions in `startTransition`.
29
+ - A one-line index of every component, with its import path and parts.
30
+ - A pointer to the full documentation bundled in the package (below).
31
+
32
+ Re-run the installer after upgrading `@funstack/ui` to update the skill. Commit the copied files if your team shares the agent setup.
33
+
34
+ ## Docs in the package
35
+
36
+ The npm package contains this whole site as Markdown, matching the installed version. The skill points the agent at its index:
37
+
38
+ ```bash
39
+ node_modules/@funstack/ui/dist/docs/index.md
40
+ ```
41
+
42
+ You can also point an agent at this file directly, without the skill. Because it comes from the installed package, it does not drift from the code the agent is writing against.
43
+
44
+ ## Docs on the web
45
+
46
+ The same Markdown is published on this site:
47
+
48
+ | URL | Contents |
49
+ | - | - |
50
+ | `https://ui.funstack.work/llms.txt` | An index of every page with a one-line description, in the [llms.txt](https://llmstxt.org) format. |
51
+ | `https://ui.funstack.work/llms-full.txt` | Every page in one file, in sidebar order. |
52
+ | Any page URL plus `.md` | That page as Markdown, for example `https://ui.funstack.work/components/dialog.md`. |
53
+
54
+ > **Which version?**
55
+ >
56
+ > The site documents the latest release. If your project pins an older alpha, prefer the docs in `node_modules`.
@@ -0,0 +1,133 @@
1
+ # Browser-owned state
2
+
3
+ "Transition by default" is about state the library owns. Some state belongs to the browser, which changes it before React hears about it. FUNSTACK UI prefers that state whenever the platform offers it, because it is the only way a component can work without JavaScript.
4
+
5
+ ## Terms
6
+
7
+ - **Library-owned state**: State held in React and changed only by the library, usually inside the [state owner](pending-and-optimistic.md#state-owner)'s transition after the user acts on a [trigger](pending-and-optimistic.md#trigger). Some library-owned state is urgent instead (typed text, a toast queue): still the library's, but not a transition.
8
+ - **Browser-owned state**: State held in the DOM and changed by the browser itself: whether a `<details>` is open, whether a popover is in the top layer (the layer the browser draws above the whole page), whether a dialog is shown. The library reads it; it does not keep a copy in React state.
9
+ - **<a id="dismissal"></a>Dismissal**: Closing something without one of its parts: Escape, the Android back gesture, an assistive-technology dismiss, a click outside, or another top-layer element opening (the Popover API calls the last two light dismiss).
10
+ - **<a id="invoker"></a>Invoker**: A button that names a popover or dialog by id, so that the browser itself opens or closes it on click, without JavaScript: through `popovertarget` (the Popover API) or through `commandfor` and `command` (Invoker Commands). A `<button>` or an `<input type="button">` / `<input type="reset">` can be one; a disabled button and a submit button inside a form are not. See [Triggers of a popup](#popup-triggers).
11
+ - **<a id="foreign-invoker"></a>Foreign invoker**: An invoker of your own that targets a component's popup or dialog, but is not one of the component's parts.
12
+ - **<a id="platform-path"></a>Platform path**: A change the browser makes to library-owned state on its own, without a click the library sees: a form reset, find-in-page opening an item, a click before hydration. The component dispatches it like a user change, with `details.reason: "platform"`, and re-applies the committed state afterwards.
13
+ - **Request and fact**: A [request](action-props.md#request) is a change the library can still roll back: it goes to an action prop (`openChangeAction`) before it is committed. A [fact](action-props.md#fact) is a change that had already happened when the library heard of it, and that it could not hold: it is reported to an [\`on\*\` handler](action-props.md#on-handler) (`onOpenChange`). Both terms are defined on Action props; see [Requests and facts](#requests-and-facts) for what they mean for a popup.
14
+ - **<a id="parts-close"></a>A part's close**: A close the user asks one of the component's parts for (a Close button, the Trigger, a form submit). It is a request: dispatched in a transition, awaited, vetoable and animatable. The opposite of a dismissal.
15
+ - **<a id="js-free-mode"></a>JS-free mode and library mode**: Some components can run either way. In **JS-free mode** (no controlled or default state, no change action and no `on*` handler), the browser owns the state and the library adds no behaviour on the native path. In **library mode** (any of those props), the state is library-owned. See [Two modes](#two-modes).
16
+
17
+ ## Two kinds of state
18
+
19
+ | | Library-owned | Browser-owned |
20
+ | - | - | - |
21
+ | Who changes it | the library, inside its transition | the browser (hover, light dismiss, Escape, find-in-page, a summary click, an [invoker](#invoker)) |
22
+ | Optimistic state | React state ([optimistic](pending-and-optimistic.md#optimistic), `useOptimistic`) | the DOM itself |
23
+ | Callback | an action prop for a [request](action-props.md#request), awaited; an `on*` handler for a [fact](action-props.md#fact) (typed text) | an `on*` handler for a fact (`onOpenChange`), not awaited; or none |
24
+ | Styling | `data-*` attributes | pseudo-classes: `:popover-open`, `:open` |
25
+ | Animation | `transition` prop (`<ViewTransition>`) | CSS: `@starting-style`, `transition-behavior: allow-discrete` |
26
+
27
+ The library never mirrors browser-owned state into React state. It reads the DOM when it needs to, and it does not duplicate a pseudo-class with a data attribute. State that nobody persists or awaits is left to the browser entirely, with no prop and no action. Whether a hint popup (such as a tooltip) is showing is one example. One read is mirrored: whether a popup is shown, where no native element exposes it to assistive technology: on a Trigger that is no invoker, and on the Combobox input (see [Triggers of a popup](#popup-triggers)). Each component page says what it leaves to the browser in its **Browser-owned state** section.
28
+
29
+ Example: [Tooltip](../components/tooltip.md)
30
+
31
+ A tooltip's visibility is not application state. The popup is a `popover` in the top layer, so Tooltip has no `open` prop, no action and no `data-open`: `:popover-open` already says it. Style and animate it in CSS:
32
+
33
+ ```css
34
+ .tip { opacity: 0; transition: opacity 120ms, display 120ms allow-discrete, overlay 120ms allow-discrete; }
35
+ .tip:popover-open {
36
+ opacity: 1;
37
+ @starting-style { opacity: 0; }
38
+ }
39
+ /* The trigger of an open tooltip: the popup is its next sibling. */
40
+ .trigger:has(+ .tip:popover-open) { outline: 1px solid; }
41
+ ```
42
+
43
+ ## <a id="two-modes"></a>Two modes, one anatomy
44
+
45
+ Some components built on a native element that does the whole interaction offer both (their pages have a **Two modes** section). Without any controlled value, default value, change action or `on*` handler it runs in [JS-free mode](#js-free-mode): the browser owns the state and nothing runs when it changes. Add any of them and the component switches to **library mode**: the native interaction is intercepted, the state is React state changed in a transition, and triggers get optimistic data attributes and `data-pending`. The parts and the markup are the same in both. The mode is decided on the first render; switching between them later is not supported (development warning).
46
+
47
+ The browser can still change the state in library mode (find-in-page, a text fragment, a click before hydration). The component turns that into a regular dispatch with `details.reason === "platform"`, and once the action settles it re-applies the committed state to the DOM, so a controlled parent that refuses the change gets its state back.
48
+
49
+ Example: [Accordion](../components/accordion.md)
50
+
51
+ An Accordion without `value`, `defaultValue` and `valueChangeAction` leaves every `<details open>` to the browser, and `exclusive` renders the native `name` group. With any of them, the summary click is intercepted and open state changes in a transition.
52
+
53
+ ```tsx
54
+ // JS-free: the browser owns open state.
55
+ <Accordion.Root exclusive>...</Accordion.Root>
56
+
57
+ // Library mode: transitions, actions, optimistic state.
58
+ <Accordion.Root exclusive defaultValue={null} valueChangeAction={save}>...</Accordion.Root>
59
+ ```
60
+
61
+ ## Requests and facts
62
+
63
+ For something that opens and closes in library mode, a change is either a [request](action-props.md#request) or a [fact](action-props.md#fact), and each has its own prop. Opening, and a close the user asks one of the component's parts for, are requests: the click, submit or command is cancelled and dispatched in a transition, `openChangeAction` is awaited, a controlled parent can veto it, and it can animate with a view transition. A [dismissal](#dismissal) is a fact: the element closes natively and at once, and `onOpenChange(false, details)` is called synchronously from the browser's own event. Nothing is pending, no view transition runs (a CSS exit animates it), and the committed state is `false` in the same event. A close the library performs itself but cannot hold, because the user has already moved on (focus leaving the popup), is a fact too.
64
+
65
+ The line sits where the platform lets the library cancel a step freely: a part's click (which cancels its command), a `command` event, a form's `submit`. Escape and the back gesture reach the element as an HTML [close request](https://html.spec.whatwg.org/multipage/interaction.html#close-requests) (the platform's term, not a request in the sense above), whose `cancel` event the browser honours only once per user activation, and a user who pressed Escape expects the element to go away now. So the library never holds a dismissal.
66
+
67
+ A popup the browser opened before hydration is still a request (`openChangeAction(true, { reason: "platform" })`): the library can roll it back by hiding the empty popup, and its load-on-open code runs. So `onOpenChange` is only ever called with `false`.
68
+
69
+ **Controlled mode needs both props.** Pass the same setter to both: `openChangeAction` adopts a request (in a transition), `onOpenChange` adopts a fact (an [urgent update](action-props.md#urgent-update)). Set state directly in `onOpenChange`, never in `startTransition` and never after an `await`: a parent that still says `open={true}` once the browser's event has been handled gets the element shown again at once, and a late `false` then closes it a second time. A controlled Root without `onOpenChange` warns in development.
70
+
71
+ A parent that keeps `open={true}` after a dismissal on purpose gets the same re-open. This is not a veto: the user sees the element close and come back, possibly for a frame. A popup that must not be dismissed is set up on the platform side instead, where the component offers it. The re-open applies no initial focus of its own: a Menu, a Combobox or a Popover rendered as a `<div>` shown again this way leaves focus where the dismissal put it (the Trigger after Escape, the next field after Tab), so a parent that never adopts `false` cannot trap the keyboard in it. A popup that is a `<dialog>` (a Dialog, a Popover by default) still gets the browser's dialog focusing steps on the re-show, as on any open.
72
+
73
+ **Uncontrolled, pass what you need.** `openChangeAction` for work an open or a part's close must wait for (loading data on open); `onOpenChange` to observe a dismissal (logging it, remembering it). To hear every close, pass one function to both props and check its first argument: the action is called with `true` for an open too.
74
+
75
+ Example: [Dialog](../components/dialog.md)
76
+
77
+ A library-mode Dialog opens through its Trigger and closes through its Close parts and `Dialog.Form` after `openChangeAction` resolves. Escape or a click outside closes it at once and calls `onOpenChange(false, details)` with `reason: "dismiss"`. Controlled, with both props:
78
+
79
+ ```tsx
80
+ const [open, setOpen] = useState(false);
81
+ <Dialog.Root open={open} openChangeAction={setOpen} onOpenChange={setOpen}>
82
+ ```
83
+
84
+ A Dialog without `lightDismiss` ignores a click outside; Escape still closes a modal dialog.
85
+
86
+ ## <a id="popup-triggers"></a>Triggers of a popup
87
+
88
+ A component whose popup is a popover has a **Trigger**: the part that opens and closes it. A Trigger rendered as a `<button>` names the popup with `popovertarget`, which makes it the popup's [invoker](#invoker). That relationship gives it three things from the browser:
89
+
90
+ - It can open the popup before hydration and with JavaScript off.
91
+ - A press on it is not a click outside: light dismiss spares the invoker of an open popover, so the Trigger's click can close the popup as [a part's close](#parts-close), awaited and animated.
92
+ - The browser exposes the popover's expanded or collapsed state on it. The Trigger therefore renders no `aria-expanded`; [ARIA in HTML](https://w3c.github.io/html-aria/) forbids the attribute on an element with `popovertarget`.
93
+
94
+ A component may give up one of these on purpose; its page says so.
95
+
96
+ Only a `<button>` can be the Trigger's invoker. A Trigger rendered as a link or another element works through the library's click handler instead, and has none of the above: it renders `aria-expanded` itself, from whether the popup is shown; and a press on it while the popup is open counts as a click outside, so light dismiss closes the popup before the click arrives. That close is a [fact](action-props.md#fact), reported to `onOpenChange` (with `reason: "activate"` and the click), not a request: it is not awaited, a controlled parent cannot veto it, and there is no view transition. A development warning says so. A disabled Trigger that stays focusable (it renders `aria-disabled`) is no invoker either, so that nothing native can open the popup.
97
+
98
+ **Two kinds of open state on a Trigger.** What assistive technology hears is whether the popup is shown. In library mode, `data-open` is the [optimistic](pending-and-optimistic.md#optimistic) state: it flips at the click, while an open that waits for an action or for content is still pending. Style click feedback with `[data-open]` and `[data-pending]`, never with `[aria-expanded]`, which a `<button>` Trigger does not have. An element that controls a popup without being its invoker, such as the Combobox input, renders `aria-expanded` from the shown popup too.
99
+
100
+ **One Trigger per Root.** The library anchors the popup to its Trigger or returns focus to it, so a Root has one. A second Trigger in the same Root is not supported (development warning); use a Root per trigger.
101
+
102
+ **Foreign invokers.** A [foreign invoker](#foreign-invoker) still works in library mode. An open through it is routed through the library like the Trigger's, so the action runs and the content loads first. A close through it has `reason: "activate"`, because the user acted on a button. It is a request where the component routes it through the library (it cancels the invoker's step and closes after `openChangeAction`), and a [fact](action-props.md#fact) reported to `onOpenChange` where the browser performs it first; each component page says which. A component that keeps focus in its popup or its input does not lose it when you press a foreign invoker: the invoker's own close is the only one.
103
+
104
+ Example: [Popover](../components/popover.md)
105
+
106
+ A `Popover.Trigger` renders `<button popovertarget>` with no `aria-expanded`. Its styling hook is `data-open`; on a page that never hydrates, select on the popup that follows it:
107
+
108
+ ```css
109
+ .trigger[data-open] { color: var(--accent); }
110
+ /* Without JavaScript: the Popup right after the Trigger. */
111
+ .trigger:has(+ :popover-open) { color: var(--accent); }
112
+ ```
113
+
114
+ ## <a id="native-inputs"></a>Native inputs: the DOM is the optimistic state
115
+
116
+ A form control built on a real `<input>` has library-owned state, but the browser flips the input before any JavaScript runs, and after every event react-dom restores a controlled input to its current props. Only the synchronous optimistic state has rendered by then, so such a control renders the input from the optimistic value. That is a **correctness requirement**: an input driven by committed state would snap back right after the click and stay wrong for as long as the action runs. As a consequence the native pseudo-class (`:checked`) and the data attribute agree, and assistive technology hears the new state at once.
117
+
118
+ Example: [Switch](../components/switch.md)
119
+
120
+ A Switch renders `<input type="checkbox" role="switch">` with `checked={optimistic}`, so `:checked` and `data-checked` agree from the click on.
121
+
122
+ The browser can still change a native input without a click the library sees. Each case is a regular dispatch with `details.reason === "platform"`, and afterwards the DOM follows the decision:
123
+
124
+ - **Form reset**: a reset button, `form.reset()`, or React's automatic reset after a successful `<form action>`. Uncontrolled, the target is the latest default value; controlled, the browser's mount-time value is offered to the parent, which adopts it or not.
125
+ - **Mount reconciliation**: a click before hydration, or Firefox restoring form state on reload. React keeps the DOM value when hydrating and fires nothing, so the component compares on mount and dispatches once (once per group for a group of inputs).
126
+
127
+ ## Consumer-owned, mirrored state
128
+
129
+ A fourth kind of state is **consumer-owned and mirrored**: the parent derives it, there is no default and no action, and the library only writes it to the DOM after every commit. Where the browser clears it on a click, the library stops writing it while an action is pending.
130
+
131
+ Example: [Checkbox](../components/checkbox.md)
132
+
133
+ `indeterminate` is derived by a "select all" parent from its rows. The library writes the DOM property after every commit and suspends it while an action is pending, because the browser clears it on the click.
@@ -0,0 +1,69 @@
1
+ # Content Security Policy
2
+
3
+ FUNSTACK UI ships no visual CSS, but it does use inline styles for placement and two tiny functional stylesheets. Under a `style-src` that lists nonces or hashes instead of `'unsafe-inline'`, here is what each needs. Everything is exported from `@funstack/ui/csp` (and the root entry).
4
+
5
+ ## What the library puts in the page
6
+
7
+ | Mechanism | Example | Under a strict style-src |
8
+ | - | - | - |
9
+ | Inline `style` set on the client | the point of a context menu, `position-area` after an update | Allowed: React writes the `style` prop through the CSSOM, which CSP does not govern. |
10
+ | Inline `style` in server-rendered HTML | `position-area` of an anchored popup, Tooltip's `interest-delay-*` | Blocked without `style-src-attr 'unsafe-inline'` (as for every library that renders inline styles). Blocked, the popup is placed by your stylesheet only until React updates the attribute, and a custom tooltip delay falls back to the browser's. |
11
+ | Hoisted `<style>` elements | the two stylesheets below | Blocked unless the text matches a `'sha256-…'` source or the element carries your nonce. |
12
+
13
+ ## The shipped stylesheets and their hashes
14
+
15
+ Each is a constant string rendered as a React hoisted `<style>` (one per page, deduplicated by its `href`), only by the part that needs it. Their base64 SHA-256 is exported as `STYLE_SHA256`, keyed by `href`; a test recomputes it from the CSS, so it cannot drift from what the parts render.
16
+
17
+ | href | Rendered by | When | style-src source |
18
+ | - | - | - | - |
19
+ | `@funstack/ui/menu-point` | `Menu.Popup` | On the client, the first time a menu opens at a point (`Menu.ContextTrigger`) without `side={null}` | `'sha256-Wm5aBRstuZ3S9kDs0IbldhidU/prqpIW69jEAS0N9mc='` |
20
+ | `@funstack/ui/tooltip-warm` | `Tooltip.Trigger` | With `experimental_interestFor` only, during server rendering too | `'sha256-nFBZGhNvo46ITrlBb48hELUAyWzpeIdJCziCectFQa4='` |
21
+
22
+ ```bash
23
+ Content-Security-Policy: style-src 'self' 'sha256-Wm5aBRstuZ3S9kDs0IbldhidU/prqpIW69jEAS0N9mc=' 'sha256-nFBZGhNvo46ITrlBb48hELUAyWzpeIdJCziCectFQa4='; style-src-attr 'unsafe-inline'
24
+ ```
25
+
26
+ ```tsx
27
+ import { STYLE_SHA256 } from "@funstack/ui/csp";
28
+
29
+ const styleSources = Object.values(STYLE_SHA256).map((hash) => `'sha256-${hash}'`);
30
+ ```
31
+
32
+ Hashes need no code and suit static sites (FUNSTACK Static's output, a CDN): the values only change with a library release, so compute the header from `STYLE_SHA256` at build time rather than copying them.
33
+
34
+ ## Nonces: CSPProvider
35
+
36
+ With a per-response nonce, render `<CSPProvider nonce>` once around the app. Every part that renders a hoisted `<style>` puts the nonce on it. It is the library's only provider, and its prop is serialisable, so a Server Component layout that knows the nonce renders it directly.
37
+
38
+ ```tsx
39
+ import { CSPProvider } from "@funstack/ui/csp";
40
+
41
+ export function Layout({ nonce, children }: { nonce: string; children: React.ReactNode }) {
42
+ return <CSPProvider nonce={nonce}>{children}</CSPProvider>;
43
+ }
44
+
45
+ // Server: pass the same value as React's style nonce.
46
+ renderToReadableStream(<App nonce={nonce} />, { nonce: { script: nonce, style: nonce } });
47
+ ```
48
+
49
+ > **Pass the same value as React's nonce.style**
50
+ >
51
+ > During server rendering React (19.3) checks a hoisted `<style>` against the `nonce: { style }` render option:
52
+ >
53
+ > - Same value on the element and the option: written with the nonce.
54
+ > - **If you pass `nonce.style`, render `<CSPProvider>` with the same value; without it React drops the rule** (the element has no nonce), and so does a different value.
55
+ > - No `nonce` option, or the string form `nonce: "…"` (scripts only): the rule is written **without** a nonce, so a nonce policy blocks it in the browser.
56
+ >
57
+ > This matters for the tooltip stylesheet, which can render on the server; the menu stylesheet is only ever inserted on the client.
58
+
59
+ | Prop | Type | Default | Description |
60
+ | - | - | - | - |
61
+ | `nonce` | `string` | – | The nonce of your `style-src`, forwarded as the `nonce` of every library `<style>`. Use the value you pass as React's `nonce.style`. |
62
+ | `children` | `ReactNode` | – | Your app. |
63
+
64
+ The library does not read a `<meta property="csp-nonce">` on its own: the server render needs the value in props anyway.
65
+
66
+ ## If a stylesheet is blocked
67
+
68
+ - **Menu point rules**: a context menu still opens at the pointer, but it never flips at the viewport edges.
69
+ - **Tooltip skip-delay rule**: on Chromium's native path (`experimental_interestFor`) the next tooltip waits its `delay` instead of opening at once (the Trigger's `var(--fsui-tooltip-warm, 0)` falls back to `0`, not to the browser's own delay). The JS path does not use the stylesheet.
@@ -0,0 +1,36 @@
1
+ # Experimental features
2
+
3
+ FUNSTACK UI supports the latest stable Blink, WebKit and Gecko, with no fallbacks for older browsers. Features that have not shipped in all three yet are still used, but only when you ask for them.
4
+
5
+ ## `experimental_*` props
6
+
7
+ A feature inside an existing component is an `experimental_<feature>` prop on the part that uses it, off by default. The prefix follows React's naming for unstable APIs. It is greppable, it sits at the call site where you make the browser-support decision, and when the feature reaches every engine the prop is removed: the type error tells you exactly where to delete it.
8
+
9
+ The flags today. What each one does is documented in the props table of the part that takes it; this is the index.
10
+
11
+ | Prop | Platform feature | Native path today | Documented on |
12
+ | - | - | - | - |
13
+ | `experimental_focusgroup` | `focusgroup` | Chromium 150+ | [Tabs.List](../components/tabs.md#props), [Toolbar.Root](../components/toolbar.md#props), [ToggleGroup.Root](../components/toggle-group.md#props), [Menu.Popup](../components/menu.md#props) |
14
+ | `experimental_interpolateSize` | `interpolate-size` | Chromium | [Accordion.Root](../components/accordion.md#props) |
15
+ | `experimental_interestFor` | `interestfor` | Chromium | [Tooltip.Trigger](../components/tooltip.md#props), [Tooltip skip-delay](../components/tooltip.md#skip-delay) |
16
+ | `experimental_hint` | `popover="hint"` | Chromium, Firefox (Safari 27.0 treats it as `manual`) | [Tooltip.Popup](../components/tooltip.md#props) |
17
+ | `experimental_closedBy` | `closedby` | Chromium, Firefox | [Dialog.Popup](../components/dialog.md#props) |
18
+
19
+ ```tsx
20
+ <Tabs.List experimental_focusgroup aria-label="Settings">...</Tabs.List>
21
+ <Accordion.Root experimental_interpolateSize>...</Accordion.Root>
22
+ <Tooltip.Trigger experimental_interestFor>Save</Tooltip.Trigger>
23
+ <Tooltip.Popup experimental_hint>Saves the document</Tooltip.Popup>
24
+ <Dialog.Popup lightDismiss experimental_closedBy>...</Dialog.Popup>
25
+ ```
26
+
27
+ ## Rules
28
+
29
+ - **Flags never change markup between server and client.** Feature detection (`"focusGroup" in HTMLElement.prototype`, `"interestForElement" in element`) runs in an effect, and only when the flag is on.
30
+ - **The baseline keeps working underneath.** A flag for a feature that would silently do nothing elsewhere keeps the JavaScript path active in engines without it.
31
+ - **No provider, no global switch.** The browser-support decision belongs next to the markup, and Server Components cannot create context anyway.
32
+ - Two features with different graduation paths are two props, so each can be removed on its own.
33
+
34
+ ## `@funstack/ui/experimental`
35
+
36
+ A whole component that cannot exist without a flagged feature would ship from an `@funstack/ui/experimental` subpath. None does yet: every current component has a baseline that works in all engines.