1 | import type { Context } from 'react';
|
2 | import type { Atom, WritableAtom, Scope } from './atom';
|
3 | import type { State } from './vanilla';
|
4 | import { createMutableSource } from './useMutableSource';
|
5 | declare type MutableSource<_Target> = ReturnType<typeof createMutableSource>;
|
6 | declare type UpdateAtom = <Value, Update>(atom: WritableAtom<Value, Update>, update: Update) => void | Promise<void>;
|
7 | declare type StoreForProduction = [
|
8 | stateMutableSource: MutableSource<State>,
|
9 | updateAtom: UpdateAtom
|
10 | ];
|
11 | export declare type StoreForDevelopment = [
|
12 | stateMutableSource: MutableSource<State>,
|
13 | updateAtom: UpdateAtom,
|
14 | debugMutableSource: MutableSource<{
|
15 | version: number;
|
16 | atoms: Atom<unknown>[];
|
17 | state: State;
|
18 | listeners: Set<() => void>;
|
19 | }>,
|
20 | restore: (values: Iterable<readonly [Atom<unknown>, unknown]>) => void
|
21 | ];
|
22 | export declare type Store = StoreForProduction | StoreForDevelopment;
|
23 | declare type CreateStore = (initialValues?: Iterable<readonly [Atom<unknown>, unknown]>) => Store;
|
24 | export declare const createStore: CreateStore;
|
25 | declare type StoreContext = Context<Store>;
|
26 | export declare const getStoreContext: (scope?: Scope | undefined) => StoreContext;
|
27 | export declare const isDevStore: (store: Store) => store is StoreForDevelopment;
|
28 | export {};
|