@vectoriox/iox-ui 5.0.0 → 5.2.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.
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The ONE descriptor shape for everything an author can put in an ordered action list —
3
+ * a form's after-submit steps today, element behaviour actions (A1) next. Promoted out of
4
+ * `forms-core` because a button action importing from the forms module would be a lie; the
5
+ * forms catalog lives here now and `forms-core` re-exports it unchanged.
6
+ * See iox-ai-guidance `architecture/builder/actions-framework-plan.md` §4 (A0).
7
+ */
8
+ /** How a step executes — decides which editor fields appear (timing only for `animated`). */
9
+ type ActionKind = 'animated' | 'instant' | 'server';
10
+ /** Picker grouping. Flat lists die at ~10 entries; the group is data, never a second list. */
11
+ type ActionGroup = 'motion' | 'visibility' | 'navigate' | 'dialog' | 'form' | 'data' | 'service';
12
+ /**
13
+ * What a step does inside the live builder canvas (the canvas RUNS interactions):
14
+ * `run` for real (open the dialog), `simulate` announce-only (navigate), `inert` with a
15
+ * "runs on the live site" note (anything server-side or costing money).
16
+ */
17
+ type BuilderBehaviour = 'run' | 'simulate' | 'inert';
18
+ /** A configurable parameter, same shape ComponentMethodDef.params already uses. */
19
+ interface ActionParamSpec {
20
+ name: string;
21
+ type: 'number' | 'string' | 'boolean' | 'page' | 'node' | 'form';
22
+ label: string;
23
+ }
24
+ /** Does this action point at another node — and may it be any node or only certain types? */
25
+ interface ActionTargetSpec {
26
+ required: boolean;
27
+ types?: string[];
28
+ }
29
+ /**
30
+ * One row of an action catalog. Every field beyond `type`/`labelKey` is optional so the
31
+ * pre-A0 forms descriptors remain valid verbatim.
32
+ */
33
+ interface ActionDescriptor {
34
+ type: string;
35
+ labelKey: string;
36
+ kind?: ActionKind;
37
+ group?: ActionGroup;
38
+ builderBehaviour?: BuilderBehaviour;
39
+ target?: ActionTargetSpec;
40
+ params?: ActionParamSpec[];
41
+ /** The connector that must be configured & healthy before this action is offerable. */
42
+ connector?: string;
43
+ /** Plan-entitlement key (AI plan D5). Absent = never gated by plan. */
44
+ entitlement?: string;
45
+ /** Always present in the list and not removable (forms: `store`). */
46
+ locked?: boolean;
47
+ /** Not offered yet — shown greyed with a "coming soon" note, so the roadmap is visible. */
48
+ planned?: boolean;
49
+ }
50
+ /**
51
+ * The FORM after-submit catalog (moved verbatim from forms-core; `forms-core` re-exports it
52
+ * under its old name `ACTION_DESCRIPTORS`). A1's element catalog is a SEPARATE constant —
53
+ * the two lists share this shape, never one bucket.
54
+ */
55
+ declare const FORM_SUBMIT_ACTION_DESCRIPTORS: readonly ActionDescriptor[];
56
+ /** Steps that can still be added to a list — each at most once, and never a planned one. */
57
+ declare function addableActions(existing?: readonly {
58
+ type: string;
59
+ }[], catalog?: readonly ActionDescriptor[]): ActionDescriptor[];
60
+
61
+ /**
62
+ * K4 of the actions plan: four different reasons a catalog row is unavailable, four different
63
+ * sentences — *coming soon* · *always on* · *connect X first* · *upgrade*. One resolver feeds
64
+ * the picker AND the AI composer's validation, so they can never disagree.
65
+ */
66
+ type ActionAvailabilityState = 'available' | 'planned' | 'locked' | 'connector-missing' | 'entitlement-missing';
67
+ interface ActionAvailability {
68
+ state: ActionAvailabilityState;
69
+ /** Set when state is connector-missing / entitlement-missing — what to name in the message. */
70
+ connector?: string;
71
+ entitlement?: string;
72
+ }
73
+ interface ActionAvailabilityContext {
74
+ /** Connector health by name. An absent map, or an absent key, means "not known" → allowed. */
75
+ connectors?: Partial<Record<string, boolean>>;
76
+ /**
77
+ * Plan entitlements by key. `Plan.entitlements` does not exist yet anywhere (the known gap),
78
+ * so an ABSENT map means "no gating" and every entitlement passes — the hook is live the day
79
+ * the control plane starts sending them.
80
+ */
81
+ entitlements?: Partial<Record<string, boolean>>;
82
+ }
83
+ declare function resolveActionAvailability(descriptor: ActionDescriptor, ctx?: ActionAvailabilityContext): ActionAvailability;
84
+
85
+ export { FORM_SUBMIT_ACTION_DESCRIPTORS, addableActions, resolveActionAvailability };
86
+ export type { ActionAvailability, ActionAvailabilityContext, ActionAvailabilityState, ActionDescriptor, ActionGroup, ActionKind, ActionParamSpec, ActionTargetSpec, BuilderBehaviour };
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../fesm2022/vectoriox-iox-ui-actions-core.mjs"
3
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * The ONE descriptor shape for everything an author can put in an ordered action list —
3
+ * a form's after-submit steps today, element behaviour actions (A1) next. Promoted out of
4
+ * `forms-core` because a button action importing from the forms module would be a lie; the
5
+ * forms catalog lives here now and `forms-core` re-exports it unchanged.
6
+ * See iox-ai-guidance `architecture/builder/actions-framework-plan.md` §4 (A0).
7
+ */
8
+ /**
9
+ * The FORM after-submit catalog (moved verbatim from forms-core; `forms-core` re-exports it
10
+ * under its old name `ACTION_DESCRIPTORS`). A1's element catalog is a SEPARATE constant —
11
+ * the two lists share this shape, never one bucket.
12
+ */
13
+ const FORM_SUBMIT_ACTION_DESCRIPTORS = Object.freeze([
14
+ { type: 'store', labelKey: 'forms.actions.store', locked: true, kind: 'server', group: 'data', builderBehaviour: 'inert' },
15
+ { type: 'email', labelKey: 'forms.actions.email', kind: 'server', group: 'service', builderBehaviour: 'inert', connector: 'mailer' },
16
+ { type: 'redirect', labelKey: 'forms.actions.redirect', kind: 'instant', group: 'navigate', builderBehaviour: 'simulate' },
17
+ { type: 'createItem', labelKey: 'forms.actions.createItem', planned: true, kind: 'server', group: 'data', builderBehaviour: 'inert' },
18
+ { type: 'webhook', labelKey: 'forms.actions.webhook', planned: true, kind: 'server', group: 'service', builderBehaviour: 'inert' },
19
+ { type: 'autoReply', labelKey: 'forms.actions.autoReply', planned: true, kind: 'server', group: 'service', builderBehaviour: 'inert', connector: 'mailer' },
20
+ ]);
21
+ /** Steps that can still be added to a list — each at most once, and never a planned one. */
22
+ function addableActions(existing = [], catalog = FORM_SUBMIT_ACTION_DESCRIPTORS) {
23
+ const used = new Set(existing.map(action => action.type));
24
+ return catalog.filter(action => !action.locked && !action.planned && !used.has(action.type));
25
+ }
26
+
27
+ function resolveActionAvailability(descriptor, ctx = {}) {
28
+ if (descriptor.planned)
29
+ return { state: 'planned' };
30
+ if (descriptor.locked)
31
+ return { state: 'locked' };
32
+ if (descriptor.connector && ctx.connectors && ctx.connectors[descriptor.connector] === false) {
33
+ return { state: 'connector-missing', connector: descriptor.connector };
34
+ }
35
+ if (descriptor.entitlement && ctx.entitlements && ctx.entitlements[descriptor.entitlement] === false) {
36
+ return { state: 'entitlement-missing', entitlement: descriptor.entitlement };
37
+ }
38
+ return { state: 'available' };
39
+ }
40
+
41
+ /**
42
+ * @vectoriox/iox-ui/actions-core — the shared, FRAMEWORK-FREE action vocabulary.
43
+ *
44
+ * One `ActionDescriptor` shape for every ordered action list in the product: the forms
45
+ * after-submit steps (whose catalog moved here; `forms-core` re-exports it unchanged) and
46
+ * the element behaviour actions of A1. Framework-free for the same reason as `forms-core`
47
+ * and `seo-core`: `iox-cms` consumes it under plain Node.
48
+ * ⚠️ Consumers wire the usual trio — ng-package raw-ts assets, jest moduleNameMapper, and
49
+ * tsconfig paths — or `nest start` dies with ERR_REQUIRE_ESM while jest and build pass.
50
+ */
51
+
52
+ /**
53
+ * Generated bundle index. Do not edit.
54
+ */
55
+
56
+ export { FORM_SUBMIT_ACTION_DESCRIPTORS, addableActions, resolveActionAvailability };
57
+ //# sourceMappingURL=vectoriox-iox-ui-actions-core.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vectoriox-iox-ui-actions-core.mjs","sources":["../../../projects/iox-ui/src/actions-core/action.model.ts","../../../projects/iox-ui/src/actions-core/availability.ts","../../../projects/iox-ui/src/actions-core/public-api.ts","../../../projects/iox-ui/src/actions-core/vectoriox-iox-ui-actions-core.ts"],"sourcesContent":["/**\n * The ONE descriptor shape for everything an author can put in an ordered action list —\n * a form's after-submit steps today, element behaviour actions (A1) next. Promoted out of\n * `forms-core` because a button action importing from the forms module would be a lie; the\n * forms catalog lives here now and `forms-core` re-exports it unchanged.\n * See iox-ai-guidance `architecture/builder/actions-framework-plan.md` §4 (A0).\n */\n\n/** How a step executes — decides which editor fields appear (timing only for `animated`). */\nexport type ActionKind = 'animated' | 'instant' | 'server';\n\n/** Picker grouping. Flat lists die at ~10 entries; the group is data, never a second list. */\nexport type ActionGroup =\n | 'motion' | 'visibility' | 'navigate' | 'dialog' | 'form' | 'data' | 'service';\n\n/**\n * What a step does inside the live builder canvas (the canvas RUNS interactions):\n * `run` for real (open the dialog), `simulate` announce-only (navigate), `inert` with a\n * \"runs on the live site\" note (anything server-side or costing money).\n */\nexport type BuilderBehaviour = 'run' | 'simulate' | 'inert';\n\n/** A configurable parameter, same shape ComponentMethodDef.params already uses. */\nexport interface ActionParamSpec {\n name: string;\n type: 'number' | 'string' | 'boolean' | 'page' | 'node' | 'form';\n label: string;\n}\n\n/** Does this action point at another node — and may it be any node or only certain types? */\nexport interface ActionTargetSpec {\n required: boolean;\n types?: string[];\n}\n\n/**\n * One row of an action catalog. Every field beyond `type`/`labelKey` is optional so the\n * pre-A0 forms descriptors remain valid verbatim.\n */\nexport interface ActionDescriptor {\n type: string;\n labelKey: string;\n kind?: ActionKind;\n group?: ActionGroup;\n builderBehaviour?: BuilderBehaviour;\n target?: ActionTargetSpec;\n params?: ActionParamSpec[];\n /** The connector that must be configured & healthy before this action is offerable. */\n connector?: string;\n /** Plan-entitlement key (AI plan D5). Absent = never gated by plan. */\n entitlement?: string;\n /** Always present in the list and not removable (forms: `store`). */\n locked?: boolean;\n /** Not offered yet — shown greyed with a \"coming soon\" note, so the roadmap is visible. */\n planned?: boolean;\n}\n\n/**\n * The FORM after-submit catalog (moved verbatim from forms-core; `forms-core` re-exports it\n * under its old name `ACTION_DESCRIPTORS`). A1's element catalog is a SEPARATE constant —\n * the two lists share this shape, never one bucket.\n */\nexport const FORM_SUBMIT_ACTION_DESCRIPTORS: readonly ActionDescriptor[] = Object.freeze([\n { type: 'store', labelKey: 'forms.actions.store', locked: true, kind: 'server', group: 'data', builderBehaviour: 'inert' },\n { type: 'email', labelKey: 'forms.actions.email', kind: 'server', group: 'service', builderBehaviour: 'inert', connector: 'mailer' },\n { type: 'redirect', labelKey: 'forms.actions.redirect', kind: 'instant', group: 'navigate', builderBehaviour: 'simulate' },\n { type: 'createItem', labelKey: 'forms.actions.createItem', planned: true, kind: 'server', group: 'data', builderBehaviour: 'inert' },\n { type: 'webhook', labelKey: 'forms.actions.webhook', planned: true, kind: 'server', group: 'service', builderBehaviour: 'inert' },\n { type: 'autoReply', labelKey: 'forms.actions.autoReply', planned: true, kind: 'server', group: 'service', builderBehaviour: 'inert', connector: 'mailer' },\n]);\n\n/** Steps that can still be added to a list — each at most once, and never a planned one. */\nexport function addableActions(\n existing: readonly { type: string }[] = [],\n catalog: readonly ActionDescriptor[] = FORM_SUBMIT_ACTION_DESCRIPTORS,\n): ActionDescriptor[] {\n const used = new Set(existing.map(action => action.type));\n return catalog.filter(action => !action.locked && !action.planned && !used.has(action.type));\n}\n","import { ActionDescriptor } from './action.model';\n\n/**\n * K4 of the actions plan: four different reasons a catalog row is unavailable, four different\n * sentences — *coming soon* · *always on* · *connect X first* · *upgrade*. One resolver feeds\n * the picker AND the AI composer's validation, so they can never disagree.\n */\nexport type ActionAvailabilityState =\n | 'available'\n | 'planned' // not built yet — greyed, \"coming soon\"\n | 'locked' // always present, not addable/removable\n | 'connector-missing' // the named connector is not configured/healthy\n | 'entitlement-missing'; // the plan does not include it\n\nexport interface ActionAvailability {\n state: ActionAvailabilityState;\n /** Set when state is connector-missing / entitlement-missing — what to name in the message. */\n connector?: string;\n entitlement?: string;\n}\n\nexport interface ActionAvailabilityContext {\n /** Connector health by name. An absent map, or an absent key, means \"not known\" → allowed. */\n connectors?: Partial<Record<string, boolean>>;\n /**\n * Plan entitlements by key. `Plan.entitlements` does not exist yet anywhere (the known gap),\n * so an ABSENT map means \"no gating\" and every entitlement passes — the hook is live the day\n * the control plane starts sending them.\n */\n entitlements?: Partial<Record<string, boolean>>;\n}\n\nexport function resolveActionAvailability(\n descriptor: ActionDescriptor,\n ctx: ActionAvailabilityContext = {},\n): ActionAvailability {\n if (descriptor.planned) return { state: 'planned' };\n if (descriptor.locked) return { state: 'locked' };\n if (descriptor.connector && ctx.connectors && ctx.connectors[descriptor.connector] === false) {\n return { state: 'connector-missing', connector: descriptor.connector };\n }\n if (descriptor.entitlement && ctx.entitlements && ctx.entitlements[descriptor.entitlement] === false) {\n return { state: 'entitlement-missing', entitlement: descriptor.entitlement };\n }\n return { state: 'available' };\n}\n","/**\n * @vectoriox/iox-ui/actions-core — the shared, FRAMEWORK-FREE action vocabulary.\n *\n * One `ActionDescriptor` shape for every ordered action list in the product: the forms\n * after-submit steps (whose catalog moved here; `forms-core` re-exports it unchanged) and\n * the element behaviour actions of A1. Framework-free for the same reason as `forms-core`\n * and `seo-core`: `iox-cms` consumes it under plain Node.\n * ⚠️ Consumers wire the usual trio — ng-package raw-ts assets, jest moduleNameMapper, and\n * tsconfig paths — or `nest start` dies with ERR_REQUIRE_ESM while jest and build pass.\n */\nexport * from './action.model';\nexport * from './availability';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;;;;;AAMG;AAmDH;;;;AAIG;AACI,MAAM,8BAA8B,GAAgC,MAAM,CAAC,MAAM,CAAC;IACrF,EAAE,IAAI,EAAE,OAAO,EAAO,QAAQ,EAAE,qBAAqB,EAAO,MAAM,EAAE,IAAI,EAAG,IAAI,EAAE,QAAQ,EAAG,KAAK,EAAE,MAAM,EAAM,gBAAgB,EAAE,OAAO,EAAE;IAC1I,EAAE,IAAI,EAAE,OAAO,EAAO,QAAQ,EAAE,qBAAqB,EAAsB,IAAI,EAAE,QAAQ,EAAG,KAAK,EAAE,SAAS,EAAG,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE;AAC/J,IAAA,EAAE,IAAI,EAAE,UAAU,EAAI,QAAQ,EAAE,wBAAwB,EAAmB,IAAI,EAAE,SAAS,EAAE,KA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AAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,KAAK,EAAE;QAC1F,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE;IAC1E;AACA,IAAA,IAAI,UAAU,CAAC,WAAW,IAAI,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,KAAK,EAAE;QAClG,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE;IAChF;AACA,IAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE;AACjC;;AC7CA;;;;;;;;;AASG;;ACTH;;AAEG;;;;"}
@@ -1,3 +1,5 @@
1
+ export { FORM_SUBMIT_ACTION_DESCRIPTORS as ACTION_DESCRIPTORS, addableActions } from '@vectoriox/iox-ui/actions-core';
2
+
1
3
  // The persisted shape of a form. Pure types + the one derived constant each renderer needs.
