This commit is contained in:
nik
2025-10-03 22:27:28 +03:00
parent 829fad0e17
commit 871cf7e792
16520 changed files with 2967597 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
import babel from '@babel/core';
import type { PluginObj } from '@babel/core';
import type { PluginOptions } from './utils';
export default function debugLabelPlugin({ types: t }: typeof babel, options?: PluginOptions): PluginObj;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,5 @@
import babel from '@babel/core';
import type { PluginObj } from '@babel/core';
import type { PluginOptions } from './utils';
export default function reactRefreshPlugin({ types: t }: typeof babel, options?: PluginOptions): PluginObj;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

6
node_modules/jotai/ts3.8/babel/preset.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import babel from '@babel/core';
import type { PluginOptions } from './utils';
export default function jotaiPreset(_: typeof babel, options?: PluginOptions): {
plugins: babel.PluginItem[];
};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

6
node_modules/jotai/ts3.8/babel/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import { types } from '@babel/core';
export interface PluginOptions {
customAtomNames?: string[];
}
export declare function isAtom(t: typeof types, callee: babel.types.Expression | babel.types.V8IntrinsicIdentifier, customAtomNames?: PluginOptions['customAtomNames']): boolean;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

3
node_modules/jotai/ts3.8/benchmarks/simple-read.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env npx tsx
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env npx tsx
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env npx tsx
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,5 @@
import babel from '@babel/core';
import type { PluginObj } from '@babel/core';
import type { PluginOptions } from './utils';
export default function debugLabelPlugin({ types: t }: typeof babel, options?: PluginOptions): PluginObj;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,5 @@
import babel from '@babel/core';
import type { PluginObj } from '@babel/core';
import type { PluginOptions } from './utils';
export default function reactRefreshPlugin({ types: t }: typeof babel, options?: PluginOptions): PluginObj;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

6
node_modules/jotai/ts3.8/esm/babel/preset.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import babel from '@babel/core';
import type { PluginOptions } from './utils';
export default function jotaiPreset(_: typeof babel, options?: PluginOptions): {
plugins: babel.PluginItem[];
};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

6
node_modules/jotai/ts3.8/esm/babel/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import { types } from '@babel/core';
export interface PluginOptions {
customAtomNames?: string[];
}
export declare function isAtom(t: typeof types, callee: babel.types.Expression | babel.types.V8IntrinsicIdentifier, customAtomNames?: PluginOptions['customAtomNames']): boolean;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

3
node_modules/jotai/ts3.8/esm/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from 'jotai/vanilla';
export * from 'jotai/react';
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

5
node_modules/jotai/ts3.8/esm/react.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export { Provider, useStore } from './react/Provider';
export { useAtomValue } from './react/useAtomValue';
export { useSetAtom } from './react/useSetAtom';
export { useAtom } from './react/useAtom';
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

17
node_modules/jotai/ts3.8/esm/react/Provider.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import type { FunctionComponent, ReactElement, ReactNode } from 'react';
import { createStore } from 'jotai/vanilla';
type Store = ReturnType<typeof createStore>;
type Options = {
store?: Store;
};
export declare function useStore(options?: Options): Store;
export declare function Provider({ children, store, }: {
children?: ReactNode;
store?: Store;
}): ReactElement<{
value: Store | undefined;
}, FunctionComponent<{
value: Store | undefined;
}>>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

28
node_modules/jotai/ts3.8/esm/react/useAtom.d.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import type { Atom, ExtractAtomArgs, ExtractAtomResult, ExtractAtomValue, PrimitiveAtom, SetStateAction, WritableAtom } from 'jotai/vanilla';
import { useAtomValue } from './useAtomValue';
type SetAtom<Args extends unknown[], Result> = (...args: Args) => Result;
type Options = Parameters<typeof useAtomValue>[1];
export declare function useAtom<Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, options?: Options): [
Awaited<Value>,
SetAtom<Args, Result>
];
export declare function useAtom<Value>(atom: PrimitiveAtom<Value>, options?: Options): [
Awaited<Value>,
SetAtom<[
SetStateAction<Value>
], void>
];
export declare function useAtom<Value>(atom: Atom<Value>, options?: Options): [
Awaited<Value>,
never
];
export declare function useAtom<AtomType extends WritableAtom<unknown, never[], unknown>>(atom: AtomType, options?: Options): [
Awaited<ExtractAtomValue<AtomType>>,
SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>
];
export declare function useAtom<AtomType extends Atom<unknown>>(atom: AtomType, options?: Options): [
Awaited<ExtractAtomValue<AtomType>>,
never
];
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

10
node_modules/jotai/ts3.8/esm/react/useAtomValue.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import type { Atom, ExtractAtomValue } from 'jotai/vanilla';
import { useStore } from './Provider';
type Options = Parameters<typeof useStore>[0] & {
delay?: number;
unstable_promiseStatus?: boolean;
};
export declare function useAtomValue<Value>(atom: Atom<Value>, options?: Options): Awaited<Value>;
export declare function useAtomValue<AtomType extends Atom<unknown>>(atom: AtomType, options?: Options): Awaited<ExtractAtomValue<AtomType>>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

8
node_modules/jotai/ts3.8/esm/react/useSetAtom.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import type { ExtractAtomArgs, ExtractAtomResult, WritableAtom } from 'jotai/vanilla';
import { useStore } from './Provider';
type SetAtom<Args extends unknown[], Result> = (...args: Args) => Result;
type Options = Parameters<typeof useStore>[0];
export declare function useSetAtom<Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, options?: Options): SetAtom<Args, Result>;
export declare function useSetAtom<AtomType extends WritableAtom<unknown, never[], unknown>>(atom: AtomType, options?: Options): SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

5
node_modules/jotai/ts3.8/esm/react/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export { useResetAtom } from './utils/useResetAtom';
export { useReducerAtom } from './utils/useReducerAtom';
export { useAtomCallback } from './utils/useAtomCallback';
export { useHydrateAtoms } from './utils/useHydrateAtoms';
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,6 @@
import { useSetAtom } from 'jotai/react';
import type { Getter, Setter } from 'jotai/vanilla';
type Options = Parameters<typeof useSetAtom>[1];
export declare function useAtomCallback<Result, Args extends unknown[]>(callback: (get: Getter, set: Setter, ...arg: Args) => Result, options?: Options): (...args: Args) => Result;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,27 @@
import { useStore } from 'jotai/react';
import type { WritableAtom } from 'jotai/vanilla';
type Options = Parameters<typeof useStore>[0] & {
dangerouslyForceHydrate?: boolean;
};
type AnyWritableAtom = WritableAtom<any, any[], any>;
type InferAtomTuples<T> = {
[K in keyof T]: T[K] extends readonly [
infer A,
...infer Rest
] ? A extends WritableAtom<unknown, infer Args, unknown> ? Rest extends Args ? readonly [
A,
...Rest
] : never : T[K] : never;
};
export type INTERNAL_InferAtomTuples<T> = InferAtomTuples<T>;
export declare function useHydrateAtoms<T extends (readonly [
AnyWritableAtom,
...unknown[]
])[]>(values: InferAtomTuples<T>, options?: Options): void;
export declare function useHydrateAtoms<T extends Map<AnyWritableAtom, unknown>>(values: T, options?: Options): void;
export declare function useHydrateAtoms<T extends Iterable<readonly [
AnyWritableAtom,
...unknown[]
]>>(values: InferAtomTuples<T>, options?: Options): void;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,21 @@
import { useAtom } from 'jotai/react';
import type { PrimitiveAtom } from 'jotai/vanilla';
type Options = Parameters<typeof useAtom>[1];
/**
* @deprecated please use a recipe instead
* https://github.com/pmndrs/jotai/pull/2467
*/
export declare function useReducerAtom<Value, Action>(anAtom: PrimitiveAtom<Value>, reducer: (v: Value, a?: Action) => Value, options?: Options): [
Value,
(action?: Action) => void
];
/**
* @deprecated please use a recipe instead
* https://github.com/pmndrs/jotai/pull/2467
*/
export declare function useReducerAtom<Value, Action>(anAtom: PrimitiveAtom<Value>, reducer: (v: Value, a: Action) => Value, options?: Options): [
Value,
(action: Action) => void
];
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,9 @@
import { useSetAtom } from 'jotai/react';
import { RESET } from 'jotai/vanilla/utils';
import type { WritableAtom } from 'jotai/vanilla';
type Options = Parameters<typeof useSetAtom>[1];
export declare function useResetAtom<T>(anAtom: WritableAtom<unknown, [
typeof RESET
], T>, options?: Options): () => T;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

