@solidjs/signals 0.13.7 → 0.13.8

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/dev.js CHANGED
@@ -2335,6 +2335,18 @@ function createWriteTraps(isActive) {
2335
2335
  }
2336
2336
  return typeof value === "object" && value !== null ? new Proxy(value, traps) : value;
2337
2337
  },
2338
+ has(_, prop) {
2339
+ let value;
2340
+ setWriteOverride(true);
2341
+ setProjectionWriteActive(true);
2342
+ try {
2343
+ value = prop in _;
2344
+ } finally {
2345
+ setWriteOverride(false);
2346
+ setProjectionWriteActive(false);
2347
+ }
2348
+ return value;
2349
+ },
2338
2350
  set(_, prop, value) {
2339
2351
  if (isActive && !isActive()) return true;
2340
2352
  setWriteOverride(true);
@@ -2392,7 +2404,12 @@ function wrap(value, target) {
2392
2404
  return p;
2393
2405
  }
2394
2406
  function isWrappable(obj) {
2395
- return obj != null && typeof obj === "object" && !Object.isFrozen(obj);
2407
+ return (
2408
+ obj != null &&
2409
+ typeof obj === "object" &&
2410
+ !Object.isFrozen(obj) &&
2411
+ !(typeof Node !== "undefined" && obj instanceof Node)
2412
+ );
2396
2413
  }
2397
2414
  let writeOverride = false;
2398
2415
  function setWriteOverride(value) {
@@ -2544,17 +2561,19 @@ const storeTraps = {
2544
2561
  : target[STORE_OVERRIDE] && property in target[STORE_OVERRIDE]
2545
2562
  ? target[STORE_OVERRIDE][property] !== $DELETED
2546
2563
  : property in target[STORE_VALUE];
2547
- getObserver() &&
2548
- read(
2549
- getNode(
2550
- getNodes(target, STORE_HAS),
2551
- property,
2552
- has,
2553
- target[STORE_FIREWALL],
2554
- isEqual,
2555
- target[STORE_OPTIMISTIC]
2556
- )
2557
- );
2564
+ if (!writeOnly(target[$PROXY])) {
2565
+ getObserver() &&
2566
+ read(
2567
+ getNode(
2568
+ getNodes(target, STORE_HAS),
2569
+ property,
2570
+ has,
2571
+ target[STORE_FIREWALL],
2572
+ isEqual,
2573
+ target[STORE_OPTIMISTIC]
2574
+ )
2575
+ );
2576
+ }
2558
2577
  return has;
2559
2578
  },
2560
2579
  set(target, property, rawValue) {
@@ -2592,25 +2611,32 @@ const storeTraps = {
2592
2611
  ? target[STORE_OVERRIDE][property]
2593
2612
  : base;
2594
2613
  const value = rawValue?.[$TARGET]?.[STORE_VALUE] ?? rawValue;
2595
- if (prev === value) return true;
2614
+ const isArrayIndexWrite = Array.isArray(state) && property !== "length";
2615
+ const nextIndex = isArrayIndexWrite ? parseInt(property) + 1 : 0;
2596
2616
  const len =
2597
- target[STORE_OPTIMISTIC_OVERRIDE]?.length ||
2598
- target[STORE_OVERRIDE]?.length ||
2599
- state.length;
2600
- if (value !== undefined && value === base) delete target[overrideKey][property];
2601
- else (target[overrideKey] || (target[overrideKey] = Object.create(null)))[property] = value;
2617
+ isArrayIndexWrite &&
2618
+ (target[STORE_OPTIMISTIC_OVERRIDE] && "length" in target[STORE_OPTIMISTIC_OVERRIDE]
2619
+ ? target[STORE_OPTIMISTIC_OVERRIDE].length
2620
+ : target[STORE_OVERRIDE] && "length" in target[STORE_OVERRIDE]
2621
+ ? target[STORE_OVERRIDE].length
2622
+ : state.length);
2623
+ const nextLength = isArrayIndexWrite && nextIndex > len ? nextIndex : undefined;
2624
+ if (prev === value && nextLength === undefined) return true;
2625
+ if (value !== undefined && value === base && nextLength === undefined)
2626
+ delete target[overrideKey]?.[property];
2627
+ else {
2628
+ const override = target[overrideKey] || (target[overrideKey] = Object.create(null));
2629
+ override[property] = value;
2630
+ if (nextLength !== undefined) override.length = nextLength;
2631
+ }
2602
2632
  const wrappable = isWrappable(value);
2603
2633
  target[STORE_HAS]?.[property] && setSignal(target[STORE_HAS][property], true);
2604
2634
  const nodes = getNodes(target, STORE_NODE);
2605
2635
  nodes[property] &&
2606
2636
  setSignal(nodes[property], () => (wrappable ? wrap(value, target) : value));
2607
2637
  if (Array.isArray(state)) {
2608
- if (property === "length") {
2609
- nodes.length && setSignal(nodes.length, value);
2610
- } else {
2611
- const index = parseInt(property) + 1;
2612
- if (index > len) nodes.length && setSignal(nodes.length, index);
2613
- }
2638
+ const lengthValue = property === "length" ? value : nextLength;
2639
+ lengthValue !== undefined && nodes.length && setSignal(nodes.length, lengthValue);
2614
2640
  }
2615
2641
  nodes[$TRACK] && setSignal(nodes[$TRACK], undefined);
2616
2642
  });
@@ -3364,8 +3390,9 @@ class CollectionQueue extends Queue {
3364
3390
  checkSources() {
3365
3391
  for (const source of this._sources) {
3366
3392
  if (
3367
- !(source._statusFlags & this._collectionType) &&
3368
- !(this._collectionType & STATUS_ERROR && source._statusFlags & STATUS_PENDING)
3393
+ source._flags & REACTIVE_DISPOSED ||
3394
+ (!(source._statusFlags & this._collectionType) &&
3395
+ !(this._collectionType & STATUS_ERROR && source._statusFlags & STATUS_PENDING))
3369
3396
  )
3370
3397
  this._sources.delete(source);
3371
3398
  }
package/dist/node.cjs CHANGED
@@ -44,8 +44,8 @@ const S = {};
44
44
  const w = {};
45
45
  const m = "sp";
46
46
  const b = typeof Proxy === "function";
47
- const _ = {};
48
- const O = Symbol("refresh");
47
+ const O = {};
48
+ const _ = Symbol("refresh");
49
49
  function actualInsertIntoHeap(e, t) {
50
50
  const n = (e.i?.t ? e.i.u?.o : e.i?.o) ?? -1;
51
51
  if (n >= e.o) e.o = n + 1;
@@ -92,8 +92,8 @@ function deleteFromHeap(e, t) {
92
92
  e.h = undefined;
93
93
  }
94
94
  function markHeap(e) {
95
- if (e._) return;
96
- e._ = true;
95
+ if (e.O) return;
96
+ e.O = true;
97
97
  for (let t = 0; t <= e.S; t++) {
98
98
  for (let n = e.l[t]; n !== undefined; n = n.h) {
99
99
  if (n.m & i) markNode(n);
@@ -104,19 +104,19 @@ function markNode(e, r = n) {
104
104
  const i = e.m;
105
105
  if ((i & (t | n)) >= r) return;
106
106
  e.m = (i & -4) | r;
107
- for (let n = e.O; n !== null; n = n.P) {
107
+ for (let n = e._; n !== null; n = n.P) {
108
108
  markNode(n.k, t);
109
109
  }
110
- if (e.C !== null) {
111
- for (let n = e.C; n !== null; n = n.W) {
112
- for (let e = n.O; e !== null; e = e.P) {
110
+ if (e.W !== null) {
111
+ for (let n = e.W; n !== null; n = n.C) {
112
+ for (let e = n._; e !== null; e = e.P) {
113
113
  markNode(e.k, t);
114
114
  }
115
115
  }
116
116
  }
117
117
  }
118
118
  function runHeap(e, t) {
119
- e._ = false;
119
+ e.O = false;
120
120
  for (e.j = 0; e.j <= e.S; e.j++) {
121
121
  let n = e.l[e.j];
122
122
  while (n !== undefined) {
@@ -137,18 +137,18 @@ function adjustHeight(e, t) {
137
137
  }
138
138
  if (e.o !== n) {
139
139
  e.o = n;
140
- for (let n = e.O; n !== null; n = n.P) {
140
+ for (let n = e._; n !== null; n = n.P) {
141
141
  insertIntoHeapHeight(n.k, t);
142
142
  }
143
143
  }
144
144
  }
145
145
  const x = new Set();
146
- const P = { l: new Array(2e3).fill(undefined), _: false, j: 0, S: 0 };
147
- const v = { l: new Array(2e3).fill(undefined), _: false, j: 0, S: 0 };
146
+ const P = { l: new Array(2e3).fill(undefined), O: false, j: 0, S: 0 };
147
+ const v = { l: new Array(2e3).fill(undefined), O: false, j: 0, S: 0 };
148
148
  let E = 0;
149
149
  let k = null;
150
- let C = false;
151
150
  let W = false;
151
+ let C = false;
152
152
  let j = null;
153
153
  function enforceLoadingBoundary(e) {}
154
154
  function shouldReadStashedOptimisticValue(e) {
@@ -165,7 +165,7 @@ function runLaneEffects(e) {
165
165
  }
166
166
  }
167
167
  function queueStashedOptimisticEffects(e) {
168
- for (let t = e.O; t !== null; t = t.P) {
168
+ for (let t = e._; t !== null; t = t.P) {
169
169
  const e = t.k;
170
170
  if (!e.D) continue;
171
171
  if (e.D === y) {
@@ -181,7 +181,7 @@ function queueStashedOptimisticEffects(e) {
181
181
  }
182
182
  }
183
183
  function setProjectionWriteActive(e) {
184
- W = e;
184
+ C = e;
185
185
  }
186
186
  function mergeTransitionState(e, t) {
187
187
  t.B = e;
@@ -227,9 +227,9 @@ function cleanupCompletedLanes(e) {
227
227
  }
228
228
  }
229
229
  function schedule() {
230
- if (C) return;
231
- C = true;
232
- if (!A.ne && !W) queueMicrotask(flush);
230
+ if (W) return;
231
+ W = true;
232
+ if (!A.ne && !C) queueMicrotask(flush);
233
233
  }
234
234
  class Queue {
235
235
  i = null;
@@ -319,7 +319,7 @@ class GlobalQueue extends Queue {
319
319
  runLaneEffects(g);
320
320
  this.stashQueues(e.ce);
321
321
  E++;
322
- C = P.S >= P.j;
322
+ W = P.S >= P.j;
323
323
  reassignPendingTransition(e.se);
324
324
  k = null;
325
325
  if (!e.G.length && e.U.length) {
@@ -350,7 +350,7 @@ class GlobalQueue extends Queue {
350
350
  finalizePureQueue();
351
351
  }
352
352
  E++;
353
- C = P.S >= P.j;
353
+ W = P.S >= P.j;
354
354
  runLaneEffects(h);
355
355
  this.run(h);
356
356
  runLaneEffects(g);
@@ -426,7 +426,7 @@ class GlobalQueue extends Queue {
426
426
  function insertSubs(e, t = false) {
427
427
  const n = e.Y || M;
428
428
  const r = e.pe !== undefined;
429
- for (let i = e.O; i !== null; i = i.P) {
429
+ for (let i = e._; i !== null; i = i.P) {
430
430
  if (r && i.k.he) {
431
431
  i.k.m |= c;
432
432
  continue;
@@ -504,7 +504,7 @@ function flush() {
504
504
  if (A.ne) {
505
505
  return;
506
506
  }
507
- while (C || k) {
507
+ while (W || k) {
508
508
  A.flush();
509
509
  }
510
510
  }
@@ -629,10 +629,10 @@ function unlinkSubs(e) {
629
629
  else t.be = i;
630
630
  if (i !== null) i.P = r;
631
631
  else {
632
- t.O = r;
632
+ t._ = r;
633
633
  if (r === null) {
634
- t._e?.();
635
- t.R && !t.Oe && !(t.m & o) && unobserved(t);
634
+ t.Oe?.();
635
+ t.R && !t._e && !(t.m & o) && unobserved(t);
636
636
  }
637
637
  }
638
638
  return n;
@@ -664,7 +664,7 @@ function link(e, t) {
664
664
  if (n !== null) n.N = u;
665
665
  else t.A = u;
666
666
  if (o !== null) o.P = u;
667
- else e.O = u;
667
+ else e._ = u;
668
668
  }
669
669
  function isValidLink(e, t) {
670
670
  const n = t.xe;
@@ -724,12 +724,12 @@ function disposeChildren(e, t = false, n) {
724
724
  e.ke = null;
725
725
  } else {
726
726
  e.Pe = null;
727
- e.Ce = 0;
727
+ e.We = 0;
728
728
  }
729
729
  runDisposal(e, n);
730
730
  }
731
731
  function runDisposal(e, t) {
732
- let n = t ? e.We : e.je;
732
+ let n = t ? e.Ce : e.je;
733
733
  if (!n) return;
734
734
  if (Array.isArray(n)) {
735
735
  for (let e = 0; e < n.length; e++) {
@@ -739,12 +739,12 @@ function runDisposal(e, t) {
739
739
  } else {
740
740
  n.call(n);
741
741
  }
742
- t ? (e.We = null) : (e.je = null);
742
+ t ? (e.Ce = null) : (e.je = null);
743
743
  }
744
744
  function childId(e, t) {
745
745
  let n = e;
746
746
  while (n.Ae && n.i) n = n.i;
747
- if (n.id != null) return formatId(n.id, t ? n.Ce++ : n.Ce);
747
+ if (n.id != null) return formatId(n.id, t ? n.We++ : n.We);
748
748
  throw new Error("Cannot get child id from owner without an id");
749
749
  }
750
750
  function getNextChildId(e) {
@@ -787,9 +787,9 @@ function createOwner(e) {
787
787
  ve: null,
788
788
  je: null,
789
789
  V: t?.V ?? A,
790
- Ne: t?.Ne || _,
791
- Ce: 0,
792
- We: null,
790
+ Ne: t?.Ne || O,
791
+ We: 0,
792
+ Ce: null,
793
793
  ke: null,
794
794
  i: t,
795
795
  dispose(e = true) {
@@ -860,9 +860,9 @@ function setPendingError(e, t, n) {
860
860
  }
861
861
  }
862
862
  function forEachDependent(e, t) {
863
- for (let n = e.O; n !== null; n = n.P) t(n.k);
864
- for (let n = e.C; n !== null; n = n.W) {
865
- for (let e = n.O; e !== null; e = e.P) t(e.k);
863
+ for (let n = e._; n !== null; n = n.P) t(n.k);
864
+ for (let n = e.W; n !== null; n = n.C) {
865
+ for (let e = n._; e !== null; e = e.P) t(e.k);
866
866
  }
867
867
  }
868
868
  function settlePendingSource(e) {
@@ -1175,11 +1175,11 @@ function recompute(t, n = false) {
1175
1175
  if (t.K || i === y) disposeChildren(t);
1176
1176
  else {
1177
1177
  markDisposal(t);
1178
- t.We = t.je;
1178
+ t.Ce = t.je;
1179
1179
  t.ke = t.Pe;
1180
1180
  t.je = null;
1181
1181
  t.Pe = null;
1182
- t.Ce = 0;
1182
+ t.We = 0;
1183
1183
  }
1184
1184
  }
1185
1185
  const s = !!(t.m & f);
@@ -1255,7 +1255,7 @@ function recompute(t, n = false) {
1255
1255
  } else if (u) {
1256
1256
  t.Z = h;
1257
1257
  } else if (t.o != g) {
1258
- for (let e = t.O; e !== null; e = e.P) {
1258
+ for (let e = t._; e !== null; e = e.P) {
1259
1259
  insertIntoHeapHeight(e.k, e.k.m & o ? v : P);
1260
1260
  }
1261
1261
  }
@@ -1289,20 +1289,20 @@ function computed(t, n, r) {
1289
1289
  Ae: i || undefined,
1290
1290
  Te: r?.equals != null ? r.equals : isEqual,
1291
1291
  le: !!r?.pureWrite,
1292
- _e: r?.unobserved,
1292
+ Oe: r?.unobserved,
1293
1293
  je: null,
1294
1294
  V: V?.V ?? A,
1295
- Ne: V?.Ne ?? _,
1296
- Ce: 0,
1295
+ Ne: V?.Ne ?? O,
1296
+ We: 0,
1297
1297
  R: t,
1298
1298
  $: n,
1299
1299
  o: 0,
1300
- C: null,
1300
+ W: null,
1301
1301
  h: undefined,
1302
1302
  p: null,
1303
1303
  A: null,
1304
1304
  xe: null,
1305
- O: null,
1305
+ _: null,
1306
1306
  be: null,
1307
1307
  i: V,
1308
1308
  ve: null,
@@ -1311,7 +1311,7 @@ function computed(t, n, r) {
1311
1311
  ge: p,
1312
1312
  de: E,
1313
1313
  Z: S,
1314
- We: null,
1314
+ Ce: null,
1315
1315
  ke: null,
1316
1316
  Ee: null,
1317
1317
  K: null
@@ -1354,16 +1354,16 @@ function signal(e, t, n = null) {
1354
1354
  Te: t?.equals != null ? t.equals : isEqual,
1355
1355
  le: !!t?.pureWrite,
1356
1356
  De: !!t?.De,
1357
- _e: t?.unobserved,
1357
+ Oe: t?.unobserved,
1358
1358
  $: e,
1359
- O: null,
1359
+ _: null,
1360
1360
  be: null,
1361
1361
  de: E,
1362
1362
  I: n,
1363
- W: n?.C || null,
1363
+ C: n?.W || null,
1364
1364
  Z: S
1365
1365
  };
1366
- n && (n.C = r);
1366
+ n && (n.W = r);
1367
1367
  if (B && !r.De && !((n?.ge ?? 0) & a)) {
1368
1368
  r.pe = e === undefined ? w : e;
1369
1369
  G.add(r);
@@ -1511,7 +1511,7 @@ function read(e) {
1511
1511
  }
1512
1512
  function setSignal(e, t) {
1513
1513
  if (e.K && k !== e.K) A.initTransition(e.K);
1514
- const n = e.ee !== undefined && !W;
1514
+ const n = e.ee !== undefined && !C;
1515
1515
  const r = e.ee !== undefined && e.ee !== S;
1516
1516
  const i = n ? (r ? e.ee : e.$) : e.Z === S ? e.$ : e.Z;
1517
1517
  if (typeof t === "function") t = t(i);
@@ -1661,7 +1661,7 @@ function refresh(e) {
1661
1661
  Q = true;
1662
1662
  try {
1663
1663
  if (typeof e !== "function") {
1664
- recompute(e[O]);
1664
+ recompute(e[_]);
1665
1665
  return e;
1666
1666
  }
1667
1667
  return untrack(e);
@@ -2091,7 +2091,7 @@ function createProjectionInternal(e, t = {}, n) {
2091
2091
  u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
2092
2092
  });
2093
2093
  });
2094
- r.Oe = true;
2094
+ r._e = true;
2095
2095
  return { store: s, node: r };
2096
2096
  }
2097
2097
  function createProjection(e, t = {}, n) {
@@ -2111,6 +2111,18 @@ function createWriteTraps(e) {
2111
2111
  }
2112
2112
  return typeof r === "object" && r !== null ? new Proxy(r, t) : r;
2113
2113
  },
2114
+ has(e, t) {
2115
+ let n;
2116
+ setWriteOverride(true);
2117
+ setProjectionWriteActive(true);
2118
+ try {
2119
+ n = t in e;
2120
+ } finally {
2121
+ setWriteOverride(false);
2122
+ setProjectionWriteActive(false);
2123
+ }
2124
+ return n;
2125
+ },
2114
2126
  set(t, n, r) {
2115
2127
  if (e && !e()) return true;
2116
2128
  setWriteOverride(true);
@@ -2168,7 +2180,12 @@ function wrap(e, t) {
2168
2180
  return n;
2169
2181
  }
2170
2182
  function isWrappable(e) {
2171
- return e != null && typeof e === "object" && !Object.isFrozen(e);
2183
+ return (
2184
+ e != null &&
2185
+ typeof e === "object" &&
2186
+ !Object.isFrozen(e) &&
2187
+ !(typeof Node !== "undefined" && e instanceof Node)
2188
+ );
2172
2189
  }
2173
2190
  let oe = false;
2174
2191
  function setWriteOverride(e) {
@@ -2231,7 +2248,7 @@ const fe = {
2231
2248
  get(e, t, n) {
2232
2249
  if (t === z) return e;
2233
2250
  if (t === U) return n;
2234
- if (t === O) return e[re];
2251
+ if (t === _) return e[re];
2235
2252
  if (t === K) {
2236
2253
  trackSelf(e);
2237
2254
  return n;
@@ -2272,7 +2289,9 @@ const fe = {
2272
2289
  has(e, t) {
2273
2290
  if (t === U || t === K || t === "__proto__") return true;
2274
2291
  const n = e[Z] && t in e[Z] ? e[Z][t] !== J : e[Y] && t in e[Y] ? e[Y][t] !== J : t in e[X];
2275
- getObserver() && read(getNode(getNodes(e, ee), t, n, e[re], isEqual, e[ie]));
2292
+ if (!writeOnly(e[U])) {
2293
+ getObserver() && read(getNode(getNodes(e, ee), t, n, e[re], isEqual, e[ie]));
2294
+ }
2276
2295
  return n;
2277
2296
  },
2278
2297
  set(e, t, n) {
@@ -2296,28 +2315,37 @@ const fe = {
2296
2315
  e[m][t] = s;
2297
2316
  }
2298
2317
  }
2299
- const o = e[ie] && !W;
2318
+ const o = e[ie] && !C;
2300
2319
  const u = o ? Z : Y;
2301
2320
  if (o) trackOptimisticStore(r);
2302
2321
  const f = e[Z] && t in e[Z] ? e[Z][t] : e[Y] && t in e[Y] ? e[Y][t] : s;
2303
2322
  const c = n?.[z]?.[X] ?? n;
2304
- if (f === c) return true;
2305
- const l = e[Z]?.length || e[Y]?.length || i.length;
2306
- if (c !== undefined && c === s) delete e[u][t];
2307
- else (e[u] || (e[u] = Object.create(null)))[t] = c;
2308
- const d = isWrappable(c);
2323
+ const l = Array.isArray(i) && t !== "length";
2324
+ const d = l ? parseInt(t) + 1 : 0;
2325
+ const p =
2326
+ l &&
2327
+ (e[Z] && "length" in e[Z]
2328
+ ? e[Z].length
2329
+ : e[Y] && "length" in e[Y]
2330
+ ? e[Y].length
2331
+ : i.length);
2332
+ const h = l && d > p ? d : undefined;
2333
+ if (f === c && h === undefined) return true;
2334
+ if (c !== undefined && c === s && h === undefined) delete e[u]?.[t];
2335
+ else {
2336
+ const n = e[u] || (e[u] = Object.create(null));
2337
+ n[t] = c;
2338
+ if (h !== undefined) n.length = h;
2339
+ }
2340
+ const g = isWrappable(c);
2309
2341
  e[ee]?.[t] && setSignal(e[ee][t], true);
2310
- const p = getNodes(e, $);
2311
- p[t] && setSignal(p[t], () => (d ? wrap(c, e) : c));
2342
+ const y = getNodes(e, $);
2343
+ y[t] && setSignal(y[t], () => (g ? wrap(c, e) : c));
2312
2344
  if (Array.isArray(i)) {
2313
- if (t === "length") {
2314
- p.length && setSignal(p.length, c);
2315
- } else {
2316
- const e = parseInt(t) + 1;
2317
- if (e > l) p.length && setSignal(p.length, e);
2318
- }
2345
+ const e = t === "length" ? c : h;
2346
+ e !== undefined && y.length && setSignal(y.length, e);
2319
2347
  }
2320
- p[K] && setSignal(p[K], undefined);
2348
+ y[K] && setSignal(y[K], undefined);
2321
2349
  });
2322
2350
  }
2323
2351
  return true;
@@ -2327,7 +2355,7 @@ const fe = {
2327
2355
  const r = e[Y]?.[t] === J;
2328
2356
  if (writeOnly(e[U]) && !n && !r) {
2329
2357
  untrack(() => {
2330
- const n = e[ie] && !W;
2358
+ const n = e[ie] && !C;
2331
2359
  const r = n ? Z : Y;
2332
2360
  if (n) trackOptimisticStore(e[U]);
2333
2361
  const i = e[Z] && t in e[Z] ? e[Z][t] : e[Y] && t in e[Y] ? e[Y][t] : e[X][t];
@@ -2485,7 +2513,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
2485
2513
  setProjectionWriteActive(false);
2486
2514
  }
2487
2515
  });
2488
- r.Oe = true;
2516
+ r._e = true;
2489
2517
  }
2490
2518
  return { store: s, node: r };
2491
2519
  }
@@ -2946,7 +2974,7 @@ function boundaryComputed(e, t) {
2946
2974
  n.V.notify(n, n.ut, r, i);
2947
2975
  };
2948
2976
  n.ut = t;
2949
- n.Oe = true;
2977
+ n._e = true;
2950
2978
  recompute(n, true);
2951
2979
  return n;
2952
2980
  }
@@ -3008,7 +3036,7 @@ class CollectionQueue extends Queue {
3008
3036
  }
3009
3037
  checkSources() {
3010
3038
  for (const e of this.ct) {
3011
- if (!(e.ge & this.ft) && !(this.ft & d && e.ge & a)) this.ct.delete(e);
3039
+ if (e.m & u || (!(e.ge & this.ft) && !(this.ft & d && e.ge & a))) this.ct.delete(e);
3012
3040
  }
3013
3041
  if (!this.ct.size) {
3014
3042
  setSignal(this.lt, false);
@@ -3100,7 +3128,7 @@ function flattenArray(e, t = [], n) {
3100
3128
  return i;
3101
3129
  }
3102
3130
  exports.$PROXY = U;
3103
- exports.$REFRESH = O;
3131
+ exports.$REFRESH = _;
3104
3132
  exports.$TARGET = z;
3105
3133
  exports.$TRACK = K;
3106
3134
  exports.ContextNotFoundError = ContextNotFoundError;
package/dist/prod.js CHANGED
@@ -424,9 +424,9 @@ class GlobalQueue extends Queue {
424
424
  }
425
425
  function insertSubs(e, t = false) {
426
426
  const n = e.q || currentOptimisticLane;
427
- const i = e.Te !== undefined;
427
+ const i = e.de !== undefined;
428
428
  for (let r = e.I; r !== null; r = r.p) {
429
- if (i && r.h.de) {
429
+ if (i && r.h.Te) {
430
430
  r.h.O |= REACTIVE_SNAPSHOT_STALE;
431
431
  continue;
432
432
  }
@@ -679,7 +679,7 @@ function isValidLink(e, t) {
679
679
  }
680
680
  const PENDING_OWNER = {};
681
681
  function markDisposal(e) {
682
- let t = e.ge;
682
+ let t = e.Pe;
683
683
  while (t) {
684
684
  t.O |= REACTIVE_ZOMBIE;
685
685
  if (t.O & REACTIVE_IN_HEAP) {
@@ -687,7 +687,7 @@ function markDisposal(e) {
687
687
  insertIntoHeap(t, zombieQueue);
688
688
  }
689
689
  markDisposal(t);
690
- t = t.Pe;
690
+ t = t.ge;
691
691
  }
692
692
  }
693
693
  function dispose(e) {
@@ -703,9 +703,9 @@ function disposeChildren(e, t = false, n) {
703
703
  if (e.O & REACTIVE_DISPOSED) return;
704
704
  if (t) e.O = REACTIVE_DISPOSED;
705
705
  if (t && e.L) e.Ce = null;
706
- let i = n ? e.De : e.ge;
706
+ let i = n ? e.De : e.Pe;
707
707
  while (i) {
708
- const e = i.Pe;
708
+ const e = i.ge;
709
709
  if (i.C) {
710
710
  const e = i;
711
711
  deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
@@ -722,13 +722,13 @@ function disposeChildren(e, t = false, n) {
722
722
  if (n) {
723
723
  e.De = null;
724
724
  } else {
725
- e.ge = null;
725
+ e.Pe = null;
726
726
  e.ye = 0;
727
727
  }
728
728
  runDisposal(e, n);
729
729
  }
730
730
  function runDisposal(e, t) {
731
- let n = t ? e.me : e.ve;
731
+ let n = t ? e.ve : e.me;
732
732
  if (!n) return;
733
733
  if (Array.isArray(n)) {
734
734
  for (let e = 0; e < n.length; e++) {
@@ -738,11 +738,11 @@ function runDisposal(e, t) {
738
738
  } else {
739
739
  n.call(n);
740
740
  }
741
- t ? (e.me = null) : (e.ve = null);
741
+ t ? (e.ve = null) : (e.me = null);
742
742
  }
743
743
  function childId(e, t) {
744
744
  let n = e;
745
- while (n.we && n.i) n = n.i;
745
+ while (n.Ve && n.i) n = n.i;
746
746
  if (n.id != null) return formatId(n.id, t ? n.ye++ : n.ye);
747
747
  throw new Error("Cannot get child id from owner without an id");
748
748
  }
@@ -766,9 +766,9 @@ function getOwner() {
766
766
  }
767
767
  function cleanup(e) {
768
768
  if (!context) return e;
769
- if (!context.ve) context.ve = e;
770
- else if (Array.isArray(context.ve)) context.ve.push(e);
771
- else context.ve = [context.ve, e];
769
+ if (!context.me) context.me = e;
770
+ else if (Array.isArray(context.me)) context.me.push(e);
771
+ else context.me = [context.me, e];
772
772
  return e;
773
773
  }
774
774
  function isDisposed(e) {
@@ -779,16 +779,16 @@ function createOwner(e) {
779
779
  const n = e?.transparent ?? false;
780
780
  const i = {
781
781
  id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
782
- we: n || undefined,
782
+ Ve: n || undefined,
783
783
  t: true,
784
784
  u: t?.t ? t.u : t,
785
- ge: null,
786
785
  Pe: null,
787
- ve: null,
786
+ ge: null,
787
+ me: null,
788
788
  F: t?.F ?? globalQueue,
789
- be: t?.be || defaultContext,
789
+ we: t?.we || defaultContext,
790
790
  ye: 0,
791
- me: null,
791
+ ve: null,
792
792
  De: null,
793
793
  i: t,
794
794
  dispose(e = true) {
@@ -796,12 +796,12 @@ function createOwner(e) {
796
796
  }
797
797
  };
798
798
  if (t) {
799
- const e = t.ge;
799
+ const e = t.Pe;
800
800
  if (e === null) {
801
- t.ge = i;
801
+ t.Pe = i;
802
802
  } else {
803
- i.Pe = e;
804
- t.ge = i;
803
+ i.ge = e;
804
+ t.Pe = i;
805
805
  }
806
806
  }
807
807
  return i;
@@ -811,28 +811,28 @@ function createRoot(e, t) {
811
811
  return runWithOwner(n, () => e(n.dispose));
812
812
  }
813
813
  function addPendingSource(e, t) {
814
- if (e.Ve === t || e.Le?.has(t)) return false;
815
- if (!e.Ve) {
816
- e.Ve = t;
814
+ if (e.be === t || e.Le?.has(t)) return false;
815
+ if (!e.be) {
816
+ e.be = t;
817
817
  return true;
818
818
  }
819
819
  if (!e.Le) {
820
- e.Le = new Set([e.Ve, t]);
820
+ e.Le = new Set([e.be, t]);
821
821
  } else {
822
822
  e.Le.add(t);
823
823
  }
824
- e.Ve = undefined;
824
+ e.be = undefined;
825
825
  return true;
826
826
  }
827
827
  function removePendingSource(e, t) {
828
- if (e.Ve) {
829
- if (e.Ve !== t) return false;
830
- e.Ve = undefined;
828
+ if (e.be) {
829
+ if (e.be !== t) return false;
830
+ e.be = undefined;
831
831
  return true;
832
832
  }
833
833
  if (!e.Le?.delete(t)) return false;
834
834
  if (e.Le.size === 1) {
835
- e.Ve = e.Le.values().next().value;
835
+ e.be = e.Le.values().next().value;
836
836
  e.Le = undefined;
837
837
  } else if (e.Le.size === 0) {
838
838
  e.Le = undefined;
@@ -840,7 +840,7 @@ function removePendingSource(e, t) {
840
840
  return true;
841
841
  }
842
842
  function clearPendingSources(e) {
843
- e.Ve = undefined;
843
+ e.be = undefined;
844
844
  e.Le?.clear();
845
845
  e.Le = undefined;
846
846
  }
@@ -871,7 +871,7 @@ function settlePendingSource(e) {
871
871
  if (n.has(i) || !removePendingSource(i, e)) return;
872
872
  n.add(i);
873
873
  i.Ee = clock;
874
- const r = i.Ve ?? i.Le?.values().next().value;
874
+ const r = i.be ?? i.Le?.values().next().value;
875
875
  if (r) {
876
876
  setPendingError(i, r);
877
877
  updatePendingSignal(i);
@@ -1072,8 +1072,8 @@ function notifyStatus(e, t, n, i, r) {
1072
1072
  forEachDependent(e, e => {
1073
1073
  e.Ee = clock;
1074
1074
  if (
1075
- (t === STATUS_PENDING && s && e.Ve !== s && !e.Le?.has(s)) ||
1076
- (t !== STATUS_PENDING && (e.le !== n || e.Ve || e.Le))
1075
+ (t === STATUS_PENDING && s && e.be !== s && !e.Le?.has(s)) ||
1076
+ (t !== STATUS_PENDING && (e.le !== n || e.be || e.Le))
1077
1077
  ) {
1078
1078
  if (!a && !e.K) globalQueue.se.push(e);
1079
1079
  notifyStatus(e, t, n, a, f);
@@ -1135,15 +1135,15 @@ function releaseSnapshotScope(e) {
1135
1135
  schedule();
1136
1136
  }
1137
1137
  function releaseSubtree(e) {
1138
- let t = e.ge;
1138
+ let t = e.Pe;
1139
1139
  while (t) {
1140
1140
  if (t.We) {
1141
- t = t.Pe;
1141
+ t = t.ge;
1142
1142
  continue;
1143
1143
  }
1144
1144
  if (t.L) {
1145
1145
  const e = t;
1146
- e.de = false;
1146
+ e.Te = false;
1147
1147
  if (e.O & REACTIVE_SNAPSHOT_STALE) {
1148
1148
  e.O &= ~REACTIVE_SNAPSHOT_STALE;
1149
1149
  e.O |= REACTIVE_DIRTY;
@@ -1152,13 +1152,13 @@ function releaseSubtree(e) {
1152
1152
  }
1153
1153
  }
1154
1154
  releaseSubtree(t);
1155
- t = t.Pe;
1155
+ t = t.ge;
1156
1156
  }
1157
1157
  }
1158
1158
  function clearSnapshots() {
1159
1159
  if (snapshotSources) {
1160
1160
  for (const e of snapshotSources) {
1161
- delete e.Te;
1161
+ delete e.de;
1162
1162
  delete e[STORE_SNAPSHOT_PROPS];
1163
1163
  }
1164
1164
  snapshotSources = null;
@@ -1175,10 +1175,10 @@ function recompute(e, t = false) {
1175
1175
  if (e.K || n === EFFECT_TRACKED) disposeChildren(e);
1176
1176
  else {
1177
1177
  markDisposal(e);
1178
- e.me = e.ve;
1179
- e.De = e.ge;
1180
- e.ve = null;
1181
- e.ge = null;
1178
+ e.ve = e.me;
1179
+ e.De = e.Pe;
1180
+ e.me = null;
1181
+ e.Pe = null;
1182
1182
  e.ye = 0;
1183
1183
  }
1184
1184
  }
@@ -1286,13 +1286,13 @@ function computed(e, t, n) {
1286
1286
  const i = n?.transparent ?? false;
1287
1287
  const r = {
1288
1288
  id: n?.id ?? (i ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
1289
- we: i || undefined,
1289
+ Ve: i || undefined,
1290
1290
  ke: n?.equals != null ? n.equals : isEqual,
1291
1291
  fe: !!n?.pureWrite,
1292
1292
  he: n?.unobserved,
1293
- ve: null,
1293
+ me: null,
1294
1294
  F: context?.F ?? globalQueue,
1295
- be: context?.be ?? defaultContext,
1295
+ we: context?.we ?? defaultContext,
1296
1296
  ye: 0,
1297
1297
  L: e,
1298
1298
  J: t,
@@ -1305,13 +1305,13 @@ function computed(e, t, n) {
1305
1305
  I: null,
1306
1306
  pe: null,
1307
1307
  i: context,
1308
- Pe: null,
1309
1308
  ge: null,
1309
+ Pe: null,
1310
1310
  O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
1311
1311
  Se: STATUS_UNINITIALIZED,
1312
1312
  Ee: clock,
1313
1313
  X: NOT_PENDING,
1314
- me: null,
1314
+ ve: null,
1315
1315
  De: null,
1316
1316
  Ce: null,
1317
1317
  K: null
@@ -1319,16 +1319,16 @@ function computed(e, t, n) {
1319
1319
  r.T = r;
1320
1320
  const s = context?.t ? context.u : context;
1321
1321
  if (context) {
1322
- const e = context.ge;
1322
+ const e = context.Pe;
1323
1323
  if (e === null) {
1324
- context.ge = r;
1324
+ context.Pe = r;
1325
1325
  } else {
1326
- r.Pe = e;
1327
- context.ge = r;
1326
+ r.ge = e;
1327
+ context.Pe = r;
1328
1328
  }
1329
1329
  }
1330
1330
  if (s) r.o = s.o + 1;
1331
- if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.de = true;
1331
+ if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.Te = true;
1332
1332
  if (externalSourceConfig) {
1333
1333
  const e = signal(undefined, { equals: false, pureWrite: true });
1334
1334
  const t = externalSourceConfig.factory(r.L, () => {
@@ -1343,7 +1343,7 @@ function computed(e, t, n) {
1343
1343
  !n?.lazy && recompute(r, true);
1344
1344
  if (snapshotCaptureActive && !n?.lazy) {
1345
1345
  if (!(r.Se & STATUS_PENDING)) {
1346
- r.Te = r.J === undefined ? NO_SNAPSHOT : r.J;
1346
+ r.de = r.J === undefined ? NO_SNAPSHOT : r.J;
1347
1347
  snapshotSources.add(r);
1348
1348
  }
1349
1349
  }
@@ -1365,7 +1365,7 @@ function signal(e, t, n = null) {
1365
1365
  };
1366
1366
  n && (n.A = i);
1367
1367
  if (snapshotCaptureActive && !i.He && !((n?.Se ?? 0) & STATUS_PENDING)) {
1368
- i.Te = e === undefined ? NO_SNAPSHOT : e;
1368
+ i.de = e === undefined ? NO_SNAPSHOT : e;
1369
1369
  snapshotSources.add(i);
1370
1370
  }
1371
1371
  return i;
@@ -1489,8 +1489,8 @@ function read(e) {
1489
1489
  return read(e);
1490
1490
  } else throw e.le;
1491
1491
  }
1492
- if (snapshotCaptureActive && t && t.de) {
1493
- const n = e.Te;
1492
+ if (snapshotCaptureActive && t && t.Te) {
1493
+ const n = e.de;
1494
1494
  if (n !== undefined) {
1495
1495
  const i = n === NO_SNAPSHOT ? undefined : n;
1496
1496
  const r = e.X !== NOT_PENDING ? e.X : e.J;
@@ -1683,7 +1683,7 @@ function getContext(e, t = getOwner()) {
1683
1683
  if (!t) {
1684
1684
  throw new NoOwnerError();
1685
1685
  }
1686
- const n = hasContext(e, t) ? t.be[e.id] : e.defaultValue;
1686
+ const n = hasContext(e, t) ? t.we[e.id] : e.defaultValue;
1687
1687
  if (isUndefined(n)) {
1688
1688
  throw new ContextNotFoundError();
1689
1689
  }
@@ -1693,10 +1693,10 @@ function setContext(e, t, n = getOwner()) {
1693
1693
  if (!n) {
1694
1694
  throw new NoOwnerError();
1695
1695
  }
1696
- n.be = { ...n.be, [e.id]: isUndefined(t) ? e.defaultValue : t };
1696
+ n.we = { ...n.we, [e.id]: isUndefined(t) ? e.defaultValue : t };
1697
1697
  }
1698
1698
  function hasContext(e, t) {
1699
- return !isUndefined(t?.be[e.id]);
1699
+ return !isUndefined(t?.we[e.id]);
1700
1700
  }
1701
1701
  function isUndefined(e) {
1702
1702
  return typeof e === "undefined";
@@ -1947,28 +1947,28 @@ function applyState(e, t, n) {
1947
1947
  let t = false;
1948
1948
  const c = getOverrideValue(r, s, u, "length", o);
1949
1949
  if (e.length && c && e[0] && n(e[0]) != null) {
1950
- let a, f, l, E, T, d, S, R;
1950
+ let a, f, l, E, d, T, S, R;
1951
1951
  for (
1952
1952
  l = 0, E = Math.min(c, e.length);
1953
1953
  l < E &&
1954
- ((d = getOverrideValue(r, s, u, l, o)) === e[l] || (d && e[l] && n(d) === n(e[l])));
1954
+ ((T = getOverrideValue(r, s, u, l, o)) === e[l] || (T && e[l] && n(T) === n(e[l])));
1955
1955
  l++
1956
1956
  ) {
1957
- applyState(e[l], wrap(d, i), n);
1957
+ applyState(e[l], wrap(T, i), n);
1958
1958
  }
1959
1959
  const O = new Array(e.length),
1960
1960
  _ = new Map();
1961
1961
  for (
1962
- E = c - 1, T = e.length - 1;
1962
+ E = c - 1, d = e.length - 1;
1963
1963
  E >= l &&
1964
- T >= l &&
1965
- ((d = getOverrideValue(r, s, u, E, o)) === e[T] || (d && e[T] && n(d) === n(e[T])));
1966
- E--, T--
1964
+ d >= l &&
1965
+ ((T = getOverrideValue(r, s, u, E, o)) === e[d] || (T && e[d] && n(T) === n(e[d])));
1966
+ E--, d--
1967
1967
  ) {
1968
- O[T] = d;
1968
+ O[d] = T;
1969
1969
  }
1970
- if (l > T || l > E) {
1971
- for (f = l; f <= T; f++) {
1970
+ if (l > d || l > E) {
1971
+ for (f = l; f <= d; f++) {
1972
1972
  t = true;
1973
1973
  i[STORE_NODE][f] && setSignal(i[STORE_NODE][f], wrap(e[f], i));
1974
1974
  }
@@ -1982,20 +1982,20 @@ function applyState(e, t, n) {
1982
1982
  c !== e.length && i[STORE_NODE].length && setSignal(i[STORE_NODE].length, e.length);
1983
1983
  return;
1984
1984
  }
1985
- S = new Array(T + 1);
1986
- for (f = T; f >= l; f--) {
1987
- d = e[f];
1988
- R = d ? n(d) : d;
1985
+ S = new Array(d + 1);
1986
+ for (f = d; f >= l; f--) {
1987
+ T = e[f];
1988
+ R = T ? n(T) : T;
1989
1989
  a = _.get(R);
1990
1990
  S[f] = a === undefined ? -1 : a;
1991
1991
  _.set(R, f);
1992
1992
  }
1993
1993
  for (a = l; a <= E; a++) {
1994
- d = getOverrideValue(r, s, u, a, o);
1995
- R = d ? n(d) : d;
1994
+ T = getOverrideValue(r, s, u, a, o);
1995
+ R = T ? n(T) : T;
1996
1996
  f = _.get(R);
1997
1997
  if (f !== undefined && f !== -1) {
1998
- O[f] = d;
1998
+ O[f] = T;
1999
1999
  f = S[f];
2000
2000
  _.set(R, f);
2001
2001
  }
@@ -2030,12 +2030,12 @@ function applyState(e, t, n) {
2030
2030
  const f = c[a];
2031
2031
  const l = u[f];
2032
2032
  const E = unwrap(getOverrideValue(r, s, u, f, o));
2033
- let T = unwrap(e[f]);
2034
- if (E === T) continue;
2035
- if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
2033
+ let d = unwrap(e[f]);
2034
+ if (E === d) continue;
2035
+ if (!E || !isWrappable(E) || !isWrappable(d) || (n(E) != null && n(E) !== n(d))) {
2036
2036
  t && setSignal(t, void 0);
2037
- l && setSignal(l, isWrappable(T) ? wrap(T, i) : T);
2038
- } else applyState(T, wrap(E, i), n);
2037
+ l && setSignal(l, isWrappable(d) ? wrap(d, i) : d);
2038
+ } else applyState(d, wrap(E, i), n);
2039
2039
  }
2040
2040
  }
2041
2041
  if ((u = i[STORE_HAS])) {
@@ -2114,6 +2114,18 @@ function createWriteTraps(e) {
2114
2114
  }
2115
2115
  return typeof i === "object" && i !== null ? new Proxy(i, t) : i;
2116
2116
  },
2117
+ has(e, t) {
2118
+ let n;
2119
+ setWriteOverride(true);
2120
+ setProjectionWriteActive(true);
2121
+ try {
2122
+ n = t in e;
2123
+ } finally {
2124
+ setWriteOverride(false);
2125
+ setProjectionWriteActive(false);
2126
+ }
2127
+ return n;
2128
+ },
2117
2129
  set(t, n, i) {
2118
2130
  if (e && !e()) return true;
2119
2131
  setWriteOverride(true);
@@ -2171,7 +2183,12 @@ function wrap(e, t) {
2171
2183
  return n;
2172
2184
  }
2173
2185
  function isWrappable(e) {
2174
- return e != null && typeof e === "object" && !Object.isFrozen(e);
2186
+ return (
2187
+ e != null &&
2188
+ typeof e === "object" &&
2189
+ !Object.isFrozen(e) &&
2190
+ !(typeof Node !== "undefined" && e instanceof Node)
2191
+ );
2175
2192
  }
2176
2193
  let writeOverride = false;
2177
2194
  function setWriteOverride(e) {
@@ -2202,7 +2219,7 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
2202
2219
  }
2203
2220
  if (o && t in o) {
2204
2221
  const e = o[t];
2205
- u.Te = e === undefined ? NO_SNAPSHOT : e;
2222
+ u.de = e === undefined ? NO_SNAPSHOT : e;
2206
2223
  snapshotSources?.add(u);
2207
2224
  }
2208
2225
  return (e[t] = u);
@@ -2305,8 +2322,12 @@ const storeTraps = {
2305
2322
  : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2306
2323
  ? e[STORE_OVERRIDE][t] !== $DELETED
2307
2324
  : t in e[STORE_VALUE];
2308
- getObserver() &&
2309
- read(getNode(getNodes(e, STORE_HAS), t, n, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC]));
2325
+ if (!writeOnly(e[$PROXY])) {
2326
+ getObserver() &&
2327
+ read(
2328
+ getNode(getNodes(e, STORE_HAS), t, n, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC])
2329
+ );
2330
+ }
2310
2331
  return n;
2311
2332
  },
2312
2333
  set(e, t, n) {
@@ -2344,23 +2365,32 @@ const storeTraps = {
2344
2365
  ? e[STORE_OVERRIDE][t]
2345
2366
  : s;
2346
2367
  const a = n?.[$TARGET]?.[STORE_VALUE] ?? n;
2347
- if (c === a) return true;
2348
- const f = e[STORE_OPTIMISTIC_OVERRIDE]?.length || e[STORE_OVERRIDE]?.length || r.length;
2349
- if (a !== undefined && a === s) delete e[u][t];
2350
- else (e[u] || (e[u] = Object.create(null)))[t] = a;
2351
- const l = isWrappable(a);
2368
+ const f = Array.isArray(r) && t !== "length";
2369
+ const l = f ? parseInt(t) + 1 : 0;
2370
+ const E =
2371
+ f &&
2372
+ (e[STORE_OPTIMISTIC_OVERRIDE] && "length" in e[STORE_OPTIMISTIC_OVERRIDE]
2373
+ ? e[STORE_OPTIMISTIC_OVERRIDE].length
2374
+ : e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
2375
+ ? e[STORE_OVERRIDE].length
2376
+ : r.length);
2377
+ const d = f && l > E ? l : undefined;
2378
+ if (c === a && d === undefined) return true;
2379
+ if (a !== undefined && a === s && d === undefined) delete e[u]?.[t];
2380
+ else {
2381
+ const n = e[u] || (e[u] = Object.create(null));
2382
+ n[t] = a;
2383
+ if (d !== undefined) n.length = d;
2384
+ }
2385
+ const T = isWrappable(a);
2352
2386
  e[STORE_HAS]?.[t] && setSignal(e[STORE_HAS][t], true);
2353
- const E = getNodes(e, STORE_NODE);
2354
- E[t] && setSignal(E[t], () => (l ? wrap(a, e) : a));
2387
+ const S = getNodes(e, STORE_NODE);
2388
+ S[t] && setSignal(S[t], () => (T ? wrap(a, e) : a));
2355
2389
  if (Array.isArray(r)) {
2356
- if (t === "length") {
2357
- E.length && setSignal(E.length, a);
2358
- } else {
2359
- const e = parseInt(t) + 1;
2360
- if (e > f) E.length && setSignal(E.length, e);
2361
- }
2390
+ const e = t === "length" ? a : d;
2391
+ e !== undefined && S.length && setSignal(S.length, e);
2362
2392
  }
2363
- E[$TRACK] && setSignal(E[$TRACK], undefined);
2393
+ S[$TRACK] && setSignal(S[$TRACK], undefined);
2364
2394
  });
2365
2395
  }
2366
2396
  return true;
@@ -2864,8 +2894,8 @@ function updateKeyedMap() {
2864
2894
  f,
2865
2895
  l,
2866
2896
  E = new Array(t),
2867
- T = new Array(t),
2868
- d = this.tt ? new Array(t) : undefined,
2897
+ d = new Array(t),
2898
+ T = this.tt ? new Array(t) : undefined,
2869
2899
  S = this.nt ? new Array(t) : undefined;
2870
2900
  for (
2871
2901
  s = 0, o = Math.min(this.Ze, t);
@@ -2882,8 +2912,8 @@ function updateKeyedMap() {
2882
2912
  o--, u--
2883
2913
  ) {
2884
2914
  E[u] = this.Xe[o];
2885
- T[u] = this.Je[o];
2886
- d && (d[u] = this.tt[o]);
2915
+ d[u] = this.Je[o];
2916
+ T && (T[u] = this.tt[o]);
2887
2917
  S && (S[u] = this.nt[o]);
2888
2918
  }
2889
2919
  f = new Map();
@@ -2901,8 +2931,8 @@ function updateKeyedMap() {
2901
2931
  i = f.get(a);
2902
2932
  if (i !== undefined && i !== -1) {
2903
2933
  E[i] = this.Xe[n];
2904
- T[i] = this.Je[n];
2905
- d && (d[i] = this.tt[n]);
2934
+ d[i] = this.Je[n];
2935
+ T && (T[i] = this.tt[n]);
2906
2936
  S && (S[i] = this.nt[n]);
2907
2937
  i = l[i];
2908
2938
  f.set(a, i);
@@ -2911,9 +2941,9 @@ function updateKeyedMap() {
2911
2941
  for (i = s; i < t; i++) {
2912
2942
  if (i in E) {
2913
2943
  this.Xe[i] = E[i];
2914
- this.Je[i] = T[i];
2915
- if (d) {
2916
- this.tt[i] = d[i];
2944
+ this.Je[i] = d[i];
2945
+ if (T) {
2946
+ this.tt[i] = T[i];
2917
2947
  setSignal(this.tt[i], e[i]);
2918
2948
  }
2919
2949
  if (S) {
@@ -3022,8 +3052,8 @@ class CollectionQueue extends Queue {
3022
3052
  ft = new Set();
3023
3053
  lt = signal(false, { pureWrite: true, He: true });
3024
3054
  Et = false;
3025
- Tt;
3026
- dt = ON_INIT;
3055
+ dt;
3056
+ Tt = ON_INIT;
3027
3057
  constructor(e) {
3028
3058
  super();
3029
3059
  this.ct = e;
@@ -3034,16 +3064,16 @@ class CollectionQueue extends Queue {
3034
3064
  }
3035
3065
  notify(e, t, n, i) {
3036
3066
  if (!(t & this.ct)) return super.notify(e, t, n, i);
3037
- if (this.Et && this.Tt) {
3067
+ if (this.Et && this.dt) {
3038
3068
  const e = untrack(() => {
3039
3069
  try {
3040
- return this.Tt();
3070
+ return this.dt();
3041
3071
  } catch {
3042
3072
  return ON_INIT;
3043
3073
  }
3044
3074
  });
3045
- if (e !== this.dt) {
3046
- this.dt = e;
3075
+ if (e !== this.Tt) {
3076
+ this.Tt = e;
3047
3077
  this.Et = false;
3048
3078
  this.ft.clear();
3049
3079
  }
@@ -3065,14 +3095,17 @@ class CollectionQueue extends Queue {
3065
3095
  }
3066
3096
  checkSources() {
3067
3097
  for (const e of this.ft) {
3068
- if (!(e.Se & this.ct) && !(this.ct & STATUS_ERROR && e.Se & STATUS_PENDING))
3098
+ if (
3099
+ e.O & REACTIVE_DISPOSED ||
3100
+ (!(e.Se & this.ct) && !(this.ct & STATUS_ERROR && e.Se & STATUS_PENDING))
3101
+ )
3069
3102
  this.ft.delete(e);
3070
3103
  }
3071
3104
  if (!this.ft.size) {
3072
3105
  setSignal(this.lt, false);
3073
- if (this.Tt) {
3106
+ if (this.dt) {
3074
3107
  try {
3075
- this.dt = untrack(() => this.Tt());
3108
+ this.Tt = untrack(() => this.dt());
3076
3109
  } catch {}
3077
3110
  }
3078
3111
  }
@@ -3081,7 +3114,7 @@ class CollectionQueue extends Queue {
3081
3114
  function createCollectionBoundary(e, t, n, i) {
3082
3115
  const r = createOwner();
3083
3116
  const s = new CollectionQueue(e);
3084
- if (i) s.Tt = i;
3117
+ if (i) s.dt = i;
3085
3118
  const o = createBoundChildren(r, t, s, e);
3086
3119
  const u = computed(() => {
3087
3120
  if (!read(s.lt)) {
@@ -1,4 +1,3 @@
1
- import { type Store } from "./store.js";
2
1
  /**
3
2
  * Returns a non reactive copy of the store object.
4
3
  * It will attempt to preserver the original reference unless the value has been modified.
@@ -12,7 +11,7 @@ export declare function snapshot<T>(item: T, map?: Map<unknown, unknown>, lookup
12
11
  * and returns plain (non-proxy) data. Works correctly with `reconcile()`.
13
12
  * @param store store proxy object
14
13
  */
15
- export declare function deep<T extends object>(store: Store<T>): T;
14
+ export declare function deep<T extends object>(store: T): T;
16
15
  type DistributeOverride<T, F> = T extends undefined ? F : T;
17
16
  type Override<T, U> = T extends any ? U extends any ? {
18
17
  [K in keyof T]: K extends keyof U ? DistributeOverride<U[K], T[K]> : T[K];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/signals",
3
- "version": "0.13.7",
3
+ "version": "0.13.8",
4
4
  "description": "SolidJS' standalone reactivity implementation",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",