valdres 0.2.0-alpha.74 → 0.2.0-alpha.75
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 +23 -19
- package/dist/types/src/atomFamily.d.ts +2 -3
- package/dist/types/src/indexConstructor.d.ts +1 -2
- package/dist/types/src/lib/atomFamilyAtom.d.ts +3 -3
- package/dist/types/src/lib/createAtomFamily.d.ts +1 -1
- package/dist/types/src/lib/createGlobalAtomFamily.d.ts +3 -4
- package/dist/types/src/lib/getState.d.ts +3 -3
- package/dist/types/src/lib/initAtom.d.ts +1 -1
- package/dist/types/src/lib/stringifyFamilyArgs.d.ts +1 -0
- package/dist/types/src/lib/updateStateSubscribers.d.ts +1 -1
- package/dist/types/src/selector.d.ts +1 -1
- package/dist/types/src/selectorFamily.d.ts +2 -2
- package/dist/types/src/types/AtomFamily.d.ts +6 -7
- package/dist/types/src/types/AtomFamilyAtom.d.ts +3 -3
- package/dist/types/src/types/AtomFamilyDefaultValue.d.ts +2 -2
- package/dist/types/src/types/AtomFamilyGlobalAtom.d.ts +1 -1
- package/dist/types/src/types/AtomFamilySelector.d.ts +3 -3
- package/dist/types/src/types/EqualFunc.d.ts +1 -1
- package/dist/types/src/types/Family.d.ts +1 -1
- package/dist/types/src/types/GetValue.d.ts +3 -3
- package/dist/types/src/types/Selector.d.ts +4 -4
- package/dist/types/src/types/SelectorFamily.d.ts +3 -4
- package/dist/types/src/types/SelectorOptions.d.ts +1 -1
- package/dist/types/src/types/State.d.ts +1 -1
- package/dist/types/src/types/Store.d.ts +2 -2
- package/dist/types/src/types/SubscribeFn.d.ts +2 -2
- package/dist/types/src/utils/isAtomFamily.d.ts +1 -1
- package/dist/types/src/utils/isFamily.d.ts +1 -1
- package/dist/types/src/utils/isFamilyAtom.d.ts +1 -1
- package/dist/types/src/utils/isFamilySelector.d.ts +1 -1
- package/dist/types/src/utils/isFamilyState.d.ts +1 -1
- package/dist/types/src/utils/isSelectorFamily.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -113,7 +113,7 @@ var updateStateSubscribers = (state, data) => {
|
|
|
113
113
|
const familySubscriptions = data.subscriptions.get(state.family);
|
|
114
114
|
if (familySubscriptions?.size) {
|
|
115
115
|
for (const subscribtion of familySubscriptions) {
|
|
116
|
-
subscribtion.callback(state.familyKey);
|
|
116
|
+
subscribtion.callback(...state.familyKey);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -422,8 +422,7 @@ var updateSelectorSubscribers = (selector, data) => {
|
|
|
422
422
|
const newValue = initSelector(selector, data);
|
|
423
423
|
if (selector.equal(newValue, oldValue))
|
|
424
424
|
return;
|
|
425
|
-
} catch (e) {
|
|
426
|
-
}
|
|
425
|
+
} catch (e) {}
|
|
427
426
|
}
|
|
428
427
|
if (subscribtions?.size) {
|
|
429
428
|
for (const subscribtion of subscribtions) {
|
|
@@ -432,7 +431,7 @@ var updateSelectorSubscribers = (selector, data) => {
|
|
|
432
431
|
}
|
|
433
432
|
if (familySubscriptions?.size) {
|
|
434
433
|
for (const subscribtion of familySubscriptions) {
|
|
435
|
-
subscribtion.callback(selector.familyKey);
|
|
434
|
+
subscribtion.callback(...selector.familyKey);
|
|
436
435
|
}
|
|
437
436
|
}
|
|
438
437
|
};
|
|
@@ -1014,6 +1013,11 @@ var stableStringify = (x) => {
|
|
|
1014
1013
|
return stableStringifyRecurse(x);
|
|
1015
1014
|
};
|
|
1016
1015
|
|
|
1016
|
+
// src/lib/stringifyFamilyArgs.ts
|
|
1017
|
+
var stringifyFamilyArgs = (...args) => {
|
|
1018
|
+
return args.length === 1 ? stableStringify(args[0]) : stableStringify(args);
|
|
1019
|
+
};
|
|
1020
|
+
|
|
1017
1021
|
// src/lib/createAtomFamily.ts
|
|
1018
1022
|
var createOptions = (options = {}, family, familyKey, keyStringified) => {
|
|
1019
1023
|
if (options.name) {
|
|
@@ -1028,27 +1032,27 @@ var createOptions = (options = {}, family, familyKey, keyStringified) => {
|
|
|
1028
1032
|
return { equal, ...options, family, familyKey };
|
|
1029
1033
|
}
|
|
1030
1034
|
};
|
|
1031
|
-
var handleDefaultValue = (defaultValue,
|
|
1035
|
+
var handleDefaultValue = (defaultValue, ...args) => {
|
|
1032
1036
|
if (isSelectorFamily(defaultValue))
|
|
1033
|
-
return defaultValue(
|
|
1037
|
+
return defaultValue(...args);
|
|
1034
1038
|
if (typeof defaultValue === "function")
|
|
1035
|
-
return () => defaultValue(
|
|
1039
|
+
return () => defaultValue(...args);
|
|
1036
1040
|
return defaultValue;
|
|
1037
1041
|
};
|
|
1038
1042
|
var createAtomFamily = (defaultValue, options) => {
|
|
1039
1043
|
const map = new Map;
|
|
1040
1044
|
const keysAtom = atom(new Set);
|
|
1041
|
-
const atomFamily = Object.assign((
|
|
1042
|
-
const keyStringified =
|
|
1045
|
+
const atomFamily = Object.assign((...args) => {
|
|
1046
|
+
const keyStringified = stringifyFamilyArgs(...args);
|
|
1043
1047
|
if (map.has(keyStringified)) {
|
|
1044
1048
|
return map.get(keyStringified);
|
|
1045
1049
|
}
|
|
1046
|
-
const familyAtom = atomFamilyAtom(handleDefaultValue(defaultValue,
|
|
1050
|
+
const familyAtom = atomFamilyAtom(handleDefaultValue(defaultValue, ...args), createOptions(options, atomFamily, args, keyStringified));
|
|
1047
1051
|
map.set(keyStringified, familyAtom);
|
|
1048
1052
|
return familyAtom;
|
|
1049
1053
|
}, {
|
|
1050
1054
|
__valdresAtomFamilyMap: map,
|
|
1051
|
-
release: (
|
|
1055
|
+
release: (...args) => map.delete(stringifyFamilyArgs(...args)),
|
|
1052
1056
|
__keysAtom: keysAtom,
|
|
1053
1057
|
__keysSelector: selector((get) => Array.from(get(keysAtom)))
|
|
1054
1058
|
});
|
|
@@ -1104,11 +1108,11 @@ var index = (family, callback) => {
|
|
|
1104
1108
|
return map.get(termKey);
|
|
1105
1109
|
const itemSelectorMap = new Map;
|
|
1106
1110
|
const selectorMapIndex = selector((get) => {
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1109
|
-
if (itemSelectorMap.has(
|
|
1111
|
+
const array = get(family);
|
|
1112
|
+
array.forEach((args) => {
|
|
1113
|
+
if (itemSelectorMap.has(args))
|
|
1110
1114
|
return;
|
|
1111
|
-
itemSelectorMap.set(
|
|
1115
|
+
itemSelectorMap.set(args, selector((get2) => callback(get2(family(...args)), term)));
|
|
1112
1116
|
});
|
|
1113
1117
|
return itemSelectorMap;
|
|
1114
1118
|
});
|
|
@@ -1140,13 +1144,13 @@ var createOptions2 = (options = {}, family, familyKey, keyStringified) => {
|
|
|
1140
1144
|
return { equal, ...options, family, familyKey };
|
|
1141
1145
|
}
|
|
1142
1146
|
};
|
|
1143
|
-
var selectorFamily = (
|
|
1147
|
+
var selectorFamily = (callback, options) => {
|
|
1144
1148
|
const map = new Map;
|
|
1145
|
-
const selectorFamily2 = (
|
|
1146
|
-
const keyStringified =
|
|
1149
|
+
const selectorFamily2 = (...args) => {
|
|
1150
|
+
const keyStringified = stringifyFamilyArgs(args);
|
|
1147
1151
|
if (map.has(keyStringified))
|
|
1148
1152
|
return map.get(keyStringified);
|
|
1149
|
-
const newSelector = selector((selectorArgs) =>
|
|
1153
|
+
const newSelector = selector((selectorArgs) => callback(...args)(selectorArgs), createOptions2(options, selectorFamily2, args, keyStringified));
|
|
1150
1154
|
map.set(keyStringified, newSelector);
|
|
1151
1155
|
return newSelector;
|
|
1152
1156
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { AtomOptions } from "./types/AtomOptions";
|
|
2
|
-
import type { FamilyKey } from "./types/FamilyKey";
|
|
3
1
|
import type { AtomFamilyDefaultValue } from "./types/AtomFamilyDefaultValue";
|
|
4
|
-
|
|
2
|
+
import type { AtomOptions } from "./types/AtomOptions";
|
|
3
|
+
export declare function atomFamily<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]>(defaultValue?: AtomFamilyDefaultValue<Value, Args>, options?: AtomOptions<Value>): import(".").AtomFamily<Value, Args>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { AtomFamily } from "./types/AtomFamily";
|
|
2
|
-
import type { FamilyKey } from "./types/FamilyKey";
|
|
3
2
|
import type { Selector } from "./types/Selector";
|
|
4
|
-
export declare const index: <
|
|
3
|
+
export declare const index: <Term, Value extends unknown, FamilyArgs extends [any, ...any[]] = [any, ...any[]]>(family: AtomFamily<Value, FamilyArgs>, callback: (value: Value, term: Term) => boolean) => ((term: Term) => Selector<Term[]>);
|
|
@@ -2,7 +2,7 @@ import type { AtomDefaultValue } from "../types/AtomDefaultValue";
|
|
|
2
2
|
import type { AtomFamilyAtom } from "../types/AtomFamilyAtom";
|
|
3
3
|
import type { AtomFamilyGlobalAtom } from "../types/AtomFamilyGlobalAtom";
|
|
4
4
|
import type { AtomOptions } from "../types/AtomOptions";
|
|
5
|
-
export declare function atomFamilyAtom<
|
|
5
|
+
export declare function atomFamilyAtom<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]>(defaultValue: AtomDefaultValue<Value>, options: AtomOptions<Value> & {
|
|
6
6
|
global: true;
|
|
7
|
-
}): AtomFamilyGlobalAtom<
|
|
8
|
-
export declare function atomFamilyAtom<
|
|
7
|
+
}): AtomFamilyGlobalAtom<Value, Args>;
|
|
8
|
+
export declare function atomFamilyAtom<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]>(defaultValue: AtomDefaultValue<Value>, options: AtomOptions<Value>): AtomFamilyAtom<Value, Args>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AtomFamily } from "../types/AtomFamily";
|
|
2
2
|
import type { AtomFamilyDefaultValue } from "../types/AtomFamilyDefaultValue";
|
|
3
3
|
import type { AtomOptions } from "../types/AtomOptions";
|
|
4
|
-
export declare const createAtomFamily: <
|
|
4
|
+
export declare const createAtomFamily: <Value extends unknown, Args extends [any, ...any[]] = [any, ...any[]]>(defaultValue: AtomFamilyDefaultValue<Value, Args>, options?: AtomOptions<Value>) => AtomFamily<Value, Args>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { AtomOptions } from "../types/AtomOptions";
|
|
2
|
-
import type { FamilyKey } from "../types/FamilyKey";
|
|
3
|
-
import type { AtomFamilyDefaultValue } from "../types/AtomFamilyDefaultValue";
|
|
4
1
|
import type { AtomFamily } from "../types/AtomFamily";
|
|
5
|
-
|
|
2
|
+
import type { AtomFamilyDefaultValue } from "../types/AtomFamilyDefaultValue";
|
|
3
|
+
import type { AtomOptions } from "../types/AtomOptions";
|
|
4
|
+
export declare const createGlobalAtomFamily: <Value extends unknown, Args extends [any, ...any[]] = [any, ...any[]]>(defaultValue: AtomFamilyDefaultValue<Value, Args>, options: AtomOptions<Value>) => AtomFamily<Value, Args>;
|
|
@@ -2,6 +2,6 @@ import type { Atom } from "../types/Atom";
|
|
|
2
2
|
import type { AtomFamily } from "../types/AtomFamily";
|
|
3
3
|
import type { Selector } from "../types/Selector";
|
|
4
4
|
import type { StoreData } from "../types/StoreData";
|
|
5
|
-
export declare function getState<
|
|
6
|
-
export declare function getState<
|
|
7
|
-
export declare function getState<
|
|
5
|
+
export declare function getState<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]>(atom: Atom<Value>, data: StoreData, circularDependencySet?: WeakSet<Selector>): Value;
|
|
6
|
+
export declare function getState<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]>(selector: Selector<Value>, data: StoreData, circularDependencySet?: WeakSet<Selector>): Value;
|
|
7
|
+
export declare function getState<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]>(family: AtomFamily<Value, Args>, data: StoreData, circularDependencySet?: WeakSet<Selector>): Args[];
|
|
@@ -2,4 +2,4 @@ import type { Atom } from "../types/Atom";
|
|
|
2
2
|
import type { AtomFamilyAtom } from "../types/AtomFamilyAtom";
|
|
3
3
|
import type { StoreData } from "../types/StoreData";
|
|
4
4
|
export declare const getAtomInitValue: <V = any>(atom: Atom<V>, data: StoreData) => any;
|
|
5
|
-
export declare const initAtom: <
|
|
5
|
+
export declare const initAtom: <Value extends unknown, Args extends [any, ...any[]] = [any, ...any[]]>(atom: Atom<Value> | AtomFamilyAtom<Value, Args>, data: StoreData) => Value;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const stringifyFamilyArgs: (...args: any[]) => string | number | boolean;
|
|
@@ -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:
|
|
3
|
+
export declare const updateStateSubscribers: (state: State, data: StoreData) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { GetValue } from "./types/GetValue";
|
|
2
2
|
import type { Selector } from "./types/Selector";
|
|
3
3
|
import type { SelectorOptions } from "./types/SelectorOptions";
|
|
4
|
-
export declare const selector: <Value,
|
|
4
|
+
export declare const selector: <Value extends unknown, FamilyArgs extends [any, ...any[]] = [any, ...any[]]>(get: (get: GetValue, storeId: string) => Value | Promise<Value>, options?: SelectorOptions<Value>) => Selector<Value, FamilyArgs>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { GetValue } from "./types/GetValue";
|
|
1
2
|
import type { SelectorFamily } from "./types/SelectorFamily";
|
|
2
3
|
import type { SelectorOptions } from "./types/SelectorOptions";
|
|
3
|
-
|
|
4
|
-
export declare const selectorFamily: <Key, Value>(get: (key: Key) => (get: GetValue) => Value, options?: SelectorOptions<Value>) => SelectorFamily<Key, Value>;
|
|
4
|
+
export declare const selectorFamily: <Value extends unknown, Args extends [any, ...any[]] = [any, ...any[]]>(callback: (...args: Args) => (get: GetValue) => Value | Promise<Value>, options?: SelectorOptions<Value>) => SelectorFamily<Value, Args>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { Atom } from "./Atom";
|
|
2
2
|
import type { AtomFamilyAtom } from "./AtomFamilyAtom";
|
|
3
|
-
import type { FamilyKey } from "./FamilyKey";
|
|
4
3
|
import type { Selector } from "./Selector";
|
|
5
|
-
export type AtomFamily<
|
|
6
|
-
(
|
|
7
|
-
release: (
|
|
4
|
+
export type AtomFamily<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]> = {
|
|
5
|
+
(...args: Args): AtomFamilyAtom<Value, Args>;
|
|
6
|
+
release: (...args: Args) => void;
|
|
8
7
|
name?: string;
|
|
9
|
-
__valdresAtomFamilyMap: Map<
|
|
10
|
-
__keysAtom: Atom<Set<
|
|
11
|
-
__keysSelector: Selector<
|
|
8
|
+
__valdresAtomFamilyMap: Map<Value, AtomFamilyAtom<Value, Args>>;
|
|
9
|
+
__keysAtom: Atom<Set<Args>>;
|
|
10
|
+
__keysSelector: Selector<Args[]>;
|
|
12
11
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Atom } from "./Atom";
|
|
2
2
|
import type { AtomFamily } from "./AtomFamily";
|
|
3
|
-
export type AtomFamilyAtom<
|
|
4
|
-
family: AtomFamily<
|
|
5
|
-
familyKey:
|
|
3
|
+
export type AtomFamilyAtom<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]> = Atom<Value> & {
|
|
4
|
+
family: AtomFamily<Value, Args>;
|
|
5
|
+
familyKey: Args;
|
|
6
6
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Selector } from "./Selector";
|
|
2
2
|
import type { SelectorFamily } from "./SelectorFamily";
|
|
3
|
-
type DefaultValueCallback<
|
|
4
|
-
export type AtomFamilyDefaultValue<
|
|
3
|
+
type DefaultValueCallback<Value extends any, Args extends [any, ...any[]]> = (...args: Args) => Value | Promise<Value>;
|
|
4
|
+
export type AtomFamilyDefaultValue<Value extends any, Args extends [any, ...any[]]> = undefined | Value | DefaultValueCallback<Value, Args> | Selector<Value, Args> | SelectorFamily<Value, Args>;
|
|
5
5
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AtomFamilyAtom } from "./AtomFamilyAtom";
|
|
2
2
|
import type { GlobalAtom } from "./GlobalAtom";
|
|
3
|
-
export type AtomFamilyGlobalAtom<
|
|
3
|
+
export type AtomFamilyGlobalAtom<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]> = AtomFamilyAtom<Value, Args> & GlobalAtom<Value>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Selector } from "./Selector";
|
|
2
2
|
import type { SelectorFamily } from "./SelectorFamily";
|
|
3
|
-
export type AtomFamilySelector<Value
|
|
4
|
-
family: SelectorFamily<
|
|
5
|
-
familyKey:
|
|
3
|
+
export type AtomFamilySelector<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]> = Selector<Value> & {
|
|
4
|
+
family: SelectorFamily<Value, Args>;
|
|
5
|
+
familyKey: Args;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type EqualFunc<Value
|
|
1
|
+
export type EqualFunc<Value extends any> = (a: Value, b: Value) => boolean;
|
|
@@ -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<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]> = AtomFamily<Value, Args> | SelectorFamily<Value, Args>;
|
|
@@ -2,7 +2,7 @@ import type { Atom } from "./Atom";
|
|
|
2
2
|
import type { AtomFamily } from "./AtomFamily";
|
|
3
3
|
import type { Selector } from "./Selector";
|
|
4
4
|
export type GetValue = {
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
<
|
|
5
|
+
<Value extends any>(atom: Atom<Value>): Value;
|
|
6
|
+
<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]>(selector: Selector<Value, Args>): Value;
|
|
7
|
+
<Value extends any, Args extends [any, ...any[]]>(family: AtomFamily<Value, Args>): Args[];
|
|
8
8
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { EqualFunc } from "./EqualFunc";
|
|
2
2
|
import type { GetValue } from "./GetValue";
|
|
3
3
|
import type { SelectorFamily } from "./SelectorFamily";
|
|
4
|
-
export type Selector<Value =
|
|
5
|
-
get: (get: GetValue, storeId: string) => Value
|
|
4
|
+
export type Selector<Value extends any = any, FamilyArgs extends [any, ...any[]] = [any, ...any[]]> = {
|
|
5
|
+
get: (get: GetValue, storeId: string) => Value | Promise<Value>;
|
|
6
6
|
equal: EqualFunc<Value>;
|
|
7
7
|
name?: string;
|
|
8
|
-
family?: SelectorFamily<
|
|
9
|
-
familyKey?:
|
|
8
|
+
family?: SelectorFamily<Value, FamilyArgs>;
|
|
9
|
+
familyKey?: FamilyArgs;
|
|
10
10
|
onMount?: () => void | (() => void);
|
|
11
11
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { FamilyKey } from "./FamilyKey";
|
|
2
1
|
import type { Selector } from "./Selector";
|
|
3
|
-
export type SelectorFamily<
|
|
4
|
-
(
|
|
5
|
-
__valdresSelectorFamilyMap: Map<
|
|
2
|
+
export type SelectorFamily<Value extends any, Args extends [any, ...any[]]> = {
|
|
3
|
+
(...args: Args): Selector<Value, Args>;
|
|
4
|
+
__valdresSelectorFamilyMap: Map<Args, Selector<Value, Args>>;
|
|
6
5
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Atom } from "./Atom";
|
|
2
2
|
import type { AtomFamily } from "./AtomFamily";
|
|
3
3
|
import type { Selector } from "./Selector";
|
|
4
|
-
export type State<
|
|
4
|
+
export type State<Value extends any = any, Args extends [any, ...any[]] = [any, ...any[]]> = Atom<Value> | Selector<Value> | AtomFamily<Value, Args>;
|
|
@@ -6,8 +6,8 @@ import type { ScopedStoreData, StoreData } from "./StoreData";
|
|
|
6
6
|
import type { SubscribeFn } from "./SubscribeFn";
|
|
7
7
|
import type { TransactionFn } from "./TransactionFn";
|
|
8
8
|
type SetAtom = {
|
|
9
|
-
<
|
|
10
|
-
<
|
|
9
|
+
<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]>(atom: AtomFamilyAtom<Value, Args>, value: Value): void;
|
|
10
|
+
<Value extends any>(atom: Atom<Value>, value: Value): void;
|
|
11
11
|
};
|
|
12
12
|
export type Store<T = StoreData> = {
|
|
13
13
|
data: T;
|
|
@@ -3,7 +3,7 @@ import type { Family } from "./Family";
|
|
|
3
3
|
import type { Selector } from "./Selector";
|
|
4
4
|
type UnsuscribeFn = () => void;
|
|
5
5
|
export type SubscribeFn = {
|
|
6
|
-
<
|
|
7
|
-
<
|
|
6
|
+
<Value extends any, Args extends [any, ...any[]] = [any, ...any[]]>(state: Family<Value, Args>, callback: (...args: Args) => void, requireDeepEqualCheckBeforeCallback?: boolean): UnsuscribeFn;
|
|
7
|
+
<Value extends any>(state: Atom<Value> | Selector<Value>, callback: () => void, requireDeepEqualCheckBeforeCallback?: boolean): UnsuscribeFn;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { AtomFamily } from "../types/AtomFamily";
|
|
2
|
-
export declare const isAtomFamily: <
|
|
2
|
+
export declare const isAtomFamily: <Value extends unknown, Args extends [any, ...any[]] = [any, ...any[]]>(state: any) => state is AtomFamily<Value, Args>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const isFamily: (state: any) => state is import("..").SelectorFamily<unknown,
|
|
1
|
+
export declare const isFamily: (state: any) => state is import("..").SelectorFamily<unknown, [any, ...any[]]> | import("..").AtomFamily<unknown, [any, ...any[]]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { AtomFamilyAtom } from "../types/AtomFamilyAtom";
|
|
2
|
-
export declare const isFamilyAtom: <
|
|
2
|
+
export declare const isFamilyAtom: <Value extends unknown, Args extends [any, ...any[]] = [any, ...any[]]>(state: any) => state is AtomFamilyAtom<Value, Args>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { AtomFamilySelector } from "../types/AtomFamilySelector";
|
|
2
|
-
export declare const isFamilySelector: <
|
|
2
|
+
export declare const isFamilySelector: <Value extends unknown, Args extends [any, ...any[]] = [any, ...any[]]>(state: any) => state is AtomFamilySelector<Value, Args>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AtomFamilyAtom } from "../types/AtomFamilyAtom";
|
|
2
2
|
import type { AtomFamilySelector } from "../types/AtomFamilySelector";
|
|
3
|
-
export declare const isFamilyState: <
|
|
3
|
+
export declare const isFamilyState: <Value extends unknown, Args extends [any, ...any[]] = [any, ...any[]]>(state: any) => state is AtomFamilyAtom<Value, Args> | AtomFamilySelector<Value, Args>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SelectorFamily } from "../types/SelectorFamily";
|
|
2
|
-
export declare const isSelectorFamily: <
|
|
2
|
+
export declare const isSelectorFamily: <Value extends unknown, Args extends [any, ...any[]] = [any, ...any[]]>(state: any) => state is SelectorFamily<Value, Args>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valdres",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.75",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Eigil Sagafos"
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"access": "public",
|
|
37
37
|
"registry": "https://registry.npmjs.org/"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "c6757088042bf15b35010217442c65f2a5e666a7"
|
|
40
40
|
}
|