@solidjs/signals 2.0.0-beta.25 → 2.0.0-beta.26

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.
@@ -19,14 +19,14 @@ const transitions = new Set;
19
19
  const dirtyQueue = {
20
20
  eE: new Array(2e3).fill(undefined),
21
21
  tE: false,
22
- Fe: 0,
22
+ He: 0,
23
23
  EE: 0
24
24
  };
25
25
 
26
26
  const zombieQueue = {
27
27
  eE: new Array(2e3).fill(undefined),
28
28
  tE: false,
29
- Fe: 0,
29
+ He: 0,
30
30
  EE: 0
31
31
  };
32
32
 
@@ -56,7 +56,7 @@ function registerTransientStoreNode(e) {
56
56
 
57
57
  function canUseSimpleSyncFlush(e) {
58
58
  const t = e.m;
59
- return transitions.size === 0 && activeLanes.size === 0 && e.vt.length === 0 && t.Ze.length === 0 && t.A.length === 0 && t.cn.size === 0 && transientStoreNodes.size === 0;
59
+ return transitions.size === 0 && activeLanes.size === 0 && e.vt.length === 0 && t.je.length === 0 && t.A.length === 0 && t.cn.size === 0 && transientStoreNodes.size === 0;
60
60
  }
61
61
 
62
62
  function sweepTransientStoreNodes() {
@@ -66,14 +66,14 @@ function sweepTransientStoreNodes() {
66
66
  transientStoreNodes.delete(e);
67
67
  continue;
68
68
  }
69
- if (e.Ne !== NOT_PENDING) continue;
70
- if (e.Ee !== undefined && e.Ee !== NOT_PENDING) continue;
69
+ if (e._e !== NOT_PENDING) continue;
70
+ if (e.Ae !== undefined && e.Ae !== NOT_PENDING) continue;
71
71
  // A live affects() mark keeps the node addressable: sweeping it would
72
72
  // detach the refcount from the slot (a fresh probe would upsert a new,
73
73
  // unmarked node for the same property).
74
74
  if (e.t) continue;
75
75
  transientStoreNodes.delete(e);
76
- e.it?.();
76
+ e.ut?.();
77
77
  }
78
78
  }
79
79
 