3
node_modules/jotai/ts3.8/esm/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from 'jotai/vanilla/utils';
export * from 'jotai/react/utils';
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

5
node_modules/jotai/ts3.8/esm/vanilla.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export { atom } from './vanilla/atom';
export type { Atom, WritableAtom, PrimitiveAtom } from './vanilla/atom';
export { createStore, getDefaultStore, INTERNAL_overrideCreateStore, } from './vanilla/store';
export type { Getter, Setter, ExtractAtomValue, ExtractAtomArgs, ExtractAtomResult, SetStateAction, } from './vanilla/typeUtils';
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

48
node_modules/jotai/ts3.8/esm/vanilla/atom.d.ts generated vendored Normal file
View File

@@ -0,0 +1,48 @@
import type { Store } from './store';
type Getter = <Value>(atom: Atom<Value>) => Value;
type Setter = <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
type SetAtom<Args extends unknown[], Result> = <A extends Args>(...args: A) => Result;
/**
* setSelf is for internal use only and subject to change without notice.
*/
type Read<Value, SetSelf = never> = (get: Getter, options: {
readonly signal: AbortSignal;
readonly setSelf: SetSelf;
}) => Value;
type Write<Args extends unknown[], Result> = (get: Getter, set: Setter, ...args: Args) => Result;
type WithInitialValue<Value> = {
init: Value;
};
type OnUnmount = () => void;
type OnMount<Args extends unknown[], Result> = <S extends SetAtom<Args, Result>>(setAtom: S) => OnUnmount | void;
export interface Atom<Value> {
toString: () => string;
read: Read<Value>;
debugLabel?: string;
/**
* To ONLY be used by Jotai libraries to mark atoms as private. Subject to change.
* @private
*/
debugPrivate?: boolean;
/**
* Fires after atom is referenced by the store for the first time
* This is still an experimental API and subject to change without notice.
*/
unstable_onInit?: (store: Store) => void;
}
export interface WritableAtom<Value, Args extends unknown[], Result> extends Atom<Value> {
read: Read<Value, SetAtom<Args, Result>>;
write: Write<Args, Result>;
onMount?: OnMount<Args, Result>;
}
type SetStateAction<Value> = Value | ((prev: Value) => Value);
export type PrimitiveAtom<Value> = WritableAtom<Value, [
SetStateAction<Value>
], void>;
export declare function atom<Value, Args extends unknown[], Result>(read: Read<Value, SetAtom<Args, Result>>, write: Write<Args, Result>): WritableAtom<Value, Args, Result>;
export declare function atom<Value>(read: Read<Value>): Atom<Value>;
export declare function atom<Value, Args extends unknown[], Result>(initialValue: Value, write: Write<Args, Result>): WritableAtom<Value, Args, Result> & WithInitialValue<Value>;
export declare function atom<Value>(): PrimitiveAtom<Value | undefined> & WithInitialValue<Value | undefined>;
export declare function atom<Value>(initialValue: Value): PrimitiveAtom<Value> & WithInitialValue<Value>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

174
node_modules/jotai/ts3.8/esm/vanilla/internals.d.ts generated vendored Normal file
View File

