@solidjs/signals 0.6.3 → 0.6.4

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
@@ -45,7 +45,7 @@ function schedule() {
45
45
  if (scheduled)
46
46
  return;
47
47
  scheduled = true;
48
- if (!globalQueue.A)
48
+ if (!globalQueue.y)
49
49
  queueMicrotask(flush);
50
50
  }
51
51
  function notifyUnobserved() {
@@ -59,7 +59,7 @@ function notifyUnobserved() {
59
59
  var pureQueue = [];
60
60
  var Queue = class {
61
61
  k = null;
62
- A = false;
62
+ y = false;
63
63
  g = [[], []];
64
64
  f = [];
65
65
  created = clock;
@@ -84,9 +84,9 @@ var Queue = class {
84
84
  }
85
85
  }
86
86
  flush() {
87
- if (this.A)
87
+ if (this.y)
88
88
  return;
89
- this.A = true;
89
+ this.y = true;
90
90
  try {
91
91
  this.run(EFFECT_PURE);
92
92
  incrementClock();
@@ -94,19 +94,19 @@ var Queue = class {
94
94
  this.run(EFFECT_RENDER);
95
95
  this.run(EFFECT_USER);
96
96
  } finally {
97
- this.A = false;
97
+ this.y = false;
98
98
  Unobserved.length && notifyUnobserved();
99
99
  }
100
100
  }
101
101
  addChild(child) {
102
- if (ActiveTransition && ActiveTransition.r.has(this))
103
- return ActiveTransition.r.get(this).addChild(child);
102
+ if (ActiveTransition && ActiveTransition.G.has(this))
103
+ return ActiveTransition.G.get(this).addChild(child);
104
104
  this.f.push(child);
105
105
  child.k = this;
106
106
  }
107
107
  removeChild(child) {
108
- if (ActiveTransition && ActiveTransition.r.has(this))
109
- return ActiveTransition.r.get(this).removeChild(child);
108
+ if (ActiveTransition && ActiveTransition.G.has(this))
109
+ return ActiveTransition.G.get(this).removeChild(child);
110
110
  const index = this.f.indexOf(child);
111
111
  if (index >= 0) {
112
112
  this.f.splice(index, 1);
@@ -157,35 +157,35 @@ function runQueue(queue, type) {
157
157
  }
158
158
  var Transition = class _Transition {
159
159
  a = /* @__PURE__ */ new Map();
160
- s = /* @__PURE__ */ new Set();
160
+ r = /* @__PURE__ */ new Set();
161
161
  H = /* @__PURE__ */ new Set();
162
- W = /* @__PURE__ */ new Set();
163
- u = false;
162
+ I = /* @__PURE__ */ new Set();
163
+ B = false;
164
164
  g = [[], []];
165
- r = /* @__PURE__ */ new Map();
166
- I = [];
165
+ G = /* @__PURE__ */ new Map();
166
+ J = [];
167
167
  f = [];
168
168
  k = null;
169
- A = false;
170
- X = false;
169
+ y = false;
170
+ Y = false;
171
171
  e = globalQueue;
172
172
  created = clock;
173
173
  constructor() {
174
- this.r.set(globalQueue, this);
174
+ this.G.set(globalQueue, this);
175
175
  for (const child of globalQueue.f) {
176
- cloneQueue(child, this, this.r);
176
+ cloneQueue(child, this, this);
177
177
  }
178
178
  }
179
179
  enqueue(type, fn) {
180
- this.I.push(fn);
180
+ this.J.push(fn);
181
181
  if (type)
182
182
  this.g[type - 1].push(fn);
183
183
  this.schedule();
184
184
  }
185
185
  run(type) {
186
186
  if (type === EFFECT_PURE) {
187
- this.I.length && runQueue(this.I, type);
188
- this.I = [];
187
+ this.J.length && runQueue(this.J, type);
188
+ this.J = [];
189
189
  return;
190
190
  } else if (this.g[type - 1].length) {
191
191
  const effects = this.g[type - 1];
@@ -197,19 +197,19 @@ var Transition = class _Transition {
197
197
  }
198
198
  }
199
199
  flush() {
200
- if (this.A)
200
+ if (this.y)
201
201
  return;
202
- this.A = true;
202
+ this.y = true;
203
203
  let currentTransition = ActiveTransition;
204
204
  ActiveTransition = this;
205
205
  try {
206
206
  this.run(EFFECT_PURE);
207
207
  incrementClock();
208
- this.X = false;
208
+ this.Y = false;
209
209
  ActiveTransition = currentTransition;
210
210
  finishTransition(this);
211
211
  } finally {
212
- this.A = false;
212
+ this.y = false;
213
213
  ActiveTransition = currentTransition;
214
214
  }
215
215
  }
@@ -226,16 +226,16 @@ var Transition = class _Transition {
226
226
  if (!(type & LOADING_BIT))
227
227
  return false;
228
228
  if (flags & LOADING_BIT) {
229
- this.s.add(node);
229
+ this.r.add(node);
230
230
  } else {
231
- this.s.delete(node);
231
+ this.r.delete(node);
232
232
  }
233
233
  return true;
234
234
  }
235
235
  merge(queue) {
236
236
  this.g[0].push.apply(this.g[0], queue.g[0]);
237
237
  this.g[1].push.apply(this.g[1], queue.g[1]);
238
- this.I.push.apply(this.I, queue.I);
238
+ this.J.push.apply(this.J, queue.J);
239
239
  for (let i = 0; i < queue.f.length; i++) {
240
240
  const og = this.f.find((c) => c.e === queue.f[i].e);
241
241
  if (og)
@@ -245,16 +245,16 @@ var Transition = class _Transition {
245
245
  }
246
246
  }
247
247
  schedule() {
248
- if (this.X)
248
+ if (this.Y)
249
249
  return;
250
- this.X = true;
251
- if (!this.A)
250
+ this.Y = true;
251
+ if (!this.y)
252
252
  queueMicrotask(() => this.flush());
253
253
  }
254
254
  runTransition(fn, force = false) {
255
- if (this.u) {
256
- if (this.u instanceof _Transition)
257
- return this.u.runTransition(fn, force);
255
+ if (this.B) {
256
+ if (this.B instanceof _Transition)
257
+ return this.B.runTransition(fn, force);
258
258
  if (!force)
259
259
  throw new Error("Transition already completed");
260
260
  fn();
@@ -273,8 +273,7 @@ var Transition = class _Transition {
273
273
  try {
274
274
  value = await temp.value;
275
275
  } finally {
276
- while (transition2.u instanceof _Transition)
277
- transition2 = transition2.u;
276
+ transition2 = latestTransition(transition2);
278
277
  transition2.H.delete(temp.value);
279
278
  }
280
279
  ActiveTransition = transition2;
@@ -288,8 +287,7 @@ var Transition = class _Transition {
288
287
  if (result instanceof Promise) {
289
288
  transition2.H.add(result);
290
289
  result.finally(() => {
291
- while (transition2.u instanceof _Transition)
292
- transition2 = transition2.u;
290
+ transition2 = latestTransition(transition2);
293
291
  transition2.H.delete(result);
294
292
  ActiveTransition = null;
295
293
  finishTransition(transition2);
@@ -308,14 +306,14 @@ var Transition = class _Transition {
308
306
  return;
309
307
  }
310
308
  fn.j = this;
311
- this.W.add(fn);
309
+ this.I.add(fn);
312
310
  }
313
311
  };
314
312
  function transition(fn) {
315
313
  let t = new Transition();
316
314
  queueMicrotask(() => t.runTransition(() => fn((fn2) => t.runTransition(fn2))));
317
315
  }
318
- function cloneGraph(node) {
316
+ function cloneGraph(node, optimistic) {
319
317
  if (node.j) {
320
318
  if (node.j !== ActiveTransition) {
321
319
  mergeTransitions(node.j, ActiveTransition);
@@ -329,48 +327,58 @@ function cloneGraph(node) {
329
327
  m: null,
330
328
  b: null,
331
329
  a: node.a ? [...node.a] : null,
332
- e: node
330
+ e: node,
331
+ I: !!optimistic
333
332
  });
333
+ delete clone.S;
334
334
  ActiveTransition.a.set(node, clone);
335
335
  node.j = ActiveTransition;
336
- if (node.a) {
336
+ if (!optimistic && node.a) {
337
337
  for (let i = 0; i < node.a.length; i++)
338
338
  node.a[i].b.push(clone);
339
339
  }
340
340
  if (node.b) {
341
341
  clone.b = [];
342
342
  for (let i = 0, length = node.b.length; i < length; i++) {
343
- !node.b[i].e && clone.b.push(cloneGraph(node.b[i]));
343
+ !node.b[i].e && clone.b.push(cloneGraph(node.b[i], optimistic));
344
344
  }
345
345
  }
346
346
  return clone;
347
347
  }
348
+ function latestTransition(t) {
349
+ while (t.B instanceof Transition)
350
+ t = t.B;
351
+ return t;
352
+ }
348
353
  function replaceSourceObservers(node, transition2) {
349
354
  let source;
355
+ let transitionSource;
350
356
  let swap;
351
357
  for (let i = 0; i < node.a.length; i++) {
352
- source = transition2.a.get(node.a[i]) || node.a[i];
358
+ transitionSource = transition2.a.get(node.a[i]);
359
+ source = transitionSource || node.a[i];
353
360
  if (source.b && (swap = source.b.indexOf(node)) !== -1) {
354
- const remove = source.b.indexOf(node.e) > -1;
355
- source.b[swap] = !remove ? node.e : source.b[source.b.length - 1];
356
- remove && source.b.pop();
361
+ source.b[swap] = transitionSource ? node.e : source.b[source.b.length - 1];
362
+ !transitionSource && source.b.pop();
357
363
  }
358
364
  }
359
365
  }
360
- function cloneQueue(queue, parent, clonedQueues) {
366
+ function cloneQueue(queue, parent, transition2) {
361
367
  const clone = Object.create(Object.getPrototypeOf(queue));
362
368
  Object.assign(clone, queue, {
363
369
  e: queue,
364
370
  k: parent,
365
371
  f: [],
366
372
  enqueue(type, fn) {
367
- ActiveTransition?.enqueue(type, fn);
373
+ transition2 = latestTransition(transition2);
374
+ transition2.enqueue(type, fn);
368
375
  },
369
376
  notify(node, type, flags) {
370
377
  node = node.e || node;
371
- if (!clone.J || type & LOADING_BIT) {
378
+ if (!clone.K || type & LOADING_BIT) {
372
379
  type &= ~LOADING_BIT;
373
- ActiveTransition?.notify(node, LOADING_BIT, flags);
380
+ transition2 = latestTransition(transition2);
381
+ transition2.notify(node, LOADING_BIT, flags);
374
382
  if (!type)
375
383
  return true;
376
384
  }
@@ -378,9 +386,9 @@ function cloneQueue(queue, parent, clonedQueues) {
378
386
  }
379
387
  });
380
388
  parent.f.push(clone);
381
- clonedQueues.set(queue, clone);
389
+ transition2.G.set(queue, clone);
382
390
  for (const child of queue.f) {
383
- cloneQueue(child, clone, clonedQueues);
391
+ cloneQueue(child, clone, transition2);
384
392
  }
385
393
  }
386
394
  function resolveQueues(children) {
@@ -405,34 +413,34 @@ function mergeTransitions(t1, t2) {
405
413
  key.j = t1;
406
414
  t1.a.set(key, value);
407
415
  });
408
- t2.W.forEach((c) => {
416
+ t2.I.forEach((c) => {
409
417
  c.j = t1;
410
- t1.W.add(c);
418
+ t1.I.add(c);
411
419
  });
412
420
  t2.H.forEach((p) => t1.H.add(p));
413
- t2.s.forEach((n) => t1.s.add(n));
421
+ t2.r.forEach((n) => t1.r.add(n));
414
422
  t1.merge(t2);
415
- t2.u = t1;
423
+ t2.B = t1;
416
424
  }
417
425
  function getTransitionSource(input) {
418
426
  return ActiveTransition && ActiveTransition.a.get(input) || input;
419
427
  }
420
428
  function getQueue(node) {
421
429
  const transition2 = ActiveTransition || node.e?.j;
422
- return transition2 && transition2.r.get(node.B) || node.B;
430
+ return transition2 && transition2.G.get(node.z) || node.z;
423
431
  }
424
432
  function initialDispose(node) {
425
433
  let current = node.m;
426
434
  while (current !== null && current.k === node) {
427
435
  initialDispose(current);
428
436
  const clone = ActiveTransition.a.get(current);
429
- if (clone && !clone.Y)
437
+ if (clone && !clone.Z)
430
438
  clone.dispose(true);
431
439
  current = current.m;
432
440
  }
433
441
  }
434
442
  function finishTransition(transition2) {
435
- if (transition2.u || transition2.X || transition2.H.size || transition2.s.size)
443
+ if (transition2.B || transition2.Y || transition2.H.size || transition2.r.size)
436
444
  return;
437
445
  globalQueue.g[0].push.apply(globalQueue.g[0], transition2.g[0]);
438
446
  globalQueue.g[1].push.apply(globalQueue.g[1], transition2.g[1]);
@@ -444,10 +452,16 @@ function finishTransition(transition2) {
444
452
  }
445
453
  if (clone.a)
446
454
  replaceSourceObservers(clone, transition2);
447
- if (clone.Y || clone.c === STATE_DISPOSED) {
455
+ if (clone.I) {
456
+ clone.dispose();
457
+ clone.emptyDisposal();
458
+ delete source.j;
459
+ continue;
460
+ }
461
+ if (clone.Z || clone.c === STATE_DISPOSED) {
448
462
  source.dispose(clone.c === STATE_DISPOSED);
449
463
  source.emptyDisposal();
450
- delete clone.Y;
464
+ delete clone.Z;
451
465
  } else {
452
466
  delete clone.m;
453
467
  delete clone.n;
@@ -455,16 +469,16 @@ function finishTransition(transition2) {
455
469
  Object.assign(source, clone);
456
470
  delete source.e;
457
471
  let current = clone.m;
458
- if (current?.w === clone)
459
- current.w = source;
472
+ if (current?.t === clone)
473
+ current.t = source;
460
474
  while (current?.k === clone) {
461
475
  current.k = source;
462
476
  current = current.m;
463
477
  }
464
478
  delete source.j;
465
479
  }
466
- transition2.u = true;
467
- for (const reset of transition2.W) {
480
+ transition2.B = true;
481
+ for (const reset of transition2.I) {
468
482
  delete reset.j;
469
483
  reset();
470
484
  }
@@ -488,11 +502,11 @@ var Owner = class {
488
502
  // See comment at the top of the file for an example of the _nextSibling traversal
489
503
  k = null;
490
504
  m = null;
491
- w = null;
505
+ t = null;
492
506
  c = STATE_CLEAN;
493
507
  n = null;
494
- x = defaultContext;
495
- B = globalQueue;
508
+ u = defaultContext;
509
+ z = globalQueue;
496
510
  fa = 0;
497
511
  id = null;
498
512
  constructor(id = null, skipAppend = false) {
@@ -503,23 +517,23 @@ var Owner = class {
503
517
  }
504
518
  append(child) {
505
519
  child.k = this;
506
- child.w = this;
520
+ child.t = this;
507
521
  if (this.m)
508
- this.m.w = child;
522
+ this.m.t = child;
509
523
  child.m = this.m;
510
524
  this.m = child;
511
525
  if (this.id != null && child.id == null)
512
526
  child.id = this.getNextChildId();
513
- if (child.x !== this.x) {
514
- child.x = { ...this.x, ...child.x };
527
+ if (child.u !== this.u) {
528
+ child.u = { ...this.u, ...child.u };
515
529
  }
516
- if (this.B)
517
- child.B = this.B;
530
+ if (this.z)
531
+ child.z = this.z;
518
532
  }
519
533
  dispose(self = true) {
520
534
  if (this.c === STATE_DISPOSED)
521
535
  return;
522
- let head = self ? this.w || this.k : this, current = this.m, next = null;
536
+ let head = self ? this.t || this.k : this, current = this.m, next = null;
523
537
  while (current && current.k === this) {
524
538
  current.dispose(true);
525
539
  next = current.m;
@@ -528,18 +542,18 @@ var Owner = class {
528
542
  }
529
543
  this.fa = 0;
530
544
  if (self)
531
- this.R();
545
+ this.T();
532
546
  if (current)
533
- current.w = !self ? this : this.w;
547
+ current.t = !self ? this : this.t;
534
548
  if (head)
535
549
  head.m = current;
536
550
  }
537
- R() {
538
- if (this.w)
539
- this.w.m = null;
551
+ T() {
552
+ if (this.t)
553
+ this.t.m = null;
540
554
  this.k = null;
541
- this.w = null;
542
- this.x = defaultContext;
555
+ this.t = null;
556
+ this.u = defaultContext;
543
557
  this.c = STATE_DISPOSED;
544
558
  this.emptyDisposal();
545
559
  }
@@ -569,7 +583,7 @@ function getContext(context, owner = currentOwner) {
569
583
  if (!owner) {
570
584
  throw new NoOwnerError();
571
585
  }
572
- const value = hasContext(context, owner) ? owner.x[context.id] : context.defaultValue;
586
+ const value = hasContext(context, owner) ? owner.u[context.id] : context.defaultValue;
573
587
  if (isUndefined(value)) {
574
588
  throw new ContextNotFoundError();
575
589
  }
@@ -579,13 +593,13 @@ function setContext(context, value, owner = currentOwner) {
579
593
  if (!owner) {
580
594
  throw new NoOwnerError();
581
595
  }
582
- owner.x = {
583
- ...owner.x,
596
+ owner.u = {
597
+ ...owner.u,
584
598
  [context.id]: isUndefined(value) ? context.defaultValue : value
585
599
  };
586
600
  }
587
601
  function hasContext(context, owner = currentOwner) {
588
- return !isUndefined(owner?.x[context.id]);
602
+ return !isUndefined(owner?.u[context.id]);
589
603
  }
590
604
  function onCleanup(fn) {
591
605
  if (!currentOwner)
@@ -625,8 +639,8 @@ var Computation = class extends Owner {
625
639
  a = null;
626
640
  b = null;
627
641
  l;
628
- L;
629
642
  M;
643
+ N;
630
644
  // Used in __DEV__ mode, hopefully removed in production
631
645
  la;
632
646
  // Using false is an optimization as an alternative to _equals: () => false
@@ -638,22 +652,21 @@ var Computation = class extends Owner {
638
652
  h = 0;
639
653
  /** Which flags raised by sources are handled, vs. being passed through. */
640
654
  ba = DEFAULT_FLAGS;
641
- N = -1;
642
- D = false;
655
+ O = -1;
656
+ C = false;
643
657
  j;
644
658
  e;
659
+ I = false;
645
660
  constructor(initialValue, compute2, options) {
646
661
  super(options?.id, compute2 === null);
647
- this.M = compute2;
662
+ this.N = compute2;
648
663
  this.c = compute2 ? STATE_DIRTY : STATE_CLEAN;
649
664
  this.h = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
650
665
  this.l = initialValue;
651
666
  if (options?.equals !== void 0)
652
667
  this.aa = options.equals;
653
- if (options?.pureWrite)
654
- this.ha = true;
655
- if (options?.unobserved)
656
- this.ea = options?.unobserved;
668
+ this.ha = !!options?.pureWrite;
669
+ this.ea = options?.unobserved;
657
670
  if (ActiveTransition) {
658
671
  this.j = ActiveTransition;
659
672
  ActiveTransition.a.set(this, this);
@@ -663,7 +676,7 @@ var Computation = class extends Owner {
663
676
  track(this);
664
677
  newFlags |= this.h & ~currentMask;
665
678
  if (this.h & ERROR_BIT) {
666
- throw this.L;
679
+ throw this.M;
667
680
  } else {
668
681
  return this.l;
669
682
  }
@@ -678,11 +691,11 @@ var Computation = class extends Owner {
678
691
  if (clone !== this)
679
692
  return clone.read();
680
693
  }
681
- if (this.M) {
682
- if (this.h & ERROR_BIT && this.N <= clock)
694
+ if (this.N) {
695
+ if (this.h & ERROR_BIT && this.O <= clock)
683
696
  update(this);
684
697
  else
685
- this.K();
698
+ this.L();
686
699
  }
687
700
  return this.ga();
688
701
  }
@@ -699,11 +712,11 @@ var Computation = class extends Owner {
699
712
  if (clone !== this)
700
713
  return clone.wait();
701
714
  }
702
- if (this.M) {
703
- if (this.h & ERROR_BIT && this.N <= clock)
715
+ if (this.N) {
716
+ if (this.h & ERROR_BIT && this.O <= clock)
704
717
  update(this);
705
718
  else
706
- this.K();
719
+ this.L();
707
720
  }
708
721
  if ((notStale || this.h & UNINITIALIZED_BIT) && this.h & LOADING_BIT) {
709
722
  track(this);
@@ -726,17 +739,17 @@ var Computation = class extends Owner {
726
739
  this.aa === false || !this.aa(this.l, newValue));
727
740
  if (valueChanged) {
728
741
  this.l = newValue;
729
- this.L = void 0;
742
+ this.M = void 0;
730
743
  }
731
744
  const changedFlagsMask = this.h ^ flags, changedFlags = changedFlagsMask & flags;
732
745
  this.h = flags;
733
- this.N = clock + 1;
746
+ this.O = clock + 1;
734
747
  if (this.b) {
735
748
  for (let i = 0; i < this.b.length; i++) {
736
749
  if (valueChanged) {
737
- this.b[i].y(STATE_DIRTY);
750
+ this.b[i].w(STATE_DIRTY);
738
751
  } else if (changedFlagsMask) {
739
- this.b[i].Z(changedFlagsMask, changedFlags);
752
+ this.b[i]._(changedFlagsMask, changedFlags);
740
753
  }
741
754
  }
742
755
  }
@@ -745,14 +758,14 @@ var Computation = class extends Owner {
745
758
  /**
746
759
  * Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
747
760
  */
748
- y(state, skipQueue) {
749
- if (this.c >= state && !this.D)
761
+ w(state, skipQueue) {
762
+ if (this.c >= state && !this.C)
750
763
  return;
751
- this.D = !!skipQueue;
764
+ this.C = !!skipQueue;
752
765
  this.c = state;
753
766
  if (this.b) {
754
767
  for (let i = 0; i < this.b.length; i++) {
755
- this.b[i].y(STATE_CHECK, skipQueue);
768
+ this.b[i].w(STATE_CHECK, skipQueue);
756
769
  }
757
770
  }
758
771
  }
@@ -762,35 +775,35 @@ var Computation = class extends Owner {
762
775
  * @param mask A bitmask for which flag(s) were changed.
763
776
  * @param newFlags The source's new flags, masked to just the changed ones.
764
777
  */
765
- Z(mask, newFlags2) {
778
+ _(mask, newFlags2) {
766
779
  if (this.c >= STATE_DIRTY)
767
780
  return;
768
781
  if (mask & this.ba) {
769
- this.y(STATE_DIRTY);
782
+ this.w(STATE_DIRTY);
770
783
  return;
771
784
  }
772
- if (this.c >= STATE_CHECK && !this.D)
785
+ if (this.c >= STATE_CHECK && !this.C)
773
786
  return;
774
787
  const prevFlags = this.h & mask;
775
788
  const deltaFlags = prevFlags ^ newFlags2;
776
789
  if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
777
- this.y(STATE_CHECK);
790
+ this.w(STATE_CHECK);
778
791
  } else {
779
792
  this.h ^= deltaFlags;
780
793
  if (this.b) {
781
794
  for (let i = 0; i < this.b.length; i++) {
782
- this.b[i].Z(mask, newFlags2);
795
+ this.b[i]._(mask, newFlags2);
783
796
  }
784
797
  }
785
798
  }
786
799
  }
787
- E(error) {
800
+ D(error) {
788
801
  if (ActiveTransition && !this.e) {
789
802
  const clone = cloneGraph(this);
790
803
  if (clone !== this)
791
- return clone.E(error);
804
+ return clone.D(error);
792
805
  }
793
- this.L = error;
806
+ this.M = error;
794
807
  this.write(UNCHANGED, this.h & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
795
808
  }
796
809
  /**
@@ -800,8 +813,8 @@ var Computation = class extends Owner {
800
813
  *
801
814
  * This function will ensure that the value and states we read from the computation are up to date
802
815
  */
803
- K() {
804
- if (!this.M) {
816
+ L() {
817
+ if (!this.N) {
805
818
  return;
806
819
  }
807
820
  if (this.c === STATE_DISPOSED) {
@@ -814,7 +827,7 @@ var Computation = class extends Owner {
814
827
  if (this.c === STATE_CHECK) {
815
828
  for (let i = 0; i < this.a.length; i++) {
816
829
  const source = getTransitionSource(this.a[i]);
817
- source.K();
830
+ source.L();
818
831
  observerFlags |= source.h & ~UNINITIALIZED_BIT;
819
832
  if (this.c === STATE_DIRTY) {
820
833
  break;
@@ -831,12 +844,12 @@ var Computation = class extends Owner {
831
844
  /**
832
845
  * Remove ourselves from the owner graph and the computation graph
833
846
  */
834
- R() {
847
+ T() {
835
848
  if (this.c === STATE_DISPOSED)
836
849
  return;
837
850
  if (this.a)
838
851
  removeSourceObservers(this, 0);
839
- super.R();
852
+ super.T();
840
853
  }
841
854
  };
842
855
  function track(computation) {
@@ -851,7 +864,7 @@ function track(computation) {
851
864
  newSources.push(computation);
852
865
  }
853
866
  if (updateCheck) {
854
- updateCheck.l = computation.N > currentObserver.N;
867
+ updateCheck.l = computation.O > currentObserver.O;
855
868
  }
856
869
  }
857
870
  }
@@ -861,19 +874,19 @@ function update(node) {
861
874
  newSourcesIndex = 0;
862
875
  newFlags = 0;
863
876
  try {
864
- if (ActiveTransition && node.e && !node.Y) {
877
+ if (ActiveTransition && node.e && !node.Z) {
865
878
  initialDispose(node.e);
866
- node.Y = true;
879
+ node.Z = true;
867
880
  }
868
881
  node.dispose(false);
869
882
  node.emptyDisposal();
870
- const result = compute(node, node.M, node);
883
+ const result = compute(node, node.N, node);
871
884
  node.write(result, newFlags, true);
872
885
  } catch (error) {
873
886
  if (error instanceof NotReadyError) {
874
887
  node.write(UNCHANGED, newFlags | LOADING_BIT | node.h & UNINITIALIZED_BIT);
875
888
  } else {
876
- node.E(error);
889
+ node.D(error);
877
890
  }
878
891
  } finally {
879
892
  if (newSources) {
@@ -902,7 +915,7 @@ function update(node) {
902
915
  newSources = prevSources;
903
916
  newSourcesIndex = prevSourcesIndex;
904
917
  newFlags = prevFlags;
905
- node.N = clock + 1;
918
+ node.O = clock + 1;
906
919
  node.c = STATE_CLEAN;
907
920
  }
908
921
  }
@@ -977,7 +990,7 @@ function runWithObserver(observer, run) {
977
990
  newFlags | LOADING_BIT | observer.h & UNINITIALIZED_BIT
978
991
  );
979
992
  } else {
980
- observer.E(error);
993
+ observer.D(error);
981
994
  }
982
995
  } finally {
983
996
  if (newSources) {
@@ -1021,29 +1034,29 @@ function compute(owner, fn, observer) {
1021
1034
  // src/core/effect.ts
1022
1035
  var Effect = class extends Computation {
1023
1036
  ca;
1024
- _;
1025
- O;
1026
- da = false;
1027
1037
  $;
1028
- C;
1038
+ P;
1039
+ da = false;
1040
+ S;
1041
+ A;
1029
1042
  constructor(initialValue, compute2, effect, error, options) {
1030
1043
  super(initialValue, compute2, options);
1031
1044
  this.ca = effect;
1032
- this._ = error;
1033
- this.$ = initialValue;
1034
- this.C = options?.render ? EFFECT_RENDER : EFFECT_USER;
1035
- if (this.C === EFFECT_RENDER) {
1036
- this.M = function(p) {
1037
- return !this.e && clock > this.B.created && !(this.h & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
1045
+ this.$ = error;
1046
+ this.S = initialValue;
1047
+ this.A = options?.render ? EFFECT_RENDER : EFFECT_USER;
1048
+ if (this.A === EFFECT_RENDER) {
1049
+ this.N = function(p) {
1050
+ return !this.e && clock > this.z.created && !(this.h & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
1038
1051
  };
1039
1052
  }
1040
- this.K();
1041
- !options?.defer && (this.C === EFFECT_USER ? getQueue(this).enqueue(this.C, this.F.bind(this)) : this.F(this.C));
1053
+ this.L();
1054
+ !options?.defer && (this.A === EFFECT_USER ? getQueue(this).enqueue(this.A, this.E.bind(this)) : this.E(this.A));
1042
1055
  }
1043
1056
  write(value, flags = 0) {
1044
1057
  if (this.c == STATE_DIRTY) {
1045
1058
  this.h = flags;
1046
- if (this.C === EFFECT_RENDER) {
1059
+ if (this.A === EFFECT_RENDER) {
1047
1060
  getQueue(this).notify(this, LOADING_BIT | ERROR_BIT, this.h);
1048
1061
  }
1049
1062
  }
@@ -1051,36 +1064,36 @@ var Effect = class extends Computation {
1051
1064
  return this.l;
1052
1065
  this.l = value;
1053
1066
  this.da = true;
1054
- this.L = void 0;
1067
+ this.M = void 0;
1055
1068
  return value;
1056
1069
  }
1057
- y(state, skipQueue) {
1070
+ w(state, skipQueue) {
1058
1071
  if (this.c >= state || skipQueue)
1059
1072
  return;
1060
- if (this.c === STATE_CLEAN)
1061
- getQueue(this).enqueue(this.C, this.F.bind(this));
1073
+ if (this.c === STATE_CLEAN || this.e && !ActiveTransition)
1074
+ getQueue(this).enqueue(this.A, this.E.bind(this));
1062
1075
  this.c = state;
1063
1076
  }
1064
- Z(mask, newFlags2) {
1077
+ _(mask, newFlags2) {
1065
1078
  if (this.e) {
1066
1079
  if (this.c >= STATE_DIRTY)
1067
1080
  return;
1068
1081
  if (mask & 3) {
1069
- this.y(STATE_DIRTY);
1082
+ this.w(STATE_DIRTY);
1070
1083
  return;
1071
1084
  }
1072
1085
  }
1073
- super.Z(mask, newFlags2);
1086
+ super._(mask, newFlags2);
1074
1087
  }
1075
- E(error) {
1076
- this.L = error;
1088
+ D(error) {
1089
+ this.M = error;
1077
1090
  getQueue(this).notify(this, LOADING_BIT, 0);
1078
1091
  this.h = ERROR_BIT;
1079
- if (this.C === EFFECT_USER) {
1092
+ if (this.A === EFFECT_USER) {
1080
1093
  try {
1081
- return this._ ? this._(error, () => {
1082
- this.O?.();
1083
- this.O = void 0;
1094
+ return this.$ ? this.$(error, () => {
1095
+ this.P?.();
1096
+ this.P = void 0;
1084
1097
  }) : console.error(error);
1085
1098
  } catch (e) {
1086
1099
  error = e;
@@ -1089,29 +1102,29 @@ var Effect = class extends Computation {
1089
1102
  if (!getQueue(this).notify(this, ERROR_BIT, ERROR_BIT))
1090
1103
  throw error;
1091
1104
  }
1092
- R() {
1105
+ T() {
1093
1106
  if (this.c === STATE_DISPOSED)
1094
1107
  return;
1095
1108
  this.ca = void 0;
1109
+ this.S = void 0;
1096
1110
  this.$ = void 0;
1097
- this._ = void 0;
1098
- this.O?.();
1099
- this.O = void 0;
1111
+ this.P?.();
1112
+ this.P = void 0;
1100
1113
  getQueue(this).notify(this, ERROR_BIT | LOADING_BIT, 0);
1101
- super.R();
1114
+ super.T();
1102
1115
  }
1103
- F(type) {
1116
+ E(type) {
1104
1117
  if (type) {
1105
1118
  const effect = this.e || this;
1106
1119
  if (effect.da && effect.c !== STATE_DISPOSED) {
1107
- effect.O?.();
1120
+ effect.P?.();
1108
1121
  try {
1109
- effect.O = effect.ca(effect.l, effect.$);
1122
+ effect.P = effect.ca(effect.l, effect.S);
1110
1123
  } catch (e) {
1111
1124
  if (!getQueue(effect).notify(effect, ERROR_BIT, ERROR_BIT))
1112
1125
  throw e;
1113
1126
  } finally {
1114
- effect.$ = effect.l;
1127
+ effect.S = effect.l;
1115
1128
  effect.da = false;
1116
1129
  }
1117
1130
  }
@@ -1122,16 +1135,16 @@ var Effect = class extends Computation {
1122
1135
  var EagerComputation = class extends Computation {
1123
1136
  constructor(initialValue, compute2, options) {
1124
1137
  super(initialValue, compute2, options);
1125
- !options?.defer && this.K();
1138
+ !options?.defer && this.L();
1126
1139
  }
1127
- y(state, skipQueue) {
1128
- if (this.c >= state && !this.D)
1140
+ w(state, skipQueue) {
1141
+ if (this.c >= state && !this.C)
1129
1142
  return;
1130
- if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.D))
1131
- getQueue(this).enqueue(EFFECT_PURE, this.F.bind(this));
1132
- super.y(state, skipQueue);
1143
+ if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.C))
1144
+ getQueue(this).enqueue(EFFECT_PURE, this.E.bind(this));
1145
+ super.w(state, skipQueue);
1133
1146
  }
1134
- F() {
1147
+ E() {
1135
1148
  this.c !== STATE_CLEAN && runTop(this);
1136
1149
  }
1137
1150
  };
@@ -1140,15 +1153,15 @@ var FirewallComputation = class extends Computation {
1140
1153
  constructor(compute2) {
1141
1154
  super(void 0, compute2);
1142
1155
  }
1143
- y(state, skipQueue) {
1144
- if (this.c >= state && !this.D)
1156
+ w(state, skipQueue) {
1157
+ if (this.c >= state && !this.C)
1145
1158
  return;
1146
- if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.D))
1147
- getQueue(this).enqueue(EFFECT_PURE, this.F.bind(this));
1148
- super.y(state, true);
1149
- this.D = !!skipQueue;
1159
+ if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.C))
1160
+ getQueue(this).enqueue(EFFECT_PURE, this.E.bind(this));
1161
+ super.w(state, true);
1162
+ this.C = !!skipQueue;
1150
1163
  }
1151
- F() {
1164
+ E() {
1152
1165
  this.c !== STATE_CLEAN && runTop(this);
1153
1166
  }
1154
1167
  };
@@ -1163,16 +1176,199 @@ function runTop(node) {
1163
1176
  }
1164
1177
  for (let i = ancestors.length - 1; i >= 0; i--) {
1165
1178
  if (ancestors[i].c !== STATE_DISPOSED)
1166
- ancestors[i].K();
1179
+ ancestors[i].L();
1180
+ }
1181
+ }
1182
+
1183
+ // src/signals.ts
1184
+ function createSignal(first, second, third) {
1185
+ if (typeof first === "function") {
1186
+ const memo = createMemo((p) => {
1187
+ const node2 = new Computation(
1188
+ first(p ? untrack(p[0]) : second),
1189
+ null,
1190
+ third
1191
+ );
1192
+ return [node2.read.bind(node2), node2.write.bind(node2)];
1193
+ });
1194
+ return [() => memo()[0](), (value) => memo()[1](value)];
1195
+ }
1196
+ const o = getOwner();
1197
+ const needsId = o?.id != null;
1198
+ const node = new Computation(
1199
+ first,
1200
+ null,
1201
+ needsId ? { id: o.getNextChildId(), ...second } : second
1202
+ );
1203
+ return [node.read.bind(node), node.write.bind(node)];
1204
+ }
1205
+ function createMemo(compute2, value, options) {
1206
+ let node = new Computation(
1207
+ value,
1208
+ compute2,
1209
+ options
1210
+ );
1211
+ let resolvedValue;
1212
+ return () => {
1213
+ if (node) {
1214
+ if (node.c === STATE_DISPOSED) {
1215
+ node = void 0;
1216
+ return resolvedValue;
1217
+ }
1218
+ resolvedValue = node.wait();
1219
+ if (!node.a?.length && node.m?.k !== node && !(node.h & UNINITIALIZED_BIT)) {
1220
+ node.dispose();
1221
+ node = void 0;
1222
+ }
1223
+ }
1224
+ return resolvedValue;
1225
+ };
1226
+ }
1227
+ function createAsync(compute2, value, options) {
1228
+ let refreshing = false;
1229
+ const node = new EagerComputation(
1230
+ value,
1231
+ (p) => {
1232
+ const source = compute2(p, refreshing);
1233
+ refreshing = false;
1234
+ const isPromise = source instanceof Promise;
1235
+ const iterator = source[Symbol.asyncIterator];
1236
+ if (!isPromise && !iterator) {
1237
+ return source;
1238
+ }
1239
+ let abort = false;
1240
+ onCleanup(() => abort = true);
1241
+ let transition2 = ActiveTransition;
1242
+ if (isPromise) {
1243
+ source.then(
1244
+ (value3) => {
1245
+ if (abort)
1246
+ return;
1247
+ if (transition2)
1248
+ return transition2.runTransition(() => {
1249
+ node.write(value3, 0, true);
1250
+ }, true);
1251
+ node.write(value3, 0, true);
1252
+ },
1253
+ (error) => {
1254
+ if (abort)
1255
+ return;
1256
+ if (transition2)
1257
+ return transition2.runTransition(() => node.D(error), true);
1258
+ node.D(error);
1259
+ }
1260
+ );
1261
+ } else {
1262
+ (async () => {
1263
+ try {
1264
+ for await (let value3 of source) {
1265
+ if (abort)
1266
+ return;
1267
+ if (transition2)
1268
+ return transition2.runTransition(() => {
1269
+ node.write(value3, 0, true);
1270
+ transition2 = null;
1271
+ }, true);
1272
+ node.write(value3, 0, true);
1273
+ }
1274
+ } catch (error) {
1275
+ if (abort)
1276
+ return;
1277
+ if (transition2)
1278
+ return transition2.runTransition(() => {
1279
+ node.D(error);
1280
+ transition2 = null;
1281
+ }, true);
1282
+ node.D(error);
1283
+ }
1284
+ })();
1285
+ }
1286
+ throw new NotReadyError();
1287
+ },
1288
+ options
1289
+ );
1290
+ const read = node.wait.bind(node);
1291
+ read.refresh = () => {
1292
+ let n = node;
1293
+ if (ActiveTransition && !node.e) {
1294
+ n = cloneGraph(node);
1295
+ }
1296
+ n.c = STATE_DIRTY;
1297
+ refreshing = true;
1298
+ n.L();
1299
+ };
1300
+ return read;
1301
+ }
1302
+ function createEffect(compute2, effect, value, options) {
1303
+ void new Effect(
1304
+ value,
1305
+ compute2,
1306
+ effect.effect ? effect.effect : effect,
1307
+ effect.error,
1308
+ options
1309
+ );
1310
+ }
1311
+ function createRenderEffect(compute2, effect, value, options) {
1312
+ void new Effect(value, compute2, effect, void 0, {
1313
+ render: true,
1314
+ ...options
1315
+ });
1316
+ }
1317
+ function createRoot(init, options) {
1318
+ const owner = new Owner(options?.id);
1319
+ return compute(owner, !init.length ? init : () => init(() => owner.dispose()), null);
1320
+ }
1321
+ function runWithOwner(owner, run) {
1322
+ return compute(owner, run, null);
1323
+ }
1324
+ function resolve(fn) {
1325
+ return new Promise((res, rej) => {
1326
+ createRoot((dispose) => {
1327
+ new EagerComputation(void 0, () => {
1328
+ try {
1329
+ res(fn());
1330
+ } catch (err) {
1331
+ if (err instanceof NotReadyError)
1332
+ throw err;
1333
+ rej(err);
1334
+ }
1335
+ dispose();
1336
+ });
1337
+ });
1338
+ });
1339
+ }
1340
+ function createPending() {
1341
+ const node = new Computation(false, null);
1342
+ const reset = () => node.write(false);
1343
+ function write() {
1344
+ if (!ActiveTransition)
1345
+ return false;
1346
+ ActiveTransition.addOptimistic(reset);
1347
+ queueMicrotask(() => reset.j && node.write(true));
1167
1348
  }
1349
+ function read() {
1350
+ const v = node.read();
1351
+ return ActiveTransition ? false : v;
1352
+ }
1353
+ return [read, write];
1354
+ }
1355
+ function useTransition() {
1356
+ const [pending, setPending] = createPending();
1357
+ function start(fn) {
1358
+ transition((resume) => {
1359
+ setPending(true);
1360
+ return fn(resume);
1361
+ });
1362
+ }
1363
+ return [pending, start];
1168
1364
  }
1169
1365
 
1170
1366
  // src/store/reconcile.ts
1171
1367
  function unwrap(value) {
1172
1368
  return value?.[$TARGET]?.[STORE_NODE] ?? value;
1173
1369
  }
1174
- function getOverrideValue(value, override, key) {
1175
- return override && key in override ? override[key] : value[key];
1370
+ function getOverrideValue(value, override, nodes, key) {
1371
+ return nodes && key in nodes ? nodes[key].read() : override && key in override ? override[key] : value[key];
1176
1372
  }
1177
1373
  function getAllKeys(value, override, next) {
1178
1374
  const keys = getKeys(value, override);
@@ -1185,6 +1381,7 @@ function applyState(next, state, keyFn, all) {
1185
1381
  return;
1186
1382
  const previous = target[STORE_VALUE];
1187
1383
  const override = target[STORE_OVERRIDE];
1384
+ let nodes = target[STORE_NODE];
1188
1385
  if (next === previous && !override)
1189
1386
  return;
1190
1387
  (target[STORE_LOOKUP] || storeLookup).set(next, target[$PROXY]);
@@ -1192,14 +1389,14 @@ function applyState(next, state, keyFn, all) {
1192
1389
  target[STORE_OVERRIDE] = void 0;
1193
1390
  if (Array.isArray(previous)) {
1194
1391
  let changed = false;
1195
- const prevLength = getOverrideValue(previous, override, "length");
1392
+ const prevLength = getOverrideValue(previous, override, nodes, "length");
1196
1393
  if (next.length && prevLength && next[0] && keyFn(next[0]) != null) {
1197
1394
  let i, j, start, end, newEnd, item, newIndicesNext, keyVal;
1198
- for (start = 0, end = Math.min(prevLength, next.length); start < end && ((item = getOverrideValue(previous, override, start)) === next[start] || item && next[start] && keyFn(item) === keyFn(next[start])); start++) {
1395
+ for (start = 0, end = Math.min(prevLength, next.length); start < end && ((item = getOverrideValue(previous, override, nodes, start)) === next[start] || item && next[start] && keyFn(item) === keyFn(next[start])); start++) {
1199
1396
  applyState(next[start], wrap(item, target), keyFn, all);
1200
1397
  }
1201
1398
  const temp = new Array(next.length), newIndices = /* @__PURE__ */ new Map();
1202
- for (end = prevLength - 1, newEnd = next.length - 1; end >= start && newEnd >= start && ((item = getOverrideValue(previous, override, end)) === next[newEnd] || item && next[newEnd] && keyFn(item) === keyFn(next[newEnd])); end--, newEnd--) {
1399
+ for (end = prevLength - 1, newEnd = next.length - 1; end >= start && newEnd >= start && ((item = getOverrideValue(previous, override, nodes, end)) === next[newEnd] || item && next[newEnd] && keyFn(item) === keyFn(next[newEnd])); end--, newEnd--) {
1203
1400
  temp[newEnd] = item;
1204
1401
  }
1205
1402
  if (start > newEnd || start > end) {
@@ -1226,7 +1423,7 @@ function applyState(next, state, keyFn, all) {
1226
1423
  newIndices.set(keyVal, j);
1227
1424
  }
1228
1425
  for (i = start; i <= end; i++) {
1229
- item = getOverrideValue(previous, override, i);
1426
+ item = getOverrideValue(previous, override, nodes, i);
1230
1427
  keyVal = item ? keyFn(item) : item;
1231
1428
  j = newIndices.get(keyVal);
1232
1429
  if (j !== void 0 && j !== -1) {
@@ -1247,7 +1444,7 @@ function applyState(next, state, keyFn, all) {
1247
1444
  changed = true;
1248
1445
  } else if (prevLength && next.length) {
1249
1446
  for (let i = 0, len = next.length; i < len; i++) {
1250
- const item = getOverrideValue(previous, override, i);
1447
+ const item = getOverrideValue(previous, override, nodes, i);
1251
1448
  isWrappable(item) && applyState(next[i], wrap(item, target), keyFn, all);
1252
1449
  }
1253
1450
  }
@@ -1258,14 +1455,13 @@ function applyState(next, state, keyFn, all) {
1258
1455
  changed && target[STORE_NODE][$TRACK]?.write(void 0);
1259
1456
  return;
1260
1457
  }
1261
- let nodes = target[STORE_NODE];
1262
1458
  if (nodes) {
1263
1459
  const tracked = nodes[$TRACK];
1264
1460
  const keys = tracked || all ? getAllKeys(previous, override, next) : Object.keys(nodes);
1265
1461
  for (let i = 0, len = keys.length; i < len; i++) {
1266
1462
  const key = keys[i];
1267
1463
  const node = nodes[key];
1268
- const previousValue = unwrap(getOverrideValue(previous, override, key));
1464
+ const previousValue = unwrap(getOverrideValue(previous, override, nodes, key));
1269
1465
  let nextValue = unwrap(next[key]);
1270
1466
  if (previousValue === nextValue)
1271
1467
  continue;
@@ -1296,16 +1492,7 @@ function reconcile(value, key, all = false) {
1296
1492
  }
1297
1493
 
1298
1494
  // src/store/projection.ts
1299
- function createProjection(fn, initialValue = {}, options) {
1300
- let wrappedStore;
1301
- const node = new FirewallComputation(() => {
1302
- storeSetter(wrappedStore, (s) => {
1303
- const value = fn(s);
1304
- if (value !== s && value !== void 0) {
1305
- reconcile(value, options?.key || "id", options?.all)(s);
1306
- }
1307
- });
1308
- });
1495
+ function createProjectionInternal(fn, initialValue = {}, options) {
1309
1496
  const wrappedMap = /* @__PURE__ */ new WeakMap();
1310
1497
  const traps = {
1311
1498
  ...storeTraps,
@@ -1316,7 +1503,7 @@ function createProjection(fn, initialValue = {}, options) {
1316
1503
  return storeTraps.get(target, property, receiver);
1317
1504
  }
1318
1505
  };
1319
- function wrapProjection(source) {
1506
+ const wrapProjection = (source) => {
1320
1507
  if (wrappedMap.has(source))
1321
1508
  return wrappedMap.get(source);
1322
1509
  if (source[$TARGET]?.[STORE_WRAP] === wrapProjection)
@@ -1327,8 +1514,20 @@ function createProjection(fn, initialValue = {}, options) {
1327
1514
  });
1328
1515
  wrappedMap.set(source, wrapped);
1329
1516
  return wrapped;
1330
- }
1331
- return wrappedStore = wrapProjection(initialValue);
1517
+ };
1518
+ const wrappedStore = wrapProjection(initialValue);
1519
+ const node = new FirewallComputation(() => {
1520
+ storeSetter(wrappedStore, (s) => {
1521
+ const value = fn(s);
1522
+ if (value !== s && value !== void 0) {
1523
+ reconcile(value, options?.key || "id", options?.all)(s);
1524
+ }
1525
+ });
1526
+ });
1527
+ return { store: wrappedStore, node };
1528
+ }
1529
+ function createProjection(fn, initialValue = {}, options) {
1530
+ return createProjectionInternal(fn, initialValue, options).store;
1332
1531
  }
1333
1532
 
1334
1533
  // src/store/store.ts
@@ -1464,7 +1663,7 @@ var storeTraps = {
1464
1663
  untrack(() => {
1465
1664
  const state = target[STORE_VALUE];
1466
1665
  const base = state[property];
1467
- const prev = target[STORE_OVERRIDE]?.[property] || base;
1666
+ const prev = target[STORE_OVERRIDE] && property in target[STORE_OVERRIDE] ? target[STORE_OVERRIDE][property] : base;
1468
1667
  const value = rawValue?.[$TARGET]?.[STORE_VALUE] ?? rawValue;
1469
1668
  if (prev === value)
1470
1669
  return true;
@@ -1496,7 +1695,7 @@ var storeTraps = {
1496
1695
  deleteProperty(target, property) {
1497
1696
  if (Writing?.has(target[$PROXY]) && target[STORE_OVERRIDE]?.[property] !== $DELETED) {
1498
1697
  untrack(() => {
1499
- const prev = target[STORE_OVERRIDE]?.[property] || target[STORE_VALUE][property];
1698
+ const prev = target[STORE_OVERRIDE] && property in target[STORE_OVERRIDE] ? target[STORE_OVERRIDE][property] : target[STORE_VALUE][property];
1500
1699
  if (property in target[STORE_VALUE]) {
1501
1700
  (target[STORE_OVERRIDE] || (target[STORE_OVERRIDE] = /* @__PURE__ */ Object.create(null)))[property] = $DELETED;
1502
1701
  } else if (target[STORE_OVERRIDE] && property in target[STORE_OVERRIDE]) {
@@ -1555,7 +1754,7 @@ function storeSetter(store, fn) {
1555
1754
  }
1556
1755
  }
1557
1756
  function createStore(first, second, options) {
1558
- const derived = typeof first === "function", wrappedStore = derived ? createProjection(first, second, options) : wrap(first);
1757
+ const derived = typeof first === "function", wrappedStore = derived ? createProjectionInternal(first, second, options).store : wrap(first);
1559
1758
  return [wrappedStore, (fn) => storeSetter(wrappedStore, fn)];
1560
1759
  }
1561
1760
  function recursivelyNotify(state, lookup) {
@@ -1619,6 +1818,29 @@ function deep(store) {
1619
1818
  return store[$DEEP];
1620
1819
  }
1621
1820
 
1821
+ // src/store/optimistic.ts
1822
+ function createOptimistic(first, second, options) {
1823
+ const derived = typeof first === "function";
1824
+ const { store, node } = derived ? createProjectionInternal(first, second, options) : createProjectionInternal(() => {
1825
+ }, first);
1826
+ const reset = () => storeSetter(
1827
+ store,
1828
+ reconcile(
1829
+ derived ? first(store) || store : first,
1830
+ options?.key || "id",
1831
+ options?.all
1832
+ )
1833
+ );
1834
+ const write = (v) => {
1835
+ if (!ActiveTransition)
1836
+ throw new Error("createOptimistic can only be updated inside a transition");
1837
+ ActiveTransition.addOptimistic(reset);
1838
+ cloneGraph(node, true);
1839
+ queueMicrotask(() => reset.j && storeSetter(store, v));
1840
+ };
1841
+ return [store, write];
1842
+ }
1843
+
1622
1844
  // src/store/utils.ts
1623
1845
  function snapshot(item, map, lookup) {
1624
1846
  let target, isArray, override, result, unwrapped, v;
@@ -1819,266 +2041,57 @@ function omit(props, ...keys) {
1819
2041
  return result;
1820
2042
  }
1821
2043
 
1822
- // src/signals.ts
1823
- function createSignal(first, second, third) {
1824
- if (typeof first === "function") {
1825
- const memo = createMemo((p) => {
1826
- const node2 = new Computation(
1827
- first(p ? untrack(p[0]) : second),
1828
- null,
1829
- third
1830
- );
1831
- return [node2.read.bind(node2), node2.write.bind(node2)];
1832
- });
1833
- return [() => memo()[0](), (value) => memo()[1](value)];
1834
- }
1835
- const o = getOwner();
1836
- const needsId = o?.id != null;
1837
- const node = new Computation(
1838
- first,
1839
- null,
1840
- needsId ? { id: o.getNextChildId(), ...second } : second
1841
- );
1842
- return [node.read.bind(node), node.write.bind(node)];
1843
- }
1844
- function createMemo(compute2, value, options) {
1845
- let node = new Computation(
1846
- value,
1847
- compute2,
1848
- options
1849
- );
1850
- let resolvedValue;
1851
- return () => {
1852
- if (node) {
1853
- if (node.c === STATE_DISPOSED) {
1854
- node = void 0;
1855
- return resolvedValue;
1856
- }
1857
- resolvedValue = node.wait();
1858
- if (!node.a?.length && node.m?.k !== node && !(node.h & UNINITIALIZED_BIT)) {
1859
- node.dispose();
1860
- node = void 0;
1861
- }
1862
- }
1863
- return resolvedValue;
1864
- };
1865
- }
1866
- function createAsync(compute2, value, options) {
1867
- let refreshing = false;
1868
- const node = new EagerComputation(
1869
- value,
1870
- (p) => {
1871
- const source = compute2(p, refreshing);
1872
- refreshing = false;
1873
- const isPromise = source instanceof Promise;
1874
- const iterator = source[Symbol.asyncIterator];
1875
- if (!isPromise && !iterator) {
1876
- return source;
1877
- }
1878
- let abort = false;
1879
- onCleanup(() => abort = true);
1880
- let transition2 = ActiveTransition;
1881
- if (isPromise) {
1882
- source.then(
1883
- (value3) => {
1884
- if (abort)
1885
- return;
1886
- if (transition2)
1887
- return transition2.runTransition(() => {
1888
- node.write(value3, 0, true);
1889
- }, true);
1890
- node.write(value3, 0, true);
1891
- },
1892
- (error) => {
1893
- if (abort)
1894
- return;
1895
- if (transition2)
1896
- return transition2.runTransition(() => node.E(error), true);
1897
- node.E(error);
1898
- }
1899
- );
1900
- } else {
1901
- (async () => {
1902
- try {
1903
- for await (let value3 of source) {
1904
- if (abort)
1905
- return;
1906
- if (transition2)
1907
- return transition2.runTransition(() => {
1908
- node.write(value3, 0, true);
1909
- transition2 = null;
1910
- }, true);
1911
- node.write(value3, 0, true);
1912
- }
1913
- } catch (error) {
1914
- if (abort)
1915
- return;
1916
- if (transition2)
1917
- return transition2.runTransition(() => {
1918
- node.E(error);
1919
- transition2 = null;
1920
- }, true);
1921
- node.E(error);
1922
- }
1923
- })();
1924
- }
1925
- throw new NotReadyError();
1926
- },
1927
- options
1928
- );
1929
- const read = node.wait.bind(node);
1930
- read.refresh = () => {
1931
- let n = node;
1932
- if (ActiveTransition && !node.e) {
1933
- n = cloneGraph(node);
1934
- }
1935
- n.c = STATE_DIRTY;
1936
- refreshing = true;
1937
- n.K();
1938
- };
1939
- return read;
1940
- }
1941
- function createEffect(compute2, effect, value, options) {
1942
- void new Effect(
1943
- value,
1944
- compute2,
1945
- effect.effect ? effect.effect : effect,
1946
- effect.error,
1947
- options
1948
- );
1949
- }
1950
- function createRenderEffect(compute2, effect, value, options) {
1951
- void new Effect(value, compute2, effect, void 0, {
1952
- render: true,
1953
- ...options
1954
- });
1955
- }
1956
- function createRoot(init, options) {
1957
- const owner = new Owner(options?.id);
1958
- return compute(owner, !init.length ? init : () => init(() => owner.dispose()), null);
1959
- }
1960
- function runWithOwner(owner, run) {
1961
- return compute(owner, run, null);
1962
- }
1963
- function resolve(fn) {
1964
- return new Promise((res, rej) => {
1965
- createRoot((dispose) => {
1966
- new EagerComputation(void 0, () => {
1967
- try {
1968
- res(fn());
1969
- } catch (err) {
1970
- if (err instanceof NotReadyError)
1971
- throw err;
1972
- rej(err);
1973
- }
1974
- dispose();
1975
- });
1976
- });
1977
- });
1978
- }
1979
- function createPending() {
1980
- const node = new Computation(false, null);
1981
- const reset = () => node.write(false);
1982
- function write() {
1983
- if (!ActiveTransition)
1984
- return false;
1985
- ActiveTransition.addOptimistic(reset);
1986
- queueMicrotask(() => reset.j && node.write(true));
1987
- }
1988
- function read() {
1989
- const v = node.read();
1990
- return ActiveTransition ? false : v;
1991
- }
1992
- return [read, write];
1993
- }
1994
- function useTransition() {
1995
- const [pending, setPending] = createPending();
1996
- function start(fn) {
1997
- transition((resume) => {
1998
- setPending(true);
1999
- return fn(resume);
2000
- });
2001
- }
2002
- return [pending, start];
2003
- }
2004
- function createOptimistic(first, second, options) {
2005
- let store, setStore;
2006
- if (typeof first === "function") {
2007
- [store, setStore] = createStore((s) => {
2008
- const value = first(s);
2009
- if (!ActiveTransition)
2010
- return value;
2011
- ActiveTransition.addOptimistic(reset);
2012
- }, {});
2013
- } else
2014
- [store, setStore] = createStore(first);
2015
- const reset = () => setStore(
2016
- reconcile(
2017
- typeof first === "function" ? first(second) : first,
2018
- options?.key || "id",
2019
- options?.all
2020
- )
2021
- );
2022
- function write(v) {
2023
- if (!ActiveTransition)
2024
- throw new Error("createOptimistic can only be updated inside a transition");
2025
- ActiveTransition.addOptimistic(reset);
2026
- queueMicrotask(() => reset.j && setStore(v));
2027
- }
2028
- return [store, write];
2029
- }
2030
-
2031
2044
  // src/map.ts
2032
2045
  function mapArray(list, map, options) {
2033
2046
  const keyFn = typeof options?.keyed === "function" ? options.keyed : void 0;
2034
2047
  return updateKeyedMap.bind({
2035
- S: new Owner(),
2048
+ U: new Owner(),
2036
2049
  o: 0,
2037
2050
  ia: list,
2038
- G: [],
2039
- P: map,
2051
+ F: [],
2052
+ Q: map,
2040
2053
  i: [],
2041
2054
  d: [],
2042
- Q: keyFn,
2055
+ R: keyFn,
2043
2056
  p: keyFn || options?.keyed === false ? [] : void 0,
2044
2057
  q: map.length > 1 ? [] : void 0,
2045
- T: options?.fallback
2058
+ V: options?.fallback
2046
2059
  });
2047
2060
  }
2048
2061
  var pureOptions = { pureWrite: true };
2049
2062
  function updateKeyedMap() {
2050
2063
  const newItems = this.ia() || [], newLen = newItems.length;
2051
2064
  newItems[$TRACK];
2052
- runWithOwner(this.S, () => {
2065
+ runWithOwner(this.U, () => {
2053
2066
  let i, j, mapper = this.p ? () => {
2054
2067
  this.p[j] = new Computation(newItems[j], null, pureOptions);
2055
2068
  this.q && (this.q[j] = new Computation(j, null, pureOptions));
2056
- return this.P(
2069
+ return this.Q(
2057
2070
  Computation.prototype.read.bind(this.p[j]),
2058
2071
  this.q ? Computation.prototype.read.bind(this.q[j]) : void 0
2059
2072
  );
2060
2073
  } : this.q ? () => {
2061
2074
  const item = newItems[j];
2062
2075
  this.q[j] = new Computation(j, null, pureOptions);
2063
- return this.P(() => item, Computation.prototype.read.bind(this.q[j]));
2076
+ return this.Q(() => item, Computation.prototype.read.bind(this.q[j]));
2064
2077
  } : () => {
2065
2078
  const item = newItems[j];
2066
- return this.P(() => item);
2079
+ return this.Q(() => item);
2067
2080
  };
2068
2081
  if (newLen === 0) {
2069
2082
  if (this.o !== 0) {
2070
- this.S.dispose(false);
2083
+ this.U.dispose(false);
2071
2084
  this.d = [];
2072
- this.G = [];
2085
+ this.F = [];
2073
2086
  this.i = [];
2074
2087
  this.o = 0;
2075
2088
  this.p && (this.p = []);
2076
2089
  this.q && (this.q = []);
2077
2090
  }
2078
- if (this.T && !this.i[0]) {
2091
+ if (this.V && !this.i[0]) {
2079
2092
  this.i[0] = compute(
2080
2093
  this.d[0] = new Owner(),
2081
- this.T,
2094
+ this.V,
2082
2095
  null
2083
2096
  );
2084
2097
  }
@@ -2087,17 +2100,17 @@ function updateKeyedMap() {
2087
2100
  this.d[0].dispose();
2088
2101
  this.i = new Array(newLen);
2089
2102
  for (j = 0; j < newLen; j++) {
2090
- this.G[j] = newItems[j];
2103
+ this.F[j] = newItems[j];
2091
2104
  this.i[j] = compute(this.d[j] = new Owner(), mapper, null);
2092
2105
  }
2093
2106
  this.o = newLen;
2094
2107
  } else {
2095
2108
  let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.p ? new Array(newLen) : void 0, tempIndexes = this.q ? new Array(newLen) : void 0;
2096
- for (start = 0, end = Math.min(this.o, newLen); start < end && (this.G[start] === newItems[start] || this.p && compare(this.Q, this.G[start], newItems[start])); start++) {
2109
+ for (start = 0, end = Math.min(this.o, newLen); start < end && (this.F[start] === newItems[start] || this.p && compare(this.R, this.F[start], newItems[start])); start++) {
2097
2110
  if (this.p)
2098
2111
  this.p[start].write(newItems[start]);
2099
2112
  }
2100
- for (end = this.o - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.G[end] === newItems[newEnd] || this.p && compare(this.Q, this.G[end], newItems[newEnd])); end--, newEnd--) {
2113
+ for (end = this.o - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.F[end] === newItems[newEnd] || this.p && compare(this.R, this.F[end], newItems[newEnd])); end--, newEnd--) {
2101
2114
  temp[newEnd] = this.i[end];
2102
2115
  tempNodes[newEnd] = this.d[end];
2103
2116
  tempRows && (tempRows[newEnd] = this.p[end]);
@@ -2107,14 +2120,14 @@ function updateKeyedMap() {
2107
2120
  newIndicesNext = new Array(newEnd + 1);
2108
2121
  for (j = newEnd; j >= start; j--) {
2109
2122
  item = newItems[j];
2110
- key = this.Q ? this.Q(item) : item;
2123
+ key = this.R ? this.R(item) : item;
2111
2124
  i = newIndices.get(key);
2112
2125
  newIndicesNext[j] = i === void 0 ? -1 : i;
2113
2126
  newIndices.set(key, j);
2114
2127
  }
2115
2128
  for (i = start; i <= end; i++) {
2116
- item = this.G[i];
2117
- key = this.Q ? this.Q(item) : item;
2129
+ item = this.F[i];
2130
+ key = this.R ? this.R(item) : item;
2118
2131
  j = newIndices.get(key);
2119
2132
  if (j !== void 0 && j !== -1) {
2120
2133
  temp[j] = this.i[i];
@@ -2143,59 +2156,59 @@ function updateKeyedMap() {
2143
2156
  }
2144
2157
  }
2145
2158
  this.i = this.i.slice(0, this.o = newLen);
2146
- this.G = newItems.slice(0);
2159
+ this.F = newItems.slice(0);
2147
2160
  }
2148
2161
  });
2149
2162
  return this.i;
2150
2163
  }
2151
2164
  function repeat(count, map, options) {
2152
2165
  return updateRepeat.bind({
2153
- S: new Owner(),
2166
+ U: new Owner(),
2154
2167
  o: 0,
2155
- z: 0,
2168
+ x: 0,
2156
2169
  ja: count,
2157
- P: map,
2170
+ Q: map,
2158
2171
  d: [],
2159
2172
  i: [],
2160
2173
  ka: options?.from,
2161
- T: options?.fallback
2174
+ V: options?.fallback
2162
2175
  });
2163
2176
  }
2164
2177
  function updateRepeat() {
2165
2178
  const newLen = this.ja();
2166
2179
  const from = this.ka?.() || 0;
2167
- runWithOwner(this.S, () => {
2180
+ runWithOwner(this.U, () => {
2168
2181
  if (newLen === 0) {
2169
2182
  if (this.o !== 0) {
2170
- this.S.dispose(false);
2183
+ this.U.dispose(false);
2171
2184
  this.d = [];
2172
2185
  this.i = [];
2173
2186
  this.o = 0;
2174
2187
  }
2175
- if (this.T && !this.i[0]) {
2188
+ if (this.V && !this.i[0]) {
2176
2189
  this.i[0] = compute(
2177
2190
  this.d[0] = new Owner(),
2178
- this.T,
2191
+ this.V,
2179
2192
  null
2180
2193
  );
2181
2194
  }
2182
2195
  return;
2183
2196
  }
2184
2197
  const to = from + newLen;
2185
- const prevTo = this.z + this.o;
2198
+ const prevTo = this.x + this.o;
2186
2199
  if (this.o === 0 && this.d[0])
2187
2200
  this.d[0].dispose();
2188
2201
  for (let i = to; i < prevTo; i++)
2189
- this.d[i - this.z].dispose();
2190
- if (this.z < from) {
2191
- let i = this.z;
2202
+ this.d[i - this.x].dispose();
2203
+ if (this.x < from) {
2204
+ let i = this.x;
2192
2205
  while (i < from && i < this.o)
2193
2206
  this.d[i++].dispose();
2194
- this.d.splice(0, from - this.z);
2195
- this.i.splice(0, from - this.z);
2196
- } else if (this.z > from) {
2197
- let i = prevTo - this.z - 1;
2198
- let difference = this.z - from;
2207
+ this.d.splice(0, from - this.x);
2208
+ this.i.splice(0, from - this.x);
2209
+ } else if (this.x > from) {
2210
+ let i = prevTo - this.x - 1;
2211
+ let difference = this.x - from;
2199
2212
  this.d.length = this.i.length = newLen;
2200
2213
  while (i >= difference) {
2201
2214
  this.d[i] = this.d[i - difference];
@@ -2205,7 +2218,7 @@ function updateRepeat() {
2205
2218
  for (let i2 = 0; i2 < difference; i2++) {
2206
2219
  this.i[i2] = compute(
2207
2220
  this.d[i2] = new Owner(),
2208
- () => this.P(i2 + from),
2221
+ () => this.Q(i2 + from),
2209
2222
  null
2210
2223
  );
2211
2224
  }
@@ -2213,12 +2226,12 @@ function updateRepeat() {
2213
2226
  for (let i = prevTo; i < to; i++) {
2214
2227
  this.i[i - from] = compute(
2215
2228
  this.d[i - from] = new Owner(),
2216
- () => this.P(i),
2229
+ () => this.Q(i),
2217
2230
  null
2218
2231
  );
2219
2232
  }
2220
2233
  this.i = this.i.slice(0, newLen);
2221
- this.z = from;
2234
+ this.x = from;
2222
2235
  this.o = newLen;
2223
2236
  });
2224
2237
  return this.i;
@@ -2229,24 +2242,24 @@ function compare(key, a, b) {
2229
2242
 
2230
2243
  // src/boundaries.ts
2231
2244
  var BoundaryComputation = class extends EagerComputation {
2232
- U;
2245
+ W;
2233
2246
  constructor(compute2, propagationMask) {
2234
2247
  super(void 0, compute2, { defer: true });
2235
- this.U = propagationMask;
2248
+ this.W = propagationMask;
2236
2249
  }
2237
2250
  write(value, flags) {
2238
- super.write(value, flags & ~this.U);
2239
- if (this.U & LOADING_BIT && !(this.h & UNINITIALIZED_BIT || ActiveTransition)) {
2251
+ super.write(value, flags & ~this.W);
2252
+ if (this.W & LOADING_BIT && !(this.h & UNINITIALIZED_BIT || ActiveTransition)) {
2240
2253
  flags &= ~LOADING_BIT;
2241
2254
  }
2242
- getQueue(this).notify(this, this.U, flags);
2255
+ getQueue(this).notify(this, this.W, flags);
2243
2256
  return this.l;
2244
2257
  }
2245
2258
  };
2246
2259
  function createBoundChildren(owner, fn, queue, mask) {
2247
- const parentQueue = owner.B;
2248
- parentQueue.addChild(owner.B = queue);
2249
- onCleanup(() => parentQueue.removeChild(owner.B));
2260
+ const parentQueue = owner.z;
2261
+ parentQueue.addChild(owner.z = queue);
2262
+ onCleanup(() => parentQueue.removeChild(owner.z));
2250
2263
  return compute(
2251
2264
  owner,
2252
2265
  () => {
@@ -2257,77 +2270,73 @@ function createBoundChildren(owner, fn, queue, mask) {
2257
2270
  );
2258
2271
  }
2259
2272
  var ConditionalQueue = class extends Queue {
2260
- t;
2261
- V = /* @__PURE__ */ new Set();
2262
- s = /* @__PURE__ */ new Set();
2273
+ s;
2274
+ X = /* @__PURE__ */ new Set();
2275
+ r = /* @__PURE__ */ new Set();
2263
2276
  constructor(disabled) {
2264
2277
  super();
2265
- this.t = disabled;
2278
+ this.s = disabled;
2266
2279
  }
2267
2280
  run(type) {
2268
- if (!type || this.t.read())
2281
+ if (!type || this.s.read())
2269
2282
  return;
2270
2283
  return super.run(type);
2271
2284
  }
2272
2285
  notify(node, type, flags) {
2273
- if (ActiveTransition && ActiveTransition.r.has(this))
2274
- return ActiveTransition.r.get(this).notify(node, type, flags);
2275
- if (this.t.read()) {
2286
+ if (this.s.read()) {
2276
2287
  if (type & LOADING_BIT) {
2277
2288
  if (flags & LOADING_BIT) {
2278
- this.s.add(node);
2289
+ this.r.add(node);
2279
2290
  type &= ~LOADING_BIT;
2280
- } else if (this.s.delete(node))
2291
+ } else if (this.r.delete(node))
2281
2292
  type &= ~LOADING_BIT;
2282
2293
  }
2283
2294
  if (type & ERROR_BIT) {
2284
2295
  if (flags & ERROR_BIT) {
2285
- this.V.add(node);
2296
+ this.X.add(node);
2286
2297
  type &= ~ERROR_BIT;
2287
- } else if (this.V.delete(node))
2298
+ } else if (this.X.delete(node))
2288
2299
  type &= ~ERROR_BIT;
2289
2300
  }
2290
2301
  }
2291
2302
  return type ? super.notify(node, type, flags) : true;
2292
2303
  }
2293
2304
  merge(queue) {
2294
- queue.s.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2295
- queue.V.forEach((n) => this.notify(n, ERROR_BIT, ERROR_BIT));
2305
+ queue.r.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2306
+ queue.X.forEach((n) => this.notify(n, ERROR_BIT, ERROR_BIT));
2296
2307
  super.merge(queue);
2297
2308
  }
2298
2309
  };
2299
2310
  var CollectionQueue = class extends Queue {
2300
- J;
2311
+ K;
2301
2312
  d = /* @__PURE__ */ new Set();
2302
- t = new Computation(false, null, { pureWrite: true });
2313
+ s = new Computation(false, null, { pureWrite: true });
2303
2314
  constructor(type) {
2304
2315
  super();
2305
- this.J = type;
2316
+ this.K = type;
2306
2317
  }
2307
2318
  run(type) {
2308
- if (!type || this.t.read())
2319
+ if (!type || this.s.read())
2309
2320
  return;
2310
2321
  return super.run(type);
2311
2322
  }
2312
2323
  notify(node, type, flags) {
2313
- if (ActiveTransition && ActiveTransition.r.has(this))
2314
- return ActiveTransition.r.get(this).notify(node, type, flags);
2315
- if (!(type & this.J))
2324
+ if (!(type & this.K))
2316
2325
  return super.notify(node, type, flags);
2317
- if (flags & this.J) {
2326
+ if (flags & this.K) {
2318
2327
  this.d.add(node);
2319
2328
  if (this.d.size === 1)
2320
- this.t.write(true);
2329
+ this.s.write(true);
2321
2330
  } else if (this.d.size > 0) {
2322
2331
  this.d.delete(node);
2323
2332
  if (this.d.size === 0)
2324
- this.t.write(false);
2333
+ this.s.write(false);
2325
2334
  }
2326
- type &= ~this.J;
2335
+ type &= ~this.K;
2327
2336
  return type ? super.notify(node, type, flags) : true;
2328
2337
  }
2329
2338
  merge(queue) {
2330
- queue.d.forEach((n) => this.notify(n, this.J, this.J));
2339
+ queue.d.forEach((n) => this.notify(n, this.K, this.K));
2331
2340
  super.merge(queue);
2332
2341
  }
2333
2342
  };
@@ -2338,25 +2347,25 @@ function createBoundary(fn, condition) {
2338
2347
  );
2339
2348
  const tree = createBoundChildren(owner, fn, queue, 0);
2340
2349
  new EagerComputation(void 0, () => {
2341
- const disabled = queue.t.read();
2342
- tree.U = disabled ? ERROR_BIT | LOADING_BIT : 0;
2350
+ const disabled = queue.s.read();
2351
+ tree.W = disabled ? ERROR_BIT | LOADING_BIT : 0;
2343
2352
  if (!disabled) {
2344
- queue.s.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2345
- queue.V.forEach((node) => queue.notify(node, ERROR_BIT, ERROR_BIT));
2346
- queue.s.clear();
2347
- queue.V.clear();
2353
+ queue.r.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2354
+ queue.X.forEach((node) => queue.notify(node, ERROR_BIT, ERROR_BIT));
2355
+ queue.r.clear();
2356
+ queue.X.clear();
2348
2357
  }
2349
2358
  });
2350
- return () => queue.t.read() ? void 0 : tree.read();
2359
+ return () => queue.s.read() ? void 0 : tree.read();
2351
2360
  }
2352
2361
  function createCollectionBoundary(type, fn, fallback) {
2353
2362
  const owner = new Owner();
2354
2363
  const queue = new CollectionQueue(type);
2355
2364
  const tree = createBoundChildren(owner, fn, queue, type);
2356
2365
  const decision = new Computation(void 0, () => {
2357
- if (!queue.t.read()) {
2366
+ if (!queue.s.read()) {
2358
2367
  const resolved = tree.read();
2359
- if (!untrack(() => queue.t.read()))
2368
+ if (!untrack(() => queue.s.read()))
2360
2369
  return resolved;
2361
2370
  }
2362
2371
  return fallback(queue);
@@ -2369,13 +2378,13 @@ function createSuspense(fn, fallback) {
2369
2378
  function createErrorBoundary(fn, fallback) {
2370
2379
  return createCollectionBoundary(ERROR_BIT, fn, (queue) => {
2371
2380
  let node = getTransitionSource(queue.d.values().next().value);
2372
- return fallback(node.L, () => {
2381
+ return fallback(node.M, () => {
2373
2382
  incrementClock();
2374
2383
  for (let node2 of queue.d) {
2375
2384
  if (ActiveTransition && !node2.e)
2376
2385
  node2 = cloneGraph(node2);
2377
2386
  node2.c = STATE_DIRTY;
2378
- getQueue(node2).enqueue(node2.C, node2.F.bind(node2));
2387
+ getQueue(node2).enqueue(node2.A, node2.E.bind(node2));
2379
2388
  }
2380
2389
  });
2381
2390
  });