@ptolemy2002/react-proxy-context 2.5.0 → 2.6.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/README.md +12 -3
- package/dist/main.d.ts +11 -4
- package/dist/main.js +162 -156
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,9 +33,9 @@ type ProxyContextChangeSubscriber<T> = {
|
|
|
33
33
|
reinitCallback: OnChangeReinitCallback<T>;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
type ProxyContextProviderProps<T> = {
|
|
36
|
+
type ProxyContextProviderProps<T, InputT = T> = {
|
|
37
37
|
children: ReactNode;
|
|
38
|
-
value:
|
|
38
|
+
value: InputT | ProxyContextValueWrapper<T>;
|
|
39
39
|
onChangeProp?: OnChangePropCallback<T>;
|
|
40
40
|
onChangeReinit?: OnChangeReinitCallback<T>;
|
|
41
41
|
proxyRef?: React.MutableRefObject<T>;
|
|
@@ -45,6 +45,14 @@ type UseProxyContextResult<T> = HookResultData<{
|
|
|
45
45
|
value: T;
|
|
46
46
|
set: (newObj: T) => T;
|
|
47
47
|
}, readonly [T, (newObj: T) => T]>;
|
|
48
|
+
|
|
49
|
+
type UseProxyContextArgs<T> = [
|
|
50
|
+
ProxyContext<T>,
|
|
51
|
+
Dependency<T>[] | null,
|
|
52
|
+
OnChangePropCallback<T>,
|
|
53
|
+
OnChangeReinitCallback<T>,
|
|
54
|
+
boolean
|
|
55
|
+
];
|
|
48
56
|
```
|
|
49
57
|
|
|
50
58
|
## Classes
|
|
@@ -100,12 +108,13 @@ Creates a new instance of the ProxyContext, essentially to be used as the contex
|
|
|
100
108
|
#### Returns
|
|
101
109
|
`ProxyContext<T>` - The context object that can be used in a provider.
|
|
102
110
|
|
|
103
|
-
### createProxyContextProvider<T extends object | null>
|
|
111
|
+
### createProxyContextProvider<T extends object | null, InputT = T>
|
|
104
112
|
#### Description
|
|
105
113
|
Creates a new proxy context provider component with the specified type. `ProxyContextProvider` is no longer used due to a TypeScript limitation that prevents the context type from being inferred.
|
|
106
114
|
|
|
107
115
|
#### Parameters
|
|
108
116
|
- `contextClass` (`ProxyContext<T>`): The context class that was created using `createProxyContext`.
|
|
117
|
+
- `transformInput` (`(input: InputT) => T`): A function that transforms the input value into the desired type `T`. This is useful when the input type differs from the context type, allowing for custom initialization logic. By default, this function simply casts the input to type `T`.
|
|
109
118
|
|
|
110
119
|
#### Returns
|
|
111
120
|
`React.MemoExoticComponent<FunctionComponent<ProxyContextProviderProps<T> & { renderDeps?: any[] }>>` - The provider component that can be used in the React tree. The resulting component is memoized to prevent unnecessary re-renders, but the `renderDeps` prop can be used to force a re-render when the specified dependencies change (necessary when working with the children prop).
|
package/dist/main.d.ts
CHANGED
|
@@ -9,9 +9,9 @@ export declare function createProxyContext<T>(name: string): ProxyContext<T>;
|
|
|
9
9
|
export type Dependency<_T, T = Exclude<_T, null | undefined>> = keyof T | (<K extends keyof T>(prop: K, current: T[K], prev: T[K], obj: T) => boolean) | null | undefined | false | [keyof T, ...PropertyKey[]];
|
|
10
10
|
export declare function evaluateDependency<T>(dep: Dependency<T>): Exclude<Dependency<T>, any[]>;
|
|
11
11
|
export type ProxyContext<T> = ContextWithName<ProxyContextValueWrapper<T> | undefined>;
|
|
12
|
-
export type ProxyContextProviderProps<T> = {
|
|
12
|
+
export type ProxyContextProviderProps<T, InputT = T> = {
|
|
13
13
|
children: ReactNode;
|
|
14
|
-
value:
|
|
14
|
+
value: InputT | ProxyContextValueWrapper<T>;
|
|
15
15
|
onChangeProp?: OnChangePropCallback<T>;
|
|
16
16
|
onChangeReinit?: OnChangeReinitCallback<T>;
|
|
17
17
|
proxyRef?: React.MutableRefObject<T>;
|
|
@@ -33,11 +33,18 @@ export declare class ProxyContextValueWrapper<T> {
|
|
|
33
33
|
get(): T;
|
|
34
34
|
set(newObj: T): T;
|
|
35
35
|
}
|
|
36
|
-
export declare function createProxyContextProvider<T extends object | null>(contextClass: ProxyContext<T
|
|
36
|
+
export declare function createProxyContextProvider<T extends object | null, InputT = T>(contextClass: ProxyContext<T>, transformInput?: (input: InputT) => T): import('react').MemoExoticComponent<import('react').FunctionComponent<ProxyContextProviderProps<T, InputT> & {
|
|
37
37
|
renderDeps?: unknown[] | null | false;
|
|
38
38
|
}>>;
|
|
39
39
|
export type UseProxyContextResult<T> = HookResultData<{
|
|
40
40
|
value: T;
|
|
41
41
|
set: (newObj: T) => T;
|
|
42
42
|
}, readonly [T, (newObj: T) => T]>;
|
|
43
|
-
export
|
|
43
|
+
export type UseProxyContextArgs<T> = [
|
|
44
|
+
ProxyContext<T>,
|
|
45
|
+
Dependency<T>[] | null,
|
|
46
|
+
OnChangePropCallback<T>,
|
|
47
|
+
OnChangeReinitCallback<T>,
|
|
48
|
+
boolean
|
|
49
|
+
];
|
|
50
|
+
export declare function useProxyContext<T>(...[contextClass, deps, onChangeProp, onChangeReinit, listenReinit]: UseProxyContextArgs<T>): UseProxyContextResult<T>;
|
package/dist/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var dr = Object.defineProperty;
|
|
2
|
-
var pr = (h, a,
|
|
3
|
-
var X = (h, a,
|
|
2
|
+
var pr = (h, a, f) => a in h ? dr(h, a, { enumerable: !0, configurable: !0, writable: !0, value: f }) : h[a] = f;
|
|
3
|
+
var X = (h, a, f) => pr(h, typeof a != "symbol" ? a + "" : a, f);
|
|
4
4
|
import Oe, { createContext as br, useRef as Ce, useImperativeHandle as hr, useEffect as yr, useContext as mr, useCallback as Er, useSyncExternalStore as gr } from "react";
|
|
5
5
|
import { nanoid as _r } from "nanoid";
|
|
6
6
|
import Y from "is-callable";
|
|
@@ -21,15 +21,15 @@ var Pe;
|
|
|
21
21
|
function xr() {
|
|
22
22
|
if (Pe) return $;
|
|
23
23
|
Pe = 1;
|
|
24
|
-
var h = Oe, a = Symbol.for("react.element"),
|
|
25
|
-
function
|
|
24
|
+
var h = Oe, a = Symbol.for("react.element"), f = Symbol.for("react.fragment"), v = Object.prototype.hasOwnProperty, d = h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, c = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
25
|
+
function l(u, p, x) {
|
|
26
26
|
var E, T = {}, P = null, k = null;
|
|
27
|
-
x !== void 0 && (P = "" + x),
|
|
28
|
-
for (E in
|
|
29
|
-
if (
|
|
30
|
-
return { $$typeof: a, type:
|
|
27
|
+
x !== void 0 && (P = "" + x), p.key !== void 0 && (P = "" + p.key), p.ref !== void 0 && (k = p.ref);
|
|
28
|
+
for (E in p) v.call(p, E) && !c.hasOwnProperty(E) && (T[E] = p[E]);
|
|
29
|
+
if (u && u.defaultProps) for (E in p = u.defaultProps, p) T[E] === void 0 && (T[E] = p[E]);
|
|
30
|
+
return { $$typeof: a, type: u, key: P, ref: k, props: T, _owner: d.current };
|
|
31
31
|
}
|
|
32
|
-
return $.Fragment =
|
|
32
|
+
return $.Fragment = f, $.jsx = l, $.jsxs = l, $;
|
|
33
33
|
}
|
|
34
34
|
var W = {};
|
|
35
35
|
/**
|
|
@@ -44,7 +44,7 @@ var W = {};
|
|
|
44
44
|
var we;
|
|
45
45
|
function Pr() {
|
|
46
46
|
return we || (we = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
|
-
var h = Oe, a = Symbol.for("react.element"),
|
|
47
|
+
var h = Oe, a = Symbol.for("react.element"), f = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), c = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), u = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), x = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), k = Symbol.for("react.offscreen"), ee = Symbol.iterator, ke = "@@iterator";
|
|
48
48
|
function je(e) {
|
|
49
49
|
if (e === null || typeof e != "object")
|
|
50
50
|
return null;
|
|
@@ -61,18 +61,18 @@ function Pr() {
|
|
|
61
61
|
}
|
|
62
62
|
function De(e, r, t) {
|
|
63
63
|
{
|
|
64
|
-
var n = j.ReactDebugCurrentFrame,
|
|
65
|
-
|
|
66
|
-
var
|
|
67
|
-
return String(
|
|
64
|
+
var n = j.ReactDebugCurrentFrame, s = n.getStackAddendum();
|
|
65
|
+
s !== "" && (r += "%s", t = t.concat([s]));
|
|
66
|
+
var b = t.map(function(o) {
|
|
67
|
+
return String(o);
|
|
68
68
|
});
|
|
69
|
-
|
|
69
|
+
b.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, b);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
var Fe = !1, Ae = !1, Ie = !1, $e = !1, We = !1, re;
|
|
73
73
|
re = Symbol.for("react.module.reference");
|
|
74
74
|
function Ye(e) {
|
|
75
|
-
return !!(typeof e == "string" || typeof e == "function" || e ===
|
|
75
|
+
return !!(typeof e == "string" || typeof e == "function" || e === v || e === c || We || e === d || e === x || e === E || $e || e === k || Fe || Ae || Ie || typeof e == "object" && e !== null && (e.$$typeof === P || e.$$typeof === T || e.$$typeof === l || e.$$typeof === u || e.$$typeof === p || // This needs to include all possible module reference object
|
|
76
76
|
// types supported by any Flight configuration anywhere since
|
|
77
77
|
// we don't know which Flight build this will end up being used
|
|
78
78
|
// with.
|
|
@@ -82,8 +82,8 @@ function Pr() {
|
|
|
82
82
|
var n = e.displayName;
|
|
83
83
|
if (n)
|
|
84
84
|
return n;
|
|
85
|
-
var
|
|
86
|
-
return
|
|
85
|
+
var s = r.displayName || r.name || "";
|
|
86
|
+
return s !== "" ? t + "(" + s + ")" : t;
|
|
87
87
|
}
|
|
88
88
|
function te(e) {
|
|
89
89
|
return e.displayName || "Context";
|
|
@@ -96,13 +96,13 @@ function Pr() {
|
|
|
96
96
|
if (typeof e == "string")
|
|
97
97
|
return e;
|
|
98
98
|
switch (e) {
|
|
99
|
-
case
|
|
99
|
+
case v:
|
|
100
100
|
return "Fragment";
|
|
101
|
-
case
|
|
101
|
+
case f:
|
|
102
102
|
return "Portal";
|
|
103
|
-
case
|
|
103
|
+
case c:
|
|
104
104
|
return "Profiler";
|
|
105
|
-
case
|
|
105
|
+
case d:
|
|
106
106
|
return "StrictMode";
|
|
107
107
|
case x:
|
|
108
108
|
return "Suspense";
|
|
@@ -111,21 +111,21 @@ function Pr() {
|
|
|
111
111
|
}
|
|
112
112
|
if (typeof e == "object")
|
|
113
113
|
switch (e.$$typeof) {
|
|
114
|
-
case
|
|
114
|
+
case u:
|
|
115
115
|
var r = e;
|
|
116
116
|
return te(r) + ".Consumer";
|
|
117
|
-
case
|
|
117
|
+
case l:
|
|
118
118
|
var t = e;
|
|
119
119
|
return te(t._context) + ".Provider";
|
|
120
|
-
case
|
|
120
|
+
case p:
|
|
121
121
|
return Ve(e, e.render, "ForwardRef");
|
|
122
122
|
case T:
|
|
123
123
|
var n = e.displayName || null;
|
|
124
124
|
return n !== null ? n : w(e.type) || "Memo";
|
|
125
125
|
case P: {
|
|
126
|
-
var
|
|
126
|
+
var s = e, b = s._payload, o = s._init;
|
|
127
127
|
try {
|
|
128
|
-
return w(
|
|
128
|
+
return w(o(b));
|
|
129
129
|
} catch {
|
|
130
130
|
return null;
|
|
131
131
|
}
|
|
@@ -201,8 +201,8 @@ function Pr() {
|
|
|
201
201
|
if (B === void 0)
|
|
202
202
|
try {
|
|
203
203
|
throw Error();
|
|
204
|
-
} catch (
|
|
205
|
-
var n =
|
|
204
|
+
} catch (s) {
|
|
205
|
+
var n = s.stack.trim().match(/\n( *(at )?)/);
|
|
206
206
|
B = n && n[1] || "";
|
|
207
207
|
}
|
|
208
208
|
return `
|
|
@@ -224,33 +224,33 @@ function Pr() {
|
|
|
224
224
|
}
|
|
225
225
|
var n;
|
|
226
226
|
J = !0;
|
|
227
|
-
var
|
|
227
|
+
var s = Error.prepareStackTrace;
|
|
228
228
|
Error.prepareStackTrace = void 0;
|
|
229
|
-
var
|
|
230
|
-
|
|
229
|
+
var b;
|
|
230
|
+
b = N.current, N.current = null, Le();
|
|
231
231
|
try {
|
|
232
232
|
if (r) {
|
|
233
|
-
var
|
|
233
|
+
var o = function() {
|
|
234
234
|
throw Error();
|
|
235
235
|
};
|
|
236
|
-
if (Object.defineProperty(
|
|
236
|
+
if (Object.defineProperty(o.prototype, "props", {
|
|
237
237
|
set: function() {
|
|
238
238
|
throw Error();
|
|
239
239
|
}
|
|
240
240
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
241
241
|
try {
|
|
242
|
-
Reflect.construct(
|
|
242
|
+
Reflect.construct(o, []);
|
|
243
243
|
} catch (R) {
|
|
244
244
|
n = R;
|
|
245
245
|
}
|
|
246
|
-
Reflect.construct(e, [],
|
|
246
|
+
Reflect.construct(e, [], o);
|
|
247
247
|
} else {
|
|
248
248
|
try {
|
|
249
|
-
|
|
249
|
+
o.call();
|
|
250
250
|
} catch (R) {
|
|
251
251
|
n = R;
|
|
252
252
|
}
|
|
253
|
-
e.call(
|
|
253
|
+
e.call(o.prototype);
|
|
254
254
|
}
|
|
255
255
|
} else {
|
|
256
256
|
try {
|
|
@@ -262,17 +262,17 @@ function Pr() {
|
|
|
262
262
|
}
|
|
263
263
|
} catch (R) {
|
|
264
264
|
if (R && n && typeof R.stack == "string") {
|
|
265
|
-
for (var
|
|
265
|
+
for (var i = R.stack.split(`
|
|
266
266
|
`), _ = n.stack.split(`
|
|
267
|
-
`), y =
|
|
267
|
+
`), y = i.length - 1, m = _.length - 1; y >= 1 && m >= 0 && i[y] !== _[m]; )
|
|
268
268
|
m--;
|
|
269
269
|
for (; y >= 1 && m >= 0; y--, m--)
|
|
270
|
-
if (
|
|
270
|
+
if (i[y] !== _[m]) {
|
|
271
271
|
if (y !== 1 || m !== 1)
|
|
272
272
|
do
|
|
273
|
-
if (y--, m--, m < 0 ||
|
|
273
|
+
if (y--, m--, m < 0 || i[y] !== _[m]) {
|
|
274
274
|
var S = `
|
|
275
|
-
` +
|
|
275
|
+
` + i[y].replace(" at new ", " at ");
|
|
276
276
|
return e.displayName && S.includes("<anonymous>") && (S = S.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, S), S;
|
|
277
277
|
}
|
|
278
278
|
while (y >= 1 && m >= 0);
|
|
@@ -280,7 +280,7 @@ function Pr() {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
} finally {
|
|
283
|
-
J = !1, N.current =
|
|
283
|
+
J = !1, N.current = b, Me(), Error.prepareStackTrace = s;
|
|
284
284
|
}
|
|
285
285
|
var F = e ? e.displayName || e.name : "", C = F ? V(F) : "";
|
|
286
286
|
return typeof e == "function" && L.set(e, C), C;
|
|
@@ -307,14 +307,14 @@ function Pr() {
|
|
|
307
307
|
}
|
|
308
308
|
if (typeof e == "object")
|
|
309
309
|
switch (e.$$typeof) {
|
|
310
|
-
case
|
|
310
|
+
case p:
|
|
311
311
|
return Ne(e.render);
|
|
312
312
|
case T:
|
|
313
313
|
return M(e.type, r, t);
|
|
314
314
|
case P: {
|
|
315
|
-
var n = e,
|
|
315
|
+
var n = e, s = n._payload, b = n._init;
|
|
316
316
|
try {
|
|
317
|
-
return M(
|
|
317
|
+
return M(b(s), r, t);
|
|
318
318
|
} catch {
|
|
319
319
|
}
|
|
320
320
|
}
|
|
@@ -329,22 +329,22 @@ function Pr() {
|
|
|
329
329
|
} else
|
|
330
330
|
de.setExtraStackFrame(null);
|
|
331
331
|
}
|
|
332
|
-
function Je(e, r, t, n,
|
|
332
|
+
function Je(e, r, t, n, s) {
|
|
333
333
|
{
|
|
334
|
-
var
|
|
335
|
-
for (var
|
|
336
|
-
if (
|
|
337
|
-
var
|
|
334
|
+
var b = Function.call.bind(I);
|
|
335
|
+
for (var o in e)
|
|
336
|
+
if (b(e, o)) {
|
|
337
|
+
var i = void 0;
|
|
338
338
|
try {
|
|
339
|
-
if (typeof e[
|
|
340
|
-
var _ = Error((n || "React class") + ": " + t + " type `" +
|
|
339
|
+
if (typeof e[o] != "function") {
|
|
340
|
+
var _ = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
341
341
|
throw _.name = "Invariant Violation", _;
|
|
342
342
|
}
|
|
343
|
-
|
|
343
|
+
i = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
344
344
|
} catch (y) {
|
|
345
|
-
|
|
345
|
+
i = y;
|
|
346
346
|
}
|
|
347
|
-
|
|
347
|
+
i && !(i instanceof Error) && (U(s), g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, o, typeof i), U(null)), i instanceof Error && !(i.message in ve) && (ve[i.message] = !0, U(s), g("Failed %s type: %s", t, i.message), U(null));
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
}
|
|
@@ -419,51 +419,51 @@ function Pr() {
|
|
|
419
419
|
});
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
var rr = function(e, r, t, n,
|
|
423
|
-
var
|
|
422
|
+
var rr = function(e, r, t, n, s, b, o) {
|
|
423
|
+
var i = {
|
|
424
424
|
// This tag allows us to uniquely identify this as a React Element
|
|
425
425
|
$$typeof: a,
|
|
426
426
|
// Built-in properties that belong on the element
|
|
427
427
|
type: e,
|
|
428
428
|
key: r,
|
|
429
429
|
ref: t,
|
|
430
|
-
props:
|
|
430
|
+
props: o,
|
|
431
431
|
// Record the component responsible for creating this element.
|
|
432
|
-
_owner:
|
|
432
|
+
_owner: b
|
|
433
433
|
};
|
|
434
|
-
return
|
|
434
|
+
return i._store = {}, Object.defineProperty(i._store, "validated", {
|
|
435
435
|
configurable: !1,
|
|
436
436
|
enumerable: !1,
|
|
437
437
|
writable: !0,
|
|
438
438
|
value: !1
|
|
439
|
-
}), Object.defineProperty(
|
|
439
|
+
}), Object.defineProperty(i, "_self", {
|
|
440
440
|
configurable: !1,
|
|
441
441
|
enumerable: !1,
|
|
442
442
|
writable: !1,
|
|
443
443
|
value: n
|
|
444
|
-
}), Object.defineProperty(
|
|
444
|
+
}), Object.defineProperty(i, "_source", {
|
|
445
445
|
configurable: !1,
|
|
446
446
|
enumerable: !1,
|
|
447
447
|
writable: !1,
|
|
448
|
-
value:
|
|
449
|
-
}), Object.freeze && (Object.freeze(
|
|
448
|
+
value: s
|
|
449
|
+
}), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
|
|
450
450
|
};
|
|
451
|
-
function tr(e, r, t, n,
|
|
451
|
+
function tr(e, r, t, n, s) {
|
|
452
452
|
{
|
|
453
|
-
var
|
|
454
|
-
t !== void 0 && (be(t),
|
|
455
|
-
for (
|
|
456
|
-
I.call(r,
|
|
453
|
+
var b, o = {}, i = null, _ = null;
|
|
454
|
+
t !== void 0 && (be(t), i = "" + t), Xe(r) && (be(r.key), i = "" + r.key), He(r) && (_ = r.ref, Ze(r, s));
|
|
455
|
+
for (b in r)
|
|
456
|
+
I.call(r, b) && !ze.hasOwnProperty(b) && (o[b] = r[b]);
|
|
457
457
|
if (e && e.defaultProps) {
|
|
458
458
|
var y = e.defaultProps;
|
|
459
|
-
for (
|
|
460
|
-
|
|
459
|
+
for (b in y)
|
|
460
|
+
o[b] === void 0 && (o[b] = y[b]);
|
|
461
461
|
}
|
|
462
|
-
if (
|
|
462
|
+
if (i || _) {
|
|
463
463
|
var m = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
464
|
-
|
|
464
|
+
i && Qe(o, m), _ && er(o, m);
|
|
465
465
|
}
|
|
466
|
-
return rr(e,
|
|
466
|
+
return rr(e, i, _, s, n, he.current, o);
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
var K = j.ReactCurrentOwner, Ee = j.ReactDebugCurrentFrame;
|
|
@@ -532,10 +532,10 @@ Check the top-level render call using <` + t + ">.");
|
|
|
532
532
|
else if (z(e))
|
|
533
533
|
e._store && (e._store.validated = !0);
|
|
534
534
|
else if (e) {
|
|
535
|
-
var
|
|
536
|
-
if (typeof
|
|
537
|
-
for (var
|
|
538
|
-
z(
|
|
535
|
+
var s = je(e);
|
|
536
|
+
if (typeof s == "function" && s !== e.entries)
|
|
537
|
+
for (var b = s.call(e), o; !(o = b.next()).done; )
|
|
538
|
+
z(o.value) && Re(o.value, r);
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
541
|
}
|
|
@@ -547,7 +547,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
547
547
|
var t;
|
|
548
548
|
if (typeof r == "function")
|
|
549
549
|
t = r.propTypes;
|
|
550
|
-
else if (typeof r == "object" && (r.$$typeof ===
|
|
550
|
+
else if (typeof r == "object" && (r.$$typeof === p || // Note: Memo only checks outer props here.
|
|
551
551
|
// Inner props are checked in the reconciler.
|
|
552
552
|
r.$$typeof === T))
|
|
553
553
|
t = r.propTypes;
|
|
@@ -558,8 +558,8 @@ Check the top-level render call using <` + t + ">.");
|
|
|
558
558
|
Je(t, e.props, "prop", n, e);
|
|
559
559
|
} else if (r.PropTypes !== void 0 && !G) {
|
|
560
560
|
G = !0;
|
|
561
|
-
var
|
|
562
|
-
g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",
|
|
561
|
+
var s = w(r);
|
|
562
|
+
g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown");
|
|
563
563
|
}
|
|
564
564
|
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
565
565
|
}
|
|
@@ -577,21 +577,21 @@ Check the top-level render call using <` + t + ">.");
|
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
var Se = {};
|
|
580
|
-
function xe(e, r, t, n,
|
|
580
|
+
function xe(e, r, t, n, s, b) {
|
|
581
581
|
{
|
|
582
|
-
var
|
|
583
|
-
if (!
|
|
584
|
-
var
|
|
585
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
582
|
+
var o = Ye(e);
|
|
583
|
+
if (!o) {
|
|
584
|
+
var i = "";
|
|
585
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (i += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
586
586
|
var _ = nr();
|
|
587
|
-
_ ?
|
|
587
|
+
_ ? i += _ : i += ge();
|
|
588
588
|
var y;
|
|
589
|
-
e === null ? y = "null" : q(e) ? y = "array" : e !== void 0 && e.$$typeof === a ? (y = "<" + (w(e.type) || "Unknown") + " />",
|
|
589
|
+
e === null ? y = "null" : q(e) ? y = "array" : e !== void 0 && e.$$typeof === a ? (y = "<" + (w(e.type) || "Unknown") + " />", i = " Did you accidentally export a JSX literal instead of a component?") : y = typeof e, g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", y, i);
|
|
590
590
|
}
|
|
591
|
-
var m = tr(e, r, t,
|
|
591
|
+
var m = tr(e, r, t, s, b);
|
|
592
592
|
if (m == null)
|
|
593
593
|
return m;
|
|
594
|
-
if (
|
|
594
|
+
if (o) {
|
|
595
595
|
var S = r.children;
|
|
596
596
|
if (S !== void 0)
|
|
597
597
|
if (n)
|
|
@@ -618,7 +618,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
618
618
|
<%s key={someKey} {...props} />`, H, C, fr, C), Se[C + H] = !0;
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
-
return e ===
|
|
621
|
+
return e === v ? or(m) : ir(m), m;
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
624
|
function ur(e, r, t) {
|
|
@@ -628,7 +628,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
628
628
|
return xe(e, r, t, !1);
|
|
629
629
|
}
|
|
630
630
|
var cr = sr, lr = ur;
|
|
631
|
-
W.Fragment =
|
|
631
|
+
W.Fragment = v, W.jsx = cr, W.jsxs = lr;
|
|
632
632
|
}()), W;
|
|
633
633
|
}
|
|
634
634
|
process.env.NODE_ENV === "production" ? Q.exports = xr() : Q.exports = Pr();
|
|
@@ -642,13 +642,13 @@ function $r(h) {
|
|
|
642
642
|
}
|
|
643
643
|
function Or(h) {
|
|
644
644
|
if (Array.isArray(h)) {
|
|
645
|
-
const [a, ...
|
|
646
|
-
return (
|
|
647
|
-
if (
|
|
648
|
-
let
|
|
649
|
-
for (const
|
|
650
|
-
|
|
651
|
-
return
|
|
645
|
+
const [a, ...f] = h;
|
|
646
|
+
return (v, d, c) => {
|
|
647
|
+
if (v !== a) return !1;
|
|
648
|
+
let l = d, u = c;
|
|
649
|
+
for (const p of f)
|
|
650
|
+
l = l == null ? void 0 : l[p], u = u == null ? void 0 : u[p];
|
|
651
|
+
return l !== u;
|
|
652
652
|
};
|
|
653
653
|
}
|
|
654
654
|
return h;
|
|
@@ -659,106 +659,112 @@ class Z {
|
|
|
659
659
|
X(this, "changeSubscribers", {});
|
|
660
660
|
this.set(a);
|
|
661
661
|
}
|
|
662
|
-
subscribe(a,
|
|
663
|
-
const
|
|
664
|
-
return this.changeSubscribers[
|
|
665
|
-
id:
|
|
666
|
-
deps:
|
|
662
|
+
subscribe(a, f, v) {
|
|
663
|
+
const d = _r();
|
|
664
|
+
return this.changeSubscribers[d] = {
|
|
665
|
+
id: d,
|
|
666
|
+
deps: v,
|
|
667
667
|
propCallback: a,
|
|
668
|
-
reinitCallback:
|
|
669
|
-
},
|
|
668
|
+
reinitCallback: f
|
|
669
|
+
}, d;
|
|
670
670
|
}
|
|
671
671
|
unsubscribe(a) {
|
|
672
672
|
delete this.changeSubscribers[a];
|
|
673
673
|
}
|
|
674
|
-
emitChange(a,
|
|
675
|
-
Object.values(this.changeSubscribers).forEach((
|
|
676
|
-
var
|
|
677
|
-
const
|
|
678
|
-
(!
|
|
679
|
-
(
|
|
680
|
-
)) &&
|
|
674
|
+
emitChange(a, f, v) {
|
|
675
|
+
Object.values(this.changeSubscribers).forEach((d) => {
|
|
676
|
+
var l;
|
|
677
|
+
const c = (l = d.deps) == null ? void 0 : l.map(Or);
|
|
678
|
+
(!c || c.includes(a) && v !== f || c.some(
|
|
679
|
+
(u) => Y(u) && u(a, f, v, this.value)
|
|
680
|
+
)) && d.propCallback(a, f, v);
|
|
681
681
|
});
|
|
682
682
|
}
|
|
683
|
-
emitReinit(a,
|
|
684
|
-
Object.values(this.changeSubscribers).forEach((
|
|
685
|
-
|
|
683
|
+
emitReinit(a, f, v = !1) {
|
|
684
|
+
Object.values(this.changeSubscribers).forEach((d) => {
|
|
685
|
+
d.reinitCallback(a, f, v);
|
|
686
686
|
});
|
|
687
687
|
}
|
|
688
688
|
get() {
|
|
689
689
|
return this.value;
|
|
690
690
|
}
|
|
691
691
|
set(a) {
|
|
692
|
-
const
|
|
692
|
+
const f = this;
|
|
693
693
|
if (a !== this.value) {
|
|
694
|
-
const
|
|
694
|
+
const v = this.value;
|
|
695
695
|
a != null ? this.value = new Proxy(a, {
|
|
696
|
-
get: function(
|
|
697
|
-
const
|
|
698
|
-
return Y(
|
|
696
|
+
get: function(d, c) {
|
|
697
|
+
const l = Reflect.get(d, c, a);
|
|
698
|
+
return Y(l) ? l.bind(f.value) : l;
|
|
699
699
|
},
|
|
700
|
-
set: (
|
|
701
|
-
const
|
|
702
|
-
return Reflect.set(
|
|
700
|
+
set: (d, c, l) => {
|
|
701
|
+
const u = c, p = d[u];
|
|
702
|
+
return Reflect.set(d, u, l, a), l = d[u], this.emitChange(u, l, p), !0;
|
|
703
703
|
}
|
|
704
|
-
}) : this.value = a, this.emitReinit(this.value,
|
|
704
|
+
}) : this.value = a, this.emitReinit(this.value, v);
|
|
705
705
|
}
|
|
706
706
|
return this.value;
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
-
function Wr(h) {
|
|
709
|
+
function Wr(h, a = (f) => f) {
|
|
710
710
|
return Sr(
|
|
711
711
|
({
|
|
712
|
-
children:
|
|
713
|
-
value:
|
|
714
|
-
onChangeProp:
|
|
715
|
-
onChangeReinit:
|
|
716
|
-
proxyRef:
|
|
712
|
+
children: f,
|
|
713
|
+
value: v,
|
|
714
|
+
onChangeProp: d,
|
|
715
|
+
onChangeReinit: c,
|
|
716
|
+
proxyRef: l
|
|
717
717
|
}) => {
|
|
718
|
-
const
|
|
719
|
-
|
|
720
|
-
const
|
|
721
|
-
return hr(
|
|
722
|
-
const
|
|
723
|
-
|
|
718
|
+
const u = Ce(void 0);
|
|
719
|
+
u.current === void 0 && (u.current = v instanceof Z ? v : new Z(a(v)), c == null || c(u.current.get(), v instanceof Z ? v.get() : void 0, !0));
|
|
720
|
+
const p = Rr();
|
|
721
|
+
return hr(l, () => u.current.get(), [u.current.get()]), yr(() => {
|
|
722
|
+
const x = u.current.subscribe(
|
|
723
|
+
d ?? (() => {
|
|
724
724
|
}),
|
|
725
|
-
(...
|
|
726
|
-
Y(
|
|
725
|
+
(...E) => {
|
|
726
|
+
Y(c) && c(...E), p();
|
|
727
727
|
},
|
|
728
728
|
null
|
|
729
729
|
);
|
|
730
730
|
return () => {
|
|
731
|
-
|
|
731
|
+
u.current.unsubscribe(x);
|
|
732
732
|
};
|
|
733
|
-
}, [
|
|
733
|
+
}, [d, c, p]), /* @__PURE__ */ wr.jsx(h.Provider, { value: u.current, children: f });
|
|
734
734
|
},
|
|
735
735
|
["children", "onChangeProp", "onChangeReinit", "proxyRef"],
|
|
736
736
|
h.name + ".Provider"
|
|
737
737
|
);
|
|
738
738
|
}
|
|
739
|
-
function Yr(
|
|
740
|
-
|
|
741
|
-
|
|
739
|
+
function Yr(...[
|
|
740
|
+
h,
|
|
741
|
+
a,
|
|
742
|
+
f,
|
|
743
|
+
v,
|
|
744
|
+
d = !0
|
|
745
|
+
]) {
|
|
746
|
+
const c = mr(h);
|
|
747
|
+
if (c === void 0)
|
|
742
748
|
throw new Error(`No ${h.name} provider found.`);
|
|
743
|
-
const
|
|
744
|
-
const E =
|
|
749
|
+
const l = Ce({ value: c }), u = Er((x) => {
|
|
750
|
+
const E = c.subscribe(
|
|
745
751
|
(T, P, k) => {
|
|
746
|
-
|
|
752
|
+
l.current = { value: c }, x(), Y(f) && f(T, P, k);
|
|
747
753
|
},
|
|
748
754
|
(T, P) => {
|
|
749
|
-
|
|
755
|
+
d && (l.current = { value: c }, x()), Y(v) && v(T, P);
|
|
750
756
|
},
|
|
751
757
|
a
|
|
752
758
|
);
|
|
753
|
-
return () =>
|
|
754
|
-
}, [a,
|
|
755
|
-
|
|
756
|
-
() =>
|
|
757
|
-
() =>
|
|
759
|
+
return () => c.unsubscribe(E);
|
|
760
|
+
}, [a, d, f, v, c]), p = gr(
|
|
761
|
+
u,
|
|
762
|
+
() => l.current,
|
|
763
|
+
() => l.current
|
|
758
764
|
);
|
|
759
765
|
return new Tr(
|
|
760
766
|
// The binding is necessary to fix a strange issue I'm having.
|
|
761
|
-
{ value:
|
|
767
|
+
{ value: p.value.get(), set: p.value.set.bind(p.value) },
|
|
762
768
|
["value", "set"]
|
|
763
769
|
);
|
|
764
770
|
}
|