react-state-custom 1.0.31 → 1.0.33
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 +102 -417
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +476 -420
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/state-utils/createAutoCtx.d.ts +10 -0
- package/dist/state-utils/createRootCtx.d.ts +7 -3
- package/dist/state-utils/ctx.d.ts +1 -0
- package/dist/state-utils/utils.d.ts +8 -0
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx as v, Fragment as
|
|
3
|
-
var
|
|
1
|
+
import R, { useRef as J, createContext as ne, useContext as H, useMemo as x, useEffect as w, useState as D, useCallback as ie, Fragment as re, useId as oe } from "react";
|
|
2
|
+
import { jsx as v, Fragment as z, jsxs as _ } from "react/jsx-runtime";
|
|
3
|
+
var I = { exports: {} }, V = {};
|
|
4
4
|
/**
|
|
5
5
|
* @license React
|
|
6
6
|
* react-compiler-runtime.production.js
|
|
@@ -10,16 +10,16 @@ var j = { exports: {} }, A = {};
|
|
|
10
10
|
* This source code is licensed under the MIT license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
12
|
*/
|
|
13
|
-
var
|
|
14
|
-
function
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
var n =
|
|
18
|
-
return
|
|
13
|
+
var P;
|
|
14
|
+
function ae() {
|
|
15
|
+
if (P) return V;
|
|
16
|
+
P = 1;
|
|
17
|
+
var n = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
18
|
+
return V.c = function(e) {
|
|
19
19
|
return n.H.useMemoCache(e);
|
|
20
|
-
},
|
|
20
|
+
}, V;
|
|
21
21
|
}
|
|
22
|
-
var
|
|
22
|
+
var A = {};
|
|
23
23
|
/**
|
|
24
24
|
* @license React
|
|
25
25
|
* react-compiler-runtime.development.js
|
|
@@ -29,11 +29,11 @@ var K = {};
|
|
|
29
29
|
* This source code is licensed under the MIT license found in the
|
|
30
30
|
* LICENSE file in the root directory of this source tree.
|
|
31
31
|
*/
|
|
32
|
-
var
|
|
33
|
-
function
|
|
34
|
-
return
|
|
35
|
-
var n =
|
|
36
|
-
|
|
32
|
+
var F;
|
|
33
|
+
function le() {
|
|
34
|
+
return F || (F = 1, process.env.NODE_ENV !== "production" && function() {
|
|
35
|
+
var n = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
36
|
+
A.c = function(e) {
|
|
37
37
|
var t = n.H;
|
|
38
38
|
return t === null && console.error(
|
|
39
39
|
`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
@@ -43,50 +43,81 @@ function ie() {
|
|
|
43
43
|
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`
|
|
44
44
|
), t.useMemoCache(e);
|
|
45
45
|
};
|
|
46
|
-
}()),
|
|
46
|
+
}()), A;
|
|
47
47
|
}
|
|
48
|
-
var
|
|
49
|
-
function
|
|
50
|
-
return
|
|
48
|
+
var G;
|
|
49
|
+
function ce() {
|
|
50
|
+
return G || (G = 1, process.env.NODE_ENV === "production" ? I.exports = ae() : I.exports = le()), I.exports;
|
|
51
51
|
}
|
|
52
|
-
var
|
|
53
|
-
function
|
|
54
|
-
let t = null, s = function(...
|
|
52
|
+
var N = ce();
|
|
53
|
+
function O(n, e) {
|
|
54
|
+
let t = null, s = function(...i) {
|
|
55
55
|
t && clearTimeout(t), t = setTimeout(() => {
|
|
56
|
-
n(...
|
|
56
|
+
n(...i);
|
|
57
57
|
}, e);
|
|
58
58
|
};
|
|
59
59
|
return s.cancel = () => clearTimeout(t), s;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function ue(n) {
|
|
62
62
|
const e = /* @__PURE__ */ new Map(), t = function(...s) {
|
|
63
|
-
const
|
|
64
|
-
if (e.has(
|
|
65
|
-
return e.get(
|
|
66
|
-
const
|
|
67
|
-
return e.set(
|
|
63
|
+
const i = JSON.stringify(s);
|
|
64
|
+
if (e.has(i))
|
|
65
|
+
return e.get(i);
|
|
66
|
+
const r = n(...s);
|
|
67
|
+
return e.set(i, r), r;
|
|
68
68
|
};
|
|
69
69
|
return t.cache = e, t;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
72
|
-
|
|
71
|
+
const K = {
|
|
72
|
+
stack: [],
|
|
73
|
+
graph: /* @__PURE__ */ new Map(),
|
|
74
|
+
enter(n) {
|
|
75
|
+
process.env.NODE_ENV !== "production" && this.stack.push(n);
|
|
76
|
+
},
|
|
77
|
+
leave() {
|
|
78
|
+
process.env.NODE_ENV !== "production" && this.stack.pop();
|
|
79
|
+
},
|
|
80
|
+
addDependency(n) {
|
|
81
|
+
if (process.env.NODE_ENV === "production") return;
|
|
82
|
+
const e = this.stack[this.stack.length - 1];
|
|
83
|
+
e && e !== n && (this.graph.has(e) || this.graph.set(e, /* @__PURE__ */ new Set()), this.graph.get(e).add(n), this.checkCycle(e, n));
|
|
84
|
+
},
|
|
85
|
+
checkCycle(n, e) {
|
|
86
|
+
if (process.env.NODE_ENV === "production") return;
|
|
87
|
+
const t = /* @__PURE__ */ new Set(), s = [e];
|
|
88
|
+
for (; s.length > 0; ) {
|
|
89
|
+
const i = s.shift();
|
|
90
|
+
if (i === n) {
|
|
91
|
+
console.warn(`[react-state-custom] Circular dependency detected: ${n} -> ... -> ${i}`);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (t.has(i)) continue;
|
|
95
|
+
t.add(i);
|
|
96
|
+
const r = this.graph.get(i);
|
|
97
|
+
if (r)
|
|
98
|
+
for (const a of r)
|
|
99
|
+
s.push(a);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}, Y = () => Math.random().toString().slice(2), he = (n) => {
|
|
103
|
+
const e = J({
|
|
73
104
|
values: [],
|
|
74
|
-
id:
|
|
105
|
+
id: Y()
|
|
75
106
|
});
|
|
76
107
|
let t = !1;
|
|
77
|
-
return t = t || !n != !e.current.values, t = t || n?.length != e.current.values?.length, t = t || n?.some((s,
|
|
78
|
-
},
|
|
79
|
-
class
|
|
108
|
+
return t = t || !n != !e.current.values, t = t || n?.length != e.current.values?.length, t = t || n?.some((s, i) => s != e.current.values[i]), t && (e.current.values = n, e.current.id = Y()), e.current.id;
|
|
109
|
+
}, W = ne(null), U = "@--change-event";
|
|
110
|
+
class de extends Event {
|
|
80
111
|
constructor(e, t) {
|
|
81
112
|
super(String(e)), this.event = e, this.value = t;
|
|
82
113
|
}
|
|
83
114
|
}
|
|
84
|
-
class
|
|
115
|
+
class q extends Event {
|
|
85
116
|
constructor(e) {
|
|
86
|
-
super(
|
|
117
|
+
super(U, e), this.value = e;
|
|
87
118
|
}
|
|
88
119
|
}
|
|
89
|
-
class
|
|
120
|
+
class pe extends EventTarget {
|
|
90
121
|
/**
|
|
91
122
|
* Create a new Context instance.
|
|
92
123
|
* @param name - The name of the context (for debugging).
|
|
@@ -111,8 +142,8 @@ class ce extends EventTarget {
|
|
|
111
142
|
publish(e, t) {
|
|
112
143
|
if (t != this.data[e]) {
|
|
113
144
|
this.data[e] = t;
|
|
114
|
-
let s = new
|
|
115
|
-
this.dispatchEvent(s), this.dispatchEvent(new
|
|
145
|
+
let s = new de(e, t);
|
|
146
|
+
this.dispatchEvent(s), this.dispatchEvent(new q(s));
|
|
116
147
|
}
|
|
117
148
|
}
|
|
118
149
|
/**
|
|
@@ -123,474 +154,497 @@ class ce extends EventTarget {
|
|
|
123
154
|
*/
|
|
124
155
|
subscribe(e, t) {
|
|
125
156
|
const s = ({
|
|
126
|
-
event:
|
|
127
|
-
value:
|
|
157
|
+
event: i,
|
|
158
|
+
value: r
|
|
128
159
|
}) => {
|
|
129
|
-
t(
|
|
160
|
+
t(r);
|
|
130
161
|
};
|
|
131
162
|
return this.addEventListener(String(e), s), e in this.data && t(this.data[e]), () => this.removeEventListener(String(e), s);
|
|
132
163
|
}
|
|
133
164
|
subscribeAll(e) {
|
|
134
165
|
const t = (s) => {
|
|
135
|
-
if (s instanceof
|
|
166
|
+
if (s instanceof q) {
|
|
136
167
|
const {
|
|
137
|
-
value:
|
|
168
|
+
value: i
|
|
138
169
|
} = s;
|
|
139
|
-
e(
|
|
170
|
+
e(i.event, this.data);
|
|
140
171
|
}
|
|
141
172
|
};
|
|
142
|
-
return this.addEventListener(String(
|
|
173
|
+
return this.addEventListener(String(U), t), () => this.removeEventListener(String(U), t);
|
|
143
174
|
}
|
|
144
175
|
}
|
|
145
|
-
const
|
|
146
|
-
const e =
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
176
|
+
const j = ue((n) => new pe(n)), T = (n = "noname") => {
|
|
177
|
+
const e = H(W), t = e ? `${e}/${n}` : n;
|
|
178
|
+
K.addDependency(t);
|
|
179
|
+
const s = x(() => j(t), [t]);
|
|
180
|
+
return w(() => (s.useCounter += 1, () => {
|
|
181
|
+
s.useCounter -= 1, s.useCounter <= 0 && setTimeout(() => {
|
|
182
|
+
s.useCounter <= 0 && j.cache.delete(JSON.stringify([t]));
|
|
150
183
|
}, 100);
|
|
151
|
-
}), [
|
|
152
|
-
},
|
|
153
|
-
const t =
|
|
184
|
+
}), [s]), s;
|
|
185
|
+
}, X = (n, ...e) => {
|
|
186
|
+
const t = N.c(6), s = e;
|
|
154
187
|
new Error("[ctx] useRegistryChecker failed " + JSON.stringify({
|
|
155
188
|
names: s,
|
|
156
189
|
ctx: n?.name ?? "undefined"
|
|
157
190
|
}));
|
|
158
|
-
let
|
|
159
|
-
t[0] !== n || t[1] !== s ? (
|
|
191
|
+
let i;
|
|
192
|
+
t[0] !== n || t[1] !== s ? (i = () => {
|
|
160
193
|
if (n)
|
|
161
|
-
return s.some((
|
|
162
|
-
s.forEach((
|
|
194
|
+
return s.some((a) => n.registry.has(a)), s.forEach((a) => n.registry.add(a)), () => {
|
|
195
|
+
s.forEach((a) => n.registry.delete(a));
|
|
163
196
|
};
|
|
164
|
-
}, t[0] = n, t[1] = s, t[2] =
|
|
165
|
-
let
|
|
166
|
-
t[3] !== n || t[4] !== s.length ? (
|
|
167
|
-
},
|
|
168
|
-
const s =
|
|
169
|
-
let
|
|
170
|
-
s[0] !== n || s[1] !== e || s[2] !== t ? (
|
|
197
|
+
}, t[0] = n, t[1] = s, t[2] = i) : i = t[2];
|
|
198
|
+
let r;
|
|
199
|
+
t[3] !== n || t[4] !== s.length ? (r = [n, s.length], t[3] = n, t[4] = s.length, t[5] = r) : r = t[5], w(i, r);
|
|
200
|
+
}, Ke = (n, e, t) => {
|
|
201
|
+
const s = N.c(5);
|
|
202
|
+
let i, r;
|
|
203
|
+
s[0] !== n || s[1] !== e || s[2] !== t ? (i = () => {
|
|
171
204
|
n && n.data[e] != t && n.publish(e, t);
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
const s =
|
|
175
|
-
let
|
|
176
|
-
s[0] !== n?.data || s[1] !== e ? (
|
|
205
|
+
}, r = [e, t, n], s[0] = n, s[1] = e, s[2] = t, s[3] = i, s[4] = r) : (i = s[3], r = s[4]), w(i, r), X(n, e);
|
|
206
|
+
}, fe = (n, e, t) => {
|
|
207
|
+
const s = N.c(11), i = t === void 0 ? 0 : t;
|
|
208
|
+
let r;
|
|
209
|
+
s[0] !== n?.data || s[1] !== e ? (r = () => ({
|
|
177
210
|
value: n?.data?.[e]
|
|
178
|
-
}), s[0] = n?.data, s[1] = e, s[2] =
|
|
179
|
-
const [
|
|
180
|
-
value:
|
|
181
|
-
} =
|
|
211
|
+
}), s[0] = n?.data, s[1] = e, s[2] = r) : r = s[2];
|
|
212
|
+
const [a, o] = D(r), {
|
|
213
|
+
value: l
|
|
214
|
+
} = a;
|
|
182
215
|
let u;
|
|
183
|
-
s[3] !== n || s[4] !==
|
|
216
|
+
s[3] !== n || s[4] !== i || s[5] !== e || s[6] !== l ? (u = () => {
|
|
184
217
|
if (n) {
|
|
185
|
-
const d =
|
|
186
|
-
value:
|
|
187
|
-
}) :
|
|
188
|
-
value:
|
|
189
|
-
}),
|
|
190
|
-
return
|
|
218
|
+
const d = i == 0 ? (f) => o({
|
|
219
|
+
value: f
|
|
220
|
+
}) : O((f) => o({
|
|
221
|
+
value: f
|
|
222
|
+
}), i), p = n.subscribe(e, d);
|
|
223
|
+
return l != n.data[e] && o({
|
|
191
224
|
value: n.data[e]
|
|
192
225
|
}), () => {
|
|
193
|
-
|
|
226
|
+
p();
|
|
194
227
|
};
|
|
195
228
|
}
|
|
196
|
-
}, s[3] = n, s[4] =
|
|
229
|
+
}, s[3] = n, s[4] = i, s[5] = e, s[6] = l, s[7] = u) : u = s[7];
|
|
197
230
|
let c;
|
|
198
231
|
return s[8] !== n || s[9] !== e ? (c = [e, n], s[8] = n, s[9] = e, s[10] = c) : c = s[10], w(u, c), n?.data[e];
|
|
199
|
-
},
|
|
200
|
-
const [, s] =
|
|
232
|
+
}, Ue = (n, e, t) => {
|
|
233
|
+
const [, s] = D(0), i = x(() => t(n?.data[e]), [t, n?.data[e]]);
|
|
201
234
|
return w(() => {
|
|
202
235
|
if (n) {
|
|
203
|
-
let
|
|
204
|
-
let
|
|
205
|
-
|
|
206
|
-
}, o = n.subscribe(e,
|
|
207
|
-
return
|
|
236
|
+
let r = i, a = () => {
|
|
237
|
+
let l = t(n.data[e]);
|
|
238
|
+
l != r && (r = l, s((u) => u + 1));
|
|
239
|
+
}, o = n.subscribe(e, a);
|
|
240
|
+
return a(), () => o();
|
|
208
241
|
}
|
|
209
|
-
}, [e, n]),
|
|
210
|
-
},
|
|
242
|
+
}, [e, n]), i;
|
|
243
|
+
}, Q = (n, ...e) => {
|
|
211
244
|
w(() => {
|
|
212
245
|
if (n)
|
|
213
246
|
for (let [t, s] of e)
|
|
214
247
|
n.data[t] != s && n.publish(t, s);
|
|
215
|
-
}, [n,
|
|
216
|
-
},
|
|
217
|
-
const t =
|
|
218
|
-
let
|
|
248
|
+
}, [n, he(e.flat())]), X(n, ...e.map((t) => t[0]));
|
|
249
|
+
}, Be = (n, ...e) => {
|
|
250
|
+
const t = N.c(18), s = e, [, i] = D(0);
|
|
251
|
+
let r;
|
|
219
252
|
if (t[0] !== n?.data || t[1] !== s) {
|
|
220
253
|
let c;
|
|
221
|
-
t[3] !== n?.data ? (c = (d) => n?.data?.[d], t[3] = n?.data, t[4] = c) : c = t[4],
|
|
254
|
+
t[3] !== n?.data ? (c = (d) => n?.data?.[d], t[3] = n?.data, t[4] = c) : c = t[4], r = s.map(c), t[0] = n?.data, t[1] = s, t[2] = r;
|
|
222
255
|
} else
|
|
223
|
-
|
|
224
|
-
const
|
|
256
|
+
r = t[2];
|
|
257
|
+
const a = r;
|
|
225
258
|
let o;
|
|
226
|
-
t[5] !== n || t[6] !== s || t[7] !==
|
|
259
|
+
t[5] !== n || t[6] !== s || t[7] !== a || t[8] !== i ? (o = () => {
|
|
227
260
|
if (n) {
|
|
228
|
-
let c =
|
|
229
|
-
const d =
|
|
261
|
+
let c = a;
|
|
262
|
+
const d = O(() => {
|
|
230
263
|
const g = s.map((h) => n?.data?.[h]);
|
|
231
|
-
s.some((h, m) => c[m] != g[m]) && (c = g,
|
|
232
|
-
}, 1),
|
|
264
|
+
s.some((h, m) => c[m] != g[m]) && (c = g, i(me));
|
|
265
|
+
}, 1), p = s.map((g) => n.subscribe(g, d)), f = setTimeout(d, 1);
|
|
233
266
|
return () => {
|
|
234
|
-
clearTimeout(
|
|
267
|
+
clearTimeout(f), d.cancel(), p.forEach(ge);
|
|
235
268
|
};
|
|
236
269
|
}
|
|
237
|
-
}, t[5] = n, t[6] = s, t[7] =
|
|
238
|
-
let
|
|
239
|
-
t[10] !== n || t[11] !== s ? (
|
|
270
|
+
}, t[5] = n, t[6] = s, t[7] = a, t[8] = i, t[9] = o) : o = t[9];
|
|
271
|
+
let l;
|
|
272
|
+
t[10] !== n || t[11] !== s ? (l = [n, ...s], t[10] = n, t[11] = s, t[12] = l) : l = t[12], w(o, l);
|
|
240
273
|
let u;
|
|
241
|
-
if (t[13] !== s || t[14] !==
|
|
274
|
+
if (t[13] !== s || t[14] !== a) {
|
|
242
275
|
let c;
|
|
243
|
-
t[16] !==
|
|
276
|
+
t[16] !== a ? (c = (d, p) => [d, a[p]], t[16] = a, t[17] = c) : c = t[17], u = Object.fromEntries(s.map(c)), t[13] = s, t[14] = a, t[15] = u;
|
|
244
277
|
} else
|
|
245
278
|
u = t[15];
|
|
246
279
|
return u;
|
|
247
|
-
},
|
|
248
|
-
const s =
|
|
280
|
+
}, Pe = (n, e, ...t) => {
|
|
281
|
+
const s = N.c(14), i = e === void 0 ? 50 : e, r = t, [, a] = D(0);
|
|
249
282
|
let o;
|
|
250
|
-
if (s[0] !== n?.data || s[1] !==
|
|
283
|
+
if (s[0] !== n?.data || s[1] !== r) {
|
|
251
284
|
let d;
|
|
252
|
-
s[3] !== n?.data ? (d = (
|
|
285
|
+
s[3] !== n?.data ? (d = (p) => n?.data?.[p], s[3] = n?.data, s[4] = d) : d = s[4], o = r.map(d), s[0] = n?.data, s[1] = r, s[2] = o;
|
|
253
286
|
} else
|
|
254
287
|
o = s[2];
|
|
255
|
-
const
|
|
288
|
+
const l = o;
|
|
256
289
|
let u;
|
|
257
|
-
s[5] !== n || s[6] !==
|
|
290
|
+
s[5] !== n || s[6] !== i || s[7] !== r || s[8] !== l || s[9] !== a ? (u = () => {
|
|
258
291
|
if (n) {
|
|
259
|
-
let d =
|
|
260
|
-
const
|
|
261
|
-
const h =
|
|
262
|
-
|
|
263
|
-
},
|
|
292
|
+
let d = l;
|
|
293
|
+
const p = O(() => {
|
|
294
|
+
const h = r.map((m) => n?.data?.[m]);
|
|
295
|
+
r.some((m, b) => d[b] != h[b]) && (d = h, a(ve));
|
|
296
|
+
}, i), f = r.map((h) => n.subscribe(h, p)), g = setTimeout(p, 1);
|
|
264
297
|
return () => {
|
|
265
|
-
clearTimeout(g),
|
|
298
|
+
clearTimeout(g), p.cancel(), f.forEach(be);
|
|
266
299
|
};
|
|
267
300
|
}
|
|
268
|
-
}, s[5] = n, s[6] =
|
|
301
|
+
}, s[5] = n, s[6] = i, s[7] = r, s[8] = l, s[9] = a, s[10] = u) : u = s[10];
|
|
269
302
|
let c;
|
|
270
|
-
return s[11] !== n || s[12] !==
|
|
303
|
+
return s[11] !== n || s[12] !== r ? (c = [n, ...r], s[11] = n, s[12] = r, s[13] = c) : c = s[13], w(u, c), l;
|
|
271
304
|
};
|
|
272
|
-
function
|
|
305
|
+
function me(n) {
|
|
273
306
|
return n + 1;
|
|
274
307
|
}
|
|
275
|
-
function
|
|
308
|
+
function ge(n) {
|
|
276
309
|
return n();
|
|
277
310
|
}
|
|
278
|
-
function
|
|
311
|
+
function ve(n) {
|
|
279
312
|
return n + 1;
|
|
280
313
|
}
|
|
281
|
-
function
|
|
314
|
+
function be(n) {
|
|
282
315
|
return n();
|
|
283
316
|
}
|
|
284
|
-
const
|
|
317
|
+
const Z = (n = void 0) => Object.keys(n ?? {}).sort().map((e) => {
|
|
285
318
|
const t = n?.[e];
|
|
286
319
|
if (t !== null && (typeof t == "object" || typeof t == "function"))
|
|
287
320
|
throw new Error(`Parameter "${e}" must be a primitive value (string, number, bigint, null, or undefined), but received ${typeof t}`);
|
|
288
321
|
return e + "=" + t;
|
|
289
|
-
}).join("&"),
|
|
290
|
-
const t = (o) => [n,
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
322
|
+
}).join("&"), Se = (n, e) => {
|
|
323
|
+
const t = (o) => [n, Z(o)].filter(Boolean).join("?"), s = /* @__PURE__ */ new Set(), i = (o) => {
|
|
324
|
+
const l = t(o), u = H(W), c = u ? `${u}/${l}` : l, d = T(l);
|
|
325
|
+
K.enter(c);
|
|
326
|
+
let p;
|
|
327
|
+
try {
|
|
328
|
+
p = e(o, {
|
|
329
|
+
...d.data
|
|
330
|
+
});
|
|
331
|
+
} finally {
|
|
332
|
+
K.leave();
|
|
333
|
+
}
|
|
334
|
+
const f = x(() => new Error().stack, []);
|
|
335
|
+
return Q(d, ...Object.entries(p)), w(() => {
|
|
299
336
|
if (s.has(c)) {
|
|
300
|
-
const
|
|
301
|
-
throw
|
|
337
|
+
const g = new Error("RootContext " + c + " are mounted more than once");
|
|
338
|
+
throw g.stack = f, g;
|
|
302
339
|
}
|
|
303
340
|
return s.add(c), () => {
|
|
304
341
|
s.delete(c);
|
|
305
342
|
};
|
|
306
|
-
}
|
|
307
|
-
},
|
|
308
|
-
const
|
|
343
|
+
}), p;
|
|
344
|
+
}, r = (o) => {
|
|
345
|
+
const l = N.c(1);
|
|
309
346
|
let u;
|
|
310
|
-
return
|
|
311
|
-
},
|
|
312
|
-
const
|
|
347
|
+
return l[0] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ v(z, {}), l[0] = u) : u = l[0], u;
|
|
348
|
+
}, a = (o) => {
|
|
349
|
+
const l = N.c(3), u = i(o);
|
|
313
350
|
let c;
|
|
314
|
-
return
|
|
351
|
+
return l[0] !== o || l[1] !== u ? (c = /* @__PURE__ */ v(r, { ...o, ...u }), l[0] = o, l[1] = u, l[2] = c) : c = l[2], c;
|
|
315
352
|
};
|
|
316
|
-
return
|
|
353
|
+
return i.displayName = `useState[${n}]`, a.displayName = `StateContainer[${n}]`, r.displayName = `Debug[${n}]`, {
|
|
317
354
|
name: n,
|
|
318
355
|
getCtxName: t,
|
|
319
|
-
useRootState:
|
|
320
|
-
Root:
|
|
356
|
+
useRootState: i,
|
|
357
|
+
Root: a,
|
|
321
358
|
/**
|
|
322
359
|
* Strict consumer: throws if the corresponding Root for these props isn't mounted.
|
|
323
360
|
* Use in development/tests to fail fast when wiring is incorrect.
|
|
324
361
|
*/
|
|
325
362
|
useCtxStateStrict: (o) => {
|
|
326
|
-
const
|
|
363
|
+
const l = t(o), u = H(W), c = u ? `${u}/${l}` : l, d = x(() => new Error().stack, []);
|
|
327
364
|
return w(() => {
|
|
328
|
-
if (!s.has(
|
|
329
|
-
const
|
|
330
|
-
throw
|
|
365
|
+
if (!s.has(c)) {
|
|
366
|
+
const p = new Error("RootContext [" + c + "] is not mounted");
|
|
367
|
+
throw p.stack = d, p;
|
|
331
368
|
}
|
|
332
|
-
}, [
|
|
369
|
+
}, [c]), T(l);
|
|
333
370
|
},
|
|
334
371
|
/**
|
|
335
372
|
* Lenient consumer: schedules a console.error if the Root isn't mounted instead of throwing.
|
|
336
373
|
* Useful in production to avoid hard crashes while still surfacing misconfiguration.
|
|
337
374
|
*/
|
|
338
375
|
useCtxState: (o) => {
|
|
339
|
-
const
|
|
376
|
+
const l = t(o), u = H(W), c = u ? `${u}/${l}` : l, d = x(() => new Error().stack, []);
|
|
340
377
|
return w(() => {
|
|
341
|
-
if (!s.has(
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
let
|
|
345
|
-
return () => clearTimeout(
|
|
378
|
+
if (!s.has(c)) {
|
|
379
|
+
const p = new Error("RootContext [" + c + "] is not mounted");
|
|
380
|
+
p.stack = d;
|
|
381
|
+
let f = setTimeout(() => console.error(p), 1e3);
|
|
382
|
+
return () => clearTimeout(f);
|
|
346
383
|
}
|
|
347
|
-
}, [s.has(
|
|
384
|
+
}, [s.has(c)]), T(l);
|
|
348
385
|
}
|
|
349
386
|
};
|
|
350
|
-
},
|
|
351
|
-
const e =
|
|
387
|
+
}, Ee = (n) => {
|
|
388
|
+
const [, e] = D(0), {
|
|
389
|
+
proxy: t,
|
|
390
|
+
finalGetter: s,
|
|
391
|
+
openGetter: i,
|
|
392
|
+
clean: r
|
|
393
|
+
} = x(() => {
|
|
394
|
+
const a = /* @__PURE__ */ new Set(), o = {}, l = /* @__PURE__ */ new Map(), u = new Proxy(n?.data, {
|
|
395
|
+
get(h, m) {
|
|
396
|
+
if (c)
|
|
397
|
+
return a.add(m), o[m] = h[m];
|
|
398
|
+
throw new Error("useQuickSubscribe: Cannot access context data outside render phase. Destructure needed properties immediately during render.");
|
|
399
|
+
},
|
|
400
|
+
ownKeys(h) {
|
|
401
|
+
return console.warn("useQuickSubscribe: Rest object operations aren't recommended as they bypass selective subscription and may cause performance issues"), Reflect.ownKeys(h);
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
let c = !0, d = O(() => {
|
|
405
|
+
[...a.values()].some((h) => o[h] != n?.data?.[h]) && e((h) => h + 1);
|
|
406
|
+
}, 0), p = () => {
|
|
407
|
+
c = !0, a.clear();
|
|
408
|
+
}, f = () => {
|
|
409
|
+
c = !1, [...a.values()].filter((h) => !l.has(h)).forEach((h) => {
|
|
410
|
+
l.set(h, n?.subscribe(h, d));
|
|
411
|
+
}), [...l.keys()].filter((h) => !a.has(h)).forEach((h) => {
|
|
412
|
+
l.get(h)?.(), l.delete(h);
|
|
413
|
+
});
|
|
414
|
+
};
|
|
415
|
+
return {
|
|
416
|
+
proxy: u,
|
|
417
|
+
finalGetter: f,
|
|
418
|
+
openGetter: p,
|
|
419
|
+
clean: () => {
|
|
420
|
+
p(), f(), e((h) => h + 1);
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
}, [n]);
|
|
424
|
+
return i(), setTimeout(s, 0), w(() => () => r(), [r]), t;
|
|
425
|
+
}, Ce = (n) => {
|
|
426
|
+
const e = N.c(1);
|
|
352
427
|
let t;
|
|
353
|
-
return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ v(
|
|
354
|
-
},
|
|
428
|
+
return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ v(z, {}), e[0] = t) : t = e[0], t;
|
|
429
|
+
}, we = ({
|
|
355
430
|
useStateFn: n,
|
|
356
431
|
params: e,
|
|
357
432
|
debugging: t
|
|
358
433
|
}) => {
|
|
359
434
|
const s = n(e);
|
|
360
|
-
return t ? /* @__PURE__ */ v(
|
|
361
|
-
},
|
|
362
|
-
Wrapper: n =
|
|
435
|
+
return t ? /* @__PURE__ */ v(Ce, { ...s }) : /* @__PURE__ */ v(z, {});
|
|
436
|
+
}, Ne = ({
|
|
437
|
+
Wrapper: n = re,
|
|
363
438
|
debugging: e = !1
|
|
364
439
|
}) => {
|
|
365
|
-
const t =
|
|
366
|
-
const
|
|
367
|
-
return
|
|
368
|
-
...
|
|
369
|
-
[
|
|
370
|
-
...p
|
|
371
|
-
useStateFn:
|
|
440
|
+
const t = T("auto-ctx"), [s, i] = D({}), r = ie((o, l, u, c = 0, d = void 0) => {
|
|
441
|
+
const p = [o, Z(u)].filter(Boolean).join("?");
|
|
442
|
+
return i((f) => ({
|
|
443
|
+
...f,
|
|
444
|
+
[p]: {
|
|
445
|
+
...f[p] ?? {
|
|
446
|
+
useStateFn: l,
|
|
372
447
|
params: u,
|
|
373
448
|
AttatchedComponent: d
|
|
374
449
|
},
|
|
375
|
-
counter: (p
|
|
450
|
+
counter: (f[p]?.counter ?? 0) + 1,
|
|
376
451
|
keepUntil: void 0,
|
|
377
|
-
useStateFn:
|
|
452
|
+
useStateFn: l,
|
|
378
453
|
AttatchedComponent: d
|
|
379
454
|
}
|
|
380
|
-
})), () =>
|
|
381
|
-
[
|
|
455
|
+
})), () => i(({
|
|
456
|
+
[p]: f,
|
|
382
457
|
...g
|
|
383
458
|
}) => ({
|
|
384
459
|
...g,
|
|
385
|
-
...
|
|
386
|
-
[
|
|
387
|
-
...
|
|
388
|
-
counter:
|
|
389
|
-
keepUntil:
|
|
460
|
+
...f?.counter > 1 || c > 0 ? {
|
|
461
|
+
[p]: {
|
|
462
|
+
...f,
|
|
463
|
+
counter: f.counter - 1,
|
|
464
|
+
keepUntil: f.counter > 1 ? void 0 : Date.now() + c
|
|
390
465
|
}
|
|
391
466
|
} : {}
|
|
392
467
|
}));
|
|
393
|
-
}, []),
|
|
468
|
+
}, []), a = x(() => Object.entries(s).filter(([, {
|
|
394
469
|
counter: o,
|
|
395
|
-
keepUntil:
|
|
396
|
-
}]) => o <= 0 &&
|
|
470
|
+
keepUntil: l
|
|
471
|
+
}]) => o <= 0 && l).toSorted(([, {
|
|
397
472
|
keepUntil: o = 0
|
|
398
473
|
}], [, {
|
|
399
|
-
keepUntil:
|
|
400
|
-
}]) => o -
|
|
474
|
+
keepUntil: l = 0
|
|
475
|
+
}]) => o - l)?.at(0), [s]);
|
|
401
476
|
return w(() => {
|
|
402
|
-
if (
|
|
477
|
+
if (a) {
|
|
403
478
|
const [o, {
|
|
404
|
-
keepUntil:
|
|
405
|
-
}] =
|
|
406
|
-
if (typeof
|
|
479
|
+
keepUntil: l
|
|
480
|
+
}] = a;
|
|
481
|
+
if (typeof l > "u") throw new Error("Invalid state mgr");
|
|
407
482
|
let u = setTimeout(() => {
|
|
408
|
-
|
|
483
|
+
i(({
|
|
409
484
|
[o]: c,
|
|
410
485
|
...d
|
|
411
486
|
}) => d);
|
|
412
|
-
}, Math.max(0,
|
|
487
|
+
}, Math.max(0, l - Date.now()));
|
|
413
488
|
return () => {
|
|
414
489
|
clearTimeout(u);
|
|
415
490
|
};
|
|
416
491
|
}
|
|
417
|
-
}, [
|
|
492
|
+
}, [a]), Q(t, ["subscribe", r], ["state", s]), /* @__PURE__ */ v(z, { children: Object.entries(s).filter(([, {
|
|
418
493
|
counter: o,
|
|
419
|
-
keepUntil:
|
|
420
|
-
}]) => o > 0 ||
|
|
421
|
-
useStateFn:
|
|
494
|
+
keepUntil: l = 0
|
|
495
|
+
}]) => o > 0 || l >= Date.now()).map(([o, {
|
|
496
|
+
useStateFn: l,
|
|
422
497
|
params: u,
|
|
423
498
|
AttatchedComponent: c
|
|
424
|
-
}]) => /* @__PURE__ */
|
|
425
|
-
/* @__PURE__ */ v(
|
|
499
|
+
}]) => /* @__PURE__ */ _(n, { children: [
|
|
500
|
+
/* @__PURE__ */ v(we, { params: u, useStateFn: l, debugging: e }, o),
|
|
426
501
|
c && /* @__PURE__ */ v(c, { ...u }, "attatch_" + o)
|
|
427
502
|
] }, o)) });
|
|
428
|
-
},
|
|
503
|
+
}, ye = ({
|
|
429
504
|
useRootState: n,
|
|
430
505
|
getCtxName: e,
|
|
431
506
|
name: t
|
|
432
|
-
}, s = 0,
|
|
433
|
-
|
|
434
|
-
const
|
|
435
|
-
return w(() =>
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
let c = !0, d = H(() => {
|
|
455
|
-
[...l.values()].some((h) => o[h] != n?.data?.[h]) && e((h) => h + 1);
|
|
456
|
-
}, 0), f = () => {
|
|
457
|
-
c = !0, l.clear();
|
|
458
|
-
}, p = () => {
|
|
459
|
-
c = !1, [...l.values()].filter((h) => !a.has(h)).forEach((h) => {
|
|
460
|
-
a.set(h, n?.subscribe(h, d));
|
|
461
|
-
}), [...a.keys()].filter((h) => !l.has(h)).forEach((h) => {
|
|
462
|
-
a.get(h)?.(), a.delete(h);
|
|
463
|
-
});
|
|
464
|
-
};
|
|
465
|
-
return {
|
|
466
|
-
proxy: u,
|
|
467
|
-
finalGetter: p,
|
|
468
|
-
openGetter: f,
|
|
469
|
-
clean: () => {
|
|
470
|
-
f(), p(), e((h) => h + 1);
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
}, [n]);
|
|
474
|
-
return r(), setTimeout(s, 0), w(() => () => i(), [i]), t;
|
|
507
|
+
}, s = 0, i = void 0) => {
|
|
508
|
+
const r = (a) => {
|
|
509
|
+
const o = e(a), l = fe(T("auto-ctx"), "subscribe");
|
|
510
|
+
return w(() => l?.(t, n, a, s, i), [n, l, t, o, s, i]), T(o);
|
|
511
|
+
};
|
|
512
|
+
return {
|
|
513
|
+
useCtxState: r,
|
|
514
|
+
useStore: (a) => Ee(r(a))
|
|
515
|
+
};
|
|
516
|
+
}, Fe = (n, e, t = 0, s = void 0) => ye(Se(n, e), t, s), Ge = (n) => {
|
|
517
|
+
const e = N.c(7), {
|
|
518
|
+
children: t,
|
|
519
|
+
Wrapper: s,
|
|
520
|
+
debugging: i
|
|
521
|
+
} = n, r = oe();
|
|
522
|
+
let a;
|
|
523
|
+
e[0] !== s || e[1] !== i ? (a = /* @__PURE__ */ v(Ne, { Wrapper: s, debugging: i }), e[0] = s, e[1] = i, e[2] = a) : a = e[2];
|
|
524
|
+
let o;
|
|
525
|
+
return e[3] !== t || e[4] !== r || e[5] !== a ? (o = /* @__PURE__ */ _(W.Provider, { value: r, children: [
|
|
526
|
+
a,
|
|
527
|
+
t
|
|
528
|
+
] }), e[3] = t, e[4] = r, e[5] = a, e[6] = o) : o = e[6], o;
|
|
475
529
|
};
|
|
476
|
-
function
|
|
477
|
-
const e =
|
|
530
|
+
function De(n) {
|
|
531
|
+
const e = N.c(4);
|
|
478
532
|
let t;
|
|
479
|
-
e[0] !== n ? (t = n ?
|
|
533
|
+
e[0] !== n ? (t = n ? Re(n.trim().toLowerCase().split(" "), "gi") : void 0, e[0] = n, e[1] = t) : t = e[1];
|
|
480
534
|
const s = t;
|
|
481
|
-
let
|
|
482
|
-
return e[2] !== s ? (
|
|
535
|
+
let i;
|
|
536
|
+
return e[2] !== s ? (i = {
|
|
483
537
|
highlight: s
|
|
484
|
-
}, e[2] = s, e[3] =
|
|
538
|
+
}, e[2] = s, e[3] = i) : i = e[3], i;
|
|
485
539
|
}
|
|
486
|
-
function
|
|
540
|
+
function _e(n) {
|
|
487
541
|
return n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
488
542
|
}
|
|
489
|
-
function
|
|
490
|
-
const t = n.map(
|
|
543
|
+
function Re(n, e = "gi") {
|
|
544
|
+
const t = n.map(_e).join("|");
|
|
491
545
|
return new RegExp(`(${t})`, e);
|
|
492
546
|
}
|
|
493
|
-
function
|
|
547
|
+
function $e(n, e) {
|
|
494
548
|
const t = [];
|
|
495
549
|
let s = 0;
|
|
496
|
-
for (const
|
|
497
|
-
const [
|
|
498
|
-
|
|
550
|
+
for (const i of n.matchAll(e)) {
|
|
551
|
+
const [r] = i, a = i.index;
|
|
552
|
+
a > s && t.push(n.slice(s, a)), t.push(/* @__PURE__ */ v("mark", { children: r }, a)), s = a + r.length;
|
|
499
553
|
}
|
|
500
554
|
return s < n.length && t.push(n.slice(s)), t;
|
|
501
555
|
}
|
|
502
|
-
const
|
|
556
|
+
const ee = R.createContext({
|
|
503
557
|
highlight: void 0
|
|
504
|
-
}),
|
|
505
|
-
const e =
|
|
558
|
+
}), xe = (n) => {
|
|
559
|
+
const e = N.c(3), {
|
|
506
560
|
children: t,
|
|
507
561
|
highlight: s
|
|
508
|
-
} = n,
|
|
509
|
-
let
|
|
510
|
-
return e[0] !== t || e[1] !==
|
|
511
|
-
},
|
|
512
|
-
const e =
|
|
562
|
+
} = n, i = De(s);
|
|
563
|
+
let r;
|
|
564
|
+
return e[0] !== t || e[1] !== i ? (r = /* @__PURE__ */ v(ee.Provider, { value: i, children: t }), e[0] = t, e[1] = i, e[2] = r) : r = e[2], r;
|
|
565
|
+
}, Te = (n) => {
|
|
566
|
+
const e = N.c(5), {
|
|
513
567
|
text: t
|
|
514
568
|
} = n, {
|
|
515
569
|
highlight: s
|
|
516
|
-
} =
|
|
517
|
-
let
|
|
518
|
-
e[0] !== s || e[1] !== t ? (
|
|
519
|
-
const
|
|
520
|
-
let
|
|
521
|
-
return e[3] !==
|
|
522
|
-
},
|
|
523
|
-
const e =
|
|
570
|
+
} = H(ee);
|
|
571
|
+
let i;
|
|
572
|
+
e[0] !== s || e[1] !== t ? (i = s ? $e(t, s) : t, e[0] = s, e[1] = t, e[2] = i) : i = e[2];
|
|
573
|
+
const r = i;
|
|
574
|
+
let a;
|
|
575
|
+
return e[3] !== r ? (a = /* @__PURE__ */ v(z, { children: r }), e[3] = r, e[4] = a) : a = e[4], a;
|
|
576
|
+
}, te = (n) => {
|
|
577
|
+
const e = N.c(5), {
|
|
524
578
|
name: t,
|
|
525
579
|
value: s
|
|
526
580
|
} = n;
|
|
527
|
-
let
|
|
581
|
+
let i;
|
|
528
582
|
try {
|
|
529
583
|
let o;
|
|
530
584
|
e[0] !== t || e[1] !== s ? (o = JSON.stringify({
|
|
531
585
|
[t]: s
|
|
532
|
-
}, null, 2), e[0] = t, e[1] = s, e[2] = o) : o = e[2],
|
|
586
|
+
}, null, 2), e[0] = t, e[1] = s, e[2] = o) : o = e[2], i = o;
|
|
533
587
|
} catch (o) {
|
|
534
|
-
|
|
588
|
+
i = String(o);
|
|
535
589
|
}
|
|
536
|
-
const
|
|
537
|
-
let
|
|
538
|
-
return e[3] !==
|
|
539
|
-
},
|
|
540
|
-
const e =
|
|
541
|
-
let t, s,
|
|
590
|
+
const r = i;
|
|
591
|
+
let a;
|
|
592
|
+
return e[3] !== r ? (a = /* @__PURE__ */ v("pre", { children: r }), e[3] = r, e[4] = a) : a = e[4], a;
|
|
593
|
+
}, ze = (n) => {
|
|
594
|
+
const e = N.c(26);
|
|
595
|
+
let t, s, i, r;
|
|
542
596
|
if (e[0] !== n) {
|
|
543
597
|
const {
|
|
544
598
|
selectedKey: S,
|
|
545
599
|
setKey: E,
|
|
546
600
|
currentKey: C,
|
|
547
|
-
highlight:
|
|
548
|
-
...
|
|
601
|
+
highlight: k,
|
|
602
|
+
...y
|
|
549
603
|
} = n;
|
|
550
|
-
|
|
604
|
+
i = S, r = E, t = C, s = y, e[0] = n, e[1] = t, e[2] = s, e[3] = i, e[4] = r;
|
|
551
605
|
} else
|
|
552
|
-
t = e[1], s = e[2],
|
|
553
|
-
let
|
|
554
|
-
e[5] !== t ? (
|
|
555
|
-
const o =
|
|
606
|
+
t = e[1], s = e[2], i = e[3], r = e[4];
|
|
607
|
+
let a;
|
|
608
|
+
e[5] !== t ? (a = j(t), e[5] = t, e[6] = a) : a = e[6];
|
|
609
|
+
const o = a, l = J(void 0);
|
|
556
610
|
let u, c;
|
|
557
611
|
e[7] !== o ? (u = () => {
|
|
558
|
-
if (
|
|
559
|
-
const S =
|
|
560
|
-
|
|
612
|
+
if (l.current) {
|
|
613
|
+
const S = O(() => {
|
|
614
|
+
l.current && (l.current?.classList.add("state-key-updated"), requestAnimationFrame(() => l.current?.classList.remove("state-key-updated")));
|
|
561
615
|
}, 5);
|
|
562
616
|
return o.subscribeAll(S);
|
|
563
617
|
}
|
|
564
|
-
}, c = [o,
|
|
565
|
-
const d = t ==
|
|
566
|
-
let
|
|
567
|
-
e[10] !== t || e[11] !==
|
|
568
|
-
const
|
|
618
|
+
}, c = [o, l], e[7] = o, e[8] = u, e[9] = c) : (u = e[8], c = e[9]), w(u, c);
|
|
619
|
+
const d = t == i;
|
|
620
|
+
let p;
|
|
621
|
+
e[10] !== t || e[11] !== r ? (p = () => r(t), e[10] = t, e[11] = r, e[12] = p) : p = e[12];
|
|
622
|
+
const f = String(t);
|
|
569
623
|
let g;
|
|
570
|
-
e[13] !==
|
|
624
|
+
e[13] !== f ? (g = /* @__PURE__ */ v("div", { className: "state-key-name", children: /* @__PURE__ */ v(Te, { text: f }) }), e[13] = f, e[14] = g) : g = e[14];
|
|
571
625
|
let h;
|
|
572
626
|
e[15] !== o.data ? (h = Object.keys(o.data), e[15] = o.data, e[16] = h) : h = e[16];
|
|
573
627
|
let m;
|
|
574
|
-
e[17] !== h.length ? (m = /* @__PURE__ */
|
|
628
|
+
e[17] !== h.length ? (m = /* @__PURE__ */ _("div", { className: "state-key-meta", children: [
|
|
575
629
|
h.length,
|
|
576
630
|
" items"
|
|
577
631
|
] }), e[17] = h.length, e[18] = m) : m = e[18];
|
|
578
632
|
let b;
|
|
579
|
-
return e[19] !== t || e[20] !== s || e[21] !== d || e[22] !==
|
|
633
|
+
return e[19] !== t || e[20] !== s || e[21] !== d || e[22] !== p || e[23] !== g || e[24] !== m ? (b = /* @__PURE__ */ _("div", { ref: l, className: "state-key", title: t, "data-active": d, onClick: p, ...s, children: [
|
|
580
634
|
g,
|
|
581
635
|
m
|
|
582
|
-
] }), e[19] = t, e[20] = s, e[21] = d, e[22] =
|
|
636
|
+
] }), e[19] = t, e[20] = s, e[21] = d, e[22] = p, e[23] = g, e[24] = m, e[25] = b) : b = e[25], b;
|
|
583
637
|
};
|
|
584
|
-
function
|
|
585
|
-
return
|
|
638
|
+
function $() {
|
|
639
|
+
return $ = Object.assign ? Object.assign.bind() : function(n) {
|
|
586
640
|
for (var e = 1; e < arguments.length; e++) {
|
|
587
641
|
var t = arguments[e];
|
|
588
642
|
for (var s in t) ({}).hasOwnProperty.call(t, s) && (n[s] = t[s]);
|
|
589
643
|
}
|
|
590
644
|
return n;
|
|
591
|
-
},
|
|
645
|
+
}, $.apply(null, arguments);
|
|
592
646
|
}
|
|
593
|
-
function
|
|
647
|
+
function Oe(n, e) {
|
|
594
648
|
if (n == null) return {};
|
|
595
649
|
var t = {};
|
|
596
650
|
for (var s in n) if ({}.hasOwnProperty.call(n, s)) {
|
|
@@ -599,8 +653,8 @@ function _e(n, e) {
|
|
|
599
653
|
}
|
|
600
654
|
return t;
|
|
601
655
|
}
|
|
602
|
-
var
|
|
603
|
-
class
|
|
656
|
+
var ke = ["prefixCls", "className", "children", "mode", "visiable", "visible", "renderBar", "lineBar", "disable", "onDragEnd", "onDragging"];
|
|
657
|
+
class B extends R.Component {
|
|
604
658
|
constructor(e) {
|
|
605
659
|
super(e), this.state = {
|
|
606
660
|
dragging: !1
|
|
@@ -615,8 +669,8 @@ class U extends D.Component {
|
|
|
615
669
|
onMouseDown(e, t) {
|
|
616
670
|
if (!(!t.target || !this.warpper)) {
|
|
617
671
|
this.paneNumber = e, this.startX = t.clientX, this.startY = t.clientY, this.move = !0, this.target = t.target.parentNode;
|
|
618
|
-
var s = this.target.previousElementSibling,
|
|
619
|
-
this.boxWidth = this.warpper.clientWidth, this.boxHeight = this.warpper.clientHeight, s && (this.preWidth = s.clientWidth, this.preHeight = s.clientHeight),
|
|
672
|
+
var s = this.target.previousElementSibling, i = this.target.nextElementSibling;
|
|
673
|
+
this.boxWidth = this.warpper.clientWidth, this.boxHeight = this.warpper.clientHeight, s && (this.preWidth = s.clientWidth, this.preHeight = s.clientHeight), i && (this.nextWidth = i.clientWidth, this.nextHeight = i.clientHeight), window.addEventListener("mousemove", this.onDragging), window.addEventListener("mouseup", this.onDragEnd, !1), this.setState({
|
|
620
674
|
dragging: !0
|
|
621
675
|
});
|
|
622
676
|
}
|
|
@@ -629,16 +683,16 @@ class U extends D.Component {
|
|
|
629
683
|
var {
|
|
630
684
|
mode: t,
|
|
631
685
|
onDragging: s
|
|
632
|
-
} = this.props,
|
|
686
|
+
} = this.props, i = this.target.nextElementSibling, r = this.target.previousElementSibling, a = e.clientX - this.startX, o = e.clientY - this.startY;
|
|
633
687
|
if (this.preSize = 0, this.nextSize = 0, t === "horizontal") {
|
|
634
|
-
if (this.preSize = this.preWidth +
|
|
688
|
+
if (this.preSize = this.preWidth + a > -1 ? this.preWidth + a : 0, this.nextSize = this.nextWidth - a > -1 ? this.nextWidth - a : 0, this.preSize === 0 || this.nextSize === 0)
|
|
635
689
|
return;
|
|
636
|
-
this.preSize = (this.preSize / this.boxWidth >= 1 ? 1 : this.preSize / this.boxWidth) * 100, this.nextSize = (this.nextSize / this.boxWidth >= 1 ? 1 : this.nextSize / this.boxWidth) * 100,
|
|
690
|
+
this.preSize = (this.preSize / this.boxWidth >= 1 ? 1 : this.preSize / this.boxWidth) * 100, this.nextSize = (this.nextSize / this.boxWidth >= 1 ? 1 : this.nextSize / this.boxWidth) * 100, r && i && (r.style.width = this.preSize + "%", i.style.width = this.nextSize + "%");
|
|
637
691
|
}
|
|
638
692
|
if (t === "vertical" && this.preHeight + o > -1 && this.nextHeight - o > -1) {
|
|
639
693
|
if (this.preSize = this.preHeight + o > -1 ? this.preHeight + o : 0, this.nextSize = this.nextHeight - o > -1 ? this.nextHeight - o : 0, this.preSize = (this.preSize / this.boxHeight >= 1 ? 1 : this.preSize / this.boxHeight) * 100, this.nextSize = (this.nextSize / this.boxHeight >= 1 ? 1 : this.nextSize / this.boxHeight) * 100, this.preSize === 0 || this.nextSize === 0)
|
|
640
694
|
return;
|
|
641
|
-
|
|
695
|
+
r && i && (r.style.height = this.preSize + "%", i.style.height = this.nextSize + "%");
|
|
642
696
|
}
|
|
643
697
|
s && s(this.preSize, this.nextSize, this.paneNumber);
|
|
644
698
|
}
|
|
@@ -654,148 +708,148 @@ class U extends D.Component {
|
|
|
654
708
|
render() {
|
|
655
709
|
var e, t = this.props, {
|
|
656
710
|
prefixCls: s,
|
|
657
|
-
className:
|
|
658
|
-
children:
|
|
659
|
-
mode:
|
|
711
|
+
className: i,
|
|
712
|
+
children: r,
|
|
713
|
+
mode: a,
|
|
660
714
|
visible: o = (e = this.props.visible) != null ? e : this.props.visiable,
|
|
661
|
-
renderBar:
|
|
715
|
+
renderBar: l,
|
|
662
716
|
lineBar: u,
|
|
663
717
|
disable: c
|
|
664
|
-
} = t, d =
|
|
665
|
-
dragging:
|
|
666
|
-
} = this.state,
|
|
667
|
-
return /* @__PURE__ */ v("div",
|
|
668
|
-
className:
|
|
718
|
+
} = t, d = Oe(t, ke), {
|
|
719
|
+
dragging: p
|
|
720
|
+
} = this.state, f = [s, i, s + "-" + a, p ? "dragging" : null].filter(Boolean).join(" ").trim(), g = R.Children.toArray(r);
|
|
721
|
+
return /* @__PURE__ */ v("div", $({
|
|
722
|
+
className: f
|
|
669
723
|
}, d, {
|
|
670
724
|
ref: (h) => this.warpper = h,
|
|
671
|
-
children:
|
|
725
|
+
children: R.Children.map(g, (h, m) => {
|
|
672
726
|
var b = Object.assign({}, h.props, {
|
|
673
727
|
className: [s + "-pane", h.props.className].filter(Boolean).join(" ").trim(),
|
|
674
|
-
style:
|
|
728
|
+
style: $({}, h.props.style)
|
|
675
729
|
}), S = o === !0 || o && o.includes(m + 1) || !1, E = {
|
|
676
730
|
className: [s + "-bar", u ? s + "-line-bar" : null, u ? null : s + "-large-bar"].filter(Boolean).join(" ").trim()
|
|
677
731
|
};
|
|
678
732
|
(c === !0 || c && c.includes(m + 1)) && (E.className = [E.className, c ? "disable" : null].filter(Boolean).join(" ").trim());
|
|
679
733
|
var C = null;
|
|
680
|
-
return m !== 0 && S &&
|
|
734
|
+
return m !== 0 && S && l ? C = l($({}, E, {
|
|
681
735
|
onMouseDown: this.onMouseDown.bind(this, m + 1)
|
|
682
|
-
})) : m !== 0 && S && (C = /* @__PURE__ */
|
|
736
|
+
})) : m !== 0 && S && (C = /* @__PURE__ */ R.createElement("div", $({}, E), /* @__PURE__ */ v("div", {
|
|
683
737
|
onMouseDown: this.onMouseDown.bind(this, m + 1)
|
|
684
|
-
}))), /* @__PURE__ */ R
|
|
685
|
-
children: [C, /* @__PURE__ */
|
|
738
|
+
}))), /* @__PURE__ */ _(R.Fragment, {
|
|
739
|
+
children: [C, /* @__PURE__ */ R.cloneElement(h, $({}, b))]
|
|
686
740
|
}, m);
|
|
687
741
|
})
|
|
688
742
|
}));
|
|
689
743
|
}
|
|
690
744
|
}
|
|
691
|
-
|
|
745
|
+
B.defaultProps = {
|
|
692
746
|
prefixCls: "w-split",
|
|
693
747
|
visiable: !0,
|
|
694
748
|
mode: "horizontal"
|
|
695
749
|
};
|
|
696
|
-
const
|
|
697
|
-
const e =
|
|
750
|
+
const M = j.cache, He = (n) => {
|
|
751
|
+
const e = N.c(27), {
|
|
698
752
|
Component: t
|
|
699
|
-
} = n, [s,
|
|
753
|
+
} = n, [s, i] = D(je), [r, a] = D(""), [o, l] = D("");
|
|
700
754
|
let u, c;
|
|
701
755
|
e[0] === Symbol.for("react.memo_cache_sentinel") ? (u = () => {
|
|
702
|
-
const
|
|
703
|
-
|
|
756
|
+
const y = setInterval(() => {
|
|
757
|
+
i(Le);
|
|
704
758
|
}, 50);
|
|
705
|
-
return () => clearInterval(
|
|
706
|
-
}, c = [
|
|
759
|
+
return () => clearInterval(y);
|
|
760
|
+
}, c = [M], e[0] = u, e[1] = c) : (u = e[0], c = e[1]), w(u, c);
|
|
707
761
|
let d;
|
|
708
|
-
e[2] !==
|
|
709
|
-
const
|
|
710
|
-
let
|
|
711
|
-
e[4] !==
|
|
712
|
-
const
|
|
713
|
-
return
|
|
714
|
-
}, e[4] =
|
|
715
|
-
const g =
|
|
762
|
+
e[2] !== r ? (d = r.toLowerCase().split(" "), e[2] = r, e[3] = d) : d = e[3];
|
|
763
|
+
const p = d;
|
|
764
|
+
let f;
|
|
765
|
+
e[4] !== p ? (f = (y) => {
|
|
766
|
+
const L = y.toLowerCase();
|
|
767
|
+
return p.every((se) => L.includes(se));
|
|
768
|
+
}, e[4] = p, e[5] = f) : f = e[5];
|
|
769
|
+
const g = f;
|
|
716
770
|
let h;
|
|
717
|
-
e[6] === Symbol.for("react.memo_cache_sentinel") ? (h = (
|
|
771
|
+
e[6] === Symbol.for("react.memo_cache_sentinel") ? (h = (y) => a(y.target.value), e[6] = h) : h = e[6];
|
|
718
772
|
let m;
|
|
719
|
-
e[7] !==
|
|
773
|
+
e[7] !== r ? (m = /* @__PURE__ */ v("input", { placeholder: "Type to Filter ...", className: "state-filter", value: r, onChange: h }), e[7] = r, e[8] = m) : m = e[8];
|
|
720
774
|
let b;
|
|
721
775
|
if (e[9] !== s || e[10] !== g || e[11] !== o) {
|
|
722
|
-
let
|
|
723
|
-
e[13] !== o ? (
|
|
776
|
+
let y;
|
|
777
|
+
e[13] !== o ? (y = (L) => /* @__PURE__ */ v(ze, { selectedKey: o, setKey: l, currentKey: L }, L), e[13] = o, e[14] = y) : y = e[14], b = s.map(Ie).filter(Me).filter(g).map(y), e[9] = s, e[10] = g, e[11] = o, e[12] = b;
|
|
724
778
|
} else
|
|
725
779
|
b = e[12];
|
|
726
780
|
let S;
|
|
727
|
-
e[15] !==
|
|
781
|
+
e[15] !== r || e[16] !== b ? (S = /* @__PURE__ */ v(xe, { highlight: r, children: b }), e[15] = r, e[16] = b, e[17] = S) : S = e[17];
|
|
728
782
|
let E;
|
|
729
|
-
e[18] !== m || e[19] !== S ? (E = /* @__PURE__ */
|
|
783
|
+
e[18] !== m || e[19] !== S ? (E = /* @__PURE__ */ _("div", { className: "state-list", children: [
|
|
730
784
|
m,
|
|
731
785
|
S
|
|
732
786
|
] }), e[18] = m, e[19] = S, e[20] = E) : E = e[20];
|
|
733
787
|
let C;
|
|
734
|
-
e[21] !== t || e[22] !== o ? (C = /* @__PURE__ */ v("div", { className: "state-view", children: /* @__PURE__ */ v(
|
|
735
|
-
let
|
|
736
|
-
return e[24] !== C || e[25] !== E ? (
|
|
788
|
+
e[21] !== t || e[22] !== o ? (C = /* @__PURE__ */ v("div", { className: "state-view", children: /* @__PURE__ */ v(We, { dataKey: o, Component: t }, o) }), e[21] = t, e[22] = o, e[23] = C) : C = e[23];
|
|
789
|
+
let k;
|
|
790
|
+
return e[24] !== C || e[25] !== E ? (k = /* @__PURE__ */ _(B, { mode: "horizontal", className: "main-panel", children: [
|
|
737
791
|
E,
|
|
738
792
|
C
|
|
739
|
-
] }), e[24] = C, e[25] = E, e[26] =
|
|
740
|
-
},
|
|
741
|
-
const e =
|
|
793
|
+
] }), e[24] = C, e[25] = E, e[26] = k) : k = e[26], k;
|
|
794
|
+
}, We = (n) => {
|
|
795
|
+
const e = N.c(11), {
|
|
742
796
|
dataKey: t,
|
|
743
797
|
Component: s
|
|
744
|
-
} = n,
|
|
745
|
-
let
|
|
746
|
-
e[0] !== t ? (
|
|
747
|
-
const
|
|
748
|
-
let
|
|
749
|
-
e[2] !== o ? (
|
|
798
|
+
} = n, i = s === void 0 ? te : s;
|
|
799
|
+
let r;
|
|
800
|
+
e[0] !== t ? (r = j(t), e[0] = t, e[1] = r) : r = e[1];
|
|
801
|
+
const a = r, o = a?.data;
|
|
802
|
+
let l;
|
|
803
|
+
e[2] !== o ? (l = {
|
|
750
804
|
...o
|
|
751
|
-
}, e[2] = o, e[3] =
|
|
752
|
-
const [u, c] =
|
|
753
|
-
let d,
|
|
754
|
-
e[4] !==
|
|
755
|
-
const g =
|
|
756
|
-
return
|
|
805
|
+
}, e[2] = o, e[3] = l) : l = e[3];
|
|
806
|
+
const [u, c] = D(l);
|
|
807
|
+
let d, p;
|
|
808
|
+
e[4] !== a ? (d = () => {
|
|
809
|
+
const g = O(c, 5);
|
|
810
|
+
return a.subscribeAll((h, m) => g({
|
|
757
811
|
...m
|
|
758
812
|
}));
|
|
759
|
-
},
|
|
760
|
-
let
|
|
761
|
-
return e[7] !==
|
|
813
|
+
}, p = [a], e[4] = a, e[5] = d, e[6] = p) : (d = e[5], p = e[6]), w(d, p);
|
|
814
|
+
let f;
|
|
815
|
+
return e[7] !== i || e[8] !== u || e[9] !== t ? (f = /* @__PURE__ */ v(i, { value: u, name: t }), e[7] = i, e[8] = u, e[9] = t, e[10] = f) : f = e[10], f;
|
|
762
816
|
};
|
|
763
|
-
function
|
|
764
|
-
return [...
|
|
817
|
+
function je() {
|
|
818
|
+
return [...M.keys()];
|
|
765
819
|
}
|
|
766
|
-
function
|
|
767
|
-
return n.length !=
|
|
820
|
+
function Le(n) {
|
|
821
|
+
return n.length != M.size ? [...M.keys()] : n;
|
|
768
822
|
}
|
|
769
|
-
function
|
|
823
|
+
function Ie(n) {
|
|
770
824
|
return JSON.parse(n)?.[0];
|
|
771
825
|
}
|
|
772
|
-
function
|
|
826
|
+
function Me(n) {
|
|
773
827
|
return n != "auto-ctx" && n;
|
|
774
828
|
}
|
|
775
|
-
const
|
|
776
|
-
const e =
|
|
777
|
-
let t, s,
|
|
829
|
+
const Ye = (n) => {
|
|
830
|
+
const e = N.c(29);
|
|
831
|
+
let t, s, i;
|
|
778
832
|
e[0] !== n ? ({
|
|
779
833
|
toggleButton: s,
|
|
780
|
-
Component:
|
|
834
|
+
Component: i,
|
|
781
835
|
...t
|
|
782
|
-
} = n, e[0] = n, e[1] = t, e[2] = s, e[3] =
|
|
783
|
-
const
|
|
784
|
-
let
|
|
785
|
-
e[4] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
836
|
+
} = n, e[0] = n, e[1] = t, e[2] = s, e[3] = i) : (t = e[1], s = e[2], i = e[3]);
|
|
837
|
+
const r = i === void 0 ? te : i, [a, o] = D(!1);
|
|
838
|
+
let l;
|
|
839
|
+
e[4] === Symbol.for("react.memo_cache_sentinel") ? (l = () => o(!0), e[4] = l) : l = e[4];
|
|
786
840
|
const u = t?.children ?? "Toggle Dev Tool";
|
|
787
841
|
let c;
|
|
788
|
-
e[5] !==
|
|
842
|
+
e[5] !== a || e[6] !== t || e[7] !== u ? (c = /* @__PURE__ */ v("button", { className: "react-state-dev-btn", "data-active": a, onClick: l, ...t, children: u }), e[5] = a, e[6] = t, e[7] = u, e[8] = c) : c = e[8];
|
|
789
843
|
let d;
|
|
790
844
|
e[9] === Symbol.for("react.memo_cache_sentinel") ? (d = {
|
|
791
845
|
height: "100%"
|
|
792
846
|
}, e[9] = d) : d = e[9];
|
|
793
|
-
const
|
|
794
|
-
let
|
|
795
|
-
e[10] !==
|
|
796
|
-
height:
|
|
797
|
-
} }), e[10] =
|
|
798
|
-
const g =
|
|
847
|
+
const p = a ? "66.66%" : "100%";
|
|
848
|
+
let f;
|
|
849
|
+
e[10] !== p ? (f = /* @__PURE__ */ v("div", { style: {
|
|
850
|
+
height: p
|
|
851
|
+
} }), e[10] = p, e[11] = f) : f = e[11];
|
|
852
|
+
const g = a ? "33.33%" : "0";
|
|
799
853
|
let h;
|
|
800
854
|
e[12] !== g ? (h = {
|
|
801
855
|
height: g,
|
|
@@ -803,41 +857,43 @@ const Be = (n) => {
|
|
|
803
857
|
position: "relative"
|
|
804
858
|
}, e[12] = g, e[13] = h) : h = e[13];
|
|
805
859
|
let m;
|
|
806
|
-
e[14] !==
|
|
860
|
+
e[14] !== a ? (m = a && /* @__PURE__ */ v("button", { className: "close-btn", onClick: () => o(!1), children: "[x]" }), e[14] = a, e[15] = m) : m = e[15];
|
|
807
861
|
let b;
|
|
808
|
-
e[16] !==
|
|
862
|
+
e[16] !== r || e[17] !== a ? (b = a && /* @__PURE__ */ v(He, { Component: r }), e[16] = r, e[17] = a, e[18] = b) : b = e[18];
|
|
809
863
|
let S;
|
|
810
|
-
e[19] !== h || e[20] !== m || e[21] !== b ? (S = /* @__PURE__ */
|
|
864
|
+
e[19] !== h || e[20] !== m || e[21] !== b ? (S = /* @__PURE__ */ _("div", { className: "react-state-dev-panel", style: h, children: [
|
|
811
865
|
m,
|
|
812
866
|
b
|
|
813
867
|
] }), e[19] = h, e[20] = m, e[21] = b, e[22] = S) : S = e[22];
|
|
814
868
|
let E;
|
|
815
|
-
e[23] !== S || e[24] !==
|
|
816
|
-
|
|
869
|
+
e[23] !== S || e[24] !== f ? (E = /* @__PURE__ */ v("div", { className: "react-state-dev-container", children: /* @__PURE__ */ _(B, { mode: "vertical", style: d, children: [
|
|
870
|
+
f,
|
|
817
871
|
S
|
|
818
|
-
] }) }), e[23] = S, e[24] =
|
|
872
|
+
] }) }), e[23] = S, e[24] = f, e[25] = E) : E = e[25];
|
|
819
873
|
let C;
|
|
820
|
-
return e[26] !== E || e[27] !== c ? (C = /* @__PURE__ */
|
|
874
|
+
return e[26] !== E || e[27] !== c ? (C = /* @__PURE__ */ _(z, { children: [
|
|
821
875
|
c,
|
|
822
876
|
E
|
|
823
877
|
] }), e[26] = E, e[27] = c, e[28] = C) : C = e[28], C;
|
|
824
878
|
};
|
|
825
879
|
export {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
880
|
+
Ne as AutoRootCtx,
|
|
881
|
+
pe as Context,
|
|
882
|
+
Ye as DevToolContainer,
|
|
883
|
+
Ge as StateScopeProvider,
|
|
884
|
+
ye as createAutoCtx,
|
|
885
|
+
Se as createRootCtx,
|
|
886
|
+
Fe as createStore,
|
|
887
|
+
j as getContext,
|
|
888
|
+
Z as paramsToId,
|
|
889
|
+
he as useArrayChangeId,
|
|
890
|
+
T as useDataContext,
|
|
891
|
+
Ke as useDataSource,
|
|
892
|
+
Q as useDataSourceMultiple,
|
|
893
|
+
fe as useDataSubscribe,
|
|
894
|
+
Be as useDataSubscribeMultiple,
|
|
895
|
+
Pe as useDataSubscribeMultipleWithDebounce,
|
|
896
|
+
Ue as useDataSubscribeWithTransform,
|
|
897
|
+
Ee as useQuickSubscribe
|
|
842
898
|
};
|
|
843
899
|
//# sourceMappingURL=index.es.js.map
|