export interface Sttore { /** * Initialize states */ (states?: T): T; /** * Update status * @param key keyname state * @param value value state * @param pending Activates pending status update mode. * To confirm this update it will require the confirm method, otherwise use the cancel method. * A pending status is not detected as a change */ set: (key: K, value: T[K], pending?: boolean) => boolean; /** * Confirm a pending update. * @param key keyname of state */ confirm: (key?: keyof T) => boolean; /** * Cancel a pending update and return to its previous value. * @param key keyname of state */ cancel: (key?: keyof T) => boolean; frozen: (key: K) => Sttore | T[K] | null; helper: (key: keyof T, value?: any) => string; helpers: (values?: Record) => Record; /** * Identifies if there were changes in states * @param key keyname of state */ change: (key?: keyof T) => boolean; /** * Returns the states that had changes. */ changes: () => Partial; /** * Initialize the states. */ init: (store?: Sttore) => void; /** * It provides you with the option to restore the helpers and pending data. * @param to Specify which one you want to restore. */ restore: (to?: 'helper' | 'pending') => void; /** * You can omit the states that you don't want to know if it had changes. * @param keys keynames for omit */ omit: (keys: Array>) => boolean; /** * Just check the changes to the keynames you specified. * @param keys keynames you want to verify. */ only: (keys: Array>) => boolean; /** * Listen to the events emitted by the data change */ on: (key: K, listen: Listen) => void; /** * Force to emit an event */ emit: (key: keyof T) => boolean; } export interface PropSttore { [key: string]: Sttore | T; } export declare type TypesStore = string | number | boolean | null; export declare type Store = Map; export declare type StoreBackup = Map>; export interface StoresManagement { set: (key: K, value: T[K]) => void; has: (key: keyof T) => boolean; list: () => T; current: () => T; sthp: Map; backup: StoreBackup; get: (key: K) => T[K] | undefined; stpd: Store; initial: string; st: Store; stev: Map>; } export declare type Listen = (value: T[K], by: EmitBy) => boolean | void; export declare type EmitBy = 'emit' | 'set' | 'confirm' | 'cancel';