import type { Assign, NonUndefined } from 'utility-types'; import { Basecoat, type KeyValue } from '../common'; export interface StoreSetOptions extends KeyValue { silent?: boolean; } export interface StoreMutateOptions extends StoreSetOptions { unset?: boolean; } export interface StoreSetByPathOptions extends StoreSetOptions { rewrite?: boolean; } type CommonArgs = { store: Store; }; export interface EventArgs { 'change:*': Assign<{ key: K; current: D[K]; previous: D[K]; options: StoreMutateOptions; }, CommonArgs>; changed: Assign<{ current: D; previous: D; options: StoreMutateOptions; }, CommonArgs>; disposed: CommonArgs; } export declare class Store extends Basecoat> { protected data: D; protected previous: D; protected changed: Partial; protected pending: boolean; protected changing: boolean; protected pendingOptions: StoreMutateOptions | null; constructor(data?: Partial); protected mutate(data: Partial, options?: StoreMutateOptions): this; get(): D; get(key: K): D[K]; get(key: K, defaultValue: D[K]): NonUndefined; get(key: string): T; get(key: string, defaultValue: T): T; getPrevious(key: keyof D): T; set(key: K, value: D[K] | null | undefined | void, options?: StoreSetOptions): this; set(key: string, value: any, options?: StoreSetOptions): this; set(data: D, options?: StoreSetOptions): this; remove(key: K | K[], options?: StoreSetOptions): this; remove(options?: StoreSetOptions): this; getByPath(path: string | string[]): T; setByPath(path: string | string[], value: any, options?: StoreSetByPathOptions): this; removeByPath(path: string | string[], options?: StoreSetOptions): this; hasChanged(): boolean; hasChanged(key: K | null): boolean; hasChanged(key: string | null): boolean; /** * Returns an object containing all the data that have changed, * or `null` if there are no changes. Useful for determining what * parts of a view need to be updated. */ getChanges(diff?: Partial): Partial; /** * Returns a copy of the store's `data` object. */ toJSON(): D; clone(): T; dispose(): void; } export {};