@lattice-php/lattice 0.17.2 → 0.19.0

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 (748) hide show
  1. package/README.md +1 -1
  2. package/dist/action/components/action-form.d.ts +2 -2
  3. package/dist/action/components/action-form.js +11 -11
  4. package/dist/action/components/action-form.js.map +1 -1
  5. package/dist/action/components/action-group.d.ts +1 -1
  6. package/dist/action/components/action-group.js +6 -4
  7. package/dist/action/components/action-group.js.map +1 -1
  8. package/dist/action/components/action-trigger-provider.d.ts +10 -0
  9. package/dist/action/components/action-trigger-provider.js +24 -0
  10. package/dist/action/components/action-trigger-provider.js.map +1 -0
  11. package/dist/action/components/action.d.ts +1 -1
  12. package/dist/action/components/action.js +4 -4
  13. package/dist/action/components/action.js.map +1 -1
  14. package/dist/action/{use-action.d.ts → hooks/use-action.d.ts} +1 -1
  15. package/dist/action/{use-action.js → hooks/use-action.js} +7 -7
  16. package/dist/action/hooks/use-action.js.map +1 -0
  17. package/dist/action/index.d.ts +10 -1
  18. package/dist/action/index.js +8 -13
  19. package/dist/action/{run-action.d.ts → lib/run-action.d.ts} +1 -1
  20. package/dist/action/{run-action.js → lib/run-action.js} +2 -2
  21. package/dist/action/lib/run-action.js.map +1 -0
  22. package/dist/action/plugin.d.ts +1 -0
  23. package/dist/action/plugin.js +15 -0
  24. package/dist/action/plugin.js.map +1 -0
  25. package/dist/appearance/index.d.ts +4 -1
  26. package/dist/appearance/index.js +11 -2
  27. package/dist/appearance/index.js.map +1 -1
  28. package/dist/chat/components/chat-box.d.ts +1 -1
  29. package/dist/chat/components/chat-box.js +2 -2
  30. package/dist/chat/components/chat-box.js.map +1 -1
  31. package/dist/chat/components/message-list.d.ts +1 -1
  32. package/dist/chat/components/message-list.js.map +1 -1
  33. package/dist/chat/components/message.d.ts +1 -1
  34. package/dist/chat/components/message.js.map +1 -1
  35. package/dist/chat/components/prompt-input.js +1 -1
  36. package/dist/chat/components/prompt-input.js.map +1 -1
  37. package/dist/chat/{use-chat.d.ts → hooks/use-chat.d.ts} +1 -1
  38. package/dist/chat/{use-chat.js → hooks/use-chat.js} +2 -2
  39. package/dist/chat/hooks/use-chat.js.map +1 -0
  40. package/dist/chat/index.d.ts +4 -1
  41. package/dist/chat/index.js +3 -17
  42. package/dist/chat/{transport.d.ts → lib/transport.d.ts} +2 -2
  43. package/dist/chat/{transport.js → lib/transport.js} +2 -2
  44. package/dist/chat/lib/transport.js.map +1 -0
  45. package/dist/chat/parts/text.d.ts +1 -1
  46. package/dist/chat/parts/tool-call.d.ts +1 -1
  47. package/dist/chat/plugin.d.ts +2 -0
  48. package/dist/chat/plugin.js +17 -0
  49. package/dist/chat/plugin.js.map +1 -0
  50. package/dist/chat/types.d.ts +2 -2
  51. package/dist/clipboard/index.d.ts +1 -2
  52. package/dist/clipboard/index.js +1 -10
  53. package/dist/clipboard/index.js.map +1 -1
  54. package/dist/core/api.d.ts +1 -1
  55. package/dist/core/api.js.map +1 -1
  56. package/dist/core/headers.js.map +1 -1
  57. package/dist/core/{column-sizing.d.ts → hooks/column-sizing.d.ts} +2 -2
  58. package/dist/core/{column-sizing.js → hooks/column-sizing.js} +1 -1
  59. package/dist/core/hooks/column-sizing.js.map +1 -0
  60. package/dist/core/{use-column-resizing.d.ts → hooks/use-column-resizing.d.ts} +2 -1
  61. package/dist/core/{use-column-resizing.js → hooks/use-column-resizing.js} +59 -31
  62. package/dist/core/hooks/use-column-resizing.js.map +1 -0
  63. package/dist/core/index.d.ts +13 -0
  64. package/dist/core/index.js +10 -0
  65. package/dist/core/materialize.d.ts +9 -0
  66. package/dist/core/materialize.js +39 -0
  67. package/dist/core/materialize.js.map +1 -0
  68. package/dist/core/nodes.d.ts +6 -1
  69. package/dist/core/nodes.js +8 -1
  70. package/dist/core/nodes.js.map +1 -1
  71. package/dist/core/registry-context.d.ts +3 -3
  72. package/dist/core/registry-context.js.map +1 -1
  73. package/dist/core/registry.d.ts +5 -3
  74. package/dist/core/registry.js.map +1 -1
  75. package/dist/core/renderer.d.ts +1 -1
  76. package/dist/core/renderer.js +4 -6
  77. package/dist/core/renderer.js.map +1 -1
  78. package/dist/core/test-id.d.ts +1 -1
  79. package/dist/core/types.d.ts +1 -1
  80. package/dist/create-app.d.ts +3 -3
  81. package/dist/effects/dispatch.d.ts +2 -2
  82. package/dist/effects/registry.d.ts +4 -3
  83. package/dist/effects/registry.js +7 -7
  84. package/dist/effects/registry.js.map +1 -1
  85. package/dist/effects/use-effect-dispatcher.d.ts +1 -1
  86. package/dist/{events/event-bridge.d.ts → event-bridge.d.ts} +2 -3
  87. package/dist/{events/event-bridge.js → event-bridge.js} +4 -11
  88. package/dist/event-bridge.js.map +1 -0
  89. package/dist/events/event-names.d.ts +0 -3
  90. package/dist/events/event-names.js +0 -3
  91. package/dist/events/event-names.js.map +1 -1
  92. package/dist/form/components/base/field.d.ts +1 -1
  93. package/dist/form/components/base/field.js +5 -5
  94. package/dist/form/components/base/field.js.map +1 -1
  95. package/dist/form/components/base/submit-button.d.ts +1 -1
  96. package/dist/form/components/base/submit-button.js +3 -3
  97. package/dist/form/components/base/submit-button.js.map +1 -1
  98. package/dist/form/components/fields/{block-add-menu.d.ts → add-row-menu.d.ts} +3 -3
  99. package/dist/form/components/fields/{block-add-menu.js → add-row-menu.js} +10 -10
  100. package/dist/form/components/fields/add-row-menu.js.map +1 -0
  101. package/dist/form/components/fields/builder.d.ts +1 -1
  102. package/dist/form/components/fields/builder.js +80 -75
  103. package/dist/form/components/fields/builder.js.map +1 -1
  104. package/dist/form/components/fields/checkbox.d.ts +1 -1
  105. package/dist/form/components/fields/checkbox.js +12 -9
  106. package/dist/form/components/fields/checkbox.js.map +1 -1
  107. package/dist/form/components/fields/choice.d.ts +1 -1
  108. package/dist/form/components/fields/choice.js +4 -4
  109. package/dist/form/components/fields/choice.js.map +1 -1
  110. package/dist/form/components/fields/date-input.d.ts +1 -1
  111. package/dist/form/components/fields/date-picker-field.js +2 -2
  112. package/dist/form/components/fields/date-picker-field.js.map +1 -1
  113. package/dist/form/components/fields/date-picker.d.ts +1 -1
  114. package/dist/form/components/fields/date-time-input.d.ts +1 -1
  115. package/dist/form/components/fields/file-upload.d.ts +1 -1
  116. package/dist/form/components/fields/file-upload.js +4 -4
  117. package/dist/form/components/fields/file-upload.js.map +1 -1
  118. package/dist/form/components/fields/hidden-input.d.ts +1 -1
  119. package/dist/form/components/fields/hidden-input.js +1 -1
  120. package/dist/form/components/fields/hidden-input.js.map +1 -1
  121. package/dist/form/components/fields/number-input.d.ts +1 -1
  122. package/dist/form/components/fields/number-input.js +2 -2
  123. package/dist/form/components/fields/number-input.js.map +1 -1
  124. package/dist/form/components/fields/otp-input.d.ts +1 -1
  125. package/dist/form/components/fields/otp-input.js +1 -1
  126. package/dist/form/components/fields/otp-input.js.map +1 -1
  127. package/dist/form/components/fields/password-input.d.ts +1 -1
  128. package/dist/form/components/fields/password-input.js +6 -6
  129. package/dist/form/components/fields/password-input.js.map +1 -1
  130. package/dist/form/components/fields/repeater-rows.d.ts +6 -1
  131. package/dist/form/components/fields/repeater-rows.js +9 -5
  132. package/dist/form/components/fields/repeater-rows.js.map +1 -1
  133. package/dist/form/components/fields/repeater.d.ts +1 -1
  134. package/dist/form/components/fields/repeater.js +57 -48
  135. package/dist/form/components/fields/repeater.js.map +1 -1
  136. package/dist/form/components/fields/rich-editor-field.d.ts +1 -1
  137. package/dist/form/components/fields/rich-editor-field.js +8 -6
  138. package/dist/form/components/fields/rich-editor-field.js.map +1 -1
  139. package/dist/form/components/fields/rich-editor.d.ts +1 -1
  140. package/dist/form/components/fields/row-action-menu.d.ts +2 -2
  141. package/dist/form/components/fields/row-actions.js +1 -1
  142. package/dist/form/components/fields/row-actions.js.map +1 -1
  143. package/dist/form/components/fields/row-item.d.ts +3 -3
  144. package/dist/form/components/fields/row-item.js +3 -2
  145. package/dist/form/components/fields/row-item.js.map +1 -1
  146. package/dist/form/components/fields/row-key-inputs.d.ts +7 -0
  147. package/dist/form/components/fields/row-key-inputs.js +16 -0
  148. package/dist/form/components/fields/row-key-inputs.js.map +1 -0
  149. package/dist/form/components/fields/row-templates.d.ts +9 -0
  150. package/dist/form/components/fields/row-templates.js +14 -0
  151. package/dist/form/components/fields/row-templates.js.map +1 -0
  152. package/dist/form/components/fields/select.d.ts +1 -1
  153. package/dist/form/components/fields/select.js +23 -13
  154. package/dist/form/components/fields/select.js.map +1 -1
  155. package/dist/form/components/fields/simple-field.d.ts +2 -2
  156. package/dist/form/components/fields/simple-field.js +2 -2
  157. package/dist/form/components/fields/simple-field.js.map +1 -1
  158. package/dist/form/components/fields/table-rows.d.ts +3 -3
  159. package/dist/form/components/fields/table-rows.js +13 -13
  160. package/dist/form/components/fields/table-rows.js.map +1 -1
  161. package/dist/form/components/fields/text-input.d.ts +1 -1
  162. package/dist/form/components/fields/text-input.js +2 -2
  163. package/dist/form/components/fields/text-input.js.map +1 -1
  164. package/dist/form/components/fields/textarea.d.ts +1 -1
  165. package/dist/form/components/fields/textarea.js +1 -1
  166. package/dist/form/components/fields/textarea.js.map +1 -1
  167. package/dist/form/components/fields/time-input.d.ts +1 -1
  168. package/dist/form/components/fields/time-input.js +3 -3
  169. package/dist/form/components/fields/time-input.js.map +1 -1
  170. package/dist/form/components/fields/time-picker.d.ts +1 -1
  171. package/dist/form/components/fields/toggle.d.ts +1 -1
  172. package/dist/form/components/fields/toggle.js +10 -9
  173. package/dist/form/components/fields/toggle.js.map +1 -1
  174. package/dist/form/components/fields/use-row-collection.d.ts +1 -1
  175. package/dist/form/components/fields/use-row-collection.js +2 -2
  176. package/dist/form/components/fields/use-row-collection.js.map +1 -1
  177. package/dist/form/components/form.d.ts +1 -1
  178. package/dist/form/components/form.js +6 -6
  179. package/dist/form/components/form.js.map +1 -1
  180. package/dist/form/components/index.d.ts +17 -17
  181. package/dist/form/embed.d.ts +17 -0
  182. package/dist/form/embed.js +10 -0
  183. package/dist/form/{components → hooks}/context.d.ts +3 -0
  184. package/dist/form/{components → hooks}/context.js +2 -1
  185. package/dist/form/hooks/context.js.map +1 -0
  186. package/dist/form/{components → hooks}/field-scope.js +3 -3
  187. package/dist/form/hooks/field-scope.js.map +1 -0
  188. package/dist/form/{components → hooks}/prefill-context.js +1 -1
  189. package/dist/form/hooks/prefill-context.js.map +1 -0
  190. package/dist/form/{components → hooks}/resolved-nodes.d.ts +1 -1
  191. package/dist/form/{components → hooks}/resolved-nodes.js +2 -2
  192. package/dist/form/hooks/resolved-nodes.js.map +1 -0
  193. package/dist/form/{components → hooks}/row-layout-context.js +1 -1
  194. package/dist/form/hooks/row-layout-context.js.map +1 -0
  195. package/dist/form/{components → hooks}/use-controlled-field.d.ts +2 -2
  196. package/dist/form/{components → hooks}/use-controlled-field.js +6 -5
  197. package/dist/form/hooks/use-controlled-field.js.map +1 -0
  198. package/dist/form/hooks/use-dependent-field.d.ts +3 -0
  199. package/dist/form/{components → hooks}/use-dependent-field.js +6 -6
  200. package/dist/form/hooks/use-dependent-field.js.map +1 -0
  201. package/dist/form/{components → hooks}/use-field-commit.d.ts +5 -0
  202. package/dist/form/{components → hooks}/use-field-commit.js +9 -2
  203. package/dist/form/hooks/use-field-commit.js.map +1 -0
  204. package/dist/form/{components → hooks}/use-form-resolver.d.ts +2 -2
  205. package/dist/form/{components → hooks}/use-form-resolver.js +5 -5
  206. package/dist/form/hooks/use-form-resolver.js.map +1 -0
  207. package/dist/form/{components → hooks}/use-seed-default.js +1 -1
  208. package/dist/form/hooks/use-seed-default.js.map +1 -0
  209. package/dist/form/{components → hooks}/values.d.ts +3 -1
  210. package/dist/form/hooks/values.js +136 -0
  211. package/dist/form/hooks/values.js.map +1 -0
  212. package/dist/form/index.d.ts +4 -1
  213. package/dist/form/index.js +3 -30
  214. package/dist/form/{components → lib}/conditions.d.ts +2 -1
  215. package/dist/form/{components → lib}/conditions.js +12 -2
  216. package/dist/form/lib/conditions.js.map +1 -0
  217. package/dist/form/lib/field-dom-name.d.ts +1 -0
  218. package/dist/form/lib/field-dom-name.js +10 -0
  219. package/dist/form/lib/field-dom-name.js.map +1 -0
  220. package/dist/form/{components → lib}/field-props.d.ts +2 -3
  221. package/dist/form/{components → lib}/field-props.js +1 -1
  222. package/dist/form/lib/field-props.js.map +1 -0
  223. package/dist/form/{components → lib}/form-path.js +1 -1
  224. package/dist/form/lib/form-path.js.map +1 -0
  225. package/dist/form/{components → lib}/form-transport.d.ts +1 -1
  226. package/dist/form/lib/form-transport.js +21 -0
  227. package/dist/form/lib/form-transport.js.map +1 -0
  228. package/dist/form/lib/override-keys.js +12 -0
  229. package/dist/form/lib/override-keys.js.map +1 -0
  230. package/dist/form/{components → lib}/prefill-targets.d.ts +2 -2
  231. package/dist/form/{components → lib}/prefill-targets.js +4 -5
  232. package/dist/form/lib/prefill-targets.js.map +1 -0
  233. package/dist/form/plugin.d.ts +1 -0
  234. package/dist/form/plugin.js +47 -0
  235. package/dist/form/plugin.js.map +1 -0
  236. package/dist/form/toolkit.d.ts +17 -0
  237. package/dist/form/toolkit.js +14 -0
  238. package/dist/form/{components/types.d.ts → types.d.ts} +3 -3
  239. package/dist/format/number.d.ts +1 -1
  240. package/dist/format/value.d.ts +1 -1
  241. package/dist/i18n/backend.d.ts +1 -1
  242. package/dist/i18n/config.d.ts +1 -1
  243. package/dist/i18n/index.d.ts +13 -13
  244. package/dist/i18n/locale-reload.js +1 -1
  245. package/dist/i18n/locale-reload.js.map +1 -1
  246. package/dist/i18n/locale.js.map +1 -1
  247. package/dist/i18n/page-props.d.ts +1 -1
  248. package/dist/i18n/timezone.js.map +1 -1
  249. package/dist/i18n/translatable.d.ts +1 -1
  250. package/dist/icons/icon-renderer.js.map +1 -1
  251. package/dist/icons/index.d.ts +4 -4
  252. package/dist/icons/sprite.js.map +1 -1
  253. package/dist/index.d.ts +37 -38
  254. package/dist/index.js +10 -9
  255. package/dist/inertia.js +1 -1
  256. package/dist/lattice.css +12 -10
  257. package/dist/layout/{breadcrumbs.d.ts → components/breadcrumbs.d.ts} +1 -1
  258. package/dist/layout/{breadcrumbs.js → components/breadcrumbs.js} +2 -2
  259. package/dist/layout/components/breadcrumbs.js.map +1 -0
  260. package/dist/layout/{callouts.d.ts → components/callouts.d.ts} +1 -1
  261. package/dist/layout/{callouts.js → components/callouts.js} +7 -7
  262. package/dist/layout/components/callouts.js.map +1 -0
  263. package/dist/layout/{dropdown.d.ts → components/dropdown.d.ts} +1 -1
  264. package/dist/layout/{dropdown.js → components/dropdown.js} +2 -2
  265. package/dist/layout/components/dropdown.js.map +1 -0
  266. package/dist/layout/{menu-item.d.ts → components/menu-item.d.ts} +1 -1
  267. package/dist/layout/{menu-item.js → components/menu-item.js} +9 -8
  268. package/dist/layout/components/menu-item.js.map +1 -0
  269. package/dist/layout/{menu.d.ts → components/menu.d.ts} +1 -1
  270. package/dist/layout/{menu.js → components/menu.js} +2 -2
  271. package/dist/layout/components/menu.js.map +1 -0
  272. package/dist/layout/{outlet.d.ts → components/outlet.d.ts} +1 -1
  273. package/dist/layout/{outlet.js → components/outlet.js} +2 -2
  274. package/dist/layout/components/outlet.js.map +1 -0
  275. package/dist/layout/{popover.js → components/popover.js} +4 -4
  276. package/dist/layout/components/popover.js.map +1 -0
  277. package/dist/layout/{schema-layout.js → components/schema-layout.js} +3 -3
  278. package/dist/layout/components/schema-layout.js.map +1 -0
  279. package/dist/layout/{sidebar.d.ts → components/sidebar.d.ts} +1 -1
  280. package/dist/layout/{sidebar.js → components/sidebar.js} +5 -5
  281. package/dist/layout/components/sidebar.js.map +1 -0
  282. package/dist/layout/{topbar.d.ts → components/topbar.d.ts} +1 -1
  283. package/dist/layout/{topbar.js → components/topbar.js} +3 -3
  284. package/dist/layout/components/topbar.js.map +1 -0
  285. package/dist/layout/{context.d.ts → hooks/context.d.ts} +1 -1
  286. package/dist/layout/{context.js → hooks/context.js} +2 -2
  287. package/dist/layout/hooks/context.js.map +1 -0
  288. package/dist/layout/index.d.ts +4 -4
  289. package/dist/layout/index.js +4 -4
  290. package/dist/layout/plugin.d.ts +2 -0
  291. package/dist/layout/{components.js → plugin.js} +10 -10
  292. package/dist/layout/plugin.js.map +1 -0
  293. package/dist/notifications/api.d.ts +1 -1
  294. package/dist/notifications/components/notification-item.d.ts +1 -1
  295. package/dist/notifications/components/notification-item.js.map +1 -1
  296. package/dist/notifications/components/notification-list.d.ts +2 -2
  297. package/dist/notifications/components/notification-list.js +1 -1
  298. package/dist/notifications/components/notification-list.js.map +1 -1
  299. package/dist/notifications/components/notifications-echo.d.ts +1 -1
  300. package/dist/notifications/components/notifications-echo.js.map +1 -1
  301. package/dist/notifications/components/notifications.d.ts +1 -1
  302. package/dist/notifications/components/notifications.js +3 -3
  303. package/dist/notifications/components/notifications.js.map +1 -1
  304. package/dist/notifications/index.d.ts +2 -1
  305. package/dist/notifications/index.js +1 -10
  306. package/dist/notifications/plugin.d.ts +2 -0
  307. package/dist/notifications/plugin.js +11 -0
  308. package/dist/notifications/plugin.js.map +1 -0
  309. package/dist/notifications/store.d.ts +1 -1
  310. package/dist/notifications/types.d.ts +1 -1
  311. package/dist/page.d.ts +1 -1
  312. package/dist/provider-base.d.ts +2 -2
  313. package/dist/provider-base.js +5 -4
  314. package/dist/provider-base.js.map +1 -1
  315. package/dist/provider.d.ts +3 -3
  316. package/dist/realtime/build-effects.d.ts +2 -2
  317. package/dist/realtime/listeners.d.ts +1 -1
  318. package/dist/realtime/subscriptions.d.ts +1 -1
  319. package/dist/registry.d.ts +1 -1
  320. package/dist/registry.js +9 -9
  321. package/dist/registry.js.map +1 -1
  322. package/dist/remote/components/data-list.d.ts +2 -2
  323. package/dist/remote/components/data-list.js +1 -34
  324. package/dist/remote/components/data-list.js.map +1 -1
  325. package/dist/remote/index.d.ts +1 -1
  326. package/dist/remote/index.js +1 -10
  327. package/dist/remote/plugin.d.ts +2 -0
  328. package/dist/remote/plugin.js +11 -0
  329. package/dist/remote/plugin.js.map +1 -0
  330. package/dist/table/components/bulk-bar.d.ts +1 -1
  331. package/dist/table/components/bulk-bar.js +4 -4
  332. package/dist/table/components/bulk-bar.js.map +1 -1
  333. package/dist/table/components/cells/badge-cell.d.ts +1 -1
  334. package/dist/table/components/cells/badge-cell.js +1 -1
  335. package/dist/table/components/cells/badge-cell.js.map +1 -1
  336. package/dist/table/components/cells/boolean-cell.d.ts +1 -1
  337. package/dist/table/components/cells/boolean-cell.js.map +1 -1
  338. package/dist/table/components/cells/icon-cell.d.ts +1 -1
  339. package/dist/table/components/cells/icon-cell.js.map +1 -1
  340. package/dist/table/components/cells/image-cell.d.ts +1 -1
  341. package/dist/table/components/cells/image-cell.js +1 -1
  342. package/dist/table/components/cells/image-cell.js.map +1 -1
  343. package/dist/table/components/cells/money-cell.d.ts +1 -1
  344. package/dist/table/components/cells/money-cell.js +1 -1
  345. package/dist/table/components/cells/money-cell.js.map +1 -1
  346. package/dist/table/components/cells/number-cell.d.ts +1 -1
  347. package/dist/table/components/cells/number-cell.js +1 -1
  348. package/dist/table/components/cells/number-cell.js.map +1 -1
  349. package/dist/table/components/cells/stack-cell.d.ts +1 -1
  350. package/dist/table/components/cells/stack-cell.js +3 -7
  351. package/dist/table/components/cells/stack-cell.js.map +1 -1
  352. package/dist/table/components/cells/text-cell.d.ts +1 -1
  353. package/dist/table/components/cells/text-cell.js +4 -4
  354. package/dist/table/components/cells/text-cell.js.map +1 -1
  355. package/dist/table/components/column-filter-control.d.ts +3 -3
  356. package/dist/table/components/column-filter-control.js +34 -19
  357. package/dist/table/components/column-filter-control.js.map +1 -1
  358. package/dist/table/components/column-header.d.ts +1 -1
  359. package/dist/table/components/column-header.js +7 -7
  360. package/dist/table/components/column-header.js.map +1 -1
  361. package/dist/table/components/column-visibility-menu.d.ts +1 -1
  362. package/dist/table/components/column-visibility-menu.js +3 -3
  363. package/dist/table/components/column-visibility-menu.js.map +1 -1
  364. package/dist/table/components/filter-bar.d.ts +9 -7
  365. package/dist/table/components/filter-bar.js +62 -52
  366. package/dist/table/components/filter-bar.js.map +1 -1
  367. package/dist/table/components/filter-controls.d.ts +5 -9
  368. package/dist/table/components/filter-controls.js +96 -224
  369. package/dist/table/components/filter-controls.js.map +1 -1
  370. package/dist/table/components/filter-value-input.d.ts +1 -1
  371. package/dist/table/components/filter-value-input.js +1 -1
  372. package/dist/table/components/filter-value-input.js.map +1 -1
  373. package/dist/table/components/pagination.d.ts +2 -2
  374. package/dist/table/components/pagination.js.map +1 -1
  375. package/dist/table/components/sort-bar.d.ts +1 -1
  376. package/dist/table/components/sort-bar.js +2 -2
  377. package/dist/table/components/sort-bar.js.map +1 -1
  378. package/dist/table/components/table-action-node.d.ts +1 -1
  379. package/dist/table/components/table-action-node.js +1 -1
  380. package/dist/table/components/table-action-node.js.map +1 -1
  381. package/dist/table/components/table-cell.d.ts +1 -1
  382. package/dist/table/components/table-cell.js +2 -2
  383. package/dist/table/components/table-cell.js.map +1 -1
  384. package/dist/table/components/table.d.ts +1 -1
  385. package/dist/table/components/table.js +23 -31
  386. package/dist/table/components/table.js.map +1 -1
  387. package/dist/{core → table/hooks}/use-column-visibility.d.ts +5 -3
  388. package/dist/{core → table/hooks}/use-column-visibility.js +4 -4
  389. package/dist/table/hooks/use-column-visibility.js.map +1 -0
  390. package/dist/table/{use-table-selection.js → hooks/use-table-selection.js} +1 -1
  391. package/dist/table/hooks/use-table-selection.js.map +1 -0
  392. package/dist/table/{use-table.d.ts → hooks/use-table.d.ts} +7 -7
  393. package/dist/table/{use-table.js → hooks/use-table.js} +12 -9
  394. package/dist/table/hooks/use-table.js.map +1 -0
  395. package/dist/table/index.d.ts +6 -1
  396. package/dist/table/index.js +5 -11
  397. package/dist/table/{align.d.ts → lib/align.d.ts} +1 -1
  398. package/dist/table/{align.js → lib/align.js} +1 -1
  399. package/dist/table/lib/align.js.map +1 -0
  400. package/dist/table/{bulk.d.ts → lib/bulk.d.ts} +3 -3
  401. package/dist/table/{bulk.js → lib/bulk.js} +1 -1
  402. package/dist/table/lib/bulk.js.map +1 -0
  403. package/dist/table/{filter-values.d.ts → lib/filter-values.d.ts} +10 -3
  404. package/dist/table/{filter-values.js → lib/filter-values.js} +14 -4
  405. package/dist/table/lib/filter-values.js.map +1 -0
  406. package/dist/table/{format.d.ts → lib/format.d.ts} +2 -2
  407. package/dist/table/{format.js → lib/format.js} +3 -3
  408. package/dist/table/lib/format.js.map +1 -0
  409. package/dist/table/{payload.d.ts → lib/payload.d.ts} +2 -3
  410. package/dist/table/{payload.js → lib/payload.js} +12 -9
  411. package/dist/table/lib/payload.js.map +1 -0
  412. package/dist/table/{query.d.ts → lib/query.d.ts} +3 -3
  413. package/dist/table/{query.js → lib/query.js} +27 -27
  414. package/dist/table/lib/query.js.map +1 -0
  415. package/dist/table/plugin.d.ts +2 -0
  416. package/dist/table/plugin.js +11 -0
  417. package/dist/table/plugin.js.map +1 -0
  418. package/dist/table/registry.d.ts +3 -1
  419. package/dist/table/registry.js.map +1 -1
  420. package/dist/table/types.d.ts +57 -7
  421. package/dist/toast/callout.d.ts +1 -1
  422. package/dist/toast/callout.js.map +1 -1
  423. package/dist/toast/index.d.ts +6 -5
  424. package/dist/toast/index.js +2 -1
  425. package/dist/toast/toast.d.ts +1 -1
  426. package/dist/toast/toaster.js.map +1 -1
  427. package/dist/toast/variant-styles.d.ts +1 -1
  428. package/dist/types/generated.d.ts +118 -64
  429. package/dist/types/index.d.ts +1 -1
  430. package/dist/{action/components → ui}/action-menu-context.js +1 -1
  431. package/dist/ui/action-menu-context.js.map +1 -0
  432. package/dist/{form/components/base → ui}/affix-group.d.ts +1 -1
  433. package/dist/{form/components/base → ui}/affix-group.js +3 -3
  434. package/dist/ui/affix-group.js.map +1 -0
  435. package/dist/{core/components → ui}/badge.d.ts +1 -1
  436. package/dist/{core/components → ui}/badge.js +2 -2
  437. package/dist/ui/badge.js.map +1 -0
  438. package/dist/{core/components → ui}/button.d.ts +2 -2
  439. package/dist/{core/components → ui}/button.js +5 -5
  440. package/dist/ui/button.js.map +1 -0
  441. package/dist/{core/components → ui}/card.d.ts +1 -1
  442. package/dist/{core/components → ui}/card.js +3 -3
  443. package/dist/ui/card.js.map +1 -0
  444. package/dist/{core/components → ui}/chart-view.d.ts +1 -1
  445. package/dist/{core/components → ui}/chart-view.js +5 -5
  446. package/dist/ui/chart-view.js.map +1 -0
  447. package/dist/{core/components → ui}/chart.d.ts +1 -1
  448. package/dist/{core/components → ui}/chart.js +1 -1
  449. package/dist/ui/chart.js.map +1 -0
  450. package/dist/{core/components → ui}/checkbox.js +3 -3
  451. package/dist/ui/checkbox.js.map +1 -0
  452. package/dist/{core/use-click-behavior.d.ts → ui/click-behavior.d.ts} +17 -19
  453. package/dist/ui/click-behavior.js +46 -0
  454. package/dist/ui/click-behavior.js.map +1 -0
  455. package/dist/{core/components → ui}/collapsible.d.ts +1 -1
  456. package/dist/{core/components → ui}/collapsible.js +6 -6
  457. package/dist/ui/collapsible.js.map +1 -0
  458. package/dist/{core/components → ui}/combobox.d.ts +1 -1
  459. package/dist/{core/components → ui}/combobox.js +4 -4
  460. package/dist/ui/combobox.js.map +1 -0
  461. package/dist/{core/components → ui}/confirm-dialog.d.ts +1 -1
  462. package/dist/{core/components → ui}/confirm-dialog.js +1 -1
  463. package/dist/ui/confirm-dialog.js.map +1 -0
  464. package/dist/{core/components → ui}/control.d.ts +1 -1
  465. package/dist/{core/components → ui}/control.js +1 -1
  466. package/dist/ui/control.js.map +1 -0
  467. package/dist/{clipboard → ui}/copyable-text.d.ts +1 -0
  468. package/dist/{clipboard → ui}/copyable-text.js +11 -3
  469. package/dist/ui/copyable-text.js.map +1 -0
  470. package/dist/{core/components → ui}/dialog.js +3 -3
  471. package/dist/ui/dialog.js.map +1 -0
  472. package/dist/{core/components → ui}/dropdown-menu.d.ts +1 -1
  473. package/dist/{core/components → ui}/dropdown-menu.js +3 -3
  474. package/dist/ui/dropdown-menu.js.map +1 -0
  475. package/dist/{core/components → ui}/floating-panel.d.ts +1 -1
  476. package/dist/{core/components → ui}/floating-panel.js +4 -4
  477. package/dist/ui/floating-panel.js.map +1 -0
  478. package/dist/{core/components → ui}/fragment.d.ts +1 -1
  479. package/dist/{core/components → ui}/fragment.js +5 -5
  480. package/dist/ui/fragment.js.map +1 -0
  481. package/dist/{core/components → ui}/grid.d.ts +1 -1
  482. package/dist/{core/components → ui}/grid.js +3 -3
  483. package/dist/ui/grid.js.map +1 -0
  484. package/dist/{core/components → ui}/heading.d.ts +1 -1
  485. package/dist/{core/components → ui}/heading.js +2 -2
  486. package/dist/ui/heading.js.map +1 -0
  487. package/dist/{core/components → ui}/icon.d.ts +1 -1
  488. package/dist/{core/components → ui}/icon.js +3 -3
  489. package/dist/ui/icon.js.map +1 -0
  490. package/dist/ui/index.d.ts +27 -0
  491. package/dist/ui/index.js +26 -0
  492. package/dist/{core/components → ui}/info-tooltip.js +3 -3
  493. package/dist/ui/info-tooltip.js.map +1 -0
  494. package/dist/{form/components/base → ui}/input-error.js +2 -2
  495. package/dist/ui/input-error.js.map +1 -0
  496. package/dist/{form/components/base → ui}/input-otp.js +2 -2
  497. package/dist/ui/input-otp.js.map +1 -0
  498. package/dist/{form/components/base → ui}/input.js +3 -3
  499. package/dist/ui/input.js.map +1 -0
  500. package/dist/{form/components/base → ui}/label.js +2 -2
  501. package/dist/ui/label.js.map +1 -0
  502. package/dist/{core/components → ui}/link.d.ts +1 -1
  503. package/dist/{core/components → ui}/link.js +8 -7
  504. package/dist/ui/link.js.map +1 -0
  505. package/dist/{core/components → ui}/modal.d.ts +1 -1
  506. package/dist/{core/components → ui}/modal.js +2 -2
  507. package/dist/ui/modal.js.map +1 -0
  508. package/dist/{form/components/base → ui}/password-input.js +3 -3
  509. package/dist/ui/password-input.js.map +1 -0
  510. package/dist/ui/plugin.d.ts +1 -0
  511. package/dist/{core/components/index.js → ui/plugin.js} +6 -6
  512. package/dist/ui/plugin.js.map +1 -0
  513. package/dist/{core/components → ui}/popover.js +2 -2
  514. package/dist/ui/popover.js.map +1 -0
  515. package/dist/{core/components → ui}/raw-block.d.ts +1 -1
  516. package/dist/{core/components → ui}/raw-block.js +1 -1
  517. package/dist/ui/raw-block.js.map +1 -0
  518. package/dist/{core/components → ui}/section.d.ts +1 -1
  519. package/dist/{core/components → ui}/section.js +6 -6
  520. package/dist/ui/section.js.map +1 -0
  521. package/dist/{core/components → ui}/segmented-control.d.ts +1 -1
  522. package/dist/{core/components → ui}/segmented-control.js +1 -1
  523. package/dist/ui/segmented-control.js.map +1 -0
  524. package/dist/{core/components → ui}/segmented-pills.d.ts +1 -1
  525. package/dist/{core/components → ui}/segmented-pills.js +2 -2
  526. package/dist/ui/segmented-pills.js.map +1 -0
  527. package/dist/{core/components → ui}/skeleton.js +2 -2
  528. package/dist/ui/skeleton.js.map +1 -0
  529. package/dist/{core/components → ui}/spinner.js +4 -4
  530. package/dist/ui/spinner.js.map +1 -0
  531. package/dist/{core/components → ui}/stack.d.ts +1 -1
  532. package/dist/{core/components → ui}/stack.js +3 -3
  533. package/dist/ui/stack.js.map +1 -0
  534. package/dist/{core/components → ui}/tabs.d.ts +1 -1
  535. package/dist/{core/components → ui}/tabs.js +3 -3
  536. package/dist/ui/tabs.js.map +1 -0
  537. package/dist/{core/components → ui}/text.d.ts +1 -1
  538. package/dist/{core/components → ui}/text.js +4 -4
  539. package/dist/ui/text.js.map +1 -0
  540. package/dist/{form/components/base → ui}/textarea.js +3 -3
  541. package/dist/ui/textarea.js.map +1 -0
  542. package/dist/{core/components → ui}/tooltip.d.ts +1 -1
  543. package/dist/{core/components → ui}/tooltip.js +3 -3
  544. package/dist/ui/tooltip.js.map +1 -0
  545. package/dist/vite.js +2 -2
  546. package/dist/vite.js.map +1 -1
  547. package/dist-standalone/chunks/chart-view-CK5fKIkR.js +36 -0
  548. package/dist-standalone/chunks/date-picker-field-BlCPFhZd.js +1 -0
  549. package/dist-standalone/chunks/dist-PaT1gYi_.js +2 -0
  550. package/dist-standalone/chunks/jsx-runtime-CJ_btYLc.js +1 -0
  551. package/dist-standalone/chunks/notifications-echo-DsfNc4Ge.js +1 -0
  552. package/dist-standalone/chunks/react-B8IZ02wI.js +1 -0
  553. package/dist-standalone/chunks/rich-editor-field-DH5dS5c1.js +154 -0
  554. package/dist-standalone/chunks/subscriptions-B3UuDBmx.js +1 -0
  555. package/dist-standalone/chunks/test-id-Dh3L6Gfh.js +1 -0
  556. package/dist-standalone/chunks/use-effect-dispatcher-k98Nzf9M.js +97 -0
  557. package/dist-standalone/chunks/with-selector-BwDoCrJJ.js +1 -0
  558. package/dist-standalone/lattice.css +3 -0
  559. package/dist-standalone/lattice.js +66 -0
  560. package/dist-standalone/manifest.json +18 -0
  561. package/dist-standalone/sprite.svg +1 -0
  562. package/package.json +33 -95
  563. package/resources/icons/align-center.svg +1 -1
  564. package/resources/icons/align-justify.svg +1 -1
  565. package/resources/icons/align-left.svg +1 -1
  566. package/resources/icons/align-right.svg +1 -1
  567. package/resources/icons/arrow-down.svg +1 -1
  568. package/resources/icons/arrow-up.svg +1 -1
  569. package/resources/icons/bell.svg +1 -1
  570. package/resources/icons/bold.svg +1 -1
  571. package/resources/icons/calendar.svg +1 -1
  572. package/resources/icons/check.svg +1 -1
  573. package/resources/icons/chevron-down.svg +1 -1
  574. package/resources/icons/chevron-left.svg +1 -1
  575. package/resources/icons/chevron-right.svg +1 -1
  576. package/resources/icons/chevrons-up-down.svg +1 -1
  577. package/resources/icons/circle-alert.svg +1 -1
  578. package/resources/icons/circle-check.svg +1 -1
  579. package/resources/icons/circle-help.svg +1 -1
  580. package/resources/icons/circle-x.svg +1 -1
  581. package/resources/icons/clock.svg +1 -1
  582. package/resources/icons/code.svg +1 -1
  583. package/resources/icons/columns-3.svg +1 -1
  584. package/resources/icons/copy.svg +1 -1
  585. package/resources/icons/external-link.svg +1 -1
  586. package/resources/icons/eye-off.svg +1 -1
  587. package/resources/icons/eye.svg +1 -1
  588. package/resources/icons/filter.svg +1 -1
  589. package/resources/icons/heading-1.svg +1 -1
  590. package/resources/icons/heading-2.svg +1 -1
  591. package/resources/icons/heading-3.svg +1 -1
  592. package/resources/icons/highlighter.svg +1 -1
  593. package/resources/icons/info.svg +1 -1
  594. package/resources/icons/italic.svg +1 -1
  595. package/resources/icons/layout-dashboard.svg +1 -1
  596. package/resources/icons/link.svg +1 -1
  597. package/resources/icons/list-ordered.svg +1 -1
  598. package/resources/icons/list.svg +1 -1
  599. package/resources/icons/loader-2.svg +1 -1
  600. package/resources/icons/minus.svg +1 -1
  601. package/resources/icons/more-horizontal.svg +1 -1
  602. package/resources/icons/panel-left.svg +1 -1
  603. package/resources/icons/pencil-line.svg +1 -1
  604. package/resources/icons/pencil.svg +1 -1
  605. package/resources/icons/plus.svg +1 -1
  606. package/resources/icons/quote.svg +1 -1
  607. package/resources/icons/rotate-ccw.svg +1 -1
  608. package/resources/icons/rows-3.svg +1 -1
  609. package/resources/icons/search.svg +1 -1
  610. package/resources/icons/send.svg +1 -1
  611. package/resources/icons/settings.svg +1 -1
  612. package/resources/icons/smile.svg +1 -1
  613. package/resources/icons/strikethrough.svg +1 -1
  614. package/resources/icons/table.svg +1 -1
  615. package/resources/icons/trash-2.svg +1 -1
  616. package/resources/icons/underline.svg +1 -1
  617. package/resources/icons/x.svg +1 -1
  618. package/dist/action/components/action-menu-context.js.map +0 -1
  619. package/dist/action/index.js.map +0 -1
  620. package/dist/action/run-action.js.map +0 -1
  621. package/dist/action/use-action.js.map +0 -1
  622. package/dist/chat/index.js.map +0 -1
  623. package/dist/chat/transport.js.map +0 -1
  624. package/dist/chat/use-chat.js.map +0 -1
  625. package/dist/clipboard/copyable-text.js.map +0 -1
  626. package/dist/core/column-sizing.js.map +0 -1
  627. package/dist/core/components/badge.js.map +0 -1
  628. package/dist/core/components/button.js.map +0 -1
  629. package/dist/core/components/card.js.map +0 -1
  630. package/dist/core/components/chart-view.js.map +0 -1
  631. package/dist/core/components/chart.js.map +0 -1
  632. package/dist/core/components/checkbox.js.map +0 -1
  633. package/dist/core/components/collapsible.js.map +0 -1
  634. package/dist/core/components/combobox.js.map +0 -1
  635. package/dist/core/components/confirm-dialog.js.map +0 -1
  636. package/dist/core/components/control.js.map +0 -1
  637. package/dist/core/components/dialog.js.map +0 -1
  638. package/dist/core/components/dropdown-menu.js.map +0 -1
  639. package/dist/core/components/floating-panel.js.map +0 -1
  640. package/dist/core/components/fragment.js.map +0 -1
  641. package/dist/core/components/grid.js.map +0 -1
  642. package/dist/core/components/heading.js.map +0 -1
  643. package/dist/core/components/icon.js.map +0 -1
  644. package/dist/core/components/index.d.ts +0 -1
  645. package/dist/core/components/index.js.map +0 -1
  646. package/dist/core/components/info-tooltip.js.map +0 -1
  647. package/dist/core/components/link.js.map +0 -1
  648. package/dist/core/components/modal.js.map +0 -1
  649. package/dist/core/components/popover.js.map +0 -1
  650. package/dist/core/components/raw-block.js.map +0 -1
  651. package/dist/core/components/section.js.map +0 -1
  652. package/dist/core/components/segmented-control.js.map +0 -1
  653. package/dist/core/components/segmented-pills.js.map +0 -1
  654. package/dist/core/components/skeleton.js.map +0 -1
  655. package/dist/core/components/spinner.js.map +0 -1
  656. package/dist/core/components/stack.js.map +0 -1
  657. package/dist/core/components/tabs.js.map +0 -1
  658. package/dist/core/components/text.js.map +0 -1
  659. package/dist/core/components/tooltip.js.map +0 -1
  660. package/dist/core/use-click-behavior.js +0 -46
  661. package/dist/core/use-click-behavior.js.map +0 -1
  662. package/dist/core/use-column-resizing.js.map +0 -1
  663. package/dist/core/use-column-visibility.js.map +0 -1
  664. package/dist/events/event-bridge.js.map +0 -1
  665. package/dist/form/components/base/affix-group.js.map +0 -1
  666. package/dist/form/components/base/input-error.js.map +0 -1
  667. package/dist/form/components/base/input-otp.js.map +0 -1
  668. package/dist/form/components/base/input.js.map +0 -1
  669. package/dist/form/components/base/label.js.map +0 -1
  670. package/dist/form/components/base/password-input.js.map +0 -1
  671. package/dist/form/components/base/textarea.js.map +0 -1
  672. package/dist/form/components/conditions.js.map +0 -1
  673. package/dist/form/components/context.js.map +0 -1
  674. package/dist/form/components/field-props.js.map +0 -1
  675. package/dist/form/components/field-scope.js.map +0 -1
  676. package/dist/form/components/fields/block-add-menu.js.map +0 -1
  677. package/dist/form/components/form-path.js.map +0 -1
  678. package/dist/form/components/form-transport.js +0 -30
  679. package/dist/form/components/form-transport.js.map +0 -1
  680. package/dist/form/components/override-keys.js +0 -12
  681. package/dist/form/components/override-keys.js.map +0 -1
  682. package/dist/form/components/prefill-context.js.map +0 -1
  683. package/dist/form/components/prefill-targets.js.map +0 -1
  684. package/dist/form/components/resolved-nodes.js.map +0 -1
  685. package/dist/form/components/row-layout-context.js.map +0 -1
  686. package/dist/form/components/use-controlled-field.js.map +0 -1
  687. package/dist/form/components/use-dependent-field.d.ts +0 -3
  688. package/dist/form/components/use-dependent-field.js.map +0 -1
  689. package/dist/form/components/use-field-commit.js.map +0 -1
  690. package/dist/form/components/use-form-resolver.js.map +0 -1
  691. package/dist/form/components/use-seed-default.js.map +0 -1
  692. package/dist/form/components/values.js +0 -52
  693. package/dist/form/components/values.js.map +0 -1
  694. package/dist/form/index.js.map +0 -1
  695. package/dist/layout/breadcrumbs.js.map +0 -1
  696. package/dist/layout/callouts.js.map +0 -1
  697. package/dist/layout/components.d.ts +0 -1
  698. package/dist/layout/components.js.map +0 -1
  699. package/dist/layout/context.js.map +0 -1
  700. package/dist/layout/dropdown.js.map +0 -1
  701. package/dist/layout/menu-item.js.map +0 -1
  702. package/dist/layout/menu.js.map +0 -1
  703. package/dist/layout/outlet.js.map +0 -1
  704. package/dist/layout/popover.js.map +0 -1
  705. package/dist/layout/schema-layout.js.map +0 -1
  706. package/dist/layout/sidebar.js.map +0 -1
  707. package/dist/layout/topbar.js.map +0 -1
  708. package/dist/notifications/index.js.map +0 -1
  709. package/dist/remote/index.js.map +0 -1
  710. package/dist/svg-sprite-client/index.d.ts +0 -1
  711. package/dist/svg-sprite-client/index.js +0 -0
  712. package/dist/table/align.js.map +0 -1
  713. package/dist/table/bulk.js.map +0 -1
  714. package/dist/table/components/filter-stack-bar.d.ts +0 -7
  715. package/dist/table/components/filter-stack-bar.js +0 -38
  716. package/dist/table/components/filter-stack-bar.js.map +0 -1
  717. package/dist/table/filter-values.js.map +0 -1
  718. package/dist/table/format.js.map +0 -1
  719. package/dist/table/index.js.map +0 -1
  720. package/dist/table/payload.js.map +0 -1
  721. package/dist/table/query.js.map +0 -1
  722. package/dist/table/use-table-selection.js.map +0 -1
  723. package/dist/table/use-table.js.map +0 -1
  724. package/dist/types/generated.js +0 -0
  725. package/dist/types/index.js +0 -0
  726. /package/dist/form/{components → hooks}/field-scope.d.ts +0 -0
  727. /package/dist/form/{components → hooks}/prefill-context.d.ts +0 -0
  728. /package/dist/form/{components → hooks}/row-layout-context.d.ts +0 -0
  729. /package/dist/form/{components → hooks}/use-seed-default.d.ts +0 -0
  730. /package/dist/form/{components → lib}/form-path.d.ts +0 -0
  731. /package/dist/form/{components → lib}/override-keys.d.ts +0 -0
  732. /package/dist/form/{components/types.js → types.js} +0 -0
  733. /package/dist/layout/{popover.d.ts → components/popover.d.ts} +0 -0
  734. /package/dist/layout/{schema-layout.d.ts → components/schema-layout.d.ts} +0 -0
  735. /package/dist/table/{use-table-selection.d.ts → hooks/use-table-selection.d.ts} +0 -0
  736. /package/dist/{action/components → ui}/action-menu-context.d.ts +0 -0
  737. /package/dist/{core/components → ui}/checkbox.d.ts +0 -0
  738. /package/dist/{core/components → ui}/dialog.d.ts +0 -0
  739. /package/dist/{core/components → ui}/info-tooltip.d.ts +0 -0
  740. /package/dist/{form/components/base → ui}/input-error.d.ts +0 -0
  741. /package/dist/{form/components/base → ui}/input-otp.d.ts +0 -0
  742. /package/dist/{form/components/base → ui}/input.d.ts +0 -0
  743. /package/dist/{form/components/base → ui}/label.d.ts +0 -0
  744. /package/dist/{form/components/base → ui}/password-input.d.ts +0 -0
  745. /package/dist/{core/components → ui}/popover.d.ts +0 -0
  746. /package/dist/{core/components → ui}/skeleton.d.ts +0 -0
  747. /package/dist/{core/components → ui}/spinner.d.ts +0 -0
  748. /package/dist/{form/components/base → ui}/textarea.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"values.js","names":[],"sources":["../../../resources/js/form/hooks/values.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useSyncExternalStore,\n} from \"react\";\nimport { getPath, setPath } from \"@lattice-php/lattice/form/lib/form-path\";\n\nexport type SetFormValue = (\n name: string,\n value: unknown | ((previous: unknown) => unknown),\n) => void;\n\ntype FormValuesStore = {\n getPathSnapshot: (path: string) => unknown;\n getPathsSnapshot: (paths: string[]) => Record<string, unknown>;\n getSnapshot: () => Record<string, unknown>;\n replaceInitial: (initial: Record<string, unknown>) => void;\n setValue: SetFormValue;\n subscribe: (listener: () => void) => () => void;\n subscribePath: (path: string, listener: () => void) => () => void;\n subscribePaths: (paths: string[], listener: () => void) => () => void;\n};\n\nconst emptyValues: Record<string, unknown> = {};\nconst emptySelectedValues: Record<string, unknown> = {};\n\nconst FormValuesStoreContext = createContext<FormValuesStore | null>(null);\nconst SetFormValueContext = createContext<SetFormValue>(() => {});\n\nfunction valuesEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) {\n return true;\n }\n\n if (!a || !b || typeof a !== \"object\" || typeof b !== \"object\") {\n return false;\n }\n\n if (Array.isArray(a) || Array.isArray(b)) {\n return (\n Array.isArray(a) &&\n Array.isArray(b) &&\n a.length === b.length &&\n a.every((value, index) => valuesEqual(value, b[index]))\n );\n }\n\n const aEntries = Object.entries(a);\n const bObject = b as Record<string, unknown>;\n\n return (\n aEntries.length === Object.keys(bObject).length &&\n aEntries.every(([key, value]) => valuesEqual(value, bObject[key]))\n );\n}\n\nfunction normalizePath(path: string): string {\n return path\n .split(\".\")\n .filter((part) => part !== \"\")\n .join(\".\");\n}\n\nfunction pathsOverlap(left: string, right: string): boolean {\n return (\n left === \"\" ||\n right === \"\" ||\n left === right ||\n left.startsWith(`${right}.`) ||\n right.startsWith(`${left}.`)\n );\n}\n\nfunction createFormValuesStore(initial: Record<string, unknown>): FormValuesStore {\n let initialValues = initial;\n let values = initial;\n const listeners = new Set<() => void>();\n const pathListeners = new Map<string, Set<() => void>>();\n const selectedCache = new Map<string, { snapshot: Record<string, unknown>; values: unknown[] }>();\n\n const notify = (path: string): void => {\n for (const listener of listeners) {\n listener();\n }\n\n const normalizedPath = normalizePath(path);\n\n for (const [subscribedPath, subscribedListeners] of pathListeners) {\n if (!pathsOverlap(subscribedPath, normalizedPath)) {\n continue;\n }\n\n for (const listener of subscribedListeners) {\n listener();\n }\n }\n };\n\n const updateValues = (next: Record<string, unknown>, path: string): void => {\n if (Object.is(values, next)) {\n return;\n }\n\n values = next;\n selectedCache.clear();\n notify(path);\n };\n\n const subscribePath = (path: string, listener: () => void): (() => void) => {\n const normalizedPath = normalizePath(path);\n const listenersForPath = pathListeners.get(normalizedPath) ?? new Set<() => void>();\n\n listenersForPath.add(listener);\n pathListeners.set(normalizedPath, listenersForPath);\n\n return () => {\n listenersForPath.delete(listener);\n\n if (listenersForPath.size === 0) {\n pathListeners.delete(normalizedPath);\n }\n };\n };\n\n return {\n getPathSnapshot: (path: string): unknown => getPath(values, path),\n getPathsSnapshot: (paths: string[]): Record<string, unknown> => {\n if (paths.length === 0) {\n return emptySelectedValues;\n }\n\n const normalizedPaths = paths.map(normalizePath);\n const key = JSON.stringify(paths);\n const selectedValues = normalizedPaths.map((path) => getPath(values, path));\n const cached = selectedCache.get(key);\n\n if (\n cached &&\n cached.values.length === selectedValues.length &&\n selectedValues.every((value, index) => Object.is(value, cached.values[index]))\n ) {\n return cached.snapshot;\n }\n\n const snapshot = Object.fromEntries(\n paths.map((path, index) => [path, selectedValues[index]]),\n );\n\n selectedCache.set(key, { snapshot, values: selectedValues });\n\n return snapshot;\n },\n getSnapshot: () => values,\n replaceInitial: (nextInitial: Record<string, unknown>): void => {\n if (valuesEqual(initialValues, nextInitial)) {\n return;\n }\n\n initialValues = nextInitial;\n updateValues(nextInitial, \"\");\n },\n setValue: (name: string, value: unknown | ((previous: unknown) => unknown)): void => {\n const previous = getPath(values, name);\n const next = typeof value === \"function\" ? value(previous) : value;\n\n if (Object.is(previous, next)) {\n return;\n }\n\n updateValues(setPath(values, name, next), name);\n },\n subscribe: (listener: () => void): (() => void) => {\n listeners.add(listener);\n\n return () => listeners.delete(listener);\n },\n subscribePath,\n subscribePaths: (paths: string[], listener: () => void): (() => void) => {\n const unsubscribers = Array.from(new Set(paths.map(normalizePath))).map((path) =>\n subscribePath(path, listener),\n );\n\n return () => {\n for (const unsubscribe of unsubscribers) {\n unsubscribe();\n }\n };\n },\n };\n}\n\nconst fallbackFormValuesStore = createFormValuesStore(emptyValues);\n\nexport function FormValuesProvider({\n initial,\n children,\n}: {\n initial: Record<string, unknown>;\n children: React.ReactNode;\n}) {\n const storeRef = useRef<FormValuesStore>(null);\n\n if (storeRef.current === null) {\n storeRef.current = createFormValuesStore(initial);\n }\n\n useEffect(() => {\n storeRef.current?.replaceInitial(initial);\n }, [initial]);\n\n return (\n <FormValuesStoreContext.Provider value={storeRef.current}>\n <SetFormValueContext.Provider value={storeRef.current.setValue}>\n {children}\n </SetFormValueContext.Provider>\n </FormValuesStoreContext.Provider>\n );\n}\n\nfunction useFormValuesStore(): FormValuesStore {\n return useContext(FormValuesStoreContext) ?? fallbackFormValuesStore;\n}\n\nexport function useFormValues(): Record<string, unknown> {\n const store = useFormValuesStore();\n\n return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);\n}\n\nexport function useFormValue(name: string): unknown {\n const store = useFormValuesStore();\n const subscribe = useCallback(\n (listener: () => void) => store.subscribePath(name, listener),\n [name, store],\n );\n const getSnapshot = useCallback(() => store.getPathSnapshot(name), [name, store]);\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\nexport function useFormValuesFor(paths: string[]): Record<string, unknown> {\n const store = useFormValuesStore();\n const pathsKey = JSON.stringify(paths);\n const selectedPaths = useMemo(() => JSON.parse(pathsKey) as string[], [pathsKey]);\n const subscribe = useCallback(\n (listener: () => void) => store.subscribePaths(selectedPaths, listener),\n [selectedPaths, store],\n );\n const getSnapshot = useCallback(\n () => store.getPathsSnapshot(selectedPaths),\n [selectedPaths, store],\n );\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\nexport function useSetFormValue(): SetFormValue {\n return useContext(SetFormValueContext);\n}\n"],"mappings":";;;;AA2BA,IAAM,cAAuC,CAAC;AAC9C,IAAM,sBAA+C,CAAC;AAEtD,IAAM,yBAAyB,cAAsC,IAAI;AACzE,IAAM,sBAAsB,oBAAkC,CAAC,CAAC;AAEhE,SAAS,YAAY,GAAY,GAAqB;CACpD,IAAI,OAAO,GAAG,GAAG,CAAC,GAChB,OAAO;CAGT,IAAI,CAAC,KAAK,CAAC,KAAK,OAAO,MAAM,YAAY,OAAO,MAAM,UACpD,OAAO;CAGT,IAAI,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,CAAC,GACrC,OACE,MAAM,QAAQ,CAAC,KACf,MAAM,QAAQ,CAAC,KACf,EAAE,WAAW,EAAE,UACf,EAAE,OAAO,OAAO,UAAU,YAAY,OAAO,EAAE,MAAM,CAAC;CAI1D,MAAM,WAAW,OAAO,QAAQ,CAAC;CACjC,MAAM,UAAU;CAEhB,OACE,SAAS,WAAW,OAAO,KAAK,OAAO,EAAE,UACzC,SAAS,OAAO,CAAC,KAAK,WAAW,YAAY,OAAO,QAAQ,IAAI,CAAC;AAErE;AAEA,SAAS,cAAc,MAAsB;CAC3C,OAAO,KACJ,MAAM,GAAG,EACT,QAAQ,SAAS,SAAS,EAAE,EAC5B,KAAK,GAAG;AACb;AAEA,SAAS,aAAa,MAAc,OAAwB;CAC1D,OACE,SAAS,MACT,UAAU,MACV,SAAS,SACT,KAAK,WAAW,GAAG,MAAM,EAAE,KAC3B,MAAM,WAAW,GAAG,KAAK,EAAE;AAE/B;AAEA,SAAS,sBAAsB,SAAmD;CAChF,IAAI,gBAAgB;CACpB,IAAI,SAAS;CACb,MAAM,4BAAY,IAAI,IAAgB;CACtC,MAAM,gCAAgB,IAAI,IAA6B;CACvD,MAAM,gCAAgB,IAAI,IAAsE;CAEhG,MAAM,UAAU,SAAuB;EACrC,KAAK,MAAM,YAAY,WACrB,SAAS;EAGX,MAAM,iBAAiB,cAAc,IAAI;EAEzC,KAAK,MAAM,CAAC,gBAAgB,wBAAwB,eAAe;GACjE,IAAI,CAAC,aAAa,gBAAgB,cAAc,GAC9C;GAGF,KAAK,MAAM,YAAY,qBACrB,SAAS;EAEb;CACF;CAEA,MAAM,gBAAgB,MAA+B,SAAuB;EAC1E,IAAI,OAAO,GAAG,QAAQ,IAAI,GACxB;EAGF,SAAS;EACT,cAAc,MAAM;EACpB,OAAO,IAAI;CACb;CAEA,MAAM,iBAAiB,MAAc,aAAuC;EAC1E,MAAM,iBAAiB,cAAc,IAAI;EACzC,MAAM,mBAAmB,cAAc,IAAI,cAAc,qBAAK,IAAI,IAAgB;EAElF,iBAAiB,IAAI,QAAQ;EAC7B,cAAc,IAAI,gBAAgB,gBAAgB;EAElD,aAAa;GACX,iBAAiB,OAAO,QAAQ;GAEhC,IAAI,iBAAiB,SAAS,GAC5B,cAAc,OAAO,cAAc;EAEvC;CACF;CAEA,OAAO;EACL,kBAAkB,SAA0B,QAAQ,QAAQ,IAAI;EAChE,mBAAmB,UAA6C;GAC9D,IAAI,MAAM,WAAW,GACnB,OAAO;GAGT,MAAM,kBAAkB,MAAM,IAAI,aAAa;GAC/C,MAAM,MAAM,KAAK,UAAU,KAAK;GAChC,MAAM,iBAAiB,gBAAgB,KAAK,SAAS,QAAQ,QAAQ,IAAI,CAAC;GAC1E,MAAM,SAAS,cAAc,IAAI,GAAG;GAEpC,IACE,UACA,OAAO,OAAO,WAAW,eAAe,UACxC,eAAe,OAAO,OAAO,UAAU,OAAO,GAAG,OAAO,OAAO,OAAO,MAAM,CAAC,GAE7E,OAAO,OAAO;GAGhB,MAAM,WAAW,OAAO,YACtB,MAAM,KAAK,MAAM,UAAU,CAAC,MAAM,eAAe,MAAM,CAAC,CAC1D;GAEA,cAAc,IAAI,KAAK;IAAE;IAAU,QAAQ;GAAe,CAAC;GAE3D,OAAO;EACT;EACA,mBAAmB;EACnB,iBAAiB,gBAA+C;GAC9D,IAAI,YAAY,eAAe,WAAW,GACxC;GAGF,gBAAgB;GAChB,aAAa,aAAa,EAAE;EAC9B;EACA,WAAW,MAAc,UAA4D;GACnF,MAAM,WAAW,QAAQ,QAAQ,IAAI;GACrC,MAAM,OAAO,OAAO,UAAU,aAAa,MAAM,QAAQ,IAAI;GAE7D,IAAI,OAAO,GAAG,UAAU,IAAI,GAC1B;GAGF,aAAa,QAAQ,QAAQ,MAAM,IAAI,GAAG,IAAI;EAChD;EACA,YAAY,aAAuC;GACjD,UAAU,IAAI,QAAQ;GAEtB,aAAa,UAAU,OAAO,QAAQ;EACxC;EACA;EACA,iBAAiB,OAAiB,aAAuC;GACvE,MAAM,gBAAgB,MAAM,KAAK,IAAI,IAAI,MAAM,IAAI,aAAa,CAAC,CAAC,EAAE,KAAK,SACvE,cAAc,MAAM,QAAQ,CAC9B;GAEA,aAAa;IACX,KAAK,MAAM,eAAe,eACxB,YAAY;GAEhB;EACF;CACF;AACF;AAEA,IAAM,0BAA0B,sBAAsB,WAAW;AAEjE,SAAgB,mBAAmB,EACjC,SACA,YAIC;CACD,MAAM,WAAW,OAAwB,IAAI;CAE7C,IAAI,SAAS,YAAY,MACvB,SAAS,UAAU,sBAAsB,OAAO;CAGlD,gBAAgB;EACd,SAAS,SAAS,eAAe,OAAO;CAC1C,GAAG,CAAC,OAAO,CAAC;CAEZ,OACE,oBAAC,uBAAuB,UAAxB;EAAiC,OAAO,SAAS;YAC/C,oBAAC,oBAAoB,UAArB;GAA8B,OAAO,SAAS,QAAQ;GACnD;EAC2B,CAAA;CACC,CAAA;AAErC;AAEA,SAAS,qBAAsC;CAC7C,OAAO,WAAW,sBAAsB,KAAK;AAC/C;AAEA,SAAgB,gBAAyC;CACvD,MAAM,QAAQ,mBAAmB;CAEjC,OAAO,qBAAqB,MAAM,WAAW,MAAM,aAAa,MAAM,WAAW;AACnF;AAEA,SAAgB,aAAa,MAAuB;CAClD,MAAM,QAAQ,mBAAmB;CACjC,MAAM,YAAY,aACf,aAAyB,MAAM,cAAc,MAAM,QAAQ,GAC5D,CAAC,MAAM,KAAK,CACd;CACA,MAAM,cAAc,kBAAkB,MAAM,gBAAgB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;CAEhF,OAAO,qBAAqB,WAAW,aAAa,WAAW;AACjE;AAEA,SAAgB,iBAAiB,OAA0C;CACzE,MAAM,QAAQ,mBAAmB;CACjC,MAAM,WAAW,KAAK,UAAU,KAAK;CACrC,MAAM,gBAAgB,cAAc,KAAK,MAAM,QAAQ,GAAe,CAAC,QAAQ,CAAC;CAChF,MAAM,YAAY,aACf,aAAyB,MAAM,eAAe,eAAe,QAAQ,GACtE,CAAC,eAAe,KAAK,CACvB;CACA,MAAM,cAAc,kBACZ,MAAM,iBAAiB,aAAa,GAC1C,CAAC,eAAe,KAAK,CACvB;CAEA,OAAO,qBAAqB,WAAW,aAAa,WAAW;AACjE;AAEA,SAAgB,kBAAgC;CAC9C,OAAO,WAAW,mBAAmB;AACvC"}
