@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.
- package/LICENSE +21 -0
- package/README.md +69 -2
- package/dist/actions/index.d.ts +3 -0
- package/dist/actions/index.js +50 -0
- package/dist/actions/index.js.map +7 -0
- package/dist/actions/plugins/auto-save.plugin.d.ts +39 -0
- package/dist/actions/plugins/auto-save.plugin.js +10 -0
- package/dist/actions/plugins/auto-save.plugin.js.map +7 -0
- package/dist/actions/plugins/form-reset.plugin.d.ts +23 -0
- package/dist/actions/plugins/form-reset.plugin.js +9 -0
- package/dist/actions/plugins/form-reset.plugin.js.map +7 -0
- package/dist/actions/plugins/form-submit.plugin.d.ts +31 -0
- package/dist/actions/plugins/form-submit.plugin.js +9 -0
- package/dist/actions/plugins/form-submit.plugin.js.map +7 -0
- package/dist/actions/plugins/form-submit.registration.d.ts +22 -0
- package/dist/actions/plugins/form-submit.registration.js +8 -0
- package/dist/actions/plugins/form-submit.registration.js.map +7 -0
- package/dist/actions/plugins/gtm.plugin.d.ts +30 -0
- package/dist/actions/plugins/gtm.plugin.js +8 -0
- package/dist/actions/plugins/gtm.plugin.js.map +7 -0
- package/dist/actions/plugins/index.d.ts +16 -0
- package/dist/actions/plugins/index.js +45 -0
- package/dist/actions/plugins/index.js.map +7 -0
- package/dist/actions/plugins/notification.plugin.d.ts +32 -0
- package/dist/actions/plugins/notification.plugin.js +9 -0
- package/dist/actions/plugins/notification.plugin.js.map +7 -0
- package/dist/actions/plugins/notification.registration.d.ts +22 -0
- package/dist/actions/plugins/notification.registration.js +8 -0
- package/dist/actions/plugins/notification.registration.js.map +7 -0
- package/dist/actions/plugins/registrations.d.ts +17 -0
- package/dist/actions/plugins/registrations.js +14 -0
- package/dist/actions/plugins/registrations.js.map +7 -0
- package/dist/actions/triggers.d.ts +42 -0
- package/dist/actions/triggers.js +6 -0
- package/dist/actions/triggers.js.map +7 -0
- package/dist/actions/types.d.ts +16 -0
- package/dist/actions/types.js +1 -0
- package/dist/actions/types.js.map +7 -0
- package/dist/agent-tool/index.d.ts +54 -0
- package/dist/agent-tool/index.js +128 -0
- package/dist/agent-tool/index.js.map +7 -0
- package/dist/browser/action-registrations.d.ts +46 -0
- package/dist/browser/action-registrations.js +19 -0
- package/dist/browser/action-registrations.js.map +7 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/index.js +36 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/tools/auto-save-storage.d.ts +20 -0
- package/dist/browser/tools/auto-save-storage.js +12 -0
- package/dist/browser/tools/auto-save-storage.js.map +7 -0
- package/dist/browser/tools/gdpr-consent.d.ts +32 -0
- package/dist/browser/tools/gdpr-consent.js +11 -0
- package/dist/browser/tools/gdpr-consent.js.map +7 -0
- package/dist/browser/tools/gtm-tracker.d.ts +7 -0
- package/dist/browser/tools/gtm-tracker.js +7 -0
- package/dist/browser/tools/gtm-tracker.js.map +7 -0
- package/dist/builder/form-authoring.d.ts +159 -0
- package/dist/builder/form-authoring.js +1 -0
- package/dist/builder/form-authoring.js.map +7 -0
- package/dist/builder/form-values.d.ts +158 -0
- package/dist/builder/form-values.js +0 -0
- package/dist/builder/form-values.js.map +7 -0
- package/dist/builder/index.d.ts +5 -0
- package/dist/builder/index.js +2 -0
- package/dist/builder/index.js.map +7 -0
- package/dist/builder/types.utils.d.ts +137 -0
- package/dist/builder/types.utils.js +1 -0
- package/dist/builder/types.utils.js.map +7 -0
- package/dist/chunk-237BHPDH.js +88 -0
- package/dist/chunk-237BHPDH.js.map +7 -0
- package/dist/chunk-25PLQDKN.js +45 -0
- package/dist/chunk-25PLQDKN.js.map +7 -0
- package/dist/chunk-2PTM54FQ.js +51 -0
- package/dist/chunk-2PTM54FQ.js.map +7 -0
- package/dist/chunk-2VKEOE2L.js +907 -0
- package/dist/chunk-2VKEOE2L.js.map +7 -0
- package/dist/chunk-2XWISGGM.js +8 -0
- package/dist/chunk-2XWISGGM.js.map +7 -0
- package/dist/chunk-2YKQAVI2.js +8 -0
- package/dist/chunk-2YKQAVI2.js.map +7 -0
- package/dist/chunk-3B7CJOF6.js +18 -0
- package/dist/chunk-3B7CJOF6.js.map +7 -0
- package/dist/chunk-3YLRJVVN.js +17 -0
- package/dist/chunk-3YLRJVVN.js.map +7 -0
- package/dist/chunk-4CUGHU36.js +58 -0
- package/dist/chunk-4CUGHU36.js.map +7 -0
- package/dist/chunk-4FELFUCD.js +0 -0
- package/dist/chunk-4FELFUCD.js.map +7 -0
- package/dist/chunk-4XPLSYTK.js +82 -0
- package/dist/chunk-4XPLSYTK.js.map +7 -0
- package/dist/chunk-56CJ2UZ7.js +55 -0
- package/dist/chunk-56CJ2UZ7.js.map +7 -0
- package/dist/chunk-5QXT7YAJ.js +87 -0
- package/dist/chunk-5QXT7YAJ.js.map +7 -0
- package/dist/chunk-5Y6U3MR3.js +54 -0
- package/dist/chunk-5Y6U3MR3.js.map +7 -0
- package/dist/chunk-6BAJHAGL.js +29 -0
- package/dist/chunk-6BAJHAGL.js.map +7 -0
- package/dist/chunk-6FUGK5HQ.js +26 -0
- package/dist/chunk-6FUGK5HQ.js.map +7 -0
- package/dist/chunk-6IZYNHZ3.js +118 -0
- package/dist/chunk-6IZYNHZ3.js.map +7 -0
- package/dist/chunk-6NV2JDGI.js +8 -0
- package/dist/chunk-6NV2JDGI.js.map +7 -0
- package/dist/chunk-6R2MBQPL.js +19 -0
- package/dist/chunk-6R2MBQPL.js.map +7 -0
- package/dist/chunk-7EQJUI5N.js +40 -0
- package/dist/chunk-7EQJUI5N.js.map +7 -0
- package/dist/chunk-AUZ45XPE.js +27 -0
- package/dist/chunk-AUZ45XPE.js.map +7 -0
- package/dist/chunk-BIHEIJG3.js +0 -0
- package/dist/chunk-BIHEIJG3.js.map +7 -0
- package/dist/chunk-BKNWW4PK.js +0 -0
- package/dist/chunk-BKNWW4PK.js.map +7 -0
- package/dist/chunk-BLFLCSG3.js +71 -0
- package/dist/chunk-BLFLCSG3.js.map +7 -0
- package/dist/chunk-BYYGAGNH.js +0 -0
- package/dist/chunk-BYYGAGNH.js.map +7 -0
- package/dist/chunk-CAZPWBQ4.js +18 -0
- package/dist/chunk-CAZPWBQ4.js.map +7 -0
- package/dist/chunk-CMPOBBRV.js +10 -0
- package/dist/chunk-CMPOBBRV.js.map +7 -0
- package/dist/chunk-CRQWKC67.js +118 -0
- package/dist/chunk-CRQWKC67.js.map +7 -0
- package/dist/chunk-CRVXBWSY.js +70 -0
- package/dist/chunk-CRVXBWSY.js.map +7 -0
- package/dist/chunk-D6ZHV6AT.js +0 -0
- package/dist/chunk-D6ZHV6AT.js.map +7 -0
- package/dist/chunk-DVDKPY2A.js +12 -0
- package/dist/chunk-DVDKPY2A.js.map +7 -0
- package/dist/chunk-E4VONSLO.js +15 -0
- package/dist/chunk-E4VONSLO.js.map +7 -0
- package/dist/chunk-EEYGPPLU.js +185 -0
- package/dist/chunk-EEYGPPLU.js.map +7 -0
- package/dist/chunk-EI5TMJDC.js +56 -0
- package/dist/chunk-EI5TMJDC.js.map +7 -0
- package/dist/chunk-EQ5AIF3T.js +117 -0
- package/dist/chunk-EQ5AIF3T.js.map +7 -0
- package/dist/chunk-EZZHO6DQ.js +26 -0
- package/dist/chunk-EZZHO6DQ.js.map +7 -0
- package/dist/chunk-FUHLRG3M.js +130 -0
- package/dist/chunk-FUHLRG3M.js.map +7 -0
- package/dist/chunk-FVOL3ZOJ.js +101 -0
- package/dist/chunk-FVOL3ZOJ.js.map +7 -0
- package/dist/chunk-G33EUV7N.js +288 -0
- package/dist/chunk-G33EUV7N.js.map +7 -0
- package/dist/chunk-GH34XFCC.js +56 -0
- package/dist/chunk-GH34XFCC.js.map +7 -0
- package/dist/chunk-GKWRJ6H4.js +27 -0
- package/dist/chunk-GKWRJ6H4.js.map +7 -0
- package/dist/chunk-GRZU6F7Q.js +80 -0
- package/dist/chunk-GRZU6F7Q.js.map +7 -0
- package/dist/chunk-GT2LARKT.js +107 -0
- package/dist/chunk-GT2LARKT.js.map +7 -0
- package/dist/chunk-GY657L56.js +206 -0
- package/dist/chunk-GY657L56.js.map +7 -0
- package/dist/chunk-H4ABGAAG.js +60 -0
- package/dist/chunk-H4ABGAAG.js.map +7 -0
- package/dist/chunk-H63UHX42.js +93 -0
- package/dist/chunk-H63UHX42.js.map +7 -0
- package/dist/chunk-HEAKWS27.js +2730 -0
- package/dist/chunk-HEAKWS27.js.map +7 -0
- package/dist/chunk-HIS4MGIR.js +8 -0
- package/dist/chunk-HIS4MGIR.js.map +7 -0
- package/dist/chunk-HPPFSWIV.js +213 -0
- package/dist/chunk-HPPFSWIV.js.map +7 -0
- package/dist/chunk-J2FC5K4B.js +87 -0
- package/dist/chunk-J2FC5K4B.js.map +7 -0
- package/dist/chunk-J5BSFDVK.js +123 -0
- package/dist/chunk-J5BSFDVK.js.map +7 -0
- package/dist/chunk-J7GSNWXT.js +151 -0
- package/dist/chunk-J7GSNWXT.js.map +7 -0
- package/dist/chunk-K22S7IZR.js +12 -0
- package/dist/chunk-K22S7IZR.js.map +7 -0
- package/dist/chunk-K5TMXCMY.js +139 -0
- package/dist/chunk-K5TMXCMY.js.map +7 -0
- package/dist/chunk-KE53GN4Q.js +246 -0
- package/dist/chunk-KE53GN4Q.js.map +7 -0
- package/dist/chunk-KFQEDSYI.js +24 -0
- package/dist/chunk-KFQEDSYI.js.map +7 -0
- package/dist/chunk-KLATKWUA.js +116 -0
- package/dist/chunk-KLATKWUA.js.map +7 -0
- package/dist/chunk-KSKWSUOB.js +17 -0
- package/dist/chunk-KSKWSUOB.js.map +7 -0
- package/dist/chunk-LFWEJXWE.js +68 -0
- package/dist/chunk-LFWEJXWE.js.map +7 -0
- package/dist/chunk-LMWJAD3B.js +24 -0
- package/dist/chunk-LMWJAD3B.js.map +7 -0
- package/dist/chunk-MD23VADH.js +92 -0
- package/dist/chunk-MD23VADH.js.map +7 -0
- package/dist/chunk-MKMJT3XR.js +0 -0
- package/dist/chunk-MKMJT3XR.js.map +7 -0
- package/dist/chunk-NJTLBSTR.js +82 -0
- package/dist/chunk-NJTLBSTR.js.map +7 -0
- package/dist/chunk-NJXKMF67.js +182 -0
- package/dist/chunk-NJXKMF67.js.map +7 -0
- package/dist/chunk-OBQBIOGN.js +16 -0
- package/dist/chunk-OBQBIOGN.js.map +7 -0
- package/dist/chunk-OLYHNFKC.js +82 -0
- package/dist/chunk-OLYHNFKC.js.map +7 -0
- package/dist/chunk-OR2L7EKO.js +33 -0
- package/dist/chunk-OR2L7EKO.js.map +7 -0
- package/dist/chunk-OUF57UZ7.js +28 -0
- package/dist/chunk-OUF57UZ7.js.map +7 -0
- package/dist/chunk-PBMM2N77.js +56 -0
- package/dist/chunk-PBMM2N77.js.map +7 -0
- package/dist/chunk-PH3LWLYN.js +49 -0
- package/dist/chunk-PH3LWLYN.js.map +7 -0
- package/dist/chunk-PHNMDWSK.js +9 -0
- package/dist/chunk-PHNMDWSK.js.map +7 -0
- package/dist/chunk-PN5EH6DM.js +36 -0
- package/dist/chunk-PN5EH6DM.js.map +7 -0
- package/dist/chunk-POCAINUE.js +42 -0
- package/dist/chunk-POCAINUE.js.map +7 -0
- package/dist/chunk-PXWVKJGF.js +6 -0
- package/dist/chunk-PXWVKJGF.js.map +7 -0
- package/dist/chunk-Q5LEK7CI.js +64 -0
- package/dist/chunk-Q5LEK7CI.js.map +7 -0
- package/dist/chunk-QH7VW7IY.js +0 -0
- package/dist/chunk-QH7VW7IY.js.map +7 -0
- package/dist/chunk-QLGM2AZW.js +173 -0
- package/dist/chunk-QLGM2AZW.js.map +7 -0
- package/dist/chunk-QT3EYUL5.js +85 -0
- package/dist/chunk-QT3EYUL5.js.map +7 -0
- package/dist/chunk-QYHOFLRX.js +43 -0
- package/dist/chunk-QYHOFLRX.js.map +7 -0
- package/dist/chunk-R3MBVWVI.js +127 -0
- package/dist/chunk-R3MBVWVI.js.map +7 -0
- package/dist/chunk-R6V3LH7F.js +67 -0
- package/dist/chunk-R6V3LH7F.js.map +7 -0
- package/dist/chunk-RB22U6HI.js +64 -0
- package/dist/chunk-RB22U6HI.js.map +7 -0
- package/dist/chunk-RQRQYYTB.js +34 -0
- package/dist/chunk-RQRQYYTB.js.map +7 -0
- package/dist/chunk-S5D2QE4G.js +53 -0
- package/dist/chunk-S5D2QE4G.js.map +7 -0
- package/dist/chunk-S7I76ISM.js +245 -0
- package/dist/chunk-S7I76ISM.js.map +7 -0
- package/dist/chunk-TBDZOQ2C.js +66 -0
- package/dist/chunk-TBDZOQ2C.js.map +7 -0
- package/dist/chunk-U2X3IYSD.js +23 -0
- package/dist/chunk-U2X3IYSD.js.map +7 -0
- package/dist/chunk-UGL3KNOT.js +42 -0
- package/dist/chunk-UGL3KNOT.js.map +7 -0
- package/dist/chunk-UN3DARLG.js +35 -0
- package/dist/chunk-UN3DARLG.js.map +7 -0
- package/dist/chunk-VGGERKV2.js +7 -0
- package/dist/chunk-VGGERKV2.js.map +7 -0
- package/dist/chunk-VVFXYY65.js +0 -0
- package/dist/chunk-VVFXYY65.js.map +7 -0
- package/dist/chunk-WLDCYUN6.js +161 -0
- package/dist/chunk-WLDCYUN6.js.map +7 -0
- package/dist/chunk-WMDTQS36.js +0 -0
- package/dist/chunk-WMDTQS36.js.map +7 -0
- package/dist/chunk-WS7SLVXL.js +550 -0
- package/dist/chunk-WS7SLVXL.js.map +7 -0
- package/dist/chunk-WUTGZYP4.js +290 -0
- package/dist/chunk-WUTGZYP4.js.map +7 -0
- package/dist/chunk-XKN3WWK3.js +0 -0
- package/dist/chunk-XKN3WWK3.js.map +7 -0
- package/dist/chunk-XPQRHO5E.js +587 -0
- package/dist/chunk-XPQRHO5E.js.map +7 -0
- package/dist/chunk-XQ5VJ4QO.js +62 -0
- package/dist/chunk-XQ5VJ4QO.js.map +7 -0
- package/dist/chunk-XQVKX47O.js +174 -0
- package/dist/chunk-XQVKX47O.js.map +7 -0
- package/dist/chunk-Y5CNB57V.js +22 -0
- package/dist/chunk-Y5CNB57V.js.map +7 -0
- package/dist/chunk-YDGH7DTL.js +18 -0
- package/dist/chunk-YDGH7DTL.js.map +7 -0
- package/dist/chunk-YIFUBPJ3.js +0 -0
- package/dist/chunk-YIFUBPJ3.js.map +7 -0
- package/dist/chunk-YUUDXRBW.js +212 -0
- package/dist/chunk-YUUDXRBW.js.map +7 -0
- package/dist/chunk-Z6DQLJS2.js +23 -0
- package/dist/chunk-Z6DQLJS2.js.map +7 -0
- package/dist/chunk-ZDEZ2FOC.js +81 -0
- package/dist/chunk-ZDEZ2FOC.js.map +7 -0
- package/dist/chunk-ZUYSGCEH.js +65 -0
- package/dist/chunk-ZUYSGCEH.js.map +7 -0
- package/dist/chunk-ZYP3MIH3.js +115 -0
- package/dist/chunk-ZYP3MIH3.js.map +7 -0
- package/dist/constraints/constraint-evaluator.d.ts +57 -0
- package/dist/constraints/constraint-evaluator.js +17 -0
- package/dist/constraints/constraint-evaluator.js.map +7 -0
- package/dist/constraints/index.d.ts +1 -0
- package/dist/constraints/index.js +17 -0
- package/dist/constraints/index.js.map +7 -0
- package/dist/csrf/index.d.ts +43 -0
- package/dist/csrf/index.js +43 -0
- package/dist/csrf/index.js.map +7 -0
- package/dist/engine/build-form-engine.d.ts +27 -0
- package/dist/engine/build-form-engine.js +58 -0
- package/dist/engine/build-form-engine.js.map +7 -0
- package/dist/engine/component-type.d.ts +19 -0
- package/dist/engine/component-type.js +6 -0
- package/dist/engine/component-type.js.map +7 -0
- package/dist/engine/create-form-engine.d.ts +100 -0
- package/dist/engine/create-form-engine.js +59 -0
- package/dist/engine/create-form-engine.js.map +7 -0
- package/dist/engine/form-action-context.d.ts +70 -0
- package/dist/engine/form-action-context.js +10 -0
- package/dist/engine/form-action-context.js.map +7 -0
- package/dist/engine/form-engine.d.ts +236 -0
- package/dist/engine/form-engine.js +61 -0
- package/dist/engine/form-engine.js.map +7 -0
- package/dist/engine/index.d.ts +12 -0
- package/dist/engine/index.js +124 -0
- package/dist/engine/index.js.map +7 -0
- package/dist/engine/schema-artifacts.d.ts +87 -0
- package/dist/engine/schema-artifacts.js +14 -0
- package/dist/engine/schema-artifacts.js.map +7 -0
- package/dist/engine/schema-metadata-catalog.d.ts +41 -0
- package/dist/engine/schema-metadata-catalog.js +6 -0
- package/dist/engine/schema-metadata-catalog.js.map +7 -0
- package/dist/engine/step-machine.d.ts +59 -0
- package/dist/engine/step-machine.js +32 -0
- package/dist/engine/step-machine.js.map +7 -0
- package/dist/engine/submission-schema.d.ts +53 -0
- package/dist/engine/submission-schema.js +22 -0
- package/dist/engine/submission-schema.js.map +7 -0
- package/dist/engine/value-validation.d.ts +237 -0
- package/dist/engine/value-validation.js +39 -0
- package/dist/engine/value-validation.js.map +7 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +283 -0
- package/dist/index.js.map +7 -0
- package/dist/lib/authoring-catalog.d.ts +5 -0
- package/dist/lib/authoring-catalog.js +11 -0
- package/dist/lib/authoring-catalog.js.map +7 -0
- package/dist/lib/container-kind-of.d.ts +5 -0
- package/dist/lib/container-kind-of.js +6 -0
- package/dist/lib/container-kind-of.js.map +7 -0
- package/dist/lib/debounce.d.ts +19 -0
- package/dist/lib/debounce.js +6 -0
- package/dist/lib/debounce.js.map +7 -0
- package/dist/lib/deep-readonly.d.ts +12 -0
- package/dist/lib/deep-readonly.js +0 -0
- package/dist/lib/deep-readonly.js.map +7 -0
- package/dist/lib/element-children.d.ts +35 -0
- package/dist/lib/element-children.js +16 -0
- package/dist/lib/element-children.js.map +7 -0
- package/dist/lib/exported-action-envelope.d.ts +11 -0
- package/dist/lib/exported-action-envelope.js +7 -0
- package/dist/lib/exported-action-envelope.js.map +7 -0
- package/dist/lib/exported-rules.d.ts +14 -0
- package/dist/lib/exported-rules.js +6 -0
- package/dist/lib/exported-rules.js.map +7 -0
- package/dist/lib/field-ref.d.ts +13 -0
- package/dist/lib/field-ref.js +6 -0
- package/dist/lib/field-ref.js.map +7 -0
- package/dist/lib/field-scope.d.ts +121 -0
- package/dist/lib/field-scope.js +41 -0
- package/dist/lib/field-scope.js.map +7 -0
- package/dist/lib/form-fetch.d.ts +36 -0
- package/dist/lib/form-fetch.js +10 -0
- package/dist/lib/form-fetch.js.map +7 -0
- package/dist/lib/form-view.d.ts +33 -0
- package/dist/lib/form-view.js +12 -0
- package/dist/lib/form-view.js.map +7 -0
- package/dist/lib/frozen-copy.d.ts +9 -0
- package/dist/lib/frozen-copy.js +7 -0
- package/dist/lib/frozen-copy.js.map +7 -0
- package/dist/lib/is-plain-object.d.ts +2 -0
- package/dist/lib/is-plain-object.js +6 -0
- package/dist/lib/is-plain-object.js.map +7 -0
- package/dist/lib/logger.d.ts +2 -0
- package/dist/lib/logger.js +6 -0
- package/dist/lib/logger.js.map +7 -0
- package/dist/lib/normalized-form-config.d.ts +106 -0
- package/dist/lib/normalized-form-config.js +19 -0
- package/dist/lib/normalized-form-config.js.map +7 -0
- package/dist/lib/omit-paths.d.ts +11 -0
- package/dist/lib/omit-paths.js +7 -0
- package/dist/lib/omit-paths.js.map +7 -0
- package/dist/lib/path-values.d.ts +47 -0
- package/dist/lib/path-values.js +22 -0
- package/dist/lib/path-values.js.map +7 -0
- package/dist/lib/renderer-data-attributes.d.ts +10 -0
- package/dist/lib/renderer-data-attributes.js +6 -0
- package/dist/lib/renderer-data-attributes.js.map +7 -0
- package/dist/lib/reserved-path-keys.d.ts +10 -0
- package/dist/lib/reserved-path-keys.js +10 -0
- package/dist/lib/reserved-path-keys.js.map +7 -0
- package/dist/lib/resolve-appearance.d.ts +48 -0
- package/dist/lib/resolve-appearance.js +10 -0
- package/dist/lib/resolve-appearance.js.map +7 -0
- package/dist/lib/standard-json-schema.d.ts +27 -0
- package/dist/lib/standard-json-schema.js +8 -0
- package/dist/lib/standard-json-schema.js.map +7 -0
- package/dist/lib/standard-schema.d.ts +19 -0
- package/dist/lib/standard-schema.js +8 -0
- package/dist/lib/standard-schema.js.map +7 -0
- package/dist/lib/submission-shape.d.ts +60 -0
- package/dist/lib/submission-shape.js +14 -0
- package/dist/lib/submission-shape.js.map +7 -0
- package/dist/lib/validate-form/grid-checks.d.ts +57 -0
- package/dist/lib/validate-form/grid-checks.js +16 -0
- package/dist/lib/validate-form/grid-checks.js.map +7 -0
- package/dist/lib/validate-form/issues.d.ts +43 -0
- package/dist/lib/validate-form/issues.js +13 -0
- package/dist/lib/validate-form/issues.js.map +7 -0
- package/dist/lib/validate-form/options.d.ts +22 -0
- package/dist/lib/validate-form/options.js +0 -0
- package/dist/lib/validate-form/options.js.map +7 -0
- package/dist/lib/validate-form/parse-elements.d.ts +23 -0
- package/dist/lib/validate-form/parse-elements.js +21 -0
- package/dist/lib/validate-form/parse-elements.js.map +7 -0
- package/dist/lib/validate-form/parse-owner-actions.d.ts +14 -0
- package/dist/lib/validate-form/parse-owner-actions.js +10 -0
- package/dist/lib/validate-form/parse-owner-actions.js.map +7 -0
- package/dist/lib/validate-form/parse-view.d.ts +11 -0
- package/dist/lib/validate-form/parse-view.js +11 -0
- package/dist/lib/validate-form/parse-view.js.map +7 -0
- package/dist/lib/validate-form/schema-issues.d.ts +16 -0
- package/dist/lib/validate-form/schema-issues.js +8 -0
- package/dist/lib/validate-form/schema-issues.js.map +7 -0
- package/dist/lib/validate-form/step-checks.d.ts +18 -0
- package/dist/lib/validate-form/step-checks.js +15 -0
- package/dist/lib/validate-form/step-checks.js.map +7 -0
- package/dist/lib/validate-form/validation-error.d.ts +26 -0
- package/dist/lib/validate-form/validation-error.js +8 -0
- package/dist/lib/validate-form/validation-error.js.map +7 -0
- package/dist/lib/validate-form.d.ts +34 -0
- package/dist/lib/validate-form.js +62 -0
- package/dist/lib/validate-form.js.map +7 -0
- package/dist/lib/zod-json-schema.d.ts +33 -0
- package/dist/lib/zod-json-schema.js +10 -0
- package/dist/lib/zod-json-schema.js.map +7 -0
- package/dist/recipes/built-in-specs.d.ts +1832 -0
- package/dist/recipes/built-in-specs.js +28 -0
- package/dist/recipes/built-in-specs.js.map +7 -0
- package/dist/recipes/built-in.d.ts +2 -0
- package/dist/recipes/built-in.js +49 -0
- package/dist/recipes/built-in.js.map +7 -0
- package/dist/recipes/define-form-recipe.d.ts +10 -0
- package/dist/recipes/define-form-recipe.js +6 -0
- package/dist/recipes/define-form-recipe.js.map +7 -0
- package/dist/recipes/define-recipe-spec.d.ts +13 -0
- package/dist/recipes/define-recipe-spec.js +8 -0
- package/dist/recipes/define-recipe-spec.js.map +7 -0
- package/dist/recipes/index.d.ts +6 -0
- package/dist/recipes/index.js +43 -0
- package/dist/recipes/index.js.map +7 -0
- package/dist/recipes/protocol.d.ts +24 -0
- package/dist/recipes/protocol.js +11 -0
- package/dist/recipes/protocol.js.map +7 -0
- package/dist/recipes/slot-schemas.d.ts +128 -0
- package/dist/recipes/slot-schemas.js +24 -0
- package/dist/recipes/slot-schemas.js.map +7 -0
- package/dist/recipes/types.d.ts +55 -0
- package/dist/recipes/types.js +1 -0
- package/dist/recipes/types.js.map +7 -0
- package/dist/recipes/view-model.d.ts +93 -0
- package/dist/recipes/view-model.js +29 -0
- package/dist/recipes/view-model.js.map +7 -0
- package/dist/registries/index.d.ts +8 -0
- package/dist/registries/index.js +0 -0
- package/dist/registries/index.js.map +7 -0
- package/dist/runtime/create-form-runtime.d.ts +43 -0
- package/dist/runtime/create-form-runtime.js +41 -0
- package/dist/runtime/create-form-runtime.js.map +7 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.js +44 -0
- package/dist/runtime/index.js.map +7 -0
- package/dist/runtime/submission-lifecycle.d.ts +65 -0
- package/dist/runtime/submission-lifecycle.js +6 -0
- package/dist/runtime/submission-lifecycle.js.map +7 -0
- package/dist/runtime/types.d.ts +172 -0
- package/dist/runtime/types.js +6 -0
- package/dist/runtime/types.js.map +7 -0
- package/dist/schemas/base-field.d.ts +450 -0
- package/dist/schemas/base-field.js +36 -0
- package/dist/schemas/base-field.js.map +7 -0
- package/dist/schemas/field-config.d.ts +36 -0
- package/dist/schemas/field-config.js +1 -0
- package/dist/schemas/field-config.js.map +7 -0
- package/dist/schemas/form-config-shape.d.ts +763 -0
- package/dist/schemas/form-config-shape.js +35 -0
- package/dist/schemas/form-config-shape.js.map +7 -0
- package/dist/schemas/form-config.d.ts +1288 -0
- package/dist/schemas/form-config.js +41 -0
- package/dist/schemas/form-config.js.map +7 -0
- package/dist/schemas/html-attributes.d.ts +12 -0
- package/dist/schemas/html-attributes.js +12 -0
- package/dist/schemas/html-attributes.js.map +7 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.js +165 -0
- package/dist/schemas/index.js.map +7 -0
- package/dist/schemas/validation/async/cache.d.ts +39 -0
- package/dist/schemas/validation/async/cache.js +6 -0
- package/dist/schemas/validation/async/cache.js.map +7 -0
- package/dist/schemas/validation/async/handler.d.ts +21 -0
- package/dist/schemas/validation/async/handler.js +11 -0
- package/dist/schemas/validation/async/handler.js.map +7 -0
- package/dist/schemas/validation/async/index.d.ts +8 -0
- package/dist/schemas/validation/async/index.js +14 -0
- package/dist/schemas/validation/async/index.js.map +7 -0
- package/dist/schemas/validation/defaults.d.ts +6 -0
- package/dist/schemas/validation/defaults.js +12 -0
- package/dist/schemas/validation/defaults.js.map +7 -0
- package/dist/schemas/validation/dependencies.d.ts +52 -0
- package/dist/schemas/validation/dependencies.js +17 -0
- package/dist/schemas/validation/dependencies.js.map +7 -0
- package/dist/schemas/validation/empty.d.ts +1 -0
- package/dist/schemas/validation/empty.js +6 -0
- package/dist/schemas/validation/empty.js.map +7 -0
- package/dist/schemas/validation/errors.d.ts +44 -0
- package/dist/schemas/validation/errors.js +12 -0
- package/dist/schemas/validation/errors.js.map +7 -0
- package/dist/schemas/validation/index.d.ts +9 -0
- package/dist/schemas/validation/index.js +130 -0
- package/dist/schemas/validation/index.js.map +7 -0
- package/dist/schemas/validation/presets.d.ts +66 -0
- package/dist/schemas/validation/presets.js +6 -0
- package/dist/schemas/validation/presets.js.map +7 -0
- package/dist/schemas/validation/relations.d.ts +12 -0
- package/dist/schemas/validation/relations.js +8 -0
- package/dist/schemas/validation/relations.js.map +7 -0
- package/dist/schemas/validation/types.d.ts +817 -0
- package/dist/schemas/validation/types.js +64 -0
- package/dist/schemas/validation/types.js.map +7 -0
- package/dist/schemas/validation/utils.d.ts +76 -0
- package/dist/schemas/validation/utils.js +24 -0
- package/dist/schemas/validation/utils.js.map +7 -0
- package/dist/schemas/validation/validation-registry.d.ts +124 -0
- package/dist/schemas/validation/validation-registry.js +27 -0
- package/dist/schemas/validation/validation-registry.js.map +7 -0
- package/dist/server-errors/from-json-api-errors.d.ts +13 -0
- package/dist/server-errors/from-json-api-errors.js +10 -0
- package/dist/server-errors/from-json-api-errors.js.map +7 -0
- package/dist/server-errors/from-problem-details.d.ts +15 -0
- package/dist/server-errors/from-problem-details.js +10 -0
- package/dist/server-errors/from-problem-details.js.map +7 -0
- package/dist/server-errors/index.d.ts +8 -0
- package/dist/server-errors/index.js +17 -0
- package/dist/server-errors/index.js.map +7 -0
- package/dist/server-errors/shared.d.ts +34 -0
- package/dist/server-errors/shared.js +23 -0
- package/dist/server-errors/shared.js.map +7 -0
- package/dist/state-container/create-form-state-container.d.ts +17 -0
- package/dist/state-container/create-form-state-container.js +31 -0
- package/dist/state-container/create-form-state-container.js.map +7 -0
- package/dist/state-container/dirty.d.ts +11 -0
- package/dist/state-container/dirty.js +9 -0
- package/dist/state-container/dirty.js.map +7 -0
- package/dist/state-container/field-array.d.ts +41 -0
- package/dist/state-container/field-array.js +8 -0
- package/dist/state-container/field-array.js.map +7 -0
- package/dist/state-container/hydration.d.ts +21 -0
- package/dist/state-container/hydration.js +11 -0
- package/dist/state-container/hydration.js.map +7 -0
- package/dist/state-container/index.d.ts +16 -0
- package/dist/state-container/index.js +51 -0
- package/dist/state-container/index.js.map +7 -0
- package/dist/state-container/issue-text.d.ts +11 -0
- package/dist/state-container/issue-text.js +6 -0
- package/dist/state-container/issue-text.js.map +7 -0
- package/dist/state-container/row-ids.d.ts +34 -0
- package/dist/state-container/row-ids.js +19 -0
- package/dist/state-container/row-ids.js.map +7 -0
- package/dist/state-container/selectors.d.ts +33 -0
- package/dist/state-container/selectors.js +22 -0
- package/dist/state-container/selectors.js.map +7 -0
- package/dist/state-container/stale-results.d.ts +28 -0
- package/dist/state-container/stale-results.js +9 -0
- package/dist/state-container/stale-results.js.map +7 -0
- package/dist/state-container/state-tree.d.ts +56 -0
- package/dist/state-container/state-tree.js +33 -0
- package/dist/state-container/state-tree.js.map +7 -0
- package/dist/state-container/submission.d.ts +45 -0
- package/dist/state-container/submission.js +26 -0
- package/dist/state-container/submission.js.map +7 -0
- package/dist/state-container/types.d.ts +404 -0
- package/dist/state-container/types.js +6 -0
- package/dist/state-container/types.js.map +7 -0
- package/dist/state-container/value-tree.d.ts +56 -0
- package/dist/state-container/value-tree.js +34 -0
- package/dist/state-container/value-tree.js.map +7 -0
- package/dist/testing/form-state-container-conformance.d.ts +51 -0
- package/dist/testing/form-state-container-conformance.js +43 -0
- package/dist/testing/form-state-container-conformance.js.map +7 -0
- package/dist/testing/index.d.ts +7 -0
- package/dist/testing/index.js +35 -0
- package/dist/testing/index.js.map +7 -0
- package/dist/types/actions.d.ts +75 -0
- package/dist/types/actions.js +1 -0
- package/dist/types/actions.js.map +7 -0
- package/dist/types/categories.d.ts +21 -0
- package/dist/types/categories.js +8 -0
- package/dist/types/categories.js.map +7 -0
- package/dist/types/define-element.d.ts +73 -0
- package/dist/types/define-element.js +8 -0
- package/dist/types/define-element.js.map +7 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js +17 -0
- package/dist/types/index.js.map +7 -0
- package/dist/types/metadata.d.ts +14 -0
- package/dist/types/metadata.js +1 -0
- package/dist/types/metadata.js.map +7 -0
- package/dist/types/registration.d.ts +142 -0
- package/dist/types/registration.js +1 -0
- package/dist/types/registration.js.map +7 -0
- package/package.json +119 -3
- package/skill/SKILL.md +79 -0
- package/skill/reference/forms-actions.md +51 -0
- package/skill/reference/forms-submission.md +44 -0
- package/skill/reference/forms-validation.md +91 -0
- package/skill/reference/forms.md +179 -0
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createActionConfigValidatorMap,
|
|
3
|
+
createFormEngineSchemaArtifacts
|
|
4
|
+
} from "./chunk-ZYP3MIH3.js";
|
|
5
|
+
import {
|
|
6
|
+
SchemaMetadataCatalog
|
|
7
|
+
} from "./chunk-PBMM2N77.js";
|
|
8
|
+
import {
|
|
9
|
+
ComponentType
|
|
10
|
+
} from "./chunk-DVDKPY2A.js";
|
|
11
|
+
import {
|
|
12
|
+
safeValidateFormConfig,
|
|
13
|
+
validateElementConfig,
|
|
14
|
+
validateFormConfig
|
|
15
|
+
} from "./chunk-GY657L56.js";
|
|
16
|
+
import {
|
|
17
|
+
RENDERER_DATA_ATTRIBUTES
|
|
18
|
+
} from "./chunk-KSKWSUOB.js";
|
|
19
|
+
import {
|
|
20
|
+
withActionEnvelope
|
|
21
|
+
} from "./chunk-AUZ45XPE.js";
|
|
22
|
+
import {
|
|
23
|
+
withExportedRules
|
|
24
|
+
} from "./chunk-S5D2QE4G.js";
|
|
25
|
+
import {
|
|
26
|
+
describeRecipeFromRegistration,
|
|
27
|
+
describeViewCatalogFromRecipes,
|
|
28
|
+
getAuthoringInstructionsFromCatalog
|
|
29
|
+
} from "./chunk-EI5TMJDC.js";
|
|
30
|
+
import {
|
|
31
|
+
assertDefaultWizardRecipe,
|
|
32
|
+
createFormRecipeRegistry
|
|
33
|
+
} from "./chunk-UGL3KNOT.js";
|
|
34
|
+
import {
|
|
35
|
+
createSubmissionSchema
|
|
36
|
+
} from "./chunk-HPPFSWIV.js";
|
|
37
|
+
import {
|
|
38
|
+
generateZodJSONSchemaDocument,
|
|
39
|
+
isZodType
|
|
40
|
+
} from "./chunk-25PLQDKN.js";
|
|
41
|
+
import {
|
|
42
|
+
createFormConfigShape
|
|
43
|
+
} from "./chunk-XQ5VJ4QO.js";
|
|
44
|
+
import {
|
|
45
|
+
createDefaultValidationRegistry
|
|
46
|
+
} from "./chunk-6IZYNHZ3.js";
|
|
47
|
+
import {
|
|
48
|
+
globalFetch,
|
|
49
|
+
withCsrf
|
|
50
|
+
} from "./chunk-OUF57UZ7.js";
|
|
51
|
+
import {
|
|
52
|
+
logger
|
|
53
|
+
} from "./chunk-VGGERKV2.js";
|
|
54
|
+
import {
|
|
55
|
+
declaresChildren,
|
|
56
|
+
withExportedChildren
|
|
57
|
+
} from "./chunk-ZUYSGCEH.js";
|
|
58
|
+
|
|
59
|
+
// src/engine/form-engine.ts
|
|
60
|
+
import "zod/mini";
|
|
61
|
+
|
|
62
|
+
// src/engine/build-form-engine.ts
|
|
63
|
+
import { assertStandardSchema, createRegistry } from "@schema-engine/registry";
|
|
64
|
+
import {
|
|
65
|
+
assertAxesNotReserved,
|
|
66
|
+
createAppearanceSchema,
|
|
67
|
+
createLayoutTheme,
|
|
68
|
+
getDefaultLayoutTheme,
|
|
69
|
+
isLayoutTheme,
|
|
70
|
+
withAppearanceAxes,
|
|
71
|
+
withSlotAppearanceAxes
|
|
72
|
+
} from "@schema-engine/layout";
|
|
73
|
+
import * as z from "zod/mini";
|
|
74
|
+
function assertValueDeclared(registration) {
|
|
75
|
+
const { kind } = registration;
|
|
76
|
+
if (kind !== "input" && kind !== "static") {
|
|
77
|
+
throw new Error(
|
|
78
|
+
`Element '${registration.$type}' states no kind. Build it with \`defineInput\` or \`defineStatic\`, or set \`kind: 'input'\` (it holds a value or children) or \`kind: 'static'\` (display only) on a registration written by hand.`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
if (kind === "static") return;
|
|
82
|
+
if (typeof registration.value === "function") return;
|
|
83
|
+
const children = declaresChildren(registration.schema);
|
|
84
|
+
if (children === true || children === void 0 && registration.containerKind !== void 0) return;
|
|
85
|
+
throw new Error(
|
|
86
|
+
`Element '${registration.$type}' is an input that declares no value. Give it \`value: (config) => schema\`, the value its control writes. An input that holds children declares \`elements\` in its schema instead; \`containerKind\` stands in for that only when the schema is not Zod, which cannot be read for them. A display-only element is made with \`defineStatic\`.`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
function createUnionSchema(schemas) {
|
|
90
|
+
if (schemas.length === 0) {
|
|
91
|
+
return z.never();
|
|
92
|
+
}
|
|
93
|
+
if (schemas.length === 1) {
|
|
94
|
+
return schemas[0];
|
|
95
|
+
}
|
|
96
|
+
return z.union(schemas);
|
|
97
|
+
}
|
|
98
|
+
function createRegistrationSchema(registrations, envelopeAppearance) {
|
|
99
|
+
const parts = registrations.map((registration) => {
|
|
100
|
+
if (isZodType(registration.exportSchema)) return registration.exportSchema;
|
|
101
|
+
return z.looseObject({
|
|
102
|
+
$type: z.literal(registration.$type),
|
|
103
|
+
...envelopeAppearance ? { appearance: z.optional(envelopeAppearance(registration)) } : {}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return createUnionSchema(parts);
|
|
107
|
+
}
|
|
108
|
+
function toExportRegistrations(registrations, componentType, layout, childSchema, ruleSchema) {
|
|
109
|
+
return Array.from(registrations, (registration) => {
|
|
110
|
+
const exported = {
|
|
111
|
+
$type: registration.$type,
|
|
112
|
+
schema: registration.schema,
|
|
113
|
+
exportSchema: registration.schema,
|
|
114
|
+
metadata: registration.metadata
|
|
115
|
+
};
|
|
116
|
+
if (!isZodType(registration.schema)) {
|
|
117
|
+
if (componentType === ComponentType.Element) {
|
|
118
|
+
exported.appearanceAxes = registration.appearanceAxes ?? [];
|
|
119
|
+
}
|
|
120
|
+
return exported;
|
|
121
|
+
}
|
|
122
|
+
if (componentType === ComponentType.Element) {
|
|
123
|
+
const withAppearance = withAppearanceAxes(
|
|
124
|
+
registration.schema,
|
|
125
|
+
layout.appearance,
|
|
126
|
+
registration.appearanceAxes
|
|
127
|
+
);
|
|
128
|
+
const withChildren = childSchema ? withExportedChildren(withAppearance, childSchema) : withAppearance;
|
|
129
|
+
exported.exportSchema = ruleSchema ? withExportedRules(withChildren, ruleSchema) : withChildren;
|
|
130
|
+
} else if (componentType === ComponentType.Recipe) {
|
|
131
|
+
exported.exportSchema = withSlotAppearanceAxes(
|
|
132
|
+
registration.schema,
|
|
133
|
+
layout.appearance,
|
|
134
|
+
registration.appearanceAxes
|
|
135
|
+
);
|
|
136
|
+
} else {
|
|
137
|
+
exported.exportSchema = withActionEnvelope(registration.schema, registration.$type);
|
|
138
|
+
}
|
|
139
|
+
return exported;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
var RULE_EXPORT_ID = "validation-rule";
|
|
143
|
+
function createRuleExportSchema(validations) {
|
|
144
|
+
return createUnionSchema(
|
|
145
|
+
validations.all().map(
|
|
146
|
+
(registration) => isZodType(registration.schema) ? registration.schema : z.looseObject({ $type: z.literal(registration.$type) })
|
|
147
|
+
)
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
function createElementsUnion(elements, layout) {
|
|
151
|
+
return createRegistrationSchema(
|
|
152
|
+
elements,
|
|
153
|
+
(element) => createAppearanceSchema(layout.appearance, element.appearanceAxes)
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
function createFormConfigSchema(elementsUnion, recipes, actions, layout) {
|
|
157
|
+
const recipesUnion = createRegistrationSchema(recipes);
|
|
158
|
+
const actionsUnion = createRegistrationSchema(actions);
|
|
159
|
+
return createFormConfigShape({
|
|
160
|
+
elements: elementsUnion,
|
|
161
|
+
view: recipes.length > 0 ? recipesUnion : z.never(),
|
|
162
|
+
actions: actionsUnion,
|
|
163
|
+
appearance: createAppearanceSchema(layout.appearance)
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function registerSchemaMetadata(catalog, componentType, registration) {
|
|
167
|
+
const id = SchemaMetadataCatalog.entryId(componentType, registration.$type);
|
|
168
|
+
catalog.register(assertStandardSchema(registration.schema, `Registration '${id}' schema`), {
|
|
169
|
+
id,
|
|
170
|
+
componentType,
|
|
171
|
+
title: registration.metadata.name,
|
|
172
|
+
description: registration.metadata.description,
|
|
173
|
+
category: registration.metadata.category
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function assertDeclaredAxes(owner, axes, layout) {
|
|
177
|
+
for (const axis of axes ?? []) {
|
|
178
|
+
if (!layout.appearance.has(axis)) {
|
|
179
|
+
throw new Error(
|
|
180
|
+
`${owner} declares unknown appearance axis '${axis}'. Declared axes: ${layout.appearance.keys().join(", ")}. Add it with createFormEngine({ layout: { appearance: [...builtInAxes, defineAxis({ $type: '${axis}', ... })] } }).`
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function resolveLayout(layout) {
|
|
186
|
+
if (layout === void 0) return getDefaultLayoutTheme();
|
|
187
|
+
if (isLayoutTheme(layout)) {
|
|
188
|
+
assertAxesNotReserved(layout, RENDERER_DATA_ATTRIBUTES);
|
|
189
|
+
return layout;
|
|
190
|
+
}
|
|
191
|
+
for (const key of Object.keys(layout)) {
|
|
192
|
+
if (key !== "grid" && key !== "appearance") {
|
|
193
|
+
throw new Error(
|
|
194
|
+
`Invalid layout option: unknown key '${key}'. layout takes a theme from createLayoutTheme or { grid, appearance } options. If this is a copy of a compiled theme, pass the compiled theme itself, not a copy.`
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return createLayoutTheme(layout, { reservedNames: RENDERER_DATA_ATTRIBUTES });
|
|
199
|
+
}
|
|
200
|
+
function buildFormEngine(lists) {
|
|
201
|
+
const layout = resolveLayout(lists.layout);
|
|
202
|
+
const elementRegistry = createRegistry("Element", lists.elements ?? []);
|
|
203
|
+
for (const registration of lists.elements ?? []) assertValueDeclared(registration);
|
|
204
|
+
const recipeRegistry = createFormRecipeRegistry(lists.recipes ?? []);
|
|
205
|
+
const actionRegistry = createRegistry("Action", lists.actions ?? []);
|
|
206
|
+
for (const element of elementRegistry.all()) {
|
|
207
|
+
assertDeclaredAxes(`Element '${element.$type}'`, element.appearanceAxes, layout);
|
|
208
|
+
}
|
|
209
|
+
for (const recipe of recipeRegistry.all()) {
|
|
210
|
+
for (const [slot, axes] of Object.entries(recipe.appearanceAxes ?? {})) {
|
|
211
|
+
assertDeclaredAxes(`Recipe '${recipe.$type}' slot '${slot}'`, axes, layout);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const validations = Object.freeze([...lists.validations ?? []]);
|
|
215
|
+
const requestFetch = lists.csrf ? withCsrf(lists.fetch ?? globalFetch, lists.csrf) : lists.fetch ?? globalFetch;
|
|
216
|
+
const validationRegistry = createDefaultValidationRegistry(
|
|
217
|
+
[
|
|
218
|
+
...collectElementValidations(elementRegistry.all()),
|
|
219
|
+
...validations
|
|
220
|
+
],
|
|
221
|
+
{ fetch: requestFetch }
|
|
222
|
+
);
|
|
223
|
+
assertDefaultWizardRecipe(recipeRegistry, lists.defaultWizardRecipe);
|
|
224
|
+
logger.debug("Building FormEngine", {
|
|
225
|
+
elements: elementRegistry.size,
|
|
226
|
+
recipes: recipeRegistry.size,
|
|
227
|
+
actions: actionRegistry.size
|
|
228
|
+
});
|
|
229
|
+
const childSchema = z.lazy(() => elementsUnion);
|
|
230
|
+
const ruleSchema = createRuleExportSchema(validationRegistry);
|
|
231
|
+
const exportedElements = toExportRegistrations(
|
|
232
|
+
elementRegistry.all(),
|
|
233
|
+
ComponentType.Element,
|
|
234
|
+
layout,
|
|
235
|
+
childSchema,
|
|
236
|
+
ruleSchema
|
|
237
|
+
);
|
|
238
|
+
const exportedRecipes = toExportRegistrations(recipeRegistry.all(), ComponentType.Recipe, layout);
|
|
239
|
+
const exportedActions = toExportRegistrations(actionRegistry.all(), ComponentType.Action, layout);
|
|
240
|
+
const exportSchemas = /* @__PURE__ */ new Map();
|
|
241
|
+
for (const [componentType, exported] of [
|
|
242
|
+
[ComponentType.Element, exportedElements],
|
|
243
|
+
[ComponentType.Recipe, exportedRecipes],
|
|
244
|
+
[ComponentType.Action, exportedActions]
|
|
245
|
+
]) {
|
|
246
|
+
for (const item of exported) {
|
|
247
|
+
if (item.exportSchema !== item.schema && isZodType(item.exportSchema)) {
|
|
248
|
+
exportSchemas.set(SchemaMetadataCatalog.entryId(componentType, item.$type), item.exportSchema);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
const metadataCatalog = lists.catalog?.clone() ?? new SchemaMetadataCatalog();
|
|
253
|
+
for (const [componentType, registrations] of [
|
|
254
|
+
[ComponentType.Element, exportedElements],
|
|
255
|
+
[ComponentType.Recipe, exportedRecipes],
|
|
256
|
+
[ComponentType.Action, exportedActions],
|
|
257
|
+
[ComponentType.Axis, layout.appearance.all()]
|
|
258
|
+
]) {
|
|
259
|
+
for (const item of registrations) {
|
|
260
|
+
registerSchemaMetadata(metadataCatalog, componentType, item);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const elementsUnion = createElementsUnion(exportedElements, layout);
|
|
264
|
+
const formConfigSchema = createFormConfigSchema(elementsUnion, exportedRecipes, exportedActions, layout);
|
|
265
|
+
const actionConfigValidators = createActionConfigValidatorMap(exportedActions);
|
|
266
|
+
const schemaArtifacts = createFormEngineSchemaArtifacts(
|
|
267
|
+
metadataCatalog,
|
|
268
|
+
formConfigSchema,
|
|
269
|
+
actionConfigValidators,
|
|
270
|
+
exportSchemas,
|
|
271
|
+
[
|
|
272
|
+
{
|
|
273
|
+
schema: ruleSchema,
|
|
274
|
+
metadata: {
|
|
275
|
+
id: RULE_EXPORT_ID,
|
|
276
|
+
title: "Validation rule",
|
|
277
|
+
description: "Any one of the rules the engine registers, with its options.",
|
|
278
|
+
componentType: ComponentType.Validation
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
);
|
|
283
|
+
return new FormEngine({
|
|
284
|
+
elements: elementRegistry,
|
|
285
|
+
recipes: recipeRegistry,
|
|
286
|
+
actions: actionRegistry,
|
|
287
|
+
schemaArtifacts,
|
|
288
|
+
layout,
|
|
289
|
+
validationRegistry,
|
|
290
|
+
validations,
|
|
291
|
+
defaultWizardRecipe: lists.defaultWizardRecipe,
|
|
292
|
+
formatIssue: lists.formatIssue,
|
|
293
|
+
fetch: requestFetch,
|
|
294
|
+
baseFetch: lists.fetch,
|
|
295
|
+
csrf: lists.csrf
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
function collectElementValidations(elements) {
|
|
299
|
+
return elements.flatMap((element) => element.validations ?? []);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// src/engine/form-engine.ts
|
|
303
|
+
var FormEngine = class {
|
|
304
|
+
registries;
|
|
305
|
+
schemaArtifacts;
|
|
306
|
+
layout;
|
|
307
|
+
validationRegistry;
|
|
308
|
+
submissionSchemas = /* @__PURE__ */ new WeakMap();
|
|
309
|
+
/**
|
|
310
|
+
* Every request the engine makes goes through this: the `fetch` given to `createFormEngine`, or the global one,
|
|
311
|
+
* with the CSRF policy applied. Bindings and actions use it (`context.fetch`) so no one remembers a token.
|
|
312
|
+
*/
|
|
313
|
+
fetch;
|
|
314
|
+
/**
|
|
315
|
+
* @remarks
|
|
316
|
+
* Shares the registries it receives instead of copying them. They are
|
|
317
|
+
* read-only, so engines built by `extend` can share them safely. Construct
|
|
318
|
+
* engines with `createFormEngine`; passing a registry that changes later is
|
|
319
|
+
* unsupported.
|
|
320
|
+
*/
|
|
321
|
+
constructor(registries) {
|
|
322
|
+
this.registries = {
|
|
323
|
+
elements: registries.elements,
|
|
324
|
+
recipes: registries.recipes,
|
|
325
|
+
actions: registries.actions,
|
|
326
|
+
schemaArtifacts: registries.schemaArtifacts,
|
|
327
|
+
layout: registries.layout,
|
|
328
|
+
validationRegistry: registries.validationRegistry,
|
|
329
|
+
validations: registries.validations,
|
|
330
|
+
defaultWizardRecipe: registries.defaultWizardRecipe,
|
|
331
|
+
formatIssue: registries.formatIssue,
|
|
332
|
+
fetch: registries.fetch,
|
|
333
|
+
baseFetch: registries.baseFetch,
|
|
334
|
+
csrf: registries.csrf
|
|
335
|
+
};
|
|
336
|
+
this.fetch = registries.fetch;
|
|
337
|
+
this.schemaArtifacts = registries.schemaArtifacts;
|
|
338
|
+
this.layout = registries.layout;
|
|
339
|
+
this.validationRegistry = registries.validationRegistry;
|
|
340
|
+
logger.debug("FormEngine initialized", {
|
|
341
|
+
elements: this.registries.elements.size,
|
|
342
|
+
recipes: this.registries.recipes.size,
|
|
343
|
+
actions: this.registries.actions.size
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
getElement(id) {
|
|
347
|
+
return this.registries.elements.get(id);
|
|
348
|
+
}
|
|
349
|
+
getAllElements() {
|
|
350
|
+
return [...this.registries.elements.all()];
|
|
351
|
+
}
|
|
352
|
+
getElementIds() {
|
|
353
|
+
return [...this.registries.elements.keys()];
|
|
354
|
+
}
|
|
355
|
+
hasElement(id) {
|
|
356
|
+
return this.registries.elements.has(id);
|
|
357
|
+
}
|
|
358
|
+
getRecipe(id) {
|
|
359
|
+
return this.registries.recipes.get(id);
|
|
360
|
+
}
|
|
361
|
+
getAllRecipes() {
|
|
362
|
+
return [...this.registries.recipes.all()];
|
|
363
|
+
}
|
|
364
|
+
getRecipeIds() {
|
|
365
|
+
return [...this.registries.recipes.keys()];
|
|
366
|
+
}
|
|
367
|
+
hasRecipe(id) {
|
|
368
|
+
return this.registries.recipes.has(id);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* The engine's immutable layout theme: grid vocabulary, appearance vocabulary, one id and one stylesheet.
|
|
372
|
+
*
|
|
373
|
+
* @remarks
|
|
374
|
+
* Compiled once when the engine is built (or taken as given from `createFormEngine({ layout })`).
|
|
375
|
+
* Renderers emit `css` inside the rendered form markup, so SSR output is styled with no FOUC and
|
|
376
|
+
* no runtime injection, and put `id` on the form, grid and item elements as `data-se-theme`.
|
|
377
|
+
* Engines built on the same theme share its id; React hoists the shared stylesheet to one
|
|
378
|
+
* element, while Radiant inlines an identical copy per form.
|
|
379
|
+
*/
|
|
380
|
+
getLayout() {
|
|
381
|
+
return this.layout;
|
|
382
|
+
}
|
|
383
|
+
/** The formatter of issues given to `createFormEngine`, which both renderer bindings read; `undefined` when none was. */
|
|
384
|
+
getIssueFormatter() {
|
|
385
|
+
return this.registries.formatIssue;
|
|
386
|
+
}
|
|
387
|
+
/** The CSRF policy given to `createFormEngine`, for a binding that adds a hidden input to a native post; `undefined` when there is none. */
|
|
388
|
+
getCsrf() {
|
|
389
|
+
return this.registries.csrf;
|
|
390
|
+
}
|
|
391
|
+
getValidationRegistry() {
|
|
392
|
+
return this.validationRegistry;
|
|
393
|
+
}
|
|
394
|
+
getAction(id) {
|
|
395
|
+
return this.registries.actions.get(id);
|
|
396
|
+
}
|
|
397
|
+
getAllActions() {
|
|
398
|
+
return [...this.registries.actions.all()];
|
|
399
|
+
}
|
|
400
|
+
getActionTypes() {
|
|
401
|
+
return [...this.registries.actions.keys()];
|
|
402
|
+
}
|
|
403
|
+
hasAction(id) {
|
|
404
|
+
return this.registries.actions.has(id);
|
|
405
|
+
}
|
|
406
|
+
getSummary() {
|
|
407
|
+
return {
|
|
408
|
+
elements: {
|
|
409
|
+
count: this.registries.elements.size,
|
|
410
|
+
ids: this.getElementIds()
|
|
411
|
+
},
|
|
412
|
+
recipes: {
|
|
413
|
+
count: this.registries.recipes.size,
|
|
414
|
+
ids: this.getRecipeIds()
|
|
415
|
+
},
|
|
416
|
+
actions: {
|
|
417
|
+
count: this.registries.actions.size,
|
|
418
|
+
types: this.getActionTypes()
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
validateForm(config, options) {
|
|
423
|
+
return validateFormConfig(config, this.validateOptions(options?.values));
|
|
424
|
+
}
|
|
425
|
+
safeValidateForm(config, options) {
|
|
426
|
+
return safeValidateFormConfig(config, this.validateOptions(options?.values));
|
|
427
|
+
}
|
|
428
|
+
validateOptions(values) {
|
|
429
|
+
return {
|
|
430
|
+
values,
|
|
431
|
+
owner: this,
|
|
432
|
+
getRecipe: (id) => this.getRecipe(id),
|
|
433
|
+
defaultWizardRecipe: this.registries.defaultWizardRecipe,
|
|
434
|
+
getElement: (id) => this.getElement(id),
|
|
435
|
+
getAction: (id) => this.getAction(id),
|
|
436
|
+
checkRule: (rule) => this.validationRegistry.check(rule),
|
|
437
|
+
axes: this.layout.axes
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Author a form from this engine's registered elements, recipes, and actions.
|
|
442
|
+
* Same runtime pipeline as {@link validateForm}.
|
|
443
|
+
*
|
|
444
|
+
* @remarks
|
|
445
|
+
* The result carries the values type the literal config declares ({@link ValuesOf}), which a renderer reads to
|
|
446
|
+
* type `onSubmit`, `onAction` and `defaultValues`. A config that is not a literal gives {@link FormValues}.
|
|
447
|
+
*
|
|
448
|
+
* The type is derived from the literal, not from this call's result: it is the static twin of
|
|
449
|
+
* {@link FormEngine.submissionSchema}, which `createFormRuntime` checks every submission against.
|
|
450
|
+
*/
|
|
451
|
+
defineForm(config) {
|
|
452
|
+
return this.validateForm(config);
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* The schema of the values a submission of `config` holds, composed from the `value` its elements declare.
|
|
456
|
+
*
|
|
457
|
+
* @remarks
|
|
458
|
+
* It follows the rules the form state container submits by: dotted names nest, named containers become
|
|
459
|
+
* objects, a container of kind `array` becomes a list, a one-child row is a list of values (unless its child is a container of its own, which makes the rows objects), and the config's
|
|
460
|
+
* `payload` keys are added. A field is a required key only when it has a `required` rule and neither it, a
|
|
461
|
+
* container around it nor its step has `constraints` or `disabled`; any other key may be absent, and an
|
|
462
|
+
* optional leaf field may hold its empty value (`''` or `null`), and a list or a group its empty list or object. Keys no field declares are not part of it.
|
|
463
|
+
* `createFormRuntime` parses every submission with it, so one that does not match fails with a
|
|
464
|
+
* `valueMismatch` issue. Its `~standard.jsonSchema` `input()` and `output()` throw for a value schema that has no JSON Schema.
|
|
465
|
+
*/
|
|
466
|
+
submissionSchema(config) {
|
|
467
|
+
const known = this.submissionSchemas.get(config);
|
|
468
|
+
if (known) return known;
|
|
469
|
+
const created = createSubmissionSchema(config, {
|
|
470
|
+
getElement: (id) => this.getElement(id),
|
|
471
|
+
validationRegistry: this.validationRegistry
|
|
472
|
+
});
|
|
473
|
+
this.submissionSchemas.set(config, created);
|
|
474
|
+
return created;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Validate a single element against this engine's registrations, including nested children.
|
|
478
|
+
* Use for standalone or dynamically created fields that are not already inside a normalized form.
|
|
479
|
+
* The normalized marker is applied only after this element and its children succeed.
|
|
480
|
+
*/
|
|
481
|
+
validateElement(config) {
|
|
482
|
+
return validateElementConfig(config, {
|
|
483
|
+
getElement: (id) => this.getElement(id),
|
|
484
|
+
checkRule: (rule) => this.validationRegistry.check(rule),
|
|
485
|
+
axes: this.layout.axes
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
describeRecipe($type) {
|
|
489
|
+
const recipe = this.getRecipe($type);
|
|
490
|
+
if (!recipe) {
|
|
491
|
+
throw new Error(`Unknown recipe '${$type}'. Register it with createFormEngine({ recipes: [...] }).`);
|
|
492
|
+
}
|
|
493
|
+
return describeRecipeFromRegistration(recipe, (r) => this.generateRecipeViewSchema(r));
|
|
494
|
+
}
|
|
495
|
+
describeViewCatalog() {
|
|
496
|
+
return describeViewCatalogFromRecipes(this.getAllRecipes(), (r) => this.generateRecipeViewSchema(r));
|
|
497
|
+
}
|
|
498
|
+
getAuthoringInstructions() {
|
|
499
|
+
return getAuthoringInstructionsFromCatalog(this.describeViewCatalog());
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* @remarks
|
|
503
|
+
* Generated as input: authors may omit prefaulted slots and defaulted keys, so only `$type` is required.
|
|
504
|
+
*
|
|
505
|
+
* Uses the schema the export lists the recipe by, which lists each slot's declared appearance axes,
|
|
506
|
+
* so a view document gets the same autocomplete as the form config.
|
|
507
|
+
*/
|
|
508
|
+
generateRecipeViewSchema(recipe) {
|
|
509
|
+
const id = SchemaMetadataCatalog.entryId(ComponentType.Recipe, recipe.$type);
|
|
510
|
+
try {
|
|
511
|
+
return generateZodJSONSchemaDocument(
|
|
512
|
+
this.schemaArtifacts.exportSchemas.get(id) ?? recipe.schema,
|
|
513
|
+
this.schemaArtifacts.metadataRegistry,
|
|
514
|
+
{
|
|
515
|
+
target: "draft-2020-12",
|
|
516
|
+
io: "input",
|
|
517
|
+
schemaId: id
|
|
518
|
+
}
|
|
519
|
+
);
|
|
520
|
+
} catch (error) {
|
|
521
|
+
logger.warn("Could not generate recipe view schema", {
|
|
522
|
+
recipe: recipe.$type,
|
|
523
|
+
error: error instanceof Error ? error.message : String(error)
|
|
524
|
+
});
|
|
525
|
+
return {};
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
getSchemaArtifacts() {
|
|
529
|
+
return this.schemaArtifacts;
|
|
530
|
+
}
|
|
531
|
+
getFormConfigStandardSchema() {
|
|
532
|
+
return this.schemaArtifacts.jsonSchema.formConfigStandardSchema;
|
|
533
|
+
}
|
|
534
|
+
getActionConfigStandardSchema(actionType) {
|
|
535
|
+
return this.schemaArtifacts.jsonSchema.actionConfigStandardSchemas[actionType];
|
|
536
|
+
}
|
|
537
|
+
getSchemaCatalog() {
|
|
538
|
+
return this.schemaArtifacts.metadataCatalog;
|
|
539
|
+
}
|
|
540
|
+
getSchemaRegistry() {
|
|
541
|
+
return this.schemaArtifacts.metadataRegistry;
|
|
542
|
+
}
|
|
543
|
+
generateJSONSchemaCollection(options) {
|
|
544
|
+
return this.schemaArtifacts.jsonSchema.generateCollection(options);
|
|
545
|
+
}
|
|
546
|
+
getFormConfigSchema() {
|
|
547
|
+
return this.schemaArtifacts.formConfigValidator;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* JSON Schema of the form config authors write, for editor autocomplete.
|
|
551
|
+
*
|
|
552
|
+
* @remarks
|
|
553
|
+
* `io` defaults to `'input'`, as it does for {@link FormEngine.generateJSONSchemaCollection} and
|
|
554
|
+
* {@link FormEngine.generateActionConfigSchema}: the export describes what authors write, and an element
|
|
555
|
+
* schema that pipes a transform (Radiant's `input-otp`) has no JSON Schema for its output side, so
|
|
556
|
+
* `io: 'output'` throws for an engine that registers one.
|
|
557
|
+
*/
|
|
558
|
+
generateFormConfigSchema(options) {
|
|
559
|
+
return this.schemaArtifacts.jsonSchema.generateFormConfig(options);
|
|
560
|
+
}
|
|
561
|
+
generateActionConfigSchema(actionType, options) {
|
|
562
|
+
return this.schemaArtifacts.jsonSchema.generateActionConfig(actionType, options);
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Return a new engine with additional registrations merged in.
|
|
566
|
+
* Duplicate `$type` values follow last-wins semantics.
|
|
567
|
+
*/
|
|
568
|
+
extend(options) {
|
|
569
|
+
return buildFormEngine({
|
|
570
|
+
elements: [...this.getAllElements(), ...options?.elements ?? []],
|
|
571
|
+
recipes: [...this.getAllRecipes(), ...options?.recipes ?? []],
|
|
572
|
+
actions: [...this.getAllActions(), ...options?.actions ?? []],
|
|
573
|
+
validations: [...this.registries.validations, ...options?.validations ?? []],
|
|
574
|
+
catalog: options?.catalog ?? this.schemaArtifacts.metadataCatalog,
|
|
575
|
+
layout: this.layout,
|
|
576
|
+
defaultWizardRecipe: this.registries.defaultWizardRecipe,
|
|
577
|
+
formatIssue: this.registries.formatIssue,
|
|
578
|
+
fetch: this.registries.baseFetch,
|
|
579
|
+
csrf: this.registries.csrf
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
export {
|
|
585
|
+
FormEngine,
|
|
586
|
+
buildFormEngine
|
|
587
|
+
};
|