@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.
@@ -1,5 +1,5 @@
1
- import { isFormInstance, createFormFromOptions, createExternalValuesSynchronizer, createSubmitHandler, getFieldState, fieldPathToDomName, createFormStateSummary, createDomBinding } from '../chunk-WO5TIXCR.js';
2
- import '../chunk-M7Y4OJPP.js';
1
+ import { isFormInstance, createFormFromOptions, createExternalValuesSynchronizer, createSubmitHandler, getFieldState, fieldPathToDomName, createFormStateSummary, createDomBinding } from '../chunk-GNWYMWEC.js';
2
+ import { FormPath } from '../chunk-FJ6OHNA5.js';
3
3
  import { useRef, useMemo, useEffect, useCallback, useSyncExternalStore } from 'react';
4
4
 
5
5
  // src/react/RegisterBinding.ts
@@ -23,27 +23,41 @@ function createRegisterProps(form, options, field, domName) {
23
23
  return props;
24
24
  }
25
25
  function useFieldSchemaRegistration(form, options) {
26
- const { name, schema, schemaOptions } = options;
27
- useEffect(() => {
28
- if (!schema) {
29
- return void 0;
30
- }
31
- return form.registerFieldSchema(name, { schema, schemaOptions });
32
- }, [form, name, schema, schemaOptions]);
26
+ useFieldSchemaRegistrations(form, [options]);
33
27
  }
