@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,57 @@
|
|
|
1
|
+
import type { ConstraintLogic } from '../schemas';
|
|
2
|
+
import { resolveFieldRef } from '../lib/field-ref.js';
|
|
3
|
+
/**
|
|
4
|
+
* Result from evaluating constraint logic
|
|
5
|
+
*/
|
|
6
|
+
export interface ConstraintEvaluationResult {
|
|
7
|
+
shouldShow: boolean;
|
|
8
|
+
shouldDisable: boolean;
|
|
9
|
+
isRequired: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Resolves an authored constraint field against the scope of the field declaring it.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Alias of {@link resolveFieldRef}. Constraints and cross-field validation ask the
|
|
16
|
+
* same question of an authored name — "what does `accountType` mean, written on
|
|
17
|
+
* `contacts.0.email`?" — so they must answer it identically. The implementation
|
|
18
|
+
* lives in `lib/field-ref` because neither subsystem owns it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const resolveConstraintPath: typeof resolveFieldRef;
|
|
21
|
+
/**
|
|
22
|
+
* Every value path a constraint set depends on, in declaration order.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* Renderers need the list separately from evaluation so they can react to exactly
|
|
26
|
+
* those paths: React subscribes to them, and Radiant's `se-constraint` compares only
|
|
27
|
+
* their values to skip evaluation when an unrelated field changes.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveConstraintPaths(constraints?: readonly ConstraintLogic[], fieldPath?: string): string[];
|
|
30
|
+
export interface EvaluateConstraintsInput {
|
|
31
|
+
constraints?: readonly ConstraintLogic[];
|
|
32
|
+
/** Nested value tree for the whole form. Paths are read with {@link getValueAtPath}. */
|
|
33
|
+
values: Record<string, unknown>;
|
|
34
|
+
/** Path of the field declaring the constraints; scopes sibling lookups. */
|
|
35
|
+
fieldPath?: string;
|
|
36
|
+
baseRequired?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Evaluates a field's constraints against the form's value tree.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* Resolution and evaluation are deliberately one call: when they were separate,
|
|
43
|
+
* each renderer had to reproduce the "map authored field name to value path" step
|
|
44
|
+
* itself, and they drifted. Callers pass the value tree, not a pre-resolved map.
|
|
45
|
+
*
|
|
46
|
+
* Multiple `show` constraints are OR'ed, then any matching `hide` wins. `enable`
|
|
47
|
+
* disables when its condition is *not* met. `require` is OR'ed with `baseRequired`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function evaluateConstraints({ constraints, values, fieldPath, baseRequired, }: EvaluateConstraintsInput): ConstraintEvaluationResult;
|
|
50
|
+
/**
|
|
51
|
+
* Evaluates constraints against values already keyed by authored field name.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* Separate from {@link evaluateConstraints} for callers that subscribe to paths
|
|
55
|
+
* themselves and therefore hold the values keyed by name, not a value tree.
|
|
56
|
+
*/
|
|
57
|
+
export declare function evaluateResolvedConstraints(constraints: readonly ConstraintLogic[] | undefined, fieldValues: Record<string, unknown>, baseRequired?: boolean): ConstraintEvaluationResult;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
evaluateConstraints,
|
|
3
|
+
evaluateResolvedConstraints,
|
|
4
|
+
resolveConstraintPath,
|
|
5
|
+
resolveConstraintPaths
|
|
6
|
+
} from "../chunk-R3MBVWVI.js";
|
|
7
|
+
import "../chunk-YDGH7DTL.js";
|
|
8
|
+
import "../chunk-QLGM2AZW.js";
|
|
9
|
+
import "../chunk-6NV2JDGI.js";
|
|
10
|
+
import "../chunk-3YLRJVVN.js";
|
|
11
|
+
import "../chunk-CMPOBBRV.js";
|
|
12
|
+
export {
|
|
13
|
+
evaluateConstraints,
|
|
14
|
+
evaluateResolvedConstraints,
|
|
15
|
+
resolveConstraintPath,
|
|
16
|
+
resolveConstraintPaths
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './constraint-evaluator';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
evaluateConstraints,
|
|
3
|
+
evaluateResolvedConstraints,
|
|
4
|
+
resolveConstraintPath,
|
|
5
|
+
resolveConstraintPaths
|
|
6
|
+
} from "../chunk-R3MBVWVI.js";
|
|
7
|
+
import "../chunk-YDGH7DTL.js";
|
|
8
|
+
import "../chunk-QLGM2AZW.js";
|
|
9
|
+
import "../chunk-6NV2JDGI.js";
|
|
10
|
+
import "../chunk-3YLRJVVN.js";
|
|
11
|
+
import "../chunk-CMPOBBRV.js";
|
|
12
|
+
export {
|
|
13
|
+
evaluateConstraints,
|
|
14
|
+
evaluateResolvedConstraints,
|
|
15
|
+
resolveConstraintPath,
|
|
16
|
+
resolveConstraintPaths
|
|
17
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type CsrfPolicy } from '../lib/form-fetch.js';
|
|
2
|
+
export type { CsrfPolicy } from '../lib/form-fetch.js';
|
|
3
|
+
/** Where the policy puts the token, besides the reader's own part. */
|
|
4
|
+
interface CsrfPlacement {
|
|
5
|
+
/** The request header that carries the token. */
|
|
6
|
+
readonly header: string;
|
|
7
|
+
/** The name of the hidden input a native post carries it in. */
|
|
8
|
+
readonly field?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Readers of a CSRF token, each returning the {@link CsrfPolicy} for `createFormEngine({ csrf })`.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* A token is read when a request is made and never kept. A reader touches `document` only then, so importing this
|
|
15
|
+
* module is safe on a server, where the token is `undefined`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const csrf: {
|
|
18
|
+
/** The `content` of `<meta name="...">`. */
|
|
19
|
+
fromMeta: (name: string, placement: CsrfPlacement) => CsrfPolicy;
|
|
20
|
+
/** The decoded value of the cookie `name`. */
|
|
21
|
+
fromCookie: (name: string, placement: CsrfPlacement) => CsrfPolicy;
|
|
22
|
+
/** A token from anywhere, read through `token` at each request. */
|
|
23
|
+
custom: ({ token, ...placement }: CsrfPlacement & {
|
|
24
|
+
readonly token: () => string | undefined;
|
|
25
|
+
}) => CsrfPolicy;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The hidden input a native form post carries the token in, or `undefined` when it must not.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Pass the method and action the submission will use, not only the form's own: when a submit button sets
|
|
32
|
+
* `formmethod` or `formaction`, those are the effective ones. Only for a form whose `method` is `post` (any case; `get` and `dialog` submit no body a server checks, and a
|
|
33
|
+
* `get` would put the token in the URL) and whose `action` is same-origin, resolved against the document's base URL
|
|
34
|
+
* as {@link CsrfPolicy} resolves a request. An empty action is the page itself. Also `undefined` without a policy,
|
|
35
|
+
* without a `field` on it, and without a token. Read at call time, so a binding calls it when it renders or submits.
|
|
36
|
+
*/
|
|
37
|
+
export declare function csrfFieldFor(policy: CsrfPolicy | undefined, form: {
|
|
38
|
+
readonly method: string;
|
|
39
|
+
readonly action: string;
|
|
40
|
+
}): {
|
|
41
|
+
readonly name: string;
|
|
42
|
+
readonly value: string;
|
|
43
|
+
} | undefined;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isSameOrigin
|
|
3
|
+
} from "../chunk-OUF57UZ7.js";
|
|
4
|
+
|
|
5
|
+
// src/csrf/index.ts
|
|
6
|
+
var placed = (token, { header, field }) => ({
|
|
7
|
+
token,
|
|
8
|
+
header,
|
|
9
|
+
...field === void 0 ? {} : { field }
|
|
10
|
+
});
|
|
11
|
+
var textOf = (value) => value === null || value === void 0 || value === "" ? void 0 : value;
|
|
12
|
+
var csrf = {
|
|
13
|
+
/** The `content` of `<meta name="...">`. */
|
|
14
|
+
fromMeta: (name, placement) => placed(() => {
|
|
15
|
+
if (typeof document === "undefined") return void 0;
|
|
16
|
+
const meta = Array.from(document.getElementsByTagName("meta")).find((candidate) => candidate.name === name);
|
|
17
|
+
return textOf(meta?.content);
|
|
18
|
+
}, placement),
|
|
19
|
+
/** The decoded value of the cookie `name`. */
|
|
20
|
+
fromCookie: (name, placement) => placed(() => {
|
|
21
|
+
if (typeof document === "undefined") return void 0;
|
|
22
|
+
const prefix = `${name}=`;
|
|
23
|
+
const pair = document.cookie.split(";").find((candidate) => candidate.trim().startsWith(prefix));
|
|
24
|
+
if (pair === void 0) return void 0;
|
|
25
|
+
try {
|
|
26
|
+
return textOf(decodeURIComponent(pair.trim().slice(prefix.length)));
|
|
27
|
+
} catch {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
}, placement),
|
|
31
|
+
/** A token from anywhere, read through `token` at each request. */
|
|
32
|
+
custom: ({ token, ...placement }) => placed(() => textOf(token()), placement)
|
|
33
|
+
};
|
|
34
|
+
function csrfFieldFor(policy, form) {
|
|
35
|
+
const name = policy?.field;
|
|
36
|
+
const value = policy?.token();
|
|
37
|
+
if (name === void 0 || value === void 0 || form.method.toLowerCase() !== "post") return void 0;
|
|
38
|
+
return isSameOrigin(form.action) ? { name, value } : void 0;
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
csrf,
|
|
42
|
+
csrfFieldFor
|
|
43
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/csrf/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { isSameOrigin, type CsrfPolicy } from '@/lib/form-fetch';\n\nexport type { CsrfPolicy } from '@/lib/form-fetch';\n\n/** Where the policy puts the token, besides the reader's own part. */\ninterface CsrfPlacement {\n\t/** The request header that carries the token. */\n\treadonly header: string;\n\t/** The name of the hidden input a native post carries it in. */\n\treadonly field?: string;\n}\n\nconst placed = (token: () => string | undefined, { header, field }: CsrfPlacement): CsrfPolicy => ({\n\ttoken,\n\theader,\n\t...(field === undefined ? {} : { field }),\n});\n\nconst textOf = (value: string | null | undefined): string | undefined =>\n\tvalue === null || value === undefined || value === '' ? undefined : value;\n\n/**\n * Readers of a CSRF token, each returning the {@link CsrfPolicy} for `createFormEngine({ csrf })`.\n *\n * @remarks\n * A token is read when a request is made and never kept. A reader touches `document` only then, so importing this\n * module is safe on a server, where the token is `undefined`.\n */\nexport const csrf = {\n\t/** The `content` of `<meta name=\"...\">`. */\n\tfromMeta: (name: string, placement: CsrfPlacement): CsrfPolicy =>\n\t\tplaced(() => {\n\t\t\tif (typeof document === 'undefined') return undefined;\n\t\t\tconst meta = Array.from(document.getElementsByTagName('meta')).find((candidate) => candidate.name === name);\n\t\t\treturn textOf(meta?.content);\n\t\t}, placement),\n\n\t/** The decoded value of the cookie `name`. */\n\tfromCookie: (name: string, placement: CsrfPlacement): CsrfPolicy =>\n\t\tplaced(() => {\n\t\t\tif (typeof document === 'undefined') return undefined;\n\t\t\tconst prefix = `${name}=`;\n\t\t\tconst pair = document.cookie.split(';').find((candidate) => candidate.trim().startsWith(prefix));\n\t\t\tif (pair === undefined) return undefined;\n\t\t\ttry {\n\t\t\t\treturn textOf(decodeURIComponent(pair.trim().slice(prefix.length)));\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}, placement),\n\n\t/** A token from anywhere, read through `token` at each request. */\n\tcustom: ({ token, ...placement }: CsrfPlacement & { readonly token: () => string | undefined }): CsrfPolicy =>\n\t\tplaced(() => textOf(token()), placement),\n};\n\n/**\n * The hidden input a native form post carries the token in, or `undefined` when it must not.\n *\n * @remarks\n * Pass the method and action the submission will use, not only the form's own: when a submit button sets\n * `formmethod` or `formaction`, those are the effective ones. Only for a form whose `method` is `post` (any case; `get` and `dialog` submit no body a server checks, and a\n * `get` would put the token in the URL) and whose `action` is same-origin, resolved against the document's base URL\n * as {@link CsrfPolicy} resolves a request. An empty action is the page itself. Also `undefined` without a policy,\n * without a `field` on it, and without a token. Read at call time, so a binding calls it when it renders or submits.\n */\nexport function csrfFieldFor(\n\tpolicy: CsrfPolicy | undefined,\n\tform: { readonly method: string; readonly action: string },\n): { readonly name: string; readonly value: string } | undefined {\n\tconst name = policy?.field;\n\tconst value = policy?.token();\n\tif (name === undefined || value === undefined || form.method.toLowerCase() !== 'post') return undefined;\n\treturn isSameOrigin(form.action) ? { name, value } : undefined;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAYA,IAAM,SAAS,CAAC,OAAiC,EAAE,QAAQ,MAAM,OAAkC;AAAA,EAClG;AAAA,EACA;AAAA,EACA,GAAI,UAAU,SAAY,CAAC,IAAI,EAAE,MAAM;AACxC;AAEA,IAAM,SAAS,CAAC,UACf,UAAU,QAAQ,UAAU,UAAa,UAAU,KAAK,SAAY;AAS9D,IAAM,OAAO;AAAA;AAAA,EAEnB,UAAU,CAAC,MAAc,cACxB,OAAO,MAAM;AACZ,QAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,UAAM,OAAO,MAAM,KAAK,SAAS,qBAAqB,MAAM,CAAC,EAAE,KAAK,CAAC,cAAc,UAAU,SAAS,IAAI;AAC1G,WAAO,OAAO,MAAM,OAAO;AAAA,EAC5B,GAAG,SAAS;AAAA;AAAA,EAGb,YAAY,CAAC,MAAc,cAC1B,OAAO,MAAM;AACZ,QAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,UAAM,SAAS,GAAG,IAAI;AACtB,UAAM,OAAO,SAAS,OAAO,MAAM,GAAG,EAAE,KAAK,CAAC,cAAc,UAAU,KAAK,EAAE,WAAW,MAAM,CAAC;AAC/F,QAAI,SAAS,OAAW,QAAO;AAC/B,QAAI;AACH,aAAO,OAAO,mBAAmB,KAAK,KAAK,EAAE,MAAM,OAAO,MAAM,CAAC,CAAC;AAAA,IACnE,QAAQ;AACP,aAAO;AAAA,IACR;AAAA,EACD,GAAG,SAAS;AAAA;AAAA,EAGb,QAAQ,CAAC,EAAE,OAAO,GAAG,UAAU,MAC9B,OAAO,MAAM,OAAO,MAAM,CAAC,GAAG,SAAS;AACzC;AAYO,SAAS,aACf,QACA,MACgE;AAChE,QAAM,OAAO,QAAQ;AACrB,QAAM,QAAQ,QAAQ,MAAM;AAC5B,MAAI,SAAS,UAAa,UAAU,UAAa,KAAK,OAAO,YAAY,MAAM,OAAQ,QAAO;AAC9F,SAAO,aAAa,KAAK,MAAM,IAAI,EAAE,MAAM,MAAM,IAAI;AACtD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type CsrfPolicy, type FormFetch } from '../lib/form-fetch.js';
|
|
2
|
+
import type { FormIssueFormatter } from '../state-container/types.js';
|
|
3
|
+
import type { ActionRegistrationConstraint, ElementRegistrationConstraint, RecipeRegistrationConstraint } from '../builder/types.utils.js';
|
|
4
|
+
import type { ValidationRegistrationConstraint } from '../schemas/validation/types.js';
|
|
5
|
+
import { FormEngine } from './form-engine.js';
|
|
6
|
+
import { SchemaMetadataCatalog } from './schema-metadata-catalog.js';
|
|
7
|
+
import { type LayoutInput } from '@schema-engine/layout';
|
|
8
|
+
export type FormEngineRegistrationLists = {
|
|
9
|
+
elements?: readonly ElementRegistrationConstraint[];
|
|
10
|
+
recipes?: readonly RecipeRegistrationConstraint[];
|
|
11
|
+
actions?: readonly ActionRegistrationConstraint[];
|
|
12
|
+
validations?: readonly ValidationRegistrationConstraint[];
|
|
13
|
+
catalog?: SchemaMetadataCatalog;
|
|
14
|
+
defaultWizardRecipe?: string;
|
|
15
|
+
formatIssue?: FormIssueFormatter;
|
|
16
|
+
layout?: LayoutInput;
|
|
17
|
+
fetch?: FormFetch;
|
|
18
|
+
csrf?: CsrfPolicy;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Single construction path for {@link createFormEngine} and {@link FormEngine.extend}.
|
|
22
|
+
* Later duplicate `$type` values overwrite earlier ones (last-wins).
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildFormEngine(lists: FormEngineRegistrationLists): FormEngine<Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, import("../builder/types.utils.js").EngineOutputMaps, {
|
|
25
|
+
size: "default" | "compact" | "comfortable";
|
|
26
|
+
surface: "flat" | "elevated" | "outlined";
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildFormEngine
|
|
3
|
+
} from "../chunk-XPQRHO5E.js";
|
|
4
|
+
import "../chunk-ZYP3MIH3.js";
|
|
5
|
+
import "../chunk-PBMM2N77.js";
|
|
6
|
+
import "../chunk-DVDKPY2A.js";
|
|
7
|
+
import "../chunk-GY657L56.js";
|
|
8
|
+
import "../chunk-6R2MBQPL.js";
|
|
9
|
+
import "../chunk-GRZU6F7Q.js";
|
|
10
|
+
import "../chunk-Q5LEK7CI.js";
|
|
11
|
+
import "../chunk-PN5EH6DM.js";
|
|
12
|
+
import "../chunk-NJXKMF67.js";
|
|
13
|
+
import "../chunk-YUUDXRBW.js";
|
|
14
|
+
import "../chunk-KSKWSUOB.js";
|
|
15
|
+
import "../chunk-RQRQYYTB.js";
|
|
16
|
+
import "../chunk-POCAINUE.js";
|
|
17
|
+
import "../chunk-AUZ45XPE.js";
|
|
18
|
+
import "../chunk-CAZPWBQ4.js";
|
|
19
|
+
import "../chunk-S5D2QE4G.js";
|
|
20
|
+
import "../chunk-EI5TMJDC.js";
|
|
21
|
+
import "../chunk-2YKQAVI2.js";
|
|
22
|
+
import "../chunk-UGL3KNOT.js";
|
|
23
|
+
import "../chunk-EZZHO6DQ.js";
|
|
24
|
+
import "../chunk-HPPFSWIV.js";
|
|
25
|
+
import "../chunk-25PLQDKN.js";
|
|
26
|
+
import "../chunk-7EQJUI5N.js";
|
|
27
|
+
import "../chunk-XQ5VJ4QO.js";
|
|
28
|
+
import "../chunk-237BHPDH.js";
|
|
29
|
+
import "../chunk-MKMJT3XR.js";
|
|
30
|
+
import "../chunk-XQVKX47O.js";
|
|
31
|
+
import "../chunk-4CUGHU36.js";
|
|
32
|
+
import "../chunk-GH34XFCC.js";
|
|
33
|
+
import "../chunk-NJTLBSTR.js";
|
|
34
|
+
import "../chunk-6IZYNHZ3.js";
|
|
35
|
+
import "../chunk-FVOL3ZOJ.js";
|
|
36
|
+
import "../chunk-LMWJAD3B.js";
|
|
37
|
+
import "../chunk-OUF57UZ7.js";
|
|
38
|
+
import "../chunk-G33EUV7N.js";
|
|
39
|
+
import "../chunk-J7GSNWXT.js";
|
|
40
|
+
import "../chunk-MD23VADH.js";
|
|
41
|
+
import "../chunk-OLYHNFKC.js";
|
|
42
|
+
import "../chunk-KE53GN4Q.js";
|
|
43
|
+
import "../chunk-VGGERKV2.js";
|
|
44
|
+
import "../chunk-3B7CJOF6.js";
|
|
45
|
+
import "../chunk-KLATKWUA.js";
|
|
46
|
+
import "../chunk-YDGH7DTL.js";
|
|
47
|
+
import "../chunk-S7I76ISM.js";
|
|
48
|
+
import "../chunk-CRQWKC67.js";
|
|
49
|
+
import "../chunk-QLGM2AZW.js";
|
|
50
|
+
import "../chunk-OR2L7EKO.js";
|
|
51
|
+
import "../chunk-ZUYSGCEH.js";
|
|
52
|
+
import "../chunk-6BAJHAGL.js";
|
|
53
|
+
import "../chunk-6NV2JDGI.js";
|
|
54
|
+
import "../chunk-3YLRJVVN.js";
|
|
55
|
+
import "../chunk-CMPOBBRV.js";
|
|
56
|
+
export {
|
|
57
|
+
buildFormEngine
|
|
58
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable component kind identifiers shared across registries, builders, and
|
|
3
|
+
* schema metadata.
|
|
4
|
+
*
|
|
5
|
+
* Keeping this outside `form-engine` prevents lower-level schema helpers from
|
|
6
|
+
* depending on the runtime engine module, which keeps the extraction boundary
|
|
7
|
+
* cleaner.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ComponentType: {
|
|
10
|
+
readonly Element: "element";
|
|
11
|
+
readonly Recipe: "recipe";
|
|
12
|
+
readonly Action: "action";
|
|
13
|
+
readonly Axis: "axis";
|
|
14
|
+
readonly Validation: "validation";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Union of all supported component kind identifiers.
|
|
18
|
+
*/
|
|
19
|
+
export type ComponentType = (typeof ComponentType)[keyof typeof ComponentType];
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { CsrfPolicy, FormFetch } from '../lib/form-fetch.js';
|
|
2
|
+
import type { FormIssueFormatter } from '../state-container/types.js';
|
|
3
|
+
import type { MergedRegistrationMap, MergedOutputMap, MergedValueMap, MergedActionRegistrationMap, ElementRegistrationConstraint, RecipeRegistrationConstraint, ActionRegistrationConstraint, ValidationRegistrationConstraint } from '../builder/types.utils.js';
|
|
4
|
+
import type { FormEngine } from './form-engine';
|
|
5
|
+
import type { SchemaMetadataCatalog } from './schema-metadata-catalog';
|
|
6
|
+
import type { LayoutAxes, LayoutInput } from '@schema-engine/layout';
|
|
7
|
+
export interface CreateFormEngineOptions<TElements extends readonly ElementRegistrationConstraint[] = readonly [], TRecipes extends readonly RecipeRegistrationConstraint[] = readonly [], TActions extends readonly ActionRegistrationConstraint[] = readonly [], TLayout extends LayoutInput = Record<never, never>> {
|
|
8
|
+
elements?: TElements;
|
|
9
|
+
recipes?: TRecipes;
|
|
10
|
+
actions?: TActions;
|
|
11
|
+
/**
|
|
12
|
+
* Validation rules to add to the built-in ones and those the elements declare.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Stored with the other validations in a read-only registry: a later registration with the same
|
|
16
|
+
* `$type` replaces an earlier one without a warning, and each `schema` must be a Standard Schema or
|
|
17
|
+
* the build throws. These come after the validations elements declare, so they win over them.
|
|
18
|
+
* {@link FormEngine.extend} inherits them. Rule configs are not typed per engine: the rule objects in
|
|
19
|
+
* a field's `rules` keep their `$type` string.
|
|
20
|
+
*/
|
|
21
|
+
validations?: readonly ValidationRegistrationConstraint[];
|
|
22
|
+
/**
|
|
23
|
+
* Extra schema metadata entries. The engine copies the catalog and writes every
|
|
24
|
+
* registration's entry over it, so an entry with a registration's id is replaced.
|
|
25
|
+
*/
|
|
26
|
+
catalog?: SchemaMetadataCatalog;
|
|
27
|
+
/**
|
|
28
|
+
* Recipe `validateForm` writes as `view` for a multi-step form that omits one. Defaults to `'bare-controls'`.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Must name a registered `wizard`-kind recipe, or the engine build throws. {@link FormEngine.extend}
|
|
32
|
+
* inherits it. Without this option and without a registered `bare-controls`, a multi-step form
|
|
33
|
+
* without `view` stays without one and `validateForm` warns.
|
|
34
|
+
*/
|
|
35
|
+
defaultWizardRecipe?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Turns an issue into the text to show: the one formatter both renderer bindings read.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* The engine reports what is wrong (`type`, `ruleId`, `params`) and owns no text, so the application's
|
|
41
|
+
* i18n layer supplies it here once, as `(issue, { path }) => string`. A renderer or provider may still pass
|
|
42
|
+
* its own for one form, and the issue's own `message` is the fallback. {@link FormEngine.extend} inherits it.
|
|
43
|
+
*/
|
|
44
|
+
formatIssue?: FormIssueFormatter;
|
|
45
|
+
/**
|
|
46
|
+
* The layout theme: a compiled theme from `createLayoutTheme`, or inline `{ grid, appearance }` options.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* `grid` is the grid vocabulary (breakpoint thresholds, gap tokens, default min column width).
|
|
50
|
+
* `appearance` is the named axes a form picks values on, over the built-in `size`
|
|
51
|
+
* (`compact | default | comfortable`) and `surface` (`flat | outlined | elevated`); an axis lists
|
|
52
|
+
* its values by name, or maps each value to the CSS custom properties it sets. Elements and
|
|
53
|
+
* recipe slots declare which axes they support.
|
|
54
|
+
*
|
|
55
|
+
* Pass one compiled theme to several engines and they share its `data-se-theme` and stylesheet,
|
|
56
|
+
* so an embedded form matches its page. Inline options compile a theme of the engine's own, with
|
|
57
|
+
* the renderer's `data-se-*` attribute names reserved so an axis cannot reuse one.
|
|
58
|
+
* {@link FormEngine.extend} inherits it.
|
|
59
|
+
*/
|
|
60
|
+
layout?: TLayout;
|
|
61
|
+
/**
|
|
62
|
+
* The request function every request the engine makes goes through; the global `fetch` by default.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* Today that is the `async` validation rule, and actions receive it as `context.fetch`. It is exposed as
|
|
66
|
+
* {@link FormEngine.fetch}, with the CSRF policy applied. {@link FormEngine.extend} inherits it.
|
|
67
|
+
*/
|
|
68
|
+
fetch?: FormFetch;
|
|
69
|
+
/**
|
|
70
|
+
* Where a CSRF token comes from, from `csrf.fromMeta`, `csrf.fromCookie` or `csrf.custom` of `@schema-engine/forms/csrf`.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* Off unless set. The engine's `fetch` then adds the token as the policy's header to same-origin requests with an
|
|
74
|
+
* unsafe method, and a binding reads the policy with {@link FormEngine.getCsrf} to add a hidden input to a native
|
|
75
|
+
* post. The token is read at request time and is never part of the config, the payload or the submitted values.
|
|
76
|
+
* {@link FormEngine.extend} inherits it.
|
|
77
|
+
*/
|
|
78
|
+
csrf?: CsrfPolicy;
|
|
79
|
+
}
|
|
80
|
+
/** Options for {@link FormEngine.extend}; layout theme and default wizard recipe are always inherited from the source engine. */
|
|
81
|
+
export type ExtendFormEngineOptions<TElements extends readonly ElementRegistrationConstraint[] = readonly [], TRecipes extends readonly RecipeRegistrationConstraint[] = readonly [], TActions extends readonly ActionRegistrationConstraint[] = readonly []> = Omit<CreateFormEngineOptions<TElements, TRecipes, TActions>, 'layout' | 'defaultWizardRecipe' | 'formatIssue' | 'fetch' | 'csrf'>;
|
|
82
|
+
/** {@link FormEngine} specialization produced from registration lists. */
|
|
83
|
+
export type FormEngineFromOptions<TElements extends readonly ElementRegistrationConstraint[], TRecipes extends readonly RecipeRegistrationConstraint[], TActions extends readonly ActionRegistrationConstraint[], TLayout extends LayoutInput = Record<never, never>> = FormEngine<MergedRegistrationMap<TElements>, MergedRegistrationMap<TRecipes>, MergedActionRegistrationMap<TActions>, {
|
|
84
|
+
elements: MergedOutputMap<TElements>;
|
|
85
|
+
recipes: MergedOutputMap<TRecipes>;
|
|
86
|
+
actions: MergedOutputMap<TActions>;
|
|
87
|
+
values: MergedValueMap<TElements>;
|
|
88
|
+
}, LayoutAxes<TLayout>>;
|
|
89
|
+
/**
|
|
90
|
+
* Create an immutable {@link FormEngine} from declarative registration arrays.
|
|
91
|
+
*
|
|
92
|
+
* Duplicate `$type` values follow last-wins semantics at runtime. For typing,
|
|
93
|
+
* last-wins applies to tuples and inline arrays; open `T[]` values use a union
|
|
94
|
+
* of configs for the same `$type`. Spread shared barrels and append overrides:
|
|
95
|
+
*
|
|
96
|
+
* ```ts
|
|
97
|
+
* createFormEngine({ elements: [...schemaFormRegistrations, customInput] });
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare function createFormEngine<const TElements extends readonly ElementRegistrationConstraint[] = readonly [], const TRecipes extends readonly RecipeRegistrationConstraint[] = readonly [], const TActions extends readonly ActionRegistrationConstraint[] = readonly [], const TLayout extends LayoutInput = Record<never, never>>(options?: CreateFormEngineOptions<TElements, TRecipes, TActions, TLayout>): FormEngineFromOptions<TElements, TRecipes, TActions, TLayout>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createFormEngine
|
|
3
|
+
} from "../chunk-U2X3IYSD.js";
|
|
4
|
+
import "../chunk-XPQRHO5E.js";
|
|
5
|
+
import "../chunk-ZYP3MIH3.js";
|
|
6
|
+
import "../chunk-PBMM2N77.js";
|
|
7
|
+
import "../chunk-DVDKPY2A.js";
|
|
8
|
+
import "../chunk-GY657L56.js";
|
|
9
|
+
import "../chunk-6R2MBQPL.js";
|
|
10
|
+
import "../chunk-GRZU6F7Q.js";
|
|
11
|
+
import "../chunk-Q5LEK7CI.js";
|
|
12
|
+
import "../chunk-PN5EH6DM.js";
|
|
13
|
+
import "../chunk-NJXKMF67.js";
|
|
14
|
+
import "../chunk-YUUDXRBW.js";
|
|
15
|
+
import "../chunk-KSKWSUOB.js";
|
|
16
|
+
import "../chunk-RQRQYYTB.js";
|
|
17
|
+
import "../chunk-POCAINUE.js";
|
|
18
|
+
import "../chunk-AUZ45XPE.js";
|
|
19
|
+
import "../chunk-CAZPWBQ4.js";
|
|
20
|
+
import "../chunk-S5D2QE4G.js";
|
|
21
|
+
import "../chunk-EI5TMJDC.js";
|
|
22
|
+
import "../chunk-2YKQAVI2.js";
|
|
23
|
+
import "../chunk-UGL3KNOT.js";
|
|
24
|
+
import "../chunk-EZZHO6DQ.js";
|
|
25
|
+
import "../chunk-HPPFSWIV.js";
|
|
26
|
+
import "../chunk-25PLQDKN.js";
|
|
27
|
+
import "../chunk-7EQJUI5N.js";
|
|
28
|
+
import "../chunk-XQ5VJ4QO.js";
|
|
29
|
+
import "../chunk-237BHPDH.js";
|
|
30
|
+
import "../chunk-MKMJT3XR.js";
|
|
31
|
+
import "../chunk-XQVKX47O.js";
|
|
32
|
+
import "../chunk-4CUGHU36.js";
|
|
33
|
+
import "../chunk-GH34XFCC.js";
|
|
34
|
+
import "../chunk-NJTLBSTR.js";
|
|
35
|
+
import "../chunk-6IZYNHZ3.js";
|
|
36
|
+
import "../chunk-FVOL3ZOJ.js";
|
|
37
|
+
import "../chunk-LMWJAD3B.js";
|
|
38
|
+
import "../chunk-OUF57UZ7.js";
|
|
39
|
+
import "../chunk-G33EUV7N.js";
|
|
40
|
+
import "../chunk-J7GSNWXT.js";
|
|
41
|
+
import "../chunk-MD23VADH.js";
|
|
42
|
+
import "../chunk-OLYHNFKC.js";
|
|
43
|
+
import "../chunk-KE53GN4Q.js";
|
|
44
|
+
import "../chunk-VGGERKV2.js";
|
|
45
|
+
import "../chunk-3B7CJOF6.js";
|
|
46
|
+
import "../chunk-KLATKWUA.js";
|
|
47
|
+
import "../chunk-YDGH7DTL.js";
|
|
48
|
+
import "../chunk-S7I76ISM.js";
|
|
49
|
+
import "../chunk-CRQWKC67.js";
|
|
50
|
+
import "../chunk-QLGM2AZW.js";
|
|
51
|
+
import "../chunk-OR2L7EKO.js";
|
|
52
|
+
import "../chunk-ZUYSGCEH.js";
|
|
53
|
+
import "../chunk-6BAJHAGL.js";
|
|
54
|
+
import "../chunk-6NV2JDGI.js";
|
|
55
|
+
import "../chunk-3YLRJVVN.js";
|
|
56
|
+
import "../chunk-CMPOBBRV.js";
|
|
57
|
+
export {
|
|
58
|
+
createFormEngine
|
|
59
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { FormFetch } from '../lib/form-fetch';
|
|
2
|
+
import type { BuilderActionBaseContext } from '../types/index.js';
|
|
3
|
+
import type { FormStateError } from '../state-container/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Renderer form state in the engine's shape.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* `errors` is flat, one entry per dotted field path, so `address.street` is read as
|
|
9
|
+
* `errors['address.street']` in every renderer and a container and a row inside it
|
|
10
|
+
* can both fail, and `touched` is flat the same way. A renderer that keeps them in another shape
|
|
11
|
+
* converts them before building the context.
|
|
12
|
+
*
|
|
13
|
+
* `isValid` is the snapshot's: true when no error is recorded, in every renderer. It says
|
|
14
|
+
* nothing about fields no validation has reached; `context.form.checkValidity()` answers for
|
|
15
|
+
* the current values.
|
|
16
|
+
*/
|
|
17
|
+
export interface FormActionContextFormState {
|
|
18
|
+
/** Whether no error is recorded for a path that takes part, as `snapshot.isValid` says. */
|
|
19
|
+
isValid: boolean;
|
|
20
|
+
/** Errors by dotted field path, as `validateFormValues` returns them. */
|
|
21
|
+
errors: Readonly<Record<string, FormStateError>>;
|
|
22
|
+
/** Touched fields by dotted path, `true` at each field the user has touched. */
|
|
23
|
+
touched: Readonly<Partial<Record<string, boolean>>>;
|
|
24
|
+
submitCount: number;
|
|
25
|
+
}
|
|
26
|
+
interface BuildFormActionContextOptions<TForm extends BuilderActionBaseContext['form']> {
|
|
27
|
+
config: {
|
|
28
|
+
id?: string;
|
|
29
|
+
};
|
|
30
|
+
values: Record<string, unknown>;
|
|
31
|
+
formState: FormActionContextFormState;
|
|
32
|
+
/** The current step: its id, its position among the steps that are not skipped and how many there are. */
|
|
33
|
+
step: {
|
|
34
|
+
id: string;
|
|
35
|
+
position: number;
|
|
36
|
+
total: number;
|
|
37
|
+
};
|
|
38
|
+
mountedAt: number;
|
|
39
|
+
form: TForm;
|
|
40
|
+
/** The engine's `fetch`, which the context hands to actions. */
|
|
41
|
+
fetch: FormFetch;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Builds the framework-neutral action context used by form action dispatch.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* Step start times are kept per form instance and reset when its current step changes.
|
|
48
|
+
* `userInteractions` counts touched fields plus submissions.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildFormActionContext<TForm extends BuilderActionBaseContext['form']>({ config, values, formState, step, mountedAt, form, fetch, }: BuildFormActionContextOptions<TForm>): BuilderActionBaseContext;
|
|
51
|
+
interface ActionScopes<TAction> {
|
|
52
|
+
actions?: readonly TAction[];
|
|
53
|
+
steps: readonly {
|
|
54
|
+
id: string;
|
|
55
|
+
actions?: readonly TAction[];
|
|
56
|
+
}[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Lists the actions a trigger dispatches while the step `stepId` is current: the form's `actions`,
|
|
60
|
+
* then that step's.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* The runtime dispatches `step_leave` while the step being left is current and `step_change` and
|
|
64
|
+
* `step_enter` once the entered step is, so a step's actions see the step triggers of navigation
|
|
65
|
+
* into and out of that step, plus every other trigger fired while it is current.
|
|
66
|
+
*/
|
|
67
|
+
export declare function collectStepActions<TAction>(config: ActionScopes<TAction>, stepId: string): TAction[];
|
|
68
|
+
/** Whether the form or any of its steps configures an action. */
|
|
69
|
+
export declare function hasConfiguredActions(config: ActionScopes<unknown>): boolean;
|
|
70
|
+
export {};
|