import { state } from '@synnaxlabs/x'; /** A state value and a setter that accepts a value or an updater. */ export type UseReturn = [ NextState, state.Setter ]; export type Use = (initial: state.Initial) => UseReturn; /** A state value and a setter that accepts only a value, never an updater. */ export type PureUseReturn = [ NextState, state.PureSetter ]; export type PureUse = (initial: NextState) => PureUseReturn; /** Props for {@link usePassthrough}. */ export interface UsePassthroughProps { initial: state.Initial; /** Set it, with `onChange`, to let the caller own the state. */ value?: NextState; onChange?: state.Setter; } /** * Lets a component be controlled or uncontrolled through one API: the caller owns the * state when it passes both `value` and `onChange`, and the component owns it * otherwise. `onChange` fires either way, so `value` decides who owns the state, not * who hears about it. */ export declare const usePassthrough: ({ initial, value, onChange, }: UsePassthroughProps) => UseReturn; /** Props for {@link usePurePassthrough}. */ export interface UsePurePassthroughProps { initialValue: state.Initial; value?: NextState; onChange?: state.PureSetter; } /** {@link usePassthrough} for a setter that takes only values, never updaters. */ export declare const usePurePassthrough: ({ initialValue, value, onChange, }: UsePurePassthroughProps) => PureUseReturn; /** State backed by local storage under the given key, restored on the next mount. */ export declare const usePersisted: (initial: state.Initial, key: string) => UseReturn; //# sourceMappingURL=state.d.ts.map