@lattice-php/lattice 0.17.2 → 0.18.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 (728) hide show
  1. package/dist/action/components/action-form.d.ts +2 -2
  2. package/dist/action/components/action-form.js +11 -11
  3. package/dist/action/components/action-form.js.map +1 -1
  4. package/dist/action/components/action-group.d.ts +1 -1
  5. package/dist/action/components/action-group.js +6 -4
  6. package/dist/action/components/action-group.js.map +1 -1
  7. package/dist/action/components/action-trigger-provider.d.ts +10 -0
  8. package/dist/action/components/action-trigger-provider.js +24 -0
  9. package/dist/action/components/action-trigger-provider.js.map +1 -0
  10. package/dist/action/components/action.d.ts +1 -1
  11. package/dist/action/components/action.js +4 -4
  12. package/dist/action/components/action.js.map +1 -1
  13. package/dist/action/{use-action.d.ts → hooks/use-action.d.ts} +1 -1
  14. package/dist/action/{use-action.js → hooks/use-action.js} +7 -7
  15. package/dist/action/hooks/use-action.js.map +1 -0
  16. package/dist/action/hooks/use-click-behavior.d.ts +3 -0
  17. package/dist/action/hooks/use-click-behavior.js +3 -0
  18. package/dist/action/index.d.ts +10 -1
  19. package/dist/action/index.js +8 -13
  20. package/dist/action/{run-action.d.ts → lib/run-action.d.ts} +1 -1
  21. package/dist/action/{run-action.js → lib/run-action.js} +2 -2
  22. package/dist/action/lib/run-action.js.map +1 -0
  23. package/dist/action/plugin.d.ts +1 -0
  24. package/dist/action/plugin.js +15 -0
  25. package/dist/action/plugin.js.map +1 -0
  26. package/dist/appearance/index.d.ts +4 -1
  27. package/dist/appearance/index.js +11 -2
  28. package/dist/appearance/index.js.map +1 -1
  29. package/dist/chat/components/chat-box.d.ts +1 -1
  30. package/dist/chat/components/chat-box.js +2 -2
  31. package/dist/chat/components/chat-box.js.map +1 -1
  32. package/dist/chat/components/message-list.d.ts +1 -1
  33. package/dist/chat/components/message-list.js.map +1 -1
  34. package/dist/chat/components/message.d.ts +1 -1
  35. package/dist/chat/components/message.js.map +1 -1
  36. package/dist/chat/components/prompt-input.js +1 -1
  37. package/dist/chat/components/prompt-input.js.map +1 -1
  38. package/dist/chat/{use-chat.d.ts → hooks/use-chat.d.ts} +1 -1
  39. package/dist/chat/{use-chat.js → hooks/use-chat.js} +2 -2
  40. package/dist/chat/hooks/use-chat.js.map +1 -0
  41. package/dist/chat/index.d.ts +4 -1
  42. package/dist/chat/index.js +3 -17
  43. package/dist/chat/{transport.d.ts → lib/transport.d.ts} +2 -2
  44. package/dist/chat/{transport.js → lib/transport.js} +2 -2
  45. package/dist/chat/lib/transport.js.map +1 -0
  46. package/dist/chat/parts/text.d.ts +1 -1
  47. package/dist/chat/parts/tool-call.d.ts +1 -1
  48. package/dist/chat/plugin.d.ts +2 -0
  49. package/dist/chat/plugin.js +17 -0
  50. package/dist/chat/plugin.js.map +1 -0
  51. package/dist/chat/types.d.ts +2 -2
  52. package/dist/clipboard/index.d.ts +1 -2
  53. package/dist/clipboard/index.js +1 -10
  54. package/dist/clipboard/index.js.map +1 -1
  55. package/dist/core/api.d.ts +1 -1
  56. package/dist/core/api.js.map +1 -1
  57. package/dist/core/headers.js.map +1 -1
  58. package/dist/core/{column-sizing.d.ts → hooks/column-sizing.d.ts} +2 -2
  59. package/dist/core/{column-sizing.js → hooks/column-sizing.js} +1 -1
  60. package/dist/core/hooks/column-sizing.js.map +1 -0
  61. package/dist/core/{use-column-resizing.d.ts → hooks/use-column-resizing.d.ts} +2 -1
  62. package/dist/core/{use-column-resizing.js → hooks/use-column-resizing.js} +59 -31
  63. package/dist/core/hooks/use-column-resizing.js.map +1 -0
  64. package/dist/core/index.d.ts +13 -0
  65. package/dist/core/index.js +10 -0
  66. package/dist/core/materialize.d.ts +9 -0
  67. package/dist/core/materialize.js +39 -0
  68. package/dist/core/materialize.js.map +1 -0
  69. package/dist/core/nodes.d.ts +1 -1
  70. package/dist/core/registry-context.d.ts +3 -3
  71. package/dist/core/registry-context.js.map +1 -1
  72. package/dist/core/registry.d.ts +5 -3
  73. package/dist/core/registry.js.map +1 -1
  74. package/dist/core/renderer.d.ts +1 -1
  75. package/dist/core/renderer.js +3 -3
  76. package/dist/core/renderer.js.map +1 -1
  77. package/dist/core/test-id.d.ts +1 -1
  78. package/dist/core/types.d.ts +1 -1
  79. package/dist/create-app.d.ts +3 -3
  80. package/dist/effects/dispatch.d.ts +2 -2
  81. package/dist/effects/registry.d.ts +4 -3
  82. package/dist/effects/registry.js +7 -7
  83. package/dist/effects/registry.js.map +1 -1
  84. package/dist/effects/use-effect-dispatcher.d.ts +1 -1
  85. package/dist/{events/event-bridge.d.ts → event-bridge.d.ts} +2 -3
  86. package/dist/{events/event-bridge.js → event-bridge.js} +4 -11
  87. package/dist/event-bridge.js.map +1 -0
  88. package/dist/form/components/base/field.d.ts +1 -1
  89. package/dist/form/components/base/field.js +5 -5
  90. package/dist/form/components/base/field.js.map +1 -1
  91. package/dist/form/components/base/submit-button.d.ts +1 -1
  92. package/dist/form/components/base/submit-button.js +3 -3
  93. package/dist/form/components/base/submit-button.js.map +1 -1
  94. package/dist/form/components/fields/{block-add-menu.d.ts → add-row-menu.d.ts} +3 -3
  95. package/dist/form/components/fields/{block-add-menu.js → add-row-menu.js} +10 -10
  96. package/dist/form/components/fields/add-row-menu.js.map +1 -0
  97. package/dist/form/components/fields/builder.d.ts +1 -1
  98. package/dist/form/components/fields/builder.js +80 -75
  99. package/dist/form/components/fields/builder.js.map +1 -1
  100. package/dist/form/components/fields/checkbox.d.ts +1 -1
  101. package/dist/form/components/fields/checkbox.js +12 -9
  102. package/dist/form/components/fields/checkbox.js.map +1 -1
  103. package/dist/form/components/fields/choice.d.ts +1 -1
  104. package/dist/form/components/fields/choice.js +4 -4
  105. package/dist/form/components/fields/choice.js.map +1 -1
  106. package/dist/form/components/fields/date-input.d.ts +1 -1
  107. package/dist/form/components/fields/date-picker-field.js +2 -2
  108. package/dist/form/components/fields/date-picker-field.js.map +1 -1
  109. package/dist/form/components/fields/date-picker.d.ts +1 -1
  110. package/dist/form/components/fields/date-time-input.d.ts +1 -1
  111. package/dist/form/components/fields/file-upload.d.ts +1 -1
  112. package/dist/form/components/fields/file-upload.js +4 -4
  113. package/dist/form/components/fields/file-upload.js.map +1 -1
  114. package/dist/form/components/fields/hidden-input.d.ts +1 -1
  115. package/dist/form/components/fields/hidden-input.js +1 -1
  116. package/dist/form/components/fields/hidden-input.js.map +1 -1
  117. package/dist/form/components/fields/number-input.d.ts +1 -1
  118. package/dist/form/components/fields/number-input.js +2 -2
  119. package/dist/form/components/fields/number-input.js.map +1 -1
  120. package/dist/form/components/fields/otp-input.d.ts +1 -1
  121. package/dist/form/components/fields/otp-input.js +1 -1
  122. package/dist/form/components/fields/otp-input.js.map +1 -1
  123. package/dist/form/components/fields/password-input.d.ts +1 -1
  124. package/dist/form/components/fields/password-input.js +6 -6
  125. package/dist/form/components/fields/password-input.js.map +1 -1
  126. package/dist/form/components/fields/repeater-rows.d.ts +6 -1
  127. package/dist/form/components/fields/repeater-rows.js +9 -5
  128. package/dist/form/components/fields/repeater-rows.js.map +1 -1
  129. package/dist/form/components/fields/repeater.d.ts +1 -1
  130. package/dist/form/components/fields/repeater.js +57 -48
  131. package/dist/form/components/fields/repeater.js.map +1 -1
  132. package/dist/form/components/fields/rich-editor-field.d.ts +1 -1
  133. package/dist/form/components/fields/rich-editor-field.js +5 -5
  134. package/dist/form/components/fields/rich-editor-field.js.map +1 -1
  135. package/dist/form/components/fields/rich-editor.d.ts +1 -1
  136. package/dist/form/components/fields/row-action-menu.d.ts +2 -2
  137. package/dist/form/components/fields/row-actions.js +1 -1
  138. package/dist/form/components/fields/row-actions.js.map +1 -1
  139. package/dist/form/components/fields/row-item.d.ts +3 -3
  140. package/dist/form/components/fields/row-item.js +1 -1
  141. package/dist/form/components/fields/row-item.js.map +1 -1
  142. package/dist/form/components/fields/row-key-inputs.d.ts +7 -0
  143. package/dist/form/components/fields/row-key-inputs.js +16 -0
  144. package/dist/form/components/fields/row-key-inputs.js.map +1 -0
  145. package/dist/form/components/fields/row-templates.d.ts +9 -0
  146. package/dist/form/components/fields/row-templates.js +14 -0
  147. package/dist/form/components/fields/row-templates.js.map +1 -0
  148. package/dist/form/components/fields/select.d.ts +1 -1
  149. package/dist/form/components/fields/select.js +23 -13
  150. package/dist/form/components/fields/select.js.map +1 -1
  151. package/dist/form/components/fields/simple-field.d.ts +2 -2
  152. package/dist/form/components/fields/simple-field.js +2 -2
  153. package/dist/form/components/fields/simple-field.js.map +1 -1
  154. package/dist/form/components/fields/table-rows.d.ts +3 -3
  155. package/dist/form/components/fields/table-rows.js +10 -11
  156. package/dist/form/components/fields/table-rows.js.map +1 -1
  157. package/dist/form/components/fields/text-input.d.ts +1 -1
  158. package/dist/form/components/fields/text-input.js +2 -2
  159. package/dist/form/components/fields/text-input.js.map +1 -1
  160. package/dist/form/components/fields/textarea.d.ts +1 -1
  161. package/dist/form/components/fields/textarea.js +1 -1
  162. package/dist/form/components/fields/textarea.js.map +1 -1
  163. package/dist/form/components/fields/time-input.d.ts +1 -1
  164. package/dist/form/components/fields/time-input.js +3 -3
  165. package/dist/form/components/fields/time-input.js.map +1 -1
  166. package/dist/form/components/fields/time-picker.d.ts +1 -1
  167. package/dist/form/components/fields/toggle.d.ts +1 -1
  168. package/dist/form/components/fields/toggle.js +10 -9
  169. package/dist/form/components/fields/toggle.js.map +1 -1
  170. package/dist/form/components/fields/use-row-collection.d.ts +1 -1
  171. package/dist/form/components/fields/use-row-collection.js +2 -2
  172. package/dist/form/components/fields/use-row-collection.js.map +1 -1
  173. package/dist/form/components/form.d.ts +1 -1
  174. package/dist/form/components/form.js +6 -6
  175. package/dist/form/components/form.js.map +1 -1
  176. package/dist/form/components/index.d.ts +17 -17
  177. package/dist/form/embed.d.ts +17 -0
  178. package/dist/form/embed.js +10 -0
  179. package/dist/form/{components → hooks}/context.d.ts +3 -0
  180. package/dist/form/{components → hooks}/context.js +2 -1
  181. package/dist/form/hooks/context.js.map +1 -0
  182. package/dist/form/{components → hooks}/field-scope.js +3 -3
  183. package/dist/form/hooks/field-scope.js.map +1 -0
  184. package/dist/form/{components → hooks}/prefill-context.js +1 -1
  185. package/dist/form/hooks/prefill-context.js.map +1 -0
  186. package/dist/form/{components → hooks}/resolved-nodes.d.ts +1 -1
  187. package/dist/form/{components → hooks}/resolved-nodes.js +2 -2
  188. package/dist/form/hooks/resolved-nodes.js.map +1 -0
  189. package/dist/form/{components → hooks}/row-layout-context.js +1 -1
  190. package/dist/form/hooks/row-layout-context.js.map +1 -0
  191. package/dist/form/{components → hooks}/use-controlled-field.d.ts +2 -2
  192. package/dist/form/{components → hooks}/use-controlled-field.js +6 -5
  193. package/dist/form/hooks/use-controlled-field.js.map +1 -0
  194. package/dist/form/hooks/use-dependent-field.d.ts +3 -0
  195. package/dist/form/{components → hooks}/use-dependent-field.js +6 -6
  196. package/dist/form/hooks/use-dependent-field.js.map +1 -0
  197. package/dist/form/{components → hooks}/use-field-commit.d.ts +5 -0
  198. package/dist/form/{components → hooks}/use-field-commit.js +9 -2
  199. package/dist/form/hooks/use-field-commit.js.map +1 -0
  200. package/dist/form/{components → hooks}/use-form-resolver.d.ts +2 -2
  201. package/dist/form/{components → hooks}/use-form-resolver.js +5 -5
  202. package/dist/form/hooks/use-form-resolver.js.map +1 -0
  203. package/dist/form/{components → hooks}/use-seed-default.js +1 -1
  204. package/dist/form/hooks/use-seed-default.js.map +1 -0
  205. package/dist/form/{components → hooks}/values.d.ts +3 -1
  206. package/dist/form/hooks/values.js +136 -0
  207. package/dist/form/hooks/values.js.map +1 -0
  208. package/dist/form/index.d.ts +4 -1
  209. package/dist/form/index.js +3 -30
  210. package/dist/form/{components → lib}/conditions.d.ts +2 -1
  211. package/dist/form/{components → lib}/conditions.js +12 -2
  212. package/dist/form/lib/conditions.js.map +1 -0
  213. package/dist/form/lib/field-dom-name.d.ts +1 -0
  214. package/dist/form/lib/field-dom-name.js +10 -0
  215. package/dist/form/lib/field-dom-name.js.map +1 -0
  216. package/dist/form/{components → lib}/field-props.d.ts +2 -3
  217. package/dist/form/{components → lib}/field-props.js +1 -1
  218. package/dist/form/lib/field-props.js.map +1 -0
  219. package/dist/form/{components → lib}/form-path.js +1 -1
  220. package/dist/form/lib/form-path.js.map +1 -0
  221. package/dist/form/{components → lib}/form-transport.d.ts +1 -1
  222. package/dist/form/lib/form-transport.js +21 -0
  223. package/dist/form/lib/form-transport.js.map +1 -0
  224. package/dist/form/lib/override-keys.js +12 -0
  225. package/dist/form/lib/override-keys.js.map +1 -0
  226. package/dist/form/{components → lib}/prefill-targets.d.ts +2 -2
  227. package/dist/form/{components → lib}/prefill-targets.js +4 -5
  228. package/dist/form/lib/prefill-targets.js.map +1 -0
  229. package/dist/form/plugin.d.ts +1 -0
  230. package/dist/form/plugin.js +47 -0
  231. package/dist/form/plugin.js.map +1 -0
  232. package/dist/form/toolkit.d.ts +17 -0
  233. package/dist/form/toolkit.js +14 -0
  234. package/dist/form/{components/types.d.ts → types.d.ts} +3 -3
  235. package/dist/format/number.d.ts +1 -1
  236. package/dist/format/value.d.ts +1 -1
  237. package/dist/i18n/backend.d.ts +1 -1
  238. package/dist/i18n/config.d.ts +1 -1
  239. package/dist/i18n/index.d.ts +13 -13
  240. package/dist/i18n/locale-reload.js +1 -1
  241. package/dist/i18n/locale-reload.js.map +1 -1
  242. package/dist/i18n/locale.js.map +1 -1
  243. package/dist/i18n/page-props.d.ts +1 -1
  244. package/dist/i18n/timezone.js.map +1 -1
  245. package/dist/i18n/translatable.d.ts +1 -1
  246. package/dist/icons/icon-renderer.js.map +1 -1
  247. package/dist/icons/index.d.ts +4 -4
  248. package/dist/icons/sprite.js.map +1 -1
  249. package/dist/index.d.ts +37 -38
  250. package/dist/index.js +10 -9
  251. package/dist/inertia.js +1 -1
  252. package/dist/layout/{breadcrumbs.d.ts → components/breadcrumbs.d.ts} +1 -1
  253. package/dist/layout/{breadcrumbs.js → components/breadcrumbs.js} +2 -2
  254. package/dist/layout/components/breadcrumbs.js.map +1 -0
  255. package/dist/layout/{callouts.d.ts → components/callouts.d.ts} +1 -1
  256. package/dist/layout/{callouts.js → components/callouts.js} +7 -7
  257. package/dist/layout/components/callouts.js.map +1 -0
  258. package/dist/layout/{dropdown.d.ts → components/dropdown.d.ts} +1 -1
  259. package/dist/layout/{dropdown.js → components/dropdown.js} +2 -2
  260. package/dist/layout/components/dropdown.js.map +1 -0
  261. package/dist/layout/{menu-item.d.ts → components/menu-item.d.ts} +1 -1
  262. package/dist/layout/{menu-item.js → components/menu-item.js} +9 -8
  263. package/dist/layout/components/menu-item.js.map +1 -0
  264. package/dist/layout/{menu.d.ts → components/menu.d.ts} +1 -1
  265. package/dist/layout/{menu.js → components/menu.js} +2 -2
  266. package/dist/layout/components/menu.js.map +1 -0
  267. package/dist/layout/{outlet.d.ts → components/outlet.d.ts} +1 -1
  268. package/dist/layout/{outlet.js → components/outlet.js} +2 -2
  269. package/dist/layout/components/outlet.js.map +1 -0
  270. package/dist/layout/{popover.js → components/popover.js} +4 -4
  271. package/dist/layout/components/popover.js.map +1 -0
  272. package/dist/layout/{schema-layout.js → components/schema-layout.js} +3 -3
  273. package/dist/layout/components/schema-layout.js.map +1 -0
  274. package/dist/layout/{sidebar.d.ts → components/sidebar.d.ts} +1 -1
  275. package/dist/layout/{sidebar.js → components/sidebar.js} +5 -5
  276. package/dist/layout/components/sidebar.js.map +1 -0
  277. package/dist/layout/{topbar.d.ts → components/topbar.d.ts} +1 -1
  278. package/dist/layout/{topbar.js → components/topbar.js} +3 -3
  279. package/dist/layout/components/topbar.js.map +1 -0
  280. package/dist/layout/{context.d.ts → hooks/context.d.ts} +1 -1
  281. package/dist/layout/{context.js → hooks/context.js} +2 -2
  282. package/dist/layout/hooks/context.js.map +1 -0
  283. package/dist/layout/index.d.ts +4 -4
  284. package/dist/layout/index.js +4 -4
  285. package/dist/layout/plugin.d.ts +2 -0
  286. package/dist/layout/{components.js → plugin.js} +10 -10
  287. package/dist/layout/plugin.js.map +1 -0
  288. package/dist/notifications/api.d.ts +1 -1
  289. package/dist/notifications/components/notification-item.d.ts +1 -1
  290. package/dist/notifications/components/notification-item.js.map +1 -1
  291. package/dist/notifications/components/notification-list.d.ts +2 -2
  292. package/dist/notifications/components/notification-list.js +1 -1
  293. package/dist/notifications/components/notification-list.js.map +1 -1
  294. package/dist/notifications/components/notifications-echo.d.ts +1 -1
  295. package/dist/notifications/components/notifications-echo.js.map +1 -1
  296. package/dist/notifications/components/notifications.d.ts +1 -1
  297. package/dist/notifications/components/notifications.js +3 -3
  298. package/dist/notifications/components/notifications.js.map +1 -1
  299. package/dist/notifications/index.d.ts +2 -1
  300. package/dist/notifications/index.js +1 -10
  301. package/dist/notifications/plugin.d.ts +2 -0
  302. package/dist/notifications/plugin.js +11 -0
  303. package/dist/notifications/plugin.js.map +1 -0
  304. package/dist/notifications/store.d.ts +1 -1
  305. package/dist/notifications/types.d.ts +1 -1
  306. package/dist/page.d.ts +1 -1
  307. package/dist/provider-base.d.ts +2 -2
  308. package/dist/provider-base.js +5 -4
  309. package/dist/provider-base.js.map +1 -1
  310. package/dist/provider.d.ts +3 -3
  311. package/dist/realtime/build-effects.d.ts +2 -2
  312. package/dist/realtime/listeners.d.ts +1 -1
  313. package/dist/realtime/subscriptions.d.ts +1 -1
  314. package/dist/registry.d.ts +1 -1
  315. package/dist/registry.js +9 -9
  316. package/dist/registry.js.map +1 -1
  317. package/dist/remote/components/data-list.d.ts +2 -2
  318. package/dist/remote/components/data-list.js +1 -34
  319. package/dist/remote/components/data-list.js.map +1 -1
  320. package/dist/remote/index.d.ts +1 -1
  321. package/dist/remote/index.js +1 -10
  322. package/dist/remote/plugin.d.ts +2 -0
  323. package/dist/remote/plugin.js +11 -0
  324. package/dist/remote/plugin.js.map +1 -0
  325. package/dist/table/components/bulk-bar.d.ts +1 -1
  326. package/dist/table/components/bulk-bar.js +4 -4
  327. package/dist/table/components/bulk-bar.js.map +1 -1
  328. package/dist/table/components/cells/badge-cell.d.ts +1 -1
  329. package/dist/table/components/cells/badge-cell.js +1 -1
  330. package/dist/table/components/cells/badge-cell.js.map +1 -1
  331. package/dist/table/components/cells/boolean-cell.d.ts +1 -1
  332. package/dist/table/components/cells/boolean-cell.js.map +1 -1
  333. package/dist/table/components/cells/icon-cell.d.ts +1 -1
  334. package/dist/table/components/cells/icon-cell.js.map +1 -1
  335. package/dist/table/components/cells/image-cell.d.ts +1 -1
  336. package/dist/table/components/cells/image-cell.js +1 -1
  337. package/dist/table/components/cells/image-cell.js.map +1 -1
  338. package/dist/table/components/cells/money-cell.d.ts +1 -1
  339. package/dist/table/components/cells/money-cell.js +1 -1
  340. package/dist/table/components/cells/money-cell.js.map +1 -1
  341. package/dist/table/components/cells/number-cell.d.ts +1 -1
  342. package/dist/table/components/cells/number-cell.js +1 -1
  343. package/dist/table/components/cells/number-cell.js.map +1 -1
  344. package/dist/table/components/cells/stack-cell.d.ts +1 -1
  345. package/dist/table/components/cells/stack-cell.js +3 -7
  346. package/dist/table/components/cells/stack-cell.js.map +1 -1
  347. package/dist/table/components/cells/text-cell.d.ts +1 -1
  348. package/dist/table/components/cells/text-cell.js +4 -4
  349. package/dist/table/components/cells/text-cell.js.map +1 -1
  350. package/dist/table/components/column-filter-control.d.ts +3 -3
  351. package/dist/table/components/column-filter-control.js +34 -19
  352. package/dist/table/components/column-filter-control.js.map +1 -1
  353. package/dist/table/components/column-header.d.ts +1 -1
  354. package/dist/table/components/column-header.js +7 -7
  355. package/dist/table/components/column-header.js.map +1 -1
  356. package/dist/table/components/column-visibility-menu.d.ts +1 -1
  357. package/dist/table/components/column-visibility-menu.js +3 -3
  358. package/dist/table/components/column-visibility-menu.js.map +1 -1
  359. package/dist/table/components/filter-bar.d.ts +9 -7
  360. package/dist/table/components/filter-bar.js +62 -52
  361. package/dist/table/components/filter-bar.js.map +1 -1
  362. package/dist/table/components/filter-controls.d.ts +5 -9
  363. package/dist/table/components/filter-controls.js +96 -224
  364. package/dist/table/components/filter-controls.js.map +1 -1
  365. package/dist/table/components/filter-value-input.d.ts +1 -1
  366. package/dist/table/components/filter-value-input.js +1 -1
  367. package/dist/table/components/filter-value-input.js.map +1 -1
  368. package/dist/table/components/pagination.d.ts +2 -2
  369. package/dist/table/components/pagination.js.map +1 -1
  370. package/dist/table/components/sort-bar.d.ts +1 -1
  371. package/dist/table/components/sort-bar.js +2 -2
  372. package/dist/table/components/sort-bar.js.map +1 -1
  373. package/dist/table/components/table-action-node.d.ts +1 -1
  374. package/dist/table/components/table-action-node.js +1 -1
  375. package/dist/table/components/table-action-node.js.map +1 -1
  376. package/dist/table/components/table-cell.d.ts +1 -1
  377. package/dist/table/components/table-cell.js +2 -2
  378. package/dist/table/components/table-cell.js.map +1 -1
  379. package/dist/table/components/table.d.ts +1 -1
  380. package/dist/table/components/table.js +23 -31
  381. package/dist/table/components/table.js.map +1 -1
  382. package/dist/{core → table/hooks}/use-column-visibility.d.ts +5 -3
  383. package/dist/{core → table/hooks}/use-column-visibility.js +4 -4
  384. package/dist/table/hooks/use-column-visibility.js.map +1 -0
  385. package/dist/table/{use-table-selection.js → hooks/use-table-selection.js} +1 -1
  386. package/dist/table/hooks/use-table-selection.js.map +1 -0
  387. package/dist/table/{use-table.d.ts → hooks/use-table.d.ts} +7 -7
  388. package/dist/table/{use-table.js → hooks/use-table.js} +12 -9
  389. package/dist/table/hooks/use-table.js.map +1 -0
  390. package/dist/table/index.d.ts +6 -1
  391. package/dist/table/index.js +5 -11
  392. package/dist/table/{align.d.ts → lib/align.d.ts} +1 -1
  393. package/dist/table/{align.js → lib/align.js} +1 -1
  394. package/dist/table/lib/align.js.map +1 -0
  395. package/dist/table/{bulk.d.ts → lib/bulk.d.ts} +3 -3
  396. package/dist/table/{bulk.js → lib/bulk.js} +1 -1
  397. package/dist/table/lib/bulk.js.map +1 -0
  398. package/dist/table/{filter-values.d.ts → lib/filter-values.d.ts} +10 -3
  399. package/dist/table/{filter-values.js → lib/filter-values.js} +14 -4
  400. package/dist/table/lib/filter-values.js.map +1 -0
  401. package/dist/table/{format.d.ts → lib/format.d.ts} +2 -2
  402. package/dist/table/{format.js → lib/format.js} +3 -3
  403. package/dist/table/lib/format.js.map +1 -0
  404. package/dist/table/{payload.d.ts → lib/payload.d.ts} +2 -3
  405. package/dist/table/{payload.js → lib/payload.js} +12 -9
  406. package/dist/table/lib/payload.js.map +1 -0
  407. package/dist/table/{query.d.ts → lib/query.d.ts} +3 -3
  408. package/dist/table/{query.js → lib/query.js} +27 -27
  409. package/dist/table/lib/query.js.map +1 -0
  410. package/dist/table/plugin.d.ts +2 -0
  411. package/dist/table/plugin.js +11 -0
  412. package/dist/table/plugin.js.map +1 -0
  413. package/dist/table/registry.d.ts +3 -1
  414. package/dist/table/registry.js.map +1 -1
  415. package/dist/table/types.d.ts +57 -7
  416. package/dist/toast/callout.d.ts +1 -1
  417. package/dist/toast/callout.js.map +1 -1
  418. package/dist/toast/index.d.ts +6 -5
  419. package/dist/toast/index.js +2 -1
  420. package/dist/toast/toast.d.ts +1 -1
  421. package/dist/toast/toaster.js.map +1 -1
  422. package/dist/toast/variant-styles.d.ts +1 -1
  423. package/dist/types/generated.d.ts +118 -64
  424. package/dist/types/index.d.ts +1 -1
  425. package/dist/{action/components → ui}/action-menu-context.js +1 -1
  426. package/dist/ui/action-menu-context.js.map +1 -0
  427. package/dist/{form/components/base → ui}/affix-group.d.ts +1 -1
  428. package/dist/{form/components/base → ui}/affix-group.js +3 -3
  429. package/dist/ui/affix-group.js.map +1 -0
  430. package/dist/{core/components → ui}/badge.d.ts +1 -1
  431. package/dist/{core/components → ui}/badge.js +2 -2
  432. package/dist/ui/badge.js.map +1 -0
  433. package/dist/{core/components → ui}/button.d.ts +2 -2
  434. package/dist/{core/components → ui}/button.js +5 -5
  435. package/dist/ui/button.js.map +1 -0
  436. package/dist/{core/components → ui}/card.d.ts +1 -1
  437. package/dist/{core/components → ui}/card.js +3 -3
  438. package/dist/ui/card.js.map +1 -0
  439. package/dist/{core/components → ui}/chart-view.d.ts +1 -1
  440. package/dist/{core/components → ui}/chart-view.js +5 -5
  441. package/dist/ui/chart-view.js.map +1 -0
  442. package/dist/{core/components → ui}/chart.d.ts +1 -1
  443. package/dist/{core/components → ui}/chart.js +1 -1
  444. package/dist/ui/chart.js.map +1 -0
  445. package/dist/{core/components → ui}/checkbox.js +3 -3
  446. package/dist/ui/checkbox.js.map +1 -0
  447. package/dist/{core/use-click-behavior.d.ts → ui/click-behavior.d.ts} +17 -19
  448. package/dist/ui/click-behavior.js +46 -0
  449. package/dist/ui/click-behavior.js.map +1 -0
  450. package/dist/{core/components → ui}/collapsible.d.ts +1 -1
  451. package/dist/{core/components → ui}/collapsible.js +6 -6
  452. package/dist/ui/collapsible.js.map +1 -0
  453. package/dist/{core/components → ui}/combobox.d.ts +1 -1
  454. package/dist/{core/components → ui}/combobox.js +4 -4
  455. package/dist/ui/combobox.js.map +1 -0
  456. package/dist/{core/components → ui}/confirm-dialog.d.ts +1 -1
  457. package/dist/{core/components → ui}/confirm-dialog.js +1 -1
  458. package/dist/ui/confirm-dialog.js.map +1 -0
  459. package/dist/{core/components → ui}/control.d.ts +1 -1
  460. package/dist/{core/components → ui}/control.js +1 -1
  461. package/dist/ui/control.js.map +1 -0
  462. package/dist/{clipboard → ui}/copyable-text.d.ts +1 -0
  463. package/dist/{clipboard → ui}/copyable-text.js +11 -3
  464. package/dist/ui/copyable-text.js.map +1 -0
  465. package/dist/{core/components → ui}/dialog.js +3 -3
  466. package/dist/ui/dialog.js.map +1 -0
  467. package/dist/{core/components → ui}/dropdown-menu.d.ts +1 -1
  468. package/dist/{core/components → ui}/dropdown-menu.js +3 -3
  469. package/dist/ui/dropdown-menu.js.map +1 -0
  470. package/dist/{core/components → ui}/floating-panel.d.ts +1 -1
  471. package/dist/{core/components → ui}/floating-panel.js +4 -4
  472. package/dist/ui/floating-panel.js.map +1 -0
  473. package/dist/{core/components → ui}/fragment.d.ts +1 -1
  474. package/dist/{core/components → ui}/fragment.js +5 -5
  475. package/dist/ui/fragment.js.map +1 -0
  476. package/dist/{core/components → ui}/grid.d.ts +1 -1
  477. package/dist/{core/components → ui}/grid.js +3 -3
  478. package/dist/ui/grid.js.map +1 -0
  479. package/dist/{core/components → ui}/heading.d.ts +1 -1
  480. package/dist/{core/components → ui}/heading.js +2 -2
  481. package/dist/ui/heading.js.map +1 -0
  482. package/dist/{core/components → ui}/icon.d.ts +1 -1
  483. package/dist/{core/components → ui}/icon.js +3 -3
  484. package/dist/ui/icon.js.map +1 -0
  485. package/dist/ui/index.d.ts +27 -0
  486. package/dist/ui/index.js +26 -0
  487. package/dist/{core/components → ui}/info-tooltip.js +3 -3
  488. package/dist/ui/info-tooltip.js.map +1 -0
  489. package/dist/{form/components/base → ui}/input-error.js +2 -2
  490. package/dist/ui/input-error.js.map +1 -0
  491. package/dist/{form/components/base → ui}/input-otp.js +2 -2
  492. package/dist/ui/input-otp.js.map +1 -0
  493. package/dist/{form/components/base → ui}/input.js +3 -3
  494. package/dist/ui/input.js.map +1 -0
  495. package/dist/{form/components/base → ui}/label.js +2 -2
  496. package/dist/ui/label.js.map +1 -0
  497. package/dist/{core/components → ui}/link.d.ts +1 -1
  498. package/dist/{core/components → ui}/link.js +8 -7
  499. package/dist/ui/link.js.map +1 -0
  500. package/dist/{core/components → ui}/modal.d.ts +1 -1
  501. package/dist/{core/components → ui}/modal.js +2 -2
  502. package/dist/ui/modal.js.map +1 -0
  503. package/dist/{form/components/base → ui}/password-input.js +3 -3
  504. package/dist/ui/password-input.js.map +1 -0
  505. package/dist/ui/plugin.d.ts +1 -0
  506. package/dist/{core/components/index.js → ui/plugin.js} +6 -6
  507. package/dist/ui/plugin.js.map +1 -0
  508. package/dist/{core/components → ui}/popover.js +2 -2
  509. package/dist/ui/popover.js.map +1 -0
  510. package/dist/{core/components → ui}/raw-block.d.ts +1 -1
  511. package/dist/{core/components → ui}/raw-block.js +1 -1
  512. package/dist/ui/raw-block.js.map +1 -0
  513. package/dist/{core/components → ui}/section.d.ts +1 -1
  514. package/dist/{core/components → ui}/section.js +6 -6
  515. package/dist/ui/section.js.map +1 -0
  516. package/dist/{core/components → ui}/segmented-control.d.ts +1 -1
  517. package/dist/{core/components → ui}/segmented-control.js +1 -1
  518. package/dist/ui/segmented-control.js.map +1 -0
  519. package/dist/{core/components → ui}/segmented-pills.d.ts +1 -1
  520. package/dist/{core/components → ui}/segmented-pills.js +2 -2
  521. package/dist/ui/segmented-pills.js.map +1 -0
  522. package/dist/{core/components → ui}/skeleton.js +2 -2
  523. package/dist/ui/skeleton.js.map +1 -0
  524. package/dist/{core/components → ui}/spinner.js +4 -4
  525. package/dist/ui/spinner.js.map +1 -0
  526. package/dist/{core/components → ui}/stack.d.ts +1 -1
  527. package/dist/{core/components → ui}/stack.js +3 -3
  528. package/dist/ui/stack.js.map +1 -0
  529. package/dist/{core/components → ui}/tabs.d.ts +1 -1
  530. package/dist/{core/components → ui}/tabs.js +3 -3
  531. package/dist/ui/tabs.js.map +1 -0
  532. package/dist/{core/components → ui}/text.d.ts +1 -1
  533. package/dist/{core/components → ui}/text.js +4 -4
  534. package/dist/ui/text.js.map +1 -0
  535. package/dist/{form/components/base → ui}/textarea.js +3 -3
  536. package/dist/ui/textarea.js.map +1 -0
  537. package/dist/{core/components → ui}/tooltip.d.ts +1 -1
  538. package/dist/{core/components → ui}/tooltip.js +3 -3
  539. package/dist/ui/tooltip.js.map +1 -0
  540. package/dist/vite.js +2 -2
  541. package/dist/vite.js.map +1 -1
  542. package/package.json +28 -94
  543. package/resources/icons/align-center.svg +1 -1
  544. package/resources/icons/align-justify.svg +1 -1
  545. package/resources/icons/align-left.svg +1 -1
  546. package/resources/icons/align-right.svg +1 -1
  547. package/resources/icons/arrow-down.svg +1 -1
  548. package/resources/icons/arrow-up.svg +1 -1
  549. package/resources/icons/bell.svg +1 -1
  550. package/resources/icons/bold.svg +1 -1
  551. package/resources/icons/calendar.svg +1 -1
  552. package/resources/icons/check.svg +1 -1
  553. package/resources/icons/chevron-down.svg +1 -1
  554. package/resources/icons/chevron-left.svg +1 -1
  555. package/resources/icons/chevron-right.svg +1 -1
  556. package/resources/icons/chevrons-up-down.svg +1 -1
  557. package/resources/icons/circle-alert.svg +1 -1
  558. package/resources/icons/circle-check.svg +1 -1
  559. package/resources/icons/circle-help.svg +1 -1
  560. package/resources/icons/circle-x.svg +1 -1
  561. package/resources/icons/clock.svg +1 -1
  562. package/resources/icons/code.svg +1 -1
  563. package/resources/icons/columns-3.svg +1 -1
  564. package/resources/icons/copy.svg +1 -1
  565. package/resources/icons/external-link.svg +1 -1
  566. package/resources/icons/eye-off.svg +1 -1
  567. package/resources/icons/eye.svg +1 -1
  568. package/resources/icons/filter.svg +1 -1
  569. package/resources/icons/heading-1.svg +1 -1
  570. package/resources/icons/heading-2.svg +1 -1
  571. package/resources/icons/heading-3.svg +1 -1
  572. package/resources/icons/highlighter.svg +1 -1
  573. package/resources/icons/info.svg +1 -1
  574. package/resources/icons/italic.svg +1 -1
  575. package/resources/icons/layout-dashboard.svg +1 -1
  576. package/resources/icons/link.svg +1 -1
  577. package/resources/icons/list-ordered.svg +1 -1
  578. package/resources/icons/list.svg +1 -1
  579. package/resources/icons/loader-2.svg +1 -1
  580. package/resources/icons/minus.svg +1 -1
  581. package/resources/icons/more-horizontal.svg +1 -1
  582. package/resources/icons/panel-left.svg +1 -1
  583. package/resources/icons/pencil-line.svg +1 -1
  584. package/resources/icons/pencil.svg +1 -1
  585. package/resources/icons/plus.svg +1 -1
  586. package/resources/icons/quote.svg +1 -1
  587. package/resources/icons/rotate-ccw.svg +1 -1
  588. package/resources/icons/rows-3.svg +1 -1
  589. package/resources/icons/search.svg +1 -1
  590. package/resources/icons/send.svg +1 -1
  591. package/resources/icons/settings.svg +1 -1
  592. package/resources/icons/smile.svg +1 -1
  593. package/resources/icons/strikethrough.svg +1 -1
  594. package/resources/icons/table.svg +1 -1
  595. package/resources/icons/trash-2.svg +1 -1
  596. package/resources/icons/underline.svg +1 -1
  597. package/resources/icons/x.svg +1 -1
  598. package/dist/action/components/action-menu-context.js.map +0 -1
  599. package/dist/action/index.js.map +0 -1
  600. package/dist/action/run-action.js.map +0 -1
  601. package/dist/action/use-action.js.map +0 -1
  602. package/dist/chat/index.js.map +0 -1
  603. package/dist/chat/transport.js.map +0 -1
  604. package/dist/chat/use-chat.js.map +0 -1
  605. package/dist/clipboard/copyable-text.js.map +0 -1
  606. package/dist/core/column-sizing.js.map +0 -1
  607. package/dist/core/components/badge.js.map +0 -1
  608. package/dist/core/components/button.js.map +0 -1
  609. package/dist/core/components/card.js.map +0 -1
  610. package/dist/core/components/chart-view.js.map +0 -1
  611. package/dist/core/components/chart.js.map +0 -1
  612. package/dist/core/components/checkbox.js.map +0 -1
  613. package/dist/core/components/collapsible.js.map +0 -1
  614. package/dist/core/components/combobox.js.map +0 -1
  615. package/dist/core/components/confirm-dialog.js.map +0 -1
  616. package/dist/core/components/control.js.map +0 -1
  617. package/dist/core/components/dialog.js.map +0 -1
  618. package/dist/core/components/dropdown-menu.js.map +0 -1
  619. package/dist/core/components/floating-panel.js.map +0 -1
  620. package/dist/core/components/fragment.js.map +0 -1
  621. package/dist/core/components/grid.js.map +0 -1
  622. package/dist/core/components/heading.js.map +0 -1
  623. package/dist/core/components/icon.js.map +0 -1
  624. package/dist/core/components/index.d.ts +0 -1
  625. package/dist/core/components/index.js.map +0 -1
  626. package/dist/core/components/info-tooltip.js.map +0 -1
  627. package/dist/core/components/link.js.map +0 -1
  628. package/dist/core/components/modal.js.map +0 -1
  629. package/dist/core/components/popover.js.map +0 -1
  630. package/dist/core/components/raw-block.js.map +0 -1
  631. package/dist/core/components/section.js.map +0 -1
  632. package/dist/core/components/segmented-control.js.map +0 -1
  633. package/dist/core/components/segmented-pills.js.map +0 -1
  634. package/dist/core/components/skeleton.js.map +0 -1
  635. package/dist/core/components/spinner.js.map +0 -1
  636. package/dist/core/components/stack.js.map +0 -1
  637. package/dist/core/components/tabs.js.map +0 -1
  638. package/dist/core/components/text.js.map +0 -1
  639. package/dist/core/components/tooltip.js.map +0 -1
  640. package/dist/core/use-click-behavior.js +0 -46
  641. package/dist/core/use-click-behavior.js.map +0 -1
  642. package/dist/core/use-column-resizing.js.map +0 -1
  643. package/dist/core/use-column-visibility.js.map +0 -1
  644. package/dist/events/event-bridge.js.map +0 -1
  645. package/dist/form/components/base/affix-group.js.map +0 -1
  646. package/dist/form/components/base/input-error.js.map +0 -1
  647. package/dist/form/components/base/input-otp.js.map +0 -1
  648. package/dist/form/components/base/input.js.map +0 -1
  649. package/dist/form/components/base/label.js.map +0 -1
  650. package/dist/form/components/base/password-input.js.map +0 -1
  651. package/dist/form/components/base/textarea.js.map +0 -1
  652. package/dist/form/components/conditions.js.map +0 -1
  653. package/dist/form/components/context.js.map +0 -1
  654. package/dist/form/components/field-props.js.map +0 -1
  655. package/dist/form/components/field-scope.js.map +0 -1
  656. package/dist/form/components/fields/block-add-menu.js.map +0 -1
  657. package/dist/form/components/form-path.js.map +0 -1
  658. package/dist/form/components/form-transport.js +0 -30
  659. package/dist/form/components/form-transport.js.map +0 -1
  660. package/dist/form/components/override-keys.js +0 -12
  661. package/dist/form/components/override-keys.js.map +0 -1
  662. package/dist/form/components/prefill-context.js.map +0 -1
  663. package/dist/form/components/prefill-targets.js.map +0 -1
  664. package/dist/form/components/resolved-nodes.js.map +0 -1
  665. package/dist/form/components/row-layout-context.js.map +0 -1
  666. package/dist/form/components/use-controlled-field.js.map +0 -1
  667. package/dist/form/components/use-dependent-field.d.ts +0 -3
  668. package/dist/form/components/use-dependent-field.js.map +0 -1
  669. package/dist/form/components/use-field-commit.js.map +0 -1
  670. package/dist/form/components/use-form-resolver.js.map +0 -1
  671. package/dist/form/components/use-seed-default.js.map +0 -1
  672. package/dist/form/components/values.js +0 -52
  673. package/dist/form/components/values.js.map +0 -1
  674. package/dist/form/index.js.map +0 -1
  675. package/dist/layout/breadcrumbs.js.map +0 -1
  676. package/dist/layout/callouts.js.map +0 -1
  677. package/dist/layout/components.d.ts +0 -1
  678. package/dist/layout/components.js.map +0 -1
  679. package/dist/layout/context.js.map +0 -1
  680. package/dist/layout/dropdown.js.map +0 -1
  681. package/dist/layout/menu-item.js.map +0 -1
  682. package/dist/layout/menu.js.map +0 -1
  683. package/dist/layout/outlet.js.map +0 -1
  684. package/dist/layout/popover.js.map +0 -1
  685. package/dist/layout/schema-layout.js.map +0 -1
  686. package/dist/layout/sidebar.js.map +0 -1
  687. package/dist/layout/topbar.js.map +0 -1
  688. package/dist/notifications/index.js.map +0 -1
  689. package/dist/remote/index.js.map +0 -1
  690. package/dist/svg-sprite-client/index.d.ts +0 -1
  691. package/dist/svg-sprite-client/index.js +0 -0
  692. package/dist/table/align.js.map +0 -1
  693. package/dist/table/bulk.js.map +0 -1
  694. package/dist/table/components/filter-stack-bar.d.ts +0 -7
  695. package/dist/table/components/filter-stack-bar.js +0 -38
  696. package/dist/table/components/filter-stack-bar.js.map +0 -1
  697. package/dist/table/filter-values.js.map +0 -1
  698. package/dist/table/format.js.map +0 -1
  699. package/dist/table/index.js.map +0 -1
  700. package/dist/table/payload.js.map +0 -1
  701. package/dist/table/query.js.map +0 -1
  702. package/dist/table/use-table-selection.js.map +0 -1
  703. package/dist/table/use-table.js.map +0 -1
  704. package/dist/types/generated.js +0 -0
  705. package/dist/types/index.js +0 -0
  706. /package/dist/form/{components → hooks}/field-scope.d.ts +0 -0
  707. /package/dist/form/{components → hooks}/prefill-context.d.ts +0 -0
  708. /package/dist/form/{components → hooks}/row-layout-context.d.ts +0 -0
  709. /package/dist/form/{components → hooks}/use-seed-default.d.ts +0 -0
  710. /package/dist/form/{components → lib}/form-path.d.ts +0 -0
  711. /package/dist/form/{components → lib}/override-keys.d.ts +0 -0
  712. /package/dist/form/{components/types.js → types.js} +0 -0
  713. /package/dist/layout/{popover.d.ts → components/popover.d.ts} +0 -0
  714. /package/dist/layout/{schema-layout.d.ts → components/schema-layout.d.ts} +0 -0
  715. /package/dist/table/{use-table-selection.d.ts → hooks/use-table-selection.d.ts} +0 -0
  716. /package/dist/{action/components → ui}/action-menu-context.d.ts +0 -0
  717. /package/dist/{core/components → ui}/checkbox.d.ts +0 -0
  718. /package/dist/{core/components → ui}/dialog.d.ts +0 -0
  719. /package/dist/{core/components → ui}/info-tooltip.d.ts +0 -0
  720. /package/dist/{form/components/base → ui}/input-error.d.ts +0 -0
  721. /package/dist/{form/components/base → ui}/input-otp.d.ts +0 -0
  722. /package/dist/{form/components/base → ui}/input.d.ts +0 -0
  723. /package/dist/{form/components/base → ui}/label.d.ts +0 -0
  724. /package/dist/{form/components/base → ui}/password-input.d.ts +0 -0
  725. /package/dist/{core/components → ui}/popover.d.ts +0 -0
  726. /package/dist/{core/components → ui}/skeleton.d.ts +0 -0
  727. /package/dist/{core/components → ui}/spinner.d.ts +0 -0
  728. /package/dist/{form/components/base → ui}/textarea.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- import { Node } from '../../core/types';
