@ptolemy2002/react-proxy-context 2.3.5 → 2.4.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 +44 -18
- package/dist/main.d.ts +20 -9
- package/dist/main.js +381 -352
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -24,22 +24,18 @@ type Dependency<_T, T=Exclude<_T, null | undefined>> = keyof T | (
|
|
|
24
24
|
<K extends keyof T>(prop: K, current: T[K], prev: T[K], obj: T) => boolean
|
|
25
25
|
) | null | undefined | false | [keyof T, ...PropertyKey[]];
|
|
26
26
|
|
|
27
|
-
type ProxyContext<T> = ContextWithName<
|
|
27
|
+
type ProxyContext<T> = ContextWithName<ProxyContextValueWrapper<T> | undefined>;
|
|
28
28
|
|
|
29
|
-
type
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
reinitCallback: OnChangeReinitCallback<T>,
|
|
35
|
-
deps: Dependency<T>[]
|
|
36
|
-
) => string;
|
|
37
|
-
unsubscribe: (id: string) => void;
|
|
29
|
+
type ProxyContextChangeSubscriber<T> = {
|
|
30
|
+
id: string;
|
|
31
|
+
deps: Dependency<T>[] | null;
|
|
32
|
+
propCallback: OnChangePropCallback<T>;
|
|
33
|
+
reinitCallback: OnChangeReinitCallback<T>;
|
|
38
34
|
};
|
|
39
35
|
|
|
40
36
|
type ProxyContextProviderProps<T> = {
|
|
41
37
|
children: ReactNode;
|
|
42
|
-
value: T
|
|
38
|
+
value: T | ProxyContextValueWrapper<T>;
|
|
43
39
|
onChangeProp?: OnChangePropCallback<T>;
|
|
44
40
|
onChangeReinit?: OnChangeReinitCallback<T>;
|
|
45
41
|
proxyRef?: React.MutableRefObject<T>;
|
|
@@ -51,6 +47,36 @@ type UseProxyContextResult<T> = HookResultData<{
|
|
|
51
47
|
}, readonly [T, (newObj: T) => T]>;
|
|
52
48
|
```
|
|
53
49
|
|
|
50
|
+
## Classes
|
|
51
|
+
The following classes are available in the library:
|
|
52
|
+
|
|
53
|
+
### ProxyContextValueWrapper<T>
|
|
54
|
+
#### Description
|
|
55
|
+
A class that wraps a value and provides proxy-based reactivity through subscription management. This class manages the proxy object internally and allows subscribers to listen to both property mutations and full object reassignments. The main benefit of this class is that it allows you to initialize a proxied value outside of a React context and pass it into the provider later, giving you more control over the proxy lifecycle.
|
|
56
|
+
|
|
57
|
+
#### Constructor
|
|
58
|
+
- `value` (`T`): The initial value to wrap in a proxy.
|
|
59
|
+
|
|
60
|
+
#### Methods
|
|
61
|
+
- `get()`: Returns the current proxied value.
|
|
62
|
+
- Returns: `T`
|
|
63
|
+
- `set(newObj: T)`: Sets a new value and wraps it in a proxy. Emits reinit events to all subscribers.
|
|
64
|
+
- Parameters:
|
|
65
|
+
- `newObj` (`T`): The new value to set
|
|
66
|
+
- Returns: `T` - The new proxied value
|
|
67
|
+
- `subscribe(propCallback, reinitCallback, deps)`: Subscribes to changes in the proxied object.
|
|
68
|
+
- Parameters:
|
|
69
|
+
- `propCallback` (`OnChangePropCallback<T>`): Called when a property changes
|
|
70
|
+
- `reinitCallback` (`OnChangeReinitCallback<T>`): Called when the entire object is reassigned
|
|
71
|
+
- `deps` (`Dependency<T>[] | null`): Array of dependencies to listen to, or null to listen to all changes
|
|
72
|
+
- Returns: `string` - A unique subscription ID
|
|
73
|
+
- `unsubscribe(id: string)`: Unsubscribes from changes using the subscription ID.
|
|
74
|
+
- `emitChange(prop, current, prev?)`: Emits a property change event to all relevant subscribers (internal use).
|
|
75
|
+
- `emitReinit(current, prev?)`: Emits a reinitialization event to all subscribers (internal use).
|
|
76
|
+
|
|
77
|
+
#### Properties
|
|
78
|
+
- `changeSubscribers`: A record of all current subscribers (internal use).
|
|
79
|
+
|
|
54
80
|
## Functions
|
|
55
81
|
The following functions are available in the library:
|
|
56
82
|
|
|
@@ -74,7 +100,7 @@ Creates a new instance of the ProxyContext, essentially to be used as the contex
|
|
|
74
100
|
#### Returns
|
|
75
101
|
`ProxyContext<T>` - The context object that can be used in a provider.
|
|
76
102
|
|
|
77
|
-
### createProxyContextProvider<T extends object>
|
|
103
|
+
### createProxyContextProvider<T extends object | null>
|
|
78
104
|
#### Description
|
|
79
105
|
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.
|
|
80
106
|
|
|
@@ -84,8 +110,8 @@ Creates a new proxy context provider component with the specified type. `ProxyCo
|
|
|
84
110
|
#### Returns
|
|
85
111
|
`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).
|
|
86
112
|
|
|
87
|
-
The component has the following
|
|
88
|
-
- `value` (T): The value of the context. This
|
|
113
|
+
The component has the following props:
|
|
114
|
+
- `value` (`T | ProxyContextValueWrapper<T>`): The value of the context. This can be either a raw value of type `T`, which will be automatically wrapped in a `ProxyContextValueWrapper`, or a pre-existing `ProxyContextValueWrapper<T>` instance. This allows you to initialize the wrapper outside of the context and pass it in, giving you more control over the proxy lifecycle.
|
|
89
115
|
- `onChangeProp` (`OnChangePropCallback<T>`): A function that is called whenever a property of the context is changed. The first parameter is the property that was changed, the second parameter is the current value of the property, and the third parameter is the previous value of the property. This is useful for listening to changes in the provider's parent component.
|
|
90
116
|
- `onChangeReinit` (`OnChangeReinitCallback<T>`): A function that is called whenever the context is reinitialized. The first parameter is the current value of the context, and the second parameter is the previous value of the context. This is useful for listening to changes in the provider's parent component.
|
|
91
117
|
- `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.
|
|
@@ -94,17 +120,17 @@ The component has the following other props:
|
|
|
94
120
|
The following hooks are available in the library:
|
|
95
121
|
|
|
96
122
|
### useProxyContext<T>
|
|
97
|
-
A hook that uses the context provided by the `ProxyContextProvider` component. This hook
|
|
123
|
+
A hook that uses the context provided by the `ProxyContextProvider` component. This hook uses React 18's `useSyncExternalStore` for optimal concurrent rendering support and provides options to choose which properties to listen to and whether to listen to full reassignments. `T` represents the type of the object that is stored in the context.
|
|
98
124
|
|
|
99
125
|
#### Parameters
|
|
100
126
|
- `contextClass` (`ProxyContext<T>`): The context class that was created using `createProxyContext`.
|
|
101
127
|
- `deps` (`Dependency<T>[] | null`): An array of dependencies to listen to. If any of these properties on the context change, the hook will re-render. If this is falsy, any mutation will trigger a re-render. If a dependency is an array, it represents a nested property dependency. You can also specify a function that returns a boolean to determine whether to re-render. By default, this is an empty array.
|
|
102
|
-
- `onChangeProp` (`OnChangePropCallback<T> | undefined`): A function that is called whenever a property of the context is changed. The first parameter is the property that was changed, the second parameter is the current value of the property, and the third parameter is the previous value of the property. This is useful for listening to changes in the
|
|
103
|
-
- `onChangeReinit` (`OnChangeReinitCallback<T> | undefined`): A function that is called whenever the context is reinitialized. The first parameter is the current value of the context, and the second parameter is the previous value of the context. This is useful for listening to changes in the
|
|
128
|
+
- `onChangeProp` (`OnChangePropCallback<T> | undefined`): A function that is called whenever a property of the context is changed. The first parameter is the property that was changed, the second parameter is the current value of the property, and the third parameter is the previous value of the property. This is useful for listening to changes in the consumer component.
|
|
129
|
+
- `onChangeReinit` (`OnChangeReinitCallback<T> | undefined`): A function that is called whenever the context is reinitialized. The first parameter is the current value of the context, and the second parameter is the previous value of the context. Also called on initial initialization with the second parameter being `undefined`. This is useful for listening to changes in the consumer component.
|
|
104
130
|
- `listenReinit` (`boolean`): Whether to listen to full reassignments of the context. If this is true, the hook will re-render whenever the context is reinitialized. By default, this is true.
|
|
105
131
|
|
|
106
132
|
#### Returns
|
|
107
|
-
`UseProxyContextResult<T>` - An object containing the current value of the context and a function to set the context. The function returns the new value of the context wrapped in a `Proxy`.
|
|
133
|
+
`UseProxyContextResult<T>` - An object containing the current value of the context and a function to set the context. The `value` property returns the unwrapped proxied object, and the `set` function returns the new value of the context wrapped in a `Proxy`. The hook subscribes to the `ProxyContextValueWrapper` and automatically manages subscription cleanup.
|
|
108
134
|
|
|
109
135
|
## Peer Dependencies
|
|
110
136
|
These should be installed in order to use the library, as npm does not automatically add peer dependencies to your project.
|
package/dist/main.d.ts
CHANGED
|
@@ -5,25 +5,36 @@ export type ContextWithName<T> = Context<T> & {
|
|
|
5
5
|
};
|
|
6
6
|
export type OnChangePropCallback<T> = <K extends keyof T>(prop: K, current: T[K], prev?: T[K]) => void;
|
|
7
7
|
export type OnChangeReinitCallback<T> = (current: T, prev?: T) => void;
|
|
8
|
-
export type ProxyContextValue<T> = {
|
|
9
|
-
obj: T;
|
|
10
|
-
set: (newObj: T) => T;
|
|
11
|
-
subscribe: (propCallback: OnChangePropCallback<T>, reinitCallback: OnChangeReinitCallback<T>, deps: Dependency<T>[] | null) => string;
|
|
12
|
-
unsubscribe: (id: string) => void;
|
|
13
|
-
};
|
|
14
8
|
export declare function createProxyContext<T>(name: string): ProxyContext<T>;
|
|
15
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[]];
|
|
16
10
|
export declare function evaluateDependency<T>(dep: Dependency<T>): Exclude<Dependency<T>, any[]>;
|
|
17
|
-
export type ProxyContext<T> = ContextWithName<
|
|
11
|
+
export type ProxyContext<T> = ContextWithName<ProxyContextValueWrapper<T> | undefined>;
|
|
18
12
|
export type ProxyContextProviderProps<T> = {
|
|
19
13
|
children: ReactNode;
|
|
20
|
-
value: T
|
|
14
|
+
value: T | ProxyContextValueWrapper<T>;
|
|
21
15
|
onChangeProp?: OnChangePropCallback<T>;
|
|
22
16
|
onChangeReinit?: OnChangeReinitCallback<T>;
|
|
23
17
|
proxyRef?: React.MutableRefObject<T>;
|
|
24
18
|
};
|
|
19
|
+
export type ProxyContextChangeSubscriber<T> = {
|
|
20
|
+
id: string;
|
|
21
|
+
deps: Dependency<T>[] | null;
|
|
22
|
+
propCallback: OnChangePropCallback<T>;
|
|
23
|
+
reinitCallback: OnChangeReinitCallback<T>;
|
|
24
|
+
};
|
|
25
|
+
export declare class ProxyContextValueWrapper<T> {
|
|
26
|
+
private value;
|
|
27
|
+
changeSubscribers: Record<string, ProxyContextChangeSubscriber<T>>;
|
|
28
|
+
constructor(value: T);
|
|
29
|
+
subscribe(propCallback: OnChangePropCallback<T>, reinitCallback: OnChangeReinitCallback<T>, deps: Dependency<T>[] | null): string;
|
|
30
|
+
unsubscribe(id: string): void;
|
|
31
|
+
emitChange(prop: keyof T, current: T[keyof T], prev?: T[keyof T]): void;
|
|
32
|
+
emitReinit(current: T, prev?: T): void;
|
|
33
|
+
get(): T;
|
|
34
|
+
set(newObj: T): T;
|
|
35
|
+
}
|
|
25
36
|
export declare function createProxyContextProvider<T extends object | null>(contextClass: ProxyContext<T>): import('react').MemoExoticComponent<import('react').FunctionComponent<ProxyContextProviderProps<T> & {
|
|
26
|
-
renderDeps?:
|
|
37
|
+
renderDeps?: unknown[] | null | false;
|
|
27
38
|
}>>;
|
|
28
39
|
export type UseProxyContextResult<T> = HookResultData<{
|
|
29
40
|
value: T;
|
package/dist/main.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var dr = Object.defineProperty;
|
|
2
|
+
var pr = (h, a, l) => a in h ? dr(h, a, { enumerable: !0, configurable: !0, writable: !0, value: l }) : h[a] = l;
|
|
3
|
+
var X = (h, a, l) => pr(h, typeof a != "symbol" ? a + "" : a, l);
|
|
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
|
+
import { nanoid as _r } from "nanoid";
|
|
6
|
+
import Y from "is-callable";
|
|
4
7
|
import Rr from "@ptolemy2002/react-force-rerender";
|
|
5
|
-
import
|
|
6
|
-
import { partialMemo as
|
|
7
|
-
var
|
|
8
|
+
import Tr from "@ptolemy2002/react-hook-result";
|
|
9
|
+
import { partialMemo as Sr } from "@ptolemy2002/react-utils";
|
|
10
|
+
var Z = { exports: {} }, $ = {};
|
|
8
11
|
/**
|
|
9
12
|
* @license React
|
|
10
13
|
* react-jsx-runtime.production.min.js
|
|
@@ -14,21 +17,21 @@ var ue = { exports: {} }, J = {};
|
|
|
14
17
|
* This source code is licensed under the MIT license found in the
|
|
15
18
|
* LICENSE file in the root directory of this source tree.
|
|
16
19
|
*/
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
function
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
for (
|
|
26
|
-
if (
|
|
27
|
-
return { $$typeof:
|
|
20
|
+
var xe;
|
|
21
|
+
function xr() {
|
|
22
|
+
if (xe) return $;
|
|
23
|
+
xe = 1;
|
|
24
|
+
var h = Oe, a = Symbol.for("react.element"), l = Symbol.for("react.fragment"), p = Object.prototype.hasOwnProperty, c = h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, b = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
25
|
+
function i(v, d, x) {
|
|
26
|
+
var E, T = {}, P = null, k = null;
|
|
27
|
+
x !== void 0 && (P = "" + x), d.key !== void 0 && (P = "" + d.key), d.ref !== void 0 && (k = d.ref);
|
|
28
|
+
for (E in d) p.call(d, E) && !b.hasOwnProperty(E) && (T[E] = d[E]);
|
|
29
|
+
if (v && v.defaultProps) for (E in d = v.defaultProps, d) T[E] === void 0 && (T[E] = d[E]);
|
|
30
|
+
return { $$typeof: a, type: v, key: P, ref: k, props: T, _owner: c.current };
|
|
28
31
|
}
|
|
29
|
-
return
|
|
32
|
+
return $.Fragment = l, $.jsx = i, $.jsxs = i, $;
|
|
30
33
|
}
|
|
31
|
-
var
|
|
34
|
+
var W = {};
|
|
32
35
|
/**
|
|
33
36
|
* @license React
|
|
34
37
|
* react-jsx-runtime.development.js
|
|
@@ -38,91 +41,91 @@ var q = {};
|
|
|
38
41
|
* This source code is licensed under the MIT license found in the
|
|
39
42
|
* LICENSE file in the root directory of this source tree.
|
|
40
43
|
*/
|
|
41
|
-
var
|
|
42
|
-
function
|
|
43
|
-
return
|
|
44
|
-
var
|
|
45
|
-
function
|
|
44
|
+
var Pe;
|
|
45
|
+
function Pr() {
|
|
46
|
+
return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
|
+
var h = Oe, a = Symbol.for("react.element"), l = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), v = Symbol.for("react.context"), d = 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"), Q = Symbol.iterator, ke = "@@iterator";
|
|
48
|
+
function je(e) {
|
|
46
49
|
if (e === null || typeof e != "object")
|
|
47
50
|
return null;
|
|
48
|
-
var r =
|
|
51
|
+
var r = Q && e[Q] || e[ke];
|
|
49
52
|
return typeof r == "function" ? r : null;
|
|
50
53
|
}
|
|
51
|
-
var
|
|
52
|
-
function
|
|
54
|
+
var j = h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
55
|
+
function g(e) {
|
|
53
56
|
{
|
|
54
57
|
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
|
|
55
58
|
t[n - 1] = arguments[n];
|
|
56
|
-
|
|
59
|
+
De("error", e, t);
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
|
-
function
|
|
62
|
+
function De(e, r, t) {
|
|
60
63
|
{
|
|
61
|
-
var n =
|
|
62
|
-
|
|
63
|
-
var f = t.map(function(
|
|
64
|
-
return String(
|
|
64
|
+
var n = j.ReactDebugCurrentFrame, s = n.getStackAddendum();
|
|
65
|
+
s !== "" && (r += "%s", t = t.concat([s]));
|
|
66
|
+
var f = t.map(function(u) {
|
|
67
|
+
return String(u);
|
|
65
68
|
});
|
|
66
69
|
f.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, f);
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
|
-
var
|
|
70
|
-
|
|
72
|
+
var Fe = !1, Ae = !1, Ie = !1, $e = !1, We = !1, ee;
|
|
73
|
+
ee = Symbol.for("react.module.reference");
|
|
71
74
|
function Ye(e) {
|
|
72
|
-
return !!(typeof e == "string" || typeof e == "function" || e ===
|
|
75
|
+
return !!(typeof e == "string" || typeof e == "function" || e === p || e === b || We || e === c || e === x || e === E || $e || e === k || Fe || Ae || Ie || typeof e == "object" && e !== null && (e.$$typeof === P || e.$$typeof === T || e.$$typeof === i || e.$$typeof === v || e.$$typeof === d || // This needs to include all possible module reference object
|
|
73
76
|
// types supported by any Flight configuration anywhere since
|
|
74
77
|
// we don't know which Flight build this will end up being used
|
|
75
78
|
// with.
|
|
76
|
-
e.$$typeof ===
|
|
79
|
+
e.$$typeof === ee || e.getModuleId !== void 0));
|
|
77
80
|
}
|
|
78
|
-
function
|
|
81
|
+
function Ve(e, r, t) {
|
|
79
82
|
var n = e.displayName;
|
|
80
83
|
if (n)
|
|
81
84
|
return n;
|
|
82
|
-
var
|
|
83
|
-
return
|
|
85
|
+
var s = r.displayName || r.name || "";
|
|
86
|
+
return s !== "" ? t + "(" + s + ")" : t;
|
|
84
87
|
}
|
|
85
|
-
function
|
|
88
|
+
function re(e) {
|
|
86
89
|
return e.displayName || "Context";
|
|
87
90
|
}
|
|
88
|
-
function
|
|
91
|
+
function w(e) {
|
|
89
92
|
if (e == null)
|
|
90
93
|
return null;
|
|
91
|
-
if (typeof e.tag == "number" &&
|
|
94
|
+
if (typeof e.tag == "number" && g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
92
95
|
return e.displayName || e.name || null;
|
|
93
96
|
if (typeof e == "string")
|
|
94
97
|
return e;
|
|
95
98
|
switch (e) {
|
|
96
|
-
case
|
|
99
|
+
case p:
|
|
97
100
|
return "Fragment";
|
|
98
|
-
case
|
|
101
|
+
case l:
|
|
99
102
|
return "Portal";
|
|
100
|
-
case
|
|
103
|
+
case b:
|
|
101
104
|
return "Profiler";
|
|
102
|
-
case
|
|
105
|
+
case c:
|
|
103
106
|
return "StrictMode";
|
|
104
|
-
case
|
|
107
|
+
case x:
|
|
105
108
|
return "Suspense";
|
|
106
|
-
case
|
|
109
|
+
case E:
|
|
107
110
|
return "SuspenseList";
|
|
108
111
|
}
|
|
109
112
|
if (typeof e == "object")
|
|
110
113
|
switch (e.$$typeof) {
|
|
111
|
-
case
|
|
114
|
+
case v:
|
|
112
115
|
var r = e;
|
|
113
|
-
return
|
|
114
|
-
case
|
|
116
|
+
return re(r) + ".Consumer";
|
|
117
|
+
case i:
|
|
115
118
|
var t = e;
|
|
116
|
-
return
|
|
117
|
-
case
|
|
118
|
-
return
|
|
119
|
-
case
|
|
119
|
+
return re(t._context) + ".Provider";
|
|
120
|
+
case d:
|
|
121
|
+
return Ve(e, e.render, "ForwardRef");
|
|
122
|
+
case T:
|
|
120
123
|
var n = e.displayName || null;
|
|
121
|
-
return n !== null ? n :
|
|
122
|
-
case
|
|
123
|
-
var
|
|
124
|
+
return n !== null ? n : w(e.type) || "Memo";
|
|
125
|
+
case P: {
|
|
126
|
+
var s = e, f = s._payload, u = s._init;
|
|
124
127
|
try {
|
|
125
|
-
return
|
|
128
|
+
return w(u(f));
|
|
126
129
|
} catch {
|
|
127
130
|
return null;
|
|
128
131
|
}
|
|
@@ -130,18 +133,18 @@ function _r() {
|
|
|
130
133
|
}
|
|
131
134
|
return null;
|
|
132
135
|
}
|
|
133
|
-
var
|
|
134
|
-
function
|
|
136
|
+
var O = Object.assign, A = 0, te, ne, ae, ie, oe, ue, se;
|
|
137
|
+
function ce() {
|
|
135
138
|
}
|
|
136
|
-
|
|
137
|
-
function
|
|
139
|
+
ce.__reactDisabledLog = !0;
|
|
140
|
+
function Le() {
|
|
138
141
|
{
|
|
139
|
-
if (
|
|
140
|
-
|
|
142
|
+
if (A === 0) {
|
|
143
|
+
te = console.log, ne = console.info, ae = console.warn, ie = console.error, oe = console.group, ue = console.groupCollapsed, se = console.groupEnd;
|
|
141
144
|
var e = {
|
|
142
145
|
configurable: !0,
|
|
143
146
|
enumerable: !0,
|
|
144
|
-
value:
|
|
147
|
+
value: ce,
|
|
145
148
|
writable: !0
|
|
146
149
|
};
|
|
147
150
|
Object.defineProperties(console, {
|
|
@@ -154,199 +157,199 @@ function _r() {
|
|
|
154
157
|
groupEnd: e
|
|
155
158
|
});
|
|
156
159
|
}
|
|
157
|
-
|
|
160
|
+
A++;
|
|
158
161
|
}
|
|
159
162
|
}
|
|
160
163
|
function Me() {
|
|
161
164
|
{
|
|
162
|
-
if (
|
|
165
|
+
if (A--, A === 0) {
|
|
163
166
|
var e = {
|
|
164
167
|
configurable: !0,
|
|
165
168
|
enumerable: !0,
|
|
166
169
|
writable: !0
|
|
167
170
|
};
|
|
168
171
|
Object.defineProperties(console, {
|
|
169
|
-
log:
|
|
170
|
-
value:
|
|
172
|
+
log: O({}, e, {
|
|
173
|
+
value: te
|
|
171
174
|
}),
|
|
172
|
-
info:
|
|
173
|
-
value:
|
|
175
|
+
info: O({}, e, {
|
|
176
|
+
value: ne
|
|
174
177
|
}),
|
|
175
|
-
warn:
|
|
176
|
-
value:
|
|
178
|
+
warn: O({}, e, {
|
|
179
|
+
value: ae
|
|
177
180
|
}),
|
|
178
|
-
error:
|
|
179
|
-
value:
|
|
181
|
+
error: O({}, e, {
|
|
182
|
+
value: ie
|
|
180
183
|
}),
|
|
181
|
-
group:
|
|
182
|
-
value:
|
|
184
|
+
group: O({}, e, {
|
|
185
|
+
value: oe
|
|
183
186
|
}),
|
|
184
|
-
groupCollapsed:
|
|
185
|
-
value:
|
|
187
|
+
groupCollapsed: O({}, e, {
|
|
188
|
+
value: ue
|
|
186
189
|
}),
|
|
187
|
-
groupEnd:
|
|
188
|
-
value:
|
|
190
|
+
groupEnd: O({}, e, {
|
|
191
|
+
value: se
|
|
189
192
|
})
|
|
190
193
|
});
|
|
191
194
|
}
|
|
192
|
-
|
|
195
|
+
A < 0 && g("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
193
196
|
}
|
|
194
197
|
}
|
|
195
|
-
var
|
|
196
|
-
function
|
|
198
|
+
var N = j.ReactCurrentDispatcher, B;
|
|
199
|
+
function V(e, r, t) {
|
|
197
200
|
{
|
|
198
|
-
if (
|
|
201
|
+
if (B === void 0)
|
|
199
202
|
try {
|
|
200
203
|
throw Error();
|
|
201
|
-
} catch (
|
|
202
|
-
var n =
|
|
203
|
-
|
|
204
|
+
} catch (s) {
|
|
205
|
+
var n = s.stack.trim().match(/\n( *(at )?)/);
|
|
206
|
+
B = n && n[1] || "";
|
|
204
207
|
}
|
|
205
208
|
return `
|
|
206
|
-
` +
|
|
209
|
+
` + B + e;
|
|
207
210
|
}
|
|
208
211
|
}
|
|
209
|
-
var
|
|
212
|
+
var J = !1, L;
|
|
210
213
|
{
|
|
211
214
|
var Ue = typeof WeakMap == "function" ? WeakMap : Map;
|
|
212
|
-
|
|
215
|
+
L = new Ue();
|
|
213
216
|
}
|
|
214
|
-
function
|
|
215
|
-
if (!e ||
|
|
217
|
+
function le(e, r) {
|
|
218
|
+
if (!e || J)
|
|
216
219
|
return "";
|
|
217
220
|
{
|
|
218
|
-
var t =
|
|
221
|
+
var t = L.get(e);
|
|
219
222
|
if (t !== void 0)
|
|
220
223
|
return t;
|
|
221
224
|
}
|
|
222
225
|
var n;
|
|
223
|
-
|
|
224
|
-
var
|
|
226
|
+
J = !0;
|
|
227
|
+
var s = Error.prepareStackTrace;
|
|
225
228
|
Error.prepareStackTrace = void 0;
|
|
226
229
|
var f;
|
|
227
|
-
f =
|
|
230
|
+
f = N.current, N.current = null, Le();
|
|
228
231
|
try {
|
|
229
232
|
if (r) {
|
|
230
|
-
var
|
|
233
|
+
var u = function() {
|
|
231
234
|
throw Error();
|
|
232
235
|
};
|
|
233
|
-
if (Object.defineProperty(
|
|
236
|
+
if (Object.defineProperty(u.prototype, "props", {
|
|
234
237
|
set: function() {
|
|
235
238
|
throw Error();
|
|
236
239
|
}
|
|
237
240
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
238
241
|
try {
|
|
239
|
-
Reflect.construct(
|
|
240
|
-
} catch (
|
|
241
|
-
n =
|
|
242
|
+
Reflect.construct(u, []);
|
|
243
|
+
} catch (R) {
|
|
244
|
+
n = R;
|
|
242
245
|
}
|
|
243
|
-
Reflect.construct(e, [],
|
|
246
|
+
Reflect.construct(e, [], u);
|
|
244
247
|
} else {
|
|
245
248
|
try {
|
|
246
|
-
|
|
247
|
-
} catch (
|
|
248
|
-
n =
|
|
249
|
+
u.call();
|
|
250
|
+
} catch (R) {
|
|
251
|
+
n = R;
|
|
249
252
|
}
|
|
250
|
-
e.call(
|
|
253
|
+
e.call(u.prototype);
|
|
251
254
|
}
|
|
252
255
|
} else {
|
|
253
256
|
try {
|
|
254
257
|
throw Error();
|
|
255
|
-
} catch (
|
|
256
|
-
n =
|
|
258
|
+
} catch (R) {
|
|
259
|
+
n = R;
|
|
257
260
|
}
|
|
258
261
|
e();
|
|
259
262
|
}
|
|
260
|
-
} catch (
|
|
261
|
-
if (
|
|
262
|
-
for (var
|
|
263
|
+
} catch (R) {
|
|
264
|
+
if (R && n && typeof R.stack == "string") {
|
|
265
|
+
for (var o = R.stack.split(`
|
|
263
266
|
`), _ = n.stack.split(`
|
|
264
|
-
`),
|
|
265
|
-
|
|
266
|
-
for (;
|
|
267
|
-
if (
|
|
268
|
-
if (
|
|
267
|
+
`), y = o.length - 1, m = _.length - 1; y >= 1 && m >= 0 && o[y] !== _[m]; )
|
|
268
|
+
m--;
|
|
269
|
+
for (; y >= 1 && m >= 0; y--, m--)
|
|
270
|
+
if (o[y] !== _[m]) {
|
|
271
|
+
if (y !== 1 || m !== 1)
|
|
269
272
|
do
|
|
270
|
-
if (
|
|
271
|
-
var
|
|
272
|
-
` +
|
|
273
|
-
return e.displayName &&
|
|
273
|
+
if (y--, m--, m < 0 || o[y] !== _[m]) {
|
|
274
|
+
var S = `
|
|
275
|
+
` + o[y].replace(" at new ", " at ");
|
|
276
|
+
return e.displayName && S.includes("<anonymous>") && (S = S.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, S), S;
|
|
274
277
|
}
|
|
275
|
-
while (
|
|
278
|
+
while (y >= 1 && m >= 0);
|
|
276
279
|
break;
|
|
277
280
|
}
|
|
278
281
|
}
|
|
279
282
|
} finally {
|
|
280
|
-
|
|
283
|
+
J = !1, N.current = f, Me(), Error.prepareStackTrace = s;
|
|
281
284
|
}
|
|
282
|
-
var
|
|
283
|
-
return typeof e == "function" &&
|
|
285
|
+
var F = e ? e.displayName || e.name : "", C = F ? V(F) : "";
|
|
286
|
+
return typeof e == "function" && L.set(e, C), C;
|
|
284
287
|
}
|
|
285
288
|
function Ne(e, r, t) {
|
|
286
|
-
return
|
|
289
|
+
return le(e, !1);
|
|
287
290
|
}
|
|
288
291
|
function Be(e) {
|
|
289
292
|
var r = e.prototype;
|
|
290
293
|
return !!(r && r.isReactComponent);
|
|
291
294
|
}
|
|
292
|
-
function
|
|
295
|
+
function M(e, r, t) {
|
|
293
296
|
if (e == null)
|
|
294
297
|
return "";
|
|
295
298
|
if (typeof e == "function")
|
|
296
|
-
return
|
|
299
|
+
return le(e, Be(e));
|
|
297
300
|
if (typeof e == "string")
|
|
298
|
-
return
|
|
301
|
+
return V(e);
|
|
299
302
|
switch (e) {
|
|
300
|
-
case
|
|
301
|
-
return
|
|
302
|
-
case
|
|
303
|
-
return
|
|
303
|
+
case x:
|
|
304
|
+
return V("Suspense");
|
|
305
|
+
case E:
|
|
306
|
+
return V("SuspenseList");
|
|
304
307
|
}
|
|
305
308
|
if (typeof e == "object")
|
|
306
309
|
switch (e.$$typeof) {
|
|
307
|
-
case
|
|
310
|
+
case d:
|
|
308
311
|
return Ne(e.render);
|
|
309
|
-
case
|
|
310
|
-
return
|
|
311
|
-
case
|
|
312
|
-
var n = e,
|
|
312
|
+
case T:
|
|
313
|
+
return M(e.type, r, t);
|
|
314
|
+
case P: {
|
|
315
|
+
var n = e, s = n._payload, f = n._init;
|
|
313
316
|
try {
|
|
314
|
-
return
|
|
317
|
+
return M(f(s), r, t);
|
|
315
318
|
} catch {
|
|
316
319
|
}
|
|
317
320
|
}
|
|
318
321
|
}
|
|
319
322
|
return "";
|
|
320
323
|
}
|
|
321
|
-
var
|
|
322
|
-
function
|
|
324
|
+
var I = Object.prototype.hasOwnProperty, fe = {}, ve = j.ReactDebugCurrentFrame;
|
|
325
|
+
function U(e) {
|
|
323
326
|
if (e) {
|
|
324
|
-
var r = e._owner, t =
|
|
325
|
-
|
|
327
|
+
var r = e._owner, t = M(e.type, e._source, r ? r.type : null);
|
|
328
|
+
ve.setExtraStackFrame(t);
|
|
326
329
|
} else
|
|
327
|
-
|
|
330
|
+
ve.setExtraStackFrame(null);
|
|
328
331
|
}
|
|
329
|
-
function Je(e, r, t, n,
|
|
332
|
+
function Je(e, r, t, n, s) {
|
|
330
333
|
{
|
|
331
|
-
var f = Function.call.bind(
|
|
332
|
-
for (var
|
|
333
|
-
if (f(e,
|
|
334
|
-
var
|
|
334
|
+
var f = Function.call.bind(I);
|
|
335
|
+
for (var u in e)
|
|
336
|
+
if (f(e, u)) {
|
|
337
|
+
var o = void 0;
|
|
335
338
|
try {
|
|
336
|
-
if (typeof e[
|
|
337
|
-
var _ = Error((n || "React class") + ": " + t + " type `" +
|
|
339
|
+
if (typeof e[u] != "function") {
|
|
340
|
+
var _ = Error((n || "React class") + ": " + t + " type `" + u + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[u] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
338
341
|
throw _.name = "Invariant Violation", _;
|
|
339
342
|
}
|
|
340
|
-
|
|
341
|
-
} catch (
|
|
342
|
-
|
|
343
|
+
o = e[u](r, u, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
344
|
+
} catch (y) {
|
|
345
|
+
o = y;
|
|
343
346
|
}
|
|
344
|
-
|
|
347
|
+
o && !(o 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, u, typeof o), U(null)), o instanceof Error && !(o.message in fe) && (fe[o.message] = !0, U(s), g("Failed %s type: %s", t, o.message), U(null));
|
|
345
348
|
}
|
|
346
349
|
}
|
|
347
350
|
}
|
|
348
351
|
var qe = Array.isArray;
|
|
349
|
-
function
|
|
352
|
+
function q(e) {
|
|
350
353
|
return qe(e);
|
|
351
354
|
}
|
|
352
355
|
function Ke(e) {
|
|
@@ -357,27 +360,26 @@ function _r() {
|
|
|
357
360
|
}
|
|
358
361
|
function Ge(e) {
|
|
359
362
|
try {
|
|
360
|
-
return
|
|
363
|
+
return de(e), !1;
|
|
361
364
|
} catch {
|
|
362
365
|
return !0;
|
|
363
366
|
}
|
|
364
367
|
}
|
|
365
|
-
function
|
|
368
|
+
function de(e) {
|
|
366
369
|
return "" + e;
|
|
367
370
|
}
|
|
368
|
-
function
|
|
371
|
+
function pe(e) {
|
|
369
372
|
if (Ge(e))
|
|
370
|
-
return
|
|
373
|
+
return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(e)), de(e);
|
|
371
374
|
}
|
|
372
|
-
var
|
|
375
|
+
var be = j.ReactCurrentOwner, ze = {
|
|
373
376
|
key: !0,
|
|
374
377
|
ref: !0,
|
|
375
378
|
__self: !0,
|
|
376
379
|
__source: !0
|
|
377
|
-
},
|
|
378
|
-
te = {};
|
|
380
|
+
}, he, ye;
|
|
379
381
|
function He(e) {
|
|
380
|
-
if (
|
|
382
|
+
if (I.call(e, "ref")) {
|
|
381
383
|
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
382
384
|
if (r && r.isReactWarning)
|
|
383
385
|
return !1;
|
|
@@ -385,7 +387,7 @@ function _r() {
|
|
|
385
387
|
return e.ref !== void 0;
|
|
386
388
|
}
|
|
387
389
|
function Xe(e) {
|
|
388
|
-
if (
|
|
390
|
+
if (I.call(e, "key")) {
|
|
389
391
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
390
392
|
if (r && r.isReactWarning)
|
|
391
393
|
return !1;
|
|
@@ -393,15 +395,12 @@ function _r() {
|
|
|
393
395
|
return e.key !== void 0;
|
|
394
396
|
}
|
|
395
397
|
function Ze(e, r) {
|
|
396
|
-
|
|
397
|
-
var t = k(B.current.type);
|
|
398
|
-
te[t] || (c('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', k(B.current.type), e.ref), te[t] = !0);
|
|
399
|
-
}
|
|
398
|
+
typeof e.ref == "string" && be.current;
|
|
400
399
|
}
|
|
401
400
|
function Qe(e, r) {
|
|
402
401
|
{
|
|
403
402
|
var t = function() {
|
|
404
|
-
|
|
403
|
+
he || (he = !0, g("%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));
|
|
405
404
|
};
|
|
406
405
|
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
407
406
|
get: t,
|
|
@@ -412,7 +411,7 @@ function _r() {
|
|
|
412
411
|
function er(e, r) {
|
|
413
412
|
{
|
|
414
413
|
var t = function() {
|
|
415
|
-
|
|
414
|
+
ye || (ye = !0, g("%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));
|
|
416
415
|
};
|
|
417
416
|
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
418
417
|
get: t,
|
|
@@ -420,70 +419,70 @@ function _r() {
|
|
|
420
419
|
});
|
|
421
420
|
}
|
|
422
421
|
}
|
|
423
|
-
var rr = function(e, r, t, n,
|
|
424
|
-
var
|
|
422
|
+
var rr = function(e, r, t, n, s, f, u) {
|
|
423
|
+
var o = {
|
|
425
424
|
// This tag allows us to uniquely identify this as a React Element
|
|
426
|
-
$$typeof:
|
|
425
|
+
$$typeof: a,
|
|
427
426
|
// Built-in properties that belong on the element
|
|
428
427
|
type: e,
|
|
429
428
|
key: r,
|
|
430
429
|
ref: t,
|
|
431
|
-
props:
|
|
430
|
+
props: u,
|
|
432
431
|
// Record the component responsible for creating this element.
|
|
433
432
|
_owner: f
|
|
434
433
|
};
|
|
435
|
-
return
|
|
434
|
+
return o._store = {}, Object.defineProperty(o._store, "validated", {
|
|
436
435
|
configurable: !1,
|
|
437
436
|
enumerable: !1,
|
|
438
437
|
writable: !0,
|
|
439
438
|
value: !1
|
|
440
|
-
}), Object.defineProperty(
|
|
439
|
+
}), Object.defineProperty(o, "_self", {
|
|
441
440
|
configurable: !1,
|
|
442
441
|
enumerable: !1,
|
|
443
442
|
writable: !1,
|
|
444
443
|
value: n
|
|
445
|
-
}), Object.defineProperty(
|
|
444
|
+
}), Object.defineProperty(o, "_source", {
|
|
446
445
|
configurable: !1,
|
|
447
446
|
enumerable: !1,
|
|
448
447
|
writable: !1,
|
|
449
|
-
value:
|
|
450
|
-
}), Object.freeze && (Object.freeze(
|
|
448
|
+
value: s
|
|
449
|
+
}), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
|
|
451
450
|
};
|
|
452
|
-
function tr(e, r, t, n,
|
|
451
|
+
function tr(e, r, t, n, s) {
|
|
453
452
|
{
|
|
454
|
-
var f,
|
|
455
|
-
t !== void 0 && (
|
|
453
|
+
var f, u = {}, o = null, _ = null;
|
|
454
|
+
t !== void 0 && (pe(t), o = "" + t), Xe(r) && (pe(r.key), o = "" + r.key), He(r) && (_ = r.ref, Ze(r, s));
|
|
456
455
|
for (f in r)
|
|
457
|
-
|
|
456
|
+
I.call(r, f) && !ze.hasOwnProperty(f) && (u[f] = r[f]);
|
|
458
457
|
if (e && e.defaultProps) {
|
|
459
|
-
var
|
|
460
|
-
for (f in
|
|
461
|
-
|
|
458
|
+
var y = e.defaultProps;
|
|
459
|
+
for (f in y)
|
|
460
|
+
u[f] === void 0 && (u[f] = y[f]);
|
|
462
461
|
}
|
|
463
|
-
if (
|
|
464
|
-
var
|
|
465
|
-
|
|
462
|
+
if (o || _) {
|
|
463
|
+
var m = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
464
|
+
o && Qe(u, m), _ && er(u, m);
|
|
466
465
|
}
|
|
467
|
-
return rr(e,
|
|
466
|
+
return rr(e, o, _, s, n, be.current, u);
|
|
468
467
|
}
|
|
469
468
|
}
|
|
470
|
-
var
|
|
471
|
-
function
|
|
469
|
+
var K = j.ReactCurrentOwner, me = j.ReactDebugCurrentFrame;
|
|
470
|
+
function D(e) {
|
|
472
471
|
if (e) {
|
|
473
|
-
var r = e._owner, t =
|
|
474
|
-
|
|
472
|
+
var r = e._owner, t = M(e.type, e._source, r ? r.type : null);
|
|
473
|
+
me.setExtraStackFrame(t);
|
|
475
474
|
} else
|
|
476
|
-
|
|
475
|
+
me.setExtraStackFrame(null);
|
|
477
476
|
}
|
|
478
|
-
var
|
|
479
|
-
|
|
480
|
-
function
|
|
481
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
477
|
+
var G;
|
|
478
|
+
G = !1;
|
|
479
|
+
function z(e) {
|
|
480
|
+
return typeof e == "object" && e !== null && e.$$typeof === a;
|
|
482
481
|
}
|
|
483
|
-
function
|
|
482
|
+
function Ee() {
|
|
484
483
|
{
|
|
485
|
-
if (
|
|
486
|
-
var e =
|
|
484
|
+
if (K.current) {
|
|
485
|
+
var e = w(K.current.type);
|
|
487
486
|
if (e)
|
|
488
487
|
return `
|
|
489
488
|
|
|
@@ -495,10 +494,10 @@ Check the render method of \`` + e + "`.";
|
|
|
495
494
|
function nr(e) {
|
|
496
495
|
return "";
|
|
497
496
|
}
|
|
498
|
-
var
|
|
497
|
+
var ge = {};
|
|
499
498
|
function ar(e) {
|
|
500
499
|
{
|
|
501
|
-
var r =
|
|
500
|
+
var r = Ee();
|
|
502
501
|
if (!r) {
|
|
503
502
|
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
504
503
|
t && (r = `
|
|
@@ -508,39 +507,39 @@ Check the top-level render call using <` + t + ">.");
|
|
|
508
507
|
return r;
|
|
509
508
|
}
|
|
510
509
|
}
|
|
511
|
-
function
|
|
510
|
+
function _e(e, r) {
|
|
512
511
|
{
|
|
513
512
|
if (!e._store || e._store.validated || e.key != null)
|
|
514
513
|
return;
|
|
515
514
|
e._store.validated = !0;
|
|
516
515
|
var t = ar(r);
|
|
517
|
-
if (
|
|
516
|
+
if (ge[t])
|
|
518
517
|
return;
|
|
519
|
-
|
|
518
|
+
ge[t] = !0;
|
|
520
519
|
var n = "";
|
|
521
|
-
e && e._owner && e._owner !==
|
|
520
|
+
e && e._owner && e._owner !== K.current && (n = " It was passed a child from " + w(e._owner.type) + "."), D(e), g('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);
|
|
522
521
|
}
|
|
523
522
|
}
|
|
524
|
-
function
|
|
523
|
+
function Re(e, r) {
|
|
525
524
|
{
|
|
526
525
|
if (typeof e != "object")
|
|
527
526
|
return;
|
|
528
|
-
if (
|
|
527
|
+
if (q(e))
|
|
529
528
|
for (var t = 0; t < e.length; t++) {
|
|
530
529
|
var n = e[t];
|
|
531
|
-
|
|
530
|
+
z(n) && _e(n, r);
|
|
532
531
|
}
|
|
533
|
-
else if (
|
|
532
|
+
else if (z(e))
|
|
534
533
|
e._store && (e._store.validated = !0);
|
|
535
534
|
else if (e) {
|
|
536
|
-
var
|
|
537
|
-
if (typeof
|
|
538
|
-
for (var f =
|
|
539
|
-
|
|
535
|
+
var s = je(e);
|
|
536
|
+
if (typeof s == "function" && s !== e.entries)
|
|
537
|
+
for (var f = s.call(e), u; !(u = f.next()).done; )
|
|
538
|
+
z(u.value) && _e(u.value, r);
|
|
540
539
|
}
|
|
541
540
|
}
|
|
542
541
|
}
|
|
543
|
-
function
|
|
542
|
+
function ir(e) {
|
|
544
543
|
{
|
|
545
544
|
var r = e.type;
|
|
546
545
|
if (r == null || typeof r == "string")
|
|
@@ -548,195 +547,225 @@ Check the top-level render call using <` + t + ">.");
|
|
|
548
547
|
var t;
|
|
549
548
|
if (typeof r == "function")
|
|
550
549
|
t = r.propTypes;
|
|
551
|
-
else if (typeof r == "object" && (r.$$typeof ===
|
|
550
|
+
else if (typeof r == "object" && (r.$$typeof === d || // Note: Memo only checks outer props here.
|
|
552
551
|
// Inner props are checked in the reconciler.
|
|
553
|
-
r.$$typeof ===
|
|
552
|
+
r.$$typeof === T))
|
|
554
553
|
t = r.propTypes;
|
|
555
554
|
else
|
|
556
555
|
return;
|
|
557
556
|
if (t) {
|
|
558
|
-
var n =
|
|
557
|
+
var n = w(r);
|
|
559
558
|
Je(t, e.props, "prop", n, e);
|
|
560
|
-
} else if (r.PropTypes !== void 0 && !
|
|
561
|
-
|
|
562
|
-
var
|
|
563
|
-
|
|
559
|
+
} else if (r.PropTypes !== void 0 && !G) {
|
|
560
|
+
G = !0;
|
|
561
|
+
var s = w(r);
|
|
562
|
+
g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown");
|
|
564
563
|
}
|
|
565
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved &&
|
|
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.");
|
|
566
565
|
}
|
|
567
566
|
}
|
|
568
|
-
function
|
|
567
|
+
function or(e) {
|
|
569
568
|
{
|
|
570
569
|
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
571
570
|
var n = r[t];
|
|
572
571
|
if (n !== "children" && n !== "key") {
|
|
573
|
-
|
|
572
|
+
D(e), g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), D(null);
|
|
574
573
|
break;
|
|
575
574
|
}
|
|
576
575
|
}
|
|
577
|
-
e.ref !== null && (
|
|
576
|
+
e.ref !== null && (D(e), g("Invalid attribute `ref` supplied to `React.Fragment`."), D(null));
|
|
578
577
|
}
|
|
579
578
|
}
|
|
580
|
-
var
|
|
581
|
-
function
|
|
579
|
+
var Te = {};
|
|
580
|
+
function Se(e, r, t, n, s, f) {
|
|
582
581
|
{
|
|
583
|
-
var
|
|
584
|
-
if (!
|
|
585
|
-
var
|
|
586
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
582
|
+
var u = Ye(e);
|
|
583
|
+
if (!u) {
|
|
584
|
+
var o = "";
|
|
585
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (o += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
587
586
|
var _ = nr();
|
|
588
|
-
_ ?
|
|
589
|
-
var
|
|
590
|
-
e === null ?
|
|
587
|
+
_ ? o += _ : o += Ee();
|
|
588
|
+
var y;
|
|
589
|
+
e === null ? y = "null" : q(e) ? y = "array" : e !== void 0 && e.$$typeof === a ? (y = "<" + (w(e.type) || "Unknown") + " />", o = " 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, o);
|
|
591
590
|
}
|
|
592
|
-
var
|
|
593
|
-
if (
|
|
594
|
-
return
|
|
595
|
-
if (
|
|
596
|
-
var
|
|
597
|
-
if (
|
|
591
|
+
var m = tr(e, r, t, s, f);
|
|
592
|
+
if (m == null)
|
|
593
|
+
return m;
|
|
594
|
+
if (u) {
|
|
595
|
+
var S = r.children;
|
|
596
|
+
if (S !== void 0)
|
|
598
597
|
if (n)
|
|
599
|
-
if (
|
|
600
|
-
for (var
|
|
601
|
-
|
|
602
|
-
Object.freeze && Object.freeze(
|
|
598
|
+
if (q(S)) {
|
|
599
|
+
for (var F = 0; F < S.length; F++)
|
|
600
|
+
Re(S[F], e);
|
|
601
|
+
Object.freeze && Object.freeze(S);
|
|
603
602
|
} else
|
|
604
|
-
|
|
603
|
+
g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
605
604
|
else
|
|
606
|
-
|
|
605
|
+
Re(S, e);
|
|
607
606
|
}
|
|
608
|
-
if (
|
|
609
|
-
var
|
|
610
|
-
return
|
|
611
|
-
}),
|
|
612
|
-
if (!
|
|
613
|
-
var
|
|
614
|
-
|
|
607
|
+
if (I.call(r, "key")) {
|
|
608
|
+
var C = w(e), R = Object.keys(r).filter(function(vr) {
|
|
609
|
+
return vr !== "key";
|
|
610
|
+
}), H = R.length > 0 ? "{key: someKey, " + R.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
611
|
+
if (!Te[C + H]) {
|
|
612
|
+
var fr = R.length > 0 ? "{" + R.join(": ..., ") + ": ...}" : "{}";
|
|
613
|
+
g(`A props object containing a "key" prop is being spread into JSX:
|
|
615
614
|
let props = %s;
|
|
616
615
|
<%s {...props} />
|
|
617
616
|
React keys must be passed directly to JSX without using spread:
|
|
618
617
|
let props = %s;
|
|
619
|
-
<%s key={someKey} {...props} />`,
|
|
618
|
+
<%s key={someKey} {...props} />`, H, C, fr, C), Te[C + H] = !0;
|
|
620
619
|
}
|
|
621
620
|
}
|
|
622
|
-
return e ===
|
|
621
|
+
return e === p ? or(m) : ir(m), m;
|
|
623
622
|
}
|
|
624
623
|
}
|
|
625
624
|
function ur(e, r, t) {
|
|
626
|
-
return
|
|
625
|
+
return Se(e, r, t, !0);
|
|
627
626
|
}
|
|
628
627
|
function sr(e, r, t) {
|
|
629
|
-
return
|
|
628
|
+
return Se(e, r, t, !1);
|
|
630
629
|
}
|
|
631
|
-
var cr = sr,
|
|
632
|
-
|
|
633
|
-
}()),
|
|
630
|
+
var cr = sr, lr = ur;
|
|
631
|
+
W.Fragment = p, W.jsx = cr, W.jsxs = lr;
|
|
632
|
+
}()), W;
|
|
634
633
|
}
|
|
635
|
-
process.env.NODE_ENV === "production" ?
|
|
636
|
-
var
|
|
637
|
-
function
|
|
634
|
+
process.env.NODE_ENV === "production" ? Z.exports = xr() : Z.exports = Pr();
|
|
635
|
+
var wr = Z.exports;
|
|
636
|
+
function $r(h) {
|
|
638
637
|
if (typeof Proxy > "u") throw new Error("Proxy is not supported in this environment.");
|
|
639
|
-
const
|
|
638
|
+
const a = br(
|
|
640
639
|
void 0
|
|
641
640
|
);
|
|
642
|
-
return
|
|
641
|
+
return a.name = h, a;
|
|
643
642
|
}
|
|
644
|
-
function
|
|
645
|
-
if (Array.isArray(
|
|
646
|
-
const [
|
|
647
|
-
return (
|
|
648
|
-
if (
|
|
649
|
-
let
|
|
650
|
-
for (const
|
|
651
|
-
|
|
652
|
-
return
|
|
643
|
+
function Or(h) {
|
|
644
|
+
if (Array.isArray(h)) {
|
|
645
|
+
const [a, ...l] = h;
|
|
646
|
+
return (p, c, b) => {
|
|
647
|
+
if (p !== a) return !1;
|
|
648
|
+
let i = c, v = b;
|
|
649
|
+
for (const d of l)
|
|
650
|
+
i = i == null ? void 0 : i[d], v = v == null ? void 0 : v[d];
|
|
651
|
+
return i !== v;
|
|
653
652
|
};
|
|
654
653
|
}
|
|
655
|
-
return
|
|
654
|
+
return h;
|
|
655
|
+
}
|
|
656
|
+
class we {
|
|
657
|
+
constructor(a) {
|
|
658
|
+
X(this, "value");
|
|
659
|
+
X(this, "changeSubscribers", {});
|
|
660
|
+
this.set(a);
|
|
661
|
+
}
|
|
662
|
+
subscribe(a, l, p) {
|
|
663
|
+
const c = _r();
|
|
664
|
+
return this.changeSubscribers[c] = {
|
|
665
|
+
id: c,
|
|
666
|
+
deps: p,
|
|
667
|
+
propCallback: a,
|
|
668
|
+
reinitCallback: l
|
|
669
|
+
}, c;
|
|
670
|
+
}
|
|
671
|
+
unsubscribe(a) {
|
|
672
|
+
delete this.changeSubscribers[a];
|
|
673
|
+
}
|
|
674
|
+
emitChange(a, l, p) {
|
|
675
|
+
Object.values(this.changeSubscribers).forEach((c) => {
|
|
676
|
+
var i;
|
|
677
|
+
const b = (i = c.deps) == null ? void 0 : i.map(Or);
|
|
678
|
+
(!b || b.includes(a) && p !== l || b.some(
|
|
679
|
+
(v) => Y(v) && v(a, l, p, this.value)
|
|
680
|
+
)) && c.propCallback(a, l, p);
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
emitReinit(a, l) {
|
|
684
|
+
Object.values(this.changeSubscribers).forEach((p) => {
|
|
685
|
+
p.reinitCallback(a, l);
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
get() {
|
|
689
|
+
return this.value;
|
|
690
|
+
}
|
|
691
|
+
set(a) {
|
|
692
|
+
const l = this;
|
|
693
|
+
if (a !== this.value) {
|
|
694
|
+
const p = this.value;
|
|
695
|
+
a != null ? this.value = new Proxy(a, {
|
|
696
|
+
get: function(c, b) {
|
|
697
|
+
const i = Reflect.get(c, b, a);
|
|
698
|
+
return Y(i) ? i.bind(l.value) : i;
|
|
699
|
+
},
|
|
700
|
+
set: (c, b, i) => {
|
|
701
|
+
const v = b, d = c[v];
|
|
702
|
+
return Reflect.set(c, v, i, a), i = c[v], this.emitChange(v, i, d), !0;
|
|
703
|
+
}
|
|
704
|
+
}) : this.value = a, this.emitReinit(this.value, p);
|
|
705
|
+
}
|
|
706
|
+
return this.value;
|
|
707
|
+
}
|
|
656
708
|
}
|
|
657
|
-
function
|
|
658
|
-
return
|
|
709
|
+
function Wr(h) {
|
|
710
|
+
return Sr(
|
|
659
711
|
({
|
|
660
|
-
children:
|
|
661
|
-
value:
|
|
662
|
-
onChangeProp:
|
|
663
|
-
onChangeReinit:
|
|
664
|
-
proxyRef:
|
|
712
|
+
children: a,
|
|
713
|
+
value: l,
|
|
714
|
+
onChangeProp: p,
|
|
715
|
+
onChangeReinit: c,
|
|
716
|
+
proxyRef: b
|
|
665
717
|
}) => {
|
|
666
|
-
const
|
|
667
|
-
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
(!w || w.includes(p) && d !== P || w.some(
|
|
683
|
-
($) => V($) && $(p, P, d, i.current)
|
|
684
|
-
)) && c.propCallback(p, P, d);
|
|
685
|
-
}), V(y) && y(p, P, d);
|
|
686
|
-
}, [y]), A = L((p, P) => {
|
|
687
|
-
Object.values(l.current).forEach((d) => {
|
|
688
|
-
d.reinitCallback(p, P);
|
|
689
|
-
}), V(T) && T(p, P);
|
|
690
|
-
}, [T]), M = L((p) => {
|
|
691
|
-
if (p !== i.current) {
|
|
692
|
-
const P = i.current;
|
|
693
|
-
p !== null ? i.current = new Proxy(p, {
|
|
694
|
-
get: function(d, c) {
|
|
695
|
-
const w = Reflect.get(d, c, p);
|
|
696
|
-
return V(w) ? w.bind(i.current) : w;
|
|
697
|
-
},
|
|
698
|
-
set: function(d, c, w) {
|
|
699
|
-
const D = c, $ = d[D];
|
|
700
|
-
return Reflect.set(d, D, w, p), w = d[D], x(D, w, $), !0;
|
|
701
|
-
}
|
|
702
|
-
}) : i.current = p, A(i.current, P), j();
|
|
703
|
-
}
|
|
704
|
-
return s.current.obj = i.current, i.current;
|
|
705
|
-
}, [y, T, x]);
|
|
706
|
-
return i.current === void 0 && (i.current = M(C)), s.current.obj = i.current, s.current.set = M, s.current.subscribe = m, s.current.unsubscribe = h, /* @__PURE__ */ Tr.jsx(E.Provider, { value: s.current, children: g });
|
|
718
|
+
const i = Ce(void 0);
|
|
719
|
+
i.current === void 0 && (i.current = l instanceof we ? l : new we(l), c == null || c(i.current.get(), void 0));
|
|
720
|
+
const v = Rr();
|
|
721
|
+
return hr(b, () => i.current.get(), [i.current.get()]), yr(() => {
|
|
722
|
+
const d = i.current.subscribe(
|
|
723
|
+
p ?? (() => {
|
|
724
|
+
}),
|
|
725
|
+
(...x) => {
|
|
726
|
+
Y(c) && c(...x), v();
|
|
727
|
+
},
|
|
728
|
+
null
|
|
729
|
+
);
|
|
730
|
+
return () => {
|
|
731
|
+
i.current.unsubscribe(d);
|
|
732
|
+
};
|
|
733
|
+
}, [p, c, v]), /* @__PURE__ */ wr.jsx(h.Provider, { value: i.current, children: a });
|
|
707
734
|
},
|
|
708
735
|
["children", "onChangeProp", "onChangeReinit", "proxyRef"],
|
|
709
|
-
|
|
736
|
+
h.name + ".Provider"
|
|
710
737
|
);
|
|
711
738
|
}
|
|
712
|
-
function
|
|
713
|
-
const
|
|
714
|
-
if (
|
|
715
|
-
throw new Error(`No ${
|
|
716
|
-
const
|
|
717
|
-
const
|
|
718
|
-
(
|
|
719
|
-
|
|
739
|
+
function Yr(h, a = [], l, p, c = !0) {
|
|
740
|
+
const b = mr(h);
|
|
741
|
+
if (b === void 0)
|
|
742
|
+
throw new Error(`No ${h.name} provider found.`);
|
|
743
|
+
const i = Ce({ value: b }), v = Er((x) => {
|
|
744
|
+
const E = b.subscribe(
|
|
745
|
+
(T, P, k) => {
|
|
746
|
+
i.current = { value: b }, x(), Y(l) && l(T, P, k);
|
|
720
747
|
},
|
|
721
|
-
(
|
|
722
|
-
|
|
748
|
+
(T, P) => {
|
|
749
|
+
c && (i.current = { value: b }, x()), Y(p) && p(T, P);
|
|
723
750
|
},
|
|
724
|
-
|
|
751
|
+
a
|
|
725
752
|
);
|
|
726
|
-
return () =>
|
|
727
|
-
}, [
|
|
728
|
-
|
|
729
|
-
() =>
|
|
730
|
-
() =>
|
|
753
|
+
return () => b.unsubscribe(E);
|
|
754
|
+
}, [a, c, l, p, b]), d = gr(
|
|
755
|
+
v,
|
|
756
|
+
() => i.current,
|
|
757
|
+
() => i.current
|
|
731
758
|
);
|
|
732
|
-
return new
|
|
733
|
-
|
|
759
|
+
return new Tr(
|
|
760
|
+
// The binding is necessary to fix a strange issue I'm having.
|
|
761
|
+
{ value: d.value.get(), set: d.value.set.bind(d.value) },
|
|
734
762
|
["value", "set"]
|
|
735
763
|
);
|
|
736
764
|
}
|
|
737
765
|
export {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
766
|
+
we as ProxyContextValueWrapper,
|
|
767
|
+
$r as createProxyContext,
|
|
768
|
+
Wr as createProxyContextProvider,
|
|
769
|
+
Or as evaluateDependency,
|
|
770
|
+
Yr as useProxyContext
|
|
742
771
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ptolemy2002/react-proxy-context",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"@types/babel__traverse": "^7.20.6",
|
|
47
47
|
"@types/eslint__js": "~8.42.3",
|
|
48
48
|
"@types/is-callable": "~1.1.2",
|
|
49
|
+
"@types/jsdom": "~21.1.7",
|
|
49
50
|
"@types/less": "~3.0.6",
|
|
50
51
|
"@types/node": "^22.7.4",
|
|
51
52
|
"@types/prop-types": "^15.7.13",
|