import { Atom, AtomOptions } from "./types.mjs"; //#region ../@mongez/atom/src/persist.d.ts /** * Shape of an external store. Methods may be sync or async; the * persistence layer handles both transparently. */ type PersistAdapter = { /** Read the persisted value for `key`. `undefined` means "not present". */get(key: string): V | undefined | Promise; /** Write `value` to the store under `key`. */ set(key: string, value: V): void | Promise; /** Drop the entry for `key`. Called on `reset()`. */ remove(key: string): void | Promise; }; /** * The shape that goes on `AtomOptions.persist`. * * - `true` → use the built-in localStorage adapter (client-only). * - `false` / omitted → no persistence. * - Any object matching `PersistAdapter` → use that adapter. */ type PersistOption = boolean | PersistAdapter; /** * Built-in adapter backed by `window.localStorage`. JSON-encodes the * value on write, decodes on read. No-ops on the server. */ declare const localStorageAdapter: PersistAdapter; /** * Resolve a `PersistOption` to an actual adapter, or `undefined` if * persistence is disabled. */ declare function resolvePersistAdapter(option: PersistOption | undefined): PersistAdapter | undefined; /** * Wire an atom up to a persistence adapter. * * On creation, asynchronously reads the stored value and applies it via * `silentUpdate` (so subscribers see it on next render but no `update` * event fires). On every update afterwards, writes through to the * adapter. On `reset`, removes the entry. * * This is internal — `createAtom` calls it when `options.persist` is * truthy. Consumers don't call it directly. */ declare function attachPersist>(atom: Atom, adapter: PersistAdapter, options: AtomOptions): void; //#endregion export { PersistAdapter, PersistOption, attachPersist, localStorageAdapter, resolvePersistAdapter }; //# sourceMappingURL=persist.d.mts.map