import { Atom, AtomConfig, AtomOptions, ReducerAtom, ReadonlyAtom, SourceAtomConfig } from "./types.js"; /** The current state of an async atom. */ export type AsyncAtomState = { status: 'pending'; } | { status: 'done'; data: Data; } | { status: 'error'; error: Error; }; /** Options passed to an async atom getter. */ export interface AsyncAtomOptions { /** Signal aborted when the async atom recomputes before this run settles. */ signal: AbortSignal; } /** * Creates a read-only atom whose value is loaded from an async getter. * * The getter receives an `AbortSignal`; when the async atom recomputes, the * previous signal is aborted and stale resolutions are ignored. */ export declare function createAsyncAtom(getValue: (options: AsyncAtomOptions) => Promise, options?: AtomOptions>): ReadonlyAtom>; /** * Creates an atom. * * Pass a value for a writable atom or a getter for a computed read-only atom. */ export declare function createAtom(getValue: (prev?: T) => T, options?: AtomOptions): ReadonlyAtom; export declare function createAtom(initialValue: T, options?: AtomOptions): Atom; /** * Creates a read-only atom backed by an external snapshot source. * * The listener is shared by direct and derived subscriptions. Plain reads do * not subscribe; the last consumer leaving synchronously releases the listener. */ export declare function createSourceAtom(source: SourceAtomConfig, options?: AtomOptions): ReadonlyAtom; /** * Creates an inert atom config that can be instantiated later. * * Useful for framework hooks that need to create a stable local atom from * component input. */ export declare function createAtomConfig(getInitialValue: (input: TInput) => T, options?: AtomOptions): AtomConfig; export declare function createAtomConfig(initialValue: T, options?: AtomOptions): AtomConfig; /** Creates an atom whose updates are handled by a reducer function. */ export declare function createReducerAtom(initialValue: TState, reducer: (state: TState, event: TEvent) => TState, options?: AtomOptions): ReducerAtom;