@schema-engine/forms 0.0.0-stage → 0.5.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 (609) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +69 -2
  3. package/dist/actions/index.d.ts +3 -0
  4. package/dist/actions/index.js +50 -0
  5. package/dist/actions/index.js.map +7 -0
  6. package/dist/actions/plugins/auto-save.plugin.d.ts +39 -0
  7. package/dist/actions/plugins/auto-save.plugin.js +10 -0
  8. package/dist/actions/plugins/auto-save.plugin.js.map +7 -0
  9. package/dist/actions/plugins/form-reset.plugin.d.ts +23 -0
  10. package/dist/actions/plugins/form-reset.plugin.js +9 -0
  11. package/dist/actions/plugins/form-reset.plugin.js.map +7 -0
  12. package/dist/actions/plugins/form-submit.plugin.d.ts +31 -0
  13. package/dist/actions/plugins/form-submit.plugin.js +9 -0
  14. package/dist/actions/plugins/form-submit.plugin.js.map +7 -0
  15. package/dist/actions/plugins/form-submit.registration.d.ts +22 -0
  16. package/dist/actions/plugins/form-submit.registration.js +8 -0
  17. package/dist/actions/plugins/form-submit.registration.js.map +7 -0
  18. package/dist/actions/plugins/gtm.plugin.d.ts +30 -0
  19. package/dist/actions/plugins/gtm.plugin.js +8 -0
  20. package/dist/actions/plugins/gtm.plugin.js.map +7 -0
  21. package/dist/actions/plugins/index.d.ts +16 -0
  22. package/dist/actions/plugins/index.js +45 -0
  23. package/dist/actions/plugins/index.js.map +7 -0
  24. package/dist/actions/plugins/notification.plugin.d.ts +32 -0
  25. package/dist/actions/plugins/notification.plugin.js +9 -0
  26. package/dist/actions/plugins/notification.plugin.js.map +7 -0
  27. package/dist/actions/plugins/notification.registration.d.ts +22 -0
  28. package/dist/actions/plugins/notification.registration.js +8 -0
  29. package/dist/actions/plugins/notification.registration.js.map +7 -0
  30. package/dist/actions/plugins/registrations.d.ts +17 -0
  31. package/dist/actions/plugins/registrations.js +14 -0
  32. package/dist/actions/plugins/registrations.js.map +7 -0
  33. package/dist/actions/triggers.d.ts +42 -0
  34. package/dist/actions/triggers.js +6 -0
  35. package/dist/actions/triggers.js.map +7 -0
  36. package/dist/actions/types.d.ts +16 -0
  37. package/dist/actions/types.js +1 -0
  38. package/dist/actions/types.js.map +7 -0
  39. package/dist/agent-tool/index.d.ts +54 -0
  40. package/dist/agent-tool/index.js +128 -0
  41. package/dist/agent-tool/index.js.map +7 -0
  42. package/dist/browser/action-registrations.d.ts +46 -0
  43. package/dist/browser/action-registrations.js +19 -0
  44. package/dist/browser/action-registrations.js.map +7 -0
  45. package/dist/browser/index.d.ts +4 -0
  46. package/dist/browser/index.js +36 -0
  47. package/dist/browser/index.js.map +7 -0
  48. package/dist/browser/tools/auto-save-storage.d.ts +20 -0
  49. package/dist/browser/tools/auto-save-storage.js +12 -0
  50. package/dist/browser/tools/auto-save-storage.js.map +7 -0
  51. package/dist/browser/tools/gdpr-consent.d.ts +32 -0
  52. package/dist/browser/tools/gdpr-consent.js +11 -0
  53. package/dist/browser/tools/gdpr-consent.js.map +7 -0
  54. package/dist/browser/tools/gtm-tracker.d.ts +7 -0
  55. package/dist/browser/tools/gtm-tracker.js +7 -0
  56. package/dist/browser/tools/gtm-tracker.js.map +7 -0
  57. package/dist/builder/form-authoring.d.ts +159 -0
  58. package/dist/builder/form-authoring.js +1 -0
  59. package/dist/builder/form-authoring.js.map +7 -0
  60. package/dist/builder/form-values.d.ts +158 -0
  61. package/dist/builder/form-values.js +0 -0
  62. package/dist/builder/form-values.js.map +7 -0
  63. package/dist/builder/index.d.ts +5 -0
  64. package/dist/builder/index.js +2 -0
  65. package/dist/builder/index.js.map +7 -0
  66. package/dist/builder/types.utils.d.ts +137 -0
  67. package/dist/builder/types.utils.js +1 -0
  68. package/dist/builder/types.utils.js.map +7 -0
  69. package/dist/chunk-237BHPDH.js +88 -0
  70. package/dist/chunk-237BHPDH.js.map +7 -0
  71. package/dist/chunk-25PLQDKN.js +45 -0
  72. package/dist/chunk-25PLQDKN.js.map +7 -0
  73. package/dist/chunk-2PTM54FQ.js +51 -0
  74. package/dist/chunk-2PTM54FQ.js.map +7 -0
  75. package/dist/chunk-2VKEOE2L.js +907 -0
  76. package/dist/chunk-2VKEOE2L.js.map +7 -0
  77. package/dist/chunk-2XWISGGM.js +8 -0
  78. package/dist/chunk-2XWISGGM.js.map +7 -0
  79. package/dist/chunk-2YKQAVI2.js +8 -0
  80. package/dist/chunk-2YKQAVI2.js.map +7 -0
  81. package/dist/chunk-3B7CJOF6.js +18 -0
  82. package/dist/chunk-3B7CJOF6.js.map +7 -0
  83. package/dist/chunk-3YLRJVVN.js +17 -0
  84. package/dist/chunk-3YLRJVVN.js.map +7 -0
  85. package/dist/chunk-4CUGHU36.js +58 -0
  86. package/dist/chunk-4CUGHU36.js.map +7 -0
  87. package/dist/chunk-4FELFUCD.js +0 -0
  88. package/dist/chunk-4FELFUCD.js.map +7 -0
  89. package/dist/chunk-4XPLSYTK.js +82 -0
  90. package/dist/chunk-4XPLSYTK.js.map +7 -0
  91. package/dist/chunk-56CJ2UZ7.js +55 -0
  92. package/dist/chunk-56CJ2UZ7.js.map +7 -0
  93. package/dist/chunk-5QXT7YAJ.js +87 -0
  94. package/dist/chunk-5QXT7YAJ.js.map +7 -0
  95. package/dist/chunk-5Y6U3MR3.js +54 -0
  96. package/dist/chunk-5Y6U3MR3.js.map +7 -0
  97. package/dist/chunk-6BAJHAGL.js +29 -0
  98. package/dist/chunk-6BAJHAGL.js.map +7 -0
  99. package/dist/chunk-6FUGK5HQ.js +26 -0
  100. package/dist/chunk-6FUGK5HQ.js.map +7 -0
  101. package/dist/chunk-6IZYNHZ3.js +118 -0
  102. package/dist/chunk-6IZYNHZ3.js.map +7 -0
  103. package/dist/chunk-6NV2JDGI.js +8 -0
  104. package/dist/chunk-6NV2JDGI.js.map +7 -0
  105. package/dist/chunk-6R2MBQPL.js +19 -0
  106. package/dist/chunk-6R2MBQPL.js.map +7 -0
  107. package/dist/chunk-7EQJUI5N.js +40 -0
  108. package/dist/chunk-7EQJUI5N.js.map +7 -0
  109. package/dist/chunk-AUZ45XPE.js +27 -0
  110. package/dist/chunk-AUZ45XPE.js.map +7 -0
  111. package/dist/chunk-BIHEIJG3.js +0 -0
  112. package/dist/chunk-BIHEIJG3.js.map +7 -0
  113. package/dist/chunk-BKNWW4PK.js +0 -0
  114. package/dist/chunk-BKNWW4PK.js.map +7 -0
  115. package/dist/chunk-BLFLCSG3.js +71 -0
  116. package/dist/chunk-BLFLCSG3.js.map +7 -0
  117. package/dist/chunk-BYYGAGNH.js +0 -0
  118. package/dist/chunk-BYYGAGNH.js.map +7 -0
  119. package/dist/chunk-CAZPWBQ4.js +18 -0
  120. package/dist/chunk-CAZPWBQ4.js.map +7 -0
  121. package/dist/chunk-CMPOBBRV.js +10 -0
  122. package/dist/chunk-CMPOBBRV.js.map +7 -0
  123. package/dist/chunk-CRQWKC67.js +118 -0
  124. package/dist/chunk-CRQWKC67.js.map +7 -0
  125. package/dist/chunk-CRVXBWSY.js +70 -0
  126. package/dist/chunk-CRVXBWSY.js.map +7 -0
  127. package/dist/chunk-D6ZHV6AT.js +0 -0
  128. package/dist/chunk-D6ZHV6AT.js.map +7 -0
  129. package/dist/chunk-DVDKPY2A.js +12 -0
  130. package/dist/chunk-DVDKPY2A.js.map +7 -0
  131. package/dist/chunk-E4VONSLO.js +15 -0
  132. package/dist/chunk-E4VONSLO.js.map +7 -0
  133. package/dist/chunk-EEYGPPLU.js +185 -0
  134. package/dist/chunk-EEYGPPLU.js.map +7 -0
  135. package/dist/chunk-EI5TMJDC.js +56 -0
  136. package/dist/chunk-EI5TMJDC.js.map +7 -0
  137. package/dist/chunk-EQ5AIF3T.js +117 -0
  138. package/dist/chunk-EQ5AIF3T.js.map +7 -0
  139. package/dist/chunk-EZZHO6DQ.js +26 -0
  140. package/dist/chunk-EZZHO6DQ.js.map +7 -0
  141. package/dist/chunk-FUHLRG3M.js +130 -0
  142. package/dist/chunk-FUHLRG3M.js.map +7 -0
  143. package/dist/chunk-FVOL3ZOJ.js +101 -0
  144. package/dist/chunk-FVOL3ZOJ.js.map +7 -0
  145. package/dist/chunk-G33EUV7N.js +288 -0
  146. package/dist/chunk-G33EUV7N.js.map +7 -0
  147. package/dist/chunk-GH34XFCC.js +56 -0
  148. package/dist/chunk-GH34XFCC.js.map +7 -0
  149. package/dist/chunk-GKWRJ6H4.js +27 -0
  150. package/dist/chunk-GKWRJ6H4.js.map +7 -0
  151. package/dist/chunk-GRZU6F7Q.js +80 -0
  152. package/dist/chunk-GRZU6F7Q.js.map +7 -0
  153. package/dist/chunk-GT2LARKT.js +107 -0
  154. package/dist/chunk-GT2LARKT.js.map +7 -0
  155. package/dist/chunk-GY657L56.js +206 -0
  156. package/dist/chunk-GY657L56.js.map +7 -0
  157. package/dist/chunk-H4ABGAAG.js +60 -0
  158. package/dist/chunk-H4ABGAAG.js.map +7 -0
  159. package/dist/chunk-H63UHX42.js +93 -0
  160. package/dist/chunk-H63UHX42.js.map +7 -0
  161. package/dist/chunk-HEAKWS27.js +2730 -0
  162. package/dist/chunk-HEAKWS27.js.map +7 -0
  163. package/dist/chunk-HIS4MGIR.js +8 -0
  164. package/dist/chunk-HIS4MGIR.js.map +7 -0
  165. package/dist/chunk-HPPFSWIV.js +213 -0
  166. package/dist/chunk-HPPFSWIV.js.map +7 -0
  167. package/dist/chunk-J2FC5K4B.js +87 -0
  168. package/dist/chunk-J2FC5K4B.js.map +7 -0
  169. package/dist/chunk-J5BSFDVK.js +123 -0
  170. package/dist/chunk-J5BSFDVK.js.map +7 -0
  171. package/dist/chunk-J7GSNWXT.js +151 -0
  172. package/dist/chunk-J7GSNWXT.js.map +7 -0
  173. package/dist/chunk-K22S7IZR.js +12 -0
  174. package/dist/chunk-K22S7IZR.js.map +7 -0
  175. package/dist/chunk-K5TMXCMY.js +139 -0
  176. package/dist/chunk-K5TMXCMY.js.map +7 -0
  177. package/dist/chunk-KE53GN4Q.js +246 -0
  178. package/dist/chunk-KE53GN4Q.js.map +7 -0
  179. package/dist/chunk-KFQEDSYI.js +24 -0
  180. package/dist/chunk-KFQEDSYI.js.map +7 -0
  181. package/dist/chunk-KLATKWUA.js +116 -0
  182. package/dist/chunk-KLATKWUA.js.map +7 -0
  183. package/dist/chunk-KSKWSUOB.js +17 -0
  184. package/dist/chunk-KSKWSUOB.js.map +7 -0
  185. package/dist/chunk-LFWEJXWE.js +68 -0
  186. package/dist/chunk-LFWEJXWE.js.map +7 -0
  187. package/dist/chunk-LMWJAD3B.js +24 -0
  188. package/dist/chunk-LMWJAD3B.js.map +7 -0
  189. package/dist/chunk-MD23VADH.js +92 -0
  190. package/dist/chunk-MD23VADH.js.map +7 -0
  191. package/dist/chunk-MKMJT3XR.js +0 -0
  192. package/dist/chunk-MKMJT3XR.js.map +7 -0
  193. package/dist/chunk-NJTLBSTR.js +82 -0
  194. package/dist/chunk-NJTLBSTR.js.map +7 -0
  195. package/dist/chunk-NJXKMF67.js +182 -0
  196. package/dist/chunk-NJXKMF67.js.map +7 -0
  197. package/dist/chunk-OBQBIOGN.js +16 -0
  198. package/dist/chunk-OBQBIOGN.js.map +7 -0
  199. package/dist/chunk-OLYHNFKC.js +82 -0
  200. package/dist/chunk-OLYHNFKC.js.map +7 -0
  201. package/dist/chunk-OR2L7EKO.js +33 -0
  202. package/dist/chunk-OR2L7EKO.js.map +7 -0
  203. package/dist/chunk-OUF57UZ7.js +28 -0
  204. package/dist/chunk-OUF57UZ7.js.map +7 -0
  205. package/dist/chunk-PBMM2N77.js +56 -0
  206. package/dist/chunk-PBMM2N77.js.map +7 -0
  207. package/dist/chunk-PH3LWLYN.js +49 -0
  208. package/dist/chunk-PH3LWLYN.js.map +7 -0
  209. package/dist/chunk-PHNMDWSK.js +9 -0
  210. package/dist/chunk-PHNMDWSK.js.map +7 -0
  211. package/dist/chunk-PN5EH6DM.js +36 -0
  212. package/dist/chunk-PN5EH6DM.js.map +7 -0
  213. package/dist/chunk-POCAINUE.js +42 -0
  214. package/dist/chunk-POCAINUE.js.map +7 -0
  215. package/dist/chunk-PXWVKJGF.js +6 -0
  216. package/dist/chunk-PXWVKJGF.js.map +7 -0
  217. package/dist/chunk-Q5LEK7CI.js +64 -0
  218. package/dist/chunk-Q5LEK7CI.js.map +7 -0
  219. package/dist/chunk-QH7VW7IY.js +0 -0
  220. package/dist/chunk-QH7VW7IY.js.map +7 -0
  221. package/dist/chunk-QLGM2AZW.js +173 -0
  222. package/dist/chunk-QLGM2AZW.js.map +7 -0
  223. package/dist/chunk-QT3EYUL5.js +85 -0
  224. package/dist/chunk-QT3EYUL5.js.map +7 -0
  225. package/dist/chunk-QYHOFLRX.js +43 -0
  226. package/dist/chunk-QYHOFLRX.js.map +7 -0
  227. package/dist/chunk-R3MBVWVI.js +127 -0
  228. package/dist/chunk-R3MBVWVI.js.map +7 -0
  229. package/dist/chunk-R6V3LH7F.js +67 -0
  230. package/dist/chunk-R6V3LH7F.js.map +7 -0
  231. package/dist/chunk-RB22U6HI.js +64 -0
  232. package/dist/chunk-RB22U6HI.js.map +7 -0
  233. package/dist/chunk-RQRQYYTB.js +34 -0
  234. package/dist/chunk-RQRQYYTB.js.map +7 -0
  235. package/dist/chunk-S5D2QE4G.js +53 -0
  236. package/dist/chunk-S5D2QE4G.js.map +7 -0
  237. package/dist/chunk-S7I76ISM.js +245 -0
  238. package/dist/chunk-S7I76ISM.js.map +7 -0
  239. package/dist/chunk-TBDZOQ2C.js +66 -0
  240. package/dist/chunk-TBDZOQ2C.js.map +7 -0
  241. package/dist/chunk-U2X3IYSD.js +23 -0
  242. package/dist/chunk-U2X3IYSD.js.map +7 -0
  243. package/dist/chunk-UGL3KNOT.js +42 -0
  244. package/dist/chunk-UGL3KNOT.js.map +7 -0
  245. package/dist/chunk-UN3DARLG.js +35 -0
  246. package/dist/chunk-UN3DARLG.js.map +7 -0
  247. package/dist/chunk-VGGERKV2.js +7 -0
  248. package/dist/chunk-VGGERKV2.js.map +7 -0
  249. package/dist/chunk-VVFXYY65.js +0 -0
  250. package/dist/chunk-VVFXYY65.js.map +7 -0
  251. package/dist/chunk-WLDCYUN6.js +161 -0
  252. package/dist/chunk-WLDCYUN6.js.map +7 -0
  253. package/dist/chunk-WMDTQS36.js +0 -0
  254. package/dist/chunk-WMDTQS36.js.map +7 -0
  255. package/dist/chunk-WS7SLVXL.js +550 -0
  256. package/dist/chunk-WS7SLVXL.js.map +7 -0
  257. package/dist/chunk-WUTGZYP4.js +290 -0
  258. package/dist/chunk-WUTGZYP4.js.map +7 -0
  259. package/dist/chunk-XKN3WWK3.js +0 -0
  260. package/dist/chunk-XKN3WWK3.js.map +7 -0
  261. package/dist/chunk-XPQRHO5E.js +587 -0
  262. package/dist/chunk-XPQRHO5E.js.map +7 -0
  263. package/dist/chunk-XQ5VJ4QO.js +62 -0
  264. package/dist/chunk-XQ5VJ4QO.js.map +7 -0
  265. package/dist/chunk-XQVKX47O.js +174 -0
  266. package/dist/chunk-XQVKX47O.js.map +7 -0
  267. package/dist/chunk-Y5CNB57V.js +22 -0
  268. package/dist/chunk-Y5CNB57V.js.map +7 -0
  269. package/dist/chunk-YDGH7DTL.js +18 -0
  270. package/dist/chunk-YDGH7DTL.js.map +7 -0
  271. package/dist/chunk-YIFUBPJ3.js +0 -0
  272. package/dist/chunk-YIFUBPJ3.js.map +7 -0
  273. package/dist/chunk-YUUDXRBW.js +212 -0
  274. package/dist/chunk-YUUDXRBW.js.map +7 -0
  275. package/dist/chunk-Z6DQLJS2.js +23 -0
  276. package/dist/chunk-Z6DQLJS2.js.map +7 -0
  277. package/dist/chunk-ZDEZ2FOC.js +81 -0
  278. package/dist/chunk-ZDEZ2FOC.js.map +7 -0
  279. package/dist/chunk-ZUYSGCEH.js +65 -0
  280. package/dist/chunk-ZUYSGCEH.js.map +7 -0
  281. package/dist/chunk-ZYP3MIH3.js +115 -0
  282. package/dist/chunk-ZYP3MIH3.js.map +7 -0
  283. package/dist/constraints/constraint-evaluator.d.ts +57 -0
  284. package/dist/constraints/constraint-evaluator.js +17 -0
  285. package/dist/constraints/constraint-evaluator.js.map +7 -0
  286. package/dist/constraints/index.d.ts +1 -0
  287. package/dist/constraints/index.js +17 -0
  288. package/dist/constraints/index.js.map +7 -0
  289. package/dist/csrf/index.d.ts +43 -0
  290. package/dist/csrf/index.js +43 -0
  291. package/dist/csrf/index.js.map +7 -0
  292. package/dist/engine/build-form-engine.d.ts +27 -0
  293. package/dist/engine/build-form-engine.js +58 -0
  294. package/dist/engine/build-form-engine.js.map +7 -0
  295. package/dist/engine/component-type.d.ts +19 -0
  296. package/dist/engine/component-type.js +6 -0
  297. package/dist/engine/component-type.js.map +7 -0
  298. package/dist/engine/create-form-engine.d.ts +100 -0
  299. package/dist/engine/create-form-engine.js +59 -0
  300. package/dist/engine/create-form-engine.js.map +7 -0
  301. package/dist/engine/form-action-context.d.ts +70 -0
  302. package/dist/engine/form-action-context.js +10 -0
  303. package/dist/engine/form-action-context.js.map +7 -0
  304. package/dist/engine/form-engine.d.ts +236 -0
  305. package/dist/engine/form-engine.js +61 -0
  306. package/dist/engine/form-engine.js.map +7 -0
  307. package/dist/engine/index.d.ts +12 -0
  308. package/dist/engine/index.js +124 -0
  309. package/dist/engine/index.js.map +7 -0
  310. package/dist/engine/schema-artifacts.d.ts +87 -0
  311. package/dist/engine/schema-artifacts.js +14 -0
  312. package/dist/engine/schema-artifacts.js.map +7 -0
  313. package/dist/engine/schema-metadata-catalog.d.ts +41 -0
  314. package/dist/engine/schema-metadata-catalog.js +6 -0
  315. package/dist/engine/schema-metadata-catalog.js.map +7 -0
  316. package/dist/engine/step-machine.d.ts +59 -0
  317. package/dist/engine/step-machine.js +32 -0
  318. package/dist/engine/step-machine.js.map +7 -0
  319. package/dist/engine/submission-schema.d.ts +53 -0
  320. package/dist/engine/submission-schema.js +22 -0
  321. package/dist/engine/submission-schema.js.map +7 -0
  322. package/dist/engine/value-validation.d.ts +237 -0
  323. package/dist/engine/value-validation.js +39 -0
  324. package/dist/engine/value-validation.js.map +7 -0
  325. package/dist/index.d.ts +76 -0
  326. package/dist/index.js +283 -0
  327. package/dist/index.js.map +7 -0
  328. package/dist/lib/authoring-catalog.d.ts +5 -0
  329. package/dist/lib/authoring-catalog.js +11 -0
  330. package/dist/lib/authoring-catalog.js.map +7 -0
  331. package/dist/lib/container-kind-of.d.ts +5 -0
  332. package/dist/lib/container-kind-of.js +6 -0
  333. package/dist/lib/container-kind-of.js.map +7 -0
  334. package/dist/lib/debounce.d.ts +19 -0
  335. package/dist/lib/debounce.js +6 -0
  336. package/dist/lib/debounce.js.map +7 -0
  337. package/dist/lib/deep-readonly.d.ts +12 -0
  338. package/dist/lib/deep-readonly.js +0 -0
  339. package/dist/lib/deep-readonly.js.map +7 -0
  340. package/dist/lib/element-children.d.ts +35 -0
  341. package/dist/lib/element-children.js +16 -0
  342. package/dist/lib/element-children.js.map +7 -0
  343. package/dist/lib/exported-action-envelope.d.ts +11 -0
  344. package/dist/lib/exported-action-envelope.js +7 -0
  345. package/dist/lib/exported-action-envelope.js.map +7 -0
  346. package/dist/lib/exported-rules.d.ts +14 -0
  347. package/dist/lib/exported-rules.js +6 -0
  348. package/dist/lib/exported-rules.js.map +7 -0
  349. package/dist/lib/field-ref.d.ts +13 -0
  350. package/dist/lib/field-ref.js +6 -0
  351. package/dist/lib/field-ref.js.map +7 -0
  352. package/dist/lib/field-scope.d.ts +121 -0
  353. package/dist/lib/field-scope.js +41 -0
  354. package/dist/lib/field-scope.js.map +7 -0
  355. package/dist/lib/form-fetch.d.ts +36 -0
  356. package/dist/lib/form-fetch.js +10 -0
  357. package/dist/lib/form-fetch.js.map +7 -0
  358. package/dist/lib/form-view.d.ts +33 -0
  359. package/dist/lib/form-view.js +12 -0
  360. package/dist/lib/form-view.js.map +7 -0
  361. package/dist/lib/frozen-copy.d.ts +9 -0
  362. package/dist/lib/frozen-copy.js +7 -0
  363. package/dist/lib/frozen-copy.js.map +7 -0
  364. package/dist/lib/is-plain-object.d.ts +2 -0
  365. package/dist/lib/is-plain-object.js +6 -0
  366. package/dist/lib/is-plain-object.js.map +7 -0
  367. package/dist/lib/logger.d.ts +2 -0
  368. package/dist/lib/logger.js +6 -0
  369. package/dist/lib/logger.js.map +7 -0
  370. package/dist/lib/normalized-form-config.d.ts +106 -0
  371. package/dist/lib/normalized-form-config.js +19 -0
  372. package/dist/lib/normalized-form-config.js.map +7 -0
  373. package/dist/lib/omit-paths.d.ts +11 -0
  374. package/dist/lib/omit-paths.js +7 -0
  375. package/dist/lib/omit-paths.js.map +7 -0
  376. package/dist/lib/path-values.d.ts +47 -0
  377. package/dist/lib/path-values.js +22 -0
  378. package/dist/lib/path-values.js.map +7 -0
  379. package/dist/lib/renderer-data-attributes.d.ts +10 -0
  380. package/dist/lib/renderer-data-attributes.js +6 -0
  381. package/dist/lib/renderer-data-attributes.js.map +7 -0
  382. package/dist/lib/reserved-path-keys.d.ts +10 -0
  383. package/dist/lib/reserved-path-keys.js +10 -0
  384. package/dist/lib/reserved-path-keys.js.map +7 -0
  385. package/dist/lib/resolve-appearance.d.ts +48 -0
  386. package/dist/lib/resolve-appearance.js +10 -0
  387. package/dist/lib/resolve-appearance.js.map +7 -0
  388. package/dist/lib/standard-json-schema.d.ts +27 -0
  389. package/dist/lib/standard-json-schema.js +8 -0
  390. package/dist/lib/standard-json-schema.js.map +7 -0
  391. package/dist/lib/standard-schema.d.ts +19 -0
  392. package/dist/lib/standard-schema.js +8 -0
  393. package/dist/lib/standard-schema.js.map +7 -0
  394. package/dist/lib/submission-shape.d.ts +60 -0
  395. package/dist/lib/submission-shape.js +14 -0
  396. package/dist/lib/submission-shape.js.map +7 -0
  397. package/dist/lib/validate-form/grid-checks.d.ts +57 -0
  398. package/dist/lib/validate-form/grid-checks.js +16 -0
  399. package/dist/lib/validate-form/grid-checks.js.map +7 -0
  400. package/dist/lib/validate-form/issues.d.ts +43 -0
  401. package/dist/lib/validate-form/issues.js +13 -0
  402. package/dist/lib/validate-form/issues.js.map +7 -0
  403. package/dist/lib/validate-form/options.d.ts +22 -0
  404. package/dist/lib/validate-form/options.js +0 -0
  405. package/dist/lib/validate-form/options.js.map +7 -0
  406. package/dist/lib/validate-form/parse-elements.d.ts +23 -0
  407. package/dist/lib/validate-form/parse-elements.js +21 -0
  408. package/dist/lib/validate-form/parse-elements.js.map +7 -0
  409. package/dist/lib/validate-form/parse-owner-actions.d.ts +14 -0
  410. package/dist/lib/validate-form/parse-owner-actions.js +10 -0
  411. package/dist/lib/validate-form/parse-owner-actions.js.map +7 -0
  412. package/dist/lib/validate-form/parse-view.d.ts +11 -0
  413. package/dist/lib/validate-form/parse-view.js +11 -0
  414. package/dist/lib/validate-form/parse-view.js.map +7 -0
  415. package/dist/lib/validate-form/schema-issues.d.ts +16 -0
  416. package/dist/lib/validate-form/schema-issues.js +8 -0
  417. package/dist/lib/validate-form/schema-issues.js.map +7 -0
  418. package/dist/lib/validate-form/step-checks.d.ts +18 -0
  419. package/dist/lib/validate-form/step-checks.js +15 -0
  420. package/dist/lib/validate-form/step-checks.js.map +7 -0
  421. package/dist/lib/validate-form/validation-error.d.ts +26 -0
  422. package/dist/lib/validate-form/validation-error.js +8 -0
  423. package/dist/lib/validate-form/validation-error.js.map +7 -0
  424. package/dist/lib/validate-form.d.ts +34 -0
  425. package/dist/lib/validate-form.js +62 -0
  426. package/dist/lib/validate-form.js.map +7 -0
  427. package/dist/lib/zod-json-schema.d.ts +33 -0
  428. package/dist/lib/zod-json-schema.js +10 -0
  429. package/dist/lib/zod-json-schema.js.map +7 -0
  430. package/dist/recipes/built-in-specs.d.ts +1832 -0
  431. package/dist/recipes/built-in-specs.js +28 -0
  432. package/dist/recipes/built-in-specs.js.map +7 -0
  433. package/dist/recipes/built-in.d.ts +2 -0
  434. package/dist/recipes/built-in.js +49 -0
  435. package/dist/recipes/built-in.js.map +7 -0
  436. package/dist/recipes/define-form-recipe.d.ts +10 -0
  437. package/dist/recipes/define-form-recipe.js +6 -0
  438. package/dist/recipes/define-form-recipe.js.map +7 -0
  439. package/dist/recipes/define-recipe-spec.d.ts +13 -0
  440. package/dist/recipes/define-recipe-spec.js +8 -0
  441. package/dist/recipes/define-recipe-spec.js.map +7 -0
  442. package/dist/recipes/index.d.ts +6 -0
  443. package/dist/recipes/index.js +43 -0
  444. package/dist/recipes/index.js.map +7 -0
  445. package/dist/recipes/protocol.d.ts +24 -0
  446. package/dist/recipes/protocol.js +11 -0
  447. package/dist/recipes/protocol.js.map +7 -0
  448. package/dist/recipes/slot-schemas.d.ts +128 -0
  449. package/dist/recipes/slot-schemas.js +24 -0
  450. package/dist/recipes/slot-schemas.js.map +7 -0
  451. package/dist/recipes/types.d.ts +55 -0
  452. package/dist/recipes/types.js +1 -0
  453. package/dist/recipes/types.js.map +7 -0
  454. package/dist/recipes/view-model.d.ts +93 -0
  455. package/dist/recipes/view-model.js +29 -0
  456. package/dist/recipes/view-model.js.map +7 -0
  457. package/dist/registries/index.d.ts +8 -0
  458. package/dist/registries/index.js +0 -0
  459. package/dist/registries/index.js.map +7 -0
  460. package/dist/runtime/create-form-runtime.d.ts +43 -0
  461. package/dist/runtime/create-form-runtime.js +41 -0
  462. package/dist/runtime/create-form-runtime.js.map +7 -0
  463. package/dist/runtime/index.d.ts +3 -0
  464. package/dist/runtime/index.js +44 -0
  465. package/dist/runtime/index.js.map +7 -0
  466. package/dist/runtime/submission-lifecycle.d.ts +65 -0
  467. package/dist/runtime/submission-lifecycle.js +6 -0
  468. package/dist/runtime/submission-lifecycle.js.map +7 -0
  469. package/dist/runtime/types.d.ts +172 -0
  470. package/dist/runtime/types.js +6 -0
  471. package/dist/runtime/types.js.map +7 -0
  472. package/dist/schemas/base-field.d.ts +450 -0
  473. package/dist/schemas/base-field.js +36 -0
  474. package/dist/schemas/base-field.js.map +7 -0
  475. package/dist/schemas/field-config.d.ts +36 -0
  476. package/dist/schemas/field-config.js +1 -0
  477. package/dist/schemas/field-config.js.map +7 -0
  478. package/dist/schemas/form-config-shape.d.ts +763 -0
  479. package/dist/schemas/form-config-shape.js +35 -0
  480. package/dist/schemas/form-config-shape.js.map +7 -0
  481. package/dist/schemas/form-config.d.ts +1288 -0
  482. package/dist/schemas/form-config.js +41 -0
  483. package/dist/schemas/form-config.js.map +7 -0
  484. package/dist/schemas/html-attributes.d.ts +12 -0
  485. package/dist/schemas/html-attributes.js +12 -0
  486. package/dist/schemas/html-attributes.js.map +7 -0
  487. package/dist/schemas/index.d.ts +5 -0
  488. package/dist/schemas/index.js +165 -0
  489. package/dist/schemas/index.js.map +7 -0
  490. package/dist/schemas/validation/async/cache.d.ts +39 -0
  491. package/dist/schemas/validation/async/cache.js +6 -0
  492. package/dist/schemas/validation/async/cache.js.map +7 -0
  493. package/dist/schemas/validation/async/handler.d.ts +21 -0
  494. package/dist/schemas/validation/async/handler.js +11 -0
  495. package/dist/schemas/validation/async/handler.js.map +7 -0
  496. package/dist/schemas/validation/async/index.d.ts +8 -0
  497. package/dist/schemas/validation/async/index.js +14 -0
  498. package/dist/schemas/validation/async/index.js.map +7 -0
  499. package/dist/schemas/validation/defaults.d.ts +6 -0
  500. package/dist/schemas/validation/defaults.js +12 -0
  501. package/dist/schemas/validation/defaults.js.map +7 -0
  502. package/dist/schemas/validation/dependencies.d.ts +52 -0
  503. package/dist/schemas/validation/dependencies.js +17 -0
  504. package/dist/schemas/validation/dependencies.js.map +7 -0
  505. package/dist/schemas/validation/empty.d.ts +1 -0
  506. package/dist/schemas/validation/empty.js +6 -0
  507. package/dist/schemas/validation/empty.js.map +7 -0
  508. package/dist/schemas/validation/errors.d.ts +44 -0
  509. package/dist/schemas/validation/errors.js +12 -0
  510. package/dist/schemas/validation/errors.js.map +7 -0
  511. package/dist/schemas/validation/index.d.ts +9 -0
  512. package/dist/schemas/validation/index.js +130 -0
  513. package/dist/schemas/validation/index.js.map +7 -0
  514. package/dist/schemas/validation/presets.d.ts +66 -0
  515. package/dist/schemas/validation/presets.js +6 -0
  516. package/dist/schemas/validation/presets.js.map +7 -0
  517. package/dist/schemas/validation/relations.d.ts +12 -0
  518. package/dist/schemas/validation/relations.js +8 -0
  519. package/dist/schemas/validation/relations.js.map +7 -0
  520. package/dist/schemas/validation/types.d.ts +817 -0
  521. package/dist/schemas/validation/types.js +64 -0
  522. package/dist/schemas/validation/types.js.map +7 -0
  523. package/dist/schemas/validation/utils.d.ts +76 -0
  524. package/dist/schemas/validation/utils.js +24 -0
  525. package/dist/schemas/validation/utils.js.map +7 -0
  526. package/dist/schemas/validation/validation-registry.d.ts +124 -0
  527. package/dist/schemas/validation/validation-registry.js +27 -0
  528. package/dist/schemas/validation/validation-registry.js.map +7 -0
  529. package/dist/server-errors/from-json-api-errors.d.ts +13 -0
  530. package/dist/server-errors/from-json-api-errors.js +10 -0
  531. package/dist/server-errors/from-json-api-errors.js.map +7 -0
  532. package/dist/server-errors/from-problem-details.d.ts +15 -0
  533. package/dist/server-errors/from-problem-details.js +10 -0
  534. package/dist/server-errors/from-problem-details.js.map +7 -0
  535. package/dist/server-errors/index.d.ts +8 -0
  536. package/dist/server-errors/index.js +17 -0
  537. package/dist/server-errors/index.js.map +7 -0
  538. package/dist/server-errors/shared.d.ts +34 -0
  539. package/dist/server-errors/shared.js +23 -0
  540. package/dist/server-errors/shared.js.map +7 -0
  541. package/dist/state-container/create-form-state-container.d.ts +17 -0
  542. package/dist/state-container/create-form-state-container.js +31 -0
  543. package/dist/state-container/create-form-state-container.js.map +7 -0
  544. package/dist/state-container/dirty.d.ts +11 -0
  545. package/dist/state-container/dirty.js +9 -0
  546. package/dist/state-container/dirty.js.map +7 -0
  547. package/dist/state-container/field-array.d.ts +41 -0
  548. package/dist/state-container/field-array.js +8 -0
  549. package/dist/state-container/field-array.js.map +7 -0
  550. package/dist/state-container/hydration.d.ts +21 -0
  551. package/dist/state-container/hydration.js +11 -0
  552. package/dist/state-container/hydration.js.map +7 -0
  553. package/dist/state-container/index.d.ts +16 -0
  554. package/dist/state-container/index.js +51 -0
  555. package/dist/state-container/index.js.map +7 -0
  556. package/dist/state-container/issue-text.d.ts +11 -0
  557. package/dist/state-container/issue-text.js +6 -0
  558. package/dist/state-container/issue-text.js.map +7 -0
  559. package/dist/state-container/row-ids.d.ts +34 -0
  560. package/dist/state-container/row-ids.js +19 -0
  561. package/dist/state-container/row-ids.js.map +7 -0
  562. package/dist/state-container/selectors.d.ts +33 -0
  563. package/dist/state-container/selectors.js +22 -0
  564. package/dist/state-container/selectors.js.map +7 -0
  565. package/dist/state-container/stale-results.d.ts +28 -0
  566. package/dist/state-container/stale-results.js +9 -0
  567. package/dist/state-container/stale-results.js.map +7 -0
  568. package/dist/state-container/state-tree.d.ts +56 -0
  569. package/dist/state-container/state-tree.js +33 -0
  570. package/dist/state-container/state-tree.js.map +7 -0
  571. package/dist/state-container/submission.d.ts +45 -0
  572. package/dist/state-container/submission.js +26 -0
  573. package/dist/state-container/submission.js.map +7 -0
  574. package/dist/state-container/types.d.ts +404 -0
  575. package/dist/state-container/types.js +6 -0
  576. package/dist/state-container/types.js.map +7 -0
  577. package/dist/state-container/value-tree.d.ts +56 -0
  578. package/dist/state-container/value-tree.js +34 -0
  579. package/dist/state-container/value-tree.js.map +7 -0
  580. package/dist/testing/form-state-container-conformance.d.ts +51 -0
  581. package/dist/testing/form-state-container-conformance.js +43 -0
  582. package/dist/testing/form-state-container-conformance.js.map +7 -0
  583. package/dist/testing/index.d.ts +7 -0
  584. package/dist/testing/index.js +35 -0
  585. package/dist/testing/index.js.map +7 -0
  586. package/dist/types/actions.d.ts +75 -0
  587. package/dist/types/actions.js +1 -0
  588. package/dist/types/actions.js.map +7 -0
  589. package/dist/types/categories.d.ts +21 -0
  590. package/dist/types/categories.js +8 -0
  591. package/dist/types/categories.js.map +7 -0
  592. package/dist/types/define-element.d.ts +73 -0
  593. package/dist/types/define-element.js +8 -0
  594. package/dist/types/define-element.js.map +7 -0
  595. package/dist/types/index.d.ts +10 -0
  596. package/dist/types/index.js +17 -0
  597. package/dist/types/index.js.map +7 -0
  598. package/dist/types/metadata.d.ts +14 -0
  599. package/dist/types/metadata.js +1 -0
  600. package/dist/types/metadata.js.map +7 -0
  601. package/dist/types/registration.d.ts +142 -0
  602. package/dist/types/registration.js +1 -0
  603. package/dist/types/registration.js.map +7 -0
  604. package/package.json +119 -3
  605. package/skill/SKILL.md +79 -0
  606. package/skill/reference/forms-actions.md +51 -0
  607. package/skill/reference/forms-submission.md +44 -0
  608. package/skill/reference/forms-validation.md +91 -0
  609. package/skill/reference/forms.md +179 -0