1
+ import { Node } from '../../core/types.js';
2
2
  export declare function ResolvedNodesProvider({ nodes, children, }: {
3
3
  nodes: Record<string, Node>;
4
4
  children: React.ReactNode;
@@ -1,8 +1,8 @@
1
- import { fieldProps } from "./field-props.js";
1
+ import { fieldProps } from "../lib/field-props.js";
2
2
  import { useFieldScope } from "./field-scope.js";
3
3
  import { createContext, useContext } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
- //#region resources/js/form/components/resolved-nodes.tsx
5
+ //#region resources/js/form/hooks/resolved-nodes.tsx
6
6
  var ResolvedNodesContext = createContext({});
7
7
  function ResolvedNodesProvider({ nodes, children }) {
8
8
  return /* @__PURE__ */ jsx(ResolvedNodesContext.Provider, {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolved-nodes.js","names":[],"sources":["../../../resources/js/form/hooks/resolved-nodes.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { Node } from \"@lattice-php/lattice/core/types\";\nimport { fieldProps } from \"@lattice-php/lattice/form/lib/field-props\";\nimport { useFieldScope } from \"./field-scope\";\n\nconst ResolvedNodesContext = createContext<Record<string, Node>>({});\n\nexport function ResolvedNodesProvider({\n nodes,\n children,\n}: {\n nodes: Record<string, Node>;\n children: React.ReactNode;\n}) {\n return <ResolvedNodesContext.Provider value={nodes}>{children}</ResolvedNodesContext.Provider>;\n}\n\nexport function useResolvedNode(node: Node): Node {\n const nodes = useContext(ResolvedNodesContext);\n const name = fieldProps(node).name ?? \"\";\n const scope = useFieldScope();\n const path = name && scope ? scope.errorKey(name) : name;\n\n return (path && nodes[path]) || (name && nodes[name]) || node;\n}\n"],"mappings":";;;;;AAKA,IAAM,uBAAuB,cAAoC,CAAC,CAAC;AAEnE,SAAgB,sBAAsB,EACpC,OACA,YAIC;CACD,OAAO,oBAAC,qBAAqB,UAAtB;EAA+B,OAAO;EAAQ;CAAwC,CAAA;AAC/F;AAEA,SAAgB,gBAAgB,MAAkB;CAChD,MAAM,QAAQ,WAAW,oBAAoB;CAC7C,MAAM,OAAO,WAAW,IAAI,EAAE,QAAQ;CACtC,MAAM,QAAQ,cAAc;CAC5B,MAAM,OAAO,QAAQ,QAAQ,MAAM,SAAS,IAAI,IAAI;CAEpD,OAAQ,QAAQ,MAAM,SAAW,QAAQ,MAAM,SAAU;AAC3D"}
@@ -1,6 +1,6 @@
1
1
  import { createContext, useContext } from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
- //#region resources/js/form/components/row-layout-context.tsx
3
+ //#region resources/js/form/hooks/row-layout-context.tsx
4
4
  var TableCellContext = createContext(false);
5
5
  function TableCellProvider({ children }) {
6
6
  return /* @__PURE__ */ jsx(TableCellContext.Provider, {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row-layout-context.js","names":[],"sources":["../../../resources/js/form/hooks/row-layout-context.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nconst TableCellContext = createContext(false);\n\nexport function TableCellProvider({ children }: { children: React.ReactNode }) {\n return <TableCellContext.Provider value={true}>{children}</TableCellContext.Provider>;\n}\n\n/** True when a field is being rendered inside a table-layout cell (no own label). */\nexport function useInTableCell(): boolean {\n return useContext(TableCellContext);\n}\n"],"mappings":";;;AAEA,IAAM,mBAAmB,cAAc,KAAK;AAE5C,SAAgB,kBAAkB,EAAE,YAA2C;CAC7E,OAAO,oBAAC,iBAAiB,UAAlB;EAA2B,OAAO;EAAO;CAAoC,CAAA;AACtF;;AAGA,SAAgB,iBAA0B;CACxC,OAAO,WAAW,gBAAgB;AACpC"}
@@ -1,5 +1,5 @@
1
- import { Node } from '../../core/types';
2
- import { FieldState } from './conditions';
1
+ import { Node } from '../../core/types.js';
2
+ import { FieldState } from '../lib/conditions.js';
3
3
  export type ControlledField = FieldState & {
4
4
  localName: string;
5
5
  name: string;
@@ -1,13 +1,14 @@
1
1
  import { testIdentity } from "../../core/test-id.js";
2
2
  import { useFormContext } from "./context.js";
3
- import { fieldProps } from "./field-props.js";
3
+ import { fieldProps } from "../lib/field-props.js";
4
4
  import { useFieldScope } from "./field-scope.js";
5
5
  import { useFormValue } from "./values.js";
6
- import { useDependentField } from "./use-dependent-field.js";
7
6
  import { useFieldCommit } from "./use-field-commit.js";
8
- //#region resources/js/form/components/use-controlled-field.ts
7
+ import { useDependentField } from "./use-dependent-field.js";
8
+ import { fieldDomName } from "../lib/field-dom-name.js";
9
+ //#region resources/js/form/hooks/use-controlled-field.ts
9
10
  function useControlledField(node) {
10
- const { errors } = useFormContext();
11
+ const { errors, fieldIdPrefix } = useFormContext();
11
12
  const scope = useFieldScope();
12
13
  const state = useDependentField(node);
13
14
  const props = fieldProps(node);
@@ -16,7 +17,7 @@ function useControlledField(node) {
16
17
  const storedValue = scope ? scope.getValue(localName) : globalValue;
17
18
  const currentValue = storedValue !== void 0 ? storedValue : props.value;
18
19
  const value = typeof currentValue === "string" || typeof currentValue === "number" ? String(currentValue) : "";
19
- const domName = scope ? scope.scopedName(localName) : localName;
20
+ const domName = fieldDomName(scope ? scope.scopedName(localName) : localName, fieldIdPrefix);
20
21
  const errorKey = scope ? scope.errorKey(localName) : localName;
21
22
  const { commit: commitField, change: changeField, blur: blurField } = useFieldCommit();
22
23
  const commit = (next) => commitField(localName, next);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-controlled-field.js","names":[],"sources":["../../../resources/js/form/hooks/use-controlled-field.ts"],"sourcesContent":["import type { Node } from \"@lattice-php/lattice/core/types\";\nimport { testIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { FieldState } from \"@lattice-php/lattice/form/lib/conditions\";\nimport { fieldProps } from \"@lattice-php/lattice/form/lib/field-props\";\nimport { useFieldScope } from \"./field-scope\";\nimport { useFormContext } from \"./context\";\nimport { fieldDomName } from \"@lattice-php/lattice/form/lib/field-dom-name\";\nimport { useDependentField } from \"./use-dependent-field\";\nimport { useFieldCommit } from \"./use-field-commit\";\nimport { useFormValue } from \"./values\";\n\nexport type ControlledField = FieldState & {\n localName: string;\n name: string;\n testId?: string;\n value: string;\n error?: string;\n commit: (value: unknown) => void;\n change: (value: unknown) => void;\n blur: () => void;\n};\n\nexport function useControlledField(node: Node): ControlledField {\n const { errors, fieldIdPrefix } = useFormContext();\n const scope = useFieldScope();\n const state = useDependentField(node);\n const props = fieldProps(node);\n const localName = props.name ?? \"\";\n\n const globalValue = useFormValue(localName);\n const storedValue = scope ? scope.getValue(localName) : globalValue;\n const currentValue = storedValue !== undefined ? storedValue : props.value;\n const value =\n typeof currentValue === \"string\" || typeof currentValue === \"number\"\n ? String(currentValue)\n : \"\";\n\n const domName = fieldDomName(scope ? scope.scopedName(localName) : localName, fieldIdPrefix);\n const errorKey = scope ? scope.errorKey(localName) : localName;\n\n const { commit: commitField, change: changeField, blur: blurField } = useFieldCommit();\n const commit = (next: unknown): void => commitField(localName, next);\n const change = (next: unknown): void => changeField(localName, next);\n const blur = (): void => blurField(localName);\n\n return {\n ...state,\n localName,\n name: domName,\n testId: testIdentity(localName),\n value,\n error: errors[errorKey],\n commit,\n change,\n blur,\n };\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAgB,mBAAmB,MAA6B;CAC9D,MAAM,EAAE,QAAQ,kBAAkB,eAAe;CACjD,MAAM,QAAQ,cAAc;CAC5B,MAAM,QAAQ,kBAAkB,IAAI;CACpC,MAAM,QAAQ,WAAW,IAAI;CAC7B,MAAM,YAAY,MAAM,QAAQ;CAEhC,MAAM,cAAc,aAAa,SAAS;CAC1C,MAAM,cAAc,QAAQ,MAAM,SAAS,SAAS,IAAI;CACxD,MAAM,eAAe,gBAAgB,KAAA,IAAY,cAAc,MAAM;CACrE,MAAM,QACJ,OAAO,iBAAiB,YAAY,OAAO,iBAAiB,WACxD,OAAO,YAAY,IACnB;CAEN,MAAM,UAAU,aAAa,QAAQ,MAAM,WAAW,SAAS,IAAI,WAAW,aAAa;CAC3F,MAAM,WAAW,QAAQ,MAAM,SAAS,SAAS,IAAI;CAErD,MAAM,EAAE,QAAQ,aAAa,QAAQ,aAAa,MAAM,cAAc,eAAe;CACrF,MAAM,UAAU,SAAwB,YAAY,WAAW,IAAI;CACnE,MAAM,UAAU,SAAwB,YAAY,WAAW,IAAI;CACnE,MAAM,aAAmB,UAAU,SAAS;CAE5C,OAAO;EACL,GAAG;EACH;EACA,MAAM;EACN,QAAQ,aAAa,SAAS;EAC9B;EACA,OAAO,OAAO;EACd;EACA;EACA;CACF;AACF"}
@@ -0,0 +1,3 @@
1
+ import { Node } from '../../core/types.js';
2
+ import { FieldState } from '../lib/conditions.js';
3
+ export declare function useDependentField(node: Node): FieldState;
@@ -1,18 +1,18 @@
1
- import { fieldProps } from "./field-props.js";
1
+ import { fieldProps } from "../lib/field-props.js";
2
2
  import { useFieldScope } from "./field-scope.js";
3
- import { useFormValues } from "./values.js";
4
- import { evaluateConditions } from "./conditions.js";
5
- //#region resources/js/form/components/use-dependent-field.ts
3
+ import { useFormValuesFor } from "./values.js";
4
+ import { conditionFields, evaluateConditions } from "../lib/conditions.js";
5
+ import { useMemo } from "react";
6
+ //#region resources/js/form/hooks/use-dependent-field.ts
6
7
  function useDependentField(node) {
7
- const values = useFormValues();
8
8
  const scope = useFieldScope();
9
9
  const props = fieldProps(node);
10
+ const values = useFormValuesFor(useMemo(() => conditionFields(props.conditions), [props.conditions]));
10
11
  const conditionValues = scope ? {
11
12
  ...values,
12
13
  ...scope.values
13
14
  } : values;
14
15
  return evaluateConditions(props.conditions ?? void 0, conditionValues, {
15
- hidden: props.hidden ?? false,
16
16
  required: props.required ?? false,
17
17
  readOnly: props.readOnly ?? false,
18
18
  disabled: props.disabled ?? false
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-dependent-field.js","names":[],"sources":["../../../resources/js/form/hooks/use-dependent-field.ts"],"sourcesContent":["import type { Node } from \"@lattice-php/lattice/core/types\";\nimport { useMemo } from \"react\";\nimport {\n conditionFields,\n type FieldState,\n evaluateConditions,\n} from \"@lattice-php/lattice/form/lib/conditions\";\nimport { fieldProps } from \"@lattice-php/lattice/form/lib/field-props\";\nimport { useFieldScope } from \"./field-scope\";\nimport { useFormValuesFor } from \"./values\";\n\nexport function useDependentField(node: Node): FieldState {\n const scope = useFieldScope();\n const props = fieldProps(node);\n const fields = useMemo(() => conditionFields(props.conditions), [props.conditions]);\n const values = useFormValuesFor(fields);\n // Bare condition names resolve to row siblings first; form values remain the fallback.\n const conditionValues = scope ? { ...values, ...scope.values } : values;\n\n return evaluateConditions(props.conditions ?? undefined, conditionValues, {\n required: props.required ?? false,\n readOnly: props.readOnly ?? false,\n disabled: props.disabled ?? false,\n });\n}\n"],"mappings":";;;;;;AAWA,SAAgB,kBAAkB,MAAwB;CACxD,MAAM,QAAQ,cAAc;CAC5B,MAAM,QAAQ,WAAW,IAAI;CAE7B,MAAM,SAAS,iBADA,cAAc,gBAAgB,MAAM,UAAU,GAAG,CAAC,MAAM,UAAU,CACjD,CAAM;CAEtC,MAAM,kBAAkB,QAAQ;EAAE,GAAG;EAAQ,GAAG,MAAM;CAAO,IAAI;CAEjE,OAAO,mBAAmB,MAAM,cAAc,KAAA,GAAW,iBAAiB;EACxE,UAAU,MAAM,YAAY;EAC5B,UAAU,MAAM,YAAY;EAC5B,UAAU,MAAM,YAAY;CAC9B,CAAC;AACH"}
@@ -1,3 +1,4 @@
1
+ import { ReactNode } from 'react';
1
2
  type FieldCommit = {
2
3
  /** Write the value and validate immediately (precognitive) or clear errors. */
3
4
  commit: (name: string, value: unknown) => void;
@@ -6,6 +7,10 @@ type FieldCommit = {
6
7
  /** Validate the field now if precognitive (e.g. on blur or popover close). */
7
8
  blur: (name: string) => void;
8
9
  };
10
+ export declare function FieldCommitOverrideProvider({ children, value, }: {
11
+ children: ReactNode;
12
+ value: FieldCommit;
13
+ }): import('react').FunctionComponentElement<import('react').ProviderProps<FieldCommit | null>>;
9
14
  /**
10
15
  * The shared field-mutation contract every form field uses to write its value
11
16
  * and drive precognition. Fields that validate on change call `commit`; fields
@@ -2,7 +2,12 @@ import { useFormContext } from "./context.js";
2
2
  import { usePrefillController } from "./prefill-context.js";
3
3
  import { useFieldScope } from "./field-scope.js";
4
4
  import { useSetFormValue } from "./values.js";
5
- //#region resources/js/form/components/use-field-commit.ts
5
+ import { createContext, createElement, useContext } from "react";
6
+ //#region resources/js/form/hooks/use-field-commit.ts
7
+ var FieldCommitOverrideContext = createContext(null);
8
+ function FieldCommitOverrideProvider({ children, value }) {
9
+ return createElement(FieldCommitOverrideContext.Provider, { value }, children);
10
+ }
6
11
  /**
7
12
  * The shared field-mutation contract every form field uses to write its value
8
13
  * and drive precognition. Fields that validate on change call `commit`; fields
@@ -13,10 +18,12 @@ import { useSetFormValue } from "./values.js";
13
18
  * behavior is identical to before.
14
19
  */
15
20
  function useFieldCommit() {
21
+ const override = useContext(FieldCommitOverrideContext);
16
22
  const { clearErrors, precognitive, validate } = useFormContext();
17
23
  const setGlobal = useSetFormValue();
18
24
  const scope = useFieldScope();
19
25
  const prefill = usePrefillController();
26
+ if (override) return override;
20
27
  const write = (name, value) => {
21
28
  if (scope) scope.setValue(name, value);
22
29
  else setGlobal(name, value);
@@ -39,6 +46,6 @@ function useFieldCommit() {
39
46
  };
40
47
  }
41
48
  //#endregion
42
- export { useFieldCommit };
49
+ export { FieldCommitOverrideProvider, useFieldCommit };
43
50
 
44
51
  //# sourceMappingURL=use-field-commit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-field-commit.js","names":[],"sources":["../../../resources/js/form/hooks/use-field-commit.ts"],"sourcesContent":["import { createContext, createElement, useContext } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { useFieldScope } from \"./field-scope\";\nimport { useFormContext } from \"./context\";\nimport { usePrefillController } from \"./prefill-context\";\nimport { useSetFormValue } from \"./values\";\n\ntype FieldCommit = {\n /** Write the value and validate immediately (precognitive) or clear errors. */\n commit: (name: string, value: unknown) => void;\n /** Write the value and clear errors, deferring validation to a later `blur`. */\n change: (name: string, value: unknown) => void;\n /** Validate the field now if precognitive (e.g. on blur or popover close). */\n blur: (name: string) => void;\n};\n\nconst FieldCommitOverrideContext = createContext<FieldCommit | null>(null);\n\nexport function FieldCommitOverrideProvider({\n children,\n value,\n}: {\n children: ReactNode;\n value: FieldCommit;\n}) {\n return createElement(FieldCommitOverrideContext.Provider, { value }, children);\n}\n\n/**\n * The shared field-mutation contract every form field uses to write its value\n * and drive precognition. Fields that validate on change call `commit`; fields\n * that validate on blur/close (rich editor, select) call `change` then `blur`.\n *\n * When called inside a `FieldScopeProvider`, writes go through the scope's\n * `setValue` and error paths use the scoped dot-key; outside a scope the\n * behavior is identical to before.\n */\nexport function useFieldCommit(): FieldCommit {\n const override = useContext(FieldCommitOverrideContext);\n const { clearErrors, precognitive, validate } = useFormContext();\n const setGlobal = useSetFormValue();\n const scope = useFieldScope();\n const prefill = usePrefillController();\n\n if (override) {\n return override;\n }\n\n const write = (name: string, value: unknown): void => {\n if (scope) {\n scope.setValue(name, value);\n } else {\n setGlobal(name, value);\n }\n prefill?.markUserEdit(scope ? scope.overrideKey(name) : name);\n };\n const errorPath = (name: string): string => (scope ? scope.errorKey(name) : name);\n\n return {\n commit(name, value) {\n write(name, value);\n if (precognitive) {\n validate(errorPath(name));\n } else {\n clearErrors(errorPath(name));\n }\n },\n change(name, value) {\n write(name, value);\n clearErrors(errorPath(name));\n },\n blur(name) {\n if (precognitive) {\n validate(errorPath(name));\n }\n },\n };\n}\n"],"mappings":";;;;;;AAgBA,IAAM,6BAA6B,cAAkC,IAAI;AAEzE,SAAgB,4BAA4B,EAC1C,UACA,SAIC;CACD,OAAO,cAAc,2BAA2B,UAAU,EAAE,MAAM,GAAG,QAAQ;AAC/E;;;;;;;;;;AAWA,SAAgB,iBAA8B;CAC5C,MAAM,WAAW,WAAW,0BAA0B;CACtD,MAAM,EAAE,aAAa,cAAc,aAAa,eAAe;CAC/D,MAAM,YAAY,gBAAgB;CAClC,MAAM,QAAQ,cAAc;CAC5B,MAAM,UAAU,qBAAqB;CAErC,IAAI,UACF,OAAO;CAGT,MAAM,SAAS,MAAc,UAAyB;EACpD,IAAI,OACF,MAAM,SAAS,MAAM,KAAK;OAE1B,UAAU,MAAM,KAAK;EAEvB,SAAS,aAAa,QAAQ,MAAM,YAAY,IAAI,IAAI,IAAI;CAC9D;CACA,MAAM,aAAa,SAA0B,QAAQ,MAAM,SAAS,IAAI,IAAI;CAE5E,OAAO;EACL,OAAO,MAAM,OAAO;GAClB,MAAM,MAAM,KAAK;GACjB,IAAI,cACF,SAAS,UAAU,IAAI,CAAC;QAExB,YAAY,UAAU,IAAI,CAAC;EAE/B;EACA,OAAO,MAAM,OAAO;GAClB,MAAM,MAAM,KAAK;GACjB,YAAY,UAAU,IAAI,CAAC;EAC7B;EACA,KAAK,MAAM;GACT,IAAI,cACF,SAAS,UAAU,IAAI,CAAC;EAE5B;CACF;AACF"}
@@ -1,5 +1,5 @@
1
- import { Node } from '../../core/types';
2
- import { PrefillController } from './prefill-context';
1
+ import { Node } from '../../core/types.js';
2
+ import { PrefillController } from './prefill-context.js';
3
3
  type FormResolver = {
4
4
  nodes: Record<string, Node>;
5
5
  markUserEdit: PrefillController["markUserEdit"];
@@ -1,10 +1,10 @@
1
- import { walkFields } from "./field-props.js";
2
- import { postFormAction } from "./form-transport.js";
3
- import { getPath } from "./form-path.js";
4
- import { collectPrefillTargets, pathsToClear, pruneOverrides, seededOverrides } from "./prefill-targets.js";
1
+ import { walkFields } from "../lib/field-props.js";
2
+ import { getPath } from "../lib/form-path.js";
5
3
  import { useFormValues, useSetFormValue } from "./values.js";
4
+ import { postFormAction } from "../lib/form-transport.js";
5
+ import { collectPrefillTargets, pathsToClear, pruneOverrides, seededOverrides } from "../lib/prefill-targets.js";
6
6
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
7
- //#region resources/js/form/components/use-form-resolver.ts
7
+ //#region resources/js/form/hooks/use-form-resolver.ts
8
8
  function useFormResolver(action, componentRef, nodes) {
9
9
  const values = useFormValues();
10
10
  const setValue = useSetFormValue();
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-form-resolver.js","names":[],"sources":["../../../resources/js/form/hooks/use-form-resolver.ts"],"sourcesContent":["import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { Node } from \"@lattice-php/lattice/core/types\";\nimport { walkFields } from \"@lattice-php/lattice/form/lib/field-props\";\nimport { FORM_DEBOUNCE_MS, postFormAction } from \"@lattice-php/lattice/form/lib/form-transport\";\nimport {\n collectPrefillTargets,\n getPath,\n pathsToClear,\n pruneOverrides,\n seededOverrides,\n} from \"@lattice-php/lattice/form/lib/prefill-targets\";\nimport type { PrefillController } from \"./prefill-context\";\nimport { useFormValues, useSetFormValue } from \"./values\";\n\ntype ResolveResponse = {\n fields?: Record<string, Node>;\n values?: Record<string, unknown>;\n prefill?: Record<string, unknown>;\n};\n\ntype FormResolver = {\n nodes: Record<string, Node>;\n markUserEdit: PrefillController[\"markUserEdit\"];\n};\n\nexport function useFormResolver(\n action: string,\n componentRef: string,\n nodes: Node[] | undefined,\n): FormResolver {\n const values = useFormValues();\n const setValue = useSetFormValue();\n const [resolved, setResolved] = useState<Record<string, Node>>({});\n\n const targets = useMemo(() => collectPrefillTargets(nodes, values), [nodes, values]);\n\n const overrides = useRef<Set<string>>(new Set());\n const seededOverrideKeys = useRef<Set<string>>(new Set());\n const previousValues = useRef<Record<string, unknown>>(values);\n const previousTargets = useRef(targets);\n\n // Read targets via a ref inside the effect: `targets` changes identity on every\n // value change, but the effect must fire only when `watchSignature` changes\n // (which already reflects added/removed target paths). Keeping `targets` out of\n // the dep array preserves the targeted watch in non-\"any\" mode.\n const targetsRef = useRef(targets);\n targetsRef.current = targets;\n\n useLayoutEffect(() => {\n const liveOverrideKeys = new Set(targets.map((target) => target.overrideKey));\n seededOverrideKeys.current = new Set(\n [...seededOverrideKeys.current].filter((overrideKey) => liveOverrideKeys.has(overrideKey)),\n );\n const freshTargets = targets.filter(\n (target) => !seededOverrideKeys.current.has(target.overrideKey),\n );\n\n // Layout ordering seeds loaded values before the first resolve effect can apply prefill.\n for (const overrideKey of seededOverrides(freshTargets, values)) {\n overrides.current.add(overrideKey);\n }\n\n for (const target of freshTargets) {\n seededOverrideKeys.current.add(target.overrideKey);\n }\n }, [targets, values]);\n\n const markUserEdit = useCallback((overrideKey: string) => {\n overrides.current.add(overrideKey);\n }, []);\n\n const watch = useMemo(() => {\n const keys = new Set<string>();\n let any = false;\n walkFields(nodes, (props) => {\n if (Array.isArray(props.dependsOnKeys)) {\n for (const key of props.dependsOnKeys) {\n keys.add(String(key));\n }\n }\n if (props.dependsOnAny) {\n any = true;\n }\n });\n return { keys: [...keys], any };\n }, [nodes]);\n\n const watchPaths = useMemo(() => {\n const set = new Set<string>(watch.keys);\n for (const target of targets) {\n for (const dep of target.resetOn) {\n set.add(dep);\n }\n for (const dep of target.refreshOn) {\n set.add(dep);\n }\n }\n return [...set];\n }, [watch.keys, targets]);\n\n // In \"any\" mode the values store keeps a stable reference until something\n // actually changes, so its identity is the change signal. Otherwise hash the\n // watched paths (form-level and per-row).\n const watchSignature = watch.any\n ? values\n : JSON.stringify(watchPaths.map((path) => getPath(values, path)));\n\n useEffect(() => {\n if (watchPaths.length === 0 && !watch.any) {\n return;\n }\n\n const previous = previousValues.current;\n previousValues.current = values;\n\n // `resetOn` deps unlock a path (a fresh product gives a fresh price); `refreshOn`\n // deps only re-ask the server and never clear an override (a customer change\n // re-prices untouched rows but leaves user-edited ones alone).\n for (const overrideKey of pathsToClear(\n { targets: previousTargets.current, values: previous },\n { targets: targetsRef.current, values },\n )) {\n overrides.current.delete(overrideKey);\n }\n previousTargets.current = targetsRef.current;\n\n // Override ownership is row-id keyed, so pruning removes departed rows without reindex drift.\n overrides.current = pruneOverrides(overrides.current, targetsRef.current);\n\n const controller = new AbortController();\n\n const timer = window.setTimeout(() => {\n void postFormAction<ResolveResponse>(\n action,\n componentRef,\n { _resolve: true, ...values },\n controller.signal,\n )\n .then((response) => {\n if (!response) {\n return;\n }\n for (const [name, value] of Object.entries(response.values ?? {})) {\n setValue(name, value);\n }\n const targetsByPath = new Map(\n targetsRef.current.map((target) => [target.path, target] as const),\n );\n for (const [path, value] of Object.entries(response.prefill ?? {})) {\n const target = targetsByPath.get(path);\n\n if (target && !overrides.current.has(target.overrideKey)) {\n setValue(path, value);\n }\n }\n if (response.fields) {\n setResolved(response.fields);\n }\n })\n .catch(() => {});\n }, FORM_DEBOUNCE_MS);\n\n return () => {\n window.clearTimeout(timer);\n controller.abort();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [watchSignature, action, componentRef, watch.any, setValue]);\n\n return { nodes: resolved, markUserEdit };\n}\n"],"mappings":"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"}
@@ -1,7 +1,7 @@
1
1
  import { useFieldScope } from "./field-scope.js";
2
2
  import { useFormValue, useSetFormValue } from "./values.js";
3
3
  import { useEffect } from "react";
4
- //#region resources/js/form/components/use-seed-default.ts
4
+ //#region resources/js/form/hooks/use-seed-default.ts
5
5
  /**
6
6
  * Seed a field's default into the store so dependent fields and the submitted
7
7
  * payload reflect it before the user interacts. Pass undefined to skip.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-seed-default.js","names":[],"sources":["../../../resources/js/form/hooks/use-seed-default.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useFieldScope } from \"./field-scope\";\nimport { useFormValue, useSetFormValue } from \"./values\";\n\n/**\n * Seed a field's default into the store so dependent fields and the submitted\n * payload reflect it before the user interacts. Pass undefined to skip.\n */\nexport function useSeedDefault(name: string, value: unknown): void {\n const scope = useFieldScope();\n const globalStored = useFormValue(name);\n const stored = scope ? scope.getValue(name) : globalStored;\n const setValue = useSetFormValue();\n\n useEffect(() => {\n if (stored === undefined && value !== undefined) {\n if (scope) {\n scope.setValue(name, value);\n } else {\n setValue(name, value);\n }\n }\n }, [name, value, stored, setValue, scope]);\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,eAAe,MAAc,OAAsB;CACjE,MAAM,QAAQ,cAAc;CAC5B,MAAM,eAAe,aAAa,IAAI;CACtC,MAAM,SAAS,QAAQ,MAAM,SAAS,IAAI,IAAI;CAC9C,MAAM,WAAW,gBAAgB;CAEjC,gBAAgB;EACd,IAAI,WAAW,KAAA,KAAa,UAAU,KAAA,GACpC,IAAI,OACF,MAAM,SAAS,MAAM,KAAK;OAE1B,SAAS,MAAM,KAAK;CAG1B,GAAG;EAAC;EAAM;EAAO;EAAQ;EAAU;CAAK,CAAC;AAC3C"}
@@ -1,7 +1,9 @@
1
+ export type SetFormValue = (name: string, value: unknown | ((previous: unknown) => unknown)) => void;
1
2
  export declare function FormValuesProvider({ initial, children, }: {
2
3
  initial: Record<string, unknown>;
3
4
  children: React.ReactNode;
4
5
  }): import("react").JSX.Element;
5
6
  export declare function useFormValues(): Record<string, unknown>;
6
7
  export declare function useFormValue(name: string): unknown;
7
- export declare function useSetFormValue(): (name: string, value: unknown) => void;
8
+ export declare function useFormValuesFor(paths: string[]): Record<string, unknown>;
9
+ export declare function useSetFormValue(): SetFormValue;
@@ -0,0 +1,136 @@
1
+ import { getPath, setPath } from "../lib/form-path.js";
2
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useSyncExternalStore } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region resources/js/form/hooks/values.tsx
5
+ var emptyValues = {};
6
+ var emptySelectedValues = {};
7
+ var FormValuesStoreContext = createContext(null);
8
+ var SetFormValueContext = createContext(() => {});
9
+ function valuesEqual(a, b) {
10
+ if (Object.is(a, b)) return true;
11
+ if (!a || !b || typeof a !== "object" || typeof b !== "object") return false;
12
+ if (Array.isArray(a) || Array.isArray(b)) return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((value, index) => valuesEqual(value, b[index]));
13
+ const aEntries = Object.entries(a);
14
+ const bObject = b;
15
+ return aEntries.length === Object.keys(bObject).length && aEntries.every(([key, value]) => valuesEqual(value, bObject[key]));
16
+ }
17
+ function normalizePath(path) {
18
+ return path.split(".").filter((part) => part !== "").join(".");
19
+ }
20
+ function pathsOverlap(left, right) {
21
+ return left === "" || right === "" || left === right || left.startsWith(`${right}.`) || right.startsWith(`${left}.`);
22
+ }
23
+ function createFormValuesStore(initial) {
24
+ let initialValues = initial;
25
+ let values = initial;
26
+ const listeners = /* @__PURE__ */ new Set();
27
+ const pathListeners = /* @__PURE__ */ new Map();
28
+ const selectedCache = /* @__PURE__ */ new Map();
29
+ const notify = (path) => {
30
+ for (const listener of listeners) listener();
31
+ const normalizedPath = normalizePath(path);
32
+ for (const [subscribedPath, subscribedListeners] of pathListeners) {
33
+ if (!pathsOverlap(subscribedPath, normalizedPath)) continue;
34
+ for (const listener of subscribedListeners) listener();
35
+ }
36
+ };
37
+ const updateValues = (next, path) => {
38
+ if (Object.is(values, next)) return;
39
+ values = next;
40
+ selectedCache.clear();
41
+ notify(path);
42
+ };
43
+ const subscribePath = (path, listener) => {
44
+ const normalizedPath = normalizePath(path);
45
+ const listenersForPath = pathListeners.get(normalizedPath) ?? /* @__PURE__ */ new Set();
46
+ listenersForPath.add(listener);
47
+ pathListeners.set(normalizedPath, listenersForPath);
48
+ return () => {
49
+ listenersForPath.delete(listener);
50
+ if (listenersForPath.size === 0) pathListeners.delete(normalizedPath);
51
+ };
52
+ };
53
+ return {
54
+ getPathSnapshot: (path) => getPath(values, path),
55
+ getPathsSnapshot: (paths) => {
56
+ if (paths.length === 0) return emptySelectedValues;
57
+ const normalizedPaths = paths.map(normalizePath);
58
+ const key = JSON.stringify(paths);
59
+ const selectedValues = normalizedPaths.map((path) => getPath(values, path));
60
+ const cached = selectedCache.get(key);
61
+ if (cached && cached.values.length === selectedValues.length && selectedValues.every((value, index) => Object.is(value, cached.values[index]))) return cached.snapshot;
62
+ const snapshot = Object.fromEntries(paths.map((path, index) => [path, selectedValues[index]]));
63
+ selectedCache.set(key, {
64
+ snapshot,
65
+ values: selectedValues
66
+ });
67
+ return snapshot;
68
+ },
69
+ getSnapshot: () => values,
70
+ replaceInitial: (nextInitial) => {
71
+ if (valuesEqual(initialValues, nextInitial)) return;
72
+ initialValues = nextInitial;
73
+ updateValues(nextInitial, "");
74
+ },
75
+ setValue: (name, value) => {
76
+ const previous = getPath(values, name);
77
+ const next = typeof value === "function" ? value(previous) : value;
78
+ if (Object.is(previous, next)) return;
79
+ updateValues(setPath(values, name, next), name);
80
+ },
81
+ subscribe: (listener) => {
82
+ listeners.add(listener);
83
+ return () => listeners.delete(listener);
84
+ },
85
+ subscribePath,
86
+ subscribePaths: (paths, listener) => {
87
+ const unsubscribers = Array.from(new Set(paths.map(normalizePath))).map((path) => subscribePath(path, listener));
88
+ return () => {
89
+ for (const unsubscribe of unsubscribers) unsubscribe();
90
+ };
91
+ }
92
+ };
93
+ }
94
+ var fallbackFormValuesStore = createFormValuesStore(emptyValues);
95
+ function FormValuesProvider({ initial, children }) {
96
+ const storeRef = useRef(null);
97
+ if (storeRef.current === null) storeRef.current = createFormValuesStore(initial);
98
+ useEffect(() => {
99
+ storeRef.current?.replaceInitial(initial);
100
+ }, [initial]);
101
+ return /* @__PURE__ */ jsx(FormValuesStoreContext.Provider, {
102
+ value: storeRef.current,
103
+ children: /* @__PURE__ */ jsx(SetFormValueContext.Provider, {
104
+ value: storeRef.current.setValue,
105
+ children
106
+ })
107
+ });
108
+ }
109
+ function useFormValuesStore() {
110
+ return useContext(FormValuesStoreContext) ?? fallbackFormValuesStore;
111
+ }
112
+ function useFormValues() {
113
+ const store = useFormValuesStore();
114
+ return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
115
+ }
116
+ function useFormValue(name) {
117
+ const store = useFormValuesStore();
118
+ const subscribe = useCallback((listener) => store.subscribePath(name, listener), [name, store]);
119
+ const getSnapshot = useCallback(() => store.getPathSnapshot(name), [name, store]);
120
+ return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
121
+ }
122
+ function useFormValuesFor(paths) {
123
+ const store = useFormValuesStore();
124
+ const pathsKey = JSON.stringify(paths);
125
+ const selectedPaths = useMemo(() => JSON.parse(pathsKey), [pathsKey]);
126
+ const subscribe = useCallback((listener) => store.subscribePaths(selectedPaths, listener), [selectedPaths, store]);
127
+ const getSnapshot = useCallback(() => store.getPathsSnapshot(selectedPaths), [selectedPaths, store]);
128
+ return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
129
+ }
130
+ function useSetFormValue() {
131
+ return useContext(SetFormValueContext);
132
+ }
133
+ //#endregion
134
+ export { FormValuesProvider, useFormValue, useFormValues, useFormValuesFor, useSetFormValue };
135
+
136
+ //# sourceMappingURL=values.js.map
@@ -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":"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"}
@@ -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>;