import { Atom } from "./types.mjs"; //#region ../@mongez/atom/src/atom-store.d.ts /** * A store is an isolated registry of atom instances. * * Each store creates and holds its own clones of atom templates so that * concurrent consumers (e.g. server-rendered requests) do not share state. * * Stores are looked up via React context by `` in * `@mongez/react-atom`, but the class itself is framework-agnostic and can * be used directly outside React. */ declare class AtomStore { /** * Scoped atom clones, keyed by the ORIGINAL atom's key (not the clone key). */ private store; /** * Values applied to atoms the moment they enter the store. Useful for * SSR hydration when atoms register lazily. */ private pendingValues; /** * Get or lazily create a store-scoped clone of the given atom template. * The clone shares the template's options (actions, beforeUpdate, get, * onUpdate) but owns its own state and event topic. */ use = {}>(template: Atom): Atom; /** * Look up a scoped atom by its original key. Returns undefined when the * atom has not been used in this store yet. */ get(key: string): Atom | undefined; /** * True when the given key has a scoped atom in this store. */ has(key: string): boolean; /** * All scoped atoms currently in this store. */ list(): Atom[]; /** * Apply initial values to atoms in the store. Atoms not yet registered * have their values queued until first `use(template)` call. */ hydrate(snapshot: Record): void; /** * Serialize the current values of every scoped atom as a plain object. * Intended for SSR payloads that the client will pass back via * ``. */ snapshot(): Record; /** * Destroy every scoped atom and clear the store. Call this at the end of * a request lifecycle to release event-bus subscriptions and let the * scoped atoms be garbage collected. */ destroy(): void; } /** * Convenience factory; equivalent to `new AtomStore()`. */ declare function createAtomStore(): AtomStore; //#endregion export { AtomStore, createAtomStore }; //# sourceMappingURL=atom-store.d.mts.map