2
4
  //
3
5
  // A FormSpec is DERIVED from the node tree (see `collect.ts`), never hand-maintained beside it —
@@ -629,19 +631,6 @@ const PATTERN_PRESET_OPTIONS = Object.freeze([
629
631
  { value: PatternPreset.Letters, labelKey: 'forms.rules.preset.letters' },
630
632
  { value: PatternPreset.Slug, labelKey: 'forms.rules.preset.slug' },
631
633
  ]);
632
- const ACTION_DESCRIPTORS = Object.freeze([
633
- { type: 'store', labelKey: 'forms.actions.store', locked: true },
634
- { type: 'email', labelKey: 'forms.actions.email' },
635
- { type: 'redirect', labelKey: 'forms.actions.redirect' },
636
- { type: 'createItem', labelKey: 'forms.actions.createItem', planned: true },
637
- { type: 'webhook', labelKey: 'forms.actions.webhook', planned: true },
638
- { type: 'autoReply', labelKey: 'forms.actions.autoReply', planned: true },
639
- ]);
640
- /** Destinations that can still be added — each at most once, and never a planned one. */
641
- function addableActions(existing = []) {
642
- const used = new Set(existing.map(action => action.type));
643
- return ACTION_DESCRIPTORS.filter(action => !action.locked && !action.planned && !used.has(action.type));
644
- }
645
634
 
646
635
  /**
647
636
  * The submit transport CONTRACT — what a host must provide to make a form actually send.
@@ -726,5 +715,5 @@ function normaliseErrors(raw) {
726
715
  * Generated bundle index. Do not edit.
727
716
  */
728
717
 
