react-state-custom 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +104 -104
- package/dist/index.umd.js +4 -4
- package/package.json +1 -1
- package/src/state-utils/createRootCtx.tsx +12 -10
package/dist/index.es.js
CHANGED
|
@@ -20,7 +20,7 @@ function $e() {
|
|
|
20
20
|
function u(s) {
|
|
21
21
|
console && console.warn && console.warn(s);
|
|
22
22
|
}
|
|
23
|
-
var
|
|
23
|
+
var c = Number.isNaN || function(o) {
|
|
24
24
|
return o !== o;
|
|
25
25
|
};
|
|
26
26
|
function a() {
|
|
@@ -38,14 +38,14 @@ function $e() {
|
|
|
38
38
|
return d;
|
|
39
39
|
},
|
|
40
40
|
set: function(s) {
|
|
41
|
-
if (typeof s != "number" || s < 0 ||
|
|
41
|
+
if (typeof s != "number" || s < 0 || c(s))
|
|
42
42
|
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + s + ".");
|
|
43
43
|
d = s;
|
|
44
44
|
}
|
|
45
45
|
}), a.init = function() {
|
|
46
46
|
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
47
47
|
}, a.prototype.setMaxListeners = function(o) {
|
|
48
|
-
if (typeof o != "number" || o < 0 ||
|
|
48
|
+
if (typeof o != "number" || o < 0 || c(o))
|
|
49
49
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + o + ".");
|
|
50
50
|
return this._maxListeners = o, this;
|
|
51
51
|
};
|
|
@@ -56,12 +56,12 @@ function $e() {
|
|
|
56
56
|
return m(this);
|
|
57
57
|
}, a.prototype.emit = function(o) {
|
|
58
58
|
for (var n = [], f = 1; f < arguments.length; f++) n.push(arguments[f]);
|
|
59
|
-
var
|
|
59
|
+
var l = o === "error", b = this._events;
|
|
60
60
|
if (b !== void 0)
|
|
61
|
-
|
|
62
|
-
else if (!
|
|
61
|
+
l = l && b.error === void 0;
|
|
62
|
+
else if (!l)
|
|
63
63
|
return !1;
|
|
64
|
-
if (
|
|
64
|
+
if (l) {
|
|
65
65
|
var v;
|
|
66
66
|
if (n.length > 0 && (v = n[0]), v instanceof Error)
|
|
67
67
|
throw v;
|
|
@@ -79,14 +79,14 @@ function $e() {
|
|
|
79
79
|
return !0;
|
|
80
80
|
};
|
|
81
81
|
function _(s, o, n, f) {
|
|
82
|
-
var
|
|
82
|
+
var l, b, v;
|
|
83
83
|
if (h(n), b = s._events, b === void 0 ? (b = s._events = /* @__PURE__ */ Object.create(null), s._eventsCount = 0) : (b.newListener !== void 0 && (s.emit(
|
|
84
84
|
"newListener",
|
|
85
85
|
o,
|
|
86
86
|
n.listener ? n.listener : n
|
|
87
87
|
), b = s._events), v = b[o]), v === void 0)
|
|
88
88
|
v = b[o] = n, ++s._eventsCount;
|
|
89
|
-
else if (typeof v == "function" ? v = b[o] = f ? [n, v] : [v, n] : f ? v.unshift(n) : v.push(n),
|
|
89
|
+
else if (typeof v == "function" ? v = b[o] = f ? [n, v] : [v, n] : f ? v.unshift(n) : v.push(n), l = m(s), l > 0 && v.length > l && !v.warned) {
|
|
90
90
|
v.warned = !0;
|
|
91
91
|
var S = new Error("Possible EventEmitter memory leak detected. " + v.length + " " + String(o) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
92
92
|
S.name = "MaxListenersExceededWarning", S.emitter = s, S.type = o, S.count = v.length, u(S);
|
|
@@ -103,21 +103,21 @@ function $e() {
|
|
|
103
103
|
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
104
104
|
}
|
|
105
105
|
function T(s, o, n) {
|
|
106
|
-
var f = { fired: !1, wrapFn: void 0, target: s, type: o, listener: n },
|
|
107
|
-
return
|
|
106
|
+
var f = { fired: !1, wrapFn: void 0, target: s, type: o, listener: n }, l = y.bind(f);
|
|
107
|
+
return l.listener = n, f.wrapFn = l, l;
|
|
108
108
|
}
|
|
109
109
|
a.prototype.once = function(o, n) {
|
|
110
110
|
return h(n), this.on(o, T(this, o, n)), this;
|
|
111
111
|
}, a.prototype.prependOnceListener = function(o, n) {
|
|
112
112
|
return h(n), this.prependListener(o, T(this, o, n)), this;
|
|
113
113
|
}, a.prototype.removeListener = function(o, n) {
|
|
114
|
-
var f,
|
|
115
|
-
if (h(n),
|
|
114
|
+
var f, l, b, v, S;
|
|
115
|
+
if (h(n), l = this._events, l === void 0)
|
|
116
116
|
return this;
|
|
117
|
-
if (f =
|
|
117
|
+
if (f = l[o], f === void 0)
|
|
118
118
|
return this;
|
|
119
119
|
if (f === n || f.listener === n)
|
|
120
|
-
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete
|
|
120
|
+
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete l[o], l.removeListener && this.emit("removeListener", o, f.listener || n));
|
|
121
121
|
else if (typeof f != "function") {
|
|
122
122
|
for (b = -1, v = f.length - 1; v >= 0; v--)
|
|
123
123
|
if (f[v] === n || f[v].listener === n) {
|
|
@@ -126,34 +126,34 @@ function $e() {
|
|
|
126
126
|
}
|
|
127
127
|
if (b < 0)
|
|
128
128
|
return this;
|
|
129
|
-
b === 0 ? f.shift() : g(f, b), f.length === 1 && (
|
|
129
|
+
b === 0 ? f.shift() : g(f, b), f.length === 1 && (l[o] = f[0]), l.removeListener !== void 0 && this.emit("removeListener", o, S || n);
|
|
130
130
|
}
|
|
131
131
|
return this;
|
|
132
132
|
}, a.prototype.off = a.prototype.removeListener, a.prototype.removeAllListeners = function(o) {
|
|
133
|
-
var n, f,
|
|
133
|
+
var n, f, l;
|
|
134
134
|
if (f = this._events, f === void 0)
|
|
135
135
|
return this;
|
|
136
136
|
if (f.removeListener === void 0)
|
|
137
137
|
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : f[o] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete f[o]), this;
|
|
138
138
|
if (arguments.length === 0) {
|
|
139
139
|
var b = Object.keys(f), v;
|
|
140
|
-
for (
|
|
141
|
-
v = b[
|
|
140
|
+
for (l = 0; l < b.length; ++l)
|
|
141
|
+
v = b[l], v !== "removeListener" && this.removeAllListeners(v);
|
|
142
142
|
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
|
|
143
143
|
}
|
|
144
144
|
if (n = f[o], typeof n == "function")
|
|
145
145
|
this.removeListener(o, n);
|
|
146
146
|
else if (n !== void 0)
|
|
147
|
-
for (
|
|
148
|
-
this.removeListener(o, n[
|
|
147
|
+
for (l = n.length - 1; l >= 0; l--)
|
|
148
|
+
this.removeListener(o, n[l]);
|
|
149
149
|
return this;
|
|
150
150
|
};
|
|
151
151
|
function j(s, o, n) {
|
|
152
152
|
var f = s._events;
|
|
153
153
|
if (f === void 0)
|
|
154
154
|
return [];
|
|
155
|
-
var
|
|
156
|
-
return
|
|
155
|
+
var l = f[o];
|
|
156
|
+
return l === void 0 ? [] : typeof l == "function" ? n ? [l.listener || l] : [l] : n ? w(l) : $(l, l.length);
|
|
157
157
|
}
|
|
158
158
|
a.prototype.listeners = function(o) {
|
|
159
159
|
return j(this, o, !0);
|
|
@@ -193,13 +193,13 @@ function $e() {
|
|
|
193
193
|
}
|
|
194
194
|
function N(s, o) {
|
|
195
195
|
return new Promise(function(n, f) {
|
|
196
|
-
function
|
|
196
|
+
function l(v) {
|
|
197
197
|
s.removeListener(o, b), f(v);
|
|
198
198
|
}
|
|
199
199
|
function b() {
|
|
200
|
-
typeof s.removeListener == "function" && s.removeListener("error",
|
|
200
|
+
typeof s.removeListener == "function" && s.removeListener("error", l), n([].slice.call(arguments));
|
|
201
201
|
}
|
|
202
|
-
D(s, o, b, { once: !0 }), o !== "error" && F(s,
|
|
202
|
+
D(s, o, b, { once: !0 }), o !== "error" && F(s, l, { once: !0 });
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
function F(s, o, n) {
|
|
@@ -209,8 +209,8 @@ function $e() {
|
|
|
209
209
|
if (typeof s.on == "function")
|
|
210
210
|
f.once ? s.once(o, n) : s.on(o, n);
|
|
211
211
|
else if (typeof s.addEventListener == "function")
|
|
212
|
-
s.addEventListener(o, function
|
|
213
|
-
f.once && s.removeEventListener(o,
|
|
212
|
+
s.addEventListener(o, function l(b) {
|
|
213
|
+
f.once && s.removeEventListener(o, l), n(b);
|
|
214
214
|
});
|
|
215
215
|
else
|
|
216
216
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof s);
|
|
@@ -227,8 +227,8 @@ function ze(e) {
|
|
|
227
227
|
var u = !0;
|
|
228
228
|
} catch {
|
|
229
229
|
}
|
|
230
|
-
var
|
|
231
|
-
return u && (t ? e[G] = r : delete e[G]),
|
|
230
|
+
var c = xe.call(e);
|
|
231
|
+
return u && (t ? e[G] = r : delete e[G]), c;
|
|
232
232
|
}
|
|
233
233
|
var Ye = Object.prototype, Ge = Ye.toString;
|
|
234
234
|
function Ue(e) {
|
|
@@ -289,11 +289,11 @@ var se = ee["__core-js_shared__"], ge = function() {
|
|
|
289
289
|
function ft(e) {
|
|
290
290
|
return !!ge && ge in e;
|
|
291
291
|
}
|
|
292
|
-
var
|
|
292
|
+
var ct = Function.prototype, lt = ct.toString;
|
|
293
293
|
function dt(e) {
|
|
294
294
|
if (e != null) {
|
|
295
295
|
try {
|
|
296
|
-
return
|
|
296
|
+
return lt.call(e);
|
|
297
297
|
} catch {
|
|
298
298
|
}
|
|
299
299
|
try {
|
|
@@ -448,11 +448,11 @@ function fe(e, t) {
|
|
|
448
448
|
if (typeof e != "function" || t != null && typeof t != "function")
|
|
449
449
|
throw new TypeError(Jt);
|
|
450
450
|
var r = function() {
|
|
451
|
-
var u = arguments,
|
|
452
|
-
if (a.has(
|
|
453
|
-
return a.get(
|
|
451
|
+
var u = arguments, c = t ? t.apply(this, u) : u[0], a = r.cache;
|
|
452
|
+
if (a.has(c))
|
|
453
|
+
return a.get(c);
|
|
454
454
|
var d = e.apply(this, u);
|
|
455
|
-
return r.cache = a.set(
|
|
455
|
+
return r.cache = a.set(c, d) || a, d;
|
|
456
456
|
};
|
|
457
457
|
return r.cache = new (fe.Cache || k)(), r;
|
|
458
458
|
}
|
|
@@ -461,24 +461,24 @@ var ue = function() {
|
|
|
461
461
|
return ee.Date.now();
|
|
462
462
|
}, Xt = "Expected a function", Kt = Math.max, Bt = Math.min;
|
|
463
463
|
function ne(e, t, r) {
|
|
464
|
-
var u,
|
|
464
|
+
var u, c, a, d, h, m, _ = 0, y = !1, T = !1, j = !0;
|
|
465
465
|
if (typeof e != "function")
|
|
466
466
|
throw new TypeError(Xt);
|
|
467
467
|
t = _e(t) || 0, x(r) && (y = !!r.leading, T = "maxWait" in r, a = T ? Kt(_e(r.maxWait) || 0, t) : a, j = "trailing" in r ? !!r.trailing : j);
|
|
468
468
|
function C(n) {
|
|
469
|
-
var f = u,
|
|
470
|
-
return u =
|
|
469
|
+
var f = u, l = c;
|
|
470
|
+
return u = c = void 0, _ = n, d = e.apply(l, f), d;
|
|
471
471
|
}
|
|
472
472
|
function $(n) {
|
|
473
473
|
return _ = n, h = setTimeout(N, t), y ? C(n) : d;
|
|
474
474
|
}
|
|
475
475
|
function g(n) {
|
|
476
|
-
var f = n - m,
|
|
477
|
-
return T ? Bt(b, a -
|
|
476
|
+
var f = n - m, l = n - _, b = t - f;
|
|
477
|
+
return T ? Bt(b, a - l) : b;
|
|
478
478
|
}
|
|
479
479
|
function w(n) {
|
|
480
|
-
var f = n - m,
|
|
481
|
-
return m === void 0 || f >= t || f < 0 || T &&
|
|
480
|
+
var f = n - m, l = n - _;
|
|
481
|
+
return m === void 0 || f >= t || f < 0 || T && l >= a;
|
|
482
482
|
}
|
|
483
483
|
function N() {
|
|
484
484
|
var n = ue();
|
|
@@ -487,17 +487,17 @@ function ne(e, t, r) {
|
|
|
487
487
|
h = setTimeout(N, g(n));
|
|
488
488
|
}
|
|
489
489
|
function F(n) {
|
|
490
|
-
return h = void 0, j && u ? C(n) : (u =
|
|
490
|
+
return h = void 0, j && u ? C(n) : (u = c = void 0, d);
|
|
491
491
|
}
|
|
492
492
|
function D() {
|
|
493
|
-
h !== void 0 && clearTimeout(h), _ = 0, u = m =
|
|
493
|
+
h !== void 0 && clearTimeout(h), _ = 0, u = m = c = h = void 0;
|
|
494
494
|
}
|
|
495
495
|
function s() {
|
|
496
496
|
return h === void 0 ? d : F(ue());
|
|
497
497
|
}
|
|
498
498
|
function o() {
|
|
499
499
|
var n = ue(), f = w(n);
|
|
500
|
-
if (u = arguments,
|
|
500
|
+
if (u = arguments, c = this, m = n, f) {
|
|
501
501
|
if (h === void 0)
|
|
502
502
|
return $(m);
|
|
503
503
|
if (T)
|
|
@@ -509,13 +509,13 @@ function ne(e, t, r) {
|
|
|
509
509
|
}
|
|
510
510
|
var Qt = "Expected a function";
|
|
511
511
|
function Zt(e, t, r) {
|
|
512
|
-
var u = !0,
|
|
512
|
+
var u = !0, c = !0;
|
|
513
513
|
if (typeof e != "function")
|
|
514
514
|
throw new TypeError(Qt);
|
|
515
|
-
return x(r) && (u = "leading" in r ? !!r.leading : u,
|
|
515
|
+
return x(r) && (u = "leading" in r ? !!r.leading : u, c = "trailing" in r ? !!r.trailing : c), ne(e, t, {
|
|
516
516
|
leading: u,
|
|
517
517
|
maxWait: t,
|
|
518
|
-
trailing:
|
|
518
|
+
trailing: c
|
|
519
519
|
});
|
|
520
520
|
}
|
|
521
521
|
class er {
|
|
@@ -550,8 +550,8 @@ class er {
|
|
|
550
550
|
* @returns Unsubscribe function.
|
|
551
551
|
*/
|
|
552
552
|
subscribe(t, r) {
|
|
553
|
-
const u = ({ value:
|
|
554
|
-
r(
|
|
553
|
+
const u = ({ value: c }) => {
|
|
554
|
+
r(c);
|
|
555
555
|
};
|
|
556
556
|
return this.event.addListener(String(t), u), console.log("listenerCount:", String(t), this.event.listenerCount(String(t))), t in this.data && r(this.data[t]), () => (this.event.removeListener(String(t), u), void 0);
|
|
557
557
|
}
|
|
@@ -572,67 +572,67 @@ const tr = fe((e) => new er(e)), Ee = (e = "noname") => H(() => tr(e), [e]), Ce
|
|
|
572
572
|
e && e.data[t] != r && e.publish(t, r);
|
|
573
573
|
}, [t, r, e]), Ce(e, t);
|
|
574
574
|
}, fr = (e, t, r = 0) => {
|
|
575
|
-
const [{ value: u },
|
|
575
|
+
const [{ value: u }, c] = J(() => {
|
|
576
576
|
var a;
|
|
577
577
|
return { value: (a = e == null ? void 0 : e.data) == null ? void 0 : a[t] };
|
|
578
578
|
});
|
|
579
579
|
return P(() => {
|
|
580
580
|
if (e) {
|
|
581
|
-
let a = r == 0 ? (h) =>
|
|
582
|
-
return u != e.data[t] &&
|
|
581
|
+
let a = r == 0 ? (h) => c({ value: h }) : ne((h) => c({ value: h }), r), d = e.subscribe(t, a);
|
|
582
|
+
return u != e.data[t] && c({ value: e.data[t] }), () => {
|
|
583
583
|
d();
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
586
|
}, [t, e]), e == null ? void 0 : e.data[t];
|
|
587
|
-
},
|
|
588
|
-
const [, u] = J(0),
|
|
587
|
+
}, cr = (e, t, r) => {
|
|
588
|
+
const [, u] = J(0), c = H(
|
|
589
589
|
() => r(e == null ? void 0 : e.data[t]),
|
|
590
590
|
[r, e == null ? void 0 : e.data[t]]
|
|
591
591
|
);
|
|
592
592
|
return P(() => {
|
|
593
593
|
if (e) {
|
|
594
|
-
let a =
|
|
594
|
+
let a = c, d = () => {
|
|
595
595
|
let m = r(e.data[t]);
|
|
596
596
|
m != a && (a = m, u((_) => _ + 1));
|
|
597
597
|
}, h = e.subscribe(t, d);
|
|
598
598
|
return d(), () => h();
|
|
599
599
|
}
|
|
600
|
-
}, [t, e]),
|
|
600
|
+
}, [t, e]), c;
|
|
601
601
|
}, rr = (e, ...t) => {
|
|
602
602
|
P(() => {
|
|
603
603
|
if (e)
|
|
604
604
|
for (let [r, u] of t)
|
|
605
605
|
e.data[r] != u && e.publish(r, u);
|
|
606
606
|
}, [e, ...t.flat()]), Ce(e, ...t.map((r) => r[0]));
|
|
607
|
-
},
|
|
608
|
-
const [, r] = J(0), u = t.map((
|
|
607
|
+
}, lr = (e, ...t) => {
|
|
608
|
+
const [, r] = J(0), u = t.map((c) => {
|
|
609
609
|
var a;
|
|
610
|
-
return (a = e == null ? void 0 : e.data) == null ? void 0 : a[
|
|
610
|
+
return (a = e == null ? void 0 : e.data) == null ? void 0 : a[c];
|
|
611
611
|
});
|
|
612
612
|
return P(() => {
|
|
613
613
|
if (e) {
|
|
614
|
-
let
|
|
614
|
+
let c = u;
|
|
615
615
|
const a = ne(() => {
|
|
616
616
|
let m = t.map((_) => {
|
|
617
617
|
var y;
|
|
618
618
|
return (y = e == null ? void 0 : e.data) == null ? void 0 : y[_];
|
|
619
619
|
});
|
|
620
|
-
t.some((_, y) =>
|
|
620
|
+
t.some((_, y) => c[y] != m[y]) && (c = m, r((_) => _ + 1));
|
|
621
621
|
}, 1);
|
|
622
622
|
let d = t.map((m) => e.subscribe(m, a)), h = setTimeout(a, 1);
|
|
623
623
|
return () => {
|
|
624
624
|
clearTimeout(h), a.cancel(), d.forEach((m) => m());
|
|
625
625
|
};
|
|
626
626
|
}
|
|
627
|
-
}, [e, ...t]), Object.fromEntries(t.map((
|
|
627
|
+
}, [e, ...t]), Object.fromEntries(t.map((c, a) => [c, u[a]]));
|
|
628
628
|
}, dr = (e, t = 100, ...r) => {
|
|
629
|
-
const [, u] = J(0),
|
|
629
|
+
const [, u] = J(0), c = r.map((a) => {
|
|
630
630
|
var d;
|
|
631
631
|
return (d = e == null ? void 0 : e.data) == null ? void 0 : d[a];
|
|
632
632
|
});
|
|
633
633
|
return P(() => {
|
|
634
634
|
if (e) {
|
|
635
|
-
let a =
|
|
635
|
+
let a = c;
|
|
636
636
|
const d = Zt(() => {
|
|
637
637
|
let _ = r.map((y) => {
|
|
638
638
|
var T;
|
|
@@ -645,7 +645,7 @@ const tr = fe((e) => new er(e)), Ee = (e = "noname") => H(() => tr(e), [e]), Ce
|
|
|
645
645
|
clearTimeout(m), d.cancel(), h.forEach((_) => _());
|
|
646
646
|
};
|
|
647
647
|
}
|
|
648
|
-
}, [e, ...r]),
|
|
648
|
+
}, [e, ...r]), c;
|
|
649
649
|
};
|
|
650
650
|
var Q = { exports: {} }, U = {};
|
|
651
651
|
/**
|
|
@@ -662,18 +662,18 @@ function nr() {
|
|
|
662
662
|
if (ye) return U;
|
|
663
663
|
ye = 1;
|
|
664
664
|
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
665
|
-
function r(u,
|
|
665
|
+
function r(u, c, a) {
|
|
666
666
|
var d = null;
|
|
667
|
-
if (a !== void 0 && (d = "" + a),
|
|
667
|
+
if (a !== void 0 && (d = "" + a), c.key !== void 0 && (d = "" + c.key), "key" in c) {
|
|
668
668
|
a = {};
|
|
669
|
-
for (var h in
|
|
670
|
-
h !== "key" && (a[h] =
|
|
671
|
-
} else a =
|
|
672
|
-
return
|
|
669
|
+
for (var h in c)
|
|
670
|
+
h !== "key" && (a[h] = c[h]);
|
|
671
|
+
} else a = c;
|
|
672
|
+
return c = a.ref, {
|
|
673
673
|
$$typeof: e,
|
|
674
674
|
type: u,
|
|
675
675
|
key: d,
|
|
676
|
-
ref:
|
|
676
|
+
ref: c !== void 0 ? c : null,
|
|
677
677
|
props: a
|
|
678
678
|
};
|
|
679
679
|
}
|
|
@@ -726,7 +726,7 @@ function or() {
|
|
|
726
726
|
return i = i.displayName, i || (i = p.displayName || p.name || "", i = i !== "" ? "ForwardRef(" + i + ")" : "ForwardRef"), i;
|
|
727
727
|
case f:
|
|
728
728
|
return p = i.displayName || null, p !== null ? p : e(i.type) || "Memo";
|
|
729
|
-
case
|
|
729
|
+
case l:
|
|
730
730
|
p = i._payload, i = i._init;
|
|
731
731
|
try {
|
|
732
732
|
return e(i(p));
|
|
@@ -757,7 +757,7 @@ function or() {
|
|
|
757
757
|
}
|
|
758
758
|
function u(i) {
|
|
759
759
|
if (i === g) return "<>";
|
|
760
|
-
if (typeof i == "object" && i !== null && i.$$typeof ===
|
|
760
|
+
if (typeof i == "object" && i !== null && i.$$typeof === l)
|
|
761
761
|
return "<...>";
|
|
762
762
|
try {
|
|
763
763
|
var p = e(i);
|
|
@@ -766,7 +766,7 @@ function or() {
|
|
|
766
766
|
return "<...>";
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
|
-
function
|
|
769
|
+
function c() {
|
|
770
770
|
var i = S.A;
|
|
771
771
|
return i === null ? null : i.getOwner();
|
|
772
772
|
}
|
|
@@ -782,7 +782,7 @@ function or() {
|
|
|
782
782
|
}
|
|
783
783
|
function h(i, p) {
|
|
784
784
|
function E() {
|
|
785
|
-
|
|
785
|
+
ce || (ce = !0, console.error(
|
|
786
786
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
787
787
|
p
|
|
788
788
|
));
|
|
@@ -794,7 +794,7 @@ function or() {
|
|
|
794
794
|
}
|
|
795
795
|
function m() {
|
|
796
796
|
var i = e(this.type);
|
|
797
|
-
return
|
|
797
|
+
return le[i] || (le[i] = !0, console.error(
|
|
798
798
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
799
799
|
)), i = this.props.ref, i !== void 0 ? i : null;
|
|
800
800
|
}
|
|
@@ -874,7 +874,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
874
874
|
R,
|
|
875
875
|
L,
|
|
876
876
|
I,
|
|
877
|
-
|
|
877
|
+
c(),
|
|
878
878
|
E,
|
|
879
879
|
oe,
|
|
880
880
|
ie
|
|
@@ -883,7 +883,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
883
883
|
function T(i) {
|
|
884
884
|
typeof i == "object" && i !== null && i.$$typeof === C && i._store && (i._store.validated = 1);
|
|
885
885
|
}
|
|
886
|
-
var j = Ae, C = Symbol.for("react.transitional.element"), $ = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), w = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), F = Symbol.for("react.consumer"), D = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), o = Symbol.for("react.suspense"), n = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"),
|
|
886
|
+
var j = Ae, C = Symbol.for("react.transitional.element"), $ = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), w = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), F = Symbol.for("react.consumer"), D = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), o = Symbol.for("react.suspense"), n = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), l = Symbol.for("react.lazy"), b = Symbol.for("react.activity"), v = Symbol.for("react.client.reference"), S = j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, X = Array.isArray, Y = console.createTask ? console.createTask : function() {
|
|
887
887
|
return null;
|
|
888
888
|
};
|
|
889
889
|
j = {
|
|
@@ -891,7 +891,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
891
891
|
return i();
|
|
892
892
|
}
|
|
893
893
|
};
|
|
894
|
-
var
|
|
894
|
+
var ce, le = {}, de = j["react-stack-bottom-frame"].bind(
|
|
895
895
|
j,
|
|
896
896
|
a
|
|
897
897
|
)(), he = Y(u(a)), pe = {};
|
|
@@ -928,39 +928,39 @@ function ir() {
|
|
|
928
928
|
}
|
|
929
929
|
var Oe = ir();
|
|
930
930
|
const hr = (e, t) => {
|
|
931
|
-
const r = (
|
|
931
|
+
const r = (c) => [
|
|
932
932
|
e,
|
|
933
|
-
...Object.entries(
|
|
933
|
+
...Object.entries(c ?? {}).sort((a, d) => a[0].localeCompare(d[0])).flat()
|
|
934
934
|
].join("-");
|
|
935
|
-
let u =
|
|
935
|
+
let u = /* @__PURE__ */ new Set();
|
|
936
936
|
return {
|
|
937
|
-
Root: (
|
|
938
|
-
const a =
|
|
937
|
+
Root: (c) => {
|
|
938
|
+
const a = r(c), d = Ee(a), h = t(c), m = H(() => new Error().stack, []);
|
|
939
939
|
return rr(
|
|
940
|
-
|
|
941
|
-
...Object.entries(
|
|
940
|
+
d,
|
|
941
|
+
...Object.entries(h)
|
|
942
942
|
), P(() => {
|
|
943
|
-
if (u
|
|
944
|
-
const
|
|
945
|
-
throw
|
|
943
|
+
if (u.has(a)) {
|
|
944
|
+
const _ = new Error("RootContext " + a + " are mounted more than once");
|
|
945
|
+
throw _.stack = m, _;
|
|
946
946
|
}
|
|
947
|
-
return u
|
|
948
|
-
u
|
|
947
|
+
return u.add(a), () => {
|
|
948
|
+
u.delete(a);
|
|
949
949
|
};
|
|
950
950
|
}), /* @__PURE__ */ Oe.jsx(Oe.Fragment, {});
|
|
951
951
|
},
|
|
952
|
-
useCtxState: (
|
|
953
|
-
const a = H(() => new Error().stack, []);
|
|
952
|
+
useCtxState: (c) => {
|
|
953
|
+
const a = r(c), d = H(() => new Error().stack, []);
|
|
954
954
|
return P(() => {
|
|
955
|
-
if (!u) {
|
|
956
|
-
const
|
|
957
|
-
throw
|
|
955
|
+
if (!u.has(a)) {
|
|
956
|
+
const h = new Error("RootContext [" + a + "] is not mounted");
|
|
957
|
+
throw h.stack = d, h;
|
|
958
958
|
}
|
|
959
|
-
}, [
|
|
959
|
+
}, [a]), Ee(a);
|
|
960
960
|
}
|
|
961
961
|
};
|
|
962
962
|
}, pr = (e) => {
|
|
963
|
-
const [, t] = J(0), { proxy: r, finalGetter: u, openGetter:
|
|
963
|
+
const [, t] = J(0), { proxy: r, finalGetter: u, openGetter: c, clean: a } = H(
|
|
964
964
|
() => {
|
|
965
965
|
const d = /* @__PURE__ */ new Set(), h = {}, m = /* @__PURE__ */ new Map(), _ = new Proxy(
|
|
966
966
|
e == null ? void 0 : e.data,
|
|
@@ -993,7 +993,7 @@ const hr = (e, t) => {
|
|
|
993
993
|
},
|
|
994
994
|
[]
|
|
995
995
|
);
|
|
996
|
-
return
|
|
996
|
+
return c(), setTimeout(u, 0), P(
|
|
997
997
|
() => () => a(),
|
|
998
998
|
[a]
|
|
999
999
|
), r;
|
|
@@ -1006,8 +1006,8 @@ export {
|
|
|
1006
1006
|
ur as useDataSource,
|
|
1007
1007
|
rr as useDataSourceMultiple,
|
|
1008
1008
|
fr as useDataSubscribe,
|
|
1009
|
-
|
|
1009
|
+
lr as useDataSubscribeMultiple,
|
|
1010
1010
|
dr as useDataSubscribeMultipleWithDebounce,
|
|
1011
|
-
|
|
1011
|
+
cr as useDataSubscribeWithTransform,
|
|
1012
1012
|
pr as useQuickSubscribe
|
|
1013
1013
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(y,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(y=typeof globalThis<"u"?globalThis:y||self,m(y.RState={},y.React))})(this,function(y,m){"use strict";var fr=Object.defineProperty;var cr=(y,m,W)=>m in y?fr(y,m,{enumerable:!0,configurable:!0,writable:!0,value:W}):y[m]=W;var ne=(y,m,W)=>cr(y,typeof m!="symbol"?m+"":m,W);function W(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var B={exports:{}},le;function Ae(){if(le)return B.exports;le=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(o,n,f){return Function.prototype.apply.call(o,n,f)},r;e&&typeof e.ownKeys=="function"?r=e.ownKeys:Object.getOwnPropertySymbols?r=function(o){return Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o))}:r=function(o){return Object.getOwnPropertyNames(o)};function u(s){console&&console.warn&&console.warn(s)}var c=Number.isNaN||function(o){return o!==o};function i(){i.init.call(this)}B.exports=i,B.exports.once=A,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var d=10;function h(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return d},set:function(s){if(typeof s!="number"||s<0||c(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");d=s}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(o){if(typeof o!="number"||o<0||c(o))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+o+".");return this._maxListeners=o,this};function b(s){return s._maxListeners===void 0?i.defaultMaxListeners:s._maxListeners}i.prototype.getMaxListeners=function(){return b(this)},i.prototype.emit=function(o){for(var n=[],f=1;f<arguments.length;f++)n.push(arguments[f]);var l=o==="error",g=this._events;if(g!==void 0)l=l&&g.error===void 0;else if(!l)return!1;if(l){var v;if(n.length>0&&(v=n[0]),v instanceof Error)throw v;var j=new Error("Unhandled error."+(v?" ("+v.message+")":""));throw j.context=v,j}var M=g[o];if(M===void 0)return!1;if(typeof M=="function")t(M,this,n);else for(var re=M.length,K=F(M,re),f=0;f<re;++f)t(K[f],this,n);return!0};function _(s,o,n,f){var l,g,v;if(h(n),g=s._events,g===void 0?(g=s._events=Object.create(null),s._eventsCount=0):(g.newListener!==void 0&&(s.emit("newListener",o,n.listener?n.listener:n),g=s._events),v=g[o]),v===void 0)v=g[o]=n,++s._eventsCount;else if(typeof v=="function"?v=g[o]=f?[n,v]:[v,n]:f?v.unshift(n):v.push(n),l=b(s),l>0&&v.length>l&&!v.warned){v.warned=!0;var j=new Error("Possible EventEmitter memory leak detected. "+v.length+" "+String(o)+" listeners added. Use emitter.setMaxListeners() to increase limit");j.name="MaxListenersExceededWarning",j.emitter=s,j.type=o,j.count=v.length,u(j)}return s}i.prototype.addListener=function(o,n){return _(this,o,n,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(o,n){return _(this,o,n,!0)};function O(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function w(s,o,n){var f={fired:!1,wrapFn:void 0,target:s,type:o,listener:n},l=O.bind(f);return l.listener=n,f.wrapFn=l,l}i.prototype.once=function(o,n){return h(n),this.on(o,w(this,o,n)),this},i.prototype.prependOnceListener=function(o,n){return h(n),this.prependListener(o,w(this,o,n)),this},i.prototype.removeListener=function(o,n){var f,l,g,v,j;if(h(n),l=this._events,l===void 0)return this;if(f=l[o],f===void 0)return this;if(f===n||f.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete l[o],l.removeListener&&this.emit("removeListener",o,f.listener||n));else if(typeof f!="function"){for(g=-1,v=f.length-1;v>=0;v--)if(f[v]===n||f[v].listener===n){j=f[v].listener,g=v;break}if(g<0)return this;g===0?f.shift():E(f,g),f.length===1&&(l[o]=f[0]),l.removeListener!==void 0&&this.emit("removeListener",o,j||n)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(o){var n,f,l;if(f=this._events,f===void 0)return this;if(f.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):f[o]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete f[o]),this;if(arguments.length===0){var g=Object.keys(f),v;for(l=0;l<g.length;++l)v=g[l],v!=="removeListener"&&this.removeAllListeners(v);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=f[o],typeof n=="function")this.removeListener(o,n);else if(n!==void 0)for(l=n.length-1;l>=0;l--)this.removeListener(o,n[l]);return this};function L(s,o,n){var f=s._events;if(f===void 0)return[];var l=f[o];return l===void 0?[]:typeof l=="function"?n?[l.listener||l]:[l]:n?S(l):F(l,l.length)}i.prototype.listeners=function(o){return L(this,o,!0)},i.prototype.rawListeners=function(o){return L(this,o,!1)},i.listenerCount=function(s,o){return typeof s.listenerCount=="function"?s.listenerCount(o):P.call(s,o)},i.prototype.listenerCount=P;function P(s){var o=this._events;if(o!==void 0){var n=o[s];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function F(s,o){for(var n=new Array(o),f=0;f<o;++f)n[f]=s[f];return n}function E(s,o){for(;o+1<s.length;o++)s[o]=s[o+1];s.pop()}function S(s){for(var o=new Array(s.length),n=0;n<o.length;++n)o[n]=s[n].listener||s[n];return o}function A(s,o){return new Promise(function(n,f){function l(v){s.removeListener(o,g),f(v)}function g(){typeof s.removeListener=="function"&&s.removeListener("error",l),n([].slice.call(arguments))}U(s,o,g,{once:!0}),o!=="error"&&G(s,l,{once:!0})})}function G(s,o,n){typeof s.on=="function"&&U(s,"error",o,n)}function U(s,o,n,f){if(typeof s.on=="function")f.once?s.once(o,n):s.on(o,n);else if(typeof s.addEventListener=="function")s.addEventListener(o,function l(g){f.once&&s.removeEventListener(o,l),n(g)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}return B.exports}var Me=Ae();const De=W(Me);var Ie=typeof global=="object"&&global&&global.Object===Object&&global,ke=typeof self=="object"&&self&&self.Object===Object&&self,Q=Ie||ke||Function("return this")(),Z=Q.Symbol,de=Object.prototype,Fe=de.hasOwnProperty,We=de.toString,x=Z?Z.toStringTag:void 0;function ze(e){var t=Fe.call(e,x),r=e[x];try{e[x]=void 0;var u=!0}catch{}var c=We.call(e);return u&&(t?e[x]=r:delete e[x]),c}var Ye=Object.prototype,Ge=Ye.toString;function Ue(e){return Ge.call(e)}var Ve="[object Null]",xe="[object Undefined]",he=Z?Z.toStringTag:void 0;function pe(e){return e==null?e===void 0?xe:Ve:he&&he in Object(e)?ze(e):Ue(e)}function He(e){return e!=null&&typeof e=="object"}var Je="[object Symbol]";function Xe(e){return typeof e=="symbol"||He(e)&&pe(e)==Je}var Ke=/\s/;function Be(e){for(var t=e.length;t--&&Ke.test(e.charAt(t)););return t}var Qe=/^\s+/;function Ze(e){return e&&e.slice(0,Be(e)+1).replace(Qe,"")}function z(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ve=NaN,$e=/^[-+]0x[0-9a-f]+$/i,qe=/^0b[01]+$/i,et=/^0o[0-7]+$/i,tt=parseInt;function me(e){if(typeof e=="number")return e;if(Xe(e))return ve;if(z(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=z(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ze(e);var r=qe.test(e);return r||et.test(e)?tt(e.slice(2),r?2:8):$e.test(e)?ve:+e}var rt="[object AsyncFunction]",nt="[object Function]",ot="[object GeneratorFunction]",at="[object Proxy]";function it(e){if(!z(e))return!1;var t=pe(e);return t==nt||t==ot||t==rt||t==at}var oe=Q["__core-js_shared__"],be=function(){var e=/[^.]+$/.exec(oe&&oe.keys&&oe.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function st(e){return!!be&&be in e}var ut=Function.prototype,ft=ut.toString;function ct(e){if(e!=null){try{return ft.call(e)}catch{}try{return e+""}catch{}}return""}var lt=/[\\^$.*+?()[\]{}|]/g,dt=/^\[object .+?Constructor\]$/,ht=Function.prototype,pt=Object.prototype,vt=ht.toString,mt=pt.hasOwnProperty,bt=RegExp("^"+vt.call(mt).replace(lt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gt(e){if(!z(e)||st(e))return!1;var t=it(e)?bt:dt;return t.test(ct(e))}function _t(e,t){return e==null?void 0:e[t]}function ge(e,t){var r=_t(e,t);return gt(r)?r:void 0}function Et(e,t){return e===t||e!==e&&t!==t}var H=ge(Object,"create");function yt(){this.__data__=H?H(null):{},this.size=0}function Tt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ot="__lodash_hash_undefined__",wt=Object.prototype,St=wt.hasOwnProperty;function Rt(e){var t=this.__data__;if(H){var r=t[e];return r===Ot?void 0:r}return St.call(t,e)?t[e]:void 0}var Ct=Object.prototype,jt=Ct.hasOwnProperty;function Lt(e){var t=this.__data__;return H?t[e]!==void 0:jt.call(t,e)}var Pt="__lodash_hash_undefined__";function Nt(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=H&&t===void 0?Pt:t,this}function I(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var u=e[t];this.set(u[0],u[1])}}I.prototype.clear=yt,I.prototype.delete=Tt,I.prototype.get=Rt,I.prototype.has=Lt,I.prototype.set=Nt;function At(){this.__data__=[],this.size=0}function $(e,t){for(var r=e.length;r--;)if(Et(e[r][0],t))return r;return-1}var Mt=Array.prototype,Dt=Mt.splice;function It(e){var t=this.__data__,r=$(t,e);if(r<0)return!1;var u=t.length-1;return r==u?t.pop():Dt.call(t,r,1),--this.size,!0}function kt(e){var t=this.__data__,r=$(t,e);return r<0?void 0:t[r][1]}function Ft(e){return $(this.__data__,e)>-1}function Wt(e,t){var r=this.__data__,u=$(r,e);return u<0?(++this.size,r.push([e,t])):r[u][1]=t,this}function Y(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var u=e[t];this.set(u[0],u[1])}}Y.prototype.clear=At,Y.prototype.delete=It,Y.prototype.get=kt,Y.prototype.has=Ft,Y.prototype.set=Wt;var zt=ge(Q,"Map");function Yt(){this.size=0,this.__data__={hash:new I,map:new(zt||Y),string:new I}}function Gt(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function q(e,t){var r=e.__data__;return Gt(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Ut(e){var t=q(this,e).delete(e);return this.size-=t?1:0,t}function Vt(e){return q(this,e).get(e)}function xt(e){return q(this,e).has(e)}function Ht(e,t){var r=q(this,e),u=r.size;return r.set(e,t),this.size+=r.size==u?0:1,this}function k(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var u=e[t];this.set(u[0],u[1])}}k.prototype.clear=Yt,k.prototype.delete=Ut,k.prototype.get=Vt,k.prototype.has=xt,k.prototype.set=Ht;var Jt="Expected a function";function ae(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Jt);var r=function(){var u=arguments,c=t?t.apply(this,u):u[0],i=r.cache;if(i.has(c))return i.get(c);var d=e.apply(this,u);return r.cache=i.set(c,d)||i,d};return r.cache=new(ae.Cache||k),r}ae.Cache=k;var ie=function(){return Q.Date.now()},Xt="Expected a function",Kt=Math.max,Bt=Math.min;function ee(e,t,r){var u,c,i,d,h,b,_=0,O=!1,w=!1,L=!0;if(typeof e!="function")throw new TypeError(Xt);t=me(t)||0,z(r)&&(O=!!r.leading,w="maxWait"in r,i=w?Kt(me(r.maxWait)||0,t):i,L="trailing"in r?!!r.trailing:L);function P(n){var f=u,l=c;return u=c=void 0,_=n,d=e.apply(l,f),d}function F(n){return _=n,h=setTimeout(A,t),O?P(n):d}function E(n){var f=n-b,l=n-_,g=t-f;return w?Bt(g,i-l):g}function S(n){var f=n-b,l=n-_;return b===void 0||f>=t||f<0||w&&l>=i}function A(){var n=ie();if(S(n))return G(n);h=setTimeout(A,E(n))}function G(n){return h=void 0,L&&u?P(n):(u=c=void 0,d)}function U(){h!==void 0&&clearTimeout(h),_=0,u=b=c=h=void 0}function s(){return h===void 0?d:G(ie())}function o(){var n=ie(),f=S(n);if(u=arguments,c=this,b=n,f){if(h===void 0)return F(b);if(w)return clearTimeout(h),h=setTimeout(A,t),P(b)}return h===void 0&&(h=setTimeout(A,t)),d}return o.cancel=U,o.flush=s,o}var Qt="Expected a function";function Zt(e,t,r){var u=!0,c=!0;if(typeof e!="function")throw new TypeError(Qt);return z(r)&&(u="leading"in r?!!r.leading:u,c="trailing"in r?!!r.trailing:c),ee(e,t,{leading:u,maxWait:t,trailing:c})}class _e{constructor(t){ne(this,"event",new De.EventEmitter);ne(this,"data",{});ne(this,"registry",new Set);this.name=t,console.log("[CONTEXT] %s",t),this.event.setMaxListeners(100)}publish(t,r){r!=this.data[t]&&(this.data[t]=r,this.event.emit(String(t),{value:r}))}subscribe(t,r){const u=({value:c})=>{r(c)};return this.event.addListener(String(t),u),console.log("listenerCount:",String(t),this.event.listenerCount(String(t))),t in this.data&&r(this.data[t]),()=>(this.event.removeListener(String(t),u),void 0)}}const Ee=ae(e=>new _e(e)),se=(e="noname")=>m.useMemo(()=>Ee(e),[e]),ye=(e,...t)=>{const r=new Error("[ctx] useRegistryChecker failed "+JSON.stringify({names:t,ctx:(e==null?void 0:e.name)??"undefined"}));m.useEffect(()=>{if(e)return t.some(u=>e.registry.has(u))&&console.error(r),t.forEach(u=>e.registry.add(u)),()=>{t.forEach(u=>e.registry.delete(u))}},[e,t.length])},$t=(e,t,r)=>{m.useEffect(()=>{e&&e.data[t]!=r&&e.publish(t,r)},[t,r,e]),ye(e,t)},qt=(e,t,r=0)=>{const[{value:u},c]=m.useState(()=>{var i;return{value:(i=e==null?void 0:e.data)==null?void 0:i[t]}});return m.useEffect(()=>{if(e){let i=r==0?h=>c({value:h}):ee(h=>c({value:h}),r),d=e.subscribe(t,i);return u!=e.data[t]&&c({value:e.data[t]}),()=>{d()}}},[t,e]),e==null?void 0:e.data[t]},er=(e,t,r)=>{const[,u]=m.useState(0),c=m.useMemo(()=>r(e==null?void 0:e.data[t]),[r,e==null?void 0:e.data[t]]);return m.useEffect(()=>{if(e){let i=c,d=()=>{let b=r(e.data[t]);b!=i&&(i=b,u(_=>_+1))},h=e.subscribe(t,d);return d(),()=>h()}},[t,e]),c},Te=(e,...t)=>{m.useEffect(()=>{if(e)for(let[r,u]of t)e.data[r]!=u&&e.publish(r,u)},[e,...t.flat()]),ye(e,...t.map(r=>r[0]))},tr=(e,...t)=>{const[,r]=m.useState(0),u=t.map(c=>{var i;return(i=e==null?void 0:e.data)==null?void 0:i[c]});return m.useEffect(()=>{if(e){let c=u;const i=ee(()=>{let b=t.map(_=>{var O;return(O=e==null?void 0:e.data)==null?void 0:O[_]});t.some((_,O)=>c[O]!=b[O])&&(c=b,r(_=>_+1))},1);let d=t.map(b=>e.subscribe(b,i)),h=setTimeout(i,1);return()=>{clearTimeout(h),i.cancel(),d.forEach(b=>b())}}},[e,...t]),Object.fromEntries(t.map((c,i)=>[c,u[i]]))},rr=(e,t=100,...r)=>{const[,u]=m.useState(0),c=r.map(i=>{var d;return(d=e==null?void 0:e.data)==null?void 0:d[i]});return m.useEffect(()=>{if(e){let i=c;const d=Zt(()=>{let _=r.map(O=>{var w;return(w=e==null?void 0:e.data)==null?void 0:w[O]});r.some((O,w)=>i[w]!=_[w])&&(i=_,u(O=>O+1))},t);let h=r.map(_=>e.subscribe(_,d)),b=setTimeout(d,1);return()=>{clearTimeout(b),d.cancel(),h.forEach(_=>_())}}},[e,...r]),c};var te={exports:{}},J={};/**
|
|
1
|
+
(function(y,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(y=typeof globalThis<"u"?globalThis:y||self,m(y.RState={},y.React))})(this,function(y,m){"use strict";var fr=Object.defineProperty;var cr=(y,m,W)=>m in y?fr(y,m,{enumerable:!0,configurable:!0,writable:!0,value:W}):y[m]=W;var ne=(y,m,W)=>cr(y,typeof m!="symbol"?m+"":m,W);function W(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var B={exports:{}},le;function Ae(){if(le)return B.exports;le=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(o,n,f){return Function.prototype.apply.call(o,n,f)},r;e&&typeof e.ownKeys=="function"?r=e.ownKeys:Object.getOwnPropertySymbols?r=function(o){return Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o))}:r=function(o){return Object.getOwnPropertyNames(o)};function u(s){console&&console.warn&&console.warn(s)}var c=Number.isNaN||function(o){return o!==o};function i(){i.init.call(this)}B.exports=i,B.exports.once=A,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var d=10;function h(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return d},set:function(s){if(typeof s!="number"||s<0||c(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");d=s}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(o){if(typeof o!="number"||o<0||c(o))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+o+".");return this._maxListeners=o,this};function b(s){return s._maxListeners===void 0?i.defaultMaxListeners:s._maxListeners}i.prototype.getMaxListeners=function(){return b(this)},i.prototype.emit=function(o){for(var n=[],f=1;f<arguments.length;f++)n.push(arguments[f]);var l=o==="error",g=this._events;if(g!==void 0)l=l&&g.error===void 0;else if(!l)return!1;if(l){var v;if(n.length>0&&(v=n[0]),v instanceof Error)throw v;var j=new Error("Unhandled error."+(v?" ("+v.message+")":""));throw j.context=v,j}var M=g[o];if(M===void 0)return!1;if(typeof M=="function")t(M,this,n);else for(var re=M.length,K=F(M,re),f=0;f<re;++f)t(K[f],this,n);return!0};function _(s,o,n,f){var l,g,v;if(h(n),g=s._events,g===void 0?(g=s._events=Object.create(null),s._eventsCount=0):(g.newListener!==void 0&&(s.emit("newListener",o,n.listener?n.listener:n),g=s._events),v=g[o]),v===void 0)v=g[o]=n,++s._eventsCount;else if(typeof v=="function"?v=g[o]=f?[n,v]:[v,n]:f?v.unshift(n):v.push(n),l=b(s),l>0&&v.length>l&&!v.warned){v.warned=!0;var j=new Error("Possible EventEmitter memory leak detected. "+v.length+" "+String(o)+" listeners added. Use emitter.setMaxListeners() to increase limit");j.name="MaxListenersExceededWarning",j.emitter=s,j.type=o,j.count=v.length,u(j)}return s}i.prototype.addListener=function(o,n){return _(this,o,n,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(o,n){return _(this,o,n,!0)};function w(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function O(s,o,n){var f={fired:!1,wrapFn:void 0,target:s,type:o,listener:n},l=w.bind(f);return l.listener=n,f.wrapFn=l,l}i.prototype.once=function(o,n){return h(n),this.on(o,O(this,o,n)),this},i.prototype.prependOnceListener=function(o,n){return h(n),this.prependListener(o,O(this,o,n)),this},i.prototype.removeListener=function(o,n){var f,l,g,v,j;if(h(n),l=this._events,l===void 0)return this;if(f=l[o],f===void 0)return this;if(f===n||f.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete l[o],l.removeListener&&this.emit("removeListener",o,f.listener||n));else if(typeof f!="function"){for(g=-1,v=f.length-1;v>=0;v--)if(f[v]===n||f[v].listener===n){j=f[v].listener,g=v;break}if(g<0)return this;g===0?f.shift():E(f,g),f.length===1&&(l[o]=f[0]),l.removeListener!==void 0&&this.emit("removeListener",o,j||n)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(o){var n,f,l;if(f=this._events,f===void 0)return this;if(f.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):f[o]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete f[o]),this;if(arguments.length===0){var g=Object.keys(f),v;for(l=0;l<g.length;++l)v=g[l],v!=="removeListener"&&this.removeAllListeners(v);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=f[o],typeof n=="function")this.removeListener(o,n);else if(n!==void 0)for(l=n.length-1;l>=0;l--)this.removeListener(o,n[l]);return this};function L(s,o,n){var f=s._events;if(f===void 0)return[];var l=f[o];return l===void 0?[]:typeof l=="function"?n?[l.listener||l]:[l]:n?S(l):F(l,l.length)}i.prototype.listeners=function(o){return L(this,o,!0)},i.prototype.rawListeners=function(o){return L(this,o,!1)},i.listenerCount=function(s,o){return typeof s.listenerCount=="function"?s.listenerCount(o):P.call(s,o)},i.prototype.listenerCount=P;function P(s){var o=this._events;if(o!==void 0){var n=o[s];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function F(s,o){for(var n=new Array(o),f=0;f<o;++f)n[f]=s[f];return n}function E(s,o){for(;o+1<s.length;o++)s[o]=s[o+1];s.pop()}function S(s){for(var o=new Array(s.length),n=0;n<o.length;++n)o[n]=s[n].listener||s[n];return o}function A(s,o){return new Promise(function(n,f){function l(v){s.removeListener(o,g),f(v)}function g(){typeof s.removeListener=="function"&&s.removeListener("error",l),n([].slice.call(arguments))}U(s,o,g,{once:!0}),o!=="error"&&G(s,l,{once:!0})})}function G(s,o,n){typeof s.on=="function"&&U(s,"error",o,n)}function U(s,o,n,f){if(typeof s.on=="function")f.once?s.once(o,n):s.on(o,n);else if(typeof s.addEventListener=="function")s.addEventListener(o,function l(g){f.once&&s.removeEventListener(o,l),n(g)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}return B.exports}var Me=Ae();const De=W(Me);var Ie=typeof global=="object"&&global&&global.Object===Object&&global,ke=typeof self=="object"&&self&&self.Object===Object&&self,Q=Ie||ke||Function("return this")(),Z=Q.Symbol,de=Object.prototype,Fe=de.hasOwnProperty,We=de.toString,V=Z?Z.toStringTag:void 0;function ze(e){var t=Fe.call(e,V),r=e[V];try{e[V]=void 0;var u=!0}catch{}var c=We.call(e);return u&&(t?e[V]=r:delete e[V]),c}var Ye=Object.prototype,Ge=Ye.toString;function Ue(e){return Ge.call(e)}var xe="[object Null]",Ve="[object Undefined]",he=Z?Z.toStringTag:void 0;function pe(e){return e==null?e===void 0?Ve:xe:he&&he in Object(e)?ze(e):Ue(e)}function He(e){return e!=null&&typeof e=="object"}var Je="[object Symbol]";function Xe(e){return typeof e=="symbol"||He(e)&&pe(e)==Je}var Ke=/\s/;function Be(e){for(var t=e.length;t--&&Ke.test(e.charAt(t)););return t}var Qe=/^\s+/;function Ze(e){return e&&e.slice(0,Be(e)+1).replace(Qe,"")}function z(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ve=NaN,$e=/^[-+]0x[0-9a-f]+$/i,qe=/^0b[01]+$/i,et=/^0o[0-7]+$/i,tt=parseInt;function me(e){if(typeof e=="number")return e;if(Xe(e))return ve;if(z(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=z(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ze(e);var r=qe.test(e);return r||et.test(e)?tt(e.slice(2),r?2:8):$e.test(e)?ve:+e}var rt="[object AsyncFunction]",nt="[object Function]",ot="[object GeneratorFunction]",at="[object Proxy]";function it(e){if(!z(e))return!1;var t=pe(e);return t==nt||t==ot||t==rt||t==at}var oe=Q["__core-js_shared__"],be=function(){var e=/[^.]+$/.exec(oe&&oe.keys&&oe.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function st(e){return!!be&&be in e}var ut=Function.prototype,ft=ut.toString;function ct(e){if(e!=null){try{return ft.call(e)}catch{}try{return e+""}catch{}}return""}var lt=/[\\^$.*+?()[\]{}|]/g,dt=/^\[object .+?Constructor\]$/,ht=Function.prototype,pt=Object.prototype,vt=ht.toString,mt=pt.hasOwnProperty,bt=RegExp("^"+vt.call(mt).replace(lt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gt(e){if(!z(e)||st(e))return!1;var t=it(e)?bt:dt;return t.test(ct(e))}function _t(e,t){return e==null?void 0:e[t]}function ge(e,t){var r=_t(e,t);return gt(r)?r:void 0}function Et(e,t){return e===t||e!==e&&t!==t}var H=ge(Object,"create");function yt(){this.__data__=H?H(null):{},this.size=0}function Tt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var wt="__lodash_hash_undefined__",Ot=Object.prototype,St=Ot.hasOwnProperty;function Rt(e){var t=this.__data__;if(H){var r=t[e];return r===wt?void 0:r}return St.call(t,e)?t[e]:void 0}var Ct=Object.prototype,jt=Ct.hasOwnProperty;function Lt(e){var t=this.__data__;return H?t[e]!==void 0:jt.call(t,e)}var Pt="__lodash_hash_undefined__";function Nt(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=H&&t===void 0?Pt:t,this}function I(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var u=e[t];this.set(u[0],u[1])}}I.prototype.clear=yt,I.prototype.delete=Tt,I.prototype.get=Rt,I.prototype.has=Lt,I.prototype.set=Nt;function At(){this.__data__=[],this.size=0}function $(e,t){for(var r=e.length;r--;)if(Et(e[r][0],t))return r;return-1}var Mt=Array.prototype,Dt=Mt.splice;function It(e){var t=this.__data__,r=$(t,e);if(r<0)return!1;var u=t.length-1;return r==u?t.pop():Dt.call(t,r,1),--this.size,!0}function kt(e){var t=this.__data__,r=$(t,e);return r<0?void 0:t[r][1]}function Ft(e){return $(this.__data__,e)>-1}function Wt(e,t){var r=this.__data__,u=$(r,e);return u<0?(++this.size,r.push([e,t])):r[u][1]=t,this}function Y(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var u=e[t];this.set(u[0],u[1])}}Y.prototype.clear=At,Y.prototype.delete=It,Y.prototype.get=kt,Y.prototype.has=Ft,Y.prototype.set=Wt;var zt=ge(Q,"Map");function Yt(){this.size=0,this.__data__={hash:new I,map:new(zt||Y),string:new I}}function Gt(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function q(e,t){var r=e.__data__;return Gt(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Ut(e){var t=q(this,e).delete(e);return this.size-=t?1:0,t}function xt(e){return q(this,e).get(e)}function Vt(e){return q(this,e).has(e)}function Ht(e,t){var r=q(this,e),u=r.size;return r.set(e,t),this.size+=r.size==u?0:1,this}function k(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var u=e[t];this.set(u[0],u[1])}}k.prototype.clear=Yt,k.prototype.delete=Ut,k.prototype.get=xt,k.prototype.has=Vt,k.prototype.set=Ht;var Jt="Expected a function";function ae(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Jt);var r=function(){var u=arguments,c=t?t.apply(this,u):u[0],i=r.cache;if(i.has(c))return i.get(c);var d=e.apply(this,u);return r.cache=i.set(c,d)||i,d};return r.cache=new(ae.Cache||k),r}ae.Cache=k;var ie=function(){return Q.Date.now()},Xt="Expected a function",Kt=Math.max,Bt=Math.min;function ee(e,t,r){var u,c,i,d,h,b,_=0,w=!1,O=!1,L=!0;if(typeof e!="function")throw new TypeError(Xt);t=me(t)||0,z(r)&&(w=!!r.leading,O="maxWait"in r,i=O?Kt(me(r.maxWait)||0,t):i,L="trailing"in r?!!r.trailing:L);function P(n){var f=u,l=c;return u=c=void 0,_=n,d=e.apply(l,f),d}function F(n){return _=n,h=setTimeout(A,t),w?P(n):d}function E(n){var f=n-b,l=n-_,g=t-f;return O?Bt(g,i-l):g}function S(n){var f=n-b,l=n-_;return b===void 0||f>=t||f<0||O&&l>=i}function A(){var n=ie();if(S(n))return G(n);h=setTimeout(A,E(n))}function G(n){return h=void 0,L&&u?P(n):(u=c=void 0,d)}function U(){h!==void 0&&clearTimeout(h),_=0,u=b=c=h=void 0}function s(){return h===void 0?d:G(ie())}function o(){var n=ie(),f=S(n);if(u=arguments,c=this,b=n,f){if(h===void 0)return F(b);if(O)return clearTimeout(h),h=setTimeout(A,t),P(b)}return h===void 0&&(h=setTimeout(A,t)),d}return o.cancel=U,o.flush=s,o}var Qt="Expected a function";function Zt(e,t,r){var u=!0,c=!0;if(typeof e!="function")throw new TypeError(Qt);return z(r)&&(u="leading"in r?!!r.leading:u,c="trailing"in r?!!r.trailing:c),ee(e,t,{leading:u,maxWait:t,trailing:c})}class _e{constructor(t){ne(this,"event",new De.EventEmitter);ne(this,"data",{});ne(this,"registry",new Set);this.name=t,console.log("[CONTEXT] %s",t),this.event.setMaxListeners(100)}publish(t,r){r!=this.data[t]&&(this.data[t]=r,this.event.emit(String(t),{value:r}))}subscribe(t,r){const u=({value:c})=>{r(c)};return this.event.addListener(String(t),u),console.log("listenerCount:",String(t),this.event.listenerCount(String(t))),t in this.data&&r(this.data[t]),()=>(this.event.removeListener(String(t),u),void 0)}}const Ee=ae(e=>new _e(e)),se=(e="noname")=>m.useMemo(()=>Ee(e),[e]),ye=(e,...t)=>{const r=new Error("[ctx] useRegistryChecker failed "+JSON.stringify({names:t,ctx:(e==null?void 0:e.name)??"undefined"}));m.useEffect(()=>{if(e)return t.some(u=>e.registry.has(u))&&console.error(r),t.forEach(u=>e.registry.add(u)),()=>{t.forEach(u=>e.registry.delete(u))}},[e,t.length])},$t=(e,t,r)=>{m.useEffect(()=>{e&&e.data[t]!=r&&e.publish(t,r)},[t,r,e]),ye(e,t)},qt=(e,t,r=0)=>{const[{value:u},c]=m.useState(()=>{var i;return{value:(i=e==null?void 0:e.data)==null?void 0:i[t]}});return m.useEffect(()=>{if(e){let i=r==0?h=>c({value:h}):ee(h=>c({value:h}),r),d=e.subscribe(t,i);return u!=e.data[t]&&c({value:e.data[t]}),()=>{d()}}},[t,e]),e==null?void 0:e.data[t]},er=(e,t,r)=>{const[,u]=m.useState(0),c=m.useMemo(()=>r(e==null?void 0:e.data[t]),[r,e==null?void 0:e.data[t]]);return m.useEffect(()=>{if(e){let i=c,d=()=>{let b=r(e.data[t]);b!=i&&(i=b,u(_=>_+1))},h=e.subscribe(t,d);return d(),()=>h()}},[t,e]),c},Te=(e,...t)=>{m.useEffect(()=>{if(e)for(let[r,u]of t)e.data[r]!=u&&e.publish(r,u)},[e,...t.flat()]),ye(e,...t.map(r=>r[0]))},tr=(e,...t)=>{const[,r]=m.useState(0),u=t.map(c=>{var i;return(i=e==null?void 0:e.data)==null?void 0:i[c]});return m.useEffect(()=>{if(e){let c=u;const i=ee(()=>{let b=t.map(_=>{var w;return(w=e==null?void 0:e.data)==null?void 0:w[_]});t.some((_,w)=>c[w]!=b[w])&&(c=b,r(_=>_+1))},1);let d=t.map(b=>e.subscribe(b,i)),h=setTimeout(i,1);return()=>{clearTimeout(h),i.cancel(),d.forEach(b=>b())}}},[e,...t]),Object.fromEntries(t.map((c,i)=>[c,u[i]]))},rr=(e,t=100,...r)=>{const[,u]=m.useState(0),c=r.map(i=>{var d;return(d=e==null?void 0:e.data)==null?void 0:d[i]});return m.useEffect(()=>{if(e){let i=c;const d=Zt(()=>{let _=r.map(w=>{var O;return(O=e==null?void 0:e.data)==null?void 0:O[w]});r.some((w,O)=>i[O]!=_[O])&&(i=_,u(w=>w+1))},t);let h=r.map(_=>e.subscribe(_,d)),b=setTimeout(d,1);return()=>{clearTimeout(b),d.cancel(),h.forEach(_=>_())}}},[e,...r]),c};var te={exports:{}},J={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var we;function nr(){if(we)return J;we=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(u,c,i){var d=null;if(i!==void 0&&(d=""+i),c.key!==void 0&&(d=""+c.key),"key"in c){i={};for(var h in c)h!=="key"&&(i[h]=c[h])}else i=c;return c=i.ref,{$$typeof:e,type:u,key:d,ref:c!==void 0?c:null,props:i}}return J.Fragment=t,J.jsx=r,J.jsxs=r,J}var X={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var Oe;function or(){return Oe||(Oe=1,process.env.NODE_ENV!=="production"&&function(){function e(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===v?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case E:return"Fragment";case A:return"Profiler";case S:return"StrictMode";case o:return"Suspense";case n:return"SuspenseList";case g:return"Activity"}if(typeof a=="object")switch(typeof a.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),a.$$typeof){case F:return"Portal";case U:return(a.displayName||"Context")+".Provider";case G:return(a._context.displayName||"Context")+".Consumer";case s:var p=a.render;return a=a.displayName,a||(a=p.displayName||p.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case f:return p=a.displayName||null,p!==null?p:e(a.type)||"Memo";case l:p=a._payload,a=a._init;try{return e(a(p))}catch{}}return null}function t(a){return""+a}function r(a){try{t(a);var p=!1}catch{p=!0}if(p){p=console;var T=p.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&a[Symbol.toStringTag]||a.constructor.name||"Object";return T.call(p,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),t(a)}}function u(a){if(a===E)return"<>";if(typeof a=="object"&&a!==null&&a.$$typeof===l)return"<...>";try{var p=e(a);return p?"<"+p+">":"<...>"}catch{return"<...>"}}function c(){var a=j.A;return a===null?null:a.getOwner()}function i(){return Error("react-stack-top-frame")}function d(a){if(M.call(a,"key")){var p=Object.getOwnPropertyDescriptor(a,"key").get;if(p&&p.isReactWarning)return!1}return a.key!==void 0}function h(a,p){function T(){Ce||(Ce=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",p))}T.isReactWarning=!0,Object.defineProperty(a,"key",{get:T,configurable:!0})}function b(){var a=e(this.type);return je[a]||(je[a]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),a=this.props.ref,a!==void 0?a:null}function _(a,p,T,R,D,N,ue,fe){return T=N.ref,a={$$typeof:P,type:a,key:p,props:N,_owner:D},(T!==void 0?T:null)!==null?Object.defineProperty(a,"ref",{enumerable:!1,get:b}):Object.defineProperty(a,"ref",{enumerable:!1,value:null}),a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(a,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(a,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ue}),Object.defineProperty(a,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:fe}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a}function w(a,p,T,R,D,N,ue,fe){var C=p.children;if(C!==void 0)if(R)if(re(C)){for(R=0;R<C.length;R++)O(C[R]);Object.freeze&&Object.freeze(C)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else O(C);if(M.call(p,"key")){C=e(a);var x=Object.keys(p).filter(function(ur){return ur!=="key"});R=0<x.length?"{key: someKey, "+x.join(": ..., ")+": ...}":"{key: someKey}",Ne[C+R]||(x=0<x.length?"{"+x.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,R,C,
|
|
22
|
+
<%s key={someKey} {...props} />`,R,C,x,C),Ne[C+R]=!0)}if(C=null,T!==void 0&&(r(T),C=""+T),d(p)&&(r(p.key),C=""+p.key),"key"in p){T={};for(var ce in p)ce!=="key"&&(T[ce]=p[ce])}else T=p;return C&&h(T,typeof a=="function"?a.displayName||a.name||"Unknown":a),_(a,C,N,D,c(),T,ue,fe)}function O(a){typeof a=="object"&&a!==null&&a.$$typeof===P&&a._store&&(a._store.validated=1)}var L=m,P=Symbol.for("react.transitional.element"),F=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),G=Symbol.for("react.consumer"),U=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),o=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),v=Symbol.for("react.client.reference"),j=L.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,re=Array.isArray,K=console.createTask?console.createTask:function(){return null};L={"react-stack-bottom-frame":function(a){return a()}};var Ce,je={},Le=L["react-stack-bottom-frame"].bind(L,i)(),Pe=K(u(i)),Ne={};X.Fragment=E,X.jsx=function(a,p,T,R,D){var N=1e4>j.recentlyCreatedOwnerStacks++;return w(a,p,T,!1,R,D,N?Error("react-stack-top-frame"):Le,N?K(u(a)):Pe)},X.jsxs=function(a,p,T,R,D){var N=1e4>j.recentlyCreatedOwnerStacks++;return w(a,p,T,!0,R,D,N?Error("react-stack-top-frame"):Le,N?K(u(a)):Pe)}}()),X}var Se;function ar(){return Se||(Se=1,process.env.NODE_ENV==="production"?te.exports=nr():te.exports=or()),te.exports}var Re=ar();const ir=(e,t)=>{const r=c=>[e,...Object.entries(c??{}).sort((i,d)=>i[0].localeCompare(d[0])).flat()].join("-");let u=new Set;return{Root:c=>{const i=r(c),d=se(i),h=t(c),b=m.useMemo(()=>new Error().stack,[]);return Te(d,...Object.entries(h)),m.useEffect(()=>{if(u.has(i)){const _=new Error("RootContext "+i+" are mounted more than once");throw _.stack=b,_}return u.add(i),()=>{u.delete(i)}}),Re.jsx(Re.Fragment,{})},useCtxState:c=>{const i=r(c),d=m.useMemo(()=>new Error().stack,[]);return m.useEffect(()=>{if(!u.has(i)){const h=new Error("RootContext ["+i+"] is not mounted");throw h.stack=d,h}},[i]),se(i)}}},sr=e=>{const[,t]=m.useState(0),{proxy:r,finalGetter:u,openGetter:c,clean:i}=m.useMemo(()=>{const d=new Set,h={},b=new Map,_=new Proxy(e==null?void 0:e.data,{get(E,S){if(w)return d.add(S),h[S]=E[S];throw new Error("now allow here")}});let w=!0,O=ee(()=>{[...d.values()].some(E=>{var S;return h[E]!=((S=e==null?void 0:e.data)==null?void 0:S[E])})&&t(E=>E+1)},0),L=()=>{w=!0,d.clear()},P=()=>{w=!1,[...d.values()].filter(E=>!b.has(E)).forEach(E=>{b.set(E,e==null?void 0:e.subscribe(E,O))}),[...b.keys()].filter(E=>!d.has(E)).forEach(E=>{let S=b.get(E);S==null||S(),b.delete(E)})};return{proxy:_,finalGetter:P,openGetter:L,clean:()=>{L(),P(),t(E=>E+1)}}},[]);return c(),setTimeout(u,0),m.useEffect(()=>()=>i(),[i]),r};y.Context=_e,y.createRootCtx=ir,y.getContext=Ee,y.useDataContext=se,y.useDataSource=$t,y.useDataSourceMultiple=Te,y.useDataSubscribe=qt,y.useDataSubscribeMultiple=tr,y.useDataSubscribeMultipleWithDebounce=rr,y.useDataSubscribeWithTransform=er,y.useQuickSubscribe=sr,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -13,11 +13,12 @@ export const createRootCtx = <U extends object, V extends object>(name: string,
|
|
|
13
13
|
.flat()
|
|
14
14
|
].join("-")
|
|
15
15
|
|
|
16
|
-
let
|
|
16
|
+
let ctxMountedCheck = new Set<string>()
|
|
17
17
|
|
|
18
18
|
return {
|
|
19
19
|
Root: (e: U) => {
|
|
20
|
-
const
|
|
20
|
+
const ctxName = resolveCtxName(e)
|
|
21
|
+
const ctx = useDataContext<V>(ctxName)
|
|
21
22
|
const state = useFn(e)
|
|
22
23
|
const stack = useMemo(() => new Error().stack, [])
|
|
23
24
|
|
|
@@ -27,30 +28,31 @@ export const createRootCtx = <U extends object, V extends object>(name: string,
|
|
|
27
28
|
)
|
|
28
29
|
|
|
29
30
|
useEffect(() => {
|
|
30
|
-
if (
|
|
31
|
-
const err = new Error("RootContext " +
|
|
31
|
+
if (ctxMountedCheck.has(ctxName)) {
|
|
32
|
+
const err = new Error("RootContext " + ctxName + " are mounted more than once")
|
|
32
33
|
err.stack = stack;
|
|
33
34
|
throw err
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
return () => {
|
|
36
|
+
ctxMountedCheck.add(ctxName)
|
|
37
|
+
return () => { ctxMountedCheck.delete(ctxName) };
|
|
37
38
|
})
|
|
38
39
|
|
|
39
40
|
return <></>
|
|
40
41
|
},
|
|
41
42
|
useCtxState: (e: U): Context<V> => {
|
|
43
|
+
const ctxName = resolveCtxName(e)
|
|
42
44
|
|
|
43
45
|
const stack = useMemo(() => new Error().stack, [])
|
|
44
46
|
|
|
45
47
|
useEffect(() => {
|
|
46
|
-
if (!
|
|
47
|
-
const err = new Error("RootContext [" +
|
|
48
|
+
if (!ctxMountedCheck.has(ctxName)) {
|
|
49
|
+
const err = new Error("RootContext [" + ctxName + "] is not mounted")
|
|
48
50
|
err.stack = stack;
|
|
49
51
|
throw err
|
|
50
52
|
}
|
|
51
|
-
}, [
|
|
53
|
+
}, [ctxName])
|
|
52
54
|
|
|
53
|
-
return useDataContext<V>(
|
|
55
|
+
return useDataContext<V>(ctxName)
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
}
|