valdres 0.2.0-alpha.2 → 0.2.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +527 -259
- package/dist/types/index.d.ts +26 -0
- package/dist/types/src/atom.d.ts +16 -0
- package/dist/types/src/atomFamily.d.ts +10 -0
- package/dist/types/src/createStoreWithSelectorSet.d.ts +2 -0
- package/dist/types/src/lib/atomFamilyAtom.d.ts +8 -0
- package/dist/types/src/lib/createStoreData.d.ts +3 -0
- package/dist/types/src/lib/getState.d.ts +7 -0
- package/dist/types/src/lib/globalAtom.d.ts +4 -0
- package/dist/{src → types/src}/lib/initAtom.d.ts +2 -1
- package/dist/{src → types/src}/lib/initSelector.d.ts +1 -1
- package/dist/types/src/lib/propagateUpdatedAtoms.d.ts +4 -0
- package/dist/types/src/lib/setAtom.d.ts +3 -0
- package/dist/types/src/lib/storeFromStoreData.d.ts +4 -0
- package/dist/{src → types/src}/lib/transaction.d.ts +2 -1
- package/dist/types/src/lib/unsubscribe.d.ts +5 -0
- package/dist/{src → types/src}/lib/updateStateSubscribers.d.ts +1 -1
- package/dist/types/src/selector.d.ts +4 -0
- package/dist/types/src/selectorFamily.d.ts +3 -0
- package/dist/types/src/store.d.ts +1 -0
- package/dist/types/src/types/Atom.d.ts +12 -0
- package/dist/types/src/types/AtomDefaultValue.d.ts +2 -0
- package/dist/types/src/types/AtomFamily.d.ts +12 -0
- package/dist/types/src/types/AtomFamilyAtom.d.ts +6 -0
- package/dist/types/src/types/AtomFamilyGlobalAtom.d.ts +5 -0
- package/dist/types/src/types/AtomFamilySelector.d.ts +6 -0
- package/dist/types/src/types/AtomOnInit.d.ts +2 -0
- package/dist/types/src/types/AtomOnSet.d.ts +2 -0
- package/dist/types/src/types/AtomOptions.d.ts +11 -0
- package/dist/{src → types/src}/types/Family.d.ts +1 -1
- package/dist/types/src/types/FamilyKey.d.ts +3 -0
- package/dist/types/src/types/GetValue.d.ts +8 -0
- package/dist/types/src/types/GlobalAtom.d.ts +5 -0
- package/dist/types/src/types/GlobalAtomSetSelfFunc.d.ts +1 -0
- package/dist/types/src/types/ResetAtom.d.ts +2 -0
- package/dist/types/src/types/Selector.d.ts +9 -0
- package/dist/types/src/types/SelectorFamily.d.ts +5 -0
- package/dist/types/src/types/SelectorOptions.d.ts +3 -0
- package/dist/types/src/types/SetAtom.d.ts +3 -0
- package/dist/types/src/types/SetAtomValue.d.ts +1 -0
- package/dist/types/src/types/Store.d.ts +24 -0
- package/dist/{src → types/src}/types/StoreData.d.ts +9 -1
- package/dist/types/src/types/Subscription.d.ts +1 -0
- package/dist/types/src/utils/isAtom.d.ts +2 -0
- package/dist/types/src/utils/isAtomFamily.d.ts +2 -0
- package/dist/types/src/utils/isFamily.d.ts +1 -0
- package/dist/types/src/utils/isFamilyAtom.d.ts +2 -0
- package/dist/types/src/utils/isFamilySelector.d.ts +2 -0
- package/dist/types/src/utils/isFamilyState.d.ts +3 -0
- package/dist/types/src/utils/isSelector.d.ts +2 -0
- package/dist/types/src/utils/isSelectorFamily.d.ts +2 -0
- package/package.json +12 -7
- package/dist/src/atom.d.ts +0 -9
- package/dist/src/atom.test.d.ts +0 -1
- package/dist/src/atomFamily.d.ts +0 -2
- package/dist/src/atomFamily.test.d.ts +0 -1
- package/dist/src/createStore.d.ts +0 -2
- package/dist/src/createStore.test.d.ts +0 -1
- package/dist/src/getDefaultStore.d.ts +0 -2
- package/dist/src/lib/getState.d.ts +0 -3
- package/dist/src/lib/initAtom.test.d.ts +0 -1
- package/dist/src/lib/initSelector.test.d.ts +0 -1
- package/dist/src/lib/propagateUpdatedAtoms.d.ts +0 -3
- package/dist/src/lib/recursivlyUpdateSelectors.d.ts +0 -1
- package/dist/src/lib/setAtom.d.ts +0 -3
- package/dist/src/lib/setAtom.test.d.ts +0 -1
- package/dist/src/lib/subscribe.test.d.ts +0 -1
- package/dist/src/lib/transaction.test.d.ts +0 -1
- package/dist/src/lib/unsubscribe.d.ts +0 -3
- package/dist/src/selector.d.ts +0 -3
- package/dist/src/selector.test.d.ts +0 -1
- package/dist/src/selectorFamily.d.ts +0 -2
- package/dist/src/selectorFamily.test.d.ts +0 -1
- package/dist/src/types/Atom.d.ts +0 -9
- package/dist/src/types/AtomFamily.d.ts +0 -5
- package/dist/src/types/GetValue.d.ts +0 -2
- package/dist/src/types/ResetAtom.d.ts +0 -2
- package/dist/src/types/Selector.d.ts +0 -8
- package/dist/src/types/SelectorFamily.d.ts +0 -5
- package/dist/src/types/SetAtom.d.ts +0 -2
- package/dist/src/types/Store.d.ts +0 -14
- package/dist/src/utils/isAtom.d.ts +0 -3
- package/dist/src/utils/isFamily.d.ts +0 -1
- package/dist/src/utils/isSelector.d.ts +0 -2
- package/dist/test/utils/wait.d.ts +0 -2
- /package/dist/{src → types/src}/lib/resetAtom.d.ts +0 -0
- /package/dist/{src → types/src}/lib/setAtoms.d.ts +0 -0
- /package/dist/{src → types/src}/lib/stableStringify.d.ts +0 -0
- /package/dist/{src → types/src}/lib/subscribe.d.ts +0 -0
- /package/dist/{src → types/src}/lib/updateSelectorSubscribers.d.ts +0 -0
- /package/dist/{src → types/src}/types/State.d.ts +0 -0
- /package/dist/{src → types/src}/types/SubscribeFn.d.ts +0 -0
- /package/dist/{src → types/src}/types/TransactionFn.d.ts +0 -0
- /package/dist/{src → types/src}/utils/isPromiseLike.d.ts +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { atom } from "./src/atom";
|
|
2
|
+
export { atomFamily } from "./src/atomFamily";
|
|
3
|
+
export { createStoreWithSelectorSet } from "./src/createStoreWithSelectorSet";
|
|
4
|
+
export { selector } from "./src/selector";
|
|
5
|
+
export { selectorFamily } from "./src/selectorFamily";
|
|
6
|
+
export { store } from "./src/store";
|
|
7
|
+
export { isAtom } from "./src/utils/isAtom";
|
|
8
|
+
export { isAtomFamily } from "./src/utils/isAtomFamily";
|
|
9
|
+
export { isFamily } from "./src/utils/isFamily";
|
|
10
|
+
export { isFamilyAtom } from "./src/utils/isFamilyAtom";
|
|
11
|
+
export { isFamilySelector } from "./src/utils/isFamilySelector";
|
|
12
|
+
export { isFamilyState } from "./src/utils/isFamilyState";
|
|
13
|
+
export { isPromiseLike } from "./src/utils/isPromiseLike";
|
|
14
|
+
export { isSelector } from "./src/utils/isSelector";
|
|
15
|
+
export { isSelectorFamily } from "./src/utils/isSelectorFamily";
|
|
16
|
+
export type { Atom } from "./src/types/Atom";
|
|
17
|
+
export type { AtomFamily } from "./src/types/AtomFamily";
|
|
18
|
+
export type { GetValue } from "./src/types/GetValue";
|
|
19
|
+
export type { ResetAtom } from "./src/types/ResetAtom";
|
|
20
|
+
export type { Selector } from "./src/types/Selector";
|
|
21
|
+
export type { SelectorFamily } from "./src/types/SelectorFamily";
|
|
22
|
+
export type { SetAtom } from "./src/types/SetAtom";
|
|
23
|
+
export type { SetAtomValue } from "./src/types/SetAtomValue";
|
|
24
|
+
export type { State } from "./src/types/State";
|
|
25
|
+
export type { Store } from "./src/types/Store";
|
|
26
|
+
export type { StoreData } from "./src/types/StoreData";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Atom } from "./types/Atom";
|
|
2
|
+
import type { AtomDefaultValue } from "./types/AtomDefaultValue";
|
|
3
|
+
import type { AtomOptions } from "./types/AtomOptions";
|
|
4
|
+
import type { GlobalAtom } from "./types/GlobalAtom";
|
|
5
|
+
/**
|
|
6
|
+
* [Docs Reference](https://valdres.dev/valdres/api/atom)
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* const user = atom<string>("Default Value", { label: "userAtom"})
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare function atom<V>(defaultValue: AtomDefaultValue<V>, options: AtomOptions<V> & {
|
|
14
|
+
global: true;
|
|
15
|
+
}): GlobalAtom<V>;
|
|
16
|
+
export declare function atom<V>(defaultValue?: AtomDefaultValue<V>, options?: AtomOptions<V>): Atom<V>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AtomFamily } from "./types/AtomFamily";
|
|
2
|
+
import type { AtomOptions } from "./types/AtomOptions";
|
|
3
|
+
import type { FamilyKey } from "./types/FamilyKey";
|
|
4
|
+
import type { Selector } from "./types/Selector";
|
|
5
|
+
import type { SelectorFamily } from "./types/SelectorFamily";
|
|
6
|
+
type DefaultValueCallback<Key, Value> = (arg: Key) => Value | Promise<Value>;
|
|
7
|
+
type AtomFamilyDefaultValue<Key, Value> = undefined | Value | DefaultValueCallback<Key, Value> | Selector<Value> | SelectorFamily<Value, Key>;
|
|
8
|
+
/** [Docs Reference](https://valdres.dev/valdres/api/atomFamily) */
|
|
9
|
+
export declare function atomFamily<Key = FamilyKey, Value = unknown>(defaultValue?: AtomFamilyDefaultValue<Key, Value>, options?: AtomOptions<Value>): AtomFamily<Key, Value>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AtomDefaultValue } from "../types/AtomDefaultValue";
|
|
2
|
+
import type { AtomFamilyAtom } from "../types/AtomFamilyAtom";
|
|
3
|
+
import type { AtomFamilyGlobalAtom } from "../types/AtomFamilyGlobalAtom";
|
|
4
|
+
import type { AtomOptions } from "../types/AtomOptions";
|
|
5
|
+
export declare function atomFamilyAtom<Key, Value>(defaultValue: AtomDefaultValue<Value>, options: AtomOptions<Value> & {
|
|
6
|
+
global: true;
|
|
7
|
+
}): AtomFamilyGlobalAtom<Key, Value>;
|
|
8
|
+
export declare function atomFamilyAtom<Key, Value>(defaultValue: AtomDefaultValue<Value>, options: AtomOptions<Value>): AtomFamilyAtom<Key, Value>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Atom } from "../types/Atom";
|
|
2
|
+
import type { AtomFamily } from "../types/AtomFamily";
|
|
3
|
+
import type { Selector } from "../types/Selector";
|
|
4
|
+
import type { StoreData } from "../types/StoreData";
|
|
5
|
+
export declare function getState<V, K>(atom: Atom<V>, data: StoreData): V;
|
|
6
|
+
export declare function getState<V, K>(selector: Selector<V>, data: StoreData): V;
|
|
7
|
+
export declare function getState<V, K>(family: AtomFamily<V, K>, data: StoreData): K[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GlobalAtom } from "./../types/GlobalAtom";
|
|
2
|
+
import type { AtomOptions } from "./../types/AtomOptions";
|
|
3
|
+
import type { AtomDefaultValue } from "../types/AtomDefaultValue";
|
|
4
|
+
export declare const globalAtom: <Value = any>(defaultValue: AtomDefaultValue<Value>, options: AtomOptions<Value>) => GlobalAtom<Value>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Atom } from "../types/Atom";
|
|
2
|
+
import type { AtomFamilyAtom } from "../types/AtomFamilyAtom";
|
|
2
3
|
import type { StoreData } from "../types/StoreData";
|
|
3
4
|
export declare const getAtomInitValue: <V>(atom: Atom<V>, data: StoreData) => any;
|
|
4
|
-
export declare const initAtom: <V>(atom: Atom<V>, data: StoreData) => any;
|
|
5
|
+
export declare const initAtom: <V, K>(atom: Atom<V> | AtomFamilyAtom<K, V>, data: StoreData) => any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { StoreData } from "../types/StoreData";
|
|
2
2
|
import type { Selector } from "../types/Selector";
|
|
3
3
|
export declare const reEvaluateSelector: <V>(selector: Selector<V>, data: StoreData) => void;
|
|
4
|
-
export declare const initSelector: <V>(selector: Selector<V>, data: StoreData) => V
|
|
4
|
+
export declare const initSelector: <V>(selector: Selector<V>, data: StoreData) => V | Promise<V>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Atom } from "../types/Atom";
|
|
2
|
+
import type { StoreData } from "../types/StoreData";
|
|
3
|
+
import type { AtomFamilyAtom } from "../types/AtomFamilyAtom";
|
|
4
|
+
export declare const propagateUpdatedAtoms: (atoms: (Atom<any> | AtomFamilyAtom<any, any>)[], data: StoreData) => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ScopedStore, Store } from "../types/Store";
|
|
2
|
+
import type { ScopedStoreData, StoreData } from "../types/StoreData";
|
|
3
|
+
export declare function storeFromStoreData(data: ScopedStoreData, detach: () => void): ScopedStore;
|
|
4
|
+
export declare function storeFromStoreData(data: StoreData): Store;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { State } from "../types/State";
|
|
2
2
|
import type { StoreData } from "../types/StoreData";
|
|
3
|
+
import type { Atom } from "../types/Atom";
|
|
3
4
|
type GetValdresValue = <V>(state: State<V>) => V;
|
|
4
5
|
type SetValdresValue = <V>(state: State<V>, value: V) => void;
|
|
5
|
-
type ResetValdresValue = <V>(
|
|
6
|
+
type ResetValdresValue = <V>(atom: Atom<V>) => V;
|
|
6
7
|
type TransactionInterface = (set: SetValdresValue, get: GetValdresValue, reset: ResetValdresValue, commit: () => void) => void;
|
|
7
8
|
export declare const transaction: (callback: TransactionInterface, data: StoreData) => void;
|
|
8
9
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Family } from "../types/Family";
|
|
2
|
+
import type { State } from "../types/State";
|
|
3
|
+
import type { StoreData } from "../types/StoreData";
|
|
4
|
+
import type { Subscription } from "../types/Subscription";
|
|
5
|
+
export declare const unsubscribe: <V>(state: State<V> | Family<V>, subscription: Subscription, data: StoreData, mount?: any, maxAgeCleanup?: any) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { State } from "../types/State";
|
|
2
2
|
import type { StoreData } from "../types/StoreData";
|
|
3
|
-
export declare const updateStateSubscribers: (state: State, data: StoreData) => void;
|
|
3
|
+
export declare const updateStateSubscribers: <V>(state: State, data: StoreData) => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GetValue } from "./types/GetValue";
|
|
2
|
+
import type { Selector } from "./types/Selector";
|
|
3
|
+
import type { SelectorOptions } from "./types/SelectorOptions";
|
|
4
|
+
export declare const selector: <Value, FamilyKey = undefined>(get: (get: GetValue, storeId: string) => Value, options?: SelectorOptions) => Selector<Value, FamilyKey>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const store: (id?: string) => import("..").Store;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AtomDefaultValue } from "./AtomDefaultValue";
|
|
2
|
+
import type { AtomOnInit } from "./AtomOnInit";
|
|
3
|
+
import type { AtomOnSet } from "./AtomOnSet";
|
|
4
|
+
export type Atom<Value = unknown> = {
|
|
5
|
+
defaultValue?: AtomDefaultValue<Value>;
|
|
6
|
+
label?: string;
|
|
7
|
+
onInit?: AtomOnInit<Value>;
|
|
8
|
+
onSet?: AtomOnSet<Value>;
|
|
9
|
+
onMount?: () => void | (() => void);
|
|
10
|
+
maxAge?: number;
|
|
11
|
+
staleWhileRevalidate?: number;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Atom } from "./Atom";
|
|
2
|
+
import type { AtomFamilyAtom } from "./AtomFamilyAtom";
|
|
3
|
+
import type { FamilyKey } from "./FamilyKey";
|
|
4
|
+
import type { Selector } from "./Selector";
|
|
5
|
+
export type AtomFamily<Key = FamilyKey, Value = unknown> = {
|
|
6
|
+
(key: Key): AtomFamilyAtom<Key, Value>;
|
|
7
|
+
release: (key: Key) => void;
|
|
8
|
+
label?: string;
|
|
9
|
+
__valdresAtomFamilyMap: Map<Key, AtomFamilyAtom<Key, Value>>;
|
|
10
|
+
__keysAtom: Atom<Set<Key>>;
|
|
11
|
+
__keysSelector: Selector<Key[]>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AtomFamilyAtom } from "./AtomFamilyAtom";
|
|
2
|
+
import type { GlobalAtomSetSelfFunc } from "./GlobalAtomSetSelfFunc";
|
|
3
|
+
export type AtomFamilyGlobalAtom<Key = unknown, Value = unknown> = AtomFamilyAtom<Key, Value> & {
|
|
4
|
+
setSelf: GlobalAtomSetSelfFunc<Value>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AtomOnSet } from "./AtomOnSet";
|
|
2
|
+
import type { StoreData } from "./StoreData";
|
|
3
|
+
export type AtomOptions<Value = unknown> = {
|
|
4
|
+
global?: boolean;
|
|
5
|
+
label?: string;
|
|
6
|
+
onInit?: (setSelf: (value: Value) => void, store: StoreData) => void;
|
|
7
|
+
onSet?: AtomOnSet<Value>;
|
|
8
|
+
onMount?: () => () => void;
|
|
9
|
+
maxAge?: number;
|
|
10
|
+
staleWhileRevalidate?: number;
|
|
11
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { SelectorFamily } from "./SelectorFamily";
|
|
2
2
|
import type { AtomFamily } from "./AtomFamily";
|
|
3
|
-
export type Family<
|
|
3
|
+
export type Family<Key, Value = any> = AtomFamily<Key, Value> | SelectorFamily<Key, Value>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Atom } from "./Atom";
|
|
2
|
+
import type { AtomFamily } from "./AtomFamily";
|
|
3
|
+
import type { Selector } from "./Selector";
|
|
4
|
+
export type GetValue = {
|
|
5
|
+
<V>(atom: Atom<V>, scopeId?: string): V;
|
|
6
|
+
<V>(selector: Selector<V>, scopeId?: string): V;
|
|
7
|
+
<V, K>(family: AtomFamily<K, V>, scopeId?: string): K[];
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type GlobalAtomSetSelfFunc<Value = unknown> = (value: Value) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GetValue } from "./GetValue";
|
|
2
|
+
import type { SelectorFamily } from "./SelectorFamily";
|
|
3
|
+
export type Selector<Value = unknown, FamilyKey = undefined> = {
|
|
4
|
+
get: (get: GetValue, storeId: string) => Value;
|
|
5
|
+
label?: string;
|
|
6
|
+
family?: SelectorFamily<Value, FamilyKey>;
|
|
7
|
+
familyKey?: FamilyKey;
|
|
8
|
+
onMount?: () => void | (() => void);
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SetAtomValue<Value> = Value | ((current: Value) => Value);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Atom } from "./Atom";
|
|
2
|
+
import type { AtomFamilyAtom } from "./AtomFamilyAtom";
|
|
3
|
+
import type { GetValue } from "./GetValue";
|
|
4
|
+
import type { ResetAtom } from "./ResetAtom";
|
|
5
|
+
import type { ScopedStoreData, StoreData } from "./StoreData";
|
|
6
|
+
import type { SubscribeFn } from "./SubscribeFn";
|
|
7
|
+
import type { TransactionFn } from "./TransactionFn";
|
|
8
|
+
type SetAtom = {
|
|
9
|
+
<V, K>(atom: AtomFamilyAtom<K, V>, value: V): void;
|
|
10
|
+
<V>(atom: Atom<V>, value: V): void;
|
|
11
|
+
};
|
|
12
|
+
export type Store<T = StoreData> = {
|
|
13
|
+
data: T;
|
|
14
|
+
get: GetValue;
|
|
15
|
+
set: SetAtom;
|
|
16
|
+
sub: SubscribeFn;
|
|
17
|
+
reset: ResetAtom;
|
|
18
|
+
txn: (callback: TransactionFn) => void;
|
|
19
|
+
scope: (scopeId: string) => ScopedStore;
|
|
20
|
+
};
|
|
21
|
+
export type ScopedStore = Store<ScopedStoreData> & {
|
|
22
|
+
detach: () => void;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type RootStoreData = {
|
|
2
2
|
id: string;
|
|
3
3
|
values: WeakMap<WeakKey, any>;
|
|
4
4
|
expiredValues: WeakMap<WeakKey, any>;
|
|
@@ -6,4 +6,12 @@ export type StoreData = {
|
|
|
6
6
|
subscriptionsRequireEqualCheck: WeakMap<WeakKey, boolean>;
|
|
7
7
|
stateConsumers: WeakMap<WeakKey, any>;
|
|
8
8
|
stateDependencies: WeakMap<WeakKey, any>;
|
|
9
|
+
scopes: {
|
|
10
|
+
[scopeId: string]: ScopedStoreData;
|
|
11
|
+
};
|
|
9
12
|
};
|
|
13
|
+
export type ScopedStoreData = RootStoreData & {
|
|
14
|
+
parent: StoreData;
|
|
15
|
+
scopeConsumers: Set<() => void>;
|
|
16
|
+
};
|
|
17
|
+
export type StoreData = RootStoreData | ScopedStoreData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Subscription = {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isFamily: (state: any) => state is import("../..").SelectorFamily<unknown, unknown> | import("../..").AtomFamily<unknown, unknown>;
|
package/package.json
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valdres",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.21",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Eigil Sagafos"
|
|
7
7
|
},
|
|
8
|
+
"homepage": "https://valdres.dev",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/eigilsagafos/valdres.git"
|
|
12
|
+
},
|
|
8
13
|
"type": "module",
|
|
9
14
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
15
|
+
"default": "./dist/index.js",
|
|
16
|
+
"types": "./dist/types/index.d.ts"
|
|
12
17
|
},
|
|
13
18
|
"files": [
|
|
14
19
|
"dist"
|
|
15
20
|
],
|
|
16
21
|
"scripts": {
|
|
17
|
-
"build": "NODE_ENV=production bun
|
|
18
|
-
"build:types": "tsc",
|
|
22
|
+
"build": "NODE_ENV=production bun build index.ts --outdir ./dist --packages external",
|
|
23
|
+
"build:types": "rm -rf dist/types && tsc",
|
|
19
24
|
"test": "bun test"
|
|
20
25
|
},
|
|
21
26
|
"dependencies": {
|
|
@@ -28,11 +33,11 @@
|
|
|
28
33
|
"react": ">=18",
|
|
29
34
|
"react-dom": ">=18",
|
|
30
35
|
"recoil": "0.7.7",
|
|
31
|
-
"typescript": "5.
|
|
36
|
+
"typescript": "5.6.2"
|
|
32
37
|
},
|
|
33
38
|
"publishConfig": {
|
|
34
39
|
"access": "public",
|
|
35
40
|
"registry": "https://registry.npmjs.org/"
|
|
36
41
|
},
|
|
37
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "6d564893ff8e43a913e9d7afa531e83d3d4e69b1"
|
|
38
43
|
}
|
package/dist/src/atom.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Atom } from "./types/Atom";
|
|
2
|
-
type AtomOptions<M = any> = {
|
|
3
|
-
label?: string;
|
|
4
|
-
onInit?: () => void;
|
|
5
|
-
onMount?: () => M;
|
|
6
|
-
onUnmount?: (mountRes?: M) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const atom: <Value, FamilyKey = undefined, MountReturnValue = undefined>(defaultValue?: Value | (() => Value | Promise<Value>), options?: AtomOptions<MountReturnValue>) => Atom<Value, FamilyKey>;
|
|
9
|
-
export {};
|
package/dist/src/atom.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/src/atomFamily.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/src/selector.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/src/types/Atom.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AtomFamily } from "./AtomFamily";
|
|
2
|
-
export type Atom<Value = unknown, FamilyKey = undefined, MountRes = undefined> = {
|
|
3
|
-
defaultValue?: Value | (() => Value | Promise<Value>);
|
|
4
|
-
label?: string;
|
|
5
|
-
family?: AtomFamily<Value, FamilyKey>;
|
|
6
|
-
familyKey?: FamilyKey;
|
|
7
|
-
onMount?: () => MountRes;
|
|
8
|
-
onUnmount?: (mountRes?: MountRes) => void;
|
|
9
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { GetValue } from "./GetValue";
|
|
2
|
-
import type { SelectorFamily } from "./SelectorFamily";
|
|
3
|
-
export type Selector<Value = any, FamilyKey = undefined> = {
|
|
4
|
-
get: (get: GetValue) => Value;
|
|
5
|
-
debugLabel?: string;
|
|
6
|
-
family?: SelectorFamily<Value, FamilyKey>;
|
|
7
|
-
familyKey?: FamilyKey;
|
|
8
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { GetValue } from "./GetValue";
|
|
2
|
-
import type { ResetAtom } from "./ResetAtom";
|
|
3
|
-
import type { SetAtom } from "./SetAtom";
|
|
4
|
-
import type { StoreData } from "./StoreData";
|
|
5
|
-
import type { SubscribeFn } from "./SubscribeFn";
|
|
6
|
-
import type { TransactionFn } from "./TransactionFn";
|
|
7
|
-
export type Store = {
|
|
8
|
-
data: StoreData;
|
|
9
|
-
get: GetValue;
|
|
10
|
-
set: SetAtom;
|
|
11
|
-
sub: SubscribeFn;
|
|
12
|
-
reset: ResetAtom;
|
|
13
|
-
txn: (callback: TransactionFn) => void;
|
|
14
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isFamily: (state: any) => boolean;
|