@@ -1 +1,4 @@
1
- export declare const formComponents: import('../core/registry').Plugin;
1
+ export * from './components/index.js';
2
+ export { FormValuesProvider } from './hooks/values.js';
3
+ export { formComponents } from './plugin.js';
4
+ export type * from './types.js';
@@ -1,4 +1,4 @@
1
- import { createPlugin, eagerComponent } from "../core/registry.js";
1
+ import { FormValuesProvider } from "./hooks/values.js";
2
2
  import { BuilderComponent } from "./components/fields/builder.js";
3
3
  import { CheckboxComponent } from "./components/fields/checkbox.js";
4
4
  import { ChoiceComponent } from "./components/fields/choice.js";
@@ -16,32 +16,5 @@ import { TextareaComponent } from "./components/fields/textarea.js";
16
16
  import { TextInputComponent } from "./components/fields/text-input.js";
17
17
  import { TimeInputComponent } from "./components/fields/time-input.js";
18
18
  import { ToggleComponent } from "./components/fields/toggle.js";
19
- import { RichEditorComponent } from "./components/fields/rich-editor.js";
20
- //#region resources/js/form/index.ts
21
- var formComponents = createPlugin({
22
- components: {
23
- form: eagerComponent(FormComponent),
24
- "field.builder": eagerComponent(BuilderComponent),
25
- "field.checkbox": eagerComponent(CheckboxComponent),
26
- "field.choice": eagerComponent(ChoiceComponent),
27
- "field.date-input": eagerComponent(DateInputComponent),
28
- "field.date-time-input": eagerComponent(DateTimeInputComponent),
29
- "field.file-upload": eagerComponent(FileUploadComponent),
30
- "field.hidden-input": eagerComponent(HiddenInputComponent),
31
- "field.number-input": eagerComponent(NumberInputComponent),
32
- "field.otp": eagerComponent(OtpInputComponent),
33
- "field.password-input": eagerComponent(PasswordInputComponent),
34
- "field.repeater": eagerComponent(RepeaterComponent),
35
- "field.rich-editor": eagerComponent(RichEditorComponent),
36
- "field.select": eagerComponent(SelectComponent),
37
- "field.textarea": eagerComponent(TextareaComponent),
38
- "field.text-input": eagerComponent(TextInputComponent),
39
- "field.time-input": eagerComponent(TimeInputComponent),
40
- "field.toggle": eagerComponent(ToggleComponent)
41
- },
42
- name: "lattice/form"
43
- });
44
- //#endregion
45
- export { formComponents };
46
-
47
- //# sourceMappingURL=index.js.map
19
+ import { formComponents } from "./plugin.js";
20
+ export { BuilderComponent, CheckboxComponent, ChoiceComponent, DateInputComponent, DateTimeInputComponent, FileUploadComponent, FormComponent, FormValuesProvider, HiddenInputComponent, NumberInputComponent, OtpInputComponent, PasswordInputComponent, RepeaterComponent, SelectComponent, TextInputComponent, TextareaComponent, TimeInputComponent, ToggleComponent, formComponents };
@@ -1,4 +1,4 @@
1
- import { Condition } from '../../types/generated';
1
+ import { Condition } from '../../types/generated.js';
2
2
  export type { Condition };