729
- export { ACTION_DESCRIPTORS, ControlType, DEFAULT_EN_MESSAGES, FIELD_NODE_TYPE, FORM_ERROR_KEYS, FORM_NODE_TYPE, FeedbackTiming, HONEYPOT_FIELD, IMPLIED_PATTERN, INITIAL_FORM_STATE, MESSAGE_NAMESPACE, MULTI_VALUE_CONTROLS, PATTERN_MESSAGE_KEYS, PATTERN_PRESETS, PATTERN_PRESET_OPTIONS, PatternPreset, RENDERED_AT_FIELD, RULE_DESCRIPTORS, RULE_MESSAGE_KEYS, RuleName, RuleParamKind, STORE_ACTION, addableActions, addableRules, applyServerErrors, collectFieldNodes, collectFormSpec, deriveFieldName, firstInvalidField, interpretSubmitResponse, onFieldBlur, onFieldChange, onSubmitAttempt, resetFormState, rulesFor, shouldShowError, submitEndpointPath, uniqueFieldName, validateField, validateForm, withAntiSpamFields };
718
+ export { ControlType, DEFAULT_EN_MESSAGES, FIELD_NODE_TYPE, FORM_ERROR_KEYS, FORM_NODE_TYPE, FeedbackTiming, HONEYPOT_FIELD, IMPLIED_PATTERN, INITIAL_FORM_STATE, MESSAGE_NAMESPACE, MULTI_VALUE_CONTROLS, PATTERN_MESSAGE_KEYS, PATTERN_PRESETS, PATTERN_PRESET_OPTIONS, PatternPreset, RENDERED_AT_FIELD, RULE_DESCRIPTORS, RULE_MESSAGE_KEYS, RuleName, RuleParamKind, STORE_ACTION, addableRules, applyServerErrors, collectFieldNodes, collectFormSpec, deriveFieldName, firstInvalidField, interpretSubmitResponse, onFieldBlur, onFieldChange, onSubmitAttempt, resetFormState, rulesFor, shouldShowError, submitEndpointPath, uniqueFieldName, validateField, validateForm, withAntiSpamFields };
730
719
  //# sourceMappingURL=vectoriox-iox-ui-forms-core.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"vectoriox-iox-ui-forms-core.mjs","sources":["../../../projects/iox-ui/src/forms-core/form.model.ts","../../../projects/iox-ui/src/forms-core/messages.ts","../../../projects/iox-ui/src/forms-core/validate.ts","../../../projects/iox-ui/src/forms-core/collect.ts","../../../projects/iox-ui/src/forms-core/runtime.ts","../../../projects/iox-ui/src/forms-core/rule-catalog.ts","../../../projects/iox-ui/src/forms-core/transport.ts","../../../projects/iox-ui/src/forms-core/public-api.ts","../../../projects/iox-ui/src/forms-core/vectoriox-iox-ui-forms-core.ts"],"sourcesContent":["// The persisted shape of a form. Pure types + the one derived constant each renderer needs.\n//\n// A FormSpec is DERIVED from the node tree (see `collect.ts`), never hand-maintained beside it —\n// there is one source of truth for \"what fields does this form have\", and it is the tree the author\n// edited. The builder writes the derived spec into the saved page so the SERVER can re-validate\n// against it without re-implementing the builder's tree walk.\n\n/** What the visitor actually types into. Chosen by a trait; it also implies a validation rule. */\nexport enum ControlType {\n Text = 'text',\n Email = 'email',\n Tel = 'tel',\n Url = 'url',\n Number = 'number',\n Password = 'password',\n Textarea = 'textarea',\n Select = 'select',\n Checkbox = 'checkbox',\n Radio = 'radio',\n Date = 'date',\n Time = 'time',\n File = 'file',\n /** Not shown; carries a constant or a bound value (campaign, source page, …). */\n Hidden = 'hidden',\n}\n\n/** The v1 rule grammar. Phase 3's conditional logic reuses these same names for its conditions. */\nexport enum RuleName {\n Required = 'required',\n MinLength = 'minLength',\n MaxLength = 'maxLength',\n Min = 'min',\n Max = 'max',\n Pattern = 'pattern',\n /** Cross-field: this value must equal another field's (confirm email / password). */\n Matches = 'matches',\n /** A checkbox that must be ticked — terms, consent. */\n Accepted = 'accepted',\n FileType = 'fileType',\n FileSize = 'fileSize',\n}\n\n/** Named regexes so an author picks \"Email\" rather than writing one. */\nexport enum PatternPreset {\n Email = 'email',\n Phone = 'phone',\n Url = 'url',\n Digits = 'digits',\n Letters = 'letters',\n Slug = 'slug',\n}\n\n/**\n * Deliberately permissive. A validator that rejects `user+tag@sub.domain.co.uk` or a real-world\n * phone number is worse than one that lets a typo through: the address gets verified by sending to\n * it, and a false rejection is a lost lead with no recourse.\n */\nexport const PATTERN_PRESETS: Readonly<Record<PatternPreset, RegExp>> = Object.freeze({\n [PatternPreset.Email]: /^[^\\s@]+@[^\\s@.]+(\\.[^\\s@.]+)+$/,\n [PatternPreset.Phone]: /^\\+?[\\d\\s().-]{6,20}$/,\n [PatternPreset.Url]: /^(https?:\\/\\/)?[^\\s.]+\\.[^\\s]{2,}$/i,\n [PatternPreset.Digits]: /^\\d+$/,\n [PatternPreset.Letters]: /^[\\p{L}\\s'-]+$/u,\n [PatternPreset.Slug]: /^[a-z0-9]+(-[a-z0-9]+)*$/,\n});\n\nexport interface ValidationRule {\n name: RuleName;\n /** `{ n }` for lengths/bounds · `{ preset } | { regex }` for pattern · `{ field }` for matches. */\n params?: Record<string, any>;\n /** Author's override. Absent → the shared message catalog supplies a translated key. */\n message?: string;\n}\n\nexport interface FieldOption {\n label: string;\n value: string;\n}\n\n/** Options pulled from a data source instead of typed by hand (a Select of CMS categories). */\nexport interface FieldOptionSource {\n source: string;\n sourcePath?: string;\n valuePath: string;\n labelPath: string;\n}\n\nexport interface FieldSpec {\n /** The submitted key. Derived from the label, unique within the form, editable. */\n name: string;\n control: ControlType;\n label: string;\n /** Surfaced as its own switch in the panel rather than buried in the rule list. */\n required?: boolean;\n rules?: ValidationRule[];\n options?: FieldOption[];\n optionsSource?: FieldOptionSource;\n defaultValue?: any;\n}\n\n/** When a field is validated, once the author has stopped deciding it per field. */\nexport enum FeedbackTiming {\n /** Validate on submit, then live per-field once that field has been touched or has failed. */\n Smart = 'smart',\n Submit = 'submit',\n Live = 'live',\n}\n\n/** What happens to a submission, in order. Card #1 (`store`) is always present. */\nexport interface SubmitAction {\n type: string;\n config?: Record<string, any>;\n /** `retry` (default) · `fail` · `ignore`. */\n onFailure?: 'retry' | 'fail' | 'ignore';\n}\n\nexport interface FormSpec {\n formId: string;\n /** Author-facing name — the submissions inbox groups by it. */\n name: string;\n feedback: FeedbackTiming;\n fields: FieldSpec[];\n actions: SubmitAction[];\n antiSpam: { honeypot: boolean; minFillMs: number; turnstile?: boolean };\n retention?: { days: number };\n}\n\n/**\n * The rule a control type implies with no configuration. Choosing \"Email\" IS choosing email\n * validation — the single biggest reason the panel can stay empty and still validate well.\n */\nexport const IMPLIED_PATTERN: Readonly<Partial<Record<ControlType, PatternPreset>>> = Object.freeze({\n [ControlType.Email]: PatternPreset.Email,\n [ControlType.Tel]: PatternPreset.Phone,\n [ControlType.Url]: PatternPreset.Url,\n});\n\n/** Controls whose value is a list rather than a scalar. */\nexport const MULTI_VALUE_CONTROLS: ReadonlySet<ControlType> = new Set([ControlType.File]);\n","// The default message for every rule, as an i18n KEY — never a rendered string.\n//\n// This is what lets the Validation panel stay empty and still produce good errors: an author who\n// configures nothing gets \"Enter a valid email address\", not \"Invalid\". The author's own `message`\n// on a rule always wins; this is the fallback, and it is the only place a default lives.\n//\n// Consumers translate the key with their own i18n (the CMS client via ngx-translate, the engine via\n// the page's locale bundle). The backend returns the key too, so a server-side rejection renders in\n// the visitor's language rather than in the server's.\n\nimport { RuleName } from './form.model';\n\n/** Namespace for every forms validation key. Keep in sync with `en.json` / `he.json`. */\nexport const MESSAGE_NAMESPACE = 'forms.validation';\n\n/**\n * Rule → i18n key. Params travel beside the key (`{ n: 8 }`, `{ field: 'Email' }`) so a translation\n * can place the number wherever its grammar needs it, rather than having it baked into the string.\n */\nexport const RULE_MESSAGE_KEYS: Readonly<Record<RuleName, string>> = Object.freeze({\n [RuleName.Required]: `${MESSAGE_NAMESPACE}.required`,\n [RuleName.MinLength]: `${MESSAGE_NAMESPACE}.minLength`,\n [RuleName.MaxLength]: `${MESSAGE_NAMESPACE}.maxLength`,\n [RuleName.Min]: `${MESSAGE_NAMESPACE}.min`,\n [RuleName.Max]: `${MESSAGE_NAMESPACE}.max`,\n // ⚠️ `.pattern.generic`, not `.pattern`: the preset keys below live UNDER `pattern`, and a JSON\n // translation bundle cannot have the same key be both a string and an object — ngx-translate\n // would hand back the object (or the raw key) for the generic case.\n [RuleName.Pattern]: `${MESSAGE_NAMESPACE}.pattern.generic`,\n [RuleName.Matches]: `${MESSAGE_NAMESPACE}.matches`,\n [RuleName.Accepted]: `${MESSAGE_NAMESPACE}.accepted`,\n [RuleName.FileType]: `${MESSAGE_NAMESPACE}.fileType`,\n [RuleName.FileSize]: `${MESSAGE_NAMESPACE}.fileSize`,\n});\n\n/**\n * A pattern failure deserves better than \"Invalid format\". Each preset gets its own key so the\n * message can say what a valid value looks like, which is the difference between a visitor fixing\n * a typo and a visitor giving up.\n */\nexport const PATTERN_MESSAGE_KEYS: Readonly<Record<string, string>> = Object.freeze({\n email: `${MESSAGE_NAMESPACE}.pattern.email`,\n phone: `${MESSAGE_NAMESPACE}.pattern.phone`,\n url: `${MESSAGE_NAMESPACE}.pattern.url`,\n digits: `${MESSAGE_NAMESPACE}.pattern.digits`,\n letters: `${MESSAGE_NAMESPACE}.pattern.letters`,\n slug: `${MESSAGE_NAMESPACE}.pattern.slug`,\n});\n\n/** Form-level outcomes the visitor sees in the Error state. One designed block, five reasons. */\nexport const FORM_ERROR_KEYS = Object.freeze({\n Network: `${MESSAGE_NAMESPACE}.form.network`,\n Rejected: `${MESSAGE_NAMESPACE}.form.rejected`,\n Spam: `${MESSAGE_NAMESPACE}.form.spam`,\n RateLimited: `${MESSAGE_NAMESPACE}.form.rateLimited`,\n Server: `${MESSAGE_NAMESPACE}.form.server`,\n});\n\n/** The English defaults, so a consumer that has not added the keys yet still shows real text. */\nexport const DEFAULT_EN_MESSAGES: Readonly<Record<string, string>> = Object.freeze({\n [RULE_MESSAGE_KEYS[RuleName.Required]]: 'This field is required',\n [RULE_MESSAGE_KEYS[RuleName.MinLength]]: 'Use at least {{n}} characters',\n [RULE_MESSAGE_KEYS[RuleName.MaxLength]]: 'Use no more than {{n}} characters',\n [RULE_MESSAGE_KEYS[RuleName.Min]]: 'Enter {{n}} or more',\n [RULE_MESSAGE_KEYS[RuleName.Max]]: 'Enter {{n}} or less',\n [RULE_MESSAGE_KEYS[RuleName.Pattern]]: 'Check the format of this value',\n [RULE_MESSAGE_KEYS[RuleName.Matches]]: 'This must match {{field}}',\n [RULE_MESSAGE_KEYS[RuleName.Accepted]]: 'Please tick this to continue',\n [RULE_MESSAGE_KEYS[RuleName.FileType]]: 'That file type isn’t accepted',\n [RULE_MESSAGE_KEYS[RuleName.FileSize]]: 'That file is larger than {{n}}MB',\n [PATTERN_MESSAGE_KEYS['email']]: 'Enter a valid email address',\n [PATTERN_MESSAGE_KEYS['phone']]: 'Enter a valid phone number',\n [PATTERN_MESSAGE_KEYS['url']]: 'Enter a valid web address',\n [PATTERN_MESSAGE_KEYS['digits']]: 'Use digits only',\n [PATTERN_MESSAGE_KEYS['letters']]: 'Use letters only',\n [PATTERN_MESSAGE_KEYS['slug']]: 'Use lowercase letters, numbers and hyphens',\n [FORM_ERROR_KEYS.Network]: 'We couldn’t reach the server — check your connection and try again',\n [FORM_ERROR_KEYS.Rejected]: 'Some answers need fixing',\n [FORM_ERROR_KEYS.Spam]: 'We couldn’t accept this submission',\n [FORM_ERROR_KEYS.RateLimited]: 'Too many attempts — please wait a moment and try again',\n [FORM_ERROR_KEYS.Server]: 'Something went wrong on our side — your answers are still here',\n});\n","// The validator. ONE implementation, run by the builder canvas, the SSR engine and `iox-cms`.\n//\n// Client-side validation is UX; server-side validation is truth. Because both call this function,\n// a visitor can never be told a value is fine and then have the server reject it, and a hand-crafted\n// POST can never bypass a rule the author configured.\n\nimport {\n ControlType,\n FieldSpec,\n FormSpec,\n IMPLIED_PATTERN,\n PATTERN_PRESETS,\n PatternPreset,\n RuleName,\n ValidationRule,\n} from './form.model';\nimport { PATTERN_MESSAGE_KEYS, RULE_MESSAGE_KEYS } from './messages';\n\nexport interface FieldError {\n /** i18n key, or the author's own override string when they set one. */\n messageKey: string;\n /** Interpolation values (`{ n: 8 }`, `{ field: 'Email' }`). */\n params?: Record<string, any>;\n}\n\nexport interface FieldResult extends Partial<FieldError> {\n valid: boolean;\n}\n\nexport interface FormResult {\n valid: boolean;\n /** Keyed by field name. Empty when valid. */\n errors: Record<string, FieldError>;\n}\n\n/** A file, as either runtime hands it over. Kept structural so this file imports no DOM types. */\ninterface FileLike {\n name?: string;\n size?: number;\n type?: string;\n}\n\n/**\n * Validate one field's value.\n *\n * Order is deliberate and is part of the contract:\n * 1. `required` (or `accepted` for a checkbox) — the only rules an EMPTY value can fail.\n * 2. Everything else, in the order the author arranged them, but ONLY for a non-empty value.\n *\n * That second point is what stops an optional \"Phone\" field from shouting \"enter a valid phone\n * number\" at someone who simply left it blank — the single most common validation-UX bug.\n * The FIRST failure wins: a visitor fixes one thing at a time.\n */\nexport function validateField(\n value: unknown,\n spec: FieldSpec,\n form: Record<string, unknown> = {},\n): FieldResult {\n const rules = effectiveRules(spec);\n const empty = isEmpty(value, spec.control);\n\n for (const rule of rules) {\n const appliesToEmpty = rule.name === RuleName.Required || rule.name === RuleName.Accepted;\n if (empty && !appliesToEmpty) continue;\n\n const failure = check(rule, value, spec, form);\n if (failure) {\n return {\n valid: false,\n messageKey: rule.message ?? failure.messageKey,\n params: failure.params,\n };\n }\n }\n return { valid: true };\n}\n\n/**\n * Validate a whole submission. Every field is checked (not short-circuited at the first bad one) so\n * the visitor sees every problem at once instead of fixing them one reload at a time.\n */\nexport function validateForm(\n values: Record<string, unknown>,\n spec: FormSpec,\n): FormResult {\n const errors: Record<string, FieldError> = {};\n for (const field of spec.fields ?? []) {\n const result = validateField(values?.[field.name], field, values ?? {});\n if (!result.valid) {\n errors[field.name] = { messageKey: result.messageKey!, params: result.params };\n }\n }\n return { valid: Object.keys(errors).length === 0, errors };\n}\n\n/** The name of the first field with an error, in spec order — what the browser should focus. */\nexport function firstInvalidField(spec: FormSpec, errors: Record<string, FieldError>): string | null {\n for (const field of spec.fields ?? []) if (errors[field.name]) return field.name;\n return null;\n}\n\n// ─── internals ───────────────────────────────────────────────────────────────\n\n/**\n * The author's rules, plus the ones the field's own configuration implies: `required` from the\n * switch (rather than making the author add a rule for the commonest case) and the pattern implied\n * by an Email/Tel/Url control. An explicitly declared rule of the same name always wins, so an\n * author who sets their own `pattern` on an Email field is not fighting an invisible second one.\n */\nfunction effectiveRules(spec: FieldSpec): ValidationRule[] {\n const declared = spec.rules ?? [];\n const has = (name: RuleName) => declared.some(r => r.name === name);\n const implied: ValidationRule[] = [];\n\n if (spec.required && !has(RuleName.Required)) {\n // A checkbox's \"required\" means TICKED, which is a different message and a different check.\n implied.push(spec.control === ControlType.Checkbox\n ? { name: RuleName.Accepted }\n : { name: RuleName.Required });\n }\n\n const preset = IMPLIED_PATTERN[spec.control];\n if (preset && !has(RuleName.Pattern)) {\n implied.push({ name: RuleName.Pattern, params: { preset } });\n }\n\n return [...implied, ...declared];\n}\n\n/** Empty means \"the visitor gave us nothing\" — per control type, not a blanket falsy check. */\nfunction isEmpty(value: unknown, control: ControlType): boolean {\n if (value === null || value === undefined) return true;\n if (control === ControlType.Checkbox) return value === false;\n if (Array.isArray(value)) return value.length === 0;\n if (typeof value === 'string') return value.trim() === '';\n return false;\n}\n\nfunction check(\n rule: ValidationRule,\n value: unknown,\n spec: FieldSpec,\n form: Record<string, unknown>,\n): FieldError | null {\n const fail = (messageKey: string, params?: Record<string, any>): FieldError => ({ messageKey, params });\n const defaultKey = RULE_MESSAGE_KEYS[rule.name];\n const n = Number(rule.params?.['n']);\n\n switch (rule.name) {\n case RuleName.Required:\n return isEmpty(value, spec.control) ? fail(defaultKey) : null;\n\n case RuleName.Accepted:\n return value === true ? null : fail(defaultKey);\n\n case RuleName.MinLength:\n return text(value).length < n ? fail(defaultKey, { n }) : null;\n\n case RuleName.MaxLength:\n return text(value).length > n ? fail(defaultKey, { n }) : null;\n\n case RuleName.Min: {\n const num = numeric(value);\n return num === null || num < n ? fail(defaultKey, { n }) : null;\n }\n\n case RuleName.Max: {\n const num = numeric(value);\n return num === null || num > n ? fail(defaultKey, { n }) : null;\n }\n\n case RuleName.Pattern: {\n const regex = patternFor(rule);\n if (!regex) return null; // an unparsable custom regex must not block a submission\n if (regex.test(text(value))) return null;\n const preset = rule.params?.['preset'] as string | undefined;\n return fail((preset && PATTERN_MESSAGE_KEYS[preset]) || defaultKey);\n }\n\n case RuleName.Matches: {\n const other = String(rule.params?.['field'] ?? '');\n return text(value) === text(form?.[other]) ? null : fail(defaultKey, { field: other });\n }\n\n case RuleName.FileType: {\n const accepted = list(rule.params?.['types']).map(t => t.toLowerCase().replace(/^\\./, ''));\n if (!accepted.length) return null;\n const bad = files(value).some(f => {\n const ext = (f.name ?? '').split('.').pop()?.toLowerCase() ?? '';\n const mime = (f.type ?? '').toLowerCase();\n return !accepted.some(t => t === ext || mime === t || mime.startsWith(t + '/'));\n });\n return bad ? fail(defaultKey, { types: accepted.join(', ') }) : null;\n }\n\n case RuleName.FileSize: {\n const maxBytes = n * 1024 * 1024;\n return files(value).some(f => (f.size ?? 0) > maxBytes) ? fail(defaultKey, { n }) : null;\n }\n\n default:\n return null;\n }\n}\n\nfunction patternFor(rule: ValidationRule): RegExp | null {\n const preset = rule.params?.['preset'] as PatternPreset | undefined;\n if (preset && PATTERN_PRESETS[preset]) return PATTERN_PRESETS[preset];\n const custom = rule.params?.['regex'];\n if (typeof custom !== 'string' || !custom) return null;\n // A malformed regex is the AUTHOR's mistake; failing open is the only safe reading, because\n // failing closed would make a live form permanently unsubmittable for every visitor.\n try { return new RegExp(custom); } catch { return null; }\n}\n\nconst text = (value: unknown): string =>\n value === null || value === undefined ? '' : String(value).trim();\n\nfunction numeric(value: unknown): number | null {\n const parsed = typeof value === 'number' ? value : parseFloat(text(value));\n return Number.isFinite(parsed) ? parsed : null;\n}\n\nconst list = (value: unknown): string[] =>\n Array.isArray(value) ? value.map(String)\n : typeof value === 'string' ? value.split(',').map(s => s.trim()).filter(Boolean)\n : [];\n\nconst files = (value: unknown): FileLike[] =>\n Array.isArray(value) ? value as FileLike[]\n : value && typeof value === 'object' ? [value as FileLike]\n : [];\n","// Derive a FormSpec from a node tree.\n//\n// The tree the author edited is the SINGLE source of truth for \"what fields does this form have\".\n// The spec is derived from it — never maintained beside it — so a field cannot exist in one and not\n// the other. The builder runs this on save and stores the result in the page document; the backend\n// reads THAT stored spec to re-validate a submission (it must never trust a spec sent by the\n// browser). See iox-ai-guidance `architecture/builder/forms-and-inputs-plan.md` §5.1 and D11.\n\nimport {\n ControlType,\n FeedbackTiming,\n FieldSpec,\n FormSpec,\n RuleName,\n SubmitAction,\n ValidationRule,\n} from './form.model';\n\n/** The minimum a node must look like. Structural on purpose: this file knows no renderer. */\nexport interface FormNodeLike {\n type: string;\n props?: Record<string, any>;\n children?: FormNodeLike[];\n}\n\nexport const FORM_NODE_TYPE = 'Form';\nexport const FIELD_NODE_TYPE = 'Field';\n\n/** Always present, never removable — the safety net that makes \"store first, deliver after\" true. */\nexport const STORE_ACTION: SubmitAction = Object.freeze({ type: 'store' });\n\n/**\n * Turn a label into the key that arrives in the submitted data — `Full name` → `fullName`.\n * Authors never have to invent keys (decision: auto-derive, with an editable override).\n *\n * Diacritics are stripped rather than dropped, so a Hebrew or accented label still yields a usable\n * ASCII key instead of an empty one; a label with no usable characters falls back to `field`.\n */\nexport function deriveFieldName(label: string): string {\n const words = (label ?? '')\n .normalize('NFD').replace(/[̀-ͯ]/g, '')\n .replace(/[^a-zA-Z0-9]+/g, ' ')\n .trim()\n .split(/\\s+/)\n .filter(Boolean);\n if (!words.length) return 'field';\n const [first, ...rest] = words;\n const name = first.toLowerCase() + rest.map(w => w[0].toUpperCase() + w.slice(1).toLowerCase()).join('');\n // A key must not start with a digit — it ends up as an object key and a form control id.\n return /^\\d/.test(name) ? `field${name}` : name;\n}\n\n/** Make `name` unique within `taken`, appending 2, 3, … — two \"Email\" fields must not collide. */\nexport function uniqueFieldName(name: string, taken: ReadonlySet<string>): string {\n if (!taken.has(name)) return name;\n let n = 2;\n while (taken.has(`${name}${n}`)) n++;\n return `${name}${n}`;\n}\n\n/**\n * Walk a Form subtree and produce its spec.\n *\n * Nested forms are not collected: a Field belongs to its NEAREST ancestor Form (decision D1), so the\n * walk stops at any inner Form node rather than stealing its fields.\n */\nexport function collectFormSpec(node: FormNodeLike | null | undefined): FormSpec | null {\n if (!node || node.type !== FORM_NODE_TYPE) return null;\n const props = node.props ?? {};\n\n const fields: FieldSpec[] = [];\n const taken = new Set<string>();\n for (const fieldNode of collectFieldNodes(node.children ?? [])) {\n const spec = toFieldSpec(fieldNode, taken);\n taken.add(spec.name);\n fields.push(spec);\n }\n\n return {\n formId: props['formId'] ?? '',\n name: props['name'] ?? 'Form',\n feedback: (props['feedback'] as FeedbackTiming) ?? FeedbackTiming.Smart,\n fields,\n actions: normaliseActions(props['actions']),\n antiSpam: {\n honeypot: props['honeypot'] !== false,\n minFillMs: Number(props['minFillMs'] ?? 1200),\n ...(props['turnstile'] ? { turnstile: true } : {}),\n },\n ...(props['retentionDays'] ? { retention: { days: Number(props['retentionDays']) } } : {}),\n };\n}\n\n/** Every Field in this subtree, in document order, not descending into a nested Form. */\nexport function collectFieldNodes(nodes: readonly FormNodeLike[]): FormNodeLike[] {\n const out: FormNodeLike[] = [];\n for (const node of nodes ?? []) {\n if (!node?.type) continue;\n if (node.type === FORM_NODE_TYPE) continue; // a nested form owns its own fields\n if (node.type === FIELD_NODE_TYPE) { out.push(node); continue; }\n out.push(...collectFieldNodes(node.children ?? []));\n }\n return out;\n}\n\nfunction toFieldSpec(node: FormNodeLike, taken: ReadonlySet<string>): FieldSpec {\n const props = node.props ?? {};\n const label = props['label'] ?? '';\n // The author's explicit override wins; otherwise derive from the label.\n const name = uniqueFieldName(props['name'] || deriveFieldName(label), taken);\n\n const spec: FieldSpec = {\n name,\n control: (props['control'] as ControlType) ?? ControlType.Text,\n label,\n };\n if (props['required']) spec.required = true;\n const rules = normaliseRules(props['rules']);\n if (rules.length) spec.rules = rules;\n if (Array.isArray(props['options']) && props['options'].length) spec.options = props['options'];\n if (props['optionsSource']) spec.optionsSource = props['optionsSource'];\n if (props['defaultValue'] !== undefined && props['defaultValue'] !== '') {\n spec.defaultValue = props['defaultValue'];\n }\n return spec;\n}\n\n/** Drop anything that isn't a rule we know — a hand-edited page must not break validation. */\nfunction normaliseRules(raw: unknown): ValidationRule[] {\n if (!Array.isArray(raw)) return [];\n const known = new Set<string>(Object.values(RuleName));\n return raw\n .filter(r => r && known.has(r.name))\n .map(r => ({\n name: r.name as RuleName,\n ...(r.params ? { params: r.params } : {}),\n ...(r.message ? { message: r.message } : {}),\n }));\n}\n\n/** `store` is always first and always present, however the page was edited. */\nfunction normaliseActions(raw: unknown): SubmitAction[] {\n const declared: SubmitAction[] = Array.isArray(raw)\n ? raw.filter(a => a && typeof a.type === 'string')\n : [];\n return [STORE_ACTION, ...declared.filter(a => a.type !== STORE_ACTION.type)];\n}\n","// When a field's error is allowed to be VISIBLE — the pure half of the form runtime.\n//\n// Validity and visibility are different questions. A field can be invalid from the moment the page\n// loads (an empty required field always is), but showing that immediately means greeting a visitor\n// with a wall of red before they have typed anything. This module owns the second question, and it\n// owns it in one place so the builder canvas, the SSR engine and any future runtime agree.\n//\n// Framework-free, like the rest of forms-core.\n\nimport { FeedbackTiming, FormSpec } from './form.model';\nimport { FieldError, validateField, validateForm } from './validate';\n\n/** Everything the runtime needs to remember. Immutable — each transition returns a new state. */\nexport interface FormRuntimeState {\n /** Field names the visitor has left (blurred) at least once. */\n touched: ReadonlySet<string>;\n /** True once a submit has been attempted — after that, every error is fair game. */\n submitted: boolean;\n /** The current errors, whether or not they are being shown. */\n errors: Readonly<Record<string, FieldError>>;\n /** In flight — the submit button shows its loading label and the form is aria-busy. */\n submitting: boolean;\n}\n\nexport const INITIAL_FORM_STATE: FormRuntimeState = Object.freeze({\n touched: new Set<string>(),\n submitted: false,\n errors: {},\n submitting: false,\n});\n\n/**\n * Should this field's error be on screen right now?\n *\n * - `Submit` — only after a submit attempt. Quietest; nothing moves while typing.\n * - `Live` — as soon as it is invalid. Loudest; shouts at a half-typed email address.\n * - `Smart` — the default, and the reason the author gets one dropdown instead of a decision per\n * field: stay quiet until the visitor has either left the field or tried to submit.\n * After that, correct live, so fixing an error clears it as they type.\n */\nexport function shouldShowError(\n fieldName: string,\n state: FormRuntimeState,\n timing: FeedbackTiming | string = FeedbackTiming.Smart,\n): boolean {\n if (!state.errors[fieldName]) return false;\n switch (timing) {\n case FeedbackTiming.Live: return true;\n case FeedbackTiming.Submit: return state.submitted;\n default: return state.submitted || state.touched.has(fieldName);\n }\n}\n\n/**\n * Re-validate one field after a change. Only that field is re-checked, EXCEPT that a `matches` rule\n * makes another field's validity depend on this one — so a confirm-email field stops being wrong\n * the moment you fix the address it points at, rather than waiting for its own blur.\n */\nexport function onFieldChange(\n state: FormRuntimeState,\n fieldName: string,\n values: Record<string, unknown>,\n spec: FormSpec,\n): FormRuntimeState {\n const errors = { ...state.errors };\n const affected = [fieldName, ...dependentsOf(fieldName, spec)];\n\n for (const name of affected) {\n const field = (spec.fields ?? []).find(f => f.name === name);\n if (!field) continue;\n const result = validateField(values?.[name], field, values ?? {});\n if (result.valid) delete errors[name];\n else errors[name] = { messageKey: result.messageKey!, params: result.params };\n }\n return { ...state, errors };\n}\n\n/** Mark a field touched (on blur) and re-check it, so Smart timing can start showing its error. */\nexport function onFieldBlur(\n state: FormRuntimeState,\n fieldName: string,\n values: Record<string, unknown>,\n spec: FormSpec,\n): FormRuntimeState {\n const touched = new Set(state.touched);\n touched.add(fieldName);\n return { ...onFieldChange(state, fieldName, values, spec), touched };\n}\n\n/**\n * A submit attempt. Validates everything and flips `submitted`, so from here on every error shows\n * whatever the timing setting is — a visitor who pressed the button is owed the full picture.\n */\nexport function onSubmitAttempt(\n state: FormRuntimeState,\n values: Record<string, unknown>,\n spec: FormSpec,\n): FormRuntimeState {\n const { errors } = validateForm(values ?? {}, spec);\n return { ...state, submitted: true, errors };\n}\n\n/** Server-side rejection: adopt the server's errors verbatim. It is the authority, not the client. */\nexport function applyServerErrors(\n state: FormRuntimeState,\n errors: Record<string, FieldError>,\n): FormRuntimeState {\n return { ...state, submitted: true, submitting: false, errors: { ...errors } };\n}\n\n/** A clean slate after a successful submit, for a form configured to clear itself. */\nexport function resetFormState(): FormRuntimeState {\n return { touched: new Set<string>(), submitted: false, errors: {}, submitting: false };\n}\n\n/** Field names whose validity depends on `fieldName` through a `matches` rule. */\nfunction dependentsOf(fieldName: string, spec: FormSpec): string[] {\n return (spec.fields ?? [])\n .filter(f => (f.rules ?? []).some(r => r.params?.['field'] === fieldName))\n .map(f => f.name);\n}\n","/**\n * Which rules exist, and which controls they make sense on.\n *\n * The panel must not offer \"must be ticked\" on a text field, or a character limit on a date. That\n * knowledge belongs with the validator, not duplicated into the editor — otherwise the two drift and\n * an author configures a rule that silently never runs.\n *\n * Pure data, in forms-core, so the builder panel, the engine and the backend all read one catalog.\n */\n\nimport { ControlType, PatternPreset, RuleName } from './form.model';\n\n/** How a rule's parameter is edited. The panel maps these to its own controls. */\nexport enum RuleParamKind {\n /** No parameter — the rule is its own statement (`required`, `accepted`). */\n None = 'none',\n /** A single number (`{ n }`) — lengths and bounds. */\n Number = 'number',\n /** A preset regex, or a custom one (`{ preset }` / `{ regex }`). */\n Pattern = 'pattern',\n /** Another field in the same form (`{ field }`). */\n Field = 'field',\n}\n\nexport interface RuleDescriptor {\n name: RuleName;\n /** i18n key for the rule's name in the Add-rule menu. */\n labelKey: string;\n param: RuleParamKind;\n /** Controls this rule can apply to. Empty means every control. */\n controls: readonly ControlType[];\n /** Suggested starting value for the parameter, so a freshly added rule is already valid. */\n defaultParams?: Record<string, any>;\n}\n\n/** Text-ish controls: the ones whose value is a string a person typed. */\nconst TEXTUAL: readonly ControlType[] = [\n ControlType.Text, ControlType.Email, ControlType.Tel, ControlType.Url,\n ControlType.Password, ControlType.Textarea,\n];\n\n/** Controls with a comparable magnitude. */\nconst NUMERIC: readonly ControlType[] = [ControlType.Number, ControlType.Date, ControlType.Time];\n\nexport const RULE_DESCRIPTORS: readonly RuleDescriptor[] = Object.freeze([\n {\n name: RuleName.MinLength, labelKey: 'forms.rules.minLength',\n param: RuleParamKind.Number, controls: TEXTUAL, defaultParams: { n: 2 },\n },\n {\n name: RuleName.MaxLength, labelKey: 'forms.rules.maxLength',\n param: RuleParamKind.Number, controls: TEXTUAL, defaultParams: { n: 200 },\n },\n {\n name: RuleName.Min, labelKey: 'forms.rules.min',\n param: RuleParamKind.Number, controls: NUMERIC, defaultParams: { n: 0 },\n },\n {\n name: RuleName.Max, labelKey: 'forms.rules.max',\n param: RuleParamKind.Number, controls: NUMERIC, defaultParams: { n: 100 },\n },\n {\n name: RuleName.Pattern, labelKey: 'forms.rules.pattern',\n param: RuleParamKind.Pattern, controls: TEXTUAL,\n defaultParams: { preset: PatternPreset.Email },\n },\n {\n // Cross-field: confirm-email, confirm-password.\n name: RuleName.Matches, labelKey: 'forms.rules.matches',\n param: RuleParamKind.Field, controls: [],\n },\n {\n // A checkbox's `required` already becomes `accepted`, so offering it again would be a\n // duplicate — it is here for a checkbox the author wants ticked WITHOUT marking it required.\n name: RuleName.Accepted, labelKey: 'forms.rules.accepted',\n param: RuleParamKind.None, controls: [ControlType.Checkbox],\n },\n]);\n\n/** The rules that can be added to a field of this control type. */\nexport function rulesFor(control: ControlType | string): RuleDescriptor[] {\n return RULE_DESCRIPTORS.filter(rule =>\n rule.controls.length === 0 || rule.controls.includes(control as ControlType));\n}\n\n/**\n * The rules an author may still ADD — the catalog minus what is already on the field.\n *\n * Each rule appears once: two `maxLength` rules on one field is not a configuration anyone means,\n * and the validator would apply whichever came first. `pattern` is the exception a caller might\n * expect to repeat, and it deliberately does not: a second pattern can only contradict the first.\n */\nexport function addableRules(\n control: ControlType | string,\n existing: readonly { name: RuleName }[] = [],\n): RuleDescriptor[] {\n const used = new Set(existing.map(rule => rule.name));\n return rulesFor(control).filter(rule => !used.has(rule.name));\n}\n\n/** The preset options a Pattern rule offers, in the order the panel should list them. */\nexport const PATTERN_PRESET_OPTIONS: readonly { value: PatternPreset; labelKey: string }[] = Object.freeze([\n { value: PatternPreset.Email, labelKey: 'forms.rules.preset.email' },\n { value: PatternPreset.Phone, labelKey: 'forms.rules.preset.phone' },\n { value: PatternPreset.Url, labelKey: 'forms.rules.preset.url' },\n { value: PatternPreset.Digits, labelKey: 'forms.rules.preset.digits' },\n { value: PatternPreset.Letters, labelKey: 'forms.rules.preset.letters' },\n { value: PatternPreset.Slug, labelKey: 'forms.rules.preset.slug' },\n]);\n\n/** Destinations an author can add to a form, for the After-submit list. */\nexport interface ActionDescriptor {\n type: string;\n labelKey: string;\n /** Always present and not removable. */\n locked?: boolean;\n /** Not offered yet — shown greyed with a \"coming soon\" note rather than hidden, so the roadmap\n * is visible rather than the feature looking absent. */\n planned?: boolean;\n}\n\nexport const ACTION_DESCRIPTORS: readonly ActionDescriptor[] = Object.freeze([\n { type: 'store', labelKey: 'forms.actions.store', locked: true },\n { type: 'email', labelKey: 'forms.actions.email' },\n { type: 'redirect', labelKey: 'forms.actions.redirect' },\n { type: 'createItem', labelKey: 'forms.actions.createItem', planned: true },\n { type: 'webhook', labelKey: 'forms.actions.webhook', planned: true },\n { type: 'autoReply', labelKey: 'forms.actions.autoReply', planned: true },\n]);\n\n/** Destinations that can still be added — each at most once, and never a planned one. */\nexport function addableActions(existing: readonly { type: string }[] = []): ActionDescriptor[] {\n const used = new Set(existing.map(action => action.type));\n return ACTION_DESCRIPTORS.filter(action => !action.locked && !action.planned && !used.has(action.type));\n}\n","/**\n * The submit transport CONTRACT — what a host must provide to make a form actually send.\n *\n * The Form component deliberately owns no HTTP: the builder canvas must never post (an author\n * clicking Submit while designing would file a real submission), and the SSR engine posts through\n * Angular's HttpClient. What IS shared is everything around the call — the endpoint's shape, the\n * anti-spam fields, and how the server's answer maps onto the form's state. Those live here so the\n * two hosts cannot drift, and so a third host (a hand-built integration) has one thing to read.\n *\n * ⚠️ Framework-free, like the rest of forms-core. No Angular, no RxJS, no fetch.\n */\n\nimport { FieldError } from './validate';\n\n/** The field a honeypot input uses. Must match `iox-cms` `anti-spam.ts` — hence the comment there. */\nexport const HONEYPOT_FIELD = '_iox_hp';\n/** When the form was rendered, so the server can measure fill time. */\nexport const RENDERED_AT_FIELD = '_iox_t';\n\n/**\n * What the form hands its host. There is deliberately no `orgId`: the tenant is the HOST's\n * knowledge, not the form's, and a form that had to be told its org would be one more trait an\n * author could get wrong.\n */\nexport interface SubmitRequest {\n formId: string;\n values: Record<string, any>;\n}\n\n/**\n * The server's answer, normalised. Mirrors `SubmitResult` in `iox-cms`\n * `form-submissions.service.ts` — the two are one contract, so change them together.\n */\nexport interface SubmitResponse {\n ok: boolean;\n /** Per-field verdicts from the server's own validation pass, keyed by field name. */\n errors?: Record<string, FieldError>;\n /** Where to send the visitor after a successful submit, when the form has a redirect action. */\n redirect?: string;\n}\n\n/**\n * The one function a host implements. Rejecting (or throwing) means the call never reached the\n * server — the form shows its Error state, which is the honest thing to show for a dropped network.\n */\nexport type FormTransport = (request: SubmitRequest) => Promise<SubmitResponse>;\n\n/**\n * The public submit path. Built here rather than interpolated at each call site, so the engine and\n * any future host cannot disagree about it — and so changing it is one edit.\n *\n * Deliberately relative and WITHOUT a leading slash: the engine mounts under a per-org base href.\n */\nexport function submitEndpointPath(orgId: string, formId: string): string {\n return `api/site/${encodeURIComponent(orgId)}/forms/${encodeURIComponent(formId)}/submit`;\n}\n\n/**\n * Add the anti-spam fields to the collected values.\n *\n * Both are invisible to a real visitor and cost them nothing (decision D12). `renderedAt` is the\n * time the form was rendered, NOT the time of submit — the server measures the difference to catch\n * a script that fills and posts instantly.\n */\nexport function withAntiSpamFields(\n values: Record<string, any>,\n renderedAt: number,\n honeypotValue = '',\n): Record<string, any> {\n return { ...values, [HONEYPOT_FIELD]: honeypotValue, [RENDERED_AT_FIELD]: renderedAt };\n}\n\n/**\n * Normalise whatever came back into a `SubmitResponse`.\n *\n * Fails CLOSED: anything that is not a recognisable success is treated as a failure. A malformed\n * body must never show the visitor a Success state for a submission that was not stored — that is\n * the one lie this feature must not tell.\n */\nexport function interpretSubmitResponse(body: any): SubmitResponse {\n if (!body || typeof body !== 'object' || body.ok !== true) {\n return {\n ok: false,\n errors: normaliseErrors(body?.errors),\n };\n }\n const redirect = typeof body.redirect === 'string' && body.redirect.trim()\n ? body.redirect.trim()\n : undefined;\n return { ok: true, redirect };\n}\n\n/** Keep only entries that actually carry a message, so a junk key cannot blank a field's error. */\nfunction normaliseErrors(raw: any): Record<string, FieldError> | undefined {\n if (!raw || typeof raw !== 'object') return undefined;\n const errors: Record<string, FieldError> = {};\n for (const [name, value] of Object.entries(raw as Record<string, any>)) {\n const messageKey = typeof value?.messageKey === 'string' ? value.messageKey : '';\n if (!messageKey) continue;\n errors[name] = value?.params ? { messageKey, params: value.params } : { messageKey };\n }\n return Object.keys(errors).length ? errors : undefined;\n}\n","/*\n * @vectoriox/iox-ui/forms-core — the shared, FRAMEWORK-FREE core of the forms feature.\n *\n * ⚠️ Nothing in this entry point may import Angular, RxJS, the DOM, or Node. It is consumed by\n * THREE runtimes: the builder canvas (Angular), the SSR engine (Angular), and `iox-cms` (NestJS,\n * plain Node). The main `@vectoriox/iox-ui` entry pulls in `@angular/core`, which Nest must never\n * load — that is the entire reason this secondary entry point exists.\n *\n * Client-side validation is UX; server-side validation is truth. Both run THIS code, so they cannot\n * disagree. See iox-ai-guidance `architecture/builder/forms-and-inputs-plan.md` §5.\n */\n\nexport * from './form.model';\nexport * from './messages';\nexport * from './validate';\nexport * from './collect';\nexport * from './runtime';\nexport * from './rule-catalog';\nexport * from './transport';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;IACY;AAAZ,CAAA,UAAY,WAAW,EAAA;AACnB,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,WAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,WAAA,CAAA,KAAA,CAAA,GAAA,KAAW;A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K,IAAI,EAAE;QACvD,OAAO;AACH,YAAA,EAAE,EAAE,KAAK;AACT,YAAA,MAAM,EAAE,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC;SACxC;IACL;AACA,IAAA,MAAM,QAAQ,GAAG,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI;AACpE,UAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;UAClB,SAAS;AACf,IAAA,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AACjC;AAEA;AACA,SAAS,eAAe,CAAC,GAAQ,EAAA;AAC7B,IAAA,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,SAAS;IACrD,MAAM,MAAM,GAA+B,EAAE;AAC7C,IAAA,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAA0B,CAAC,EAAE;AACpE,QAAA,MAAM,UAAU,GAAG,OAAO,KAAK,EAAE,UAAU,KAAK,QAAQ,GAAG,KAAK,CAAC,UAAU,GAAG,EAAE;AAChF,QAAA,IAAI,CAAC,UAAU;YAAE;QACjB,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,EAAE,MAAM,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE;IACxF;AACA,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS;AAC1D;;ACtGA;;;;;;;;;;AAUG;;ACVH;;AAEG;;;;"}
