@vectoriox/iox-ui 4.30.2 → 4.31.1

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.
@@ -103,7 +103,10 @@ const RULE_MESSAGE_KEYS = Object.freeze({
103
103
  [RuleName.MaxLength]: `${MESSAGE_NAMESPACE}.maxLength`,
104
104
  [RuleName.Min]: `${MESSAGE_NAMESPACE}.min`,
105
105
  [RuleName.Max]: `${MESSAGE_NAMESPACE}.max`,
106
- [RuleName.Pattern]: `${MESSAGE_NAMESPACE}.pattern`,
106
+ // ⚠️ `.pattern.generic`, not `.pattern`: the preset keys below live UNDER `pattern`, and a JSON
107
+ // translation bundle cannot have the same key be both a string and an object — ngx-translate
108
+ // would hand back the object (or the raw key) for the generic case.
109
+ [RuleName.Pattern]: `${MESSAGE_NAMESPACE}.pattern.generic`,
107
110
  [RuleName.Matches]: `${MESSAGE_NAMESPACE}.matches`,
108
111
  [RuleName.Accepted]: `${MESSAGE_NAMESPACE}.accepted`,
109
112
  [RuleName.FileType]: `${MESSAGE_NAMESPACE}.fileType`,
@@ -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/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 [RuleName.Pattern]: `${MESSAGE_NAMESPACE}.pattern`,\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 * @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';\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;AACrB,CAAC,EAhBW,WAAW,KAAX,WAAW,GAAA,EAAA,CAAA,CAAA;AAkBvB;IACY;AAAZ,CAAA,UAAY,QAAQ,EAAA;AAChB,IAAA,QAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,QAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,QAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,QAAA,CAAA,SAAA,CAAA,GA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E,GAAG,MAAM,EAAE,EAAE;AAClF;AAEA;SACgB,cAAc,GAAA;AAC1B,IAAA,OAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;AAC1F;AAEA;AACA,SAAS,YAAY,CAAC,SAAiB,EAAE,IAAc,EAAA;AACnD,IAAA,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE;AACpB,SAAA,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,SAAS,CAAC;SACxE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;AACzB;;ACxHA;;;;;;;;;;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/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 * @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';\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;AACrB,CAAC,EAhBW,WAAW,KAAX,WAAW,GAAA,EAAA,CAAA,CAAA;AAkBvB;IACY;AAAZ,CAAA,UAAY,QAAQ,EAAA;AAChB,IAAA,QAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,QAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,QAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,QAAA,CAAA,SAAA,CAAA,GA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AAE,EAAE,GAAG,MAAM,EAAE,EAAE;AAClF;AAEA;SACgB,cAAc,GAAA;AAC1B,IAAA,OAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;AAC1F;AAEA;AACA,SAAS,YAAY,CAAC,SAAiB,EAAE,IAAc,EAAA;AACnD,IAAA,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE;AACpB,SAAA,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,SAAS,CAAC;SACxE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;AACzB;;ACxHA;;;;;;;;;;AAUG;;ACVH;;AAEG;;;;"}
@@ -3228,7 +3228,10 @@ const RULE_MESSAGE_KEYS = Object.freeze({
3228
3228
  [RuleName.MaxLength]: `${MESSAGE_NAMESPACE}.maxLength`,
3229
3229
  [RuleName.Min]: `${MESSAGE_NAMESPACE}.min`,
3230
3230
  [RuleName.Max]: `${MESSAGE_NAMESPACE}.max`,
3231
- [RuleName.Pattern]: `${MESSAGE_NAMESPACE}.pattern`,
3231
+ // ⚠️ `.pattern.generic`, not `.pattern`: the preset keys below live UNDER `pattern`, and a JSON
3232
+ // translation bundle cannot have the same key be both a string and an object — ngx-translate
3233
+ // would hand back the object (or the raw key) for the generic case.
3234
+ [RuleName.Pattern]: `${MESSAGE_NAMESPACE}.pattern.generic`,
3232
3235
  [RuleName.Matches]: `${MESSAGE_NAMESPACE}.matches`,
3233
3236
  [RuleName.Accepted]: `${MESSAGE_NAMESPACE}.accepted`,
3234
3237
  [RuleName.FileType]: `${MESSAGE_NAMESPACE}.fileType`,