@@ -0,0 +1,174 @@
import type { Atom, WritableAtom } from './atom';
type AnyValue = unknown;
type AnyError = unknown;
type AnyAtom = Atom<AnyValue>;
type AnyWritableAtom = WritableAtom<AnyValue, unknown[], unknown>;
type OnUnmount = () => void;
type EpochNumber = number;
/**
* Mutable atom state,
* tracked for both mounted and unmounted atoms in a store.
*
* This should be garbage collectable.
* We can mutate it during atom read. (except for fields with TODO)
*/
type AtomState<Value = AnyValue> = {
/**
* Map of atoms that the atom depends on.
* The map value is the epoch number of the dependency.
*/
readonly d: Map<AnyAtom, EpochNumber>;
/**
* Set of atoms with pending promise that depend on the atom.
*
* This may cause memory leaks, but it's for the capability to continue promises
* TODO(daishi): revisit how to handle this
*/
readonly p: Set<AnyAtom>;
/** The epoch number of the atom. */
n: EpochNumber;
/** Atom value */
v?: Value;
/** Atom error */
e?: AnyError;
};
/**
* State tracked for mounted atoms. An atom is considered "mounted" if it has a
* subscriber, or is a transitive dependency of another atom that has a
* subscriber.
* The mounted state of an atom is freed once it is no longer mounted.
*/
type Mounted = {
/** Set of listeners to notify when the atom value changes. */
readonly l: Set<() => void>;
/** Set of mounted atoms that the atom depends on. */
readonly d: Set<AnyAtom>;
/** Set of mounted atoms that depends on the atom. */
readonly t: Set<AnyAtom>;
/** Function to run when the atom is unmounted. */
u?: () => void;
};
type AtomStateMap = {
get(atom: AnyAtom): AtomState | undefined;
set(atom: AnyAtom, atomState: AtomState): void;
};
type MountedMap = {
get(atom: AnyAtom): Mounted | undefined;
has(atom: AnyAtom): boolean;
set(atom: AnyAtom, mounted: Mounted): void;
delete(atom: AnyAtom): void;
};
type InvalidatedAtoms = {
get(atom: AnyAtom): EpochNumber | undefined;
has(atom: AnyAtom): boolean;
set(atom: AnyAtom, n: EpochNumber): void;
delete(atom: AnyAtom): void;
};
type ChangedAtoms = {
readonly size: number;
add(atom: AnyAtom): void;
has(atom: AnyAtom): boolean;
clear(): void;
forEach(callback: (atom: AnyAtom) => void): void;
[Symbol.iterator](): IterableIterator<AnyAtom>;
};
type Callbacks = {
readonly size: number;
add(fn: () => void): void;
clear(): void;
forEach(callback: (fn: () => void) => void): void;
};
type AtomRead = <Value>(store: Store, atom: Atom<Value>, ...params: Parameters<Atom<Value>['read']>) => Value;
type AtomWrite = <Value, Args extends unknown[], Result>(store: Store, atom: WritableAtom<Value, Args, Result>, ...params: Parameters<WritableAtom<Value, Args, Result>['write']>) => Result;
type AtomOnInit = <Value>(store: Store, atom: Atom<Value>) => void;
type AtomOnMount = <Value, Args extends unknown[], Result>(store: Store, atom: WritableAtom<Value, Args, Result>, setAtom: (...args: Args) => Result) => OnUnmount | void;
type EnsureAtomState = <Value>(store: Store, atom: Atom<Value>) => AtomState<Value>;
type FlushCallbacks = (store: Store) => void;
type RecomputeInvalidatedAtoms = (store: Store) => void;
type ReadAtomState = <Value>(store: Store, atom: Atom<Value>) => AtomState<Value>;
type InvalidateDependents = (store: Store, atom: AnyAtom) => void;
type WriteAtomState = <Value, Args extends unknown[], Result>(store: Store, atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
type MountDependencies = (store: Store, atom: AnyAtom) => void;
type MountAtom = <Value>(store: Store, atom: Atom<Value>) => Mounted;
type UnmountAtom = <Value>(store: Store, atom: Atom<Value>) => Mounted | undefined;
type SetAtomStateValueOrPromise = <Value>(store: Store, atom: Atom<Value>, valueOrPromise: Value) => void;
type StoreGet = <Value>(store: Store, atom: Atom<Value>) => Value;
type StoreSet = <Value, Args extends unknown[], Result>(store: Store, atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
type StoreSub = (store: Store, atom: AnyAtom, listener: () => void) => () => void;
type EnhanceBuildingBlocks = (buildingBlocks: Readonly<BuildingBlocks>) => Readonly<BuildingBlocks>;
type Store = {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
};
type BuildingBlocks = [
/*atomStateMap*/ AtomStateMap,
/*mountedMap*/ MountedMap,
/*invalidatedAtoms*/ InvalidatedAtoms,
/*changedAtoms*/ ChangedAtoms,
/*mountCallbacks*/ Callbacks,
/*unmountCallbacks*/ Callbacks,
/*storeHooks*/ StoreHooks,
/*atomRead*/ AtomRead,
/*atomWrite*/ AtomWrite,
/*atomOnInit*/ AtomOnInit,
/*atomOnMount*/ AtomOnMount,
/*ensureAtomState*/ EnsureAtomState,
/*flushCallbacks*/ FlushCallbacks,
/*recomputeInvalidatedAtoms*/ RecomputeInvalidatedAtoms,
/*readAtomState*/ ReadAtomState,
/*invalidateDependents*/ InvalidateDependents,
/*writeAtomState*/ WriteAtomState,
/*mountDependencies*/ MountDependencies,
/*mountAtom*/ MountAtom,
/*unmountAtom*/ UnmountAtom,
/*setAtomStateValueOrPromise*/ SetAtomStateValueOrPromise,
/*storeGet*/ StoreGet,
/*storeSet*/ StoreSet,
/*storeSub*/ StoreSub,
/*enhanceBuildingBlocks*/ EnhanceBuildingBlocks | undefined
];
export type { AtomState as INTERNAL_AtomState, Mounted as INTERNAL_Mounted, AtomStateMap as INTERNAL_AtomStateMap, MountedMap as INTERNAL_MountedMap, InvalidatedAtoms as INTERNAL_InvalidatedAtoms, ChangedAtoms as INTERNAL_ChangedAtoms, Callbacks as INTERNAL_Callbacks, AtomRead as INTERNAL_AtomRead, AtomWrite as INTERNAL_AtomWrite, AtomOnInit as INTERNAL_AtomOnInit, AtomOnMount as INTERNAL_AtomOnMount, EnsureAtomState as INTERNAL_EnsureAtomState, FlushCallbacks as INTERNAL_FlushCallbacks, RecomputeInvalidatedAtoms as INTERNAL_RecomputeInvalidatedAtoms, ReadAtomState as INTERNAL_ReadAtomState, InvalidateDependents as INTERNAL_InvalidateDependents, WriteAtomState as INTERNAL_WriteAtomState, MountDependencies as INTERNAL_MountDependencies, MountAtom as INTERNAL_MountAtom, UnmountAtom as INTERNAL_UnmountAtom, Store as INTERNAL_Store, BuildingBlocks as INTERNAL_BuildingBlocks, StoreHooks as INTERNAL_StoreHooks, };
declare function hasInitialValue<T extends Atom<AnyValue>>(atom: T): atom is T & (T extends Atom<infer Value> ? {
init: Value;
} : never);
declare function isActuallyWritableAtom(atom: AnyAtom): atom is AnyWritableAtom;
declare function isAtomStateInitialized<Value>(atomState: AtomState<Value>): boolean;
declare function returnAtomValue<Value>(atomState: AtomState<Value>): Value;
declare const promiseStateMap: WeakMap<PromiseLike<unknown>, [
/*pending*/ boolean,
/*abortHandlers*/ Set<() => void>
]>;
declare function isPendingPromise(value: unknown): value is PromiseLike<unknown>;
declare function abortPromise<T>(promise: PromiseLike<T>): void;
declare function registerAbortHandler<T>(promise: PromiseLike<T>, abortHandler: () => void): void;
declare function isPromiseLike(p: unknown): p is PromiseLike<unknown>;
declare function addPendingPromiseToDependency(atom: AnyAtom, promise: PromiseLike<AnyValue>, dependencyAtomState: AtomState): void;
declare function getMountedOrPendingDependents(atom: AnyAtom, atomState: AtomState, mountedMap: MountedMap): Set<AnyAtom>;
type StoreHook = {
(): void;
add(callback: () => void): () => void;
};
type StoreHookForAtoms = {
(atom: AnyAtom): void;
add(atom: AnyAtom, callback: () => void): () => void;
add(atom: undefined, callback: (atom: AnyAtom) => void): () => void;
};
/** StoreHooks are an experimental API. */
type StoreHooks = {
/** Listener to notify when the atom is read. */
readonly r?: StoreHookForAtoms;
/** Listener to notify when the atom value is changed. */
readonly c?: StoreHookForAtoms;
/** Listener to notify when the atom is mounted. */
readonly m?: StoreHookForAtoms;
/** Listener to notify when the atom is unmounted. */
readonly u?: StoreHookForAtoms;
/** Listener to notify when callbacks are being flushed. */
readonly f?: StoreHook;
};
declare function initializeStoreHooks(storeHooks: StoreHooks): Required<StoreHooks>;
declare function getBuildingBlocks(store: Store): Readonly<BuildingBlocks>;
declare function buildStore(...buildArgs: Partial<BuildingBlocks>): Store;
export { buildStore as INTERNAL_buildStoreRev2, getBuildingBlocks as INTERNAL_getBuildingBlocksRev2, initializeStoreHooks as INTERNAL_initializeStoreHooksRev2, hasInitialValue as INTERNAL_hasInitialValue, isActuallyWritableAtom as INTERNAL_isActuallyWritableAtom, isAtomStateInitialized as INTERNAL_isAtomStateInitialized, returnAtomValue as INTERNAL_returnAtomValue, promiseStateMap as INTERNAL_promiseStateMap, isPendingPromise as INTERNAL_isPendingPromise, abortPromise as INTERNAL_abortPromise, registerAbortHandler as INTERNAL_registerAbortHandler, isPromiseLike as INTERNAL_isPromiseLike, addPendingPromiseToDependency as INTERNAL_addPendingPromiseToDependency, getMountedOrPendingDependents as INTERNAL_getMountedOrPendingDependents, };
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

6
node_modules/jotai/ts3.8/esm/vanilla/store.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import type { INTERNAL_Store } from 'jotai/vanilla/internals';
export type Store = INTERNAL_Store;
export declare function INTERNAL_overrideCreateStore(fn: (prev: typeof createStore | undefined) => typeof createStore): void;
export declare function createStore(): Store;
export declare function getDefaultStore(): Store;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

8
node_modules/jotai/ts3.8/esm/vanilla/typeUtils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import type { Atom, PrimitiveAtom, WritableAtom } from './atom';
export type Getter = Parameters<Atom<unknown>['read']>[0];
export type Setter = Parameters<WritableAtom<unknown, unknown[], unknown>['write']>[1];
export type ExtractAtomValue<AtomType> = AtomType extends Atom<infer Value> ? Value : never;
export type ExtractAtomArgs<AtomType> = AtomType extends WritableAtom<unknown, infer Args, infer _Result> ? Args : never;
export type ExtractAtomResult<AtomType> = AtomType extends WritableAtom<unknown, infer _Args, infer Result> ? Result : never;
export type SetStateAction<Value> = ExtractAtomArgs<PrimitiveAtom<Value>>[0];
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

15
node_modules/jotai/ts3.8/esm/vanilla/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
export { RESET } from './utils/constants';
export { atomWithReset } from './utils/atomWithReset';
export { atomWithReducer } from './utils/atomWithReducer';
export { atomFamily } from './utils/atomFamily';
export { selectAtom } from './utils/selectAtom';
export { freezeAtom, freezeAtomCreator } from './utils/freezeAtom';
export { splitAtom } from './utils/splitAtom';
export { atomWithDefault } from './utils/atomWithDefault';
export { atomWithStorage, createJSONStorage, withStorageValidator as unstable_withStorageValidator, } from './utils/atomWithStorage';
export { atomWithObservable } from './utils/atomWithObservable';
export { loadable } from './utils/loadable';
export { unwrap } from './utils/unwrap';
export { atomWithRefresh } from './utils/atomWithRefresh';
export { atomWithLazy } from './utils/atomWithLazy';
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,26 @@
import type { Atom } from 'jotai/vanilla';
/**
* in milliseconds
*/
type CreatedAt = number;
type ShouldRemove<Param> = (createdAt: CreatedAt, param: Param) => boolean;
type Cleanup = () => void;
type Callback<Param, AtomType> = (event: {
type: 'CREATE' | 'REMOVE';
param: Param;
atom: AtomType;
}) => void;
export interface AtomFamily<Param, AtomType> {
(param: Param): AtomType;
getParams(): Iterable<Param>;
remove(param: Param): void;
setShouldRemove(shouldRemove: ShouldRemove<Param> | null): void;
/**
* fires when a atom is created or removed
* This API is for advanced use cases, and can change without notice.
*/
unstable_listen(callback: Callback<Param, AtomType>): Cleanup;
}
export declare function atomFamily<Param, AtomType extends Atom<unknown>>(initializeAtom: (param: Param) => AtomType, areEqual?: (a: Param, b: Param) => boolean): AtomFamily<Param, AtomType>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,11 @@
import type { WritableAtom } from 'jotai/vanilla';
import { RESET } from './constants';
type Read<Value, Args extends unknown[], Result> = WritableAtom<Value, Args, Result>['read'];
type DefaultSetStateAction<Value> = Value | typeof RESET | ((prev: Value) => Value | typeof RESET);
export declare function atomWithDefault<Value>(getDefault: Read<Value, [
DefaultSetStateAction<Value>
], void>): WritableAtom<Value, [
DefaultSetStateAction<Value>
], void>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,3 @@
import type { PrimitiveAtom } from 'jotai/vanilla';
export declare function atomWithLazy<Value>(makeInitial: () => Value): PrimitiveAtom<Value>;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,37 @@
import type { Atom, Getter, WritableAtom } from 'jotai/vanilla';
type AnyError = unknown;
type Subscription = {
unsubscribe: () => void;
};
type Observer<T> = {
next: (value: T) => void;
error: (error: AnyError) => void;
complete: () => void;
};
type ObservableLike<T> = {
subscribe(observer: Observer<T>): Subscription;
} | {
subscribe(observer: Partial<Observer<T>>): Subscription;
} | {
subscribe(observer: Partial<Observer<T>>): Subscription;
subscribe(next: (value: T) => void): Subscription;
};
type SubjectLike<T> = ObservableLike<T> & Observer<T>;
type Options<Data> = {
initialValue?: Data | (() => Data);
unstable_timeout?: number;
};
type OptionsWithInitialValue<Data> = {
initialValue: Data | (() => Data);
unstable_timeout?: number;
};
export declare function atomWithObservable<Data>(getObservable: (get: Getter) => SubjectLike<Data>, options: OptionsWithInitialValue<Data>): WritableAtom<Data, [
Data
], void>;
export declare function atomWithObservable<Data>(getObservable: (get: Getter) => SubjectLike<Data>, options?: Options<Data>): WritableAtom<Data | Promise<Data>, [
Data
], void>;
export declare function atomWithObservable<Data>(getObservable: (get: Getter) => ObservableLike<Data>, options: OptionsWithInitialValue<Data>): Atom<Data>;
export declare function atomWithObservable<Data>(getObservable: (get: Getter) => ObservableLike<Data>, options?: Options<Data>): Atom<Data | Promise<Data>>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,8 @@
import type { WritableAtom } from 'jotai/vanilla';
export declare function atomWithReducer<Value, Action>(initialValue: Value, reducer: (value: Value, action?: Action) => Value): WritableAtom<Value, [
Action?
], void>;
export declare function atomWithReducer<Value, Action>(initialValue: Value, reducer: (value: Value, action: Action) => Value): WritableAtom<Value, [
Action
], void>;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,10 @@
import type { WritableAtom } from 'jotai/vanilla';
type Read<Value, Args extends unknown[], Result> = WritableAtom<Value, Args, Result>['read'];
type Write<Value, Args extends unknown[], Result> = WritableAtom<Value, Args, Result>['write'];
export declare function atomWithRefresh<Value, Args extends unknown[], Result>(read: Read<Value, Args, Result>, write: Write<Value, Args, Result>): WritableAtom<Value, Args | [
], Result | void>;
export declare function atomWithRefresh<Value>(read: Read<Value, [
], void>): WritableAtom<Value, [
], void>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,11 @@
import type { WritableAtom } from 'jotai/vanilla';
import { RESET } from './constants';
type SetStateActionWithReset<Value> = Value | typeof RESET | ((prev: Value) => Value | typeof RESET);
type WithInitialValue<Value> = {
init: Value;
};
export declare function atomWithReset<Value>(initialValue: Value): WritableAtom<Value, [
SetStateActionWithReset<Value>
], void> & WithInitialValue<Value>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,53 @@
import type { WritableAtom } from 'jotai/vanilla';
import { RESET } from './constants';
type Unsubscribe = () => void;
type Subscribe<Value> = (key: string, callback: (value: Value) => void, initialValue: Value) => Unsubscribe | undefined;
type StringSubscribe = (key: string, callback: (value: string | null) => void) => Unsubscribe | undefined;
type SetStateActionWithReset<Value> = Value | typeof RESET | ((prev: Value) => Value | typeof RESET);
export interface AsyncStorage<Value> {
getItem: (key: string, initialValue: Value) => PromiseLike<Value>;
setItem: (key: string, newValue: Value) => PromiseLike<void>;
removeItem: (key: string) => PromiseLike<void>;
subscribe?: Subscribe<Value>;
}
export interface SyncStorage<Value> {
getItem: (key: string, initialValue: Value) => Value;
setItem: (key: string, newValue: Value) => void;
removeItem: (key: string) => void;
subscribe?: Subscribe<Value>;
}
export interface AsyncStringStorage {
getItem: (key: string) => PromiseLike<string | null>;
setItem: (key: string, newValue: string) => PromiseLike<void>;
removeItem: (key: string) => PromiseLike<void>;
subscribe?: StringSubscribe;
}
export interface SyncStringStorage {
getItem: (key: string) => string | null;
setItem: (key: string, newValue: string) => void;
removeItem: (key: string) => void;
subscribe?: StringSubscribe;
}
export declare function withStorageValidator<Value>(validator: (value: unknown) => value is Value): {
(storage: AsyncStorage<unknown>): AsyncStorage<Value>;
(storage: SyncStorage<unknown>): SyncStorage<Value>;
};
type JsonStorageOptions = {
reviver?: (key: string, value: unknown) => unknown;
replacer?: (key: string, value: unknown) => unknown;
};
export declare function createJSONStorage<Value>(): SyncStorage<Value>;
export declare function createJSONStorage<Value>(getStringStorage: () => AsyncStringStorage, options?: JsonStorageOptions): AsyncStorage<Value>;
export declare function createJSONStorage<Value>(getStringStorage: () => SyncStringStorage, options?: JsonStorageOptions): SyncStorage<Value>;
export declare function atomWithStorage<Value>(key: string, initialValue: Value, storage: AsyncStorage<Value>, options?: {
getOnInit?: boolean;
}): WritableAtom<Value | Promise<Value>, [
SetStateActionWithReset<Value | Promise<Value>>
], Promise<void>>;
export declare function atomWithStorage<Value>(key: string, initialValue: Value, storage?: SyncStorage<Value>, options?: {
getOnInit?: boolean;
}): WritableAtom<Value, [
SetStateActionWithReset<Value>
], void>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,2 @@
export declare const RESET: unique symbol;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,7 @@
import type { Atom } from 'jotai/vanilla';
export declare function freezeAtom<AtomType extends Atom<unknown>>(anAtom: AtomType): AtomType;
/**
* @deprecated Define it on users end
*/
export declare function freezeAtomCreator<CreateAtom extends (...args: unknown[]) => Atom<unknown>>(createAtom: CreateAtom): CreateAtom;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,12 @@
import type { Atom } from 'jotai/vanilla';
export type Loadable<Value> = {
state: 'loading';
} | {
state: 'hasError';
error: unknown;
} | {
state: 'hasData';
data: Awaited<Value>;
};
export declare function loadable<Value>(anAtom: Atom<Value>): Atom<Loadable<Value>>;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,3 @@
import type { Atom } from 'jotai/vanilla';
export declare function selectAtom<Value, Slice>(anAtom: Atom<Value>, selector: (v: Value, prevSlice?: Slice) => Slice, equalityFn?: (a: Slice, b: Slice) => boolean): Atom<Slice>;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,21 @@
import type { Atom, PrimitiveAtom, WritableAtom } from 'jotai/vanilla';
type SplitAtomAction<Item> = {
type: 'remove';
atom: PrimitiveAtom<Item>;
} | {
type: 'insert';
value: Item;
before?: PrimitiveAtom<Item>;
} | {
type: 'move';
atom: PrimitiveAtom<Item>;
before?: PrimitiveAtom<Item>;
};
export declare function splitAtom<Item, Key>(arrAtom: WritableAtom<Item[], [
Item[]
], void>, keyExtractor?: (item: Item) => Key): WritableAtom<PrimitiveAtom<Item>[], [
SplitAtomAction<Item>
], void>;
export declare function splitAtom<Item, Key>(arrAtom: Atom<Item[]>, keyExtractor?: (item: Item) => Key): Atom<Atom<Item>[]>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,6 @@
import type { Atom, WritableAtom } from 'jotai/vanilla';
export declare function unwrap<Value, Args extends unknown[], Result>(anAtom: WritableAtom<Value, Args, Result>): WritableAtom<Awaited<Value> | undefined, Args, Result>;
export declare function unwrap<Value, Args extends unknown[], Result, PendingValue>(anAtom: WritableAtom<Value, Args, Result>, fallback: (prev?: Awaited<Value>) => PendingValue): WritableAtom<Awaited<Value> | PendingValue, Args, Result>;
export declare function unwrap<Value>(anAtom: Atom<Value>): Atom<Awaited<Value> | undefined>;
export declare function unwrap<Value, PendingValue>(anAtom: Atom<Value>, fallback: (prev?: Awaited<Value>) => PendingValue): Atom<Awaited<Value> | PendingValue>;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

3
node_modules/jotai/ts3.8/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from 'jotai/vanilla';
export * from 'jotai/react';
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

5
node_modules/jotai/ts3.8/react.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export { Provider, useStore } from './react/Provider';
export { useAtomValue } from './react/useAtomValue';
export { useSetAtom } from './react/useSetAtom';
export { useAtom } from './react/useAtom';
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

17
node_modules/jotai/ts3.8/react/Provider.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import type { FunctionComponent, ReactElement, ReactNode } from 'react';
import { createStore } from 'jotai/vanilla';
type Store = ReturnType<typeof createStore>;
type Options = {
store?: Store;
};
export declare function useStore(options?: Options): Store;
export declare function Provider({ children, store, }: {
children?: ReactNode;
store?: Store;
}): ReactElement<{
value: Store | undefined;
}, FunctionComponent<{
value: Store | undefined;
}>>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

28
node_modules/jotai/ts3.8/react/useAtom.d.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import type { Atom, ExtractAtomArgs, ExtractAtomResult, ExtractAtomValue, PrimitiveAtom, SetStateAction, WritableAtom } from 'jotai/vanilla';
import { useAtomValue } from './useAtomValue';
type SetAtom<Args extends unknown[], Result> = (...args: Args) => Result;
type Options = Parameters<typeof useAtomValue>[1];
export declare function useAtom<Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, options?: Options): [
Awaited<Value>,
SetAtom<Args, Result>
];
export declare function useAtom<Value>(atom: PrimitiveAtom<Value>, options?: Options): [
Awaited<Value>,
SetAtom<[
SetStateAction<Value>
], void>
];
export declare function useAtom<Value>(atom: Atom<Value>, options?: Options): [
Awaited<Value>,
never
];
export declare function useAtom<AtomType extends WritableAtom<unknown, never[], unknown>>(atom: AtomType, options?: Options): [
Awaited<ExtractAtomValue<AtomType>>,
SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>
];
export declare function useAtom<AtomType extends Atom<unknown>>(atom: AtomType, options?: Options): [
Awaited<ExtractAtomValue<AtomType>>,
never
];
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

10
node_modules/jotai/ts3.8/react/useAtomValue.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import type { Atom, ExtractAtomValue } from 'jotai/vanilla';
import { useStore } from './Provider';
type Options = Parameters<typeof useStore>[0] & {
delay?: number;
unstable_promiseStatus?: boolean;
};
export declare function useAtomValue<Value>(atom: Atom<Value>, options?: Options): Awaited<Value>;
export declare function useAtomValue<AtomType extends Atom<unknown>>(atom: AtomType, options?: Options): Awaited<ExtractAtomValue<AtomType>>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

8
node_modules/jotai/ts3.8/react/useSetAtom.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import type { ExtractAtomArgs, ExtractAtomResult, WritableAtom } from 'jotai/vanilla';
import { useStore } from './Provider';
type SetAtom<Args extends unknown[], Result> = (...args: Args) => Result;
type Options = Parameters<typeof useStore>[0];
export declare function useSetAtom<Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, options?: Options): SetAtom<Args, Result>;
export declare function useSetAtom<AtomType extends WritableAtom<unknown, never[], unknown>>(atom: AtomType, options?: Options): SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