1
+ {"version":3,"file":"vectoriox-iox-ui-forms-core.mjs","sources":["../../../projects/iox-ui/src/forms-core/form.model.ts","../../../projects/iox-ui/src/forms-core/messages.ts","../../../projects/iox-ui/src/forms-core/validate.ts","../../../projects/iox-ui/src/forms-core/collect.ts","../../../projects/iox-ui/src/forms-core/runtime.ts","../../../projects/iox-ui/src/forms-core/rule-catalog.ts","../../../projects/iox-ui/src/forms-core/transport.ts","../../../projects/iox-ui/src/forms-core/public-api.ts","../../../projects/iox-ui/src/forms-core/vectoriox-iox-ui-forms-core.ts"],"sourcesContent":["// The persisted shape of a form. Pure types + the one derived constant each renderer needs.\n//\n// A FormSpec is DERIVED from the node tree (see `collect.ts`), never hand-maintained beside it —\n// there is one source of truth for \"what fields does this form have\", and it is the tree the author\n// edited. The builder writes the derived spec into the saved page so the SERVER can re-validate\n// against it without re-implementing the builder's tree walk.\n\n/** What the visitor actually types into. Chosen by a trait; it also implies a validation rule. */\nexport enum ControlType {\n Text = 'text',\n Email = 'email',\n Tel = 'tel',\n Url = 'url',\n Number = 'number',\n Password = 'password',\n Textarea = 'textarea',\n Select = 'select',\n Checkbox = 'checkbox',\n Radio = 'radio',\n Date = 'date',\n Time = 'time',\n File = 'file',\n /** Not shown; carries a constant or a bound value (campaign, source page, …). */\n Hidden = 'hidden',\n}\n\n/** The v1 rule grammar. Phase 3's conditional logic reuses these same names for its conditions. */\nexport enum RuleName {\n Required = 'required',\n MinLength = 'minLength',\n MaxLength = 'maxLength',\n Min = 'min',\n Max = 'max',\n Pattern = 'pattern',\n /** Cross-field: this value must equal another field's (confirm email / password). */\n Matches = 'matches',\n /** A checkbox that must be ticked — terms, consent. */\n Accepted = 'accepted',\n FileType = 'fileType',\n FileSize = 'fileSize',\n}\n\n/** Named regexes so an author picks \"Email\" rather than writing one. */\nexport enum PatternPreset {\n Email = 'email',\n Phone = 'phone',\n Url = 'url',\n Digits = 'digits',\n Letters = 'letters',\n Slug = 'slug',\n}\n\n/**\n * Deliberately permissive. A validator that rejects `user+tag@sub.domain.co.uk` or a real-world\n * phone number is worse than one that lets a typo through: the address gets verified by sending to\n * it, and a false rejection is a lost lead with no recourse.\n */\nexport const PATTERN_PRESETS: Readonly<Record<PatternPreset, RegExp>> = Object.freeze({\n [PatternPreset.Email]: /^[^\\s@]+@[^\\s@.]+(\\.[^\\s@.]+)+$/,\n [PatternPreset.Phone]: /^\\+?[\\d\\s().-]{6,20}$/,\n [PatternPreset.Url]: /^(https?:\\/\\/)?[^\\s.]+\\.[^\\s]{2,}$/i,\n [PatternPreset.Digits]: /^\\d+$/,\n [PatternPreset.Letters]: /^[\\p{L}\\s'-]+$/u,\n [PatternPreset.Slug]: /^[a-z0-9]+(-[a-z0-9]+)*$/,\n});\n\nexport interface ValidationRule {\n name: RuleName;\n /** `{ n }` for lengths/bounds · `{ preset } | { regex }` for pattern · `{ field }` for matches. */\n params?: Record<string, any>;\n /** Author's override. Absent → the shared message catalog supplies a translated key. */\n message?: string;\n}\n\nexport interface FieldOption {\n label: string;\n value: string;\n}\n\n/** Options pulled from a data source instead of typed by hand (a Select of CMS categories). */\nexport interface FieldOptionSource {\n source: string;\n sourcePath?: string;\n valuePath: string;\n labelPath: string;\n}\n\nexport interface FieldSpec {\n /** The submitted key. Derived from the label, unique within the form, editable. */\n name: string;\n control: ControlType;\n label: string;\n /** Surfaced as its own switch in the panel rather than buried in the rule list. */\n required?: boolean;\n rules?: ValidationRule[];\n options?: FieldOption[];\n optionsSource?: FieldOptionSource;\n defaultValue?: any;\n}\n\n/** When a field is validated, once the author has stopped deciding it per field. */\nexport enum FeedbackTiming {\n /** Validate on submit, then live per-field once that field has been touched or has failed. */\n Smart = 'smart',\n Submit = 'submit',\n Live = 'live',\n}\n\n/** What happens to a submission, in order. Card #1 (`store`) is always present. */\nexport interface SubmitAction {\n type: string;\n config?: Record<string, any>;\n /** `retry` (default) · `fail` · `ignore`. */\n onFailure?: 'retry' | 'fail' | 'ignore';\n}\n\nexport interface FormSpec {\n formId: string;\n /** Author-facing name — the submissions inbox groups by it. */\n name: string;\n feedback: FeedbackTiming;\n fields: FieldSpec[];\n actions: SubmitAction[];\n antiSpam: { honeypot: boolean; minFillMs: number; turnstile?: boolean };\n retention?: { days: number };\n}\n\n/**\n * The rule a control type implies with no configuration. Choosing \"Email\" IS choosing email\n * validation — the single biggest reason the panel can stay empty and still validate well.\n */\nexport const IMPLIED_PATTERN: Readonly<Partial<Record<ControlType, PatternPreset>>> = Object.freeze({\n [ControlType.Email]: PatternPreset.Email,\n [ControlType.Tel]: PatternPreset.Phone,\n [ControlType.Url]: PatternPreset.Url,\n});\n\n/** Controls whose value is a list rather than a scalar. */\nexport const MULTI_VALUE_CONTROLS: ReadonlySet<ControlType> = new Set([ControlType.File]);\n","// The default message for every rule, as an i18n KEY — never a rendered string.\n//\n// This is what lets the Validation panel stay empty and still produce good errors: an author who\n// configures nothing gets \"Enter a valid email address\", not \"Invalid\". The author's own `message`\n// on a rule always wins; this is the fallback, and it is the only place a default lives.\n//\n// Consumers translate the key with their own i18n (the CMS client via ngx-translate, the engine via\n// the page's locale bundle). The backend returns the key too, so a server-side rejection renders in\n// the visitor's language rather than in the server's.\n\nimport { RuleName } from './form.model';\n\n/** Namespace for every forms validation key. Keep in sync with `en.json` / `he.json`. */\nexport const MESSAGE_NAMESPACE = 'forms.validation';\n\n/**\n * Rule → i18n key. Params travel beside the key (`{ n: 8 }`, `{ field: 'Email' }`) so a translation\n * can place the number wherever its grammar needs it, rather than having it baked into the string.\n */\nexport const RULE_MESSAGE_KEYS: Readonly<Record<RuleName, string>> = Object.freeze({\n [RuleName.Required]: `${MESSAGE_NAMESPACE}.required`,\n [RuleName.MinLength]: `${MESSAGE_NAMESPACE}.minLength`,\n [RuleName.MaxLength]: `${MESSAGE_NAMESPACE}.maxLength`,\n [RuleName.Min]: `${MESSAGE_NAMESPACE}.min`,\n [RuleName.Max]: `${MESSAGE_NAMESPACE}.max`,\n // ⚠️ `.pattern.generic`, not `.pattern`: the preset keys below live UNDER `pattern`, and a JSON\n // translation bundle cannot have the same key be both a string and an object — ngx-translate\n // would hand back the object (or the raw key) for the generic case.\n [RuleName.Pattern]: `${MESSAGE_NAMESPACE}.pattern.generic`,\n [RuleName.Matches]: `${MESSAGE_NAMESPACE}.matches`,\n [RuleName.Accepted]: `${MESSAGE_NAMESPACE}.accepted`,\n [RuleName.FileType]: `${MESSAGE_NAMESPACE}.fileType`,\n [RuleName.FileSize]: `${MESSAGE_NAMESPACE}.fileSize`,\n});\n\n/**\n * A pattern failure deserves better than \"Invalid format\". Each preset gets its own key so the\n * message can say what a valid value looks like, which is the difference between a visitor fixing\n * a typo and a visitor giving up.\n */\nexport const PATTERN_MESSAGE_KEYS: Readonly<Record<string, string>> = Object.freeze({\n email: `${MESSAGE_NAMESPACE}.pattern.email`,\n phone: `${MESSAGE_NAMESPACE}.pattern.phone`,\n url: `${MESSAGE_NAMESPACE}.pattern.url`,\n digits: `${MESSAGE_NAMESPACE}.pattern.digits`,\n letters: `${MESSAGE_NAMESPACE}.pattern.letters`,\n slug: `${MESSAGE_NAMESPACE}.pattern.slug`,\n});\n\n/** Form-level outcomes the visitor sees in the Error state. One designed block, five reasons. */\nexport const FORM_ERROR_KEYS = Object.freeze({\n Network: `${MESSAGE_NAMESPACE}.form.network`,\n Rejected: `${MESSAGE_NAMESPACE}.form.rejected`,\n Spam: `${MESSAGE_NAMESPACE}.form.spam`,\n RateLimited: `${MESSAGE_NAMESPACE}.form.rateLimited`,\n Server: `${MESSAGE_NAMESPACE}.form.server`,\n});\n\n/** The English defaults, so a consumer that has not added the keys yet still shows real text. */\nexport const DEFAULT_EN_MESSAGES: Readonly<Record<string, string>> = Object.freeze({\n [RULE_MESSAGE_KEYS[RuleName.Required]]: 'This field is required',\n [RULE_MESSAGE_KEYS[RuleName.MinLength]]: 'Use at least {{n}} characters',\n [RULE_MESSAGE_KEYS[RuleName.MaxLength]]: 'Use no more than {{n}} characters',\n [RULE_MESSAGE_KEYS[RuleName.Min]]: 'Enter {{n}} or more',\n [RULE_MESSAGE_KEYS[RuleName.Max]]: 'Enter {{n}} or less',\n [RULE_MESSAGE_KEYS[RuleName.Pattern]]: 'Check the format of this value',\n [RULE_MESSAGE_KEYS[RuleName.Matches]]: 'This must match {{field}}',\n [RULE_MESSAGE_KEYS[RuleName.Accepted]]: 'Please tick this to continue',\n [RULE_MESSAGE_KEYS[RuleName.FileType]]: 'That file type isn’t accepted',\n [RULE_MESSAGE_KEYS[RuleName.FileSize]]: 'That file is larger than {{n}}MB',\n [PATTERN_MESSAGE_KEYS['email']]: 'Enter a valid email address',\n [PATTERN_MESSAGE_KEYS['phone']]: 'Enter a valid phone number',\n [PATTERN_MESSAGE_KEYS['url']]: 'Enter a valid web address',\n [PATTERN_MESSAGE_KEYS['digits']]: 'Use digits only',\n [PATTERN_MESSAGE_KEYS['letters']]: 'Use letters only',\n [PATTERN_MESSAGE_KEYS['slug']]: 'Use lowercase letters, numbers and hyphens',\n [FORM_ERROR_KEYS.Network]: 'We couldn’t reach the server — check your connection and try again',\n [FORM_ERROR_KEYS.Rejected]: 'Some answers need fixing',\n [FORM_ERROR_KEYS.Spam]: 'We couldn’t accept this submission',\n [FORM_ERROR_KEYS.RateLimited]: 'Too many attempts — please wait a moment and try again',\n [FORM_ERROR_KEYS.Server]: 'Something went wrong on our side — your answers are still here',\n});\n","// The validator. ONE implementation, run by the builder canvas, the SSR engine and `iox-cms`.\n//\n// Client-side validation is UX; server-side validation is truth. Because both call this function,\n// a visitor can never be told a value is fine and then have the server reject it, and a hand-crafted\n// POST can never bypass a rule the author configured.\n\nimport {\n ControlType,\n FieldSpec,\n FormSpec,\n IMPLIED_PATTERN,\n PATTERN_PRESETS,\n PatternPreset,\n RuleName,\n ValidationRule,\n} from './form.model';\nimport { PATTERN_MESSAGE_KEYS, RULE_MESSAGE_KEYS } from './messages';\n\nexport interface FieldError {\n /** i18n key, or the author's own override string when they set one. */\n messageKey: string;\n /** Interpolation values (`{ n: 8 }`, `{ field: 'Email' }`). */\n params?: Record<string, any>;\n}\n\nexport interface FieldResult extends Partial<FieldError> {\n valid: boolean;\n}\n\nexport interface FormResult {\n valid: boolean;\n /** Keyed by field name. Empty when valid. */\n errors: Record<string, FieldError>;\n}\n\n/** A file, as either runtime hands it over. Kept structural so this file imports no DOM types. */\ninterface FileLike {\n name?: string;\n size?: number;\n type?: string;\n}\n\n/**\n * Validate one field's value.\n *\n * Order is deliberate and is part of the contract:\n * 1. `required` (or `accepted` for a checkbox) — the only rules an EMPTY value can fail.\n * 2. Everything else, in the order the author arranged them, but ONLY for a non-empty value.\n *\n * That second point is what stops an optional \"Phone\" field from shouting \"enter a valid phone\n * number\" at someone who simply left it blank — the single most common validation-UX bug.\n * The FIRST failure wins: a visitor fixes one thing at a time.\n */\nexport function validateField(\n value: unknown,\n spec: FieldSpec,\n form: Record<string, unknown> = {},\n): FieldResult {\n const rules = effectiveRules(spec);\n const empty = isEmpty(value, spec.control);\n\n for (const rule of rules) {\n const appliesToEmpty = rule.name === RuleName.Required || rule.name === RuleName.Accepted;\n if (empty && !appliesToEmpty) continue;\n\n const failure = check(rule, value, spec, form);\n if (failure) {\n return {\n valid: false,\n messageKey: rule.message ?? failure.messageKey,\n params: failure.params,\n };\n }\n }\n return { valid: true };\n}\n\n/**\n * Validate a whole submission. Every field is checked (not short-circuited at the first bad one) so\n * the visitor sees every problem at once instead of fixing them one reload at a time.\n */\nexport function validateForm(\n values: Record<string, unknown>,\n spec: FormSpec,\n): FormResult {\n const errors: Record<string, FieldError> = {};\n for (const field of spec.fields ?? []) {\n const result = validateField(values?.[field.name], field, values ?? {});\n if (!result.valid) {\n errors[field.name] = { messageKey: result.messageKey!, params: result.params };\n }\n }\n return { valid: Object.keys(errors).length === 0, errors };\n}\n\n/** The name of the first field with an error, in spec order — what the browser should focus. */\nexport function firstInvalidField(spec: FormSpec, errors: Record<string, FieldError>): string | null {\n for (const field of spec.fields ?? []) if (errors[field.name]) return field.name;\n return null;\n}\n\n// ─── internals ───────────────────────────────────────────────────────────────\n\n/**\n * The author's rules, plus the ones the field's own configuration implies: `required` from the\n * switch (rather than making the author add a rule for the commonest case) and the pattern implied\n * by an Email/Tel/Url control. An explicitly declared rule of the same name always wins, so an\n * author who sets their own `pattern` on an Email field is not fighting an invisible second one.\n */\nfunction effectiveRules(spec: FieldSpec): ValidationRule[] {\n const declared = spec.rules ?? [];\n const has = (name: RuleName) => declared.some(r => r.name === name);\n const implied: ValidationRule[] = [];\n\n if (spec.required && !has(RuleName.Required)) {\n // A checkbox's \"required\" means TICKED, which is a different message and a different check.\n implied.push(spec.control === ControlType.Checkbox\n ? { name: RuleName.Accepted }\n : { name: RuleName.Required });\n }\n\n const preset = IMPLIED_PATTERN[spec.control];\n if (preset && !has(RuleName.Pattern)) {\n implied.push({ name: RuleName.Pattern, params: { preset } });\n }\n\n return [...implied, ...declared];\n}\n\n/** Empty means \"the visitor gave us nothing\" — per control type, not a blanket falsy check. */\nfunction isEmpty(value: unknown, control: ControlType): boolean {\n if (value === null || value === undefined) return true;\n if (control === ControlType.Checkbox) return value === false;\n if (Array.isArray(value)) return value.length === 0;\n if (typeof value === 'string') return value.trim() === '';\n return false;\n}\n\nfunction check(\n rule: ValidationRule,\n value: unknown,\n spec: FieldSpec,\n form: Record<string, unknown>,\n): FieldError | null {\n const fail = (messageKey: string, params?: Record<string, any>): FieldError => ({ messageKey, params });\n const defaultKey = RULE_MESSAGE_KEYS[rule.name];\n const n = Number(rule.params?.['n']);\n\n switch (rule.name) {\n case RuleName.Required:\n return isEmpty(value, spec.control) ? fail(defaultKey) : null;\n\n case RuleName.Accepted:\n return value === true ? null : fail(defaultKey);\n\n case RuleName.MinLength:\n return text(value).length < n ? fail(defaultKey, { n }) : null;\n\n case RuleName.MaxLength:\n return text(value).length > n ? fail(defaultKey, { n }) : null;\n\n case RuleName.Min: {\n const num = numeric(value);\n return num === null || num < n ? fail(defaultKey, { n }) : null;\n }\n\n case RuleName.Max: {\n const num = numeric(value);\n return num === null || num > n ? fail(defaultKey, { n }) : null;\n }\n\n case RuleName.Pattern: {\n const regex = patternFor(rule);\n if (!regex) return null; // an unparsable custom regex must not block a submission\n if (regex.test(text(value))) return null;\n const preset = rule.params?.['preset'] as string | undefined;\n return fail((preset && PATTERN_MESSAGE_KEYS[preset]) || defaultKey);\n }\n\n case RuleName.Matches: {\n const other = String(rule.params?.['field'] ?? '');\n return text(value) === text(form?.[other]) ? null : fail(defaultKey, { field: other });\n }\n\n case RuleName.FileType: {\n const accepted = list(rule.params?.['types']).map(t => t.toLowerCase().replace(/^\\./, ''));\n if (!accepted.length) return null;\n const bad = files(value).some(f => {\n const ext = (f.name ?? '').split('.').pop()?.toLowerCase() ?? '';\n const mime = (f.type ?? '').toLowerCase();\n return !accepted.some(t => t === ext || mime === t || mime.startsWith(t + '/'));\n });\n return bad ? fail(defaultKey, { types: accepted.join(', ') }) : null;\n }\n\n case RuleName.FileSize: {\n const maxBytes = n * 1024 * 1024;\n return files(value).some(f => (f.size ?? 0) > maxBytes) ? fail(defaultKey, { n }) : null;\n }\n\n default:\n return null;\n }\n}\n\nfunction patternFor(rule: ValidationRule): RegExp | null {\n const preset = rule.params?.['preset'] as PatternPreset | undefined;\n if (preset && PATTERN_PRESETS[preset]) return PATTERN_PRESETS[preset];\n const custom = rule.params?.['regex'];\n if (typeof custom !== 'string' || !custom) return null;\n // A malformed regex is the AUTHOR's mistake; failing open is the only safe reading, because\n // failing closed would make a live form permanently unsubmittable for every visitor.\n try { return new RegExp(custom); } catch { return null; }\n}\n\nconst text = (value: unknown): string =>\n value === null || value === undefined ? '' : String(value).trim();\n\nfunction numeric(value: unknown): number | null {\n const parsed = typeof value === 'number' ? value : parseFloat(text(value));\n return Number.isFinite(parsed) ? parsed : null;\n}\n\nconst list = (value: unknown): string[] =>\n Array.isArray(value) ? value.map(String)\n : typeof value === 'string' ? value.split(',').map(s => s.trim()).filter(Boolean)\n : [];\n\nconst files = (value: unknown): FileLike[] =>\n Array.isArray(value) ? value as FileLike[]\n : value && typeof value === 'object' ? [value as FileLike]\n : [];\n","// Derive a FormSpec from a node tree.\n//\n// The tree the author edited is the SINGLE source of truth for \"what fields does this form have\".\n// The spec is derived from it — never maintained beside it — so a field cannot exist in one and not\n// the other. The builder runs this on save and stores the result in the page document; the backend\n// reads THAT stored spec to re-validate a submission (it must never trust a spec sent by the\n// browser). See iox-ai-guidance `architecture/builder/forms-and-inputs-plan.md` §5.1 and D11.\n\nimport {\n ControlType,\n FeedbackTiming,\n FieldSpec,\n FormSpec,\n RuleName,\n SubmitAction,\n ValidationRule,\n} from './form.model';\n\n/** The minimum a node must look like. Structural on purpose: this file knows no renderer. */\nexport interface FormNodeLike {\n type: string;\n props?: Record<string, any>;\n children?: FormNodeLike[];\n}\n\nexport const FORM_NODE_TYPE = 'Form';\nexport const FIELD_NODE_TYPE = 'Field';\n\n/** Always present, never removable — the safety net that makes \"store first, deliver after\" true. */\nexport const STORE_ACTION: SubmitAction = Object.freeze({ type: 'store' });\n\n/**\n * Turn a label into the key that arrives in the submitted data — `Full name` → `fullName`.\n * Authors never have to invent keys (decision: auto-derive, with an editable override).\n *\n * Diacritics are stripped rather than dropped, so a Hebrew or accented label still yields a usable\n * ASCII key instead of an empty one; a label with no usable characters falls back to `field`.\n */\nexport function deriveFieldName(label: string): string {\n const words = (label ?? '')\n .normalize('NFD').replace(/[̀-ͯ]/g, '')\n .replace(/[^a-zA-Z0-9]+/g, ' ')\n .trim()\n .split(/\\s+/)\n .filter(Boolean);\n if (!words.length) return 'field';\n const [first, ...rest] = words;\n const name = first.toLowerCase() + rest.map(w => w[0].toUpperCase() + w.slice(1).toLowerCase()).join('');\n // A key must not start with a digit — it ends up as an object key and a form control id.\n return /^\\d/.test(name) ? `field${name}` : name;\n}\n\n/** Make `name` unique within `taken`, appending 2, 3, … — two \"Email\" fields must not collide. */\nexport function uniqueFieldName(name: string, taken: ReadonlySet<string>): string {\n if (!taken.has(name)) return name;\n let n = 2;\n while (taken.has(`${name}${n}`)) n++;\n return `${name}${n}`;\n}\n\n/**\n * Walk a Form subtree and produce its spec.\n *\n * Nested forms are not collected: a Field belongs to its NEAREST ancestor Form (decision D1), so the\n * walk stops at any inner Form node rather than stealing its fields.\n */\nexport function collectFormSpec(node: FormNodeLike | null | undefined): FormSpec | null {\n if (!node || node.type !== FORM_NODE_TYPE) return null;\n const props = node.props ?? {};\n\n const fields: FieldSpec[] = [];\n const taken = new Set<string>();\n for (const fieldNode of collectFieldNodes(node.children ?? [])) {\n const spec = toFieldSpec(fieldNode, taken);\n taken.add(spec.name);\n fields.push(spec);\n }\n\n return {\n formId: props['formId'] ?? '',\n name: props['name'] ?? 'Form',\n feedback: (props['feedback'] as FeedbackTiming) ?? FeedbackTiming.Smart,\n fields,\n actions: normaliseActions(props['actions']),\n antiSpam: {\n honeypot: props['honeypot'] !== false,\n minFillMs: Number(props['minFillMs'] ?? 1200),\n ...(props['turnstile'] ? { turnstile: true } : {}),\n },\n ...(props['retentionDays'] ? { retention: { days: Number(props['retentionDays']) } } : {}),\n };\n}\n\n/** Every Field in this subtree, in document order, not descending into a nested Form. */\nexport function collectFieldNodes(nodes: readonly FormNodeLike[]): FormNodeLike[] {\n const out: FormNodeLike[] = [];\n for (const node of nodes ?? []) {\n if (!node?.type) continue;\n if (node.type === FORM_NODE_TYPE) continue; // a nested form owns its own fields\n if (node.type === FIELD_NODE_TYPE) { out.push(node); continue; }\n out.push(...collectFieldNodes(node.children ?? []));\n }\n return out;\n}\n\nfunction toFieldSpec(node: FormNodeLike, taken: ReadonlySet<string>): FieldSpec {\n const props = node.props ?? {};\n const label = props['label'] ?? '';\n // The author's explicit override wins; otherwise derive from the label.\n const name = uniqueFieldName(props['name'] || deriveFieldName(label), taken);\n\n const spec: FieldSpec = {\n name,\n control: (props['control'] as ControlType) ?? ControlType.Text,\n label,\n };\n if (props['required']) spec.required = true;\n const rules = normaliseRules(props['rules']);\n if (rules.length) spec.rules = rules;\n if (Array.isArray(props['options']) && props['options'].length) spec.options = props['options'];\n if (props['optionsSource']) spec.optionsSource = props['optionsSource'];\n if (props['defaultValue'] !== undefined && props['defaultValue'] !== '') {\n spec.defaultValue = props['defaultValue'];\n }\n return spec;\n}\n\n/** Drop anything that isn't a rule we know — a hand-edited page must not break validation. */\nfunction normaliseRules(raw: unknown): ValidationRule[] {\n if (!Array.isArray(raw)) return [];\n const known = new Set<string>(Object.values(RuleName));\n return raw\n .filter(r => r && known.has(r.name))\n .map(r => ({\n name: r.name as RuleName,\n ...(r.params ? { params: r.params } : {}),\n ...(r.message ? { message: r.message } : {}),\n }));\n}\n\n/** `store` is always first and always present, however the page was edited. */\nfunction normaliseActions(raw: unknown): SubmitAction[] {\n const declared: SubmitAction[] = Array.isArray(raw)\n ? raw.filter(a => a && typeof a.type === 'string')\n : [];\n return [STORE_ACTION, ...declared.filter(a => a.type !== STORE_ACTION.type)];\n}\n","// When a field's error is allowed to be VISIBLE — the pure half of the form runtime.\n//\n// Validity and visibility are different questions. A field can be invalid from the moment the page\n// loads (an empty required field always is), but showing that immediately means greeting a visitor\n// with a wall of red before they have typed anything. This module owns the second question, and it\n// owns it in one place so the builder canvas, the SSR engine and any future runtime agree.\n//\n// Framework-free, like the rest of forms-core.\n\nimport { FeedbackTiming, FormSpec } from './form.model';\nimport { FieldError, validateField, validateForm } from './validate';\n\n/** Everything the runtime needs to remember. Immutable — each transition returns a new state. */\nexport interface FormRuntimeState {\n /** Field names the visitor has left (blurred) at least once. */\n touched: ReadonlySet<string>;\n /** True once a submit has been attempted — after that, every error is fair game. */\n submitted: boolean;\n /** The current errors, whether or not they are being shown. */\n errors: Readonly<Record<string, FieldError>>;\n /** In flight — the submit button shows its loading label and the form is aria-busy. */\n submitting: boolean;\n}\n\nexport const INITIAL_FORM_STATE: FormRuntimeState = Object.freeze({\n touched: new Set<string>(),\n submitted: false,\n errors: {},\n submitting: false,\n});\n\n/**\n * Should this field's error be on screen right now?\n *\n * - `Submit` — only after a submit attempt. Quietest; nothing moves while typing.\n * - `Live` — as soon as it is invalid. Loudest; shouts at a half-typed email address.\n * - `Smart` — the default, and the reason the author gets one dropdown instead of a decision per\n * field: stay quiet until the visitor has either left the field or tried to submit.\n * After that, correct live, so fixing an error clears it as they type.\n */\nexport function shouldShowError(\n fieldName: string,\n state: FormRuntimeState,\n timing: FeedbackTiming | string = FeedbackTiming.Smart,\n): boolean {\n if (!state.errors[fieldName]) return false;\n switch (timing) {\n case FeedbackTiming.Live: return true;\n case FeedbackTiming.Submit: return state.submitted;\n default: return state.submitted || state.touched.has(fieldName);\n }\n}\n\n/**\n * Re-validate one field after a change. Only that field is re-checked, EXCEPT that a `matches` rule\n * makes another field's validity depend on this one — so a confirm-email field stops being wrong\n * the moment you fix the address it points at, rather than waiting for its own blur.\n */\nexport function onFieldChange(\n state: FormRuntimeState,\n fieldName: string,\n values: Record<string, unknown>,\n spec: FormSpec,\n): FormRuntimeState {\n const errors = { ...state.errors };\n const affected = [fieldName, ...dependentsOf(fieldName, spec)];\n\n for (const name of affected) {\n const field = (spec.fields ?? []).find(f => f.name === name);\n if (!field) continue;\n const result = validateField(values?.[name], field, values ?? {});\n if (result.valid) delete errors[name];\n else errors[name] = { messageKey: result.messageKey!, params: result.params };\n }\n return { ...state, errors };\n}\n\n/** Mark a field touched (on blur) and re-check it, so Smart timing can start showing its error. */\nexport function onFieldBlur(\n state: FormRuntimeState,\n fieldName: string,\n values: Record<string, unknown>,\n spec: FormSpec,\n): FormRuntimeState {\n const touched = new Set(state.touched);\n touched.add(fieldName);\n return { ...onFieldChange(state, fieldName, values, spec), touched };\n}\n\n/**\n * A submit attempt. Validates everything and flips `submitted`, so from here on every error shows\n * whatever the timing setting is — a visitor who pressed the button is owed the full picture.\n */\nexport function onSubmitAttempt(\n state: FormRuntimeState,\n values: Record<string, unknown>,\n spec: FormSpec,\n): FormRuntimeState {\n const { errors } = validateForm(values ?? {}, spec);\n return { ...state, submitted: true, errors };\n}\n\n/** Server-side rejection: adopt the server's errors verbatim. It is the authority, not the client. */\nexport function applyServerErrors(\n state: FormRuntimeState,\n errors: Record<string, FieldError>,\n): FormRuntimeState {\n return { ...state, submitted: true, submitting: false, errors: { ...errors } };\n}\n\n/** A clean slate after a successful submit, for a form configured to clear itself. */\nexport function resetFormState(): FormRuntimeState {\n return { touched: new Set<string>(), submitted: false, errors: {}, submitting: false };\n}\n\n/** Field names whose validity depends on `fieldName` through a `matches` rule. */\nfunction dependentsOf(fieldName: string, spec: FormSpec): string[] {\n return (spec.fields ?? [])\n .filter(f => (f.rules ?? []).some(r => r.params?.['field'] === fieldName))\n .map(f => f.name);\n}\n","/**\n * Which rules exist, and which controls they make sense on.\n *\n * The panel must not offer \"must be ticked\" on a text field, or a character limit on a date. That\n * knowledge belongs with the validator, not duplicated into the editor — otherwise the two drift and\n * an author configures a rule that silently never runs.\n *\n * Pure data, in forms-core, so the builder panel, the engine and the backend all read one catalog.\n */\n\nimport { ControlType, PatternPreset, RuleName } from './form.model';\n\n/** How a rule's parameter is edited. The panel maps these to its own controls. */\nexport enum RuleParamKind {\n /** No parameter — the rule is its own statement (`required`, `accepted`). */\n None = 'none',\n /** A single number (`{ n }`) — lengths and bounds. */\n Number = 'number',\n /** A preset regex, or a custom one (`{ preset }` / `{ regex }`). */\n Pattern = 'pattern',\n /** Another field in the same form (`{ field }`). */\n Field = 'field',\n}\n\nexport interface RuleDescriptor {\n name: RuleName;\n /** i18n key for the rule's name in the Add-rule menu. */\n labelKey: string;\n param: RuleParamKind;\n /** Controls this rule can apply to. Empty means every control. */\n controls: readonly ControlType[];\n /** Suggested starting value for the parameter, so a freshly added rule is already valid. */\n defaultParams?: Record<string, any>;\n}\n\n/** Text-ish controls: the ones whose value is a string a person typed. */\nconst TEXTUAL: readonly ControlType[] = [\n ControlType.Text, ControlType.Email, ControlType.Tel, ControlType.Url,\n ControlType.Password, ControlType.Textarea,\n];\n\n/** Controls with a comparable magnitude. */\nconst NUMERIC: readonly ControlType[] = [ControlType.Number, ControlType.Date, ControlType.Time];\n\nexport const RULE_DESCRIPTORS: readonly RuleDescriptor[] = Object.freeze([\n {\n name: RuleName.MinLength, labelKey: 'forms.rules.minLength',\n param: RuleParamKind.Number, controls: TEXTUAL, defaultParams: { n: 2 },\n },\n {\n name: RuleName.MaxLength, labelKey: 'forms.rules.maxLength',\n param: RuleParamKind.Number, controls: TEXTUAL, defaultParams: { n: 200 },\n },\n {\n name: RuleName.Min, labelKey: 'forms.rules.min',\n param: RuleParamKind.Number, controls: NUMERIC, defaultParams: { n: 0 },\n },\n {\n name: RuleName.Max, labelKey: 'forms.rules.max',\n param: RuleParamKind.Number, controls: NUMERIC, defaultParams: { n: 100 },\n },\n {\n name: RuleName.Pattern, labelKey: 'forms.rules.pattern',\n param: RuleParamKind.Pattern, controls: TEXTUAL,\n defaultParams: { preset: PatternPreset.Email },\n },\n {\n // Cross-field: confirm-email, confirm-password.\n name: RuleName.Matches, labelKey: 'forms.rules.matches',\n param: RuleParamKind.Field, controls: [],\n },\n {\n // A checkbox's `required` already becomes `accepted`, so offering it again would be a\n // duplicate — it is here for a checkbox the author wants ticked WITHOUT marking it required.\n name: RuleName.Accepted, labelKey: 'forms.rules.accepted',\n param: RuleParamKind.None, controls: [ControlType.Checkbox],\n },\n]);\n\n/** The rules that can be added to a field of this control type. */\nexport function rulesFor(control: ControlType | string): RuleDescriptor[] {\n return RULE_DESCRIPTORS.filter(rule =>\n rule.controls.length === 0 || rule.controls.includes(control as ControlType));\n}\n\n/**\n * The rules an author may still ADD — the catalog minus what is already on the field.\n *\n * Each rule appears once: two `maxLength` rules on one field is not a configuration anyone means,\n * and the validator would apply whichever came first. `pattern` is the exception a caller might\n * expect to repeat, and it deliberately does not: a second pattern can only contradict the first.\n */\nexport function addableRules(\n control: ControlType | string,\n existing: readonly { name: RuleName }[] = [],\n): RuleDescriptor[] {\n const used = new Set(existing.map(rule => rule.name));\n return rulesFor(control).filter(rule => !used.has(rule.name));\n}\n\n/** The preset options a Pattern rule offers, in the order the panel should list them. */\nexport const PATTERN_PRESET_OPTIONS: readonly { value: PatternPreset; labelKey: string }[] = Object.freeze([\n { value: PatternPreset.Email, labelKey: 'forms.rules.preset.email' },\n { value: PatternPreset.Phone, labelKey: 'forms.rules.preset.phone' },\n { value: PatternPreset.Url, labelKey: 'forms.rules.preset.url' },\n { value: PatternPreset.Digits, labelKey: 'forms.rules.preset.digits' },\n { value: PatternPreset.Letters, labelKey: 'forms.rules.preset.letters' },\n { value: PatternPreset.Slug, labelKey: 'forms.rules.preset.slug' },\n]);\n\n// ── MOVED to @vectoriox/iox-ui/actions-core (A0) ─────────────────────────────\n// The descriptor shape and the after-submit catalog are the ONE action vocabulary the whole\n// product shares; element actions (A1) consume the same shape. Re-exported here under the\n// original names so no forms consumer changes a line.\nexport type { ActionDescriptor } from '@vectoriox/iox-ui/actions-core';\nexport { FORM_SUBMIT_ACTION_DESCRIPTORS as ACTION_DESCRIPTORS, addableActions } from '@vectoriox/iox-ui/actions-core';\n","/**\n * The submit transport CONTRACT — what a host must provide to make a form actually send.\n *\n * The Form component deliberately owns no HTTP: the builder canvas must never post (an author\n * clicking Submit while designing would file a real submission), and the SSR engine posts through\n * Angular's HttpClient. What IS shared is everything around the call — the endpoint's shape, the\n * anti-spam fields, and how the server's answer maps onto the form's state. Those live here so the\n * two hosts cannot drift, and so a third host (a hand-built integration) has one thing to read.\n *\n * ⚠️ Framework-free, like the rest of forms-core. No Angular, no RxJS, no fetch.\n */\n\nimport { FieldError } from './validate';\n\n/** The field a honeypot input uses. Must match `iox-cms` `anti-spam.ts` — hence the comment there. */\nexport const HONEYPOT_FIELD = '_iox_hp';\n/** When the form was rendered, so the server can measure fill time. */\nexport const RENDERED_AT_FIELD = '_iox_t';\n\n/**\n * What the form hands its host. There is deliberately no `orgId`: the tenant is the HOST's\n * knowledge, not the form's, and a form that had to be told its org would be one more trait an\n * author could get wrong.\n */\nexport interface SubmitRequest {\n formId: string;\n values: Record<string, any>;\n}\n\n/**\n * The server's answer, normalised. Mirrors `SubmitResult` in `iox-cms`\n * `form-submissions.service.ts` — the two are one contract, so change them together.\n */\nexport interface SubmitResponse {\n ok: boolean;\n /** Per-field verdicts from the server's own validation pass, keyed by field name. */\n errors?: Record<string, FieldError>;\n /** Where to send the visitor after a successful submit, when the form has a redirect action. */\n redirect?: string;\n}\n\n/**\n * The one function a host implements. Rejecting (or throwing) means the call never reached the\n * server — the form shows its Error state, which is the honest thing to show for a dropped network.\n */\nexport type FormTransport = (request: SubmitRequest) => Promise<SubmitResponse>;\n\n/**\n * The public submit path. Built here rather than interpolated at each call site, so the engine and\n * any future host cannot disagree about it — and so changing it is one edit.\n *\n * Deliberately relative and WITHOUT a leading slash: the engine mounts under a per-org base href.\n */\nexport function submitEndpointPath(orgId: string, formId: string): string {\n return `api/site/${encodeURIComponent(orgId)}/forms/${encodeURIComponent(formId)}/submit`;\n}\n\n/**\n * Add the anti-spam fields to the collected values.\n *\n * Both are invisible to a real visitor and cost them nothing (decision D12). `renderedAt` is the\n * time the form was rendered, NOT the time of submit — the server measures the difference to catch\n * a script that fills and posts instantly.\n */\nexport function withAntiSpamFields(\n values: Record<string, any>,\n renderedAt: number,\n honeypotValue = '',\n): Record<string, any> {\n return { ...values, [HONEYPOT_FIELD]: honeypotValue, [RENDERED_AT_FIELD]: renderedAt };\n}\n\n/**\n * Normalise whatever came back into a `SubmitResponse`.\n *\n * Fails CLOSED: anything that is not a recognisable success is treated as a failure. A malformed\n * body must never show the visitor a Success state for a submission that was not stored — that is\n * the one lie this feature must not tell.\n */\nexport function interpretSubmitResponse(body: any): SubmitResponse {\n if (!body || typeof body !== 'object' || body.ok !== true) {\n return {\n ok: false,\n errors: normaliseErrors(body?.errors),\n };\n }\n const redirect = typeof body.redirect === 'string' && body.redirect.trim()\n ? body.redirect.trim()\n : undefined;\n return { ok: true, redirect };\n}\n\n/** Keep only entries that actually carry a message, so a junk key cannot blank a field's error. */\nfunction normaliseErrors(raw: any): Record<string, FieldError> | undefined {\n if (!raw || typeof raw !== 'object') return undefined;\n const errors: Record<string, FieldError> = {};\n for (const [name, value] of Object.entries(raw as Record<string, any>)) {\n const messageKey = typeof value?.messageKey === 'string' ? value.messageKey : '';\n if (!messageKey) continue;\n errors[name] = value?.params ? { messageKey, params: value.params } : { messageKey };\n }\n return Object.keys(errors).length ? errors : undefined;\n}\n","/*\n * @vectoriox/iox-ui/forms-core — the shared, FRAMEWORK-FREE core of the forms feature.\n *\n * ⚠️ Nothing in this entry point may import Angular, RxJS, the DOM, or Node. It is consumed by\n * THREE runtimes: the builder canvas (Angular), the SSR engine (Angular), and `iox-cms` (NestJS,\n * plain Node). The main `@vectoriox/iox-ui` entry pulls in `@angular/core`, which Nest must never\n * load — that is the entire reason this secondary entry point exists.\n *\n * Client-side validation is UX; server-side validation is truth. Both run THIS code, so they cannot\n * disagree. See iox-ai-guidance `architecture/builder/forms-and-inputs-plan.md` §5.\n */\n\nexport * from './form.model';\nexport * from './messages';\nexport * from './validate';\nexport * from './collect';\nexport * from './runtime';\nexport * from './rule-catalog';\nexport * from './transport';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;IACY;AAAZ,CAAA,UAAY,WAAW,EAAA;AACnB,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,WAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,WAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,WAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,WAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,WAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,WAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,WAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa;;AAEb,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB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