import { StateBase, ActionsBase, StoreSpec, StoreContainer, SelectorContext, Selector, StableResult } from '../types'; /** * Selector for useStore.from(spec) hook. * Receives state and actions directly (no get needed), plus SelectorContext for advanced features. */ export type FromSelector = (state: Readonly, actions: TActions, ctx: SelectorContext) => T; /** * Custom hook returned by useStore.from(spec). */ export type UseFromStore = (selector: FromSelector) => StableResult; /** * Selector with arguments for useStore.from(selector) overload. * Receives SelectorContext and additional arguments. */ export type FromSelectorWithArgs = (ctx: SelectorContext, ...args: TArgs) => TResult; /** * Custom hook returned by useStore.from(selector). * Accepts the same arguments as the original selector (minus ctx). */ export type UseFromSelectorHook = (...args: TArgs) => StableResult; /** * Core hook implementation that accepts container as parameter. * Use this when you have direct access to a container. */ export declare function useStoreWithContainer(selector: Selector, container: StoreContainer): StableResult; /** * useStore hook interface with from() method. */ export interface UseStoreFn { /** * Main useStore hook - consumes stores with automatic optimization. */ (selector: Selector): StableResult; /** * useStore with void selector - for side effects only (trigger, effects). * * @example * ```tsx * function MyComponent({ id }: { id: string }) { * useStore(({ get }) => { * const [, actions] = get(dataStore); * trigger(actions.fetch, [id], id); * // No return - just side effects * }); * return
...
; * } * ``` */ (selector: Selector): void; /** * Create a pre-bound hook for a specific store. * * @example * ```tsx * const useCounter = useStore.from(counterStore); * * function Counter() { * const { count, increment } = useCounter((state, actions) => ({ * count: state.count, * increment: actions.increment, * })); * return ; * } * ``` */ from(spec: StoreSpec): UseFromStore; /** * Create a reusable hook from a selector function with arguments. * * @example * ```tsx * const useUserById = useStore.from((ctx, userId: string) => { * const [state] = ctx.get(userStore); * return { user: state.users[userId] }; * }); * * function UserCard({ userId }: { userId: string }) { * const { user } = useUserById(userId); * return
{user?.name}
; * } * ``` */ from(selector: FromSelectorWithArgs): UseFromSelectorHook; } /** * React hook to consume stores with automatic optimization. * * @see {@link UseStoreFn} for full documentation */ export declare const useStore: UseStoreFn; //# sourceMappingURL=useStore.d.ts.map