react-shared-states 1.0.13 → 1.0.15
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/README.md +5 -5
- package/dist/SharedValuesManager.d.ts +9 -0
- package/dist/hooks/use-shared-function.d.ts +6 -0
- package/dist/hooks/use-shared-state.d.ts +2 -0
- package/dist/hooks/use-shared-subscription.d.ts +6 -0
- package/dist/main.esm.js +351 -321
- package/dist/main.min.js +5 -5
- package/package.json +1 -1
- package/tests/index.test.tsx +70 -0
package/dist/main.esm.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-shared-states v1.0.
|
|
2
|
+
* react-shared-states v1.0.15
|
|
3
3
|
* (c) Hichem Taboukouyout
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
* Github: github.com/HichemTab-tech/react-shared-states
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import ve, { createContext as be, useMemo as
|
|
9
|
-
function me(
|
|
10
|
-
return
|
|
8
|
+
import ve, { createContext as be, useMemo as A, useContext as xe, useEffect as se, useSyncExternalStore as V, useRef as Ee } from "react";
|
|
9
|
+
function me(o) {
|
|
10
|
+
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
11
11
|
}
|
|
12
|
-
var F = { exports: {} },
|
|
12
|
+
var F = { exports: {} }, D = {};
|
|
13
13
|
/**
|
|
14
14
|
* @license React
|
|
15
15
|
* react-jsx-runtime.production.js
|
|
@@ -20,28 +20,28 @@ var F = { exports: {} }, C = {};
|
|
|
20
20
|
* LICENSE file in the root directory of this source tree.
|
|
21
21
|
*/
|
|
22
22
|
var Q;
|
|
23
|
-
function
|
|
24
|
-
if (Q) return
|
|
23
|
+
function _e() {
|
|
24
|
+
if (Q) return D;
|
|
25
25
|
Q = 1;
|
|
26
|
-
var
|
|
27
|
-
function r(t,
|
|
28
|
-
var
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
for (var f in
|
|
32
|
-
f !== "key" && (
|
|
33
|
-
} else
|
|
34
|
-
return
|
|
35
|
-
$$typeof:
|
|
26
|
+
var o = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
|
|
27
|
+
function r(t, i, n) {
|
|
28
|
+
var s = null;
|
|
29
|
+
if (n !== void 0 && (s = "" + n), i.key !== void 0 && (s = "" + i.key), "key" in i) {
|
|
30
|
+
n = {};
|
|
31
|
+
for (var f in i)
|
|
32
|
+
f !== "key" && (n[f] = i[f]);
|
|
33
|
+
} else n = i;
|
|
34
|
+
return i = n.ref, {
|
|
35
|
+
$$typeof: o,
|
|
36
36
|
type: t,
|
|
37
|
-
key:
|
|
38
|
-
ref:
|
|
39
|
-
props:
|
|
37
|
+
key: s,
|
|
38
|
+
ref: i !== void 0 ? i : null,
|
|
39
|
+
props: n
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
return
|
|
42
|
+
return D.Fragment = e, D.jsx = r, D.jsxs = r, D;
|
|
43
43
|
}
|
|
44
|
-
var
|
|
44
|
+
var C = {};
|
|
45
45
|
/**
|
|
46
46
|
* @license React
|
|
47
47
|
* react-jsx-runtime.development.js
|
|
@@ -52,17 +52,17 @@ var D = {};
|
|
|
52
52
|
* LICENSE file in the root directory of this source tree.
|
|
53
53
|
*/
|
|
54
54
|
var K;
|
|
55
|
-
function
|
|
55
|
+
function Re() {
|
|
56
56
|
return K || (K = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
57
|
-
function
|
|
58
|
-
if (
|
|
59
|
-
if (typeof
|
|
60
|
-
return
|
|
61
|
-
if (typeof
|
|
62
|
-
switch (
|
|
57
|
+
function o(a) {
|
|
58
|
+
if (a == null) return null;
|
|
59
|
+
if (typeof a == "function")
|
|
60
|
+
return a.$$typeof === he ? null : a.displayName || a.name || null;
|
|
61
|
+
if (typeof a == "string") return a;
|
|
62
|
+
switch (a) {
|
|
63
63
|
case x:
|
|
64
64
|
return "Fragment";
|
|
65
|
-
case
|
|
65
|
+
case L:
|
|
66
66
|
return "Profiler";
|
|
67
67
|
case O:
|
|
68
68
|
return "StrictMode";
|
|
@@ -73,130 +73,130 @@ function _e() {
|
|
|
73
73
|
case pe:
|
|
74
74
|
return "Activity";
|
|
75
75
|
}
|
|
76
|
-
if (typeof
|
|
77
|
-
switch (typeof
|
|
76
|
+
if (typeof a == "object")
|
|
77
|
+
switch (typeof a.tag == "number" && console.error(
|
|
78
78
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
79
|
-
),
|
|
79
|
+
), a.$$typeof) {
|
|
80
80
|
case v:
|
|
81
81
|
return "Portal";
|
|
82
82
|
case ce:
|
|
83
|
-
return (
|
|
84
|
-
case
|
|
85
|
-
return (
|
|
83
|
+
return (a.displayName || "Context") + ".Provider";
|
|
84
|
+
case oe:
|
|
85
|
+
return (a._context.displayName || "Context") + ".Consumer";
|
|
86
86
|
case ue:
|
|
87
|
-
var u =
|
|
88
|
-
return
|
|
87
|
+
var u = a.render;
|
|
88
|
+
return a = a.displayName, a || (a = u.displayName || u.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
|
|
89
89
|
case de:
|
|
90
|
-
return u =
|
|
91
|
-
case
|
|
92
|
-
u =
|
|
90
|
+
return u = a.displayName || null, u !== null ? u : o(a.type) || "Memo";
|
|
91
|
+
case B:
|
|
92
|
+
u = a._payload, a = a._init;
|
|
93
93
|
try {
|
|
94
|
-
return
|
|
94
|
+
return o(a(u));
|
|
95
95
|
} catch {
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
return null;
|
|
99
99
|
}
|
|
100
|
-
function e(
|
|
101
|
-
return "" +
|
|
100
|
+
function e(a) {
|
|
101
|
+
return "" + a;
|
|
102
102
|
}
|
|
103
|
-
function r(
|
|
103
|
+
function r(a) {
|
|
104
104
|
try {
|
|
105
|
-
e(
|
|
105
|
+
e(a);
|
|
106
106
|
var u = !1;
|
|
107
107
|
} catch {
|
|
108
108
|
u = !0;
|
|
109
109
|
}
|
|
110
110
|
if (u) {
|
|
111
111
|
u = console;
|
|
112
|
-
var h = u.error, E = typeof Symbol == "function" && Symbol.toStringTag &&
|
|
112
|
+
var h = u.error, E = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
|
|
113
113
|
return h.call(
|
|
114
114
|
u,
|
|
115
115
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
116
116
|
E
|
|
117
|
-
), e(
|
|
117
|
+
), e(a);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
function t(
|
|
121
|
-
if (
|
|
122
|
-
if (typeof
|
|
120
|
+
function t(a) {
|
|
121
|
+
if (a === x) return "<>";
|
|
122
|
+
if (typeof a == "object" && a !== null && a.$$typeof === B)
|
|
123
123
|
return "<...>";
|
|
124
124
|
try {
|
|
125
|
-
var u =
|
|
125
|
+
var u = o(a);
|
|
126
126
|
return u ? "<" + u + ">" : "<...>";
|
|
127
127
|
} catch {
|
|
128
128
|
return "<...>";
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
var
|
|
133
|
-
return
|
|
131
|
+
function i() {
|
|
132
|
+
var a = $.A;
|
|
133
|
+
return a === null ? null : a.getOwner();
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function n() {
|
|
136
136
|
return Error("react-stack-top-frame");
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
if (
|
|
140
|
-
var u = Object.getOwnPropertyDescriptor(
|
|
138
|
+
function s(a) {
|
|
139
|
+
if (J.call(a, "key")) {
|
|
140
|
+
var u = Object.getOwnPropertyDescriptor(a, "key").get;
|
|
141
141
|
if (u && u.isReactWarning) return !1;
|
|
142
142
|
}
|
|
143
|
-
return
|
|
143
|
+
return a.key !== void 0;
|
|
144
144
|
}
|
|
145
|
-
function f(
|
|
145
|
+
function f(a, u) {
|
|
146
146
|
function h() {
|
|
147
|
-
|
|
147
|
+
M || (M = !0, console.error(
|
|
148
148
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
149
149
|
u
|
|
150
150
|
));
|
|
151
151
|
}
|
|
152
|
-
h.isReactWarning = !0, Object.defineProperty(
|
|
152
|
+
h.isReactWarning = !0, Object.defineProperty(a, "key", {
|
|
153
153
|
get: h,
|
|
154
154
|
configurable: !0
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
function c() {
|
|
158
|
-
var
|
|
159
|
-
return
|
|
158
|
+
var a = o(this.type);
|
|
159
|
+
return X[a] || (X[a] = !0, console.error(
|
|
160
160
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
161
|
-
)),
|
|
161
|
+
)), a = this.props.ref, a !== void 0 ? a : null;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
return h =
|
|
163
|
+
function S(a, u, h, E, y, T, I, q) {
|
|
164
|
+
return h = T.ref, a = {
|
|
165
165
|
$$typeof: b,
|
|
166
|
-
type:
|
|
166
|
+
type: a,
|
|
167
167
|
key: u,
|
|
168
|
-
props:
|
|
169
|
-
_owner:
|
|
170
|
-
}, (h !== void 0 ? h : null) !== null ? Object.defineProperty(
|
|
168
|
+
props: T,
|
|
169
|
+
_owner: y
|
|
170
|
+
}, (h !== void 0 ? h : null) !== null ? Object.defineProperty(a, "ref", {
|
|
171
171
|
enumerable: !1,
|
|
172
172
|
get: c
|
|
173
|
-
}) : Object.defineProperty(
|
|
173
|
+
}) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
174
174
|
configurable: !1,
|
|
175
175
|
enumerable: !1,
|
|
176
176
|
writable: !0,
|
|
177
177
|
value: 0
|
|
178
|
-
}), Object.defineProperty(
|
|
178
|
+
}), Object.defineProperty(a, "_debugInfo", {
|
|
179
179
|
configurable: !1,
|
|
180
180
|
enumerable: !1,
|
|
181
181
|
writable: !0,
|
|
182
182
|
value: null
|
|
183
|
-
}), Object.defineProperty(
|
|
183
|
+
}), Object.defineProperty(a, "_debugStack", {
|
|
184
184
|
configurable: !1,
|
|
185
185
|
enumerable: !1,
|
|
186
186
|
writable: !0,
|
|
187
|
-
value:
|
|
188
|
-
}), Object.defineProperty(
|
|
187
|
+
value: I
|
|
188
|
+
}), Object.defineProperty(a, "_debugTask", {
|
|
189
189
|
configurable: !1,
|
|
190
190
|
enumerable: !1,
|
|
191
191
|
writable: !0,
|
|
192
|
-
value:
|
|
193
|
-
}), Object.freeze && (Object.freeze(
|
|
192
|
+
value: q
|
|
193
|
+
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
194
194
|
}
|
|
195
|
-
function p(
|
|
195
|
+
function p(a, u, h, E, y, T, I, q) {
|
|
196
196
|
var m = u.children;
|
|
197
197
|
if (m !== void 0)
|
|
198
198
|
if (E)
|
|
199
|
-
if (
|
|
199
|
+
if (ge(m)) {
|
|
200
200
|
for (E = 0; E < m.length; E++)
|
|
201
201
|
l(m[E]);
|
|
202
202
|
Object.freeze && Object.freeze(m);
|
|
@@ -205,12 +205,12 @@ function _e() {
|
|
|
205
205
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
206
206
|
);
|
|
207
207
|
else l(m);
|
|
208
|
-
if (
|
|
209
|
-
m =
|
|
210
|
-
var
|
|
211
|
-
return
|
|
208
|
+
if (J.call(u, "key")) {
|
|
209
|
+
m = o(a);
|
|
210
|
+
var P = Object.keys(u).filter(function(Se) {
|
|
211
|
+
return Se !== "key";
|
|
212
212
|
});
|
|
213
|
-
E = 0 <
|
|
213
|
+
E = 0 < P.length ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}", k[m + E] || (P = 0 < P.length ? "{" + P.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
214
214
|
`A props object containing a "key" prop is being spread into JSX:
|
|
215
215
|
let props = %s;
|
|
216
216
|
<%s {...props} />
|
|
@@ -219,92 +219,92 @@ React keys must be passed directly to JSX without using spread:
|
|
|
219
219
|
<%s key={someKey} {...props} />`,
|
|
220
220
|
E,
|
|
221
221
|
m,
|
|
222
|
-
|
|
222
|
+
P,
|
|
223
223
|
m
|
|
224
|
-
),
|
|
224
|
+
), k[m + E] = !0);
|
|
225
225
|
}
|
|
226
|
-
if (m = null, h !== void 0 && (r(h), m = "" + h),
|
|
226
|
+
if (m = null, h !== void 0 && (r(h), m = "" + h), s(u) && (r(u.key), m = "" + u.key), "key" in u) {
|
|
227
227
|
h = {};
|
|
228
|
-
for (var
|
|
229
|
-
|
|
228
|
+
for (var W in u)
|
|
229
|
+
W !== "key" && (h[W] = u[W]);
|
|
230
230
|
} else h = u;
|
|
231
231
|
return m && f(
|
|
232
232
|
h,
|
|
233
|
-
typeof
|
|
234
|
-
),
|
|
235
|
-
|
|
233
|
+
typeof a == "function" ? a.displayName || a.name || "Unknown" : a
|
|
234
|
+
), S(
|
|
235
|
+
a,
|
|
236
236
|
m,
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
T,
|
|
238
|
+
y,
|
|
239
|
+
i(),
|
|
240
240
|
h,
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
I,
|
|
242
|
+
q
|
|
243
243
|
);
|
|
244
244
|
}
|
|
245
|
-
function l(
|
|
246
|
-
typeof
|
|
245
|
+
function l(a) {
|
|
246
|
+
typeof a == "object" && a !== null && a.$$typeof === b && a._store && (a._store.validated = 1);
|
|
247
247
|
}
|
|
248
|
-
var
|
|
248
|
+
var _ = ve, b = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), L = Symbol.for("react.profiler"), oe = Symbol.for("react.consumer"), ce = Symbol.for("react.context"), ue = Symbol.for("react.forward_ref"), fe = Symbol.for("react.suspense"), le = Symbol.for("react.suspense_list"), de = Symbol.for("react.memo"), B = Symbol.for("react.lazy"), pe = Symbol.for("react.activity"), he = Symbol.for("react.client.reference"), $ = _.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, ge = Array.isArray, Y = console.createTask ? console.createTask : function() {
|
|
249
249
|
return null;
|
|
250
250
|
};
|
|
251
|
-
|
|
252
|
-
react_stack_bottom_frame: function(
|
|
253
|
-
return
|
|
251
|
+
_ = {
|
|
252
|
+
react_stack_bottom_frame: function(a) {
|
|
253
|
+
return a();
|
|
254
254
|
}
|
|
255
255
|
};
|
|
256
|
-
var
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
)(),
|
|
260
|
-
|
|
261
|
-
var
|
|
256
|
+
var M, X = {}, H = _.react_stack_bottom_frame.bind(
|
|
257
|
+
_,
|
|
258
|
+
n
|
|
259
|
+
)(), Z = Y(t(n)), k = {};
|
|
260
|
+
C.Fragment = x, C.jsx = function(a, u, h, E, y) {
|
|
261
|
+
var T = 1e4 > $.recentlyCreatedOwnerStacks++;
|
|
262
262
|
return p(
|
|
263
|
-
|
|
263
|
+
a,
|
|
264
264
|
u,
|
|
265
265
|
h,
|
|
266
266
|
!1,
|
|
267
267
|
E,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
268
|
+
y,
|
|
269
|
+
T ? Error("react-stack-top-frame") : H,
|
|
270
|
+
T ? Y(t(a)) : Z
|
|
271
271
|
);
|
|
272
|
-
},
|
|
273
|
-
var
|
|
272
|
+
}, C.jsxs = function(a, u, h, E, y) {
|
|
273
|
+
var T = 1e4 > $.recentlyCreatedOwnerStacks++;
|
|
274
274
|
return p(
|
|
275
|
-
|
|
275
|
+
a,
|
|
276
276
|
u,
|
|
277
277
|
h,
|
|
278
278
|
!0,
|
|
279
279
|
E,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
280
|
+
y,
|
|
281
|
+
T ? Error("react-stack-top-frame") : H,
|
|
282
|
+
T ? Y(t(a)) : Z
|
|
283
283
|
);
|
|
284
284
|
};
|
|
285
|
-
})()),
|
|
285
|
+
})()), C;
|
|
286
286
|
}
|
|
287
287
|
var ee;
|
|
288
|
-
function
|
|
289
|
-
return ee || (ee = 1, process.env.NODE_ENV === "production" ? F.exports =
|
|
288
|
+
function we() {
|
|
289
|
+
return ee || (ee = 1, process.env.NODE_ENV === "production" ? F.exports = _e() : F.exports = Re()), F.exports;
|
|
290
290
|
}
|
|
291
|
-
var
|
|
292
|
-
let
|
|
293
|
-
const $e = (
|
|
294
|
-
|
|
295
|
-
},
|
|
296
|
-
|
|
291
|
+
var Te = we();
|
|
292
|
+
let ne = !1;
|
|
293
|
+
const $e = (o) => {
|
|
294
|
+
ne = o;
|
|
295
|
+
}, G = (...o) => {
|
|
296
|
+
ne && console.log(
|
|
297
297
|
"%c[react-shared-states]",
|
|
298
298
|
"color: #007acc; font-weight: bold",
|
|
299
|
-
...
|
|
299
|
+
...o
|
|
300
300
|
);
|
|
301
|
-
}, j = (
|
|
302
|
-
if (!
|
|
303
|
-
return
|
|
304
|
-
}, ae = () => Math.random().toString(36).substring(2, 15),
|
|
301
|
+
}, j = (o) => {
|
|
302
|
+
if (!o) throw new Error("Value is empty");
|
|
303
|
+
return o;
|
|
304
|
+
}, ae = () => Math.random().toString(36).substring(2, 15), ie = be(void 0), Ye = ({ children: o, scopeName: e }) => {
|
|
305
305
|
if (e && e.includes("//")) throw new Error("scopeName cannot contain '//'");
|
|
306
|
-
return e || (e =
|
|
307
|
-
},
|
|
306
|
+
return e || (e = A(() => ae(), [])), /* @__PURE__ */ Te.jsx(ie.Provider, { value: { scopeName: e }, children: o });
|
|
307
|
+
}, Ae = () => xe(ie), te = [];
|
|
308
308
|
class d {
|
|
309
309
|
data = /* @__PURE__ */ new Map();
|
|
310
310
|
defaultValue() {
|
|
@@ -317,42 +317,42 @@ class d {
|
|
|
317
317
|
}), this.data.get(d.prefix(e, r)).listeners.push(t);
|
|
318
318
|
}
|
|
319
319
|
removeListener(e, r, t) {
|
|
320
|
-
this.data.has(d.prefix(e, r)) && (this.data.get(d.prefix(e, r)).listeners = this.data.get(d.prefix(e, r)).listeners.filter((
|
|
320
|
+
this.data.has(d.prefix(e, r)) && (this.data.get(d.prefix(e, r)).listeners = this.data.get(d.prefix(e, r)).listeners.filter((i) => i !== t));
|
|
321
321
|
}
|
|
322
322
|
callListeners(e, r) {
|
|
323
323
|
this.data.has(d.prefix(e, r)) && this.data.get(d.prefix(e, r)).listeners.forEach((t) => t());
|
|
324
324
|
}
|
|
325
|
-
init(e, r, t,
|
|
325
|
+
init(e, r, t, i = !1) {
|
|
326
326
|
this.data.has(d.prefix(e, r)) || this.data.set(d.prefix(e, r), {
|
|
327
327
|
...t,
|
|
328
|
-
isStatic:
|
|
328
|
+
isStatic: i,
|
|
329
329
|
listeners: []
|
|
330
330
|
});
|
|
331
331
|
}
|
|
332
332
|
createStatic(e, r) {
|
|
333
|
-
const t = r ?? r ?? "_global",
|
|
333
|
+
const t = r ?? r ?? "_global", i = {
|
|
334
334
|
key: ae(),
|
|
335
335
|
prefix: t,
|
|
336
336
|
...e
|
|
337
337
|
};
|
|
338
|
-
return te.push(
|
|
338
|
+
return te.push(i), this.initStatic(i), i;
|
|
339
339
|
}
|
|
340
340
|
initStatic(e) {
|
|
341
341
|
const { key: r, prefix: t } = e;
|
|
342
342
|
this.init(r, t, this.defaultValue(), !0);
|
|
343
343
|
}
|
|
344
344
|
clearAll(e = !1, r = !1) {
|
|
345
|
-
this.data.forEach((t,
|
|
346
|
-
const [
|
|
347
|
-
this.clear(
|
|
345
|
+
this.data.forEach((t, i) => {
|
|
346
|
+
const [n, s] = d.extractPrefix(i);
|
|
347
|
+
this.clear(s, n, e, r);
|
|
348
348
|
});
|
|
349
349
|
}
|
|
350
|
-
clear(e, r, t = !1,
|
|
350
|
+
clear(e, r, t = !1, i = !1) {
|
|
351
351
|
t || this.callListeners(e, r);
|
|
352
|
-
const
|
|
353
|
-
if (!
|
|
354
|
-
const
|
|
355
|
-
if (this.data.delete(d.prefix(e, r)),
|
|
352
|
+
const n = this.data.get(d.prefix(e, r));
|
|
353
|
+
if (!n) return;
|
|
354
|
+
const s = { ...n };
|
|
355
|
+
if (this.data.delete(d.prefix(e, r)), s.isStatic && !i) {
|
|
356
356
|
const f = te.find((c) => c.key === e && c.prefix === r);
|
|
357
357
|
f && this.initStatic(f);
|
|
358
358
|
}
|
|
@@ -379,34 +379,40 @@ class d {
|
|
|
379
379
|
return e.split("//");
|
|
380
380
|
}
|
|
381
381
|
useEffect(e, r, t = null) {
|
|
382
|
-
|
|
383
|
-
t?.(),
|
|
382
|
+
se(() => () => {
|
|
383
|
+
t?.(), G(`[${d.prefix(e, r)}]`, "unmount effect"), this.data.get(d.prefix(e, r)).listeners?.length === 0 && this.clear(e, r);
|
|
384
384
|
}, []);
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
|
-
class
|
|
387
|
+
class U {
|
|
388
388
|
constructor(e) {
|
|
389
389
|
this.sharedData = e;
|
|
390
390
|
}
|
|
391
391
|
get(e, r) {
|
|
392
|
-
let t,
|
|
392
|
+
let t, i = r;
|
|
393
393
|
if (typeof e != "string") {
|
|
394
394
|
const { key: f, prefix: c } = e;
|
|
395
|
-
t = f,
|
|
395
|
+
t = f, i = c;
|
|
396
396
|
} else
|
|
397
397
|
t = j(e);
|
|
398
|
-
const
|
|
399
|
-
return this.sharedData.get(t,
|
|
398
|
+
const n = i || "_global";
|
|
399
|
+
return this.sharedData.get(t, n);
|
|
400
400
|
}
|
|
401
401
|
set(e, r, t) {
|
|
402
|
-
let
|
|
402
|
+
let i, n = t;
|
|
403
403
|
if (typeof e != "string") {
|
|
404
404
|
const { key: f, prefix: c } = e;
|
|
405
|
-
|
|
405
|
+
i = f, n = c;
|
|
406
406
|
} else
|
|
407
|
-
|
|
408
|
-
const
|
|
409
|
-
this.sharedData.init(
|
|
407
|
+
i = j(e);
|
|
408
|
+
const s = n || "_global";
|
|
409
|
+
this.sharedData.init(i, s, r), this.sharedData.setValue(i, s, r), this.sharedData.callListeners(i, s);
|
|
410
|
+
}
|
|
411
|
+
update(e, r, t) {
|
|
412
|
+
let i;
|
|
413
|
+
typeof e == "string" ? i = this.get(e, t) : i = this.get(e);
|
|
414
|
+
const n = r(i);
|
|
415
|
+
typeof e == "string" ? this.set(e, n, t) : this.set(e, n);
|
|
410
416
|
}
|
|
411
417
|
/**
|
|
412
418
|
* clear all values from the shared data
|
|
@@ -420,10 +426,10 @@ class G {
|
|
|
420
426
|
*/
|
|
421
427
|
clearScope(e) {
|
|
422
428
|
const r = e || "_global";
|
|
423
|
-
this.sharedData.data.forEach((t,
|
|
424
|
-
const [
|
|
425
|
-
if (
|
|
426
|
-
this.sharedData.clear(
|
|
429
|
+
this.sharedData.data.forEach((t, i) => {
|
|
430
|
+
const [n, s] = d.extractPrefix(i);
|
|
431
|
+
if (n === r) {
|
|
432
|
+
this.sharedData.clear(s, n), this.sharedData.callListeners(s, n);
|
|
427
433
|
return;
|
|
428
434
|
}
|
|
429
435
|
});
|
|
@@ -437,8 +443,8 @@ class G {
|
|
|
437
443
|
return this.get(r, t);
|
|
438
444
|
}
|
|
439
445
|
clear(e, r) {
|
|
440
|
-
let t,
|
|
441
|
-
typeof e == "string" ? (t = e,
|
|
446
|
+
let t, i;
|
|
447
|
+
typeof e == "string" ? (t = e, i = r || "_global") : (t = e.key, i = e.prefix), this.sharedData.clear(t, i);
|
|
442
448
|
}
|
|
443
449
|
/**
|
|
444
450
|
* check if a value exists in the shared data
|
|
@@ -455,93 +461,99 @@ class G {
|
|
|
455
461
|
getAll() {
|
|
456
462
|
const e = {};
|
|
457
463
|
return this.sharedData.data.forEach((r, t) => {
|
|
458
|
-
const [
|
|
459
|
-
e[
|
|
464
|
+
const [i, n] = d.extractPrefix(t);
|
|
465
|
+
e[i] = e[i] || {}, e[i][n] = r;
|
|
460
466
|
}), e;
|
|
461
467
|
}
|
|
468
|
+
subscribe(e, r, t) {
|
|
469
|
+
let i, n;
|
|
470
|
+
return typeof e == "string" ? (i = e, n = t || "_global") : (i = e.key, n = e.prefix), this.sharedData.addListener(i, n, r), () => {
|
|
471
|
+
this.sharedData.removeListener(i, n, r);
|
|
472
|
+
};
|
|
473
|
+
}
|
|
462
474
|
}
|
|
463
|
-
const
|
|
464
|
-
const e =
|
|
475
|
+
const N = (o) => {
|
|
476
|
+
const e = Ae();
|
|
465
477
|
return {
|
|
466
|
-
prefix:
|
|
478
|
+
prefix: o ?? e?.scopeName ?? "_global"
|
|
467
479
|
};
|
|
468
480
|
};
|
|
469
|
-
var
|
|
470
|
-
function
|
|
471
|
-
if (re) return
|
|
481
|
+
var z, re;
|
|
482
|
+
function ye() {
|
|
483
|
+
if (re) return z;
|
|
472
484
|
re = 1;
|
|
473
|
-
var
|
|
474
|
-
function
|
|
475
|
-
if (
|
|
476
|
-
if (
|
|
477
|
-
if (
|
|
478
|
-
var f, c,
|
|
479
|
-
if (Array.isArray(
|
|
480
|
-
if (f =
|
|
485
|
+
var o = typeof Element < "u", e = typeof Map == "function", r = typeof Set == "function", t = typeof ArrayBuffer == "function" && !!ArrayBuffer.isView;
|
|
486
|
+
function i(n, s) {
|
|
487
|
+
if (n === s) return !0;
|
|
488
|
+
if (n && s && typeof n == "object" && typeof s == "object") {
|
|
489
|
+
if (n.constructor !== s.constructor) return !1;
|
|
490
|
+
var f, c, S;
|
|
491
|
+
if (Array.isArray(n)) {
|
|
492
|
+
if (f = n.length, f != s.length) return !1;
|
|
481
493
|
for (c = f; c-- !== 0; )
|
|
482
|
-
if (!
|
|
494
|
+
if (!i(n[c], s[c])) return !1;
|
|
483
495
|
return !0;
|
|
484
496
|
}
|
|
485
497
|
var p;
|
|
486
|
-
if (e &&
|
|
487
|
-
if (
|
|
488
|
-
for (p =
|
|
489
|
-
if (!
|
|
490
|
-
for (p =
|
|
491
|
-
if (!
|
|
498
|
+
if (e && n instanceof Map && s instanceof Map) {
|
|
499
|
+
if (n.size !== s.size) return !1;
|
|
500
|
+
for (p = n.entries(); !(c = p.next()).done; )
|
|
501
|
+
if (!s.has(c.value[0])) return !1;
|
|
502
|
+
for (p = n.entries(); !(c = p.next()).done; )
|
|
503
|
+
if (!i(c.value[1], s.get(c.value[0]))) return !1;
|
|
492
504
|
return !0;
|
|
493
505
|
}
|
|
494
|
-
if (r &&
|
|
495
|
-
if (
|
|
496
|
-
for (p =
|
|
497
|
-
if (!
|
|
506
|
+
if (r && n instanceof Set && s instanceof Set) {
|
|
507
|
+
if (n.size !== s.size) return !1;
|
|
508
|
+
for (p = n.entries(); !(c = p.next()).done; )
|
|
509
|
+
if (!s.has(c.value[0])) return !1;
|
|
498
510
|
return !0;
|
|
499
511
|
}
|
|
500
|
-
if (t && ArrayBuffer.isView(
|
|
501
|
-
if (f =
|
|
512
|
+
if (t && ArrayBuffer.isView(n) && ArrayBuffer.isView(s)) {
|
|
513
|
+
if (f = n.length, f != s.length) return !1;
|
|
502
514
|
for (c = f; c-- !== 0; )
|
|
503
|
-
if (
|
|
515
|
+
if (n[c] !== s[c]) return !1;
|
|
504
516
|
return !0;
|
|
505
517
|
}
|
|
506
|
-
if (
|
|
507
|
-
if (
|
|
508
|
-
if (
|
|
509
|
-
if (
|
|
518
|
+
if (n.constructor === RegExp) return n.source === s.source && n.flags === s.flags;
|
|
519
|
+
if (n.valueOf !== Object.prototype.valueOf && typeof n.valueOf == "function" && typeof s.valueOf == "function") return n.valueOf() === s.valueOf();
|
|
520
|
+
if (n.toString !== Object.prototype.toString && typeof n.toString == "function" && typeof s.toString == "function") return n.toString() === s.toString();
|
|
521
|
+
if (S = Object.keys(n), f = S.length, f !== Object.keys(s).length) return !1;
|
|
510
522
|
for (c = f; c-- !== 0; )
|
|
511
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
512
|
-
if (
|
|
523
|
+
if (!Object.prototype.hasOwnProperty.call(s, S[c])) return !1;
|
|
524
|
+
if (o && n instanceof Element) return !1;
|
|
513
525
|
for (c = f; c-- !== 0; )
|
|
514
|
-
if (!((
|
|
526
|
+
if (!((S[c] === "_owner" || S[c] === "__v" || S[c] === "__o") && n.$$typeof) && !i(n[S[c]], s[S[c]]))
|
|
515
527
|
return !1;
|
|
516
528
|
return !0;
|
|
517
529
|
}
|
|
518
|
-
return
|
|
530
|
+
return n !== n && s !== s;
|
|
519
531
|
}
|
|
520
|
-
return
|
|
532
|
+
return z = function(s, f) {
|
|
521
533
|
try {
|
|
522
|
-
return
|
|
534
|
+
return i(s, f);
|
|
523
535
|
} catch (c) {
|
|
524
536
|
if ((c.message || "").match(/stack|recursion/i))
|
|
525
537
|
return console.warn("react-fast-compare cannot handle circular refs"), !1;
|
|
526
538
|
throw c;
|
|
527
539
|
}
|
|
528
|
-
},
|
|
540
|
+
}, z;
|
|
529
541
|
}
|
|
530
|
-
var Oe =
|
|
531
|
-
const
|
|
532
|
-
class
|
|
542
|
+
var Oe = ye();
|
|
543
|
+
const Le = /* @__PURE__ */ me(Oe);
|
|
544
|
+
class Pe extends d {
|
|
533
545
|
defaultValue() {
|
|
534
546
|
return { value: void 0 };
|
|
535
547
|
}
|
|
536
|
-
initValue(e, r, t,
|
|
537
|
-
super.init(e, r, { value: t },
|
|
548
|
+
initValue(e, r, t, i = !1) {
|
|
549
|
+
super.init(e, r, { value: t }, i);
|
|
538
550
|
}
|
|
539
551
|
initStatic(e) {
|
|
540
|
-
const { key: r, prefix: t, initialValue:
|
|
541
|
-
this.initValue(r, t,
|
|
552
|
+
const { key: r, prefix: t, initialValue: i } = e;
|
|
553
|
+
this.initValue(r, t, i, !0);
|
|
542
554
|
}
|
|
543
555
|
}
|
|
544
|
-
class je extends
|
|
556
|
+
class je extends U {
|
|
545
557
|
constructor(e) {
|
|
546
558
|
super(e);
|
|
547
559
|
}
|
|
@@ -555,44 +567,50 @@ class je extends G {
|
|
|
555
567
|
}
|
|
556
568
|
super.set(e, { value: r }, t);
|
|
557
569
|
}
|
|
570
|
+
update(e, r, t = "_global") {
|
|
571
|
+
let i;
|
|
572
|
+
typeof e == "string" ? i = this.get(e, t) : i = this.get(e);
|
|
573
|
+
const n = r(i);
|
|
574
|
+
typeof e == "string" ? this.set(e, n, t) : this.set(e, n);
|
|
575
|
+
}
|
|
558
576
|
}
|
|
559
|
-
const
|
|
560
|
-
function
|
|
561
|
-
let t,
|
|
562
|
-
if (typeof
|
|
563
|
-
const { key: l, initialValue:
|
|
564
|
-
t = l,
|
|
577
|
+
const R = new Pe(), Ie = new je(R), qe = (o, e) => R.createStatic({ initialValue: o }, e);
|
|
578
|
+
function We(o, e, r) {
|
|
579
|
+
let t, i, n = r;
|
|
580
|
+
if (typeof o != "string") {
|
|
581
|
+
const { key: l, initialValue: _, prefix: b } = o;
|
|
582
|
+
t = l, i = _, n = b;
|
|
565
583
|
} else
|
|
566
|
-
t = j(
|
|
567
|
-
const { prefix:
|
|
568
|
-
|
|
569
|
-
const f =
|
|
570
|
-
|
|
571
|
-
}), []), c =
|
|
572
|
-
const
|
|
573
|
-
|
|
584
|
+
t = j(o), i = e;
|
|
585
|
+
const { prefix: s } = N(n);
|
|
586
|
+
R.initValue(t, s, i);
|
|
587
|
+
const f = A(() => (l) => (R.initValue(t, s, e), R.addListener(t, s, l), () => {
|
|
588
|
+
R.removeListener(t, s, l);
|
|
589
|
+
}), []), c = A(() => () => R.get(t, s)?.value, []), S = V(f, c), p = (l) => {
|
|
590
|
+
const _ = typeof l == "function" ? l(R.get(t, s)?.value) : l;
|
|
591
|
+
_ !== S && (R.setValue(t, s, { value: _ }), R.callListeners(t, s));
|
|
574
592
|
};
|
|
575
|
-
return
|
|
576
|
-
|
|
593
|
+
return R.useEffect(t, s), [
|
|
594
|
+
S,
|
|
577
595
|
p
|
|
578
596
|
];
|
|
579
597
|
}
|
|
580
|
-
function
|
|
581
|
-
let t,
|
|
582
|
-
if (typeof
|
|
583
|
-
const { key: p, prefix: l } =
|
|
584
|
-
t = p,
|
|
598
|
+
function ze(o, e, r) {
|
|
599
|
+
let t, i = r;
|
|
600
|
+
if (typeof o != "string") {
|
|
601
|
+
const { key: p, prefix: l } = o;
|
|
602
|
+
t = p, i = l;
|
|
585
603
|
} else
|
|
586
|
-
t = j(
|
|
587
|
-
const { prefix:
|
|
588
|
-
|
|
589
|
-
}), []), c =
|
|
590
|
-
const p =
|
|
591
|
-
return
|
|
592
|
-
}, []),
|
|
593
|
-
return
|
|
604
|
+
t = j(o);
|
|
605
|
+
const { prefix: n } = N(i), s = Ee(void 0), f = A(() => (p) => (R.addListener(t, n, p), () => {
|
|
606
|
+
R.removeListener(t, n, p);
|
|
607
|
+
}), []), c = A(() => () => {
|
|
608
|
+
const p = R.get(t, n)?.value, l = e(p);
|
|
609
|
+
return Le(s.current, l) ? s.current : l;
|
|
610
|
+
}, []), S = V(f, c);
|
|
611
|
+
return R.useEffect(t, n), S;
|
|
594
612
|
}
|
|
595
|
-
class
|
|
613
|
+
class De extends d {
|
|
596
614
|
defaultValue() {
|
|
597
615
|
return {
|
|
598
616
|
fnState: {
|
|
@@ -609,7 +627,7 @@ class Ce extends d {
|
|
|
609
627
|
super.setValue(e, r, t);
|
|
610
628
|
}
|
|
611
629
|
}
|
|
612
|
-
class
|
|
630
|
+
class Ce extends U {
|
|
613
631
|
constructor(e) {
|
|
614
632
|
super(e);
|
|
615
633
|
}
|
|
@@ -623,39 +641,45 @@ class De extends G {
|
|
|
623
641
|
}
|
|
624
642
|
super.set(e, r, t);
|
|
625
643
|
}
|
|
644
|
+
update(e, r, t = "_global") {
|
|
645
|
+
let i;
|
|
646
|
+
typeof e == "string" ? i = this.get(e, t) : i = this.get(e);
|
|
647
|
+
const n = r(i);
|
|
648
|
+
typeof e == "string" ? this.set(e, n, t) : this.set(e, n);
|
|
649
|
+
}
|
|
626
650
|
}
|
|
627
|
-
const
|
|
628
|
-
function
|
|
629
|
-
let t,
|
|
630
|
-
if (typeof
|
|
631
|
-
const { key: l, fn:
|
|
632
|
-
t = l,
|
|
651
|
+
const w = new De(), Ge = new Ce(w), Ue = (o, e) => w.createStatic({ fn: o }, e);
|
|
652
|
+
function Be(o, e, r) {
|
|
653
|
+
let t, i, n = r;
|
|
654
|
+
if (typeof o != "string") {
|
|
655
|
+
const { key: l, fn: _, prefix: b } = o;
|
|
656
|
+
t = l, i = _, n = b;
|
|
633
657
|
} else
|
|
634
|
-
t = j(
|
|
635
|
-
const { prefix:
|
|
636
|
-
|
|
637
|
-
const f =
|
|
638
|
-
() => (l) => (
|
|
639
|
-
|
|
658
|
+
t = j(o), i = e;
|
|
659
|
+
const { prefix: s } = N(n);
|
|
660
|
+
w.initValue(t, s);
|
|
661
|
+
const f = A(
|
|
662
|
+
() => (l) => (w.initValue(t, s), w.addListener(t, s, l), () => {
|
|
663
|
+
w.removeListener(t, s, l);
|
|
640
664
|
}),
|
|
641
665
|
[]
|
|
642
|
-
), c =
|
|
643
|
-
() => () =>
|
|
666
|
+
), c = A(
|
|
667
|
+
() => () => w.get(t, s).fnState,
|
|
644
668
|
[]
|
|
645
|
-
),
|
|
646
|
-
const b =
|
|
669
|
+
), S = V(f, c), p = async (l, ..._) => {
|
|
670
|
+
const b = w.get(t, s);
|
|
647
671
|
if (!l && (b.fnState.isLoading || b.fnState.results !== void 0)) return b.fnState;
|
|
648
|
-
b.fnState = { ...b.fnState, isLoading: !0, error: void 0 },
|
|
672
|
+
b.fnState = { ...b.fnState, isLoading: !0, error: void 0 }, w.callListeners(t, s);
|
|
649
673
|
try {
|
|
650
|
-
const v = await
|
|
674
|
+
const v = await i(..._);
|
|
651
675
|
b.fnState = { results: v, isLoading: !1, error: void 0 };
|
|
652
676
|
} catch (v) {
|
|
653
677
|
b.fnState = { ...b.fnState, isLoading: !1, error: v };
|
|
654
678
|
}
|
|
655
|
-
|
|
679
|
+
w.callListeners(t, s);
|
|
656
680
|
};
|
|
657
|
-
return
|
|
658
|
-
state:
|
|
681
|
+
return w.useEffect(t, s), {
|
|
682
|
+
state: S,
|
|
659
683
|
trigger: (...l) => {
|
|
660
684
|
p(!1, ...l);
|
|
661
685
|
},
|
|
@@ -663,8 +687,8 @@ function Ue(i, e, r) {
|
|
|
663
687
|
p(!0, ...l);
|
|
664
688
|
},
|
|
665
689
|
clear: () => {
|
|
666
|
-
const l =
|
|
667
|
-
l && (l.fnState =
|
|
690
|
+
const l = w.get(t, s);
|
|
691
|
+
l && (l.fnState = w.defaultValue().fnState, w.callListeners(t, s));
|
|
668
692
|
}
|
|
669
693
|
};
|
|
670
694
|
}
|
|
@@ -686,8 +710,8 @@ class Fe extends d {
|
|
|
686
710
|
super.setValue(e, r, t);
|
|
687
711
|
}
|
|
688
712
|
useEffect(e, r) {
|
|
689
|
-
|
|
690
|
-
|
|
713
|
+
se(() => () => {
|
|
714
|
+
G(`[${d.prefix(e, r)}]`, "unmount effect2"), this.get(e, r)?.listeners.length === 0 && this.unsubscribe(e, r);
|
|
691
715
|
}, []), super.useEffect(e, r);
|
|
692
716
|
}
|
|
693
717
|
async unsubscribe(e, r) {
|
|
@@ -695,7 +719,7 @@ class Fe extends d {
|
|
|
695
719
|
t && (t.unsubscribe && (t.unsubscribe(), t.unsubscribe = void 0), t.fnState = { ...t.fnState, subscribed: !1 }, this.callListeners(e, r));
|
|
696
720
|
}
|
|
697
721
|
}
|
|
698
|
-
class
|
|
722
|
+
class Ve extends U {
|
|
699
723
|
constructor(e) {
|
|
700
724
|
super(e);
|
|
701
725
|
}
|
|
@@ -709,49 +733,55 @@ class Ne extends G {
|
|
|
709
733
|
}
|
|
710
734
|
super.set(e, r, t);
|
|
711
735
|
}
|
|
736
|
+
update(e, r, t = "_global") {
|
|
737
|
+
let i;
|
|
738
|
+
typeof e == "string" ? i = this.get(e, t) : i = this.get(e);
|
|
739
|
+
const n = r(i);
|
|
740
|
+
typeof e == "string" ? this.set(e, n, t) : this.set(e, n);
|
|
741
|
+
}
|
|
712
742
|
}
|
|
713
|
-
const
|
|
714
|
-
function
|
|
715
|
-
let t,
|
|
716
|
-
if (typeof
|
|
717
|
-
const { key: v, subscriber: x, prefix: O } =
|
|
718
|
-
t = v,
|
|
743
|
+
const g = new Fe(), Je = new Ve(g), Me = (o, e) => g.createStatic({ subscriber: o }, e);
|
|
744
|
+
function Xe(o, e, r) {
|
|
745
|
+
let t, i, n = r;
|
|
746
|
+
if (typeof o != "string") {
|
|
747
|
+
const { key: v, subscriber: x, prefix: O } = o;
|
|
748
|
+
t = v, i = x, n = O;
|
|
719
749
|
} else
|
|
720
|
-
t = j(
|
|
721
|
-
const { prefix:
|
|
722
|
-
|
|
723
|
-
const f =
|
|
724
|
-
() => (v) => (
|
|
725
|
-
|
|
750
|
+
t = j(o), i = e;
|
|
751
|
+
const { prefix: s } = N(n);
|
|
752
|
+
g.initValue(t, s);
|
|
753
|
+
const f = A(
|
|
754
|
+
() => (v) => (g.initValue(t, s), g.addListener(t, s, v), () => {
|
|
755
|
+
g.removeListener(t, s, v);
|
|
726
756
|
}),
|
|
727
757
|
[]
|
|
728
|
-
), c =
|
|
729
|
-
() => () =>
|
|
758
|
+
), c = A(
|
|
759
|
+
() => () => g.get(t, s).fnState,
|
|
730
760
|
[]
|
|
731
|
-
),
|
|
732
|
-
const x =
|
|
733
|
-
x.fnState = { ...x.fnState, data: v },
|
|
761
|
+
), S = V(f, c), p = (v) => {
|
|
762
|
+
const x = g.get(t, s);
|
|
763
|
+
x.fnState = { ...x.fnState, data: v }, g.callListeners(t, s);
|
|
734
764
|
}, l = (v) => {
|
|
735
|
-
const x =
|
|
736
|
-
x.fnState = { ...x.fnState, isLoading: !1, data: void 0, error: v },
|
|
737
|
-
},
|
|
738
|
-
const v =
|
|
739
|
-
v.fnState = { ...v.fnState, isLoading: !1 },
|
|
765
|
+
const x = g.get(t, s);
|
|
766
|
+
x.fnState = { ...x.fnState, isLoading: !1, data: void 0, error: v }, g.callListeners(t, s);
|
|
767
|
+
}, _ = () => {
|
|
768
|
+
const v = g.get(t, s);
|
|
769
|
+
v.fnState = { ...v.fnState, isLoading: !1 }, g.callListeners(t, s);
|
|
740
770
|
}, b = async (v) => {
|
|
741
|
-
const x =
|
|
742
|
-
if (v && (await
|
|
743
|
-
|
|
771
|
+
const x = g.get(t, s);
|
|
772
|
+
if (v && (await g.unsubscribe(t, s), x.fnState = { ...x.fnState, isLoading: !1, data: void 0, error: void 0, subscribed: !1 }), x.fnState.subscribed) return x.fnState;
|
|
773
|
+
G("triggered !!"), x.fnState = { ...x.fnState, isLoading: !0, error: void 0 }, g.callListeners(t, s);
|
|
744
774
|
try {
|
|
745
|
-
const O = await
|
|
746
|
-
|
|
775
|
+
const O = await i(p, l, _), L = g.get(t, s);
|
|
776
|
+
L.unsubscribe = O, L.fnState.subscribed = !0;
|
|
747
777
|
} catch (O) {
|
|
748
|
-
const
|
|
749
|
-
|
|
778
|
+
const L = g.get(t, s);
|
|
779
|
+
L.fnState = { ...L.fnState, isLoading: !1, error: O };
|
|
750
780
|
}
|
|
751
|
-
|
|
781
|
+
g.callListeners(t, s);
|
|
752
782
|
};
|
|
753
|
-
return
|
|
754
|
-
state:
|
|
783
|
+
return g.useEffect(t, s), {
|
|
784
|
+
state: S,
|
|
755
785
|
trigger: () => {
|
|
756
786
|
b(!1);
|
|
757
787
|
},
|
|
@@ -759,25 +789,25 @@ function Me(i, e, r) {
|
|
|
759
789
|
b(!0);
|
|
760
790
|
},
|
|
761
791
|
unsubscribe: () => {
|
|
762
|
-
|
|
792
|
+
g.unsubscribe(t, s);
|
|
763
793
|
}
|
|
764
794
|
};
|
|
765
795
|
}
|
|
766
796
|
export {
|
|
767
|
-
|
|
797
|
+
Ce as SharedFunctionsApi,
|
|
768
798
|
je as SharedStatesApi,
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
799
|
+
Ye as SharedStatesProvider,
|
|
800
|
+
Ve as SharedSubscriptionsApi,
|
|
801
|
+
Ue as createSharedFunction,
|
|
802
|
+
qe as createSharedState,
|
|
803
|
+
Me as createSharedSubscription,
|
|
804
|
+
ne as isDevMode,
|
|
775
805
|
$e as setDevMode,
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
806
|
+
Ge as sharedFunctionsApi,
|
|
807
|
+
Ie as sharedStatesApi,
|
|
808
|
+
Je as sharedSubscriptionsApi,
|
|
809
|
+
Be as useSharedFunction,
|
|
810
|
+
We as useSharedState,
|
|
811
|
+
ze as useSharedStateSelector,
|
|
812
|
+
Xe as useSharedSubscription
|
|
783
813
|
};
|