/** * Store persistence helpers. */ import type { PersistedStoreOptions, Store, StoreDefinition } from './types'; /** * Creates a store with automatic persistence. * * Supports configurable storage backends, custom serializers, and schema * versioning with migration functions. All options are optional and * backward-compatible with the simple `(definition, storageKey?)` signature. * * @param definition - Store definition * @param options - Persistence options or a plain string storage key for backward compatibility * @returns The reactive store instance * * @example Basic usage (localStorage + JSON) * ```ts * const store = createPersistedStore({ * id: 'settings', * state: () => ({ theme: 'dark' }), * }); * ``` * * @example With sessionStorage and custom key * ```ts * const store = createPersistedStore( * { id: 'session', state: () => ({ token: '' }) }, * { key: 'my-session', storage: sessionStorage }, * ); * ``` * * @example With versioning and migration * ```ts * const store = createPersistedStore( * { id: 'app', state: () => ({ name: '', theme: 'auto' }) }, * { * version: 2, * migrate: (old, v) => { * if (v < 2) return { ...old, theme: 'auto' }; * return old; * }, * }, * ); * ``` */ export declare const createPersistedStore: , G extends Record = Record, A extends Record any> = Record>(definition: StoreDefinition, options?: PersistedStoreOptions | string) => Store; //# sourceMappingURL=persisted.d.ts.map