UNPKG

@adpt/core

Version:
12 lines 812 B
import { AdaptElement, AnyProps, AnyState } from "./jsx"; export interface StateStore { setElementState(elem: StateNamespace, data: AnyState | undefined): void; elementState(elem: StateNamespace): AnyState | undefined; serialize(): string; } export declare function createStateStore(json?: string): StateStore; export declare type StateNamespace = string[]; export declare type StateUpdater<P = AnyProps, S = AnyState> = (prev: S, props: P) => Partial<S> | Promise<Partial<S>>; export declare function applyStateUpdates<P extends object = AnyProps, S extends object = AnyState>(path: StateNamespace, store: StateStore, props: P, updaters: StateUpdater<P, S>[]): Promise<boolean>; export declare function stateNamespaceForPath(path: AdaptElement[]): StateNamespace; //# sourceMappingURL=state.d.ts.map