valdres 0.1.0-alpha.8 → 0.1.0-alpha.9
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.d.ts +14 -0
- package/dist/src/atom.d.ts +9 -0
- package/dist/src/atomFamily.d.ts +2 -0
- package/dist/src/createStore.d.ts +2 -0
- package/dist/src/getDefaultStore.d.ts +2 -0
- package/dist/src/lib/getState.d.ts +3 -0
- package/dist/src/lib/initAtom.d.ts +4 -0
- package/dist/src/lib/initSelector.d.ts +4 -0
- package/dist/src/lib/propagateUpdatedAtoms.d.ts +3 -0
- package/dist/src/lib/resetAtom.d.ts +3 -0
- package/dist/src/lib/setAtom.d.ts +3 -0
- package/dist/src/lib/setAtoms.d.ts +3 -0
- package/dist/src/lib/stableStringify.d.ts +1 -0
- package/dist/src/lib/subscribe.d.ts +3 -0
- package/dist/src/lib/transaction.d.ts +8 -0
- package/dist/src/lib/unsubscribe.d.ts +3 -0
- package/dist/src/lib/updateSelectorSubscribers.d.ts +3 -0
- package/dist/src/lib/updateStateSubscribers.d.ts +3 -0
- package/dist/src/selector.d.ts +5 -0
- package/dist/src/selectorFamily.d.ts +4 -0
- package/dist/src/types/Atom.d.ts +7 -0
- package/dist/src/types/AtomFamily.d.ts +5 -0
- package/dist/src/types/Family.d.ts +3 -0
- package/dist/src/types/GetValue.d.ts +2 -0
- package/dist/src/types/ResetAtom.d.ts +2 -0
- package/dist/src/types/Selector.d.ts +4 -0
- package/dist/src/types/SelectorFamily.d.ts +1 -0
- package/dist/src/types/SetAtom.d.ts +2 -0
- package/dist/src/types/State.d.ts +3 -0
- package/dist/src/types/Store.d.ts +14 -0
- package/dist/src/types/StoreData.d.ts +7 -0
- package/dist/src/types/SubscribeFn.d.ts +2 -0
- package/dist/src/types/TransactionFn.d.ts +4 -0
- package/dist/src/utils/isAtom.d.ts +2 -0
- package/dist/src/utils/isFamily.d.ts +1 -0
- package/dist/src/utils/isPromiseLike.d.ts +1 -0
- package/dist/src/utils/isSelector.d.ts +3 -0
- package/package.json +4 -2
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { atom } from "./src/atom";
|
|
2
|
+
export { atomFamily } from "./src/atomFamily";
|
|
3
|
+
export { createStore } from "./src/createStore";
|
|
4
|
+
export { getDefaultStore, resetDefaultStore } from "./src/getDefaultStore";
|
|
5
|
+
export { selector } from "./src/selector";
|
|
6
|
+
export { selectorFamily } from "./src/selectorFamily";
|
|
7
|
+
export { isAtom } from "./src/utils/isAtom";
|
|
8
|
+
export { isSelector } from "./src/utils/isSelector";
|
|
9
|
+
export { isFamily } from "./src/utils/isFamily";
|
|
10
|
+
export { isPromiseLike } from "./src/utils/isPromiseLike";
|
|
11
|
+
export type { Atom } from "./src/types/Atom";
|
|
12
|
+
export type { Selector } from "./src/types/Selector";
|
|
13
|
+
export type { State } from "./src/types/State";
|
|
14
|
+
export type { Store } from "./src/types/Store";
|
|
@@ -0,0 +1,9 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StoreData } from "../types/StoreData";
|
|
2
|
+
import type { Selector } from "../types/Selector";
|
|
3
|
+
export declare const reEvaluateSelector: <V>(selector: Selector<V>, data: StoreData) => void;
|
|
4
|
+
export declare const initSelector: <V>(selector: Selector<V>, data: StoreData) => V;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const stableStringify: (x: any) => string | number | boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { State } from "../types/State";
|
|
2
|
+
import type { StoreData } from "../types/StoreData";
|
|
3
|
+
type GetValdresValue = <V>(state: State<V>) => V;
|
|
4
|
+
type SetValdresValue = <V>(state: State<V>, value: V) => void;
|
|
5
|
+
type ResetValdresValue = <V>(state: State<V>) => V;
|
|
6
|
+
type TransactionInterface = (set: SetValdresValue, get: GetValdresValue, reset: ResetValdresValue, commit: () => void) => void;
|
|
7
|
+
export declare const transaction: (callback: TransactionInterface, data: StoreData) => void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SelectorFamily<A, V> = {};
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isFamily: (state: any) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isPromiseLike: (object: any) => boolean;
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valdres",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.9",
|
|
4
4
|
"module": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
5
6
|
"files": [
|
|
6
7
|
"dist"
|
|
7
8
|
],
|
|
8
9
|
"type": "module",
|
|
9
10
|
"scripts": {
|
|
10
11
|
"build": "bun scripts/build.ts",
|
|
12
|
+
"build:types": "tsc index.ts --declaration --emitDeclarationOnly --outDir dist",
|
|
11
13
|
"test": "bun test"
|
|
12
14
|
},
|
|
13
15
|
"dependencies": {
|
|
@@ -24,5 +26,5 @@
|
|
|
24
26
|
"access": "public",
|
|
25
27
|
"registry": "https://registry.npmjs.org/"
|
|
26
28
|
},
|
|
27
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "1324ed703443d3b6bea79193a6e398da5cad0ca0"
|
|
28
30
|
}
|