@ilokesto/form 2.0.3 → 2.0.4
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/README.ko.md +1 -1
- package/README.md +1 -1
- package/dist/{chunk-M7Y4OJPP.js → chunk-FJ6OHNA5.js} +133 -40
- package/dist/chunk-FJ6OHNA5.js.map +1 -0
- package/dist/{chunk-WO5TIXCR.js → chunk-GNWYMWEC.js} +5 -4
- package/dist/chunk-GNWYMWEC.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +32 -18
- package/dist/react/index.js.map +1 -1
- package/dist/solid/index.js +2 -2
- package/dist/svelte/index.js +2 -2
- package/dist/vue/index.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-M7Y4OJPP.js.map +0 -1
- package/dist/chunk-WO5TIXCR.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/array/ArrayKeyGenerator.ts","../src/core/array/ArrayItemReorder.ts","../src/core/array/FormArrayMutationPlanner.ts","../src/core/path/FormPath.ts","../src/core/array/FormArrayPath.ts","../src/core/state/FieldStateFactory.ts","../src/core/state/FormStateInitializer.ts","../src/core/value/ValueHelper.ts","../src/core/state/FormStateReader.ts","../src/core/array/FormArrayRebaser.ts","../src/core/array/FormArrayController.ts","../src/core/form/FormSubmitter.ts","../src/core/state/FormStateStore.ts","../src/core/validation/StandardSchemaValidator.ts","../src/core/validation/ValidationSequencer.ts","../src/core/validation/ValidationSnapshot.ts","../src/core/validation/ValidationEngine.ts","../src/core/form/CreateForm.ts"],"names":[],"mappings":";;;;AAOO,IAAM,oBAAN,MAAwB;AAAA;AAAA,EAErB,EAAA,GAAK,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWN,MAAA,GAAiB;AACtB,IAAA,IAAA,CAAK,EAAA,IAAM,CAAA;AACX,IAAA,OAAO,CAAA,K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AAA,CAAI,CAAA,IAAA,KAAQ,QAAA,CAAS,cAAA,CAAe,IAAI,CAAC,IAAI,MAAS,CAAA;AAAA,EACxG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,WAAW,KAAA,EAA2C;AAC3D,IAAA,IAAI,KAAA,CAAM,WAAW,CAAA,EAAG;AACtB,MAAA,OAAO,IAAA,CAAK,UAAA,CAAW,wBAAA,CAAyB,QAAQ,CAAA;AAAA,IAC1D;AAEA,IAAA,OAAO,IAAA,CAAK,UAAA,CAAW,cAAA,CAAe,KAAA,CAAM,GAAA,CAAI,CAAA,IAAA,KAAQ,QAAA,CAAS,cAAA,CAAe,IAAI,CAAC,CAAA,EAAG,QAAQ,CAAA;AAAA,EAClG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBO,MAAM,IAAA,EAAiC;AAC5C,IAAA,OAAO,IAAI,oBAAoB,IAAA,CAAK,KAAA,EAAO,KAAK,SAAA,EAAW,QAAA,CAAS,WAAA,CAAY,IAAI,CAAC,CAAA;AAAA,EACvF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeO,KAAA,CAAM,QAAkB,OAAA,EAA8B;AAC3D,IAAA,IAAA,CAAK,KAAA,CAAM,KAAA,CAAM,MAAA,EAAQ,OAAO,CAAA;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYO,MAAA,CACL,SACA,SAAA,EAC8B;AAC9B,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,MAAA,CAAO,OAAA,EAAS,SAAS,CAAA;AAAA,EACjD;AACF","file":"chunk-M7Y4OJPP.js","sourcesContent":["/**\n * @description Allocates form-local item-N keys for items added at runtime; initial items use deterministic initial-N keys.\n * @example\n * ```ts\n * const key = new ArrayKeyGenerator().create();\n * ```\n */\nexport class ArrayKeyGenerator {\n /** 다음 key에 사용할 증가 숫자다. */\n private id = 0;\n\n /**\n * @description Allocate the next item-N rendering key; numbering starts at item-1 for this generator.\n * @returns {string} Next form-local key in item-N format.\n * @example\n * ```ts\n * const keys = new ArrayKeyGenerator();\n * const key = keys.create();\n * ```\n */\n public create(): string {\n this.id += 1;\n return `item-${this.id}`;\n }\n}\n","/**\n * 이전 배열 index를 다음 배열 index로 변환하는 함수다.\n *\n * @returns item이 삭제되어 더 이상 존재하지 않으면 undefined.\n */\nexport type IndexMapper = (index: number) => number | undefined;\n\n/**\n * @description Provides immutable array reorder operations and old-to-new index mapping.\n * @example\n * ```ts\n * const moved = ArrayItemReorder.moveItem([\"Ada\", \"Lin\"], 0, 1);\n * ```\n */\nexport class ArrayItemReorder {\n /**\n * @description Build an old-to-new index mapper; removed and out-of-range old indexes resolve to undefined.\n * @param {number} previousLength - Array length before the reorder.\n * @param {readonly number[]} nextOrder - Old item indexes in next order; -1 denotes a newly inserted item.\n * @returns {IndexMapper} Mapper returning the next index, or undefined when the old item was removed.\n * @example\n * ```ts\n * ArrayItemReorder.createIndexMapper(2, [1, 0]);\n * ```\n */\n public static createIndexMapper(previousLength: number, nextOrder: readonly number[]): IndexMapper {\n const positions = new Map<number, number>();\n\n nextOrder.forEach((previousIndex, nextIndex) => {\n if (previousIndex >= 0 && previousIndex < previousLength) {\n positions.set(previousIndex, nextIndex);\n }\n });\n\n return index => positions.get(index);\n }\n\n /**\n * @description Return a copied array with one item moved to the destination index.\n * @param {readonly T[]} items - Items to reorder without mutating the input.\n * @param {number} fromIndex - Original index of the item to move.\n * @param {number} toIndex - Destination index of the moved item.\n * @returns {T[]} Copied array in the requested order; the input array is unchanged.\n * @example\n * ```ts\n * ArrayItemReorder.moveItem([\"Ada\", \"Lin\"], 0, 1);\n * ```\n */\n public static moveItem<T>(items: readonly T[], fromIndex: number, toIndex: number): T[] {\n const nextItems = [...items];\n const [item] = nextItems.splice(fromIndex, 1);\n nextItems.splice(toIndex, 0, item);\n return nextItems;\n }\n\n /**\n * @description Return a copied array with the two item positions exchanged.\n * @param {readonly T[]} items - Items to reorder without mutating the input.\n * @param {number} leftIndex - First item index.\n * @param {number} rightIndex - Second item index.\n * @returns {T[]} Copied array with the two positions exchanged.\n * @example\n * ```ts\n * ArrayItemReorder.swapItems([\"Ada\", \"Lin\"], 0, 1);\n * ```\n */\n public static swapItems<T>(items: readonly T[], leftIndex: number, rightIndex: number): T[] {\n const nextItems = [...items];\n const left = nextItems[leftIndex];\n nextItems[leftIndex] = nextItems[rightIndex];\n nextItems[rightIndex] = left;\n return nextItems;\n }\n}\n","import { ArrayItemReorder, type IndexMapper } from './ArrayItemReorder';\n\n/**\n * 배열 조작 결과를 표현한다.\n *\n * @remarks\n * values와 keys는 다음 배열 상태이고, mapPreviousIndex는 이전 child field 상태를\n * 어느 새 index로 옮길지 FormArrayRebaser에 알려 준다.\n */\nexport type FormArrayMutation = {\n /** Array values after this mutation, in the same order as the stable keys. */\n values: readonly unknown[];\n /** Stable item keys in array order. */\n keys: readonly string[];\n /** Map an old item index to its new position, or undefined if removed. */\n mapPreviousIndex: IndexMapper;\n};\n\n/**\n * @description Computes array values, stable keys, and index mappings without reading or writing a store.\n * @example\n * ```ts\n * const next = FormArrayMutationPlanner.push([], [], \"Ada\", \"item-1\");\n * ```\n */\nexport class FormArrayMutationPlanner {\n /**\n * @description Compute a bounded insertion using the supplied new item key and preserve old item mappings.\n * @param {readonly unknown[]} currentArray - Array values before the mutation.\n * @param {readonly string[]} currentKeys - Stable item keys before the mutation.\n * @param {number} index - Zero-based item index.\n * @param {unknown} value - Value to store or inspect.\n * @param {string} nextKey - Stable key allocated for the new item.\n * @returns {FormArrayMutation} Next values, stable keys, and old-to-new index mapper.\n * - values `readonly unknown[]` - Array values after this mutation, in the same order as the stable keys.\n * - keys `readonly string[]` - Stable item keys in array order.\n * - mapPreviousIndex `IndexMapper` - Map an old item index to its new position, or undefined if removed.\n * @example\n * ```ts\n * FormArrayMutationPlanner.insert([\"Ada\", \"Lin\"], [\"item-1\", \"item-2\"], 0, \"Ada\", \"item-3\");\n * ```\n */\n public static insert(\n currentArray: readonly unknown[],\n currentKeys: readonly string[],\n index: number,\n value: unknown,\n nextKey: string,\n ): FormArrayMutation {\n const boundedIndex = Math.max(0, Math.min(index, currentArray.length));\n const nextArray = [...currentArray];\n const nextKeys = [...currentKeys];\n const nextOrder = [...currentArray.keys()];\n\n nextArray.splice(boundedIndex, 0, value);\n nextKeys.splice(boundedIndex, 0, nextKey);\n nextOrder.splice(boundedIndex, 0, -1);\n\n return {\n values: nextArray,\n keys: nextKeys,\n mapPreviousIndex: ArrayItemReorder.createIndexMapper(currentArray.length, nextOrder),\n };\n }\n\n /**\n * @description Compute an append using the supplied new item key and preserve old item mappings.\n * @param {readonly unknown[]} currentArray - Array values before the mutation.\n * @param {readonly string[]} currentKeys - Stable item keys before the mutation.\n * @param {unknown} value - Value to store or inspect.\n * @param {string} nextKey - Stable key allocated for the new item.\n * @returns {FormArrayMutation} Next values, stable keys, and old-to-new index mapper.\n * - values `readonly unknown[]` - Array values after this mutation, in the same order as the stable keys.\n * - keys `readonly string[]` - Stable item keys in array order.\n * - mapPreviousIndex `IndexMapper` - Map an old item index to its new position, or undefined if removed.\n * @example\n * ```ts\n * FormArrayMutationPlanner.push([\"Ada\", \"Lin\"], [\"item-1\", \"item-2\"], \"Ada\", \"item-3\");\n * ```\n */\n public static push(currentArray: readonly unknown[], currentKeys: readonly string[], value: unknown, nextKey: string): FormArrayMutation {\n return {\n values: [...currentArray, value],\n keys: [...currentKeys, nextKey],\n mapPreviousIndex: ArrayItemReorder.createIndexMapper(currentArray.length, [...currentArray.keys(), -1]),\n };\n }\n\n /**\n * @description Compute removal and remap surviving indexes; return undefined for an invalid index.\n * @param {readonly unknown[]} currentArray - Array values before the mutation.\n * @param {readonly string[]} currentKeys - Stable item keys before the mutation.\n * @param {number} index - Zero-based item index.\n * @returns {FormArrayMutation | undefined} Next array mutation, or undefined for invalid or unchanged indexes.\n * - values `readonly unknown[]` - Array values after this mutation, in the same order as the stable keys.\n * - keys `readonly string[]` - Stable item keys in array order.\n * - mapPreviousIndex `IndexMapper` - Map an old item index to its new position, or undefined if removed.\n * @example\n * ```ts\n * FormArrayMutationPlanner.remove([\"Ada\", \"Lin\"], [\"item-1\", \"item-2\"], 0);\n * ```\n */\n public static remove(currentArray: readonly unknown[], currentKeys: readonly string[], index: number): FormArrayMutation | undefined {\n if (index < 0 || index >= currentArray.length) {\n return undefined;\n }\n\n const nextOrder = [...currentArray.keys()].filter(itemIndex => itemIndex !== index);\n\n return {\n values: currentArray.filter((_, itemIndex) => itemIndex !== index),\n keys: currentKeys.filter((_, itemIndex) => itemIndex !== index),\n mapPreviousIndex: ArrayItemReorder.createIndexMapper(currentArray.length, nextOrder),\n };\n }\n\n /**\n * @description Compute reordered values, keys, and index mapping; return undefined for invalid or identical indexes.\n * @param {readonly unknown[]} currentArray - Array values before the mutation.\n * @param {readonly string[]} currentKeys - Stable item keys before the mutation.\n * @param {number} fromIndex - Original index of the item to move.\n * @param {number} toIndex - Destination index of the moved item.\n * @returns {FormArrayMutation | undefined} Next array mutation, or undefined for invalid or unchanged indexes.\n * - values `readonly unknown[]` - Array values after this mutation, in the same order as the stable keys.\n * - keys `readonly string[]` - Stable item keys in array order.\n * - mapPreviousIndex `IndexMapper` - Map an old item index to its new position, or undefined if removed.\n * @example\n * ```ts\n * FormArrayMutationPlanner.move([\"Ada\", \"Lin\"], [\"item-1\", \"item-2\"], 0, 1);\n * ```\n */\n public static move(currentArray: readonly unknown[], currentKeys: readonly string[], fromIndex: number, toIndex: number): FormArrayMutation | undefined {\n if (fromIndex < 0 || fromIndex >= currentArray.length || toIndex < 0 || toIndex >= currentArray.length || fromIndex === toIndex) {\n return undefined;\n }\n\n const nextOrder = ArrayItemReorder.moveItem([...currentArray.keys()], fromIndex, toIndex);\n\n return {\n values: ArrayItemReorder.moveItem(currentArray, fromIndex, toIndex),\n keys: ArrayItemReorder.moveItem(currentKeys, fromIndex, toIndex),\n mapPreviousIndex: ArrayItemReorder.createIndexMapper(currentArray.length, nextOrder),\n };\n }\n\n /**\n * @description Compute exchanged values, keys, and index mapping; return undefined for invalid or identical indexes.\n * @param {readonly unknown[]} currentArray - Array values before the mutation.\n * @param {readonly string[]} currentKeys - Stable item keys before the mutation.\n * @param {number} leftIndex - First item index.\n * @param {number} rightIndex - Second item index.\n * @returns {FormArrayMutation | undefined} Next array mutation, or undefined for invalid or unchanged indexes.\n * - values `readonly unknown[]` - Array values after this mutation, in the same order as the stable keys.\n * - keys `readonly string[]` - Stable item keys in array order.\n * - mapPreviousIndex `IndexMapper` - Map an old item index to its new position, or undefined if removed.\n * @example\n * ```ts\n * FormArrayMutationPlanner.swap([\"Ada\", \"Lin\"], [\"item-1\", \"item-2\"], 0, 1);\n * ```\n */\n public static swap(currentArray: readonly unknown[], currentKeys: readonly string[], leftIndex: number, rightIndex: number): FormArrayMutation | undefined {\n if (\n leftIndex < 0 ||\n rightIndex < 0 ||\n leftIndex >= currentArray.length ||\n rightIndex >= currentArray.length ||\n leftIndex === rightIndex\n ) {\n return undefined;\n }\n\n const nextOrder = ArrayItemReorder.swapItems([...currentArray.keys()], leftIndex, rightIndex);\n\n return {\n values: ArrayItemReorder.swapItems(currentArray, leftIndex, rightIndex),\n keys: ArrayItemReorder.swapItems(currentKeys, leftIndex, rightIndex),\n mapPreviousIndex: ArrayItemReorder.createIndexMapper(currentArray.length, nextOrder),\n };\n }\n\n /**\n * @description Copy replacement values and supplied keys, disconnecting every previous item mapping.\n * @param {readonly unknown[]} values - Replacement or current form values.\n * @param {readonly string[]} nextKeys - Stable keys for the replacement array.\n * @returns {FormArrayMutation} Replacement values and keys with all previous item mappings removed.\n * - values `readonly unknown[]` - Array values after this mutation, in the same order as the stable keys.\n * - keys `readonly string[]` - Stable item keys in array order.\n * - mapPreviousIndex `IndexMapper` - Map an old item index to its new position, or undefined if removed.\n * @example\n * ```ts\n * FormArrayMutationPlanner.replace([\"Ada\"], [\"item-1\"]);\n * ```\n */\n public static replace(values: readonly unknown[], nextKeys: readonly string[]): FormArrayMutation {\n return {\n values: [...values],\n keys: [...nextKeys],\n mapPreviousIndex: () => undefined,\n };\n }\n}\n","import type { FieldPath, FieldPathInput, PathKey } from '../types';\n\n/**\n * @description Converts literal names and tuple paths to collision-free normalized keys; only tuples represent nested paths.\n * @example\n * ```ts\n * const key = FormPath.pathInputToKey([\"users\", 0, \"email\"]);\n * ```\n */\nexport class FormPath {\n /**\n * root path를 표현하는 특수 key다.\n *\n * @remarks\n * 일반 path는 JSON.stringify 배열 문자열이므로 `$`와 충돌하지 않는다.\n */\n public static readonly ROOT_PATH_KEY = '$';\n\n /**\n * @description Return the supplied segments as a tuple path without parsing strings.\n * @param {FieldPath} segments - Path segments; numeric segments identify array indexes.\n * @returns {FieldPath} Tuple containing the supplied path segments.\n * @example\n * ```ts\n * FormPath.path(\"users\", 0, \"email\");\n * ```\n */\n public static path(...segments: FieldPath): FieldPath {\n return segments;\n }\n\n /**\n * @description Wrap a string as one literal field name or preserve the supplied tuple path.\n * @param {FieldPathInput} fieldPath - Literal field name or tuple path; strings are not split on dots.\n * @returns {FieldPath} Tuple path; a string becomes exactly one segment.\n * @example\n * ```ts\n * FormPath.toFieldPath([\"email\"]);\n * ```\n */\n public static toFieldPath(fieldPath: FieldPathInput): FieldPath {\n if (typeof fieldPath === 'string') {\n // 문자열은 dot path로 파싱하지 않고 하나의 필드 이름으로 취급해 실제 키의 `.` 문자와 충돌하지 않게 한다.\n return [fieldPath];\n }\n\n return fieldPath;\n }\n\n /**\n * @description Normalize a literal name or tuple into a field-store key.\n * @param {FieldPathInput} fieldPath - Literal field name or tuple path; strings are not split on dots.\n * @returns {string} Normalized key for field and array-key lookup.\n * @example\n * ```ts\n * FormPath.pathInputToKey([\"email\"]);\n * ```\n */\n public static pathInputToKey(fieldPath: FieldPathInput): PathKey {\n return this.pathToKey(this.toFieldPath(fieldPath));\n }\n\n /**\n * @description Serialize a tuple as JSON, using $ for the empty root path.\n * @param {FieldPath} fieldPath - Tuple path identifying the target field or value.\n * @returns {string} $ for the root path, otherwise the JSON-serialized tuple.\n * @example\n * ```ts\n * FormPath.pathToKey([\"email\"]);\n * ```\n */\n public static pathToKey(fieldPath: FieldPath): PathKey {\n if (fieldPath.length === 0) {\n return this.ROOT_PATH_KEY;\n }\n\n // 구분자 기반 문자열 대신 JSON을 쓰면 `user.name` 같은 실제 키와 경로 표기가 충돌하지 않는다.\n return JSON.stringify(fieldPath);\n }\n\n /**\n * @description Parse a stored key back to tuple segments and throw for invalid keys or segment types.\n * @param {string} key - Serialized path key produced by pathToKey.\n * @returns {FieldPath} Decoded string and numeric path segments.\n * @example\n * ```ts\n * FormPath.keyToPath(FormPath.pathToKey([\"email\"]));\n * ```\n */\n public static keyToPath(key: PathKey): FieldPath {\n if (key === this.ROOT_PATH_KEY) {\n return [];\n }\n\n // 외부 입력이 들어올 수 있으므로 파싱 결과를 바로 믿지 않고 아래에서 segment 타입을 검증한다.\n const parsed: unknown = JSON.parse(key);\n\n if (!Array.isArray(parsed)) {\n throw new Error(`Invalid form path key: ${key}`);\n }\n\n return parsed.map(segment => {\n if (typeof segment === 'string' || typeof segment === 'number') {\n return segment;\n }\n\n throw new Error(`Invalid form path segment in key: ${key}`);\n });\n }\n}\n","import type { FieldPath } from '../types';\n\n/**\n * @description Identifies array-child paths and replaces only their item-index segment.\n * @example\n * ```ts\n * const child = FormArrayPath.isArrayChildPath([\"users\", 0, \"email\"], [\"users\"]);\n * ```\n */\nexport class FormArrayPath {\n /**\n * @description Compare path segments with Object.is to check whether a tuple starts with the prefix.\n * @param {FieldPath} fieldPath - Tuple path identifying the target field or value.\n * @param {FieldPath} prefix - Path prefix to compare segment by segment.\n * @returns {boolean} Whether every prefix segment matches by Object.is.\n * @example\n * ```ts\n * FormArrayPath.hasPathPrefix([\"email\"], [\"users\"]);\n * ```\n */\n public static hasPathPrefix(fieldPath: FieldPath, prefix: FieldPath): boolean {\n return prefix.every((segment, index) => Object.is(fieldPath[index], segment));\n }\n\n /**\n * @description Check that a path extends the array path with a numeric item-index segment.\n * @param {FieldPath} fieldPath - Tuple path identifying the target field or value.\n * @param {FieldPath} arrayPath - Tuple path of the array container.\n * @returns {boolean} Whether the next segment below the array container is a numeric index.\n * @example\n * ```ts\n * FormArrayPath.isArrayChildPath([\"users\", 0, \"email\"], [\"users\"]);\n * ```\n */\n public static isArrayChildPath(fieldPath: FieldPath, arrayPath: FieldPath): boolean {\n return fieldPath.length > arrayPath.length && this.hasPathPrefix(fieldPath, arrayPath) && typeof fieldPath[arrayPath.length] === 'number';\n }\n\n /**\n * @description Replace the item index beneath an array path while retaining the remaining child segments.\n * @param {FieldPath} fieldPath - Tuple path identifying the target field or value.\n * @param {FieldPath} arrayPath - Tuple path of the array container.\n * @param {number} nextIndex - Replacement item index.\n * @returns {FieldPath} Copied child path containing the replacement array index.\n * @example\n * ```ts\n * FormArrayPath.replaceArrayIndex([\"users\", 0, \"email\"], [\"users\"], 1);\n * ```\n */\n public static replaceArrayIndex(fieldPath: FieldPath, arrayPath: FieldPath, nextIndex: number): FieldPath {\n return [...arrayPath, nextIndex, ...fieldPath.slice(arrayPath.length + 1)];\n }\n}\n","import type { FieldState } from '../types';\n\n/**\n * @description Creates independent field snapshots with shared default metadata rules and fresh error arrays.\n * @example\n * ```ts\n * const field = FieldStateFactory.create(\"\");\n * ```\n */\nexport class FieldStateFactory {\n /** 모든 field가 공통으로 갖는 기본 메타데이터 값이다. errors는 매번 새 배열로 복사해서 공유 참조를 피한다. */\n private static readonly DEFAULT_FIELD_STATE: FieldState = {\n value: undefined,\n errors: [],\n touched: false,\n dirty: false,\n modified: false,\n isFocused: false,\n };\n\n /**\n * @description Create a field snapshot with the supplied value, fresh errors, and false metadata flags.\n * @param {unknown} value - Value to store or inspect.\n * @returns {FieldState} Independent field snapshot with the supplied value and fresh errors.\n * - value `unknown` - Current field value.\n * - errors `FormError[]` - Current validation errors for the field.\n * - touched `boolean` - Whether the field has blurred at least once.\n * - dirty `boolean` - Whether the current value differs from its default by Object.is.\n * - modified `boolean` - Whether a user-originated write has changed this field.\n * - isFocused `boolean` - Whether focus has been recorded without a subsequent blur.\n * @example\n * ```ts\n * FieldStateFactory.create(\"Ada\");\n * ```\n */\n public static create(value: unknown): FieldState {\n return {\n ...this.DEFAULT_FIELD_STATE,\n value,\n errors: [],\n };\n }\n\n /**\n * @description Create an empty field snapshot with undefined value and fresh errors.\n * @returns {FieldState} Independent empty snapshot with undefined value and false metadata flags.\n * - value `unknown` - Current field value.\n * - errors `FormError[]` - Current validation errors for the field.\n * - touched `boolean` - Whether the field has blurred at least once.\n * - dirty `boolean` - Whether the current value differs from its default by Object.is.\n * - modified `boolean` - Whether a user-originated write has changed this field.\n * - isFocused `boolean` - Whether focus has been recorded without a subsequent blur.\n * @example\n * ```ts\n * FieldStateFactory.createDefault();\n * ```\n */\n public static createDefault(): FieldState {\n return this.create(undefined);\n }\n}\n","import { FieldStateFactory } from './FieldStateFactory';\nimport { FormPath } from '../path/index';\nimport type { ArrayKeys, FieldPath, FieldState, FormState } from '../types';\n\n/**\n * @description Normalizes default values into leaf field snapshots and array-container keys.\n * @example\n * ```ts\n * const state = FormStateInitializer.initialize({ email: \"\" });\n * ```\n */\nexport class FormStateInitializer {\n /**\n * @description Normalize default values; arrays become key containers, plain objects recurse, and other values become leaves.\n * @param {TValues} defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @returns {FormState<TValues>} Initial normalized state with deterministic initial-N array keys.\n * - defaultValues `TValues` - Initial values and the baseline used for dirty checks and reset.\n * - fields `Record<string, FieldState<unknown>>` - Field snapshots indexed by normalized path keys.\n * - submitCount `number` - Number of submission attempts started by the form.\n * - isSubmitting `boolean` - Whether queued validation or a submit callback is still pending.\n * - isSubmitted `boolean` - Whether a submission has completed at least once.\n * - isSubmitSuccessful `boolean` - Whether the latest completed submission reached a successful valid callback.\n * - arrayKeys `ArrayKeys` - Stable rendering keys indexed by array path.\n * @example\n * ```ts\n * FormStateInitializer.initialize({ email: \"\" });\n * ```\n */\n public static initialize<TValues>(defaultValues: TValues): FormState<TValues> {\n const fields: Record<string, FieldState> = {};\n const arrayKeys: ArrayKeys = {};\n\n this.visitInitialValue(defaultValues, [], fields, arrayKeys);\n\n return {\n defaultValues,\n fields,\n submitCount: 0,\n isSubmitting: false,\n isSubmitted: false,\n isSubmitSuccessful: false,\n arrayKeys,\n };\n }\n\n /**\n * 순회 가능한 plain object인지 확인한다.\n *\n * @remarks\n * class 인스턴스나 Date 같은 객체는 내부 프로퍼티를 form field로 쪼개지 않고 leaf value로 보존한다.\n *\n * @param value - 검사할 값.\n * @returns plain object이면 true.\n */\n private static isTraversableObject(value: unknown): value is Record<string, unknown> {\n return Object.prototype.toString.call(value) === '[object Object]';\n }\n\n /**\n * defaultValues 안에 이미 존재하는 배열 item의 deterministic key를 만든다.\n *\n * @param length - 배열 길이.\n * @returns `initial-0`, `initial-1` 형태의 key 배열.\n */\n private static createInitialArrayKeys(length: number): string[] {\n return Array.from({ length }, (_, index) => `initial-${index}`);\n }\n\n /**\n * initial value tree를 DFS로 순회하며 fields와 arrayKeys 누적 객체에 기록한다.\n *\n * @param value - 현재 방문 중인 값.\n * @param fieldPath - 현재 값이 위치한 tuple path.\n * @param fields - leaf field 상태를 기록할 mutable accumulator.\n * @param arrayKeys - 배열 container key 목록을 기록할 mutable accumulator.\n */\n private static visitInitialValue(\n value: unknown,\n fieldPath: FieldPath,\n fields: Record<string, FieldState>,\n arrayKeys: ArrayKeys,\n ): void {\n if (Array.isArray(value)) {\n // 배열 자체는 field leaf가 아니라 field array 컨테이너이므로 key 목록만 저장하고 자식만 순회한다.\n arrayKeys[FormPath.pathToKey(fieldPath)] = this.createInitialArrayKeys(value.length);\n\n value.forEach((item, index) => {\n this.visitInitialValue(item, [...fieldPath, index], fields, arrayKeys);\n });\n\n return;\n }\n\n if (this.isTraversableObject(value)) {\n const entries = Object.entries(value);\n\n if (entries.length === 0) {\n // 빈 객체는 더 내려갈 leaf가 없으므로 그 자체를 하나의 field value로 보존한다.\n fields[FormPath.pathToKey(fieldPath)] = FieldStateFactory.create(value);\n return;\n }\n\n entries.forEach(([key, childValue]) => {\n this.visitInitialValue(childValue, [...fieldPath, key], fields, arrayKeys);\n });\n\n return;\n }\n\n // primitive, null, Date, class instance 등 순회하지 않는 값은 leaf field로 등록한다.\n fields[FormPath.pathToKey(fieldPath)] = FieldStateFactory.create(value);\n }\n}\n","import { FormPath } from '../path/index';\nimport type { FieldPath, FormState, PathKey } from '../types';\n\n/**\n * @description Reads, immutably updates, and reconstructs nested form values from normalized field snapshots.\n * @example\n * ```ts\n * const next = ValueHelper.setValueAtPath({ email: \"\" }, [\"email\"], \"Ada\");\n * ```\n */\nexport class ValueHelper {\n /**\n * values 복원을 시작할 root container를 만든다.\n *\n * @param source - defaultValues의 root 값.\n * @returns source가 배열이면 빈 배열, 객체면 빈 객체, primitive면 source 자체.\n */\n private static createEmptyRoot(source: unknown): unknown {\n if (Array.isArray(source)) {\n return [];\n }\n\n if (typeof source === 'object' && source !== null) {\n return {};\n }\n\n return source;\n }\n\n /**\n * @description Read a nested tuple path, returning undefined when a traversed container is missing or primitive.\n * @param {unknown} source - Root object or array to read or immutably update.\n * @param {FieldPath} path - Tuple path identifying the target field or value.\n * @returns {unknown} Value at the tuple path, or undefined for an unreachable path.\n * @example\n * ```ts\n * ValueHelper.getValueAtPath({ email: \"Ada\" }, [\"email\"]);\n * ```\n */\n public static getValueAtPath(source: unknown, path: FieldPath): unknown {\n let current = source;\n\n for (const segment of path) {\n if (current === null || current === undefined) {\n return undefined;\n }\n\n if (typeof current !== 'object' && typeof current !== 'function') {\n return undefined;\n }\n\n current = (current as Record<string | number, unknown>)[segment];\n }\n\n return current;\n }\n\n /**\n * @description Copy containers along a tuple path and write the value without mutating the original root.\n * @param {TValues} source - Root object or array to read or immutably update.\n * @param {FieldPath} path - Tuple path identifying the target field or value.\n * @param {unknown} value - Value to store or inspect.\n * @returns {TValues} New root with the path updated; untouched branches retain their references.\n * @example\n * ```ts\n * ValueHelper.setValueAtPath({ email: \"Ada\" }, [\"email\"], \"Ada\");\n * ```\n */\n public static setValueAtPath<TValues>(source: TValues, path: FieldPath, value: unknown): TValues {\n if (path.length === 0) {\n return value as TValues;\n }\n\n const cloneRoot = Array.isArray(source)\n ? [...source]\n : typeof source === 'object' && source !== null\n ? { ...source }\n : {};\n let current: Record<string | number, unknown> = cloneRoot as Record<string | number, unknown>;\n\n path.forEach((segment, index) => {\n if (index === path.length - 1) {\n current[segment] = value;\n return;\n }\n\n const nextSegment = path[index + 1];\n const previous = current[segment];\n const next = Array.isArray(previous)\n ? [...previous]\n : typeof previous === 'object' && previous !== null\n ? { ...previous }\n : typeof nextSegment === 'number'\n ? []\n : {};\n\n current[segment] = next;\n current = next as Record<string | number, unknown>;\n });\n\n return cloneRoot as TValues;\n }\n\n /**\n * @description Rebuild nested values from normalized fields and array keys, using the supplied path lookup.\n * @param {FormState<TValues>} state - Form snapshot used as the source of this calculation.\n * @param {TValues} state.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {Record<string, FieldState<unknown>>} state.fields - Field snapshots indexed by normalized path keys.\n * @param {number} state.submitCount - Number of submission attempts started by the form.\n * @param {boolean} state.isSubmitting - Whether queued validation or a submit callback is still pending.\n * @param {boolean} state.isSubmitted - Whether a submission has completed at least once.\n * @param {boolean} state.isSubmitSuccessful - Whether the latest completed submission reached a successful valid callback.\n * @param {ArrayKeys} state.arrayKeys - Stable rendering keys indexed by array path.\n * @param {Readonly<Record<string, FieldPath>>} fieldPaths - Lookup from normalized keys to tuple paths.\n * @returns {TValues} Nested values rebuilt from field values and array container lengths.\n * @example\n * ```ts\n * ValueHelper.getValuesFromFields(state, FormStateReader.getKnownFieldPaths(state));\n * ```\n */\n public static getValuesFromFields<TValues>(\n state: FormState<TValues>,\n fieldPaths: Readonly<Record<PathKey, FieldPath>>,\n ): TValues {\n const valueWithArrays = Object.entries(state.arrayKeys).reduce<unknown>((values, [key, keys]) => {\n return this.setValueAtPath(values, FormPath.keyToPath(key), new Array(keys.length));\n }, this.createEmptyRoot(state.defaultValues));\n\n return Object.entries(state.fields).reduce<TValues>((values, [key, field]) => {\n const fieldPath = fieldPaths[key];\n\n if (!fieldPath) {\n return values;\n }\n\n return this.setValueAtPath(values, fieldPath, field.value);\n }, valueWithArrays as TValues);\n }\n}\n","import { FieldStateFactory } from './FieldStateFactory';\nimport { FormPath } from '../path/index';\nimport { ValueHelper } from '../value/index';\nimport type { FieldPath, FieldPathInput, FieldState, FormState, PathKey } from '../types';\n\n/**\n * @description Derives values and field metadata from one supplied snapshot without reading a live store.\n * @example\n * ```ts\n * const values = FormStateReader.getValues(form.getState());\n * ```\n */\nexport class FormStateReader {\n /**\n * @description Decode the snapshot field keys into a lookup of tuple paths.\n * @param {Readonly<FormState<TValues>>} state - Form snapshot used as the source of this calculation.\n * @param {TValues} state.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {Record<string, FieldState<unknown>>} state.fields - Field snapshots indexed by normalized path keys.\n * @param {number} state.submitCount - Number of submission attempts started by the form.\n * @param {boolean} state.isSubmitting - Whether queued validation or a submit callback is still pending.\n * @param {boolean} state.isSubmitted - Whether a submission has completed at least once.\n * @param {boolean} state.isSubmitSuccessful - Whether the latest completed submission reached a successful valid callback.\n * @param {ArrayKeys} state.arrayKeys - Stable rendering keys indexed by array path.\n * @returns {Record<string, FieldPath>} Lookup mapping each stored field key to its decoded tuple path.\n * @example\n * ```ts\n * FormStateReader.getKnownFieldPaths(state);\n * ```\n */\n public static getKnownFieldPaths<TValues>(state: Readonly<FormState<TValues>>): Record<PathKey, FieldPath> {\n return Object.keys(state.fields).reduce<Record<PathKey, FieldPath>>((paths, key) => {\n paths[key] = FormPath.keyToPath(key);\n return paths;\n }, {});\n }\n\n /**\n * @description Read a normalized field key, returning an independent default snapshot when absent.\n * @param {Readonly<FormState<TValues>>} state - Form snapshot used as the source of this calculation.\n * @param {TValues} state.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {Record<string, FieldState<unknown>>} state.fields - Field snapshots indexed by normalized path keys.\n * @param {number} state.submitCount - Number of submission attempts started by the form.\n * @param {boolean} state.isSubmitting - Whether queued validation or a submit callback is still pending.\n * @param {boolean} state.isSubmitted - Whether a submission has completed at least once.\n * @param {boolean} state.isSubmitSuccessful - Whether the latest completed submission reached a successful valid callback.\n * @param {ArrayKeys} state.arrayKeys - Stable rendering keys indexed by array path.\n * @param {string} fieldKey - Normalized path key of the target field.\n * @returns {Readonly<FieldState>} Stored field snapshot, or an empty snapshot for an absent key.\n * - value `unknown` - Current field value.\n * - errors `FormError[]` - Current validation errors for the field.\n * - touched `boolean` - Whether the field has blurred at least once.\n * - dirty `boolean` - Whether the current value differs from its default by Object.is.\n * - modified `boolean` - Whether a user-originated write has changed this field.\n * - isFocused `boolean` - Whether focus has been recorded without a subsequent blur.\n * @example\n * ```ts\n * FormStateReader.getFieldStateByKey(state, FormPath.pathToKey([\"email\"]));\n * ```\n */\n public static getFieldStateByKey<TValues>(state: Readonly<FormState<TValues>>, fieldKey: PathKey): Readonly<FieldState> {\n return state.fields[fieldKey] ?? FieldStateFactory.createDefault();\n }\n\n /**\n * @description Read field metadata and use a default snapshot when the field is not present.\n * @param {Readonly<FormState<TValues>>} state - Form snapshot used as the source of this calculation.\n * @param {TValues} state.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {Record<string, FieldState<unknown>>} state.fields - Field snapshots indexed by normalized path keys.\n * @param {number} state.submitCount - Number of submission attempts started by the form.\n * @param {boolean} state.isSubmitting - Whether queued validation or a submit callback is still pending.\n * @param {boolean} state.isSubmitted - Whether a submission has completed at least once.\n * @param {boolean} state.isSubmitSuccessful - Whether the latest completed submission reached a successful valid callback.\n * @param {ArrayKeys} state.arrayKeys - Stable rendering keys indexed by array path.\n * @param {FieldPathInput} fieldPath - Literal field name or tuple path; strings are not split on dots.\n * @returns {Readonly<FieldState>} Field snapshot, with a default shape when the leaf field is absent.\n * - value `unknown` - Current field value.\n * - errors `FormError[]` - Current validation errors for the field.\n * - touched `boolean` - Whether the field has blurred at least once.\n * - dirty `boolean` - Whether the current value differs from its default by Object.is.\n * - modified `boolean` - Whether a user-originated write has changed this field.\n * - isFocused `boolean` - Whether focus has been recorded without a subsequent blur.\n * @example\n * ```ts\n * FormStateReader.getFieldState(state, [\"email\"]);\n * ```\n */\n public static getFieldState<TValues>(state: Readonly<FormState<TValues>>, fieldPath: FieldPathInput): Readonly<FieldState> {\n return FormStateReader.getFieldStateByKey(state, FormPath.pathInputToKey(fieldPath));\n }\n\n /**\n * @description Read only the current value of the selected field.\n * @param {Readonly<FormState<TValues>>} state - Form snapshot used as the source of this calculation.\n * @param {TValues} state.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {Record<string, FieldState<unknown>>} state.fields - Field snapshots indexed by normalized path keys.\n * @param {number} state.submitCount - Number of submission attempts started by the form.\n * @param {boolean} state.isSubmitting - Whether queued validation or a submit callback is still pending.\n * @param {boolean} state.isSubmitted - Whether a submission has completed at least once.\n * @param {boolean} state.isSubmitSuccessful - Whether the latest completed submission reached a successful valid callback.\n * @param {ArrayKeys} state.arrayKeys - Stable rendering keys indexed by array path.\n * @param {FieldPathInput} fieldPath - Literal field name or tuple path; strings are not split on dots.\n * @returns {unknown} Stored field value, or undefined when the field has no value.\n * @example\n * ```ts\n * FormStateReader.getValue(state, [\"email\"]);\n * ```\n */\n public static getValue<TValues>(state: Readonly<FormState<TValues>>, fieldPath: FieldPathInput): unknown {\n return FormStateReader.getFieldState(state, fieldPath).value;\n }\n\n /**\n * @description Reconstruct the nested values object from leaf fields and array containers.\n * @param {Readonly<FormState<TValues>>} state - Form snapshot used as the source of this calculation.\n * @param {TValues} state.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {Record<string, FieldState<unknown>>} state.fields - Field snapshots indexed by normalized path keys.\n * @param {number} state.submitCount - Number of submission attempts started by the form.\n * @param {boolean} state.isSubmitting - Whether queued validation or a submit callback is still pending.\n * @param {boolean} state.isSubmitted - Whether a submission has completed at least once.\n * @param {boolean} state.isSubmitSuccessful - Whether the latest completed submission reached a successful valid callback.\n * @param {ArrayKeys} state.arrayKeys - Stable rendering keys indexed by array path.\n * @returns {TValues} Nested values reconstructed in the shape of the supplied defaults.\n * @example\n * ```ts\n * FormStateReader.getValues(state);\n * ```\n */\n public static getValues<TValues>(state: Readonly<FormState<TValues>>): TValues {\n return ValueHelper.getValuesFromFields(state, FormStateReader.getKnownFieldPaths(state));\n }\n\n /**\n * @description Read a nested tuple path, returning undefined when a traversed container is missing or primitive.\n * @param {Readonly<FormState<TValues>>} state - Form snapshot used as the source of this calculation.\n * @param {TValues} state.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {Record<string, FieldState<unknown>>} state.fields - Field snapshots indexed by normalized path keys.\n * @param {number} state.submitCount - Number of submission attempts started by the form.\n * @param {boolean} state.isSubmitting - Whether queued validation or a submit callback is still pending.\n * @param {boolean} state.isSubmitted - Whether a submission has completed at least once.\n * @param {boolean} state.isSubmitSuccessful - Whether the latest completed submission reached a successful valid callback.\n * @param {ArrayKeys} state.arrayKeys - Stable rendering keys indexed by array path.\n * @param {FieldPath} fieldPath - Tuple path identifying the target field or value.\n * @returns {unknown} Value at the tuple path, or undefined for an unreachable path.\n * @example\n * ```ts\n * FormStateReader.getValueAtPath(state, [\"email\"]);\n * ```\n */\n public static getValueAtPath<TValues>(state: Readonly<FormState<TValues>>, fieldPath: FieldPath): unknown {\n return ValueHelper.getValueAtPath(FormStateReader.getValues(state), fieldPath);\n }\n}\n","import type { FormArrayMutation } from './FormArrayMutationPlanner';\nimport { FormArrayPath } from './FormArrayPath';\nimport { FieldStateFactory } from '../state/FieldStateFactory';\nimport { FormStateInitializer } from '../state/FormStateInitializer';\nimport { FormStateReader } from '../state/FormStateReader';\nimport { FormPath } from '../path/index';\nimport { ValueHelper } from '../value/index';\nimport type { FieldPath, FormState } from '../types';\n\n/**\n * @description Rebases fields and nested array keys after item changes while preserving surviving metadata and submission state.\n * @example\n * ```ts\n * const next = FormArrayRebaser.rebase(state, [\"users\"], mutation);\n * ```\n */\nexport class FormArrayRebaser {\n /**\n * @description Apply next array values and move surviving child metadata and nested array keys to their new indexes.\n * @param {Readonly<FormState<TValues>>} previousState - Snapshot before the array mutation.\n * @param {TValues} previousState.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {Record<string, FieldState<unknown>>} previousState.fields - Field snapshots indexed by normalized path keys.\n * @param {number} previousState.submitCount - Number of submission attempts started by the form.\n * @param {boolean} previousState.isSubmitting - Whether queued validation or a submit callback is still pending.\n * @param {boolean} previousState.isSubmitted - Whether a submission has completed at least once.\n * @param {boolean} previousState.isSubmitSuccessful - Whether the latest completed submission reached a successful valid callback.\n * @param {ArrayKeys} previousState.arrayKeys - Stable rendering keys indexed by array path.\n * @param {FieldPath} fieldPath - Tuple path identifying the target field or value.\n * @param {FormArrayMutation} mutation - Next array values, stable keys, and old-to-new index mapper.\n * @param {readonly unknown[]} mutation.values - Array values after this mutation, in the same order as the stable keys.\n * @param {readonly string[]} mutation.keys - Stable item keys in array order.\n * @param {IndexMapper} mutation.mapPreviousIndex - Map an old item index to its new position, or undefined if removed.\n * @returns {FormState<TValues>} Next form snapshot with surviving child metadata and submission state preserved.\n * - defaultValues `TValues` - Initial values and the baseline used for dirty checks and reset.\n * - fields `Record<string, FieldState<unknown>>` - Field snapshots indexed by normalized path keys.\n * - submitCount `number` - Number of submission attempts started by the form.\n * - isSubmitting `boolean` - Whether queued validation or a submit callback is still pending.\n * - isSubmitted `boolean` - Whether a submission has completed at least once.\n * - isSubmitSuccessful `boolean` - Whether the latest completed submission reached a successful valid callback.\n * - arrayKeys `ArrayKeys` - Stable rendering keys indexed by array path.\n * @example\n * ```ts\n * const mutation = FormArrayMutationPlanner.push([], [], \"Ada\", \"item-1\");\n * const next = FormArrayRebaser.rebase(state, [\"users\"], mutation);\n * ```\n */\n public static rebase<TValues>(\n previousState: Readonly<FormState<TValues>>,\n fieldPath: FieldPath,\n mutation: FormArrayMutation,\n ): FormState<TValues> {\n const fieldPaths = FormStateReader.getKnownFieldPaths(previousState);\n const nextValues = ValueHelper.setValueAtPath(FormStateReader.getValues(previousState), fieldPath, [...mutation.values]);\n const initializedState = FormStateInitializer.initialize(nextValues);\n const arrayKey = FormPath.pathToKey(fieldPath);\n const rebasedFields = { ...initializedState.fields };\n const rebasedArrayKeys = { ...initializedState.arrayKeys };\n\n Object.entries(previousState.fields).forEach(([fieldKey, previousField]) => {\n const currentFieldPath = fieldPaths[fieldKey];\n\n if (!currentFieldPath) {\n return;\n }\n\n if (!FormArrayPath.isArrayChildPath(currentFieldPath, fieldPath)) {\n rebasedFields[fieldKey] = previousField;\n return;\n }\n\n const previousIndex = currentFieldPath[fieldPath.length];\n\n if (typeof previousIndex !== 'number') {\n return;\n }\n\n const nextIndex = mutation.mapPreviousIndex(previousIndex);\n\n if (nextIndex === undefined) {\n return;\n }\n\n const nextFieldPath = FormArrayPath.replaceArrayIndex(currentFieldPath, fieldPath, nextIndex);\n const nextFieldKey = FormPath.pathToKey(nextFieldPath);\n const nextField = initializedState.fields[nextFieldKey] ?? FieldStateFactory.createDefault();\n\n rebasedFields[nextFieldKey] = {\n ...nextField,\n errors: previousField.errors,\n touched: previousField.touched,\n dirty: previousField.dirty,\n modified: previousField.modified,\n isFocused: previousField.isFocused,\n };\n });\n\n Object.entries(previousState.arrayKeys).forEach(([previousArrayKey, previousKeys]) => {\n if (previousArrayKey === arrayKey) {\n return;\n }\n\n const previousArrayPath = FormPath.keyToPath(previousArrayKey);\n let nextArrayPath = previousArrayPath;\n\n if (FormArrayPath.isArrayChildPath(previousArrayPath, fieldPath)) {\n const previousIndex = previousArrayPath[fieldPath.length];\n\n if (typeof previousIndex !== 'number') {\n return;\n }\n\n const nextIndex = mutation.mapPreviousIndex(previousIndex);\n\n if (nextIndex === undefined) {\n return;\n }\n\n nextArrayPath = FormArrayPath.replaceArrayIndex(previousArrayPath, fieldPath, nextIndex);\n }\n\n const nextArrayKey = FormPath.pathToKey(nextArrayPath);\n const initializedKeys = initializedState.arrayKeys[nextArrayKey];\n\n if (initializedKeys?.length === previousKeys.length) {\n rebasedArrayKeys[nextArrayKey] = [...previousKeys];\n }\n });\n\n rebasedArrayKeys[arrayKey] = [...mutation.keys];\n\n return {\n ...initializedState,\n fields: rebasedFields,\n arrayKeys: rebasedArrayKeys,\n submitCount: previousState.submitCount,\n isSubmitting: previousState.isSubmitting,\n isSubmitted: previousState.isSubmitted,\n isSubmitSuccessful: previousState.isSubmitSuccessful,\n };\n }\n}\n","import { ArrayKeyGenerator } from './ArrayKeyGenerator';\nimport { FormArrayMutationPlanner, type FormArrayMutation } from './FormArrayMutationPlanner';\nimport { FormPath } from '../path/index';\nimport { FormStateStore } from '../state/index';\nimport { FormArrayRebaser } from './FormArrayRebaser';\nimport type { FieldPath, FormArray } from '../types';\n\n/**\n * @description Applies array commands with shared item keys and rebases child field metadata with each change.\n * @example\n * ```ts\n * const items = new FormArrayController(store, new ArrayKeyGenerator(), [\"users\"]);\n * items.push({ email: \"\" });\n * ```\n */\nexport class FormArrayController<TValues> implements FormArray {\n /** 배열 값과 arrayKeys를 읽고, 최종 FormState를 교체할 store다. */\n private readonly store: FormStateStore<TValues>;\n /** 새 배열 item에 부여할 안정적인 render key를 만든다. */\n private readonly keyGenerator: ArrayKeyGenerator;\n /** 이 controller가 담당하는 배열 field의 내부 tuple path다. */\n private readonly fieldPath: FieldPath;\n\n /**\n * @description Create an array controller for one tuple path with the shared form key generator.\n * @param {FormStateStore<TValues>} store - Shared form state store to read and update.\n * @param {ArrayKeyGenerator} keys - Item key generator shared by controllers in this form.\n * @param {FieldPath} fieldPath - Tuple path identifying the target field or value.\n * @example\n * ```ts\n * const items = new FormArrayController(store, new ArrayKeyGenerator(), [\"users\"]);\n * ```\n */\n public constructor(store: FormStateStore<TValues>, keys: ArrayKeyGenerator, fieldPath: FieldPath) {\n this.store = store;\n this.keyGenerator = keys;\n this.fieldPath = fieldPath;\n }\n\n /**\n * @description Read stable rendering keys in current item order.\n * @returns {readonly string[]} Stable rendering keys corresponding to current array items.\n * @example\n * ```ts\n * items.keys();\n * ```\n */\n public keys(): readonly string[] {\n return this.getKeys();\n }\n\n /**\n * @description Insert an item at a bounded index and allocate its stable key.\n * @param {number} index - Zero-based item index.\n * @param {unknown} value - Value to store or inspect.\n * @example\n * ```ts\n * items.insert(0, \"Ada\");\n * ```\n */\n public insert(index: number, value: unknown): void {\n this.applyMutation(FormArrayMutationPlanner.insert(this.getArray(), this.getKeys(), index, value, this.keyGenerator.create()));\n }\n\n /**\n * @description Append an item and allocate its stable key.\n * @param {unknown} value - Value to store or inspect.\n * @example\n * ```ts\n * items.push(\"Ada\");\n * ```\n */\n public push(value: unknown): void {\n this.applyMutation(FormArrayMutationPlanner.push(this.getArray(), this.getKeys(), value, this.keyGenerator.create()));\n }\n\n /**\n * @description Remove a valid item and its child state; an invalid index leaves the state unchanged.\n * @param {number} index - Zero-based item index.\n * @example\n * ```ts\n * items.remove(0);\n * ```\n */\n public remove(index: number): void {\n this.applyMutation(FormArrayMutationPlanner.remove(this.getArray(), this.getKeys(), index));\n }\n\n /**\n * @description Move an item and its metadata; invalid or identical indexes leave the state unchanged.\n * @param {number} fromIndex - Original index of the item to move.\n * @param {number} toIndex - Destination index of the moved item.\n * @example\n * ```ts\n * items.move(0, 1);\n * ```\n */\n public move(fromIndex: number, toIndex: number): void {\n this.applyMutation(FormArrayMutationPlanner.move(this.getArray(), this.getKeys(), fromIndex, toIndex));\n }\n\n /**\n * @description Swap two items with their keys and metadata; invalid or identical indexes leave the state unchanged.\n * @param {number} leftIndex - First item index.\n * @param {number} rightIndex - Second item index.\n * @example\n * ```ts\n * items.swap(0, 1);\n * ```\n */\n public swap(leftIndex: number, rightIndex: number): void {\n this.applyMutation(FormArrayMutationPlanner.swap(this.getArray(), this.getKeys(), leftIndex, rightIndex));\n }\n\n /**\n * @description Replace all items and regenerate their keys and child field state.\n * @param {readonly unknown[]} values - Replacement or current form values.\n * @example\n * ```ts\n * items.replace([\"Ada\", \"Lin\"]);\n * ```\n */\n public replace(values: readonly unknown[]): void {\n this.applyMutation(FormArrayMutationPlanner.replace(values, values.map(() => this.keyGenerator.create())));\n }\n\n /**\n * store에서 현재 배열 값을 읽는다.\n *\n * @returns path의 값이 배열이면 그 배열, 아니면 빈 배열.\n */\n private getArray(): unknown[] {\n const value = this.store.getValueAtPath(this.fieldPath);\n return Array.isArray(value) ? value : [];\n }\n\n /**\n * 현재 배열에 대응하는 render key 목록을 읽는다.\n *\n * @returns store에 저장된 arrayKeys가 있으면 그것을 사용하고, 없으면 현재 배열 길이만큼 새 key를 만든다.\n */\n private getKeys(): string[] {\n const arrayKey = FormPath.pathToKey(this.fieldPath);\n const currentArray = this.getArray();\n return this.store.getState().arrayKeys[arrayKey] ?? currentArray.map(() => this.keyGenerator.create());\n }\n\n /**\n * planner가 만든 mutation이 있으면 rebase를 실행한다.\n *\n * @param mutation - 유효하지 않은 조작이면 undefined일 수 있다.\n */\n private applyMutation(mutation: FormArrayMutation | undefined): void {\n if (!mutation) {\n return;\n }\n\n this.store.replaceState(previousState =>\n FormArrayRebaser.rebase(previousState, this.fieldPath, mutation),\n );\n }\n}\n","import type { FormStateStore } from '../state/index';\nimport type { ValidationEngine } from '../validation/index';\nimport type { FieldState, PathKey } from '../types';\n\n/**\n * @description Serializes submissions, retries stale validation, and records lifecycle state after the final queued submission.\n * @example\n * ```ts\n * const submitter = new FormSubmitter(store, validation);\n * await submitter.submit(values => save(values));\n * ```\n */\nexport class FormSubmitter<TValues> {\n private submissionQueue: Promise<void> = Promise.resolve();\n private pendingSubmissionCount = 0;\n\n /**\n * @description Create a submit queue over the same store and validation engine.\n * @param {FormStateStore<TValues>} store - Shared form state store to read and update.\n * @param {ValidationEngine<TValues>} validation - Validation engine sharing the same state store.\n * @example\n * ```ts\n * const submitter = new FormSubmitter(store, validation);\n * ```\n */\n public constructor(\n private readonly store: FormStateStore<TValues>,\n private readonly validation: ValidationEngine<TValues>,\n ) {}\n\n /**\n * @description Queue a submission, retry stale validation, and return the valid callback result or undefined after invalid validation.\n * @param {(values: TValues) => TResult | Promise<TResult>} onValid - Callback receiving current values after successful validation.\n * @param {((fields: Readonly<Record<PathKey, FieldState>>) => void) | undefined} [onInvalid] - Callback receiving field snapshots when validation fails.\n * @returns {Promise<TResult | undefined>} Promise of the valid callback result, or undefined when validation fails; callback errors reject.\n * @example\n * ```ts\n * await submitter.submit(values => save(values), fields => showErrors(fields));\n * ```\n */\n public submit<TResult>(\n onValid: (values: TValues) => TResult | Promise<TResult>,\n onInvalid?: (fields: Readonly<Record<PathKey, FieldState>>) => void,\n ): Promise<TResult | undefined> {\n this.pendingSubmissionCount += 1;\n this.store.beginSubmit();\n\n const submission = this.submissionQueue.then(() => this.executeSubmission(onValid, onInvalid));\n this.submissionQueue = submission.then(\n () => undefined,\n () => undefined,\n );\n\n return submission;\n }\n\n private async executeSubmission<TResult>(\n onValid: (values: TValues) => TResult | Promise<TResult>,\n onInvalid?: (fields: Readonly<Record<PathKey, FieldState>>) => void,\n ): Promise<TResult | undefined> {\n let successful = false;\n\n try {\n while (true) {\n const outcome = await this.validation.validateRegisteredFieldsOutcome('submit');\n\n switch (outcome.kind) {\n case 'stale':\n continue;\n case 'invalid':\n onInvalid?.(this.store.getState().fields);\n return undefined;\n case 'valid': {\n const result = await onValid(this.store.getValues());\n\n successful = true;\n return result;\n }\n }\n }\n } finally {\n this.pendingSubmissionCount -= 1;\n if (this.pendingSubmissionCount === 0) {\n this.store.completeSubmit(successful);\n }\n }\n }\n}\n","import { createStore, type StoreApi } from '@ilokesto/store';\nimport { produce } from 'immer';\n\nimport { FieldStateFactory } from './FieldStateFactory';\nimport { FormStateInitializer } from './FormStateInitializer';\nimport { FormStateReader } from './FormStateReader';\nimport { FormPath } from '../path/index';\nimport { ValueHelper } from '../value/index';\nimport type { FieldPath, FieldPathInput, FieldState, FormError, FormState, PathKey, ResetOptions, SetValueOptions } from '../types';\n\n/**\n * @description Owns immutable form snapshots and writes; each command preserves the store notification boundary.\n * @example\n * ```ts\n * const store = new FormStateStore({ email: \"\" });\n * store.setValue([\"email\"], \"Ada\");\n * ```\n */\nexport class FormStateStore<TValues> {\n private readonly store: StoreApi<FormState<TValues>>;\n\n /**\n * @description Create a store by normalizing the supplied default values.\n * @param {TValues} defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @example\n * ```ts\n * const store = new FormStateStore({ email: \"\" });\n * ```\n */\n public constructor(defaultValues: TValues) {\n this.store = createStore<FormState<TValues>>(FormStateInitializer.initialize(defaultValues));\n }\n\n /**\n * @description Read the current immutable form snapshot without cloning it.\n * @returns {Readonly<FormState<TValues>>} Current read-only snapshot; callers must not mutate it.\n * - defaultValues `TValues` - Initial values and the baseline used for dirty checks and reset.\n * - fields `Record<string, FieldState<unknown>>` - Field snapshots indexed by normalized path keys.\n * - submitCount `number` - Number of submission attempts started by the form.\n * - isSubmitting `boolean` - Whether queued validation or a submit callback is still pending.\n * - isSubmitted `boolean` - Whether a submission has completed at least once.\n * - isSubmitSuccessful `boolean` - Whether the latest completed submission reached a successful valid callback.\n * - arrayKeys `ArrayKeys` - Stable rendering keys indexed by array path.\n * @example\n * ```ts\n * store.getState();\n * ```\n */\n public getState(): Readonly<FormState<TValues>> {\n return this.store.getState();\n }\n\n /**\n * @description Subscribe to form state changes and return the callback that unsubscribes this listener.\n * @param {() => void} listener - Callback invoked synchronously after a state change.\n * @returns {() => void} Cleanup callback for this subscription or registration.\n * @example\n * ```ts\n * store.subscribe(() => render());\n * ```\n */\n public subscribe(listener: () => void): () => void {\n return this.store.subscribe(listener);\n }\n\n /**\n * @description Read a normalized field key, returning an independent default snapshot when absent.\n * @param {string} fieldKey - Normalized path key of the target field.\n * @returns {Readonly<FieldState>} Stored field snapshot, or an empty snapshot for an absent key.\n * - value `unknown` - Current field value.\n * - errors `FormError[]` - Current validation errors for the field.\n * - touched `boolean` - Whether the field has blurred at least once.\n * - dirty `boolean` - Whether the current value differs from its default by Object.is.\n * - modified `boolean` - Whether a user-originated write has changed this field.\n * - isFocused `boolean` - Whether focus has been recorded without a subsequent blur.\n * @example\n * ```ts\n * store.getFieldStateByKey(FormPath.pathToKey([\"email\"]));\n * ```\n */\n public getFieldStateByKey(fieldKey: PathKey): Readonly<FieldState> {\n return FormStateReader.getFieldStateByKey(this.store.getState(), fieldKey);\n }\n\n /**\n * @description Read field metadata and use a default snapshot when the field is not present.\n * @param {FieldPathInput} fieldPath - Literal field name or tuple path; strings are not split on dots.\n * @returns {Readonly<FieldState>} Field snapshot, with a default shape when the leaf field is absent.\n * - value `unknown` - Current field value.\n * - errors `FormError[]` - Current validation errors for the field.\n * - touched `boolean` - Whether the field has blurred at least once.\n * - dirty `boolean` - Whether the current value differs from its default by Object.is.\n * - modified `boolean` - Whether a user-originated write has changed this field.\n * - isFocused `boolean` - Whether focus has been recorded without a subsequent blur.\n * @example\n * ```ts\n * store.getFieldState([\"email\"]);\n * ```\n */\n public getFieldState(fieldPath: FieldPathInput): Readonly<FieldState> {\n return FormStateReader.getFieldState(this.store.getState(), fieldPath);\n }\n\n /**\n * @description Read only the current value of the selected field.\n * @param {FieldPathInput} fieldPath - Literal field name or tuple path; strings are not split on dots.\n * @returns {unknown} Stored field value, or undefined when the field has no value.\n * @example\n * ```ts\n * store.getValue([\"email\"]);\n * ```\n */\n public getValue(fieldPath: FieldPathInput): unknown {\n return FormStateReader.getValue(this.store.getState(), fieldPath);\n }\n\n /**\n * @description Reconstruct the nested values object from leaf fields and array containers.\n * @returns {TValues} Nested values reconstructed in the shape of the supplied defaults.\n * @example\n * ```ts\n * store.getValues();\n * ```\n */\n public getValues(): TValues {\n return FormStateReader.getValues(this.store.getState());\n }\n\n /**\n * @description Read a nested tuple path, returning undefined when a traversed container is missing or primitive.\n * @param {FieldPath} fieldPath - Tuple path identifying the target field or value.\n * @returns {unknown} Value at the tuple path, or undefined for an unreachable path.\n * @example\n * ```ts\n * store.getValueAtPath([\"email\"]);\n * ```\n */\n public getValueAtPath(fieldPath: FieldPath): unknown {\n return FormStateReader.getValueAtPath(this.store.getState(), fieldPath);\n }\n\n /**\n * @description Write a field value, compare dirty state with its default, and mark user-originated changes as modified. Return the normalized key for subsequent validation.\n * @param {FieldPath} fieldPath - Tuple path identifying the target field or value.\n * @param {unknown} value - Value to store or inspect.\n * @param {SetValueOptions} [options] - Write origin and optional immediate validation request.\n * @param {\"user\" | \"program\" | undefined} [options.source] - Write origin; user writes mark the field as modified.\n * @param {boolean | undefined} [options.validate] - Validation request for the controller; the state store itself does not run validation.\n * @returns {string} Normalized field key for the updated value.\n * @example\n * ```ts\n * store.setValue([\"email\"], \"Ada\", { source: \"user\" });\n * ```\n */\n public setValue(fieldPath: FieldPath, value: unknown, options: SetValueOptions = {}): PathKey {\n const fieldKey = FormPath.pathToKey(fieldPath);\n const defaultValue = ValueHelper.getValueAtPath(this.store.getState().defaultValues, fieldPath);\n\n this.store.setState(prevState =>\n produce(prevState, draft => {\n const previousField = draft.fields[fieldKey] ?? FieldStateFactory.createDefault();\n\n draft.fields[fieldKey] = {\n ...previousField,\n value,\n dirty: !Object.is(value, defaultValue),\n modified: options.source === 'user' ? true : previousField.modified,\n };\n }),\n );\n\n return fieldKey;\n }\n\n /**\n * @description Mark a field touched, creating default metadata if the field does not yet exist.\n * @param {string} fieldKey - Normalized path key of the target field.\n * @example\n * ```ts\n * store.touchField(FormPath.pathToKey([\"email\"]));\n * ```\n */\n public touchField(fieldKey: PathKey): void {\n this.store.setState(prevState =>\n produce(prevState, draft => {\n const previousField = draft.fields[fieldKey] ?? FieldStateFactory.createDefault();\n\n draft.fields[fieldKey] = {\n ...previousField,\n touched: true,\n };\n }),\n );\n }\n\n /**\n * @description Record focus, creating a default snapshot for an unknown field without clearing other fields.\n * @param {string} fieldKey - Normalized path key of the target field.\n * @example\n * ```ts\n * store.focusField(FormPath.pathToKey([\"email\"]));\n * ```\n */\n public focusField(fieldKey: PathKey): void {\n this.store.setState(prevState =>\n produce(prevState, draft => {\n const previousField = draft.fields[fieldKey] ?? FieldStateFactory.createDefault();\n\n draft.fields[fieldKey] = {\n ...previousField,\n isFocused: true,\n };\n }),\n );\n }\n\n /**\n * @description Clear focus, creating a default snapshot for an unknown field if necessary.\n * @param {string} fieldKey - Normalized path key of the target field.\n * @example\n * ```ts\n * store.unfocusField(FormPath.pathToKey([\"email\"]));\n * ```\n */\n public unfocusField(fieldKey: PathKey): void {\n this.store.setState(prevState =>\n produce(prevState, draft => {\n const previousField = draft.fields[fieldKey] ?? FieldStateFactory.createDefault();\n\n draft.fields[fieldKey] = {\n ...previousField,\n isFocused: false,\n };\n }),\n );\n }\n\n /**\n * @description Replace the errors for a normalized field key, creating a default field if necessary.\n * @param {string} fieldKey - Normalized path key of the target field.\n * @param {readonly FormError[]} errors - Current validation errors for the field.\n * @example\n * ```ts\n * store.setErrorsByKey(FormPath.pathToKey([\"email\"]), errors);\n * ```\n */\n public setErrorsByKey(fieldKey: PathKey, errors: readonly FormError[]): void {\n this.store.setState(prevState =>\n produce(prevState, draft => {\n const previousField = draft.fields[fieldKey] ?? FieldStateFactory.createDefault();\n\n draft.fields[fieldKey] = {\n ...previousField,\n errors: [...errors],\n };\n }),\n );\n }\n\n /**\n * @description Clear selected fields or all fields when no paths are provided.\n * @param {readonly string[] | undefined} [fieldKeys] - Normalized path keys to target.\n * @example\n * ```ts\n * store.clearErrors([FormPath.pathToKey([\"email\"])]);\n * ```\n */\n public clearErrors(fieldKeys?: readonly PathKey[]): void {\n this.store.setState(prevState =>\n produce(prevState, draft => {\n const keys = fieldKeys && fieldKeys.length > 0 ? fieldKeys : Object.keys(draft.fields);\n\n keys.forEach(fieldKey => {\n const previousField = draft.fields[fieldKey] ?? FieldStateFactory.createDefault();\n\n draft.fields[fieldKey] = {\n ...previousField,\n errors: [],\n };\n });\n }),\n );\n }\n\n /**\n * @description Reinitialize values and metadata, optionally retaining dirty values, errors, touched flags, and submission state.\n * @param {TValues | undefined} [values] - Replacement or current form values.\n * @param {ResetOptions} [options] - State preservation flags for this reset.\n * @param {boolean | undefined} [options.keepDirtyValues] - Preserve current values and modified flags of dirty fields.\n * @param {boolean | undefined} [options.keepErrors] - Preserve errors on surviving field paths.\n * @param {boolean | undefined} [options.keepTouched] - Preserve touched flags on surviving field paths.\n * @param {boolean | undefined} [options.keepSubmitState] - Preserve submission counters and lifecycle flags.\n * @example\n * ```ts\n * store.reset({ email: \"Ada\" }, { keepTouched: true });\n * ```\n */\n public reset(values?: TValues, options: ResetOptions = {}): void {\n const previousState = this.store.getState();\n const nextDefaultValues = values ?? previousState.defaultValues;\n const initializedState = FormStateInitializer.initialize(nextDefaultValues);\n\n this.store.setState(\n produce(initializedState, draft => {\n Object.entries(draft.fields).forEach(([fieldKey, nextField]) => {\n const previousField = previousState.fields[fieldKey];\n\n if (!previousField) {\n return;\n }\n\n if (options.keepDirtyValues && previousField.dirty) {\n const fieldPath = FormPath.keyToPath(fieldKey);\n const defaultValue = ValueHelper.getValueAtPath(nextDefaultValues, fieldPath);\n\n nextField.value = previousField.value;\n nextField.dirty = !Object.is(previousField.value, defaultValue);\n nextField.modified = previousField.modified;\n }\n\n if (options.keepErrors) {\n nextField.errors = [...previousField.errors];\n }\n\n if (options.keepTouched) {\n nextField.touched = previousField.touched;\n }\n });\n\n if (options.keepSubmitState) {\n draft.submitCount = previousState.submitCount;\n draft.isSubmitting = previousState.isSubmitting;\n draft.isSubmitted = previousState.isSubmitted;\n draft.isSubmitSuccessful = previousState.isSubmitSuccessful;\n }\n }),\n );\n }\n\n /**\n * @description Increment the attempt counter, mark submission pending, and clear the previous success flag.\n * @example\n * ```ts\n * store.beginSubmit();\n * ```\n */\n public beginSubmit(): void {\n this.store.setState(prevState =>\n produce(prevState, draft => {\n draft.submitCount += 1;\n draft.isSubmitting = true;\n draft.isSubmitSuccessful = false;\n }),\n );\n }\n\n /**\n * @description Finish the submission lifecycle and record whether the valid callback succeeded.\n * @param {boolean} successful - Whether the final submission callback completed successfully.\n * @example\n * ```ts\n * store.completeSubmit(true);\n * ```\n */\n public completeSubmit(successful: boolean): void {\n this.store.setState(prevState =>\n produce(prevState, draft => {\n draft.isSubmitting = false;\n draft.isSubmitted = true;\n draft.isSubmitSuccessful = successful;\n }),\n );\n }\n\n /**\n * @description Apply a complete normalized state updater through the underlying store.\n * @param {(previousState: FormState<TValues>) => FormState<TValues>} updater - State updater that replaces the complete normalized snapshot.\n * @example\n * ```ts\n * store.replaceState(previous => ({ ...previous, submitCount: 0 }));\n * ```\n */\n public replaceState(updater: (previousState: FormState<TValues>) => FormState<TValues>): void {\n this.store.setState(updater);\n }\n}\n","import { FormPath } from '../path/index';\nimport type { FieldPath, FieldPathSegment, FormError, PathKey, StandardSchemaV1 } from '../types';\n\n/**\n * @description Adapts Standard Schema validation results into field errors without depending on a specific schema library.\n * @example\n * ```ts\n * const validator = new StandardSchemaValidator(schema);\n * const result = await validator.validate(values);\n * ```\n */\nexport class StandardSchemaValidator<TValues> {\n /**\n * @description Create a Standard Schema adapter with optional library validation settings.\n * @param {StandardSchemaV1<unknown, TValues>} schema - Standard Schema validator to execute.\n * @param {StandardSchemaV1.Props<unknown, TValues>} schema.~standard - Standard Schema version, vendor, type metadata, and validation entry point.\n * @param {1} schema.~standard.version - Standard Schema major version, which must be 1.\n * @param {string} schema.~standard.vendor - Name of the schema library implementation.\n * @param {StandardSchemaV1.Types<unknown, TValues> | undefined} [schema.~standard.types] - Optional compile-time input and output metadata.\n * @param {unknown} [schema.~standard.types.input] - Schema input type metadata.\n * @param {TValues} [schema.~standard.types.output] - Schema output type metadata.\n * @param {(value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<TValues> | Promise<StandardSchemaV1.Result<TValues>>} schema.~standard.validate - Validate unknown input and return accepted values or issues, synchronously or asynchronously.\n * @param {StandardSchemaV1.Options | undefined} [options] - Optional library-specific Standard Schema validation settings.\n * @param {Record<string, unknown> | undefined} [options.libraryOptions] - Library-specific validation options; keys are defined by the schema library.\n * @example\n * ```ts\n * const validator = new StandardSchemaValidator(schema);\n * ```\n */\n public constructor(\n private readonly schema: StandardSchemaV1<unknown, TValues>,\n private readonly options?: StandardSchemaV1.Options,\n ) {}\n\n /**\n * @description Validate all values and group schema issues by normalized field key.\n * @param {TValues} values - Replacement or current form values.\n * @returns {Promise<StandardSchemaValidationResult>} Promise of schema validity and errors grouped by normalized path.\n * - valid `boolean` - Whether the schema accepted the supplied values.\n * - errorsByKey `Record<string, FormError[]>` - Validation errors grouped by normalized field path.\n * @example\n * ```ts\n * await validator.validate({ email: \"Ada\" });\n * ```\n */\n public async validate(values: TValues): Promise<StandardSchemaValidationResult> {\n const result = await this.schema['~standard'].validate(values, this.options);\n\n if (!result.issues) {\n return {\n valid: true,\n errorsByKey: {},\n };\n }\n\n return {\n valid: false,\n errorsByKey: result.issues.reduce<Record<PathKey, FormError[]>>((errorsByKey, issue) => {\n const fieldKey = FormPath.pathToKey(StandardSchemaValidator.issuePathToFieldPath(issue.path));\n errorsByKey[fieldKey] = [\n ...(errorsByKey[fieldKey] ?? []),\n {\n type: 'standard_schema',\n message: issue.message,\n },\n ];\n return errorsByKey;\n }, {}),\n };\n }\n\n /**\n * @description Validate one field value and flatten every issue into errors for that field.\n * @param {unknown} value - Value to store or inspect.\n * @returns {Promise<FormError[]>} Promise of the errors for this value, or an empty array on success.\n * @example\n * ```ts\n * await validator.validateValue(\"Ada\");\n * ```\n */\n public async validateValue(value: unknown): Promise<FormError[]> {\n const result = await this.schema['~standard'].validate(value, this.options);\n\n if (!result.issues) {\n return [];\n }\n\n return result.issues.map(issue => ({\n type: 'standard_schema',\n message: issue.message,\n }));\n }\n\n /**\n * Standard Schema issue path를 core FieldPath로 변환한다.\n *\n * @remarks\n * Standard Schema path segment는 PropertyKey 또는 `{ key }` 형태일 수 있다.\n * core FieldPath는 string/number만 지원하므로 symbol 등 표현할 수 없는 segment가 있으면 root error로 돌린다.\n *\n * @param issuePath - Standard Schema issue path.\n * @returns core에서 사용하는 FieldPath.\n */\n private static issuePathToFieldPath(issuePath: StandardSchemaV1.Issue['path']): FieldPath {\n if (!issuePath || issuePath.length === 0) {\n return [];\n }\n\n const fieldPath: FieldPathSegment[] = [];\n\n for (const segment of issuePath) {\n const key = StandardSchemaValidator.issuePathSegmentToKey(segment);\n\n if (key === undefined) {\n return [];\n }\n\n fieldPath.push(key);\n }\n\n return fieldPath;\n }\n\n /**\n * Standard Schema path segment 하나를 core path segment로 변환한다.\n *\n * @param segment - PropertyKey 또는 `{ key }` 형태의 path segment.\n * @returns string/number key면 그대로 반환하고, symbol처럼 표현할 수 없으면 undefined.\n */\n private static issuePathSegmentToKey(segment: PropertyKey | StandardSchemaV1.PathSegment): FieldPathSegment | undefined {\n const key = typeof segment === 'object' ? segment.key : segment;\n\n if (typeof key === 'string' || typeof key === 'number') {\n return key;\n }\n\n return undefined;\n }\n}\n\n/**\n * Standard Schema validation을 core가 사용할 수 있게 정규화한 결과다.\n */\nexport type StandardSchemaValidationResult = {\n /** schema validation 전체가 성공했는지 여부다. */\n valid: boolean;\n /** PathKey별로 묶은 FormError 목록이다. */\n errorsByKey: Record<PathKey, FormError[]>;\n};\n","import type { PathKey } from '../types';\n\ntype FullValidationToken = {\n /** Discriminant identifying the validation scope or valid, invalid, or stale outcome. */\n readonly kind: 'full';\n /** Global validation revision captured when full validation starts. */\n readonly revision: number;\n};\n\ntype FieldValidationToken = {\n /** Full-validation revision captured when field validation starts. */\n readonly fullRevision: number;\n /** Discriminant identifying the validation scope or valid, invalid, or stale outcome. */\n readonly kind: 'fields';\n /** Per-field revisions captured for this validation request. */\n readonly targetRevisions: ReadonlyMap<PathKey, number>;\n};\n\nexport type ValidationToken = FullValidationToken | FieldValidationToken;\n\n/**\n * @description Tracks global and per-field revisions so newer validation work invalidates stale results.\n * @example\n * ```ts\n * const sequencer = new ValidationSequencer();\n * const token = sequencer.startFields([\"email\"]);\n * ```\n */\nexport class ValidationSequencer {\n private revision = 0;\n private fullRevision = 0;\n private readonly targetRevisions = new Map<PathKey, number>();\n\n /**\n * @description Start a full validation revision, invalidating earlier full and field requests.\n * @returns {ValidationToken} Token capturing this full validation revision.\n * - kind `\"full\" | \"fields\"` - Validation scope: full-form or selected fields.\n * - revision `number` - Global validation revision captured when full validation starts.\n * - fullRevision `number` - Full-validation revision captured when field validation starts.\n * - targetRevisions `ReadonlyMap<string, number>` - Per-field revisions captured for this validation request.\n * @example\n * ```ts\n * sequencer.startFull();\n * ```\n */\n public startFull(): ValidationToken {\n this.revision += 1;\n this.fullRevision += 1;\n return { kind: 'full', revision: this.revision };\n }\n\n /**\n * @description Start revisions for the selected fields without invalidating unrelated field requests.\n * @param {readonly string[]} fieldKeys - Normalized path keys to target.\n * @returns {ValidationToken} Token capturing the full revision and selected field revisions.\n * - kind `\"full\" | \"fields\"` - Validation scope: full-form or selected fields.\n * - revision `number` - Global validation revision captured when full validation starts.\n * - fullRevision `number` - Full-validation revision captured when field validation starts.\n * - targetRevisions `ReadonlyMap<string, number>` - Per-field revisions captured for this validation request.\n * @example\n * ```ts\n * sequencer.startFields([FormPath.pathToKey([\"email\"])]);\n * ```\n */\n public startFields(fieldKeys: readonly PathKey[]): ValidationToken {\n this.revision += 1;\n const targetRevisions = new Map<PathKey, number>();\n\n for (const fieldKey of fieldKeys) {\n const revision = (this.targetRevisions.get(fieldKey) ?? 0) + 1;\n this.targetRevisions.set(fieldKey, revision);\n targetRevisions.set(fieldKey, revision);\n }\n\n return {\n fullRevision: this.fullRevision,\n kind: 'fields',\n targetRevisions,\n };\n }\n\n /**\n * @description Invalidate outstanding validation for the selected fields and any pending full request.\n * @param {readonly string[]} fieldKeys - Normalized path keys to target.\n * @example\n * ```ts\n * sequencer.invalidateFields([FormPath.pathToKey([\"email\"])]);\n * ```\n */\n public invalidateFields(fieldKeys: readonly PathKey[]): void {\n this.revision += 1;\n for (const fieldKey of fieldKeys) {\n this.targetRevisions.set(fieldKey, (this.targetRevisions.get(fieldKey) ?? 0) + 1);\n }\n }\n\n /**\n * @description Compare a captured token with current revisions to detect superseded validation.\n * @param {ValidationToken} token - Validation revision token to compare with current revisions.\n * @param {\"full\" | \"fields\"} token.kind - Validation scope: full-form or selected fields.\n * @param {number} token.revision - Global validation revision captured when full validation starts.\n * @param {number} token.fullRevision - Full-validation revision captured when field validation starts.\n * @param {ReadonlyMap<string, number>} token.targetRevisions - Per-field revisions captured for this validation request.\n * @returns {boolean} Whether any relevant revision has superseded the captured token.\n * @example\n * ```ts\n * const token = sequencer.startFull();\n * sequencer.startFields([FormPath.pathToKey([\"email\"])]);\n * const stale = sequencer.isStale(token);\n * ```\n */\n public isStale(token: ValidationToken): boolean {\n switch (token.kind) {\n case 'full':\n return token.revision !== this.revision;\n case 'fields':\n if (token.fullRevision !== this.fullRevision) return true;\n for (const [fieldKey, revision] of token.targetRevisions) {\n if (this.targetRevisions.get(fieldKey) !== revision) return true;\n }\n return false;\n }\n }\n}\n","import type { FormState, PathKey } from '../types';\n\ntype ValidationState = Pick<FormState<unknown>, 'arrayKeys' | 'fields'>;\n\n/**\n * @description Captures field-value and array-key identities so metadata-only writes do not invalidate validation.\n * @example\n * ```ts\n * const snapshot = ValidationSnapshot.capture(form.getState());\n * const unchanged = snapshot.matches(form.getState());\n * ```\n */\nexport class ValidationSnapshot {\n private constructor(\n private readonly fieldValues: ReadonlyMap<PathKey, unknown>,\n private readonly arrayKeys: ReadonlyMap<PathKey, readonly string[]>,\n ) {}\n\n /**\n * @description Capture current field-value and array-key references without retaining a store.\n * @param {ValidationState} state - Form snapshot used as the source of this calculation.\n * @param {Record<string, FieldState<unknown>>} state.fields - Field snapshots indexed by normalized path keys.\n * @param {ArrayKeys} state.arrayKeys - Stable rendering keys indexed by array path.\n * @returns {ValidationSnapshot} Identity snapshot independent of validation revisions and the live store.\n * @example\n * ```ts\n * ValidationSnapshot.capture(state);\n * ```\n */\n public static capture(state: ValidationState): ValidationSnapshot {\n return new ValidationSnapshot(\n new Map(Object.entries(state.fields).map(([fieldKey, field]) => [fieldKey, field.value])),\n new Map(Object.entries(state.arrayKeys)),\n );\n }\n\n /**\n * @description Check value and array-key identities; metadata-only and error-only changes still match.\n * @param {ValidationState} state - Form snapshot used as the source of this calculation.\n * @param {Record<string, FieldState<unknown>>} state.fields - Field snapshots indexed by normalized path keys.\n * @param {ArrayKeys} state.arrayKeys - Stable rendering keys indexed by array path.\n * @returns {boolean} Whether all captured field values and array keys still have identical references.\n * @example\n * ```ts\n * snapshot.matches(state);\n * ```\n */\n public matches(state: ValidationState): boolean {\n if (this.fieldValues.size !== Object.keys(state.fields).length) return false;\n if (this.arrayKeys.size !== Object.keys(state.arrayKeys).length) return false;\n\n for (const [fieldKey, value] of this.fieldValues) {\n if (!Object.is(state.fields[fieldKey]?.value, value)) return false;\n }\n for (const [fieldKey, keys] of this.arrayKeys) {\n if (!Object.is(state.arrayKeys[fieldKey], keys)) return false;\n }\n return true;\n }\n}\n","import { StandardSchemaValidator, type StandardSchemaValidationResult } from './StandardSchemaValidator';\nimport { ValidationSequencer, type ValidationToken } from './ValidationSequencer';\nimport { ValidationSnapshot } from './ValidationSnapshot';\nimport type { FormStateStore } from '../state/index';\nimport type { CreateFormOptions, FieldSchemaOptions, FormError, PathKey, ValidationTrigger } from '../types';\n\nexport type ValidationOutcome =\n | { /** Discriminant identifying the validation scope or valid, invalid, or stale outcome. */\n readonly kind: 'invalid' }\n | { /** Discriminant identifying the validation scope or valid, invalid, or stale outcome. */\n readonly kind: 'stale' }\n | { /** Discriminant identifying the validation scope or valid, invalid, or stale outcome. */\n readonly kind: 'valid' };\n\n/**\n * @description Runs form and field-local Standard Schema validators and rejects stale asynchronous results.\n * @example\n * ```ts\n * const validation = new ValidationEngine(store, { defaultValues: { email: \"\" } });\n * ```\n */\nexport class ValidationEngine<TValues> {\n /** validateOn이 지정되지 않았을 때 submit에서만 자동 검증하도록 하는 기본값이다. */\n private static readonly DEFAULT_VALIDATE_ON: readonly ValidationTrigger[] = ['submit'];\n\n /** validation 대상 field value와 errors를 읽고 쓰는 저장소다. */\n private readonly store: FormStateStore<TValues>;\n /** Standard Schema compatible schema를 실행하고 issue를 field errors로 바꾸는 adapter다. */\n private readonly schema?: StandardSchemaValidator<TValues>;\n /** field별로 form-level schema보다 우선 적용할 schema validator다. */\n private readonly fieldSchemas = new Map<PathKey, RegisteredFieldSchema>();\n /** 어떤 trigger에서 자동 validation을 실행할지 나타내는 설정이다. */\n private readonly validateOn: readonly ValidationTrigger[];\n /** field schema cleanup이 최신 등록만 제거하도록 구분하는 증가 id다. */\n private nextFieldSchemaId = 0;\n private readonly sequencer = new ValidationSequencer();\n\n /**\n * @description Create a validation engine with optional form schema and configured automatic triggers.\n * @param {FormStateStore<TValues>} store - Shared form state store to read and update.\n * @param {CreateFormOptions<TValues>} options - Default values, optional form schema, and automatic validation triggers.\n * @param {TValues} options.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {StandardSchemaV1<unknown, TValues> | undefined} [options.schema] - Standard Schema validator; a field-local schema takes precedence over the form schema.\n * @param {StandardSchemaV1.Props<unknown, TValues>} [options.schema.~standard] - Standard Schema version, vendor, type metadata, and validation entry point.\n * @param {1} [options.schema.~standard.version] - Standard Schema major version, which must be 1.\n * @param {string} [options.schema.~standard.vendor] - Name of the schema library implementation.\n * @param {StandardSchemaV1.Types<unknown, TValues> | undefined} [options.schema.~standard.types] - Optional compile-time input and output metadata.\n * @param {unknown} [options.schema.~standard.types.input] - Schema input type metadata.\n * @param {TValues} [options.schema.~standard.types.output] - Schema output type metadata.\n * @param {(value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<TValues> | Promise<StandardSchemaV1.Result<TValues>>} [options.schema.~standard.validate] - Validate unknown input and return accepted values or issues, synchronously or asynchronously.\n * @param {StandardSchemaV1.Options | undefined} [options.schemaOptions] - Options forwarded to the Standard Schema validator.\n * @param {Record<string, unknown> | undefined} [options.schemaOptions.libraryOptions] - Library-specific validation options; keys are defined by the schema library.\n * @param {readonly ValidationTrigger[] | undefined} [options.validateOn] - Triggers that run automatic validation; defaults to submit.\n * @example\n * ```ts\n * const validation = new ValidationEngine(store, { defaultValues: { email: \"\" } });\n * ```\n */\n public constructor(store: FormStateStore<TValues>, options: CreateFormOptions<TValues>) {\n this.store = store;\n this.schema = options.schema ? new StandardSchemaValidator(options.schema, options.schemaOptions) : undefined;\n this.validateOn = options.validateOn ?? ValidationEngine.DEFAULT_VALIDATE_ON;\n }\n\n /**\n * @description Check whether the configured automatic-validation triggers include this trigger.\n * @param {ValidationTrigger} trigger - Reason validation was requested; not passed to the schema.\n * @returns {boolean} Whether this trigger is enabled for automatic validation.\n * @example\n * ```ts\n * validation.shouldValidateOn(\"manual\");\n * ```\n */\n public shouldValidateOn(trigger: ValidationTrigger): boolean {\n return this.validateOn.includes(trigger);\n }\n\n /**\n * @description Register a field-local schema; the returned cleanup removes only this registration if it is still current.\n * @param {string} fieldKey - Normalized path key of the target field.\n * @param {FieldSchemaOptions} options - Field-local schema and validation settings.\n * @param {StandardSchemaV1<unknown, unknown>} options.schema - Standard Schema validator; a field-local schema takes precedence over the form schema.\n * @param {StandardSchemaV1.Props<unknown, unknown>} options.schema.~standard - Standard Schema version, vendor, type metadata, and validation entry point.\n * @param {1} options.schema.~standard.version - Standard Schema major version, which must be 1.\n * @param {string} options.schema.~standard.vendor - Name of the schema library implementation.\n * @param {StandardSchemaV1.Types<unknown, unknown> | undefined} [options.schema.~standard.types] - Optional compile-time input and output metadata.\n * @param {unknown} [options.schema.~standard.types.input] - Schema input type metadata.\n * @param {unknown} [options.schema.~standard.types.output] - Schema output type metadata.\n * @param {(value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<unknown> | Promise<StandardSchemaV1.Result<unknown>>} options.schema.~standard.validate - Validate unknown input and return accepted values or issues, synchronously or asynchronously.\n * @param {StandardSchemaV1.Options | undefined} [options.schemaOptions] - Options forwarded to the Standard Schema validator.\n * @param {Record<string, unknown> | undefined} [options.schemaOptions.libraryOptions] - Library-specific validation options; keys are defined by the schema library.\n * @returns {() => void} Cleanup callback for this subscription or registration.\n * @example\n * ```ts\n * validation.registerFieldSchema(FormPath.pathToKey([\"email\"]), { schema });\n * ```\n */\n public registerFieldSchema(fieldKey: PathKey, options: FieldSchemaOptions): () => void {\n const id = ++this.nextFieldSchemaId;\n\n this.fieldSchemas.set(fieldKey, {\n id,\n validator: new StandardSchemaValidator(options.schema, options.schemaOptions),\n });\n this.sequencer.invalidateFields([fieldKey]);\n\n return () => {\n if (this.fieldSchemas.get(fieldKey)?.id === id) {\n this.fieldSchemas.delete(fieldKey);\n this.sequencer.invalidateFields([fieldKey]);\n }\n };\n }\n\n /**\n * @description Validate one field with local-schema precedence and reject stale results.\n * @param {string} fieldKey - Normalized path key of the target field.\n * @param {ValidationTrigger} _trigger - Reason validation was requested; not passed to the schema.\n * @returns {Promise<boolean>} Promise resolving true only when the current validation result is valid.\n * @example\n * ```ts\n * await validation.validateField(FormPath.pathToKey([\"email\"]), \"manual\");\n * ```\n */\n public async validateField(fieldKey: PathKey, _trigger: ValidationTrigger): Promise<boolean> {\n return this.validateFields([fieldKey], _trigger);\n }\n\n /**\n * @description Validate selected fields with local-schema precedence; an empty list validates the full form.\n * @param {readonly string[]} fieldKeys - Normalized path keys to target.\n * @param {ValidationTrigger} _trigger - Reason validation was requested; not passed to the schema.\n * @returns {Promise<boolean>} Promise resolving true only when the current validation result is valid.\n * @example\n * ```ts\n * await validation.validateFields([FormPath.pathToKey([\"email\"])], \"manual\");\n * ```\n */\n public async validateFields(fieldKeys: readonly PathKey[], _trigger: ValidationTrigger): Promise<boolean> {\n const targetFieldKeys = ValidationEngine.unique(fieldKeys);\n\n if (targetFieldKeys.length === 0) {\n return this.validateRegisteredFields('manual');\n }\n\n const token = this.sequencer.startFields(targetFieldKeys);\n const snapshot = ValidationSnapshot.capture(this.store.getState());\n\n // Field validation gives local schemas precedence before running the form fallback.\n const localErrorsByKey = await this.validateFieldSchemas(targetFieldKeys);\n\n if (this.isStale(token, snapshot)) {\n return false;\n }\n\n const formSchemaFieldKeys = targetFieldKeys.filter(fieldKey => !this.fieldSchemas.has(fieldKey));\n const schemaResult = formSchemaFieldKeys.length > 0\n ? await this.validateFormSchema()\n : ValidationEngine.createValidSchemaResult();\n\n if (this.isStale(token, snapshot)) {\n return false;\n }\n\n const errorsByKey = this.mergeErrorsByKey(schemaResult.errorsByKey, localErrorsByKey);\n\n this.applyErrors([...formSchemaFieldKeys, ...Object.keys(localErrorsByKey)], errorsByKey);\n\n return targetFieldKeys.every(fieldKey => (errorsByKey[fieldKey] ?? []).length === 0);\n }\n\n /**\n * @description Validate the form and local overrides, returning false for invalid or stale results.\n * @param {ValidationTrigger} _trigger - Reason validation was requested; not passed to the schema.\n * @returns {Promise<boolean>} Promise resolving true only when the current validation result is valid.\n * @example\n * ```ts\n * await validation.validateRegisteredFields(\"manual\");\n * ```\n */\n public async validateRegisteredFields(_trigger: ValidationTrigger): Promise<boolean> {\n const outcome = await this.validateRegisteredFieldsOutcome(_trigger);\n return outcome.kind === 'valid';\n }\n\n /**\n * @description Validate the form and local overrides, distinguishing accepted, invalid, and stale results.\n * @param {ValidationTrigger} _trigger - Reason validation was requested; not passed to the schema.\n * @returns {Promise<ValidationOutcome>} Promise of a valid, invalid, or stale validation outcome.\n * - kind `\"invalid\" | \"stale\" | \"valid\"` - Validation outcome: valid, invalid, or stale.\n * @example\n * ```ts\n * await validation.validateRegisteredFieldsOutcome(\"manual\");\n * ```\n */\n public async validateRegisteredFieldsOutcome(\n _trigger: ValidationTrigger,\n ): Promise<ValidationOutcome> {\n const token = this.sequencer.startFull();\n const snapshot = ValidationSnapshot.capture(this.store.getState());\n\n // Full validation runs the form schema first, then applies local overrides.\n const schemaResult = await this.validateFormSchema();\n\n if (this.isStale(token, snapshot)) {\n return { kind: 'stale' };\n }\n\n const localErrorsByKey = await this.validateFieldSchemas([...this.fieldSchemas.keys()]);\n\n if (this.isStale(token, snapshot)) {\n return { kind: 'stale' };\n }\n\n const errorsByKey = this.mergeErrorsByKey(schemaResult.errorsByKey, localErrorsByKey);\n const keysToWrite = this.getValidationWriteKeys(errorsByKey);\n\n this.applyErrors(keysToWrite, errorsByKey);\n\n return keysToWrite.every(fieldKey => (errorsByKey[fieldKey] ?? []).length === 0)\n ? { kind: 'valid' }\n : { kind: 'invalid' };\n }\n\n /**\n * Standard Schema가 있으면 전체 form values를 검증한다.\n *\n * @returns schema가 없으면 성공 결과, 있으면 schema validation 결과.\n */\n private validateFormSchema(): Promise<StandardSchemaValidationResult> {\n if (!this.schema) {\n return Promise.resolve(ValidationEngine.createValidSchemaResult());\n }\n\n return this.schema.validate(this.store.getValues());\n }\n\n private isStale(token: ValidationToken, snapshot: ValidationSnapshot): boolean {\n return this.sequencer.isStale(token) || !snapshot.matches(this.store.getState());\n }\n\n /**\n * validation 결과를 store에 기록한다.\n *\n * @param fieldKeys - errors를 교체할 field key 목록.\n * @param errorsByKey - field key별 errors.\n */\n private applyErrors(fieldKeys: readonly PathKey[], errorsByKey: Readonly<Record<PathKey, readonly FormError[]>>): void {\n // Each field write notifies synchronously; applying a result is not a batched state change.\n fieldKeys.forEach(fieldKey => {\n this.store.setErrorsByKey(fieldKey, errorsByKey[fieldKey] ?? []);\n });\n }\n\n /** field-local schema가 있으면 해당 field value를 검증한다. */\n private async validateFieldSchema(fieldKey: PathKey): Promise<FormError[] | undefined> {\n const fieldSchema = this.fieldSchemas.get(fieldKey);\n\n if (!fieldSchema) {\n return undefined;\n }\n\n return fieldSchema.validator.validateValue(this.store.getFieldStateByKey(fieldKey).value);\n }\n\n /** 지정된 field들 중 field-local schema가 등록된 field만 검증한다. */\n private async validateFieldSchemas(fieldKeys: readonly PathKey[]): Promise<Record<PathKey, FormError[]>> {\n const errorsByKey: Record<PathKey, FormError[]> = {};\n\n await Promise.all(fieldKeys.map(async fieldKey => {\n const errors = await this.validateFieldSchema(fieldKey);\n\n if (errors) {\n errorsByKey[fieldKey] = errors;\n }\n }));\n\n return errorsByKey;\n }\n\n /**\n * form-level schema 결과에 field-local schema 결과를 덮어쓴다.\n *\n * @remarks\n * field-local schema가 등록된 field는 valid 결과([])까지도 form-level error보다 우선한다.\n */\n private mergeErrorsByKey(\n formErrorsByKey: Readonly<Record<PathKey, readonly FormError[]>>,\n fieldErrorsByKey: Readonly<Record<PathKey, readonly FormError[]>>,\n ): Record<PathKey, FormError[]> {\n const merged = Object.entries(formErrorsByKey).reduce<Record<PathKey, FormError[]>>((errorsByKey, [fieldKey, errors]) => {\n if (!this.fieldSchemas.has(fieldKey)) {\n errorsByKey[fieldKey] = [...errors];\n }\n\n return errorsByKey;\n }, {});\n\n Object.entries(fieldErrorsByKey).forEach(([fieldKey, errors]) => {\n merged[fieldKey] = [...errors];\n });\n\n return merged;\n }\n\n /**\n * 전체 validation 결과를 기록할 key 목록을 만든다.\n *\n * @remarks\n * 이전 schema error가 남아 있던 field도 clear해야 하므로 현재 store의 field key를 포함한다.\n *\n * @param schemaErrorsByKey - schema issue가 발생한 key 목록.\n * @returns errors를 교체할 key 목록.\n */\n private getValidationWriteKeys(\n schemaErrorsByKey: Readonly<Record<PathKey, readonly FormError[]>>,\n ): PathKey[] {\n return ValidationEngine.unique([...Object.keys(this.store.getState().fields), ...Object.keys(schemaErrorsByKey)]);\n }\n\n /**\n * 입력 순서를 유지하며 중복 field key를 제거한다.\n *\n * @param fieldKeys - 중복이 있을 수 있는 field key 목록.\n * @returns 중복 제거된 field key 목록.\n */\n private static unique(fieldKeys: readonly PathKey[]): PathKey[] {\n return [...new Set(fieldKeys)];\n }\n\n /** schema가 없거나 실행할 필요가 없을 때 쓰는 빈 성공 결과다. */\n private static createValidSchemaResult(): StandardSchemaValidationResult {\n return {\n valid: true,\n errorsByKey: {},\n };\n }\n}\n\ntype RegisteredFieldSchema = {\n id: number;\n validator: StandardSchemaValidator<unknown>;\n};\n","import { ArrayKeyGenerator, FormArrayController } from '../array/index';\nimport { FormSubmitter } from './FormSubmitter';\nimport { FormStateStore } from '../state/index';\nimport { FormPath } from '../path/index';\nimport { ValidationEngine } from '../validation/index';\nimport type { CreateFormOptions, FieldPathInput, FieldSchemaOptions, FieldState, Form, FormArray, FormError, FormState, PathKey, ResetOptions, SetValueOptions } from '../types';\n\n/**\n * @description Coordinates framework-neutral field, array, validation, and queued submission commands over one store.\n * @example\n * ```ts\n * const form = new CreateForm({ defaultValues: { email: \"\" } });\n * form.setValue(\"email\", \"Ada\");\n * ```\n */\nexport class CreateForm<TValues> implements Form<TValues> {\n /** form의 단일 상태 저장소. 모든 값/필드 메타데이터/배열 키는 이 store를 통해 읽고 쓴다. */\n private readonly store: FormStateStore<TValues>;\n /** 필드 명령 뒤에 실행할 검증과 field-local schema 등록을 담당한다. */\n private readonly validation: ValidationEngine<TValues>;\n /** 같은 form의 모든 배열 controller가 공유하는 item key 생성기. */\n private readonly arrayKeys = new ArrayKeyGenerator();\n /** submitCount 증가, submit validation, onValid/onInvalid 호출을 담당한다. */\n private readonly submitter: FormSubmitter<TValues>;\n\n /**\n * @description Create a form and connect its state, array, validation, and submission collaborators.\n * @param {CreateFormOptions<TValues>} options - Default values, optional form schema, and automatic validation triggers.\n * @param {TValues} options.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {StandardSchemaV1<unknown, TValues> | undefined} [options.schema] - Standard Schema validator; a field-local schema takes precedence over the form schema.\n * @param {StandardSchemaV1.Props<unknown, TValues>} [options.schema.~standard] - Standard Schema version, vendor, type metadata, and validation entry point.\n * @param {1} [options.schema.~standard.version] - Standard Schema major version, which must be 1.\n * @param {string} [options.schema.~standard.vendor] - Name of the schema library implementation.\n * @param {StandardSchemaV1.Types<unknown, TValues> | undefined} [options.schema.~standard.types] - Optional compile-time input and output metadata.\n * @param {unknown} [options.schema.~standard.types.input] - Schema input type metadata.\n * @param {TValues} [options.schema.~standard.types.output] - Schema output type metadata.\n * @param {(value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<TValues> | Promise<StandardSchemaV1.Result<TValues>>} [options.schema.~standard.validate] - Validate unknown input and return accepted values or issues, synchronously or asynchronously.\n * @param {StandardSchemaV1.Options | undefined} [options.schemaOptions] - Options forwarded to the Standard Schema validator.\n * @param {Record<string, unknown> | undefined} [options.schemaOptions.libraryOptions] - Library-specific validation options; keys are defined by the schema library.\n * @param {readonly ValidationTrigger[] | undefined} [options.validateOn] - Triggers that run automatic validation; defaults to submit.\n * @example\n * ```ts\n * const form = new CreateForm({ defaultValues: { email: \"\" } });\n * ```\n */\n public constructor(options: CreateFormOptions<TValues>) {\n this.store = new FormStateStore(options.defaultValues);\n\n this.validation = new ValidationEngine(this.store, options);\n this.submitter = new FormSubmitter(this.store, this.validation);\n }\n\n /**\n * @description Read the current immutable form snapshot without cloning it.\n * @returns {Readonly<FormState<TValues>>} Current read-only snapshot; callers must not mutate it.\n * - defaultValues `TValues` - Initial values and the baseline used for dirty checks and reset.\n * - fields `Record<string, FieldState<unknown>>` - Field snapshots indexed by normalized path keys.\n * - submitCount `number` - Number of submission attempts started by the form.\n * - isSubmitting `boolean` - Whether queued validation or a submit callback is still pending.\n * - isSubmitted `boolean` - Whether a submission has completed at least once.\n * - isSubmitSuccessful `boolean` - Whether the latest completed submission reached a successful valid callback.\n * - arrayKeys `ArrayKeys` - Stable rendering keys indexed by array path.\n * @example\n * ```ts\n * form.getState();\n * ```\n */\n public getState(): Readonly<FormState<TValues>> {\n return this.store.getState();\n }\n\n /**\n * @description Subscribe to form state changes and return the callback that unsubscribes this listener.\n * @param {() => void} listener - Callback invoked synchronously after a state change.\n * @returns {() => void} Cleanup callback for this subscription or registration.\n * @example\n * ```ts\n * form.subscribe(() => render());\n * ```\n */\n public subscribe(listener: () => void): () => void {\n return this.store.subscribe(listener);\n }\n\n /**\n * @description Register a field-local schema; the returned cleanup removes only this registration if it is still current.\n * @param {FieldPathInput} path - Literal field name or tuple path; strings are not split on dots.\n * @param {FieldSchemaOptions} options - Field-local schema and validation settings.\n * @param {StandardSchemaV1<unknown, unknown>} options.schema - Standard Schema validator; a field-local schema takes precedence over the form schema.\n * @param {StandardSchemaV1.Props<unknown, unknown>} options.schema.~standard - Standard Schema version, vendor, type metadata, and validation entry point.\n * @param {1} options.schema.~standard.version - Standard Schema major version, which must be 1.\n * @param {string} options.schema.~standard.vendor - Name of the schema library implementation.\n * @param {StandardSchemaV1.Types<unknown, unknown> | undefined} [options.schema.~standard.types] - Optional compile-time input and output metadata.\n * @param {unknown} [options.schema.~standard.types.input] - Schema input type metadata.\n * @param {unknown} [options.schema.~standard.types.output] - Schema output type metadata.\n * @param {(value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<unknown> | Promise<StandardSchemaV1.Result<unknown>>} options.schema.~standard.validate - Validate unknown input and return accepted values or issues, synchronously or asynchronously.\n * @param {StandardSchemaV1.Options | undefined} [options.schemaOptions] - Options forwarded to the Standard Schema validator.\n * @param {Record<string, unknown> | undefined} [options.schemaOptions.libraryOptions] - Library-specific validation options; keys are defined by the schema library.\n * @returns {() => void} Cleanup callback for this subscription or registration.\n * @example\n * ```ts\n * form.registerFieldSchema([\"email\"], { schema });\n * ```\n */\n public registerFieldSchema(path: FieldPathInput, options: FieldSchemaOptions): () => void {\n return this.validation.registerFieldSchema(FormPath.pathInputToKey(path), options);\n }\n\n /**\n * @description Read field metadata and use a default snapshot when the field is not present.\n * @param {FieldPathInput} path - Literal field name or tuple path; strings are not split on dots.\n * @returns {Readonly<FieldState>} Field snapshot, with a default shape when the leaf field is absent.\n * - value `unknown` - Current field value.\n * - errors `FormError[]` - Current validation errors for the field.\n * - touched `boolean` - Whether the field has blurred at least once.\n * - dirty `boolean` - Whether the current value differs from its default by Object.is.\n * - modified `boolean` - Whether a user-originated write has changed this field.\n * - isFocused `boolean` - Whether focus has been recorded without a subsequent blur.\n * @example\n * ```ts\n * form.getFieldState([\"email\"]);\n * ```\n */\n public getFieldState(path: FieldPathInput): Readonly<FieldState> {\n return this.store.getFieldState(path);\n }\n\n /**\n * @description Read only the current value of the selected field.\n * @param {FieldPathInput} path - Literal field name or tuple path; strings are not split on dots.\n * @returns {unknown} Stored field value, or undefined when the field has no value.\n * @example\n * ```ts\n * form.getValue([\"email\"]);\n * ```\n */\n public getValue(path: FieldPathInput): unknown {\n return this.store.getValue(path);\n }\n\n /**\n * @description Reconstruct the nested values object from leaf fields and array containers.\n * @returns {TValues} Nested values reconstructed in the shape of the supplied defaults.\n * @example\n * ```ts\n * form.getValues();\n * ```\n */\n public getValues(): TValues {\n return this.store.getValues();\n }\n\n /**\n * @description Write a field value, compare dirty state with its default, and mark user-originated changes as modified. Start change validation when explicitly requested or configured.\n * @param {FieldPathInput} path - Literal field name or tuple path; strings are not split on dots.\n * @param {unknown} value - Value to store or inspect.\n * @param {SetValueOptions} [options] - Write origin and optional immediate validation request.\n * @param {\"user\" | \"program\" | undefined} [options.source] - Write origin; user writes mark the field as modified.\n * @param {boolean | undefined} [options.validate] - Whether to start validation immediately after this write.\n * @example\n * ```ts\n * form.setValue([\"email\"], \"Ada\", { source: \"user\" });\n * ```\n */\n public setValue(path: FieldPathInput, value: unknown, options: SetValueOptions = {}): void {\n const fieldKey = this.store.setValue(FormPath.toFieldPath(path), value, options);\n\n // setValue는 동기 API다. 상태 알림 이후 change validation을 시작한다.\n if (options.validate || this.validation.shouldValidateOn('change')) {\n void this.validation.validateField(fieldKey, 'change');\n }\n }\n\n /**\n * @description Clear focus and mark touched before running configured blur validation; return true when validation is disabled.\n * @param {FieldPathInput} path - Literal field name or tuple path; strings are not split on dots.\n * @returns {Promise<boolean>} Promise resolving true when validation is disabled or the current field result is valid.\n * @example\n * ```ts\n * await form.blur([\"email\"]);\n * ```\n */\n public async blur(path: FieldPathInput): Promise<boolean> {\n const fieldKey = FormPath.pathInputToKey(path);\n this.store.unfocusField(fieldKey);\n this.store.touchField(fieldKey);\n\n if (!this.validation.shouldValidateOn('blur')) {\n return true;\n }\n\n return this.validation.validateField(fieldKey, 'blur');\n }\n\n /**\n * @description Record focus for this field without modifying its value.\n * @param {FieldPathInput} path - Literal field name or tuple path; strings are not split on dots.\n * @example\n * ```ts\n * form.focus([\"email\"]);\n * ```\n */\n public focus(path: FieldPathInput): void {\n this.store.focusField(FormPath.pathInputToKey(path));\n }\n\n /**\n * @description Replace the selected field error list without running validation.\n * @param {FieldPathInput} path - Literal field name or tuple path; strings are not split on dots.\n * @param {readonly FormError[]} errors - Current validation errors for the field.\n * @example\n * ```ts\n * form.setErrors([\"email\"], errors);\n * ```\n */\n public setErrors(path: FieldPathInput, errors: readonly FormError[]): void {\n this.store.setErrorsByKey(FormPath.pathInputToKey(path), errors);\n }\n\n /**\n * @description Clear selected fields or all fields when no paths are provided.\n * @param {FieldPathInput[]} paths - Fields to target; no paths means all fields.\n * @example\n * ```ts\n * form.clearErrors(\"email\");\n * ```\n */\n public clearErrors(...paths: FieldPathInput[]): void {\n this.store.clearErrors(paths.length > 0 ? paths.map(path => FormPath.pathInputToKey(path)) : undefined);\n }\n\n /**\n * @description Run manual schema validation for selected paths or the whole form when no paths are supplied.\n * @param {FieldPathInput[]} paths - Fields to target; no paths means all fields.\n * @returns {Promise<boolean>} Promise resolving true only when the targeted current validation result is valid.\n * @example\n * ```ts\n * await form.trigger(\"email\");\n * ```\n */\n public trigger(...paths: FieldPathInput[]): Promise<boolean> {\n if (paths.length === 0) {\n return this.validation.validateRegisteredFields('manual');\n }\n\n return this.validation.validateFields(paths.map(path => FormPath.pathInputToKey(path)), 'manual');\n }\n\n /**\n * @description Create commands for an array field that keep values, stable keys, and child state aligned.\n * @param {FieldPathInput} path - Literal field name or tuple path; strings are not split on dots.\n * @returns {FormArray} Array commands sharing the current form store and item-key generator.\n * - keys `() => readonly string[]` - Stable item keys in array order.\n * - insert `(index: number, value: unknown) => void` - Insert a value at a bounded array index.\n * - push `(value: unknown) => void` - Append a value and allocate a stable item key.\n * - remove `(index: number) => void` - Remove the indexed item and rebase surviving child fields.\n * - move `(fromIndex: number, toIndex: number) => void` - Move an item while preserving its key and child metadata.\n * - swap `(leftIndex: number, rightIndex: number) => void` - Swap item positions while preserving keys and child metadata.\n * - replace `(values: readonly unknown[]) => void` - Replace all array items and regenerate their keys and child state.\n * @example\n * ```ts\n * form.array(\"users\").push({ email: \"\" });\n * ```\n */\n public array(path: FieldPathInput): FormArray {\n return new FormArrayController(this.store, this.arrayKeys, FormPath.toFieldPath(path));\n }\n\n /**\n * @description Reinitialize values and metadata, optionally retaining dirty values, errors, touched flags, and submission state.\n * @param {TValues | undefined} [values] - Replacement or current form values.\n * @param {ResetOptions | undefined} [options] - State preservation flags for this reset.\n * @param {boolean | undefined} [options.keepDirtyValues] - Preserve current values and modified flags of dirty fields.\n * @param {boolean | undefined} [options.keepErrors] - Preserve errors on surviving field paths.\n * @param {boolean | undefined} [options.keepTouched] - Preserve touched flags on surviving field paths.\n * @param {boolean | undefined} [options.keepSubmitState] - Preserve submission counters and lifecycle flags.\n * @example\n * ```ts\n * form.reset({ email: \"Ada\" }, { keepTouched: true });\n * ```\n */\n public reset(values?: TValues, options?: ResetOptions): void {\n this.store.reset(values, options);\n }\n\n /**\n * @description Queue a submission, retry stale validation, and return the valid callback result or undefined after invalid validation.\n * @param {(values: TValues) => TResult | Promise<TResult>} onValid - Callback receiving current values after successful validation.\n * @param {((fields: Readonly<Record<PathKey, FieldState>>) => void) | undefined} [onInvalid] - Callback receiving field snapshots when validation fails.\n * @returns {Promise<TResult | undefined>} Promise of the valid callback result, or undefined when validation fails; callback errors reject.\n * @example\n * ```ts\n * await form.submit(values => save(values), fields => showErrors(fields));\n * ```\n */\n public submit<TResult>(\n onValid: (values: TValues) => TResult | Promise<TResult>,\n onInvalid?: (fields: Readonly<Record<PathKey, FieldState>>) => void,\n ): Promise<TResult | undefined> {\n return this.submitter.submit(onValid, onInvalid);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/adapters/dom/SubmitHandler.ts","../src/ad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AAA,IACxC,cAAc,KAAA,CAAM,YAAA;AAAA,IACpB,aAAa,KAAA,CAAM,WAAA;AAAA,IACnB,oBAAoB,KAAA,CAAM,kBAAA;AAAA,IAC1B,aAAa,KAAA,CAAM;AAAA,GACrB;AACF;AAEA,SAAS,cAAuB,KAAA,EAAkE;AAChG,EAAA,OAAO,MAAA,CAAO,WAAA;AAAA,IACZ,MAAA,CAAO,OAAA,CAAQ,KAAA,CAAM,MAAM,CAAA,CACxB,MAAA,CAAO,CAAC,GAAG,KAAK,CAAA,KAAM,KAAA,CAAM,MAAA,CAAO,MAAA,GAAS,CAAC,CAAA,CAC7C,GAAA,CAAI,CAAC,CAAC,GAAA,EAAK,KAAK,CAAA,KAAM,CAAC,GAAA,EAAK,CAAC,GAAG,KAAA,CAAM,MAAM,CAAC,CAAC;AAAA,GACnD;AACF;AAEA,SAAS,oBAAA,CAA8B,OAAqC,IAAA,EAAiD;AAC3H,EAAA,OAAO,MAAA,CAAO,WAAA;AAAA,IACZ,MAAA,CAAO,QAAQ,KAAA,CAAM,MAAM,EACxB,MAAA,CAAO,CAAC,GAAG,KAAK,CAAA,KAAM,MAAM,IAAI,CAAC,CAAA,CACjC,GAAA,CAAI,CAAC,CAAC,GAAG,CAAA,KAAM,CAAC,GAAA,EAAK,IAAI,CAAC;AAAA,GAC/B;AACF;AAEA,SAAS,iBAA0B,KAAA,EAAoD;AACrF,EAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,OAAA,CAAQ,KAAA,CAAM,MAAM,CAAA,CAAE,IAAA,CAAK,CAAC,GAAG,KAAK,CAAA,KAAM,MAAM,SAAS,CAAA;AAC9E,EAAA,OAAO,KAAA,GAAQ,KAAA,CAAM,CAAC,CAAA,GAAI,IAAA;AAC5B","file":"chunk-WO5TIXCR.js","sourcesContent":["import type { FieldState, Form } from '../../core/index';\nimport type { PathKey } from '../../core/types';\n\nexport type SubmitEventLike = {\n /** Optional callback used to cancel native form submission. */\n preventDefault?: () => void;\n};\n\nexport type SubmitValidHandler<TValues, TResult> = (values: TValues) => TResult | Promise<TResult>;\n\nexport type SubmitInvalidHandler = (fields: Readonly<Record<PathKey, FieldState>>) => void;\n\nexport type SubmitHandler<TEvent extends SubmitEventLike, TResult> = (event?: TEvent) => Promise<TResult | undefined>;\n\n/**\n * @description Create an asynchronous event handler that optionally prevents default before running the form submission queue.\n * @param {Form<TValues>} form - Core form instance shared by all bound helpers.\n * @param {() => Readonly<FormState<TValues>>} form.getState - Read the current immutable form snapshot.\n * @param {(listener: () => void) => () => void} form.subscribe - Subscribe to state changes and return an unsubscribe callback.\n * @param {(path: FieldPathInput, options: FieldSchemaOptions) => () => void} form.registerFieldSchema - Register an overriding field-local validator and return its guarded cleanup.\n * @param {(path: FieldPathInput) => Readonly<FieldState>} form.getFieldState - Read field metadata, using a default snapshot for an unknown field.\n * @param {(path: FieldPathInput) => unknown} form.getValue - Read the current value of one field.\n * @param {() => TValues} form.getValues - Reconstruct nested values from fields and array containers.\n * @param {(path: FieldPathInput, value: unknown, options?: SetValueOptions) => void} form.setValue - Write a field with configurable user or program origin and optional immediate validation.\n * @param {(path: FieldPathInput) => Promise<boolean>} form.blur - Clear focus, mark touched, and run configured blur validation.\n * @param {(path: FieldPathInput) => void} form.focus - Record focus for the selected field.\n * @param {(path: FieldPathInput, errors: readonly FormError[]) => void} form.setErrors - Replace all errors for the selected field.\n * @param {(...paths: FieldPathInput[]) => void} form.clearErrors - Clear selected fields, or all field errors when no paths are supplied.\n * @param {(...paths: FieldPathInput[]) => Promise<boolean>} form.trigger - Run manual validation for selected paths or the entire form.\n * @param {(path: FieldPathInput) => FormArray} form.array - Return commands that keep array values, keys, and child metadata aligned.\n * @param {(values?: TValues | undefined, options?: ResetOptions) => void} form.reset - Reinitialize from default or replacement values with optional preservation flags.\n * @param {<TResult>(onValid: (values: TValues) => TResult | Promise<TResult>, onInvalid?: (fields: Readonly<Record<PathKey, FieldState>>) => void) => Promise<TResult | undefined>} form.submit - Queue validation and dispatch the valid or invalid callback.\n * @param {SubmitValidHandler<TValues, TResult>} onValid - Callback receiving current values after successful validation.\n * @param {SubmitInvalidHandler | undefined} [onInvalid] - Callback receiving field snapshots when validation fails.\n * @returns {SubmitHandler<TEvent, TResult>} Event handler resolving to the valid callback result or undefined after invalid validation.\n * @example\n * ```ts\n * createSubmitHandler(form, values => save(values), fields => showErrors(fields));\n * ```\n */\nexport function createSubmitHandler<TValues, TEvent extends SubmitEventLike, TResult>(\n form: Form<TValues>,\n onValid: SubmitValidHandler<TValues, TResult>,\n onInvalid?: SubmitInvalidHandler,\n): SubmitHandler<TEvent, TResult> {\n return async event => {\n event?.preventDefault?.();\n\n return form.submit(onValid, onInvalid);\n };\n}\n","import type { FieldPathInput, FieldState, Form, FormState } from '../../core/index';\n\n/**\n * @description Read field metadata, reconstructing container values from current nested values when no leaf field exists.\n * @param {Form<TValues>} form - Core form instance shared by all bound helpers.\n * @param {() => Readonly<FormState<TValues>>} form.getState - Read the current immutable form snapshot.\n * @param {(listener: () => void) => () => void} form.subscribe - Subscribe to state changes and return an unsubscribe callback.\n * @param {(path: FieldPathInput, options: FieldSchemaOptions) => () => void} form.registerFieldSchema - Register an overriding field-local validator and return its guarded cleanup.\n * @param {(path: FieldPathInput) => Readonly<FieldState>} form.getFieldState - Read field metadata, using a default snapshot for an unknown field.\n * @param {(path: FieldPathInput) => unknown} form.getValue - Read the current value of one field.\n * @param {() => TValues} form.getValues - Reconstruct nested values from fields and array containers.\n * @param {(path: FieldPathInput, value: unknown, options?: SetValueOptions) => void} form.setValue - Write a field with configurable user or program origin and optional immediate validation.\n * @param {(path: FieldPathInput) => Promise<boolean>} form.blur - Clear focus, mark touched, and run configured blur validation.\n * @param {(path: FieldPathInput) => void} form.focus - Record focus for the selected field.\n * @param {(path: FieldPathInput, errors: readonly FormError[]) => void} form.setErrors - Replace all errors for the selected field.\n * @param {(...paths: FieldPathInput[]) => void} form.clearErrors - Clear selected fields, or all field errors when no paths are supplied.\n * @param {(...paths: FieldPathInput[]) => Promise<boolean>} form.trigger - Run manual validation for selected paths or the entire form.\n * @param {(path: FieldPathInput) => FormArray} form.array - Return commands that keep array values, keys, and child metadata aligned.\n * @param {(values?: TValues | undefined, options?: ResetOptions) => void} form.reset - Reinitialize from default or replacement values with optional preservation flags.\n * @param {<TResult>(onValid: (values: TValues) => TResult | Promise<TResult>, onInvalid?: (fields: Readonly<Record<PathKey, FieldState>>) => void) => Promise<TResult | undefined>} form.submit - Queue validation and dispatch the valid or invalid callback.\n * @param {Readonly<FormState<TValues>>} state - Form snapshot used as the source of this calculation.\n * @param {TValues} state.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {Record<string, FieldState<unknown>>} state.fields - Field snapshots indexed by normalized path keys.\n * @param {number} state.submitCount - Number of submission attempts started by the form.\n * @param {boolean} state.isSubmitting - Whether queued validation or a submit callback is still pending.\n * @param {boolean} state.isSubmitted - Whether a submission has completed at least once.\n * @param {boolean} state.isSubmitSuccessful - Whether the latest completed submission reached a successful valid callback.\n * @param {ArrayKeys} state.arrayKeys - Stable rendering keys indexed by array path.\n * @param {FieldPathInput} name - Literal field name or tuple path; strings are not split on dots.\n * @returns {Readonly<FieldState>} Field snapshot, with a default shape when the leaf field is absent.\n * - value `unknown` - Current field value.\n * - errors `FormError[]` - Current validation errors for the field.\n * - touched `boolean` - Whether the field has blurred at least once.\n * - dirty `boolean` - Whether the current value differs from its default by Object.is.\n * - modified `boolean` - Whether a user-originated write has changed this field.\n * - isFocused `boolean` - Whether focus has been recorded without a subsequent blur.\n * @example\n * ```ts\n * const field = getFieldState(form, form.getState(), \"email\");\n * ```\n */\nexport function getFieldState<TValues>(form: Form<TValues>, state: Readonly<FormState<TValues>>, name: FieldPathInput): Readonly<FieldState> {\n const field = form.getFieldState(name);\n\n if (fieldPathExists(state, name)) {\n return field;\n }\n\n const value = getValueAtPath(form.getValues(), toFieldPath(name));\n\n return {\n ...field,\n value,\n };\n}\n\nfunction toFieldPath(name: FieldPathInput): readonly (string | number)[] {\n return typeof name === 'string' ? [name] : name;\n}\n\nfunction fieldPathExists<TValues>(state: Readonly<FormState<TValues>>, name: FieldPathInput): boolean {\n return pathInputToKey(name) in state.fields;\n}\n\nfunction pathInputToKey(name: FieldPathInput): string {\n const path = toFieldPath(name);\n\n return path.length === 0 ? '$' : JSON.stringify(path);\n}\n\nfunction getValueAtPath(source: unknown, path: readonly (string | number)[]): unknown {\n let current = source;\n\n for (const segment of path) {\n if (current === null || current === undefined) {\n return undefined;\n }\n\n if (typeof current !== 'object' && typeof current !== 'function') {\n return undefined;\n }\n\n current = (current as Record<string | number, unknown>)[segment];\n }\n\n return current;\n}\n","import type { FieldPathInput, FieldState, Form } from '../../core/index';\nimport type { DomValue, FieldEventTarget, RegisterOptions } from './types';\n\nconst SKIP_CHANGE = Symbol('skip change');\n\ntype ChangeValue = unknown | typeof SKIP_CHANGE;\n\nexport type DomBindingCore = {\n /** DOM name string; tuple paths are JSON-serialized. */\n readonly name: string;\n /** Input kind; checkbox and radio use checked semantics, otherwise defaults to text. */\n readonly type: string;\n /** Current field value. */\n readonly value?: DomValue;\n /** Whether this checkbox or radio represents the current field value. */\n readonly checked?: boolean;\n /** Schema input type metadata. */\n input(target: FieldEventTarget): void;\n /** Commit the change event value using checkbox, radio, or selection semantics. */\n change(target: FieldEventTarget): void;\n /** Clear focus, mark touched, and run configured blur validation. */\n blur(): void;\n /** Record focus for the selected field. */\n focus(): void;\n};\n\n/**\n * @description Create shared DOM value and checked bindings plus event commands that write user-originated changes.\n * @param {Form<TValues>} form - Core form instance shared by all bound helpers.\n * @param {() => Readonly<FormState<TValues>>} form.getState - Read the current immutable form snapshot.\n * @param {(listener: () => void) => () => void} form.subscribe - Subscribe to state changes and return an unsubscribe callback.\n * @param {(path: FieldPathInput, options: FieldSchemaOptions) => () => void} form.registerFieldSchema - Register an overriding field-local validator and return its guarded cleanup.\n * @param {(path: FieldPathInput) => Readonly<FieldState>} form.getFieldState - Read field metadata, using a default snapshot for an unknown field.\n * @param {(path: FieldPathInput) => unknown} form.getValue - Read the current value of one field.\n * @param {() => TValues} form.getValues - Reconstruct nested values from fields and array containers.\n * @param {(path: FieldPathInput, value: unknown, options?: SetValueOptions) => void} form.setValue - Write a field with configurable user or program origin and optional immediate validation.\n * @param {(path: FieldPathInput) => Promise<boolean>} form.blur - Clear focus, mark touched, and run configured blur validation.\n * @param {(path: FieldPathInput) => void} form.focus - Record focus for the selected field.\n * @param {(path: FieldPathInput, errors: readonly FormError[]) => void} form.setErrors - Replace all errors for the selected field.\n * @param {(...paths: FieldPathInput[]) => void} form.clearErrors - Clear selected fields, or all field errors when no paths are supplied.\n * @param {(...paths: FieldPathInput[]) => Promise<boolean>} form.trigger - Run manual validation for selected paths or the entire form.\n * @param {(path: FieldPathInput) => FormArray} form.array - Return commands that keep array values, keys, and child metadata aligned.\n * @param {(values?: TValues | undefined, options?: ResetOptions) => void} form.reset - Reinitialize from default or replacement values with optional preservation flags.\n * @param {<TResult>(onValid: (values: TValues) => TResult | Promise<TResult>, onInvalid?: (fields: Readonly<Record<PathKey, FieldState>>) => void) => Promise<TResult | undefined>} form.submit - Queue validation and dispatch the valid or invalid callback.\n * @param {RegisterOptions} options - Field schema and DOM binding options.\n * @param {FieldPathInput} options.name - Literal field name or tuple path; strings are not split on dots.\n * @param {StandardSchemaV1<unknown, unknown> | undefined} [options.schema] - Standard Schema validator; a field-local schema takes precedence over the form schema.\n * @param {StandardSchemaV1.Props<unknown, unknown>} [options.schema.~standard] - Standard Schema version, vendor, type metadata, and validation entry point.\n * @param {1} [options.schema.~standard.version] - Standard Schema major version, which must be 1.\n * @param {string} [options.schema.~standard.vendor] - Name of the schema library implementation.\n * @param {StandardSchemaV1.Types<unknown, unknown> | undefined} [options.schema.~standard.types] - Optional compile-time input and output metadata.\n * @param {unknown} [options.schema.~standard.types.input] - Schema input type metadata.\n * @param {unknown} [options.schema.~standard.types.output] - Schema output type metadata.\n * @param {(value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<unknown> | Promise<StandardSchemaV1.Result<unknown>>} [options.schema.~standard.validate] - Validate unknown input and return accepted values or issues, synchronously or asynchronously.\n * @param {StandardSchemaV1.Options | undefined} [options.schemaOptions] - Options forwarded to the Standard Schema validator.\n * @param {Record<string, unknown> | undefined} [options.schemaOptions.libraryOptions] - Library-specific validation options; keys are defined by the schema library.\n * @param {string | undefined} [options.type] - Input kind; checkbox and radio use checked semantics, otherwise defaults to text.\n * @param {unknown} [options.value] - Explicit option value used by checkbox and radio bindings.\n * @param {unknown} [options.checkedValue] - Value written by a checked checkbox; omitted for a boolean checkbox.\n * @param {unknown} [options.uncheckedValue] - Value written by an unchecked checkbox; defaults to false.\n * @param {() => Readonly<FieldState>} getField - Read the latest field snapshot when a binding is accessed.\n * @param {string} domName - Name string assigned to the DOM control.\n * @returns {DomBindingCore} Live value and checked getters with commands for DOM interaction.\n * - name `string` - DOM name string; tuple paths are JSON-serialized.\n * - type `string` - Input kind; checkbox and radio use checked semantics, otherwise defaults to text.\n * - value `DomValue | undefined` - DOM-compatible field or option value for this input kind.\n * - checked `boolean | undefined` - Whether this checkbox or radio represents the current field value.\n * - input `(target: FieldEventTarget) => void` - Process text input while ignoring checkbox, radio, and multiple-select input events.\n * - change `(target: FieldEventTarget) => void` - Commit the change event value using checkbox, radio, or selection semantics.\n * - blur `() => void` - Clear focus, mark touched, and run configured blur validation.\n * - focus `() => void` - Record focus for the selected field.\n * @example\n * ```ts\n * createDomBinding(form, { name: \"email\" }, () => form.getFieldState(\"email\"), \"email\");\n * ```\n */\nexport function createDomBinding<TValues>(\n form: Form<TValues>,\n options: RegisterOptions,\n getField: () => Readonly<FieldState>,\n domName: string,\n): DomBindingCore {\n const inputType = options.type ?? 'text';\n\n return {\n name: domName,\n type: inputType,\n get value() {\n return getBoundValue(inputType, getField().value, getOptionValue(options));\n },\n get checked() {\n return getBoundChecked(inputType, getField().value, getOptionValue(options));\n },\n input(target) {\n if (shouldIgnoreInputEvent(target, options)) {\n return;\n }\n\n commitEventValue(form, options, getField().value, target);\n },\n change(target) {\n commitEventValue(form, options, getField().value, target);\n },\n blur() {\n void form.blur(options.name);\n },\n focus() {\n form.focus(options.name);\n },\n };\n}\n\n/**\n * @description Preserve literal field names and stringify tuple paths for the DOM name attribute.\n * @param {FieldPathInput} name - Literal field name or tuple path; strings are not split on dots.\n * @returns {string} Literal string name or JSON-serialized tuple for the DOM attribute.\n * @example\n * ```ts\n * fieldPathToDomName(\"email\");\n * ```\n */\nexport function fieldPathToDomName(name: FieldPathInput): string {\n return typeof name === 'string' ? name : JSON.stringify(name);\n}\n\nfunction commitEventValue<TValues>(form: Form<TValues>, options: RegisterOptions, currentValue: unknown, target: FieldEventTarget): void {\n const nextValue = getEventValue(target, options, currentValue);\n\n if (nextValue !== SKIP_CHANGE) {\n form.setValue(options.name, nextValue, { source: 'user' });\n }\n}\n\nfunction shouldIgnoreInputEvent(target: FieldEventTarget, options: RegisterOptions): boolean {\n const type = options.type ?? target.type;\n\n return type === 'checkbox' || type === 'radio' || Boolean(target.multiple);\n}\n\nfunction getOptionValue(options: RegisterOptions): unknown {\n return options.value ?? options.checkedValue;\n}\n\nfunction getBoundValue(kind: string | undefined, fieldValue: unknown, optionValue: unknown): DomValue | undefined {\n if (kind === 'checkbox') {\n return toDomValue(optionValue);\n }\n\n if (kind === 'radio') {\n return toDomValue(optionValue) ?? '';\n }\n\n return toDomValue(fieldValue) ?? '';\n}\n\nfunction getBoundChecked(kind: string | undefined, fieldValue: unknown, optionValue: unknown): boolean | undefined {\n if (kind === 'checkbox') {\n if (optionValue !== undefined && Array.isArray(fieldValue)) {\n return fieldValue.some(item => Object.is(item, optionValue));\n }\n\n if (optionValue !== undefined) {\n return Object.is(fieldValue, optionValue);\n }\n\n return Boolean(fieldValue);\n }\n\n if (kind === 'radio') {\n return Object.is(fieldValue, optionValue);\n }\n\n return undefined;\n}\n\nfunction getEventValue(target: FieldEventTarget, options: RegisterOptions, currentValue: unknown): ChangeValue {\n const type = options.type ?? target.type;\n\n if (type === 'checkbox') {\n return getCheckboxEventValue(target, options, currentValue);\n }\n\n if (type === 'radio') {\n if (!target.checked) {\n return SKIP_CHANGE;\n }\n\n return getOptionValue(options) ?? target.value;\n }\n\n if (target.multiple && target.selectedOptions) {\n return [...target.selectedOptions].map(option => option.value);\n }\n\n return target.value;\n}\n\nfunction getCheckboxEventValue(target: FieldEventTarget, options: RegisterOptions, currentValue: unknown): unknown {\n if (options.checkedValue === undefined && options.value === undefined) {\n return Boolean(target.checked);\n }\n\n if (Array.isArray(currentValue)) {\n const optionValue = getOptionValue(options);\n\n if (target.checked) {\n return currentValue.some(item => Object.is(item, optionValue)) ? currentValue : [...currentValue, optionValue];\n }\n\n return currentValue.filter(item => !Object.is(item, optionValue));\n }\n\n return target.checked ? getOptionValue(options) : (options.uncheckedValue ?? false);\n}\n\nfunction toDomValue(value: unknown): DomValue | undefined {\n if (value === undefined || value === null) {\n return undefined;\n }\n\n if (typeof value === 'string' || typeof value === 'number') {\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map(item => String(item));\n }\n\n return String(value);\n}\n","import { CreateForm, type CreateFormOptions, type Form, type ResetOptions } from '../core/index';\n\nexport type ReactiveFormOptions<TValues, TSource> = CreateFormOptions<TValues> & {\n /** Replacement values; defined reference changes reset the form. */\n readonly values?: TSource;\n /** State preservation policy for external-value resets. */\n readonly resetOptions?: ResetOptions;\n};\n\nexport type FormInput<TValues, TOptions extends CreateFormOptions<TValues>> = Form<TValues> | TOptions;\n\n/**\n * @description Distinguish an existing core form from creation options by its subscribe and submit members.\n * @param {Form<TValues> | CreateFormOptions<TValues>} input - Existing form instance or options used to create one.\n * @param {() => Readonly<FormState<TValues>>} input.getState - Read the current immutable form snapshot.\n * @param {(listener: () => void) => () => void} input.subscribe - Subscribe to state changes and return an unsubscribe callback.\n * @param {(path: FieldPathInput, options: FieldSchemaOptions) => () => void} input.registerFieldSchema - Register an overriding field-local validator and return its guarded cleanup.\n * @param {(path: FieldPathInput) => Readonly<FieldState>} input.getFieldState - Read field metadata, using a default snapshot for an unknown field.\n * @param {(path: FieldPathInput) => unknown} input.getValue - Read the current value of one field.\n * @param {() => TValues} input.getValues - Reconstruct nested values from fields and array containers.\n * @param {(path: FieldPathInput, value: unknown, options?: SetValueOptions) => void} input.setValue - Write a field with configurable user or program origin and optional immediate validation.\n * @param {(path: FieldPathInput) => Promise<boolean>} input.blur - Clear focus, mark touched, and run configured blur validation.\n * @param {(path: FieldPathInput) => void} input.focus - Record focus for the selected field.\n * @param {(path: FieldPathInput, errors: readonly FormError[]) => void} input.setErrors - Replace all errors for the selected field.\n * @param {(...paths: FieldPathInput[]) => void} input.clearErrors - Clear selected fields, or all field errors when no paths are supplied.\n * @param {(...paths: FieldPathInput[]) => Promise<boolean>} input.trigger - Run manual validation for selected paths or the entire form.\n * @param {(path: FieldPathInput) => FormArray} input.array - Return commands that keep array values, keys, and child metadata aligned.\n * @param {(values?: TValues | undefined, options?: ResetOptions) => void} input.reset - Reinitialize from default or replacement values with optional preservation flags.\n * @param {<TResult>(onValid: (values: TValues) => TResult | Promise<TResult>, onInvalid?: (fields: Readonly<Record<PathKey, FieldState>>) => void) => Promise<TResult | undefined>} input.submit - Queue validation and dispatch the valid or invalid callback.\n * @param {TValues} input.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {StandardSchemaV1<unknown, TValues> | undefined} [input.schema] - Standard Schema validator; a field-local schema takes precedence over the form schema.\n * @param {StandardSchemaV1.Props<unknown, TValues>} [input.schema.~standard] - Standard Schema version, vendor, type metadata, and validation entry point.\n * @param {1} [input.schema.~standard.version] - Standard Schema major version, which must be 1.\n * @param {string} [input.schema.~standard.vendor] - Name of the schema library implementation.\n * @param {StandardSchemaV1.Types<unknown, TValues> | undefined} [input.schema.~standard.types] - Optional compile-time input and output metadata.\n * @param {unknown} [input.schema.~standard.types.input] - Schema input type metadata.\n * @param {TValues} [input.schema.~standard.types.output] - Schema output type metadata.\n * @param {(value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<TValues> | Promise<StandardSchemaV1.Result<TValues>>} [input.schema.~standard.validate] - Validate unknown input and return accepted values or issues, synchronously or asynchronously.\n * @param {StandardSchemaV1.Options | undefined} [input.schemaOptions] - Options forwarded to the Standard Schema validator.\n * @param {Record<string, unknown> | undefined} [input.schemaOptions.libraryOptions] - Library-specific validation options; keys are defined by the schema library.\n * @param {readonly ValidationTrigger[] | undefined} [input.validateOn] - Triggers that run automatic validation; defaults to submit.\n * @returns {boolean} Whether input exposes the core form subscription and submission surface.\n * @example\n * ```ts\n * if (isFormInstance(input)) { input.getValues(); }\n * ```\n */\nexport function isFormInstance<TValues>(\n input: Form<TValues> | CreateFormOptions<TValues>,\n): input is Form<TValues> {\n return 'subscribe' in input && 'submit' in input;\n}\n\n/**\n * @description Create a core form from the framework-neutral options, excluding reactive adapter-only settings.\n * @param {CreateFormOptions<TValues>} options - Default values, optional form schema, and automatic validation triggers.\n * @param {TValues} options.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {StandardSchemaV1<unknown, TValues> | undefined} [options.schema] - Standard Schema validator; a field-local schema takes precedence over the form schema.\n * @param {StandardSchemaV1.Props<unknown, TValues>} [options.schema.~standard] - Standard Schema version, vendor, type metadata, and validation entry point.\n * @param {1} [options.schema.~standard.version] - Standard Schema major version, which must be 1.\n * @param {string} [options.schema.~standard.vendor] - Name of the schema library implementation.\n * @param {StandardSchemaV1.Types<unknown, TValues> | undefined} [options.schema.~standard.types] - Optional compile-time input and output metadata.\n * @param {unknown} [options.schema.~standard.types.input] - Schema input type metadata.\n * @param {TValues} [options.schema.~standard.types.output] - Schema output type metadata.\n * @param {(value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<TValues> | Promise<StandardSchemaV1.Result<TValues>>} [options.schema.~standard.validate] - Validate unknown input and return accepted values or issues, synchronously or asynchronously.\n * @param {StandardSchemaV1.Options | undefined} [options.schemaOptions] - Options forwarded to the Standard Schema validator.\n * @param {Record<string, unknown> | undefined} [options.schemaOptions.libraryOptions] - Library-specific validation options; keys are defined by the schema library.\n * @param {readonly ValidationTrigger[] | undefined} [options.validateOn] - Triggers that run automatic validation; defaults to submit.\n * @returns {Form<TValues>} New framework-neutral form initialized from the creation settings.\n * - getState `() => Readonly<FormState<TValues>>` - Read the current immutable form snapshot.\n * - subscribe `(listener: () => void) => () => void` - Subscribe to state changes and return an unsubscribe callback.\n * - registerFieldSchema `(path: FieldPathInput, options: FieldSchemaOptions) => () => void` - Register an overriding field-local validator and return its guarded cleanup.\n * - getFieldState `(path: FieldPathInput) => Readonly<FieldState>` - Read field metadata, using a default snapshot for an unknown field.\n * - getValue `(path: FieldPathInput) => unknown` - Read the current value of one field.\n * - getValues `() => TValues` - Reconstruct nested values from fields and array containers.\n * - setValue `(path: FieldPathInput, value: unknown, options?: SetValueOptions) => void` - Write a field with configurable user or program origin and optional immediate validation.\n * - blur `(path: FieldPathInput) => Promise<boolean>` - Clear focus, mark touched, and run configured blur validation.\n * - focus `(path: FieldPathInput) => void` - Record focus for the selected field.\n * - setErrors `(path: FieldPathInput, errors: readonly FormError[]) => void` - Replace all errors for the selected field.\n * - clearErrors `(...paths: FieldPathInput[]) => void` - Clear selected fields, or all field errors when no paths are supplied.\n * - trigger `(...paths: FieldPathInput[]) => Promise<boolean>` - Run manual validation for selected paths or the entire form.\n * - array `(path: FieldPathInput) => FormArray` - Return commands that keep array values, keys, and child metadata aligned.\n * - reset `(values?: TValues | undefined, options?: ResetOptions) => void` - Reinitialize from default or replacement values with optional preservation flags.\n * - submit `<TResult>(onValid: (values: TValues) => TResult | Promise<TResult>, onInvalid?: (fields: Readonly<Record<PathKey, FieldState>>) => void) => Promise<TResult | undefined>` - Queue validation and dispatch the valid or invalid callback.\n * @example\n * ```ts\n * createFormFromOptions({ defaultValues: { email: \"\" } });\n * ```\n */\nexport function createFormFromOptions<TValues>(options: CreateFormOptions<TValues>): Form<TValues> {\n const { defaultValues, schema, schemaOptions, validateOn } = options;\n return new CreateForm({ defaultValues, schema, schemaOptions, validateOn });\n}\n\n/**\n * @description Create a synchronizer that resets only for defined external-value references different from the previous defined reference.\n * @param {Form<TValues>} form - Core form instance shared by all bound helpers.\n * @param {() => Readonly<FormState<TValues>>} form.getState - Read the current immutable form snapshot.\n * @param {(listener: () => void) => () => void} form.subscribe - Subscribe to state changes and return an unsubscribe callback.\n * @param {(path: FieldPathInput, options: FieldSchemaOptions) => () => void} form.registerFieldSchema - Register an overriding field-local validator and return its guarded cleanup.\n * @param {(path: FieldPathInput) => Readonly<FieldState>} form.getFieldState - Read field metadata, using a default snapshot for an unknown field.\n * @param {(path: FieldPathInput) => unknown} form.getValue - Read the current value of one field.\n * @param {() => TValues} form.getValues - Reconstruct nested values from fields and array containers.\n * @param {(path: FieldPathInput, value: unknown, options?: SetValueOptions) => void} form.setValue - Write a field with configurable user or program origin and optional immediate validation.\n * @param {(path: FieldPathInput) => Promise<boolean>} form.blur - Clear focus, mark touched, and run configured blur validation.\n * @param {(path: FieldPathInput) => void} form.focus - Record focus for the selected field.\n * @param {(path: FieldPathInput, errors: readonly FormError[]) => void} form.setErrors - Replace all errors for the selected field.\n * @param {(...paths: FieldPathInput[]) => void} form.clearErrors - Clear selected fields, or all field errors when no paths are supplied.\n * @param {(...paths: FieldPathInput[]) => Promise<boolean>} form.trigger - Run manual validation for selected paths or the entire form.\n * @param {(path: FieldPathInput) => FormArray} form.array - Return commands that keep array values, keys, and child metadata aligned.\n * @param {(values?: TValues | undefined, options?: ResetOptions) => void} form.reset - Reinitialize from default or replacement values with optional preservation flags.\n * @param {<TResult>(onValid: (values: TValues) => TResult | Promise<TResult>, onInvalid?: (fields: Readonly<Record<PathKey, FieldState>>) => void) => Promise<TResult | undefined>} form.submit - Queue validation and dispatch the valid or invalid callback.\n * @returns {(values: TValues | undefined, resetOptions: ResetOptions | undefined) => void} Callback accepting replacement values and reset options; undefined or repeated references are ignored.\n * @example\n * ```ts\n * const synchronize = createExternalValuesSynchronizer(form);\n * synchronize({ email: \"Ada\" }, { keepTouched: true });\n * ```\n */\nexport function createExternalValuesSynchronizer<TValues>(\n form: Form<TValues>,\n): (values: TValues | undefined, resetOptions: ResetOptions | undefined) => void {\n let previousDefinedValues: TValues | undefined;\n\n return (values, resetOptions) => {\n if (values === undefined || Object.is(previousDefinedValues, values)) {\n return;\n }\n\n previousDefinedValues = values;\n form.reset(values, resetOptions);\n };\n}\n","import type { FormError, FormState } from '../core/index';\n\nexport type FormStateSummary<TValues> = {\n /** Current immutable form snapshot. */\n state: Readonly<FormState<TValues>>;\n /** Nonempty validation error lists indexed by normalized field path. */\n errors: Record<string, FormError[]>;\n /** Normalized paths whose fields are dirty. */\n dirtyFields: Record<string, true>;\n /** Normalized paths whose fields are touched. */\n touchedFields: Record<string, true>;\n /**\n * 현재 focus 된 field의 PathKey 중 하나를 반환하거나 focus 된 field가 없으면 null을 반환한다.\n *\n * @remarks\n * core는 DOM과 독립적으로 동작하므로 focus() 호출로 여러 field가 동시에 isFocused: true가 될 수 있다.\n * 이 값은 entries 순서상 첫 번째로 발견된 focused field이지 \"마지막으로 focus 된 field\"가 아니다.\n * DOM 어댑터에서는 브라우저가 이전 element의 blur를 자연스럽게 발생시켜 항상 1개 이하가 유지되지만,\n * core를 직접 사용할 때는 여러 field가 focus 될 수 있으므로 이 값만으로 전체 focus 상태를 파악하면 안 된다.\n * 모든 focused field를 알려면 state.fields를 직접 순회하라.\n */\n focusedField: string | null;\n /** Whether at least one field is dirty. */\n isDirty: boolean;\n /** Whether no field currently has recorded errors. */\n isValid: boolean;\n /** Whether queued validation or a submit callback is still pending. */\n isSubmitting: boolean;\n /** Whether a submission has completed at least once. */\n isSubmitted: boolean;\n /** Whether the latest completed submission reached a successful valid callback. */\n isSubmitSuccessful: boolean;\n /** Number of submission attempts started by the form. */\n submitCount: number;\n};\n\n/**\n * @description Derive form-wide error, dirty, touched, focus, and submission aggregates from one snapshot.\n * @param {Readonly<FormState<TValues>>} state - Form snapshot used as the source of this calculation.\n * @param {TValues} state.defaultValues - Initial values and the baseline used for dirty checks and reset.\n * @param {Record<string, FieldState<unknown>>} state.fields - Field snapshots indexed by normalized path keys.\n * @param {number} state.submitCount - Number of submission attempts started by the form.\n * @param {boolean} state.isSubmitting - Whether queued validation or a submit callback is still pending.\n * @param {boolean} state.isSubmitted - Whether a submission has completed at least once.\n * @param {boolean} state.isSubmitSuccessful - Whether the latest completed submission reached a successful valid callback.\n * @param {ArrayKeys} state.arrayKeys - Stable rendering keys indexed by array path.\n * @returns {FormStateSummary<TValues>} Form-wide state aggregates calculated from the supplied snapshot.\n * - state `Readonly<FormState<TValues>>` - Current immutable form snapshot.\n * : state.defaultValues `TValues` - Initial values and the baseline used for dirty checks and reset.\n * : state.fields `Record<string, FieldState<unknown>>` - Field snapshots indexed by normalized path keys.\n * : state.submitCount `number` - Number of submission attempts started by the form.\n * : state.isSubmitting `boolean` - Whether queued validation or a submit callback is still pending.\n * : state.isSubmitted `boolean` - Whether a submission has completed at least once.\n * : state.isSubmitSuccessful `boolean` - Whether the latest completed submission reached a successful valid callback.\n * : state.arrayKeys `ArrayKeys` - Stable rendering keys indexed by array path.\n * - errors `Record<string, FormError[]>` - Nonempty validation error lists indexed by normalized field path.\n * - dirtyFields `Record<string, true>` - Normalized paths whose fields are dirty.\n * - touchedFields `Record<string, true>` - Normalized paths whose fields are touched.\n * - focusedField `string | null` - First focused field in entry order, or null; not necessarily the last focused field.\n * - isDirty `boolean` - Whether at least one field is dirty.\n * - isValid `boolean` - Whether no field currently has recorded errors.\n * - isSubmitting `boolean` - Whether queued validation or a submit callback is still pending.\n * - isSubmitted `boolean` - Whether a submission has completed at least once.\n * - isSubmitSuccessful `boolean` - Whether the latest completed submission reached a successful valid callback.\n * - submitCount `number` - Number of submission attempts started by the form.\n * @example\n * ```ts\n * const summary = createFormStateSummary(form.getState());\n * ```\n */\nexport function createFormStateSummary<TValues>(state: Readonly<FormState<TValues>>): FormStateSummary<TValues> {\n const errors = collectErrors(state);\n const dirtyFields = collectFlaggedFields(state, 'dirty');\n const touchedFields = collectFlaggedFields(state, 'touched');\n const focusedField = findFocusedField(state);\n\n return {\n state,\n errors,\n dirtyFields,\n touchedFields,\n focusedField,\n isDirty: Object.keys(dirtyFields).length > 0,\n isValid: Object.keys(errors).length === 0,\n isSubmitting: state.isSubmitting,\n isSubmitted: state.isSubmitted,\n isSubmitSuccessful: state.isSubmitSuccessful,\n submitCount: state.submitCount,\n };\n}\n\nfunction collectErrors<TValues>(state: Readonly<FormState<TValues>>): Record<string, FormError[]> {\n return Object.fromEntries(\n Object.entries(state.fields)\n .filter(([, field]) => field.errors.length > 0)\n .map(([key, field]) => [key, [...field.errors]]),\n );\n}\n\nfunction collectFlaggedFields<TValues>(state: Readonly<FormState<TValues>>, flag: 'dirty' | 'touched'): Record<string, true> {\n return Object.fromEntries(\n Object.entries(state.fields)\n .filter(([, field]) => field[flag])\n .map(([key]) => [key, true]),\n );\n}\n\nfunction findFocusedField<TValues>(state: Readonly<FormState<TValues>>): string | null {\n const entry = Object.entries(state.fields).find(([, field]) => field.isFocused);\n return entry ? entry[0] : null;\n}\n"]}
|