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

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 (558) 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 +2 -0
  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 +25 -7
  26. package/dist/button/button.d.mts.map +1 -1
  27. package/dist/button/button.mjs +2 -0
  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 +2 -0
  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 +16 -0
  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 +49 -12
  82. package/dist/combobox/combobox-root.d.mts.map +1 -1
  83. package/dist/combobox/combobox-root.mjs +2 -0
  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 +2 -0
  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 +18 -0
  102. package/dist/dialog/dialog-close.d.mts.map +1 -1
  103. package/dist/dialog/dialog-close.mjs +2 -0
  104. package/dist/dialog/dialog-close.mjs.map +1 -1
  105. package/dist/dialog/dialog-description.d.mts +12 -0
  106. package/dist/dialog/dialog-description.d.mts.map +1 -1
  107. package/dist/dialog/dialog-description.mjs +2 -0
  108. package/dist/dialog/dialog-description.mjs.map +1 -1
  109. package/dist/dialog/dialog-form.d.mts +18 -1
  110. package/dist/dialog/dialog-form.d.mts.map +1 -1
  111. package/dist/dialog/dialog-form.mjs +2 -0
  112. package/dist/dialog/dialog-form.mjs.map +1 -1
  113. package/dist/dialog/dialog-popup.d.mts +25 -4
  114. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  115. package/dist/dialog/dialog-popup.mjs +2 -0
  116. package/dist/dialog/dialog-popup.mjs.map +1 -1
  117. package/dist/dialog/dialog-root.d.mts +15 -1
  118. package/dist/dialog/dialog-root.d.mts.map +1 -1
  119. package/dist/dialog/dialog-root.mjs +2 -0
  120. package/dist/dialog/dialog-root.mjs.map +1 -1
  121. package/dist/dialog/dialog-title.d.mts +11 -0
  122. package/dist/dialog/dialog-title.d.mts.map +1 -1
  123. package/dist/dialog/dialog-title.mjs +2 -0
  124. package/dist/dialog/dialog-title.mjs.map +1 -1
  125. package/dist/dialog/dialog-trigger.d.mts +16 -0
  126. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  127. package/dist/dialog/dialog-trigger.mjs +2 -0
  128. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  129. package/dist/dialog/index.d.mts +2 -0
  130. package/dist/dialog/index.d.mts.map +1 -1
  131. package/dist/dialog/index.mjs +2 -0
  132. package/dist/dialog/index.mjs.map +1 -1
  133. package/dist/docs/components/accordion.md +426 -0
  134. package/dist/docs/components/button.md +464 -0
  135. package/dist/docs/components/checkbox-group.md +474 -0
  136. package/dist/docs/components/checkbox.md +373 -0
  137. package/dist/docs/components/combobox.md +635 -0
  138. package/dist/docs/components/context-menu.md +524 -0
  139. package/dist/docs/components/dialog.md +686 -0
  140. package/dist/docs/components/field.md +587 -0
  141. package/dist/docs/components/menu.md +589 -0
  142. package/dist/docs/components/meter.md +313 -0
  143. package/dist/docs/components/number-field.md +528 -0
  144. package/dist/docs/components/popover.md +591 -0
  145. package/dist/docs/components/progress.md +450 -0
  146. package/dist/docs/components/radio-group.md +457 -0
  147. package/dist/docs/components/select.md +662 -0
  148. package/dist/docs/components/slider.md +558 -0
  149. package/dist/docs/components/switch.md +311 -0
  150. package/dist/docs/components/tabs.md +473 -0
  151. package/dist/docs/components/toast.md +576 -0
  152. package/dist/docs/components/toggle-group.md +341 -0
  153. package/dist/docs/components/toggle.md +245 -0
  154. package/dist/docs/components/toolbar.md +389 -0
  155. package/dist/docs/components/tooltip.md +494 -0
  156. package/dist/docs/concepts/action-props.md +251 -0
  157. package/dist/docs/concepts/ai-agents.md +56 -0
  158. package/dist/docs/concepts/browser-owned-state.md +118 -0
  159. package/dist/docs/concepts/content-security-policy.md +69 -0
  160. package/dist/docs/concepts/experimental.md +36 -0
  161. package/dist/docs/concepts/pending-and-optimistic.md +250 -0
  162. package/dist/docs/concepts/server-components.md +118 -0
  163. package/dist/docs/concepts/suspense.md +124 -0
  164. package/dist/docs/concepts/transitions.md +118 -0
  165. package/dist/docs/getting-started.md +115 -0
  166. package/dist/docs/index.md +181 -0
  167. package/dist/docs/roadmap.md +74 -0
  168. package/dist/docs/why.md +100 -0
  169. package/dist/field/field-control.d.mts +26 -3
  170. package/dist/field/field-control.d.mts.map +1 -1
  171. package/dist/field/field-control.mjs +2 -0
  172. package/dist/field/field-control.mjs.map +1 -1
  173. package/dist/field/field-description.d.mts +11 -0
  174. package/dist/field/field-description.d.mts.map +1 -1
  175. package/dist/field/field-description.mjs +2 -0
  176. package/dist/field/field-description.mjs.map +1 -1
  177. package/dist/field/field-error.d.mts +14 -2
  178. package/dist/field/field-error.d.mts.map +1 -1
  179. package/dist/field/field-error.mjs +2 -0
  180. package/dist/field/field-error.mjs.map +1 -1
  181. package/dist/field/field-label.d.mts +10 -0
  182. package/dist/field/field-label.d.mts.map +1 -1
  183. package/dist/field/field-label.mjs +2 -0
  184. package/dist/field/field-label.mjs.map +1 -1
  185. package/dist/field/field-root.d.mts +21 -2
  186. package/dist/field/field-root.d.mts.map +1 -1
  187. package/dist/field/field-root.mjs +2 -0
  188. package/dist/field/field-root.mjs.map +1 -1
  189. package/dist/field/index.d.mts +9 -0
  190. package/dist/field/index.d.mts.map +1 -1
  191. package/dist/field/index.mjs +9 -0
  192. package/dist/field/index.mjs.map +1 -1
  193. package/dist/form/form-root.d.mts +17 -1
  194. package/dist/form/form-root.d.mts.map +1 -1
  195. package/dist/form/form-root.mjs +2 -0
  196. package/dist/form/form-root.mjs.map +1 -1
  197. package/dist/form/form-submit.d.mts +18 -0
  198. package/dist/form/form-submit.d.mts.map +1 -1
  199. package/dist/form/form-submit.mjs +2 -0
  200. package/dist/form/form-submit.mjs.map +1 -1
  201. package/dist/form/index.d.mts +7 -0
  202. package/dist/form/index.d.mts.map +1 -1
  203. package/dist/form/index.mjs +7 -0
  204. package/dist/form/index.mjs.map +1 -1
  205. package/dist/index.d.mts +2 -1
  206. package/dist/internal/types.d.mts +3 -0
  207. package/dist/internal/types.d.mts.map +1 -1
  208. package/dist/internal/use-popover-trigger.d.mts +1 -0
  209. package/dist/internal/use-popover-trigger.d.mts.map +1 -1
  210. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  211. package/dist/internal/validity.d.mts +11 -0
  212. package/dist/internal/validity.d.mts.map +1 -1
  213. package/dist/internal/validity.mjs.map +1 -1
  214. package/dist/menu/index.d.mts +2 -0
  215. package/dist/menu/index.d.mts.map +1 -1
  216. package/dist/menu/index.mjs +2 -0
  217. package/dist/menu/index.mjs.map +1 -1
  218. package/dist/menu/menu-checkbox-item.d.mts +26 -2
  219. package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
  220. package/dist/menu/menu-checkbox-item.mjs +2 -0
  221. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  222. package/dist/menu/menu-context-trigger.d.mts +24 -2
  223. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  224. package/dist/menu/menu-context-trigger.mjs +2 -0
  225. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  226. package/dist/menu/menu-group.d.mts +36 -1
  227. package/dist/menu/menu-group.d.mts.map +1 -1
  228. package/dist/menu/menu-group.mjs +9 -1
  229. package/dist/menu/menu-group.mjs.map +1 -1
  230. package/dist/menu/menu-item.d.mts +23 -1
  231. package/dist/menu/menu-item.d.mts.map +1 -1
  232. package/dist/menu/menu-item.mjs +2 -0
  233. package/dist/menu/menu-item.mjs.map +1 -1
  234. package/dist/menu/menu-popup.d.mts +33 -8
  235. package/dist/menu/menu-popup.d.mts.map +1 -1
  236. package/dist/menu/menu-popup.mjs +2 -0
  237. package/dist/menu/menu-popup.mjs.map +1 -1
  238. package/dist/menu/menu-radio-group.d.mts +20 -1
  239. package/dist/menu/menu-radio-group.d.mts.map +1 -1
  240. package/dist/menu/menu-radio-group.mjs +2 -0
  241. package/dist/menu/menu-radio-group.mjs.map +1 -1
  242. package/dist/menu/menu-radio-item.d.mts +16 -0
  243. package/dist/menu/menu-radio-item.d.mts.map +1 -1
  244. package/dist/menu/menu-radio-item.mjs +2 -0
  245. package/dist/menu/menu-radio-item.mjs.map +1 -1
  246. package/dist/menu/menu-root.d.mts +22 -3
  247. package/dist/menu/menu-root.d.mts.map +1 -1
  248. package/dist/menu/menu-root.mjs +2 -0
  249. package/dist/menu/menu-root.mjs.map +1 -1
  250. package/dist/menu/menu-submenu-trigger.d.mts +13 -0
  251. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  252. package/dist/menu/menu-submenu-trigger.mjs +2 -0
  253. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  254. package/dist/menu/menu-trigger.d.mts +15 -0
  255. package/dist/menu/menu-trigger.d.mts.map +1 -1
  256. package/dist/menu/menu-trigger.mjs +2 -0
  257. package/dist/menu/menu-trigger.mjs.map +1 -1
  258. package/dist/meter/index.d.mts +2 -0
  259. package/dist/meter/index.d.mts.map +1 -1
  260. package/dist/meter/index.mjs +2 -0
  261. package/dist/meter/index.mjs.map +1 -1
  262. package/dist/meter/meter-indicator.d.mts +11 -0
  263. package/dist/meter/meter-indicator.d.mts.map +1 -1
  264. package/dist/meter/meter-indicator.mjs +2 -0
  265. package/dist/meter/meter-indicator.mjs.map +1 -1
  266. package/dist/meter/meter-label.d.mts +11 -0
  267. package/dist/meter/meter-label.d.mts.map +1 -1
  268. package/dist/meter/meter-label.mjs +2 -0
  269. package/dist/meter/meter-label.mjs.map +1 -1
  270. package/dist/meter/meter-region.d.mts +5 -0
  271. package/dist/meter/meter-region.d.mts.map +1 -1
  272. package/dist/meter/meter-region.mjs.map +1 -1
  273. package/dist/meter/meter-root.d.mts +52 -10
  274. package/dist/meter/meter-root.d.mts.map +1 -1
  275. package/dist/meter/meter-root.mjs +2 -0
  276. package/dist/meter/meter-root.mjs.map +1 -1
  277. package/dist/meter/meter-track.d.mts +11 -0
  278. package/dist/meter/meter-track.d.mts.map +1 -1
  279. package/dist/meter/meter-track.mjs +2 -0
  280. package/dist/meter/meter-track.mjs.map +1 -1
  281. package/dist/meter/meter-value.d.mts +15 -1
  282. package/dist/meter/meter-value.d.mts.map +1 -1
  283. package/dist/meter/meter-value.mjs +2 -0
  284. package/dist/meter/meter-value.mjs.map +1 -1
  285. package/dist/number-field/index.d.mts +2 -0
  286. package/dist/number-field/index.d.mts.map +1 -1
  287. package/dist/number-field/index.mjs +2 -0
  288. package/dist/number-field/index.mjs.map +1 -1
  289. package/dist/number-field/number-field-decrement.d.mts +2 -0
  290. package/dist/number-field/number-field-decrement.d.mts.map +1 -1
  291. package/dist/number-field/number-field-decrement.mjs +2 -0
  292. package/dist/number-field/number-field-decrement.mjs.map +1 -1
  293. package/dist/number-field/number-field-increment.d.mts +2 -0
  294. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  295. package/dist/number-field/number-field-increment.mjs +2 -0
  296. package/dist/number-field/number-field-increment.mjs.map +1 -1
  297. package/dist/number-field/number-field-input.d.mts +9 -0
  298. package/dist/number-field/number-field-input.d.mts.map +1 -1
  299. package/dist/number-field/number-field-input.mjs +2 -0
  300. package/dist/number-field/number-field-input.mjs.map +1 -1
  301. package/dist/number-field/number-field-label.d.mts +10 -0
  302. package/dist/number-field/number-field-label.d.mts.map +1 -1
  303. package/dist/number-field/number-field-label.mjs +2 -0
  304. package/dist/number-field/number-field-label.mjs.map +1 -1
  305. package/dist/number-field/number-field-root.d.mts +62 -14
  306. package/dist/number-field/number-field-root.d.mts.map +1 -1
  307. package/dist/number-field/number-field-root.mjs +2 -0
  308. package/dist/number-field/number-field-root.mjs.map +1 -1
  309. package/dist/number-field/use-step-button.d.mts +20 -0
  310. package/dist/number-field/use-step-button.d.mts.map +1 -1
  311. package/dist/number-field/use-step-button.mjs.map +1 -1
  312. package/dist/popover/index.d.mts +2 -0
  313. package/dist/popover/index.d.mts.map +1 -1
  314. package/dist/popover/index.mjs +2 -0
  315. package/dist/popover/index.mjs.map +1 -1
  316. package/dist/popover/popover-close.d.mts +18 -0
  317. package/dist/popover/popover-close.d.mts.map +1 -1
  318. package/dist/popover/popover-close.mjs +2 -0
  319. package/dist/popover/popover-close.mjs.map +1 -1
  320. package/dist/popover/popover-description.d.mts +12 -0
  321. package/dist/popover/popover-description.d.mts.map +1 -1
  322. package/dist/popover/popover-description.mjs +2 -0
  323. package/dist/popover/popover-description.mjs.map +1 -1
  324. package/dist/popover/popover-popup.d.mts +30 -4
  325. package/dist/popover/popover-popup.d.mts.map +1 -1
  326. package/dist/popover/popover-popup.mjs +2 -0
  327. package/dist/popover/popover-popup.mjs.map +1 -1
  328. package/dist/popover/popover-root.d.mts +9 -0
  329. package/dist/popover/popover-root.d.mts.map +1 -1
  330. package/dist/popover/popover-root.mjs +2 -0
  331. package/dist/popover/popover-root.mjs.map +1 -1
  332. package/dist/popover/popover-title.d.mts +11 -0
  333. package/dist/popover/popover-title.d.mts.map +1 -1
  334. package/dist/popover/popover-title.mjs +2 -0
  335. package/dist/popover/popover-title.mjs.map +1 -1
  336. package/dist/popover/popover-trigger.d.mts +15 -0
  337. package/dist/popover/popover-trigger.d.mts.map +1 -1
  338. package/dist/popover/popover-trigger.mjs +2 -0
  339. package/dist/popover/popover-trigger.mjs.map +1 -1
  340. package/dist/progress/index.d.mts +2 -0
  341. package/dist/progress/index.d.mts.map +1 -1
  342. package/dist/progress/index.mjs +2 -0
  343. package/dist/progress/index.mjs.map +1 -1
  344. package/dist/progress/progress-indicator.d.mts +11 -0
  345. package/dist/progress/progress-indicator.d.mts.map +1 -1
  346. package/dist/progress/progress-indicator.mjs +2 -0
  347. package/dist/progress/progress-indicator.mjs.map +1 -1
  348. package/dist/progress/progress-label.d.mts +11 -0
  349. package/dist/progress/progress-label.d.mts.map +1 -1
  350. package/dist/progress/progress-label.mjs +2 -0
  351. package/dist/progress/progress-label.mjs.map +1 -1
  352. package/dist/progress/progress-root.d.mts +36 -8
  353. package/dist/progress/progress-root.d.mts.map +1 -1
  354. package/dist/progress/progress-root.mjs +2 -0
  355. package/dist/progress/progress-root.mjs.map +1 -1
  356. package/dist/progress/progress-track.d.mts +11 -0
  357. package/dist/progress/progress-track.d.mts.map +1 -1
  358. package/dist/progress/progress-track.mjs +2 -0
  359. package/dist/progress/progress-track.mjs.map +1 -1
  360. package/dist/progress/progress-value.d.mts +15 -1
  361. package/dist/progress/progress-value.d.mts.map +1 -1
  362. package/dist/progress/progress-value.mjs +2 -0
  363. package/dist/progress/progress-value.mjs.map +1 -1
  364. package/dist/radio-group/index.d.mts +2 -0
  365. package/dist/radio-group/index.d.mts.map +1 -1
  366. package/dist/radio-group/index.mjs +2 -0
  367. package/dist/radio-group/index.mjs.map +1 -1
  368. package/dist/radio-group/radio-group-item.d.mts +18 -1
  369. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  370. package/dist/radio-group/radio-group-item.mjs +2 -0
  371. package/dist/radio-group/radio-group-item.mjs.map +1 -1
  372. package/dist/radio-group/radio-group-label.d.mts +10 -0
  373. package/dist/radio-group/radio-group-label.d.mts.map +1 -1
  374. package/dist/radio-group/radio-group-label.mjs +2 -0
  375. package/dist/radio-group/radio-group-label.mjs.map +1 -1
  376. package/dist/radio-group/radio-group-root.d.mts +29 -5
  377. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  378. package/dist/radio-group/radio-group-root.mjs +2 -0
  379. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  380. package/dist/select/index.d.mts +2 -0
  381. package/dist/select/index.d.mts.map +1 -1
  382. package/dist/select/index.mjs +2 -0
  383. package/dist/select/index.mjs.map +1 -1
  384. package/dist/select/select-group-label.d.mts +10 -0
  385. package/dist/select/select-group-label.d.mts.map +1 -1
  386. package/dist/select/select-group-label.mjs +2 -0
  387. package/dist/select/select-group-label.mjs.map +1 -1
  388. package/dist/select/select-group.d.mts +15 -1
  389. package/dist/select/select-group.d.mts.map +1 -1
  390. package/dist/select/select-group.mjs +2 -0
  391. package/dist/select/select-group.mjs.map +1 -1
  392. package/dist/select/select-option.d.mts +19 -1
  393. package/dist/select/select-option.d.mts.map +1 -1
  394. package/dist/select/select-option.mjs +2 -0
  395. package/dist/select/select-option.mjs.map +1 -1
  396. package/dist/select/select-root.d.mts +24 -1
  397. package/dist/select/select-root.d.mts.map +1 -1
  398. package/dist/select/select-root.mjs +2 -0
  399. package/dist/select/select-root.mjs.map +1 -1
  400. package/dist/select/select-separator.d.mts +9 -0
  401. package/dist/select/select-separator.d.mts.map +1 -1
  402. package/dist/select/select-separator.mjs +2 -0
  403. package/dist/select/select-separator.mjs.map +1 -1
  404. package/dist/select/select-trigger.d.mts +9 -0
  405. package/dist/select/select-trigger.d.mts.map +1 -1
  406. package/dist/select/select-trigger.mjs +2 -0
  407. package/dist/select/select-trigger.mjs.map +1 -1
  408. package/dist/select/select-value.d.mts +9 -0
  409. package/dist/select/select-value.d.mts.map +1 -1
  410. package/dist/select/select-value.mjs +2 -0
  411. package/dist/select/select-value.mjs.map +1 -1
  412. package/dist/slider/index.d.mts +2 -0
  413. package/dist/slider/index.d.mts.map +1 -1
  414. package/dist/slider/index.mjs +2 -0
  415. package/dist/slider/index.mjs.map +1 -1
  416. package/dist/slider/slider-indicator.d.mts +12 -0
  417. package/dist/slider/slider-indicator.d.mts.map +1 -1
  418. package/dist/slider/slider-indicator.mjs +2 -0
  419. package/dist/slider/slider-indicator.mjs.map +1 -1
  420. package/dist/slider/slider-label.d.mts +11 -1
  421. package/dist/slider/slider-label.d.mts.map +1 -1
  422. package/dist/slider/slider-label.mjs +2 -0
  423. package/dist/slider/slider-label.mjs.map +1 -1
  424. package/dist/slider/slider-root.d.mts +53 -9
  425. package/dist/slider/slider-root.d.mts.map +1 -1
  426. package/dist/slider/slider-root.mjs +2 -0
  427. package/dist/slider/slider-root.mjs.map +1 -1
  428. package/dist/slider/slider-thumb.d.mts +32 -3
  429. package/dist/slider/slider-thumb.d.mts.map +1 -1
  430. package/dist/slider/slider-thumb.mjs +2 -0
  431. package/dist/slider/slider-thumb.mjs.map +1 -1
  432. package/dist/slider/slider-track.d.mts +17 -0
  433. package/dist/slider/slider-track.d.mts.map +1 -1
  434. package/dist/slider/slider-track.mjs +2 -0
  435. package/dist/slider/slider-track.mjs.map +1 -1
  436. package/dist/slider/slider-value.d.mts +11 -0
  437. package/dist/slider/slider-value.d.mts.map +1 -1
  438. package/dist/slider/slider-value.mjs +2 -0
  439. package/dist/slider/slider-value.mjs.map +1 -1
  440. package/dist/switch/switch.d.mts +23 -3
  441. package/dist/switch/switch.d.mts.map +1 -1
  442. package/dist/switch/switch.mjs +2 -0
  443. package/dist/switch/switch.mjs.map +1 -1
  444. package/dist/tabs/index.d.mts +2 -0
  445. package/dist/tabs/index.d.mts.map +1 -1
  446. package/dist/tabs/index.mjs +2 -0
  447. package/dist/tabs/index.mjs.map +1 -1
  448. package/dist/tabs/tabs-context.d.mts +5 -0
  449. package/dist/tabs/tabs-context.d.mts.map +1 -1
  450. package/dist/tabs/tabs-context.mjs.map +1 -1
  451. package/dist/tabs/tabs-indicator.d.mts +17 -0
  452. package/dist/tabs/tabs-indicator.d.mts.map +1 -1
  453. package/dist/tabs/tabs-indicator.mjs +2 -0
  454. package/dist/tabs/tabs-indicator.mjs.map +1 -1
  455. package/dist/tabs/tabs-list.d.mts +19 -1
  456. package/dist/tabs/tabs-list.d.mts.map +1 -1
  457. package/dist/tabs/tabs-list.mjs +2 -0
  458. package/dist/tabs/tabs-list.mjs.map +1 -1
  459. package/dist/tabs/tabs-panel.d.mts +19 -0
  460. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  461. package/dist/tabs/tabs-panel.mjs +2 -0
  462. package/dist/tabs/tabs-panel.mjs.map +1 -1
  463. package/dist/tabs/tabs-root.d.mts +39 -5
  464. package/dist/tabs/tabs-root.d.mts.map +1 -1
  465. package/dist/tabs/tabs-root.mjs +2 -0
  466. package/dist/tabs/tabs-root.mjs.map +1 -1
  467. package/dist/tabs/tabs-tab.d.mts +22 -1
  468. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  469. package/dist/tabs/tabs-tab.mjs +2 -0
  470. package/dist/tabs/tabs-tab.mjs.map +1 -1
  471. package/dist/toast/index.d.mts +2 -0
  472. package/dist/toast/index.d.mts.map +1 -1
  473. package/dist/toast/index.mjs +2 -0
  474. package/dist/toast/index.mjs.map +1 -1
  475. package/dist/toast/toast-action.d.mts +28 -3
  476. package/dist/toast/toast-action.d.mts.map +1 -1
  477. package/dist/toast/toast-action.mjs +2 -0
  478. package/dist/toast/toast-action.mjs.map +1 -1
  479. package/dist/toast/toast-close.d.mts +16 -0
  480. package/dist/toast/toast-close.d.mts.map +1 -1
  481. package/dist/toast/toast-close.mjs +2 -0
  482. package/dist/toast/toast-close.mjs.map +1 -1
  483. package/dist/toast/toast-description.d.mts +16 -1
  484. package/dist/toast/toast-description.d.mts.map +1 -1
  485. package/dist/toast/toast-description.mjs +2 -0
  486. package/dist/toast/toast-description.mjs.map +1 -1
  487. package/dist/toast/toast-root.d.mts +20 -0
  488. package/dist/toast/toast-root.d.mts.map +1 -1
  489. package/dist/toast/toast-root.mjs +2 -0
  490. package/dist/toast/toast-root.mjs.map +1 -1
  491. package/dist/toast/toast-title.d.mts +15 -1
  492. package/dist/toast/toast-title.d.mts.map +1 -1
  493. package/dist/toast/toast-title.mjs +2 -0
  494. package/dist/toast/toast-title.mjs.map +1 -1
  495. package/dist/toast/toast-viewport.d.mts +34 -5
  496. package/dist/toast/toast-viewport.d.mts.map +1 -1
  497. package/dist/toast/toast-viewport.mjs +2 -0
  498. package/dist/toast/toast-viewport.mjs.map +1 -1
  499. package/dist/toast/toast.d.mts +46 -6
  500. package/dist/toast/toast.d.mts.map +1 -1
  501. package/dist/toast/toast.mjs +4 -0
  502. package/dist/toast/toast.mjs.map +1 -1
  503. package/dist/toggle/toggle.d.mts +20 -2
  504. package/dist/toggle/toggle.d.mts.map +1 -1
  505. package/dist/toggle/toggle.mjs +2 -0
  506. package/dist/toggle/toggle.mjs.map +1 -1
  507. package/dist/toggle-group/index.d.mts +2 -0
  508. package/dist/toggle-group/index.d.mts.map +1 -1
  509. package/dist/toggle-group/index.mjs +2 -0
  510. package/dist/toggle-group/index.mjs.map +1 -1
  511. package/dist/toggle-group/toggle-group-context.d.mts +1 -0
  512. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  513. package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
  514. package/dist/toggle-group/toggle-group-item.d.mts +16 -0
  515. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  516. package/dist/toggle-group/toggle-group-item.mjs +2 -0
  517. package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
  518. package/dist/toggle-group/toggle-group-root.d.mts +73 -12
  519. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  520. package/dist/toggle-group/toggle-group-root.mjs +2 -0
  521. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  522. package/dist/toolbar/index.d.mts +2 -0
  523. package/dist/toolbar/index.d.mts.map +1 -1
  524. package/dist/toolbar/index.mjs +2 -0
  525. package/dist/toolbar/index.mjs.map +1 -1
  526. package/dist/toolbar/toolbar-root.d.mts +30 -3
  527. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  528. package/dist/toolbar/toolbar-root.mjs +2 -0
  529. package/dist/toolbar/toolbar-root.mjs.map +1 -1
  530. package/dist/toolbar/toolbar-separator.d.mts +13 -0
  531. package/dist/toolbar/toolbar-separator.d.mts.map +1 -1
  532. package/dist/toolbar/toolbar-separator.mjs +2 -0
  533. package/dist/toolbar/toolbar-separator.mjs.map +1 -1
  534. package/dist/tooltip/index.d.mts +2 -0
  535. package/dist/tooltip/index.d.mts.map +1 -1
  536. package/dist/tooltip/index.mjs +2 -0
  537. package/dist/tooltip/index.mjs.map +1 -1
  538. package/dist/tooltip/tooltip-arrow.d.mts +16 -0
  539. package/dist/tooltip/tooltip-arrow.d.mts.map +1 -1
  540. package/dist/tooltip/tooltip-arrow.mjs +2 -0
  541. package/dist/tooltip/tooltip-arrow.mjs.map +1 -1
  542. package/dist/tooltip/tooltip-context.d.mts +4 -0
  543. package/dist/tooltip/tooltip-context.d.mts.map +1 -1
  544. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  545. package/dist/tooltip/tooltip-popup.d.mts +24 -3
  546. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  547. package/dist/tooltip/tooltip-popup.mjs +2 -0
  548. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  549. package/dist/tooltip/tooltip-root.d.mts +24 -2
  550. package/dist/tooltip/tooltip-root.d.mts.map +1 -1
  551. package/dist/tooltip/tooltip-root.mjs +2 -0
  552. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  553. package/dist/tooltip/tooltip-trigger.d.mts +18 -1
  554. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  555. package/dist/tooltip/tooltip-trigger.mjs +2 -0
  556. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  557. package/package.json +9 -1
  558. package/skills/funstack-ui-knowledge/SKILL.md +75 -0
