@hanzogui/use-store 2.0.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 +91 -0
- package/dist/cjs/comparators.cjs +37 -0
- package/dist/cjs/comparators.native.js +46 -0
- package/dist/cjs/comparators.native.js.map +1 -0
- package/dist/cjs/configureUseStore.cjs +30 -0
- package/dist/cjs/configureUseStore.native.js +33 -0
- package/dist/cjs/configureUseStore.native.js.map +1 -0
- package/dist/cjs/constants.cjs +31 -0
- package/dist/cjs/constants.native.js +34 -0
- package/dist/cjs/constants.native.js.map +1 -0
- package/dist/cjs/decorators.cjs +30 -0
- package/dist/cjs/decorators.native.js +33 -0
- package/dist/cjs/decorators.native.js.map +1 -0
- package/dist/cjs/helpers.cjs +55 -0
- package/dist/cjs/helpers.native.js +65 -0
- package/dist/cjs/helpers.native.js.map +1 -0
- package/dist/cjs/index.cjs +40 -0
- package/dist/cjs/index.native.js +54 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/interfaces.cjs +16 -0
- package/dist/cjs/interfaces.native.js +19 -0
- package/dist/cjs/interfaces.native.js.map +1 -0
- package/dist/cjs/observe.cjs +120 -0
- package/dist/cjs/observe.native.js +186 -0
- package/dist/cjs/observe.native.js.map +1 -0
- package/dist/cjs/useStore.cjs +390 -0
- package/dist/cjs/useStore.native.js +544 -0
- package/dist/cjs/useStore.native.js.map +1 -0
- package/dist/cjs/useStoreDebug.cjs +56 -0
- package/dist/cjs/useStoreDebug.native.js +65 -0
- package/dist/cjs/useStoreDebug.native.js.map +1 -0
- package/dist/esm/comparators.mjs +14 -0
- package/dist/esm/comparators.mjs.map +1 -0
- package/dist/esm/comparators.native.js +20 -0
- package/dist/esm/comparators.native.js.map +1 -0
- package/dist/esm/configureUseStore.mjs +6 -0
- package/dist/esm/configureUseStore.mjs.map +1 -0
- package/dist/esm/configureUseStore.native.js +6 -0
- package/dist/esm/configureUseStore.native.js.map +1 -0
- package/dist/esm/constants.mjs +7 -0
- package/dist/esm/constants.mjs.map +1 -0
- package/dist/esm/constants.native.js +7 -0
- package/dist/esm/constants.native.js.map +1 -0
- package/dist/esm/decorators.mjs +7 -0
- package/dist/esm/decorators.mjs.map +1 -0
- package/dist/esm/decorators.native.js +7 -0
- package/dist/esm/decorators.native.js.map +1 -0
- package/dist/esm/helpers.mjs +26 -0
- package/dist/esm/helpers.mjs.map +1 -0
- package/dist/esm/helpers.native.js +33 -0
- package/dist/esm/helpers.native.js.map +1 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index.mjs +14 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +25 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/esm/interfaces.mjs +2 -0
- package/dist/esm/interfaces.mjs.map +1 -0
- package/dist/esm/interfaces.native.js +2 -0
- package/dist/esm/interfaces.native.js.map +1 -0
- package/dist/esm/observe.mjs +85 -0
- package/dist/esm/observe.mjs.map +1 -0
- package/dist/esm/observe.native.js +148 -0
- package/dist/esm/observe.native.js.map +1 -0
- package/dist/esm/useStore.mjs +342 -0
- package/dist/esm/useStore.mjs.map +1 -0
- package/dist/esm/useStore.native.js +493 -0
- package/dist/esm/useStore.native.js.map +1 -0
- package/dist/esm/useStoreDebug.mjs +18 -0
- package/dist/esm/useStoreDebug.mjs.map +1 -0
- package/dist/esm/useStoreDebug.native.js +24 -0
- package/dist/esm/useStoreDebug.native.js.map +1 -0
- package/package.json +47 -0
- package/src/comparators.tsx +18 -0
- package/src/configureUseStore.tsx +7 -0
- package/src/constants.tsx +6 -0
- package/src/decorators.tsx +8 -0
- package/src/helpers.tsx +56 -0
- package/src/index.ts +12 -0
- package/src/interfaces.tsx +46 -0
- package/src/observe.tsx +160 -0
- package/src/useStore.tsx +705 -0
- package/src/useStoreDebug.tsx +41 -0
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
8
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: !0
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
__copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: !0
|
|
30
|
+
}) : target, mod)),
|
|
31
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: !0
|
|
33
|
+
}), mod);
|
|
34
|
+
var useStore_exports = {};
|
|
35
|
+
__export(useStore_exports, {
|
|
36
|
+
allStores: () => allStores,
|
|
37
|
+
createStore: () => createStore,
|
|
38
|
+
createUseStore: () => createUseStore,
|
|
39
|
+
createUseStoreSelector: () => createUseStoreSelector,
|
|
40
|
+
getOrCreateStore: () => getOrCreateStore,
|
|
41
|
+
getStore: () => getStore,
|
|
42
|
+
getStoreInfo: () => getStoreInfo,
|
|
43
|
+
onCreateStore: () => onCreateStore,
|
|
44
|
+
setIsInReaction: () => setIsInReaction,
|
|
45
|
+
trackStoresAccess: () => trackStoresAccess,
|
|
46
|
+
useGlobalStore: () => useGlobalStore,
|
|
47
|
+
useGlobalStoreSelector: () => useGlobalStoreSelector,
|
|
48
|
+
useStore: () => useStore,
|
|
49
|
+
useStoreDebug: () => useStoreDebug,
|
|
50
|
+
useStoreSelector: () => useStoreSelector
|
|
51
|
+
});
|
|
52
|
+
module.exports = __toCommonJS(useStore_exports);
|
|
53
|
+
var import_react = __toESM(require("react"), 1),
|
|
54
|
+
import_comparators = require("./comparators.native.js"),
|
|
55
|
+
import_configureUseStore = require("./configureUseStore.native.js"),
|
|
56
|
+
import_constants = require("./constants.native.js"),
|
|
57
|
+
import_helpers = require("./helpers.native.js"),
|
|
58
|
+
import_useStoreDebug = require("./useStoreDebug.native.js");
|
|
59
|
+
function _instanceof(left, right) {
|
|
60
|
+
return right != null && typeof Symbol < "u" && right[Symbol.hasInstance] ? !!right[Symbol.hasInstance](left) : left instanceof right;
|
|
61
|
+
}
|
|
62
|
+
var idFn = function (_) {
|
|
63
|
+
return _;
|
|
64
|
+
};
|
|
65
|
+
function useStore(StoreKlass, props) {
|
|
66
|
+
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : import_constants.defaultOptions,
|
|
67
|
+
info = getOrCreateStoreInfo(StoreKlass, props, options);
|
|
68
|
+
return useStoreFromInfo(info, options.selector, options);
|
|
69
|
+
}
|
|
70
|
+
function useStoreDebug(StoreKlass, props) {
|
|
71
|
+
return useStore(StoreKlass, props, {
|
|
72
|
+
debug: !0
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function createStore(StoreKlass, props, options) {
|
|
76
|
+
var _getOrCreateStoreInfo;
|
|
77
|
+
return (_getOrCreateStoreInfo = getOrCreateStoreInfo(StoreKlass, props, options)) === null || _getOrCreateStoreInfo === void 0 ? void 0 : _getOrCreateStoreInfo.store;
|
|
78
|
+
}
|
|
79
|
+
function useGlobalStore(instance, debug) {
|
|
80
|
+
var store = instance[import_constants.UNWRAP_PROXY],
|
|
81
|
+
uid = (0, import_helpers.getStoreUid)(store.constructor, store.props),
|
|
82
|
+
info = import_helpers.cache.get(uid);
|
|
83
|
+
if (!info) throw new Error("This store not created using createStore()");
|
|
84
|
+
return useStoreFromInfo(info, void 0, {
|
|
85
|
+
debug
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function useGlobalStoreSelector(instance, selector, debug) {
|
|
89
|
+
var store = instance[import_constants.UNWRAP_PROXY],
|
|
90
|
+
uid = (0, import_helpers.getStoreUid)(store.constructor, store.props),
|
|
91
|
+
info = import_helpers.cache.get(uid);
|
|
92
|
+
if (!info) throw new Error("This store not created using createStore()");
|
|
93
|
+
return useStoreFromInfo(info, selector, {
|
|
94
|
+
debug
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function createUseStore(StoreKlass) {
|
|
98
|
+
return function (props, options) {
|
|
99
|
+
return useStore(StoreKlass, props, options);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function createUseStoreSelector(StoreKlass, selector) {
|
|
103
|
+
return function (props) {
|
|
104
|
+
return useStore(StoreKlass, props, {
|
|
105
|
+
selector
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function useStoreSelector(StoreKlass, selector, props) {
|
|
110
|
+
return useStore(StoreKlass, props, {
|
|
111
|
+
selector
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
var storeAccessTrackers = /* @__PURE__ */new Set();
|
|
115
|
+
function trackStoresAccess(cb) {
|
|
116
|
+
return storeAccessTrackers.add(cb), function () {
|
|
117
|
+
storeAccessTrackers.delete(cb);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function getStore(StoreKlass, props) {
|
|
121
|
+
var _getStoreInfo;
|
|
122
|
+
return (_getStoreInfo = getStoreInfo(StoreKlass, props)) === null || _getStoreInfo === void 0 ? void 0 : _getStoreInfo.store;
|
|
123
|
+
}
|
|
124
|
+
function getOrCreateStore(StoreKlass, props) {
|
|
125
|
+
var _getOrCreateStoreInfo;
|
|
126
|
+
return (_getOrCreateStoreInfo = getOrCreateStoreInfo(StoreKlass, props, {
|
|
127
|
+
refuseCreation: !1
|
|
128
|
+
})) === null || _getOrCreateStoreInfo === void 0 ? void 0 : _getOrCreateStoreInfo.store;
|
|
129
|
+
}
|
|
130
|
+
function getStoreInfo(StoreKlass, props) {
|
|
131
|
+
return getOrCreateStoreInfo(StoreKlass, props, {
|
|
132
|
+
refuseCreation: !0
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
var onCreateListeners = /* @__PURE__ */new Set();
|
|
136
|
+
function onCreateStore(cb) {
|
|
137
|
+
return onCreateListeners.add(cb), function () {
|
|
138
|
+
onCreateListeners.delete(cb);
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function getOrCreateStoreInfo(StoreKlass, props, options, propsKeyCalculated) {
|
|
142
|
+
var _store_mount;
|
|
143
|
+
if (!StoreKlass) return null;
|
|
144
|
+
var uid = (0, import_helpers.getStoreUid)(StoreKlass, propsKeyCalculated ?? props);
|
|
145
|
+
if (!options?.avoidCache && import_helpers.cache.has(uid)) return import_helpers.cache.get(uid);
|
|
146
|
+
if (options?.refuseCreation) throw new Error(`No store exists (${StoreKlass.name}) with props: ${props}`);
|
|
147
|
+
var storeInstance = new StoreKlass(props);
|
|
148
|
+
storeInstance.props = props;
|
|
149
|
+
var getters = {},
|
|
150
|
+
actions = {},
|
|
151
|
+
stateKeys = /* @__PURE__ */new Set(),
|
|
152
|
+
descriptors = (0, import_helpers.getStoreDescriptors)(storeInstance);
|
|
153
|
+
for (var key in descriptors) {
|
|
154
|
+
var descriptor = descriptors[key];
|
|
155
|
+
typeof descriptor.value == "function" ? actions[key] = descriptor.value : typeof descriptor.get == "function" ? getters[key] = descriptor.get : key !== "props" && key[0] !== "_" && stateKeys.add(key);
|
|
156
|
+
}
|
|
157
|
+
var keyComparators = storeInstance._comparators,
|
|
158
|
+
listeners = /* @__PURE__ */new Set(),
|
|
159
|
+
storeInfo = {
|
|
160
|
+
uid,
|
|
161
|
+
keyComparators,
|
|
162
|
+
storeInstance,
|
|
163
|
+
getters,
|
|
164
|
+
stateKeys,
|
|
165
|
+
props,
|
|
166
|
+
actions,
|
|
167
|
+
debug: options?.debug,
|
|
168
|
+
disableTracking: !1,
|
|
169
|
+
gettersState: {
|
|
170
|
+
getCache: /* @__PURE__ */new Map(),
|
|
171
|
+
depsToGetter: /* @__PURE__ */new Map(),
|
|
172
|
+
curGetKeys: /* @__PURE__ */new Set(),
|
|
173
|
+
isGetting: !1
|
|
174
|
+
},
|
|
175
|
+
listeners,
|
|
176
|
+
trackers: /* @__PURE__ */new Set(),
|
|
177
|
+
version: 0,
|
|
178
|
+
subscribe: function (onChanged) {
|
|
179
|
+
return listeners.add(onChanged), function () {
|
|
180
|
+
listeners.delete(onChanged);
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
triggerUpdate: function () {
|
|
184
|
+
storeInfo.version = (storeInfo.version + 1) % Number.MAX_SAFE_INTEGER;
|
|
185
|
+
var _iteratorNormalCompletion = !0,
|
|
186
|
+
_didIteratorError = !1,
|
|
187
|
+
_iteratorError = void 0;
|
|
188
|
+
try {
|
|
189
|
+
for (var _iterator = listeners[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
190
|
+
var cb = _step.value;
|
|
191
|
+
cb();
|
|
192
|
+
}
|
|
193
|
+
} catch (err) {
|
|
194
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
195
|
+
} finally {
|
|
196
|
+
try {
|
|
197
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
198
|
+
} finally {
|
|
199
|
+
if (_didIteratorError) throw _iteratorError;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
store = createProxiedStore(
|
|
205
|
+
// we assign store right after and proxiedStore never accesses it until later on
|
|
206
|
+
storeInfo);
|
|
207
|
+
process.env.NODE_ENV === "development" && (allStores[StoreKlass.name + uid] = store), (_store_mount = store.mount) === null || _store_mount === void 0 || _store_mount.call(store), storeInfo.store = store;
|
|
208
|
+
var result = storeInfo;
|
|
209
|
+
return import_helpers.cache.set(uid, result), onCreateListeners.forEach(function (cb) {
|
|
210
|
+
return cb(result);
|
|
211
|
+
}), result;
|
|
212
|
+
}
|
|
213
|
+
var allStores = {};
|
|
214
|
+
if (process.env.NODE_ENV === "development") {
|
|
215
|
+
var _globalThis, _Store;
|
|
216
|
+
(_globalThis = globalThis)[_Store = "Store"] || (_globalThis[_Store] = allStores);
|
|
217
|
+
}
|
|
218
|
+
var emptyObj = {},
|
|
219
|
+
selectKeys = function (obj, keys) {
|
|
220
|
+
if (!keys.length) return emptyObj;
|
|
221
|
+
var res = {},
|
|
222
|
+
_iteratorNormalCompletion = !0,
|
|
223
|
+
_didIteratorError = !1,
|
|
224
|
+
_iteratorError = void 0;
|
|
225
|
+
try {
|
|
226
|
+
for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
227
|
+
var key = _step.value;
|
|
228
|
+
res[key] = obj[key];
|
|
229
|
+
}
|
|
230
|
+
} catch (err) {
|
|
231
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
232
|
+
} finally {
|
|
233
|
+
try {
|
|
234
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
235
|
+
} finally {
|
|
236
|
+
if (_didIteratorError) throw _iteratorError;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return res;
|
|
240
|
+
},
|
|
241
|
+
isInReaction = !1,
|
|
242
|
+
setIsInReaction = function (val) {
|
|
243
|
+
isInReaction = val;
|
|
244
|
+
};
|
|
245
|
+
function useStoreFromInfo(info, userSelector, options) {
|
|
246
|
+
var store = info?.store,
|
|
247
|
+
internal = import_react.default.useRef(void 0),
|
|
248
|
+
component = (0, import_useStoreDebug.useCurrentComponent)();
|
|
249
|
+
internal.current || (internal.current = {
|
|
250
|
+
component,
|
|
251
|
+
tracked: /* @__PURE__ */new Set(),
|
|
252
|
+
last: null,
|
|
253
|
+
lastKeys: null
|
|
254
|
+
});
|
|
255
|
+
var curInternal = internal.current,
|
|
256
|
+
shouldPrintDebug = options?.debug,
|
|
257
|
+
getSnapshot = import_react.default.useCallback(function () {
|
|
258
|
+
if (!(!info || !store)) {
|
|
259
|
+
var curInternal2 = internal.current,
|
|
260
|
+
isTracking = curInternal2.tracked.size,
|
|
261
|
+
keys = [...(isTracking ? curInternal2.tracked : info.stateKeys)],
|
|
262
|
+
nextKeys = `${info.version}${keys.join("")}${userSelector || ""}`,
|
|
263
|
+
lastKeys = curInternal2.lastKeys;
|
|
264
|
+
if (nextKeys === curInternal2.lastKeys) return curInternal2.last;
|
|
265
|
+
curInternal2.lastKeys = nextKeys;
|
|
266
|
+
var snap;
|
|
267
|
+
info.disableTracking = !0;
|
|
268
|
+
var last = curInternal2.last;
|
|
269
|
+
userSelector ? snap = userSelector(store) : snap = selectKeys(store, keys), info.disableTracking = !1;
|
|
270
|
+
var isUnchanged = !userSelector && !isTracking && last || typeof last < "u" && (0, import_comparators.isEqualSubsetShallow)(last, snap, {
|
|
271
|
+
keyComparators: info.keyComparators
|
|
272
|
+
});
|
|
273
|
+
return shouldPrintDebug && console.info("\u{1F311} getSnapshot", {
|
|
274
|
+
storeState: selectKeys(store, Object.keys(store)),
|
|
275
|
+
userSelector,
|
|
276
|
+
info,
|
|
277
|
+
isUnchanged,
|
|
278
|
+
component,
|
|
279
|
+
keys,
|
|
280
|
+
last,
|
|
281
|
+
snap,
|
|
282
|
+
curInternal: curInternal2,
|
|
283
|
+
nextKeys,
|
|
284
|
+
lastKeys
|
|
285
|
+
}), isUnchanged ? last : (curInternal2.last = snap, snap);
|
|
286
|
+
}
|
|
287
|
+
}, [store]),
|
|
288
|
+
state = import_react.default.useSyncExternalStore(info?.subscribe || idFn, getSnapshot, getSnapshot);
|
|
289
|
+
return !info || !store || !state || userSelector ? state : new Proxy(store, {
|
|
290
|
+
get(target, key) {
|
|
291
|
+
var curVal = Reflect.get(target, key);
|
|
292
|
+
if (isInReaction) return curVal;
|
|
293
|
+
var keyString = key;
|
|
294
|
+
return (info.stateKeys.has(keyString) || keyString in info.getters) && (shouldPrintDebug && console.info("\u{1F440} tracking", keyString), curInternal.tracked.add(keyString)), Reflect.has(state, key) ? Reflect.get(state, key) : curVal;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
var setters = /* @__PURE__ */new Set(),
|
|
299
|
+
logStack = /* @__PURE__ */new Set();
|
|
300
|
+
function createProxiedStore(storeInfo) {
|
|
301
|
+
var _loop = function (key2) {
|
|
302
|
+
if (key2 === "subscribe") return "continue";
|
|
303
|
+
var actionFn = actions[key2],
|
|
304
|
+
isGetFn = key2.startsWith("get");
|
|
305
|
+
if (wrappedActions[key2] = function () {
|
|
306
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
307
|
+
var res;
|
|
308
|
+
return isGetFn || gettersState.isGetting ? Reflect.apply(actionFn, proxiedStore, args) : (process.env.NODE_ENV === "development" && shouldDebug2 && console.info("(debug) startAction", key2), res = Reflect.apply(actionFn, proxiedStore, args), _instanceof(res, Promise) ? res.then(finishAction) : (finishAction(), res));
|
|
309
|
+
}, process.env.NODE_ENV === "development") {
|
|
310
|
+
let hashCode2 = function (str) {
|
|
311
|
+
for (var hash = 0, i = 0; i < str.length; i++) hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
312
|
+
return hash;
|
|
313
|
+
},
|
|
314
|
+
strColor2 = function (str) {
|
|
315
|
+
return `hsl(${hashCode2(str) % 360}, 90%, 40%)`;
|
|
316
|
+
};
|
|
317
|
+
var hashCode = hashCode2,
|
|
318
|
+
strColor = strColor2;
|
|
319
|
+
if (!key2.startsWith("get") && !key2.startsWith("_") && key2 !== "subscribe") {
|
|
320
|
+
var ogAction = wrappedActions[key2];
|
|
321
|
+
wrappedActions[key2] = new Proxy(ogAction, {
|
|
322
|
+
apply(target, thisArg, args) {
|
|
323
|
+
var isDebugging = shouldDebug2 || storeInfo.debug,
|
|
324
|
+
shouldLog = process.env.LOG_LEVEL !== "0" && (isDebugging || import_configureUseStore.configureOpts.logLevel !== "error");
|
|
325
|
+
if (!shouldLog) return Reflect.apply(target, thisArg, args);
|
|
326
|
+
setters = /* @__PURE__ */new Set();
|
|
327
|
+
var curSetters = setters,
|
|
328
|
+
isTopLevelLogger = logStack.size == 0,
|
|
329
|
+
logs = /* @__PURE__ */new Set();
|
|
330
|
+
logStack.add(logs);
|
|
331
|
+
var res,
|
|
332
|
+
id = counter++;
|
|
333
|
+
try {
|
|
334
|
+
res = Reflect.apply(target, thisArg, args);
|
|
335
|
+
} catch (err) {
|
|
336
|
+
throw console.error("Error", err), err;
|
|
337
|
+
} finally {
|
|
338
|
+
logStack.add("end");
|
|
339
|
+
var name = constr.name,
|
|
340
|
+
color = strColor2(name),
|
|
341
|
+
simpleArgs = args.map(import_helpers.simpleStr);
|
|
342
|
+
if (logs.add([`%c \u{1F311} ${id} ${name.padStart(isTopLevelLogger ? 8 : 4)}%c.${key2}(${simpleArgs.join(", ")})${isTopLevelLogger && logStack.size > 1 ? ` (+${logStack.size - 1})` : ""}`, `color: ${color};`, "color: black;"]), curSetters.size && curSetters.forEach(function (param) {
|
|
343
|
+
var {
|
|
344
|
+
key: key3,
|
|
345
|
+
value
|
|
346
|
+
} = param;
|
|
347
|
+
typeof value == "string" || typeof value == "number" || typeof value == "boolean" ? logs.add([` SET ${key3} ${value}`, value]) : logs.add([` SET ${key3}`, value]);
|
|
348
|
+
}), isTopLevelLogger) {
|
|
349
|
+
var error = null;
|
|
350
|
+
try {
|
|
351
|
+
var _iteratorNormalCompletion = !0,
|
|
352
|
+
_didIteratorError = !1,
|
|
353
|
+
_iteratorError = void 0;
|
|
354
|
+
try {
|
|
355
|
+
for (var _iterator = logStack[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
356
|
+
var item = _step.value;
|
|
357
|
+
if (item === "end") {
|
|
358
|
+
console.groupEnd();
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
var [head, ...rest] = item;
|
|
362
|
+
if (head) {
|
|
363
|
+
console.groupCollapsed(...head), console.groupCollapsed("..."), console.info("args", args), console.info("response", res), console.groupCollapsed("trace"), console.trace(), console.groupEnd(), console.groupEnd();
|
|
364
|
+
var _iteratorNormalCompletion1 = !0,
|
|
365
|
+
_didIteratorError1 = !1,
|
|
366
|
+
_iteratorError1 = void 0;
|
|
367
|
+
try {
|
|
368
|
+
for (var _iterator1 = rest[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0) {
|
|
369
|
+
var [name1, ...log] = _step1.value;
|
|
370
|
+
console.groupCollapsed(name1), console.info(...log), console.groupEnd();
|
|
371
|
+
}
|
|
372
|
+
} catch (err) {
|
|
373
|
+
_didIteratorError1 = !0, _iteratorError1 = err;
|
|
374
|
+
} finally {
|
|
375
|
+
try {
|
|
376
|
+
!_iteratorNormalCompletion1 && _iterator1.return != null && _iterator1.return();
|
|
377
|
+
} finally {
|
|
378
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
} else console.info("Weird log", head, ...rest);
|
|
382
|
+
}
|
|
383
|
+
} catch (err) {
|
|
384
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
385
|
+
} finally {
|
|
386
|
+
try {
|
|
387
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
388
|
+
} finally {
|
|
389
|
+
if (_didIteratorError) throw _iteratorError;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
} catch (err) {
|
|
393
|
+
error = err;
|
|
394
|
+
}
|
|
395
|
+
var _iteratorNormalCompletion2 = !0,
|
|
396
|
+
_didIteratorError2 = !1,
|
|
397
|
+
_iteratorError2 = void 0;
|
|
398
|
+
try {
|
|
399
|
+
for (var _iterator2 = logStack[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
|
|
400
|
+
var _ = _step2.value;
|
|
401
|
+
console.groupEnd();
|
|
402
|
+
}
|
|
403
|
+
} catch (err) {
|
|
404
|
+
_didIteratorError2 = !0, _iteratorError2 = err;
|
|
405
|
+
} finally {
|
|
406
|
+
try {
|
|
407
|
+
!_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
|
|
408
|
+
} finally {
|
|
409
|
+
if (_didIteratorError2) throw _iteratorError2;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
error && console.error("error loggin", error), logStack.clear();
|
|
413
|
+
}
|
|
414
|
+
return res;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
actions,
|
|
423
|
+
storeInstance,
|
|
424
|
+
getters,
|
|
425
|
+
gettersState
|
|
426
|
+
} = storeInfo,
|
|
427
|
+
{
|
|
428
|
+
getCache,
|
|
429
|
+
curGetKeys,
|
|
430
|
+
depsToGetter
|
|
431
|
+
} = gettersState,
|
|
432
|
+
constr = storeInstance.constructor,
|
|
433
|
+
_storeInfo_debug,
|
|
434
|
+
shouldDebug2 = (_storeInfo_debug = storeInfo.debug) !== null && _storeInfo_debug !== void 0 ? _storeInfo_debug : import_useStoreDebug.DebugStores.has(constr),
|
|
435
|
+
didSet = !1,
|
|
436
|
+
wrappedActions = {};
|
|
437
|
+
for (var key in actions) _loop(key);
|
|
438
|
+
var finishAction = function (val) {
|
|
439
|
+
return process.env.NODE_ENV === "development" && shouldDebug2 && console.info("(debug) finishAction", {
|
|
440
|
+
didSet
|
|
441
|
+
}), didSet && (storeInfo.triggerUpdate(), didSet = !1), val;
|
|
442
|
+
},
|
|
443
|
+
isTriggering = !1,
|
|
444
|
+
proxiedStore = new Proxy(storeInstance, {
|
|
445
|
+
// GET
|
|
446
|
+
get(_, key2) {
|
|
447
|
+
if (key2 in wrappedActions) return wrappedActions[key2];
|
|
448
|
+
if (key2 in passThroughKeys) return Reflect.get(storeInstance, key2);
|
|
449
|
+
if (key2 === import_constants.UNWRAP_PROXY) return storeInstance;
|
|
450
|
+
if (key2 === import_helpers.UNWRAP_STORE_INFO) return storeInfo;
|
|
451
|
+
if (storeAccessTrackers.size && storeAccessTrackers.forEach(function (cb) {
|
|
452
|
+
return cb(storeInfo);
|
|
453
|
+
}), typeof key2 != "string") return Reflect.get(storeInstance, key2);
|
|
454
|
+
if (storeInfo.disableTracking || gettersState.isGetting && gettersState.curGetKeys.add(key2), key2 in getters) {
|
|
455
|
+
if (getCache.has(key2)) return getCache.get(key2);
|
|
456
|
+
curGetKeys.clear();
|
|
457
|
+
var isSubGetter = gettersState.isGetting;
|
|
458
|
+
gettersState.isGetting = !0;
|
|
459
|
+
var res = getters[key2].call(proxiedStore);
|
|
460
|
+
isSubGetter || (gettersState.isGetting = !1);
|
|
461
|
+
var _iteratorNormalCompletion = !0,
|
|
462
|
+
_didIteratorError = !1,
|
|
463
|
+
_iteratorError = void 0;
|
|
464
|
+
try {
|
|
465
|
+
for (var _iterator = curGetKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
466
|
+
var gk = _step.value;
|
|
467
|
+
depsToGetter.has(gk) || depsToGetter.set(gk, /* @__PURE__ */new Set());
|
|
468
|
+
var cur = depsToGetter.get(gk);
|
|
469
|
+
cur.add(key2);
|
|
470
|
+
}
|
|
471
|
+
} catch (err) {
|
|
472
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
473
|
+
} finally {
|
|
474
|
+
try {
|
|
475
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
476
|
+
} finally {
|
|
477
|
+
if (_didIteratorError) throw _iteratorError;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return getCache.set(key2, res), res;
|
|
481
|
+
}
|
|
482
|
+
return Reflect.get(storeInstance, key2);
|
|
483
|
+
},
|
|
484
|
+
// SET
|
|
485
|
+
set(target, key2, value, receiver) {
|
|
486
|
+
var cur = Reflect.get(target, key2),
|
|
487
|
+
res = Reflect.set(target, key2, value, receiver);
|
|
488
|
+
return res && cur !== value && (typeof key2 == "string" && (clearGetterCache(key2), shouldDebug2 && (setters.add({
|
|
489
|
+
key: key2,
|
|
490
|
+
value
|
|
491
|
+
}), getShouldDebug(storeInfo) && console.info("(debug) SET", res, key2, value)), process.env.NODE_ENV === "development" && shouldDebug2 && console.info("SET...", {
|
|
492
|
+
key: key2,
|
|
493
|
+
value
|
|
494
|
+
})), isTriggering || (isTriggering = !0, waitForEventLoop(function () {
|
|
495
|
+
storeInfo.triggerUpdate(), isTriggering = !1;
|
|
496
|
+
}))), res;
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
function clearGetterCache(setKey) {
|
|
500
|
+
var parentGetters = depsToGetter.get(setKey);
|
|
501
|
+
if (getCache.delete(setKey), !!parentGetters) {
|
|
502
|
+
var _iteratorNormalCompletion = !0,
|
|
503
|
+
_didIteratorError = !1,
|
|
504
|
+
_iteratorError = void 0;
|
|
505
|
+
try {
|
|
506
|
+
for (var _iterator = parentGetters[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
507
|
+
var gk = _step.value;
|
|
508
|
+
getCache.delete(gk), depsToGetter.has(gk) && clearGetterCache(gk);
|
|
509
|
+
}
|
|
510
|
+
} catch (err) {
|
|
511
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
512
|
+
} finally {
|
|
513
|
+
try {
|
|
514
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
515
|
+
} finally {
|
|
516
|
+
if (_didIteratorError) throw _iteratorError;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return proxiedStore;
|
|
522
|
+
}
|
|
523
|
+
var waitForEventLoop = (process.env.NODE_ENV, function (cb) {
|
|
524
|
+
return cb();
|
|
525
|
+
}),
|
|
526
|
+
counter = 0,
|
|
527
|
+
passThroughKeys = {
|
|
528
|
+
subscribe: !0,
|
|
529
|
+
_version: !0,
|
|
530
|
+
_trackers: !0,
|
|
531
|
+
$$typeof: !0,
|
|
532
|
+
_listeners: !0,
|
|
533
|
+
_enableTracking: !0
|
|
534
|
+
};
|
|
535
|
+
function getShouldDebug(storeInfo) {
|
|
536
|
+
var info = {
|
|
537
|
+
storeInstance: storeInfo.store
|
|
538
|
+
},
|
|
539
|
+
trackers = storeInfo.trackers;
|
|
540
|
+
return [...trackers].some(function (tracker) {
|
|
541
|
+
return tracker.component && (0, import_useStoreDebug.shouldDebug)(tracker.component, info);
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
//# sourceMappingURL=useStore.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useStore_exports","__export","allStores","createStore","createUseStore","createUseStoreSelector","getOrCreateStore","getStore","getStoreInfo","onCreateStore","setIsInReaction","trackStoresAccess","useGlobalStore","useGlobalStoreSelector","useStore","useStoreDebug","useStoreSelector","module","exports","import_react","__toESM","require","import_comparators","import_configureUseStore","import_constants","import_helpers","import_useStoreDebug","_instanceof","left","right","Symbol","hasInstance","idFn","_","StoreKlass","props","options","arguments","length","defaultOptions","info","getOrCreateStoreInfo","useStoreFromInfo","selector","debug","_getOrCreateStoreInfo","store","instance","UNWRAP_PROXY","uid","getStoreUid","constructor","cache","get","Error","storeAccessTrackers","Set","cb","add","delete","_getStoreInfo","refuseCreation","onCreateListeners","propsKeyCalculated","_store_mount","avoidCache","has","name","storeInstance","getters","actions","stateKeys","descriptors","getStoreDescriptors","key","descriptor","keyComparators","_comparators","listeners","storeInfo","disableTracking","gettersState","getCache","Map","depsToGetter","curGetKeys","isGetting","trackers","version","subscribe","onChanged","triggerUpdate","Number","MAX_SAFE_INTEGER","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","iterator","_step","next","done","err","return","createProxiedStore","process","env","NODE_ENV","mount","call","result","set","forEach","_globalThis","_Store","globalThis","emptyObj","selectKeys","obj","keys","res","isInReaction","val","userSelector","internal","default","useRef","component","useCurrentComponent","current","tracked","last","lastKeys","curInternal","shouldPrintDebug","getSnapshot","useCallback","curInternal2","isTracking","size","nextKeys","join","snap","isUnchanged","isEqualSubsetShallow","console","storeState","Object","state","useSyncExternalStore","Proxy","target","curVal","Reflect","keyString","setters","logStack","_loop","key2","actionFn","isGetFn","startsWith","wrappedActions","_len","args","Array","_key","apply","proxiedStore","shouldDebug2","Promise","then","finishAction","hashCode2","str","hash","i","charCodeAt","strColor2","hashCode","strColor","ogAction","thisArg","isDebugging","shouldLog","LOG_LEVEL","configureOpts","logLevel","curSetters","isTopLevelLogger","logs","id","counter","error","constr","color","simpleArgs","map","simpleStr","padStart","param","key3","item","groupEnd","head","rest","groupCollapsed","trace","_iteratorNormalCompletion1","_didIteratorError1","_iteratorError1","_iterator1","_step1","name1","log"],"sources":["../../src/useStore.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,gBAAA;AAAAC,QAAA,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= Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
32
|
+
var useStoreDebug_exports = {};
|
|
33
|
+
__export(useStoreDebug_exports, {
|
|
34
|
+
DebugComponents: () => DebugComponents,
|
|
35
|
+
DebugStores: () => DebugStores,
|
|
36
|
+
shouldDebug: () => shouldDebug,
|
|
37
|
+
useCurrentComponent: () => useCurrentComponent,
|
|
38
|
+
useDebugStoreComponent: () => useDebugStoreComponent
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(useStoreDebug_exports);
|
|
41
|
+
var import_react = __toESM(require("react"), 1);
|
|
42
|
+
const useCurrentComponent = () => ({});
|
|
43
|
+
function useDebugStoreComponent(StoreCons) {
|
|
44
|
+
const cmp = useCurrentComponent();
|
|
45
|
+
DebugStores.add(StoreCons), DebugComponents.has(cmp) || DebugComponents.set(cmp, /* @__PURE__ */new Set());
|
|
46
|
+
const stores = DebugComponents.get(cmp);
|
|
47
|
+
stores.add(StoreCons), import_react.default.useLayoutEffect(() => () => {
|
|
48
|
+
DebugStores.delete(StoreCons), stores.delete(StoreCons);
|
|
49
|
+
}, []);
|
|
50
|
+
}
|
|
51
|
+
const shouldDebug = (component, info) => {
|
|
52
|
+
const StoreCons = info.storeInstance?.constructor;
|
|
53
|
+
return DebugComponents.get(component)?.has(StoreCons);
|
|
54
|
+
},
|
|
55
|
+
DebugComponents = /* @__PURE__ */new Map(),
|
|
56
|
+
DebugStores = /* @__PURE__ */new Set();
|