import type { FieldPath, FieldPathValue, FieldValues } from './path'; import type { State, StoreRoot } from './types'; export { createNode, createRootNode, type Extension }; /** * Creates the root proxy node for dynamic path access. * * This is an internal function that wraps a store API in a Proxy, enabling * property-chain syntax like `store.user.profile.name.use()`. * * @param storeApi - The underlying store API with path-based methods * @param initialPath - Starting path segment (default: empty string for root) * @returns A proxy that intercepts property access and returns nested proxies or state methods */ declare function createRootNode>(storeApi: StoreRoot, initialPath?: P): State>; /** * Extension interface for adding custom getters/setters to proxy nodes. * Used internally by form handling to add error-related methods. */ type Extension = { /** Custom getter function */ get?: (path: FieldPath) => any; /** Custom setter function; returns true if the set was handled */ set?:

>(path: P, value: FieldPathValue) => boolean; }; /** * Creates a proxy node for a specific path in the store. * * The proxy intercepts property access to provide state methods (use, set, value, etc.) * and recursively creates child proxies for nested paths. Supports derived state * transformations via the `from` and `to` parameters. * * @param storeApi - The underlying store API * @param path - Dot-separated path to this node (e.g., "user.profile.name") * @param cache - Shared cache to avoid recreating proxies for the same path * @param extensions - Optional custom getters/setters (used by form handling) * @param from - Transform function applied when reading values (for derived state) * @param to - Transform function applied when writing values (for derived state) * @returns A proxy implementing the State interface for the given path */ declare function createNode(storeApi: StoreRoot, path: string, cache: Map, extensions?: Record>, from?: typeof unchanged, to?: typeof unchanged): State; declare function unchanged(value: any): any;