type DeepSubjectSubscription = (value: unknown) => void; type Path = string; type DeepValue = object; type DeepSubscriptionHandle = { unsubscribe: () => void; }; interface DeepSubjectConstructorOptions { name?: string; updateIfStrictlyEqual?: boolean; } /** * Batch multiple mutations into a single notification cycle. * Subscribers are notified once per unique path after the batch completes. * * @example * ```typescript * batch(() => { * state.getValue().user.name = 'Bob'; * state.getValue().user.age = 31; * }); // subscribers notified once * ``` */ declare function batch(fn: () => void): void; declare function matchPath(pattern: string, path: string): boolean; /** * Proxy-based deep observation subject. * * Circular references are safe — the internal proxy cache (WeakMap) ensures * that the same object is never wrapped twice, preventing infinite recursion. */ declare class DeepSubject { private value; private subscribers; private proxyCache; private options; /** * Enables debug logs (only works in development mode) */ debug: boolean | ((nextValue: T) => void); /** * A function that is called before the value changes. */ before: (nextValue: T) => T; /** * Count the number of value updates. */ count: number; constructor(initialValue: T, options?: DeepSubjectConstructorOptions); private setupProxy; private createProxy; private notifySubscribers; private executeNotify; /** * Resolve the value a pattern subscriber should receive on a full-tree * replacement (`next()`). Wildcard patterns (`**`, `foo/**`, `foo/*`) don't * resolve through getValueAtPath (there is no literal `**` key), so we walk * down to the concrete prefix before the first wildcard segment: * `**` -> the whole value * `user/name/**` -> value at `user/name` (the useDeepSubject pattern) * `items/*` -> value at `items` * `user/name` -> value at `user/name` (unchanged for exact paths) */ private getValueForPattern; private getValueAtPath; subscribe(pattern: Path, subscriber: DeepSubjectSubscription, options?: { skipInitialCall?: boolean; }): DeepSubscriptionHandle; /** * Unsubscribes all subscribers. */ complete(): void; getValue(): T; /** * Replace the entire value and notify subscribers. * The new value is re-wrapped in a proxy so subsequent mutations (property sets, * deletes, array splice/push etc.) remain observable. Prefer mutating via * getValue() when possible so only affected paths notify. */ next(nextValue: T): void; unsubscribe(subscriber: DeepSubjectSubscription): void; } export { DeepSubject as D, type Path as P, type DeepSubjectConstructorOptions as a, type DeepSubjectSubscription as b, type DeepSubscriptionHandle as c, type DeepValue as d, batch as e, matchPath as m };