@depup/jotai 2.18.0-depup.0
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/LICENSE +21 -0
- package/README.md +25 -0
- package/babel/plugin-debug-label.d.ts +5 -0
- package/babel/plugin-debug-label.js +54 -0
- package/babel/plugin-react-refresh.d.ts +5 -0
- package/babel/plugin-react-refresh.js +72 -0
- package/babel/preset.d.ts +6 -0
- package/babel/preset.js +110 -0
- package/babel/utils.d.ts +5 -0
- package/benchmarks/simple-read.d.ts +2 -0
- package/benchmarks/simple-write.d.ts +2 -0
- package/benchmarks/subscribe-write.d.ts +2 -0
- package/changes.json +5 -0
- package/esm/babel/plugin-debug-label.d.mts +5 -0
- package/esm/babel/plugin-debug-label.mjs +103 -0
- package/esm/babel/plugin-react-refresh.d.mts +5 -0
- package/esm/babel/plugin-react-refresh.mjs +121 -0
- package/esm/babel/preset.d.mts +6 -0
- package/esm/babel/preset.mjs +179 -0
- package/esm/babel/utils.d.mts +5 -0
- package/esm/index.d.mts +2 -0
- package/esm/index.mjs +2 -0
- package/esm/react/Provider.d.mts +16 -0
- package/esm/react/useAtom.d.mts +13 -0
- package/esm/react/useAtomValue.d.mts +9 -0
- package/esm/react/useSetAtom.d.mts +7 -0
- package/esm/react/utils/useAtomCallback.d.mts +5 -0
- package/esm/react/utils/useHydrateAtoms.d.mts +14 -0
- package/esm/react/utils/useReducerAtom.d.mts +14 -0
- package/esm/react/utils/useResetAtom.d.mts +6 -0
- package/esm/react/utils.d.mts +4 -0
- package/esm/react/utils.mjs +57 -0
- package/esm/react.d.mts +4 -0
- package/esm/react.mjs +182 -0
- package/esm/utils.d.mts +2 -0
- package/esm/utils.mjs +2 -0
- package/esm/vanilla/atom.d.mts +47 -0
- package/esm/vanilla/internals.d.mts +164 -0
- package/esm/vanilla/internals.mjs +715 -0
- package/esm/vanilla/store.d.mts +5 -0
- package/esm/vanilla/typeUtils.d.mts +7 -0
- package/esm/vanilla/utils/atomFamily.d.mts +55 -0
- package/esm/vanilla/utils/atomWithDefault.d.mts +6 -0
- package/esm/vanilla/utils/atomWithLazy.d.mts +2 -0
- package/esm/vanilla/utils/atomWithObservable.d.mts +32 -0
- package/esm/vanilla/utils/atomWithReducer.d.mts +3 -0
- package/esm/vanilla/utils/atomWithRefresh.d.mts +6 -0
- package/esm/vanilla/utils/atomWithReset.d.mts +8 -0
- package/esm/vanilla/utils/atomWithStorage.d.mts +50 -0
- package/esm/vanilla/utils/constants.d.mts +1 -0
- package/esm/vanilla/utils/freezeAtom.d.mts +6 -0
- package/esm/vanilla/utils/loadable.d.mts +33 -0
- package/esm/vanilla/utils/selectAtom.d.mts +2 -0
- package/esm/vanilla/utils/splitAtom.d.mts +16 -0
- package/esm/vanilla/utils/unwrap.d.mts +5 -0
- package/esm/vanilla/utils.d.mts +14 -0
- package/esm/vanilla/utils.mjs +736 -0
- package/esm/vanilla.d.mts +4 -0
- package/esm/vanilla.mjs +59 -0
- package/index.d.ts +2 -0
- package/index.js +19 -0
- package/package.json +125 -0
- package/react/Provider.d.ts +16 -0
- package/react/useAtom.d.ts +13 -0
- package/react/useAtomValue.d.ts +9 -0
- package/react/useSetAtom.d.ts +7 -0
- package/react/utils/useAtomCallback.d.ts +5 -0
- package/react/utils/useHydrateAtoms.d.ts +14 -0
- package/react/utils/useReducerAtom.d.ts +14 -0
- package/react/utils/useResetAtom.d.ts +6 -0
- package/react/utils.d.ts +4 -0
- package/react/utils.js +100 -0
- package/react.d.ts +4 -0
- package/react.js +182 -0
- package/system/babel/plugin-debug-label.development.js +113 -0
- package/system/babel/plugin-debug-label.production.js +4 -0
- package/system/babel/plugin-react-refresh.development.js +131 -0
- package/system/babel/plugin-react-refresh.production.js +11 -0
- package/system/babel/preset.development.js +189 -0
- package/system/babel/preset.production.js +14 -0
- package/system/index.development.js +27 -0
- package/system/index.production.js +1 -0
- package/system/react/utils.development.js +79 -0
- package/system/react/utils.production.js +2 -0
- package/system/react.development.js +210 -0
- package/system/react.production.js +2 -0
- package/system/utils.development.js +27 -0
- package/system/utils.production.js +1 -0
- package/system/vanilla/internals.development.js +735 -0
- package/system/vanilla/internals.production.js +1 -0
- package/system/vanilla/utils.development.js +764 -0
- package/system/vanilla/utils.production.js +1 -0
- package/system/vanilla.development.js +75 -0
- package/system/vanilla.production.js +1 -0
- package/ts3.8/babel/plugin-debug-label.d.ts +6 -0
- package/ts3.8/babel/plugin-react-refresh.d.ts +6 -0
- package/ts3.8/babel/preset.d.ts +7 -0
- package/ts3.8/babel/utils.d.ts +6 -0
- package/ts3.8/benchmarks/simple-read.d.ts +3 -0
- package/ts3.8/benchmarks/simple-write.d.ts +3 -0
- package/ts3.8/benchmarks/subscribe-write.d.ts +3 -0
- package/ts3.8/esm/babel/plugin-debug-label.d.ts +6 -0
- package/ts3.8/esm/babel/plugin-react-refresh.d.ts +6 -0
- package/ts3.8/esm/babel/preset.d.ts +7 -0
- package/ts3.8/esm/babel/utils.d.ts +6 -0
- package/ts3.8/esm/index.d.ts +3 -0
- package/ts3.8/esm/react/Provider.d.ts +17 -0
- package/ts3.8/esm/react/useAtom.d.ts +28 -0
- package/ts3.8/esm/react/useAtomValue.d.ts +10 -0
- package/ts3.8/esm/react/useSetAtom.d.ts +8 -0
- package/ts3.8/esm/react/utils/useAtomCallback.d.ts +6 -0
- package/ts3.8/esm/react/utils/useHydrateAtoms.d.ts +27 -0
- package/ts3.8/esm/react/utils/useReducerAtom.d.ts +21 -0
- package/ts3.8/esm/react/utils/useResetAtom.d.ts +9 -0
- package/ts3.8/esm/react/utils.d.ts +5 -0
- package/ts3.8/esm/react.d.ts +5 -0
- package/ts3.8/esm/utils.d.ts +3 -0
- package/ts3.8/esm/vanilla/atom.d.ts +48 -0
- package/ts3.8/esm/vanilla/internals.d.ts +165 -0
- package/ts3.8/esm/vanilla/store.d.ts +6 -0
- package/ts3.8/esm/vanilla/typeUtils.d.ts +8 -0
- package/ts3.8/esm/vanilla/utils/atomFamily.d.ts +56 -0
- package/ts3.8/esm/vanilla/utils/atomWithDefault.d.ts +11 -0
- package/ts3.8/esm/vanilla/utils/atomWithLazy.d.ts +3 -0
- package/ts3.8/esm/vanilla/utils/atomWithObservable.d.ts +37 -0
- package/ts3.8/esm/vanilla/utils/atomWithReducer.d.ts +8 -0
- package/ts3.8/esm/vanilla/utils/atomWithRefresh.d.ts +10 -0
- package/ts3.8/esm/vanilla/utils/atomWithReset.d.ts +11 -0
- package/ts3.8/esm/vanilla/utils/atomWithStorage.d.ts +53 -0
- package/ts3.8/esm/vanilla/utils/constants.d.ts +2 -0
- package/ts3.8/esm/vanilla/utils/freezeAtom.d.ts +7 -0
- package/ts3.8/esm/vanilla/utils/loadable.d.ts +34 -0
- package/ts3.8/esm/vanilla/utils/selectAtom.d.ts +3 -0
- package/ts3.8/esm/vanilla/utils/splitAtom.d.ts +21 -0
- package/ts3.8/esm/vanilla/utils/unwrap.d.ts +6 -0
- package/ts3.8/esm/vanilla/utils.d.ts +15 -0
- package/ts3.8/esm/vanilla.d.ts +5 -0
- package/ts3.8/index.d.ts +3 -0
- package/ts3.8/react/Provider.d.ts +17 -0
- package/ts3.8/react/useAtom.d.ts +28 -0
- package/ts3.8/react/useAtomValue.d.ts +10 -0
- package/ts3.8/react/useSetAtom.d.ts +8 -0
- package/ts3.8/react/utils/useAtomCallback.d.ts +6 -0
- package/ts3.8/react/utils/useHydrateAtoms.d.ts +27 -0
- package/ts3.8/react/utils/useReducerAtom.d.ts +21 -0
- package/ts3.8/react/utils/useResetAtom.d.ts +9 -0
- package/ts3.8/react/utils.d.ts +5 -0
- package/ts3.8/react.d.ts +5 -0
- package/ts3.8/utils.d.ts +3 -0
- package/ts3.8/vanilla/atom.d.ts +48 -0
- package/ts3.8/vanilla/internals.d.ts +165 -0
- package/ts3.8/vanilla/store.d.ts +6 -0
- package/ts3.8/vanilla/typeUtils.d.ts +8 -0
- package/ts3.8/vanilla/utils/atomFamily.d.ts +56 -0
- package/ts3.8/vanilla/utils/atomWithDefault.d.ts +11 -0
- package/ts3.8/vanilla/utils/atomWithLazy.d.ts +3 -0
- package/ts3.8/vanilla/utils/atomWithObservable.d.ts +37 -0
- package/ts3.8/vanilla/utils/atomWithReducer.d.ts +8 -0
- package/ts3.8/vanilla/utils/atomWithRefresh.d.ts +10 -0
- package/ts3.8/vanilla/utils/atomWithReset.d.ts +11 -0
- package/ts3.8/vanilla/utils/atomWithStorage.d.ts +53 -0
- package/ts3.8/vanilla/utils/constants.d.ts +2 -0
- package/ts3.8/vanilla/utils/freezeAtom.d.ts +7 -0
- package/ts3.8/vanilla/utils/loadable.d.ts +34 -0
- package/ts3.8/vanilla/utils/selectAtom.d.ts +3 -0
- package/ts3.8/vanilla/utils/splitAtom.d.ts +21 -0
- package/ts3.8/vanilla/utils/unwrap.d.ts +6 -0
- package/ts3.8/vanilla/utils.d.ts +15 -0
- package/ts3.8/vanilla.d.ts +5 -0
- package/ts_version_3.8_and_above_is_required.d.ts +0 -0
- package/umd/babel/plugin-debug-label.development.js +58 -0
- package/umd/babel/plugin-debug-label.production.js +1 -0
- package/umd/babel/plugin-react-refresh.development.js +76 -0
- package/umd/babel/plugin-react-refresh.production.js +1 -0
- package/umd/babel/preset.development.js +114 -0
- package/umd/babel/preset.production.js +1 -0
- package/umd/index.development.js +20 -0
- package/umd/index.production.js +1 -0
- package/umd/react/utils.development.js +101 -0
- package/umd/react/utils.production.js +1 -0
- package/umd/react.development.js +184 -0
- package/umd/react.production.js +1 -0
- package/umd/utils.development.js +20 -0
- package/umd/utils.production.js +1 -0
- package/umd/vanilla/internals.development.js +785 -0
- package/umd/vanilla/internals.production.js +1 -0
- package/umd/vanilla/utils.development.js +858 -0
- package/umd/vanilla/utils.production.js +1 -0
- package/umd/vanilla.development.js +64 -0
- package/umd/vanilla.production.js +1 -0
- package/utils.d.ts +2 -0
- package/utils.js +19 -0
- package/vanilla/atom.d.ts +47 -0
- package/vanilla/internals.d.ts +164 -0
- package/vanilla/internals.js +779 -0
- package/vanilla/store.d.ts +5 -0
- package/vanilla/typeUtils.d.ts +7 -0
- package/vanilla/utils/atomFamily.d.ts +55 -0
- package/vanilla/utils/atomWithDefault.d.ts +6 -0
- package/vanilla/utils/atomWithLazy.d.ts +2 -0
- package/vanilla/utils/atomWithObservable.d.ts +32 -0
- package/vanilla/utils/atomWithReducer.d.ts +3 -0
- package/vanilla/utils/atomWithRefresh.d.ts +6 -0
- package/vanilla/utils/atomWithReset.d.ts +8 -0
- package/vanilla/utils/atomWithStorage.d.ts +50 -0
- package/vanilla/utils/constants.d.ts +1 -0
- package/vanilla/utils/freezeAtom.d.ts +6 -0
- package/vanilla/utils/loadable.d.ts +33 -0
- package/vanilla/utils/selectAtom.d.ts +2 -0
- package/vanilla/utils/splitAtom.d.ts +16 -0
- package/vanilla/utils/unwrap.d.ts +5 -0
- package/vanilla/utils.d.ts +14 -0
- package/vanilla/utils.js +854 -0
- package/vanilla.d.ts +4 -0
- package/vanilla.js +60 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
System.register(['react', 'jotai/vanilla', 'jotai/vanilla/internals'], (function (exports) {
|
|
3
|
+
'use strict';
|
|
4
|
+
var createContext, useContext, useRef, createElement, React, useReducer, useEffect, useDebugValue, useCallback, getDefaultStore, createStore, INTERNAL_getBuildingBlocksRev2;
|
|
5
|
+
return {
|
|
6
|
+
setters: [function (module) {
|
|
7
|
+
createContext = module.createContext;
|
|
8
|
+
useContext = module.useContext;
|
|
9
|
+
useRef = module.useRef;
|
|
10
|
+
createElement = module.createElement;
|
|
11
|
+
React = module.default;
|
|
12
|
+
useReducer = module.useReducer;
|
|
13
|
+
useEffect = module.useEffect;
|
|
14
|
+
useDebugValue = module.useDebugValue;
|
|
15
|
+
useCallback = module.useCallback;
|
|
16
|
+
}, function (module) {
|
|
17
|
+
getDefaultStore = module.getDefaultStore;
|
|
18
|
+
createStore = module.createStore;
|
|
19
|
+
}, function (module) {
|
|
20
|
+
INTERNAL_getBuildingBlocksRev2 = module.INTERNAL_getBuildingBlocksRev2;
|
|
21
|
+
}],
|
|
22
|
+
execute: (function () {
|
|
23
|
+
|
|
24
|
+
exports({
|
|
25
|
+
Provider: Provider,
|
|
26
|
+
useAtom: useAtom,
|
|
27
|
+
useAtomValue: useAtomValue,
|
|
28
|
+
useSetAtom: useSetAtom,
|
|
29
|
+
useStore: useStore
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const StoreContext = createContext(
|
|
33
|
+
void 0
|
|
34
|
+
);
|
|
35
|
+
function useStore(options) {
|
|
36
|
+
const store = useContext(StoreContext);
|
|
37
|
+
return (options == null ? void 0 : options.store) || store || getDefaultStore();
|
|
38
|
+
}
|
|
39
|
+
function Provider({
|
|
40
|
+
children,
|
|
41
|
+
store
|
|
42
|
+
}) {
|
|
43
|
+
const storeRef = useRef(null);
|
|
44
|
+
if (store) {
|
|
45
|
+
return createElement(StoreContext.Provider, { value: store }, children);
|
|
46
|
+
}
|
|
47
|
+
if (storeRef.current === null) {
|
|
48
|
+
storeRef.current = createStore();
|
|
49
|
+
}
|
|
50
|
+
return createElement(
|
|
51
|
+
StoreContext.Provider,
|
|
52
|
+
{
|
|
53
|
+
// TODO: If this is not a false positive, consider using useState instead of useRef like https://github.com/pmndrs/jotai/pull/2771
|
|
54
|
+
// eslint-disable-next-line react-hooks/refs
|
|
55
|
+
value: storeRef.current
|
|
56
|
+
},
|
|
57
|
+
children
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const isPromiseLike = (x) => typeof (x == null ? void 0 : x.then) === "function";
|
|
62
|
+
const attachPromiseStatus = (promise) => {
|
|
63
|
+
if (!promise.status) {
|
|
64
|
+
promise.status = "pending";
|
|
65
|
+
promise.then(
|
|
66
|
+
(v) => {
|
|
67
|
+
promise.status = "fulfilled";
|
|
68
|
+
promise.value = v;
|
|
69
|
+
},
|
|
70
|
+
(e) => {
|
|
71
|
+
promise.status = "rejected";
|
|
72
|
+
promise.reason = e;
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const use = React.use || // A shim for older React versions
|
|
78
|
+
((promise) => {
|
|
79
|
+
if (promise.status === "pending") {
|
|
80
|
+
throw promise;
|
|
81
|
+
} else if (promise.status === "fulfilled") {
|
|
82
|
+
return promise.value;
|
|
83
|
+
} else if (promise.status === "rejected") {
|
|
84
|
+
throw promise.reason;
|
|
85
|
+
} else {
|
|
86
|
+
attachPromiseStatus(promise);
|
|
87
|
+
throw promise;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const continuablePromiseMap = /* @__PURE__ */ new WeakMap();
|
|
91
|
+
const createContinuablePromise = (store, promise, getValue) => {
|
|
92
|
+
const buildingBlocks = INTERNAL_getBuildingBlocksRev2(store);
|
|
93
|
+
const registerAbortHandler = buildingBlocks[26];
|
|
94
|
+
let continuablePromise = continuablePromiseMap.get(promise);
|
|
95
|
+
if (!continuablePromise) {
|
|
96
|
+
continuablePromise = new Promise((resolve, reject) => {
|
|
97
|
+
let curr = promise;
|
|
98
|
+
const onFulfilled = (me) => (v) => {
|
|
99
|
+
if (curr === me) {
|
|
100
|
+
resolve(v);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const onRejected = (me) => (e) => {
|
|
104
|
+
if (curr === me) {
|
|
105
|
+
reject(e);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const onAbort = () => {
|
|
109
|
+
try {
|
|
110
|
+
const nextValue = getValue();
|
|
111
|
+
if (isPromiseLike(nextValue)) {
|
|
112
|
+
continuablePromiseMap.set(nextValue, continuablePromise);
|
|
113
|
+
curr = nextValue;
|
|
114
|
+
nextValue.then(onFulfilled(nextValue), onRejected(nextValue));
|
|
115
|
+
registerAbortHandler(store, nextValue, onAbort);
|
|
116
|
+
} else {
|
|
117
|
+
resolve(nextValue);
|
|
118
|
+
}
|
|
119
|
+
} catch (e) {
|
|
120
|
+
reject(e);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
promise.then(onFulfilled(promise), onRejected(promise));
|
|
124
|
+
registerAbortHandler(store, promise, onAbort);
|
|
125
|
+
});
|
|
126
|
+
continuablePromiseMap.set(promise, continuablePromise);
|
|
127
|
+
}
|
|
128
|
+
return continuablePromise;
|
|
129
|
+
};
|
|
130
|
+
function useAtomValue(atom, options) {
|
|
131
|
+
const { delay, unstable_promiseStatus: promiseStatus = !React.use } = options || {};
|
|
132
|
+
const store = useStore(options);
|
|
133
|
+
const [[valueFromReducer, storeFromReducer, atomFromReducer], rerender] = useReducer(
|
|
134
|
+
(prev) => {
|
|
135
|
+
const nextValue = store.get(atom);
|
|
136
|
+
if (Object.is(prev[0], nextValue) && prev[1] === store && prev[2] === atom) {
|
|
137
|
+
return prev;
|
|
138
|
+
}
|
|
139
|
+
return [nextValue, store, atom];
|
|
140
|
+
},
|
|
141
|
+
void 0,
|
|
142
|
+
() => [store.get(atom), store, atom]
|
|
143
|
+
);
|
|
144
|
+
let value = valueFromReducer;
|
|
145
|
+
if (storeFromReducer !== store || atomFromReducer !== atom) {
|
|
146
|
+
rerender();
|
|
147
|
+
value = store.get(atom);
|
|
148
|
+
}
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
const unsub = store.sub(atom, () => {
|
|
151
|
+
if (promiseStatus) {
|
|
152
|
+
try {
|
|
153
|
+
const value2 = store.get(atom);
|
|
154
|
+
if (isPromiseLike(value2)) {
|
|
155
|
+
attachPromiseStatus(
|
|
156
|
+
createContinuablePromise(store, value2, () => store.get(atom))
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
} catch (e) {
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (typeof delay === "number") {
|
|
163
|
+
setTimeout(rerender, delay);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
rerender();
|
|
167
|
+
});
|
|
168
|
+
rerender();
|
|
169
|
+
return unsub;
|
|
170
|
+
}, [store, atom, delay, promiseStatus]);
|
|
171
|
+
useDebugValue(value);
|
|
172
|
+
if (isPromiseLike(value)) {
|
|
173
|
+
const promise = createContinuablePromise(
|
|
174
|
+
store,
|
|
175
|
+
value,
|
|
176
|
+
() => store.get(atom)
|
|
177
|
+
);
|
|
178
|
+
if (promiseStatus) {
|
|
179
|
+
attachPromiseStatus(promise);
|
|
180
|
+
}
|
|
181
|
+
return use(promise);
|
|
182
|
+
}
|
|
183
|
+
return value;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function useSetAtom(atom, options) {
|
|
187
|
+
const store = useStore(options);
|
|
188
|
+
const setAtom = useCallback(
|
|
189
|
+
(...args) => {
|
|
190
|
+
if (!("write" in atom)) {
|
|
191
|
+
throw new Error("not writable atom");
|
|
192
|
+
}
|
|
193
|
+
return store.set(atom, ...args);
|
|
194
|
+
},
|
|
195
|
+
[store, atom]
|
|
196
|
+
);
|
|
197
|
+
return setAtom;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function useAtom(atom, options) {
|
|
201
|
+
return [
|
|
202
|
+
useAtomValue(atom, options),
|
|
203
|
+
// We do wrong type assertion here, which results in throwing an error.
|
|
204
|
+
useSetAtom(atom, options)
|
|
205
|
+
];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
})
|
|
209
|
+
};
|
|
210
|
+
}));
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
System.register(["react","jotai/vanilla","jotai/vanilla/internals"],(function(V){"use strict";var y,k,p,v,d,C,E,j,m,x,P,w;return{setters:[function(s){y=s.createContext,k=s.useContext,p=s.useRef,v=s.createElement,d=s.default,C=s.useReducer,E=s.useEffect,j=s.useDebugValue,m=s.useCallback},function(s){x=s.getDefaultStore,P=s.createStore},function(s){w=s.INTERNAL_getBuildingBlocksRev2}],execute:(function(){V({Provider:L,useAtom:_,useAtomValue:D,useSetAtom:N,useStore:S});const s=y(void 0);function S(t){const e=k(s);return(t==null?void 0:t.store)||e||x()}function L({children:t,store:e}){const n=p(null);return e?v(s.Provider,{value:e},t):(n.current===null&&(n.current=P()),v(s.Provider,{value:n.current},t))}const h=t=>typeof(t==null?void 0:t.then)=="function",A=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},T=d.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(A(t),t)}),b=new WeakMap,B=(t,e,n)=>{const c=w(t)[26];let r=b.get(e);return r||(r=new Promise((f,g)=>{let l=e;const i=u=>R=>{l===u&&f(R)},a=u=>R=>{l===u&&g(R)},o=()=>{try{const u=n();h(u)?(b.set(u,r),l=u,u.then(i(u),a(u)),c(t,u,o)):f(u)}catch(u){g(u)}};e.then(i(e),a(e)),c(t,e,o)}),b.set(e,r)),r};function D(t,e){const{delay:n,unstable_promiseStatus:c=!d.use}=e||{},r=S(e),[[f,g,l],i]=C(o=>{const u=r.get(t);return Object.is(o[0],u)&&o[1]===r&&o[2]===t?o:[u,r,t]},void 0,()=>[r.get(t),r,t]);let a=f;if((g!==r||l!==t)&&(i(),a=r.get(t)),E(()=>{const o=r.sub(t,()=>{if(c)try{const u=r.get(t);h(u)&&A(B(r,u,()=>r.get(t)))}catch(u){}if(typeof n=="number"){setTimeout(i,n);return}i()});return i(),o},[r,t,n,c]),j(a),h(a)){const o=B(r,a,()=>r.get(t));return c&&A(o),T(o)}return a}function N(t,e){const n=S(e);return m((...c)=>n.set(t,...c),[n,t])}function _(t,e){return[D(t,e),N(t,e)]}})}}));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
System.register(['jotai/vanilla/utils', 'jotai/react/utils'], (function (exports) {
|
|
2
|
+
'use strict';
|
|
3
|
+
var _starExcludes = {
|
|
4
|
+
__proto__: null,
|
|
5
|
+
default: 1
|
|
6
|
+
};
|
|
7
|
+
return {
|
|
8
|
+
setters: [function (module) {
|
|
9
|
+
var setter = { __proto__: null };
|
|
10
|
+
for (var name in module) {
|
|
11
|
+
if (!_starExcludes[name]) setter[name] = module[name];
|
|
12
|
+
}
|
|
13
|
+
exports(setter);
|
|
14
|
+
}, function (module) {
|
|
15
|
+
var setter = { __proto__: null };
|
|
16
|
+
for (var name in module) {
|
|
17
|
+
if (!_starExcludes[name]) setter[name] = module[name];
|
|
18
|
+
}
|
|
19
|
+
exports(setter);
|
|
20
|
+
}],
|
|
21
|
+
execute: (function () {
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
})
|
|
26
|
+
};
|
|
27
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
System.register(["jotai/vanilla/utils","jotai/react/utils"],(function(_){"use strict";var u={__proto__:null,default:1};return{setters:[function(r){var i={__proto__:null};for(var t in r)u[t]||(i[t]=r[t]);_(i)},function(r){var i={__proto__:null};for(var t in r)u[t]||(i[t]=r[t]);_(i)}],execute:(function(){})}}));
|