import { FieldValidityKey, FieldValidationError, FieldFormRegistration } from './field.js'; type FormState = { fieldCount: number; }; type FormFieldRegistration = FieldFormRegistration; type FormValidationTiming = "blur" | "change" | "manual" | "submit"; type FormValues = Record; type FormValidationErrorInput = string | { readonly key?: FieldValidityKey; readonly message: string; readonly source?: Extract; }; type FormValidationResult = FormValidationErrorInput | null | readonly FormValidationErrorInput[] | undefined; type FormSchemaIssuePath = string | number | readonly (string | number)[]; type FormSchemaIssue = { readonly key?: FieldValidityKey; readonly message: string; readonly name?: string; readonly path?: FormSchemaIssuePath; }; type FormSchemaResult = { readonly success: true; } | { readonly errors?: readonly FormSchemaIssue[]; readonly fieldErrors?: Record; readonly formErrors?: FormValidationResult; readonly issues?: readonly FormSchemaIssue[]; readonly success: false; }; type FormSchemaParser = (values: FormValues) => FormSchemaResult; type FormSchemaValidationOptions = { readonly formErrorName?: string; readonly key?: FieldValidityKey; readonly source?: Extract; }; type FormSchemaValidation = { readonly errors: FormExternalErrors; readonly valid: boolean; readonly validatorResult: Record | null; }; type FormFieldValidatorContext = { readonly field: FormFieldRegistration; readonly fields: FormFieldRegistration[]; readonly form: HTMLFormElement; readonly name: string; readonly values: FormValues; }; type FormFieldValidator = (value: FormFieldRegistration["value"], context: FormFieldValidatorContext) => FormValidationResult; type FormFieldValidators = Record; type FormValidationCause = FormValidationTiming; type FormAsyncFieldValidatorContext = FormFieldValidatorContext & { readonly cause: FormValidationCause; readonly signal: AbortSignal; }; type FormAsyncFieldValidator = (value: FormFieldRegistration["value"], context: FormAsyncFieldValidatorContext) => FormValidationResult | Promise; type FormAsyncFieldValidators = Record; type FormValidatorContext = { readonly fields: FormFieldRegistration[]; readonly form: HTMLFormElement; readonly values: FormValues; }; type FormValidator = (values: FormValues, context: FormValidatorContext) => Record | null | undefined; type FormAsyncValidatorContext = FormValidatorContext & { readonly cause: FormValidationCause; readonly signal: AbortSignal; }; type FormAsyncValidator = (values: FormValues, context: FormAsyncValidatorContext) => Record | null | undefined | Promise | null | undefined>; type FormSubmitDetails = { readonly event: SubmitEvent; readonly fields: FormFieldRegistration[]; readonly form: HTMLFormElement; readonly submitter: HTMLElement | null; readonly values: FormValues; }; type FormSubmitHandler = (details: FormSubmitDetails) => void; type FormOptions = { readonly asyncFieldValidators?: FormAsyncFieldValidators; readonly asyncFormValidators?: FormAsyncValidator | readonly FormAsyncValidator[]; readonly asyncValidationDebounceMs?: number; readonly externalErrorsOnReset?: "clear" | "preserve"; readonly fieldValidators?: FormFieldValidators; readonly formValidators?: FormValidator | readonly FormValidator[]; readonly onSubmit?: FormSubmitHandler; }; type FormExternalErrorSource = Extract; type FormExternalErrorInput = string | { readonly key?: FieldValidityKey; readonly message: string; readonly source?: FormExternalErrorSource; }; type FormExternalErrors = Record; type FormExternalErrorOptions = { readonly clearOnChange?: boolean; readonly visibility?: "immediate" | "policy"; }; type FormValidationError = FieldValidationError & { readonly control?: HTMLElement; readonly field: HTMLElement; readonly name?: string; }; type FormValidateOptions = { readonly focus?: boolean; readonly names?: readonly string[]; readonly reveal?: boolean; }; type FormResetValidationOptions = { readonly externalErrors?: "clear" | "preserve"; readonly names?: readonly string[]; }; type FormValidationOutcome = { readonly errors: readonly FormValidationError[]; readonly status: "complete"; readonly valid: boolean; } | { readonly errors: readonly []; readonly status: "aborted"; readonly valid: null; }; type FormInstance = { readonly root: HTMLFormElement; destroy(): void; clearExternalErrors(name?: string): void; getErrors(): FormValidationError[]; getFields(): FormFieldRegistration[]; getState(): FormState; refresh(): void; resetValidation(options?: FormResetValidationOptions): void; setErrorsVisible(visible: boolean, names?: readonly string[]): void; setExternalErrors(errors: FormExternalErrors, options?: FormExternalErrorOptions): void; setOptions(options: FormOptions): void; validate(options?: FormValidateOptions): Promise; }; declare function createForm(root: HTMLElement, options?: FormOptions): FormInstance; declare function createFormSchemaValidator(parser: FormSchemaParser, options?: FormSchemaValidationOptions): FormValidator; declare function validateFormSchema(values: FormValues, parser: FormSchemaParser, options?: FormSchemaValidationOptions): FormSchemaValidation; export { type FormExternalErrorInput, type FormExternalErrorOptions, type FormExternalErrorSource, type FormExternalErrors, type FormFieldRegistration, type FormFieldValidator, type FormFieldValidatorContext, type FormFieldValidators, type FormInstance, type FormOptions, type FormResetValidationOptions, type FormSchemaIssue, type FormSchemaIssuePath, type FormSchemaParser, type FormSchemaResult, type FormSchemaValidation, type FormSchemaValidationOptions, type FormState, type FormSubmitDetails, type FormSubmitHandler, type FormValidateOptions, type FormValidationCause, type FormValidationError, type FormValidationErrorInput, type FormValidationOutcome, type FormValidationResult, type FormValidationTiming, type FormValidator, type FormValidatorContext, type FormValues, createForm, createFormSchemaValidator, validateFormSchema };