@@ -0,0 +1,250 @@
1
+ # Pending & optimistic state
2
+
3
+ Every component that owns state keeps three values for it. Knowing which part of the component shows which value is the key to styling FUNSTACK UI.
4
+
5
+ ## Terms
6
+
7
+ These words are used throughout the documentation. A [part](../getting-started.md#part) is one element-rendering piece of a component, such as `Tabs.Tab`.
8
+
9
+ - **<a id="state-owner"></a>State owner**: The part that holds a piece of state, runs its [action](action-props.md#action) in a transition and decides when the state is committed. For a compound component it is usually the `Root`; a single-element component (a Toggle, a Switch) owns its own state.
10
+ - **<a id="trigger"></a>Trigger**: A part the user acts on to change the state: a button, a tab, a summary, a checkbox. Some components have a part literally named `Trigger`; the concept is wider than that name.
11
+ - **<a id="pure-trigger"></a>Pure trigger**: A trigger whose action changes no state of its own: it runs a task (save, close, confirm). See [A second click while pending](#second-click).
12
+ - **<a id="content-region"></a>Content region (panel)**: A part that shows the content belonging to a state rather than letting the user change it: the content of the selected tab, of an open accordion item, of an open dialog. The docs call it a **panel** when the part is named `Panel`.
13
+ - **<a id="committed"></a>Committed value**: The value the application has accepted: the controlled prop, or, uncontrolled, the internal state written after the action succeeded.
14
+ - **<a id="optimistic"></a>Optimistic value**: The value the user asked for, shown before the action has finished. It is React's `useOptimistic` over the committed value, set at the start of the action.
15
+ - **Pending**: True while an action dispatched through a component is in flight, from the user's interaction until the render that ends it has committed (including a Suspense wait). It is the pending flag of the transition that runs the action: the state owner's, or a pure trigger's own. Field and Form read the form channel (`useFormStatus`) instead.
16
+ - **Rollback**: The optimistic value falling back to the committed one when the action ends without the new value being committed (it rejected, or a controlled parent did not adopt it).
17
+
18
+ ## Triggers are optimistic, content is committed
19
+
20
+ Triggers render the optimistic value, so the user sees their click land at once. Content regions render the committed value. This rule follows from how React works, not from taste. An optimistic update renders synchronously, and a synchronous render that suspends shows the nearest Suspense fallback. If a content region followed the optimistic value, choosing content that loads data would flash a fallback. Because content regions follow the committed value, the old content stays on screen while the new one loads, the trigger already shows the new choice, and the state owner and the trigger are marked pending. When the data is ready, the content swaps in one commit.
21
+
22
+ Example: [Tabs](../components/tabs.md)
23
+
24
+ In Tabs, `Tabs.Tab` and `Tabs.Indicator` are triggers and show the optimistic selection (`aria-selected`, `data-selected`); `Tabs.Panel` is the content region and shows the committed selection; `Tabs.Root` is the state owner. In the tabs below, switching waits for an 800 ms save. The indicator and the tab colour move at once (optimistic); the panel changes when the save resolves (committed). Every third save fails and everything rolls back.
25
+
26
+ ```tsx title="TabsSaved.tsx"
27
+ "use client";
28
+ import { Tabs } from "@funstack/ui/tabs";
29
+ import { DemoErrorBoundary } from "./DemoErrorBoundary.js";
30
+ import { fakeSave } from "./fake-api.js";
31
+
32
+ let saves = 0;
33
+
34
+ // Manual activation with an awaited save: arrow keys only move focus, Enter / Space / click
35
+ // select. The panel switches when the save resolves; every third save rejects, the selection
36
+ // rolls back and the error reaches the Error Boundary. Panels slide by DOM direction through
37
+ // the library's fsui-tabs-next / fsui-tabs-prev transition types.
38
+ export function TabsSaved() {
39
+ return (
40
+ <DemoErrorBoundary>
41
+ <Tabs.Root
42
+ className="demo-tabs"
43
+ defaultValue="profile"
44
+ activationMode="manual"
45
+ valueChangeAction={async (next) => {
46
+ await fakeSave(`tab "${next}"`, { fail: ++saves % 3 === 0 });
47
+ }}
48
+ >
49
+ <Tabs.List className="demo-tabs-list" aria-label="Account settings">
50
+ <Tabs.Tab value="profile" className="demo-tab">
51
+ Profile
52
+ </Tabs.Tab>
53
+ <Tabs.Tab value="billing" className="demo-tab">
54
+ Billing
55
+ </Tabs.Tab>
56
+ <Tabs.Tab value="danger" className="demo-tab" disabled>
57
+ Danger zone
58
+ </Tabs.Tab>
59
+ <Tabs.Tab value="team" className="demo-tab">
60
+ Team
61
+ </Tabs.Tab>
62
+ <Tabs.Indicator className="demo-tabs-indicator" />
63
+ </Tabs.List>
64
+ {["profile", "billing", "danger", "team"].map((value) => (
65
+ <Tabs.Panel
66
+ key={value}
67
+ value={value}
68
+ className="demo-tab-panel"
69
+ transition={{
70
+ "fsui-tabs-next": "demo-slide-next",
71
+ "fsui-tabs-prev": "demo-slide-prev",
72
+ default: "none",
73
+ }}
74
+ >
75
+ <p>The {value} settings.</p>
76
+ </Tabs.Panel>
77
+ ))}
78
+ </Tabs.Root>
79
+ </DemoErrorBoundary>
80
+ );
81
+ }
82
+ ```
83
+
84
+ ```css title="tabs.css"
85
+ /* Tabs: optimistic selection on tabs and the indicator, committed selection on panels. */
86
+ .demo-tabs-list {
87
+ /* The Indicator is absolutely positioned against the Tabs (its anchors) inside the list. */
88
+ position: relative;
89
+ display: flex;
90
+ gap: 4px;
91
+ border-bottom: 1px solid var(--color-border);
92
+ }
93
+
94
+ .demo-tab {
95
+ display: inline-flex;
96
+ align-items: center;
97
+ gap: 0.4em;
98
+ padding: 0.5em 0.9em;
99
+ border: none;
100
+ background: none;
101
+ color: var(--color-text-secondary);
102
+ font: inherit;
103
+ cursor: pointer;
104
+ transition: color 120ms;
105
+ }
106
+
107
+ .demo-tab[data-selected] {
108
+ color: var(--color-primary);
109
+ }
110
+
111
+ .demo-tab[data-pending] {
112
+ cursor: progress;
113
+ }
114
+
115
+ .demo-tab[aria-disabled="true"] {
116
+ opacity: 0.4;
117
+ cursor: not-allowed;
118
+ }
119
+
120
+ .demo-tab:focus-visible {
121
+ outline: 2px solid var(--color-primary);
122
+ outline-offset: -2px;
123
+ }
124
+
125
+ /* CSS Anchor Positioning places the indicator under the optimistic tab; a CSS transition
126
+ slides it. */
127
+ .demo-tabs-indicator {
128
+ position: absolute;
129
+ bottom: -1px;
130
+ left: anchor(left);
131
+ width: anchor-size(width);
132
+ height: 3px;
133
+ border-radius: 2px;
134
+ background: var(--color-primary);
135
+ transition:
136
+ left 200ms ease-out,
137
+ width 200ms ease-out;
138
+ }
139
+
140
+ .demo-tab-panel {
141
+ padding: 12px 4px 0;
142
+ }
143
+
144
+ .demo-tab-panel :is(p, ul) {
145
+ margin: 0 0 12px;
146
+ }
147
+
148
+ /* The old panel stays while the next one loads; dim it after a short delay. */
149
+ .demo-tabs[data-pending] .demo-tab-panel {
150
+ opacity: 0.5;
151
+ transition: opacity 150ms 150ms;
152
+ }
153
+
154
+ /* ViewTransition classes used by the `transition` prop on Tabs.Panel. */
155
+ ::view-transition-old(.demo-slide-next) {
156
+ animation: 180ms ease-in both demo-out-left;
157
+ }
158
+ ::view-transition-new(.demo-slide-next) {
159
+ animation: 180ms ease-out both demo-in-right;
160
+ }
161
+ ::view-transition-old(.demo-slide-prev) {
162
+ animation: 180ms ease-in both demo-out-right;
163
+ }
164
+ ::view-transition-new(.demo-slide-prev) {
165
+ animation: 180ms ease-out both demo-in-left;
166
+ }
167
+
168
+ @keyframes demo-out-left {
169
+ to {
170
+ opacity: 0;
171
+ translate: -2rem 0;
172
+ }
173
+ }
174
+ @keyframes demo-in-right {
175
+ from {
176
+ opacity: 0;
177
+ translate: 2rem 0;
178
+ }
179
+ }
180
+ @keyframes demo-out-right {
181
+ to {
182
+ opacity: 0;
183
+ translate: 2rem 0;
184
+ }
185
+ }
186
+ @keyframes demo-in-left {
187
+ from {
188
+ opacity: 0;
189
+ translate: -2rem 0;
190
+ }
191
+ }
192
+
193
+ @media (prefers-reduced-motion: reduce) {
194
+ ::view-transition-group(*),
195
+ ::view-transition-old(*),
196
+ ::view-transition-new(*) {
197
+ animation: none !important;
198
+ }
199
+ .demo-tabs-indicator,
200
+ .demo-tab {
201
+ transition: none;
202
+ }
203
+ }
204
+ ```
205
+
206
+ Two consequences for triggers:
207
+
208
+ - Content rendered from a trigger's state (its `children` function) must not suspend, or must have its own Suspense boundary.
209
+ - The optimistic flip is a synchronous commit and never starts a view transition. Animate trigger visuals with a CSS `transition` on the data attribute (see [What animates when](transitions.md#what-animates-when)).
210
+
211
+ Each component page lists which of its parts show which value in its **Optimistic and pending** section and its data attributes table.
212
+
213
+ ## Where `data-pending` lands
214
+
215
+ - **On the state owner** while its transition is pending.
216
+ - **On the trigger the user is waiting on**: the one whose optimistic value differs from the committed one, or that started the action. Decorative parts that follow the trigger (an indicator) may mirror it.
217
+ - **Never on content regions.** A content region shows the committed value or nothing; it is never "in between". To dim the old content while the next one loads, select through the state owner.
218
+
219
+ The same names exist in the function props (`className`, `style`, `children` as a function of state): `state.pending`, and the state's own name such as `state.pressed`, `state.selected` or `state.open`.
220
+
221
+ Example: [Tabs](../components/tabs.md)
222
+
223
+ `data-pending` is on `Tabs.Root` and on the `Tabs.Tab` that is the optimistic selection; `Tabs.Indicator` mirrors the Root. The panels never get it, so the CSS selects through the Root:
224
+
225
+ ```css
226
+ .tabs[data-pending] .panel { opacity: 0.6; transition: opacity 150ms 150ms; }
227
+ .tab[data-pending]::after { content: ""; /* spinner */ }
228
+ ```
229
+
230
+ ```tsx
231
+ <Tabs.Tab value="billing">
232
+ {({ pending }) => <>Billing{pending && <Spinner />}</>}
233
+ </Tabs.Tab>
234
+ ```
235
+
236
+ ## <a id="second-click"></a>A second click while pending
237
+
238
+ A trigger that changes state takes every click: a second click on a pending trigger is a new intent, the optimistic value follows it, and the latest intent wins (see [Overlapping actions](action-props.md#overlapping-actions)). A [pure trigger](#pure-trigger) ignores a second click, Enter or Space while its own action is pending, and renders `aria-disabled="true"` for as long as it shows `data-pending`, so a double click never runs a save twice. Neither kind is ever natively disabled, so focus stays where it is.
239
+
240
+ Example: [Button](../components/button.md)
241
+
242
+ A `Button` is a pure trigger. While the promise its `action` returned is pending, it ignores further clicks and carries `aria-disabled`. For a button that should count every click (a "+1"), do not return the promise: `action={() => { void increment(); }}`.
243
+
244
+ ## Rollback
245
+
246
+ If the action rejects, or a controlled parent does not adopt the new value, the optimistic value falls back to the committed one when the transition ends. Nothing has to be undone by hand: uncontrolled state is only written after success.
247
+
248
+ ## Assistive technology
249
+
250
+ ARIA state on a trigger (`aria-pressed`, `aria-selected`, a native input's checked state) follows the optimistic value, so screen reader users get the same immediate feedback as sighted users. Where HTML gives the state to a native element that cannot carry the ARIA attribute, assistive technology hears the committed state and the optimistic data attribute is visual only; the component page says so when that applies (for example [Accordion](../components/accordion.md)). The same holds for the trigger of a popup and for the Combobox input: assistive technology hears whether the popup is shown, and `data-open` is the optimistic state (see [Triggers of a popup](browser-owned-state.md#popup-triggers)).
@@ -0,0 +1,118 @@
1
+ # Server Components
2
+
3
+ A Server Component can render every FUNSTACK UI [part](../getting-started.md#part) directly. Which behaviour works before hydration depends on how much of it the platform does.
4
+
5
+ Hydration is the moment React attaches to server-rendered HTML in the browser: until then the page is plain HTML that the browser alone drives, and afterwards React's event handlers and state are live.
6
+
7
+ ## Per-file `"use client"`
8
+
9
+ The package is built unbundled: one output file per source file, and every file that uses a client-only API keeps its `"use client"` directive. The component namespaces (`Tabs`, `Accordion`, ...) are plain objects of client references, so this works in a Server Component:
10
+
11
+ ```tsx
12
+ // app/settings.tsx: a Server Component, no "use client"
13
+ import { Tabs } from "@funstack/ui/tabs";
14
+
15
+ export function Settings() {
16
+ return (
17
+ <Tabs.Root defaultValue="general">
18
+ <Tabs.List aria-label="Settings">
19
+ <Tabs.Tab value="general">General</Tabs.Tab>
20
+ <Tabs.Tab value="billing">Billing</Tabs.Tab>
21
+ </Tabs.List>
22
+ <Tabs.Panel value="general"><GeneralSettings /></Tabs.Panel>
23
+ <Tabs.Panel value="billing"><BillingSettings /></Tabs.Panel>
24
+ </Tabs.Root>
25
+ );
26
+ }
27
+ ```
28
+
29
+ Compound parts find their Root through context, and a Server Component cannot read context, so parts are client modules. The exceptions are [Progress](../components/progress.md) and [Meter](../components/meter.md): their Roots have no `"use client"` (they only compute, then render a context provider created in a client module), so a Server Component renders the Root on the server, may pass it function props, and only the small context module and the parts reach the browser.
30
+
31
+ Server-rendered ids inside FUNSTACK Static `defer()` need `@funstack/static` 1.3.4 or later; other frameworks that render several server payloads into one page must give each its own `identifierPrefix`, or ids from different payloads can collide.
32
+
33
+ ## <a id="js-free"></a>What "JS-free" means
34
+
35
+ "JS-free" on this site (the [JS-free mode](browser-owned-state.md#js-free-mode) of a component, the native Tooltip path in Chromium) means two things: no behaviour JavaScript runs on the native path, because the browser does the interaction, and the server HTML works before hydration and without it. It does **not** mean "no client bundle". The parts are `"use client"` modules, so in a Server Components app they are shipped and hydrated with the page like any client component, whatever props they receive.
36
+
37
+ For scale, measured on FUNSTACK Static (the stack this site is built with): a page whose Server Components render no client component at all still loads about 76 KB gzip of framework runtime (React, react-dom and the RSC client) and hydrates the document. The parts add a few KB on top: between 2 and 5 KB gzip per component in the ones measured, and less each when several share internals. Other RSC hosts were not measured; Next.js App Router and Waku also boot a client runtime on every page.
38
+
39
+ Where a page really ships no JavaScript, such as server rendering or a static prerender that is never hydrated (`react-dom/static` `prerender`, `renderToString`), `"use client"` has no effect and the parts' HTML works as is, to the extent described under [Before hydration](#before-hydration)below. There is no separate directive-free variant of the parts: it was considered in [issue #19](https://github.com/uhyo/funstack-ui/issues/19) and not built, since it would save those few KB but not the runtime. For a single form control, the component page has a **Plain HTML** section where that is an option: the HTML a Server Component can render instead, and what it gives up (for example [Switch](../components/switch.md)).
40
+
41
+ ## Actions from the server
42
+
43
+ A Server Component can only pass serialisable props, so it cannot pass a plain function as an action. It can pass a Server Function, which works directly because `details` serialises cleanly (see [Action props](action-props.md)):
44
+
45
+ ```tsx
46
+ import { Accordion } from "@funstack/ui/accordion";
47
+ import { saveOpenSections } from "./actions"; // "use server"
48
+
49
+ <Accordion.Root defaultValue={user.openSections} valueChangeAction={saveOpenSections}>
50
+ ...
51
+ </Accordion.Root>
52
+ ```
53
+
54
+ ## Before hydration
55
+
56
+ The server HTML of every part carries its markup, its ARIA attributes and its data attributes, so it is accessible and styled from the first paint. What the user can _do_ before hydration depends on who performs the interaction:
57
+
58
+ - **Behaviour the browser performs** works before hydration and without JavaScript: a `<details>` that opens, a native input that toggles and posts with its form, a dialog opened by an invoker command, a tooltip shown on interest (where the engine implements `interestfor`). Components are built on these elements wherever the platform offers them (see [Browser-owned state](browser-owned-state.md)).
59
+ - **Behaviour the library performs** (a transition, an action, keyboard navigation the platform lacks, content rendered on demand) starts at hydration. Until then the part shows its server state and does nothing on interaction, or falls back to what the native element does.
60
+ - **Changes the browser made before hydration are not lost.** When a native element's state differs from the server's at hydration (an item opened, a box checked, text typed), the component reconciles on mount with one dispatch (for a continuous control, one step and one commit), with `details.reason === "platform"` (see [Action props](action-props.md)).
61
+ - **Server Function actions** on native form paths (a `formAction`, a form's `action`) submit before hydration through React's progressive enhancement.
62
+
63
+ Each component page says exactly what works before hydration in its **Before hydration** section.
64
+
65
+ Example: [Accordion](../components/accordion.md)
66
+
67
+ An Accordion without value props runs in JS-free mode: the browser owns every `<details open>`, so opening and closing, the exclusive group and find-in-page all work before hydration; hydration only adds arrow-key navigation and `disabled`. With value props (library mode) the native toggle still works before hydration, and items opened then are reconciled on mount with one `valueChangeAction` call.
68
+
69
+ This FAQ is rendered by a Server Component in JS-free mode. It opens and closes before the page has hydrated, and in any page that works without JavaScript. (This site streams each page behind a Suspense boundary, which needs a small inline script to reveal it, so here it needs JavaScript enabled, but not the library's.)
70
+
71
+ ```tsx title="AccordionFaq.tsx"
72
+ // No "use client": this file is a Server Component. The Accordion has no value props, so it runs
73
+ // in JS-free mode: the browser owns <details open>, `exclusive` becomes the native `name` group,
74
+ // and opening an item works before hydration (and with JavaScript off).
75
+ import { Accordion } from "@funstack/ui/accordion";
76
+
77
+ const faq = [
78
+ {
79
+ id: "what",
80
+ question: "What is FUNSTACK UI?",
81
+ answer:
82
+ "A headless React component library built for Async React: transitions by default, action props, Suspense-native content.",
83
+ },
84
+ {
85
+ id: "js",
86
+ question: "Does this accordion need JavaScript?",
87
+ answer:
88
+ "No. It renders <details> and <summary>. Try your browser's find-in-page for the word zeppelin: the browser opens the matching item by itself.",
89
+ },
90
+ {
91
+ id: "zeppelin",
92
+ question: "Is anything hidden in here?",
93
+ answer: "Only a zeppelin, to show that closed items stay searchable.",
94
+ },
95
+ ];
96
+
97
+ export function AccordionFaq() {
98
+ return (
99
+ <Accordion.Root exclusive className="demo-accordion">
100
+ {faq.map((item, index) => (
101
+ <Accordion.Item
102
+ key={item.id}
103
+ value={item.id}
104
+ defaultOpen={index === 0}
105
+ className="demo-accordion-item"
106
+ >
107
+ <Accordion.Trigger className="demo-accordion-trigger">
108
+ <h4>{item.question}</h4>
109
+ </Accordion.Trigger>
110
+ <Accordion.Panel className="demo-accordion-panel">
111
+ <p>{item.answer}</p>
112
+ </Accordion.Panel>
113
+ </Accordion.Item>
114
+ ))}
115
+ </Accordion.Root>
116
+ );
117
+ }
118
+ ```
@@ -0,0 +1,124 @@
1
+ # Suspense
2
+
3
+ Suspending children are the normal case, not an edge case. Content that reads data with `use()` works inside any FUNSTACK UI [content region](pending-and-optimistic.md#content-region) without extra props.
4
+
5
+ ## You own the boundaries
6
+
7
+ The library never wraps `children` in `<Suspense>` and has no `fallback` props. Where a fallback appears is a layout decision, so it is yours. Put a boundary wherever you would put one without the library, for example above the whole component.
8
+
9
+ ## What happens when new content suspends
10
+
11
+ A change of state is a transition, and content regions follow the [committed value](pending-and-optimistic.md#committed). When the content for the new value suspends, React keeps the current content on screen instead of showing the fallback, because during a transition React does not hide content that is already visible behind a fallback. Meanwhile the [trigger](pending-and-optimistic.md#trigger) already shows the new value (optimistic), and the state owner and the trigger carry `data-pending`. When the data arrives, the new content replaces the old in one commit. If the user changes their mind while waiting, only the latest choice is ever committed.
12
+
13
+ Example: [Tabs](../components/tabs.md)
14
+
15
+ Selecting a tab whose panel suspends keeps the current panel on screen; the new tab is already selected and the Root and that tab carry `data-pending`. Pressing arrow keys quickly with automatic activation dispatches one selection per key; the latest one wins, and only its panel is committed.
16
+
17
+ ```tsx title="TabsSuspending.tsx"
18
+ "use client";
19
+ import { Suspense, use, useState } from "react";
20
+ import { Tabs } from "@funstack/ui/tabs";
21
+ import { sleep } from "./fake-api.js";
22
+
23
+ // Cache the promises so `use()` sees the same one on every render.
24
+ const cache = new Map<string, Promise<string[]>>();
25
+ function loadOrders(status: string): Promise<string[]> {
26
+ let promise = cache.get(status);
27
+ if (promise === undefined) {
28
+ promise = sleep(1200).then(() => [1, 2, 3].map((n) => `${status} order #${n}0${n}`));
29
+ cache.set(status, promise);
30
+ }
31
+ return promise;
32
+ }
33
+
34
+ function Orders({ status }: { status: string }) {
35
+ const orders = use(loadOrders(status));
36
+ return (
37
+ <ul>
38
+ {orders.map((order) => (
39
+ <li key={order}>{order}</li>
40
+ ))}
41
+ </ul>
42
+ );
43
+ }
44
+
45
+ const statuses = ["Open", "Shipped", "Returned"];
46
+ const tabs = ["Summary", ...statuses];
47
+
48
+ // Panels suspend while their data loads. The Suspense boundary sits above Tabs.Root, yet its
49
+ // fallback never replaces a loaded panel: selection is a transition, so the old panel stays
50
+ // (dimmed through .demo-tabs[data-pending]) and the selected tab shows a spinner.
51
+ export function TabsSuspending() {
52
+ const [generation, setGeneration] = useState(0);
53
+ return (
54
+ <>
55
+ <Suspense key={generation} fallback={<p>Loading orders…</p>}>
56
+ <Tabs.Root className="demo-tabs" defaultValue="Summary">
57
+ <Tabs.List className="demo-tabs-list" aria-label="Orders">
58
+ {tabs.map((status) => (
59
+ <Tabs.Tab key={status} value={status} className="demo-tab">
60
+ {({ pending }) => (
61
+ <>
62
+ {status}
63
+ {pending && <span className="demo-spinner" aria-hidden />}
64
+ </>
65
+ )}
66
+ </Tabs.Tab>
67
+ ))}
68
+ <Tabs.Indicator className="demo-tabs-indicator" />
69
+ </Tabs.List>
70
+ {/* The first panel needs no data, so the server-rendered HTML is complete. */}
71
+ <Tabs.Panel value="Summary" className="demo-tab-panel">
72
+ <p>Pick a status. Each list takes 1.2 s to load the first time.</p>
73
+ </Tabs.Panel>
74
+ {statuses.map((status) => (
75
+ <Tabs.Panel key={status} value={status} className="demo-tab-panel">
76
+ <Orders status={status} />
77
+ </Tabs.Panel>
78
+ ))}
79
+ </Tabs.Root>
80
+ </Suspense>
81
+ <button
82
+ type="button"
83
+ className="demo-button"
84
+ onClick={() => {
85
+ cache.clear();
86
+ setGeneration((g) => g + 1);
87
+ }}
88
+ >
89
+ Clear the cache and start over
90
+ </button>
91
+ </>
92
+ );
93
+ }
94
+ ```
95
+
96
+ The same rule has two more shapes. Content that is hidden until a state opens it waits in the closed state: the trigger is pending, and the open happens once, complete. Content that is re-rendered for a new input (a search) keeps the previous result on screen, marked stale, until the next one is ready. Each component page describes its case in its **Suspense** section.
97
+
98
+ Example: [Accordion](../components/accordion.md#suspense)
99
+
100
+ `Accordion.Panel` is always mounted; its function child receives the committed `open` state, which is how content is mounted lazily. In library mode, if that content suspends, the item stays closed with the trigger pending until the content is ready, then opens.
101
+
102
+ Example: [Combobox](../components/combobox.md#suspense)
103
+
104
+ A Combobox renders its results from `useDeferredValue` of the typed text, so an async search is `use(search(query))` inside a boundary in the List. The first load shows the fallback (a new boundary); after that, every keystroke keeps the previous results on screen, marked `data-stale` and `aria-busy`, until the new ones are ready. Only the latest query is ever rendered, so responses cannot arrive out of order.
105
+
106
+ ## Opting into a fallback
107
+
108
+ A boundary that mounts with the new content shows its fallback immediately (a React rule). That is the way to say "show a skeleton instead of waiting". Put the boundary inside the content region:
109
+
110
+ Example: [Tabs](../components/tabs.md)
111
+
112
+ ```tsx
113
+ <Tabs.Panel value="orders">
114
+ <Suspense fallback={<OrdersSkeleton />}>
115
+ <Orders />
116
+ </Suspense>
117
+ </Tabs.Panel>
118
+ ```
119
+
120
+ To get a fresh fallback per tab rather than a wait, key the boundary: `<Suspense key={tab}>`.
121
+
122
+ ## What must not suspend
123
+
124
+ [Trigger](pending-and-optimistic.md#trigger) content is rendered from [optimistic state](pending-and-optimistic.md#optimistic), which updates synchronously, and a synchronous render that suspends shows a fallback. A `children` function on a trigger must not suspend, or must have its own boundary inside the trigger. The props tables mark these props "must not suspend". Content that a component renders ahead of time, before it is shown, follows the same rule: keep it static or put the boundary inside the part that shows it.
@@ -0,0 +1,118 @@
1
+ # Transitions & ViewTransition
2
+
3
+ Every state change the library makes is a React transition. That is what lets React keep old content on screen, and it is also what lets `<ViewTransition>` animate the change.
4
+
5
+ ## Terms
6
+
7
+ - **<a id="commit"></a>Commit**: The moment React applies a finished render to the DOM. One user interaction can lead to several commits: the synchronous one that shows the [optimistic value](pending-and-optimistic.md#optimistic), and the transition commit that ends the action.
8
+ - **View transition**: The browser's View Transition API: it snapshots the page before and after a DOM change and animates between the two. React starts one for a transition commit when a `<ViewTransition>` boundary in the tree is affected.
9
+ - **Transition type**: A string attached to a transition with React's `addTransitionType`. A `<ViewTransition>` can pick its animation by type, and CSS can match it with `:active-view-transition-type()`.
10
+
11
+ ## <a id="transition-prop"></a>The `transition` prop
12
+
13
+ Each part whose mount, unmount or content is driven by library state has a `transition` prop. When you pass it, the part renders a `<ViewTransition default={transition}>` as the outermost node of its output; without it, the part renders no boundary at all. The value has exactly React's type: `"auto"`, `"none"`, a View Transition class, or a map from transition type to class.
14
+
15
+ Treat `transition` as static. Changing it between `undefined` and a value remounts the part (development warns); switching between `"none"` and a class does not. Any value, `"none"` and a type map that does not match included, has a cost: when the part mounts or is revealed in a transition (a tab switch with `keepMounted` `false` or `true`, a part inside a dialog that opens), React starts a document view transition. The browser then cross-fades the whole page for 250 ms, and the next transition commit waits for it.
16
+
17
+ Example: [Tabs](../components/tabs.md)
18
+
19
+ `Tabs.Panel` takes `transition`, which animates the swap from one panel to the next. A class animates every swap; a type map picks a slide direction from the Tabs transition types:
20
+
21
+ ```tsx
22
+ <Tabs.Panel value="billing" transition="fade">...</Tabs.Panel>
23
+
24
+ <Tabs.Panel
25
+ value="billing"
26
+ transition={{ "fsui-tabs-next": "slide-left", "fsui-tabs-prev": "slide-right", default: "none" }}
27
+ >
28
+ ...
29
+ </Tabs.Panel>
30
+ ```
31
+
32
+ ```css
33
+ ::view-transition-old(.slide-left) { animation: 160ms ease-in both slide-out-left; }
34
+ ::view-transition-new(.slide-left) { animation: 160ms ease-out both slide-in-right; }
35
+
36
+ @media (prefers-reduced-motion: reduce) {
37
+ ::view-transition-group(*),
38
+ ::view-transition-old(*),
39
+ ::view-transition-new(*) { animation: none !important; }
40
+ }
41
+ ```
42
+
43
+ The library ships no animation, so there is nothing to turn off for reduced motion; keep the media query above in your own stylesheet.
44
+
45
+ If you want only your own named animations, you can opt out of the page cross-fade with the CSS below. It is optional and applies to every view transition on the page, including your router's. The last rule keeps clicks working during a transition in Firefox, which otherwise suppresses hit testing.
46
+
47
+ ```css
48
+ ::view-transition-old(root),
49
+ ::view-transition-new(root) { animation: none; }
50
+ /* or: :root { view-transition-name: none; } */
51
+
52
+ ::view-transition { pointer-events: none; }
53
+ ```
54
+
55
+ ## Transition types
56
+
57
+ Each dispatch adds `fsui-<component>` and, where the change has a direction or kind, `fsui-<component>-<change>` through `addTransitionType`. A few examples:
58
+
59
+ | Component | Types |
60
+ | - | - |
61
+ | Toggle | `fsui-toggle`, `fsui-toggle-press`, `fsui-toggle-release` |
62
+ | Tabs | `fsui-tabs`, `fsui-tabs-next`, `fsui-tabs-prev` (DOM order of the new tab relative to the committed one) |
63
+ | Dialog | `fsui-dialog`, `fsui-dialog-open`, `fsui-dialog-close` |
64
+
65
+ Every component page lists its own types, or says that it has none, in its **Transition types** section. Components whose state never changes in a transition add none: their commits are urgent, or their state belongs to the browser.
66
+
67
+ Use them in a `transition` map, or in CSS with `:active-view-transition-type(fsui-tabs-next)`. Types you add yourself with `addTransitionType` in the synchronous part of an action join the same transition.
68
+
69
+ Types are attached only to the commit that ends a dispatched action. A rollback after a rejection, or a controlled parent snapping the value back, carries no `fsui-*` type: a type map needs a `default` entry if rollbacks should animate.
70
+
71
+ ## What animates when
72
+
73
+ React starts a view transition only for commits made entirely of transition lanes (a lane is React's priority class for an update; transitions have their own). The optimistic flip is a synchronous commit, so it never animates through `<ViewTransition>`. What to animate with depends on which value the part renders (see [the three values](pending-and-optimistic.md#terms)):
74
+
75
+ | The part renders | Animate with |
76
+ | - | - |
77
+ | optimistic state (a trigger) | a CSS `transition` on the data attribute |
78
+ | committed state (a content region) | the `transition` prop |
79
+ | the end of pending, or a rollback | the `transition` prop |
80
+ | [browser-owned state](browser-owned-state.md) | CSS: `@starting-style`, `transition-behavior: allow-discrete` |
81
+
82
+ Example: [Tabs](../components/tabs.md)
83
+
84
+ `Tabs.Tab` renders the optimistic selection: animate its colour with a CSS transition on `[data-selected]`. `Tabs.Indicator` follows the optimistic tab with CSS Anchor Positioning, so a plain CSS transition on its inset properties makes it slide on click and slide back on rollback. `Tabs.Panel` renders the committed selection: animate the swap with its `transition` prop. A spinner rendered from the Tab's `pending` state disappears in the commit that ends the action, which the Tab's own `transition` prop can animate.
85
+
86
+ ### <a id="css-exit"></a>A popup with a CSS exit and a view transition
87
+
88
+ A popup in the top layer can close two ways. A close the library performs (a part's close, a controlled `open={false}`) happens in a commit, so the popup's `transition` prop can animate it with a view transition in every engine. A [dismissal](browser-owned-state.md#dismissal) happens in the browser before React hears about it, so only a CSS exit (`@starting-style`, `transition-behavior: allow-discrete`) can animate it. Keep both, and turn the CSS exit off while a view transition runs:
89
+
90
+ ```css
91
+ html:active-view-transition .my-popup { transition: none; }
92
+ ```
93
+
94
+ Without that rule, a popup the library hides keeps rendering through its CSS fade, and Chromium captures it in the close's new snapshot as well as the old one: a double image. The selector has no transition type on purpose, because a controlled close carries none. The cost is that an unrelated view transition of the page also cuts a CSS fade in progress. Put the rule on the whole popup class, so that nested popups that close with their parent are covered too.
95
+
96
+ Example: [Dialog](../components/dialog.md)
97
+
98
+ A Dialog with a CSS fade for Escape and a click outside, and a view transition for its Close parts:
99
+
100
+ ```tsx
101
+ <Dialog.Popup className="dialog" transition={{ "fsui-dialog-open": "pop", "fsui-dialog-close": "pop", default: "none" }}>
102
+ ```
103
+
104
+ ```css
105
+ .dialog { opacity: 0; transition: opacity 150ms, display 150ms allow-discrete, overlay 150ms allow-discrete; }
106
+ .dialog:open { opacity: 1; }
107
+ @starting-style { .dialog:open { opacity: 0; } }
108
+ ::view-transition-new(.pop) { animation: 180ms ease-out both pop-in; }
109
+ ::view-transition-old(.pop) { animation: 140ms ease-in both pop-out; }
110
+ /* Keep the CSS exit for dismissals, but not while a view transition runs. */
111
+ html:active-view-transition .dialog { transition: none; }
112
+ ```
113
+
114
+ ## Rules the library follows for you
115
+
116
+ - It never calls `document.startViewTransition` and never uses `flushSync`.
117
+ - `<ViewTransition>` renders no DOM and is safe in server-rendered trees; hydration is not a transition, so nothing animates on first paint.
118
+ - [Content regions](pending-and-optimistic.md#content-region) kept mounted while hidden (Tabs `keepMounted`) switch their `<Activity>` mode inside the library's transition, so nested `<ViewTransition>` boundaries get enter and exit animations.