cogsbox-state 0.5.282 → 0.5.283

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.
@@ -52,7 +52,7 @@ const ae = (t, c) => {
52
52
  options: a,
53
53
  initialOptionsPart: v
54
54
  });
55
- const r = o.getState().cogsStateStore[I] || f[I], S = a?.modifyState ? a.modifyState(r) : r, [D, O] = Lt(
55
+ const r = o.getState().cogsStateStore[I] || f[I], S = a?.modifyState ? a.modifyState(r) : r, [W, O] = Lt(
56
56
  S,
57
57
  {
58
58
  stateKey: I,
@@ -193,8 +193,8 @@ function Lt(t, {
193
193
  dependencies: r,
194
194
  serverState: S
195
195
  } = {}) {
196
- const [D, O] = K({}), { sessionId: R } = $t();
197
- let W = !c;
196
+ const [W, O] = K({}), { sessionId: R } = $t();
197
+ let G = !c;
198
198
  const [m] = K(c ?? yt()), l = o.getState().stateLog[m], ot = q(/* @__PURE__ */ new Set()), Y = q(I ?? yt()), j = q(
199
199
  null
200
200
  );
@@ -238,7 +238,7 @@ function Lt(t, {
238
238
  S?.data,
239
239
  ...r || []
240
240
  ]), it(() => {
241
- W && pt(m, {
241
+ G && pt(m, {
242
242
  serverSync: h,
243
243
  formElements: v,
244
244
  initialState: a,
@@ -363,7 +363,7 @@ function Lt(t, {
363
363
  const T = n.slice(0, -1), _ = z(E, T);
364
364
  return N === n.length - 1 && ["insert", "cut"].includes(s.updateType) ? (_.length - 1).toString() : M;
365
365
  });
366
- const { oldValue: V, newValue: G } = Gt(
366
+ const { oldValue: V, newValue: D } = Gt(
367
367
  s.updateType,
368
368
  u,
369
369
  E,
@@ -375,7 +375,7 @@ function Lt(t, {
375
375
  updateType: s.updateType,
376
376
  status: "new",
377
377
  oldValue: V,
378
- newValue: G
378
+ newValue: D
379
379
  };
380
380
  switch (s.updateType) {
381
381
  case "update":
@@ -383,7 +383,7 @@ function Lt(t, {
383
383
  break;
384
384
  case "insert":
385
385
  const M = n.slice(0, -1);
386
- g.insertShadowArrayElement(m, M);
386
+ g.insertShadowArrayElement(m, M, D);
387
387
  break;
388
388
  case "cut":
389
389
  const N = n.slice(0, -1), T = parseInt(n[n.length - 1]);
@@ -450,8 +450,8 @@ function lt(t, c, h, f) {
450
450
  r?.key && H(r?.key), y?.validationKey && H(y.validationKey);
451
451
  const S = o.getState().initialStateGlobal[t];
452
452
  o.getState().clearSelectedIndexesForState(t), v.clear(), k++;
453
- const D = a(S, []), O = Q(t), R = J(O?.localStorage?.key) ? O?.localStorage?.key(S) : O?.localStorage?.key, W = `${f}-${t}-${R}`;
454
- W && localStorage.removeItem(W), ct(t, D), Z(t, S);
453
+ const W = a(S, []), O = Q(t), R = J(O?.localStorage?.key) ? O?.localStorage?.key(S) : O?.localStorage?.key, G = `${f}-${t}-${R}`;
454
+ G && localStorage.removeItem(G), ct(t, W), Z(t, S);
455
455
  const m = o.getState().stateComponents.get(t);
456
456
  return m && m.components.forEach((l) => {
457
457
  l.forceUpdate();
@@ -464,15 +464,15 @@ function lt(t, c, h, f) {
464
464
  c,
465
465
  h,
466
466
  f
467
- ), S = o.getState().initialStateGlobal[t], D = Q(t), O = J(D?.localStorage?.key) ? D?.localStorage?.key(S) : D?.localStorage?.key, R = `${f}-${t}-${O}`;
467
+ ), S = o.getState().initialStateGlobal[t], W = Q(t), O = J(W?.localStorage?.key) ? W?.localStorage?.key(S) : W?.localStorage?.key, R = `${f}-${t}-${O}`;
468
468
  return localStorage.getItem(R) && localStorage.removeItem(R), Vt(() => {
469
469
  vt(t, y), o.getState().initializeShadowState(t, y), ct(t, r), Z(t, y);
470
- const W = o.getState().stateComponents.get(t);
471
- W && W.components.forEach((m) => {
470
+ const G = o.getState().stateComponents.get(t);
471
+ G && G.components.forEach((m) => {
472
472
  m.forceUpdate();
473
473
  });
474
474
  }), {
475
- fetchId: (W) => r.get()[W]
475
+ fetchId: (G) => r.get()[G]
476
476
  };
477
477
  },
478
478
  _initialState: o.getState().initialStateGlobal[t],
@@ -484,8 +484,8 @@ function lt(t, c, h, f) {
484
484
  }
485
485
  };
486
486
  function a(y, r = [], S) {
487
- const D = r.map(String).join(".");
488
- v.get(D);
487
+ const W = r.map(String).join(".");
488
+ v.get(W);
489
489
  const O = function() {
490
490
  return o().getNestedState(t, r);
491
491
  };
@@ -629,7 +629,7 @@ function lt(t, c, h, f) {
629
629
  const w = q(i), $ = q(0), x = q(!0), C = o().getNestedState(
630
630
  t,
631
631
  r
632
- ), V = C.length, G = Tt(() => {
632
+ ), V = C.length, D = Tt(() => {
633
633
  const T = Math.max(0, u.startIndex), _ = Math.min(V, u.endIndex), A = Array.from(
634
634
  { length: _ - T },
635
635
  (b, U) => T + U
@@ -702,7 +702,7 @@ function lt(t, c, h, f) {
702
702
  }
703
703
  };
704
704
  return {
705
- virtualState: G,
705
+ virtualState: D,
706
706
  virtualizerProps: N,
707
707
  scrollToBottom: B,
708
708
  scrollToIndex: M
@@ -741,13 +741,13 @@ function lt(t, c, h, f) {
741
741
  register: () => {
742
742
  const [, x] = K({}), C = `${h}-${r.join(".")}-${i}`;
743
743
  it(() => {
744
- const V = `${t}////${C}`, G = o.getState().stateComponents.get(t) || {
744
+ const V = `${t}////${C}`, D = o.getState().stateComponents.get(t) || {
745
745
  components: /* @__PURE__ */ new Map()
746
746
  };
747
- return G.components.set(V, {
747
+ return D.components.set(V, {
748
748
  forceUpdate: () => x({}),
749
749
  paths: /* @__PURE__ */ new Set([E.join(".")])
750
- }), o.getState().stateComponents.set(t, G), () => {
750
+ }), o.getState().stateComponents.set(t, D), () => {
751
751
  const B = o.getState().stateComponents.get(t);
752
752
  B && B.components.delete(V);
753
753
  };
@@ -987,8 +987,8 @@ function lt(t, c, h, f) {
987
987
  }
988
988
  let V = C.lastIndexOf(".");
989
989
  for (; V !== -1; ) {
990
- const G = C.substring(0, V);
991
- if (w.paths.has(G)) {
990
+ const D = C.substring(0, V);
991
+ if (w.paths.has(D)) {
992
992
  $ = !0;
993
993
  break;
994
994
  }
@@ -996,9 +996,9 @@ function lt(t, c, h, f) {
996
996
  V + 1
997
997
  );
998
998
  if (!isNaN(Number(B))) {
999
- const M = G.lastIndexOf(".");
999
+ const M = D.lastIndexOf(".");
1000
1000
  if (M !== -1) {
1001
- const N = G.substring(
1001
+ const N = D.substring(
1002
1002
  0,
1003
1003
  M
1004
1004
  );
@@ -1008,7 +1008,7 @@ function lt(t, c, h, f) {
1008
1008
  }
1009
1009
  }
1010
1010
  }
1011
- V = G.lastIndexOf(".");
1011
+ V = D.lastIndexOf(".");
1012
1012
  }
1013
1013
  if ($) break;
1014
1014
  }
@@ -1110,11 +1110,11 @@ function lt(t, c, h, f) {
1110
1110
  const j = [...r, l], tt = o.getState().getNestedState(t, j);
1111
1111
  return a(tt, j, S);
1112
1112
  }
1113
- }, W = new Proxy(O, R);
1114
- return v.set(D, {
1115
- proxy: W,
1113
+ }, G = new Proxy(O, R);
1114
+ return v.set(W, {
1115
+ proxy: G,
1116
1116
  stateVersion: k
1117
- }), W;
1117
+ }), G;
1118
1118
  }
1119
1119
  return a(
1120
1120
  o.getState().getNestedState(t, [])
@@ -1166,8 +1166,8 @@ function Bt({
1166
1166
  else
1167
1167
  S = r;
1168
1168
  S !== null && typeof S == "object" && (S = JSON.stringify(S));
1169
- const D = document.createTextNode(String(S));
1170
- f.replaceWith(D);
1169
+ const W = document.createTextNode(String(S));
1170
+ f.replaceWith(W);
1171
1171
  }, [t._stateKey, t._path.join("."), t._effect]), rt("span", {
1172
1172
  ref: c,
1173
1173
  style: { display: "none" },