@@ -0,0 +1,159 @@
1
+ import type { AppearanceInput, GridLayoutConfig } from '@schema-engine/layout';
2
+ import type { ActionConfigBase } from '@schema-engine/actions';
3
+ import type { StepConstraint } from '../schemas/base-field';
4
+ import type { ActionArguments } from '../types/registration';
5
+ /**
6
+ * Discriminated union of `{ $type }` plus the registered config for each key.
7
+ * An empty map yields `never`, so unregistered slots cannot be authored.
8
+ */
9
+ export type DiscriminatedConfigs<TMap extends Record<string, unknown>> = string extends keyof TMap ? never : [keyof TMap] extends [never] ? never : {
10
+ [K in keyof TMap]: {
11
+ readonly $type: K;
12
+ } & TMap[K];
13
+ }[keyof TMap];
14
+ /**
15
+ * Rejects `view` keys, and keys inside each slot, that the selected recipe does not declare.
16
+ *
17
+ * @remarks
18
+ * `defineForm` infers its config through a generic constraint, which skips excess property
19
+ * checks. This maps undeclared keys to `never` so a misspelled or undeclared slot, or an
20
+ * unknown key inside a slot, is a type error. Exactness stops at the slot's own keys: objects
21
+ * nested deeper inside a slot config are not checked.
22
+ */
23
+ export type ExactViewConfig<TView, TRecipes extends Record<string, unknown>, TAppearance extends Record<string, string> = Record<string, string>> = TView extends {
24
+ readonly $type: infer K;
25
+ } ? ExactSlots<TView, Extract<DiscriminatedConfigs<TRecipes>, {
26
+ readonly $type: K;
27
+ }>, TAppearance> : TView;
28
+ type ExactSlots<TView, TDeclared, TAppearance extends Record<string, string>> = {
29
+ [P in keyof TView]: P extends keyof TDeclared ? P extends '$type' ? TView[P] : ExactSlot<TView[P], NonNullable<TDeclared[P]>, TAppearance> : never;
30
+ };
31
+ /**
32
+ * An `appearance` pick is held to the engine's axes and values: an undeclared axis or value maps to `never`.
33
+ *
34
+ * @remarks
35
+ * Needed because `defineForm` infers its config through a generic constraint, which allows extra
36
+ * keys: `{ size: 'compact', density: 'high' }` satisfies a weak type with an optional `size`.
37
+ */
38
+ export type ExactAppearance<TPick, TAppearance extends Record<string, string>> = {
39
+ [A in keyof TPick]: A extends keyof TAppearance ? Extract<TPick[A], TAppearance[A]> : never;
40
+ };
41
+ type ExactElementList<TElements, TAppearance extends Record<string, string>> = TElements extends readonly unknown[] ? {
42
+ [I in keyof TElements]: ExactElement<TElements[I], TAppearance>;
43
+ } : TElements;
44
+ type ExactElement<TElement, TAppearance extends Record<string, string>> = TElement extends object ? {
45
+ [K in keyof TElement]: K extends 'appearance' ? ExactAppearance<TElement[K], TAppearance> : K extends 'elements' ? ExactElementList<TElement[K], TAppearance> : TElement[K];
46
+ } : TElement;
47
+ type ExactSteps<TSteps, TAppearance extends Record<string, string>> = TSteps extends readonly unknown[] ? {
48
+ [I in keyof TSteps]: TSteps[I] extends object ? {
49
+ [K in keyof TSteps[I]]: K extends 'appearance' ? ExactAppearance<TSteps[I][K], TAppearance> : K extends 'elements' ? ExactElementList<TSteps[I][K], TAppearance> : TSteps[I][K];
50
+ } : TSteps[I];
51
+ } : TSteps;
52
+ /**
53
+ * Holds the form's, every step's and every element's `appearance` to the engine's axes and values.
54
+ */
55
+ export type ExactFormAppearance<TConfig extends {
56
+ appearance?: unknown;
57
+ steps?: unknown;
58
+ }, TAppearance extends Record<string, string>> = {
59
+ appearance?: ExactAppearance<TConfig['appearance'], TAppearance>;
60
+ steps?: ExactSteps<TConfig['steps'], TAppearance>;
61
+ };
62
+ type ExactSlot<TSlot, TDeclared, TAppearance extends Record<string, string>> = TSlot extends readonly unknown[] | ((...args: never[]) => unknown) ? TSlot : TSlot extends object ? {
63
+ [Q in keyof TSlot]: Q extends 'appearance' ? ExactAppearance<TSlot[Q], TAppearance> : Q extends keyof TDeclared ? ExactSlot<TSlot[Q], NonNullable<TDeclared[Q]>, TAppearance> : never;
64
+ } : TSlot;
65
+ /**
66
+ * An action as an author writes it: the keys the engine owns plus the arguments its registration's schema lists.
67
+ *
68
+ * @remarks An empty map yields `never`, like {@link DiscriminatedConfigs}.
69
+ */
70
+ export type FormAuthoringAction<TActions extends Record<string, unknown>> = string extends keyof TActions ? never : [keyof TActions] extends [never] ? never : {
71
+ [K in keyof TActions & string]: ActionConfigBase<K> & ActionArguments<TActions[K]>;
72
+ }[keyof TActions & string];
73
+ /**
74
+ * Recursively rewrite container `elements` to this engine's authoring union.
75
+ * Nested fieldsets and arrays use the same registrations as top-level fields.
76
+ */
77
+ type WithEngineChildren<TConfig, TElements extends Record<string, unknown>, TAppearance extends Record<string, string>> = TConfig extends {
78
+ elements: unknown[];
79
+ } ? Omit<TConfig, 'elements'> & {
80
+ elements: Array<AuthoringElement<TElements, TAppearance>>;
81
+ } : TConfig extends {
82
+ elements?: unknown[];
83
+ } ? Omit<TConfig, 'elements'> & {
84
+ elements?: Array<AuthoringElement<TElements, TAppearance>>;
85
+ } : TConfig;
86
+ /**
87
+ * Authoring union of an engine's elements. `appearance` is the engine's declared axes and values,
88
+ * narrowed from the schema's open `Record<string, string>`.
89
+ */
90
+ export type AuthoringElement<TElements extends Record<string, unknown>, TAppearance extends Record<string, string> = Record<string, string>> = string extends keyof TElements ? never : [keyof TElements] extends [never] ? never : {
91
+ [K in keyof TElements]: {
92
+ readonly $type: K;
93
+ } & Omit<WithEngineChildren<TElements[K], TElements, TAppearance>, 'appearance'> & {
94
+ appearance?: AppearanceInput<TAppearance>;
95
+ };
96
+ }[keyof TElements];
97
+ export type FormAuthoringStep<TElements extends Record<string, unknown> = Record<never, unknown>, TActions extends Record<string, unknown> = Record<never, unknown>, TAppearance extends Record<string, string> = Record<string, string>> = {
98
+ id: string;
99
+ title: string;
100
+ description?: string;
101
+ icon?: string;
102
+ elements: Array<AuthoringElement<TElements, TAppearance>>;
103
+ /** Show or hide constraints on fields of earlier steps; a step they hide is skipped. */
104
+ constraints?: StepConstraint[];
105
+ className?: string;
106
+ style?: Record<string, string | number>;
107
+ appearance?: AppearanceInput<TAppearance>;
108
+ /** Actions dispatched after the form's actions on every trigger while this step is current. */
109
+ actions?: Array<FormAuthoringAction<TActions> | FormAuthoringAction<TActions>[]>;
110
+ };
111
+ /**
112
+ * Typed form authoring input for an engine's registered elements, recipes, and actions.
113
+ * Pass this to {@link FormEngine.defineForm}. External JSON uses {@link FormEngine.validateForm}.
114
+ * Both return a frozen `NormalizedFormConfig`, not this authoring shape.
115
+ *
116
+ * Nested container `elements` are typed from the same engine registrations as
117
+ * top-level fields.
118
+ */
119
+ export interface FormAuthoringInput<TElements extends Record<string, unknown> = Record<never, unknown>, TRecipes extends Record<string, unknown> = Record<never, unknown>, TActions extends Record<string, unknown> = Record<never, unknown>, TAppearance extends Record<string, string> = Record<string, string>> {
120
+ id: string;
121
+ title?: string;
122
+ description?: string;
123
+ steps: Array<FormAuthoringStep<TElements, TActions, TAppearance>>;
124
+ view?: DiscriminatedConfigs<TRecipes>;
125
+ grid?: GridLayoutConfig;
126
+ /**
127
+ * When a field validates before a check of it has failed: on `change`, on `blur`, on both (`all`), on the
128
+ * first `blur` and every change after it (`onTouched`) or only on an explicit check.
129
+ *
130
+ * @remarks Normalization fills it with `'onSubmit'` when unset, so a normalized form always has it and both renderers agree.
131
+ */
132
+ validationMode?: 'onSubmit' | 'onChange' | 'onBlur' | 'onTouched' | 'all';
133
+ /**
134
+ * When a field validates again once an explicit check of it has run, whether that check passed or failed.
135
+ *
136
+ * @remarks Normalization fills it with `'onChange'` when unset.
137
+ */
138
+ reValidateMode?: 'onSubmit' | 'onChange' | 'onBlur';
139
+ /**
140
+ * How freely the stepper moves forward: `'linear'` reaches only visited steps and validates the steps on the way,
141
+ * `'free'` reaches any active step without validating.
142
+ *
143
+ * @remarks Normalization fills it with `'linear'` when unset. Back is always allowed and `next()` validates in both.
144
+ */
145
+ navigation?: 'linear' | 'free';
146
+ /**
147
+ * Serializable data that always travels with a submission, such as ids or context.
148
+ *
149
+ * @remarks
150
+ * Merged into `submission.values`. It is never rendered, never a value of the form and never validated, and a
151
+ * key cannot name a field of the form or be a reserved segment: the config is rejected when it does.
152
+ */
153
+ payload?: Record<string, unknown>;
154
+ className?: string;
155
+ style?: Record<string, string | number>;
156
+ appearance?: AppearanceInput<TAppearance>;
157
+ actions?: Array<FormAuthoringAction<TActions> | FormAuthoringAction<TActions>[]>;
158
+ }
159
+ export {};
@@ -0,0 +1 @@
1
+ import "../chunk-D6ZHV6AT.js";
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,158 @@
1
+ import type { FormValues } from '../runtime/types.js';
2
+ import type { ValueEntry } from './types.utils';
3
+ /**
4
+ * The values a form submits, read from its literal config and the engine's value entries.
5
+ *
6
+ * @remarks
7
+ * The static twin of `FormEngine.submissionSchema`: it follows the same rules, so what the runtime accepts is what
8
+ * the type says. Dotted names nest, a named container is an object of its children, a container of kind `array`
9
+ * is a list of rows, a one-child row is the child's value, and the config's `payload` keys are added.
10
+ *
11
+ * A key is required only when its field has a `required` rule and neither it, a container around it nor its step has
12
+ * `constraints` or `disabled`: any of those can leave it out. A field with the rule and a constraint is an
13
+ * optional key of its declared type; a field without the rule is an optional key that may also hold its empty
14
+ * value (`''` or `null`), which a submission keeps. An element whose `$type` has no entry, a static one, adds nothing.
15
+ *
16
+ * It falls back to {@link FormValues} when the config is not a literal: an element whose `$type` or `name` is
17
+ * the wide `string`, as a config built at runtime has. Widening there would claim a shape nothing checks.
18
+ */
19
+ export type ValuesOf<TConfig, TEntries extends Record<string, unknown>> = string extends keyof TEntries ? FormValues : TConfig extends {
20
+ readonly steps: infer TSteps extends readonly unknown[];
21
+ } ? IsLiteral<TSteps> extends true ? Simplify<MergeAll<StepValues<TSteps[number], TEntries>> & (TConfig extends {
22
+ readonly payload: infer TPayload extends object;
23
+ } ? Readonly<TPayload> : unknown)> : FormValues : FormValues;
24
+ type Simplify<T> = {
25
+ [K in keyof T]: T[K];
26
+ };
27
+ /**
28
+ * What an element that holds no value adds: nothing, which an intersection keeps as it is.
29
+ *
30
+ * @remarks
31
+ * An object type with no keys, written as a mapped type over `never` so it reads as intent. `unknown` would also
32
+ * be the identity of an intersection, but `Simplify` of it is not the empty object the callers expect.
33
+ */
34
+ type Empty = {
35
+ readonly [K in never]: never;
36
+ };
37
+ /** The intersection of the members of a union. An empty union is `unknown`, the identity of an intersection. */
38
+ type MergeAll<U> = (U extends unknown ? (value: U) => void : never) extends (value: infer I) => void ? I : unknown;
39
+ type Mode = 'required' | 'present' | 'optional';
40
+ /** `{ [name]: V }` with the key required, optional but present as `V`, or optional and possibly empty. */
41
+ type Field<TName extends string, V, M extends Mode> = M extends 'required' ? {
42
+ readonly [K in TName]: V;
43
+ } : M extends 'present' ? {
44
+ readonly [K in TName]?: V;
45
+ } : {
46
+ readonly [K in TName]?: V | '' | null;
47
+ };
48
+ /** A field under a dotted name nests: `address.street` is `{ address: { street } }`, required when the field is. */
49
+ type Nest<TName extends string, V, M extends Mode> = TName extends `${infer Head}.${infer Tail}` ? M extends 'required' ? {
50
+ readonly [K in Head]: Simplify<Nest<Tail, V, M>>;
51
+ } : {
52
+ readonly [K in Head]?: Simplify<Nest<Tail, V, M>>;
53
+ } : Field<TName, V, M>;
54
+ type IsLiteral<TSteps extends readonly unknown[]> = [NonLiteralStep<TSteps[number]>] extends [never] ? true : false;
55
+ type NonLiteralStep<S> = S extends {
56
+ readonly elements: infer C extends readonly unknown[];
57
+ } ? NonLiteralElement<C[number]> : S;
58
+ type NonLiteralElement<E> = E extends {
59
+ readonly $type: infer T;
60
+ } ? string extends T ? E : E extends {
61
+ readonly name: infer N;
62
+ } ? string extends N ? E : ChildrenNonLiteral<E> : ChildrenNonLiteral<E> : E;
63
+ type ChildrenNonLiteral<E> = E extends {
64
+ readonly elements: infer C extends readonly unknown[];
65
+ } ? NonLiteralElement<C[number]> : never;
66
+ /**
67
+ * Whether a config can leave its key out: it is `disabled` (a wide `boolean` can be), or has `constraints` (a wide list can).
68
+ *
69
+ * @remarks The one test for an element and for a step, which has `constraints` and no `disabled`.
70
+ */
71
+ type IsConditional<E> = E extends {
72
+ readonly disabled: infer D;
73
+ } ? [D] extends [false] ? HasConstraints<E> : true : HasConstraints<E>;
74
+ type HasConstraints<E> = E extends {
75
+ readonly constraints: infer C extends readonly unknown[];
76
+ } ? C extends readonly [] ? false : true : false;
77
+ type IsRequiredRule<E> = E extends {
78
+ readonly rules: infer R extends readonly unknown[];
79
+ } ? R[number] extends infer Rule ? Rule extends {
80
+ readonly $type: infer T;
81
+ } ? 'required' extends T ? string extends T ? never : true : never : never : never : never;
82
+ /** The mode of an element's own key, from its rule and whether it or anything around it is conditional. */
83
+ type ModeOf<E, TConditional extends boolean> = [IsRequiredRule<E>] extends [never] ? 'optional' : TConditional extends true ? 'present' : 'required';
84
+ type StepValues<S, TEntries extends Record<string, unknown>> = S extends {
85
+ readonly elements: infer C extends readonly unknown[];
86
+ } ? ElementsValues<C[number], TEntries, IsConditional<S>> : never;
87
+ /** The contribution of each element of a union, a union of the objects they add. */
88
+ type ElementsValues<E, TEntries extends Record<string, unknown>, TConditional extends boolean> = E extends unknown ? Contribution<E, TEntries, TConditional> : never;
89
+ type Contribution<E, TEntries extends Record<string, unknown>, TAbove extends boolean> = E extends {
90
+ readonly $type: infer T extends string;
91
+ readonly name: infer N extends string;
92
+ } ? T extends keyof TEntries ? TEntries[T] extends infer Entry extends ValueEntry ? Entry extends {
93
+ readonly container: infer K;
94
+ } ? ContainerContribution<E, N, K, TEntries, TAbove extends true ? true : IsConditional<E>> : Entry extends {
95
+ readonly value: infer V;
96
+ } ? Nest<N, V, ModeOf<E, TAbove extends true ? true : IsConditional<E>>> : Empty : Empty : Empty : Empty;
97
+ type ChildrenOf<E> = E extends {
98
+ readonly elements: infer C extends readonly unknown[];
99
+ } ? C : readonly [];
100
+ /** The object a container's children make, with its keys as the children's own modes say. */
101
+ type ChildrenObject<E, TEntries extends Record<string, unknown>, TConditional extends boolean> = Simplify<MergeAll<ElementsValues<ChildrenOf<E>[number], TEntries, TConditional>>>;
102
+ type ContainerContribution<E, N extends string, K, TEntries extends Record<string, unknown>, TConditional extends boolean> = K extends 'array' ? Nest<N, ArrayRows<E, TEntries, TConditional>, ContainerMode<E, TConditional, false>> : Nest<N, ChildrenObject<E, TEntries, TConditional>, ContainerMode<E, TConditional, HasRequiredKey<ChildrenObject<E, TEntries, TConditional>>>>;
103
+ /** A container is a required key when its own rule requires it or a key inside it is required. */
104
+ type ContainerMode<E, TConditional extends boolean, TInside extends boolean> = ModeOf<E, TConditional> extends 'required' ? 'required' : TInside extends true ? 'required' : 'present';
105
+ type HasRequiredKey<T> = {} extends T ? false : true;
106
+ /**
107
+ * A one-child array has scalar rows, unless its `initialValues` or the child's default is a record, or the child is a
108
+ * container that is not an array (a group or a fieldset), which makes each row an object of the array's children.
109
+ *
110
+ * @remarks The static twin of `usesScalarArrayItem`, which decides the same from the config.
111
+ */
112
+ type ArrayRows<E, TEntries extends Record<string, unknown>, TConditional extends boolean> = ChildrenOf<E> extends readonly [infer Only] ? E extends {
113
+ readonly initialValues: object;
114
+ } ? Array<ChildrenObject<E, TEntries, TConditional>> : Only extends {
115
+ readonly defaultValue: object;
116
+ } ? Array<ChildrenObject<E, TEntries, TConditional>> : IsObjectContainer<Only, TEntries> extends true ? Array<ChildrenObject<E, TEntries, TConditional>> : Array<RowValue<Only, TEntries, TConditional>> : Array<ChildrenObject<E, TEntries, TConditional>>;
117
+ /** Whether an element holds children that make an object: a container that is not an array and is not empty. */
118
+ type IsObjectContainer<E, TEntries extends Record<string, unknown>> = E extends {
119
+ readonly $type: infer T extends string;
120
+ } ? T extends keyof TEntries ? TEntries[T] extends {
121
+ readonly container: infer K;
122
+ } ? K extends 'array' ? false : ChildrenOf<E> extends readonly [] ? false : true : false : false : false;
123
+ /** The value of a scalar row: its child's own value, as a field or as a container. */
124
+ type RowValue<E, TEntries extends Record<string, unknown>, TConditional extends boolean> = E extends {
125
+ readonly $type: infer T extends string;
126
+ } ? T extends keyof TEntries ? TEntries[T] extends infer Entry extends ValueEntry ? Entry extends {
127
+ readonly container: infer K;
128
+ } ? K extends 'array' ? ArrayRows<E, TEntries, TConditional> : ChildrenObject<E, TEntries, TConditional> : Entry extends {
129
+ readonly value: infer V;
130
+ } ? ModeOf<E, TConditional> extends 'optional' ? V | '' | null : V : never : never : never : never;
131
+ type DefaultOf<T> = T extends readonly (infer Row)[] ? Array<DefaultRow<Row>> : T extends Blob ? T | null : T extends object ? {
132
+ [K in keyof T]?: DefaultOf<Exclude<T[K], undefined>>;
133
+ } : T | '' | null | undefined;
134
+ /**
135
+ * A row of a list default, which is as the values type has it.
136
+ *
137
+ * @remarks
138
+ * A row is not a field of its own, so it gains no empty value here: an optional scalar row already has it in the values
139
+ * type (`ValuesOf`), and the rows of an array-valued leaf, such as a checkbox group, have none, because its declared
140
+ * schema rejects them. A record row is partial, as a default may give some of its keys.
141
+ */
142
+ type DefaultRow<T> = T extends readonly (infer Row)[] ? Array<DefaultRow<Row>> : T extends Blob ? T : T extends object ? {
143
+ [K in keyof T]?: DefaultOf<Exclude<T[K], undefined>>;
144
+ } : T;
145
+ /**
146
+ * What a form may start from: its values with every key optional at every depth, and an empty value in place of any leaf.
147
+ *
148
+ * @remarks
149
+ * A default is a start, not a submission: a field may be left out, empty or only partly given (one row of a list, one
150
+ * key of an object). Only a leaf has an empty value (`''` or `null`, where its own type allows it): the empty value of a
151
+ * list or a group is its empty list or object. A form whose values type is {@link FormValues} takes any record, as
152
+ * `defaultValues` did.
153
+ * Whether a value is the one its field declares is checked when the runtime is created.
154
+ */
155
+ export type DefaultValuesOf<TValues> = {
156
+ [K in keyof TValues]?: DefaultOf<Exclude<TValues[K], undefined>>;
157
+ };
158
+ export {};
File without changes
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Builder module - form authoring types and internal registration utilities.
3
+ */
4
+ export * from './form-authoring';
5
+ export * from './types.utils';
@@ -0,0 +1,2 @@
1
+ import "../chunk-D6ZHV6AT.js";
2
+ import "../chunk-YIFUBPJ3.js";
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,137 @@
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import type { ValidationRegistrationConstraint } from '../schemas/validation/types.js';
3
+ import type { AppearanceAxisList, SlotAppearanceAxes } from '@schema-engine/layout';
4
+ import type { ContainerKind } from '../types/registration.js';
5
+ /** Coerce inferred registration maps into the engine generic constraint. */
6
+ export type AsRegistrationMap<T> = T extends Record<string, unknown> ? T : Record<never, never>;
7
+ /**
8
+ * Config input type from a registration schema, without `$type`.
9
+ *
10
+ * Form authors supply this shape: defaults stay optional, transforms apply
11
+ * at `defineForm` / `validateForm` time.
12
+ */
13
+ export type ExtractSchemaType<TSchema> = TSchema extends StandardSchemaV1 ? Omit<StandardSchemaV1.InferInput<TSchema>, '$type'> : Record<string, unknown>;
14
+ /**
15
+ * Config output type from a registration schema.
16
+ * Components receive this shape after defaults and transforms.
17
+ */
18
+ export type ExtractSchemaOutput<TSchema> = TSchema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<TSchema> : unknown;
19
+ /**
20
+ * Extract type identifier from a registration object.
21
+ */
22
+ export type ExtractTypeId<T> = T extends {
23
+ $type: infer K;
24
+ } ? K : never;
25
+ /**
26
+ * What a registration contributes to a map of the engine: its config as authors write it (`input`), its parsed
27
+ * config (`output`), or what its control writes (`value`).
28
+ */
29
+ export type RegistrationMapMode = 'input' | 'output' | 'value';
30
+ /**
31
+ * What a registration says about the value of the elements it types, for the values type of a form.
32
+ *
33
+ * @remarks
34
+ * An input that holds its own value is `{ value }`, the output type of its declared schema. A container (it declares a
35
+ * `containerKind`) is `{ container }`, which tells whether its children make an object or a list of rows. A static
36
+ * element has neither, so it is no key of the map and contributes no value.
37
+ */
38
+ export type ValueEntry = {
39
+ readonly value: unknown;
40
+ readonly container?: undefined;
41
+ } | {
42
+ readonly container: ContainerKind;
43
+ readonly value?: undefined;
44
+ };
45
+ type ValueEntryOf<R> = 'value' extends keyof R ? [NonNullable<R[keyof R & 'containerKind']>] extends [never] ? NonNullable<R[keyof R & 'value']> extends (config: never) => infer V ? [V] extends [never] ? {
46
+ readonly container: 'object';
47
+ } : [V] extends [StandardSchemaV1] ? {
48
+ readonly value: StandardSchemaV1.InferOutput<V>;
49
+ } : never : never : {
50
+ readonly container: NonNullable<R[keyof R & 'containerKind']>;
51
+ } : never;
52
+ type ConfigMapFromRegistration<R, TMode extends RegistrationMapMode = 'input'> = R extends {
53
+ $type: infer K extends string;
54
+ schema: infer S;
55
+ } ? TMode extends 'value' ? [ValueEntryOf<R>] extends [never] ? Record<never, never> : Record<K, ValueEntryOf<R>> : S extends StandardSchemaV1 ? Record<K, TMode extends 'output' ? Omit<StandardSchemaV1.InferOutput<S>, '$type'> : ExtractSchemaType<S>> : Record<never, never> : Record<never, never>;
56
+ /**
57
+ * Merge open arrays of registrations. Duplicate `$type` keys become a union of
58
+ * configs because TypeScript cannot see registration order. Runtime is last-wins;
59
+ * pass a tuple or an inline array for last-wins typing.
60
+ */
61
+ type UnionMergeMaps<U> = {
62
+ [K in U extends unknown ? keyof U : never]: U extends Record<K, infer V> ? V : never;
63
+ };
64
+ export type MergeRegistrationMaps<T extends readonly unknown[], TMode extends RegistrationMapMode = 'input'> = [
65
+ T[number]
66
+ ] extends [never] ? Record<never, never> : UnionMergeMaps<ConfigMapFromRegistration<T[number], TMode>>;
67
+ /** Later keys in `Override` replace matching keys in `Base`. Empty override maps preserve `Base`. */
68
+ export type LastWinsMerge<Base extends Record<string, unknown>, Override extends Record<string, unknown>> = [
69
+ keyof Override
70
+ ] extends [never] ? Base : Omit<Base, keyof Override> & Override;
71
+ type IsFixedLengthTuple<T extends readonly unknown[]> = number extends T['length'] ? false : true;
72
+ type FoldRegistrationMapsLastWins<T extends readonly unknown[], TMode extends RegistrationMapMode = 'input'> = T extends readonly [infer Head, ...infer Tail extends readonly unknown[]] ? LastWinsMerge<ConfigMapFromRegistration<Head, TMode>, FoldRegistrationMapsLastWins<Tail, TMode>> : Record<never, never>;
73
+ /**
74
+ * Duplicate `$type` contract:
75
+ * - Runtime always last-wins.
76
+ * - Tuple / inline arrays: last-wins in the type.
77
+ * - Open arrays (`T[]`): union of configs for the same `$type`.
78
+ */
79
+ export type MergeRegistrationMapsLastWins<T extends readonly unknown[], TMode extends RegistrationMapMode = 'input'> = [
80
+ T[number]
81
+ ] extends [never] ? Record<never, never> : IsFixedLengthTuple<T> extends true ? FoldRegistrationMapsLastWins<T, TMode> : MergeRegistrationMaps<T, TMode>;
82
+ /** Engine element/recipe map for a registration list (see {@link MergeRegistrationMapsLastWins}). */
83
+ export type MergedRegistrationMap<T extends readonly unknown[]> = AsRegistrationMap<MergeRegistrationMapsLastWins<T>>;
84
+ /** Action registrations use the same last-wins merge as elements and recipes. */
85
+ export type MergedActionRegistrationMap<T extends readonly unknown[]> = MergedRegistrationMap<T>;
86
+ /** Structural Standard Schema check used to reject `{}` and primitives at the factory. */
87
+ export type StandardSchemaConstraint = {
88
+ readonly '~standard': {
89
+ readonly validate: (value: unknown) => unknown;
90
+ };
91
+ };
92
+ export type ElementRegistrationConstraint = {
93
+ readonly $type: string;
94
+ /** Set by `defineInput` or `defineStatic`; a registration written by hand states it. */
95
+ readonly kind: 'input' | 'static';
96
+ readonly schema: StandardSchemaConstraint;
97
+ readonly metadata: {
98
+ readonly name: string;
99
+ readonly category?: string;
100
+ };
101
+ readonly render: (props: never) => unknown;
102
+ readonly validations?: readonly ValidationRegistrationConstraint[];
103
+ readonly containerKind?: ContainerKind;
104
+ readonly appearanceAxes?: AppearanceAxisList;
105
+ readonly value?: (config: never) => StandardSchemaConstraint;
106
+ };
107
+ export type RecipeRegistrationConstraint = {
108
+ readonly $type: string;
109
+ readonly schema: StandardSchemaConstraint;
110
+ readonly kind: 'single-step' | 'wizard';
111
+ readonly slots: readonly string[];
112
+ readonly appearanceAxes?: SlotAppearanceAxes;
113
+ readonly metadata: {
114
+ readonly name: string;
115
+ };
116
+ readonly render: unknown;
117
+ };
118
+ export type ActionRegistrationConstraint = {
119
+ readonly $type: string;
120
+ readonly schema: StandardSchemaConstraint;
121
+ readonly metadata: {
122
+ readonly name: string;
123
+ };
124
+ readonly execute: (...args: never[]) => unknown;
125
+ };
126
+ export type { ValidationRegistrationConstraint };
127
+ /** Parsed config maps retain defaults and transforms independently of authoring input. */
128
+ export interface EngineOutputMaps {
129
+ elements: Record<string, unknown>;
130
+ recipes: Record<string, unknown>;
131
+ actions: Record<string, unknown>;
132
+ /** What each element `$type` says about its value, a {@link ValueEntry}; read to type the values of a form. */
133
+ values: Record<string, unknown>;
134
+ }
135
+ export type MergedOutputMap<T extends readonly unknown[]> = AsRegistrationMap<MergeRegistrationMapsLastWins<T, 'output'>>;
136
+ /** The value entry of each element `$type` of a registration list, last registration winning. */
137
+ export type MergedValueMap<T extends readonly unknown[]> = AsRegistrationMap<MergeRegistrationMapsLastWins<T, 'value'>>;
@@ -0,0 +1 @@
1
+ import "../chunk-YIFUBPJ3.js";
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,88 @@
1
+ import {
2
+ HtmlAttributesSchema
3
+ } from "./chunk-4CUGHU36.js";
4
+ import {
5
+ BaseValidationRuleSchema
6
+ } from "./chunk-KE53GN4Q.js";
7
+
8
+ // src/schemas/base-field.ts
9
+ import * as z from "zod/mini";
10
+ import { AppearanceConfigSchema, ElementGridConfigSchema } from "@schema-engine/layout";
11
+ var RendererStyleSchema = z.record(z.string(), z.union([z.string(), z.number()])).check(
12
+ z.superRefine((style, ctx) => {
13
+ for (const [key, value] of Object.entries(style)) {
14
+ if (!key.startsWith("--")) {
15
+ ctx.addIssue({
16
+ code: "custom",
17
+ input: style,
18
+ path: [key],
19
+ message: `style accepts CSS custom properties only: '${key}' must start with '--'.`
20
+ });
21
+ } else if (key.length === 2) {
22
+ ctx.addIssue({
23
+ code: "custom",
24
+ input: style,
25
+ path: [key],
26
+ message: `style accepts CSS custom properties only: the name after '--' must not be empty.`
27
+ });
28
+ }
29
+ if (typeof value === "string" && /[;{}]/.test(value)) {
30
+ ctx.addIssue({
31
+ code: "custom",
32
+ input: style,
33
+ path: [key],
34
+ message: `style '${key}' must be a single value: it cannot contain ';', '{' or '}', which would start another declaration.`
35
+ });
36
+ }
37
+ }
38
+ })
39
+ );
40
+ var ConstraintValueSchema = z.any();
41
+ var ConstraintLogicSchema = z.object({
42
+ field: z.string(),
43
+ operator: z.enum([
44
+ "equals",
45
+ "not_equals",
46
+ "contains",
47
+ "not_contains",
48
+ "greater_than",
49
+ "less_than",
50
+ "is_empty",
51
+ "is_not_empty"
52
+ ]),
53
+ value: ConstraintValueSchema,
54
+ $type: z.enum(["show", "hide", "enable", "disable", "require"])
55
+ });
56
+ var StepConstraintSchema = z.object({
57
+ ...ConstraintLogicSchema.shape,
58
+ $type: z.enum(["show", "hide"])
59
+ });
60
+ var BaseFieldSchema = z.object({
61
+ name: z.string().check(z.describe("Form field name used for form submission")),
62
+ id: z.optional(z.string()).check(z.describe("HTML element ID")),
63
+ $type: z.string().check(z.describe("Field component identifier")),
64
+ label: z.optional(z.string()).check(z.describe("Display label for the field")),
65
+ description: z.optional(z.string()).check(z.describe("Help text or description")),
66
+ placeholder: z.optional(z.string()).check(z.describe("Placeholder text")),
67
+ disabled: z.optional(z.boolean()).check(z.describe("Whether the field is disabled")),
68
+ readonly: z.optional(z.boolean()).check(z.describe("Whether the field is read-only")),
69
+ /**
70
+ * Field values are element-specific and may be unconstrained in the shared schema.
71
+ * @remarks The registered element schema validates configuration; field-value rules validate submitted values.
72
+ */
73
+ defaultValue: z.optional(z.any()).check(z.describe("Default value for the field")),
74
+ rules: z.optional(z.array(BaseValidationRuleSchema)).check(z.describe("Validation rules")),
75
+ className: z.optional(z.string()).check(z.describe("CSS class name")),
76
+ style: z.optional(RendererStyleSchema).check(z.describe("CSS custom properties")),
77
+ appearance: z.optional(AppearanceConfigSchema).check(z.describe("Named appearance values, one per axis")),
78
+ htmlAttributes: z.optional(HtmlAttributesSchema),
79
+ grid: z.optional(ElementGridConfigSchema).check(z.describe("Grid positioning configuration")),
80
+ constraints: z.optional(z.array(z.lazy(() => ConstraintLogicSchema))).check(z.describe("Conditional logic rules"))
81
+ });
82
+
83
+ export {
84
+ RendererStyleSchema,
85
+ ConstraintLogicSchema,
86
+ StepConstraintSchema,
87
+ BaseFieldSchema
88
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/schemas/base-field.ts"],
4
+ "sourcesContent": ["import * as z from 'zod/mini';\nimport { HtmlAttributesSchema } from './html-attributes';\nimport { AppearanceConfigSchema, ElementGridConfigSchema } from '@schema-engine/layout';\nimport { BaseValidationRuleSchema } from './validation/';\n\n/**\n * Inline style: CSS custom properties only, keyed `--name`, with string or number values.\n *\n * @remarks\n * Custom properties are the one style shape that means the same in every renderer: React reads\n * `style` as camelCase `CSSProperties` and Radiant as a plain record, so a named CSS property such as\n * `maxWidth` would render differently, and it could not be written portably in JSON or YAML.\n * Styling beyond custom properties goes through `className` or the form's `appearance`.\n *\n * A string value may not contain `;`, `{` or `}`: renderers write the value into a declaration, so\n * those characters would let one entry carry further declarations once the markup is server rendered.\n */\nexport const RendererStyleSchema = z.record(z.string(), z.union([z.string(), z.number()])).check(\n\tz.superRefine((style, ctx) => {\n\t\tfor (const [key, value] of Object.entries(style)) {\n\t\t\tif (!key.startsWith('--')) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: 'custom',\n\t\t\t\t\tinput: style,\n\t\t\t\t\tpath: [key],\n\t\t\t\t\tmessage: `style accepts CSS custom properties only: '${key}' must start with '--'.`,\n\t\t\t\t});\n\t\t\t} else if (key.length === 2) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: 'custom',\n\t\t\t\t\tinput: style,\n\t\t\t\t\tpath: [key],\n\t\t\t\t\tmessage: `style accepts CSS custom properties only: the name after '--' must not be empty.`,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (typeof value === 'string' && /[;{}]/.test(value)) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: 'custom',\n\t\t\t\t\tinput: style,\n\t\t\t\t\tpath: [key],\n\t\t\t\t\tmessage: `style '${key}' must be a single value: it cannot contain ';', '{' or '}', which would start another declaration.`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}),\n);\n\nexport type RendererStyle = z.infer<typeof RendererStyleSchema>;\n\n/**\n * Constraint operands can be values from any registered field.\n * @remarks Their concrete types are selected by the form's element registrations.\n */\nconst ConstraintValueSchema = z.any();\n\n/**\n * Constraint logic configuration schema\n */\nexport const ConstraintLogicSchema = z.object({\n\tfield: z.string(),\n\toperator: z.enum([\n\t\t'equals',\n\t\t'not_equals',\n\t\t'contains',\n\t\t'not_contains',\n\t\t'greater_than',\n\t\t'less_than',\n\t\t'is_empty',\n\t\t'is_not_empty',\n\t]),\n\tvalue: ConstraintValueSchema,\n\t$type: z.enum(['show', 'hide', 'enable', 'disable', 'require']),\n});\n\n/**\n * A step's constraint: the field constraint restricted to `show` and `hide`.\n *\n * @remarks\n * A step a constraint hides is skipped. Enabling, disabling and requiring apply to a field, not a step.\n */\nexport const StepConstraintSchema = z.object({\n\t...ConstraintLogicSchema.shape,\n\t$type: z.enum(['show', 'hide']),\n});\n\n/**\n * Base field configuration schema that all field types extend\n * This contains all common properties shared by all form fields\n */\nexport const BaseFieldSchema = z.object({\n\tname: z.string().check(z.describe('Form field name used for form submission')),\n\tid: z.optional(z.string()).check(z.describe('HTML element ID')),\n\t$type: z.string().check(z.describe('Field component identifier')),\n\n\tlabel: z.optional(z.string()).check(z.describe('Display label for the field')),\n\tdescription: z.optional(z.string()).check(z.describe('Help text or description')),\n\tplaceholder: z.optional(z.string()).check(z.describe('Placeholder text')),\n\n\tdisabled: z.optional(z.boolean()).check(z.describe('Whether the field is disabled')),\n\treadonly: z.optional(z.boolean()).check(z.describe('Whether the field is read-only')),\n\t/**\n\t * Field values are element-specific and may be unconstrained in the shared schema.\n\t * @remarks The registered element schema validates configuration; field-value rules validate submitted values.\n\t */\n\tdefaultValue: z.optional(z.any()).check(z.describe('Default value for the field')),\n\n\trules: z.optional(z.array(BaseValidationRuleSchema)).check(z.describe('Validation rules')),\n\n\tclassName: z.optional(z.string()).check(z.describe('CSS class name')),\n\tstyle: z.optional(RendererStyleSchema).check(z.describe('CSS custom properties')),\n\tappearance: z.optional(AppearanceConfigSchema).check(z.describe('Named appearance values, one per axis')),\n\thtmlAttributes: z.optional(HtmlAttributesSchema),\n\n\tgrid: z.optional(ElementGridConfigSchema).check(z.describe('Grid positioning configuration')),\n\n\tconstraints: z.optional(z.array(z.lazy(() => ConstraintLogicSchema))).check(z.describe('Conditional logic rules')),\n});\n\n/**\n * Type definitions\n */\nexport type BaseField = z.infer<typeof BaseFieldSchema>;\nexport type BaseFieldInput = z.input<typeof BaseFieldSchema>;\nexport type ConstraintLogic = z.infer<typeof ConstraintLogicSchema>;\nexport type StepConstraint = z.infer<typeof StepConstraintSchema>;\n"],
5
+ "mappings": ";;;;;;;;AAAA,YAAY,OAAO;AAEnB,SAAS,wBAAwB,+BAA+B;AAezD,IAAM,sBAAwB,SAAS,SAAO,GAAK,QAAM,CAAG,SAAO,GAAK,SAAO,CAAC,CAAC,CAAC,EAAE;AAAA,EACxF,cAAY,CAAC,OAAO,QAAQ;AAC7B,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AACjD,UAAI,CAAC,IAAI,WAAW,IAAI,GAAG;AAC1B,YAAI,SAAS;AAAA,UACZ,MAAM;AAAA,UACN,OAAO;AAAA,UACP,MAAM,CAAC,GAAG;AAAA,UACV,SAAS,8CAA8C,GAAG;AAAA,QAC3D,CAAC;AAAA,MACF,WAAW,IAAI,WAAW,GAAG;AAC5B,YAAI,SAAS;AAAA,UACZ,MAAM;AAAA,UACN,OAAO;AAAA,UACP,MAAM,CAAC,GAAG;AAAA,UACV,SAAS;AAAA,QACV,CAAC;AAAA,MACF;AACA,UAAI,OAAO,UAAU,YAAY,QAAQ,KAAK,KAAK,GAAG;AACrD,YAAI,SAAS;AAAA,UACZ,MAAM;AAAA,UACN,OAAO;AAAA,UACP,MAAM,CAAC,GAAG;AAAA,UACV,SAAS,UAAU,GAAG;AAAA,QACvB,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD,CAAC;AACF;AAQA,IAAM,wBAA0B,MAAI;AAK7B,IAAM,wBAA0B,SAAO;AAAA,EAC7C,OAAS,SAAO;AAAA,EAChB,UAAY,OAAK;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAC;AAAA,EACD,OAAO;AAAA,EACP,OAAS,OAAK,CAAC,QAAQ,QAAQ,UAAU,WAAW,SAAS,CAAC;AAC/D,CAAC;AAQM,IAAM,uBAAyB,SAAO;AAAA,EAC5C,GAAG,sBAAsB;AAAA,EACzB,OAAS,OAAK,CAAC,QAAQ,MAAM,CAAC;AAC/B,CAAC;AAMM,IAAM,kBAAoB,SAAO;AAAA,EACvC,MAAQ,SAAO,EAAE,MAAQ,WAAS,0CAA0C,CAAC;AAAA,EAC7E,IAAM,WAAW,SAAO,CAAC,EAAE,MAAQ,WAAS,iBAAiB,CAAC;AAAA,EAC9D,OAAS,SAAO,EAAE,MAAQ,WAAS,4BAA4B,CAAC;AAAA,EAEhE,OAAS,WAAW,SAAO,CAAC,EAAE,MAAQ,WAAS,6BAA6B,CAAC;AAAA,EAC7E,aAAe,WAAW,SAAO,CAAC,EAAE,MAAQ,WAAS,0BAA0B,CAAC;AAAA,EAChF,aAAe,WAAW,SAAO,CAAC,EAAE,MAAQ,WAAS,kBAAkB,CAAC;AAAA,EAExE,UAAY,WAAW,UAAQ,CAAC,EAAE,MAAQ,WAAS,+BAA+B,CAAC;AAAA,EACnF,UAAY,WAAW,UAAQ,CAAC,EAAE,MAAQ,WAAS,gCAAgC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKpF,cAAgB,WAAW,MAAI,CAAC,EAAE,MAAQ,WAAS,6BAA6B,CAAC;AAAA,EAEjF,OAAS,WAAW,QAAM,wBAAwB,CAAC,EAAE,MAAQ,WAAS,kBAAkB,CAAC;AAAA,EAEzF,WAAa,WAAW,SAAO,CAAC,EAAE,MAAQ,WAAS,gBAAgB,CAAC;AAAA,EACpE,OAAS,WAAS,mBAAmB,EAAE,MAAQ,WAAS,uBAAuB,CAAC;AAAA,EAChF,YAAc,WAAS,sBAAsB,EAAE,MAAQ,WAAS,uCAAuC,CAAC;AAAA,EACxG,gBAAkB,WAAS,oBAAoB;AAAA,EAE/C,MAAQ,WAAS,uBAAuB,EAAE,MAAQ,WAAS,gCAAgC,CAAC;AAAA,EAE5F,aAAe,WAAW,QAAQ,OAAK,MAAM,qBAAqB,CAAC,CAAC,EAAE,MAAQ,WAAS,yBAAyB,CAAC;AAClH,CAAC;",
6
+ "names": []
7
+ }