@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,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
15
|
+
value: !0
|
|
16
|
+
}), mod);
|
|
17
|
+
var interfaces_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(interfaces_exports);
|
|
19
|
+
//# sourceMappingURL=interfaces.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","interfaces_exports"],"sources":["../../src/interfaces.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
var __create = 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 observe_exports = {};
|
|
33
|
+
__export(observe_exports, {
|
|
34
|
+
observe: () => observe,
|
|
35
|
+
useObserve: () => useObserve
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(observe_exports);
|
|
38
|
+
var import_react = __toESM(require("react"), 1),
|
|
39
|
+
import_comparators = require("./comparators.cjs"),
|
|
40
|
+
import_constants = require("./constants.cjs"),
|
|
41
|
+
import_useStore = require("./useStore.cjs");
|
|
42
|
+
const logUpdate = process.env.NODE_ENV === "development" ? (fn, stores, last, next) => {
|
|
43
|
+
const getStoreLogName = store => `${(store[import_constants.UNWRAP_PROXY] ?? store).constructor.name}${store.props?.id ? `:${store.props.id}` : ""}`,
|
|
44
|
+
storeNames = stores.map(getStoreLogName).join(", "),
|
|
45
|
+
name = `\u{1F311} \u25B6\uFE0F %c${fn.name} ${storeNames} () ${last} => ${next}`;
|
|
46
|
+
console.groupCollapsed(name, "color: tomato;"), console.groupCollapsed("trace >"), console.trace(), console.groupEnd(), console.info(" next", next), console.groupEnd();
|
|
47
|
+
} : null;
|
|
48
|
+
function observe(fn) {
|
|
49
|
+
let prev = getObserverValueAndStoresAccessed(fn),
|
|
50
|
+
disposeValue = null;
|
|
51
|
+
const subscribe = () => {
|
|
52
|
+
const stores = [...prev.storeInfos];
|
|
53
|
+
return subscribeToStores(stores, () => {
|
|
54
|
+
disposeValue?.();
|
|
55
|
+
const next = getObserverValueAndStoresAccessed(fn);
|
|
56
|
+
if (typeof next.value == "function") {
|
|
57
|
+
disposeValue = next.value, process.env.NODE_ENV === "development" && logUpdate(fn, [...next.storeInfos], "(fn)", "(fn)");
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
(0, import_comparators.isEqualSubsetShallow)(prev.storeInfos, next.storeInfos) && (0, import_comparators.isEqualSubsetShallow)(prev.value, next.value) || (process.env.NODE_ENV === "development" && logUpdate(fn, [...next.storeInfos], prev.value, next.value), prev = next, dispose(), dispose = subscribe());
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
let dispose = subscribe();
|
|
64
|
+
return {
|
|
65
|
+
dispose: () => {
|
|
66
|
+
dispose(), disposeValue?.();
|
|
67
|
+
},
|
|
68
|
+
getValue: () => prev.value
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function useObserve(fn) {
|
|
72
|
+
const [state, setState] = import_react.default.useState(() => getObserverValueAndStoresAccessed(fn));
|
|
73
|
+
return import_react.default.useEffect(() => {
|
|
74
|
+
let dispose;
|
|
75
|
+
const unsub = subscribeToStores([...state.storeInfos], () => {
|
|
76
|
+
dispose?.();
|
|
77
|
+
const next = getObserverValueAndStoresAccessed(fn),
|
|
78
|
+
nextStoreInfos = [...next.storeInfos],
|
|
79
|
+
prevStoreInfos = [...state.storeInfos];
|
|
80
|
+
if (typeof next.value == "function") {
|
|
81
|
+
process.env.NODE_ENV === "development" && logUpdate(fn, nextStoreInfos, "(fn)", "(fn)"), dispose = next.value;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
setState(prev => (0, import_comparators.isEqualSubsetShallow)(prevStoreInfos, nextStoreInfos) && (0, import_comparators.isEqualSubsetShallow)(prev.value, next.value) ? prev : (process.env.NODE_ENV === "development" && logUpdate(fn, nextStoreInfos, prev.value, next.value), next));
|
|
85
|
+
});
|
|
86
|
+
return () => {
|
|
87
|
+
unsub(), dispose?.();
|
|
88
|
+
};
|
|
89
|
+
}, [[...state.storeInfos].map(i => i.uid).join(",")]), state.value;
|
|
90
|
+
}
|
|
91
|
+
function getObserverValueAndStoresAccessed(selector) {
|
|
92
|
+
const storeInfos = /* @__PURE__ */new Set(),
|
|
93
|
+
dispose = (0, import_useStore.trackStoresAccess)(storeInfo => {
|
|
94
|
+
storeInfos.add(storeInfo);
|
|
95
|
+
}),
|
|
96
|
+
value = selector();
|
|
97
|
+
return dispose(), {
|
|
98
|
+
value,
|
|
99
|
+
storeInfos
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function subscribeToStores(storeInfos, onUpdate) {
|
|
103
|
+
const disposes = [];
|
|
104
|
+
let isUpdating = !1;
|
|
105
|
+
const onUpdateDebouncedWithoutTracking = () => {
|
|
106
|
+
isUpdating || (isUpdating = !0, queueMicrotask(() => {
|
|
107
|
+
try {
|
|
108
|
+
for (const storeInfo of storeInfos) storeInfo.disableTracking = !0;
|
|
109
|
+
onUpdate();
|
|
110
|
+
} finally {
|
|
111
|
+
isUpdating = !1;
|
|
112
|
+
for (const storeInfo of storeInfos) storeInfo.disableTracking = !1;
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
};
|
|
116
|
+
for (const storeInfo of storeInfos) disposes.push(storeInfo.subscribe(onUpdateDebouncedWithoutTracking));
|
|
117
|
+
return () => {
|
|
118
|
+
disposes.forEach(x => x());
|
|
119
|
+
};
|
|
120
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
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 observe_exports = {};
|
|
35
|
+
__export(observe_exports, {
|
|
36
|
+
observe: () => observe,
|
|
37
|
+
useObserve: () => useObserve
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(observe_exports);
|
|
40
|
+
var import_react = __toESM(require("react"), 1),
|
|
41
|
+
import_comparators = require("./comparators.native.js"),
|
|
42
|
+
import_constants = require("./constants.native.js"),
|
|
43
|
+
import_useStore = require("./useStore.native.js"),
|
|
44
|
+
logUpdate = process.env.NODE_ENV === "development" ? function (fn, stores, last, next) {
|
|
45
|
+
var getStoreLogName = function (store) {
|
|
46
|
+
var _store_props,
|
|
47
|
+
_store_UNWRAP_PROXY,
|
|
48
|
+
str = (_store_UNWRAP_PROXY = store[import_constants.UNWRAP_PROXY]) !== null && _store_UNWRAP_PROXY !== void 0 ? _store_UNWRAP_PROXY : store;
|
|
49
|
+
return `${str.constructor.name}${!((_store_props = store.props) === null || _store_props === void 0) && _store_props.id ? `:${store.props.id}` : ""}`;
|
|
50
|
+
},
|
|
51
|
+
storeNames = stores.map(getStoreLogName).join(", "),
|
|
52
|
+
name = `\u{1F311} \u25B6\uFE0F %c${fn.name} ${storeNames} () ${last} => ${next}`;
|
|
53
|
+
console.groupCollapsed(name, "color: tomato;"), console.groupCollapsed("trace >"), console.trace(), console.groupEnd(), console.info(" next", next), console.groupEnd();
|
|
54
|
+
} : null;
|
|
55
|
+
function observe(fn) {
|
|
56
|
+
var prev = getObserverValueAndStoresAccessed(fn),
|
|
57
|
+
disposeValue = null,
|
|
58
|
+
subscribe = function () {
|
|
59
|
+
var stores = [...prev.storeInfos];
|
|
60
|
+
return subscribeToStores(stores, function () {
|
|
61
|
+
disposeValue?.();
|
|
62
|
+
var next = getObserverValueAndStoresAccessed(fn);
|
|
63
|
+
if (typeof next.value == "function") {
|
|
64
|
+
disposeValue = next.value, process.env.NODE_ENV === "development" && logUpdate(fn, [...next.storeInfos], "(fn)", "(fn)");
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
(0, import_comparators.isEqualSubsetShallow)(prev.storeInfos, next.storeInfos) && (0, import_comparators.isEqualSubsetShallow)(prev.value, next.value) || (process.env.NODE_ENV === "development" && logUpdate(fn, [...next.storeInfos], prev.value, next.value), prev = next, dispose(), dispose = subscribe());
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
dispose = subscribe();
|
|
71
|
+
return {
|
|
72
|
+
dispose: function () {
|
|
73
|
+
dispose(), disposeValue?.();
|
|
74
|
+
},
|
|
75
|
+
getValue: function () {
|
|
76
|
+
return prev.value;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function useObserve(fn) {
|
|
81
|
+
var [state, setState] = import_react.default.useState(function () {
|
|
82
|
+
return getObserverValueAndStoresAccessed(fn);
|
|
83
|
+
});
|
|
84
|
+
return import_react.default.useEffect(function () {
|
|
85
|
+
var dispose,
|
|
86
|
+
unsub = subscribeToStores([...state.storeInfos], function () {
|
|
87
|
+
dispose?.();
|
|
88
|
+
var next = getObserverValueAndStoresAccessed(fn),
|
|
89
|
+
nextStoreInfos = [...next.storeInfos],
|
|
90
|
+
prevStoreInfos = [...state.storeInfos];
|
|
91
|
+
if (typeof next.value == "function") {
|
|
92
|
+
process.env.NODE_ENV === "development" && logUpdate(fn, nextStoreInfos, "(fn)", "(fn)"), dispose = next.value;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
setState(function (prev) {
|
|
96
|
+
return (0, import_comparators.isEqualSubsetShallow)(prevStoreInfos, nextStoreInfos) && (0, import_comparators.isEqualSubsetShallow)(prev.value, next.value) ? prev : (process.env.NODE_ENV === "development" && logUpdate(fn, nextStoreInfos, prev.value, next.value), next);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
return function () {
|
|
100
|
+
unsub(), dispose?.();
|
|
101
|
+
};
|
|
102
|
+
}, [[...state.storeInfos].map(function (i) {
|
|
103
|
+
return i.uid;
|
|
104
|
+
}).join(",")]), state.value;
|
|
105
|
+
}
|
|
106
|
+
function getObserverValueAndStoresAccessed(selector) {
|
|
107
|
+
var storeInfos = /* @__PURE__ */new Set(),
|
|
108
|
+
dispose = (0, import_useStore.trackStoresAccess)(function (storeInfo) {
|
|
109
|
+
storeInfos.add(storeInfo);
|
|
110
|
+
}),
|
|
111
|
+
value = selector();
|
|
112
|
+
return dispose(), {
|
|
113
|
+
value,
|
|
114
|
+
storeInfos
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function subscribeToStores(storeInfos, onUpdate) {
|
|
118
|
+
var disposes = [],
|
|
119
|
+
isUpdating = !1,
|
|
120
|
+
onUpdateDebouncedWithoutTracking = function () {
|
|
121
|
+
isUpdating || (isUpdating = !0, queueMicrotask(function () {
|
|
122
|
+
try {
|
|
123
|
+
var _iteratorNormalCompletion2 = !0,
|
|
124
|
+
_didIteratorError2 = !1,
|
|
125
|
+
_iteratorError2 = void 0;
|
|
126
|
+
try {
|
|
127
|
+
for (var _iterator2 = storeInfos[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
|
|
128
|
+
var storeInfo2 = _step2.value;
|
|
129
|
+
storeInfo2.disableTracking = !0;
|
|
130
|
+
}
|
|
131
|
+
} catch (err) {
|
|
132
|
+
_didIteratorError2 = !0, _iteratorError2 = err;
|
|
133
|
+
} finally {
|
|
134
|
+
try {
|
|
135
|
+
!_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
|
|
136
|
+
} finally {
|
|
137
|
+
if (_didIteratorError2) throw _iteratorError2;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
onUpdate();
|
|
141
|
+
} finally {
|
|
142
|
+
isUpdating = !1;
|
|
143
|
+
var _iteratorNormalCompletion1 = !0,
|
|
144
|
+
_didIteratorError1 = !1,
|
|
145
|
+
_iteratorError1 = void 0;
|
|
146
|
+
try {
|
|
147
|
+
for (var _iterator1 = storeInfos[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0) {
|
|
148
|
+
var storeInfo1 = _step1.value;
|
|
149
|
+
storeInfo1.disableTracking = !1;
|
|
150
|
+
}
|
|
151
|
+
} catch (err) {
|
|
152
|
+
_didIteratorError1 = !0, _iteratorError1 = err;
|
|
153
|
+
} finally {
|
|
154
|
+
try {
|
|
155
|
+
!_iteratorNormalCompletion1 && _iterator1.return != null && _iterator1.return();
|
|
156
|
+
} finally {
|
|
157
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}));
|
|
162
|
+
},
|
|
163
|
+
_iteratorNormalCompletion = !0,
|
|
164
|
+
_didIteratorError = !1,
|
|
165
|
+
_iteratorError = void 0;
|
|
166
|
+
try {
|
|
167
|
+
for (var _iterator = storeInfos[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
168
|
+
var storeInfo = _step.value;
|
|
169
|
+
disposes.push(storeInfo.subscribe(onUpdateDebouncedWithoutTracking));
|
|
170
|
+
}
|
|
171
|
+
} catch (err) {
|
|
172
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
173
|
+
} finally {
|
|
174
|
+
try {
|
|
175
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
176
|
+
} finally {
|
|
177
|
+
if (_didIteratorError) throw _iteratorError;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return function () {
|
|
181
|
+
disposes.forEach(function (x) {
|
|
182
|
+
return x();
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=observe.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","observe_exports","__export","observe","useObserve","module","exports","import_react","__toESM","require","import_comparators","import_constants","import_useStore","logUpdate","process","env","NODE_ENV","fn","stores","last","next","getStoreLogName","store","_store_props","_store_UNWRAP_PROXY","str","UNWRAP_PROXY","constructor","name","props","id","storeNames","map","join","console","groupCollapsed","trace","groupEnd","info","prev","getObserverValueAndStoresAccessed","disposeValue","subscribe","storeInfos","subscribeToStores","isEqualSubsetShallow","dispose","getValue","state","setState","default","useState","useEffect","unsub","nextStoreInfos","prevStoreInfos","i","uid","selector","Set","trackStoresAccess","storeInfo","add"],"sources":["../../src/observe.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAA,OAAA;EAAAC,UAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAV,YAAkB,CAAAK,eAAA;AAOlB,IAAAM,YAAM,GACJC,OAAQ,CAAAC,OAAI,SAAa;EAAAC,kBACX,GAAAD,OAAe,CAAW,yBAAc;EAAAE,gBAAA,GAAAF,OAAA;EAAAG,eAAA,GAAAH,OAAA;EAAAI,SAAA,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,+BAAAC,EAAA,EAAAC,MAAA,EAAAC,IAAA,EAAAC,IAAA;IAChD,IAAAC,eAAM,YAAAA,CAAmBC,KAEhB;QAIT,IAAAC,YAAQ;UAAAC,mBAAqB;UAAAC,GAAA,GAAgB,CAC7CD,mBAAQ,GAAAF,KAAe,CAAAX,gBACf,CAAAe,YACR,OAAQ,QACRF,mBAAa,KAAU,KAAI,CAC3B,GAAAA,mBAAiB,GAAAF,KAAA;QAEnB,UAAAG,GAAA,CAAAE,WAAA,CAAAC,IAAA,MAAAL,YAAA,GAAAD,KAAA,CAAAO,KAAA,cAAAN,YAAA,gBAAAA,YAAA,CAAAO,EAAA,OAAAR,KAAA,CAAAO,KAAA,CAAAC,EAAA;MAEC;MAAAC,UAAS,GAAQb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