react-state-custom 1.0.30 → 1.0.31

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 CHANGED
@@ -49,7 +49,7 @@ var I;
49
49
  function re() {
50
50
  return I || (I = 1, process.env.NODE_ENV === "production" ? j.exports = ne() : j.exports = ie()), j.exports;
51
51
  }
52
- var _ = re();
52
+ var y = re();
53
53
  function H(n, e) {
54
54
  let t = null, s = function(...r) {
55
55
  t && clearTimeout(t), t = setTimeout(() => {
@@ -150,7 +150,7 @@ const k = oe((n) => new ce(n)), z = (n = "noname") => {
150
150
  }, 100);
151
151
  }), [e]), e;
152
152
  }, Y = (n, ...e) => {
153
- const t = _.c(6), s = e;
153
+ const t = y.c(6), s = e;
154
154
  new Error("[ctx] useRegistryChecker failed " + JSON.stringify({
155
155
  names: s,
156
156
  ctx: n?.name ?? "undefined"
@@ -165,35 +165,35 @@ const k = oe((n) => new ce(n)), z = (n = "noname") => {
165
165
  let i;
166
166
  t[3] !== n || t[4] !== s.length ? (i = [n, s.length], t[3] = n, t[4] = s.length, t[5] = i) : i = t[5], w(r, i);
167
167
  }, ke = (n, e, t) => {
168
- const s = _.c(5);
168
+ const s = y.c(5);
169
169
  let r, i;
170
170
  s[0] !== n || s[1] !== e || s[2] !== t ? (r = () => {
171
171
  n && n.data[e] != t && n.publish(e, t);
172
172
  }, i = [e, t, n], s[0] = n, s[1] = e, s[2] = t, s[3] = r, s[4] = i) : (r = s[3], i = s[4]), w(r, i), Y(n, e);
173
173
  }, ue = (n, e, t) => {
174
- const s = _.c(11), r = t === void 0 ? 0 : t;
174
+ const s = y.c(11), r = t === void 0 ? 0 : t;
175
175
  let i;
176
176
  s[0] !== n?.data || s[1] !== e ? (i = () => ({
177
177
  value: n?.data?.[e]
178
178
  }), s[0] = n?.data, s[1] = e, s[2] = i) : i = s[2];
179
- const [l, a] = N(i), {
180
- value: o
179
+ const [l, o] = N(i), {
180
+ value: a
181
181
  } = l;
182
182
  let u;
183
- s[3] !== n || s[4] !== r || s[5] !== e || s[6] !== o ? (u = () => {
183
+ s[3] !== n || s[4] !== r || s[5] !== e || s[6] !== a ? (u = () => {
184
184
  if (n) {
185
- const d = r == 0 ? (m) => a({
186
- value: m
187
- }) : H((m) => a({
188
- value: m
185
+ const d = r == 0 ? (p) => o({
186
+ value: p
187
+ }) : H((p) => o({
188
+ value: p
189
189
  }), r), f = n.subscribe(e, d);
190
- return o != n.data[e] && a({
190
+ return a != n.data[e] && o({
191
191
  value: n.data[e]
192
192
  }), () => {
193
193
  f();
194
194
  };
195
195
  }
196
- }, s[3] = n, s[4] = r, s[5] = e, s[6] = o, s[7] = u) : u = s[7];
196
+ }, s[3] = n, s[4] = r, s[5] = e, s[6] = a, s[7] = u) : u = s[7];
197
197
  let c;
198
198
  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
199
  }, We = (n, e, t) => {
@@ -201,10 +201,10 @@ const k = oe((n) => new ce(n)), z = (n = "noname") => {
201
201
  return w(() => {
202
202
  if (n) {
203
203
  let i = r, l = () => {
204
- let o = t(n.data[e]);
205
- o != i && (i = o, s((u) => u + 1));
206
- }, a = n.subscribe(e, l);
207
- return l(), () => a();
204
+ let a = t(n.data[e]);
205
+ a != i && (i = a, s((u) => u + 1));
206
+ }, o = n.subscribe(e, l);
207
+ return l(), () => o();
208
208
  }
209
209
  }, [e, n]), r;
210
210
  }, q = (n, ...e) => {
@@ -214,7 +214,7 @@ const k = oe((n) => new ce(n)), z = (n = "noname") => {
214
214
  n.data[t] != s && n.publish(t, s);
215
215
  }, [n, ae(e.flat())]), Y(n, ...e.map((t) => t[0]));
216
216
  }, je = (n, ...e) => {
217
- const t = _.c(18), s = e, [, r] = N(0);
217
+ const t = y.c(18), s = e, [, r] = N(0);
218
218
  let i;
219
219
  if (t[0] !== n?.data || t[1] !== s) {
220
220
  let c;
@@ -222,21 +222,21 @@ const k = oe((n) => new ce(n)), z = (n = "noname") => {
222
222
  } else
223
223
  i = t[2];
224
224
  const l = i;
225
- let a;
226
- t[5] !== n || t[6] !== s || t[7] !== l || t[8] !== r ? (a = () => {
225
+ let o;
226
+ t[5] !== n || t[6] !== s || t[7] !== l || t[8] !== r ? (o = () => {
227
227
  if (n) {
228
228
  let c = l;
229
229
  const d = H(() => {
230
230
  const g = s.map((h) => n?.data?.[h]);
231
- s.some((h, p) => c[p] != g[p]) && (c = g, r(he));
232
- }, 1), f = s.map((g) => n.subscribe(g, d)), m = setTimeout(d, 1);
231
+ s.some((h, m) => c[m] != g[m]) && (c = g, r(he));
232
+ }, 1), f = s.map((g) => n.subscribe(g, d)), p = setTimeout(d, 1);
233
233
  return () => {
234
- clearTimeout(m), d.cancel(), f.forEach(de);
234
+ clearTimeout(p), d.cancel(), f.forEach(de);
235
235
  };
236
236
  }
237
- }, t[5] = n, t[6] = s, t[7] = l, t[8] = r, t[9] = a) : a = t[9];
238
- let o;
239
- t[10] !== n || t[11] !== s ? (o = [n, ...s], t[10] = n, t[11] = s, t[12] = o) : o = t[12], w(a, o);
237
+ }, t[5] = n, t[6] = s, t[7] = l, t[8] = r, t[9] = o) : o = t[9];
238
+ let a;
239
+ t[10] !== n || t[11] !== s ? (a = [n, ...s], t[10] = n, t[11] = s, t[12] = a) : a = t[12], w(o, a);
240
240
  let u;
241
241
  if (t[13] !== s || t[14] !== l) {
242
242
  let c;
@@ -245,29 +245,29 @@ const k = oe((n) => new ce(n)), z = (n = "noname") => {
245
245
  u = t[15];
246
246
  return u;
247
247
  }, Le = (n, e, ...t) => {
248
- const s = _.c(14), r = e === void 0 ? 50 : e, i = t, [, l] = N(0);
249
- let a;
248
+ const s = y.c(14), r = e === void 0 ? 50 : e, i = t, [, l] = N(0);
249
+ let o;
250
250
  if (s[0] !== n?.data || s[1] !== i) {
251
251
  let d;
252
- s[3] !== n?.data ? (d = (f) => n?.data?.[f], s[3] = n?.data, s[4] = d) : d = s[4], a = i.map(d), s[0] = n?.data, s[1] = i, s[2] = a;
252
+ s[3] !== n?.data ? (d = (f) => n?.data?.[f], s[3] = n?.data, s[4] = d) : d = s[4], o = i.map(d), s[0] = n?.data, s[1] = i, s[2] = o;
253
253
  } else
254
- a = s[2];
255
- const o = a;
254
+ o = s[2];
255
+ const a = o;
256
256
  let u;
257
- s[5] !== n || s[6] !== r || s[7] !== i || s[8] !== o || s[9] !== l ? (u = () => {
257
+ s[5] !== n || s[6] !== r || s[7] !== i || s[8] !== a || s[9] !== l ? (u = () => {
258
258
  if (n) {
259
- let d = o;
259
+ let d = a;
260
260
  const f = H(() => {
261
- const h = i.map((p) => n?.data?.[p]);
262
- i.some((p, b) => d[b] != h[b]) && (d = h, l(fe));
263
- }, r), m = i.map((h) => n.subscribe(h, f)), g = setTimeout(f, 1);
261
+ const h = i.map((m) => n?.data?.[m]);
262
+ i.some((m, b) => d[b] != h[b]) && (d = h, l(fe));
263
+ }, r), p = i.map((h) => n.subscribe(h, f)), g = setTimeout(f, 1);
264
264
  return () => {
265
- clearTimeout(g), f.cancel(), m.forEach(pe);
265
+ clearTimeout(g), f.cancel(), p.forEach(pe);
266
266
  };
267
267
  }
268
- }, s[5] = n, s[6] = r, s[7] = i, s[8] = o, s[9] = l, s[10] = u) : u = s[10];
268
+ }, s[5] = n, s[6] = r, s[7] = i, s[8] = a, s[9] = l, s[10] = u) : u = s[10];
269
269
  let c;
270
- return s[11] !== n || s[12] !== i ? (c = [n, ...i], s[11] = n, s[12] = i, s[13] = c) : c = s[13], w(u, c), o;
270
+ return s[11] !== n || s[12] !== i ? (c = [n, ...i], s[11] = n, s[12] = i, s[13] = c) : c = s[13], w(u, c), a;
271
271
  };
272
272
  function he(n) {
273
273
  return n + 1;
@@ -287,31 +287,31 @@ const J = (n = void 0) => Object.keys(n ?? {}).sort().map((e) => {
287
287
  throw new Error(`Parameter "${e}" must be a primitive value (string, number, bigint, null, or undefined), but received ${typeof t}`);
288
288
  return e + "=" + t;
289
289
  }).join("&"), Ae = (n, e) => {
290
- const t = (a) => [n, J(a)].filter(Boolean).join("?"), s = /* @__PURE__ */ new Set(), r = (a) => {
291
- const o = _.c(5), u = e(a), c = t(a), d = z(c);
290
+ const t = (o) => [n, J(o)].filter(Boolean).join("?"), s = /* @__PURE__ */ new Set(), r = (o) => {
291
+ const a = y.c(5), u = e(o), c = t(o), d = z(c);
292
292
  let f;
293
- o[0] === Symbol.for("react.memo_cache_sentinel") ? (f = new Error(), o[0] = f) : f = o[0];
294
- const m = f.stack;
293
+ a[0] === Symbol.for("react.memo_cache_sentinel") ? (f = new Error(), a[0] = f) : f = a[0];
294
+ const p = f.stack;
295
295
  let g;
296
- o[1] !== u ? (g = Object.entries(u), o[1] = u, o[2] = g) : g = o[2], q(d, ...g);
296
+ a[1] !== u ? (g = Object.entries(u), a[1] = u, a[2] = g) : g = a[2], q(d, ...g);
297
297
  let h;
298
- return o[3] !== c ? (h = () => {
298
+ return a[3] !== c ? (h = () => {
299
299
  if (s.has(c)) {
300
- const p = new Error("RootContext " + c + " are mounted more than once");
301
- throw p.stack = m, p;
300
+ const m = new Error("RootContext " + c + " are mounted more than once");
301
+ throw m.stack = p, m;
302
302
  }
303
303
  return s.add(c), () => {
304
304
  s.delete(c);
305
305
  };
306
- }, o[3] = c, o[4] = h) : h = o[4], w(h), u;
307
- }, i = (a) => {
308
- const o = _.c(1);
306
+ }, a[3] = c, a[4] = h) : h = a[4], w(h), u;
307
+ }, i = (o) => {
308
+ const a = y.c(1);
309
309
  let u;
310
- return o[0] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ v($, {}), o[0] = u) : u = o[0], u;
311
- }, l = (a) => {
312
- const o = _.c(3), u = r(a);
310
+ return a[0] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ v($, {}), a[0] = u) : u = a[0], u;
311
+ }, l = (o) => {
312
+ const a = y.c(3), u = r(o);
313
313
  let c;
314
- return o[0] !== a || o[1] !== u ? (c = /* @__PURE__ */ v(i, { ...a, ...u }), o[0] = a, o[1] = u, o[2] = c) : c = o[2], c;
314
+ return a[0] !== o || a[1] !== u ? (c = /* @__PURE__ */ v(i, { ...o, ...u }), a[0] = o, a[1] = u, a[2] = c) : c = a[2], c;
315
315
  };
316
316
  return r.displayName = `useState[${n}]`, l.displayName = `StateContainer[${n}]`, i.displayName = `Debug[${n}]`, {
317
317
  name: n,
@@ -322,33 +322,33 @@ const J = (n = void 0) => Object.keys(n ?? {}).sort().map((e) => {
322
322
  * Strict consumer: throws if the corresponding Root for these props isn't mounted.
323
323
  * Use in development/tests to fail fast when wiring is incorrect.
324
324
  */
325
- useCtxStateStrict: (a) => {
326
- const o = t(a), u = x(() => new Error().stack, []);
325
+ useCtxStateStrict: (o) => {
326
+ const a = t(o), u = x(() => new Error().stack, []);
327
327
  return w(() => {
328
- if (!s.has(o)) {
329
- const c = new Error("RootContext [" + o + "] is not mounted");
328
+ if (!s.has(a)) {
329
+ const c = new Error("RootContext [" + a + "] is not mounted");
330
330
  throw c.stack = u, c;
331
331
  }
332
- }, [o]), z(o);
332
+ }, [a]), z(a);
333
333
  },
334
334
  /**
335
335
  * Lenient consumer: schedules a console.error if the Root isn't mounted instead of throwing.
336
336
  * Useful in production to avoid hard crashes while still surfacing misconfiguration.
337
337
  */
338
- useCtxState: (a) => {
339
- const o = t(a), u = x(() => new Error().stack, []);
338
+ useCtxState: (o) => {
339
+ const a = t(o), u = x(() => new Error().stack, []);
340
340
  return w(() => {
341
- if (!s.has(o)) {
342
- const c = new Error("RootContext [" + o + "] is not mounted");
341
+ if (!s.has(a)) {
342
+ const c = new Error("RootContext [" + a + "] is not mounted");
343
343
  c.stack = u;
344
344
  let d = setTimeout(() => console.error(c), 1e3);
345
345
  return () => clearTimeout(d);
346
346
  }
347
- }, [s.has(o)]), z(o);
347
+ }, [s.has(a)]), z(a);
348
348
  }
349
349
  };
350
350
  }, me = (n) => {
351
- const e = _.c(1);
351
+ const e = y.c(1);
352
352
  let t;
353
353
  return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ v($, {}), e[0] = t) : t = e[0], t;
354
354
  }, ge = ({
@@ -362,71 +362,77 @@ const J = (n = void 0) => Object.keys(n ?? {}).sort().map((e) => {
362
362
  Wrapper: n = te,
363
363
  debugging: e = !1
364
364
  }) => {
365
- const t = z("auto-ctx"), [s, r] = N({}), i = ee((a, o, u, c = 0) => {
366
- const d = [a, J(u)].filter(Boolean).join("?");
367
- return r((f) => ({
368
- ...f,
369
- [d]: {
370
- ...f[d] ?? {
371
- useStateFn: o,
372
- params: u
365
+ const t = z("auto-ctx"), [s, r] = N({}), i = ee((o, a, u, c = 0, d = void 0) => {
366
+ const f = [o, J(u)].filter(Boolean).join("?");
367
+ return r((p) => ({
368
+ ...p,
369
+ [f]: {
370
+ ...p[f] ?? {
371
+ useStateFn: a,
372
+ params: u,
373
+ AttatchedComponent: d
373
374
  },
374
- counter: (f[d]?.counter ?? 0) + 1,
375
+ counter: (p[f]?.counter ?? 0) + 1,
375
376
  keepUntil: void 0,
376
- useStateFn: o
377
+ useStateFn: a,
378
+ AttatchedComponent: d
377
379
  }
378
380
  })), () => r(({
379
- [d]: f,
380
- ...m
381
+ [f]: p,
382
+ ...g
381
383
  }) => ({
382
- ...m,
383
- ...f?.counter > 1 || c > 0 ? {
384
- [d]: {
385
- ...f,
386
- counter: f.counter - 1,
387
- keepUntil: f.counter > 1 ? void 0 : Date.now() + c
384
+ ...g,
385
+ ...p?.counter > 1 || c > 0 ? {
386
+ [f]: {
387
+ ...p,
388
+ counter: p.counter - 1,
389
+ keepUntil: p.counter > 1 ? void 0 : Date.now() + c
388
390
  }
389
391
  } : {}
390
392
  }));
391
393
  }, []), l = x(() => Object.entries(s).filter(([, {
392
- counter: a,
393
- keepUntil: o
394
- }]) => a <= 0 && o).toSorted(([, {
395
- keepUntil: a = 0
396
- }], [, {
394
+ counter: o,
395
+ keepUntil: a
396
+ }]) => o <= 0 && a).toSorted(([, {
397
397
  keepUntil: o = 0
398
- }]) => a - o)?.at(0), [s]);
398
+ }], [, {
399
+ keepUntil: a = 0
400
+ }]) => o - a)?.at(0), [s]);
399
401
  return w(() => {
400
402
  if (l) {
401
- const [a, {
402
- keepUntil: o
403
+ const [o, {
404
+ keepUntil: a
403
405
  }] = l;
404
- if (typeof o > "u") throw new Error("Invalid state mgr");
406
+ if (typeof a > "u") throw new Error("Invalid state mgr");
405
407
  let u = setTimeout(() => {
406
408
  r(({
407
- [a]: c,
409
+ [o]: c,
408
410
  ...d
409
411
  }) => d);
410
- }, Math.max(0, o - Date.now()));
412
+ }, Math.max(0, a - Date.now()));
411
413
  return () => {
412
414
  clearTimeout(u);
413
415
  };
414
416
  }
415
417
  }, [l]), q(t, ["subscribe", i], ["state", s]), /* @__PURE__ */ v($, { children: Object.entries(s).filter(([, {
416
- counter: a,
417
- keepUntil: o = 0
418
- }]) => a > 0 || o >= Date.now()).map(([a, {
419
- useStateFn: o,
420
- params: u
421
- }]) => /* @__PURE__ */ v(n, { children: /* @__PURE__ */ v(ge, { params: u, useStateFn: o, debugging: e }, a) }, a)) });
418
+ counter: o,
419
+ keepUntil: a = 0
420
+ }]) => o > 0 || a >= Date.now()).map(([o, {
421
+ useStateFn: a,
422
+ params: u,
423
+ AttatchedComponent: c
424
+ }]) => /* @__PURE__ */ R(n, { children: [
425
+ /* @__PURE__ */ v(ge, { params: u, useStateFn: a, debugging: e }, o),
426
+ c && /* @__PURE__ */ v(c, { ...u }, "attatch_" + o)
427
+ ] }, o)) });
422
428
  }, Me = ({
423
429
  useRootState: n,
424
430
  getCtxName: e,
425
431
  name: t
426
- }, s = 0) => ({
427
- useCtxState: (r) => {
428
- const i = e(r), l = ue(z("auto-ctx"), "subscribe");
429
- return w(() => l?.(t, n, r, s), [n, l, t, i, s]), z(i);
432
+ }, s = 0, r = void 0) => ({
433
+ useCtxState: (i) => {
434
+ const l = e(i), o = ue(z("auto-ctx"), "subscribe");
435
+ return w(() => o?.(t, n, i, s, r), [n, o, t, l, s, r]), z(l);
430
436
  }
431
437
  }), Ue = (n) => {
432
438
  const [, e] = N(0), {
@@ -435,10 +441,10 @@ const J = (n = void 0) => Object.keys(n ?? {}).sort().map((e) => {
435
441
  openGetter: r,
436
442
  clean: i
437
443
  } = x(() => {
438
- const l = /* @__PURE__ */ new Set(), a = {}, o = /* @__PURE__ */ new Map(), u = new Proxy(n?.data, {
439
- get(h, p) {
444
+ const l = /* @__PURE__ */ new Set(), o = {}, a = /* @__PURE__ */ new Map(), u = new Proxy(n?.data, {
445
+ get(h, m) {
440
446
  if (c)
441
- return l.add(p), a[p] = h[p];
447
+ return l.add(m), o[m] = h[m];
442
448
  throw new Error("useQuickSubscribe: Cannot access context data outside render phase. Destructure needed properties immediately during render.");
443
449
  },
444
450
  ownKeys(h) {
@@ -446,29 +452,29 @@ const J = (n = void 0) => Object.keys(n ?? {}).sort().map((e) => {
446
452
  }
447
453
  });
448
454
  let c = !0, d = H(() => {
449
- [...l.values()].some((h) => a[h] != n?.data?.[h]) && e((h) => h + 1);
455
+ [...l.values()].some((h) => o[h] != n?.data?.[h]) && e((h) => h + 1);
450
456
  }, 0), f = () => {
451
457
  c = !0, l.clear();
452
- }, m = () => {
453
- c = !1, [...l.values()].filter((h) => !o.has(h)).forEach((h) => {
454
- o.set(h, n?.subscribe(h, d));
455
- }), [...o.keys()].filter((h) => !l.has(h)).forEach((h) => {
456
- o.get(h)?.(), o.delete(h);
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);
457
463
  });
458
464
  };
459
465
  return {
460
466
  proxy: u,
461
- finalGetter: m,
467
+ finalGetter: p,
462
468
  openGetter: f,
463
469
  clean: () => {
464
- f(), m(), e((h) => h + 1);
470
+ f(), p(), e((h) => h + 1);
465
471
  }
466
472
  };
467
473
  }, [n]);
468
474
  return r(), setTimeout(s, 0), w(() => () => i(), [i]), t;
469
475
  };
470
476
  function ve(n) {
471
- const e = _.c(4);
477
+ const e = y.c(4);
472
478
  let t;
473
479
  e[0] !== n ? (t = n ? Se(n.trim().toLowerCase().split(" "), "gi") : void 0, e[0] = n, e[1] = t) : t = e[1];
474
480
  const s = t;
@@ -484,7 +490,7 @@ function Se(n, e = "gi") {
484
490
  const t = n.map(be).join("|");
485
491
  return new RegExp(`(${t})`, e);
486
492
  }
487
- function Ce(n, e) {
493
+ function Ee(n, e) {
488
494
  const t = [];
489
495
  let s = 0;
490
496
  for (const r of n.matchAll(e)) {
@@ -495,85 +501,85 @@ function Ce(n, e) {
495
501
  }
496
502
  const X = D.createContext({
497
503
  highlight: void 0
498
- }), Ee = (n) => {
499
- const e = _.c(3), {
504
+ }), Ce = (n) => {
505
+ const e = y.c(3), {
500
506
  children: t,
501
507
  highlight: s
502
508
  } = n, r = ve(s);
503
509
  let i;
504
510
  return e[0] !== t || e[1] !== r ? (i = /* @__PURE__ */ v(X.Provider, { value: r, children: t }), e[0] = t, e[1] = r, e[2] = i) : i = e[2], i;
505
511
  }, we = (n) => {
506
- const e = _.c(5), {
512
+ const e = y.c(5), {
507
513
  text: t
508
514
  } = n, {
509
515
  highlight: s
510
516
  } = se(X);
511
517
  let r;
512
- e[0] !== s || e[1] !== t ? (r = s ? Ce(t, s) : t, e[0] = s, e[1] = t, e[2] = r) : r = e[2];
518
+ e[0] !== s || e[1] !== t ? (r = s ? Ee(t, s) : t, e[0] = s, e[1] = t, e[2] = r) : r = e[2];
513
519
  const i = r;
514
520
  let l;
515
521
  return e[3] !== i ? (l = /* @__PURE__ */ v($, { children: i }), e[3] = i, e[4] = l) : l = e[4], l;
516
522
  }, Q = (n) => {
517
- const e = _.c(5), {
523
+ const e = y.c(5), {
518
524
  name: t,
519
525
  value: s
520
526
  } = n;
521
527
  let r;
522
528
  try {
523
- let a;
524
- e[0] !== t || e[1] !== s ? (a = JSON.stringify({
529
+ let o;
530
+ e[0] !== t || e[1] !== s ? (o = JSON.stringify({
525
531
  [t]: s
526
- }, null, 2), e[0] = t, e[1] = s, e[2] = a) : a = e[2], r = a;
527
- } catch (a) {
528
- r = String(a);
532
+ }, null, 2), e[0] = t, e[1] = s, e[2] = o) : o = e[2], r = o;
533
+ } catch (o) {
534
+ r = String(o);
529
535
  }
530
536
  const i = r;
531
537
  let l;
532
538
  return e[3] !== i ? (l = /* @__PURE__ */ v("pre", { children: i }), e[3] = i, e[4] = l) : l = e[4], l;
533
- }, _e = (n) => {
534
- const e = _.c(26);
539
+ }, ye = (n) => {
540
+ const e = y.c(26);
535
541
  let t, s, r, i;
536
542
  if (e[0] !== n) {
537
543
  const {
538
544
  selectedKey: S,
539
- setKey: C,
540
- currentKey: E,
545
+ setKey: E,
546
+ currentKey: C,
541
547
  highlight: O,
542
- ...y
548
+ ..._
543
549
  } = n;
544
- r = S, i = C, t = E, s = y, e[0] = n, e[1] = t, e[2] = s, e[3] = r, e[4] = i;
550
+ r = S, i = E, t = C, s = _, e[0] = n, e[1] = t, e[2] = s, e[3] = r, e[4] = i;
545
551
  } else
546
552
  t = e[1], s = e[2], r = e[3], i = e[4];
547
553
  let l;
548
554
  e[5] !== t ? (l = k(t), e[5] = t, e[6] = l) : l = e[6];
549
- const a = l, o = P(void 0);
555
+ const o = l, a = P(void 0);
550
556
  let u, c;
551
- e[7] !== a ? (u = () => {
552
- if (o.current) {
557
+ e[7] !== o ? (u = () => {
558
+ if (a.current) {
553
559
  const S = H(() => {
554
- o.current && (o.current?.classList.add("state-key-updated"), requestAnimationFrame(() => o.current?.classList.remove("state-key-updated")));
560
+ a.current && (a.current?.classList.add("state-key-updated"), requestAnimationFrame(() => a.current?.classList.remove("state-key-updated")));
555
561
  }, 5);
556
- return a.subscribeAll(S);
562
+ return o.subscribeAll(S);
557
563
  }
558
- }, c = [a, o], e[7] = a, e[8] = u, e[9] = c) : (u = e[8], c = e[9]), w(u, c);
564
+ }, c = [o, a], e[7] = o, e[8] = u, e[9] = c) : (u = e[8], c = e[9]), w(u, c);
559
565
  const d = t == r;
560
566
  let f;
561
567
  e[10] !== t || e[11] !== i ? (f = () => i(t), e[10] = t, e[11] = i, e[12] = f) : f = e[12];
562
- const m = String(t);
568
+ const p = String(t);
563
569
  let g;
564
- e[13] !== m ? (g = /* @__PURE__ */ v("div", { className: "state-key-name", children: /* @__PURE__ */ v(we, { text: m }) }), e[13] = m, e[14] = g) : g = e[14];
570
+ e[13] !== p ? (g = /* @__PURE__ */ v("div", { className: "state-key-name", children: /* @__PURE__ */ v(we, { text: p }) }), e[13] = p, e[14] = g) : g = e[14];
565
571
  let h;
566
- e[15] !== a.data ? (h = Object.keys(a.data), e[15] = a.data, e[16] = h) : h = e[16];
567
- let p;
568
- e[17] !== h.length ? (p = /* @__PURE__ */ R("div", { className: "state-key-meta", children: [
572
+ e[15] !== o.data ? (h = Object.keys(o.data), e[15] = o.data, e[16] = h) : h = e[16];
573
+ let m;
574
+ e[17] !== h.length ? (m = /* @__PURE__ */ R("div", { className: "state-key-meta", children: [
569
575
  h.length,
570
576
  " items"
571
- ] }), e[17] = h.length, e[18] = p) : p = e[18];
577
+ ] }), e[17] = h.length, e[18] = m) : m = e[18];
572
578
  let b;
573
- return e[19] !== t || e[20] !== s || e[21] !== d || e[22] !== f || e[23] !== g || e[24] !== p ? (b = /* @__PURE__ */ R("div", { ref: o, className: "state-key", title: t, "data-active": d, onClick: f, ...s, children: [
579
+ return e[19] !== t || e[20] !== s || e[21] !== d || e[22] !== f || e[23] !== g || e[24] !== m ? (b = /* @__PURE__ */ R("div", { ref: a, className: "state-key", title: t, "data-active": d, onClick: f, ...s, children: [
574
580
  g,
575
- p
576
- ] }), e[19] = t, e[20] = s, e[21] = d, e[22] = f, e[23] = g, e[24] = p, e[25] = b) : b = e[25], b;
581
+ m
582
+ ] }), e[19] = t, e[20] = s, e[21] = d, e[22] = f, e[23] = g, e[24] = m, e[25] = b) : b = e[25], b;
577
583
  };
578
584
  function T() {
579
585
  return T = Object.assign ? Object.assign.bind() : function(n) {
@@ -584,7 +590,7 @@ function T() {
584
590
  return n;
585
591
  }, T.apply(null, arguments);
586
592
  }
587
- function ye(n, e) {
593
+ function _e(n, e) {
588
594
  if (n == null) return {};
589
595
  var t = {};
590
596
  for (var s in n) if ({}.hasOwnProperty.call(n, s)) {
@@ -623,14 +629,14 @@ class U extends D.Component {
623
629
  var {
624
630
  mode: t,
625
631
  onDragging: s
626
- } = this.props, r = this.target.nextElementSibling, i = this.target.previousElementSibling, l = e.clientX - this.startX, a = e.clientY - this.startY;
632
+ } = this.props, r = this.target.nextElementSibling, i = this.target.previousElementSibling, l = e.clientX - this.startX, o = e.clientY - this.startY;
627
633
  if (this.preSize = 0, this.nextSize = 0, t === "horizontal") {
628
634
  if (this.preSize = this.preWidth + l > -1 ? this.preWidth + l : 0, this.nextSize = this.nextWidth - l > -1 ? this.nextWidth - l : 0, this.preSize === 0 || this.nextSize === 0)
629
635
  return;
630
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, i && r && (i.style.width = this.preSize + "%", r.style.width = this.nextSize + "%");
631
637
  }
632
- if (t === "vertical" && this.preHeight + a > -1 && this.nextHeight - a > -1) {
633
- if (this.preSize = this.preHeight + a > -1 ? this.preHeight + a : 0, this.nextSize = this.nextHeight - a > -1 ? this.nextHeight - a : 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)
638
+ if (t === "vertical" && this.preHeight + o > -1 && this.nextHeight - o > -1) {
639
+ 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)
634
640
  return;
635
641
  i && r && (i.style.height = this.preSize + "%", r.style.height = this.nextSize + "%");
636
642
  }
@@ -651,33 +657,33 @@ class U extends D.Component {
651
657
  className: r,
652
658
  children: i,
653
659
  mode: l,
654
- visible: a = (e = this.props.visible) != null ? e : this.props.visiable,
655
- renderBar: o,
660
+ visible: o = (e = this.props.visible) != null ? e : this.props.visiable,
661
+ renderBar: a,
656
662
  lineBar: u,
657
663
  disable: c
658
- } = t, d = ye(t, Ne), {
664
+ } = t, d = _e(t, Ne), {
659
665
  dragging: f
660
- } = this.state, m = [s, r, s + "-" + l, f ? "dragging" : null].filter(Boolean).join(" ").trim(), g = D.Children.toArray(i);
666
+ } = this.state, p = [s, r, s + "-" + l, f ? "dragging" : null].filter(Boolean).join(" ").trim(), g = D.Children.toArray(i);
661
667
  return /* @__PURE__ */ v("div", T({
662
- className: m
668
+ className: p
663
669
  }, d, {
664
670
  ref: (h) => this.warpper = h,
665
- children: D.Children.map(g, (h, p) => {
671
+ children: D.Children.map(g, (h, m) => {
666
672
  var b = Object.assign({}, h.props, {
667
673
  className: [s + "-pane", h.props.className].filter(Boolean).join(" ").trim(),
668
674
  style: T({}, h.props.style)
669
- }), S = a === !0 || a && a.includes(p + 1) || !1, C = {
675
+ }), S = o === !0 || o && o.includes(m + 1) || !1, E = {
670
676
  className: [s + "-bar", u ? s + "-line-bar" : null, u ? null : s + "-large-bar"].filter(Boolean).join(" ").trim()
671
677
  };
672
- (c === !0 || c && c.includes(p + 1)) && (C.className = [C.className, c ? "disable" : null].filter(Boolean).join(" ").trim());
673
- var E = null;
674
- return p !== 0 && S && o ? E = o(T({}, C, {
675
- onMouseDown: this.onMouseDown.bind(this, p + 1)
676
- })) : p !== 0 && S && (E = /* @__PURE__ */ D.createElement("div", T({}, C), /* @__PURE__ */ v("div", {
677
- onMouseDown: this.onMouseDown.bind(this, p + 1)
678
+ (c === !0 || c && c.includes(m + 1)) && (E.className = [E.className, c ? "disable" : null].filter(Boolean).join(" ").trim());
679
+ var C = null;
680
+ return m !== 0 && S && a ? C = a(T({}, E, {
681
+ onMouseDown: this.onMouseDown.bind(this, m + 1)
682
+ })) : m !== 0 && S && (C = /* @__PURE__ */ D.createElement("div", T({}, E), /* @__PURE__ */ v("div", {
683
+ onMouseDown: this.onMouseDown.bind(this, m + 1)
678
684
  }))), /* @__PURE__ */ R(D.Fragment, {
679
- children: [E, /* @__PURE__ */ D.cloneElement(h, T({}, b))]
680
- }, p);
685
+ children: [C, /* @__PURE__ */ D.cloneElement(h, T({}, b))]
686
+ }, m);
681
687
  })
682
688
  }));
683
689
  }
@@ -688,71 +694,71 @@ U.defaultProps = {
688
694
  mode: "horizontal"
689
695
  };
690
696
  const L = k.cache, De = (n) => {
691
- const e = _.c(27), {
697
+ const e = y.c(27), {
692
698
  Component: t
693
- } = n, [s, r] = N(Te), [i, l] = N(""), [a, o] = N("");
699
+ } = n, [s, r] = N(Te), [i, l] = N(""), [o, a] = N("");
694
700
  let u, c;
695
701
  e[0] === Symbol.for("react.memo_cache_sentinel") ? (u = () => {
696
- const y = setInterval(() => {
702
+ const _ = setInterval(() => {
697
703
  r(ze);
698
704
  }, 50);
699
- return () => clearInterval(y);
705
+ return () => clearInterval(_);
700
706
  }, c = [L], e[0] = u, e[1] = c) : (u = e[0], c = e[1]), w(u, c);
701
707
  let d;
702
708
  e[2] !== i ? (d = i.toLowerCase().split(" "), e[2] = i, e[3] = d) : d = e[3];
703
709
  const f = d;
704
- let m;
705
- e[4] !== f ? (m = (y) => {
706
- const W = y.toLowerCase();
710
+ let p;
711
+ e[4] !== f ? (p = (_) => {
712
+ const W = _.toLowerCase();
707
713
  return f.every((Z) => W.includes(Z));
708
- }, e[4] = f, e[5] = m) : m = e[5];
709
- const g = m;
714
+ }, e[4] = f, e[5] = p) : p = e[5];
715
+ const g = p;
710
716
  let h;
711
- e[6] === Symbol.for("react.memo_cache_sentinel") ? (h = (y) => l(y.target.value), e[6] = h) : h = e[6];
712
- let p;
713
- e[7] !== i ? (p = /* @__PURE__ */ v("input", { placeholder: "Type to Filter ...", className: "state-filter", value: i, onChange: h }), e[7] = i, e[8] = p) : p = e[8];
717
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (h = (_) => l(_.target.value), e[6] = h) : h = e[6];
718
+ let m;
719
+ e[7] !== i ? (m = /* @__PURE__ */ v("input", { placeholder: "Type to Filter ...", className: "state-filter", value: i, onChange: h }), e[7] = i, e[8] = m) : m = e[8];
714
720
  let b;
715
- if (e[9] !== s || e[10] !== g || e[11] !== a) {
716
- let y;
717
- e[13] !== a ? (y = (W) => /* @__PURE__ */ v(_e, { selectedKey: a, setKey: o, currentKey: W }, W), e[13] = a, e[14] = y) : y = e[14], b = s.map(xe).filter($e).filter(g).map(y), e[9] = s, e[10] = g, e[11] = a, e[12] = b;
721
+ if (e[9] !== s || e[10] !== g || e[11] !== o) {
722
+ let _;
723
+ e[13] !== o ? (_ = (W) => /* @__PURE__ */ v(ye, { selectedKey: o, setKey: a, currentKey: W }, W), e[13] = o, e[14] = _) : _ = e[14], b = s.map(xe).filter($e).filter(g).map(_), e[9] = s, e[10] = g, e[11] = o, e[12] = b;
718
724
  } else
719
725
  b = e[12];
720
726
  let S;
721
- e[15] !== i || e[16] !== b ? (S = /* @__PURE__ */ v(Ee, { highlight: i, children: b }), e[15] = i, e[16] = b, e[17] = S) : S = e[17];
722
- let C;
723
- e[18] !== p || e[19] !== S ? (C = /* @__PURE__ */ R("div", { className: "state-list", children: [
724
- p,
725
- S
726
- ] }), e[18] = p, e[19] = S, e[20] = C) : C = e[20];
727
+ e[15] !== i || e[16] !== b ? (S = /* @__PURE__ */ v(Ce, { highlight: i, children: b }), e[15] = i, e[16] = b, e[17] = S) : S = e[17];
727
728
  let E;
728
- e[21] !== t || e[22] !== a ? (E = /* @__PURE__ */ v("div", { className: "state-view", children: /* @__PURE__ */ v(Re, { dataKey: a, Component: t }, a) }), e[21] = t, e[22] = a, e[23] = E) : E = e[23];
729
+ e[18] !== m || e[19] !== S ? (E = /* @__PURE__ */ R("div", { className: "state-list", children: [
730
+ m,
731
+ S
732
+ ] }), e[18] = m, e[19] = S, e[20] = E) : E = e[20];
733
+ let C;
734
+ e[21] !== t || e[22] !== o ? (C = /* @__PURE__ */ v("div", { className: "state-view", children: /* @__PURE__ */ v(Re, { dataKey: o, Component: t }, o) }), e[21] = t, e[22] = o, e[23] = C) : C = e[23];
729
735
  let O;
730
- return e[24] !== E || e[25] !== C ? (O = /* @__PURE__ */ R(U, { mode: "horizontal", className: "main-panel", children: [
731
- C,
732
- E
733
- ] }), e[24] = E, e[25] = C, e[26] = O) : O = e[26], O;
736
+ return e[24] !== C || e[25] !== E ? (O = /* @__PURE__ */ R(U, { mode: "horizontal", className: "main-panel", children: [
737
+ E,
738
+ C
739
+ ] }), e[24] = C, e[25] = E, e[26] = O) : O = e[26], O;
734
740
  }, Re = (n) => {
735
- const e = _.c(11), {
741
+ const e = y.c(11), {
736
742
  dataKey: t,
737
743
  Component: s
738
744
  } = n, r = s === void 0 ? Q : s;
739
745
  let i;
740
746
  e[0] !== t ? (i = k(t), e[0] = t, e[1] = i) : i = e[1];
741
- const l = i, a = l?.data;
742
- let o;
743
- e[2] !== a ? (o = {
744
- ...a
745
- }, e[2] = a, e[3] = o) : o = e[3];
746
- const [u, c] = N(o);
747
+ const l = i, o = l?.data;
748
+ let a;
749
+ e[2] !== o ? (a = {
750
+ ...o
751
+ }, e[2] = o, e[3] = a) : a = e[3];
752
+ const [u, c] = N(a);
747
753
  let d, f;
748
754
  e[4] !== l ? (d = () => {
749
755
  const g = H(c, 5);
750
- return l.subscribeAll((h, p) => g({
751
- ...p
756
+ return l.subscribeAll((h, m) => g({
757
+ ...m
752
758
  }));
753
759
  }, f = [l], e[4] = l, e[5] = d, e[6] = f) : (d = e[5], f = e[6]), w(d, f);
754
- let m;
755
- return e[7] !== r || e[8] !== u || e[9] !== t ? (m = /* @__PURE__ */ v(r, { value: u, name: t }), e[7] = r, e[8] = u, e[9] = t, e[10] = m) : m = e[10], m;
760
+ let p;
761
+ return e[7] !== r || e[8] !== u || e[9] !== t ? (p = /* @__PURE__ */ v(r, { value: u, name: t }), e[7] = r, e[8] = u, e[9] = t, e[10] = p) : p = e[10], p;
756
762
  };
757
763
  function Te() {
758
764
  return [...L.keys()];
@@ -767,28 +773,28 @@ function $e(n) {
767
773
  return n != "auto-ctx" && n;
768
774
  }
769
775
  const Be = (n) => {
770
- const e = _.c(29);
776
+ const e = y.c(29);
771
777
  let t, s, r;
772
778
  e[0] !== n ? ({
773
779
  toggleButton: s,
774
780
  Component: r,
775
781
  ...t
776
782
  } = n, e[0] = n, e[1] = t, e[2] = s, e[3] = r) : (t = e[1], s = e[2], r = e[3]);
777
- const i = r === void 0 ? Q : r, [l, a] = N(!1);
778
- let o;
779
- e[4] === Symbol.for("react.memo_cache_sentinel") ? (o = () => a(!0), e[4] = o) : o = e[4];
783
+ const i = r === void 0 ? Q : r, [l, o] = N(!1);
784
+ let a;
785
+ e[4] === Symbol.for("react.memo_cache_sentinel") ? (a = () => o(!0), e[4] = a) : a = e[4];
780
786
  const u = t?.children ?? "Toggle Dev Tool";
781
787
  let c;
782
- e[5] !== l || e[6] !== t || e[7] !== u ? (c = /* @__PURE__ */ v("button", { className: "react-state-dev-btn", "data-active": l, onClick: o, ...t, children: u }), e[5] = l, e[6] = t, e[7] = u, e[8] = c) : c = e[8];
788
+ e[5] !== l || e[6] !== t || e[7] !== u ? (c = /* @__PURE__ */ v("button", { className: "react-state-dev-btn", "data-active": l, onClick: a, ...t, children: u }), e[5] = l, e[6] = t, e[7] = u, e[8] = c) : c = e[8];
783
789
  let d;
784
790
  e[9] === Symbol.for("react.memo_cache_sentinel") ? (d = {
785
791
  height: "100%"
786
792
  }, e[9] = d) : d = e[9];
787
793
  const f = l ? "66.66%" : "100%";
788
- let m;
789
- e[10] !== f ? (m = /* @__PURE__ */ v("div", { style: {
794
+ let p;
795
+ e[10] !== f ? (p = /* @__PURE__ */ v("div", { style: {
790
796
  height: f
791
- } }), e[10] = f, e[11] = m) : m = e[11];
797
+ } }), e[10] = f, e[11] = p) : p = e[11];
792
798
  const g = l ? "33.33%" : "0";
793
799
  let h;
794
800
  e[12] !== g ? (h = {
@@ -796,25 +802,25 @@ const Be = (n) => {
796
802
  backgroundColor: "var(--rs-bg-color)",
797
803
  position: "relative"
798
804
  }, e[12] = g, e[13] = h) : h = e[13];
799
- let p;
800
- e[14] !== l ? (p = l && /* @__PURE__ */ v("button", { className: "close-btn", onClick: () => a(!1), children: "[x]" }), e[14] = l, e[15] = p) : p = e[15];
805
+ let m;
806
+ e[14] !== l ? (m = l && /* @__PURE__ */ v("button", { className: "close-btn", onClick: () => o(!1), children: "[x]" }), e[14] = l, e[15] = m) : m = e[15];
801
807
  let b;
802
808
  e[16] !== i || e[17] !== l ? (b = l && /* @__PURE__ */ v(De, { Component: i }), e[16] = i, e[17] = l, e[18] = b) : b = e[18];
803
809
  let S;
804
- e[19] !== h || e[20] !== p || e[21] !== b ? (S = /* @__PURE__ */ R("div", { className: "react-state-dev-panel", style: h, children: [
805
- p,
806
- b
807
- ] }), e[19] = h, e[20] = p, e[21] = b, e[22] = S) : S = e[22];
808
- let C;
809
- e[23] !== S || e[24] !== m ? (C = /* @__PURE__ */ v("div", { className: "react-state-dev-container", children: /* @__PURE__ */ R(U, { mode: "vertical", style: d, children: [
810
+ e[19] !== h || e[20] !== m || e[21] !== b ? (S = /* @__PURE__ */ R("div", { className: "react-state-dev-panel", style: h, children: [
810
811
  m,
811
- S
812
- ] }) }), e[23] = S, e[24] = m, e[25] = C) : C = e[25];
812
+ b
813
+ ] }), e[19] = h, e[20] = m, e[21] = b, e[22] = S) : S = e[22];
813
814
  let E;
814
- return e[26] !== C || e[27] !== c ? (E = /* @__PURE__ */ R($, { children: [
815
+ e[23] !== S || e[24] !== p ? (E = /* @__PURE__ */ v("div", { className: "react-state-dev-container", children: /* @__PURE__ */ R(U, { mode: "vertical", style: d, children: [
816
+ p,
817
+ S
818
+ ] }) }), e[23] = S, e[24] = p, e[25] = E) : E = e[25];
819
+ let C;
820
+ return e[26] !== E || e[27] !== c ? (C = /* @__PURE__ */ R($, { children: [
815
821
  c,
816
- C
817
- ] }), e[26] = C, e[27] = c, e[28] = E) : E = e[28], E;
822
+ E
823
+ ] }), e[26] = E, e[27] = c, e[28] = C) : C = e[28], C;
818
824
  };
819
825
  export {
820
826
  Ke as AutoRootCtx,
@@ -823,6 +829,7 @@ export {
823
829
  Me as createAutoCtx,
824
830
  Ae as createRootCtx,
825
831
  k as getContext,
832
+ J as paramsToId,
826
833
  ae as useArrayChangeId,
827
834
  z as useDataContext,
828
835
  ke as useDataSource,