@ptolemy2002/react-proxy-context 2.6.0 → 2.6.2
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 +30 -7
- package/dist/main.d.ts +12 -7
- package/dist/main.js +147 -139
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,13 +46,19 @@ type UseProxyContextResult<T> = HookResultData<{
|
|
|
46
46
|
set: (newObj: T) => T;
|
|
47
47
|
}, readonly [T, (newObj: T) => T]>;
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
]
|
|
49
|
+
// ArrayWithOptional is internal
|
|
50
|
+
type ArrayWithOptional<AR extends unknown[], AO extends unknown[]> = AR | [...AR, ...AO];
|
|
51
|
+
|
|
52
|
+
type UseProxyContextArgsNoClass<T> = ArrayWithOptional<
|
|
53
|
+
[Dependency<T>[] | null],
|
|
54
|
+
ArrayWithOptional<
|
|
55
|
+
[OnChangePropCallback<T>], ArrayWithOptional<
|
|
56
|
+
[OnChangeReinitCallback<T>], [boolean]
|
|
57
|
+
>
|
|
58
|
+
>
|
|
59
|
+
>;
|
|
60
|
+
|
|
61
|
+
type UseProxyContextArgs<T> = ArrayWithOptional<[ProxyContext<T>], UseProxyContextArgsNoClass<T>>;
|
|
56
62
|
```
|
|
57
63
|
|
|
58
64
|
## Classes
|
|
@@ -125,6 +131,23 @@ The component has the following props:
|
|
|
125
131
|
- `onChangeReinit` (`OnChangeReinitCallback<T>`): A function that is called whenever the context is reinitialized. The first parameter is the current value of the context, the second parameter is the previous value of the context, and the third parameter is a boolean indicating whether this is the first initialization. Also called on first initialization, with the previous value being `undefined` if you passed in a raw value instead of a `ProxyContextValueWrapper`. This is useful for listening to changes in the provider's parent component.
|
|
126
132
|
- `proxyRef` (`React.MutableRefObject<T>`): A ref object that is assigned the proxy object of the context. This is useful for accessing the proxy object directly by the provider's parent component.
|
|
127
133
|
|
|
134
|
+
### createOnChangeProp<T>
|
|
135
|
+
#### Description
|
|
136
|
+
A helper function that creates an `OnChangePropCallback` function. This should never be necessary, but there are some cases where TypeScript cannot infer the type of the callback arguments correctly, so wrapping with this would make sense.
|
|
137
|
+
|
|
138
|
+
#### Parameters
|
|
139
|
+
- `f` (`OnChangePropCallback<T>`): The function to wrap.
|
|
140
|
+
|
|
141
|
+
### createOnChangeReinit<T>
|
|
142
|
+
#### Description
|
|
143
|
+
A helper function that creates an `OnChangeReinitCallback` function. This should never be necessary, but there are some cases where TypeScript cannot infer the type of the callback arguments correctly, so wrapping with this would make sense.
|
|
144
|
+
|
|
145
|
+
#### Parameters
|
|
146
|
+
- `f` (`OnChangeReinitCallback<T>`): The function to wrap.
|
|
147
|
+
|
|
148
|
+
#### Returns
|
|
149
|
+
`OnChangeReinitCallback<T>` - The same function that was passed in.
|
|
150
|
+
|
|
128
151
|
## Hooks
|
|
129
152
|
The following hooks are available in the library:
|
|
130
153
|
|
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Context, ReactNode } from 'react';
|
|
2
2
|
import { HookResultData } from '@ptolemy2002/react-hook-result';
|
|
3
|
+
type ArrayWithOptional<AR extends unknown[], AO extends unknown[]> = AR | [...AR, ...AO];
|
|
3
4
|
export type ContextWithName<T> = Context<T> & {
|
|
4
5
|
name: string;
|
|
5
6
|
};
|
|
@@ -40,11 +41,15 @@ export type UseProxyContextResult<T> = HookResultData<{
|
|
|
40
41
|
value: T;
|
|
41
42
|
set: (newObj: T) => T;
|
|
42
43
|
}, readonly [T, (newObj: T) => T]>;
|
|
43
|
-
export type
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
OnChangePropCallback<T
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
]
|
|
44
|
+
export type UseProxyContextArgsNoClass<T> = ArrayWithOptional<[
|
|
45
|
+
Dependency<T>[] | null
|
|
46
|
+
], ArrayWithOptional<[
|
|
47
|
+
OnChangePropCallback<T>
|
|
48
|
+
], ArrayWithOptional<[
|
|
49
|
+
OnChangeReinitCallback<T>
|
|
50
|
+
], [boolean]>>>;
|
|
51
|
+
export type UseProxyContextArgs<T> = ArrayWithOptional<[ProxyContext<T>], UseProxyContextArgsNoClass<T>>;
|
|
50
52
|
export declare function useProxyContext<T>(...[contextClass, deps, onChangeProp, onChangeReinit, listenReinit]: UseProxyContextArgs<T>): UseProxyContextResult<T>;
|
|
53
|
+
export declare function createOnChangeReinit<T>(f: OnChangeReinitCallback<T>): OnChangeReinitCallback<T>;
|
|
54
|
+
export declare function createOnChangeProp<T>(f: OnChangePropCallback<T>): OnChangePropCallback<T>;
|
|
55
|
+
export {};
|
package/dist/main.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var dr = Object.defineProperty;
|
|
2
2
|
var pr = (h, a, f) => a in h ? dr(h, a, { enumerable: !0, configurable: !0, writable: !0, value: f }) : h[a] = f;
|
|
3
3
|
var X = (h, a, f) => pr(h, typeof a != "symbol" ? a + "" : a, f);
|
|
4
|
-
import
|
|
5
|
-
import { nanoid as
|
|
4
|
+
import we, { createContext as br, useRef as Ce, useImperativeHandle as hr, useEffect as yr, useContext as gr, useCallback as mr, useSyncExternalStore as Er } from "react";
|
|
5
|
+
import { nanoid as Rr } from "nanoid";
|
|
6
6
|
import Y from "is-callable";
|
|
7
|
-
import
|
|
7
|
+
import _r from "@ptolemy2002/react-force-rerender";
|
|
8
8
|
import Tr from "@ptolemy2002/react-hook-result";
|
|
9
|
-
import { partialMemo as
|
|
9
|
+
import { partialMemo as Pr } from "@ptolemy2002/react-utils";
|
|
10
10
|
var Q = { exports: {} }, $ = {};
|
|
11
11
|
/**
|
|
12
12
|
* @license React
|
|
@@ -17,17 +17,17 @@ var Q = { exports: {} }, $ = {};
|
|
|
17
17
|
* This source code is licensed under the MIT license found in the
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
19
|
*/
|
|
20
|
-
var
|
|
21
|
-
function
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
var h =
|
|
25
|
-
function l(u, p,
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
for (
|
|
29
|
-
if (u && u.defaultProps) for (
|
|
30
|
-
return { $$typeof: a, type: u, key:
|
|
20
|
+
var xe;
|
|
21
|
+
function Sr() {
|
|
22
|
+
if (xe) return $;
|
|
23
|
+
xe = 1;
|
|
24
|
+
var h = we, 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, S) {
|
|
26
|
+
var m, T = {}, x = null, k = null;
|
|
27
|
+
S !== void 0 && (x = "" + S), p.key !== void 0 && (x = "" + p.key), p.ref !== void 0 && (k = p.ref);
|
|
28
|
+
for (m in p) v.call(p, m) && !c.hasOwnProperty(m) && (T[m] = p[m]);
|
|
29
|
+
if (u && u.defaultProps) for (m in p = u.defaultProps, p) T[m] === void 0 && (T[m] = p[m]);
|
|
30
|
+
return { $$typeof: a, type: u, key: x, ref: k, props: T, _owner: d.current };
|
|
31
31
|
}
|
|
32
32
|
return $.Fragment = f, $.jsx = l, $.jsxs = l, $;
|
|
33
33
|
}
|
|
@@ -41,10 +41,10 @@ var W = {};
|
|
|
41
41
|
* This source code is licensed under the MIT license found in the
|
|
42
42
|
* LICENSE file in the root directory of this source tree.
|
|
43
43
|
*/
|
|
44
|
-
var
|
|
45
|
-
function
|
|
46
|
-
return
|
|
47
|
-
var h =
|
|
44
|
+
var Oe;
|
|
45
|
+
function xr() {
|
|
46
|
+
return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
|
+
var h = we, 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"), S = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), x = 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;
|
|
@@ -52,7 +52,7 @@ function Pr() {
|
|
|
52
52
|
return typeof r == "function" ? r : null;
|
|
53
53
|
}
|
|
54
54
|
var j = h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
55
|
-
function
|
|
55
|
+
function E(e) {
|
|
56
56
|
{
|
|
57
57
|
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
|
|
58
58
|
t[n - 1] = arguments[n];
|
|
@@ -72,7 +72,7 @@ function Pr() {
|
|
|
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 === v || e === c || We || e === d || e ===
|
|
75
|
+
return !!(typeof e == "string" || typeof e == "function" || e === v || e === c || We || e === d || e === S || e === m || $e || e === k || Fe || Ae || Ie || typeof e == "object" && e !== null && (e.$$typeof === x || 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.
|
|
@@ -88,10 +88,10 @@ function Pr() {
|
|
|
88
88
|
function te(e) {
|
|
89
89
|
return e.displayName || "Context";
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function O(e) {
|
|
92
92
|
if (e == null)
|
|
93
93
|
return null;
|
|
94
|
-
if (typeof e.tag == "number" &&
|
|
94
|
+
if (typeof e.tag == "number" && E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
95
95
|
return e.displayName || e.name || null;
|
|
96
96
|
if (typeof e == "string")
|
|
97
97
|
return e;
|
|
@@ -104,9 +104,9 @@ function Pr() {
|
|
|
104
104
|
return "Profiler";
|
|
105
105
|
case d:
|
|
106
106
|
return "StrictMode";
|
|
107
|
-
case
|
|
107
|
+
case S:
|
|
108
108
|
return "Suspense";
|
|
109
|
-
case
|
|
109
|
+
case m:
|
|
110
110
|
return "SuspenseList";
|
|
111
111
|
}
|
|
112
112
|
if (typeof e == "object")
|
|
@@ -121,11 +121,11 @@ function Pr() {
|
|
|
121
121
|
return Ve(e, e.render, "ForwardRef");
|
|
122
122
|
case T:
|
|
123
123
|
var n = e.displayName || null;
|
|
124
|
-
return n !== null ? n :
|
|
125
|
-
case
|
|
124
|
+
return n !== null ? n : O(e.type) || "Memo";
|
|
125
|
+
case x: {
|
|
126
126
|
var s = e, b = s._payload, o = s._init;
|
|
127
127
|
try {
|
|
128
|
-
return
|
|
128
|
+
return O(o(b));
|
|
129
129
|
} catch {
|
|
130
130
|
return null;
|
|
131
131
|
}
|
|
@@ -133,7 +133,7 @@ function Pr() {
|
|
|
133
133
|
}
|
|
134
134
|
return null;
|
|
135
135
|
}
|
|
136
|
-
var
|
|
136
|
+
var w = Object.assign, A = 0, ne, ae, ie, oe, ue, se, ce;
|
|
137
137
|
function le() {
|
|
138
138
|
}
|
|
139
139
|
le.__reactDisabledLog = !0;
|
|
@@ -169,30 +169,30 @@ function Pr() {
|
|
|
169
169
|
writable: !0
|
|
170
170
|
};
|
|
171
171
|
Object.defineProperties(console, {
|
|
172
|
-
log:
|
|
172
|
+
log: w({}, e, {
|
|
173
173
|
value: ne
|
|
174
174
|
}),
|
|
175
|
-
info:
|
|
175
|
+
info: w({}, e, {
|
|
176
176
|
value: ae
|
|
177
177
|
}),
|
|
178
|
-
warn:
|
|
178
|
+
warn: w({}, e, {
|
|
179
179
|
value: ie
|
|
180
180
|
}),
|
|
181
|
-
error:
|
|
181
|
+
error: w({}, e, {
|
|
182
182
|
value: oe
|
|
183
183
|
}),
|
|
184
|
-
group:
|
|
184
|
+
group: w({}, e, {
|
|
185
185
|
value: ue
|
|
186
186
|
}),
|
|
187
|
-
groupCollapsed:
|
|
187
|
+
groupCollapsed: w({}, e, {
|
|
188
188
|
value: se
|
|
189
189
|
}),
|
|
190
|
-
groupEnd:
|
|
190
|
+
groupEnd: w({}, e, {
|
|
191
191
|
value: ce
|
|
192
192
|
})
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
|
-
A < 0 &&
|
|
195
|
+
A < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
var N = j.ReactCurrentDispatcher, B;
|
|
@@ -240,42 +240,42 @@ function Pr() {
|
|
|
240
240
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
241
241
|
try {
|
|
242
242
|
Reflect.construct(o, []);
|
|
243
|
-
} catch (
|
|
244
|
-
n =
|
|
243
|
+
} catch (_) {
|
|
244
|
+
n = _;
|
|
245
245
|
}
|
|
246
246
|
Reflect.construct(e, [], o);
|
|
247
247
|
} else {
|
|
248
248
|
try {
|
|
249
249
|
o.call();
|
|
250
|
-
} catch (
|
|
251
|
-
n =
|
|
250
|
+
} catch (_) {
|
|
251
|
+
n = _;
|
|
252
252
|
}
|
|
253
253
|
e.call(o.prototype);
|
|
254
254
|
}
|
|
255
255
|
} else {
|
|
256
256
|
try {
|
|
257
257
|
throw Error();
|
|
258
|
-
} catch (
|
|
259
|
-
n =
|
|
258
|
+
} catch (_) {
|
|
259
|
+
n = _;
|
|
260
260
|
}
|
|
261
261
|
e();
|
|
262
262
|
}
|
|
263
|
-
} catch (
|
|
264
|
-
if (
|
|
265
|
-
for (var i =
|
|
266
|
-
`),
|
|
267
|
-
`), y = i.length - 1,
|
|
268
|
-
|
|
269
|
-
for (; y >= 1 &&
|
|
270
|
-
if (i[y] !==
|
|
271
|
-
if (y !== 1 ||
|
|
263
|
+
} catch (_) {
|
|
264
|
+
if (_ && n && typeof _.stack == "string") {
|
|
265
|
+
for (var i = _.stack.split(`
|
|
266
|
+
`), R = n.stack.split(`
|
|
267
|
+
`), y = i.length - 1, g = R.length - 1; y >= 1 && g >= 0 && i[y] !== R[g]; )
|
|
268
|
+
g--;
|
|
269
|
+
for (; y >= 1 && g >= 0; y--, g--)
|
|
270
|
+
if (i[y] !== R[g]) {
|
|
271
|
+
if (y !== 1 || g !== 1)
|
|
272
272
|
do
|
|
273
|
-
if (y--,
|
|
274
|
-
var
|
|
273
|
+
if (y--, g--, g < 0 || i[y] !== R[g]) {
|
|
274
|
+
var P = `
|
|
275
275
|
` + i[y].replace(" at new ", " at ");
|
|
276
|
-
return e.displayName &&
|
|
276
|
+
return e.displayName && P.includes("<anonymous>") && (P = P.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, P), P;
|
|
277
277
|
}
|
|
278
|
-
while (y >= 1 &&
|
|
278
|
+
while (y >= 1 && g >= 0);
|
|
279
279
|
break;
|
|
280
280
|
}
|
|
281
281
|
}
|
|
@@ -300,9 +300,9 @@ function Pr() {
|
|
|
300
300
|
if (typeof e == "string")
|
|
301
301
|
return V(e);
|
|
302
302
|
switch (e) {
|
|
303
|
-
case
|
|
303
|
+
case S:
|
|
304
304
|
return V("Suspense");
|
|
305
|
-
case
|
|
305
|
+
case m:
|
|
306
306
|
return V("SuspenseList");
|
|
307
307
|
}
|
|
308
308
|
if (typeof e == "object")
|
|
@@ -311,7 +311,7 @@ function Pr() {
|
|
|
311
311
|
return Ne(e.render);
|
|
312
312
|
case T:
|
|
313
313
|
return M(e.type, r, t);
|
|
314
|
-
case
|
|
314
|
+
case x: {
|
|
315
315
|
var n = e, s = n._payload, b = n._init;
|
|
316
316
|
try {
|
|
317
317
|
return M(b(s), r, t);
|
|
@@ -337,14 +337,14 @@ function Pr() {
|
|
|
337
337
|
var i = void 0;
|
|
338
338
|
try {
|
|
339
339
|
if (typeof e[o] != "function") {
|
|
340
|
-
var
|
|
341
|
-
throw
|
|
340
|
+
var R = 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
|
+
throw R.name = "Invariant Violation", R;
|
|
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
|
-
i && !(i instanceof Error) && (U(s),
|
|
347
|
+
i && !(i instanceof Error) && (U(s), E("%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), E("Failed %s type: %s", t, i.message), U(null));
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
}
|
|
@@ -370,14 +370,14 @@ function Pr() {
|
|
|
370
370
|
}
|
|
371
371
|
function be(e) {
|
|
372
372
|
if (Ge(e))
|
|
373
|
-
return
|
|
373
|
+
return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(e)), pe(e);
|
|
374
374
|
}
|
|
375
375
|
var he = j.ReactCurrentOwner, ze = {
|
|
376
376
|
key: !0,
|
|
377
377
|
ref: !0,
|
|
378
378
|
__self: !0,
|
|
379
379
|
__source: !0
|
|
380
|
-
}, ye,
|
|
380
|
+
}, ye, ge;
|
|
381
381
|
function He(e) {
|
|
382
382
|
if (I.call(e, "ref")) {
|
|
383
383
|
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
@@ -400,7 +400,7 @@ function Pr() {
|
|
|
400
400
|
function Qe(e, r) {
|
|
401
401
|
{
|
|
402
402
|
var t = function() {
|
|
403
|
-
ye || (ye = !0,
|
|
403
|
+
ye || (ye = !0, E("%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://reactjs.org/link/special-props)", r));
|
|
404
404
|
};
|
|
405
405
|
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
406
406
|
get: t,
|
|
@@ -411,7 +411,7 @@ function Pr() {
|
|
|
411
411
|
function er(e, r) {
|
|
412
412
|
{
|
|
413
413
|
var t = function() {
|
|
414
|
-
|
|
414
|
+
ge || (ge = !0, E("%s: `ref` 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://reactjs.org/link/special-props)", r));
|
|
415
415
|
};
|
|
416
416
|
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
417
417
|
get: t,
|
|
@@ -450,8 +450,8 @@ function Pr() {
|
|
|
450
450
|
};
|
|
451
451
|
function tr(e, r, t, n, s) {
|
|
452
452
|
{
|
|
453
|
-
var b, o = {}, i = null,
|
|
454
|
-
t !== void 0 && (be(t), i = "" + t), Xe(r) && (be(r.key), i = "" + r.key), He(r) && (
|
|
453
|
+
var b, o = {}, i = null, R = null;
|
|
454
|
+
t !== void 0 && (be(t), i = "" + t), Xe(r) && (be(r.key), i = "" + r.key), He(r) && (R = r.ref, Ze(r, s));
|
|
455
455
|
for (b in r)
|
|
456
456
|
I.call(r, b) && !ze.hasOwnProperty(b) && (o[b] = r[b]);
|
|
457
457
|
if (e && e.defaultProps) {
|
|
@@ -459,30 +459,30 @@ function Pr() {
|
|
|
459
459
|
for (b in y)
|
|
460
460
|
o[b] === void 0 && (o[b] = y[b]);
|
|
461
461
|
}
|
|
462
|
-
if (i ||
|
|
463
|
-
var
|
|
464
|
-
i && Qe(o,
|
|
462
|
+
if (i || R) {
|
|
463
|
+
var g = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
464
|
+
i && Qe(o, g), R && er(o, g);
|
|
465
465
|
}
|
|
466
|
-
return rr(e, i,
|
|
466
|
+
return rr(e, i, R, s, n, he.current, o);
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
var K = j.ReactCurrentOwner,
|
|
469
|
+
var K = j.ReactCurrentOwner, me = j.ReactDebugCurrentFrame;
|
|
470
470
|
function D(e) {
|
|
471
471
|
if (e) {
|
|
472
472
|
var r = e._owner, t = M(e.type, e._source, r ? r.type : null);
|
|
473
|
-
|
|
473
|
+
me.setExtraStackFrame(t);
|
|
474
474
|
} else
|
|
475
|
-
|
|
475
|
+
me.setExtraStackFrame(null);
|
|
476
476
|
}
|
|
477
477
|
var G;
|
|
478
478
|
G = !1;
|
|
479
479
|
function z(e) {
|
|
480
480
|
return typeof e == "object" && e !== null && e.$$typeof === a;
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function Ee() {
|
|
483
483
|
{
|
|
484
484
|
if (K.current) {
|
|
485
|
-
var e =
|
|
485
|
+
var e = O(K.current.type);
|
|
486
486
|
if (e)
|
|
487
487
|
return `
|
|
488
488
|
|
|
@@ -494,10 +494,10 @@ Check the render method of \`` + e + "`.";
|
|
|
494
494
|
function nr(e) {
|
|
495
495
|
return "";
|
|
496
496
|
}
|
|
497
|
-
var
|
|
497
|
+
var Re = {};
|
|
498
498
|
function ar(e) {
|
|
499
499
|
{
|
|
500
|
-
var r =
|
|
500
|
+
var r = Ee();
|
|
501
501
|
if (!r) {
|
|
502
502
|
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
503
503
|
t && (r = `
|
|
@@ -507,17 +507,17 @@ Check the top-level render call using <` + t + ">.");
|
|
|
507
507
|
return r;
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function _e(e, r) {
|
|
511
511
|
{
|
|
512
512
|
if (!e._store || e._store.validated || e.key != null)
|
|
513
513
|
return;
|
|
514
514
|
e._store.validated = !0;
|
|
515
515
|
var t = ar(r);
|
|
516
|
-
if (
|
|
516
|
+
if (Re[t])
|
|
517
517
|
return;
|
|
518
|
-
|
|
518
|
+
Re[t] = !0;
|
|
519
519
|
var n = "";
|
|
520
|
-
e && e._owner && e._owner !== K.current && (n = " It was passed a child from " +
|
|
520
|
+
e && e._owner && e._owner !== K.current && (n = " It was passed a child from " + O(e._owner.type) + "."), D(e), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), D(null);
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
function Te(e, r) {
|
|
@@ -527,7 +527,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
527
527
|
if (q(e))
|
|
528
528
|
for (var t = 0; t < e.length; t++) {
|
|
529
529
|
var n = e[t];
|
|
530
|
-
z(n) &&
|
|
530
|
+
z(n) && _e(n, r);
|
|
531
531
|
}
|
|
532
532
|
else if (z(e))
|
|
533
533
|
e._store && (e._store.validated = !0);
|
|
@@ -535,7 +535,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
535
535
|
var s = je(e);
|
|
536
536
|
if (typeof s == "function" && s !== e.entries)
|
|
537
537
|
for (var b = s.call(e), o; !(o = b.next()).done; )
|
|
538
|
-
z(o.value) &&
|
|
538
|
+
z(o.value) && _e(o.value, r);
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
541
|
}
|
|
@@ -554,14 +554,14 @@ Check the top-level render call using <` + t + ">.");
|
|
|
554
554
|
else
|
|
555
555
|
return;
|
|
556
556
|
if (t) {
|
|
557
|
-
var n =
|
|
557
|
+
var n = O(r);
|
|
558
558
|
Je(t, e.props, "prop", n, e);
|
|
559
559
|
} else if (r.PropTypes !== void 0 && !G) {
|
|
560
560
|
G = !0;
|
|
561
|
-
var s =
|
|
562
|
-
|
|
561
|
+
var s = O(r);
|
|
562
|
+
E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown");
|
|
563
563
|
}
|
|
564
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved &&
|
|
564
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
567
|
function or(e) {
|
|
@@ -569,70 +569,70 @@ Check the top-level render call using <` + t + ">.");
|
|
|
569
569
|
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
570
570
|
var n = r[t];
|
|
571
571
|
if (n !== "children" && n !== "key") {
|
|
572
|
-
D(e),
|
|
572
|
+
D(e), E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), D(null);
|
|
573
573
|
break;
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
|
-
e.ref !== null && (D(e),
|
|
576
|
+
e.ref !== null && (D(e), E("Invalid attribute `ref` supplied to `React.Fragment`."), D(null));
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
var
|
|
580
|
-
function
|
|
579
|
+
var Pe = {};
|
|
580
|
+
function Se(e, r, t, n, s, b) {
|
|
581
581
|
{
|
|
582
582
|
var o = Ye(e);
|
|
583
583
|
if (!o) {
|
|
584
584
|
var i = "";
|
|
585
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
|
-
var
|
|
587
|
-
|
|
586
|
+
var R = nr();
|
|
587
|
+
R ? i += R : i += Ee();
|
|
588
588
|
var y;
|
|
589
|
-
e === null ? y = "null" : q(e) ? y = "array" : e !== void 0 && e.$$typeof === a ? (y = "<" + (
|
|
589
|
+
e === null ? y = "null" : q(e) ? y = "array" : e !== void 0 && e.$$typeof === a ? (y = "<" + (O(e.type) || "Unknown") + " />", i = " Did you accidentally export a JSX literal instead of a component?") : y = typeof e, E("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
|
|
592
|
-
if (
|
|
593
|
-
return
|
|
591
|
+
var g = tr(e, r, t, s, b);
|
|
592
|
+
if (g == null)
|
|
593
|
+
return g;
|
|
594
594
|
if (o) {
|
|
595
|
-
var
|
|
596
|
-
if (
|
|
595
|
+
var P = r.children;
|
|
596
|
+
if (P !== void 0)
|
|
597
597
|
if (n)
|
|
598
|
-
if (q(
|
|
599
|
-
for (var F = 0; F <
|
|
600
|
-
Te(
|
|
601
|
-
Object.freeze && Object.freeze(
|
|
598
|
+
if (q(P)) {
|
|
599
|
+
for (var F = 0; F < P.length; F++)
|
|
600
|
+
Te(P[F], e);
|
|
601
|
+
Object.freeze && Object.freeze(P);
|
|
602
602
|
} else
|
|
603
|
-
|
|
603
|
+
E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
604
604
|
else
|
|
605
|
-
Te(
|
|
605
|
+
Te(P, e);
|
|
606
606
|
}
|
|
607
607
|
if (I.call(r, "key")) {
|
|
608
|
-
var C =
|
|
608
|
+
var C = O(e), _ = Object.keys(r).filter(function(vr) {
|
|
609
609
|
return vr !== "key";
|
|
610
|
-
}), H =
|
|
611
|
-
if (!
|
|
612
|
-
var fr =
|
|
613
|
-
|
|
610
|
+
}), H = _.length > 0 ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
611
|
+
if (!Pe[C + H]) {
|
|
612
|
+
var fr = _.length > 0 ? "{" + _.join(": ..., ") + ": ...}" : "{}";
|
|
613
|
+
E(`A props object containing a "key" prop is being spread into JSX:
|
|
614
614
|
let props = %s;
|
|
615
615
|
<%s {...props} />
|
|
616
616
|
React keys must be passed directly to JSX without using spread:
|
|
617
617
|
let props = %s;
|
|
618
|
-
<%s key={someKey} {...props} />`, H, C, fr, C),
|
|
618
|
+
<%s key={someKey} {...props} />`, H, C, fr, C), Pe[C + H] = !0;
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
-
return e === v ? or(
|
|
621
|
+
return e === v ? or(g) : ir(g), g;
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
624
|
function ur(e, r, t) {
|
|
625
|
-
return
|
|
625
|
+
return Se(e, r, t, !0);
|
|
626
626
|
}
|
|
627
627
|
function sr(e, r, t) {
|
|
628
|
-
return
|
|
628
|
+
return Se(e, r, t, !1);
|
|
629
629
|
}
|
|
630
630
|
var cr = sr, lr = ur;
|
|
631
631
|
W.Fragment = v, W.jsx = cr, W.jsxs = lr;
|
|
632
632
|
}()), W;
|
|
633
633
|
}
|
|
634
|
-
process.env.NODE_ENV === "production" ? Q.exports =
|
|
635
|
-
var
|
|
634
|
+
process.env.NODE_ENV === "production" ? Q.exports = Sr() : Q.exports = xr();
|
|
635
|
+
var Or = Q.exports;
|
|
636
636
|
function $r(h) {
|
|
637
637
|
if (typeof Proxy > "u") throw new Error("Proxy is not supported in this environment.");
|
|
638
638
|
const a = br(
|
|
@@ -640,7 +640,7 @@ function $r(h) {
|
|
|
640
640
|
);
|
|
641
641
|
return a.name = h, a;
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function wr(h) {
|
|
644
644
|
if (Array.isArray(h)) {
|
|
645
645
|
const [a, ...f] = h;
|
|
646
646
|
return (v, d, c) => {
|
|
@@ -660,7 +660,7 @@ class Z {
|
|
|
660
660
|
this.set(a);
|
|
661
661
|
}
|
|
662
662
|
subscribe(a, f, v) {
|
|
663
|
-
const d =
|
|
663
|
+
const d = Rr();
|
|
664
664
|
return this.changeSubscribers[d] = {
|
|
665
665
|
id: d,
|
|
666
666
|
deps: v,
|
|
@@ -674,7 +674,7 @@ class Z {
|
|
|
674
674
|
emitChange(a, f, v) {
|
|
675
675
|
Object.values(this.changeSubscribers).forEach((d) => {
|
|
676
676
|
var l;
|
|
677
|
-
const c = (l = d.deps) == null ? void 0 : l.map(
|
|
677
|
+
const c = (l = d.deps) == null ? void 0 : l.map(wr);
|
|
678
678
|
(!c || c.includes(a) && v !== f || c.some(
|
|
679
679
|
(u) => Y(u) && u(a, f, v, this.value)
|
|
680
680
|
)) && d.propCallback(a, f, v);
|
|
@@ -707,7 +707,7 @@ class Z {
|
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
709
|
function Wr(h, a = (f) => f) {
|
|
710
|
-
return
|
|
710
|
+
return Pr(
|
|
711
711
|
({
|
|
712
712
|
children: f,
|
|
713
713
|
value: v,
|
|
@@ -717,20 +717,20 @@ function Wr(h, a = (f) => f) {
|
|
|
717
717
|
}) => {
|
|
718
718
|
const u = Ce(void 0);
|
|
719
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 =
|
|
720
|
+
const p = _r();
|
|
721
721
|
return hr(l, () => u.current.get(), [u.current.get()]), yr(() => {
|
|
722
|
-
const
|
|
722
|
+
const S = u.current.subscribe(
|
|
723
723
|
d ?? (() => {
|
|
724
724
|
}),
|
|
725
|
-
(...
|
|
726
|
-
Y(c) && c(...
|
|
725
|
+
(...m) => {
|
|
726
|
+
Y(c) && c(...m), p();
|
|
727
727
|
},
|
|
728
728
|
null
|
|
729
729
|
);
|
|
730
730
|
return () => {
|
|
731
|
-
u.current.unsubscribe(
|
|
731
|
+
u.current.unsubscribe(S);
|
|
732
732
|
};
|
|
733
|
-
}, [d, c, p]), /* @__PURE__ */
|
|
733
|
+
}, [d, c, p]), /* @__PURE__ */ Or.jsx(h.Provider, { value: u.current, children: f });
|
|
734
734
|
},
|
|
735
735
|
["children", "onChangeProp", "onChangeReinit", "proxyRef"],
|
|
736
736
|
h.name + ".Provider"
|
|
@@ -738,26 +738,26 @@ function Wr(h, a = (f) => f) {
|
|
|
738
738
|
}
|
|
739
739
|
function Yr(...[
|
|
740
740
|
h,
|
|
741
|
-
a,
|
|
741
|
+
a = [],
|
|
742
742
|
f,
|
|
743
743
|
v,
|
|
744
744
|
d = !0
|
|
745
745
|
]) {
|
|
746
|
-
const c =
|
|
746
|
+
const c = gr(h);
|
|
747
747
|
if (c === void 0)
|
|
748
748
|
throw new Error(`No ${h.name} provider found.`);
|
|
749
|
-
const l = Ce({ value: c }), u =
|
|
750
|
-
const
|
|
751
|
-
(T,
|
|
752
|
-
l.current = { value: c },
|
|
749
|
+
const l = Ce({ value: c }), u = mr((S) => {
|
|
750
|
+
const m = c.subscribe(
|
|
751
|
+
(T, x, k) => {
|
|
752
|
+
l.current = { value: c }, S(), Y(f) && f(T, x, k);
|
|
753
753
|
},
|
|
754
|
-
(T,
|
|
755
|
-
d && (l.current = { value: c },
|
|
754
|
+
(T, x) => {
|
|
755
|
+
d && (l.current = { value: c }, S()), Y(v) && v(T, x);
|
|
756
756
|
},
|
|
757
757
|
a
|
|
758
758
|
);
|
|
759
|
-
return () => c.unsubscribe(
|
|
760
|
-
}, [a, d, f, v, c]), p =
|
|
759
|
+
return () => c.unsubscribe(m);
|
|
760
|
+
}, [a, d, f, v, c]), p = Er(
|
|
761
761
|
u,
|
|
762
762
|
() => l.current,
|
|
763
763
|
() => l.current
|
|
@@ -768,10 +768,18 @@ function Yr(...[
|
|
|
768
768
|
["value", "set"]
|
|
769
769
|
);
|
|
770
770
|
}
|
|
771
|
+
function Vr(h) {
|
|
772
|
+
return h;
|
|
773
|
+
}
|
|
774
|
+
function Lr(h) {
|
|
775
|
+
return h;
|
|
776
|
+
}
|
|
771
777
|
export {
|
|
772
778
|
Z as ProxyContextValueWrapper,
|
|
779
|
+
Lr as createOnChangeProp,
|
|
780
|
+
Vr as createOnChangeReinit,
|
|
773
781
|
$r as createProxyContext,
|
|
774
782
|
Wr as createProxyContextProvider,
|
|
775
|
-
|
|
783
|
+
wr as evaluateDependency,
|
|
776
784
|
Yr as useProxyContext
|
|
777
785
|
};
|