@whatsaaaa/form-builder-schema 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["meta","meta","kinds","meta","kinds","meta","meta","kinds","meta"],"sources":["../src/errors/definition-error.ts","../src/shared/each-item.ts","../src/builder/build-field-schema.ts","../src/rules/rule-params.ts","../src/field-types/basic-types.ts","../src/field-types/define-field-type.ts","../src/field-types/choice-types.ts","../src/field-types/container-types.ts","../src/field-types/date-types.ts","../src/field-types/display-types.ts","../src/field-types/file-type.ts","../src/field-types/default-field-types.ts","../src/kinds/default-kinds.ts","../src/rules/define-rule.ts","../src/rules/param-schemas.ts","../src/rules/comparison-rules.ts","../src/rules/content-rules.ts","../src/rules/date-rules.ts","../src/rules/file-rules.ts","../src/rules/format-rules.ts","../src/rules/length-rules.ts","../src/rules/normalize-rules.ts","../src/rules/number-rules.ts","../src/rules/text-unit-rules.ts","../src/rules/default-rules.ts","../src/builder/registry.ts","../src/shared/reserved-keys.ts","../src/builder/validate-definition.ts","../src/builder/compile-definition.ts","../src/builder/build-context.ts","../src/builder/create-schema-builder.ts","../src/definition/initial-input.ts","../src/definition/walk-fields.ts"],"sourcesContent":["/** Where something is in a definition, e.g. `['fields', 0, 'rules', 1]`. */\nexport type DefinitionPath = readonly (string | number)[]\n\n/** Public API: adding a code is a minor change, renaming one is breaking. */\nexport type DefinitionIssueCode =\n | 'invalid_shape'\n | 'unsupported_version'\n | 'unknown_key'\n | 'unknown_type'\n | 'missing_name'\n | 'invalid_name'\n | 'duplicate_name'\n | 'invalid_props'\n | 'invalid_default'\n | 'unknown_rule'\n | 'unknown_param'\n | 'invalid_params'\n | 'kind_mismatch'\n\nexport interface DefinitionIssue {\n code: DefinitionIssueCode\n path: DefinitionPath\n message: string\n}\n\nexport type ValidateResult =\n | { success: true; issues: [] }\n | { success: false; issues: DefinitionIssue[] }\n\nexport function formatPath(path: DefinitionPath): string {\n return path.reduce<string>((out, key) => {\n if (typeof key === 'number') return `${out}[${key}]`\n return out ? `${out}.${key}` : key\n }, '')\n}\n\n/** Thrown by `build()` when the definition has issues. Lists all of them. */\nexport class DefinitionError extends Error {\n readonly issues: readonly DefinitionIssue[]\n\n constructor(issues: readonly DefinitionIssue[]) {\n const lines = issues.map(\n (issue) => ` ${formatPath(issue.path) || '(root)'}: ${issue.message}`,\n )\n super(`Invalid form definition:\\n${lines.join('\\n')}`)\n this.name = 'DefinitionError'\n this.issues = issues\n }\n}\n","import * as v from 'valibot'\nimport type { AnyAction, AnySchema } from './valibot-types'\n\n/**\n * Checks every item of an array with `schema` and reports the issues on the array itself.\n * Formisch keeps no field for each item of an array value, so an issue with an item's index in\n * its path would show nowhere.\n */\nexport function eachItem(schema: AnySchema): AnyAction {\n return v.rawCheck(({ dataset, config, addIssue }) => {\n if (!dataset.typed || !Array.isArray(dataset.value)) return\n for (const item of dataset.value as unknown[]) {\n const result = v.safeParse(schema, item, config as v.Config<v.BaseIssue<unknown>>)\n for (const issue of result.issues ?? []) {\n addIssue({\n message: issue.message,\n input: item,\n expected: issue.expected ?? undefined,\n received: issue.received,\n })\n }\n }\n })\n}\n","import * as v from 'valibot'\nimport type { JsonField } from '../definition/json-form-schema'\nimport type { DefinitionPath } from '../errors/definition-error'\nimport type { BuildContext } from '../field-types/field-type-def'\nimport type { RuleStage } from '../rules/rule-def'\nimport type { CheckedField } from './validate-definition'\nimport { eachItem } from '../shared/each-item'\nimport type { AnyAction, AnySchema } from '../shared/valibot-types'\n\nexport interface MessageContext {\n field: JsonField\n rule?: string\n path: DefinitionPath\n}\n\nexport interface Messages {\n required: string\n resolve(text: string, ctx: MessageContext): string\n}\n\n/**\n * The schema runs in this order: empty check, base schema, normalize rules, required check,\n * then the type's default rules and the field's rules, and last the type's `finalize()`.\n * A container has no empty check: its value is never empty.\n */\nexport function buildFieldSchema(\n checked: CheckedField,\n messages: Messages,\n ctx: BuildContext,\n): AnySchema {\n const { field, path, type, kind, valueKind } = checked\n const required = !!field.required\n const requiredMessage = messages.resolve(\n (typeof field.required === 'object' && field.required.message) || messages.required,\n { field, path },\n )\n\n // Rules for a whole value, and rules that run on each item of an array value.\n const whole: Record<RuleStage, PipeItem[]> = { normalize: [], validate: [] }\n const each: Record<RuleStage, AnyAction[]> = { normalize: [], validate: [] }\n\n for (const rule of checked.rules) {\n const message =\n rule.message === undefined\n ? undefined\n : messages.resolve(rule.message, { field, rule: rule.name, path })\n const action = rule.def.create(rule.params, message)\n const stage = rule.def.stage ?? 'validate'\n if (rule.each) {\n each[stage].push(action)\n } else {\n whole[stage].push(action)\n }\n }\n\n // Item rules run before the rules for the whole array.\n if (each.normalize.length) {\n whole.normalize.unshift(v.array(pipe(v.unknown(), each.normalize)))\n }\n if (each.validate.length) {\n whole.validate.unshift(eachItem(pipe(v.unknown(), each.validate)))\n }\n\n const finalize = type.finalize?.(field)\n if (finalize) whole.validate.push(finalize)\n\n const base = (type.schema as NonNullable<typeof type.schema>)(field, ctx)\n // The type can replace the kind's required check, e.g. a yes/no radio accepts false.\n const requiredCheck = !required\n ? undefined\n : type.required\n ? type.required(requiredMessage)\n : kind.required?.(requiredMessage)\n const head = pipe(base, requiredCheck ? [...whole.normalize, requiredCheck] : whole.normalize)\n\n if (type.container) {\n // Formisch reads the object or array schema to keep a field for each child, so nothing may\n // wrap it but optional. A missing value is read as an empty one, and the rules still run.\n // They sit in a nested pipe, so an empty required list reports only the required message.\n const rules = whole.validate.length ? [pipe(v.unknown(), whole.validate)] : []\n return v.optional(pipe(head, rules), valueKind === 'object' ? () => ({}) : () => [])\n }\n\n const empty = required\n ? v.never(requiredMessage)\n : v.pipe(\n v.unknown(),\n v.transform(() => undefined),\n )\n\n const whenFilled = (schema: AnySchema): AnySchema =>\n v.lazy((input) => (kind.isEmpty(input) ? empty : schema))\n\n const schema = whenFilled(v.pipe(head, whenFilled(pipe(v.unknown(), whole.validate))))\n\n return required ? schema : v.optional(schema)\n}\n\n/** An action, or a schema that runs on the value so far, e.g. on each item of an array. */\ntype PipeItem = AnyAction | AnySchema\n\nconst pipe = (schema: AnySchema, items: readonly PipeItem[]): AnySchema =>\n items.reduce<AnySchema>((acc, item) => v.pipe(acc, item), schema)\n","import type { AnyObjectSchema } from '../shared/valibot-types'\nimport type { ValueKind } from '../shared/value-kind'\nimport type { RuleDef } from './rule-def'\n\nconst cache = new WeakMap<RuleDef, Map<ValueKind, AnyObjectSchema>>()\n\nexport function paramsFor(def: RuleDef, kind: ValueKind): AnyObjectSchema | undefined {\n if (typeof def.params !== 'function') return def.params\n\n let byKind = cache.get(def)\n\n if (!byKind) {\n byKind = new Map()\n cache.set(def, byKind)\n }\n\n let params = byKind.get(kind)\n if (!params) {\n params = def.params(kind)\n byKind.set(kind, params)\n }\n\n return params\n}\n","import * as v from 'valibot'\nimport type { FieldTypeDef } from './field-type-def'\n\n/** Types with one plain value and no props. Each maps to a native input. */\nexport const basicTypes = {\n text: { kind: 'string', schema: () => v.string() },\n textarea: { kind: 'string', schema: () => v.string() },\n email: { kind: 'string', schema: () => v.string(), defaultRules: [{ rule: 'email' }] },\n password: { kind: 'string', schema: () => v.string() },\n url: { kind: 'string', schema: () => v.string(), defaultRules: [{ rule: 'url' }] },\n // Phone formats differ per country, so there is no default rule. Add a regex rule for yours.\n tel: { kind: 'string', schema: () => v.string() },\n number: { kind: 'number', schema: () => v.number() },\n // Required means \"must be ticked\", e.g. accepting terms.\n checkbox: { kind: 'boolean', schema: () => v.boolean() },\n} satisfies Record<string, FieldTypeDef>\n","import type { AnyObjectSchema } from '../shared/valibot-types'\nimport type { FieldTypeDef } from './field-type-def'\n\nexport const defineFieldType = <T extends AnyObjectSchema>(def: FieldTypeDef<T>): FieldTypeDef<T> =>\n def\n","import * as v from 'valibot'\nimport type { ValueKind } from '../shared/value-kind'\nimport { defineFieldType } from './define-field-type'\nimport type { FieldTypeDef } from './field-type-def'\n\ntype OptionValue = string | number | boolean\ntype Option = { value: OptionValue; label: string }\n\nconst options = <TValue extends v.GenericSchema<OptionValue>>(value: TValue) =>\n v.pipe(\n v.array(v.object({ value, label: v.string() })),\n v.minLength(1, 'Give at least one option'),\n v.check(\n (items) => new Set(items.map((item) => typeof item.value)).size <= 1,\n 'Give every option a value of the same type',\n ),\n v.check(\n (items) => new Set(items.map((item) => item.value)).size === items.length,\n 'Give every option a different value',\n ),\n )\n\nconst stringOrNumber = v.union([v.string(), v.number()])\nconst anyValue = v.union([v.string(), v.number(), v.boolean()])\n\n/** The options' value type. Every option has the same one. */\nconst kindOf = (items: readonly Option[]): ValueKind => {\n const [first] = items\n return first ? typeof first.value : 'string'\n}\n\n/** One of the option values. `v.picklist` can't hold booleans, so this is a union of literals. */\nconst oneOf = (items: readonly Option[]) => v.union(items.map((item) => v.literal(item.value)))\n\nexport const choiceTypes = {\n select: defineFieldType({\n kind: (field) => (field.options ? kindOf(field.options) : (field.valueType ?? 'string')),\n props: v.object({\n options: v.optional(options(stringOrNumber)),\n /** The value's type while `options` is missing, e.g. until they load from an API. */\n valueType: v.optional(v.picklist(['string', 'number'])),\n }),\n schema: (field) => {\n if (field.options) return oneOf(field.options)\n return field.valueType === 'number' ? v.number() : v.string()\n },\n }),\n radio: defineFieldType({\n kind: (field) => kindOf(field.options),\n props: v.object({ options: options(anyValue) }),\n schema: (field) => oneOf(field.options),\n // Any option counts as an answer, so a required yes/no radio accepts \"no\". The empty check\n // already rejects a radio with nothing picked.\n required: () => null,\n }),\n // A checkbox group is a multiselect with `ui: { widget: 'checkboxes' }`.\n multiselect: defineFieldType({\n kind: 'array',\n itemKind: (field) => kindOf(field.options),\n props: v.object({ options: options(stringOrNumber) }),\n schema: (field) => v.array(oneOf(field.options)),\n }),\n} satisfies Record<string, FieldTypeDef>\n","import * as v from 'valibot'\nimport type { JsonField } from '../definition/json-form-schema'\nimport { defineFieldType } from './define-field-type'\nimport type { FieldTypeDef } from './field-type-def'\n\n// The builder checks child fields itself, at their own paths, so the props take any value here.\nconst childField = v.custom<JsonField>(() => true)\n\n/** Types whose value holds other fields. Display elements can go inside them too. */\nexport const containerTypes = {\n // An object with a key for each of its fields. It is always there, so it can't be required.\n group: defineFieldType({\n kind: 'object',\n container: true,\n props: v.object({ fields: v.array(childField) }),\n schema: (field, ctx) => ctx.buildFields(field.fields, [...ctx.path, 'fields']),\n }),\n // A list. `of` is the field of a list of single values, such as tags; its name isn't used.\n // `fields` makes a list of objects, such as order lines. Rules like minLength count the items.\n array: defineFieldType({\n kind: 'array',\n container: true,\n props: v.pipe(\n v.object({ of: v.optional(childField), fields: v.optional(v.array(childField)) }),\n v.check(\n (props) => (props.of === undefined) !== (props.fields === undefined),\n 'Give exactly one of \"of\" and \"fields\"',\n ),\n ),\n schema: (field, ctx) =>\n v.array(\n field.of\n ? ctx.buildField(field.of, [...ctx.path, 'of'])\n : ctx.buildFields(field.fields ?? [], [...ctx.path, 'fields']),\n ),\n }),\n} satisfies Record<string, FieldTypeDef>\n","import * as v from 'valibot'\nimport { defineFieldType } from './define-field-type'\nimport type { FieldTypeDef } from './field-type-def'\n\nconst outputProps = v.object({\n /** `'date'` turns the ISO string into a `Date`. Defaults to `'string'`. */\n output: v.optional(v.picklist(['string', 'date'])),\n})\n\n// Runs after every rule, so comparison rules like minValue still compare ISO strings.\nconst finalize = (field: v.InferOutput<typeof outputProps>) =>\n field.output === 'date' ? v.toDate() : undefined\n\n/**\n * Dates and times are ISO strings, the values of <input type=\"date|time|datetime-local\">.\n * The format is part of the type rather than a default rule, so these types don't depend on\n * `dateRules` being registered.\n */\nexport const dateTypes = {\n date: defineFieldType({\n kind: 'date',\n props: outputProps,\n schema: () => v.pipe(v.string(), v.isoDate()),\n finalize,\n }),\n time: { kind: 'date', schema: () => v.pipe(v.string(), v.isoTime()) },\n // A local date and time without a time zone, e.g. 2026-10-28T14:30.\n datetime: defineFieldType({\n kind: 'date',\n props: outputProps,\n schema: () => v.pipe(v.string(), v.isoDateTime()),\n finalize,\n }),\n} satisfies Record<string, FieldTypeDef>\n","import * as v from 'valibot'\nimport { defineFieldType } from './define-field-type'\nimport type { FieldTypeDef } from './field-type-def'\n\n/**\n * Elements without a value. They need no name and add no output key. Their `text` can be an\n * i18n key: renderers resolve it with the same function they pass as `resolveMessage`.\n */\nexport const displayTypes = {\n heading: defineFieldType({\n kind: 'none',\n props: v.object({\n text: v.string(),\n /** 1 to 6. Defaults to 2. */\n level: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(6))),\n }),\n }),\n // Plain text. Whether to render markdown is up to the renderer.\n paragraph: defineFieldType({ kind: 'none', props: v.object({ text: v.string() }) }),\n divider: { kind: 'none' },\n} satisfies Record<string, FieldTypeDef>\n","import * as v from 'valibot'\nimport { eachItem } from '../shared/each-item'\nimport { defineFieldType } from './define-field-type'\n\ntype MimeType = `${string}/${string}`\n\nconst mimeTypes = (accept: string) => accept.split(',').map((type) => type.trim()) as MimeType[]\n\nconst fileProps = v.object({\n multiple: v.optional(v.boolean()),\n // A File only carries its MIME type, so extensions (.pdf) and wildcards (image/*) can't be\n // checked against it.\n accept: v.optional(\n v.pipe(\n v.string(),\n v.check(\n (input) => mimeTypes(input).every((type) => /^[\\w.+-]+\\/[\\w.+-]+$/.test(type)),\n 'Use MIME types separated by commas, such as image/png,image/jpeg',\n ),\n ),\n ),\n})\n\n/**\n * A File, or an array of them with `multiple`. Rules for files, like `maxSize`, run on each one;\n * rules for arrays, like `maxLength`, limit the count.\n */\nexport const fileType = defineFieldType({\n kind: (field) => (field.multiple ? 'array' : 'file'),\n itemKind: 'file',\n props: fileProps,\n // The schema is created per field and v.file() only reads the File global while parsing, so\n // the package still loads where File doesn't exist.\n schema: (field) => {\n const file = field.accept ? v.pipe(v.file(), v.mimeType(mimeTypes(field.accept))) : v.file()\n if (!field.multiple) return file\n // Checking each file after the array keeps the issues on the field, not on its items.\n return field.accept ? v.pipe(v.array(v.file()), eachItem(file)) : v.array(file)\n },\n})\n","import { basicTypes } from './basic-types'\nimport { choiceTypes } from './choice-types'\nimport { containerTypes } from './container-types'\nimport { dateTypes } from './date-types'\nimport { displayTypes } from './display-types'\nimport { fileType } from './file-type'\nimport type { FieldTypeDef } from './field-type-def'\n\n/** Every built-in field type. */\nexport const defaultFieldTypes = {\n ...basicTypes,\n ...dateTypes,\n ...choiceTypes,\n file: fileType,\n ...displayTypes,\n ...containerTypes,\n} satisfies Record<string, FieldTypeDef>\n","import * as v from 'valibot'\nimport type { KindDef } from './kind-def'\n\nconst isNil = (input: unknown) => input === undefined || input === null\n\nexport const defaultKinds = {\n string: {\n isEmpty: (input) => isNil(input) || input === '',\n required: (message) => v.nonEmpty(message),\n },\n // A cleared <input type=\"number\"/> holds '' or NaN, depending on the adapter.\n number: {\n isEmpty: (input) => isNil(input) || input === '' || Number.isNaN(input),\n },\n // Required means \"must be ticked\", e.g accepting terms.\n boolean: {\n isEmpty: isNil,\n required: (message) => v.value(true, message),\n },\n date: {\n isEmpty: (input) => isNil(input) || input === '',\n required: (message) => v.nonEmpty(message),\n },\n array: {\n isEmpty: (input) => isNil(input) || (Array.isArray(input) && input.length === 0),\n required: (message) => v.minLength(1, message),\n },\n file: { isEmpty: isNil },\n object: { isEmpty: isNil },\n // Display elements (headings, dividers) have no value, so the builder never calls this.\n none: { isEmpty: () => true },\n} satisfies Record<string, KindDef>\n","import type { AnyObjectSchema } from '../shared/valibot-types'\nimport type { RuleDef } from './rule-def'\n\nexport const defineRule = <T extends AnyObjectSchema>(def: RuleDef<T>): RuleDef<T> => def\n","import * as v from 'valibot'\nimport type { ValueKind } from '../shared/value-kind'\n\n/** A length, count or size: a whole number from 0. */\nexport const count = v.pipe(v.number(), v.integer(), v.minValue(0))\n\nexport const countParams = v.object({ value: count })\n\nconst isIsoValue = (input: string) =>\n v.ISO_DATE_REGEX.test(input) || v.ISO_DATE_TIME_REGEX.test(input) || v.ISO_TIME_REGEX.test(input)\n\n/** Valibot compares dates as ISO strings, so the param must be one too. */\nexport const isoValue = v.pipe(\n v.string(),\n v.check(isIsoValue, 'Use an ISO date, date-time or time, such as 2026-01-01'),\n)\n\nexport const valueSchema = (kind: ValueKind) => {\n switch (kind) {\n case 'date':\n return isoValue\n case 'string':\n return v.string()\n case 'boolean':\n return v.boolean()\n default:\n return v.number()\n }\n}\n","import * as v from 'valibot'\nimport type { AnyAction } from '../shared/valibot-types'\nimport type { ValueKind } from '../shared/value-kind'\nimport { defineRule } from './define-rule'\nimport { valueSchema } from './param-schemas'\nimport type { RuleDef } from './rule-def'\n\ntype Value = string | number | boolean\n\nconst ordered = ['number', 'date'] as const\nconst any = ['number', 'date', 'string', 'boolean'] as const\nconst meta = (label: string) => ({ label, category: 'comparison' }) as const\n\n// The param has the field's type: a number on a number field, an ISO string on a date field.\nconst valueParams = (kind: ValueKind) => v.object({ value: valueSchema(kind) })\nconst valuesParams = (kind: ValueKind) =>\n v.object({\n values: v.pipe(v.array(valueSchema(kind)), v.minLength(1, 'Give at least one value')),\n })\n\n/** Compares the value with a param of the same type. */\nexport const comparisonRules = {\n minValue: defineRule({\n kinds: ordered,\n params: valueParams,\n meta: meta('Minimum'),\n create: (p, m) => v.minValue(p.value as Value, m) as AnyAction,\n }),\n maxValue: defineRule({\n kinds: ordered,\n params: valueParams,\n meta: meta('Maximum'),\n create: (p, m) => v.maxValue(p.value as Value, m) as AnyAction,\n }),\n gtValue: defineRule({\n kinds: ordered,\n params: valueParams,\n meta: meta('Greater than'),\n create: (p, m) => v.gtValue(p.value as Value, m) as AnyAction,\n }),\n ltValue: defineRule({\n kinds: ordered,\n params: valueParams,\n meta: meta('Less than'),\n create: (p, m) => v.ltValue(p.value as Value, m) as AnyAction,\n }),\n value: defineRule({\n kinds: any,\n params: valueParams,\n meta: meta('Equals'),\n create: (p, m) => v.value(p.value as Value, m) as AnyAction,\n }),\n notValue: defineRule({\n kinds: any,\n params: valueParams,\n meta: meta('Does not equal'),\n create: (p, m) => v.notValue(p.value as Value, m) as AnyAction,\n }),\n values: defineRule({\n kinds: ordered,\n params: valuesParams,\n meta: meta('One of'),\n create: (p, m) => v.values(p.values as Value[], m) as AnyAction,\n }),\n notValues: defineRule({\n kinds: ordered,\n params: valuesParams,\n meta: meta('None of'),\n create: (p, m) => v.notValues(p.values as Value[], m) as AnyAction,\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport type { ValueKind } from '../shared/value-kind'\nimport { defineRule } from './define-rule'\nimport type { AnyAction } from '../shared/valibot-types'\nimport type { RuleDef } from './rule-def'\n\nconst meta = (label: string, description?: string) =>\n ({ label, description, category: 'content' }) as const\n\nconst regexError = (pattern: string, flags = '') => {\n try {\n new RegExp(pattern, flags)\n return undefined\n } catch (error) {\n return (error as Error).message\n }\n}\n\nconst FLAGS = /^[dgimsuvy]*$/\n\nconst regexParams = v.pipe(\n v.object({\n pattern: v.string(),\n flags: v.optional(v.pipe(v.string(), v.regex(FLAGS, 'Flags can be d, g, i, m, s, u, v and y'))),\n }),\n v.forward(\n v.check(\n (p) => !FLAGS.test(p.flags ?? '') || regexError(p.pattern, p.flags) === undefined,\n (issue) => regexError(issue.input.pattern, issue.input.flags) ?? 'Invalid pattern',\n ),\n ['pattern'],\n ),\n)\n\nconst item = v.union([v.string(), v.number(), v.boolean()])\nconst stringParams = v.object({ value: v.string() })\nconst contentParams = (kind: ValueKind) => v.object({ value: kind === 'array' ? item : v.string() })\n\nexport const contentRules = {\n regex: defineRule({\n kinds: ['string'],\n params: regexParams,\n meta: meta('Matches pattern', 'A JavaScript regular expression, without the slashes.'),\n create: (p, m) => v.regex(new RegExp(p.pattern, p.flags?.replace(/[gy]/g, '')), m),\n }),\n startsWith: defineRule({\n kinds: ['string'],\n params: stringParams,\n meta: meta('Starts with'),\n create: (p, m) => v.startsWith(p.value, m),\n }),\n endsWith: defineRule({\n kinds: ['string'],\n params: stringParams,\n meta: meta('Ends with'),\n create: (p, m) => v.endsWith(p.value, m),\n }),\n includes: defineRule({\n kinds: ['string', 'array'],\n params: contentParams,\n meta: meta('Contains'),\n create: (p, m) => v.includes(p.value, m) as AnyAction,\n }),\n excludes: defineRule({\n kinds: ['string', 'array'],\n params: contentParams,\n meta: meta('Does not contain'),\n create: (p, m) => v.excludes(p.value, m) as AnyAction,\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport type { AnyAction } from '../shared/valibot-types'\nimport { defineRule } from './define-rule'\nimport type { RuleDef } from './rule-def'\n\nconst iso = (label: string, description: string, create: (message?: string) => AnyAction) =>\n defineRule({\n kinds: ['string', 'date'],\n meta: { label, description, category: 'date' },\n create: (_, message) => create(message),\n })\n\nexport const dateRules = {\n isoDate: iso('ISO date', 'Like 2026-10-28', (m) => v.isoDate(m)),\n isoDateTime: iso('ISO date and time', 'Like 2026-10-28T14:30', (m) => v.isoDateTime(m)),\n isoTime: iso('ISO time', 'Like 14:30', (m) => v.isoTime(m)),\n isoTimeSecond: iso('ISO time with seconds', 'Like 14:30:15', (m) => v.isoTimeSecond(m)),\n isoTimestamp: iso('ISO timestamp', 'Like 2026-10-28T14:30:15.000z', (m) => v.isoTimestamp(m)),\n isoWeek: iso('ISO week', 'Like 2026-W44', (m) => v.isoWeek(m)),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport { defineRule } from './define-rule'\nimport { countParams } from './param-schemas'\nimport type { RuleDef } from './rule-def'\n\nconst kinds = ['file'] as const\nconst meta = (label: string, description?: string) =>\n ({ label, description, category: 'file' }) as const\nconst bytes = 'In bytes, e.g. 1048576 for 1 MiB.'\n\ntype MimeType = `${string}/${string}`\n\n// A File only carries its MIME type, and Valibot compares it exactly, so image/* can't work.\nconst mimeTypeParams = v.object({\n types: v.pipe(\n v.array(\n v.pipe(v.string(), v.regex(/^[\\w.+-]+\\/[\\w.+-]+$/, 'Use a MIME type, such as image/png')),\n ),\n v.minLength(1, 'Give at least one MIME type'),\n ),\n})\n\n/** Size and type of a File or Blob. */\nexport const fileRules = {\n minSize: defineRule({\n kinds,\n params: countParams,\n meta: meta('Minimum size', bytes),\n create: (p, m) => v.minSize(p.value, m),\n }),\n maxSize: defineRule({\n kinds,\n params: countParams,\n meta: meta('Maximum size', bytes),\n create: (p, m) => v.maxSize(p.value, m),\n }),\n size: defineRule({\n kinds,\n params: countParams,\n meta: meta('Exact size', bytes),\n create: (p, m) => v.size(p.value, m),\n }),\n notSize: defineRule({\n kinds,\n params: countParams,\n meta: meta('Not this size', bytes),\n create: (p, m) => v.notSize(p.value, m),\n }),\n mimeType: defineRule({\n kinds,\n params: mimeTypeParams,\n meta: meta('File type'),\n create: (p, m) => v.mimeType(p.types as MimeType[], m),\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport type { AnyAction } from '../shared/valibot-types'\nimport { defineRule } from './define-rule'\nimport type { RuleDef } from './rule-def'\n\n/** A string format without params. */\nconst format = (label: string, create: (message?: string) => AnyAction) =>\n defineRule({\n kinds: ['string'],\n meta: { label, category: 'format' },\n create: (_, message) => create(message),\n })\n\n/** Valibot's hash types. Valibot doesn't export the list, only the type. */\nconst HASH_TYPES = [\n 'md4',\n 'md5',\n 'sha1',\n 'sha256',\n 'sha384',\n 'sha512',\n 'ripemd128',\n 'ripemd160',\n 'tiger128',\n 'tiger160',\n 'tiger192',\n 'crc32',\n 'crc32b',\n 'adler32',\n] as const satisfies readonly v.HashType[]\n\nconst hashParams = v.object({\n types: v.pipe(v.array(v.picklist(HASH_TYPES)), v.minLength(1, 'Pick at least one hash type')),\n})\n\n/** Formats Valibot can check on a string. */\nexport const formatRules = {\n email: format('Email', (m) => v.email(m)),\n rfcEmail: format('Email (RFC 5322)', (m) => v.rfcEmail(m)),\n url: format('URL', (m) => v.url(m)),\n domain: format('Domain', (m) => v.domain(m)),\n slug: format('Slug', (m) => v.slug(m)),\n uuid: format('UUID', (m) => v.uuid(m)),\n ulid: format('ULID', (m) => v.ulid(m)),\n cuid2: format('CUID2', (m) => v.cuid2(m)),\n nanoid: format('Nano ID', (m) => v.nanoid(m)),\n ip: format('IP address', (m) => v.ip(m)),\n ipv4: format('IPv4 address', (m) => v.ipv4(m)),\n ipv6: format('IPv6 address', (m) => v.ipv6(m)),\n mac: format('MAC address', (m) => v.mac(m)),\n mac48: format('MAC-48 address', (m) => v.mac48(m)),\n mac64: format('MAC-64 address', (m) => v.mac64(m)),\n hexColor: format('Hex colour', (m) => v.hexColor(m)),\n hexadecimal: format('Hexadecimal', (m) => v.hexadecimal(m)),\n octal: format('Octal', (m) => v.octal(m)),\n decimal: format('Decimal number', (m) => v.decimal(m)),\n digits: format('Digits only', (m) => v.digits(m)),\n base64: format('Base64', (m) => v.base64(m)),\n bic: format('BIC (SWIFT code)', (m) => v.bic(m)),\n creditCard: format('Credit card number', (m) => v.creditCard(m)),\n imei: format('IMEI', (m) => v.imei(m)),\n isbn: format('ISBN', (m) => v.isbn(m)),\n isrc: format('ISRC', (m) => v.isrc(m)),\n emoji: format('Emoji', (m) => v.emoji(m)),\n hash: defineRule({\n kinds: ['string'],\n params: hashParams,\n meta: { label: 'Hash', category: 'format' },\n create: (p, m) => v.hash(p.types as [v.HashType, ...v.HashType[]], m),\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport { defineRule } from './define-rule'\nimport { countParams } from './param-schemas'\nimport type { RuleDef } from './rule-def'\n\nconst kinds = ['string', 'array'] as const\nconst meta = (label: string) => ({ label, category: 'length' }) as const\n\n/** Characters of a string, or items of an array */\nexport const lengthRules = {\n length: defineRule({\n kinds,\n params: countParams,\n meta: meta('Exact length'),\n create: (p, m) => v.length(p.value, m),\n }),\n minLength: defineRule({\n kinds,\n params: countParams,\n meta: meta('Minimum length'),\n create: (p, m) => v.minLength(p.value, m),\n }),\n maxLength: defineRule({\n kinds,\n params: countParams,\n meta: meta('Maximum length'),\n create: (p, m) => v.maxLength(p.value, m),\n }),\n notLength: defineRule({\n kinds,\n params: countParams,\n meta: meta('Not this length'),\n create: (p, m) => v.notLength(p.value, m),\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport { defineRule } from './define-rule'\nimport type { RuleDef } from './rule-def'\n\nconst stage = 'normalize'\nconst meta = (label: string, description?: string) =>\n ({ label, description, category: 'normalize' }) as const\nconst limit = v.object({ value: v.number() })\n\n/**\n * Rules that change the value instead of checking it. They run before the required check, so\n * `' '` with `trim` is empty. Their `message` is never shown.\n */\nexport const normalizeRules = {\n trim: defineRule({ kinds: ['string'], stage, meta: meta('Trim'), create: () => v.trim() }),\n trimStart: defineRule({\n kinds: ['string'],\n stage,\n meta: meta('Trim start'),\n create: () => v.trimStart(),\n }),\n trimEnd: defineRule({\n kinds: ['string'],\n stage,\n meta: meta('Trim end'),\n create: () => v.trimEnd(),\n }),\n toLowerCase: defineRule({\n kinds: ['string'],\n stage,\n meta: meta('Lowercase'),\n create: () => v.toLowerCase(),\n }),\n toUpperCase: defineRule({\n kinds: ['string'],\n stage,\n meta: meta('Uppercase'),\n create: () => v.toUpperCase(),\n }),\n normalize: defineRule({\n kinds: ['string'],\n stage,\n params: v.object({ form: v.optional(v.picklist(['NFC', 'NFD', 'NFKC', 'NFKD'])) }),\n meta: meta('Unicode normalize', 'Defaults to NFC.'),\n create: (p) => v.normalize(p.form),\n }),\n toMinValue: defineRule({\n kinds: ['number'],\n stage,\n params: limit,\n meta: meta('Raise to minimum', 'Replaces a smaller number with the minimum.'),\n create: (p) => v.toMinValue(p.value),\n }),\n toMaxValue: defineRule({\n kinds: ['number'],\n stage,\n params: limit,\n meta: meta('Lower to maximum', 'Replaces a larger number with the maximum.'),\n create: (p) => v.toMaxValue(p.value),\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport { defineRule } from './define-rule'\nimport type { RuleDef } from './rule-def'\n\nconst kinds = ['number'] as const\nconst meta = (label: string) => ({ label, category: 'number' }) as const\n\nconst divisor = v.pipe(v.number(), v.finite(), v.notValue(0, \"Can't be 0\"))\n\n/** Checks only numbers have. */\nexport const numberRules = {\n integer: defineRule({ kinds, meta: meta('Whole number'), create: (_, m) => v.integer(m) }),\n safeInteger: defineRule({\n kinds,\n meta: meta('Safe whole number'),\n create: (_, m) => v.safeInteger(m),\n }),\n finite: defineRule({ kinds, meta: meta('Finite number'), create: (_, m) => v.finite(m) }),\n multipleOf: defineRule({\n kinds,\n params: v.object({ value: divisor }),\n meta: meta('Multiple of'),\n create: (p, m) => v.multipleOf(p.value, m),\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport { count, countParams } from './param-schemas'\nimport { defineRule } from './define-rule'\nimport type { RuleDef } from './rule-def'\n\nconst kinds = ['string'] as const\nconst meta = (label: string, description?: string) =>\n ({ label, description, category: 'text' }) as const\n\nconst isLocale = (input: string) => {\n try {\n return Intl.getCanonicalLocales(input).length === 1\n } catch {\n return false\n }\n}\n\nconst wordsParams = v.object({\n locale: v.optional(\n v.pipe(v.string(), v.check(isLocale, 'Use a language tag, such as en or sr-Latn')),\n ),\n value: count,\n})\n\nconst graphemesInfo = 'Counts characters as people see them, so an emoji is one.'\nconst bytesInfo = 'Counts UTF-8 bytes, e.g. to fit a database column,'\n\nexport const textUnitRules = {\n graphemes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Exact characters', graphemesInfo),\n create: (p, m) => v.graphemes(p.value, m),\n }),\n minGraphemes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Minimum characters', graphemesInfo),\n create: (p, m) => v.minGraphemes(p.value, m),\n }),\n maxGraphemes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Maximum characters', graphemesInfo),\n create: (p, m) => v.maxGraphemes(p.value, m),\n }),\n notGraphemes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Not this many characters', graphemesInfo),\n create: (p, m) => v.notGraphemes(p.value, m),\n }),\n words: defineRule({\n kinds,\n params: wordsParams,\n meta: meta('Exact words'),\n create: (p, m) => v.words(p.locale, p.value, m),\n }),\n minWords: defineRule({\n kinds,\n params: wordsParams,\n meta: meta('Minimum words'),\n create: (p, m) => v.minWords(p.locale, p.value, m),\n }),\n maxWords: defineRule({\n kinds,\n params: wordsParams,\n meta: meta('Maximum words'),\n create: (p, m) => v.maxWords(p.locale, p.value, m),\n }),\n notWords: defineRule({\n kinds,\n params: wordsParams,\n meta: meta('Not this many words'),\n create: (p, m) => v.notWords(p.locale, p.value, m),\n }),\n bytes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Exact bytes', bytesInfo),\n create: (p, m) => v.bytes(p.value, m),\n }),\n minBytes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Minimum bytes', bytesInfo),\n create: (p, m) => v.minBytes(p.value, m),\n }),\n maxBytes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Maximum bytes', bytesInfo),\n create: (p, m) => v.maxBytes(p.value, m),\n }),\n notBytes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Not this many bytes', bytesInfo),\n create: (p, m) => v.notBytes(p.value, m),\n }),\n} satisfies Record<string, RuleDef>\n","import { comparisonRules } from './comparison-rules'\nimport { contentRules } from './content-rules'\nimport { dateRules } from './date-rules'\nimport { fileRules } from './file-rules'\nimport { formatRules } from './format-rules'\nimport { lengthRules } from './length-rules'\nimport { normalizeRules } from './normalize-rules'\nimport { numberRules } from './number-rules'\nimport { textUnitRules } from './text-unit-rules'\n\n/** Every built-in rule. Register single families with `includeDefaultRules: false`. */\nexport const defaultRules = {\n ...lengthRules,\n ...textUnitRules,\n ...contentRules,\n ...formatRules,\n ...dateRules,\n ...comparisonRules,\n ...numberRules,\n ...fileRules,\n ...normalizeRules,\n}\n","import { defaultFieldTypes } from '../field-types/default-field-types'\nimport type { FieldTypeDef } from '../field-types/field-type-def'\nimport { defaultKinds } from '../kinds/default-kinds'\nimport type { KindDef } from '../kinds/kind-def'\nimport { defaultRules } from '../rules/default-rules'\nimport type { RuleDef } from '../rules/rule-def'\n\nexport interface Registry {\n readonly kinds: Readonly<Record<string, KindDef>>\n readonly fieldTypes: Readonly<Record<string, FieldTypeDef>>\n readonly rules: Readonly<Record<string, RuleDef>>\n}\n\nexport interface RegistryOptions extends Partial<Registry> {\n /** With false, only the consumer's own rules are registered. Defaults to true. */\n includeDefaultRules?: boolean\n}\n\n/** Consumer entries replace defaults with the same key. */\nexport function mergeRegistry(custom: RegistryOptions): Registry {\n const rules = custom.includeDefaultRules === false ? {} : defaultRules\n return {\n kinds: Object.freeze({ ...defaultKinds, ...custom.kinds }),\n fieldTypes: Object.freeze({ ...defaultFieldTypes, ...custom.fieldTypes }),\n rules: Object.freeze({ ...rules, ...custom.rules }),\n }\n}\n\nexport function lookup<T>(record: Readonly<Record<string, T>>, key: string): T | undefined {\n return Object.hasOwn(record, key) ? record[key] : undefined\n}\n","/**\n * Field keys this package owns. A field type's props can't use them.\n */\nexport const RESERVED_FIELD_KEYS = [\n 'name',\n 'type',\n 'label',\n 'description',\n 'placeholder',\n 'default',\n 'required',\n 'rules',\n 'ui',\n] as const\n\n/**\n * Rule keys this package owns. A rule's params can't use them.\n */\nexport const RESERVED_RULE_KEYS = ['rule', 'message'] as const\n\nconst fieldKeys: ReadonlySet<string> = new Set(RESERVED_FIELD_KEYS)\nconst ruleKeys: ReadonlySet<string> = new Set(RESERVED_RULE_KEYS)\n\nexport const isReservedFieldKey = (key: string): boolean => fieldKeys.has(key)\nexport const isReservedRuleKey = (key: string): boolean => ruleKeys.has(key)\n","import * as v from 'valibot'\nimport type { JsonField, JsonRule } from '../definition/json-form-schema'\nimport {\n type DefinitionPath,\n type DefinitionIssue,\n type DefinitionIssueCode,\n formatPath,\n} from '../errors/definition-error'\nimport type { FieldTypeDef, KindOf } from '../field-types/field-type-def'\nimport type { KindDef } from '../kinds/kind-def'\nimport type { RuleDef } from '../rules/rule-def'\nimport { paramsFor } from '../rules/rule-params'\nimport { lookup, type Registry } from './registry'\nimport { isReservedFieldKey, isReservedRuleKey } from '../shared/reserved-keys'\nimport type { ValueKind } from '../shared/value-kind'\n\nexport interface CheckedField {\n /** Undefined for the field of a list's items, which has no name. */\n name: string | undefined\n field: JsonField\n path: DefinitionPath\n type: FieldTypeDef\n kind: KindDef\n /** The name of the kind, e.g. `'array'`. */\n valueKind: ValueKind\n rules: CheckedRule[]\n}\n\nexport interface CheckedRule {\n name: string\n def: RuleDef\n params: Record<string, unknown>\n message?: string\n /** True when the rule runs on each item of an array value, not on the array. */\n each: boolean\n}\n\n/** The kind of a field's value, and of its items when the value is an array. */\nexport interface FieldKinds {\n kind: ValueKind\n itemKind?: ValueKind\n}\n\nconst fieldShape = v.looseObject({\n name: v.optional(v.string()),\n type: v.string(),\n label: v.optional(v.string()),\n description: v.optional(v.string()),\n placeholder: v.optional(v.string()),\n default: v.optional(v.unknown()),\n required: v.optional(v.union([v.boolean(), v.strictObject({ message: v.optional(v.string()) })])),\n rules: v.optional(v.array(v.unknown())),\n ui: v.optional(v.record(v.string(), v.unknown())),\n})\nconst ruleShape = v.looseObject({ rule: v.string(), message: v.optional(v.string()) })\nconst noParams = v.object({})\n\n/**\n * Checks one field's shape, name, type, props and rules, and adds its issues to `issues`.\n * Returns the field ready to build, or undefined when it has issues or no value.\n *\n * `names` holds the names used so far at this level. It is undefined for the field of a list's\n * items, which needs no name.\n */\nexport function checkField(\n raw: unknown,\n path: DefinitionPath,\n registry: Registry,\n names: Set<string> | undefined,\n issues: DefinitionIssue[],\n): CheckedField | undefined {\n const shape = v.safeParse(fieldShape, raw)\n if (!shape.success) {\n issues.push(...toIssues('invalid_shape', path, shape.issues))\n return undefined\n }\n\n const field = shape.output as JsonField\n const issueCount = issues.length\n const type = lookup(registry.fieldTypes, field.type)\n // Only a fixed kind can be 'none'. A kind() function that returns it throws in kindDef.\n const hasValue = type?.kind !== 'none'\n\n if (!names) {\n // The field of a list's items has no name.\n } else if (!field.name) {\n if (type && hasValue) {\n issues.push(issue('missing_name', [...path, 'name'], 'A field needs a name'))\n }\n } else if (hasValue) {\n // A name is one key of the value. Paths like 'address.city' and 'lines[0]' use these as\n // separators.\n if (/[.[\\]]/.test(field.name)) {\n const message = `Name \"${field.name}\" can't contain \".\", \"[\" or \"]\"`\n issues.push(issue('invalid_name', [...path, 'name'], message))\n }\n if (names.has(field.name)) {\n issues.push(issue('duplicate_name', [...path, 'name'], `Duplicate name \"${field.name}\"`))\n }\n names.add(field.name)\n }\n\n if (!type) {\n issues.push(issue('unknown_type', [...path, 'type'], `Unknown field type \"${field.type}\"`))\n return undefined\n }\n\n const props = checkProps(field, type, path, issues)\n\n if (!hasValue) {\n for (const key of ['required', 'rules'] as const) {\n if (field[key] !== undefined) {\n const message = `A \"${field.type}\" field has no value, so it can't have \"${key}\"`\n issues.push(issue('invalid_shape', [...path, key], message))\n }\n }\n if (!names) {\n const message = `A list's items need a value, and a \"${field.type}\" field has none`\n issues.push(issue('invalid_shape', [...path, 'type'], message))\n }\n return undefined\n }\n\n // A kind that comes from a function needs the parsed props. Without them, the rules can't be\n // checked either; the props issues are reported already.\n const withProps = props && { ...field, ...props }\n const kind = resolveKind(type.kind, withProps)\n if (kind === undefined) return undefined\n const kinds: FieldKinds = {\n kind,\n itemKind: kind === 'array' ? resolveKind(type.itemKind, withProps) : undefined,\n }\n\n // A group is always there, and its fields decide what is required.\n if (type.container && kind === 'object') {\n for (const key of ['required', 'default'] as const) {\n if (field[key] !== undefined) {\n const message = `A \"${field.type}\" field is always there, so it can't have \"${key}\"`\n issues.push(issue('invalid_shape', [...path, key], message))\n }\n }\n }\n\n const fieldRules = (shape.output.rules ?? []).flatMap(\n (rule, j) => checkRule(rule, kinds, [...path, 'rules', j], registry, issues) ?? [],\n )\n if (issues.length > issueCount || (names && !field.name) || !withProps) return undefined\n\n const overridden = new Set(fieldRules.map((rule) => rule.name))\n const defaultRules = checkDefaultRules(field.type, type, kinds, registry).filter(\n (rule) => !overridden.has(rule.name),\n )\n\n return {\n name: field.name,\n field: withProps,\n path,\n type,\n kind: kindDef(field.type, kind, registry),\n valueKind: kind,\n rules: [...defaultRules, ...fieldRules],\n }\n}\n\nfunction resolveKind(\n kind: ValueKind | KindOf | undefined,\n field: JsonField | undefined,\n): ValueKind | undefined {\n if (typeof kind !== 'function') return kind\n return field && kind(field)\n}\n\n/** A kind that doesn't fit is a mistake in the field type, not in the definition. */\nfunction kindDef(typeName: string, kind: ValueKind, registry: Registry): KindDef {\n const at = `Field type \"${typeName}\"`\n if (kind === 'none') throw new TypeError(`${at}: kind() can't return 'none'`)\n const def = lookup(registry.kinds, kind)\n if (!def) throw new TypeError(`${at}: kind \"${kind}\" is not registered`)\n return def\n}\n\n/** Throws for a default rule that doesn't fit, because that is a mistake in the type. */\nfunction checkDefaultRules(\n typeName: string,\n type: FieldTypeDef,\n kinds: FieldKinds,\n registry: Registry,\n): CheckedRule[] {\n const issues: DefinitionIssue[] = []\n const rules = (type.defaultRules ?? []).flatMap(\n (rule, j) => checkRule(rule, kinds, ['defaultRules', j], registry, issues) ?? [],\n )\n const [first] = issues\n if (first) {\n throw new TypeError(`Field type \"${typeName}\": ${formatPath(first.path)}: ${first.message}`)\n }\n return rules\n}\n\nfunction checkProps(\n field: JsonField,\n type: FieldTypeDef,\n path: DefinitionPath,\n issues: DefinitionIssue[],\n): Record<string, unknown> | undefined {\n const propKeys = Object.keys(type.props?.entries ?? {})\n const input: Record<string, unknown> = {}\n\n for (const key of Object.keys(field)) {\n if (isReservedFieldKey(key)) continue\n if (propKeys.includes(key)) {\n input[key] = field[key]\n } else {\n issues.push(\n issue('unknown_key', [...path, key], `Unknown key \"${key}\" on a \"${field.type}\" field`),\n )\n }\n }\n\n if (!type.props) return {}\n const parsed = v.safeParse(type.props, input)\n if (parsed.success) return parsed.output\n issues.push(...toIssues('invalid_props', path, parsed.issues))\n return undefined\n}\n\nexport function checkRule(\n raw: unknown,\n { kind, itemKind }: FieldKinds,\n path: DefinitionPath,\n registry: Registry,\n issues: DefinitionIssue[],\n): CheckedRule | undefined {\n const shape = v.safeParse(ruleShape, raw)\n if (!shape.success) {\n issues.push(...toIssues('invalid_shape', path, shape.issues))\n return undefined\n }\n\n const rule: JsonRule = shape.output\n const def = lookup(registry.rules, rule.rule)\n if (!def) {\n issues.push(issue('unknown_rule', [...path, 'rule'], `Unknown rule \"${rule.rule}\"`))\n return undefined\n }\n\n // A rule for the items of an array, but not for arrays, runs on each item.\n const each = !def.kinds.includes(kind) && !!itemKind && def.kinds.includes(itemKind)\n\n // Params can depend on the kind, so they can't be checked for a kind the rule doesn't support.\n if (!def.kinds.includes(kind) && !each) {\n const items = itemKind ? ` or their ${itemKind} items` : ''\n const message = `Rule \"${rule.rule}\" can't be used on ${kind} fields${items}`\n issues.push(issue('kind_mismatch', [...path, 'rule'], message))\n return undefined\n }\n\n const issueCount = issues.length\n const params = paramsFor(def, each ? (itemKind as ValueKind) : kind)\n const paramKeys = Object.keys(params?.entries ?? {})\n const input: Record<string, unknown> = {}\n for (const key of Object.keys(rule)) {\n if (isReservedRuleKey(key)) continue\n if (paramKeys.includes(key)) {\n input[key] = rule[key]\n } else {\n issues.push(\n issue('unknown_param', [...path, key], `Rule \"${rule.rule}\" has no param \"${key}\"`),\n )\n }\n }\n\n const parsed = v.safeParse(params ?? noParams, input)\n if (!parsed.success) issues.push(...toIssues('invalid_params', path, parsed.issues))\n if (!parsed.success || issues.length > issueCount) return undefined\n\n return { name: rule.rule, def, params: parsed.output, message: rule.message, each }\n}\n\nexport function checkRegistry(registry: Registry): void {\n for (const [name, rule] of Object.entries(registry.rules)) {\n // Params can depend on the kind, so check them for every kind the rule supports.\n for (const kind of rule.kinds) {\n for (const key of Object.keys(paramsFor(rule, kind)?.entries ?? {})) {\n if (isReservedRuleKey(key)) {\n throw new TypeError(`Rule \"${name}\": params can't use the reserved key \"${key}\"`)\n }\n }\n }\n }\n\n for (const [name, type] of Object.entries(registry.fieldTypes)) {\n const at = `Field type \"${name}\"`\n for (const kind of [type.kind, type.itemKind]) {\n if (typeof kind === 'string' && !lookup(registry.kinds, kind)) {\n throw new TypeError(`${at}: kind \"${kind}\" is not registered`)\n }\n }\n if (type.container && type.kind !== 'object' && type.kind !== 'array') {\n throw new TypeError(`${at}: a container's kind must be 'object' or 'array'`)\n }\n if (type.kind !== 'none' && !type.schema) {\n throw new TypeError(`${at}: schema() is required unless the kind is 'none'`)\n }\n for (const key of Object.keys(type.props?.entries ?? {})) {\n if (isReservedFieldKey(key)) {\n throw new TypeError(`${at}: props can't use the reserved key \"${key}\"`)\n }\n }\n\n // A kind from a function is only known per field, so checkField checks those default rules.\n if (typeof type.kind === 'string' && typeof type.itemKind !== 'function') {\n const kinds: FieldKinds = {\n kind: type.kind,\n itemKind: type.kind === 'array' ? type.itemKind : undefined,\n }\n checkDefaultRules(name, type, kinds, registry)\n }\n }\n}\n\nfunction issue(code: DefinitionIssueCode, path: DefinitionPath, message: string): DefinitionIssue {\n return { code, path, message }\n}\n\nexport function toIssues(\n code: DefinitionIssueCode,\n path: DefinitionPath,\n valibotIssues: readonly v.BaseIssue<unknown>[],\n): DefinitionIssue[] {\n return valibotIssues.map((valibotIssue) => {\n const keys = valibotIssue.path?.map((item) => item.key as string | number) ?? []\n return issue(code, [...path, ...keys], valibotIssue.message)\n })\n}\n","import * as v from 'valibot'\nimport type { DefinitionIssue, DefinitionPath } from '../errors/definition-error'\nimport type { BuildContext } from '../field-types/field-type-def'\nimport type { AnySchema } from '../shared/valibot-types'\nimport { buildFieldSchema, type Messages } from './build-field-schema'\nimport type { Registry } from './registry'\nimport { type CheckedField, checkField, toIssues } from './validate-definition'\n\nexport interface CompileResult {\n /** Every issue in the definition, in document order. */\n issues: DefinitionIssue[]\n /** The form's schema. Only complete when there are no issues. */\n schema: FieldsSchema\n}\n\n/** The schema of a list of fields: an object with a key for each field that has a value. */\nexport type FieldsSchema = v.ObjectSchema<v.ObjectEntries, undefined>\n\nconst formShape = v.object({ version: v.string(), fields: v.array(v.unknown()) })\n\n/**\n * Checks a definition and builds its schema in the same pass, so `validate()` and `build()`\n * always agree. Never throws on bad input.\n */\nexport function compileDefinition(\n json: unknown,\n registry: Registry,\n messages: Messages,\n): CompileResult {\n const issues: DefinitionIssue[] = []\n\n const form = v.safeParse(formShape, json)\n if (!form.success) {\n return { issues: toIssues('invalid_shape', [], form.issues), schema: v.object({}) }\n }\n\n if (form.output.version !== '1') {\n const message = `Unsupported version \"${form.output.version}\". This package reads version '1'.`\n issues.push({ code: 'unsupported_version', path: ['version'], message })\n return { issues, schema: v.object({}) }\n }\n\n const compiler = createCompiler(registry, messages, issues)\n return { issues, schema: compiler.fields(form.output.fields, ['fields']) }\n}\n\nexport interface Compiler {\n /** Checks and builds a list of fields. `path` is where the list is, e.g. `['fields']`. */\n fields(fields: readonly unknown[], path: DefinitionPath): FieldsSchema\n /** Checks and builds the field of a list's items, which needs no name. */\n field(field: unknown, path: DefinitionPath): AnySchema\n}\n\n/** Every field the compiler checks adds its issues to `issues`. */\nexport function createCompiler(\n registry: Registry,\n messages: Messages,\n issues: DefinitionIssue[],\n): Compiler {\n // A field type builds its child fields through these, so it never imports the builder.\n const context = (path: DefinitionPath): BuildContext => ({\n path,\n buildFields: fields,\n buildField: field,\n })\n\n function fields(list: readonly unknown[], path: DefinitionPath): FieldsSchema {\n const entries: v.ObjectEntries = {}\n const names = new Set<string>()\n list.forEach((raw, i) => {\n const checked = checkField(raw, [...path, i], registry, names, issues)\n if (checked?.name) entries[checked.name] = build(checked)\n })\n return v.object(entries)\n }\n\n function field(raw: unknown, path: DefinitionPath): AnySchema {\n const checked = checkField(raw, path, registry, undefined, issues)\n // A field with issues gets no schema. build() throws before anything parses with it.\n return checked ? build(checked) : v.never()\n }\n\n function build(checked: CheckedField): AnySchema {\n const schema = buildFieldSchema(checked, messages, context(checked.path))\n checkDefault(checked, schema, issues)\n return schema\n }\n\n return { fields, field }\n}\n\n/** A default must be a value the field accepts. An empty one is the same as none. */\nfunction checkDefault(\n { field, kind, path }: CheckedField,\n schema: AnySchema,\n issues: DefinitionIssue[],\n): void {\n if (field.default === undefined || kind.isEmpty(field.default)) return\n const result = v.safeParse(schema, field.default)\n if (!result.success) {\n issues.push(...toIssues('invalid_default', [...path, 'default'], result.issues))\n }\n}\n","import { DefinitionError, type DefinitionIssue } from '../errors/definition-error'\nimport type { BuildContext } from '../field-types/field-type-def'\nimport type { Messages } from './build-field-schema'\nimport { type Compiler, createCompiler } from './compile-definition'\nimport { mergeRegistry } from './registry'\n\nconst messages: Messages = { required: 'Required', resolve: (text) => text }\n\n/**\n * A build context for testing a field type on its own, without a definition around it.\n * `buildFields` and `buildField` use the default registries and throw a `DefinitionError` when\n * the child fields have issues. `overrides` replaces any member, e.g. `path`.\n */\nexport function createBuildContext(overrides: Partial<BuildContext> = {}): BuildContext {\n const registry = mergeRegistry({})\n\n const run = <T>(compile: (compiler: Compiler) => T): T => {\n const issues: DefinitionIssue[] = []\n const result = compile(createCompiler(registry, messages, issues))\n if (issues.length) throw new DefinitionError(issues)\n return result\n }\n\n return {\n path: [],\n buildFields: (fields, path) => run((compiler) => compiler.fields(fields, path)),\n buildField: (field, path) => run((compiler) => compiler.field(field, path)),\n ...overrides,\n }\n}\n","import type { KindDef } from '../kinds/kind-def'\nimport type { FieldTypeDef } from '../field-types/field-type-def'\nimport type { RuleDef } from '../rules/rule-def'\nimport type { MessageContext, Messages } from './build-field-schema'\nimport { compileDefinition } from './compile-definition'\nimport { mergeRegistry } from './registry'\nimport { checkRegistry } from './validate-definition'\nimport { DefinitionError, type ValidateResult } from '../errors/definition-error'\nimport type { JsonForm } from '../definition/json-form-schema'\nimport type { ValueKind } from '../shared/value-kind'\n\nexport interface SchemaBuilderOptions {\n kinds?: Record<string, KindDef>\n fieldTypes?: Record<string, FieldTypeDef>\n rules?: Record<string, RuleDef>\n includeDefaultRules?: boolean\n messages?: { required?: string }\n /**\n * Called with every message from the definition and with `messages.required`, e.g. to treat\n * them as i18n keys. Return undefined to use the text as written.\n */\n resolveMessage?(key: string, ctx: MessageContext): string | undefined\n}\n\nexport function createSchemaBuilder(options: SchemaBuilderOptions = {}) {\n const registry = mergeRegistry(options)\n checkRegistry(registry)\n\n const messages: Messages = {\n required: options.messages?.required ?? 'Required',\n resolve: (text, ctx) => options.resolveMessage?.(text, ctx) ?? text,\n }\n\n /** Every issue in the definition, in document order. Never throws on bad input. */\n function validate(json: unknown): ValidateResult {\n const { issues } = compileDefinition(json, registry, messages)\n return issues.length ? { success: false, issues } : { success: true, issues: [] }\n }\n\n function build(json: JsonForm) {\n const { issues, schema } = compileDefinition(json, registry, messages)\n if (issues.length) throw new DefinitionError(issues)\n return schema\n }\n\n /**\n * The registered rules that can be used on a field of `kind`, e.g. for a rule picker.\n */\n function rulesForKind(kind: ValueKind): [name: string, def: RuleDef][] {\n return Object.entries(registry.rules).filter(([, def]) => def.kinds.includes(kind))\n }\n\n return {\n build,\n validate,\n rulesForKind,\n kinds: registry.kinds,\n fieldTypes: registry.fieldTypes,\n rules: registry.rules,\n }\n}\n","import type { JsonField, JsonForm } from './json-form-schema'\n\n/**\n * Formisch's `initialInput` for a definition: each field's `default`, nested the way the value\n * is. A group gives an object, and an array without a default gives `[]`. Other fields without\n * a default are left out. Like `walkFields`, it reads the built-in `group` and `array` types\n * and needs no builder.\n */\nexport function getInitialInput(definition: JsonForm): Record<string, unknown> {\n return inputOf(definition.fields)\n}\n\nfunction inputOf(fields: readonly JsonField[]): Record<string, unknown> {\n const input: Record<string, unknown> = {}\n for (const field of fields) {\n if (field.name === undefined) continue\n const value = initialValue(field)\n if (value !== undefined) input[field.name] = value\n }\n return input\n}\n\nfunction initialValue(field: JsonField): unknown {\n if (field.type === 'group') return inputOf(Array.isArray(field.fields) ? field.fields : [])\n if (field.type === 'array') return field.default ?? []\n return field.default\n}\n","import type { DefinitionPath } from '../errors/definition-error'\nimport type { JsonField, JsonForm } from './json-form-schema'\n\n/** One field found by `walkFields`. */\nexport interface WalkedField {\n field: JsonField\n /** The field's type, e.g. `'text'`. */\n type: string\n /**\n * Where the field's value is, as a Formisch path: `['address', 'city']`. The items of an array\n * have no fixed index, so they have `'*'` in its place. A field without a name, like a\n * heading, has its parent's path.\n */\n dataPath: readonly (string | number)[]\n /** Where the field is in the definition: `['fields', 1, 'fields', 0]`. */\n definitionPath: DefinitionPath\n /** 0 for the form's own fields, 1 for the fields inside them, and so on. */\n depth: number\n}\n\n/**\n * Every field of a definition, at every depth, in document order. A group or an array comes\n * before its fields, and the fields of an array's items come once. It reads the built-in\n * `group` and `array` types and needs no builder, so it doesn't check the definition: run\n * `validate()` first.\n */\nexport function* walkFields(definition: JsonForm): Generator<WalkedField, void, undefined> {\n yield* walkList(definition.fields, ['fields'], [], 0)\n}\n\nfunction* walkList(\n fields: readonly JsonField[],\n at: DefinitionPath,\n dataPath: readonly (string | number)[],\n depth: number,\n): Generator<WalkedField, void, undefined> {\n for (const [i, field] of fields.entries()) {\n const path = field.name === undefined ? dataPath : [...dataPath, field.name]\n yield* walkField(field, [...at, i], path, depth)\n }\n}\n\nfunction* walkField(\n field: JsonField,\n definitionPath: DefinitionPath,\n dataPath: readonly (string | number)[],\n depth: number,\n): Generator<WalkedField, void, undefined> {\n yield { field, type: field.type, dataPath, definitionPath, depth }\n\n if (field.type === 'group' && Array.isArray(field.fields)) {\n yield* walkList(field.fields, [...definitionPath, 'fields'], dataPath, depth + 1)\n } else if (field.type === 'array') {\n const items = [...dataPath, '*']\n if (isField(field.of)) {\n // The field of a list of single values has no name: its value is the item itself.\n yield* walkField(field.of, [...definitionPath, 'of'], items, depth + 1)\n } else if (Array.isArray(field.fields)) {\n yield* walkList(field.fields, [...definitionPath, 'fields'], items, depth + 1)\n }\n }\n}\n\nconst isField = (value: unknown): value is JsonField =>\n typeof value === 'object' && value !== null && 'type' in value\n"],"mappings":";;AA6BA,SAAgB,WAAW,MAA8B;CACvD,OAAO,KAAK,QAAgB,KAAK,QAAQ;EACvC,IAAI,OAAO,QAAQ,UAAU,OAAO,GAAG,IAAI,GAAG,IAAI;EAClD,OAAO,MAAM,GAAG,IAAI,GAAG,QAAQ;CACjC,GAAG,EAAE;AACP;;AAGA,IAAa,kBAAb,cAAqC,MAAM;CACzC;CAEA,YAAY,QAAoC;EAC9C,MAAM,QAAQ,OAAO,KAClB,UAAU,MAAM,WAAW,MAAM,IAAI,KA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EAC3E,OAAO,UAAU,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,MAAM,KAAK;CACjD;AACF;AAEA,UAAU,UACR,OACA,gBACA,UACA,OACyC;CACzC,MAAM;EAAE;EAAO,MAAM,MAAM;EAAM;EAAU;EAAgB;CAAM;CAEjE,IAAI,MAAM,SAAS,WAAW,MAAM,QAAQ,MAAM,MAAM,GACtD,OAAO,SAAS,MAAM,QAAQ,CAAC,GAAG,gBAAgB,QAAQ,GAAG,UAAU,QAAQ,CAAC;MAC3E,IAAI,MAAM,SAAS,SAAS;EACjC,MAAM,QAAQ,CAAC,GAAG,UAAU,GAAG;EAC/B,IAAI,QAAQ,MAAM,EAAE,GAElB,OAAO,UAAU,MAAM,IAAI,CAAC,GAAG,gBAAgB,IAAI,GAAG,OAAO,QAAQ,CAAC;OACjE,IAAI,MAAM,QAAQ,MAAM,MAAM,GACnC,OAAO,SAAS,MAAM,QAAQ,CAAC,GAAG,gBAAgB,QAAQ,GAAG,OAAO,QAAQ,CAAC;CAEjF;AACF;AAEA,MAAM,WAAW,UACf,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU"}
1
+ {"version":3,"file":"index.js","names":["meta","meta","kinds","meta","kinds","meta","meta","kinds","meta","meta","ruleShape"],"sources":["../src/errors/definition-error.ts","../src/shared/each-item.ts","../src/builder/build-field-schema.ts","../src/shared/reserved-keys.ts","../src/field-types/basic-types.ts","../src/field-types/define-field-type.ts","../src/field-types/choice-types.ts","../src/field-types/container-types.ts","../src/field-types/date-types.ts","../src/field-types/display-types.ts","../src/field-types/file-type.ts","../src/field-types/default-field-types.ts","../src/kinds/default-kinds.ts","../src/rules/define-rule.ts","../src/rules/param-schemas.ts","../src/rules/comparison-rules.ts","../src/rules/content-rules.ts","../src/rules/date-rules.ts","../src/rules/file-rules.ts","../src/rules/format-rules.ts","../src/rules/length-rules.ts","../src/rules/normalize-rules.ts","../src/rules/number-rules.ts","../src/rules/text-unit-rules.ts","../src/rules/default-rules.ts","../src/rules/define-form-rule.ts","../src/rules/form-rules.ts","../src/builder/registry.ts","../src/rules/rule-params.ts","../src/builder/validate-definition.ts","../src/builder/check-form-rules.ts","../src/builder/form-rule-action.ts","../src/builder/compile-definition.ts","../src/builder/build-context.ts","../src/builder/create-schema-builder.ts","../src/definition/initial-input.ts","../src/definition/walk-fields.ts"],"sourcesContent":["/** Where something is in a definition, e.g. `['fields', 0, 'rules', 1]`. */\nexport type DefinitionPath = readonly (string | number)[]\n\n/** Public API: adding a code is a minor change, renaming one is breaking. */\nexport type DefinitionIssueCode =\n | 'invalid_shape'\n | 'unsupported_version'\n | 'unknown_key'\n | 'unknown_type'\n | 'missing_name'\n | 'invalid_name'\n | 'duplicate_name'\n | 'invalid_props'\n | 'invalid_default'\n | 'unknown_rule'\n | 'unknown_param'\n | 'invalid_params'\n | 'kind_mismatch'\n | 'unknown_field'\n\nexport interface DefinitionIssue {\n code: DefinitionIssueCode\n path: DefinitionPath\n message: string\n}\n\nexport type ValidateResult =\n | { success: true; issues: [] }\n | { success: false; issues: DefinitionIssue[] }\n\nexport function formatPath(path: DefinitionPath): string {\n return path.reduce<string>((out, key) => {\n if (typeof key === 'number') return `${out}[${key}]`\n return out ? `${out}.${key}` : key\n }, '')\n}\n\n/** Thrown by `build()` when the definition has issues. Lists all of them. */\nexport class DefinitionError extends Error {\n readonly issues: readonly DefinitionIssue[]\n\n constructor(issues: readonly DefinitionIssue[]) {\n const lines = issues.map(\n (issue) => ` ${formatPath(issue.path) || '(root)'}: ${issue.message}`,\n )\n super(`Invalid form definition:\\n${lines.join('\\n')}`)\n this.name = 'DefinitionError'\n this.issues = issues\n }\n}\n","import * as v from 'valibot'\nimport type { AnyAction, AnySchema } from './valibot-types'\n\n/**\n * Checks every item of an array with `schema` and reports the issues on the array itself.\n * Formisch keeps no field for each item of an array value, so an issue with an item's index in\n * its path would show nowhere.\n */\nexport function eachItem(schema: AnySchema): AnyAction {\n return v.rawCheck(({ dataset, config, addIssue }) => {\n if (!dataset.typed || !Array.isArray(dataset.value)) return\n for (const item of dataset.value as unknown[]) {\n const result = v.safeParse(schema, item, config as v.Config<v.BaseIssue<unknown>>)\n for (const issue of result.issues ?? []) {\n addIssue({\n message: issue.message,\n input: item,\n expected: issue.expected ?? undefined,\n received: issue.received,\n })\n }\n }\n })\n}\n","import * as v from 'valibot'\nimport type { JsonField } from '../definition/json-form-schema'\nimport type { DefinitionPath } from '../errors/definition-error'\nimport type { BuildContext } from '../field-types/field-type-def'\nimport type { RuleStage } from '../rules/rule-def'\nimport type { CheckedField } from './validate-definition'\nimport { eachItem } from '../shared/each-item'\nimport type { AnyAction, AnySchema } from '../shared/valibot-types'\n\nexport interface MessageContext {\n field: JsonField\n rule?: string\n path: DefinitionPath\n}\n\nexport interface Messages {\n required: string\n resolve(text: string, ctx: MessageContext): string\n}\n\n/**\n * The schema runs in this order: empty check, base schema, normalize rules, required check,\n * then the type's default rules and the field's rules, and last the type's `finalize()`.\n * A container has no empty check: its value is never empty.\n */\nexport function buildFieldSchema(\n checked: CheckedField,\n messages: Messages,\n ctx: BuildContext,\n): AnySchema {\n const { field, path, type, kind, valueKind } = checked\n const required = !!field.required\n const requiredMessage = messages.resolve(\n (typeof field.required === 'object' && field.required.message) || messages.required,\n { field, path },\n )\n\n // Rules for a whole value, and rules that run on each item of an array value.\n const whole: Record<RuleStage, PipeItem[]> = { normalize: [], validate: [] }\n const each: Record<RuleStage, AnyAction[]> = { normalize: [], validate: [] }\n\n for (const rule of checked.rules) {\n const message =\n rule.message === undefined\n ? undefined\n : messages.resolve(rule.message, { field, rule: rule.name, path })\n const action = rule.def.create(rule.params, message)\n const stage = rule.def.stage ?? 'validate'\n if (rule.each) {\n each[stage].push(action)\n } else {\n whole[stage].push(action)\n }\n }\n\n // Item rules run before the rules for the whole array.\n if (each.normalize.length) {\n whole.normalize.unshift(v.array(pipe(v.unknown(), each.normalize)))\n }\n if (each.validate.length) {\n whole.validate.unshift(eachItem(pipe(v.unknown(), each.validate)))\n }\n\n const finalize = type.finalize?.(field)\n if (finalize) whole.validate.push(finalize)\n\n const base = (type.schema as NonNullable<typeof type.schema>)(field, ctx)\n // The type can replace the kind's required check, e.g. a yes/no radio accepts false.\n const requiredCheck = !required\n ? undefined\n : type.required\n ? type.required(requiredMessage)\n : kind.required?.(requiredMessage)\n const head = pipe(base, requiredCheck ? [...whole.normalize, requiredCheck] : whole.normalize)\n\n if (type.container) {\n // Formisch reads the object or array schema to keep a field for each child, so nothing may\n // wrap it but optional. A missing value is read as an empty one, and the rules still run.\n // They sit in a nested pipe, so an empty required list reports only the required message.\n const rules = whole.validate.length ? [pipe(v.unknown(), whole.validate)] : []\n return v.optional(pipe(head, rules), valueKind === 'object' ? () => ({}) : () => [])\n }\n\n const empty = required\n ? v.never(requiredMessage)\n : v.pipe(\n v.unknown(),\n v.transform(() => undefined),\n )\n\n const whenFilled = (schema: AnySchema): AnySchema =>\n v.lazy((input) => (kind.isEmpty(input) ? empty : schema))\n\n const schema = whenFilled(v.pipe(head, whenFilled(pipe(v.unknown(), whole.validate))))\n\n return required ? schema : v.optional(schema)\n}\n\n/** An action, or a schema that runs on the value so far, e.g. on each item of an array. */\ntype PipeItem = AnyAction | AnySchema\n\nconst pipe = (schema: AnySchema, items: readonly PipeItem[]): AnySchema =>\n items.reduce<AnySchema>((acc, item) => v.pipe(acc, item), schema)\n","/**\n * Field keys this package owns. A field type's props can't use them.\n */\nexport const RESERVED_FIELD_KEYS = [\n 'name',\n 'type',\n 'label',\n 'description',\n 'placeholder',\n 'default',\n 'required',\n 'rules',\n 'ui',\n] as const\n\n/**\n * Rule keys this package owns. A rule's params can't use them.\n */\nexport const RESERVED_RULE_KEYS = ['rule', 'message'] as const\n\n/**\n * Form rule keys this package owns. A form rule's params can't use them.\n */\nexport const RESERVED_FORM_RULE_KEYS = ['rule', 'field', 'message'] as const\n\nconst fieldKeys: ReadonlySet<string> = new Set(RESERVED_FIELD_KEYS)\nconst ruleKeys: ReadonlySet<string> = new Set(RESERVED_RULE_KEYS)\nconst formRuleKeys: ReadonlySet<string> = new Set(RESERVED_FORM_RULE_KEYS)\n\nexport const isReservedFieldKey = (key: string): boolean => fieldKeys.has(key)\nexport const isReservedRuleKey = (key: string): boolean => ruleKeys.has(key)\nexport const isReservedFormRuleKey = (key: string): boolean => formRuleKeys.has(key)\n","import * as v from 'valibot'\nimport type { FieldTypeDef } from './field-type-def'\n\n/** Types with one plain value and no props. Each maps to a native input. */\nexport const basicTypes = {\n text: { kind: 'string', schema: () => v.string() },\n textarea: { kind: 'string', schema: () => v.string() },\n email: { kind: 'string', schema: () => v.string(), defaultRules: [{ rule: 'email' }] },\n password: { kind: 'string', schema: () => v.string() },\n url: { kind: 'string', schema: () => v.string(), defaultRules: [{ rule: 'url' }] },\n // Phone formats differ per country, so there is no default rule. Add a regex rule for yours.\n tel: { kind: 'string', schema: () => v.string() },\n number: { kind: 'number', schema: () => v.number() },\n // Required means \"must be ticked\", e.g. accepting terms.\n checkbox: { kind: 'boolean', schema: () => v.boolean() },\n} satisfies Record<string, FieldTypeDef>\n","import type { AnyObjectSchema } from '../shared/valibot-types'\nimport type { FieldTypeDef } from './field-type-def'\n\nexport const defineFieldType = <T extends AnyObjectSchema>(def: FieldTypeDef<T>): FieldTypeDef<T> =>\n def\n","import * as v from 'valibot'\nimport type { ValueKind } from '../shared/value-kind'\nimport { defineFieldType } from './define-field-type'\nimport type { FieldTypeDef } from './field-type-def'\n\ntype OptionValue = string | number | boolean\ntype Option = { value: OptionValue; label: string }\n\nconst options = <TValue extends v.GenericSchema<OptionValue>>(value: TValue) =>\n v.pipe(\n v.array(v.object({ value, label: v.string() })),\n v.minLength(1, 'Give at least one option'),\n v.check(\n (items) => new Set(items.map((item) => typeof item.value)).size <= 1,\n 'Give every option a value of the same type',\n ),\n v.check(\n (items) => new Set(items.map((item) => item.value)).size === items.length,\n 'Give every option a different value',\n ),\n )\n\nconst stringOrNumber = v.union([v.string(), v.number()])\nconst anyValue = v.union([v.string(), v.number(), v.boolean()])\n\n/** The options' value type. Every option has the same one. */\nconst kindOf = (items: readonly Option[]): ValueKind => {\n const [first] = items\n return first ? typeof first.value : 'string'\n}\n\n/** One of the option values. `v.picklist` can't hold booleans, so this is a union of literals. */\nconst oneOf = (items: readonly Option[]) => v.union(items.map((item) => v.literal(item.value)))\n\nexport const choiceTypes = {\n select: defineFieldType({\n kind: (field) => (field.options ? kindOf(field.options) : (field.valueType ?? 'string')),\n props: v.object({\n options: v.optional(options(stringOrNumber)),\n /** The value's type while `options` is missing, e.g. until they load from an API. */\n valueType: v.optional(v.picklist(['string', 'number'])),\n }),\n schema: (field) => {\n if (field.options) return oneOf(field.options)\n return field.valueType === 'number' ? v.number() : v.string()\n },\n }),\n radio: defineFieldType({\n kind: (field) => kindOf(field.options),\n props: v.object({ options: options(anyValue) }),\n schema: (field) => oneOf(field.options),\n // Any option counts as an answer, so a required yes/no radio accepts \"no\". The empty check\n // already rejects a radio with nothing picked.\n required: () => null,\n }),\n // A checkbox group is a multiselect with `ui: { widget: 'checkboxes' }`.\n multiselect: defineFieldType({\n kind: 'array',\n itemKind: (field) => kindOf(field.options),\n props: v.object({ options: options(stringOrNumber) }),\n schema: (field) => v.array(oneOf(field.options)),\n }),\n} satisfies Record<string, FieldTypeDef>\n","import * as v from 'valibot'\nimport type { JsonField } from '../definition/json-form-schema'\nimport { defineFieldType } from './define-field-type'\nimport type { FieldTypeDef } from './field-type-def'\n\n// The builder checks child fields itself, at their own paths, so the props take any value here.\nconst childField = v.custom<JsonField>(() => true)\n\n/** Types whose value holds other fields. Display elements can go inside them too. */\nexport const containerTypes = {\n // An object with a key for each of its fields. It is always there, so it can't be required.\n group: defineFieldType({\n kind: 'object',\n container: true,\n props: v.object({ fields: v.array(childField) }),\n schema: (field, ctx) => ctx.buildFields(field.fields, [...ctx.path, 'fields']),\n }),\n // A list. `of` is the field of a list of single values, such as tags; its name isn't used.\n // `fields` makes a list of objects, such as order lines. Rules like minLength count the items.\n array: defineFieldType({\n kind: 'array',\n container: true,\n props: v.pipe(\n v.object({ of: v.optional(childField), fields: v.optional(v.array(childField)) }),\n v.check(\n (props) => (props.of === undefined) !== (props.fields === undefined),\n 'Give exactly one of \"of\" and \"fields\"',\n ),\n ),\n schema: (field, ctx) =>\n v.array(\n field.of\n ? ctx.buildField(field.of, [...ctx.path, 'of'])\n : ctx.buildFields(field.fields ?? [], [...ctx.path, 'fields']),\n ),\n }),\n} satisfies Record<string, FieldTypeDef>\n","import * as v from 'valibot'\nimport { defineFieldType } from './define-field-type'\nimport type { FieldTypeDef } from './field-type-def'\n\nconst outputProps = v.object({\n /** `'date'` turns the ISO string into a `Date`. Defaults to `'string'`. */\n output: v.optional(v.picklist(['string', 'date'])),\n})\n\n// Runs after every rule, so comparison rules like minValue still compare ISO strings.\nconst finalize = (field: v.InferOutput<typeof outputProps>) =>\n field.output === 'date' ? v.toDate() : undefined\n\n/**\n * Dates and times are ISO strings, the values of <input type=\"date|time|datetime-local\">.\n * The format is part of the type rather than a default rule, so these types don't depend on\n * `dateRules` being registered.\n */\nexport const dateTypes = {\n date: defineFieldType({\n kind: 'date',\n props: outputProps,\n schema: () => v.pipe(v.string(), v.isoDate()),\n finalize,\n }),\n time: { kind: 'date', schema: () => v.pipe(v.string(), v.isoTime()) },\n // A local date and time without a time zone, e.g. 2026-10-28T14:30.\n datetime: defineFieldType({\n kind: 'date',\n props: outputProps,\n schema: () => v.pipe(v.string(), v.isoDateTime()),\n finalize,\n }),\n} satisfies Record<string, FieldTypeDef>\n","import * as v from 'valibot'\nimport { defineFieldType } from './define-field-type'\nimport type { FieldTypeDef } from './field-type-def'\n\n/**\n * Elements without a value. They need no name and add no output key. Their `text` can be an\n * i18n key: renderers resolve it with the same function they pass as `resolveMessage`.\n */\nexport const displayTypes = {\n heading: defineFieldType({\n kind: 'none',\n props: v.object({\n text: v.string(),\n /** 1 to 6. Defaults to 2. */\n level: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(6))),\n }),\n }),\n // Plain text. Whether to render markdown is up to the renderer.\n paragraph: defineFieldType({ kind: 'none', props: v.object({ text: v.string() }) }),\n divider: { kind: 'none' },\n} satisfies Record<string, FieldTypeDef>\n","import * as v from 'valibot'\nimport { eachItem } from '../shared/each-item'\nimport { defineFieldType } from './define-field-type'\n\ntype MimeType = `${string}/${string}`\n\nconst mimeTypes = (accept: string) => accept.split(',').map((type) => type.trim()) as MimeType[]\n\nconst fileProps = v.object({\n multiple: v.optional(v.boolean()),\n // A File only carries its MIME type, so extensions (.pdf) and wildcards (image/*) can't be\n // checked against it.\n accept: v.optional(\n v.pipe(\n v.string(),\n v.check(\n (input) => mimeTypes(input).every((type) => /^[\\w.+-]+\\/[\\w.+-]+$/.test(type)),\n 'Use MIME types separated by commas, such as image/png,image/jpeg',\n ),\n ),\n ),\n})\n\n/**\n * A File, or an array of them with `multiple`. Rules for files, like `maxSize`, run on each one;\n * rules for arrays, like `maxLength`, limit the count.\n */\nexport const fileType = defineFieldType({\n kind: (field) => (field.multiple ? 'array' : 'file'),\n itemKind: 'file',\n props: fileProps,\n // The schema is created per field and v.file() only reads the File global while parsing, so\n // the package still loads where File doesn't exist.\n schema: (field) => {\n const file = field.accept ? v.pipe(v.file(), v.mimeType(mimeTypes(field.accept))) : v.file()\n if (!field.multiple) return file\n // Checking each file after the array keeps the issues on the field, not on its items.\n return field.accept ? v.pipe(v.array(v.file()), eachItem(file)) : v.array(file)\n },\n})\n","import { basicTypes } from './basic-types'\nimport { choiceTypes } from './choice-types'\nimport { containerTypes } from './container-types'\nimport { dateTypes } from './date-types'\nimport { displayTypes } from './display-types'\nimport { fileType } from './file-type'\nimport type { FieldTypeDef } from './field-type-def'\n\n/** Every built-in field type. */\nexport const defaultFieldTypes = {\n ...basicTypes,\n ...dateTypes,\n ...choiceTypes,\n file: fileType,\n ...displayTypes,\n ...containerTypes,\n} satisfies Record<string, FieldTypeDef>\n","import * as v from 'valibot'\nimport type { KindDef } from './kind-def'\n\nconst isNil = (input: unknown) => input === undefined || input === null\n\nexport const defaultKinds = {\n string: {\n isEmpty: (input) => isNil(input) || input === '',\n required: (message) => v.nonEmpty(message),\n },\n // A cleared <input type=\"number\"/> holds '' or NaN, depending on the adapter.\n number: {\n isEmpty: (input) => isNil(input) || input === '' || Number.isNaN(input),\n },\n // Required means \"must be ticked\", e.g accepting terms.\n boolean: {\n isEmpty: isNil,\n required: (message) => v.value(true, message),\n },\n date: {\n isEmpty: (input) => isNil(input) || input === '',\n required: (message) => v.nonEmpty(message),\n },\n array: {\n isEmpty: (input) => isNil(input) || (Array.isArray(input) && input.length === 0),\n required: (message) => v.minLength(1, message),\n },\n file: { isEmpty: isNil },\n object: { isEmpty: isNil },\n // Display elements (headings, dividers) have no value, so the builder never calls this.\n none: { isEmpty: () => true },\n} satisfies Record<string, KindDef>\n","import type { AnyObjectSchema } from '../shared/valibot-types'\nimport type { RuleDef } from './rule-def'\n\nexport const defineRule = <T extends AnyObjectSchema>(def: RuleDef<T>): RuleDef<T> => def\n","import * as v from 'valibot'\nimport type { ValueKind } from '../shared/value-kind'\n\n/** A length, count or size: a whole number from 0. */\nexport const count = v.pipe(v.number(), v.integer(), v.minValue(0))\n\nexport const countParams = v.object({ value: count })\n\nconst isIsoValue = (input: string) =>\n v.ISO_DATE_REGEX.test(input) || v.ISO_DATE_TIME_REGEX.test(input) || v.ISO_TIME_REGEX.test(input)\n\n/** Valibot compares dates as ISO strings, so the param must be one too. */\nexport const isoValue = v.pipe(\n v.string(),\n v.check(isIsoValue, 'Use an ISO date, date-time or time, such as 2026-01-01'),\n)\n\nexport const valueSchema = (kind: ValueKind) => {\n switch (kind) {\n case 'date':\n return isoValue\n case 'string':\n return v.string()\n case 'boolean':\n return v.boolean()\n default:\n return v.number()\n }\n}\n","import * as v from 'valibot'\nimport type { AnyAction } from '../shared/valibot-types'\nimport type { ValueKind } from '../shared/value-kind'\nimport { defineRule } from './define-rule'\nimport { valueSchema } from './param-schemas'\nimport type { RuleDef } from './rule-def'\n\ntype Value = string | number | boolean\n\nconst ordered = ['number', 'date'] as const\nconst any = ['number', 'date', 'string', 'boolean'] as const\nconst meta = (label: string) => ({ label, category: 'comparison' }) as const\n\n// The param has the field's type: a number on a number field, an ISO string on a date field.\nconst valueParams = (kind: ValueKind) => v.object({ value: valueSchema(kind) })\nconst valuesParams = (kind: ValueKind) =>\n v.object({\n values: v.pipe(v.array(valueSchema(kind)), v.minLength(1, 'Give at least one value')),\n })\n\n/** Compares the value with a param of the same type. */\nexport const comparisonRules = {\n minValue: defineRule({\n kinds: ordered,\n params: valueParams,\n meta: meta('Minimum'),\n create: (p, m) => v.minValue(p.value as Value, m) as AnyAction,\n }),\n maxValue: defineRule({\n kinds: ordered,\n params: valueParams,\n meta: meta('Maximum'),\n create: (p, m) => v.maxValue(p.value as Value, m) as AnyAction,\n }),\n gtValue: defineRule({\n kinds: ordered,\n params: valueParams,\n meta: meta('Greater than'),\n create: (p, m) => v.gtValue(p.value as Value, m) as AnyAction,\n }),\n ltValue: defineRule({\n kinds: ordered,\n params: valueParams,\n meta: meta('Less than'),\n create: (p, m) => v.ltValue(p.value as Value, m) as AnyAction,\n }),\n value: defineRule({\n kinds: any,\n params: valueParams,\n meta: meta('Equals'),\n create: (p, m) => v.value(p.value as Value, m) as AnyAction,\n }),\n notValue: defineRule({\n kinds: any,\n params: valueParams,\n meta: meta('Does not equal'),\n create: (p, m) => v.notValue(p.value as Value, m) as AnyAction,\n }),\n values: defineRule({\n kinds: ordered,\n params: valuesParams,\n meta: meta('One of'),\n create: (p, m) => v.values(p.values as Value[], m) as AnyAction,\n }),\n notValues: defineRule({\n kinds: ordered,\n params: valuesParams,\n meta: meta('None of'),\n create: (p, m) => v.notValues(p.values as Value[], m) as AnyAction,\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport type { ValueKind } from '../shared/value-kind'\nimport { defineRule } from './define-rule'\nimport type { AnyAction } from '../shared/valibot-types'\nimport type { RuleDef } from './rule-def'\n\nconst meta = (label: string, description?: string) =>\n ({ label, description, category: 'content' }) as const\n\nconst regexError = (pattern: string, flags = '') => {\n try {\n new RegExp(pattern, flags)\n return undefined\n } catch (error) {\n return (error as Error).message\n }\n}\n\nconst FLAGS = /^[dgimsuvy]*$/\n\nconst regexParams = v.pipe(\n v.object({\n pattern: v.string(),\n flags: v.optional(v.pipe(v.string(), v.regex(FLAGS, 'Flags can be d, g, i, m, s, u, v and y'))),\n }),\n v.forward(\n v.check(\n (p) => !FLAGS.test(p.flags ?? '') || regexError(p.pattern, p.flags) === undefined,\n (issue) => regexError(issue.input.pattern, issue.input.flags) ?? 'Invalid pattern',\n ),\n ['pattern'],\n ),\n)\n\nconst item = v.union([v.string(), v.number(), v.boolean()])\nconst stringParams = v.object({ value: v.string() })\nconst contentParams = (kind: ValueKind) => v.object({ value: kind === 'array' ? item : v.string() })\n\nexport const contentRules = {\n regex: defineRule({\n kinds: ['string'],\n params: regexParams,\n meta: meta('Matches pattern', 'A JavaScript regular expression, without the slashes.'),\n create: (p, m) => v.regex(new RegExp(p.pattern, p.flags?.replace(/[gy]/g, '')), m),\n }),\n startsWith: defineRule({\n kinds: ['string'],\n params: stringParams,\n meta: meta('Starts with'),\n create: (p, m) => v.startsWith(p.value, m),\n }),\n endsWith: defineRule({\n kinds: ['string'],\n params: stringParams,\n meta: meta('Ends with'),\n create: (p, m) => v.endsWith(p.value, m),\n }),\n includes: defineRule({\n kinds: ['string', 'array'],\n params: contentParams,\n meta: meta('Contains'),\n create: (p, m) => v.includes(p.value, m) as AnyAction,\n }),\n excludes: defineRule({\n kinds: ['string', 'array'],\n params: contentParams,\n meta: meta('Does not contain'),\n create: (p, m) => v.excludes(p.value, m) as AnyAction,\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport type { AnyAction } from '../shared/valibot-types'\nimport { defineRule } from './define-rule'\nimport type { RuleDef } from './rule-def'\n\nconst iso = (label: string, description: string, create: (message?: string) => AnyAction) =>\n defineRule({\n kinds: ['string', 'date'],\n meta: { label, description, category: 'date' },\n create: (_, message) => create(message),\n })\n\nexport const dateRules = {\n isoDate: iso('ISO date', 'Like 2026-10-28', (m) => v.isoDate(m)),\n isoDateTime: iso('ISO date and time', 'Like 2026-10-28T14:30', (m) => v.isoDateTime(m)),\n isoTime: iso('ISO time', 'Like 14:30', (m) => v.isoTime(m)),\n isoTimeSecond: iso('ISO time with seconds', 'Like 14:30:15', (m) => v.isoTimeSecond(m)),\n isoTimestamp: iso('ISO timestamp', 'Like 2026-10-28T14:30:15.000z', (m) => v.isoTimestamp(m)),\n isoWeek: iso('ISO week', 'Like 2026-W44', (m) => v.isoWeek(m)),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport { defineRule } from './define-rule'\nimport { countParams } from './param-schemas'\nimport type { RuleDef } from './rule-def'\n\nconst kinds = ['file'] as const\nconst meta = (label: string, description?: string) =>\n ({ label, description, category: 'file' }) as const\nconst bytes = 'In bytes, e.g. 1048576 for 1 MiB.'\n\ntype MimeType = `${string}/${string}`\n\n// A File only carries its MIME type, and Valibot compares it exactly, so image/* can't work.\nconst mimeTypeParams = v.object({\n types: v.pipe(\n v.array(\n v.pipe(v.string(), v.regex(/^[\\w.+-]+\\/[\\w.+-]+$/, 'Use a MIME type, such as image/png')),\n ),\n v.minLength(1, 'Give at least one MIME type'),\n ),\n})\n\n/** Size and type of a File or Blob. */\nexport const fileRules = {\n minSize: defineRule({\n kinds,\n params: countParams,\n meta: meta('Minimum size', bytes),\n create: (p, m) => v.minSize(p.value, m),\n }),\n maxSize: defineRule({\n kinds,\n params: countParams,\n meta: meta('Maximum size', bytes),\n create: (p, m) => v.maxSize(p.value, m),\n }),\n size: defineRule({\n kinds,\n params: countParams,\n meta: meta('Exact size', bytes),\n create: (p, m) => v.size(p.value, m),\n }),\n notSize: defineRule({\n kinds,\n params: countParams,\n meta: meta('Not this size', bytes),\n create: (p, m) => v.notSize(p.value, m),\n }),\n mimeType: defineRule({\n kinds,\n params: mimeTypeParams,\n meta: meta('File type'),\n create: (p, m) => v.mimeType(p.types as MimeType[], m),\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport type { AnyAction } from '../shared/valibot-types'\nimport { defineRule } from './define-rule'\nimport type { RuleDef } from './rule-def'\n\n/** A string format without params. */\nconst format = (label: string, create: (message?: string) => AnyAction) =>\n defineRule({\n kinds: ['string'],\n meta: { label, category: 'format' },\n create: (_, message) => create(message),\n })\n\n/** Valibot's hash types. Valibot doesn't export the list, only the type. */\nconst HASH_TYPES = [\n 'md4',\n 'md5',\n 'sha1',\n 'sha256',\n 'sha384',\n 'sha512',\n 'ripemd128',\n 'ripemd160',\n 'tiger128',\n 'tiger160',\n 'tiger192',\n 'crc32',\n 'crc32b',\n 'adler32',\n] as const satisfies readonly v.HashType[]\n\nconst hashParams = v.object({\n types: v.pipe(v.array(v.picklist(HASH_TYPES)), v.minLength(1, 'Pick at least one hash type')),\n})\n\n/** Formats Valibot can check on a string. */\nexport const formatRules = {\n email: format('Email', (m) => v.email(m)),\n rfcEmail: format('Email (RFC 5322)', (m) => v.rfcEmail(m)),\n url: format('URL', (m) => v.url(m)),\n domain: format('Domain', (m) => v.domain(m)),\n slug: format('Slug', (m) => v.slug(m)),\n uuid: format('UUID', (m) => v.uuid(m)),\n ulid: format('ULID', (m) => v.ulid(m)),\n cuid2: format('CUID2', (m) => v.cuid2(m)),\n nanoid: format('Nano ID', (m) => v.nanoid(m)),\n ip: format('IP address', (m) => v.ip(m)),\n ipv4: format('IPv4 address', (m) => v.ipv4(m)),\n ipv6: format('IPv6 address', (m) => v.ipv6(m)),\n mac: format('MAC address', (m) => v.mac(m)),\n mac48: format('MAC-48 address', (m) => v.mac48(m)),\n mac64: format('MAC-64 address', (m) => v.mac64(m)),\n hexColor: format('Hex colour', (m) => v.hexColor(m)),\n hexadecimal: format('Hexadecimal', (m) => v.hexadecimal(m)),\n octal: format('Octal', (m) => v.octal(m)),\n decimal: format('Decimal number', (m) => v.decimal(m)),\n digits: format('Digits only', (m) => v.digits(m)),\n base64: format('Base64', (m) => v.base64(m)),\n bic: format('BIC (SWIFT code)', (m) => v.bic(m)),\n creditCard: format('Credit card number', (m) => v.creditCard(m)),\n imei: format('IMEI', (m) => v.imei(m)),\n isbn: format('ISBN', (m) => v.isbn(m)),\n isrc: format('ISRC', (m) => v.isrc(m)),\n emoji: format('Emoji', (m) => v.emoji(m)),\n hash: defineRule({\n kinds: ['string'],\n params: hashParams,\n meta: { label: 'Hash', category: 'format' },\n create: (p, m) => v.hash(p.types as [v.HashType, ...v.HashType[]], m),\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport { defineRule } from './define-rule'\nimport { countParams } from './param-schemas'\nimport type { RuleDef } from './rule-def'\n\nconst kinds = ['string', 'array'] as const\nconst meta = (label: string) => ({ label, category: 'length' }) as const\n\n/** Characters of a string, or items of an array */\nexport const lengthRules = {\n length: defineRule({\n kinds,\n params: countParams,\n meta: meta('Exact length'),\n create: (p, m) => v.length(p.value, m),\n }),\n minLength: defineRule({\n kinds,\n params: countParams,\n meta: meta('Minimum length'),\n create: (p, m) => v.minLength(p.value, m),\n }),\n maxLength: defineRule({\n kinds,\n params: countParams,\n meta: meta('Maximum length'),\n create: (p, m) => v.maxLength(p.value, m),\n }),\n notLength: defineRule({\n kinds,\n params: countParams,\n meta: meta('Not this length'),\n create: (p, m) => v.notLength(p.value, m),\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport { defineRule } from './define-rule'\nimport type { RuleDef } from './rule-def'\n\nconst stage = 'normalize'\nconst meta = (label: string, description?: string) =>\n ({ label, description, category: 'normalize' }) as const\nconst limit = v.object({ value: v.number() })\n\n/**\n * Rules that change the value instead of checking it. They run before the required check, so\n * `' '` with `trim` is empty. Their `message` is never shown.\n */\nexport const normalizeRules = {\n trim: defineRule({ kinds: ['string'], stage, meta: meta('Trim'), create: () => v.trim() }),\n trimStart: defineRule({\n kinds: ['string'],\n stage,\n meta: meta('Trim start'),\n create: () => v.trimStart(),\n }),\n trimEnd: defineRule({\n kinds: ['string'],\n stage,\n meta: meta('Trim end'),\n create: () => v.trimEnd(),\n }),\n toLowerCase: defineRule({\n kinds: ['string'],\n stage,\n meta: meta('Lowercase'),\n create: () => v.toLowerCase(),\n }),\n toUpperCase: defineRule({\n kinds: ['string'],\n stage,\n meta: meta('Uppercase'),\n create: () => v.toUpperCase(),\n }),\n normalize: defineRule({\n kinds: ['string'],\n stage,\n params: v.object({ form: v.optional(v.picklist(['NFC', 'NFD', 'NFKC', 'NFKD'])) }),\n meta: meta('Unicode normalize', 'Defaults to NFC.'),\n create: (p) => v.normalize(p.form),\n }),\n toMinValue: defineRule({\n kinds: ['number'],\n stage,\n params: limit,\n meta: meta('Raise to minimum', 'Replaces a smaller number with the minimum.'),\n create: (p) => v.toMinValue(p.value),\n }),\n toMaxValue: defineRule({\n kinds: ['number'],\n stage,\n params: limit,\n meta: meta('Lower to maximum', 'Replaces a larger number with the maximum.'),\n create: (p) => v.toMaxValue(p.value),\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport { defineRule } from './define-rule'\nimport type { RuleDef } from './rule-def'\n\nconst kinds = ['number'] as const\nconst meta = (label: string) => ({ label, category: 'number' }) as const\n\nconst divisor = v.pipe(v.number(), v.finite(), v.notValue(0, \"Can't be 0\"))\n\n/** Checks only numbers have. */\nexport const numberRules = {\n integer: defineRule({ kinds, meta: meta('Whole number'), create: (_, m) => v.integer(m) }),\n safeInteger: defineRule({\n kinds,\n meta: meta('Safe whole number'),\n create: (_, m) => v.safeInteger(m),\n }),\n finite: defineRule({ kinds, meta: meta('Finite number'), create: (_, m) => v.finite(m) }),\n multipleOf: defineRule({\n kinds,\n params: v.object({ value: divisor }),\n meta: meta('Multiple of'),\n create: (p, m) => v.multipleOf(p.value, m),\n }),\n} satisfies Record<string, RuleDef>\n","import * as v from 'valibot'\nimport { count, countParams } from './param-schemas'\nimport { defineRule } from './define-rule'\nimport type { RuleDef } from './rule-def'\n\nconst kinds = ['string'] as const\nconst meta = (label: string, description?: string) =>\n ({ label, description, category: 'text' }) as const\n\nconst isLocale = (input: string) => {\n try {\n return Intl.getCanonicalLocales(input).length === 1\n } catch {\n return false\n }\n}\n\nconst wordsParams = v.object({\n locale: v.optional(\n v.pipe(v.string(), v.check(isLocale, 'Use a language tag, such as en or sr-Latn')),\n ),\n value: count,\n})\n\nconst graphemesInfo = 'Counts characters as people see them, so an emoji is one.'\nconst bytesInfo = 'Counts UTF-8 bytes, e.g. to fit a database column,'\n\nexport const textUnitRules = {\n graphemes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Exact characters', graphemesInfo),\n create: (p, m) => v.graphemes(p.value, m),\n }),\n minGraphemes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Minimum characters', graphemesInfo),\n create: (p, m) => v.minGraphemes(p.value, m),\n }),\n maxGraphemes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Maximum characters', graphemesInfo),\n create: (p, m) => v.maxGraphemes(p.value, m),\n }),\n notGraphemes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Not this many characters', graphemesInfo),\n create: (p, m) => v.notGraphemes(p.value, m),\n }),\n words: defineRule({\n kinds,\n params: wordsParams,\n meta: meta('Exact words'),\n create: (p, m) => v.words(p.locale, p.value, m),\n }),\n minWords: defineRule({\n kinds,\n params: wordsParams,\n meta: meta('Minimum words'),\n create: (p, m) => v.minWords(p.locale, p.value, m),\n }),\n maxWords: defineRule({\n kinds,\n params: wordsParams,\n meta: meta('Maximum words'),\n create: (p, m) => v.maxWords(p.locale, p.value, m),\n }),\n notWords: defineRule({\n kinds,\n params: wordsParams,\n meta: meta('Not this many words'),\n create: (p, m) => v.notWords(p.locale, p.value, m),\n }),\n bytes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Exact bytes', bytesInfo),\n create: (p, m) => v.bytes(p.value, m),\n }),\n minBytes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Minimum bytes', bytesInfo),\n create: (p, m) => v.minBytes(p.value, m),\n }),\n maxBytes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Maximum bytes', bytesInfo),\n create: (p, m) => v.maxBytes(p.value, m),\n }),\n notBytes: defineRule({\n kinds,\n params: countParams,\n meta: meta('Not this many bytes', bytesInfo),\n create: (p, m) => v.notBytes(p.value, m),\n }),\n} satisfies Record<string, RuleDef>\n","import { comparisonRules } from './comparison-rules'\nimport { contentRules } from './content-rules'\nimport { dateRules } from './date-rules'\nimport { fileRules } from './file-rules'\nimport { formatRules } from './format-rules'\nimport { lengthRules } from './length-rules'\nimport { normalizeRules } from './normalize-rules'\nimport { numberRules } from './number-rules'\nimport { textUnitRules } from './text-unit-rules'\n\n/** Every built-in rule. Register single families with `includeDefaultRules: false`. */\nexport const defaultRules = {\n ...lengthRules,\n ...textUnitRules,\n ...contentRules,\n ...formatRules,\n ...dateRules,\n ...comparisonRules,\n ...numberRules,\n ...fileRules,\n ...normalizeRules,\n}\n","import type { AnyObjectSchema } from '../shared/valibot-types'\nimport type { FormRuleDef } from './form-rule-def'\n\nexport const defineFormRule = <T extends AnyObjectSchema>(def: FormRuleDef<T>): FormRuleDef<T> =>\n def\n","import * as v from 'valibot'\nimport { defineFormRule } from './define-form-rule'\nimport type { FormRuleDef } from './form-rule-def'\n\ntype Ordered = number | string\n\nconst meta = (label: string, description: string) =>\n ({ label, description, category: 'comparison' }) as const\n\n// A date field with `output: 'date'` holds a Date by the time form rules run. Two Dates are\n// compared by their time, because `===` compares the objects.\nconst comparable = (value: unknown) => (value instanceof Date ? value.getTime() : value)\n\nconst otherParams = v.object({ other: v.string() })\n\nconst operators = {\n lt: (a: Ordered, b: Ordered) => a < b,\n lte: (a: Ordered, b: Ordered) => a <= b,\n gt: (a: Ordered, b: Ordered) => a > b,\n gte: (a: Ordered, b: Ordered) => a >= b,\n}\n\n/** Every built-in form rule. */\nexport const defaultFormRules = {\n sameAs: defineFormRule({\n params: otherParams,\n reads: (params) => [params.other],\n kinds: ['string', 'number', 'boolean', 'date'],\n sameKind: true,\n meta: meta('Same as', 'Equals another field, e.g. to confirm a password'),\n check: ([value, other]) => comparable(value) === comparable(other),\n }),\n differentFrom: defineFormRule({\n params: otherParams,\n reads: (params) => [params.other],\n kinds: ['string', 'number', 'boolean', 'date'],\n sameKind: true,\n meta: meta('Different from', 'Differs from another field, e.g. a new password'),\n check: ([value, other]) => comparable(value) !== comparable(other),\n }),\n compare: defineFormRule({\n params: v.object({ op: v.picklist(['lt', 'lte', 'gt', 'gte']), other: v.string() }),\n reads: (params) => [params.other],\n kinds: ['number', 'date'],\n sameKind: true,\n meta: meta('Compare', 'Less or greater than another field, e.g. an end date after the start'),\n check: ([value, other], { op }) =>\n operators[op](comparable(value) as Ordered, comparable(other) as Ordered),\n }),\n} satisfies Record<string, FormRuleDef>\n","import { defaultFieldTypes } from '../field-types/default-field-types'\nimport type { FieldTypeDef } from '../field-types/field-type-def'\nimport { defaultKinds } from '../kinds/default-kinds'\nimport type { KindDef } from '../kinds/kind-def'\nimport { defaultRules } from '../rules/default-rules'\nimport type { FormRuleDef } from '../rules/form-rule-def'\nimport { defaultFormRules } from '../rules/form-rules'\nimport type { RuleDef } from '../rules/rule-def'\n\nexport interface Registry {\n readonly kinds: Readonly<Record<string, KindDef>>\n readonly fieldTypes: Readonly<Record<string, FieldTypeDef>>\n readonly rules: Readonly<Record<string, RuleDef>>\n readonly formRules: Readonly<Record<string, FormRuleDef>>\n}\n\nexport interface RegistryOptions extends Partial<Registry> {\n /** With false, only the consumer's own rules and form rules are registered. Defaults to true. */\n includeDefaultRules?: boolean\n}\n\n/** Consumer entries replace defaults with the same key. */\nexport function mergeRegistry(custom: RegistryOptions): Registry {\n const defaults = custom.includeDefaultRules !== false\n return {\n kinds: Object.freeze({ ...defaultKinds, ...custom.kinds }),\n fieldTypes: Object.freeze({ ...defaultFieldTypes, ...custom.fieldTypes }),\n rules: Object.freeze({ ...(defaults ? defaultRules : {}), ...custom.rules }),\n formRules: Object.freeze({ ...(defaults ? defaultFormRules : {}), ...custom.formRules }),\n }\n}\n\nexport function lookup<T>(record: Readonly<Record<string, T>>, key: string): T | undefined {\n return Object.hasOwn(record, key) ? record[key] : undefined\n}\n","import type { AnyObjectSchema } from '../shared/valibot-types'\nimport type { ValueKind } from '../shared/value-kind'\nimport type { RuleDef } from './rule-def'\n\nconst cache = new WeakMap<RuleDef, Map<ValueKind, AnyObjectSchema>>()\n\nexport function paramsFor(def: RuleDef, kind: ValueKind): AnyObjectSchema | undefined {\n if (typeof def.params !== 'function') return def.params\n\n let byKind = cache.get(def)\n\n if (!byKind) {\n byKind = new Map()\n cache.set(def, byKind)\n }\n\n let params = byKind.get(kind)\n if (!params) {\n params = def.params(kind)\n byKind.set(kind, params)\n }\n\n return params\n}\n","import * as v from 'valibot'\nimport type { JsonField, JsonRule } from '../definition/json-form-schema'\nimport {\n type DefinitionPath,\n type DefinitionIssue,\n type DefinitionIssueCode,\n formatPath,\n} from '../errors/definition-error'\nimport type { FieldTypeDef, KindOf } from '../field-types/field-type-def'\nimport type { KindDef } from '../kinds/kind-def'\nimport type { RuleDef } from '../rules/rule-def'\nimport { paramsFor } from '../rules/rule-params'\nimport { lookup, type Registry } from './registry'\nimport {\n isReservedFieldKey,\n isReservedFormRuleKey,\n isReservedRuleKey,\n} from '../shared/reserved-keys'\nimport type { AnyObjectSchema } from '../shared/valibot-types'\nimport type { ValueKind } from '../shared/value-kind'\n\nexport interface CheckedField {\n /** Undefined for the field of a list's items, which has no name. */\n name: string | undefined\n field: JsonField\n path: DefinitionPath\n type: FieldTypeDef\n kind: KindDef\n /** The name of the kind, e.g. `'array'`. */\n valueKind: ValueKind\n rules: CheckedRule[]\n}\n\nexport interface CheckedRule {\n name: string\n def: RuleDef\n params: Record<string, unknown>\n message?: string\n /** True when the rule runs on each item of an array value, not on the array. */\n each: boolean\n}\n\n/** The kind of a field's value, and of its items when the value is an array. */\nexport interface FieldKinds {\n kind: ValueKind\n itemKind?: ValueKind\n}\n\nconst fieldShape = v.looseObject({\n name: v.optional(v.string()),\n type: v.string(),\n label: v.optional(v.string()),\n description: v.optional(v.string()),\n placeholder: v.optional(v.string()),\n default: v.optional(v.unknown()),\n required: v.optional(v.union([v.boolean(), v.strictObject({ message: v.optional(v.string()) })])),\n rules: v.optional(v.array(v.unknown())),\n ui: v.optional(v.record(v.string(), v.unknown())),\n})\nconst ruleShape = v.looseObject({ rule: v.string(), message: v.optional(v.string()) })\nconst noParams = v.object({})\n\n/**\n * Checks one field's shape, name, type, props and rules, and adds its issues to `issues`.\n * Returns the field ready to build, or undefined when it has issues or no value.\n *\n * `names` holds the names used so far at this level. It is undefined for the field of a list's\n * items, which needs no name.\n */\nexport function checkField(\n raw: unknown,\n path: DefinitionPath,\n registry: Registry,\n names: Set<string> | undefined,\n issues: DefinitionIssue[],\n): CheckedField | undefined {\n const shape = v.safeParse(fieldShape, raw)\n if (!shape.success) {\n issues.push(...toIssues('invalid_shape', path, shape.issues))\n return undefined\n }\n\n const field = shape.output as JsonField\n const issueCount = issues.length\n const type = lookup(registry.fieldTypes, field.type)\n // Only a fixed kind can be 'none'. A kind() function that returns it throws in kindDef.\n const hasValue = type?.kind !== 'none'\n\n if (!names) {\n // The field of a list's items has no name.\n } else if (!field.name) {\n if (type && hasValue) {\n issues.push(issue('missing_name', [...path, 'name'], 'A field needs a name'))\n }\n } else if (hasValue) {\n // A name is one key of the value. Paths like 'address.city' and 'lines[0]' use these as\n // separators.\n if (/[.[\\]]/.test(field.name)) {\n const message = `Name \"${field.name}\" can't contain \".\", \"[\" or \"]\"`\n issues.push(issue('invalid_name', [...path, 'name'], message))\n }\n if (names.has(field.name)) {\n issues.push(issue('duplicate_name', [...path, 'name'], `Duplicate name \"${field.name}\"`))\n }\n names.add(field.name)\n }\n\n if (!type) {\n issues.push(issue('unknown_type', [...path, 'type'], `Unknown field type \"${field.type}\"`))\n return undefined\n }\n\n const props = checkProps(field, type, path, issues)\n\n if (!hasValue) {\n for (const key of ['required', 'rules'] as const) {\n if (field[key] !== undefined) {\n const message = `A \"${field.type}\" field has no value, so it can't have \"${key}\"`\n issues.push(issue('invalid_shape', [...path, key], message))\n }\n }\n if (!names) {\n const message = `A list's items need a value, and a \"${field.type}\" field has none`\n issues.push(issue('invalid_shape', [...path, 'type'], message))\n }\n return undefined\n }\n\n // A kind that comes from a function needs the parsed props. Without them, the rules can't be\n // checked either; the props issues are reported already.\n const withProps = props && { ...field, ...props }\n const kind = resolveKind(type.kind, withProps)\n if (kind === undefined) return undefined\n const kinds: FieldKinds = {\n kind,\n itemKind: kind === 'array' ? resolveKind(type.itemKind, withProps) : undefined,\n }\n\n // A group is always there, and its fields decide what is required.\n if (type.container && kind === 'object') {\n for (const key of ['required', 'default'] as const) {\n if (field[key] !== undefined) {\n const message = `A \"${field.type}\" field is always there, so it can't have \"${key}\"`\n issues.push(issue('invalid_shape', [...path, key], message))\n }\n }\n }\n\n const fieldRules = (shape.output.rules ?? []).flatMap(\n (rule, j) => checkRule(rule, kinds, [...path, 'rules', j], registry, issues) ?? [],\n )\n if (issues.length > issueCount || (names && !field.name) || !withProps) return undefined\n\n const overridden = new Set(fieldRules.map((rule) => rule.name))\n const defaultRules = checkDefaultRules(field.type, type, kinds, registry).filter(\n (rule) => !overridden.has(rule.name),\n )\n\n return {\n name: field.name,\n field: withProps,\n path,\n type,\n kind: kindDef(field.type, kind, registry),\n valueKind: kind,\n rules: [...defaultRules, ...fieldRules],\n }\n}\n\nfunction resolveKind(\n kind: ValueKind | KindOf | undefined,\n field: JsonField | undefined,\n): ValueKind | undefined {\n if (typeof kind !== 'function') return kind\n return field && kind(field)\n}\n\n/** A kind that doesn't fit is a mistake in the field type, not in the definition. */\nfunction kindDef(typeName: string, kind: ValueKind, registry: Registry): KindDef {\n const at = `Field type \"${typeName}\"`\n if (kind === 'none') throw new TypeError(`${at}: kind() can't return 'none'`)\n const def = lookup(registry.kinds, kind)\n if (!def) throw new TypeError(`${at}: kind \"${kind}\" is not registered`)\n return def\n}\n\n/** Throws for a default rule that doesn't fit, because that is a mistake in the type. */\nfunction checkDefaultRules(\n typeName: string,\n type: FieldTypeDef,\n kinds: FieldKinds,\n registry: Registry,\n): CheckedRule[] {\n const issues: DefinitionIssue[] = []\n const rules = (type.defaultRules ?? []).flatMap(\n (rule, j) => checkRule(rule, kinds, ['defaultRules', j], registry, issues) ?? [],\n )\n const [first] = issues\n if (first) {\n throw new TypeError(`Field type \"${typeName}\": ${formatPath(first.path)}: ${first.message}`)\n }\n return rules\n}\n\nfunction checkProps(\n field: JsonField,\n type: FieldTypeDef,\n path: DefinitionPath,\n issues: DefinitionIssue[],\n): Record<string, unknown> | undefined {\n const propKeys = Object.keys(type.props?.entries ?? {})\n const input: Record<string, unknown> = {}\n\n for (const key of Object.keys(field)) {\n if (isReservedFieldKey(key)) continue\n if (propKeys.includes(key)) {\n input[key] = field[key]\n } else {\n issues.push(\n issue('unknown_key', [...path, key], `Unknown key \"${key}\" on a \"${field.type}\" field`),\n )\n }\n }\n\n if (!type.props) return {}\n const parsed = v.safeParse(type.props, input)\n if (parsed.success) return parsed.output\n issues.push(...toIssues('invalid_props', path, parsed.issues))\n return undefined\n}\n\nexport function checkRule(\n raw: unknown,\n { kind, itemKind }: FieldKinds,\n path: DefinitionPath,\n registry: Registry,\n issues: DefinitionIssue[],\n): CheckedRule | undefined {\n const shape = v.safeParse(ruleShape, raw)\n if (!shape.success) {\n issues.push(...toIssues('invalid_shape', path, shape.issues))\n return undefined\n }\n\n const rule: JsonRule = shape.output\n const def = lookup(registry.rules, rule.rule)\n if (!def) {\n issues.push(issue('unknown_rule', [...path, 'rule'], `Unknown rule \"${rule.rule}\"`))\n return undefined\n }\n\n // A rule for the items of an array, but not for arrays, runs on each item.\n const each = !def.kinds.includes(kind) && !!itemKind && def.kinds.includes(itemKind)\n\n // Params can depend on the kind, so they can't be checked for a kind the rule doesn't support.\n if (!def.kinds.includes(kind) && !each) {\n const items = itemKind ? ` or their ${itemKind} items` : ''\n const message = `Rule \"${rule.rule}\" can't be used on ${kind} fields${items}`\n issues.push(issue('kind_mismatch', [...path, 'rule'], message))\n return undefined\n }\n\n const params = checkParams(\n rule,\n paramsFor(def, each ? (itemKind as ValueKind) : kind),\n isReservedRuleKey,\n `Rule \"${rule.rule}\"`,\n path,\n issues,\n )\n if (!params) return undefined\n\n return { name: rule.rule, def, params, message: rule.message, each }\n}\n\n/**\n * Checks the params of a rule or a form rule. Every key that isn't reserved must be one of\n * `params`, and together they must pass it. Returns the parsed params, or undefined when they\n * have issues. `at` names the rule in messages, e.g. `Rule \"minLength\"`.\n */\nexport function checkParams(\n raw: Record<string, unknown>,\n params: AnyObjectSchema | undefined,\n isReserved: (key: string) => boolean,\n at: string,\n path: DefinitionPath,\n issues: DefinitionIssue[],\n): Record<string, unknown> | undefined {\n const issueCount = issues.length\n const paramKeys = Object.keys(params?.entries ?? {})\n const input: Record<string, unknown> = {}\n for (const key of Object.keys(raw)) {\n if (isReserved(key)) continue\n if (paramKeys.includes(key)) {\n input[key] = raw[key]\n } else {\n issues.push(issue('unknown_param', [...path, key], `${at} has no param \"${key}\"`))\n }\n }\n\n const parsed = v.safeParse(params ?? noParams, input)\n if (!parsed.success) issues.push(...toIssues('invalid_params', path, parsed.issues))\n if (!parsed.success || issues.length > issueCount) return undefined\n return parsed.output\n}\n\nexport function checkRegistry(registry: Registry): void {\n for (const [name, rule] of Object.entries(registry.rules)) {\n // Params can depend on the kind, so check them for every kind the rule supports.\n for (const kind of rule.kinds) {\n for (const key of Object.keys(paramsFor(rule, kind)?.entries ?? {})) {\n if (isReservedRuleKey(key)) {\n throw new TypeError(`Rule \"${name}\": params can't use the reserved key \"${key}\"`)\n }\n }\n }\n }\n\n for (const [name, rule] of Object.entries(registry.formRules)) {\n for (const key of Object.keys(rule.params?.entries ?? {})) {\n if (isReservedFormRuleKey(key)) {\n throw new TypeError(`Form rule \"${name}\": params can't use the reserved key \"${key}\"`)\n }\n }\n }\n\n for (const [name, type] of Object.entries(registry.fieldTypes)) {\n const at = `Field type \"${name}\"`\n for (const kind of [type.kind, type.itemKind]) {\n if (typeof kind === 'string' && !lookup(registry.kinds, kind)) {\n throw new TypeError(`${at}: kind \"${kind}\" is not registered`)\n }\n }\n if (type.container && type.kind !== 'object' && type.kind !== 'array') {\n throw new TypeError(`${at}: a container's kind must be 'object' or 'array'`)\n }\n if (type.kind !== 'none' && !type.schema) {\n throw new TypeError(`${at}: schema() is required unless the kind is 'none'`)\n }\n for (const key of Object.keys(type.props?.entries ?? {})) {\n if (isReservedFieldKey(key)) {\n throw new TypeError(`${at}: props can't use the reserved key \"${key}\"`)\n }\n }\n\n // A kind from a function is only known per field, so checkField checks those default rules.\n if (typeof type.kind === 'string' && typeof type.itemKind !== 'function') {\n const kinds: FieldKinds = {\n kind: type.kind,\n itemKind: type.kind === 'array' ? type.itemKind : undefined,\n }\n checkDefaultRules(name, type, kinds, registry)\n }\n }\n}\n\nexport function issue(\n code: DefinitionIssueCode,\n path: DefinitionPath,\n message: string,\n): DefinitionIssue {\n return { code, path, message }\n}\n\nexport function toIssues(\n code: DefinitionIssueCode,\n path: DefinitionPath,\n valibotIssues: readonly v.BaseIssue<unknown>[],\n): DefinitionIssue[] {\n return valibotIssues.map((valibotIssue) => {\n const keys = valibotIssue.path?.map((item) => item.key as string | number) ?? []\n return issue(code, [...path, ...keys], valibotIssue.message)\n })\n}\n","import * as v from 'valibot'\nimport type { JsonField, JsonFormRule } from '../definition/json-form-schema'\nimport type { DefinitionIssue, DefinitionPath } from '../errors/definition-error'\nimport type { FormRuleDef } from '../rules/form-rule-def'\nimport { isReservedFormRuleKey } from '../shared/reserved-keys'\nimport { lookup, type Registry } from './registry'\nimport { type CheckedField, checkParams, issue, toIssues } from './validate-definition'\n\nexport interface CheckedFormRule {\n name: string\n def: FormRuleDef\n params: Record<string, unknown>\n message: string\n /** Where the rule is in the definition, e.g. `['formRules', 0]`. */\n path: DefinitionPath\n /** The field the error shows on. */\n field: JsonField\n /** Where `field` and the paths from `reads()` are, split into keys: `['lines', '*', 'qty']`. */\n paths: string[][]\n}\n\n// A form rule needs its own message: Valibot's would only say the value is invalid.\nconst ruleShape = v.looseObject({ rule: v.string(), field: v.string(), message: v.string() })\n\n/**\n * Checks the definition's form rules against the fields the compiler built, and adds their\n * issues to `issues`. Returns the rules that are ready to build.\n */\nexport function checkFormRules(\n rules: readonly unknown[],\n registry: Registry,\n fieldsByPath: ReadonlyMap<string, CheckedField | null>,\n issues: DefinitionIssue[],\n): CheckedFormRule[] {\n return rules.flatMap(\n (raw, i) => checkFormRule(raw, ['formRules', i], registry, fieldsByPath, issues) ?? [],\n )\n}\n\nfunction checkFormRule(\n raw: unknown,\n path: DefinitionPath,\n registry: Registry,\n fieldsByPath: ReadonlyMap<string, CheckedField | null>,\n issues: DefinitionIssue[],\n): CheckedFormRule | undefined {\n const shape = v.safeParse(ruleShape, raw)\n if (!shape.success) {\n issues.push(...toIssues('invalid_shape', path, shape.issues))\n return undefined\n }\n\n const rule: JsonFormRule = shape.output\n const at = `Form rule \"${rule.rule}\"`\n const def = lookup(registry.formRules, rule.rule)\n if (!def) {\n issues.push(issue('unknown_rule', [...path, 'rule'], `Unknown form rule \"${rule.rule}\"`))\n return undefined\n }\n\n const params = checkParams(rule, def.params, isReservedFormRuleKey, at, path, issues)\n if (!params) return undefined\n\n const dotPaths = [rule.field, ...def.reads(params)]\n const paths = dotPaths.map((dotPath) => dotPath.split('.'))\n const fieldKeys = paths[0] as string[]\n const issueCount = issues.length\n const fields = dotPaths.map((dotPath, i) => {\n const found = findField(dotPath, fieldsByPath)\n const message =\n typeof found === 'string' ? found : i > 0 && outsideItem(paths[i] as string[], fieldKeys)\n if (!message) return found as CheckedField | null\n // `field` has its own key. The paths from reads() come from the params, so their issues go on\n // the rule.\n issues.push(issue('unknown_field', i === 0 ? [...path, 'field'] : path, message))\n return null\n })\n if (issues.length > issueCount) return undefined\n\n // A field with issues of its own has them reported already.\n if (fields.some((field) => !field)) return undefined\n const checked = fields as CheckedField[]\n\n const kinds = checked.map((field) => field.valueKind)\n const wrong = kinds.find((kind) => def.kinds && !def.kinds.includes(kind))\n if (wrong !== undefined) {\n const message = `${at} can't be used on ${wrong} fields`\n issues.push(issue('kind_mismatch', [...path, 'rule'], message))\n return undefined\n }\n if (def.sameKind && new Set(kinds).size > 1) {\n const message = `${at} needs fields of one kind, not ${[...new Set(kinds)].join(' and ')}`\n issues.push(issue('kind_mismatch', [...path, 'rule'], message))\n return undefined\n }\n\n const field = (checked[0] as CheckedField).field\n return { name: rule.rule, def, params, message: rule.message, path, field, paths }\n}\n\n/**\n * The field with a value at `dotPath`. Null when a field on the way has issues of its own, and\n * the issue's message when there is no such field.\n */\nfunction findField(\n dotPath: string,\n fieldsByPath: ReadonlyMap<string, CheckedField | null>,\n): CheckedField | null | string {\n const keys = dotPath.split('.')\n let found: CheckedField | null | undefined\n for (let i = 1; i <= keys.length; i++) {\n found = fieldsByPath.get(keys.slice(0, i).join('.'))\n if (found === null) return null\n if (found) continue\n // The items of a list of objects have no field of their own. The next key is checked.\n if (keys[i - 1] === '*' && i < keys.length) continue\n const parent = fieldsByPath.get(keys.slice(0, i - 1).join('.'))\n if (parent?.valueKind === 'array' && keys[i - 1] !== '*') {\n const withStar = [...keys.slice(0, i - 1), '*', ...keys.slice(i - 1)].join('.')\n return `Unknown field \"${dotPath}\". A list's items are read with \"*\": \"${withStar}\"`\n }\n return `Unknown field \"${dotPath}\"`\n }\n return found ?? `Unknown field \"${dotPath}\"`\n}\n\n/**\n * A path into the items of a list is read once per item, so `field` must be in the same items.\n * Returns the issue's message when it isn't.\n */\nfunction outsideItem(keys: string[], fieldKeys: string[]): string | undefined {\n const star = keys.lastIndexOf('*')\n const item = (path: string[]) => path.slice(0, star + 1).join('.')\n if (star === -1 || item(keys) === item(fieldKeys)) return undefined\n const list = keys.slice(0, star).join('.')\n const read = keys.join('.')\n return `\"${read}\" is read from each item of \"${list}\", so \"${fieldKeys.join('.')}\" must be too`\n}\n","import * as v from 'valibot'\nimport type { AnyAction } from '../shared/valibot-types'\nimport type { CheckedFormRule } from './check-form-rules'\n\ntype Path = readonly (string | number)[]\n\n/**\n * Runs a form rule on the form's value and puts its issue on `field`. A rule on the fields of a\n * list's items runs once per item, with the item's index in place of each `'*'`.\n *\n * The rule only runs when none of the fields it reads has an issue. `v.partialCheck` can't do\n * this: it runs whenever the form has no schema issues, even when a field it reads failed a rule.\n */\nexport function formRuleAction(rule: CheckedFormRule, message: string): AnyAction {\n const { def, params, paths } = rule\n const fieldKeys = paths[0] as string[]\n\n return v.rawCheck(({ dataset, addIssue }) => {\n for (const indexes of itemIndexes(dataset.value, fieldKeys)) {\n const read = paths.map((keys) => withIndexes(keys, indexes))\n if (read.some((path) => hasIssue(dataset.issues, path))) continue\n\n const values = read.map((path) => valueAt(dataset.value, path))\n // Like a field's rules, a form rule never runs on an empty value.\n if (values.includes(undefined) || def.check(values, params)) continue\n\n const field = read[0] as Path\n addIssue({ message, input: values[0], path: issuePath(dataset.value, field) })\n }\n })\n}\n\n/** Replaces each `'*'` in `keys` with the next index. */\nconst withIndexes = (keys: readonly string[], indexes: readonly number[]): Path => {\n let next = 0\n return keys.map((key) => (key === '*' ? (indexes[next++] as number) : key))\n}\n\nconst valueAt = (input: unknown, path: Path): unknown =>\n path.reduce<unknown>(\n (value, key) =>\n typeof value === 'object' && value !== null\n ? (value as Record<string | number, unknown>)[key]\n : undefined,\n input,\n )\n\n/** True when an issue is on `path`, inside it, or on a value that holds it. */\nconst hasIssue = (issues: readonly v.BaseIssue<unknown>[] | undefined, path: Path) =>\n !!issues?.some((issue) =>\n (issue.path ?? []).every((item, i) => i >= path.length || item.key === path[i]),\n )\n\n/** Valibot's path to `path` in `input`, the way an object or array schema reports it. */\nconst issuePath = (input: unknown, path: Path) =>\n path.map((key, i) => {\n const parent = valueAt(input, path.slice(0, i))\n return {\n type: Array.isArray(parent) ? 'array' : 'object',\n origin: 'value',\n input: parent,\n key,\n value: valueAt(parent, [key]),\n }\n }) as unknown as [v.IssuePathItem, ...v.IssuePathItem[]]\n\n/** The indexes for each `'*'` in `keys`, for every item `value` has there. */\nfunction* itemIndexes(\n value: unknown,\n keys: readonly string[],\n indexes: readonly number[] = [],\n): Generator<readonly number[], void, undefined> {\n const star = keys.indexOf('*')\n if (star === -1) {\n yield indexes\n return\n }\n const list = valueAt(value, keys.slice(0, star))\n if (!Array.isArray(list)) return\n for (const [i, item] of list.entries()) {\n yield* itemIndexes(item, keys.slice(star + 1), [...indexes, i])\n }\n}\n","import * as v from 'valibot'\nimport type { DefinitionIssue, DefinitionPath } from '../errors/definition-error'\nimport type { BuildContext } from '../field-types/field-type-def'\nimport type { AnySchema } from '../shared/valibot-types'\nimport { buildFieldSchema, type Messages } from './build-field-schema'\nimport { checkFormRules } from './check-form-rules'\nimport { formRuleAction } from './form-rule-action'\nimport { lookup, type Registry } from './registry'\nimport { type CheckedField, checkField, toIssues } from './validate-definition'\n\nexport interface CompileResult {\n /** Every issue in the definition, in document order. */\n issues: DefinitionIssue[]\n /** The form's schema. Only complete when there are no issues. */\n schema: FieldsSchema\n}\n\n/** The schema of a list of fields: an object with a key for each field that has a value. */\nexport type FieldsSchema = v.ObjectSchema<v.ObjectEntries, undefined>\n\nconst formShape = v.object({\n version: v.string(),\n fields: v.array(v.unknown()),\n formRules: v.optional(v.array(v.unknown())),\n})\n\n/**\n * Checks a definition and builds its schema in the same pass, so `validate()` and `build()`\n * always agree. Never throws on bad input.\n */\nexport function compileDefinition(\n json: unknown,\n registry: Registry,\n messages: Messages,\n): CompileResult {\n const issues: DefinitionIssue[] = []\n\n const form = v.safeParse(formShape, json)\n if (!form.success) {\n return { issues: toIssues('invalid_shape', [], form.issues), schema: v.object({}) }\n }\n\n if (form.output.version !== '1') {\n const message = `Unsupported version \"${form.output.version}\". This package reads version '1'.`\n issues.push({ code: 'unsupported_version', path: ['version'], message })\n return { issues, schema: v.object({}) }\n }\n\n const compiler = createCompiler(registry, messages, issues)\n const schema = compiler.fields(form.output.fields, ['fields'])\n const rules = checkFormRules(form.output.formRules ?? [], registry, compiler.fieldsByPath, issues)\n if (issues.length || !rules.length) return { issues, schema }\n\n // Form rules run after every field's schema, on the whole value. They only check, so the schema\n // keeps the object's type, entries and output, and Formisch still keeps a field for each entry.\n const withRules = rules.reduce<AnySchema>((acc, rule) => {\n const ctx = { field: rule.field, rule: rule.name, path: rule.path }\n return v.pipe(acc, formRuleAction(rule, messages.resolve(rule.message, ctx)))\n }, schema)\n return { issues, schema: withRules as FieldsSchema }\n}\n\nexport interface Compiler {\n /** Checks and builds a list of fields. `path` is where the list is, e.g. `['fields']`. */\n fields(fields: readonly unknown[], path: DefinitionPath): FieldsSchema\n /** Checks and builds the field of a list's items, which needs no name. */\n field(field: unknown, path: DefinitionPath): AnySchema\n /**\n * Every field with a value that the compiler has seen, by where its value is, as a dot path:\n * `'address.city'`, or `'lines.*.quantity'` for the fields of a list's items. A field with\n * issues is null.\n */\n readonly fieldsByPath: ReadonlyMap<string, CheckedField | null>\n}\n\n/** Every field the compiler checks adds its issues to `issues`. */\nexport function createCompiler(\n registry: Registry,\n messages: Messages,\n issues: DefinitionIssue[],\n): Compiler {\n // A field type builds its child fields through these, so it never imports the builder.\n const context = (path: DefinitionPath): BuildContext => ({\n path,\n buildFields: fields,\n buildField: field,\n })\n\n const fieldsByPath = new Map<string, CheckedField | null>()\n // Where the values of the child fields go, for each container whose schema() is running.\n const parents: DataPath[] = []\n const parentPath = (): DataPath => parents.at(-1) ?? []\n\n function fields(list: readonly unknown[], path: DefinitionPath): FieldsSchema {\n const entries: v.ObjectEntries = {}\n const names = new Set<string>()\n list.forEach((raw, i) => {\n const checked = checkField(raw, [...path, i], registry, names, issues)\n const name = checked ? checked.name : nameOf(raw)\n if (name === undefined) return\n const dataPath = [...parentPath(), name]\n remember(raw, checked, dataPath)\n if (checked) entries[name] = build(checked, dataPath)\n })\n return v.object(entries)\n }\n\n function field(raw: unknown, path: DefinitionPath): AnySchema {\n const checked = checkField(raw, path, registry, undefined, issues)\n // The field of a list's items has no name: its value is the item itself.\n const dataPath = parentPath()\n remember(raw, checked, dataPath)\n // A field with issues gets no schema. build() throws before anything parses with it.\n return checked ? build(checked, dataPath) : v.never()\n }\n\n function build(checked: CheckedField, dataPath: DataPath): AnySchema {\n // The fields of a list's items have no fixed index, so their paths have '*' in its place.\n parents.push(checked.valueKind === 'array' ? [...dataPath, '*'] : dataPath)\n try {\n const schema = buildFieldSchema(checked, messages, context(checked.path))\n checkDefault(checked, schema, issues)\n return schema\n } finally {\n parents.pop()\n }\n }\n\n /** The first field at a path wins, as with duplicate names. Display elements are left out. */\n function remember(raw: unknown, checked: CheckedField | undefined, dataPath: DataPath): void {\n const key = dataPath.join('.')\n if (fieldsByPath.has(key) || (!checked && !hasValue(raw, registry))) return\n fieldsByPath.set(key, checked ?? null)\n }\n\n return { fields, field, fieldsByPath }\n}\n\ntype DataPath = readonly string[]\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null\n\nconst nameOf = (raw: unknown) =>\n isRecord(raw) && typeof raw.name === 'string' ? raw.name : undefined\n\n/** An unknown type counts as one with a value, so a form rule that reads the field is fine. */\nconst hasValue = (raw: unknown, registry: Registry) =>\n isRecord(raw) &&\n typeof raw.type === 'string' &&\n lookup(registry.fieldTypes, raw.type)?.kind !== 'none'\n\n/** A default must be a value the field accepts. An empty one is the same as none. */\nfunction checkDefault(\n { field, kind, path }: CheckedField,\n schema: AnySchema,\n issues: DefinitionIssue[],\n): void {\n if (field.default === undefined || kind.isEmpty(field.default)) return\n const result = v.safeParse(schema, field.default)\n if (!result.success) {\n issues.push(...toIssues('invalid_default', [...path, 'default'], result.issues))\n }\n}\n","import { DefinitionError, type DefinitionIssue } from '../errors/definition-error'\nimport type { BuildContext } from '../field-types/field-type-def'\nimport type { Messages } from './build-field-schema'\nimport { type Compiler, createCompiler } from './compile-definition'\nimport { mergeRegistry } from './registry'\n\nconst messages: Messages = { required: 'Required', resolve: (text) => text }\n\n/**\n * A build context for testing a field type on its own, without a definition around it.\n * `buildFields` and `buildField` use the default registries and throw a `DefinitionError` when\n * the child fields have issues. `overrides` replaces any member, e.g. `path`.\n */\nexport function createBuildContext(overrides: Partial<BuildContext> = {}): BuildContext {\n const registry = mergeRegistry({})\n\n const run = <T>(compile: (compiler: Compiler) => T): T => {\n const issues: DefinitionIssue[] = []\n const result = compile(createCompiler(registry, messages, issues))\n if (issues.length) throw new DefinitionError(issues)\n return result\n }\n\n return {\n path: [],\n buildFields: (fields, path) => run((compiler) => compiler.fields(fields, path)),\n buildField: (field, path) => run((compiler) => compiler.field(field, path)),\n ...overrides,\n }\n}\n","import type { KindDef } from '../kinds/kind-def'\nimport type { FieldTypeDef } from '../field-types/field-type-def'\nimport type { FormRuleDef } from '../rules/form-rule-def'\nimport type { RuleDef } from '../rules/rule-def'\nimport type { MessageContext, Messages } from './build-field-schema'\nimport { compileDefinition } from './compile-definition'\nimport { mergeRegistry } from './registry'\nimport { checkRegistry } from './validate-definition'\nimport { DefinitionError, type ValidateResult } from '../errors/definition-error'\nimport type { JsonForm } from '../definition/json-form-schema'\nimport type { ValueKind } from '../shared/value-kind'\n\nexport interface SchemaBuilderOptions {\n kinds?: Record<string, KindDef>\n fieldTypes?: Record<string, FieldTypeDef>\n rules?: Record<string, RuleDef>\n formRules?: Record<string, FormRuleDef>\n /** With false, only your own rules and form rules are registered. Defaults to true. */\n includeDefaultRules?: boolean\n messages?: { required?: string }\n /**\n * Called with every message from the definition and with `messages.required`, e.g. to treat\n * them as i18n keys. Return undefined to use the text as written.\n */\n resolveMessage?(key: string, ctx: MessageContext): string | undefined\n}\n\nexport function createSchemaBuilder(options: SchemaBuilderOptions = {}) {\n const registry = mergeRegistry(options)\n checkRegistry(registry)\n\n const messages: Messages = {\n required: options.messages?.required ?? 'Required',\n resolve: (text, ctx) => options.resolveMessage?.(text, ctx) ?? text,\n }\n\n /** Every issue in the definition, in document order. Never throws on bad input. */\n function validate(json: unknown): ValidateResult {\n const { issues } = compileDefinition(json, registry, messages)\n return issues.length ? { success: false, issues } : { success: true, issues: [] }\n }\n\n function build(json: JsonForm) {\n const { issues, schema } = compileDefinition(json, registry, messages)\n if (issues.length) throw new DefinitionError(issues)\n return schema\n }\n\n /**\n * The registered rules that can be used on a field of `kind`, e.g. for a rule picker.\n */\n function rulesForKind(kind: ValueKind): [name: string, def: RuleDef][] {\n return Object.entries(registry.rules).filter(([, def]) => def.kinds.includes(kind))\n }\n\n return {\n build,\n validate,\n rulesForKind,\n kinds: registry.kinds,\n fieldTypes: registry.fieldTypes,\n rules: registry.rules,\n formRules: registry.formRules,\n }\n}\n","import type { JsonField, JsonForm } from './json-form-schema'\n\n/**\n * Formisch's `initialInput` for a definition: each field's `default`, nested the way the value\n * is. A group gives an object, and an array without a default gives `[]`. Other fields without\n * a default are left out. Like `walkFields`, it reads the built-in `group` and `array` types\n * and needs no builder.\n */\nexport function getInitialInput(definition: JsonForm): Record<string, unknown> {\n return inputOf(definition.fields)\n}\n\nfunction inputOf(fields: readonly JsonField[]): Record<string, unknown> {\n const input: Record<string, unknown> = {}\n for (const field of fields) {\n if (field.name === undefined) continue\n const value = initialValue(field)\n if (value !== undefined) input[field.name] = value\n }\n return input\n}\n\nfunction initialValue(field: JsonField): unknown {\n if (field.type === 'group') return inputOf(Array.isArray(field.fields) ? field.fields : [])\n if (field.type === 'array') return field.default ?? []\n return field.default\n}\n","import type { DefinitionPath } from '../errors/definition-error'\nimport type { JsonField, JsonForm } from './json-form-schema'\n\n/** One field found by `walkFields`. */\nexport interface WalkedField {\n field: JsonField\n /** The field's type, e.g. `'text'`. */\n type: string\n /**\n * Where the field's value is, as a Formisch path: `['address', 'city']`. The items of an array\n * have no fixed index, so they have `'*'` in its place. A field without a name, like a\n * heading, has its parent's path.\n */\n dataPath: readonly (string | number)[]\n /** Where the field is in the definition: `['fields', 1, 'fields', 0]`. */\n definitionPath: DefinitionPath\n /** 0 for the form's own fields, 1 for the fields inside them, and so on. */\n depth: number\n}\n\n/**\n * Every field of a definition, at every depth, in document order. A group or an array comes\n * before its fields, and the fields of an array's items come once. It reads the built-in\n * `group` and `array` types and needs no builder, so it doesn't check the definition: run\n * `validate()` first.\n */\nexport function* walkFields(definition: JsonForm): Generator<WalkedField, void, undefined> {\n yield* walkList(definition.fields, ['fields'], [], 0)\n}\n\nfunction* walkList(\n fields: readonly JsonField[],\n at: DefinitionPath,\n dataPath: readonly (string | number)[],\n depth: number,\n): Generator<WalkedField, void, undefined> {\n for (const [i, field] of fields.entries()) {\n const path = field.name === undefined ? dataPath : [...dataPath, field.name]\n yield* walkField(field, [...at, i], path, depth)\n }\n}\n\nfunction* walkField(\n field: JsonField,\n definitionPath: DefinitionPath,\n dataPath: readonly (string | number)[],\n depth: number,\n): Generator<WalkedField, void, undefined> {\n yield { field, type: field.type, dataPath, definitionPath, depth }\n\n if (field.type === 'group' && Array.isArray(field.fields)) {\n yield* walkList(field.fields, [...definitionPath, 'fields'], dataPath, depth + 1)\n } else if (field.type === 'array') {\n const items = [...dataPath, '*']\n if (isField(field.of)) {\n // The field of a list of single values has no name: its value is the item itself.\n yield* walkField(field.of, [...definitionPath, 'of'], items, depth + 1)\n } else if (Array.isArray(field.fields)) {\n yield* walkList(field.fields, [...definitionPath, 'fields'], items, depth + 1)\n }\n }\n}\n\nconst isField = (value: unknown): value is JsonField =>\n typeof value === 'object' && value !== null && 'type' in value\n"],"mappings":";;AA8BA,SAAgB,WAAW,MAA8B;CACvD,OAAO,KAAK,QAAgB,KAAK,QAAQ;EACvC,IAAI,OAAO,QAAQ,UAAU,OAAO,GAAG,IAAI,GAAG,IAAI;EAClD,OAAO,MAAM,GAAG,IAAI,GAAG,QAAQ;CACjC,GAAG,EAAE;AACP;;AAGA,IAAa,kBAAb,cAAqC,MAAM;CACzC;CAEA,YAAY,QAAoC;EAC9C,MAAM,QAAQ,OAAO,KAClB,UAAU,MAAM,WAAW,MAAM,IAAI,KAAK,SAAS,IAAI,MAAM,SAChE;EACA,MAAM,6BAA6B,MAAM,KAAK,IAAI,GAAG;EACrD,K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O,UAAU,YAAY,UAAU,QAAQ,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatsaaaa/form-builder-schema",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Build Formisch-ready Valibot schemas from JSON form definitions.",
5
5
  "keywords": [
6
6
  "form",