@solidjs/signals 0.0.11 → 0.2.0

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
@@ -43,11 +43,11 @@ function schedule() {
43
43
  if (scheduled)
44
44
  return;
45
45
  scheduled = true;
46
- if (!globalQueue.H)
46
+ if (!globalQueue.I)
47
47
  queueMicrotask(flushSync);
48
48
  }
49
49
  var Queue = class {
50
- H = false;
50
+ I = false;
51
51
  r = [[], [], []];
52
52
  D = [];
53
53
  created = clock;
@@ -76,9 +76,9 @@ var Queue = class {
76
76
  return true;
77
77
  }
78
78
  flush() {
79
- if (this.H)
79
+ if (this.I)
80
80
  return;
81
- this.H = true;
81
+ this.I = true;
82
82
  try {
83
83
  while (this.run(EFFECT_PURE)) {
84
84
  }
@@ -87,7 +87,7 @@ var Queue = class {
87
87
  this.run(EFFECT_RENDER);
88
88
  this.run(EFFECT_USER);
89
89
  } finally {
90
- this.H = false;
90
+ this.I = false;
91
91
  }
92
92
  }
93
93
  addChild(child) {
@@ -236,19 +236,19 @@ var Owner = class {
236
236
  let head = self ? this.t || this.s : this, current = this.n, next = null;
237
237
  while (current && current.s === this) {
238
238
  current.dispose(true);
239
- current.A();
239
+ current.z();
240
240
  next = current.n;
241
241
  current.n = null;
242
242
  current = next;
243
243
  }
244
244
  if (self)
245
- this.A();
245
+ this.z();
246
246
  if (current)
247
247
  current.t = !self ? this : this.t;
248
248
  if (head)
249
249
  head.n = current;
250
250
  }
251
- A() {
251
+ z() {
252
252
  if (this.t)
253
253
  this.t.n = null;
254
254
  this.s = null;
@@ -349,11 +349,11 @@ function getObserver() {
349
349
  }
350
350
  var UNCHANGED = Symbol(0);
351
351
  var Computation = class extends Owner {
352
- f = null;
353
- d = null;
354
- b;
352
+ b = null;
353
+ c = null;
354
+ e;
355
355
  E;
356
- u;
356
+ A;
357
357
  // Used in __DEV__ mode, hopefully removed in production
358
358
  Z;
359
359
  // Using false is an optimization as an alternative to _equals: () => false
@@ -361,37 +361,37 @@ var Computation = class extends Owner {
361
361
  N = isEqual;
362
362
  U;
363
363
  /** Whether the computation is an error or has ancestors that are unresolved */
364
- c = 0;
364
+ d = 0;
365
365
  /** Which flags raised by sources are handled, vs. being passed through. */
366
366
  O = DEFAULT_FLAGS;
367
367
  P = null;
368
- z = -1;
369
- I = false;
368
+ x = -1;
369
+ J = false;
370
370
  constructor(initialValue, compute2, options) {
371
371
  super(compute2 === null);
372
- this.u = compute2;
372
+ this.A = compute2;
373
373
  this.a = compute2 ? STATE_DIRTY : STATE_CLEAN;
374
- this.c = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
375
- this.b = initialValue;
374
+ this.d = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
375
+ this.e = initialValue;
376
376
  if (options?.equals !== void 0)
377
377
  this.N = options.equals;
378
378
  if (options?.unobserved)
379
379
  this.U = options?.unobserved;
380
380
  }
381
381
  V() {
382
- if (this.u) {
383
- if (this.c & ERROR_BIT && this.z <= getClock())
382
+ if (this.A) {
383
+ if (this.d & ERROR_BIT && this.x <= getClock())
384
384
  update(this);
385
385
  else
386
386
  this.y();
387
387
  }
388
- if (!this.u || this.f?.length)
388
+ if (!this.A || this.b?.length)
389
389
  track(this);
390
- newFlags |= this.c & ~currentMask;
391
- if (this.c & ERROR_BIT) {
390
+ newFlags |= this.d & ~currentMask;
391
+ if (this.d & ERROR_BIT) {
392
392
  throw this.E;
393
393
  } else {
394
- return this.b;
394
+ return this.e;
395
395
  }
396
396
  }
397
397
  /**
@@ -409,14 +409,14 @@ var Computation = class extends Owner {
409
409
  * before continuing
410
410
  */
411
411
  wait() {
412
- if (this.u && this.c & ERROR_BIT && this.z <= getClock()) {
412
+ if (this.A && this.d & ERROR_BIT && this.x <= getClock()) {
413
413
  update(this);
414
414
  }
415
- if ((notStale || this.c & UNINITIALIZED_BIT) && this.loading()) {
415
+ if ((notStale || this.d & UNINITIALIZED_BIT) && this.loading()) {
416
416
  throw new NotReadyError();
417
417
  }
418
418
  if (staleCheck && this.loading())
419
- staleCheck.b = true;
419
+ staleCheck.e = true;
420
420
  return this.V();
421
421
  }
422
422
  /**
@@ -434,37 +434,37 @@ var Computation = class extends Owner {
434
434
  }
435
435
  /** Update the computation with a new value. */
436
436
  write(value, flags = 0, raw = false) {
437
- const newValue = !raw && typeof value === "function" ? value(this.b) : value;
438
- const valueChanged = newValue !== UNCHANGED && (!!(this.c & UNINITIALIZED_BIT) || this.N === false || !this.N(this.b, newValue));
437
+ const newValue = !raw && typeof value === "function" ? value(this.e) : value;
438
+ const valueChanged = newValue !== UNCHANGED && (!!(this.d & UNINITIALIZED_BIT) || this.N === false || !this.N(this.e, newValue));
439
439
  if (valueChanged) {
440
- this.b = newValue;
440
+ this.e = newValue;
441
441
  this.E = void 0;
442
442
  }
443
- const changedFlagsMask = this.c ^ flags, changedFlags = changedFlagsMask & flags;
444
- this.c = flags;
445
- this.z = getClock() + 1;
446
- if (this.d) {
447
- for (let i = 0; i < this.d.length; i++) {
443
+ const changedFlagsMask = this.d ^ flags, changedFlags = changedFlagsMask & flags;
444
+ this.d = flags;
445
+ this.x = getClock() + 1;
446
+ if (this.c) {
447
+ for (let i = 0; i < this.c.length; i++) {
448
448
  if (valueChanged) {
449
- this.d[i].q(STATE_DIRTY);
449
+ this.c[i].q(STATE_DIRTY);
450
450
  } else if (changedFlagsMask) {
451
- this.d[i].W(changedFlagsMask, changedFlags);
451
+ this.c[i].W(changedFlagsMask, changedFlags);
452
452
  }
453
453
  }
454
454
  }
455
- return this.b;
455
+ return this.e;
456
456
  }
457
457
  /**
458
458
  * Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
459
459
  */
460
460
  q(state, skipQueue) {
461
- if (this.a >= state && !this.I)
461
+ if (this.a >= state && !this.J)
462
462
  return;
463
- this.I = !!skipQueue;
463
+ this.J = !!skipQueue;
464
464
  this.a = state;
465
- if (this.d) {
466
- for (let i = 0; i < this.d.length; i++) {
467
- this.d[i].q(STATE_CHECK, skipQueue);
465
+ if (this.c) {
466
+ for (let i = 0; i < this.c.length; i++) {
467
+ this.c[i].q(STATE_CHECK, skipQueue);
468
468
  }
469
469
  }
470
470
  }
@@ -483,22 +483,22 @@ var Computation = class extends Owner {
483
483
  }
484
484
  if (this.a >= STATE_CHECK)
485
485
  return;
486
- const prevFlags = this.c & mask;
486
+ const prevFlags = this.d & mask;
487
487
  const deltaFlags = prevFlags ^ newFlags2;
488
488
  if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
489
489
  this.q(STATE_CHECK);
490
490
  } else {
491
- this.c ^= deltaFlags;
492
- if (this.d) {
493
- for (let i = 0; i < this.d.length; i++) {
494
- this.d[i].W(mask, newFlags2);
491
+ this.d ^= deltaFlags;
492
+ if (this.c) {
493
+ for (let i = 0; i < this.c.length; i++) {
494
+ this.c[i].W(mask, newFlags2);
495
495
  }
496
496
  }
497
497
  }
498
498
  }
499
- J(error) {
499
+ F(error) {
500
500
  this.E = error;
501
- this.write(UNCHANGED, this.c & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
501
+ this.write(UNCHANGED, this.d & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
502
502
  }
503
503
  /**
504
504
  * This is the core part of the reactivity system, which makes sure that the values are updated
@@ -516,9 +516,9 @@ var Computation = class extends Owner {
516
516
  }
517
517
  let observerFlags = 0;
518
518
  if (this.a === STATE_CHECK) {
519
- for (let i = 0; i < this.f.length; i++) {
520
- this.f[i].y();
521
- observerFlags |= this.f[i].c;
519
+ for (let i = 0; i < this.b.length; i++) {
520
+ this.b[i].y();
521
+ observerFlags |= this.b[i].d;
522
522
  if (this.a === STATE_DIRTY) {
523
523
  break;
524
524
  }
@@ -534,12 +534,12 @@ var Computation = class extends Owner {
534
534
  /**
535
535
  * Remove ourselves from the owner graph and the computation graph
536
536
  */
537
- A() {
537
+ z() {
538
538
  if (this.a === STATE_DISPOSED)
539
539
  return;
540
- if (this.f)
540
+ if (this.b)
541
541
  removeSourceObservers(this, 0);
542
- super.A();
542
+ super.z();
543
543
  }
544
544
  };
545
545
  function loadingState(node) {
@@ -550,7 +550,7 @@ function loadingState(node) {
550
550
  () => {
551
551
  track(node);
552
552
  node.y();
553
- return !!(node.c & LOADING_BIT);
553
+ return !!(node.d & LOADING_BIT);
554
554
  },
555
555
  options
556
556
  );
@@ -560,7 +560,7 @@ function loadingState(node) {
560
560
  }
561
561
  function track(computation) {
562
562
  if (currentObserver) {
563
- if (!newSources && currentObserver.f && currentObserver.f[newSourcesIndex] === computation) {
563
+ if (!newSources && currentObserver.b && currentObserver.b[newSourcesIndex] === computation) {
564
564
  newSourcesIndex++;
565
565
  } else if (!newSources)
566
566
  newSources = [computation];
@@ -568,7 +568,7 @@ function track(computation) {
568
568
  newSources.push(computation);
569
569
  }
570
570
  if (updateCheck) {
571
- updateCheck.b = computation.z > currentObserver.z;
571
+ updateCheck.e = computation.x > currentObserver.x;
572
572
  }
573
573
  }
574
574
  }
@@ -580,55 +580,55 @@ function update(node) {
580
580
  try {
581
581
  node.dispose(false);
582
582
  node.emptyDisposal();
583
- const result = compute(node, node.u, node);
583
+ const result = compute(node, node.A, node);
584
584
  node.write(result, newFlags, true);
585
585
  } catch (error) {
586
586
  if (error instanceof NotReadyError) {
587
- node.write(UNCHANGED, newFlags | LOADING_BIT | node.c & UNINITIALIZED_BIT);
587
+ node.write(UNCHANGED, newFlags | LOADING_BIT | node.d & UNINITIALIZED_BIT);
588
588
  } else {
589
- node.J(error);
589
+ node.F(error);
590
590
  }
591
591
  } finally {
592
592
  if (newSources) {
593
- if (node.f)
593
+ if (node.b)
594
594
  removeSourceObservers(node, newSourcesIndex);
595
- if (node.f && newSourcesIndex > 0) {
596
- node.f.length = newSourcesIndex + newSources.length;
595
+ if (node.b && newSourcesIndex > 0) {
596
+ node.b.length = newSourcesIndex + newSources.length;
597
597
  for (let i = 0; i < newSources.length; i++) {
598
- node.f[newSourcesIndex + i] = newSources[i];
598
+ node.b[newSourcesIndex + i] = newSources[i];
599
599
  }
600
600
  } else {
601
- node.f = newSources;
601
+ node.b = newSources;
602
602
  }
603
603
  let source;
604
- for (let i = newSourcesIndex; i < node.f.length; i++) {
605
- source = node.f[i];
606
- if (!source.d)
607
- source.d = [node];
604
+ for (let i = newSourcesIndex; i < node.b.length; i++) {
605
+ source = node.b[i];
606
+ if (!source.c)
607
+ source.c = [node];
608
608
  else
609
- source.d.push(node);
609
+ source.c.push(node);
610
610
  }
611
- } else if (node.f && newSourcesIndex < node.f.length) {
611
+ } else if (node.b && newSourcesIndex < node.b.length) {
612
612
  removeSourceObservers(node, newSourcesIndex);
613
- node.f.length = newSourcesIndex;
613
+ node.b.length = newSourcesIndex;
614
614
  }
615
615
  newSources = prevSources;
616
616
  newSourcesIndex = prevSourcesIndex;
617
617
  newFlags = prevFlags;
618
- node.z = getClock() + 1;
618
+ node.x = getClock() + 1;
619
619
  node.a = STATE_CLEAN;
620
620
  }
621
621
  }
622
622
  function removeSourceObservers(node, index) {
623
623
  let source;
624
624
  let swap;
625
- for (let i = index; i < node.f.length; i++) {
626
- source = node.f[i];
627
- if (source.d) {
628
- swap = source.d.indexOf(node);
629
- source.d[swap] = source.d[source.d.length - 1];
630
- source.d.pop();
631
- if (!source.d.length)
625
+ for (let i = index; i < node.b.length; i++) {
626
+ source = node.b[i];
627
+ if (source.c) {
628
+ swap = source.c.indexOf(node);
629
+ source.c[swap] = source.c[source.c.length - 1];
630
+ source.c.pop();
631
+ if (!source.c.length)
632
632
  source.U?.();
633
633
  }
634
634
  }
@@ -643,25 +643,23 @@ function untrack(fn) {
643
643
  }
644
644
  function hasUpdated(fn) {
645
645
  const current = updateCheck;
646
- updateCheck = { b: false };
646
+ updateCheck = { e: false };
647
647
  try {
648
648
  fn();
649
- return updateCheck.b;
649
+ return updateCheck.e;
650
650
  } finally {
651
651
  updateCheck = current;
652
652
  }
653
653
  }
654
654
  function isStale(fn) {
655
655
  const current = staleCheck;
656
- staleCheck = { b: false };
656
+ staleCheck = { e: false };
657
657
  try {
658
658
  latest(fn);
659
- return staleCheck.b;
660
- } catch {
659
+ return staleCheck.e;
661
660
  } finally {
662
661
  staleCheck = current;
663
662
  }
664
- return false;
665
663
  }
666
664
  function latest(fn) {
667
665
  const prevFlags = newFlags;
@@ -683,13 +681,50 @@ function catchError(fn) {
683
681
  return e;
684
682
  }
685
683
  }
684
+ function runWithObserver(observer, run) {
685
+ const prevSources = newSources, prevSourcesIndex = newSourcesIndex, prevFlags = newFlags;
686
+ newSources = null;
687
+ newSourcesIndex = observer.b ? observer.b.length : 0;
688
+ newFlags = 0;
689
+ try {
690
+ return compute(observer, run, observer);
691
+ } catch (error) {
692
+ if (error instanceof NotReadyError) {
693
+ observer.write(UNCHANGED, newFlags | LOADING_BIT | observer.d & UNINITIALIZED_BIT);
694
+ } else {
695
+ observer.F(error);
696
+ }
697
+ } finally {
698
+ if (newSources) {
699
+ if (newSourcesIndex > 0) {
700
+ observer.b.length = newSourcesIndex + newSources.length;
701
+ for (let i = 0; i < newSources.length; i++) {
702
+ observer.b[newSourcesIndex + i] = newSources[i];
703
+ }
704
+ } else {
705
+ observer.b = newSources;
706
+ }
707
+ let source;
708
+ for (let i = newSourcesIndex; i < observer.b.length; i++) {
709
+ source = observer.b[i];
710
+ if (!source.c)
711
+ source.c = [observer];
712
+ else
713
+ source.c.push(observer);
714
+ }
715
+ }
716
+ newSources = prevSources;
717
+ newSourcesIndex = prevSourcesIndex;
718
+ newFlags = prevFlags;
719
+ }
720
+ }
686
721
  function compute(owner, fn, observer) {
687
722
  const prevOwner = setOwner(owner), prevObserver = currentObserver, prevMask = currentMask, prevNotStale = notStale;
688
723
  currentObserver = observer;
689
724
  currentMask = observer?.O ?? DEFAULT_FLAGS;
690
725
  notStale = true;
691
726
  try {
692
- return fn(observer ? observer.b : void 0);
727
+ return fn(observer ? observer.e : void 0);
693
728
  } finally {
694
729
  setOwner(prevOwner);
695
730
  currentObserver = prevObserver;
@@ -712,32 +747,30 @@ var Effect = class extends Computation {
712
747
  B;
713
748
  Q = false;
714
749
  M;
715
- w;
750
+ u;
716
751
  constructor(initialValue, compute2, effect, error, options) {
717
752
  super(initialValue, compute2, options);
718
753
  this.K = effect;
719
754
  this.L = error;
720
755
  this.M = initialValue;
721
- this.w = options?.render ? EFFECT_RENDER : EFFECT_USER;
722
- if (this.w === EFFECT_RENDER) {
723
- this.u = (p) => getClock() > this.h.created ? latest(() => compute2(p)) : compute2(p);
724
- }
725
- if (!options?.defer) {
726
- this.y();
727
- this.w === EFFECT_USER ? this.h.enqueue(this.w, this) : this.T();
756
+ this.u = options?.render ? EFFECT_RENDER : EFFECT_USER;
757
+ if (this.u === EFFECT_RENDER) {
758
+ this.A = (p) => getClock() > this.h.created ? latest(() => compute2(p)) : compute2(p);
728
759
  }
760
+ this.y();
761
+ !options?.defer && (this.u === EFFECT_USER ? this.h.enqueue(this.u, this) : this.T());
729
762
  }
730
763
  write(value, flags = 0) {
731
764
  if (this.a == STATE_DIRTY) {
732
- const currentFlags = this.c;
733
- this.c = flags;
734
- if (this.w === EFFECT_RENDER && (flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
765
+ const currentFlags = this.d;
766
+ this.d = flags;
767
+ if (this.u === EFFECT_RENDER && (flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
735
768
  this.h.R?.(this);
736
769
  }
737
770
  }
738
771
  if (value === UNCHANGED)
739
- return this.b;
740
- this.b = value;
772
+ return this.e;
773
+ this.e = value;
741
774
  this.Q = true;
742
775
  return value;
743
776
  }
@@ -745,16 +778,16 @@ var Effect = class extends Computation {
745
778
  if (this.a >= state || skipQueue)
746
779
  return;
747
780
  if (this.a === STATE_CLEAN)
748
- this.h.enqueue(this.w, this);
781
+ this.h.enqueue(this.u, this);
749
782
  this.a = state;
750
783
  }
751
- J(error) {
784
+ F(error) {
752
785
  this.B?.();
753
- if (this.c & LOADING_BIT) {
754
- this.c = 0;
786
+ if (this.d & LOADING_BIT) {
787
+ this.d = 0;
755
788
  this.h.R?.(this);
756
789
  }
757
- if (this.w === EFFECT_USER) {
790
+ if (this.u === EFFECT_USER) {
758
791
  try {
759
792
  return this.L ? this.B = this.L(error) : console.error(new EffectError(this.K, error));
760
793
  } catch (e) {
@@ -763,7 +796,7 @@ var Effect = class extends Computation {
763
796
  }
764
797
  this.handleError(error);
765
798
  }
766
- A() {
799
+ z() {
767
800
  if (this.a === STATE_DISPOSED)
768
801
  return;
769
802
  this.K = void 0;
@@ -771,17 +804,17 @@ var Effect = class extends Computation {
771
804
  this.L = void 0;
772
805
  this.B?.();
773
806
  this.B = void 0;
774
- super.A();
807
+ super.z();
775
808
  }
776
809
  T() {
777
810
  if (this.Q && this.a !== STATE_DISPOSED) {
778
811
  this.B?.();
779
812
  try {
780
- this.B = this.K(this.b, this.M);
813
+ this.B = this.K(this.e, this.M);
781
814
  } catch (e) {
782
815
  this.handleError(e);
783
816
  } finally {
784
- this.M = this.b;
817
+ this.M = this.e;
785
818
  this.Q = false;
786
819
  }
787
820
  }
@@ -793,7 +826,7 @@ var EagerComputation = class extends Computation {
793
826
  !options?.defer && this.y();
794
827
  }
795
828
  q(state, skipQueue) {
796
- if (this.a >= state && !this.I)
829
+ if (this.a >= state && !this.J)
797
830
  return;
798
831
  if (this.a === STATE_CLEAN && !skipQueue)
799
832
  this.h.enqueue(EFFECT_PURE, this);
@@ -805,7 +838,7 @@ var ProjectionComputation = class extends Computation {
805
838
  super(null, compute2);
806
839
  }
807
840
  q(state, skipQueue) {
808
- if (this.a >= state && !this.I)
841
+ if (this.a >= state && !this.J)
809
842
  return;
810
843
  if (this.a === STATE_CLEAN && !skipQueue)
811
844
  this.h.enqueue(EFFECT_PURE, this);
@@ -815,7 +848,7 @@ var ProjectionComputation = class extends Computation {
815
848
 
816
849
  // src/core/suspense.ts
817
850
  var SuspenseQueue = class extends Queue {
818
- e = /* @__PURE__ */ new Set();
851
+ f = /* @__PURE__ */ new Set();
819
852
  o = false;
820
853
  S = new Computation(false, null);
821
854
  run(type) {
@@ -824,15 +857,15 @@ var SuspenseQueue = class extends Queue {
824
857
  return super.run(type);
825
858
  }
826
859
  R(node) {
827
- if (node.c & LOADING_BIT) {
828
- this.e.add(node);
860
+ if (node.d & LOADING_BIT) {
861
+ this.f.add(node);
829
862
  if (!this.o) {
830
863
  this.o = true;
831
864
  this.S.write(true);
832
865
  }
833
866
  } else {
834
- this.e.delete(node);
835
- if (this.e.size === 0) {
867
+ this.f.delete(node);
868
+ if (this.f.size === 0) {
836
869
  this.o = false;
837
870
  this.S.write(false);
838
871
  }
@@ -841,13 +874,13 @@ var SuspenseQueue = class extends Queue {
841
874
  };
842
875
  var LiveComputation = class extends EagerComputation {
843
876
  write(value, flags = 0) {
844
- const currentFlags = this.c;
877
+ const currentFlags = this.d;
845
878
  const dirty = this.a === STATE_DIRTY;
846
879
  super.write(value, flags);
847
880
  if (dirty && (flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
848
881
  this.h.R?.(this);
849
882
  }
850
- return this.b;
883
+ return this.e;
851
884
  }
852
885
  };
853
886
  function createSuspense(fn, fallback) {
@@ -887,10 +920,10 @@ function createMemo(compute2, value, options) {
887
920
  return () => {
888
921
  if (node) {
889
922
  resolvedValue = node.wait();
890
- if (!node.f?.length && node.n?.s !== node) {
923
+ if (!node.b?.length && node.n?.s !== node) {
891
924
  node.dispose();
892
925
  node = void 0;
893
- } else if (!node.s && !node.d?.length) {
926
+ } else if (!node.s && !node.c?.length) {
894
927
  node.dispose();
895
928
  node.a = STATE_DIRTY;
896
929
  }
@@ -902,10 +935,10 @@ function createAsync(compute2, value, options) {
902
935
  let uninitialized = value === void 0;
903
936
  const lhs = new EagerComputation(
904
937
  {
905
- b: value
938
+ e: value
906
939
  },
907
940
  (p) => {
908
- const value2 = p?.b;
941
+ const value2 = p?.e;
909
942
  const source = compute2(value2);
910
943
  const isPromise = source instanceof Promise;
911
944
  const iterator = source[Symbol.asyncIterator];
@@ -914,13 +947,13 @@ function createAsync(compute2, value, options) {
914
947
  wait() {
915
948
  return source;
916
949
  },
917
- b: source
950
+ e: source
918
951
  };
919
952
  }
920
953
  const signal = new Computation(value2, null, options);
921
954
  const w = signal.wait;
922
955
  signal.wait = function() {
923
- if (signal.c & ERROR_BIT && signal.z <= getClock()) {
956
+ if (signal.d & ERROR_BIT && signal.x <= getClock()) {
924
957
  lhs.q(STATE_DIRTY);
925
958
  throw new NotReadyError();
926
959
  }
@@ -935,7 +968,7 @@ function createAsync(compute2, value, options) {
935
968
  },
936
969
  (error) => {
937
970
  uninitialized = true;
938
- signal.J(error);
971
+ signal.F(error);
939
972
  }
940
973
  );
941
974
  } else {
@@ -964,13 +997,13 @@ function createEffect(compute2, effect, error, value, options) {
964
997
  compute2,
965
998
  effect,
966
999
  error,
967
- void 0
1000
+ options
968
1001
  );
969
1002
  }
970
1003
  function createRenderEffect(compute2, effect, value, options) {
971
1004
  void new Effect(value, compute2, effect, void 0, {
972
1005
  render: true,
973
- ...void 0
1006
+ ...options
974
1007
  });
975
1008
  }
976
1009
  function createRoot(init) {
@@ -978,12 +1011,7 @@ function createRoot(init) {
978
1011
  return compute(owner, !init.length ? init : () => init(() => owner.dispose()), null);
979
1012
  }
980
1013
  function runWithOwner(owner, run) {
981
- try {
982
- return compute(owner, run, null);
983
- } catch (error) {
984
- owner?.handleError(error);
985
- return void 0;
986
- }
1014
+ return compute(owner, run, null);
987
1015
  }
988
1016
  function createErrorBoundary(fn, fallback) {
989
1017
  const owner = new Owner();
@@ -1011,7 +1039,7 @@ function createErrorBoundary(fn, fallback) {
1011
1039
  () => {
1012
1040
  const c = new Computation(void 0, fn);
1013
1041
  const f = new EagerComputation(void 0, () => flatten(c.read()), { defer: true });
1014
- f.J = function(error2) {
1042
+ f.F = function(error2) {
1015
1043
  this.handleError(error2);
1016
1044
  };
1017
1045
  return f;
@@ -1028,7 +1056,7 @@ function createErrorBoundary(fn, fallback) {
1028
1056
  incrementClock();
1029
1057
  for (let node of nodes) {
1030
1058
  node.a = STATE_DIRTY;
1031
- node.h?.enqueue(node.w, node);
1059
+ node.h?.enqueue(node.u, node);
1032
1060
  }
1033
1061
  });
1034
1062
  });
@@ -1050,19 +1078,6 @@ function resolve(fn) {
1050
1078
  });
1051
1079
  });
1052
1080
  }
1053
- function createReaction(effect, error, options) {
1054
- const node = new Effect(void 0, () => {
1055
- }, effect, error, {
1056
- defer: true,
1057
- ...void 0
1058
- });
1059
- return (tracking) => {
1060
- node.u = tracking;
1061
- node.a = STATE_DIRTY;
1062
- node.y();
1063
- node.u = null;
1064
- };
1065
- }
1066
1081
 
1067
1082
  // src/store/projection.ts
1068
1083
  function createProjection(fn, initialValue = {}) {
@@ -1209,7 +1224,7 @@ var proxyTraps = {
1209
1224
  return desc.get.call(receiver);
1210
1225
  }
1211
1226
  if (Writing.has(storeValue)) {
1212
- const value2 = tracked ? tracked.b : storeValue[property];
1227
+ const value2 = tracked ? tracked.e : storeValue[property];
1213
1228
  return isWrappable(value2) ? (Writing.add(value2[$RAW] || value2), wrap2(value2)) : value2;
1214
1229
  }
1215
1230
  let value = tracked ? nodes[property].read() : storeValue[property];
@@ -1548,13 +1563,13 @@ function omit(props, ...keys) {
1548
1563
  function mapArray(list, map, options) {
1549
1564
  const keyFn = typeof options?.keyed === "function" ? options.keyed : void 0;
1550
1565
  return updateKeyedMap.bind({
1551
- F: new Owner(),
1566
+ G: new Owner(),
1552
1567
  i: 0,
1553
1568
  X: list,
1554
- x: [],
1555
- G: map,
1569
+ w: [],
1570
+ H: map,
1556
1571
  g: [],
1557
- e: [],
1572
+ f: [],
1558
1573
  C: keyFn,
1559
1574
  j: keyFn || options?.keyed === false ? [] : void 0,
1560
1575
  k: map.length > 1 ? [] : void 0,
@@ -1564,27 +1579,27 @@ function mapArray(list, map, options) {
1564
1579
  function updateKeyedMap() {
1565
1580
  const newItems = this.X() || [], newLen = newItems.length;
1566
1581
  newItems[$TRACK];
1567
- runWithOwner(this.F, () => {
1582
+ runWithOwner(this.G, () => {
1568
1583
  let i, j, mapper = this.j ? () => {
1569
1584
  this.j[j] = new Computation(newItems[j], null);
1570
1585
  this.k && (this.k[j] = new Computation(j, null));
1571
- return this.G(
1586
+ return this.H(
1572
1587
  Computation.prototype.read.bind(this.j[j]),
1573
1588
  this.k ? Computation.prototype.read.bind(this.k[j]) : void 0
1574
1589
  );
1575
1590
  } : this.k ? () => {
1576
1591
  const item = newItems[j];
1577
1592
  this.k[j] = new Computation(j, null);
1578
- return this.G(() => item, Computation.prototype.read.bind(this.k[j]));
1593
+ return this.H(() => item, Computation.prototype.read.bind(this.k[j]));
1579
1594
  } : () => {
1580
1595
  const item = newItems[j];
1581
- return this.G(() => item);
1596
+ return this.H(() => item);
1582
1597
  };
1583
1598
  if (newLen === 0) {
1584
1599
  if (this.i !== 0) {
1585
- this.F.dispose(false);
1586
- this.e = [];
1587
- this.x = [];
1600
+ this.G.dispose(false);
1601
+ this.f = [];
1602
+ this.w = [];
1588
1603
  this.g = [];
1589
1604
  this.i = 0;
1590
1605
  this.j && (this.j = []);
@@ -1592,29 +1607,29 @@ function updateKeyedMap() {
1592
1607
  }
1593
1608
  if (this.o && !this.g[0]) {
1594
1609
  this.g[0] = compute(
1595
- this.e[0] = new Owner(),
1610
+ this.f[0] = new Owner(),
1596
1611
  this.o,
1597
1612
  null
1598
1613
  );
1599
1614
  }
1600
1615
  } else if (this.i === 0) {
1601
- if (this.e[0])
1602
- this.e[0].dispose();
1616
+ if (this.f[0])
1617
+ this.f[0].dispose();
1603
1618
  this.g = new Array(newLen);
1604
1619
  for (j = 0; j < newLen; j++) {
1605
- this.x[j] = newItems[j];
1606
- this.g[j] = compute(this.e[j] = new Owner(), mapper, null);
1620
+ this.w[j] = newItems[j];
1621
+ this.g[j] = compute(this.f[j] = new Owner(), mapper, null);
1607
1622
  }
1608
1623
  this.i = newLen;
1609
1624
  } else {
1610
1625
  let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.j ? new Array(newLen) : void 0, tempIndexes = this.k ? new Array(newLen) : void 0;
1611
- for (start = 0, end = Math.min(this.i, newLen); start < end && (this.x[start] === newItems[start] || this.j && compare(this.C, this.x[start], newItems[start])); start++) {
1626
+ for (start = 0, end = Math.min(this.i, newLen); start < end && (this.w[start] === newItems[start] || this.j && compare(this.C, this.w[start], newItems[start])); start++) {
1612
1627
  if (this.j)
1613
1628
  this.j[start].write(newItems[start]);
1614
1629
  }
1615
- for (end = this.i - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.x[end] === newItems[newEnd] || this.j && compare(this.C, this.x[end], newItems[newEnd])); end--, newEnd--) {
1630
+ for (end = this.i - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.w[end] === newItems[newEnd] || this.j && compare(this.C, this.w[end], newItems[newEnd])); end--, newEnd--) {
1616
1631
  temp[newEnd] = this.g[end];
1617
- tempNodes[newEnd] = this.e[end];
1632
+ tempNodes[newEnd] = this.f[end];
1618
1633
  tempRows && (tempRows[newEnd] = this.j[end]);
1619
1634
  tempIndexes && (tempIndexes[newEnd] = this.k[end]);
1620
1635
  }
@@ -1628,23 +1643,23 @@ function updateKeyedMap() {
1628
1643
  newIndices.set(key, j);
1629
1644
  }
1630
1645
  for (i = start; i <= end; i++) {
1631
- item = this.x[i];
1646
+ item = this.w[i];
1632
1647
  key = this.C ? this.C(item) : item;
1633
1648
  j = newIndices.get(key);
1634
1649
  if (j !== void 0 && j !== -1) {
1635
1650
  temp[j] = this.g[i];
1636
- tempNodes[j] = this.e[i];
1651
+ tempNodes[j] = this.f[i];
1637
1652
  tempRows && (tempRows[j] = this.j[i]);
1638
1653
  tempIndexes && (tempIndexes[j] = this.k[i]);
1639
1654
  j = newIndicesNext[j];
1640
1655
  newIndices.set(key, j);
1641
1656
  } else
1642
- this.e[i].dispose();
1657
+ this.f[i].dispose();
1643
1658
  }
1644
1659
  for (j = start; j < newLen; j++) {
1645
1660
  if (j in temp) {
1646
1661
  this.g[j] = temp[j];
1647
- this.e[j] = tempNodes[j];
1662
+ this.f[j] = tempNodes[j];
1648
1663
  if (tempRows) {
1649
1664
  this.j[j] = tempRows[j];
1650
1665
  this.j[j].write(newItems[j]);
@@ -1654,55 +1669,55 @@ function updateKeyedMap() {
1654
1669
  this.k[j].write(j);
1655
1670
  }
1656
1671
  } else {
1657
- this.g[j] = compute(this.e[j] = new Owner(), mapper, null);
1672
+ this.g[j] = compute(this.f[j] = new Owner(), mapper, null);
1658
1673
  }
1659
1674
  }
1660
1675
  this.g = this.g.slice(0, this.i = newLen);
1661
- this.x = newItems.slice(0);
1676
+ this.w = newItems.slice(0);
1662
1677
  }
1663
1678
  });
1664
1679
  return this.g;
1665
1680
  }
1666
1681
  function repeat(count, map, options) {
1667
1682
  return updateRepeat.bind({
1668
- F: new Owner(),
1683
+ G: new Owner(),
1669
1684
  i: 0,
1670
1685
  Y: count,
1671
- G: map,
1672
- e: [],
1686
+ H: map,
1687
+ f: [],
1673
1688
  g: [],
1674
1689
  o: options?.fallback
1675
1690
  });
1676
1691
  }
1677
1692
  function updateRepeat() {
1678
1693
  const newLen = this.Y();
1679
- runWithOwner(this.F, () => {
1694
+ runWithOwner(this.G, () => {
1680
1695
  if (newLen === 0) {
1681
1696
  if (this.i !== 0) {
1682
- this.F.dispose(false);
1683
- this.e = [];
1697
+ this.G.dispose(false);
1698
+ this.f = [];
1684
1699
  this.g = [];
1685
1700
  this.i = 0;
1686
1701
  }
1687
1702
  if (this.o && !this.g[0]) {
1688
1703
  this.g[0] = compute(
1689
- this.e[0] = new Owner(),
1704
+ this.f[0] = new Owner(),
1690
1705
  this.o,
1691
1706
  null
1692
1707
  );
1693
1708
  }
1694
1709
  } else {
1695
- if (this.i === 0 && this.e[0])
1696
- this.e[0].dispose();
1710
+ if (this.i === 0 && this.f[0])
1711
+ this.f[0].dispose();
1697
1712
  for (let i = this.i; i < newLen; i++) {
1698
1713
  this.g[i] = compute(
1699
- this.e[i] = new Owner(),
1700
- () => this.G(i),
1714
+ this.f[i] = new Owner(),
1715
+ () => this.H(i),
1701
1716
  null
1702
1717
  );
1703
1718
  }
1704
1719
  for (let i = newLen; i < this.i; i++)
1705
- this.e[i].dispose();
1720
+ this.f[i].dispose();
1706
1721
  this.g = this.g.slice(0, newLen);
1707
1722
  this.i = newLen;
1708
1723
  }
@@ -1713,4 +1728,4 @@ function compare(key, a, b) {
1713
1728
  return key ? key(a) === key(b) : true;
1714
1729
  }
1715
1730
 
1716
- export { $PROXY, $RAW, $TARGET, $TRACK, Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, SUPPORTS_PROXY, catchError, createAsync, createBoundary, createContext, createEffect, createErrorBoundary, createMemo, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createSuspense, flatten, flushSync, getContext, getObserver, getOwner, hasContext, hasUpdated, isEqual, isStale, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, repeat, resolve, runWithOwner, setContext, untrack, unwrap };
1731
+ export { $PROXY, $RAW, $TARGET, $TRACK, Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, SUPPORTS_PROXY, catchError, createAsync, createBoundary, createContext, createEffect, createErrorBoundary, createMemo, createProjection, createRenderEffect, createRoot, createSignal, createStore, createSuspense, flatten, flushSync, getContext, getObserver, getOwner, hasContext, hasUpdated, isEqual, isStale, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, repeat, resolve, runWithObserver, runWithOwner, setContext, untrack, unwrap };