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

16
node_modules/jotai/esm/react/Provider.d.mts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
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 {};

13
node_modules/jotai/esm/react/useAtom.d.mts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import type { Atom, ExtractAtomArgs, ExtractAtomResult, ExtractAtomValue, PrimitiveAtom, SetStateAction, WritableAtom } from 'jotai/vanilla';
import { useAtomValue } from './useAtomValue.mjs';
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 {};

9
node_modules/jotai/esm/react/useAtomValue.d.mts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import type { Atom, ExtractAtomValue } from 'jotai/vanilla';
import { useStore } from './Provider.mjs';
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 {};

7
node_modules/jotai/esm/react/useSetAtom.d.mts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import type { ExtractAtomArgs, ExtractAtomResult, WritableAtom } from 'jotai/vanilla';
import { useStore } from './Provider.mjs';
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 {};

4
node_modules/jotai/esm/react/utils.d.mts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export { useResetAtom } from './utils/useResetAtom.mjs';
export { useReducerAtom } from './utils/useReducerAtom.mjs';
export { useAtomCallback } from './utils/useAtomCallback.mjs';
export { useHydrateAtoms } from './utils/useHydrateAtoms.mjs';

57
node_modules/jotai/esm/react/utils.mjs generated vendored Normal file
View File

@@ -0,0 +1,57 @@
'use client';
import { useCallback, useMemo } from 'react';
import { useSetAtom, useAtom, useStore } from 'jotai/react';
import { RESET } from 'jotai/vanilla/utils';
import { atom } from 'jotai/vanilla';
function useResetAtom(anAtom, options) {
const setAtom = useSetAtom(anAtom, options);
const resetAtom = useCallback(() => setAtom(RESET), [setAtom]);
return resetAtom;
}
function useReducerAtom(anAtom, reducer, options) {
if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production") {
console.warn(
"[DEPRECATED] useReducerAtom is deprecated and will be removed in the future. Please create your own version using the recipe. https://github.com/pmndrs/jotai/pull/2467"
);
}
const [state, setState] = useAtom(anAtom, options);
const dispatch = useCallback(
(action) => {
setState((prev) => reducer(prev, action));
},
[setState, reducer]
);
return [state, dispatch];
}
function useAtomCallback(callback, options) {
const anAtom = useMemo(
() => atom(null, (get, set, ...args) => callback(get, set, ...args)),
[callback]
);
return useSetAtom(anAtom, options);
}
const hydratedMap = /* @__PURE__ */ new WeakMap();
function useHydrateAtoms(values, options) {
const store = useStore(options);
const hydratedSet = getHydratedSet(store);
for (const [atom, ...args] of values) {
if (!hydratedSet.has(atom) || (options == null ? void 0 : options.dangerouslyForceHydrate)) {
hydratedSet.add(atom);
store.set(atom, ...args);
}
}
}
const getHydratedSet = (store) => {
let hydratedSet = hydratedMap.get(store);
if (!hydratedSet) {
hydratedSet = /* @__PURE__ */ new WeakSet();
hydratedMap.set(store, hydratedSet);
}
return hydratedSet;
};
export { useAtomCallback, useHydrateAtoms, useReducerAtom, useResetAtom };

View File

@@ -0,0 +1,5 @@
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 {};

View File

@@ -0,0 +1,14 @@
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 {};

View File

@@ -0,0 +1,14 @@
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 {};

View File

@@ -0,0 +1,6 @@
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 {};