3
3
  export type FieldConditions = {
4
4
  visible?: Condition[];
@@ -18,5 +18,6 @@ export type FieldState = {
18
18
  readOnly: boolean;
19
19
  disabled: boolean;
20
20
  };
21
+ export declare function conditionFields(conditions: FieldConditions | undefined | null): string[];
21
22
  export declare function toBoolean(value: unknown): boolean;
22
23
  export declare function evaluateConditions(conditions: FieldConditions | undefined, values: Record<string, unknown>, flags: FieldFlags): FieldState;
@@ -1,4 +1,14 @@
1
- //#region resources/js/form/components/conditions.ts
1
+ //#region resources/js/form/lib/conditions.ts
2
+ function conditionFields(conditions) {
3
+ const fields = /* @__PURE__ */ new Set();
4
+ for (const group of [
5
+ conditions?.visible,
6
+ conditions?.required,
7
+ conditions?.readOnly,
8
+ conditions?.disabled
9
+ ]) for (const condition of group ?? []) fields.add(condition.field);
10
+ return Array.from(fields);
11
+ }
2
12
  var BOOLEAN_TRUE_VALUES = new Set([
3
13
  "1",
4
14
  "true",
@@ -65,6 +75,6 @@ function evaluateConditions(conditions, values, flags) {
65
75
  };
66
76
  }
67
77
  //#endregion
68
- export { evaluateConditions, toBoolean };
78
+ export { conditionFields, evaluateConditions, toBoolean };
69
79
 
70
80
  //# sourceMappingURL=conditions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.js","names":[],"sources":["../../../resources/js/form/lib/conditions.ts"],"sourcesContent":["import type { Condition, Op } from \"@lattice-php/lattice/types/generated\";\n\nexport type { Condition };\n\nexport type FieldConditions = {\n visible?: Condition[];\n required?: Condition[];\n readOnly?: Condition[];\n disabled?: Condition[];\n};\n\ntype FieldFlags = {\n hidden?: boolean;\n required?: boolean;\n readOnly?: boolean;\n disabled?: boolean;\n};\n\nexport type FieldState = {\n hidden: boolean;\n required: boolean;\n readOnly: boolean;\n disabled: boolean;\n};\n\nexport function conditionFields(conditions: FieldConditions | undefined | null): string[] {\n const fields = new Set<string>();\n\n for (const group of [\n conditions?.visible,\n conditions?.required,\n conditions?.readOnly,\n conditions?.disabled,\n ]) {\n for (const condition of group ?? []) {\n fields.add(condition.field);\n }\n }\n\n return Array.from(fields);\n}\n\nconst BOOLEAN_TRUE_VALUES = new Set([\"1\", \"true\", \"on\", \"yes\"]);\n\n// Mirrors PHP filter_var(FILTER_VALIDATE_BOOLEAN) so conditions evaluate\n// identically on the server and the client.\nexport function toBoolean(value: unknown): boolean {\n if (typeof value === \"boolean\") {\n return value;\n }\n\n if (typeof value === \"number\") {\n return value === 1;\n }\n\n return BOOLEAN_TRUE_VALUES.has(String(value).toLowerCase());\n}\n\nfunction equals(actual: unknown, expected: unknown): boolean {\n if (typeof expected === \"boolean\") {\n return toBoolean(actual) === expected;\n }\n return String(actual ?? \"\") === String(expected ?? \"\");\n}\n\nfunction isIn(actual: unknown, expected: unknown): boolean {\n const needles = (Array.isArray(expected) ? expected : [expected]).map((value) => String(value));\n return needles.includes(String(actual ?? \"\"));\n}\n\nfunction isBlank(value: unknown): boolean {\n return value == null || String(value).trim() === \"\";\n}\n\n// Null when either value can't be parsed, so before/after never matches a bad date. Mirrors PHP strtotime.\nfunction compareDates(actual: unknown, expected: unknown): number | null {\n const left = Date.parse(String(actual));\n const right = Date.parse(String(expected));\n\n if (Number.isNaN(left) || Number.isNaN(right)) {\n return null;\n }\n\n return left === right ? 0 : left < right ? -1 : 1;\n}\n\n// Unknown operators from untrusted payloads fail open (the condition matches).\n// The `never` parameter makes an Op value added without a case above a\n// compile error rather than a silent fall-through.\nfunction evaluateUnknownOperator(_operator: never): boolean {\n return true;\n}\n\nfunction evaluateOp(operator: Op, actual: unknown, expected: unknown): boolean {\n switch (operator) {\n case \"eq\":\n return equals(actual, expected);\n case \"neq\":\n return !equals(actual, expected);\n case \"gt\":\n return Number(actual) > Number(expected);\n case \"lt\":\n return Number(actual) < Number(expected);\n case \"gte\":\n return Number(actual) >= Number(expected);\n case \"lte\":\n return Number(actual) <= Number(expected);\n case \"contains\":\n return String(actual ?? \"\").includes(String(expected ?? \"\"));\n case \"starts_with\":\n return String(actual ?? \"\").startsWith(String(expected ?? \"\"));\n case \"ends_with\":\n return String(actual ?? \"\").endsWith(String(expected ?? \"\"));\n case \"in\":\n return isIn(actual, expected);\n case \"not_in\":\n return !isIn(actual, expected);\n case \"before\":\n return compareDates(actual, expected) === -1;\n case \"after\":\n return compareDates(actual, expected) === 1;\n case \"empty\":\n return isBlank(actual);\n case \"filled\":\n return !isBlank(actual);\n default:\n return evaluateUnknownOperator(operator);\n }\n}\n\nfunction allMatch(conditions: Condition[], values: Record<string, unknown>): boolean {\n return conditions.every((condition) =>\n evaluateOp(condition.operator, values[condition.field], condition.value),\n );\n}\n\nfunction anyMatch(conditions: Condition[] | undefined, values: Record<string, unknown>): boolean {\n return Boolean(\n conditions?.some((condition) =>\n evaluateOp(condition.operator, values[condition.field], condition.value),\n ),\n );\n}\n\nexport function evaluateConditions(\n conditions: FieldConditions | undefined,\n values: Record<string, unknown>,\n flags: FieldFlags,\n): FieldState {\n const visible = !conditions?.visible?.length || allMatch(conditions.visible, values);\n\n return {\n hidden: Boolean(flags.hidden) || !visible,\n required: Boolean(flags.required) || anyMatch(conditions?.required, values),\n readOnly: Boolean(flags.readOnly) || anyMatch(conditions?.readOnly, values),\n disabled: Boolean(flags.disabled) || anyMatch(conditions?.disabled, values),\n };\n}\n"],"mappings":"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"}
@@ -0,0 +1 @@
1
+ export declare function fieldDomName(name: string, prefix?: string): string;
@@ -0,0 +1,10 @@
1
+ //#region resources/js/form/lib/field-dom-name.ts
2
+ function fieldDomName(name, prefix) {
3
+ if (!prefix) return name;
4
+ const suffix = name.replace(/[^A-Za-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
5
+ return suffix ? `${prefix}-${suffix}` : prefix;
6
+ }
7
+ //#endregion
8
+ export { fieldDomName };
9
+
10
+ //# sourceMappingURL=field-dom-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-dom-name.js","names":[],"sources":["../../../resources/js/form/lib/field-dom-name.ts"],"sourcesContent":["export function fieldDomName(name: string, prefix?: string): string {\n if (!prefix) {\n return name;\n }\n\n const suffix = name.replace(/[^A-Za-z0-9_-]+/g, \"-\").replace(/^-+|-+$/g, \"\");\n\n return suffix ? `${prefix}-${suffix}` : prefix;\n}\n"],"mappings":";AAAA,SAAgB,aAAa,MAAc,QAAyB;CAClE,IAAI,CAAC,QACH,OAAO;CAGT,MAAM,SAAS,KAAK,QAAQ,oBAAoB,GAAG,EAAE,QAAQ,YAAY,EAAE;CAE3E,OAAO,SAAS,GAAG,OAAO,GAAG,WAAW;AAC1C"}
@@ -1,5 +1,5 @@
1
- import { Node } from '../../core/types';
2
- import { FieldConditions } from './conditions';
1
+ import { Node } from '../../core/types.js';
2
+ import { FieldConditions } from './conditions.js';
3
3
  /**
4
4
  * The props every form-field node shares (the PHP Field base). Nodes flow through
5
5
  * the form framework loosely typed via the generic schema, so this is the typed
@@ -12,7 +12,6 @@ type FieldProps = {
12
12
  dependsOnKeys?: string[] | null;
13
13
  disabled?: boolean | null;
14
14
  helperText?: string | null;
15
- hidden?: boolean | null;
16
15
  label?: string | null;
17
16
  name?: string;
18
17
  editablePrefill?: boolean | null;
@@ -1,4 +1,4 @@
1
- //#region resources/js/form/components/field-props.ts
1
+ //#region resources/js/form/lib/field-props.ts
2
2
  function fieldProps(node) {
3
3
  return node.props;
4
4
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-props.js","names":[],"sources":["../../../resources/js/form/lib/field-props.ts"],"sourcesContent":["import type { Node } from \"@lattice-php/lattice/core/types\";\nimport type { FieldConditions } from \"./conditions\";\n\n/**\n * The props every form-field node shares (the PHP Field base). Nodes flow through\n * the form framework loosely typed via the generic schema, so this is the typed\n * lens the shared hooks read them through. Everything is optional because the\n * lens is also applied to non-field nodes while walking the schema.\n */\ntype FieldProps = {\n conditions?: FieldConditions | null;\n dependsOnAny?: boolean | null;\n dependsOnKeys?: string[] | null;\n disabled?: boolean | null;\n helperText?: string | null;\n label?: string | null;\n name?: string;\n editablePrefill?: boolean | null;\n prefillRefreshOn?: string[] | null;\n prefillResetOn?: string[] | null;\n readOnly?: boolean | null;\n required?: boolean | null;\n tooltip?: string | null;\n value?: unknown;\n};\n\nexport function fieldProps(node: Node): FieldProps {\n return node.props as FieldProps;\n}\n\nexport function walkFields(\n nodes: Node[] | undefined,\n visit: (props: FieldProps, node: Node) => void,\n): void {\n for (const child of nodes ?? []) {\n visit(fieldProps(child), child);\n walkFields(child.schema, visit);\n }\n}\n"],"mappings":";AA0BA,SAAgB,WAAW,MAAwB;CACjD,OAAO,KAAK;AACd;AAEA,SAAgB,WACd,OACA,OACM;CACN,KAAK,MAAM,SAAS,SAAS,CAAC,GAAG;EAC/B,MAAM,WAAW,KAAK,GAAG,KAAK;EAC9B,WAAW,MAAM,QAAQ,KAAK;CAChC;AACF"}
@@ -1,4 +1,4 @@
1
- //#region resources/js/form/components/form-path.ts
1
+ //#region resources/js/form/lib/form-path.ts
2
2
  function pathParts(path) {
3
3
  return path.split(".").filter((part) => part !== "");
4
4
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-path.js","names":[],"sources":["../../../resources/js/form/lib/form-path.ts"],"sourcesContent":["function pathParts(path: string): string[] {\n return path.split(\".\").filter((part) => part !== \"\");\n}\n\nexport function appendPath(\n base: string | null | undefined,\n ...parts: Array<string | number>\n): string {\n const suffix = parts.map(String).filter((part) => part !== \"\");\n\n return [base ?? \"\", ...suffix].filter((part) => part !== \"\").join(\".\");\n}\n\nexport function toHtmlName(path: string): string {\n const [head, ...tail] = pathParts(path);\n\n return tail.reduce((name, part) => `${name}[${part}]`, head ?? \"\");\n}\n\nexport function getPath(values: Record<string, unknown>, path: string): unknown {\n let current: unknown = values;\n\n for (const part of pathParts(path)) {\n if (current == null) {\n return undefined;\n }\n\n current = (current as Record<string, unknown>)[part];\n }\n\n return current;\n}\n\nfunction emptyContainer(nextPart: string | undefined): Record<string, unknown> | unknown[] {\n return nextPart !== undefined && /^\\d+$/.test(nextPart) ? [] : {};\n}\n\nexport function setPath(\n values: Record<string, unknown>,\n path: string,\n value: unknown,\n): Record<string, unknown> {\n const parts = pathParts(path);\n\n if (parts.length === 0) {\n return values;\n }\n\n const write = (current: unknown, index: number): unknown => {\n const part = parts[index];\n const last = index === parts.length - 1;\n const source =\n current && typeof current === \"object\" ? current : emptyContainer(parts[index + 1]);\n const next = Array.isArray(source) ? [...source] : { ...(source as Record<string, unknown>) };\n\n (next as Record<string, unknown>)[part] = last\n ? value\n : write((source as Record<string, unknown>)[part], index + 1);\n\n return next;\n };\n\n return write(values, 0) as Record<string, unknown>;\n}\n"],"mappings":";AAAA,SAAS,UAAU,MAAwB;CACzC,OAAO,KAAK,MAAM,GAAG,EAAE,QAAQ,SAAS,SAAS,EAAE;AACrD;AAEA,SAAgB,WACd,MACA,GAAG,OACK;CACR,MAAM,SAAS,MAAM,IAAI,MAAM,EAAE,QAAQ,SAAS,SAAS,EAAE;CAE7D,OAAO,CAAC,QAAQ,IAAI,GAAG,MAAM,EAAE,QAAQ,SAAS,SAAS,EAAE,EAAE,KAAK,GAAG;AACvE;AAEA,SAAgB,WAAW,MAAsB;CAC/C,MAAM,CAAC,MAAM,GAAG,QAAQ,UAAU,IAAI;CAEtC,OAAO,KAAK,QAAQ,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,IAAI,QAAQ,EAAE;AACnE;AAEA,SAAgB,QAAQ,QAAiC,MAAuB;CAC9E,IAAI,UAAmB;CAEvB,KAAK,MAAM,QAAQ,UAAU,IAAI,GAAG;EAClC,IAAI,WAAW,MACb;EAGF,UAAW,QAAoC;CACjD;CAEA,OAAO;AACT;AAEA,SAAS,eAAe,UAAmE;CACzF,OAAO,aAAa,KAAA,KAAa,QAAQ,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC;AAClE;AAEA,SAAgB,QACd,QACA,MACA,OACyB;CACzB,MAAM,QAAQ,UAAU,IAAI;CAE5B,IAAI,MAAM,WAAW,GACnB,OAAO;CAGT,MAAM,SAAS,SAAkB,UAA2B;EAC1D,MAAM,OAAO,MAAM;EACnB,MAAM,OAAO,UAAU,MAAM,SAAS;EACtC,MAAM,SACJ,WAAW,OAAO,YAAY,WAAW,UAAU,eAAe,MAAM,QAAQ,EAAE;EACpF,MAAM,OAAO,MAAM,QAAQ,MAAM,IAAI,CAAC,GAAG,MAAM,IAAI,EAAE,GAAI,OAAmC;EAE5F,KAAkC,QAAQ,OACtC,QACA,MAAO,OAAmC,OAAO,QAAQ,CAAC;EAE9D,OAAO;CACT;CAEA,OAAO,MAAM,QAAQ,CAAC;AACxB"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Shared client transport for the lattice form endpoint: every form sub-action
3
3
  * (validation resolve, option search) POSTs to the same signed URL, so the
4
- * request shape — notably stripping client-only row ids — lives here once.
4
+ * request shape lives here once.
5
5
  */
6
6
  export declare const FORM_DEBOUNCE_MS = 250;
7
7
  export declare function postFormAction<T>(action: string, componentRef: string, body: Record<string, unknown>, signal: AbortSignal): Promise<T | null>;
@@ -0,0 +1,21 @@
1
+ import { apiFetch } from "../../core/api.js";
2
+ //#region resources/js/form/lib/form-transport.ts
3
+ /**
4
+ * Shared client transport for the lattice form endpoint: every form sub-action
5
+ * (validation resolve, option search) POSTs to the same signed URL, so the
6
+ * request shape lives here once.
7
+ */
8
+ var FORM_DEBOUNCE_MS = 250;
9
+ function postFormAction(action, componentRef, body, signal) {
10
+ return apiFetch(action, {
11
+ method: "POST",
12
+ ref: componentRef,
13
+ signal,
14
+ body: JSON.stringify(body),
15
+ throwOnError: false
16
+ }).then((response) => response.ok ? response.json() : null);
17
+ }
18
+ //#endregion
19
+ export { FORM_DEBOUNCE_MS, postFormAction };
20
+
21
+ //# sourceMappingURL=form-transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-transport.js","names":[],"sources":["../../../resources/js/form/lib/form-transport.ts"],"sourcesContent":["/**\n * Shared client transport for the lattice form endpoint: every form sub-action\n * (validation resolve, option search) POSTs to the same signed URL, so the\n * request shape lives here once.\n */\n\nimport { apiFetch } from \"@lattice-php/lattice/core/api\";\n\nexport const FORM_DEBOUNCE_MS = 250;\n\nexport function postFormAction<T>(\n action: string,\n componentRef: string,\n body: Record<string, unknown>,\n signal: AbortSignal,\n): Promise<T | null> {\n return apiFetch(action, {\n method: \"POST\",\n ref: componentRef,\n signal,\n body: JSON.stringify(body),\n throwOnError: false,\n }).then((response) => (response.ok ? (response.json() as Promise<T>) : null));\n}\n"],"mappings":";;;;;;;AAQA,IAAa,mBAAmB;AAEhC,SAAgB,eACd,QACA,cACA,MACA,QACmB;CACnB,OAAO,SAAS,QAAQ;EACtB,QAAQ;EACR,KAAK;EACL;EACA,MAAM,KAAK,UAAU,IAAI;EACzB,cAAc;CAChB,CAAC,EAAE,MAAM,aAAc,SAAS,KAAM,SAAS,KAAK,IAAmB,IAAK;AAC9E"}
@@ -0,0 +1,12 @@
1
+ import { ROW_ID_KEY } from "../components/fields/repeater-rows.js";
2
+ //#region resources/js/form/lib/override-keys.ts
3
+ function rowIdFrom(row) {
4
+ return typeof row["rowId"] === "string" ? row[ROW_ID_KEY] : null;
5
+ }
6
+ function buildOverrideKey(base, rowId, index, name) {
7
+ return `${base}.${rowId ?? String(index)}.${name}`;
8
+ }
9
+ //#endregion
10
+ export { buildOverrideKey, rowIdFrom };
11
+
12
+ //# sourceMappingURL=override-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"override-keys.js","names":[],"sources":["../../../resources/js/form/lib/override-keys.ts"],"sourcesContent":["import { ROW_ID_KEY } from \"@lattice-php/lattice/form/components/fields/repeater-rows\";\n\nexport function rowIdFrom(row: Record<string, unknown>): string | null {\n return typeof row[ROW_ID_KEY] === \"string\" ? row[ROW_ID_KEY] : null;\n}\n\nexport function buildOverrideKey(\n base: string,\n rowId: string | null,\n index: number,\n name: string,\n): string {\n return `${base}.${rowId ?? String(index)}.${name}`;\n}\n"],"mappings":";;AAEA,SAAgB,UAAU,KAA6C;CACrE,OAAO,OAAO,IAAA,aAAoB,WAAW,IAAI,cAAc;AACjE;AAEA,SAAgB,iBACd,MACA,OACA,OACA,MACQ;CACR,OAAO,GAAG,KAAK,GAAG,SAAS,OAAO,KAAK,EAAE,GAAG;AAC9C"}
@@ -1,4 +1,4 @@
1
- import { Node } from '../../core/types';
1
+ import { Node } from '../../core/types.js';
2
2
  type PrefillTarget = {
3
3
  path: string;
4
4
  overrideKey: string;
@@ -9,7 +9,7 @@ type PrefillSnapshot = {
9
9
  targets: PrefillTarget[];
10
10
  values: Record<string, unknown>;
11
11
  };
12
- export { getPath } from './form-path';
12
+ export { getPath } from './form-path.js';
13
13
  export declare function collectPrefillTargets(nodes: Node[] | undefined, values: Record<string, unknown>): PrefillTarget[];
14
14
  export declare function pathsToClear(previous: PrefillSnapshot, next: PrefillSnapshot): string[];
15
15
  export declare function seededOverrides(targets: PrefillTarget[], values: Record<string, unknown>): string[];
@@ -1,7 +1,8 @@
1
1
  import { fieldProps } from "./field-props.js";
2
2
  import { appendPath, getPath } from "./form-path.js";
3
3
  import { buildOverrideKey, rowIdFrom } from "./override-keys.js";
4
- //#region resources/js/form/components/prefill-targets.ts
4
+ import { rowSchemaFor } from "../components/fields/row-templates.js";
5
+ //#region resources/js/form/lib/prefill-targets.ts
5
6
  var ROW_COLLECTION_TYPES = new Set(["field.builder", "field.repeater"]);
6
7
  function mapDep(dep, rowPath) {
7
8
  if (dep.startsWith("@")) return dep.slice(1);
@@ -28,10 +29,8 @@ function collectPrefillTargets(nodes, values) {
28
29
  const childCollectionPath = appendPath(rowPath, name);
29
30
  const childIdentityCollectionPath = appendPath(identityRowPath, name);
30
31
  const storedRows = getPath(values, childCollectionPath);
31
- const rows = Array.isArray(storedRows) ? storedRows : [];
32
- const blocks = node.blocks;
33
- rows.forEach((childRow, childIndex) => {
34
- walk(blocks ? blocks.find((block) => block.type === childRow.type)?.schema ?? [] : node.schema ?? [], appendPath(childCollectionPath, childIndex), appendPath(childIdentityCollectionPath, rowIdFrom(childRow) ?? childIndex), childIdentityCollectionPath, childIndex, childRow);
32
+ (Array.isArray(storedRows) ? storedRows : []).forEach((childRow, childIndex) => {
33
+ walk(rowSchemaFor(node, childRow), appendPath(childCollectionPath, childIndex), appendPath(childIdentityCollectionPath, rowIdFrom(childRow) ?? childIndex), childIdentityCollectionPath, childIndex, childRow);
35
34
  });
36
35
  }
37
36
  continue;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefill-targets.js","names":[],"sources":["../../../resources/js/form/lib/prefill-targets.ts"],"sourcesContent":["import type { Node } from \"@lattice-php/lattice/core/types\";\nimport { fieldProps } from \"./field-props\";\nimport { rowSchemaFor } from \"@lattice-php/lattice/form/components/fields/row-templates\";\nimport { appendPath, getPath } from \"./form-path\";\nimport { buildOverrideKey, rowIdFrom } from \"./override-keys\";\n\ntype PrefillTarget = {\n path: string;\n overrideKey: string;\n resetOn: string[];\n refreshOn: string[];\n};\n\ntype PrefillSnapshot = {\n targets: PrefillTarget[];\n values: Record<string, unknown>;\n};\n\nconst ROW_COLLECTION_TYPES = new Set([\"field.builder\", \"field.repeater\"]);\n\nexport { getPath } from \"./form-path\";\n\nfunction mapDep(dep: string, rowPath: string | null): string {\n if (dep.startsWith(\"@\")) {\n return dep.slice(1);\n }\n\n return rowPath === null ? dep : appendPath(rowPath, dep);\n}\n\nfunction targetFor(\n node: Node,\n rowPath: string | null,\n identityCollectionPath: string | null,\n index = 0,\n row: Record<string, unknown> = {},\n): PrefillTarget | null {\n const props = fieldProps(node);\n\n if (!props.editablePrefill || !props.name) {\n return null;\n }\n\n const rowId = rowIdFrom(row);\n\n return {\n path: rowPath === null ? props.name : appendPath(rowPath, props.name),\n overrideKey:\n identityCollectionPath === null\n ? props.name\n : buildOverrideKey(identityCollectionPath, rowId, index, props.name),\n resetOn: (props.prefillResetOn ?? []).map((dep) => mapDep(dep, rowPath)),\n refreshOn: (props.prefillRefreshOn ?? []).map((dep) => mapDep(dep, rowPath)),\n };\n}\n\nexport function collectPrefillTargets(\n nodes: Node[] | undefined,\n values: Record<string, unknown>,\n): PrefillTarget[] {\n const targets: PrefillTarget[] = [];\n\n const walk = (\n list: Node[] | undefined,\n rowPath: string | null = null,\n identityRowPath: string | null = null,\n identityCollectionPath: string | null = null,\n index = 0,\n row: Record<string, unknown> = {},\n ): void => {\n for (const node of list ?? []) {\n if (ROW_COLLECTION_TYPES.has(node.type)) {\n const name = fieldProps(node).name;\n if (name) {\n const childCollectionPath = appendPath(rowPath, name);\n const childIdentityCollectionPath = appendPath(identityRowPath, name);\n const storedRows = getPath(values, childCollectionPath);\n const rows = Array.isArray(storedRows)\n ? (storedRows as Array<Record<string, unknown>>)\n : [];\n rows.forEach((childRow, childIndex) => {\n walk(\n rowSchemaFor(node, childRow),\n appendPath(childCollectionPath, childIndex),\n appendPath(childIdentityCollectionPath, rowIdFrom(childRow) ?? childIndex),\n childIdentityCollectionPath,\n childIndex,\n childRow,\n );\n });\n }\n\n continue;\n }\n\n const target = targetFor(node, rowPath, identityCollectionPath, index, row);\n if (target) {\n targets.push(target);\n }\n\n walk(node.schema, rowPath, identityRowPath, identityCollectionPath, index, row);\n }\n };\n\n walk(nodes);\n\n return targets;\n}\n\nexport function pathsToClear(previous: PrefillSnapshot, next: PrefillSnapshot): string[] {\n const previousByKey = new Map(\n previous.targets.map((target) => [target.overrideKey, target] as const),\n );\n\n return next.targets\n .filter((target) => {\n const previousTarget = previousByKey.get(target.overrideKey);\n\n return target.resetOn.some((dep, index) => {\n const previousDep = previousTarget?.resetOn[index] ?? dep;\n\n return !Object.is(getPath(previous.values, previousDep), getPath(next.values, dep));\n });\n })\n .map((target) => target.overrideKey);\n}\n\nexport function seededOverrides(\n targets: PrefillTarget[],\n values: Record<string, unknown>,\n): string[] {\n return targets\n .filter((target) => {\n const value = getPath(values, target.path);\n\n return value !== undefined && value !== null && value !== \"\";\n })\n .map((target) => target.overrideKey);\n}\n\nexport function pruneOverrides(overrides: Set<string>, targets: PrefillTarget[]): Set<string> {\n const liveKeys = new Set(targets.map((target) => target.overrideKey));\n\n return new Set([...overrides].filter((key) => liveKeys.has(key)));\n}\n"],"mappings":"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"}
@@ -0,0 +1 @@
1
+ export declare const formComponents: import('../core/registry.js').Plugin;
@@ -0,0 +1,47 @@
1
+ import { createPlugin, eagerComponent } from "../core/registry.js";
2
+ import { BuilderComponent } from "./components/fields/builder.js";
3
+ import { CheckboxComponent } from "./components/fields/checkbox.js";
4
+ import { ChoiceComponent } from "./components/fields/choice.js";
5
+ import { DateInputComponent } from "./components/fields/date-input.js";
6
+ import { DateTimeInputComponent } from "./components/fields/date-time-input.js";
7
+ import { FileUploadComponent } from "./components/fields/file-upload.js";
8
+ import { FormComponent } from "./components/form.js";
9
+ import { HiddenInputComponent } from "./components/fields/hidden-input.js";
10
+ import { NumberInputComponent } from "./components/fields/number-input.js";
11
+ import { OtpInputComponent } from "./components/fields/otp-input.js";
12
+ import { PasswordInputComponent } from "./components/fields/password-input.js";
13
+ import { RepeaterComponent } from "./components/fields/repeater.js";
14
+ import { SelectComponent } from "./components/fields/select.js";
15
+ import { TextareaComponent } from "./components/fields/textarea.js";
16
+ import { TextInputComponent } from "./components/fields/text-input.js";
17
+ import { TimeInputComponent } from "./components/fields/time-input.js";
18
+ import { ToggleComponent } from "./components/fields/toggle.js";
19
+ import { RichEditorComponent } from "./components/fields/rich-editor.js";
20
+ //#region resources/js/form/plugin.ts
21
+ var formComponents = createPlugin({
22
+ components: {
23
+ form: eagerComponent(FormComponent),
24
+ "field.builder": eagerComponent(BuilderComponent),
25
+ "field.checkbox": eagerComponent(CheckboxComponent),
26
+ "field.choice": eagerComponent(ChoiceComponent),
27
+ "field.date-input": eagerComponent(DateInputComponent),
28
+ "field.date-time-input": eagerComponent(DateTimeInputComponent),
29
+ "field.file-upload": eagerComponent(FileUploadComponent),
30
+ "field.hidden-input": eagerComponent(HiddenInputComponent),
31
+ "field.number-input": eagerComponent(NumberInputComponent),
32
+ "field.otp": eagerComponent(OtpInputComponent),
33
+ "field.password-input": eagerComponent(PasswordInputComponent),
34
+ "field.repeater": eagerComponent(RepeaterComponent),
35
+ "field.rich-editor": eagerComponent(RichEditorComponent),
36
+ "field.select": eagerComponent(SelectComponent),
37
+ "field.textarea": eagerComponent(TextareaComponent),
38
+ "field.text-input": eagerComponent(TextInputComponent),
39
+ "field.time-input": eagerComponent(TimeInputComponent),
40
+ "field.toggle": eagerComponent(ToggleComponent)
41
+ },
42
+ name: "lattice/form"
43
+ });
44
+ //#endregion
45
+ export { formComponents };
46
+
47
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","names":[],"sources":["../../resources/js/form/plugin.ts"],"sourcesContent":["import {\n createPlugin,\n eagerComponent,\n type ComponentRegistryFor,\n} from \"@lattice-php/lattice/core/registry\";\nimport type { FormNodeType } from \"@lattice-php/lattice/types/generated\";\nimport {\n BuilderComponent,\n CheckboxComponent,\n ChoiceComponent,\n DateInputComponent,\n DateTimeInputComponent,\n FileUploadComponent,\n FormComponent,\n HiddenInputComponent,\n NumberInputComponent,\n OtpInputComponent,\n PasswordInputComponent,\n RepeaterComponent,\n SelectComponent,\n TextareaComponent,\n TextInputComponent,\n TimeInputComponent,\n ToggleComponent,\n} from \"./components\";\nimport { RichEditorComponent } from \"./components/fields/rich-editor\";\n\nexport const formComponents = createPlugin({\n components: {\n form: eagerComponent(FormComponent),\n \"field.builder\": eagerComponent(BuilderComponent),\n \"field.checkbox\": eagerComponent(CheckboxComponent),\n \"field.choice\": eagerComponent(ChoiceComponent),\n \"field.date-input\": eagerComponent(DateInputComponent),\n \"field.date-time-input\": eagerComponent(DateTimeInputComponent),\n \"field.file-upload\": eagerComponent(FileUploadComponent),\n \"field.hidden-input\": eagerComponent(HiddenInputComponent),\n \"field.number-input\": eagerComponent(NumberInputComponent),\n \"field.otp\": eagerComponent(OtpInputComponent),\n \"field.password-input\": eagerComponent(PasswordInputComponent),\n \"field.repeater\": eagerComponent(RepeaterComponent),\n \"field.rich-editor\": eagerComponent(RichEditorComponent),\n \"field.select\": eagerComponent(SelectComponent),\n \"field.textarea\": eagerComponent(TextareaComponent),\n \"field.text-input\": eagerComponent(TextInputComponent),\n \"field.time-input\": eagerComponent(TimeInputComponent),\n \"field.toggle\": eagerComponent(ToggleComponent),\n } satisfies ComponentRegistryFor<FormNodeType>,\n name: \"lattice/form\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,IAAa,iBAAiB,aAAa;CACzC,YAAY;EACV,MAAM,eAAe,aAAa;EAClC,iBAAiB,eAAe,gBAAgB;EAChD,kBAAkB,eAAe,iBAAiB;EAClD,gBAAgB,eAAe,eAAe;EAC9C,oBAAoB,eAAe,kBAAkB;EACrD,yBAAyB,eAAe,sBAAsB;EAC9D,qBAAqB,eAAe,mBAAmB;EACvD,sBAAsB,eAAe,oBAAoB;EACzD,sBAAsB,eAAe,oBAAoB;EACzD,aAAa,eAAe,iBAAiB;EAC7C,wBAAwB,eAAe,sBAAsB;EAC7D,kBAAkB,eAAe,iBAAiB;EAClD,qBAAqB,eAAe,mBAAmB;EACvD,gBAAgB,eAAe,eAAe;EAC9C,kBAAkB,eAAe,iBAAiB;EAClD,oBAAoB,eAAe,kBAAkB;EACrD,oBAAoB,eAAe,kBAAkB;EACrD,gBAAgB,eAAe,eAAe;CAChD;CACA,MAAM;AACR,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Entry point for building custom form fields outside the package. Form
3
+ * modules not re-exported here are internal and may change without notice.
4
+ */
5
+ export { FormFieldFrame } from './components/base/field.js';
6
+ export { useFormContext } from './hooks/context.js';
7
+ export { FieldScopeProvider, useFieldScope } from './hooks/field-scope.js';
8
+ export { fieldProps, walkFields } from './lib/field-props.js';
9
+ export { appendPath, getPath, setPath, toHtmlName } from './lib/form-path.js';
10
+ export { AddRowMenu, type AddRowOption } from './components/fields/add-row-menu.js';
11
+ export { ROW_ID_KEY, addRow, duplicateRow, ensureRowIds, moveRow, removeRow, seedRows, withRowId, type RepeaterRow, } from './components/fields/repeater-rows.js';
12
+ export { RowKeyInputs } from './components/fields/row-key-inputs.js';
13
+ export { rowSchemaFor, rowTemplatesOf, type RowTemplate } from './components/fields/row-templates.js';
14
+ export { useRowCollection } from './components/fields/use-row-collection.js';
15
+ export { useDependentField } from './hooks/use-dependent-field.js';
16
+ export { useFieldCommit } from './hooks/use-field-commit.js';
17
+ export { useFormValue, useFormValues, useSetFormValue } from './hooks/values.js';
@@ -0,0 +1,14 @@
1
+ import { useFormContext } from "./hooks/context.js";
2
+ import { fieldProps, walkFields } from "./lib/field-props.js";
3
+ import { appendPath, getPath, setPath, toHtmlName } from "./lib/form-path.js";
4
+ import { ROW_ID_KEY, addRow, duplicateRow, ensureRowIds, moveRow, removeRow, seedRows, withRowId } from "./components/fields/repeater-rows.js";
5
+ import { FieldScopeProvider, useFieldScope } from "./hooks/field-scope.js";
6
+ import { useFormValue, useFormValues, useSetFormValue } from "./hooks/values.js";
7
+ import { useFieldCommit } from "./hooks/use-field-commit.js";
8
+ import { rowSchemaFor, rowTemplatesOf } from "./components/fields/row-templates.js";
9
+ import { FormFieldFrame } from "./components/base/field.js";
10
+ import { useDependentField } from "./hooks/use-dependent-field.js";
11
+ import { AddRowMenu } from "./components/fields/add-row-menu.js";
12
+ import { RowKeyInputs } from "./components/fields/row-key-inputs.js";
13
+ import { useRowCollection } from "./components/fields/use-row-collection.js";
14
+ export { AddRowMenu, FieldScopeProvider, FormFieldFrame, ROW_ID_KEY, RowKeyInputs, addRow, appendPath, duplicateRow, ensureRowIds, fieldProps, getPath, moveRow, removeRow, rowSchemaFor, rowTemplatesOf, seedRows, setPath, toHtmlName, useDependentField, useFieldCommit, useFieldScope, useFormContext, useFormValue, useFormValues, useRowCollection, useSetFormValue, walkFields, withRowId };
@@ -1,7 +1,7 @@
1
1
  import { Method } from '@inertiajs/core';
2
- import { NodeUnionOf } from '../../core/types';
3
- import { FormFieldNodeType, FormNodeType } from '../../types/generated';
4
- export type { Checkbox, Choice, DateInput, DateTimeInput, Form, FormNodeType, HiddenInput, NumberInput, PasswordInput, RichEditor, Select, Textarea, TextInput, TimeInput, } from '../../types/generated';
2
+ import { NodeUnionOf } from '../core/types.js';
3
+ import { FormFieldNodeType, FormNodeType } from '../types/generated.js';
4
+ export type { Checkbox, Choice, DateInput, DateTimeInput, Form, FormNodeType, HiddenInput, NumberInput, PasswordInput, RichEditor, Select, Textarea, TextInput, TimeInput, } from '../types/generated.js';
5
5
  export type FormFieldNode = NodeUnionOf<FormFieldNodeType>;
6
6
  export type FormNode = NodeUnionOf<FormNodeType>;
7
7
  export type FormMethod = Method;
@@ -1,2 +1,2 @@
1
- import { NumberFormat } from '../types';
1
+ import { NumberFormat } from '../types/index.js';
2
2
  export declare function formatNumber(value: unknown, format: NumberFormat, locale: string): string;
@@ -1,4 +1,4 @@
1
- import { DateFormat, NumberFormat } from '../types';
1
+ import { DateFormat, NumberFormat } from '../types/index.js';
2
2
  export type Format = NumberFormat | DateFormat;
3
3
  export declare function formatValue(value: unknown, format: Format | null, ctx: {
4
4
  locale: string;
@@ -1,4 +1,4 @@
1
- import { I18nConfig } from '../types/generated';
1
+ import { I18nConfig } from '../types/generated.js';
2
2
  /** The i18n settings the backend shares to the frontend (Inertia `lattice.i18n`). */
3
3
  export type { I18nConfig };
4
4
  export type BackendOptions = {
@@ -1,4 +1,4 @@
1
- import { I18nConfig } from '../types/generated';
1
+ import { I18nConfig } from '../types/generated.js';
2
2
  type Config = {
3
3
  readonly locales: readonly string[];
4
4
  readonly timezone: string | null;
@@ -1,13 +1,13 @@
1
- export { i18n, useT, translate } from './instance';
2
- export { configureI18n, enableBackend } from './backend';
3
- export { currentLocale, localeHeader, setLocale, useLocale } from './locale';
4
- export { LocaleReload } from './locale-reload';
5
- export { LocaleSwitcher, useLocaleOptions } from './locale-switcher';
6
- export { configureI18nFromPageProps, i18nConfigFromPageProps } from './page-props';
7
- export type { BackendOptions, ConfigureI18nOptions, I18nConfig } from './backend';
8
- export type { LocaleOption, LocaleSwitcherProps, UseLocaleOptionsOptions, UseLocaleOptionsReturn, } from './locale-switcher';
9
- export type { UseLocaleReturn } from './locale';
10
- export { currentTimezone, setTimezone, useTimezone } from './timezone';
11
- export type { UseTimezoneReturn } from './timezone';
12
- export { DateTime } from './date-time';
13
- export type { DateTimeProps } from './date-time';
1
+ export { i18n, useT, translate } from './instance.js';
2
+ export { configureI18n, enableBackend } from './backend.js';
3
+ export { currentLocale, localeHeader, setLocale, useLocale } from './locale.js';
4
+ export { LocaleReload } from './locale-reload.js';
5
+ export { LocaleSwitcher, useLocaleOptions } from './locale-switcher.js';
6
+ export { configureI18nFromPageProps, i18nConfigFromPageProps } from './page-props.js';
7
+ export type { BackendOptions, ConfigureI18nOptions, I18nConfig } from './backend.js';
8
+ export type { LocaleOption, LocaleSwitcherProps, UseLocaleOptionsOptions, UseLocaleOptionsReturn, } from './locale-switcher.js';
9
+ export type { UseLocaleReturn } from './locale.js';
10
+ export { currentTimezone, setTimezone, useTimezone } from './timezone.js';
11
+ export type { UseTimezoneReturn } from './timezone.js';
12
+ export { DateTime } from './date-time.js';
13
+ export type { DateTimeProps } from './date-time.js';
@@ -1,4 +1,4 @@
1
- import { EventBridge } from "../events/event-bridge.js";
1
+ import { EventBridge } from "../event-bridge.js";
2
2
  import { router } from "@inertiajs/react";
3
3
  import { useCallback } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"locale-reload.js","names":[],"sources":["../../resources/js/i18n/locale-reload.tsx"],"sourcesContent":["import type { VisitOptions } from \"@inertiajs/core\";\nimport { router } from \"@inertiajs/react\";\nimport { useCallback } from \"react\";\nimport { EventBridge } from \"../events/event-bridge\";\n\ntype LocaleReloadProps = Pick<VisitOptions, \"preserveScroll\" | \"preserveState\">;\n\n// preserveState by default: the visit only re-fetches the re-localized props,\n// so keeping the page mounted avoids remounting the whole tree (and losing\n// table sort/filter, form input, focus) on every locale switch.\nexport function LocaleReload({ preserveScroll = true, preserveState = true }: LocaleReloadProps) {\n const reload = useCallback(() => {\n router.visit(window.location.href, { preserveScroll, preserveState });\n }, [preserveScroll, preserveState]);\n\n return <EventBridge onLocaleChange={reload} />;\n}\n"],"mappings":";;;;;AAUA,SAAgB,aAAa,EAAE,iBAAiB,MAAM,gBAAgB,QAA2B;CAK/F,OAAO,oBAAC,aAAD,EAAa,gBAJL,kBAAkB;EAC/B,OAAO,MAAM,OAAO,SAAS,MAAM;GAAE;GAAgB;EAAc,CAAC;CACtE,GAAG,CAAC,gBAAgB,aAAa,CAEG,EAAS,CAAA;AAC/C"}
1
+ {"version":3,"file":"locale-reload.js","names":[],"sources":["../../resources/js/i18n/locale-reload.tsx"],"sourcesContent":["import type { VisitOptions } from \"@inertiajs/core\";\nimport { router } from \"@inertiajs/react\";\nimport { useCallback } from \"react\";\nimport { EventBridge } from \"@lattice-php/lattice/event-bridge\";\n\ntype LocaleReloadProps = Pick<VisitOptions, \"preserveScroll\" | \"preserveState\">;\n\n// preserveState by default: the visit only re-fetches the re-localized props,\n// so keeping the page mounted avoids remounting the whole tree (and losing\n// table sort/filter, form input, focus) on every locale switch.\nexport function LocaleReload({ preserveScroll = true, preserveState = true }: LocaleReloadProps) {\n const reload = useCallback(() => {\n router.visit(window.location.href, { preserveScroll, preserveState });\n }, [preserveScroll, preserveState]);\n\n return <EventBridge onLocaleChange={reload} />;\n}\n"],"mappings":";;;;;AAUA,SAAgB,aAAa,EAAE,iBAAiB,MAAM,gBAAgB,QAA2B;CAK/F,OAAO,oBAAC,aAAD,EAAa,gBAJL,kBAAkB;EAC/B,OAAO,MAAM,OAAO,SAAS,MAAM;GAAE;GAAgB;EAAc,CAAC;CACtE,GAAG,CAAC,gBAAgB,aAAa,CAEG,EAAS,CAAA;AAC/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"locale.js","names":[],"sources":["../../resources/js/i18n/locale.ts"],"sourcesContent":["import { useSyncExternalStore } from \"react\";\nimport { LATTICE_EVENT } from \"../events/event-names\";\n\nexport type UseLocaleReturn = {\n readonly locale: string;\n readonly setLocale: (locale: string) => void;\n};\n\nconst key = \"locale\";\nconst fallback = \"en\";\nconst maxAge = 365 * 24 * 60 * 60;\nconst listeners = new Set<() => void>();\n\nlet active: string | undefined;\n\nfunction normalize(value: string): string {\n const next = value.trim();\n\n return next === \"\" ? fallback : next;\n}\n\nfunction storedValue(): string | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n try {\n return localStorage.getItem(key);\n } catch {\n return null;\n }\n}\n\nfunction cookieValue(): string | null {\n if (typeof document === \"undefined\") {\n return null;\n }\n\n const item = document.cookie\n .split(\";\")\n .map((cookie) => cookie.trim())\n .find((cookie) => cookie.startsWith(`${key}=`));\n\n if (!item) {\n return null;\n }\n\n try {\n return decodeURIComponent(item.slice(key.length + 1));\n } catch {\n return null;\n }\n}\n\nfunction documentValue(): string | null {\n if (typeof document === \"undefined\") {\n return null;\n }\n\n return document.documentElement.lang || null;\n}\n\nfunction detectedLocale(): string {\n return normalize(storedValue() ?? cookieValue() ?? documentValue() ?? fallback);\n}\n\nfunction persist(locale: string): void {\n if (typeof document !== \"undefined\") {\n document.cookie = `${key}=${encodeURIComponent(locale)};path=/;max-age=${maxAge};SameSite=Lax`;\n document.documentElement.lang = locale;\n }\n\n if (typeof window !== \"undefined\") {\n try {\n localStorage.setItem(key, locale);\n } catch {\n return;\n }\n }\n}\n\nfunction snapshot(): string {\n active ??= detectedLocale();\n\n return active;\n}\n\nfunction subscribe(callback: () => void): () => void {\n listeners.add(callback);\n\n return () => {\n listeners.delete(callback);\n };\n}\n\nfunction notify(): void {\n listeners.forEach((listener) => listener());\n}\n\nfunction dispatch(locale: string): void {\n if (typeof window === \"undefined\") {\n return;\n }\n\n window.dispatchEvent(new CustomEvent(LATTICE_EVENT.localeChange, { detail: { locale } }));\n}\n\nexport function currentLocale(): string {\n return snapshot();\n}\n\nexport function localeHeader(): Record<string, string> {\n return { \"Accept-Language\": currentLocale() };\n}\n\nexport function subscribeLocale(callback: (locale: string) => void): () => void {\n return subscribe(() => callback(currentLocale()));\n}\n\nexport function setLocale(locale: string): void {\n const previous = currentLocale();\n const next = normalize(locale);\n\n active = next;\n persist(next);\n\n if (next === previous) {\n return;\n }\n\n notify();\n dispatch(next);\n}\n\nexport function useLocale(): UseLocaleReturn {\n const locale = useSyncExternalStore(subscribe, snapshot, () => fallback);\n\n return { locale, setLocale } as const;\n}\n"],"mappings":";;;AAQA,IAAM,MAAM;AACZ,IAAM,WAAW;AACjB,IAAM,SAAS,MAAM,KAAK,KAAK;AAC/B,IAAM,4BAAY,IAAI,IAAgB;AAEtC,IAAI;AAEJ,SAAS,UAAU,OAAuB;CACxC,MAAM,OAAO,MAAM,KAAK;CAExB,OAAO,SAAS,KAAK,WAAW;AAClC;AAEA,SAAS,cAA6B;CACpC,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,IAAI;EACF,OAAO,aAAa,QAAQ,GAAG;CACjC,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,cAA6B;CACpC,IAAI,OAAO,aAAa,aACtB,OAAO;CAGT,MAAM,OAAO,SAAS,OACnB,MAAM,GAAG,EACT,KAAK,WAAW,OAAO,KAAK,CAAC,EAC7B,MAAM,WAAW,OAAO,WAAW,GAAG,IAAI,EAAE,CAAC;CAEhD,IAAI,CAAC,MACH,OAAO;CAGT,IAAI;EACF,OAAO,mBAAmB,KAAK,MAAM,CAAc,CAAC;CACtD,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,gBAA+B;CACtC,IAAI,OAAO,aAAa,aACtB,OAAO;CAGT,OAAO,SAAS,gBAAgB,QAAQ;AAC1C;AAEA,SAAS,iBAAyB;CAChC,OAAO,UAAU,YAAY,KAAK,YAAY,KAAK,cAAc,KAAK,QAAQ;AAChF;AAEA,SAAS,QAAQ,QAAsB;CACrC,IAAI,OAAO,aAAa,aAAa;EACnC,SAAS,SAAS,GAAG,IAAI,GAAG,mBAAmB,MAAM,EAAE,kBAAkB,OAAO;EAChF,SAAS,gBAAgB,OAAO;CAClC;CAEA,IAAI,OAAO,WAAW,aACpB,IAAI;EACF,aAAa,QAAQ,KAAK,MAAM;CAClC,QAAQ;EACN;CACF;AAEJ;AAEA,SAAS,WAAmB;CAC1B,WAAW,eAAe;CAE1B,OAAO;AACT;AAEA,SAAS,UAAU,UAAkC;CACnD,UAAU,IAAI,QAAQ;CAEtB,aAAa;EACX,UAAU,OAAO,QAAQ;CAC3B;AACF;AAEA,SAAS,SAAe;CACtB,UAAU,SAAS,aAAa,SAAS,CAAC;AAC5C;AAEA,SAAS,SAAS,QAAsB;CACtC,IAAI,OAAO,WAAW,aACpB;CAGF,OAAO,cAAc,IAAI,YAAY,cAAc,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1F;AAEA,SAAgB,gBAAwB;CACtC,OAAO,SAAS;AAClB;AAEA,SAAgB,eAAuC;CACrD,OAAO,EAAE,mBAAmB,cAAc,EAAE;AAC9C;AAEA,SAAgB,gBAAgB,UAAgD;CAC9E,OAAO,gBAAgB,SAAS,cAAc,CAAC,CAAC;AAClD;AAEA,SAAgB,UAAU,QAAsB;CAC9C,MAAM,WAAW,cAAc;CAC/B,MAAM,OAAO,UAAU,MAAM;CAE7B,SAAS;CACT,QAAQ,IAAI;CAEZ,IAAI,SAAS,UACX;CAGF,OAAO;CACP,SAAS,IAAI;AACf;AAEA,SAAgB,YAA6B;CAG3C,OAAO;EAAE,QAFM,qBAAqB,WAAW,gBAAgB,QAEtD;EAAQ;CAAU;AAC7B"}
1
+ {"version":3,"file":"locale.js","names":[],"sources":["../../resources/js/i18n/locale.ts"],"sourcesContent":["import { useSyncExternalStore } from \"react\";\nimport { LATTICE_EVENT } from \"@lattice-php/lattice/events/event-names\";\n\nexport type UseLocaleReturn = {\n readonly locale: string;\n readonly setLocale: (locale: string) => void;\n};\n\nconst key = \"locale\";\nconst fallback = \"en\";\nconst maxAge = 365 * 24 * 60 * 60;\nconst listeners = new Set<() => void>();\n\nlet active: string | undefined;\n\nfunction normalize(value: string): string {\n const next = value.trim();\n\n return next === \"\" ? fallback : next;\n}\n\nfunction storedValue(): string | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n try {\n return localStorage.getItem(key);\n } catch {\n return null;\n }\n}\n\nfunction cookieValue(): string | null {\n if (typeof document === \"undefined\") {\n return null;\n }\n\n const item = document.cookie\n .split(\";\")\n .map((cookie) => cookie.trim())\n .find((cookie) => cookie.startsWith(`${key}=`));\n\n if (!item) {\n return null;\n }\n\n try {\n return decodeURIComponent(item.slice(key.length + 1));\n } catch {\n return null;\n }\n}\n\nfunction documentValue(): string | null {\n if (typeof document === \"undefined\") {\n return null;\n }\n\n return document.documentElement.lang || null;\n}\n\nfunction detectedLocale(): string {\n return normalize(storedValue() ?? cookieValue() ?? documentValue() ?? fallback);\n}\n\nfunction persist(locale: string): void {\n if (typeof document !== \"undefined\") {\n document.cookie = `${key}=${encodeURIComponent(locale)};path=/;max-age=${maxAge};SameSite=Lax`;\n document.documentElement.lang = locale;\n }\n\n if (typeof window !== \"undefined\") {\n try {\n localStorage.setItem(key, locale);\n } catch {\n return;\n }\n }\n}\n\nfunction snapshot(): string {\n active ??= detectedLocale();\n\n return active;\n}\n\nfunction subscribe(callback: () => void): () => void {\n listeners.add(callback);\n\n return () => {\n listeners.delete(callback);\n };\n}\n\nfunction notify(): void {\n listeners.forEach((listener) => listener());\n}\n\nfunction dispatch(locale: string): void {\n if (typeof window === \"undefined\") {\n return;\n }\n\n window.dispatchEvent(new CustomEvent(LATTICE_EVENT.localeChange, { detail: { locale } }));\n}\n\nexport function currentLocale(): string {\n return snapshot();\n}\n\nexport function localeHeader(): Record<string, string> {\n return { \"Accept-Language\": currentLocale() };\n}\n\nexport function subscribeLocale(callback: (locale: string) => void): () => void {\n return subscribe(() => callback(currentLocale()));\n}\n\nexport function setLocale(locale: string): void {\n const previous = currentLocale();\n const next = normalize(locale);\n\n active = next;\n persist(next);\n\n if (next === previous) {\n return;\n }\n\n notify();\n dispatch(next);\n}\n\nexport function useLocale(): UseLocaleReturn {\n const locale = useSyncExternalStore(subscribe, snapshot, () => fallback);\n\n return { locale, setLocale } as const;\n}\n"],"mappings":";;;AAQA,IAAM,MAAM;AACZ,IAAM,WAAW;AACjB,IAAM,SAAS,MAAM,KAAK,KAAK;AAC/B,IAAM,4BAAY,IAAI,IAAgB;AAEtC,IAAI;AAEJ,SAAS,UAAU,OAAuB;CACxC,MAAM,OAAO,MAAM,KAAK;CAExB,OAAO,SAAS,KAAK,WAAW;AAClC;AAEA,SAAS,cAA6B;CACpC,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,IAAI;EACF,OAAO,aAAa,QAAQ,GAAG;CACjC,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,cAA6B;CACpC,IAAI,OAAO,aAAa,aACtB,OAAO;CAGT,MAAM,OAAO,SAAS,OACnB,MAAM,GAAG,EACT,KAAK,WAAW,OAAO,KAAK,CAAC,EAC7B,MAAM,WAAW,OAAO,WAAW,GAAG,IAAI,EAAE,CAAC;CAEhD,IAAI,CAAC,MACH,OAAO;CAGT,IAAI;EACF,OAAO,mBAAmB,KAAK,MAAM,CAAc,CAAC;CACtD,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,gBAA+B;CACtC,IAAI,OAAO,aAAa,aACtB,OAAO;CAGT,OAAO,SAAS,gBAAgB,QAAQ;AAC1C;AAEA,SAAS,iBAAyB;CAChC,OAAO,UAAU,YAAY,KAAK,YAAY,KAAK,cAAc,KAAK,QAAQ;AAChF;AAEA,SAAS,QAAQ,QAAsB;CACrC,IAAI,OAAO,aAAa,aAAa;EACnC,SAAS,SAAS,GAAG,IAAI,GAAG,mBAAmB,MAAM,EAAE,kBAAkB,OAAO;EAChF,SAAS,gBAAgB,OAAO;CAClC;CAEA,IAAI,OAAO,WAAW,aACpB,IAAI;EACF,aAAa,QAAQ,KAAK,MAAM;CAClC,QAAQ;EACN;CACF;AAEJ;AAEA,SAAS,WAAmB;CAC1B,WAAW,eAAe;CAE1B,OAAO;AACT;AAEA,SAAS,UAAU,UAAkC;CACnD,UAAU,IAAI,QAAQ;CAEtB,aAAa;EACX,UAAU,OAAO,QAAQ;CAC3B;AACF;AAEA,SAAS,SAAe;CACtB,UAAU,SAAS,aAAa,SAAS,CAAC;AAC5C;AAEA,SAAS,SAAS,QAAsB;CACtC,IAAI,OAAO,WAAW,aACpB;CAGF,OAAO,cAAc,IAAI,YAAY,cAAc,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1F;AAEA,SAAgB,gBAAwB;CACtC,OAAO,SAAS;AAClB;AAEA,SAAgB,eAAuC;CACrD,OAAO,EAAE,mBAAmB,cAAc,EAAE;AAC9C;AAEA,SAAgB,gBAAgB,UAAgD;CAC9E,OAAO,gBAAgB,SAAS,cAAc,CAAC,CAAC;AAClD;AAEA,SAAgB,UAAU,QAAsB;CAC9C,MAAM,WAAW,cAAc;CAC/B,MAAM,OAAO,UAAU,MAAM;CAE7B,SAAS;CACT,QAAQ,IAAI;CAEZ,IAAI,SAAS,UACX;CAGF,OAAO;CACP,SAAS,IAAI;AACf;AAEA,SAAgB,YAA6B;CAG3C,OAAO;EAAE,QAFM,qBAAqB,WAAW,gBAAgB,QAEtD;EAAQ;CAAU;AAC7B"}
@@ -1,3 +1,3 @@
1
- import { ConfigureI18nOptions, I18nConfig } from './backend';
1
+ import { ConfigureI18nOptions, I18nConfig } from './backend.js';
2
2
  export declare function i18nConfigFromPageProps(props: unknown): I18nConfig | undefined;
3
3
  export declare function configureI18nFromPageProps(props: unknown, options?: ConfigureI18nOptions): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"timezone.js","names":[],"sources":["../../resources/js/i18n/timezone.ts"],"sourcesContent":["import { useSyncExternalStore } from \"react\";\nimport { LATTICE_EVENT } from \"../events/event-names\";\nimport { configTimezone, subscribeConfig } from \"./config\";\n\nexport type UseTimezoneReturn = {\n readonly timezone: string;\n readonly setTimezone: (timezone: string) => void;\n};\n\nconst fallback = \"UTC\";\nconst listeners = new Set<() => void>();\n\nlet override: string | undefined;\n\nfunction detectedTimezone(): string {\n if (typeof Intl === \"undefined\") {\n return fallback;\n }\n\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone || fallback;\n } catch {\n return fallback;\n }\n}\n\nfunction snapshot(): string {\n return override ?? configTimezone() ?? detectedTimezone();\n}\n\nfunction subscribe(callback: () => void): () => void {\n listeners.add(callback);\n\n return () => {\n listeners.delete(callback);\n };\n}\n\nfunction notify(): void {\n listeners.forEach((listener) => listener());\n}\n\nsubscribeConfig(() => notify());\n\nfunction dispatch(timezone: string): void {\n if (typeof window === \"undefined\") {\n return;\n }\n\n window.dispatchEvent(new CustomEvent(LATTICE_EVENT.timezoneChange, { detail: { timezone } }));\n}\n\nexport function currentTimezone(): string {\n return snapshot();\n}\n\nexport function setTimezone(timezone: string): void {\n const previous = currentTimezone();\n const next = timezone.trim();\n\n override = next === \"\" ? undefined : next;\n\n if (currentTimezone() === previous) {\n return;\n }\n\n notify();\n dispatch(currentTimezone());\n}\n\nexport function useTimezone(): UseTimezoneReturn {\n const timezone = useSyncExternalStore(subscribe, snapshot, () => fallback);\n\n return { timezone, setTimezone } as const;\n}\n"],"mappings":";;;;AASA,IAAM,WAAW;AACjB,IAAM,4BAAY,IAAI,IAAgB;AAEtC,IAAI;AAEJ,SAAS,mBAA2B;CAClC,IAAI,OAAO,SAAS,aAClB,OAAO;CAGT,IAAI;EACF,OAAO,KAAK,eAAe,EAAE,gBAAgB,EAAE,YAAY;CAC7D,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,WAAmB;CAC1B,OAAO,YAAY,eAAe,KAAK,iBAAiB;AAC1D;AAEA,SAAS,UAAU,UAAkC;CACnD,UAAU,IAAI,QAAQ;CAEtB,aAAa;EACX,UAAU,OAAO,QAAQ;CAC3B;AACF;AAEA,SAAS,SAAe;CACtB,UAAU,SAAS,aAAa,SAAS,CAAC;AAC5C;AAEA,sBAAsB,OAAO,CAAC;AAE9B,SAAS,SAAS,UAAwB;CACxC,IAAI,OAAO,WAAW,aACpB;CAGF,OAAO,cAAc,IAAI,YAAY,cAAc,gBAAgB,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;AAC9F;AAEA,SAAgB,kBAA0B;CACxC,OAAO,SAAS;AAClB;AAEA,SAAgB,YAAY,UAAwB;CAClD,MAAM,WAAW,gBAAgB;CACjC,MAAM,OAAO,SAAS,KAAK;CAE3B,WAAW,SAAS,KAAK,KAAA,IAAY;CAErC,IAAI,gBAAgB,MAAM,UACxB;CAGF,OAAO;CACP,SAAS,gBAAgB,CAAC;AAC5B;AAEA,SAAgB,cAAiC;CAG/C,OAAO;EAAE,UAFQ,qBAAqB,WAAW,gBAAgB,QAExD;EAAU;CAAY;AACjC"}
1
+ {"version":3,"file":"timezone.js","names":[],"sources":["../../resources/js/i18n/timezone.ts"],"sourcesContent":["import { useSyncExternalStore } from \"react\";\nimport { LATTICE_EVENT } from \"@lattice-php/lattice/events/event-names\";\nimport { configTimezone, subscribeConfig } from \"./config\";\n\nexport type UseTimezoneReturn = {\n readonly timezone: string;\n readonly setTimezone: (timezone: string) => void;\n};\n\nconst fallback = \"UTC\";\nconst listeners = new Set<() => void>();\n\nlet override: string | undefined;\n\nfunction detectedTimezone(): string {\n if (typeof Intl === \"undefined\") {\n return fallback;\n }\n\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone || fallback;\n } catch {\n return fallback;\n }\n}\n\nfunction snapshot(): string {\n return override ?? configTimezone() ?? detectedTimezone();\n}\n\nfunction subscribe(callback: () => void): () => void {\n listeners.add(callback);\n\n return () => {\n listeners.delete(callback);\n };\n}\n\nfunction notify(): void {\n listeners.forEach((listener) => listener());\n}\n\nsubscribeConfig(() => notify());\n\nfunction dispatch(timezone: string): void {\n if (typeof window === \"undefined\") {\n return;\n }\n\n window.dispatchEvent(new CustomEvent(LATTICE_EVENT.timezoneChange, { detail: { timezone } }));\n}\n\nexport function currentTimezone(): string {\n return snapshot();\n}\n\nexport function setTimezone(timezone: string): void {\n const previous = currentTimezone();\n const next = timezone.trim();\n\n override = next === \"\" ? undefined : next;\n\n if (currentTimezone() === previous) {\n return;\n }\n\n notify();\n dispatch(currentTimezone());\n}\n\nexport function useTimezone(): UseTimezoneReturn {\n const timezone = useSyncExternalStore(subscribe, snapshot, () => fallback);\n\n return { timezone, setTimezone } as const;\n}\n"],"mappings":";;;;AASA,IAAM,WAAW;AACjB,IAAM,4BAAY,IAAI,IAAgB;AAEtC,IAAI;AAEJ,SAAS,mBAA2B;CAClC,IAAI,OAAO,SAAS,aAClB,OAAO;CAGT,IAAI;EACF,OAAO,KAAK,eAAe,EAAE,gBAAgB,EAAE,YAAY;CAC7D,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,WAAmB;CAC1B,OAAO,YAAY,eAAe,KAAK,iBAAiB;AAC1D;AAEA,SAAS,UAAU,UAAkC;CACnD,UAAU,IAAI,QAAQ;CAEtB,aAAa;EACX,UAAU,OAAO,QAAQ;CAC3B;AACF;AAEA,SAAS,SAAe;CACtB,UAAU,SAAS,aAAa,SAAS,CAAC;AAC5C;AAEA,sBAAsB,OAAO,CAAC;AAE9B,SAAS,SAAS,UAAwB;CACxC,IAAI,OAAO,WAAW,aACpB;CAGF,OAAO,cAAc,IAAI,YAAY,cAAc,gBAAgB,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;AAC9F;AAEA,SAAgB,kBAA0B;CACxC,OAAO,SAAS;AAClB;AAEA,SAAgB,YAAY,UAAwB;CAClD,MAAM,WAAW,gBAAgB;CACjC,MAAM,OAAO,SAAS,KAAK;CAE3B,WAAW,SAAS,KAAK,KAAA,IAAY;CAErC,IAAI,gBAAgB,MAAM,UACxB;CAGF,OAAO;CACP,SAAS,gBAAgB,CAAC;AAC5B;AAEA,SAAgB,cAAiC;CAG/C,OAAO;EAAE,UAFQ,qBAAqB,WAAW,gBAAgB,QAExD;EAAU;CAAY;AACjC"}
@@ -1,4 +1,4 @@
1
- import { Translatable } from '../types/generated';
1
+ import { Translatable } from '../types/generated.js';
2
2
  export type Translate = (key: string, defaultValue?: string, options?: Record<string, unknown>) => string;
3
3
  export declare function isTranslatable(value: unknown): value is Translatable;
4
4
  export declare function resolveTranslatable(value: Translatable, payload: Record<string, unknown>, t: Translate): string;
@@ -1 +1 @@
1
- {"version":3,"file":"icon-renderer.js","names":[],"sources":["../../resources/js/icons/icon-renderer.tsx"],"sourcesContent":["import { createContext, useContext, useMemo } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { Icon, useSprite } from \"./sprite\";\n\nexport type IconRendererProps = {\n className?: string;\n icon: string;\n};\n\nexport type IconRendererFunction = (props: IconRendererProps) => ReactNode;\n\ntype IconRendererProviderProps = {\n children: ReactNode;\n mode?: \"replace\" | \"stack\";\n renderer: IconRendererFunction;\n};\n\nconst IconRenderersContext = createContext<IconRendererFunction[]>([]);\nconst loggedMissingIcons = new Set<string>();\n\nexport function IconRendererProvider({\n children,\n mode = \"stack\",\n renderer,\n}: IconRendererProviderProps) {\n const parentRenderers = useContext(IconRenderersContext);\n const renderers = useMemo(\n () => (mode === \"replace\" ? [renderer] : [renderer, ...parentRenderers]),\n [mode, parentRenderers, renderer],\n );\n\n return (\n <IconRenderersContext.Provider value={renderers}>{children}</IconRenderersContext.Provider>\n );\n}\n\nexport function IconRenderer({ className, icon }: IconRendererProps) {\n const renderers = useContext(IconRenderersContext);\n const { ids } = useSprite();\n\n // Custom renderers (the override stack) take precedence over the sprite.\n for (const renderer of renderers) {\n const rendered = renderer({ className, icon });\n\n if (rendered !== null && rendered !== undefined && rendered !== false) {\n return rendered;\n }\n }\n\n // When the sprite is wired and the icon is genuinely absent, show a visible\n // marker. When `ids` is unknown (not yet wired), optimistically emit the\n // sprite reference rather than crying wolf.\n if (ids && !ids.includes(icon)) {\n logMissingIcon(icon);\n return <MissingIcon className={className} />;\n }\n\n return <Icon className={className} name={icon} />;\n}\n\nfunction MissingIcon({ className }: { className?: string }) {\n return (\n <svg\n aria-hidden=\"true\"\n className={cn(\"size-lt-icon-md text-lt-muted-fg\", className)}\n data-lattice-missing-icon=\"\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n );\n}\n\nfunction logMissingIcon(icon: string): void {\n if (!import.meta.env.DEV || loggedMissingIcons.has(icon)) {\n return;\n }\n\n loggedMissingIcons.add(icon);\n console.log(`[Lattice] Missing icon renderer for \"${icon}\".`);\n}\n"],"mappings":";;;;;AAkBA,IAAM,uBAAuB,cAAsC,CAAC,CAAC;AAGrE,SAAgB,qBAAqB,EACnC,UACA,OAAO,SACP,YAC4B;CAC5B,MAAM,kBAAkB,WAAW,oBAAoB;CACvD,MAAM,YAAY,cACT,SAAS,YAAY,CAAC,QAAQ,IAAI,CAAC,UAAU,GAAG,eAAe,GACtE;EAAC;EAAM;EAAiB;CAAQ,CAClC;CAEA,OACE,oBAAC,qBAAqB,UAAtB;EAA+B,OAAO;EAAY;CAAwC,CAAA;AAE9F;AAEA,SAAgB,aAAa,EAAE,WAAW,QAA2B;CACnE,MAAM,YAAY,WAAW,oBAAoB;CACjD,MAAM,EAAE,QAAQ,UAAU;CAG1B,KAAK,MAAM,YAAY,WAAW;EAChC,MAAM,WAAW,SAAS;GAAE;GAAW;EAAK,CAAC;EAE7C,IAAI,aAAa,QAAQ,aAAa,KAAA,KAAa,aAAa,OAC9D,OAAO;CAEX;CAKA,IAAI,OAAO,CAAC,IAAI,SAAS,IAAI,GAE3B,OAAO,oBAAC,aAAD,EAAwB,UAAY,CAAA;CAG7C,OAAO,oBAAC,MAAD;EAAiB;EAAW,MAAM;CAAO,CAAA;AAClD;AAEA,SAAS,YAAY,EAAE,aAAqC;CAC1D,OACE,qBAAC,OAAD;EACE,eAAY;EACZ,WAAW,GAAG,oCAAoC,SAAS;EAC3D,6BAA0B;EAC1B,MAAK;EACL,QAAO;EACP,eAAc;EACd,gBAAe;EACf,aAAY;EACZ,SAAQ;YATV;GAWE,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAK,GAAE;GAAM,CAAA;GAChC,oBAAC,QAAD,EAAM,GAAE,uCAAwC,CAAA;GAChD,oBAAC,QAAD,EAAM,GAAE,aAAc,CAAA;EACnB;;AAET"}
1
+ {"version":3,"file":"icon-renderer.js","names":[],"sources":["../../resources/js/icons/icon-renderer.tsx"],"sourcesContent":["import { createContext, useContext, useMemo } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { Icon, useSprite } from \"./sprite\";\n\nexport type IconRendererProps = {\n className?: string;\n icon: string;\n};\n\nexport type IconRendererFunction = (props: IconRendererProps) => ReactNode;\n\ntype IconRendererProviderProps = {\n children: ReactNode;\n mode?: \"replace\" | \"stack\";\n renderer: IconRendererFunction;\n};\n\nconst IconRenderersContext = createContext<IconRendererFunction[]>([]);\nconst loggedMissingIcons = new Set<string>();\n\nexport function IconRendererProvider({\n children,\n mode = \"stack\",\n renderer,\n}: IconRendererProviderProps) {\n const parentRenderers = useContext(IconRenderersContext);\n const renderers = useMemo(\n () => (mode === \"replace\" ? [renderer] : [renderer, ...parentRenderers]),\n [mode, parentRenderers, renderer],\n );\n\n return (\n <IconRenderersContext.Provider value={renderers}>{children}</IconRenderersContext.Provider>\n );\n}\n\nexport function IconRenderer({ className, icon }: IconRendererProps) {\n const renderers = useContext(IconRenderersContext);\n const { ids } = useSprite();\n\n for (const renderer of renderers) {\n const rendered = renderer({ className, icon });\n\n if (rendered !== null && rendered !== undefined && rendered !== false) {\n return rendered;\n }\n }\n\n // When the sprite is wired and the icon is genuinely absent, show a visible\n // marker. When `ids` is unknown (not yet wired), optimistically emit the\n // sprite reference rather than crying wolf.\n if (ids && !ids.includes(icon)) {\n logMissingIcon(icon);\n return <MissingIcon className={className} />;\n }\n\n return <Icon className={className} name={icon} />;\n}\n\nfunction MissingIcon({ className }: { className?: string }) {\n return (\n <svg\n aria-hidden=\"true\"\n className={cn(\"size-lt-icon-md text-lt-muted-fg\", className)}\n data-lattice-missing-icon=\"\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n );\n}\n\nfunction logMissingIcon(icon: string): void {\n if (!import.meta.env.DEV || loggedMissingIcons.has(icon)) {\n return;\n }\n\n loggedMissingIcons.add(icon);\n console.log(`[Lattice] Missing icon renderer for \"${icon}\".`);\n}\n"],"mappings":";;;;;AAkBA,IAAM,uBAAuB,cAAsC,CAAC,CAAC;AAGrE,SAAgB,qBAAqB,EACnC,UACA,OAAO,SACP,YAC4B;CAC5B,MAAM,kBAAkB,WAAW,oBAAoB;CACvD,MAAM,YAAY,cACT,SAAS,YAAY,CAAC,QAAQ,IAAI,CAAC,UAAU,GAAG,eAAe,GACtE;EAAC;EAAM;EAAiB;CAAQ,CAClC;CAEA,OACE,oBAAC,qBAAqB,UAAtB;EAA+B,OAAO;EAAY;CAAwC,CAAA;AAE9F;AAEA,SAAgB,aAAa,EAAE,WAAW,QAA2B;CACnE,MAAM,YAAY,WAAW,oBAAoB;CACjD,MAAM,EAAE,QAAQ,UAAU;CAE1B,KAAK,MAAM,YAAY,WAAW;EAChC,MAAM,WAAW,SAAS;GAAE;GAAW;EAAK,CAAC;EAE7C,IAAI,aAAa,QAAQ,aAAa,KAAA,KAAa,aAAa,OAC9D,OAAO;CAEX;CAKA,IAAI,OAAO,CAAC,IAAI,SAAS,IAAI,GAE3B,OAAO,oBAAC,aAAD,EAAwB,UAAY,CAAA;CAG7C,OAAO,oBAAC,MAAD;EAAiB;EAAW,MAAM;CAAO,CAAA;AAClD;AAEA,SAAS,YAAY,EAAE,aAAqC;CAC1D,OACE,qBAAC,OAAD;EACE,eAAY;EACZ,WAAW,GAAG,oCAAoC,SAAS;EAC3D,6BAA0B;EAC1B,MAAK;EACL,QAAO;EACP,eAAc;EACd,gBAAe;EACf,aAAY;EACZ,SAAQ;YATV;GAWE,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAK,GAAE;GAAM,CAAA;GAChC,oBAAC,QAAD,EAAM,GAAE,uCAAwC,CAAA;GAChD,oBAAC,QAAD,EAAM,GAAE,aAAc,CAAA;EACnB;;AAET"}
@@ -1,4 +1,4 @@
1
- export { Icon, SpriteProvider, useSprite } from './sprite';
2
- export type { IconName, KnownIcons, SpriteValue } from './sprite';
3
- export { IconRenderer, IconRendererProvider } from './icon-renderer';
4
- export type { IconRendererFunction, IconRendererProps } from './icon-renderer';
1
+ export { Icon, SpriteProvider, useSprite } from './sprite.js';
2
+ export type { IconName, KnownIcons, SpriteValue } from './sprite.js';
3
+ export { IconRenderer, IconRendererProvider } from './icon-renderer.js';
4
+ export type { IconRendererFunction, IconRendererProps } from './icon-renderer.js';