34
28
  function useFieldSchemaRegistrations(form, options) {
35
- const schemaSignature = options.map((option) => `${fieldPathToDomName(option.name)}:${option.schema ? "schema" : "none"}`).join("|");
29
+ const registrations = useRef(/* @__PURE__ */ new Map());
36
30
  useEffect(() => {
37
- const cleanups = options.flatMap((option) => {
38
- if (!option.schema) {
39
- return [];
31
+ const next = /* @__PURE__ */ new Map();
32
+ options.forEach((option) => {
33
+ if (option.schema) {
34
+ next.set(FormPath.pathInputToKey(option.name), {
35
+ schema: option.schema,
36
+ schemaOptions: option.schemaOptions
37
+ });
38
+ }
39
+ });
40
+ registrations.current.forEach((registered, fieldKey) => {
41
+ const desired = next.get(fieldKey);
42
+ if (desired?.schema === registered.schema && desired.schemaOptions === registered.schemaOptions) {
43
+ return;
44
+ }
45
+ registered.cleanup();
46
+ registrations.current.delete(fieldKey);
47
+ });
48
+ next.forEach((desired, fieldKey) => {
49
+ if (!registrations.current.has(fieldKey)) {
50
+ registrations.current.set(fieldKey, {
51
+ ...desired,
52
+ cleanup: form.registerFieldSchema(FormPath.keyToPath(fieldKey), desired)
53
+ });
40
54
  }
41
- return [form.registerFieldSchema(option.name, { schema: option.schema, schemaOptions: option.schemaOptions })];
42
55
  });
43
- return () => {
44
- cleanups.forEach((cleanup) => cleanup());
45
- };
46
- }, [form, options, schemaSignature]);
56
+ });
57
+ useEffect(() => () => {
58
+ registrations.current.forEach((registered) => registered.cleanup());
59
+ registrations.current.clear();
60
+ }, [form]);
47
61
  }
48
62
  function useFormSnapshot(form) {
49
63
  return useSyncExternalStore(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/RegisterBinding.ts","../../src/react/useFieldSchemaRegistration.ts","../../src/react/useFormSnapshot.ts","../../src/react/useField.ts","../../src/react/useFieldState.ts","../../src/react/useFormState.ts","../../src/react/useRegister.ts","../../src/react/useForm.ts"],"names":["useMemo","useEffect"],"mappings":";;;;;AAqDO,SAAS,mBAAA,CACd,IAAA,EACA,OAAA,EACA,KAAA,EACA,OAAA,EACmC;AACnC,EAAA,MAAM,UAAU,gBAAA,CAAiB,IAAA,EAAM,OAAA,EAAS,MAAM,OAAO,OAAO,CAAA;AACpE,EAAA,MAAM,KAAA,GAAQ;AAAA,IACZ,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,QAAA,EAAU,CAAC,KAAA,KAAoC;AAC7C,MAAA,OAAA,CAAQ,MAAA,CAAO,MAAM,aAAiC,CAAA;AAAA,IACxD,CAAA;AAAA,IACA,QAAQ,MAAM;AACZ,MAAA,OAAA,CAAQ,IAAA,EAAK;AAAA,IACf,CAA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B,MAAM,IAAI,CAAA,CAAA;AAClC,EAAA,MAAM,YAAA,GAAe,MACnB,oBAAA,CAAqB,IAAI,CAAA;AAC3B,EAAA,MAAM,gBAAgB,CAAC,OAAA,EAAS,cAC9B,mBAAA,CAAoB,IAAA,EAAM,SAAS,SAAS,CAAA,CAAA;AAE9C,EAAA,OAAOD,OAAAA,CAAQ,OAAO,EAAE,IAAA,EAAM,WAAA,EAAa,QAAA,EAAU,aAAA,EAAe,YAAA,EAAc,YAAA,EAAa,CAAA,EAAI,CAAC,IAAI,CAAC,CAAA;AAC3G","file":"index.js","sourcesContent":["import type { ChangeEvent } from 'react';\nimport type { FieldState, Form } from '../core/index';\nimport { createDomBinding, type FieldEventTarget, type RegisterOptions, fieldPathToDomName } from '../adapters/dom';\nimport type { RegisterElement, RegisterPropsForElement } from './types';\n\n/**\n * @description Create framework-specific DOM bindings that forward value, checked, change, blur, and focus behavior to the core form.\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>} field - Field snapshot used to build binding properties.\n * @param {unknown} field.value - Current field value.\n * @param {FormError[]} field.errors - Current validation errors for the field.\n * @param {boolean} field.touched - Whether the field has blurred at least once.\n * @param {boolean} field.dirty - Whether the current value differs from its default by Object.is.\n * @param {boolean} field.modified - Whether a user-originated write has changed this field.\n * @param {boolean} field.isFocused - Whether focus has been recorded without a subsequent blur.\n * @param {string} domName - Name string assigned to the DOM control.\n * @returns {RegisterPropsForElement<TElement>} Binding properties suitable for the selected framework and element type.\n * @example\n * ```ts\n * createRegisterProps(form, { name: \"email\" }, form.getFieldState(\"email\"), \"email\");\n * ```\n */\nexport function createRegisterProps<TValues, TElement extends RegisterElement>(\n form: Form<TValues>,\n options: RegisterOptions,\n field: Readonly<FieldState>,\n domName: string,\n): RegisterPropsForElement<TElement> {\n const binding = createDomBinding(form, options, () => field, domName);\n const props = {\n name: binding.name,\n type: binding.type,\n value: binding.value,\n checked: binding.checked,\n onChange: (event: ChangeEvent<HTMLElement>) => {\n binding.change(event.currentTarget as FieldEventTarget);\n },\n onBlur: () => {\n binding.blur();\n },\n onFocus: () => {\n binding.focus();\n },\n };\n\n return props as unknown as RegisterPropsForElement<TElement>;\n}\n\nexport { fieldPathToDomName };\n","import { useEffect } from 'react';\nimport type { Form } from '../core/index';\nimport type { RegisterOptions } from './types';\nimport { fieldPathToDomName } from './RegisterBinding';\n\n/**\n * @description Register one field-local schema after the React commit and clean it up when options change or the component unmounts.\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 * @example\n * ```ts\n * useFieldSchemaRegistration(form, { name: \"email\", schema });\n * ```\n */\nexport function useFieldSchemaRegistration<TValues>(form: Form<TValues>, options: RegisterOptions): void {\n const { name, schema, schemaOptions } = options;\n\n useEffect(() => {\n if (!schema) {\n return undefined;\n }\n\n return form.registerFieldSchema(name, { schema, schemaOptions });\n }, [form, name, schema, schemaOptions]);\n}\n\n/**\n * @description Register field-local schemas together and release them with the framework lifecycle.\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 RegisterOptions[]} options - Field schema and DOM binding options.\n * @example\n * ```ts\n * useFieldSchemaRegistrations(form, [{ name: \"email\", schema }]);\n * ```\n */\nexport function useFieldSchemaRegistrations<TValues>(form: Form<TValues>, options: readonly RegisterOptions[]): void {\n const schemaSignature = options.map(option => `${fieldPathToDomName(option.name)}:${option.schema ? 'schema' : 'none'}`).join('|');\n\n useEffect(() => {\n const cleanups = options.flatMap(option => {\n if (!option.schema) {\n return [];\n }\n\n return [form.registerFieldSchema(option.name, { schema: option.schema, schemaOptions: option.schemaOptions })];\n });\n\n return () => {\n cleanups.forEach(cleanup => cleanup());\n };\n }, [form, options, schemaSignature]);\n}\n","import { useSyncExternalStore } from 'react';\nimport type { Form, FormState } from '../core/index';\n\n/**\n * @description Subscribe the framework view to core form snapshots and release the subscription through its lifecycle.\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 {Readonly<FormState<TValues>>} Framework subscription to current immutable snapshots.\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 * useFormSnapshot(form);\n * ```\n */\nexport function useFormSnapshot<TValues>(form: Form<TValues>): Readonly<FormState<TValues>> {\n return useSyncExternalStore(\n listener => form.subscribe(listener),\n () => form.getState(),\n () => form.getState(),\n );\n}\n","import { useCallback, useMemo } from 'react';\nimport type { Form } from '../core/index';\nimport type { RegisterElement, RegisterOptions, RegisterPropsForElement, UseFieldReturn } from './types';\nimport { createRegisterProps, fieldPathToDomName } from './RegisterBinding';\nimport { getFieldState } from '../adapters/dom';\nimport { useFieldSchemaRegistration } from './useFieldSchemaRegistration';\nimport { useFormSnapshot } from './useFormSnapshot';\n\n/**\n * @description Bind one field to its framework view, exposing reactive bindings, copied errors, metadata, and a programmatic setter.\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 * @returns {UseFieldReturn<RegisterPropsForElement<TElement>>} Reactive field bindings, value, copied errors, flags, and programmatic setter.\n * - props `RegisterPropsForElement<TElement>` - Binding properties to spread onto the matching DOM control.\n * - value `unknown` - Current field value.\n * - setValue `(value: unknown) => void` - Replace the field value as a programmatic write.\n * - errors `FormError[]` - Current validation errors for the field.\n * - dirty `boolean` - Whether the current value differs from its default by Object.is.\n * - touched `boolean` - Whether the field has blurred at least once.\n * @example\n * ```ts\n * useFieldWithForm(form, { name: \"email\", schema });\n * ```\n */\nexport function useFieldWithForm<TValues, TElement extends RegisterElement = HTMLInputElement>(form: Form<TValues>, options: RegisterOptions): UseFieldReturn<RegisterPropsForElement<TElement>> {\n useFieldSchemaRegistration(form, options);\n\n const state = useFormSnapshot(form);\n const field = getFieldState(form, state, options.name);\n const domName = fieldPathToDomName(options.name);\n const props = useMemo(() => createRegisterProps<TValues, TElement>(form, options, field, domName), [form, options, field, domName]);\n\n const setValue = useCallback((value: unknown) => {\n form.setValue(options.name, value, { source: 'program' });\n }, [form, options.name]);\n\n return useMemo(() => ({\n props,\n value: field.value,\n setValue,\n errors: [...field.errors],\n dirty: field.dirty,\n touched: field.touched,\n }), [field, props, setValue]);\n}\n","import type { FieldPathInput, Form } from '../core/index';\nimport { getFieldState } from '../adapters/dom';\nimport type { UseFieldStateReturn } from './types';\nimport { useFormSnapshot } from './useFormSnapshot';\n\n/**\n * @description Subscribe to one field snapshot with its value type inferred from the form values and literal or tuple path.\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 {TName} name - Literal field name or tuple path; strings are not split on dots.\n * @returns {Readonly<FieldState<FieldPathValue<TValues, TName>>>} Read-only field snapshot whose value follows the supplied path type.\n * - value `FieldPathValue<TValues, TName>` - 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 * useFieldStateWithForm(form, \"email\");\n * ```\n */\nexport function useFieldStateWithForm<TValues, const TName extends FieldPathInput>(form: Form<TValues>, name: TName): UseFieldStateReturn<TValues, TName> {\n const state = useFormSnapshot(form);\n\n return getFieldState(form, state, name) as UseFieldStateReturn<TValues, TName>;\n}\n","import { useMemo } from 'react';\nimport type { Form } from '../core/index';\nimport { createFormStateSummary } from '../adapters/FormStateSummary';\nimport type { UseFormStateReturn } from './types';\nimport { useFormSnapshot } from './useFormSnapshot';\n\n/**\n * @description Subscribe to form-wide aggregates derived from the current core snapshot.\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 {UseFormStateReturn<TValues>} Reactive form-wide aggregates and submission flags.\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 * useFormStateWithForm(form);\n * ```\n */\nexport function useFormStateWithForm<TValues>(form: Form<TValues>): UseFormStateReturn<TValues> {\n const state = useFormSnapshot(form);\n\n return useMemo(() => createFormStateSummary(state), [state]);\n}\n","import { useMemo } from 'react';\nimport type { Form } from '../core/index';\nimport type { RegisterElement, RegisterOptions, RegisterPropsForElement, RegisterPropsList } from './types';\nimport { getFieldState } from '../adapters/dom';\nimport { createRegisterProps, fieldPathToDomName } from './RegisterBinding';\nimport { useFieldSchemaRegistrations } from './useFieldSchemaRegistration';\nimport { useFormSnapshot } from './useFormSnapshot';\n\n/**\n * @description Create a single binding or ordered binding list for single, array, or variadic registration options.\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 | TOptions} options - Single registration options or an ordered list; variadic calls use the same options order.\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 {RegisterOptions | readonly RegisterOptions[]} first - First single registration or ordered registration list.\n * @param {FieldPathInput} first.name - Literal field name or tuple path; strings are not split on dots.\n * @param {StandardSchemaV1<unknown, unknown> | undefined} [first.schema] - Standard Schema validator; a field-local schema takes precedence over the form schema.\n * @param {StandardSchemaV1.Props<unknown, unknown>} [first.schema.~standard] - Standard Schema version, vendor, type metadata, and validation entry point.\n * @param {1} [first.schema.~standard.version] - Standard Schema major version, which must be 1.\n * @param {string} [first.schema.~standard.vendor] - Name of the schema library implementation.\n * @param {StandardSchemaV1.Types<unknown, unknown> | undefined} [first.schema.~standard.types] - Optional compile-time input and output metadata.\n * @param {unknown} [first.schema.~standard.types.input] - Schema input type metadata.\n * @param {unknown} [first.schema.~standard.types.output] - Schema output type metadata.\n * @param {(value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<unknown> | Promise<StandardSchemaV1.Result<unknown>>} [first.schema.~standard.validate] - Validate unknown input and return accepted values or issues, synchronously or asynchronously.\n * @param {StandardSchemaV1.Options | undefined} [first.schemaOptions] - Options forwarded to the Standard Schema validator.\n * @param {Record<string, unknown> | undefined} [first.schemaOptions.libraryOptions] - Library-specific validation options; keys are defined by the schema library.\n * @param {string | undefined} [first.type] - Input kind; checkbox and radio use checked semantics, otherwise defaults to text.\n * @param {unknown} [first.value] - Explicit option value used by checkbox and radio bindings.\n * @param {unknown} [first.checkedValue] - Value written by a checked checkbox; omitted for a boolean checkbox.\n * @param {unknown} [first.uncheckedValue] - Value written by an unchecked checkbox; defaults to false.\n * @param {readonly RegisterOptions[]} rest - Additional registration options for variadic binding creation.\n * @returns {RegisterPropsForElement<TElement> | RegisterPropsList<TElement, TOptions> | RegisterPropsForElement<RegisterElement> | RegisterPropsForElement<RegisterElement>[]} One binding for a single options object, otherwise bindings in supplied order.\n * - onChange `React.ChangeEventHandler<HTMLSelectElement> | React.ChangeEventHandler<HTMLElement> | React.ChangeEventHandler<HTMLInputElement> | React.ChangeEventHandler<HTMLTextAreaElement>` - Forward change events, including checked and selection state, into the form.\n * - onBlur `React.FocusEventHandler<HTMLSelectElement> | React.FocusEventHandler<HTMLElement> | React.FocusEventHandler<HTMLInputElement> | React.FocusEventHandler<HTMLTextAreaElement>` - Clear focus and mark the field touched.\n * - onFocus `React.FocusEventHandler<HTMLSelectElement> | React.FocusEventHandler<HTMLElement> | React.FocusEventHandler<HTMLInputElement> | React.FocusEventHandler<HTMLTextAreaElement>` - Record focus for this field.\n * - name `string` - DOM name string; tuple paths are JSON-serialized.\n * - value `string | number | readonly string[] | undefined | unknown` - Current field value.\n * - checked `boolean | undefined` - Whether this checkbox or radio represents the current field value.\n * - type `React.HTMLInputTypeAttribute | undefined` - Input kind; checkbox and radio use checked semantics, otherwise defaults to text.\n * @example\n * ```ts\n * const email = useRegisterWithForm(form, { name: \"email\" });\n * const fields = useRegisterWithForm(form, [{ name: \"email\" }, { name: \"name\" }]);\n * ```\n */\nexport function useRegisterWithForm<TValues, TElement extends RegisterElement = HTMLInputElement>(form: Form<TValues>, options: RegisterOptions): RegisterPropsForElement<TElement>;\nexport function useRegisterWithForm<TValues, TElement extends RegisterElement = HTMLInputElement, TOptions extends readonly RegisterOptions[] = readonly RegisterOptions[]>(form: Form<TValues>, options: TOptions): RegisterPropsList<TElement, TOptions>;\nexport function useRegisterWithForm<TValues, TElement extends RegisterElement = HTMLInputElement, TOptions extends readonly RegisterOptions[] = readonly RegisterOptions[]>(form: Form<TValues>, ...options: TOptions): RegisterPropsList<TElement, TOptions>;\nexport function useRegisterWithForm<TValues>(form: Form<TValues>, first: RegisterOptions | readonly RegisterOptions[], ...rest: readonly RegisterOptions[]): RegisterPropsForElement<RegisterElement> | RegisterPropsForElement<RegisterElement>[];\n\nexport function useRegisterWithForm<TValues>(\n form: Form<TValues>,\n first: RegisterOptions | readonly RegisterOptions[],\n ...rest: readonly RegisterOptions[]\n): RegisterPropsForElement<RegisterElement> | RegisterPropsForElement<RegisterElement>[] {\n const shouldReturnList = Array.isArray(first) || rest.length > 0;\n const options = normalizeRegisterOptions(first, rest);\n\n useFieldSchemaRegistrations(form, options);\n\n const state = useFormSnapshot(form);\n const bindings = useMemo(\n () => options.map(option => {\n const field = getFieldState(form, state, option.name);\n const domName = fieldPathToDomName(option.name);\n\n return createRegisterProps(form, option, field, domName);\n }),\n [form, options, state],\n );\n\n return shouldReturnList ? bindings : bindings[0];\n}\n\nfunction normalizeRegisterOptions(first: RegisterOptions | readonly RegisterOptions[], rest: readonly RegisterOptions[]): readonly RegisterOptions[] {\n if (Array.isArray(first)) {\n return first as readonly RegisterOptions[];\n }\n\n if (rest.length > 0) {\n return [first as RegisterOptions, ...rest];\n }\n\n return [first as RegisterOptions];\n}\n","import { useEffect, useMemo, useRef } from 'react';\nimport { createSubmitHandler } from '../adapters/dom';\nimport {\n createExternalValuesSynchronizer,\n createFormFromOptions,\n isFormInstance,\n type FormInput,\n} from '../adapters/FormInput';\nimport type { FieldPathInput, Form } from '../core/index';\nimport type { ReactForm, ReactFormOptions, RegisterOptions } from './types';\nimport { useFieldWithForm } from './useField';\nimport { useFieldStateWithForm } from './useFieldState';\nimport { useFormStateWithForm } from './useFormState';\nimport { useRegisterWithForm } from './useRegister';\n\n/**\n * @description Bind framework helpers to an existing form or create one from options; defined external-value reference changes reset it.\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 {ReactFormOptions<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 * @param {TValues | undefined} [options.values] - Replacement values; defined reference changes reset the form.\n * @param {ResetOptions | undefined} [options.resetOptions] - State preservation policy for external-value resets.\n * @param {boolean | undefined} [options.resetOptions.keepDirtyValues] - Preserve current values and modified flags of dirty fields.\n * @param {boolean | undefined} [options.resetOptions.keepErrors] - Preserve errors on surviving field paths.\n * @param {boolean | undefined} [options.resetOptions.keepTouched] - Preserve touched flags on surviving field paths.\n * @param {boolean | undefined} [options.resetOptions.keepSubmitState] - Preserve submission counters and lifecycle flags.\n * @returns {ReactForm<TValues>} Core form and bound framework helpers sharing its state and lifecycle.\n * - form `Form<TValues>` - Core form instance shared by all bound helpers.\n * : form.getState `() => Readonly<FormState<TValues>>` - Read the current immutable form snapshot.\n * : form.subscribe `(listener: () => void) => () => void` - Subscribe to state changes and return an unsubscribe callback.\n * : form.registerFieldSchema `(path: FieldPathInput, options: FieldSchemaOptions) => () => void` - Register an overriding field-local validator and return its guarded cleanup.\n * : form.getFieldState `(path: FieldPathInput) => Readonly<FieldState>` - Read field metadata, using a default snapshot for an unknown field.\n * : form.getValue `(path: FieldPathInput) => unknown` - Read the current value of one field.\n * : form.getValues `() => TValues` - Reconstruct nested values from fields and array containers.\n * : form.setValue `(path: FieldPathInput, value: unknown, options?: SetValueOptions) => void` - Write a field with configurable user or program origin and optional immediate validation.\n * : form.blur `(path: FieldPathInput) => Promise<boolean>` - Clear focus, mark touched, and run configured blur validation.\n * : form.focus `(path: FieldPathInput) => void` - Record focus for the selected field.\n * : form.setErrors `(path: FieldPathInput, errors: readonly FormError[]) => void` - Replace all errors for the selected field.\n * : form.clearErrors `(...paths: FieldPathInput[]) => void` - Clear selected fields, or all field errors when no paths are supplied.\n * : form.trigger `(...paths: FieldPathInput[]) => Promise<boolean>` - Run manual validation for selected paths or the entire form.\n * : form.array `(path: FieldPathInput) => FormArray` - Return commands that keep array values, keys, and child metadata aligned.\n * : form.reset `(values?: TValues | undefined, options?: ResetOptions) => void` - Reinitialize from default or replacement values with optional preservation flags.\n * : form.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 * - useRegister `{ <TElement extends RegisterElement = HTMLInputElement>(options: RegisterOptions): RegisterPropsForElement<TElement>; <TElement extends RegisterElement = HTMLInputElement, TOptions extends readonly RegisterOptions[] = readonly RegisterOptions[]>(options: TOptions): RegisterPropsList<TElement, TOptions>; <TElement extends RegisterElement = HTMLInputElement, TOptions extends readonly RegisterOptions[] = readonly RegisterOptions[]>(...options: TOptions): RegisterPropsList<TElement, TOptions>; }` - Create one binding or an ordered list from single, array, or variadic options.\n * - useField `<TElement extends RegisterElement = HTMLInputElement>(options: RegisterOptions) => UseFieldReturn<RegisterPropsForElement<TElement>>` - Create field bindings, reactive value and metadata, and a setter.\n * - useFieldState `<const TName extends FieldPathInput>(name: TName) => Readonly<FieldState<FieldPathValue<TValues, TName>>>` - Subscribe to a path-typed field snapshot.\n * - useFormState `() => UseFormStateReturn<TValues>` - Subscribe to form-wide errors and lifecycle aggregates.\n * - handleSubmit `<TResult>(onValid: SubmitValidHandler<TValues, TResult>, onInvalid?: SubmitInvalidHandler) => SubmitHandler<React.FormEvent<HTMLFormElement>, TResult>` - Create an event handler that prevents default submission before validating.\n * @example\n * ```ts\n * const { form, handleSubmit } = useForm({ defaultValues: { email: \"\" } });\n * ```\n */\nexport function useForm<TValues>(form: Form<TValues>): ReactForm<TValues>;\nexport function useForm<TValues>(options: ReactFormOptions<TValues>): ReactForm<TValues>;\nexport function useForm<TValues>(input: FormInput<TValues, ReactFormOptions<TValues>>): ReactForm<TValues> {\n const optionsFormRef = useRef<Form<TValues> | undefined>(undefined);\n const isForm = isFormInstance(input);\n const form = isForm\n ? input\n : (optionsFormRef.current ??= createFormFromOptions(input));\n const values = isForm ? undefined : input.values;\n const resetOptions = isForm ? undefined : input.resetOptions;\n const synchronizeValues = useMemo(() => createExternalValuesSynchronizer(form), [form]);\n\n useEffect(() => {\n synchronizeValues(values, resetOptions);\n }, [resetOptions, synchronizeValues, values]);\n\n const useRegister = ((\n first: RegisterOptions | readonly RegisterOptions[],\n ...rest: readonly RegisterOptions[]\n ) => useRegisterWithForm(form, first, ...rest)) as ReactForm<TValues>['useRegister'];\n const useField = ((options: RegisterOptions) =>\n useFieldWithForm(form, options)) as ReactForm<TValues>['useField'];\n const useFieldState = ((name: FieldPathInput) =>\n useFieldStateWithForm(form, name)) as ReactForm<TValues>['useFieldState'];\n const useFormState = (): ReturnType<ReactForm<TValues>['useFormState']> =>\n useFormStateWithForm(form);\n const handleSubmit = ((onValid, onInvalid) =>\n createSubmitHandler(form, onValid, onInvalid)) as ReactForm<TValues>['handleSubmit'];\n\n return useMemo(() => ({ form, useRegister, useField, useFieldState, useFormState, handleSubmit }), [form]);\n}\n"]}
1
+ {"version":3,"sources":["../../src/react/RegisterBinding.ts","../../src/react/useFieldSchemaRegistration.ts","../../src/react/useFormSnapshot.ts","../../src/react/useField.ts","../../src/react/useFieldState.ts","../../src/react/useFormState.ts","../../src/react/useRegister.ts","../../src/react/useForm.ts"],"names":["useMemo","useRef","useEffect"],"mappings":";;;;;AAqDO,SAAS,mBAAA,CACd,IAAA,EACA,OAAA,EACA,KAAA,EACA,OAAA,EACmC;AACnC,EAAA,MAAM,UAAU,gBAAA,CAAiB,IAAA,EAAM,OAAA,EAAS,MAAM,OAAO,OAAO,CAAA;AACpE,EAAA,MAAM,KAAA,GAAQ;AAAA,IACZ,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,QAAA,EAAU,CAAC,KAAA,KAAoC;AAC7C,MAAA,OAAA,CAAQ,MAAA,CAAO,MAAM,aAAiC,CAAA;AAAA,IACxD,CAAA;AAAA,IACA,QAAQ,MAAM;AACZ,MAAA,OAAA,CAAQ,IAAA,EAAK;AAAA,IACf,CAAA;AAAA,IACA,SAAS,MAAM;AACb,MAAA,OAAA,CAAQ,KAAA,EAAM;AAAA,IAChB;AAAA,GACF;AAEA,EAAA,OAAO,KAAA;AACT;ACjCO,SAAS,0BAAA,CAAoC,MAAqB,OAAA,EAAgC;AACvG,EAAA,2BAAA,CAA4B,IAAA,EAAM,CAAC,OAAO,CAAC,CAAA;AAC7C;AA0BO,SAAS,2BAAA,CAAqC,MAAqB,OAAA,EAA2C;AACnH,EAAA,MAAM,aAAA,GAAgB,MAAA,iBAAO,IAAI,GAAA,EAA2D,CAAA;AAE5F,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,IAAA,uBAAW,GAAA,EAAgC;AACjD,IAAA,OAAA,CAAQ,QAAQ,CAAA,MAAA,KAAU;AACxB,MAAA,IAAI,OAAO,MAA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AgB,CAAC,OAAA,EAAS,cAC9B,mBAAA,CAAoB,IAAA,EAAM,SAAS,SAAS,CAAA,CAAA;AAE9C,EAAA,OAAOF,OAAAA,CAAQ,OAAO,EAAE,IAAA,EAAM,WAAA,EAAa,QAAA,EAAU,aAAA,EAAe,YAAA,EAAc,YAAA,EAAa,CAAA,EAAI,CAAC,IAAI,CAAC,CAAA;AAC3G","file":"index.js","sourcesContent":["import type { ChangeEvent } from 'react';\nimport type { FieldState, Form } from '../core/index';\nimport { createDomBinding, type FieldEventTarget, type RegisterOptions, fieldPathToDomName } from '../adapters/dom';\nimport type { RegisterElement, RegisterPropsForElement } from './types';\n\n/**\n * @description Create framework-specific DOM bindings that forward value, checked, change, blur, and focus behavior to the core form.\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>} field - Field snapshot used to build binding properties.\n * @param {unknown} field.value - Current field value.\n * @param {FormError[]} field.errors - Current validation errors for the field.\n * @param {boolean} field.touched - Whether the field has blurred at least once.\n * @param {boolean} field.dirty - Whether the current value differs from its default by Object.is.\n * @param {boolean} field.modified - Whether a user-originated write has changed this field.\n * @param {boolean} field.isFocused - Whether focus has been recorded without a subsequent blur.\n * @param {string} domName - Name string assigned to the DOM control.\n * @returns {RegisterPropsForElement<TElement>} Binding properties suitable for the selected framework and element type.\n * @example\n * ```ts\n * createRegisterProps(form, { name: \"email\" }, form.getFieldState(\"email\"), \"email\");\n * ```\n */\nexport function createRegisterProps<TValues, TElement extends RegisterElement>(\n form: Form<TValues>,\n options: RegisterOptions,\n field: Readonly<FieldState>,\n domName: string,\n): RegisterPropsForElement<TElement> {\n const binding = createDomBinding(form, options, () => field, domName);\n const props = {\n name: binding.name,\n type: binding.type,\n value: binding.value,\n checked: binding.checked,\n onChange: (event: ChangeEvent<HTMLElement>) => {\n binding.change(event.currentTarget as FieldEventTarget);\n },\n onBlur: () => {\n binding.blur();\n },\n onFocus: () => {\n binding.focus();\n },\n };\n\n return props as unknown as RegisterPropsForElement<TElement>;\n}\n\nexport { fieldPathToDomName };\n","import { useEffect, useRef } from 'react';\nimport type { FieldSchemaOptions, Form } from '../core/index';\nimport { FormPath } from '../core/path/index';\nimport type { RegisterOptions } from './types';\n\n/**\n * @description Register one field-local schema after the React commit and clean it up when options change or the component unmounts.\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 * @example\n * ```ts\n * useFieldSchemaRegistration(form, { name: \"email\", schema });\n * ```\n */\nexport function useFieldSchemaRegistration<TValues>(form: Form<TValues>, options: RegisterOptions): void {\n useFieldSchemaRegistrations(form, [options]);\n}\n\n/**\n * @description Reconcile field-local schemas by normalized path and schema/options identity after each commit, preserving unchanged registrations until removal or unmount.\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 RegisterOptions[]} options - Field schema and DOM binding options.\n * @example\n * ```ts\n * useFieldSchemaRegistrations(form, [{ name: \"email\", schema }]);\n * ```\n */\nexport function useFieldSchemaRegistrations<TValues>(form: Form<TValues>, options: readonly RegisterOptions[]): void {\n const registrations = useRef(new Map<string, FieldSchemaOptions & { cleanup: () => void }>());\n\n useEffect(() => {\n const next = new Map<string, FieldSchemaOptions>();\n options.forEach(option => {\n if (option.schema) {\n next.set(FormPath.pathInputToKey(option.name), {\n schema: option.schema,\n schemaOptions: option.schemaOptions,\n });\n }\n });\n\n registrations.current.forEach((registered, fieldKey) => {\n const desired = next.get(fieldKey);\n if (desired?.schema === registered.schema && desired.schemaOptions === registered.schemaOptions) {\n return;\n }\n\n registered.cleanup();\n registrations.current.delete(fieldKey);\n });\n\n next.forEach((desired, fieldKey) => {\n if (!registrations.current.has(fieldKey)) {\n registrations.current.set(fieldKey, {\n ...desired,\n cleanup: form.registerFieldSchema(FormPath.keyToPath(fieldKey), desired),\n });\n }\n });\n });\n\n useEffect(() => () => {\n registrations.current.forEach(registered => registered.cleanup());\n registrations.current.clear();\n }, [form]);\n}\n","import { useSyncExternalStore } from 'react';\nimport type { Form, FormState } from '../core/index';\n\n/**\n * @description Subscribe the framework view to core form snapshots and release the subscription through its lifecycle.\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 {Readonly<FormState<TValues>>} Framework subscription to current immutable snapshots.\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 * useFormSnapshot(form);\n * ```\n */\nexport function useFormSnapshot<TValues>(form: Form<TValues>): Readonly<FormState<TValues>> {\n return useSyncExternalStore(\n listener => form.subscribe(listener),\n () => form.getState(),\n () => form.getState(),\n );\n}\n","import { useCallback, useMemo } from 'react';\nimport type { Form } from '../core/index';\nimport type { RegisterElement, RegisterOptions, RegisterPropsForElement, UseFieldReturn } from './types';\nimport { createRegisterProps, fieldPathToDomName } from './RegisterBinding';\nimport { getFieldState } from '../adapters/dom';\nimport { useFieldSchemaRegistration } from './useFieldSchemaRegistration';\nimport { useFormSnapshot } from './useFormSnapshot';\n\n/**\n * @description Bind one field to its framework view, exposing reactive bindings, copied errors, metadata, and a programmatic setter.\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 * @returns {UseFieldReturn<RegisterPropsForElement<TElement>>} Reactive field bindings, value, copied errors, flags, and programmatic setter.\n * - props `RegisterPropsForElement<TElement>` - Binding properties to spread onto the matching DOM control.\n * - value `unknown` - Current field value.\n * - setValue `(value: unknown) => void` - Replace the field value as a programmatic write.\n * - errors `FormError[]` - Current validation errors for the field.\n * - dirty `boolean` - Whether the current value differs from its default by Object.is.\n * - touched `boolean` - Whether the field has blurred at least once.\n * @example\n * ```ts\n * useFieldWithForm(form, { name: \"email\", schema });\n * ```\n */\nexport function useFieldWithForm<TValues, TElement extends RegisterElement = HTMLInputElement>(form: Form<TValues>, options: RegisterOptions): UseFieldReturn<RegisterPropsForElement<TElement>> {\n useFieldSchemaRegistration(form, options);\n\n const state = useFormSnapshot(form);\n const field = getFieldState(form, state, options.name);\n const domName = fieldPathToDomName(options.name);\n const props = useMemo(() => createRegisterProps<TValues, TElement>(form, options, field, domName), [form, options, field, domName]);\n\n const setValue = useCallback((value: unknown) => {\n form.setValue(options.name, value, { source: 'program' });\n }, [form, options.name]);\n\n return useMemo(() => ({\n props,\n value: field.value,\n setValue,\n errors: [...field.errors],\n dirty: field.dirty,\n touched: field.touched,\n }), [field, props, setValue]);\n}\n","import type { FieldPathInput, Form } from '../core/index';\nimport { getFieldState } from '../adapters/dom';\nimport type { UseFieldStateReturn } from './types';\nimport { useFormSnapshot } from './useFormSnapshot';\n\n/**\n * @description Subscribe to one field snapshot with its value type inferred from the form values and literal or tuple path.\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 {TName} name - Literal field name or tuple path; strings are not split on dots.\n * @returns {Readonly<FieldState<FieldPathValue<TValues, TName>>>} Read-only field snapshot whose value follows the supplied path type.\n * - value `FieldPathValue<TValues, TName>` - 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 * useFieldStateWithForm(form, \"email\");\n * ```\n */\nexport function useFieldStateWithForm<TValues, const TName extends FieldPathInput>(form: Form<TValues>, name: TName): UseFieldStateReturn<TValues, TName> {\n const state = useFormSnapshot(form);\n\n return getFieldState(form, state, name) as UseFieldStateReturn<TValues, TName>;\n}\n","import { useMemo } from 'react';\nimport type { Form } from '../core/index';\nimport { createFormStateSummary } from '../adapters/FormStateSummary';\nimport type { UseFormStateReturn } from './types';\nimport { useFormSnapshot } from './useFormSnapshot';\n\n/**\n * @description Subscribe to form-wide aggregates derived from the current core snapshot.\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 {UseFormStateReturn<TValues>} Reactive form-wide aggregates and submission flags.\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 * useFormStateWithForm(form);\n * ```\n */\nexport function useFormStateWithForm<TValues>(form: Form<TValues>): UseFormStateReturn<TValues> {\n const state = useFormSnapshot(form);\n\n return useMemo(() => createFormStateSummary(state), [state]);\n}\n","import { useMemo } from 'react';\nimport type { Form } from '../core/index';\nimport type { RegisterElement, RegisterOptions, RegisterPropsForElement, RegisterPropsList } from './types';\nimport { getFieldState } from '../adapters/dom';\nimport { createRegisterProps, fieldPathToDomName } from './RegisterBinding';\nimport { useFieldSchemaRegistrations } from './useFieldSchemaRegistration';\nimport { useFormSnapshot } from './useFormSnapshot';\n\n/**\n * @description Create a single binding or ordered binding list for single, array, or variadic registration options.\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 | TOptions} options - Single registration options or an ordered list; variadic calls use the same options order.\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 {RegisterOptions | readonly RegisterOptions[]} first - First single registration or ordered registration list.\n * @param {FieldPathInput} first.name - Literal field name or tuple path; strings are not split on dots.\n * @param {StandardSchemaV1<unknown, unknown> | undefined} [first.schema] - Standard Schema validator; a field-local schema takes precedence over the form schema.\n * @param {StandardSchemaV1.Props<unknown, unknown>} [first.schema.~standard] - Standard Schema version, vendor, type metadata, and validation entry point.\n * @param {1} [first.schema.~standard.version] - Standard Schema major version, which must be 1.\n * @param {string} [first.schema.~standard.vendor] - Name of the schema library implementation.\n * @param {StandardSchemaV1.Types<unknown, unknown> | undefined} [first.schema.~standard.types] - Optional compile-time input and output metadata.\n * @param {unknown} [first.schema.~standard.types.input] - Schema input type metadata.\n * @param {unknown} [first.schema.~standard.types.output] - Schema output type metadata.\n * @param {(value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<unknown> | Promise<StandardSchemaV1.Result<unknown>>} [first.schema.~standard.validate] - Validate unknown input and return accepted values or issues, synchronously or asynchronously.\n * @param {StandardSchemaV1.Options | undefined} [first.schemaOptions] - Options forwarded to the Standard Schema validator.\n * @param {Record<string, unknown> | undefined} [first.schemaOptions.libraryOptions] - Library-specific validation options; keys are defined by the schema library.\n * @param {string | undefined} [first.type] - Input kind; checkbox and radio use checked semantics, otherwise defaults to text.\n * @param {unknown} [first.value] - Explicit option value used by checkbox and radio bindings.\n * @param {unknown} [first.checkedValue] - Value written by a checked checkbox; omitted for a boolean checkbox.\n * @param {unknown} [first.uncheckedValue] - Value written by an unchecked checkbox; defaults to false.\n * @param {readonly RegisterOptions[]} rest - Additional registration options for variadic binding creation.\n * @returns {RegisterPropsForElement<TElement> | RegisterPropsList<TElement, TOptions> | RegisterPropsForElement<RegisterElement> | RegisterPropsForElement<RegisterElement>[]} One binding for a single options object, otherwise bindings in supplied order.\n * - onChange `React.ChangeEventHandler<HTMLSelectElement> | React.ChangeEventHandler<HTMLElement> | React.ChangeEventHandler<HTMLInputElement> | React.ChangeEventHandler<HTMLTextAreaElement>` - Forward change events, including checked and selection state, into the form.\n * - onBlur `React.FocusEventHandler<HTMLSelectElement> | React.FocusEventHandler<HTMLElement> | React.FocusEventHandler<HTMLInputElement> | React.FocusEventHandler<HTMLTextAreaElement>` - Clear focus and mark the field touched.\n * - onFocus `React.FocusEventHandler<HTMLSelectElement> | React.FocusEventHandler<HTMLElement> | React.FocusEventHandler<HTMLInputElement> | React.FocusEventHandler<HTMLTextAreaElement>` - Record focus for this field.\n * - name `string` - DOM name string; tuple paths are JSON-serialized.\n * - value `string | number | readonly string[] | undefined | unknown` - Current field value.\n * - checked `boolean | undefined` - Whether this checkbox or radio represents the current field value.\n * - type `React.HTMLInputTypeAttribute | undefined` - Input kind; checkbox and radio use checked semantics, otherwise defaults to text.\n * @example\n * ```ts\n * const email = useRegisterWithForm(form, { name: \"email\" });\n * const fields = useRegisterWithForm(form, [{ name: \"email\" }, { name: \"name\" }]);\n * ```\n */\nexport function useRegisterWithForm<TValues, TElement extends RegisterElement = HTMLInputElement>(form: Form<TValues>, options: RegisterOptions): RegisterPropsForElement<TElement>;\nexport function useRegisterWithForm<TValues, TElement extends RegisterElement = HTMLInputElement, TOptions extends readonly RegisterOptions[] = readonly RegisterOptions[]>(form: Form<TValues>, options: TOptions): RegisterPropsList<TElement, TOptions>;\nexport function useRegisterWithForm<TValues, TElement extends RegisterElement = HTMLInputElement, TOptions extends readonly RegisterOptions[] = readonly RegisterOptions[]>(form: Form<TValues>, ...options: TOptions): RegisterPropsList<TElement, TOptions>;\nexport function useRegisterWithForm<TValues>(form: Form<TValues>, first: RegisterOptions | readonly RegisterOptions[], ...rest: readonly RegisterOptions[]): RegisterPropsForElement<RegisterElement> | RegisterPropsForElement<RegisterElement>[];\n\nexport function useRegisterWithForm<TValues>(\n form: Form<TValues>,\n first: RegisterOptions | readonly RegisterOptions[],\n ...rest: readonly RegisterOptions[]\n): RegisterPropsForElement<RegisterElement> | RegisterPropsForElement<RegisterElement>[] {\n const shouldReturnList = Array.isArray(first) || rest.length > 0;\n const options = normalizeRegisterOptions(first, rest);\n\n useFieldSchemaRegistrations(form, options);\n\n const state = useFormSnapshot(form);\n const bindings = useMemo(\n () => options.map(option => {\n const field = getFieldState(form, state, option.name);\n const domName = fieldPathToDomName(option.name);\n\n return createRegisterProps(form, option, field, domName);\n }),\n [form, options, state],\n );\n\n return shouldReturnList ? bindings : bindings[0];\n}\n\nfunction normalizeRegisterOptions(first: RegisterOptions | readonly RegisterOptions[], rest: readonly RegisterOptions[]): readonly RegisterOptions[] {\n if (Array.isArray(first)) {\n return first as readonly RegisterOptions[];\n }\n\n if (rest.length > 0) {\n return [first as RegisterOptions, ...rest];\n }\n\n return [first as RegisterOptions];\n}\n","import { useEffect, useMemo, useRef } from 'react';\nimport { createSubmitHandler } from '../adapters/dom';\nimport {\n createExternalValuesSynchronizer,\n createFormFromOptions,\n isFormInstance,\n type FormInput,\n} from '../adapters/FormInput';\nimport type { FieldPathInput, Form } from '../core/index';\nimport type { ReactForm, ReactFormOptions, RegisterOptions } from './types';\nimport { useFieldWithForm } from './useField';\nimport { useFieldStateWithForm } from './useFieldState';\nimport { useFormStateWithForm } from './useFormState';\nimport { useRegisterWithForm } from './useRegister';\n\n/**\n * @description Bind framework helpers to an existing form or create one from options; defined external-value reference changes reset it.\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 {ReactFormOptions<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 * @param {TValues | undefined} [options.values] - Replacement values; defined reference changes reset the form.\n * @param {ResetOptions | undefined} [options.resetOptions] - State preservation policy for external-value resets.\n * @param {boolean | undefined} [options.resetOptions.keepDirtyValues] - Preserve current values and modified flags of dirty fields.\n * @param {boolean | undefined} [options.resetOptions.keepErrors] - Preserve errors on surviving field paths.\n * @param {boolean | undefined} [options.resetOptions.keepTouched] - Preserve touched flags on surviving field paths.\n * @param {boolean | undefined} [options.resetOptions.keepSubmitState] - Preserve submission counters and lifecycle flags.\n * @returns {ReactForm<TValues>} Core form and bound framework helpers sharing its state and lifecycle.\n * - form `Form<TValues>` - Core form instance shared by all bound helpers.\n * : form.getState `() => Readonly<FormState<TValues>>` - Read the current immutable form snapshot.\n * : form.subscribe `(listener: () => void) => () => void` - Subscribe to state changes and return an unsubscribe callback.\n * : form.registerFieldSchema `(path: FieldPathInput, options: FieldSchemaOptions) => () => void` - Register an overriding field-local validator and return its guarded cleanup.\n * : form.getFieldState `(path: FieldPathInput) => Readonly<FieldState>` - Read field metadata, using a default snapshot for an unknown field.\n * : form.getValue `(path: FieldPathInput) => unknown` - Read the current value of one field.\n * : form.getValues `() => TValues` - Reconstruct nested values from fields and array containers.\n * : form.setValue `(path: FieldPathInput, value: unknown, options?: SetValueOptions) => void` - Write a field with configurable user or program origin and optional immediate validation.\n * : form.blur `(path: FieldPathInput) => Promise<boolean>` - Clear focus, mark touched, and run configured blur validation.\n * : form.focus `(path: FieldPathInput) => void` - Record focus for the selected field.\n * : form.setErrors `(path: FieldPathInput, errors: readonly FormError[]) => void` - Replace all errors for the selected field.\n * : form.clearErrors `(...paths: FieldPathInput[]) => void` - Clear selected fields, or all field errors when no paths are supplied.\n * : form.trigger `(...paths: FieldPathInput[]) => Promise<boolean>` - Run manual validation for selected paths or the entire form.\n * : form.array `(path: FieldPathInput) => FormArray` - Return commands that keep array values, keys, and child metadata aligned.\n * : form.reset `(values?: TValues | undefined, options?: ResetOptions) => void` - Reinitialize from default or replacement values with optional preservation flags.\n * : form.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 * - useRegister `{ <TElement extends RegisterElement = HTMLInputElement>(options: RegisterOptions): RegisterPropsForElement<TElement>; <TElement extends RegisterElement = HTMLInputElement, TOptions extends readonly RegisterOptions[] = readonly RegisterOptions[]>(options: TOptions): RegisterPropsList<TElement, TOptions>; <TElement extends RegisterElement = HTMLInputElement, TOptions extends readonly RegisterOptions[] = readonly RegisterOptions[]>(...options: TOptions): RegisterPropsList<TElement, TOptions>; }` - Create one binding or an ordered list from single, array, or variadic options.\n * - useField `<TElement extends RegisterElement = HTMLInputElement>(options: RegisterOptions) => UseFieldReturn<RegisterPropsForElement<TElement>>` - Create field bindings, reactive value and metadata, and a setter.\n * - useFieldState `<const TName extends FieldPathInput>(name: TName) => Readonly<FieldState<FieldPathValue<TValues, TName>>>` - Subscribe to a path-typed field snapshot.\n * - useFormState `() => UseFormStateReturn<TValues>` - Subscribe to form-wide errors and lifecycle aggregates.\n * - handleSubmit `<TResult>(onValid: SubmitValidHandler<TValues, TResult>, onInvalid?: SubmitInvalidHandler) => SubmitHandler<React.FormEvent<HTMLFormElement>, TResult>` - Create an event handler that prevents default submission before validating.\n * @example\n * ```ts\n * const { form, handleSubmit } = useForm({ defaultValues: { email: \"\" } });\n * ```\n */\nexport function useForm<TValues>(form: Form<TValues>): ReactForm<TValues>;\nexport function useForm<TValues>(options: ReactFormOptions<TValues>): ReactForm<TValues>;\nexport function useForm<TValues>(input: FormInput<TValues, ReactFormOptions<TValues>>): ReactForm<TValues> {\n const optionsFormRef = useRef<Form<TValues> | undefined>(undefined);\n const isForm = isFormInstance(input);\n const form = isForm\n ? input\n : (optionsFormRef.current ??= createFormFromOptions(input));\n const values = isForm ? undefined : input.values;\n const resetOptions = isForm ? undefined : input.resetOptions;\n const synchronizeValues = useMemo(() => createExternalValuesSynchronizer(form), [form]);\n\n useEffect(() => {\n synchronizeValues(values, resetOptions);\n }, [resetOptions, synchronizeValues, values]);\n\n const useRegister = ((\n first: RegisterOptions | readonly RegisterOptions[],\n ...rest: readonly RegisterOptions[]\n ) => useRegisterWithForm(form, first, ...rest)) as ReactForm<TValues>['useRegister'];\n const useField = ((options: RegisterOptions) =>\n useFieldWithForm(form, options)) as ReactForm<TValues>['useField'];\n const useFieldState = ((name: FieldPathInput) =>\n useFieldStateWithForm(form, name)) as ReactForm<TValues>['useFieldState'];\n const useFormState = (): ReturnType<ReactForm<TValues>['useFormState']> =>\n useFormStateWithForm(form);\n const handleSubmit = ((onValid, onInvalid) =>\n createSubmitHandler(form, onValid, onInvalid)) as ReactForm<TValues>['handleSubmit'];\n\n return useMemo(() => ({ form, useRegister, useField, useFieldState, useFormState, handleSubmit }), [form]);\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { isFormInstance, createFormFromOptions, createExternalValuesSynchronizer, createSubmitHandler, fieldPathToDomName, getFieldState, createDomBinding, createFormStateSummary } from '../chunk-WO5TIXCR.js';
2
- import '../chunk-M7Y4OJPP.js';
1
+ import { isFormInstance, createFormFromOptions, createExternalValuesSynchronizer, createSubmitHandler, fieldPathToDomName, getFieldState, createDomBinding, createFormStateSummary } from '../chunk-GNWYMWEC.js';
2
+ import '../chunk-FJ6OHNA5.js';
3
3
  import { getOwner, createRenderEffect, onCleanup, createSignal } from 'solid-js';
4
4
 
5
5
  // src/solid/RegisterBinding.ts
@@ -1,5 +1,5 @@
1
- import { isFormInstance, createFormFromOptions, createExternalValuesSynchronizer, createSubmitHandler, createFormStateSummary, getFieldState, createDomBinding, fieldPathToDomName } from '../chunk-WO5TIXCR.js';
2
- import '../chunk-M7Y4OJPP.js';
1
+ import { isFormInstance, createFormFromOptions, createExternalValuesSynchronizer, createSubmitHandler, createFormStateSummary, getFieldState, createDomBinding, fieldPathToDomName } from '../chunk-GNWYMWEC.js';
2
+ import '../chunk-FJ6OHNA5.js';
3
3
  import { onDestroy } from 'svelte';
4
4
  import { readable } from 'svelte/store';
5
5
 
package/dist/vue/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { isFormInstance, createFormFromOptions, createExternalValuesSynchronizer, createSubmitHandler, fieldPathToDomName, getFieldState, createDomBinding, createFormStateSummary } from '../chunk-WO5TIXCR.js';
2
- import '../chunk-M7Y4OJPP.js';
1
+ import { isFormInstance, createFormFromOptions, createExternalValuesSynchronizer, createSubmitHandler, fieldPathToDomName, getFieldState, createDomBinding, createFormStateSummary } from '../chunk-GNWYMWEC.js';
2
+ import '../chunk-FJ6OHNA5.js';
3
3
  import { getCurrentScope, toValue, watch, onScopeDispose, shallowRef } from 'vue';
4
4
 
5
5
  // src/vue/RegisterBinding.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilokesto/form",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "engines": {
5
5
  "node": ">=24.22.1"
6
6
  },
@@ -54,6 +54,7 @@
54
54
  "immer": "11.1.8"
55
55
  },
56
56
  "devDependencies": {
57
+ "@changesets/cli": "2.31.1",
57
58
  "@sveltejs/vite-plugin-svelte": "6.2.4",
58
59
  "@testing-library/react": "16.3.2",
59
60
  "@types/node": "22.20.1",
@@ -69,7 +70,6 @@
69
70
  "vite": "7.3.6",
70
71
  "vitest": "4.1.10",
71
72
  "vue": "3.5.41",
72
- "@changesets/cli": "2.31.1",
73
73
  "yaml": "2.8.2"
74
74
  },
75
75
  "peerDependencies": {