/** * ZUI StateManager * Reactive state management for ZUI components */ import type { StateSelector, StateSubscription, StateUpdater } from './types'; type Listener = (state: T, prevState: T) => void; /** * Create a reactive state store * @param initialState - Initial state value */ export declare function createState(initialState: T): State; /** * State class for managing reactive state */ export declare class State { private state; private listeners; private selectorListeners; private batching; private pendingState; constructor(initialState: T); /** * Get current state */ get(): T; /** * Get a specific value from state using a selector * @param selector - Selector function */ select(selector: StateSelector): R; /** * Set new state (merges with existing state) * @param newState - Partial state to merge */ set(newState: Partial): void; /** * Update state using an updater function * @param updater - Function that receives current state and returns partial update */ update(updater: StateUpdater): void; /** * Replace entire state * @param newState - New state to replace existing */ replace(newState: T): void; /** * Subscribe to state changes * @param listener - Callback function */ subscribe(listener: Listener): StateSubscription; /** * Subscribe to specific state changes using a selector * @param selector - Selector function * @param listener - Callback function */ subscribeToSelector(selector: StateSelector, listener: Listener): StateSubscription; /** * Batch multiple state updates * @param fn - Function containing state updates */ batch(fn: () => void): void; /** * Reset state to initial value * @param initialState - Initial state to reset to */ reset(initialState: T): void; /** * Get a snapshot of current state (deep clone) */ snapshot(): T; private notifyListeners; private deepClone; private isEqual; } /** * Create a computed value derived from state * @param state - Source state * @param selector - Selector function */ export declare function computed(state: State, selector: StateSelector): { get: () => R; subscribe: (listener: Listener) => StateSubscription; }; /** * Effect hook - runs callback when dependencies change * @param state - Source state * @param selector - Selector function for dependencies * @param effect - Effect callback */ export declare function effect(state: State, selector: StateSelector, effectFn: (value: R, prevValue: R) => void | (() => void)): StateSubscription; export {}; //# sourceMappingURL=StateManager.d.ts.map