5
node_modules/jotai/ts3.8/react/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export { useResetAtom } from './utils/useResetAtom';
export { useReducerAtom } from './utils/useReducerAtom';
export { useAtomCallback } from './utils/useAtomCallback';
export { useHydrateAtoms } from './utils/useHydrateAtoms';
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,6 @@
import { useSetAtom } from 'jotai/react';
import type { Getter, Setter } from 'jotai/vanilla';
type Options = Parameters<typeof useSetAtom>[1];
export declare function useAtomCallback<Result, Args extends unknown[]>(callback: (get: Getter, set: Setter, ...arg: Args) => Result, options?: Options): (...args: Args) => Result;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,27 @@
import { useStore } from 'jotai/react';
import type { WritableAtom } from 'jotai/vanilla';
type Options = Parameters<typeof useStore>[0] & {
dangerouslyForceHydrate?: boolean;
};
type AnyWritableAtom = WritableAtom<any, any[], any>;
type InferAtomTuples<T> = {
[K in keyof T]: T[K] extends readonly [
infer A,
...infer Rest
] ? A extends WritableAtom<unknown, infer Args, unknown> ? Rest extends Args ? readonly [
A,
...Rest
] : never : T[K] : never;
};
export type INTERNAL_InferAtomTuples<T> = InferAtomTuples<T>;
export declare function useHydrateAtoms<T extends (readonly [
AnyWritableAtom,
...unknown[]
])[]>(values: InferAtomTuples<T>, options?: Options): void;
export declare function useHydrateAtoms<T extends Map<AnyWritableAtom, unknown>>(values: T, options?: Options): void;
export declare function useHydrateAtoms<T extends Iterable<readonly [
AnyWritableAtom,
...unknown[]
]>>(values: InferAtomTuples<T>, options?: Options): void;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,21 @@
import { useAtom } from 'jotai/react';
import type { PrimitiveAtom } from 'jotai/vanilla';
type Options = Parameters<typeof useAtom>[1];
/**
* @deprecated please use a recipe instead
* https://github.com/pmndrs/jotai/pull/2467
*/
export declare function useReducerAtom<Value, Action>(anAtom: PrimitiveAtom<Value>, reducer: (v: Value, a?: Action) => Value, options?: Options): [
Value,
(action?: Action) => void
];
/**
* @deprecated please use a recipe instead
* https://github.com/pmndrs/jotai/pull/2467
*/
export declare function useReducerAtom<Value, Action>(anAtom: PrimitiveAtom<Value>, reducer: (v: Value, a: Action) => Value, options?: Options): [
Value,
(action: Action) => void
];
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,9 @@
import { useSetAtom } from 'jotai/react';
import { RESET } from 'jotai/vanilla/utils';
import type { WritableAtom } from 'jotai/vanilla';
type Options = Parameters<typeof useSetAtom>[1];
export declare function useResetAtom<T>(anAtom: WritableAtom<unknown, [
typeof RESET
], T>, options?: Options): () => T;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

