@solidjs/signals 2.0.0-beta.16 → 2.0.0-beta.17

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/prod.js CHANGED
@@ -12,6 +12,9 @@ class StatusError extends Error {
12
12
  this.source = e;
13
13
  }
14
14
  }
15
+ function unwrapStatusError(e) {
16
+ return e instanceof StatusError ? e.cause : e;
17
+ }
15
18
  class NoOwnerError extends Error {
16
19
  constructor() {
17
20
  super("");
@@ -76,20 +79,20 @@ function getOrCreateLane(e) {
76
79
  }
77
80
  const n = e.t;
78
81
  const i = n?.i ? findLane(n.i) : null;
79
- t = { o: e, u: new Set(), l: [[], []], S: null, T: activeTransition, _: i };
82
+ t = { o: e, u: new Set(), l: [[], []], T: null, S: activeTransition, _: i };
80
83
  signalLanes.set(e, t);
81
84
  activeLanes.add(t);
82
85
  return t;
83
86
  }
84
87
  function findLane(e) {
85
- while (e.S) e = e.S;
88
+ while (e.T) e = e.T;
86
89
  return e;
87
90
  }
88
91
  function mergeLanes(e, t) {
89
92
  e = findLane(e);
90
93
  t = findLane(t);
91
94
  if (e === t) return e;
92
- t.S = e;
95
+ t.T = e;
93
96
  for (const n of t.u) e.u.add(n);
94
97
  t.u.clear();
95
98
  e.l[0].push(...t.l[0]);
@@ -107,7 +110,7 @@ function resolveLane(e) {
107
110
  return undefined;
108
111
  }
109
112
  function resolveTransition(e) {
110
- return resolveLane(e)?.T ?? e.T;
113
+ return resolveLane(e)?.S ?? e.S;
111
114
  }
112
115
  function hasActiveOverride(e) {
113
116
  return !!(e.O !== undefined && e.O !== NOT_PENDING);
@@ -116,7 +119,7 @@ function assignOrMergeLane(e, t) {
116
119
  const n = findLane(t);
117
120
  const i = e.i;
118
121
  if (i) {
119
- if (i.S) {
122
+ if (i.T) {
120
123
  e.i = t;
121
124
  return;
122
125
  }
@@ -134,8 +137,8 @@ function assignOrMergeLane(e, t) {
134
137
  e.i = t;
135
138
  }
136
139
  const transitions = new Set();
137
- const dirtyQueue = { p: new Array(2e3).fill(undefined), R: false, I: 0, h: 0 };
138
- const zombieQueue = { p: new Array(2e3).fill(undefined), R: false, I: 0, h: 0 };
140
+ const dirtyQueue = { R: new Array(2e3).fill(undefined), p: false, I: 0, h: 0 };
141
+ const zombieQueue = { R: new Array(2e3).fill(undefined), p: false, I: 0, h: 0 };
139
142
  let clock = 0;
140
143
  let activeTransition = null;
141
144
  let scheduled = false;
@@ -177,7 +180,7 @@ function shouldReadStashedOptimisticValue(e) {
177
180
  }
178
181
  function runLaneEffects(e) {
179
182
  for (const t of activeLanes) {
180
- if (t.S || t.u.size > 0) continue;
183
+ if (t.T || t.u.size > 0) continue;
181
184
  const n = t.l[e - 1];
182
185
  if (n.length) {
183
186
  t.l[e - 1] = [];
@@ -207,7 +210,7 @@ function setProjectionWriteActive(e) {
207
210
  function mergeTransitionState(e, t) {
208
211
  t.M = e;
209
212
  e.j.push(...t.j);
210
- for (const n of activeLanes) if (n.T === t) n.T = e;
213
+ for (const n of activeLanes) if (n.S === t) n.S = e;
211
214
  e.N.push(...t.N);
212
215
  for (const n of t.C) e.C.add(n);
213
216
  for (const [n, i] of t.$) {
@@ -226,7 +229,7 @@ function resolveOptimisticNodes(e) {
226
229
  const i = t.O;
227
230
  t.O = NOT_PENDING;
228
231
  if (i !== NOT_PENDING && t.Z !== i) insertSubs(t, true);
229
- t.T = null;
232
+ t.S = null;
230
233
  }
231
234
  for (let n = 0; n < t; n++) {
232
235
  const t = e[n];
@@ -238,9 +241,9 @@ function resolveOptimisticNodes(e) {
238
241
  }
239
242
  function cleanupCompletedLanes(e) {
240
243
  for (const t of activeLanes) {
241
- const n = e ? t.T === e : !t.T;
244
+ const n = e ? t.S === e : !t.S;
242
245
  if (!n) continue;
243
- if (!t.S) {
246
+ if (!t.T) {
244
247
  if (t.l[0].length) runQueue(t.l[0], EFFECT_RENDER);
245
248
  if (t.l[1].length) runQueue(t.l[1], EFFECT_USER);
246
249
  }
@@ -467,14 +470,14 @@ class GlobalQueue extends Queue {
467
470
  transitions.add(activeTransition);
468
471
  activeTransition.fe = clock;
469
472
  if (this.te !== null) {
470
- this.te.T = activeTransition;
473
+ this.te.S = activeTransition;
471
474
  activeTransition.ne.push(this.te);
472
475
  this.te = null;
473
476
  }
474
477
  if (this.ne !== activeTransition.ne) {
475
478
  for (let e = 0; e < this.ne.length; e++) {
476
479
  const t = this.ne[e];
477
- t.T = activeTransition;
480
+ t.S = activeTransition;
478
481
  activeTransition.ne.push(t);
479
482
  }
480
483
  this.ne = activeTransition.ne;
@@ -482,13 +485,13 @@ class GlobalQueue extends Queue {
482
485
  if (this.N !== activeTransition.N) {
483
486
  for (let e = 0; e < this.N.length; e++) {
484
487
  const t = this.N[e];
485
- t.T = activeTransition;
488
+ t.S = activeTransition;
486
489
  activeTransition.N.push(t);
487
490
  }
488
491
  this.N = activeTransition.N;
489
492
  }
490
493
  for (const e of activeLanes) {
491
- if (!e.T) e.T = activeTransition;
494
+ if (!e.S) e.S = activeTransition;
492
495
  }
493
496
  if (this.C !== activeTransition.C) {
494
497
  for (const e of this.C) activeTransition.C.add(e);
@@ -556,7 +559,7 @@ function commitPendingNode(e) {
556
559
  }
557
560
  t.W &= ~REACTIVE_MANUAL_WRITE;
558
561
  if (!(t.Y & STATUS_PENDING)) t.Y &= ~STATUS_UNINITIALIZED;
559
- if (t.de !== null || t.Se !== null) GlobalQueue.re(t, false, true);
562
+ if (t.de !== null || t.Te !== null) GlobalQueue.re(t, false, true);
560
563
  if (e.B || e.q) snapCompanionsToState(e);
561
564
  }
562
565
  function commitPendingNodes() {
@@ -619,7 +622,7 @@ function trackOptimisticStore(e) {
619
622
  }
620
623
  function reassignPendingTransition(e) {
621
624
  for (let t = 0; t < e.length; t++) {
622
- e[t].T = activeTransition;
625
+ e[t].S = activeTransition;
623
626
  }
624
627
  }
625
628
  const globalQueue = new GlobalQueue();
@@ -649,9 +652,9 @@ function runQueue(e, t) {
649
652
  }
650
653
  function reporterBlocksSource(e, t) {
651
654
  if (e.W & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
652
- if (e.Te === t || e._e?.has(t)) return true;
653
- for (let n = e.Oe; n; n = n.pe) {
654
- let e = n.Re;
655
+ if (e.Se === t || e._e?.has(t)) return true;
656
+ for (let n = e.Oe; n; n = n.Re) {
657
+ let e = n.pe;
655
658
  while (e) {
656
659
  if (e === t || e.Ie === t) return true;
657
660
  e = e.t;
@@ -715,8 +718,8 @@ function actualInsertIntoHeap(e, t) {
715
718
  const n = (e.J?.he ? e.J.Ae?.H : e.J?.H) ?? -1;
716
719
  if (n >= e.H) e.H = n + 1;
717
720
  const i = e.H;
718
- const r = t.p[i];
719
- if (r === undefined) t.p[i] = e;
721
+ const r = t.R[i];
722
+ if (r === undefined) t.R[i] = e;
720
723
  else {
721
724
  const t = r.Ne;
722
725
  t.Ce = e;
@@ -748,12 +751,12 @@ function deleteFromHeap(e, t) {
748
751
  if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
749
752
  e.W = n & -25;
750
753
  const i = e.H;
751
- if (e.Ne === e) t.p[i] = undefined;
754
+ if (e.Ne === e) t.R[i] = undefined;
752
755
  else {
753
756
  const n = e.Ce;
754
- const r = t.p[i];
757
+ const r = t.R[i];
755
758
  const o = n ?? r;
756
- if (e === r) t.p[i] = n;
759
+ if (e === r) t.R[i] = n;
757
760
  else e.Ne.Ce = n;
758
761
  o.Ne = e.Ne;
759
762
  }
@@ -761,10 +764,10 @@ function deleteFromHeap(e, t) {
761
764
  e.Ce = undefined;
762
765
  }
763
766
  function markHeap(e) {
764
- if (e.R) return;
765
- e.R = true;
767
+ if (e.p) return;
768
+ e.p = true;
766
769
  for (let t = 0; t <= e.h; t++) {
767
- for (let n = e.p[t]; n !== undefined; n = n.Ce) {
770
+ for (let n = e.R[t]; n !== undefined; n = n.Ce) {
768
771
  if (n.W & REACTIVE_IN_HEAP) markNode(n);
769
772
  }
770
773
  }
@@ -785,13 +788,13 @@ function markNode(e, t = REACTIVE_DIRTY) {
785
788
  }
786
789
  }
787
790
  function runHeap(e, t) {
788
- e.R = false;
791
+ e.p = false;
789
792
  for (e.I = 0; e.I <= e.h; e.I++) {
790
- let n = e.p[e.I];
793
+ let n = e.R[e.I];
791
794
  while (n !== undefined) {
792
795
  if (n.W & REACTIVE_IN_HEAP) t(n);
793
796
  else adjustHeight(n, e);
794
- n = e.p[e.I];
797
+ n = e.R[e.I];
795
798
  }
796
799
  }
797
800
  e.h = 0;
@@ -799,8 +802,8 @@ function runHeap(e, t) {
799
802
  function adjustHeight(e, t) {
800
803
  deleteFromHeap(e, t);
801
804
  let n = e.H;
802
- for (let t = e.Oe; t; t = t.pe) {
803
- const e = t.Re;
805
+ for (let t = e.Oe; t; t = t.Re) {
806
+ const e = t.pe;
804
807
  const i = e.Ie || e;
805
808
  if (i.ce && i.H >= n) n = i.H + 1;
806
809
  }
@@ -882,7 +885,7 @@ function disposeChildren(e, t = false, n) {
882
885
  }
883
886
  }
884
887
  function runDisposal(e, t) {
885
- let n = t ? e.Se : e.Ue;
888
+ let n = t ? e.Te : e.Ue;
886
889
  if (!n) return;
887
890
  if (Array.isArray(n)) {
888
891
  for (let e = 0; e < n.length; e++) {
@@ -892,7 +895,7 @@ function runDisposal(e, t) {
892
895
  } else {
893
896
  n.call(n);
894
897
  }
895
- t ? (e.Se = null) : (e.Ue = null);
898
+ t ? (e.Te = null) : (e.Ue = null);
896
899
  }
897
900
  function childId(e, t) {
898
901
  let n = e;
@@ -946,7 +949,7 @@ function createOwner(e) {
946
949
  F: t?.F ?? globalQueue,
947
950
  Ve: t?.Ve || defaultContext,
948
951
  ve: 0,
949
- Se: null,
952
+ Te: null,
950
953
  de: null,
951
954
  J: t,
952
955
  dispose: disposeRootSelf
@@ -968,8 +971,8 @@ function createRoot(e, t) {
968
971
  return runWithOwner(n, () => e(() => n.dispose()));
969
972
  }
970
973
  function unlinkSubs(e) {
971
- const t = e.Re;
972
- const n = e.pe;
974
+ const t = e.pe;
975
+ const n = e.Re;
973
976
  const i = e.L;
974
977
  const r = e.Ge;
975
978
  if (i !== null) i.Ge = r;
@@ -987,12 +990,12 @@ function unlinkSubs(e) {
987
990
  }
988
991
  function trimStaleDeps(e) {
989
992
  const t = e.me;
990
- let n = t !== null ? t.pe : e.Oe;
993
+ let n = t !== null ? t.Re : e.Oe;
991
994
  if (n !== null) {
992
995
  do {
993
996
  n = unlinkSubs(n);
994
997
  } while (n !== null);
995
- if (t !== null) t.pe = null;
998
+ if (t !== null) t.Re = null;
996
999
  else e.Oe = null;
997
1000
  }
998
1001
  }
@@ -1008,15 +1011,15 @@ function unobserved(e) {
1008
1011
  }
1009
1012
  function link(e, t, n = false) {
1010
1013
  const i = t.me;
1011
- if (i !== null && i.Re === e) {
1014
+ if (i !== null && i.pe === e) {
1012
1015
  i.ke = n;
1013
1016
  return;
1014
1017
  }
1015
1018
  let r = null;
1016
1019
  const o = t.W & REACTIVE_RECOMPUTING_DEPS;
1017
1020
  if (o) {
1018
- r = i !== null ? i.pe : t.Oe;
1019
- if (r !== null && r.Re === e) {
1021
+ r = i !== null ? i.Re : t.Oe;
1022
+ if (r !== null && r.pe === e) {
1020
1023
  r.We = t.He;
1021
1024
  t.me = r;
1022
1025
  r.ke = n;
@@ -1028,35 +1031,35 @@ function link(e, t, n = false) {
1028
1031
  s.ke = n;
1029
1032
  return;
1030
1033
  }
1031
- const u = (t.me = e.Fe = { Re: e, U: t, pe: r, Ge: s, L: null, We: t.He, ke: n });
1032
- if (i !== null) i.pe = u;
1034
+ const u = (t.me = e.Fe = { pe: e, U: t, Re: r, Ge: s, L: null, We: t.He, ke: n });
1035
+ if (i !== null) i.Re = u;
1033
1036
  else t.Oe = u;
1034
1037
  if (s !== null) s.L = u;
1035
1038
  else e.P = u;
1036
1039
  }
1037
1040
  function addPendingSource(e, t) {
1038
- if (e.Te === t || e._e?.has(t)) return false;
1039
- if (!e.Te) {
1040
- e.Te = t;
1041
+ if (e.Se === t || e._e?.has(t)) return false;
1042
+ if (!e.Se) {
1043
+ e.Se = t;
1041
1044
  return true;
1042
1045
  }
1043
1046
  if (!e._e) {
1044
- e._e = new Set([e.Te, t]);
1047
+ e._e = new Set([e.Se, t]);
1045
1048
  } else {
1046
1049
  e._e.add(t);
1047
1050
  }
1048
- e.Te = undefined;
1051
+ e.Se = undefined;
1049
1052
  return true;
1050
1053
  }
1051
1054
  function removePendingSource(e, t) {
1052
- if (e.Te) {
1053
- if (e.Te !== t) return false;
1054
- e.Te = undefined;
1055
+ if (e.Se) {
1056
+ if (e.Se !== t) return false;
1057
+ e.Se = undefined;
1055
1058
  return true;
1056
1059
  }
1057
1060
  if (!e._e?.delete(t)) return false;
1058
1061
  if (e._e.size === 1) {
1059
- e.Te = e._e.values().next().value;
1062
+ e.Se = e._e.values().next().value;
1060
1063
  e._e = undefined;
1061
1064
  } else if (e._e.size === 0) {
1062
1065
  e._e = undefined;
@@ -1064,7 +1067,7 @@ function removePendingSource(e, t) {
1064
1067
  return true;
1065
1068
  }
1066
1069
  function clearPendingSources(e) {
1067
- e.Te = undefined;
1070
+ e.Se = undefined;
1068
1071
  e._e?.clear();
1069
1072
  e._e = undefined;
1070
1073
  }
@@ -1108,7 +1111,7 @@ function settlePendingSource(e) {
1108
1111
  if (n.has(i) || !removePendingSource(i, e)) return;
1109
1112
  n.add(i);
1110
1113
  i.fe = clock;
1111
- const r = i.Te ?? i._e?.values().next().value;
1114
+ const r = i.Se ?? i._e?.values().next().value;
1112
1115
  if (r) {
1113
1116
  setPendingError(i, r);
1114
1117
  updatePendingSignal(i);
@@ -1227,6 +1230,7 @@ function handleAsync(e, t, n) {
1227
1230
  const n = t[Symbol.asyncIterator]();
1228
1231
  let i = false;
1229
1232
  let r = false;
1233
+ let s = true;
1230
1234
  cleanup(() => {
1231
1235
  if (r) return;
1232
1236
  r = true;
@@ -1236,41 +1240,59 @@ function handleAsync(e, t, n) {
1236
1240
  } catch {}
1237
1241
  });
1238
1242
  const iterate = () => {
1239
- let s,
1240
- u = false,
1241
- c = true;
1243
+ let u,
1244
+ c,
1245
+ l = false,
1246
+ a = false,
1247
+ f = true;
1242
1248
  n.next().then(
1243
1249
  n => {
1244
- if (c) {
1245
- s = n;
1246
- u = true;
1250
+ if (f) {
1251
+ u = n;
1252
+ l = true;
1247
1253
  if (n.done) r = true;
1248
1254
  } else if (e.be !== t) {
1249
1255
  return;
1250
- } else if (!n.done) asyncWrite(n.value, iterate);
1251
- else {
1256
+ } else if (!n.done) {
1257
+ i = true;
1258
+ asyncWrite(n.value, iterate);
1259
+ } else {
1252
1260
  r = true;
1253
- schedule();
1254
- flush();
1261
+ if (i) {
1262
+ schedule();
1263
+ flush();
1264
+ } else {
1265
+ asyncWrite(undefined);
1266
+ }
1255
1267
  }
1256
1268
  },
1257
1269
  n => {
1258
- if (!c && e.be === t) {
1270
+ if (f) {
1271
+ c = n;
1272
+ a = true;
1273
+ } else if (e.be === t) {
1259
1274
  r = true;
1260
1275
  handleError(n);
1261
1276
  }
1262
1277
  }
1263
1278
  );
1264
- c = false;
1265
- if (u && !s.done) {
1266
- o = s.value;
1279
+ f = false;
1280
+ if (a) {
1281
+ r = true;
1282
+ handleError(c);
1283
+ if (s) throw c;
1284
+ return true;
1285
+ }
1286
+ if (l && !u.done) {
1287
+ o = u.value;
1267
1288
  i = true;
1268
1289
  return iterate();
1269
1290
  }
1270
- return u && s.done;
1291
+ return l && u.done;
1271
1292
  };
1272
- const s = iterate();
1273
- if (!i && !s) {
1293
+ const u = iterate();
1294
+ s = false;
1295
+ if (!i && !u) {
1274
1296
  globalQueue.initTransition(resolveTransition(e));
1275
1297
  throw new NotReadyError(context);
1276
1298
  }
@@ -1278,7 +1300,7 @@ function handleAsync(e, t, n) {
1278
1300
  return o;
1279
1301
  }
1280
1302
  function clearStatus(e, t = false) {
1281
- if (e.Te || e._e) clearPendingSources(e);
1303
+ if (e.Se || e._e) clearPendingSources(e);
1282
1304
  if (e.Me) e.Me = false;
1283
1305
  e.Y = t ? 0 : e.Y & STATUS_UNINITIALIZED;
1284
1306
  if (e.ae) setPendingError(e);
@@ -1325,15 +1347,15 @@ function notifyStatus(e, t, n, i, r) {
1325
1347
  forEachDependent(e, (e, i) => {
1326
1348
  e.fe = clock;
1327
1349
  if (
1328
- (t === STATUS_PENDING && o && e.Te !== o && !e._e?.has(o)) ||
1329
- (t !== STATUS_PENDING && (e.ae !== n || e.Te || e._e))
1350
+ (t === STATUS_PENDING && o && e.Se !== o && !e._e?.has(o)) ||
1351
+ (t !== STATUS_PENDING && (e.ae !== n || e.Se || e._e))
1330
1352
  ) {
1331
1353
  if (i.ke && t !== STATUS_PENDING && !(n instanceof NotReadyError)) {
1332
1354
  enqueueForRerun(e);
1333
1355
  schedule();
1334
1356
  return;
1335
1357
  }
1336
- if (!l && !e.T) queuePendingNode(e);
1358
+ if (!l && !e.S) queuePendingNode(e);
1337
1359
  notifyStatus(e, t, n, l, a);
1338
1360
  }
1339
1361
  });
@@ -1425,14 +1447,14 @@ function clearSnapshots() {
1425
1447
  function recompute(e, t = false) {
1426
1448
  const n = e.V;
1427
1449
  if (!t) {
1428
- if (e.T && (!n || activeTransition) && activeTransition !== e.T)
1429
- globalQueue.initTransition(e.T);
1450
+ if (e.S && (!n || activeTransition) && activeTransition !== e.S)
1451
+ globalQueue.initTransition(e.S);
1430
1452
  deleteFromHeap(e, e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1431
1453
  e.be = null;
1432
- if (e.T || n === EFFECT_TRACKED) disposeChildren(e);
1454
+ if (e.S || n === EFFECT_TRACKED) disposeChildren(e);
1433
1455
  else if (e.ge !== null || e.Ue !== null) {
1434
1456
  markDisposal(e);
1435
- e.Se = e.Ue;
1457
+ e.Te = e.Ue;
1436
1458
  e.de = e.ge;
1437
1459
  e.Ue = null;
1438
1460
  e.ge = null;
@@ -1458,8 +1480,8 @@ function recompute(e, t = false) {
1458
1480
  const t = resolveLane(e);
1459
1481
  if (t) currentOptimisticLane = t;
1460
1482
  } else if (activeTransition && !t && activeTransition.N.length) {
1461
- for (let t = e.Oe; t; t = t.pe) {
1462
- const n = t.Re;
1483
+ for (let t = e.Oe; t; t = t.Re) {
1484
+ const n = t.pe;
1463
1485
  if (n.W & REACTIVE_OPTIMISTIC_DIRTY) {
1464
1486
  const t = resolveLane(n);
1465
1487
  if (t) {
@@ -1534,7 +1556,7 @@ function recompute(e, t = false) {
1534
1556
  if (e.ae);
1535
1557
  else if (l) {
1536
1558
  const o = r ? e.O : undefined;
1537
- if (t || (n && activeTransition !== e.T) || i) {
1559
+ if (t || (n && activeTransition !== e.S) || i) {
1538
1560
  e.Z = u;
1539
1561
  if (r && i) {
1540
1562
  e.O = u;
@@ -1542,7 +1564,7 @@ function recompute(e, t = false) {
1542
1564
  }
1543
1565
  } else {
1544
1566
  e.D = u;
1545
- if (activeTransition || e.T) syncCompanions(e, u);
1567
+ if (activeTransition || e.S) syncCompanions(e, u);
1546
1568
  }
1547
1569
  if (!r || i || e.O !== o) insertSubs(e, i || r);
1548
1570
  } else if (r) {
@@ -1558,15 +1580,15 @@ function recompute(e, t = false) {
1558
1580
  const d =
1559
1581
  e.D !== NOT_PENDING ||
1560
1582
  e.de !== null ||
1561
- e.Se !== null ||
1583
+ e.Te !== null ||
1562
1584
  !!(e.Y & (STATUS_PENDING | STATUS_UNINITIALIZED));
1563
- d && (!t || e.Y & STATUS_PENDING) && (!e.T || r) && queuePendingNode(e);
1564
- e.T && n && activeTransition !== e.T && runInTransition(e.T, () => recompute(e));
1585
+ d && (!t || e.Y & STATUS_PENDING) && (!e.S || r) && queuePendingNode(e);
1586
+ e.S && n && activeTransition !== e.S && runInTransition(e.S, () => recompute(e));
1565
1587
  }
1566
1588
  function updateIfNecessary(e) {
1567
1589
  if (e.W & REACTIVE_CHECK) {
1568
- for (let t = e.Oe; t; t = t.pe) {
1569
- const n = t.Re;
1590
+ for (let t = e.Oe; t; t = t.Re) {
1591
+ const n = t.pe;
1570
1592
  const i = n.Ie || n;
1571
1593
  if (i.ce) {
1572
1594
  updateIfNecessary(i);
@@ -1617,10 +1639,10 @@ function computed(e, t) {
1617
1639
  Y: STATUS_UNINITIALIZED,
1618
1640
  fe: clock,
1619
1641
  D: NOT_PENDING,
1620
- Se: null,
1642
+ Te: null,
1621
1643
  de: null,
1622
1644
  be: null,
1623
- T: null
1645
+ S: null
1624
1646
  };
1625
1647
  setupComputedNode(i, t);
1626
1648
  return i;
@@ -1659,10 +1681,10 @@ function createEffectNode(e, t, n, i, r, o) {
1659
1681
  Y: STATUS_UNINITIALIZED,
1660
1682
  fe: clock,
1661
1683
  D: NOT_PENDING,
1662
- Se: null,
1684
+ Te: null,
1663
1685
  de: null,
1664
1686
  be: null,
1665
- T: null,
1687
+ S: null,
1666
1688
  G: false,
1667
1689
  Ye: undefined,
1668
1690
  Ze: t,
@@ -1835,7 +1857,7 @@ function read(e) {
1835
1857
  }
1836
1858
  }
1837
1859
  if (r.Y & STATUS_PENDING) {
1838
- if (t && !(stale && r.T && activeTransition !== r.T)) {
1860
+ if (t && !(stale && r.S && activeTransition !== r.S)) {
1839
1861
  if (currentOptimisticLane) {
1840
1862
  const n = r.i;
1841
1863
  const i = findLane(currentOptimisticLane);
@@ -1890,7 +1912,7 @@ function read(e) {
1890
1912
  (currentOptimisticLane !== null &&
1891
1913
  (e.O !== undefined || e.i || (r === e && stale && t.t !== e) || !!(r.Y & STATUS_PENDING))) ||
1892
1914
  e.D === NOT_PENDING ||
1893
- (stale && e.T && activeTransition !== e.T)
1915
+ (stale && e.S && activeTransition !== e.S)
1894
1916
  ? e.Z
1895
1917
  : e.D;
1896
1918
  if (pendingCheckActive && pendingProbe !== null && e.D !== NOT_PENDING && o === e.D)
@@ -1908,7 +1930,7 @@ function read(e) {
1908
1930
  return o;
1909
1931
  }
1910
1932
  function setSignal(e, t) {
1911
- if (e.T && activeTransition !== e.T) globalQueue.initTransition(e.T);
1933
+ if (e.S && activeTransition !== e.S) globalQueue.initTransition(e.S);
1912
1934
  const n = e.O !== undefined && !projectionWriteActive;
1913
1935
  const i = e.O !== undefined && e.O !== NOT_PENDING;
1914
1936
  const r = n ? (i ? e.O : e.Z) : e.D === NOT_PENDING ? e.Z : e.D;
@@ -2170,7 +2192,7 @@ function notifyEffectStatus(e, t) {
2170
2192
  function runEffect(e) {
2171
2193
  if (!e.G || e.W & REACTIVE_DISPOSED) return;
2172
2194
  if (e.Y & STATUS_ERROR && e.V === EFFECT_USER) {
2173
- const t = e.ae instanceof StatusError ? (e.ae.cause ?? e.ae) : e.ae;
2195
+ const t = unwrapStatusError(e.ae);
2174
2196
  e.Ye = e.Z;
2175
2197
  e.G = false;
2176
2198
  try {
@@ -2259,22 +2281,22 @@ function action(e) {
2259
2281
  globalQueue.initTransition();
2260
2282
  let o = activeTransition;
2261
2283
  o.j.push(r);
2262
- const done = (e, t) => {
2284
+ const done = (e, t, s = false) => {
2263
2285
  o = currentTransition(o);
2264
- const s = o.j.indexOf(r);
2265
- if (s >= 0) o.j.splice(s, 1);
2286
+ const u = o.j.indexOf(r);
2287
+ if (u >= 0) o.j.splice(u, 1);
2266
2288
  setActiveTransition(o);
2267
2289
  schedule();
2268
- t ? i(t) : n(e);
2290
+ s ? i(t) : n(e);
2269
2291
  };
2270
2292
  const step = (e, t) => {
2271
2293
  let n;
2272
2294
  try {
2273
2295
  n = t ? r.throw(e) : r.next(e);
2274
2296
  } catch (e) {
2275
- return done(undefined, e);
2297
+ return done(undefined, e, true);
2276
2298
  }
2277
- if (isThenable(n)) return void n.then(run, e => done(undefined, e));
2299
+ if (isThenable(n)) return void n.then(run, e => done(undefined, e, true));
2278
2300
  run(n);
2279
2301
  };
2280
2302
  const run = e => {
@@ -2322,11 +2344,17 @@ function createReaction(e, t) {
2322
2344
  let n = undefined;
2323
2345
  cleanup(() => n?.());
2324
2346
  const i = getOwner();
2325
- return r => {
2347
+ let r;
2348
+ return o => {
2349
+ if (r) {
2350
+ dispose(r);
2351
+ r = undefined;
2352
+ }
2326
2353
  runWithOwner(i, () => {
2327
2354
  effect(
2328
- () => (r(), getOwner()),
2355
+ () => (o(), (r = getOwner())),
2329
2356
  t => {
2357
+ r = undefined;
2330
2358
  n?.();
2331
2359
  const i = (e.effect || e)?.();
2332
2360
  if (false && i !== undefined && typeof i !== "function");
@@ -2483,18 +2511,18 @@ function applyStateFast(e, t, n) {
2483
2511
  let o = false;
2484
2512
  const s = i.length;
2485
2513
  if (e.length && s && isWrappable(e[0]) && n(e[0]) != null) {
2486
- let u, c, l, a, f, E, d, S;
2514
+ let u, c, l, a, f, E, d, T;
2487
2515
  for (l = 0, a = Math.min(s, e.length); l < a && keyedMatch((E = i[l]), e[l], n); l++) {
2488
2516
  isWrappable(E) && isWrappable(e[l]) && applyState(e[l], wrap(E, t), n);
2489
2517
  }
2490
- const T = new Array(e.length),
2518
+ const S = new Array(e.length),
2491
2519
  _ = new Map();
2492
2520
  for (
2493
2521
  a = s - 1, f = e.length - 1;
2494
2522
  a >= l && f >= l && keyedMatch((E = i[a]), e[f], n);
2495
2523
  a--, f--
2496
2524
  ) {
2497
- T[f] = E;
2525
+ S[f] = E;
2498
2526
  }
2499
2527
  if (l > f || l > a) {
2500
2528
  for (c = l; c <= f; c++) {
@@ -2503,7 +2531,7 @@ function applyStateFast(e, t, n) {
2503
2531
  }
2504
2532
  for (; c < e.length; c++) {
2505
2533
  o = true;
2506
- applyArrayItem(e[c], T[c], t, r?.[c], n);
2534
+ applyArrayItem(e[c], S[c], t, r?.[c], n);
2507
2535
  }
2508
2536
  syncArrayNodeMembership(t, e);
2509
2537
  (o || s !== e.length) && notifySelf(t);
@@ -2513,24 +2541,24 @@ function applyStateFast(e, t, n) {
2513
2541
  d = new Array(f + 1);
2514
2542
  for (c = f; c >= l; c--) {
2515
2543
  E = e[c];
2516
- S = itemKey(E, n);
2517
- u = _.get(S);
2544
+ T = itemKey(E, n);
2545
+ u = _.get(T);
2518
2546
  d[c] = u === undefined ? -1 : u;
2519
- _.set(S, c);
2547
+ _.set(T, c);
2520
2548
  }
2521
2549
  for (u = l; u <= a; u++) {
2522
2550
  E = i[u];
2523
- S = itemKey(E, n);
2524
- c = _.get(S);
2551
+ T = itemKey(E, n);
2552
+ c = _.get(T);
2525
2553
  if (c !== undefined && c !== -1) {
2526
- T[c] = E;
2554
+ S[c] = E;
2527
2555
  c = d[c];
2528
- _.set(S, c);
2556
+ _.set(T, c);
2529
2557
  }
2530
2558
  }
2531
2559
  for (c = l; c < e.length; c++) {
2532
- if (c in T) {
2533
- applyArrayItem(e[c], T[c], t, r?.[c], n);
2560
+ if (c in S) {
2561
+ applyArrayItem(e[c], S[c], t, r?.[c], n);
2534
2562
  } else r?.[c] && setSignal(r[c], wrapValue(e[c], t));
2535
2563
  }
2536
2564
  if (l < e.length) o = true;
@@ -2594,22 +2622,22 @@ function applyStateSlow(e, t, n) {
2594
2622
  let u = false;
2595
2623
  const c = getOverrideValue(i, r, "length", o);
2596
2624
  if (e.length && c && isWrappable(e[0]) && n(e[0]) != null) {
2597
- let l, a, f, E, d, S, T, _;
2625
+ let l, a, f, E, d, T, S, _;
2598
2626
  for (
2599
2627
  f = 0, E = Math.min(c, e.length);
2600
- f < E && keyedMatch((S = getOverrideValue(i, r, f, o)), e[f], n);
2628
+ f < E && keyedMatch((T = getOverrideValue(i, r, f, o)), e[f], n);
2601
2629
  f++
2602
2630
  ) {
2603
- isWrappable(S) && isWrappable(e[f]) && applyState(e[f], wrap(S, t), n);
2631
+ isWrappable(T) && isWrappable(e[f]) && applyState(e[f], wrap(T, t), n);
2604
2632
  }
2605
2633
  const O = new Array(e.length),
2606
- p = new Map();
2634
+ R = new Map();
2607
2635
  for (
2608
2636
  E = c - 1, d = e.length - 1;
2609
- E >= f && d >= f && keyedMatch((S = getOverrideValue(i, r, E, o)), e[d], n);
2637
+ E >= f && d >= f && keyedMatch((T = getOverrideValue(i, r, E, o)), e[d], n);
2610
2638
  E--, d--
2611
2639
  ) {
2612
- O[d] = S;
2640
+ O[d] = T;
2613
2641
  }
2614
2642
  if (f > d || f > E) {
2615
2643
  for (a = f; a <= d; a++) {
@@ -2626,22 +2654,22 @@ function applyStateSlow(e, t, n) {
2626
2654
  c !== i && s?.length && setSignal(s.length, i);
2627
2655
  return;
2628
2656
  }
2629
- T = new Array(d + 1);
2657
+ S = new Array(d + 1);
2630
2658
  for (a = d; a >= f; a--) {
2631
- S = e[a];
2632
- _ = itemKey(S, n);
2633
- l = p.get(_);
2634
- T[a] = l === undefined ? -1 : l;
2635
- p.set(_, a);
2659
+ T = e[a];
2660
+ _ = itemKey(T, n);
2661
+ l = R.get(_);
2662
+ S[a] = l === undefined ? -1 : l;
2663
+ R.set(_, a);
2636
2664
  }
2637
2665
  for (l = f; l <= E; l++) {
2638
- S = getOverrideValue(i, r, l, o);
2639
- _ = itemKey(S, n);
2640
- a = p.get(_);
2666
+ T = getOverrideValue(i, r, l, o);
2667
+ _ = itemKey(T, n);
2668
+ a = R.get(_);
2641
2669
  if (a !== undefined && a !== -1) {
2642
- O[a] = S;
2643
- a = T[a];
2644
- p.set(_, a);
2670
+ O[a] = T;
2671
+ a = S[a];
2672
+ R.set(_, a);
2645
2673
  }
2646
2674
  }
2647
2675
  for (a = f; a < e.length; a++) {
@@ -2958,10 +2986,17 @@ function getNode(e, t, n, i, r = isEqual, o, s) {
2958
2986
  return (e[t] = u);
2959
2987
  }
2960
2988
  function trackSelf(e, t = $TRACK) {
2961
- getObserver() &&
2962
- read(
2963
- getNode(getNodes(e, STORE_NODE), t, undefined, e[STORE_FIREWALL], false, e[STORE_OPTIMISTIC])
2964
- );
2989
+ if (!getObserver()) return;
2990
+ read(
2991
+ getNode(getNodes(e, STORE_NODE), t, undefined, e[STORE_FIREWALL], false, e[STORE_OPTIMISTIC])
2992
+ );
2993
+ if (
2994
+ t === $TRACK &&
2995
+ !e[STORE_OVERRIDE] &&
2996
+ !e[STORE_OPTIMISTIC_OVERRIDE] &&
2997
+ e[STORE_VALUE][$TARGET]
2998
+ )
2999
+ e[STORE_VALUE][$TRACK];
2965
3000
  }
2966
3001
  function notifySelf(e) {
2967
3002
  const t = e[STORE_NODE]?.[$TRACK];
@@ -3009,8 +3044,8 @@ function maskStoreTarget(e, t) {
3009
3044
  function prepareStoreWrite(e, t, n) {
3010
3045
  if (e[STORE_OPTIMISTIC]) {
3011
3046
  const t = e[STORE_FIREWALL];
3012
- if (t?.T) {
3013
- globalQueue.initTransition(t.T);
3047
+ if (t?.S) {
3048
+ globalQueue.initTransition(t.S);
3014
3049
  }
3015
3050
  }
3016
3051
  const i = e[STORE_VALUE];
@@ -3178,10 +3213,12 @@ const storeTraps = {
3178
3213
  const c = u ? u[t] : r;
3179
3214
  const l = u ? u[t] !== $DELETED : t in e[STORE_VALUE];
3180
3215
  const a = unwrapStoreValue(n);
3181
- const f = Array.isArray(s) && t !== "length" && typeof t !== "symbol";
3182
- const E = f ? parseInt(t) + 1 : 0;
3183
- const d = f && (getOverlayLayer(e, "length") ?? s).length;
3184
- const S = f && E > d ? E : undefined;
3216
+ const f = typeof t === "string" ? Number(t) : -1;
3217
+ const E =
3218
+ Array.isArray(s) && Number.isInteger(f) && f >= 0 && f < 4294967295 && String(f) === t;
3219
+ const d = E ? f + 1 : 0;
3220
+ const T = E && (getOverlayLayer(e, "length") ?? s).length;
3221
+ const S = E && d > T ? d : undefined;
3185
3222
  if (c === a && S === undefined) return true;
3186
3223
  armOptimisticStoreWrite(e, i);
3187
3224
  if (a !== undefined && a === r && S === undefined) delete e[o]?.[t];
@@ -3212,7 +3249,7 @@ const storeTraps = {
3212
3249
  if (t.length) {
3213
3250
  setSignal(t.length, S);
3214
3251
  } else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
3215
- const n = upsertStoreNode(e, t, "length", d, e[STORE_SNAPSHOT_PROPS]);
3252
+ const n = upsertStoreNode(e, t, "length", T, e[STORE_SNAPSHOT_PROPS]);
3216
3253
  setSignal(n, S);
3217
3254
  }
3218
3255
  }
@@ -3805,8 +3842,8 @@ function updateKeyedMap() {
3805
3842
  f,
3806
3843
  E = new Array(t),
3807
3844
  d = new Array(t),
3808
- S = this.ot ? new Array(t) : undefined,
3809
- T = this.st ? new Array(t) : undefined;
3845
+ T = this.ot ? new Array(t) : undefined,
3846
+ S = this.st ? new Array(t) : undefined;
3810
3847
  for (
3811
3848
  o = 0, s = Math.min(this.Xe, t);
3812
3849
  o < s && (this.et[o] === e[o] || (this.ot && compare(this.rt, this.et[o], e[o])));
@@ -3823,8 +3860,8 @@ function updateKeyedMap() {
3823
3860
  ) {
3824
3861
  E[u] = this.nt[s];
3825
3862
  d[u] = this.it[s];
3826
- S && (S[u] = this.ot[s]);
3827
- T && (T[u] = this.st[s]);
3863
+ T && (T[u] = this.ot[s]);
3864
+ S && (S[u] = this.st[s]);
3828
3865
  }
3829
3866
  a = new Map();
3830
3867
  f = new Array(u + 1);
@@ -3842,8 +3879,8 @@ function updateKeyedMap() {
3842
3879
  if (i !== undefined && i !== -1) {
3843
3880
  E[i] = this.nt[n];
3844
3881
  d[i] = this.it[n];
3845
- S && (S[i] = this.ot[n]);
3846
- T && (T[i] = this.st[n]);
3882
+ T && (T[i] = this.ot[n]);
3883
+ S && (S[i] = this.st[n]);
3847
3884
  i = f[i];
3848
3885
  a.set(l, i);
3849
3886
  } else this.it[n].dispose();
@@ -3852,12 +3889,12 @@ function updateKeyedMap() {
3852
3889
  if (i in E) {
3853
3890
  this.nt[i] = E[i];
3854
3891
  this.it[i] = d[i];
3855
- if (S) {
3856
- this.ot[i] = S[i];
3892
+ if (T) {
3893
+ this.ot[i] = T[i];
3857
3894
  setSignal(this.ot[i], e[i]);
3858
3895
  }
3859
- if (T) {
3860
- this.st[i] = T[i];
3896
+ if (S) {
3897
+ this.st[i] = S[i];
3861
3898
  setSignal(this.st[i], i);
3862
3899
  }
3863
3900
  } else {
@@ -3985,7 +4022,7 @@ function isRevealController(e) {
3985
4022
  return e instanceof RevealController;
3986
4023
  }
3987
4024
  function isSlotReady(e) {
3988
- return isRevealController(e) ? e.isReady() : e.St.size === 0 && !e.Tt;
4025
+ return isRevealController(e) ? e.isReady() : e.Tt.size === 0 && !e.St;
3989
4026
  }
3990
4027
  function isSlotMinimallyReady(e) {
3991
4028
  return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
@@ -4108,9 +4145,9 @@ class RevealController {
4108
4145
  }
4109
4146
  class CollectionQueue extends Queue {
4110
4147
  bt;
4111
- St = new Set();
4148
+ Tt = new Set();
4112
4149
  vt;
4113
- Tt = true;
4150
+ St = true;
4114
4151
  _t = signal(false, { ownedWrite: true, Ke: true });
4115
4152
  ae;
4116
4153
  Ot = signal(false, { ownedWrite: true, Ke: true });
@@ -4139,22 +4176,19 @@ class CollectionQueue extends Queue {
4139
4176
  if (e !== this.Lt) {
4140
4177
  this.Lt = e;
4141
4178
  this.ht = false;
4142
- this.St.clear();
4179
+ this.Tt.clear();
4143
4180
  }
4144
4181
  }
4145
- if (this.bt & STATUS_PENDING && n & STATUS_ERROR) {
4146
- return super.notify(e, STATUS_ERROR, n, i);
4147
- }
4148
4182
  if (this.bt & STATUS_PENDING && this.ht) return super.notify(e, t, n, i);
4149
4183
  if (n & this.bt) {
4150
- this.Tt = true;
4184
+ this.St = true;
4151
4185
  const t = i?.source || e.ae?.source;
4152
4186
  if (t) {
4153
- const e = this.St.size === 0;
4154
- this.St.add(t);
4187
+ const e = this.Tt.size === 0;
4188
+ this.Tt.add(t);
4155
4189
  if (e) setSignal(this._t, true);
4156
4190
  if (this.bt & STATUS_ERROR) {
4157
- setSignal(this.ae, t.ae?.cause ?? t.ae);
4191
+ setSignal(this.ae, unwrapStatusError(t.ae));
4158
4192
  }
4159
4193
  }
4160
4194
  }
@@ -4162,20 +4196,20 @@ class CollectionQueue extends Queue {
4162
4196
  return t ? super.notify(e, t, n, i) : true;
4163
4197
  }
4164
4198
  checkSources() {
4165
- for (const e of this.St) {
4199
+ for (const e of this.Tt) {
4166
4200
  if (
4167
4201
  e.W & REACTIVE_DISPOSED ||
4168
4202
  (!(e.Y & this.bt) && !(this.bt & STATUS_ERROR && e.Y & STATUS_PENDING))
4169
4203
  )
4170
- this.St.delete(e);
4204
+ this.Tt.delete(e);
4171
4205
  }
4172
- if (!this.St.size) {
4173
- if (this.bt & STATUS_PENDING && this.Tt && !this.ht && this.vt) {
4174
- this.Tt = !!(this.vt.Y & this.bt);
4206
+ if (!this.Tt.size) {
4207
+ if (this.bt & STATUS_PENDING && this.St && !this.ht && this.vt) {
4208
+ this.St = !!(this.vt.Y & this.bt);
4175
4209
  } else {
4176
- this.Tt = false;
4210
+ this.St = false;
4177
4211
  }
4178
- if (!this.Tt) {
4212
+ if (!this.St) {
4179
4213
  setSignal(this._t, false);
4180
4214
  if (this.wt) {
4181
4215
  try {
@@ -4202,7 +4236,7 @@ function createCollectionBoundary(e, t, n, i) {
4202
4236
  if (e instanceof NotReadyError) t = true;
4203
4237
  else throw e;
4204
4238
  }
4205
- o.Tt = t || !!(s.Y & e) || s.ae instanceof NotReadyError;
4239
+ o.St = t || !!(s.Y & e) || s.ae instanceof NotReadyError;
4206
4240
  });
4207
4241
  const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
4208
4242
  if (u) {
@@ -4230,7 +4264,7 @@ function createLoadingBoundary(e, t, n) {
4230
4264
  function createErrorBoundary(e, t) {
4231
4265
  return createCollectionBoundary(STATUS_ERROR, e, e =>
4232
4266
  t(accessor(e.ae), () => {
4233
- for (const t of e.St) recompute(t);
4267
+ for (const t of e.Tt) recompute(t);
4234
4268
  schedule();
4235
4269
  })
4236
4270
  );