import { ValidationError, type ValidationState } from '../../validation/types.js'; import type { ControlRegistrationHandle, FormApi, FormSubmitData, FormSubmitOutcome, 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: FormSubmitData) => FormSubmitOutcome | Promise; onValidityChange?: (state: ValidationState) => void; } /** * A field error together with its provenance: `isManual` marks errors the * consumer supplied, whether through `form.setError()` or by returning them * from `onSubmit`. Those reveal immediately instead of waiting for the field to * be touched. * @internal */ export interface RuntimeFieldMessage { error: ValidationError; isManual: boolean; } /** * 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`, each paired * with whether the consumer supplied it, through `setError()` or an * `onSubmit` return, as opposed to a form-level validator or a control's own * validation run producing it. */ getFieldMessages: (controlId: string) => RuntimeFieldMessage[]; /** * 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