@@ -100,15 +100,15 @@ function setProjectionWriteActive(e) {
100
100
  * land there directly — no per-field aliasing.
101
101
  */ function createBatch() {
102
102
  return {
103
- ce: clock,
103
+ Se: clock,
104
104
  Qt: [],
105
- yt: new Map,
106
- Ze: [],
105
+ Ee: new Map,
106
+ je: [],
107
107
  A: [],
108
108
  cn: new Set,
109
109
  ie: [],
110
- gt: {
111
- bt: [ [], [] ],
110
+ yt: {
111
+ gt: [ [], [] ],
112
112
  vt: []
113
113
  },
114
114
  fn: false,
@@ -119,13 +119,13 @@ function setProjectionWriteActive(e) {
119
119
  function mergeTransitionState(e, t) {
120
120
  t.fn = e;
121
121
  e.ie.push(...t.ie);
122
- for (const i of activeLanes) if (i.Ue === t) i.Ue = e;
123
- if (t.Ze.length) {
122
+ for (const i of activeLanes) if (i.Ie === t) i.Ie = e;
123
+ if (t.je.length) {
124
124
  // Move (don't copy): the global queue's batch may still be the outgoing
125
125
  // transition, and the adoption pass in initTransition would re-push its
126
126
  // contents into the target — duplicating every entry.
127
- e.Ze.push(...t.Ze);
128
- t.Ze.length = 0;
127
+ e.je.push(...t.je);
128
+ t.je.length = 0;
129
129
  }
130
130
  if (t.A.length) {
131
131
  // Move (don't copy): the global queue's batch may still be the outgoing
@@ -135,9 +135,9 @@ function mergeTransitionState(e, t) {
135
135
  t.A.length = 0;
136
136
  }
137
137
  for (const i of t.cn) e.cn.add(i);
138
- for (const [i, n] of t.yt) {
139
- let t = e.yt.get(i);
140
- if (!t) e.yt.set(i, t = new Set);
138
+ for (const [i, n] of t.Ee) {
139
+ let t = e.Ee.get(i);
140
+ if (!t) e.Ee.set(i, t = new Set);
141
141
  for (const e of n) t.add(e);
142
142
  }
143
143
  for (const i of t.ln) e.ln.add(i);
@@ -150,7 +150,7 @@ function schedule() {
150
150
  }
151
151
  if (scheduled) return;
152
152
  scheduled = true;
153
- if (!syncDepth && !globalQueue.kt && !projectionWriteActive) queueMicrotask(flush);
153
+ if (!syncDepth && !globalQueue.bt && !projectionWriteActive) queueMicrotask(flush);
154
154
  }
155
155
 
156
156
  /**
@@ -180,29 +180,29 @@ function notifyHalted() {
180
180
  }
181
181
 
182
182
  class Queue {
183
- Ge=null;
184
- bt=[ [], [] ];
183
+ ve=null;
184
+ gt=[ [], [] ];
185
185
  vt=[];
186
186
  created=clock;
187
187
  addChild(e) {
188
188
  this.vt.push(e);
189
- e.Ge = this;
189
+ e.ve = this;
190
190
  }
191
191
  removeChild(e) {
192
192
  const t = this.vt.indexOf(e);
193
193
  if (t >= 0) {
194
194
  this.vt.splice(t, 1);
195
- e.Ge = null;
195
+ e.ve = null;
196
196
  }
197
197
  }
198
198
  notify(e, t, i, n) {
199
- if (this.Ge) return this.Ge.notify(e, t, i, n);
199
+ if (this.ve) return this.ve.notify(e, t, i, n);
200
200
  return false;
201
201
  }
202
202
  run(e) {
203
- if (this.bt[e - 1].length) {
204
- const t = this.bt[e - 1];
205
- this.bt[e - 1] = [];
203
+ if (this.gt[e - 1].length) {
204
+ const t = this.gt[e - 1];
205
+ this.gt[e - 1] = [];
206
206
  runQueue(t, e);
207
207
  }
208
208
  for (let t = 0; t < this.vt.length; t++) this.vt[t].run?.(e);
@@ -214,21 +214,21 @@ class Queue {
214
214
  const i = findLane(currentOptimisticLane);
215
215
  i.rn[e - 1].push(t);
216
216
  } else {
217
- this.bt[e - 1].push(t);
217
+ this.gt[e - 1].push(t);
218
218
  }
219
219
  }
220
220
  schedule();
221
221
  }
222
222
  stashQueues(e) {
223
- e.bt[0].push(...this.bt[0]);
224
- e.bt[1].push(...this.bt[1]);
225
- this.bt = [ [], [] ];
223
+ e.gt[0].push(...this.gt[0]);
224
+ e.gt[1].push(...this.gt[1]);
225
+ this.gt = [ [], [] ];
226
226
  for (let t = 0; t < this.vt.length; t++) {
227
227
  let i = this.vt[t];
228
228
  let n = e.vt[t];
229
229
  if (!n) {
230
230
  n = {
231
- bt: [ [], [] ],
231
+ gt: [ [], [] ],
232
232
  vt: []
233
233
  };
234
234
  e.vt[t] = n;
@@ -237,8 +237,8 @@ class Queue {
237
237
  }
238
238
  }
239
239
  restoreQueues(e) {
240
- this.bt[0].push(...e.bt[0]);
241
- this.bt[1].push(...e.bt[1]);
240
+ this.gt[0].push(...e.gt[0]);
241
+ this.gt[1].push(...e.gt[1]);
242
242
  for (let t = 0; t < e.vt.length; t++) {
243
243
  const i = e.vt[t];
244
244
  let n = this.vt[t];
@@ -248,14 +248,14 @@ class Queue {
248
248
  }
249
249
 
250
250
  class GlobalQueue extends Queue {
251
- kt=false;
251
+ bt=false;
252
252
  // The current transaction-shaped batch: a plain ambient batch while no
253
253
  // transition is active, the active transition itself after initTransition.
254
254
  m=createBatch();
255
255
  static pe;
256
256
  static Ce;
257
- static Je;
258
- static Dt=null;
257
+ static Xe;
258
+ static kt=null;
259
259
  // Store-side hook: drops a keyless affects() mark's identity scope when the
260
260
  // carrier node's last registration releases (wired by store.ts, mirroring
261
261
  // _clearOptimisticStore).
@@ -269,24 +269,24 @@ class GlobalQueue extends Queue {
269
269
  static h=null;
270
270
  // External-source bridge (wired by enableExternalSource(); null while no
271
271
  // config is active — including after _resetExternalSourceConfig()).
272
- static Tt=null;
273
272
  static It=null;
273
+ static dt=null;
274
274
  // Verdict-layer hooks (wired by verdict.ts when isPending()/latest() are
275
275
  // imported; null in apps that never use them). Call sites either guard for
276
276
  // null or sit behind state only the verdict layer can create (`!` is safe
277
277
  // there: `_pendingSignal`/`_latestValueComputed` are only ever assigned by
278
278
  // verdict.ts, and `pendingCheckActive`/`latestReadActive` only flip inside
279
279
  // isPending()/latest()).
280
- static Ie=null;
281
- static ae=null;
282
- static he=null;
280
+ static De=null;
281
+ static ce=null;
282
+ static Oe=null;
283
283
  static un=null;
284
- static dt=null;
285
284
  static St=null;
286
- static Rt=null;
287
- static ze=null;
285
+ static At=null;
286
+ static Pt=null;
287
+ static $e=null;
288
288
  static k=null;
289
- static Lt=null;
289
+ static Dt=null;
290
290
  // Optimistic-engine hooks (wired by core/optimistic.ts via
291
291
  // installOptimisticEngine(), called from verdict.ts / createOptimistic /
292
292
  // createOptimisticStore — every module that can create optimistic state).
@@ -294,21 +294,21 @@ class GlobalQueue extends Queue {
294
294
  // `_overrideValue` slot, a lane in `activeLanes`, an `_optimisticNodes`
295
295
  // entry, or a non-null `currentOptimisticLane`, so `!` invocations are safe
296
296
  // once the gate holds.
297
- static Pt=null;
297
+ static ht=null;
298
298
  static En=null;
299
299
  static dn=null;
300
300
  static Tn=null;
301
301
  static In=null;
302
- static Ct=null;
303
- static At=null;
304
302
  static Ot=null;
305
- static Ye=null;
303
+ static Ct=null;
304
+ static Rt=null;
305
+ static Ze=null;
306
+ static ze=null;
306
307
  static Ke=null;
307
- static Me=null;
308
308
  static Nn=null;
309
309
  flush() {
310
- if (this.kt) return;
311
- this.kt = true;
310
+ if (this.bt) return;
311
+ this.bt = true;
312
312
  try {
313
313
  if (false) ;
314
314
  runHeap(dirtyQueue, GlobalQueue.pe);
@@ -329,12 +329,12 @@ class GlobalQueue extends Queue {
329
329
  GlobalQueue.In(EFFECT_RENDER);
330
330
  GlobalQueue.In(EFFECT_USER);
331
331
  }
332
- this.stashQueues(e.gt);
332
+ this.stashQueues(e.yt);
333
333
  clock++;
334
334
  // A kept ambient batch may hold pending nodes (#2916): stay
335
335
  // scheduled so the outer drain loop commits them via the plain
336
336
  // flush path instead of leaving them until the next natural flush.
337
- scheduled = dirtyQueue.EE >= dirtyQueue.Fe || this.m.Qt.length > 0;
337
+ scheduled = dirtyQueue.EE >= dirtyQueue.He || this.m.Qt.length > 0;
338
338
  reassignPendingTransition(e.Qt);
339
339
  activeTransition = null;
340
340
  finalizePureQueue(null, true);
@@ -343,7 +343,7 @@ class GlobalQueue extends Queue {
343
343
  const t = activeTransition;
344
344
  const i = this.m;
345
345
  i !== t && i.Qt.push(...t.Qt);
346
- this.restoreQueues(t.gt);
346
+ this.restoreQueues(t.yt);
347
347
  transitions.delete(t);
348
348
  activeTransition = null;
349
349
  reassignPendingTransition(i.Qt);
@@ -354,7 +354,7 @@ class GlobalQueue extends Queue {
354
354
  // there and must survive to the next flush.
355
355
  const e = createBatch();
356
356
  e.Qt = i.Qt;
357
- e.Ze = i.Ze;
357
+ e.je = i.je;
358
358
  e.A = i.A;
359
359
  e.cn = i.cn;
360
360
  currentBatch = this.m = e;
@@ -362,7 +362,7 @@ class GlobalQueue extends Queue {
362
362
  } else {
363
363
  if (canUseSimpleSyncFlush(this)) {
364
364
  commitPendingNodes();
365
- if (dirtyQueue.EE >= dirtyQueue.Fe) {
365
+ if (dirtyQueue.EE >= dirtyQueue.He) {
366
366
  runHeap(dirtyQueue, GlobalQueue.pe);
367
367
  commitPendingNodes();
368
368
  }
@@ -373,7 +373,7 @@ class GlobalQueue extends Queue {
373
373
  }
374
374
  clock++;
375
375
  // Check if finalization added items to the heap (from optimistic reversion)
376
- scheduled = dirtyQueue.EE >= dirtyQueue.Fe;
376
+ scheduled = dirtyQueue.EE >= dirtyQueue.He;
377
377
  // Run lane effects first (for ready lanes), then regular effects
378
378
  activeLanes.size && GlobalQueue.In(EFFECT_RENDER);
379
379
  this.run(EFFECT_RENDER);
@@ -383,7 +383,7 @@ class GlobalQueue extends Queue {
383
383
  if (false && !scheduled && !activeTransition && transitions.size === 0 && activeLanes.size === 0) ;
384
384
  if (false) ;
385
385
  } finally {
386
- this.kt = false;
386
+ this.bt = false;
387
387
  }
388
388
  }
389
389
  notify(e, t, i, n) {
@@ -398,8 +398,8 @@ class GlobalQueue extends Queue {
398
398
  if (t?.l) return true;
399
399
  if (activeTransition && t) {
400
400
  const i = t.source;
401
- let n = activeTransition.yt.get(i);
402
- if (!n) activeTransition.yt.set(i, n = new Set);
401
+ let n = activeTransition.Ee.get(i);
402
+ if (!n) activeTransition.Ee.set(i, n = new Set);
403
403
  const s = n.size;
404
404
  n.add(e);
405
405
  if (n.size !== s) schedule();
@@ -412,7 +412,7 @@ class GlobalQueue extends Queue {
412
412
  initTransition(e) {
413
413
  if (e) e = currentTransition(e);
414
414
  if (e && e === activeTransition) return;
415
- if (!e && activeTransition && activeTransition.ce === clock) return;
415
+ if (!e && activeTransition && activeTransition.Se === clock) return;
416
416
  if (!activeTransition) {
417
417
  activeTransition = e ?? createBatch();
418
418
  } else if (e) {
@@ -422,7 +422,7 @@ class GlobalQueue extends Queue {
422
422
  activeTransition = e;
423
423
  }
424
424
  transitions.add(activeTransition);
425
- activeTransition.ce = clock;
425
+ activeTransition.Se = clock;
426
426
  const t = this.m;
427
427
  if (t !== activeTransition) {
428
428
  // Adopt the ambient batch into the transaction, then make the
@@ -434,20 +434,20 @@ class GlobalQueue extends Queue {
434
434
  // nodes, see propagateAffectsMark, #2893.
435
435
  for (let e = 0; e < t.Qt.length; e++) {
436
436
  const i = t.Qt[e];
437
- i.Ue = activeTransition;
437
+ i.Ie = activeTransition;
438
438
  activeTransition.Qt.push(i);
439
439
  }
440
- for (let e = 0; e < t.Ze.length; e++) {
441
- const i = t.Ze[e];
442
- i.Ue = activeTransition;
443
- activeTransition.Ze.push(i);
440
+ for (let e = 0; e < t.je.length; e++) {
441
+ const i = t.je[e];
442
+ i.Ie = activeTransition;
443
+ activeTransition.je.push(i);
444
444
  }
445
445
  if (t.A.length) activeTransition.A.push(...t.A);
446
446
  for (const e of t.cn) activeTransition.cn.add(e);
447
447
  currentBatch = this.m = activeTransition;
448
448
  }
449
449
  for (const e of activeLanes) {
450
- if (!e.Ue) e.Ue = activeTransition;
450
+ if (!e.Ie) e.Ie = activeTransition;
451
451
  }
452
452
  }
453
453
  }
@@ -468,8 +468,8 @@ function armReaskClear() {
468
468
  function insertSubs(e, t = false) {
469
469
  // Get source lane: prefer node's own lane over current context
470
470
  // This is important for isPending signals which need their own lane to flush immediately
471
- const i = e.je || currentOptimisticLane;
472
- const n = e.Ve !== undefined;
471
+ const i = e.Me || currentOptimisticLane;
472
+ const n = e.xe !== undefined;
473
473
  const s = reaskArmed;
474
474
  for (let r = e.o; r !== null; r = r.ue) {
475
475
  // A value-change notification is a new question for the subscriber: any
@@ -485,7 +485,7 @@ function insertSubs(e, t = false) {
485
485
  } else if (t) {
486
486
  r.le.se |= REACTIVE_OPTIMISTIC_DIRTY;
487
487
  // No source lane means reversion - clear subscriber's lane so effects go to regular queue
488
- r.le.je = undefined;
488
+ r.le.Me = undefined;
489
489
  }
490
490
  enqueueSub(r.le);
491
491
  }
@@ -493,24 +493,24 @@ function insertSubs(e, t = false) {
493
493
 
494
494
  function commitPendingNode(e) {
495
495
  const t = e;
496
- if (!t.ke) {
497
- if (e.Ne !== NOT_PENDING) {
498
- e.Pe = e.Ne;
499
- e.Ne = NOT_PENDING;
496
+ if (!t.ae) {
497
+ if (e._e !== NOT_PENDING) {
498
+ e.Ue = e._e;
499
+ e._e = NOT_PENDING;
500
500
  }
501
- if (e.be || e.ge) GlobalQueue.un(e);
501
+ if (e.he || e.Ge) GlobalQueue.un(e);
502
502
  return;
503
503
  }
504
- if (e.Ne !== NOT_PENDING) {
505
- e.Pe = e.Ne;
506
- e.Ne = NOT_PENDING;
504
+ if (e._e !== NOT_PENDING) {
505
+ e.Ue = e._e;
506
+ e._e = NOT_PENDING;
507
507
  // Set _modified for effects, but not for tracked effects (they handle their own scheduling)
508
- if (e.Ae && e.Ae !== EFFECT_TRACKED) e.$e = true;
508
+ if (e.Pe && e.Pe !== EFFECT_TRACKED) e.Be = true;
509
509
  }
510
510
  t.se &= ~REACTIVE_MANUAL_WRITE;
511
511
  if (!(t.S & STATUS_PENDING)) t.S &= ~STATUS_UNINITIALIZED;
512
- if (t.ye !== null || t.Le !== null) GlobalQueue.Ce(t, false, true);
513
- if (e.be || e.ge) GlobalQueue.un(e);
512
+ if (t.Qe !== null || t.ye !== null) GlobalQueue.Ce(t, false, true);
513
+ if (e.he || e.Ge) GlobalQueue.un(e);
514
514
  }
515
515
 
516
516
  function commitPendingNodes() {
@@ -527,7 +527,7 @@ function finalizePureQueue(e = null, t = false) {
527
527
  const i = !t;
528
528
  if (i) commitPendingNodes();
529
529
  if (!t && globalQueue.vt.length) checkBoundaryChildren(globalQueue);
530
- const n = dirtyQueue.EE >= dirtyQueue.Fe;
530
+ const n = dirtyQueue.EE >= dirtyQueue.He;
531
531
  if (n) runHeap(dirtyQueue, GlobalQueue.pe);
532
532
  if (i) {
533
533
  if (n) commitPendingNodes();
@@ -535,7 +535,7 @@ function finalizePureQueue(e = null, t = false) {
535
535
  const t = e ?? globalQueue.m;
536
536
  // Optimistic reversion: a non-empty batch means _optimisticWrite ran,
537
537
  // which installed the engine's hooks.
538
- if (t.Ze.length) GlobalQueue.En(t.Ze);
538
+ if (t.je.length) GlobalQueue.En(t.je);
539
539
  // Replay entanglement: subs recorded by the read-time gate get rescheduled
540
540
  // so they re-run with the now-committed values visible.
541
541
  if (e && e.ln.size) {
@@ -559,7 +559,7 @@ function finalizePureQueue(e = null, t = false) {
559
559
  // hook; the hook iterates, clears, and schedules (keeping the loop out of
560
560
  // core lets esbuild shake it — rollup already folds the null guard). The
561
561
  // completing transition scopes the clear to its own layer keys (#2899).
562
- if (t.cn.size) GlobalQueue.Dt(t.cn, e);
562
+ if (t.cn.size) GlobalQueue.kt(t.cn, e);
563
563
  sweepTransientStoreNodes();
564
564
  // Lanes only enter activeLanes through the engine's getOrCreateLane.
565
565
  if (activeLanes.size) GlobalQueue.Tn(e);
@@ -591,7 +591,7 @@ function checkBoundaryChildren(e) {
591
591
 
592
592
  function reassignPendingTransition(e) {
593
593
  for (let t = 0; t < e.length; t++) {
594
- e[t].Ue = activeTransition;
594
+ e[t].Ie = activeTransition;
595
595
  }
596
596
  }
597
597
 
@@ -619,7 +619,7 @@ function flush(e) {
619
619
  }
620
620
  }
621
621
  }
622
- if (globalQueue.kt) {
622
+ if (globalQueue.bt) {
623
623
  return;
624
624
  }
625
625
  if (halted) return;
@@ -637,10 +637,10 @@ function runQueue(e, t) {
637
637
  function reporterBlocksSource(e, t) {
638
638
  if (e.se & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
639
639
  if (e.oe?.has(t)) return true;
640
- for (let i = e.Xe; i; i = i.et) {
641
- let e = i.tt;
640
+ for (let i = e.et; i; i = i.tt) {
641
+ let e = i.nt;
642
642
  while (e) {
643
- if (e === t || e.nt === t) return true;
643
+ if (e === t || e.it === t) return true;
644
644
  e = e.nn;
645
645
  }
646
646
  }
@@ -651,7 +651,7 @@ function transitionComplete(e) {
651
651
  if (e.fn) return true;
652
652
  if (e.ie.length) return false;
653
653
  let t = true;
654
- for (const [i, n] of e.yt) {
654
+ for (const [i, n] of e.Ee) {
655
655
  let s = false;
656
656
  for (const e of n) {
657
657
  if (reporterBlocksSource(e, i)) {
@@ -660,7 +660,7 @@ function transitionComplete(e) {
660
660
  }
661
661
  n.delete(e);
662
662
  }
663
- if (!s) e.yt.delete(i); else if (i.S & STATUS_PENDING && i._?.source === i) {
663
+ if (!s) e.Ee.delete(i); else if (i.S & STATUS_PENDING && i._?.source === i) {
664
664
  t = false;
665
665
  break;
666
666
  }
@@ -668,7 +668,7 @@ function transitionComplete(e) {
668
668
  // Override blockage lives with the engine. Absent hook = "no optimistic
669
669
  // blockage", which is exact: only _optimisticWrite (engine) pushes to
670
670
  // _optimisticNodes, so without the engine the loop was vacuous anyway.
671
- if (t && e.Ze.length && GlobalQueue.dn(e)) t = false;
671
+ if (t && e.je.length && GlobalQueue.dn(e)) t = false;
672
672
  t && (e.fn = true);
673
673
  return t;
674
674
  }