3
node_modules/jotai/ts3.8/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from 'jotai/vanilla/utils';
export * from 'jotai/react/utils';
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

5
node_modules/jotai/ts3.8/vanilla.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export { atom } from './vanilla/atom';
export type { Atom, WritableAtom, PrimitiveAtom } from './vanilla/atom';
export { createStore, getDefaultStore, INTERNAL_overrideCreateStore, } from './vanilla/store';
export type { Getter, Setter, ExtractAtomValue, ExtractAtomArgs, ExtractAtomResult, SetStateAction, } from './vanilla/typeUtils';
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

48
node_modules/jotai/ts3.8/vanilla/atom.d.ts generated vendored Normal file
View File

@@ -0,0 +1,48 @@
import type { Store } from './store';
type Getter = <Value>(atom: Atom<Value>) => Value;
type Setter = <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
type SetAtom<Args extends unknown[], Result> = <A extends Args>(...args: A) => Result;
/**
* setSelf is for internal use only and subject to change without notice.
*/
type Read<Value, SetSelf = never> = (get: Getter, options: {
readonly signal: AbortSignal;
readonly setSelf: SetSelf;
}) => Value;
type Write<Args extends unknown[], Result> = (get: Getter, set: Setter, ...args: Args) => Result;
type WithInitialValue<Value> = {
init: Value;
};
type OnUnmount = () => void;
type OnMount<Args extends unknown[], Result> = <S extends SetAtom<Args, Result>>(setAtom: S) => OnUnmount | void;
export interface Atom<Value> {
toString: () => string;
read: Read<Value>;
debugLabel?: string;
/**
* To ONLY be used by Jotai libraries to mark atoms as private. Subject to change.
* @private
*/
debugPrivate?: boolean;
/**
* Fires after atom is referenced by the store for the first time
* This is still an experimental API and subject to change without notice.
*/
unstable_onInit?: (store: Store) => void;
}
export interface WritableAtom<Value, Args extends unknown[], Result> extends Atom<Value> {
read: Read<Value, SetAtom<Args, Result>>;
write: Write<Args, Result>;
onMount?: OnMount<Args, Result>;
}
type SetStateAction<Value> = Value | ((prev: Value) => Value);
export type PrimitiveAtom<Value> = WritableAtom<Value, [
SetStateAction<Value>
], void>;
export declare function atom<Value, Args extends unknown[], Result>(read: Read<Value, SetAtom<Args, Result>>, write: Write<Args, Result>): WritableAtom<Value, Args, Result>;
export declare function atom<Value>(read: Read<Value>): Atom<Value>;
export declare function atom<Value, Args extends unknown[], Result>(initialValue: Value, write: Write<Args, Result>): WritableAtom<Value, Args, Result> & WithInitialValue<Value>;
export declare function atom<Value>(): PrimitiveAtom<Value | undefined> & WithInitialValue<Value | undefined>;
export declare function atom<Value>(initialValue: Value): PrimitiveAtom<Value> & WithInitialValue<Value>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

