import { StateBase, ActionsBase, StoreOptions, StoreInstance, StableResult, ContainerOptions, SelectorContext } from '../types'; import { BoundWithStore } from './withStore'; /** * Selector for create() hook. * Receives state and actions directly (no get needed), plus SelectorContext for advanced features. */ export type CreateSelector = (state: Readonly, actions: TActions, ctx: SelectorContext) => T; /** * Custom hook returned by create(). */ export type UseCreatedStore = (selector: CreateSelector) => StableResult; /** * Context type for withStore hooks created by create(). * Receives [state, actions] tuple directly. */ export type CreatedStoreContext = readonly [Readonly, TActions]; /** * WithStore function bound to a specific store created by create(). * Hook receives [state, actions] tuple directly instead of SelectorContext. */ export type WithCreatedStore = BoundWithStore>; /** * Result of create() call. */ export type CreateResult = readonly [ StoreInstance, UseCreatedStore, WithCreatedStore ]; /** * Create a store instance, custom hook, and bound withStore for single-store apps. * * @example * ```ts * const [counter, useCounter, withCounter] = create({ * state: { count: 0 }, * setup({ state }) { * return { * increment() { state.count++ }, * decrement() { state.count-- }, * }; * } * }); * * // Use the instance directly * counter.actions.increment(); * console.log(counter.state.count); * * // Use the hook in React components * function Counter() { * const { count, increment } = useCounter((state, actions, ctx) => ({ * count: state.count, * increment: actions.increment, * // ctx provides: mixin, scoped, once, id, container, etc. * })); * * return ; * } * * // Use withStore for separation of concerns * const CounterDisplay = withCounter( * ([state, actions], props: { multiplier: number }) => ({ * count: state.count * props.multiplier, * increment: actions.increment, * }), * ({ count, increment }) => ( * * ) * ); * * // HOC mode * const withCounterData = withCounter(([state]) => ({ * count: state.count, * })); * const DisplayValue = withCounterData(({ count }) => {count}); * ``` * * @param storeOptions - Store options (state, setup, etc.) * @param containerOptions - Optional container options (middleware, etc.) * @returns Tuple of [instance, hook, withStore] */ export declare function create(storeOptions: StoreOptions, containerOptions?: ContainerOptions): CreateResult; //# sourceMappingURL=create.d.ts.map