valdres 0.2.0-alpha.26 → 0.2.0-alpha.28
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 +5 -5
- package/dist/types/src/atomFamily.d.ts +1 -1
- package/dist/types/src/selectorFamily.d.ts +1 -1
- package/dist/types/src/types/AtomFamilySelector.d.ts +1 -1
- package/dist/types/src/types/Selector.d.ts +1 -1
- package/dist/types/src/types/SelectorFamily.d.ts +2 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -329,7 +329,10 @@ var globalAtom = (defaultValue, options) => {
|
|
|
329
329
|
label: options?.label,
|
|
330
330
|
onInit,
|
|
331
331
|
onSet,
|
|
332
|
-
setSelf
|
|
332
|
+
setSelf,
|
|
333
|
+
get currentValue() {
|
|
334
|
+
return value;
|
|
335
|
+
}
|
|
333
336
|
};
|
|
334
337
|
return atom;
|
|
335
338
|
};
|
|
@@ -349,10 +352,7 @@ function atom(defaultValue, options) {
|
|
|
349
352
|
// src/lib/atomFamilyAtom.ts
|
|
350
353
|
function atomFamilyAtom(defaultValue, options) {
|
|
351
354
|
if (options.global) {
|
|
352
|
-
return
|
|
353
|
-
...options,
|
|
354
|
-
defaultValue
|
|
355
|
-
};
|
|
355
|
+
return globalAtom(defaultValue, options);
|
|
356
356
|
}
|
|
357
357
|
return {
|
|
358
358
|
...options,
|
|
@@ -4,7 +4,7 @@ import type { FamilyKey } from "./types/FamilyKey";
|
|
|
4
4
|
import type { Selector } from "./types/Selector";
|
|
5
5
|
import type { SelectorFamily } from "./types/SelectorFamily";
|
|
6
6
|
type DefaultValueCallback<Key, Value> = (arg: Key) => Value | Promise<Value>;
|
|
7
|
-
type AtomFamilyDefaultValue<Key, Value> = undefined | Value | DefaultValueCallback<Key, Value> | Selector<Value> | SelectorFamily<
|
|
7
|
+
type AtomFamilyDefaultValue<Key, Value> = undefined | Value | DefaultValueCallback<Key, Value> | Selector<Value> | SelectorFamily<Key, Value>;
|
|
8
8
|
/** [Docs Reference](https://valdres.dev/valdres/api/atomFamily) */
|
|
9
9
|
export declare function atomFamily<Key = FamilyKey, Value = unknown>(defaultValue?: AtomFamilyDefaultValue<Key, Value>, options?: AtomOptions<Value>): AtomFamily<Key, Value>;
|
|
10
10
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { SelectorFamily } from "./types/SelectorFamily";
|
|
2
2
|
import type { SelectorOptions } from "./types/SelectorOptions";
|
|
3
|
-
export declare const selectorFamily: <
|
|
3
|
+
export declare const selectorFamily: <Key, Value>(get: any, options?: SelectorOptions) => SelectorFamily<Key, Value>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Selector } from "./Selector";
|
|
2
2
|
import type { SelectorFamily } from "./SelectorFamily";
|
|
3
3
|
export type AtomFamilySelector<Value = unknown, Key = unknown> = Selector<Value> & {
|
|
4
|
-
family: SelectorFamily<
|
|
4
|
+
family: SelectorFamily<Key, Value>;
|
|
5
5
|
familyKey: Key;
|
|
6
6
|
};
|
|
@@ -3,7 +3,7 @@ import type { SelectorFamily } from "./SelectorFamily";
|
|
|
3
3
|
export type Selector<Value = unknown, FamilyKey = undefined> = {
|
|
4
4
|
get: (get: GetValue, storeId: string) => Value;
|
|
5
5
|
label?: string;
|
|
6
|
-
family?: SelectorFamily<
|
|
6
|
+
family?: SelectorFamily<FamilyKey, Value>;
|
|
7
7
|
familyKey?: FamilyKey;
|
|
8
8
|
onMount?: () => void | (() => void);
|
|
9
9
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { FamilyKey } from "./FamilyKey";
|
|
1
2
|
import type { Selector } from "./Selector";
|
|
2
|
-
export type SelectorFamily<
|
|
3
|
+
export type SelectorFamily<Key = FamilyKey, Value = unknown> = {
|
|
3
4
|
(key: Key, defaultOverride?: any): Selector<Value>;
|
|
4
5
|
__valdresSelectorFamilyMap: Map<Key, Selector<Value, Key>>;
|
|
5
6
|
};
|
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.28",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Eigil Sagafos"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"access": "public",
|
|
40
40
|
"registry": "https://registry.npmjs.org/"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "ee5f438acdbdb9ef0ed120f019242959928ac0e9"
|
|
43
43
|
}
|