cross-state 0.53.3 → 0.54.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/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/diff-BQ8bB3Wk.d.cts +22 -0
- package/dist/diff-gZezL04N.d.ts +22 -0
- package/dist/extendedJson-BZkQBXEv.js +29 -0
- package/dist/extendedJson-BZkQBXEv.js.map +1 -0
- package/dist/extendedJson-Dn2F7Edo.cjs +53 -0
- package/dist/extendedJson-Dn2F7Edo.cjs.map +1 -0
- package/dist/hash-BV06P7va.js +19 -0
- package/dist/hash-BV06P7va.js.map +1 -0
- package/dist/hash-CJPl7SRj.cjs +30 -0
- package/dist/hash-CJPl7SRj.cjs.map +1 -0
- package/dist/index.cjs +49 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +59 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/mutative/index.cjs +3 -0
- package/dist/mutative/index.d.cts +3 -0
- package/dist/mutative/index.d.ts +3 -0
- package/dist/mutative/index.js +3 -0
- package/dist/mutative/register.cjs +10 -0
- package/dist/mutative/register.cjs.map +1 -0
- package/dist/mutative/register.d.cts +11 -0
- package/dist/mutative/register.d.ts +9 -0
- package/dist/mutative/register.js +10 -0
- package/dist/mutative/register.js.map +1 -0
- package/dist/mutativeMethods-6QzygG3W.d.cts +13 -0
- package/dist/mutativeMethods-Br3xN2Iq.d.ts +13 -0
- package/dist/mutativeMethods-CZKeRIDL.js +27 -0
- package/dist/mutativeMethods-CZKeRIDL.js.map +1 -0
- package/dist/mutativeMethods-CgXk_bMt.cjs +33 -0
- package/dist/mutativeMethods-CgXk_bMt.cjs.map +1 -0
- package/dist/patchMethods-C3L7Kh8T.d.cts +48 -0
- package/dist/patchMethods-D5YJwcpn.cjs +264 -0
- package/dist/patchMethods-D5YJwcpn.cjs.map +1 -0
- package/dist/patchMethods-DRPfkhAe.js +241 -0
- package/dist/patchMethods-DRPfkhAe.js.map +1 -0
- package/dist/patchMethods-Dxad6HF6.d.ts +48 -0
- package/dist/patches/index.cjs +5 -0
- package/dist/patches/index.d.cts +4 -0
- package/dist/patches/index.d.ts +4 -0
- package/dist/patches/index.js +5 -0
- package/dist/patches/register.cjs +11 -0
- package/dist/patches/register.cjs.map +1 -0
- package/dist/patches/register.d.cts +12 -0
- package/dist/patches/register.d.ts +10 -0
- package/dist/patches/register.js +11 -0
- package/dist/patches/register.js.map +1 -0
- package/dist/persist/register.cjs +13 -0
- package/dist/persist/register.cjs.map +1 -0
- package/dist/persist/register.d.cts +15 -0
- package/dist/persist/register.d.ts +13 -0
- package/dist/persist/register.js +13 -0
- package/dist/persist/register.js.map +1 -0
- package/dist/persist-BluRVcW6.js +258 -0
- package/dist/persist-BluRVcW6.js.map +1 -0
- package/dist/persist-CPjpg6D0.d.ts +61 -0
- package/dist/persist-CztClydq.cjs +263 -0
- package/dist/persist-CztClydq.cjs.map +1 -0
- package/dist/persist-D7MAsyyW.d.cts +61 -0
- package/dist/propAccess-ByqBjC19.cjs +173 -0
- package/dist/propAccess-ByqBjC19.cjs.map +1 -0
- package/dist/propAccess-DGchzVfy.js +113 -0
- package/dist/propAccess-DGchzVfy.js.map +1 -0
- package/dist/react/index.cjs +610 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +305 -0
- package/dist/react/index.d.ts +305 -0
- package/dist/react/index.js +590 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/register.cjs +16 -0
- package/dist/react/register.cjs.map +1 -0
- package/dist/react/register.d.cts +16 -0
- package/dist/react/register.d.ts +14 -0
- package/dist/react/register.js +16 -0
- package/dist/react/register.js.map +1 -0
- package/dist/scope-DI1OFHcr.d.ts +167 -0
- package/dist/scope-DO5vpLPV.d.cts +167 -0
- package/dist/scope-DU5dFP1T.js +322 -0
- package/dist/scope-DU5dFP1T.js.map +1 -0
- package/dist/scope-DvqvkIHB.cjs +369 -0
- package/dist/scope-DvqvkIHB.cjs.map +1 -0
- package/dist/store-BEsiS8y7.d.cts +242 -0
- package/dist/store-BWMWEUpu.cjs +819 -0
- package/dist/store-BWMWEUpu.cjs.map +1 -0
- package/dist/store-DKaeE840.d.ts +242 -0
- package/dist/store-Dr8gM3lq.js +730 -0
- package/dist/store-Dr8gM3lq.js.map +1 -0
- package/dist/storeMethods-AIJSwxHz.js +315 -0
- package/dist/storeMethods-AIJSwxHz.js.map +1 -0
- package/dist/storeMethods-BQwU2Uia.d.cts +107 -0
- package/dist/storeMethods-C4luym7C.d.ts +107 -0
- package/dist/storeMethods-DVVsmUg1.cjs +375 -0
- package/dist/storeMethods-DVVsmUg1.cjs.map +1 -0
- package/package.json +92 -135
- package/dist/cjs/hash.cjs +0 -30
- package/dist/cjs/hash.cjs.map +0 -1
- package/dist/cjs/index.cjs +0 -56
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/index2.cjs +0 -300
- package/dist/cjs/index2.cjs.map +0 -1
- package/dist/cjs/mutative/index.cjs +0 -10
- package/dist/cjs/mutative/index.cjs.map +0 -1
- package/dist/cjs/mutative/register.cjs +0 -8
- package/dist/cjs/mutative/register.cjs.map +0 -1
- package/dist/cjs/mutativeMethods.cjs +0 -29
- package/dist/cjs/mutativeMethods.cjs.map +0 -1
- package/dist/cjs/patches/index.cjs +0 -10
- package/dist/cjs/patches/index.cjs.map +0 -1
- package/dist/cjs/patches/register.cjs +0 -8
- package/dist/cjs/patches/register.cjs.map +0 -1
- package/dist/cjs/persist/register.cjs +0 -11
- package/dist/cjs/persist/register.cjs.map +0 -1
- package/dist/cjs/persist.cjs +0 -302
- package/dist/cjs/persist.cjs.map +0 -1
- package/dist/cjs/propAccess.cjs +0 -162
- package/dist/cjs/propAccess.cjs.map +0 -1
- package/dist/cjs/react/index.cjs +0 -628
- package/dist/cjs/react/index.cjs.map +0 -1
- package/dist/cjs/react/register.cjs +0 -13
- package/dist/cjs/react/register.cjs.map +0 -1
- package/dist/cjs/scope.cjs +0 -400
- package/dist/cjs/scope.cjs.map +0 -1
- package/dist/cjs/store.cjs +0 -829
- package/dist/cjs/store.cjs.map +0 -1
- package/dist/cjs/storeMethods.cjs +0 -856
- package/dist/cjs/storeMethods.cjs.map +0 -1
- package/dist/cjs/urlStore.cjs +0 -120
- package/dist/cjs/urlStore.cjs.map +0 -1
- package/dist/es/hash.mjs +0 -27
- package/dist/es/hash.mjs.map +0 -1
- package/dist/es/index.mjs +0 -20
- package/dist/es/index.mjs.map +0 -1
- package/dist/es/index2.mjs +0 -291
- package/dist/es/index2.mjs.map +0 -1
- package/dist/es/mutative/index.mjs +0 -2
- package/dist/es/mutative/index.mjs.map +0 -1
- package/dist/es/mutative/register.mjs +0 -6
- package/dist/es/mutative/register.mjs.map +0 -1
- package/dist/es/mutativeMethods.mjs +0 -27
- package/dist/es/mutativeMethods.mjs.map +0 -1
- package/dist/es/patches/index.mjs +0 -2
- package/dist/es/patches/index.mjs.map +0 -1
- package/dist/es/patches/register.mjs +0 -6
- package/dist/es/patches/register.mjs.map +0 -1
- package/dist/es/persist/register.mjs +0 -9
- package/dist/es/persist/register.mjs.map +0 -1
- package/dist/es/persist.mjs +0 -300
- package/dist/es/persist.mjs.map +0 -1
- package/dist/es/propAccess.mjs +0 -151
- package/dist/es/propAccess.mjs.map +0 -1
- package/dist/es/react/index.mjs +0 -611
- package/dist/es/react/index.mjs.map +0 -1
- package/dist/es/react/register.mjs +0 -11
- package/dist/es/react/register.mjs.map +0 -1
- package/dist/es/scope.mjs +0 -391
- package/dist/es/scope.mjs.map +0 -1
- package/dist/es/store.mjs +0 -812
- package/dist/es/store.mjs.map +0 -1
- package/dist/es/storeMethods.mjs +0 -845
- package/dist/es/storeMethods.mjs.map +0 -1
- package/dist/es/urlStore.mjs +0 -116
- package/dist/es/urlStore.mjs.map +0 -1
- package/dist/types/core/cache.d.ts +0 -119
- package/dist/types/core/commonTypes.d.ts +0 -76
- package/dist/types/core/index.d.ts +0 -6
- package/dist/types/core/resourceGroup.d.ts +0 -16
- package/dist/types/core/scope.d.ts +0 -5
- package/dist/types/core/store.d.ts +0 -86
- package/dist/types/core/urlStore.d.ts +0 -21
- package/dist/types/index.d.ts +0 -14
- package/dist/types/lib/applyPatches.d.ts +0 -2
- package/dist/types/lib/autobind.d.ts +0 -1
- package/dist/types/lib/cacheState.d.ts +0 -20
- package/dist/types/lib/calcDuration.d.ts +0 -2
- package/dist/types/lib/calculatedValue.d.ts +0 -9
- package/dist/types/lib/castArray.d.ts +0 -1
- package/dist/types/lib/clone.d.ts +0 -1
- package/dist/types/lib/constrain.d.ts +0 -1
- package/dist/types/lib/debounce.d.ts +0 -12
- package/dist/types/lib/deferred.d.ts +0 -5
- package/dist/types/lib/diff.d.ts +0 -17
- package/dist/types/lib/disposable.d.ts +0 -3
- package/dist/types/lib/equals.d.ts +0 -3
- package/dist/types/lib/extendedJson.d.ts +0 -5
- package/dist/types/lib/forwardError.d.ts +0 -1
- package/dist/types/lib/hash.d.ts +0 -5
- package/dist/types/lib/helpers.d.ts +0 -2
- package/dist/types/lib/instanceCache.d.ts +0 -18
- package/dist/types/lib/isPromise.d.ts +0 -1
- package/dist/types/lib/makeSelector.d.ts +0 -2
- package/dist/types/lib/maybePromise.d.ts +0 -1
- package/dist/types/lib/path.d.ts +0 -41
- package/dist/types/lib/promiseChain.d.ts +0 -5
- package/dist/types/lib/promiseWithCancel.d.ts +0 -8
- package/dist/types/lib/promiseWithState.d.ts +0 -9
- package/dist/types/lib/propAccess.d.ts +0 -7
- package/dist/types/lib/queue.d.ts +0 -11
- package/dist/types/lib/standardMethods.d.ts +0 -20
- package/dist/types/lib/throttle.d.ts +0 -2
- package/dist/types/lib/trackingProxy.d.ts +0 -2
- package/dist/types/lib/trie.d.ts +0 -11
- package/dist/types/lib/typeHelpers.d.ts +0 -12
- package/dist/types/lib/unwrapPromise.d.ts +0 -1
- package/dist/types/lib/updateHelpers.d.ts +0 -1
- package/dist/types/lib/wildcardMatch.d.ts +0 -3
- package/dist/types/mutative/index.d.ts +0 -1
- package/dist/types/mutative/mutativeMethods.d.ts +0 -11
- package/dist/types/mutative/register.d.ts +0 -7
- package/dist/types/patches/index.d.ts +0 -1
- package/dist/types/patches/patchMethods.d.ts +0 -44
- package/dist/types/patches/register.d.ts +0 -7
- package/dist/types/persist/index.d.ts +0 -3
- package/dist/types/persist/persist.d.ts +0 -40
- package/dist/types/persist/persistPathHelpers.d.ts +0 -6
- package/dist/types/persist/persistStorage.d.ts +0 -17
- package/dist/types/persist/register.d.ts +0 -9
- package/dist/types/react/cacheMethods.d.ts +0 -5
- package/dist/types/react/form/customInput.d.ts +0 -6
- package/dist/types/react/form/form.d.ts +0 -98
- package/dist/types/react/form/formField.d.ts +0 -68
- package/dist/types/react/form/formForEach.d.ts +0 -19
- package/dist/types/react/form/index.d.ts +0 -3
- package/dist/types/react/form/useFormAutosave.d.ts +0 -9
- package/dist/types/react/index.d.ts +0 -11
- package/dist/types/react/loadingBoundary.d.ts +0 -21
- package/dist/types/react/register.d.ts +0 -15
- package/dist/types/react/scope.d.ts +0 -24
- package/dist/types/react/scopeMethods.d.ts +0 -20
- package/dist/types/react/storeMethods.d.ts +0 -15
- package/dist/types/react/useCache.d.ts +0 -34
- package/dist/types/react/useDecoupledState.d.ts +0 -7
- package/dist/types/react/useProp.d.ts +0 -8
- package/dist/types/react/useStore.d.ts +0 -16
- package/dist/types/react/useUrlParamScope.d.ts +0 -4
|
@@ -1,856 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const store = require('./store.cjs');
|
|
4
|
-
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
const require$$0 = require('react');
|
|
6
|
-
const propAccess = require('./propAccess.cjs');
|
|
7
|
-
const hash = require('./hash.cjs');
|
|
8
|
-
|
|
9
|
-
const unwrapProxySymbol = /* @__PURE__ */ Symbol("unwrapProxy");
|
|
10
|
-
function trackingProxy(value, equals = propAccess.deepEqual) {
|
|
11
|
-
if (!propAccess.isPlainObject(value) && !Array.isArray(value)) {
|
|
12
|
-
return [value, (other) => equals(value, other)];
|
|
13
|
-
}
|
|
14
|
-
value = value[unwrapProxySymbol] ?? value;
|
|
15
|
-
const deps = new Array();
|
|
16
|
-
const revokations = new Array();
|
|
17
|
-
let revoked = false;
|
|
18
|
-
function trackComplexProp(function_, ...args) {
|
|
19
|
-
const [proxiedValue, equals2, revoke] = trackingProxy(function_(value, ...args));
|
|
20
|
-
deps.push((otherValue) => {
|
|
21
|
-
if (!propAccess.isPlainObject(otherValue) && !Array.isArray(otherValue)) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
return equals2(function_(otherValue, ...args));
|
|
25
|
-
});
|
|
26
|
-
if (revoke) {
|
|
27
|
-
revokations.push(revoke);
|
|
28
|
-
}
|
|
29
|
-
return proxiedValue;
|
|
30
|
-
}
|
|
31
|
-
function trackSimpleProp(function_, ...args) {
|
|
32
|
-
const calculatedValue = function_(value, ...args);
|
|
33
|
-
deps.push((otherValue) => {
|
|
34
|
-
return function_(otherValue, ...args) === calculatedValue;
|
|
35
|
-
});
|
|
36
|
-
return calculatedValue;
|
|
37
|
-
}
|
|
38
|
-
const proxy = new Proxy(value, {
|
|
39
|
-
get(target, p, receiver) {
|
|
40
|
-
if (p === unwrapProxySymbol) {
|
|
41
|
-
return value;
|
|
42
|
-
}
|
|
43
|
-
if (revoked) {
|
|
44
|
-
return target[p];
|
|
45
|
-
}
|
|
46
|
-
const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};
|
|
47
|
-
if (writable === false && configurable === false) {
|
|
48
|
-
return target[p];
|
|
49
|
-
}
|
|
50
|
-
return trackComplexProp(Reflect.get, p, receiver);
|
|
51
|
-
},
|
|
52
|
-
getOwnPropertyDescriptor(target, p) {
|
|
53
|
-
const { writable, configurable } = Object.getOwnPropertyDescriptor(target, p) ?? {};
|
|
54
|
-
if (writable === false && configurable === false) {
|
|
55
|
-
return Reflect.getOwnPropertyDescriptor(target, p);
|
|
56
|
-
}
|
|
57
|
-
return trackComplexProp(Reflect.getOwnPropertyDescriptor, p);
|
|
58
|
-
},
|
|
59
|
-
ownKeys() {
|
|
60
|
-
return trackComplexProp(Reflect.ownKeys);
|
|
61
|
-
},
|
|
62
|
-
getPrototypeOf() {
|
|
63
|
-
return trackSimpleProp(Reflect.getPrototypeOf);
|
|
64
|
-
},
|
|
65
|
-
has(_target, p) {
|
|
66
|
-
return trackSimpleProp(Reflect.has, p);
|
|
67
|
-
},
|
|
68
|
-
isExtensible() {
|
|
69
|
-
return trackSimpleProp(Reflect.isExtensible);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
return [
|
|
73
|
-
proxy,
|
|
74
|
-
(other) => !!other && deps.every((equals2) => equals2(other)),
|
|
75
|
-
() => {
|
|
76
|
-
revoked = true;
|
|
77
|
-
revokations.forEach((revoke) => revoke());
|
|
78
|
-
}
|
|
79
|
-
];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var withSelector = {exports: {}};
|
|
83
|
-
|
|
84
|
-
var withSelector_production_min = {};
|
|
85
|
-
|
|
86
|
-
var shim = {exports: {}};
|
|
87
|
-
|
|
88
|
-
var useSyncExternalStoreShim_production_min = {};
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @license React
|
|
92
|
-
* use-sync-external-store-shim.production.min.js
|
|
93
|
-
*
|
|
94
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
95
|
-
*
|
|
96
|
-
* This source code is licensed under the MIT license found in the
|
|
97
|
-
* LICENSE file in the root directory of this source tree.
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
|
-
var hasRequiredUseSyncExternalStoreShim_production_min;
|
|
101
|
-
|
|
102
|
-
function requireUseSyncExternalStoreShim_production_min () {
|
|
103
|
-
if (hasRequiredUseSyncExternalStoreShim_production_min) return useSyncExternalStoreShim_production_min;
|
|
104
|
-
hasRequiredUseSyncExternalStoreShim_production_min = 1;
|
|
105
|
-
var e=require$$0;function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c});},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c});})},[a]);p(d);return d}
|
|
106
|
-
function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return !k(a,d)}catch(f){return true}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;useSyncExternalStoreShim_production_min.useSyncExternalStore=undefined!==e.useSyncExternalStore?e.useSyncExternalStore:u;
|
|
107
|
-
return useSyncExternalStoreShim_production_min;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
var useSyncExternalStoreShim_development = {};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @license React
|
|
114
|
-
* use-sync-external-store-shim.development.js
|
|
115
|
-
*
|
|
116
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
117
|
-
*
|
|
118
|
-
* This source code is licensed under the MIT license found in the
|
|
119
|
-
* LICENSE file in the root directory of this source tree.
|
|
120
|
-
*/
|
|
121
|
-
|
|
122
|
-
var hasRequiredUseSyncExternalStoreShim_development;
|
|
123
|
-
|
|
124
|
-
function requireUseSyncExternalStoreShim_development () {
|
|
125
|
-
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
126
|
-
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
127
|
-
|
|
128
|
-
if (process.env.NODE_ENV !== "production") {
|
|
129
|
-
(function() {
|
|
130
|
-
|
|
131
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
132
|
-
if (
|
|
133
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
134
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
135
|
-
'function'
|
|
136
|
-
) {
|
|
137
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
138
|
-
}
|
|
139
|
-
var React = require$$0;
|
|
140
|
-
|
|
141
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
142
|
-
|
|
143
|
-
function error(format) {
|
|
144
|
-
{
|
|
145
|
-
{
|
|
146
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
147
|
-
args[_key2 - 1] = arguments[_key2];
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
printWarning('error', format, args);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function printWarning(level, format, args) {
|
|
156
|
-
// When changing this logic, you might want to also
|
|
157
|
-
// update consoleWithStackDev.www.js as well.
|
|
158
|
-
{
|
|
159
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
160
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
161
|
-
|
|
162
|
-
if (stack !== '') {
|
|
163
|
-
format += '%s';
|
|
164
|
-
args = args.concat([stack]);
|
|
165
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
var argsWithFormat = args.map(function (item) {
|
|
169
|
-
return String(item);
|
|
170
|
-
}); // Careful: RN currently depends on this prefix
|
|
171
|
-
|
|
172
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
173
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
174
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
175
|
-
|
|
176
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
182
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
183
|
-
*/
|
|
184
|
-
function is(x, y) {
|
|
185
|
-
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
|
186
|
-
;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
|
190
|
-
|
|
191
|
-
// dispatch for CommonJS interop named imports.
|
|
192
|
-
|
|
193
|
-
var useState = React.useState,
|
|
194
|
-
useEffect = React.useEffect,
|
|
195
|
-
useLayoutEffect = React.useLayoutEffect,
|
|
196
|
-
useDebugValue = React.useDebugValue;
|
|
197
|
-
var didWarnOld18Alpha = false;
|
|
198
|
-
var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
|
|
199
|
-
// because of a very particular set of implementation details and assumptions
|
|
200
|
-
// -- change any one of them and it will break. The most important assumption
|
|
201
|
-
// is that updates are always synchronous, because concurrent rendering is
|
|
202
|
-
// only available in versions of React that also have a built-in
|
|
203
|
-
// useSyncExternalStore API. And we only use this shim when the built-in API
|
|
204
|
-
// does not exist.
|
|
205
|
-
//
|
|
206
|
-
// Do not assume that the clever hacks used by this hook also work in general.
|
|
207
|
-
// The point of this shim is to replace the need for hacks by other libraries.
|
|
208
|
-
|
|
209
|
-
function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
210
|
-
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
211
|
-
// will need to track that themselves and return the correct value
|
|
212
|
-
// from `getSnapshot`.
|
|
213
|
-
getServerSnapshot) {
|
|
214
|
-
{
|
|
215
|
-
if (!didWarnOld18Alpha) {
|
|
216
|
-
if (React.startTransition !== undefined) {
|
|
217
|
-
didWarnOld18Alpha = true;
|
|
218
|
-
|
|
219
|
-
error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
} // Read the current snapshot from the store on every render. Again, this
|
|
223
|
-
// breaks the rules of React, and only works here because of specific
|
|
224
|
-
// implementation details, most importantly that updates are
|
|
225
|
-
// always synchronous.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
var value = getSnapshot();
|
|
229
|
-
|
|
230
|
-
{
|
|
231
|
-
if (!didWarnUncachedGetSnapshot) {
|
|
232
|
-
var cachedValue = getSnapshot();
|
|
233
|
-
|
|
234
|
-
if (!objectIs(value, cachedValue)) {
|
|
235
|
-
error('The result of getSnapshot should be cached to avoid an infinite loop');
|
|
236
|
-
|
|
237
|
-
didWarnUncachedGetSnapshot = true;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
} // Because updates are synchronous, we don't queue them. Instead we force a
|
|
241
|
-
// re-render whenever the subscribed state changes by updating an some
|
|
242
|
-
// arbitrary useState hook. Then, during render, we call getSnapshot to read
|
|
243
|
-
// the current value.
|
|
244
|
-
//
|
|
245
|
-
// Because we don't actually use the state returned by the useState hook, we
|
|
246
|
-
// can save a bit of memory by storing other stuff in that slot.
|
|
247
|
-
//
|
|
248
|
-
// To implement the early bailout, we need to track some things on a mutable
|
|
249
|
-
// object. Usually, we would put that in a useRef hook, but we can stash it in
|
|
250
|
-
// our useState hook instead.
|
|
251
|
-
//
|
|
252
|
-
// To force a re-render, we call forceUpdate({inst}). That works because the
|
|
253
|
-
// new object always fails an equality check.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
var _useState = useState({
|
|
257
|
-
inst: {
|
|
258
|
-
value: value,
|
|
259
|
-
getSnapshot: getSnapshot
|
|
260
|
-
}
|
|
261
|
-
}),
|
|
262
|
-
inst = _useState[0].inst,
|
|
263
|
-
forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
|
|
264
|
-
// in the layout phase so we can access it during the tearing check that
|
|
265
|
-
// happens on subscribe.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
useLayoutEffect(function () {
|
|
269
|
-
inst.value = value;
|
|
270
|
-
inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
|
|
271
|
-
// commit phase if there was an interleaved mutation. In concurrent mode
|
|
272
|
-
// this can happen all the time, but even in synchronous mode, an earlier
|
|
273
|
-
// effect may have mutated the store.
|
|
274
|
-
|
|
275
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
276
|
-
// Force a re-render.
|
|
277
|
-
forceUpdate({
|
|
278
|
-
inst: inst
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
}, [subscribe, value, getSnapshot]);
|
|
282
|
-
useEffect(function () {
|
|
283
|
-
// Check for changes right before subscribing. Subsequent changes will be
|
|
284
|
-
// detected in the subscription handler.
|
|
285
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
286
|
-
// Force a re-render.
|
|
287
|
-
forceUpdate({
|
|
288
|
-
inst: inst
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
var handleStoreChange = function () {
|
|
293
|
-
// TODO: Because there is no cross-renderer API for batching updates, it's
|
|
294
|
-
// up to the consumer of this library to wrap their subscription event
|
|
295
|
-
// with unstable_batchedUpdates. Should we try to detect when this isn't
|
|
296
|
-
// the case and print a warning in development?
|
|
297
|
-
// The store changed. Check if the snapshot changed since the last time we
|
|
298
|
-
// read from the store.
|
|
299
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
300
|
-
// Force a re-render.
|
|
301
|
-
forceUpdate({
|
|
302
|
-
inst: inst
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
}; // Subscribe to the store and return a clean-up function.
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
return subscribe(handleStoreChange);
|
|
309
|
-
}, [subscribe]);
|
|
310
|
-
useDebugValue(value);
|
|
311
|
-
return value;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
function checkIfSnapshotChanged(inst) {
|
|
315
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
316
|
-
var prevValue = inst.value;
|
|
317
|
-
|
|
318
|
-
try {
|
|
319
|
-
var nextValue = latestGetSnapshot();
|
|
320
|
-
return !objectIs(prevValue, nextValue);
|
|
321
|
-
} catch (error) {
|
|
322
|
-
return true;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
|
|
327
|
-
// Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
328
|
-
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
329
|
-
// will need to track that themselves and return the correct value
|
|
330
|
-
// from `getSnapshot`.
|
|
331
|
-
return getSnapshot();
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
|
|
335
|
-
|
|
336
|
-
var isServerEnvironment = !canUseDOM;
|
|
337
|
-
|
|
338
|
-
var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
|
|
339
|
-
var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
|
|
340
|
-
|
|
341
|
-
useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
|
|
342
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
343
|
-
if (
|
|
344
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
345
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
346
|
-
'function'
|
|
347
|
-
) {
|
|
348
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
})();
|
|
352
|
-
}
|
|
353
|
-
return useSyncExternalStoreShim_development;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
var hasRequiredShim;
|
|
357
|
-
|
|
358
|
-
function requireShim () {
|
|
359
|
-
if (hasRequiredShim) return shim.exports;
|
|
360
|
-
hasRequiredShim = 1;
|
|
361
|
-
|
|
362
|
-
if (process.env.NODE_ENV === 'production') {
|
|
363
|
-
shim.exports = requireUseSyncExternalStoreShim_production_min();
|
|
364
|
-
} else {
|
|
365
|
-
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
366
|
-
}
|
|
367
|
-
return shim.exports;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* @license React
|
|
372
|
-
* use-sync-external-store-shim/with-selector.production.min.js
|
|
373
|
-
*
|
|
374
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
375
|
-
*
|
|
376
|
-
* This source code is licensed under the MIT license found in the
|
|
377
|
-
* LICENSE file in the root directory of this source tree.
|
|
378
|
-
*/
|
|
379
|
-
|
|
380
|
-
var hasRequiredWithSelector_production_min;
|
|
381
|
-
|
|
382
|
-
function requireWithSelector_production_min () {
|
|
383
|
-
if (hasRequiredWithSelector_production_min) return withSelector_production_min;
|
|
384
|
-
hasRequiredWithSelector_production_min = 1;
|
|
385
|
-
var h=require$$0,n=requireShim();function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q="function"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;
|
|
386
|
-
withSelector_production_min.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:false,value:null};c.current=f;}else f=c.current;c=v(function(){function a(a){if(!c){c=true;d=a;a=l(a);if(undefined!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(undefined!==g&&g(b,e))return b;d=a;return k=e}var c=false,d,k,m=undefined===e?null:e;return [function(){return a(b())},null===m?undefined:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);
|
|
387
|
-
u(function(){f.hasValue=true;f.value=d;},[d]);w(d);return d};
|
|
388
|
-
return withSelector_production_min;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
var withSelector_development = {};
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* @license React
|
|
395
|
-
* use-sync-external-store-shim/with-selector.development.js
|
|
396
|
-
*
|
|
397
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
398
|
-
*
|
|
399
|
-
* This source code is licensed under the MIT license found in the
|
|
400
|
-
* LICENSE file in the root directory of this source tree.
|
|
401
|
-
*/
|
|
402
|
-
|
|
403
|
-
var hasRequiredWithSelector_development;
|
|
404
|
-
|
|
405
|
-
function requireWithSelector_development () {
|
|
406
|
-
if (hasRequiredWithSelector_development) return withSelector_development;
|
|
407
|
-
hasRequiredWithSelector_development = 1;
|
|
408
|
-
|
|
409
|
-
if (process.env.NODE_ENV !== "production") {
|
|
410
|
-
(function() {
|
|
411
|
-
|
|
412
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
413
|
-
if (
|
|
414
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
415
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
416
|
-
'function'
|
|
417
|
-
) {
|
|
418
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
419
|
-
}
|
|
420
|
-
var React = require$$0;
|
|
421
|
-
var shim = requireShim();
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
425
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
426
|
-
*/
|
|
427
|
-
function is(x, y) {
|
|
428
|
-
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
|
429
|
-
;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
|
433
|
-
|
|
434
|
-
var useSyncExternalStore = shim.useSyncExternalStore;
|
|
435
|
-
|
|
436
|
-
// for CommonJS interop.
|
|
437
|
-
|
|
438
|
-
var useRef = React.useRef,
|
|
439
|
-
useEffect = React.useEffect,
|
|
440
|
-
useMemo = React.useMemo,
|
|
441
|
-
useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.
|
|
442
|
-
|
|
443
|
-
function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
444
|
-
// Use this to track the rendered snapshot.
|
|
445
|
-
var instRef = useRef(null);
|
|
446
|
-
var inst;
|
|
447
|
-
|
|
448
|
-
if (instRef.current === null) {
|
|
449
|
-
inst = {
|
|
450
|
-
hasValue: false,
|
|
451
|
-
value: null
|
|
452
|
-
};
|
|
453
|
-
instRef.current = inst;
|
|
454
|
-
} else {
|
|
455
|
-
inst = instRef.current;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
var _useMemo = useMemo(function () {
|
|
459
|
-
// Track the memoized state using closure variables that are local to this
|
|
460
|
-
// memoized instance of a getSnapshot function. Intentionally not using a
|
|
461
|
-
// useRef hook, because that state would be shared across all concurrent
|
|
462
|
-
// copies of the hook/component.
|
|
463
|
-
var hasMemo = false;
|
|
464
|
-
var memoizedSnapshot;
|
|
465
|
-
var memoizedSelection;
|
|
466
|
-
|
|
467
|
-
var memoizedSelector = function (nextSnapshot) {
|
|
468
|
-
if (!hasMemo) {
|
|
469
|
-
// The first time the hook is called, there is no memoized result.
|
|
470
|
-
hasMemo = true;
|
|
471
|
-
memoizedSnapshot = nextSnapshot;
|
|
472
|
-
|
|
473
|
-
var _nextSelection = selector(nextSnapshot);
|
|
474
|
-
|
|
475
|
-
if (isEqual !== undefined) {
|
|
476
|
-
// Even if the selector has changed, the currently rendered selection
|
|
477
|
-
// may be equal to the new selection. We should attempt to reuse the
|
|
478
|
-
// current value if possible, to preserve downstream memoizations.
|
|
479
|
-
if (inst.hasValue) {
|
|
480
|
-
var currentSelection = inst.value;
|
|
481
|
-
|
|
482
|
-
if (isEqual(currentSelection, _nextSelection)) {
|
|
483
|
-
memoizedSelection = currentSelection;
|
|
484
|
-
return currentSelection;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
memoizedSelection = _nextSelection;
|
|
490
|
-
return _nextSelection;
|
|
491
|
-
} // We may be able to reuse the previous invocation's result.
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
// We may be able to reuse the previous invocation's result.
|
|
495
|
-
var prevSnapshot = memoizedSnapshot;
|
|
496
|
-
var prevSelection = memoizedSelection;
|
|
497
|
-
|
|
498
|
-
if (objectIs(prevSnapshot, nextSnapshot)) {
|
|
499
|
-
// The snapshot is the same as last time. Reuse the previous selection.
|
|
500
|
-
return prevSelection;
|
|
501
|
-
} // The snapshot has changed, so we need to compute a new selection.
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
// The snapshot has changed, so we need to compute a new selection.
|
|
505
|
-
var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data
|
|
506
|
-
// has changed. If it hasn't, return the previous selection. That signals
|
|
507
|
-
// to React that the selections are conceptually equal, and we can bail
|
|
508
|
-
// out of rendering.
|
|
509
|
-
|
|
510
|
-
// If a custom isEqual function is provided, use that to check if the data
|
|
511
|
-
// has changed. If it hasn't, return the previous selection. That signals
|
|
512
|
-
// to React that the selections are conceptually equal, and we can bail
|
|
513
|
-
// out of rendering.
|
|
514
|
-
if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {
|
|
515
|
-
return prevSelection;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
memoizedSnapshot = nextSnapshot;
|
|
519
|
-
memoizedSelection = nextSelection;
|
|
520
|
-
return nextSelection;
|
|
521
|
-
}; // Assigning this to a constant so that Flow knows it can't change.
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
// Assigning this to a constant so that Flow knows it can't change.
|
|
525
|
-
var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;
|
|
526
|
-
|
|
527
|
-
var getSnapshotWithSelector = function () {
|
|
528
|
-
return memoizedSelector(getSnapshot());
|
|
529
|
-
};
|
|
530
|
-
|
|
531
|
-
var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {
|
|
532
|
-
return memoizedSelector(maybeGetServerSnapshot());
|
|
533
|
-
};
|
|
534
|
-
return [getSnapshotWithSelector, getServerSnapshotWithSelector];
|
|
535
|
-
}, [getSnapshot, getServerSnapshot, selector, isEqual]),
|
|
536
|
-
getSelection = _useMemo[0],
|
|
537
|
-
getServerSelection = _useMemo[1];
|
|
538
|
-
|
|
539
|
-
var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
|
|
540
|
-
useEffect(function () {
|
|
541
|
-
inst.hasValue = true;
|
|
542
|
-
inst.value = value;
|
|
543
|
-
}, [value]);
|
|
544
|
-
useDebugValue(value);
|
|
545
|
-
return value;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
withSelector_development.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
|
|
549
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
550
|
-
if (
|
|
551
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
552
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
553
|
-
'function'
|
|
554
|
-
) {
|
|
555
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
})();
|
|
559
|
-
}
|
|
560
|
-
return withSelector_development;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
var hasRequiredWithSelector;
|
|
564
|
-
|
|
565
|
-
function requireWithSelector () {
|
|
566
|
-
if (hasRequiredWithSelector) return withSelector.exports;
|
|
567
|
-
hasRequiredWithSelector = 1;
|
|
568
|
-
|
|
569
|
-
if (process.env.NODE_ENV === 'production') {
|
|
570
|
-
withSelector.exports = requireWithSelector_production_min();
|
|
571
|
-
} else {
|
|
572
|
-
withSelector.exports = requireWithSelector_development();
|
|
573
|
-
}
|
|
574
|
-
return withSelector.exports;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
var withSelectorExports = requireWithSelector();
|
|
578
|
-
|
|
579
|
-
function useStore(store$1, argument1, argument2) {
|
|
580
|
-
const selector = store.makeSelector(
|
|
581
|
-
typeof argument1 === "function" || typeof argument1 === "string" ? argument1 : undefined
|
|
582
|
-
);
|
|
583
|
-
const allOptions = typeof argument1 === "object" ? argument1 : argument2 ?? {};
|
|
584
|
-
const lastEqualsRef = require$$0.useRef();
|
|
585
|
-
if (store$1.derivedFrom) {
|
|
586
|
-
return useStore(
|
|
587
|
-
store$1.derivedFrom.store,
|
|
588
|
-
(value2) => {
|
|
589
|
-
for (const selector2 of store$1.derivedFrom.selectors) {
|
|
590
|
-
value2 = store.makeSelector(selector2)(value2);
|
|
591
|
-
}
|
|
592
|
-
return selector(value2);
|
|
593
|
-
},
|
|
594
|
-
allOptions
|
|
595
|
-
);
|
|
596
|
-
}
|
|
597
|
-
const {
|
|
598
|
-
disableTrackingProxy = true,
|
|
599
|
-
equals = store$1.options.equals ?? propAccess.deepEqual,
|
|
600
|
-
withViewTransition,
|
|
601
|
-
...options
|
|
602
|
-
} = allOptions;
|
|
603
|
-
const subOptions = { ...options, runNow: false };
|
|
604
|
-
const subscribe = require$$0.useCallback(
|
|
605
|
-
(listener) => {
|
|
606
|
-
let _listener = listener;
|
|
607
|
-
let stopped = false;
|
|
608
|
-
if (withViewTransition && document.startViewTransition) {
|
|
609
|
-
let lastObservedValue;
|
|
610
|
-
_listener = (value2) => {
|
|
611
|
-
const observedValue = withViewTransition instanceof Function ? withViewTransition(value2) : value2;
|
|
612
|
-
if (equals(lastObservedValue, observedValue)) {
|
|
613
|
-
listener();
|
|
614
|
-
return;
|
|
615
|
-
}
|
|
616
|
-
lastObservedValue = observedValue;
|
|
617
|
-
let hasChanges = false;
|
|
618
|
-
const mutationObserver = new MutationObserver(() => {
|
|
619
|
-
hasChanges = true;
|
|
620
|
-
mutationObserver.disconnect();
|
|
621
|
-
});
|
|
622
|
-
mutationObserver.observe(document.body, { childList: true, subtree: true });
|
|
623
|
-
document.startViewTransition(() => {
|
|
624
|
-
mutationObserver.disconnect();
|
|
625
|
-
if (!stopped) {
|
|
626
|
-
listener();
|
|
627
|
-
}
|
|
628
|
-
if (!hasChanges) {
|
|
629
|
-
throw new Error("no change");
|
|
630
|
-
}
|
|
631
|
-
});
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
const cancel = store$1.subscribe(_listener, subOptions);
|
|
635
|
-
return () => {
|
|
636
|
-
stopped = true;
|
|
637
|
-
cancel();
|
|
638
|
-
};
|
|
639
|
-
},
|
|
640
|
-
[store$1, hash.simpleHash(subOptions)]
|
|
641
|
-
);
|
|
642
|
-
let value = withSelectorExports.useSyncExternalStoreWithSelector(
|
|
643
|
-
//
|
|
644
|
-
subscribe,
|
|
645
|
-
store$1.get,
|
|
646
|
-
undefined,
|
|
647
|
-
(x) => selector(x),
|
|
648
|
-
(_v, newValue) => lastEqualsRef.current?.(newValue) ?? false
|
|
649
|
-
);
|
|
650
|
-
let lastEquals = (newValue) => equals(newValue, value);
|
|
651
|
-
let revoke;
|
|
652
|
-
if (!disableTrackingProxy) {
|
|
653
|
-
[value, lastEquals, revoke] = trackingProxy(value, equals);
|
|
654
|
-
}
|
|
655
|
-
require$$0.useLayoutEffect(() => {
|
|
656
|
-
lastEqualsRef.current = lastEquals;
|
|
657
|
-
revoke?.();
|
|
658
|
-
});
|
|
659
|
-
require$$0.useDebugValue(value);
|
|
660
|
-
return value;
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
const LoadingBoundaryContext = require$$0.createContext(store.createStore(/* @__PURE__ */ new Set()));
|
|
664
|
-
function LoadingBoundary({
|
|
665
|
-
fallback,
|
|
666
|
-
children,
|
|
667
|
-
isLoading: isLoadingExternal
|
|
668
|
-
}) {
|
|
669
|
-
const store$1 = require$$0.useMemo(() => store.createStore(/* @__PURE__ */ new Set()), []);
|
|
670
|
-
const entries = useStore(store$1);
|
|
671
|
-
const isLoading = entries.size > 0 || isLoadingExternal;
|
|
672
|
-
const fallbackNode = isLoading ? typeof fallback === "function" ? fallback([...entries]) : fallback : undefined;
|
|
673
|
-
return /* @__PURE__ */ jsxRuntime.jsx(LoadingBoundaryContext.Provider, { value: store$1, children: fallbackNode !== undefined ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
674
|
-
fallbackNode,
|
|
675
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "none" }, children })
|
|
676
|
-
] }) : children });
|
|
677
|
-
}
|
|
678
|
-
function useLoadingBoundary(isLoading, label) {
|
|
679
|
-
const store = require$$0.useContext(LoadingBoundaryContext);
|
|
680
|
-
require$$0.useLayoutEffect(() => {
|
|
681
|
-
if (!isLoading) {
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
const entry = { label };
|
|
685
|
-
store.set((entries) => new Set(entries).add(entry));
|
|
686
|
-
return () => {
|
|
687
|
-
store.set((entries) => {
|
|
688
|
-
const newEntries = new Set(entries);
|
|
689
|
-
newEntries.delete(entry);
|
|
690
|
-
return newEntries;
|
|
691
|
-
});
|
|
692
|
-
};
|
|
693
|
-
}, [isLoading]);
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
function useCache(cache, {
|
|
697
|
-
passive,
|
|
698
|
-
disabled,
|
|
699
|
-
updateOnMount,
|
|
700
|
-
withViewTransition,
|
|
701
|
-
suspense,
|
|
702
|
-
loadingBoundary,
|
|
703
|
-
...options
|
|
704
|
-
} = {}) {
|
|
705
|
-
if (withViewTransition === true) {
|
|
706
|
-
withViewTransition = (state) => state.value;
|
|
707
|
-
}
|
|
708
|
-
const { rootCache, selector } = require$$0.useMemo(() => {
|
|
709
|
-
const rootCache2 = cache.derivedFromCache?.cache ?? cache;
|
|
710
|
-
let selector2 = (x) => x;
|
|
711
|
-
if (cache.derivedFromCache) {
|
|
712
|
-
selector2 = (value) => {
|
|
713
|
-
for (const s of cache.derivedFromCache.selectors) {
|
|
714
|
-
value = store.makeSelector(s)(value);
|
|
715
|
-
}
|
|
716
|
-
return value;
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
return { rootCache: rootCache2, selector: selector2 };
|
|
720
|
-
}, [cache]);
|
|
721
|
-
const hasMounted = require$$0.useRef(false);
|
|
722
|
-
require$$0.useEffect(() => {
|
|
723
|
-
hasMounted.current = true;
|
|
724
|
-
if (updateOnMount) {
|
|
725
|
-
rootCache.invalidate();
|
|
726
|
-
}
|
|
727
|
-
}, []);
|
|
728
|
-
const result = useStore(
|
|
729
|
-
rootCache.state,
|
|
730
|
-
(state) => {
|
|
731
|
-
if (disabled) {
|
|
732
|
-
return Object.assign(
|
|
733
|
-
[undefined, undefined, false, false],
|
|
734
|
-
{ status: "pending", isUpdating: false, isStale: false, isConnected: false }
|
|
735
|
-
);
|
|
736
|
-
}
|
|
737
|
-
const isStale = updateOnMount && !hasMounted.current ? true : state.isStale;
|
|
738
|
-
try {
|
|
739
|
-
const value = state.status === "value" ? selector(state.value) : void 0;
|
|
740
|
-
return Object.assign(
|
|
741
|
-
[value, state.error, state.isUpdating, isStale],
|
|
742
|
-
{ ...state, value, isStale }
|
|
743
|
-
);
|
|
744
|
-
} catch (error) {
|
|
745
|
-
return Object.assign(
|
|
746
|
-
[undefined, error, state.isUpdating, isStale],
|
|
747
|
-
{
|
|
748
|
-
status: "error",
|
|
749
|
-
error,
|
|
750
|
-
isUpdating: state.isUpdating,
|
|
751
|
-
isStale,
|
|
752
|
-
isConnected: state.isConnected
|
|
753
|
-
}
|
|
754
|
-
);
|
|
755
|
-
}
|
|
756
|
-
},
|
|
757
|
-
{ ...options, withViewTransition, passive: passive || disabled }
|
|
758
|
-
);
|
|
759
|
-
require$$0.useEffect(
|
|
760
|
-
() => rootCache.subscribe(() => undefined, { passive: passive || disabled }),
|
|
761
|
-
[rootCache, passive || disabled]
|
|
762
|
-
);
|
|
763
|
-
useLoadingBoundary(loadingBoundary && !disabled && result.status === "pending");
|
|
764
|
-
if (suspense && result.status === "pending") {
|
|
765
|
-
throw rootCache.get();
|
|
766
|
-
}
|
|
767
|
-
return result;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
const cacheMethods = {
|
|
771
|
-
useCache(options) {
|
|
772
|
-
return useCache(this, options);
|
|
773
|
-
}
|
|
774
|
-
};
|
|
775
|
-
|
|
776
|
-
function useProp(store, argument1, argument2, argument3) {
|
|
777
|
-
const selector = typeof argument1 === "function" || typeof argument1 === "string" ? argument1 : undefined;
|
|
778
|
-
const updater = typeof argument2 === "function" ? argument2 : undefined;
|
|
779
|
-
const options = typeof argument1 === "object" ? argument1 : typeof argument2 === "object" ? argument2 : argument3;
|
|
780
|
-
if (selector) {
|
|
781
|
-
store = store.map(selector, updater);
|
|
782
|
-
}
|
|
783
|
-
const value = useStore(store, options);
|
|
784
|
-
return [value, store.set];
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
function getScopeContext(scope) {
|
|
788
|
-
scope.context ??= require$$0.createContext(store.createStore(scope.defaultValue));
|
|
789
|
-
return scope.context;
|
|
790
|
-
}
|
|
791
|
-
function ScopeProvider({
|
|
792
|
-
scope,
|
|
793
|
-
store: inputStore,
|
|
794
|
-
children
|
|
795
|
-
}) {
|
|
796
|
-
const context = getScopeContext(scope);
|
|
797
|
-
const currentStore = require$$0.useMemo(
|
|
798
|
-
() => inputStore ?? store.createStore(scope.defaultValue),
|
|
799
|
-
[scope, inputStore]
|
|
800
|
-
);
|
|
801
|
-
return /* @__PURE__ */ jsxRuntime.jsx(context.Provider, { value: currentStore, children });
|
|
802
|
-
}
|
|
803
|
-
function useScope(scope) {
|
|
804
|
-
const context = getScopeContext(scope);
|
|
805
|
-
return require$$0.useContext(context);
|
|
806
|
-
}
|
|
807
|
-
function useScopeStore(scope, ...args) {
|
|
808
|
-
const store = useScope(scope);
|
|
809
|
-
return useStore(store, ...args);
|
|
810
|
-
}
|
|
811
|
-
function useScopeProp(scope, ...args) {
|
|
812
|
-
const store = useScope(scope);
|
|
813
|
-
return useProp(store, ...args);
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
function boundUseScope() {
|
|
817
|
-
return useScope(this);
|
|
818
|
-
}
|
|
819
|
-
function boundUseScopeStore(...args) {
|
|
820
|
-
return useScopeStore(this, ...args);
|
|
821
|
-
}
|
|
822
|
-
function boundUseScopeProp(...args) {
|
|
823
|
-
return useScopeProp(this, ...args);
|
|
824
|
-
}
|
|
825
|
-
function Provider(props) {
|
|
826
|
-
return ScopeProvider({ ...props, scope: this });
|
|
827
|
-
}
|
|
828
|
-
const scopeMethods = {
|
|
829
|
-
useScope: boundUseScope,
|
|
830
|
-
useStore: boundUseScopeStore,
|
|
831
|
-
useProp: boundUseScopeProp,
|
|
832
|
-
Provider
|
|
833
|
-
};
|
|
834
|
-
|
|
835
|
-
function boundUseStore(...args) {
|
|
836
|
-
return useStore(this, ...args);
|
|
837
|
-
}
|
|
838
|
-
function boundUseProp(...args) {
|
|
839
|
-
return useProp(this, ...args);
|
|
840
|
-
}
|
|
841
|
-
const storeMethods = {
|
|
842
|
-
useStore: boundUseStore,
|
|
843
|
-
useProp: boundUseProp
|
|
844
|
-
};
|
|
845
|
-
|
|
846
|
-
exports.LoadingBoundary = LoadingBoundary;
|
|
847
|
-
exports.ScopeProvider = ScopeProvider;
|
|
848
|
-
exports.cacheMethods = cacheMethods;
|
|
849
|
-
exports.scopeMethods = scopeMethods;
|
|
850
|
-
exports.storeMethods = storeMethods;
|
|
851
|
-
exports.useCache = useCache;
|
|
852
|
-
exports.useLoadingBoundary = useLoadingBoundary;
|
|
853
|
-
exports.useProp = useProp;
|
|
854
|
-
exports.useScope = useScope;
|
|
855
|
-
exports.useStore = useStore;
|
|
856
|
-
//# sourceMappingURL=storeMethods.cjs.map
|