import { ValidationError, type ValidationState } from '../../validation/types.js'; import type { ControlRegistrationHandle, FormApi, FormSnapshot, FormStatus, FormValidator, RegisteredControl } from '../form.types.js'; /** * Mutable config the `
` component feeds into the runtime on every render. * @internal */ export interface FormRuntimeConfig> { formId?: string; validators: FormValidator[]; onSubmit?: (context: { snapshot: FormSnapshot; form: FormApi; }) => void; onInvalid?: (context: { snapshot: FormSnapshot; status: FormStatus; form: FormApi; }) => void; onValidityChange?: (state: ValidationState) => void; } /** * The full runtime surface: the public {@link FormApi} plus the internal hooks * the `` component and registered controls use. * @internal */ export interface FormRuntime> extends FormApi { /** Registers a control and returns its imperative handle. */ register: (control: RegisteredControl) => ControlRegistrationHandle; /** Subscribes to any runtime change (for `useSyncExternalStore`). */ subscribe: (listener: () => void) => () => void; /** The form-wide errors currently rendered by ``. */ getFormMessages: () => ValidationError[]; /** Runtime-owned field errors rendered by `FormFieldMessages`. */ getFieldMessages: (controlId: string) => ValidationError[]; /** * Replaces the config getter that the runtime calls on each submit/validate. * Called by `` when an external runtime is supplied via the `form` prop. * Pass `undefined` to revert to the no-op default (e.g. on unmount). * @internal */ _bindConfig?: (fn: (() => FormRuntimeConfig) | undefined) => void; } export declare function createFormRuntime>(getConfig?: () => FormRuntimeConfig): FormRuntime; //# sourceMappingURL=createFormRuntime.d.ts.map