174
node_modules/jotai/ts3.8/vanilla/internals.d.ts generated vendored Normal file
View File

@@ -0,0 +1,174 @@
import type { Atom, WritableAtom } from './atom';
type AnyValue = unknown;
type AnyError = unknown;
type AnyAtom = Atom<AnyValue>;
type AnyWritableAtom = WritableAtom<AnyValue, unknown[], unknown>;
type OnUnmount = () => void;
type EpochNumber = number;
/**
* Mutable atom state,
* tracked for both mounted and unmounted atoms in a store.
*
* This should be garbage collectable.
* We can mutate it during atom read. (except for fields with TODO)
*/
type AtomState<Value = AnyValue> = {
/**
* Map of atoms that the atom depends on.
* The map value is the epoch number of the dependency.
*/
readonly d: Map<AnyAtom, EpochNumber>;
/**
* Set of atoms with pending promise that depend on the atom.
*
* This may cause memory leaks, but it's for the capability to continue promises
* TODO(daishi): revisit how to handle this
*/
readonly p: Set<AnyAtom>;
/** The epoch number of the atom. */
n: EpochNumber;
/** Atom value */
v?: Value;
/** Atom error */
e?: AnyError;
};
/**
* State tracked for mounted atoms. An atom is considered "mounted" if it has a
* subscriber, or is a transitive dependency of another atom that has a
* subscriber.
* The mounted state of an atom is freed once it is no longer mounted.
*/
type Mounted = {
/** Set of listeners to notify when the atom value changes. */
readonly l: Set<() => void>;
/** Set of mounted atoms that the atom depends on. */
readonly d: Set<AnyAtom>;
/** Set of mounted atoms that depends on the atom. */
readonly t: Set<AnyAtom>;
/** Function to run when the atom is unmounted. */
u?: () => void;
};
type AtomStateMap = {
get(atom: AnyAtom): AtomState | undefined;
set(atom: AnyAtom, atomState: AtomState): void;
};
type MountedMap = {
get(atom: AnyAtom): Mounted | undefined;
has(atom: AnyAtom): boolean;
set(atom: AnyAtom, mounted: Mounted): void;
delete(atom: AnyAtom): void;
};
type InvalidatedAtoms = {
get(atom: AnyAtom): EpochNumber | undefined;
has(atom: AnyAtom): boolean;
set(atom: AnyAtom, n: EpochNumber): void;
delete(atom: AnyAtom): void;
};
type ChangedAtoms = {
readonly size: number;
add(atom: AnyAtom): void;
has(atom: AnyAtom): boolean;
clear(): void;
forEach(callback: (atom: AnyAtom) => void): void;
[Symbol.iterator](): IterableIterator<AnyAtom>;
};
type Callbacks = {
readonly size: number;
add(fn: () => void): void;
clear(): void;
forEach(callback: (fn: () => void) => void): void;
};
type AtomRead = <Value>(store: Store, atom: Atom<Value>, ...params: Parameters<Atom<Value>['read']>) => Value;
type AtomWrite = <Value, Args extends unknown[], Result>(store: Store, atom: WritableAtom<Value, Args, Result>, ...params: Parameters<WritableAtom<Value, Args, Result>['write']>) => Result;
type AtomOnInit = <Value>(store: Store, atom: Atom<Value>) => void;
type AtomOnMount = <Value, Args extends unknown[], Result>(store: Store, atom: WritableAtom<Value, Args, Result>, setAtom: (...args: Args) => Result) => OnUnmount | void;
type EnsureAtomState = <Value>(store: Store, atom: Atom<Value>) => AtomState<Value>;
type FlushCallbacks = (store: Store) => void;
type RecomputeInvalidatedAtoms = (store: Store) => void;
type ReadAtomState = <Value>(store: Store, atom: Atom<Value>) => AtomState<Value>;
type InvalidateDependents = (store: Store, atom: AnyAtom) => void;
type WriteAtomState = <Value, Args extends unknown[], Result>(store: Store, atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
type MountDependencies = (store: Store, atom: AnyAtom) => void;
type MountAtom = <Value>(store: Store, atom: Atom<Value>) => Mounted;
type UnmountAtom = <Value>(store: Store, atom: Atom<Value>) => Mounted | undefined;
type SetAtomStateValueOrPromise = <Value>(store: Store, atom: Atom<Value>, valueOrPromise: Value) => void;
type StoreGet = <Value>(store: Store, atom: Atom<Value>) => Value;
type StoreSet = <Value, Args extends unknown[], Result>(store: Store, atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
type StoreSub = (store: Store, atom: AnyAtom, listener: () => void) => () => void;
type EnhanceBuildingBlocks = (buildingBlocks: Readonly<BuildingBlocks>) => Readonly<BuildingBlocks>;
type Store = {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
};
type BuildingBlocks = [
/*atomStateMap*/ AtomStateMap,
/*mountedMap*/ MountedMap,
/*invalidatedAtoms*/ InvalidatedAtoms,
/*changedAtoms*/ ChangedAtoms,
/*mountCallbacks*/ Callbacks,
/*unmountCallbacks*/ Callbacks,
/*storeHooks*/ StoreHooks,
/*atomRead*/ AtomRead,
/*atomWrite*/ AtomWrite,
/*atomOnInit*/ AtomOnInit,
/*atomOnMount*/ AtomOnMount,
/*ensureAtomState*/ EnsureAtomState,
/*flushCallbacks*/ FlushCallbacks,
/*recomputeInvalidatedAtoms*/ RecomputeInvalidatedAtoms,
/*readAtomState*/ ReadAtomState,
/*invalidateDependents*/ InvalidateDependents,
/*writeAtomState*/ WriteAtomState,
/*mountDependencies*/ MountDependencies,
/*mountAtom*/ MountAtom,
/*unmountAtom*/ UnmountAtom,
/*setAtomStateValueOrPromise*/ SetAtomStateValueOrPromise,
/*storeGet*/ StoreGet,
/*storeSet*/ StoreSet,
/*storeSub*/ StoreSub,
/*enhanceBuildingBlocks*/ EnhanceBuildingBlocks | undefined
];
export type { AtomState as INTERNAL_AtomState, Mounted as INTERNAL_Mounted, AtomStateMap as INTERNAL_AtomStateMap, MountedMap as INTERNAL_MountedMap, InvalidatedAtoms as INTERNAL_InvalidatedAtoms, ChangedAtoms as INTERNAL_ChangedAtoms, Callbacks as INTERNAL_Callbacks, AtomRead as INTERNAL_AtomRead, AtomWrite as INTERNAL_AtomWrite, AtomOnInit as INTERNAL_AtomOnInit, AtomOnMount as INTERNAL_AtomOnMount, EnsureAtomState as INTERNAL_EnsureAtomState, FlushCallbacks as INTERNAL_FlushCallbacks, RecomputeInvalidatedAtoms as INTERNAL_RecomputeInvalidatedAtoms, ReadAtomState as INTERNAL_ReadAtomState, InvalidateDependents as INTERNAL_InvalidateDependents, WriteAtomState as INTERNAL_WriteAtomState, MountDependencies as INTERNAL_MountDependencies, MountAtom as INTERNAL_MountAtom, UnmountAtom as INTERNAL_UnmountAtom, Store as INTERNAL_Store, BuildingBlocks as INTERNAL_BuildingBlocks, StoreHooks as INTERNAL_StoreHooks, };
declare function hasInitialValue<T extends Atom<AnyValue>>(atom: T): atom is T & (T extends Atom<infer Value> ? {
init: Value;
} : never);
declare function isActuallyWritableAtom(atom: AnyAtom): atom is AnyWritableAtom;
declare function isAtomStateInitialized<Value>(atomState: AtomState<Value>): boolean;
declare function returnAtomValue<Value>(atomState: AtomState<Value>): Value;
declare const promiseStateMap: WeakMap<PromiseLike<unknown>, [
/*pending*/ boolean,
/*abortHandlers*/ Set<() => void>
]>;
declare function isPendingPromise(value: unknown): value is PromiseLike<unknown>;
declare function abortPromise<T>(promise: PromiseLike<T>): void;
declare function registerAbortHandler<T>(promise: PromiseLike<T>, abortHandler: () => void): void;
declare function isPromiseLike(p: unknown): p is PromiseLike<unknown>;
declare function addPendingPromiseToDependency(atom: AnyAtom, promise: PromiseLike<AnyValue>, dependencyAtomState: AtomState): void;
declare function getMountedOrPendingDependents(atom: AnyAtom, atomState: AtomState, mountedMap: MountedMap): Set<AnyAtom>;
type StoreHook = {
(): void;
add(callback: () => void): () => void;
};
type StoreHookForAtoms = {
(atom: AnyAtom): void;
add(atom: AnyAtom, callback: () => void): () => void;
add(atom: undefined, callback: (atom: AnyAtom) => void): () => void;
};
/** StoreHooks are an experimental API. */
type StoreHooks = {
/** Listener to notify when the atom is read. */
readonly r?: StoreHookForAtoms;
/** Listener to notify when the atom value is changed. */
readonly c?: StoreHookForAtoms;
/** Listener to notify when the atom is mounted. */
readonly m?: StoreHookForAtoms;
/** Listener to notify when the atom is unmounted. */
readonly u?: StoreHookForAtoms;
/** Listener to notify when callbacks are being flushed. */
readonly f?: StoreHook;
};
declare function initializeStoreHooks(storeHooks: StoreHooks): Required<StoreHooks>;
declare function getBuildingBlocks(store: Store): Readonly<BuildingBlocks>;
declare function buildStore(...buildArgs: Partial<BuildingBlocks>): Store;
export { buildStore as INTERNAL_buildStoreRev2, getBuildingBlocks as INTERNAL_getBuildingBlocksRev2, initializeStoreHooks as INTERNAL_initializeStoreHooksRev2, hasInitialValue as INTERNAL_hasInitialValue, isActuallyWritableAtom as INTERNAL_isActuallyWritableAtom, isAtomStateInitialized as INTERNAL_isAtomStateInitialized, returnAtomValue as INTERNAL_returnAtomValue, promiseStateMap as INTERNAL_promiseStateMap, isPendingPromise as INTERNAL_isPendingPromise, abortPromise as INTERNAL_abortPromise, registerAbortHandler as INTERNAL_registerAbortHandler, isPromiseLike as INTERNAL_isPromiseLike, addPendingPromiseToDependency as INTERNAL_addPendingPromiseToDependency, getMountedOrPendingDependents as INTERNAL_getMountedOrPendingDependents, };
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

6
node_modules/jotai/ts3.8/vanilla/store.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import type { INTERNAL_Store } from 'jotai/vanilla/internals';
export type Store = INTERNAL_Store;
export declare function INTERNAL_overrideCreateStore(fn: (prev: typeof createStore | undefined) => typeof createStore): void;
export declare function createStore(): Store;
export declare function getDefaultStore(): Store;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

8
node_modules/jotai/ts3.8/vanilla/typeUtils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import type { Atom, PrimitiveAtom, WritableAtom } from './atom';
export type Getter = Parameters<Atom<unknown>['read']>[0];
export type Setter = Parameters<WritableAtom<unknown, unknown[], unknown>['write']>[1];
export type ExtractAtomValue<AtomType> = AtomType extends Atom<infer Value> ? Value : never;
export type ExtractAtomArgs<AtomType> = AtomType extends WritableAtom<unknown, infer Args, infer _Result> ? Args : never;
export type ExtractAtomResult<AtomType> = AtomType extends WritableAtom<unknown, infer _Args, infer Result> ? Result : never;
export type SetStateAction<Value> = ExtractAtomArgs<PrimitiveAtom<Value>>[0];
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

15
node_modules/jotai/ts3.8/vanilla/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
export { RESET } from './utils/constants';
export { atomWithReset } from './utils/atomWithReset';
export { atomWithReducer } from './utils/atomWithReducer';
export { atomFamily } from './utils/atomFamily';
export { selectAtom } from './utils/selectAtom';
export { freezeAtom, freezeAtomCreator } from './utils/freezeAtom';
export { splitAtom } from './utils/splitAtom';
export { atomWithDefault } from './utils/atomWithDefault';
export { atomWithStorage, createJSONStorage, withStorageValidator as unstable_withStorageValidator, } from './utils/atomWithStorage';
export { atomWithObservable } from './utils/atomWithObservable';
export { loadable } from './utils/loadable';
export { unwrap } from './utils/unwrap';
export { atomWithRefresh } from './utils/atomWithRefresh';
export { atomWithLazy } from './utils/atomWithLazy';
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

26
node_modules/jotai/ts3.8/vanilla/utils/atomFamily.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import type { Atom } from 'jotai/vanilla';
/**
* in milliseconds
*/
type CreatedAt = number;
type ShouldRemove<Param> = (createdAt: CreatedAt, param: Param) => boolean;
type Cleanup = () => void;
type Callback<Param, AtomType> = (event: {
type: 'CREATE' | 'REMOVE';
param: Param;
atom: AtomType;
}) => void;
export interface AtomFamily<Param, AtomType> {
(param: Param): AtomType;
getParams(): Iterable<Param>;
remove(param: Param): void;
setShouldRemove(shouldRemove: ShouldRemove<Param> | null): void;
/**
* fires when a atom is created or removed
* This API is for advanced use cases, and can change without notice.
*/
unstable_listen(callback: Callback<Param, AtomType>): Cleanup;
}
export declare function atomFamily<Param, AtomType extends Atom<unknown>>(initializeAtom: (param: Param) => AtomType, areEqual?: (a: Param, b: Param) => boolean): AtomFamily<Param, AtomType>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,11 @@
import type { WritableAtom } from 'jotai/vanilla';
import { RESET } from './constants';
type Read<Value, Args extends unknown[], Result> = WritableAtom<Value, Args, Result>['read'];
type DefaultSetStateAction<Value> = Value | typeof RESET | ((prev: Value) => Value | typeof RESET);
export declare function atomWithDefault<Value>(getDefault: Read<Value, [
DefaultSetStateAction<Value>
], void>): WritableAtom<Value, [
DefaultSetStateAction<Value>
], void>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,3 @@
import type { PrimitiveAtom } from 'jotai/vanilla';
export declare function atomWithLazy<Value>(makeInitial: () => Value): PrimitiveAtom<Value>;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,37 @@
import type { Atom, Getter, WritableAtom } from 'jotai/vanilla';
type AnyError = unknown;
type Subscription = {
unsubscribe: () => void;
};
type Observer<T> = {
next: (value: T) => void;
error: (error: AnyError) => void;
complete: () => void;
};
type ObservableLike<T> = {
subscribe(observer: Observer<T>): Subscription;
} | {
subscribe(observer: Partial<Observer<T>>): Subscription;
} | {
subscribe(observer: Partial<Observer<T>>): Subscription;
subscribe(next: (value: T) => void): Subscription;
};
type SubjectLike<T> = ObservableLike<T> & Observer<T>;
type Options<Data> = {
initialValue?: Data | (() => Data);
unstable_timeout?: number;
};
type OptionsWithInitialValue<Data> = {
initialValue: Data | (() => Data);
unstable_timeout?: number;
};
export declare function atomWithObservable<Data>(getObservable: (get: Getter) => SubjectLike<Data>, options: OptionsWithInitialValue<Data>): WritableAtom<Data, [
Data
], void>;
export declare function atomWithObservable<Data>(getObservable: (get: Getter) => SubjectLike<Data>, options?: Options<Data>): WritableAtom<Data | Promise<Data>, [
Data
], void>;
export declare function atomWithObservable<Data>(getObservable: (get: Getter) => ObservableLike<Data>, options: OptionsWithInitialValue<Data>): Atom<Data>;
export declare function atomWithObservable<Data>(getObservable: (get: Getter) => ObservableLike<Data>, options?: Options<Data>): Atom<Data | Promise<Data>>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,8 @@
import type { WritableAtom } from 'jotai/vanilla';
export declare function atomWithReducer<Value, Action>(initialValue: Value, reducer: (value: Value, action?: Action) => Value): WritableAtom<Value, [
Action?
], void>;
export declare function atomWithReducer<Value, Action>(initialValue: Value, reducer: (value: Value, action: Action) => Value): WritableAtom<Value, [
Action
], void>;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,10 @@
import type { WritableAtom } from 'jotai/vanilla';
type Read<Value, Args extends unknown[], Result> = WritableAtom<Value, Args, Result>['read'];
type Write<Value, Args extends unknown[], Result> = WritableAtom<Value, Args, Result>['write'];
export declare function atomWithRefresh<Value, Args extends unknown[], Result>(read: Read<Value, Args, Result>, write: Write<Value, Args, Result>): WritableAtom<Value, Args | [
], Result | void>;
export declare function atomWithRefresh<Value>(read: Read<Value, [
], void>): WritableAtom<Value, [
], void>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,11 @@
import type { WritableAtom } from 'jotai/vanilla';
import { RESET } from './constants';
type SetStateActionWithReset<Value> = Value | typeof RESET | ((prev: Value) => Value | typeof RESET);
type WithInitialValue<Value> = {
init: Value;
};
export declare function atomWithReset<Value>(initialValue: Value): WritableAtom<Value, [
SetStateActionWithReset<Value>
], void> & WithInitialValue<Value>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,53 @@
import type { WritableAtom } from 'jotai/vanilla';
import { RESET } from './constants';
type Unsubscribe = () => void;
type Subscribe<Value> = (key: string, callback: (value: Value) => void, initialValue: Value) => Unsubscribe | undefined;
type StringSubscribe = (key: string, callback: (value: string | null) => void) => Unsubscribe | undefined;
type SetStateActionWithReset<Value> = Value | typeof RESET | ((prev: Value) => Value | typeof RESET);
export interface AsyncStorage<Value> {
getItem: (key: string, initialValue: Value) => PromiseLike<Value>;
setItem: (key: string, newValue: Value) => PromiseLike<void>;
removeItem: (key: string) => PromiseLike<void>;
subscribe?: Subscribe<Value>;
}
export interface SyncStorage<Value> {
getItem: (key: string, initialValue: Value) => Value;
setItem: (key: string, newValue: Value) => void;
removeItem: (key: string) => void;
subscribe?: Subscribe<Value>;
}
export interface AsyncStringStorage {
getItem: (key: string) => PromiseLike<string | null>;
setItem: (key: string, newValue: string) => PromiseLike<void>;
removeItem: (key: string) => PromiseLike<void>;
subscribe?: StringSubscribe;
}
export interface SyncStringStorage {
getItem: (key: string) => string | null;
setItem: (key: string, newValue: string) => void;
removeItem: (key: string) => void;
subscribe?: StringSubscribe;
}
export declare function withStorageValidator<Value>(validator: (value: unknown) => value is Value): {
(storage: AsyncStorage<unknown>): AsyncStorage<Value>;
(storage: SyncStorage<unknown>): SyncStorage<Value>;
};
type JsonStorageOptions = {
reviver?: (key: string, value: unknown) => unknown;
replacer?: (key: string, value: unknown) => unknown;
};
export declare function createJSONStorage<Value>(): SyncStorage<Value>;
export declare function createJSONStorage<Value>(getStringStorage: () => AsyncStringStorage, options?: JsonStorageOptions): AsyncStorage<Value>;
export declare function createJSONStorage<Value>(getStringStorage: () => SyncStringStorage, options?: JsonStorageOptions): SyncStorage<Value>;
export declare function atomWithStorage<Value>(key: string, initialValue: Value, storage: AsyncStorage<Value>, options?: {
getOnInit?: boolean;
}): WritableAtom<Value | Promise<Value>, [
SetStateActionWithReset<Value | Promise<Value>>
], Promise<void>>;
export declare function atomWithStorage<Value>(key: string, initialValue: Value, storage?: SyncStorage<Value>, options?: {
getOnInit?: boolean;
}): WritableAtom<Value, [
SetStateActionWithReset<Value>
], void>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,2 @@
export declare const RESET: unique symbol;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,7 @@
import type { Atom } from 'jotai/vanilla';
export declare function freezeAtom<AtomType extends Atom<unknown>>(anAtom: AtomType): AtomType;
/**
* @deprecated Define it on users end
*/
export declare function freezeAtomCreator<CreateAtom extends (...args: unknown[]) => Atom<unknown>>(createAtom: CreateAtom): CreateAtom;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

12
node_modules/jotai/ts3.8/vanilla/utils/loadable.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import type { Atom } from 'jotai/vanilla';
export type Loadable<Value> = {
state: 'loading';
} | {
state: 'hasError';
error: unknown;
} | {
state: 'hasData';
data: Awaited<Value>;
};
export declare function loadable<Value>(anAtom: Atom<Value>): Atom<Loadable<Value>>;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,3 @@
import type { Atom } from 'jotai/vanilla';
export declare function selectAtom<Value, Slice>(anAtom: Atom<Value>, selector: (v: Value, prevSlice?: Slice) => Slice, equalityFn?: (a: Slice, b: Slice) => boolean): Atom<Slice>;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

21
node_modules/jotai/ts3.8/vanilla/utils/splitAtom.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import type { Atom, PrimitiveAtom, WritableAtom } from 'jotai/vanilla';
type SplitAtomAction<Item> = {
type: 'remove';
atom: PrimitiveAtom<Item>;
} | {
type: 'insert';
value: Item;
before?: PrimitiveAtom<Item>;
} | {
type: 'move';
atom: PrimitiveAtom<Item>;
before?: PrimitiveAtom<Item>;
};
export declare function splitAtom<Item, Key>(arrAtom: WritableAtom<Item[], [
Item[]
], void>, keyExtractor?: (item: Item) => Key): WritableAtom<PrimitiveAtom<Item>[], [
SplitAtomAction<Item>
], void>;
export declare function splitAtom<Item, Key>(arrAtom: Atom<Item[]>, keyExtractor?: (item: Item) => Key): Atom<Atom<Item>[]>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

6
node_modules/jotai/ts3.8/vanilla/utils/unwrap.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import type { Atom, WritableAtom } from 'jotai/vanilla';
export declare function unwrap<Value, Args extends unknown[], Result>(anAtom: WritableAtom<Value, Args, Result>): WritableAtom<Awaited<Value> | undefined, Args, Result>;
export declare function unwrap<Value, Args extends unknown[], Result, PendingValue>(anAtom: WritableAtom<Value, Args, Result>, fallback: (prev?: Awaited<Value>) => PendingValue): WritableAtom<Awaited<Value> | PendingValue, Args, Result>;
export declare function unwrap<Value>(anAtom: Atom<Value>): Atom<Awaited<Value> | undefined>;
export declare function unwrap<Value, PendingValue>(anAtom: Atom<Value>, fallback: (prev?: Awaited<Value>) => PendingValue): Atom<Awaited<Value> | PendingValue>;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;