import { S as Subject } from '../core-BR8gTRyy.js'; import { D as DeepSubject } from '../deepSubject-a50MlFII.js'; /** * Custom hook for using Subject in React components * @param subject - The Subject instance to subscribe to * @returns A tuple containing the current value and a function to update it */ declare function useSubject(subject: Subject): [T, (value: T) => void]; /** * Utility types for type-safe DeepSubject paths */ /** * Converts a nested object type into all possible path strings * Example: { user: { name: string } } -> "user" | "user/name" * * Note: Arrays are treated as terminal values (you subscribe to "cart/items", not "cart/items/0") */ type Paths = T extends object ? T extends readonly unknown[] ? never : { [K in keyof T]: K extends string ? T[K] extends object ? T[K] extends readonly unknown[] ? K : K | `${K}/${Paths}` : K : never; }[keyof T] : never; /** * Gets the value type at a given path * Example: PathValue -> string */ type PathValue> = P extends `${infer K}/${infer Rest}` ? K extends keyof T ? Rest extends Paths ? PathValue : never : never : P extends keyof T ? T[P] : never; /** * Helper type to extract paths from a DeepSubject type */ type DeepSubjectPaths> = T extends DeepSubject ? Paths : never; /** * Custom hook for using DeepSubject in React components with type-safe paths. * * Uses a version counter internally so mutable proxy references still trigger * re-renders via useSyncExternalStore. * * @param subject - The DeepSubject instance to subscribe to * @param path - The path to subscribe to (e.g., "user/name" or "cart/items") * @returns A tuple containing the current value and a setter function * * @example * const [userName, setUserName] = useDeepSubject(appState, "user/name"); * const [cartItems] = useDeepSubject(appState, "cart/items"); */ declare function useDeepSubject>(subject: DeepSubject, path: P): [PathValue, (value: PathValue) => void]; declare function useDeepSubjectSelector, R>(subject: DeepSubject, path: P, selector: (value: PathValue) => R, isEqual?: (a: R, b: R) => boolean): R; export { type DeepSubjectPaths, type PathValue, type Paths, useDeepSubject, useDeepSubjectSelector, useSubject };