import type { ComponentType, ReactElement, ReactNode } from 'react'; import type { FemoModel } from 'femo'; export interface ExtendProps

{ extendProps?: P; } export declare enum NodeValueType { string = "string", number = "number", boolean = "boolean", object = "object", array = "array", void = "void" } declare type NodeValueTypeBak = typeof NodeValueType; declare type NodeValueTypeObj = { [key in NodeValueTypeBak[keyof NodeValueTypeBak]]: any; }; export declare type NodeValueTypeString = `${keyof NodeValueTypeObj}`; export interface CommonState extends ExtendProps

{ className?: string; initialValue?: V; value?: V; valueType?: NodeValueTypeString; name?: string; label?: ReactElement | ReactNode; visible?: boolean; preserve?: boolean; disabled?: boolean; } export declare enum ValidateStatus { validating = "validating", error = "error", warn = "warn", success = "success", default = "default" } export interface ErrorInfo { node?: FNode; message?: ReactNode; value?: V; validateStatus?: ValidateStatus; } export interface SerpentRule { required?: boolean; message?: string | ReactNode; validator?: (value: V, field: FieldInstance, form: FormInstance) => ReactNode | Promise; } export interface FieldState extends CommonState { errors?: ErrorInfo[]; validateStatus?: ValidateStatus; rules?: SerpentRule[]; description?: ReactElement | ReactNode; [index: string]: any; } export interface FormState extends Omit, 'label'> { errors?: ErrorInfo[]; validateStatus?: ValidateStatus; [index: string]: any; } export interface SerpentFormItemProps { children: ReactElement | ReactNode; onChange: (arg: A) => void; fieldState: F; id: string; } export interface SerpentContextInterface { decorator: ComponentType; prefix: string; } export interface FormContextValue = FormState> { state: S; node: FNode; } export interface NodeInstance { state?: P; node?: FNode

; model: FemoModel

; validate: () => Promise; query?: (path?: FPath, options?: Omit) => null | FieldInstance; } export declare type FormInstance = FormState> = NodeInstance; export declare type FieldInstance = FieldState> = NodeInstance; export interface FieldProps extends FieldState { decorator?: SerpentContextInterface['decorator']; onFieldChange?: (state: FieldState, prevState: FieldState, field: FieldInstance) => void; onChange?: (value: V) => void; [index: string]: any; } export interface FormProps extends FormState { children: any; [index: string]: any; } export declare type NodeType = 'form' | 'field'; export declare type FPath = string; export declare enum NodeStatusEnum { mount = "mount", unmount = "unmount", init = "init" } export declare type NodeStatus = NodeStatusEnum.mount | NodeStatusEnum.unmount | NodeStatusEnum.init; export declare enum SearchAction { node_change = "node_change", node_position_change = "node_position_change", node_name_change = "node_name_change", node_visible_change = "node_visible_change" } export interface FNode

{ id?: string; type: NodeType; valueType: NodeValueTypeString; name?: string; status?: FemoModel; searchingPath?: Map<(node: FNode, str: string, action: SearchAction) => void, Set>; mountedBy?: number; instance?: NodeInstance

; parent?: FNode

| null; sibling?: FNode

| null; child?: FNode

| null; pushChild?: (field: FNode

) => void; detach?: () => void; validateModel?: FemoModel; scrollToField?: (fieldId: string) => void; } export interface NodeStateMap { form: FormState; field: FieldState; } export interface NodeInstanceMap { form: FormInstance; field: FieldInstance; } export interface QueryFieldInstanceOptions { context?: FNode; watch?: boolean; watchedKeys?: string | string[]; } export {};