import type { EditorValues } from '../core/editor-values.js'; import type { SelectOption } from '../fields/field-config.js'; import type { MaybePromise } from '../fields/field-value.js'; import type { FieldPath, FieldPathValue } from '../object-path/field-path.js'; /** Immutable values and cancellation state supplied to a dependency resolver. */ export interface FormDependencyContext { readonly values: Readonly>; readonly signal: AbortSignal; } /** Option values accepted by a dependency patch for one field path. */ export type ChoicePatchOptions = Extract, string | number> extends never ? readonly SelectOption[] : readonly SelectOption, string | number>>[]; /** Declarative state changes available for one configured field path. */ export interface FieldStatePatchFor> { readonly visible?: boolean; readonly disabled?: boolean; readonly readOnly?: boolean; readonly required?: boolean; readonly value?: FieldPathValue; readonly options?: ChoicePatchOptions>; } /** Field patches returned by one dependency resolver. */ export type FormDependencyResult = Partial<{ [TPath in FieldPath]: FieldStatePatchFor; }>; /** Resolver associated with one source field path. */ export type FormDependencyResolver> = (value: FieldPathValue, context: FormDependencyContext) => MaybePromise>; /** Source-path mapping for declarative dialog field dependencies. */ export type FormDependencies = Partial<{ [TSourcePath in FieldPath]: FormDependencyResolver; }>; /** Preserves contextual source-path inference for a dependency mapping. */ export declare function defineFormDependencies(): >(dependencies: TDependencies) => TDependencies;