@solidjs/signals 0.13.6 → 0.13.7

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.
Files changed (4) hide show
  1. package/dist/dev.js +255 -207
  2. package/dist/node.cjs +335 -305
  3. package/dist/prod.js +326 -296
  4. package/package.json +1 -1
package/dist/prod.js CHANGED
@@ -619,39 +619,230 @@ function assignOrMergeLane(e, t) {
619
619
  }
620
620
  e.q = t;
621
621
  }
622
+ function unlinkSubs(e) {
623
+ const t = e.m;
624
+ const n = e.D;
625
+ const i = e.p;
626
+ const r = e.Ie;
627
+ if (i !== null) i.Ie = r;
628
+ else t.pe = r;
629
+ if (r !== null) r.p = i;
630
+ else {
631
+ t.I = i;
632
+ if (i === null) {
633
+ t.he?.();
634
+ t.L && !t.Ae && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
635
+ }
636
+ }
637
+ return n;
638
+ }
639
+ function unobserved(e) {
640
+ deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
641
+ let t = e.C;
642
+ while (t !== null) {
643
+ t = unlinkSubs(t);
644
+ }
645
+ e.C = null;
646
+ disposeChildren(e, true);
647
+ }
648
+ function link(e, t) {
649
+ const n = t.Ne;
650
+ if (n !== null && n.m === e) return;
651
+ let i = null;
652
+ const r = t.O & REACTIVE_RECOMPUTING_DEPS;
653
+ if (r) {
654
+ i = n !== null ? n.D : t.C;
655
+ if (i !== null && i.m === e) {
656
+ t.Ne = i;
657
+ return;
658
+ }
659
+ }
660
+ const s = e.pe;
661
+ if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
662
+ const o = (t.Ne = e.pe = { m: e, h: t, D: i, Ie: s, p: null });
663
+ if (n !== null) n.D = o;
664
+ else t.C = o;
665
+ if (s !== null) s.p = o;
666
+ else e.I = o;
667
+ }
668
+ function isValidLink(e, t) {
669
+ const n = t.Ne;
670
+ if (n !== null) {
671
+ let i = t.C;
672
+ do {
673
+ if (i === e) return true;
674
+ if (i === n) break;
675
+ i = i.D;
676
+ } while (i !== null);
677
+ }
678
+ return false;
679
+ }
680
+ const PENDING_OWNER = {};
681
+ function markDisposal(e) {
682
+ let t = e.ge;
683
+ while (t) {
684
+ t.O |= REACTIVE_ZOMBIE;
685
+ if (t.O & REACTIVE_IN_HEAP) {
686
+ deleteFromHeap(t, dirtyQueue);
687
+ insertIntoHeap(t, zombieQueue);
688
+ }
689
+ markDisposal(t);
690
+ t = t.Pe;
691
+ }
692
+ }
693
+ function dispose(e) {
694
+ let t = e.C || null;
695
+ do {
696
+ t = unlinkSubs(t);
697
+ } while (t !== null);
698
+ e.C = null;
699
+ e.Ne = null;
700
+ disposeChildren(e, true);
701
+ }
702
+ function disposeChildren(e, t = false, n) {
703
+ if (e.O & REACTIVE_DISPOSED) return;
704
+ if (t) e.O = REACTIVE_DISPOSED;
705
+ if (t && e.L) e.Ce = null;
706
+ let i = n ? e.De : e.ge;
707
+ while (i) {
708
+ const e = i.Pe;
709
+ if (i.C) {
710
+ const e = i;
711
+ deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
712
+ let t = e.C;
713
+ do {
714
+ t = unlinkSubs(t);
715
+ } while (t !== null);
716
+ e.C = null;
717
+ e.Ne = null;
718
+ }
719
+ disposeChildren(i, true);
720
+ i = e;
721
+ }
722
+ if (n) {
723
+ e.De = null;
724
+ } else {
725
+ e.ge = null;
726
+ e.ye = 0;
727
+ }
728
+ runDisposal(e, n);
729
+ }
730
+ function runDisposal(e, t) {
731
+ let n = t ? e.me : e.ve;
732
+ if (!n) return;
733
+ if (Array.isArray(n)) {
734
+ for (let e = 0; e < n.length; e++) {
735
+ const t = n[e];
736
+ t.call(t);
737
+ }
738
+ } else {
739
+ n.call(n);
740
+ }
741
+ t ? (e.me = null) : (e.ve = null);
742
+ }
743
+ function childId(e, t) {
744
+ let n = e;
745
+ while (n.we && n.i) n = n.i;
746
+ if (n.id != null) return formatId(n.id, t ? n.ye++ : n.ye);
747
+ throw new Error("Cannot get child id from owner without an id");
748
+ }
749
+ function getNextChildId(e) {
750
+ return childId(e, true);
751
+ }
752
+ function peekNextChildId(e) {
753
+ return childId(e, false);
754
+ }
755
+ function formatId(e, t) {
756
+ const n = t.toString(36),
757
+ i = n.length - 1;
758
+ return e + (i ? String.fromCharCode(64 + i) : "") + n;
759
+ }
760
+ function getObserver() {
761
+ if (pendingCheckActive || latestReadActive) return PENDING_OWNER;
762
+ return tracking ? context : null;
763
+ }
764
+ function getOwner() {
765
+ return context;
766
+ }
767
+ function cleanup(e) {
768
+ if (!context) return e;
769
+ if (!context.ve) context.ve = e;
770
+ else if (Array.isArray(context.ve)) context.ve.push(e);
771
+ else context.ve = [context.ve, e];
772
+ return e;
773
+ }
774
+ function isDisposed(e) {
775
+ return !!(e.O & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
776
+ }
777
+ function createOwner(e) {
778
+ const t = context;
779
+ const n = e?.transparent ?? false;
780
+ const i = {
781
+ id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
782
+ we: n || undefined,
783
+ t: true,
784
+ u: t?.t ? t.u : t,
785
+ ge: null,
786
+ Pe: null,
787
+ ve: null,
788
+ F: t?.F ?? globalQueue,
789
+ be: t?.be || defaultContext,
790
+ ye: 0,
791
+ me: null,
792
+ De: null,
793
+ i: t,
794
+ dispose(e = true) {
795
+ disposeChildren(i, e);
796
+ }
797
+ };
798
+ if (t) {
799
+ const e = t.ge;
800
+ if (e === null) {
801
+ t.ge = i;
802
+ } else {
803
+ i.Pe = e;
804
+ t.ge = i;
805
+ }
806
+ }
807
+ return i;
808
+ }
809
+ function createRoot(e, t) {
810
+ const n = createOwner(t);
811
+ return runWithOwner(n, () => e(n.dispose));
812
+ }
622
813
  function addPendingSource(e, t) {
623
- if (e.Ie === t || e.pe?.has(t)) return false;
624
- if (!e.Ie) {
625
- e.Ie = t;
814
+ if (e.Ve === t || e.Le?.has(t)) return false;
815
+ if (!e.Ve) {
816
+ e.Ve = t;
626
817
  return true;
627
818
  }
628
- if (!e.pe) {
629
- e.pe = new Set([e.Ie, t]);
819
+ if (!e.Le) {
820
+ e.Le = new Set([e.Ve, t]);
630
821
  } else {
631
- e.pe.add(t);
822
+ e.Le.add(t);
632
823
  }
633
- e.Ie = undefined;
824
+ e.Ve = undefined;
634
825
  return true;
635
826
  }
636
827
  function removePendingSource(e, t) {
637
- if (e.Ie) {
638
- if (e.Ie !== t) return false;
639
- e.Ie = undefined;
828
+ if (e.Ve) {
829
+ if (e.Ve !== t) return false;
830
+ e.Ve = undefined;
640
831
  return true;
641
832
  }
642
- if (!e.pe?.delete(t)) return false;
643
- if (e.pe.size === 1) {
644
- e.Ie = e.pe.values().next().value;
645
- e.pe = undefined;
646
- } else if (e.pe.size === 0) {
647
- e.pe = undefined;
833
+ if (!e.Le?.delete(t)) return false;
834
+ if (e.Le.size === 1) {
835
+ e.Ve = e.Le.values().next().value;
836
+ e.Le = undefined;
837
+ } else if (e.Le.size === 0) {
838
+ e.Le = undefined;
648
839
  }
649
840
  return true;
650
841
  }
651
842
  function clearPendingSources(e) {
652
- e.Ie = undefined;
653
- e.pe?.clear();
654
- e.pe = undefined;
843
+ e.Ve = undefined;
844
+ e.Le?.clear();
845
+ e.Le = undefined;
655
846
  }
656
847
  function setPendingError(e, t, n) {
657
848
  if (!t) {
@@ -680,7 +871,7 @@ function settlePendingSource(e) {
680
871
  if (n.has(i) || !removePendingSource(i, e)) return;
681
872
  n.add(i);
682
873
  i.Ee = clock;
683
- const r = i.Ie ?? i.pe?.values().next().value;
874
+ const r = i.Ve ?? i.Le?.values().next().value;
684
875
  if (r) {
685
876
  setPendingError(i, r);
686
877
  updatePendingSignal(i);
@@ -688,7 +879,7 @@ function settlePendingSource(e) {
688
879
  i.Se &= ~STATUS_PENDING;
689
880
  setPendingError(i);
690
881
  updatePendingSignal(i);
691
- if (i.he) {
882
+ if (i.Ue) {
692
883
  if (i.W === EFFECT_TRACKED) {
693
884
  const e = i;
694
885
  if (!e.H) {
@@ -702,7 +893,7 @@ function settlePendingSource(e) {
702
893
  }
703
894
  t = true;
704
895
  }
705
- i.he = false;
896
+ i.Ue = false;
706
897
  }
707
898
  forEachDependent(i, settle);
708
899
  };
@@ -714,19 +905,19 @@ function handleAsync(e, t, n) {
714
905
  const r = i && untrack(() => t[Symbol.asyncIterator]);
715
906
  const s = !r && i && untrack(() => typeof t.then === "function");
716
907
  if (!s && !r) {
717
- e.Ae = null;
908
+ e.Ce = null;
718
909
  return t;
719
910
  }
720
- e.Ae = t;
911
+ e.Ce = t;
721
912
  let o;
722
913
  const handleError = n => {
723
- if (e.Ae !== t) return;
914
+ if (e.Ce !== t) return;
724
915
  globalQueue.initTransition(resolveTransition(e));
725
916
  notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
726
917
  e.Ee = clock;
727
918
  };
728
919
  const asyncWrite = (i, r) => {
729
- if (e.Ae !== t) return;
920
+ if (e.Ce !== t) return;
730
921
  if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
731
922
  globalQueue.initTransition(resolveTransition(e));
732
923
  clearStatus(e);
@@ -742,12 +933,12 @@ function handleAsync(e, t, n) {
742
933
  e.Ee = clock;
743
934
  } else if (s) {
744
935
  const t = e.J;
745
- const n = e.Ne;
936
+ const n = e.ke;
746
937
  if (!n || !n(i, t)) {
747
938
  e.J = i;
748
939
  e.Ee = clock;
749
- if (e.Pe) {
750
- setSignal(e.Pe, i);
940
+ if (e.Ge) {
941
+ setSignal(e.Ge, i);
751
942
  }
752
943
  insertSubs(e, true);
753
944
  }
@@ -782,35 +973,53 @@ function handleAsync(e, t, n) {
782
973
  if (r) {
783
974
  const n = t[Symbol.asyncIterator]();
784
975
  let i = false;
976
+ let r = false;
977
+ cleanup(() => {
978
+ if (r) return;
979
+ r = true;
980
+ try {
981
+ const e = n.return?.();
982
+ if (e && typeof e.then === "function") {
983
+ e.then(undefined, () => {});
984
+ }
985
+ } catch {}
986
+ });
785
987
  const iterate = () => {
786
- let e,
787
- t = false,
788
- r = true;
988
+ let s,
989
+ u = false,
990
+ c = true;
789
991
  n.next().then(
790
992
  n => {
791
- if (r) {
792
- e = n;
793
- t = true;
993
+ if (c) {
994
+ s = n;
995
+ u = true;
996
+ if (n.done) r = true;
997
+ } else if (e.Ce !== t) {
998
+ return;
794
999
  } else if (!n.done) asyncWrite(n.value, iterate);
795
1000
  else {
1001
+ r = true;
796
1002
  schedule();
797
1003
  flush();
798
1004
  }
799
1005
  },
800
- e => {
801
- if (!r) handleError(e);
1006
+ n => {
1007
+ if (!c && e.Ce === t) {
1008
+ r = true;
1009
+ handleError(n);
1010
+ }
802
1011
  }
803
1012
  );
804
- r = false;
805
- if (t && !e.done) {
806
- o = e.value;
1013
+ c = false;
1014
+ if (u && !s.done) {
1015
+ o = s.value;
807
1016
  i = true;
808
1017
  return iterate();
809
1018
  }
810
- return t && e.done;
1019
+ return u && s.done;
811
1020
  };
812
- const r = iterate();
813
- if (!i && !r) {
1021
+ const s = iterate();
1022
+ if (!i && !s) {
814
1023
  globalQueue.initTransition(resolveTransition(e));
815
1024
  throw new NotReadyError(context);
816
1025
  }
@@ -819,11 +1028,11 @@ function handleAsync(e, t, n) {
819
1028
  }
820
1029
  function clearStatus(e, t = false) {
821
1030
  clearPendingSources(e);
822
- e.he = false;
1031
+ e.Ue = false;
823
1032
  e.Se = t ? 0 : e.Se & STATUS_UNINITIALIZED;
824
1033
  setPendingError(e);
825
1034
  updatePendingSignal(e);
826
- e.ge?.();
1035
+ e.xe?.();
827
1036
  }
828
1037
  function notifyStatus(e, t, n, i, r) {
829
1038
  if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
@@ -849,22 +1058,22 @@ function notifyStatus(e, t, n, i, r) {
849
1058
  }
850
1059
  const a = i || c;
851
1060
  const f = i || u ? undefined : r;
852
- if (e.ge) {
1061
+ if (e.xe) {
853
1062
  if (i && t === STATUS_PENDING) {
854
1063
  return;
855
1064
  }
856
1065
  if (a) {
857
- e.ge(t, n);
1066
+ e.xe(t, n);
858
1067
  } else {
859
- e.ge();
1068
+ e.xe();
860
1069
  }
861
1070
  return;
862
1071
  }
863
1072
  forEachDependent(e, e => {
864
1073
  e.Ee = clock;
865
1074
  if (
866
- (t === STATUS_PENDING && s && e.Ie !== s && !e.pe?.has(s)) ||
867
- (t !== STATUS_PENDING && (e.le !== n || e.Ie || e.pe))
1075
+ (t === STATUS_PENDING && s && e.Ve !== s && !e.Le?.has(s)) ||
1076
+ (t !== STATUS_PENDING && (e.le !== n || e.Ve || e.Le))
868
1077
  ) {
869
1078
  if (!a && !e.K) globalQueue.se.push(e);
870
1079
  notifyStatus(e, t, n, a, f);
@@ -894,196 +1103,6 @@ function enableExternalSource(e) {
894
1103
  externalSourceConfig = { factory: t, untrack: n };
895
1104
  }
896
1105
  }
897
- const PENDING_OWNER = {};
898
- function markDisposal(e) {
899
- let t = e.Ce;
900
- while (t) {
901
- t.O |= REACTIVE_ZOMBIE;
902
- if (t.O & REACTIVE_IN_HEAP) {
903
- deleteFromHeap(t, dirtyQueue);
904
- insertIntoHeap(t, zombieQueue);
905
- }
906
- markDisposal(t);
907
- t = t.De;
908
- }
909
- }
910
- function dispose(e) {
911
- let t = e.C || null;
912
- do {
913
- t = unlinkSubs(t);
914
- } while (t !== null);
915
- e.C = null;
916
- e.ye = null;
917
- disposeChildren(e, true);
918
- }
919
- function disposeChildren(e, t = false, n) {
920
- if (e.O & REACTIVE_DISPOSED) return;
921
- if (t) e.O = REACTIVE_DISPOSED;
922
- let i = n ? e.me : e.Ce;
923
- while (i) {
924
- const e = i.De;
925
- if (i.C) {
926
- const e = i;
927
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
928
- let t = e.C;
929
- do {
930
- t = unlinkSubs(t);
931
- } while (t !== null);
932
- e.C = null;
933
- e.ye = null;
934
- }
935
- disposeChildren(i, true);
936
- i = e;
937
- }
938
- if (n) {
939
- e.me = null;
940
- } else {
941
- e.Ce = null;
942
- e.ve = 0;
943
- }
944
- runDisposal(e, n);
945
- }
946
- function runDisposal(e, t) {
947
- let n = t ? e.we : e.be;
948
- if (!n) return;
949
- if (Array.isArray(n)) {
950
- for (let e = 0; e < n.length; e++) {
951
- const t = n[e];
952
- t.call(t);
953
- }
954
- } else {
955
- n.call(n);
956
- }
957
- t ? (e.we = null) : (e.be = null);
958
- }
959
- function childId(e, t) {
960
- let n = e;
961
- while (n.Ve && n.i) n = n.i;
962
- if (n.id != null) return formatId(n.id, t ? n.ve++ : n.ve);
963
- throw new Error("Cannot get child id from owner without an id");
964
- }
965
- function getNextChildId(e) {
966
- return childId(e, true);
967
- }
968
- function peekNextChildId(e) {
969
- return childId(e, false);
970
- }
971
- function formatId(e, t) {
972
- const n = t.toString(36),
973
- i = n.length - 1;
974
- return e + (i ? String.fromCharCode(64 + i) : "") + n;
975
- }
976
- function getObserver() {
977
- if (pendingCheckActive || latestReadActive) return PENDING_OWNER;
978
- return tracking ? context : null;
979
- }
980
- function getOwner() {
981
- return context;
982
- }
983
- function cleanup(e) {
984
- if (!context) return e;
985
- if (!context.be) context.be = e;
986
- else if (Array.isArray(context.be)) context.be.push(e);
987
- else context.be = [context.be, e];
988
- return e;
989
- }
990
- function isDisposed(e) {
991
- return !!(e.O & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
992
- }
993
- function createOwner(e) {
994
- const t = context;
995
- const n = e?.transparent ?? false;
996
- const i = {
997
- id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
998
- Ve: n || undefined,
999
- t: true,
1000
- u: t?.t ? t.u : t,
1001
- Ce: null,
1002
- De: null,
1003
- be: null,
1004
- F: t?.F ?? globalQueue,
1005
- Le: t?.Le || defaultContext,
1006
- ve: 0,
1007
- we: null,
1008
- me: null,
1009
- i: t,
1010
- dispose(e = true) {
1011
- disposeChildren(i, e);
1012
- }
1013
- };
1014
- if (t) {
1015
- const e = t.Ce;
1016
- if (e === null) {
1017
- t.Ce = i;
1018
- } else {
1019
- i.De = e;
1020
- t.Ce = i;
1021
- }
1022
- }
1023
- return i;
1024
- }
1025
- function createRoot(e, t) {
1026
- const n = createOwner(t);
1027
- return runWithOwner(n, () => e(n.dispose));
1028
- }
1029
- function unlinkSubs(e) {
1030
- const t = e.m;
1031
- const n = e.D;
1032
- const i = e.p;
1033
- const r = e.Ue;
1034
- if (i !== null) i.Ue = r;
1035
- else t.ke = r;
1036
- if (r !== null) r.p = i;
1037
- else {
1038
- t.I = i;
1039
- if (i === null) {
1040
- t.Ge?.();
1041
- t.L && !t.xe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
1042
- }
1043
- }
1044
- return n;
1045
- }
1046
- function unobserved(e) {
1047
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1048
- let t = e.C;
1049
- while (t !== null) {
1050
- t = unlinkSubs(t);
1051
- }
1052
- e.C = null;
1053
- disposeChildren(e, true);
1054
- }
1055
- function link(e, t) {
1056
- const n = t.ye;
1057
- if (n !== null && n.m === e) return;
1058
- let i = null;
1059
- const r = t.O & REACTIVE_RECOMPUTING_DEPS;
1060
- if (r) {
1061
- i = n !== null ? n.D : t.C;
1062
- if (i !== null && i.m === e) {
1063
- t.ye = i;
1064
- return;
1065
- }
1066
- }
1067
- const s = e.ke;
1068
- if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
1069
- const o = (t.ye = e.ke = { m: e, h: t, D: i, Ue: s, p: null });
1070
- if (n !== null) n.D = o;
1071
- else t.C = o;
1072
- if (s !== null) s.p = o;
1073
- else e.I = o;
1074
- }
1075
- function isValidLink(e, t) {
1076
- const n = t.ye;
1077
- if (n !== null) {
1078
- let i = t.C;
1079
- do {
1080
- if (i === e) return true;
1081
- if (i === n) break;
1082
- i = i.D;
1083
- } while (i !== null);
1084
- }
1085
- return false;
1086
- }
1087
1106
  GlobalQueue.oe = recompute;
1088
1107
  GlobalQueue.ue = disposeChildren;
1089
1108
  let tracking = false;
@@ -1116,10 +1135,10 @@ function releaseSnapshotScope(e) {
1116
1135
  schedule();
1117
1136
  }
1118
1137
  function releaseSubtree(e) {
1119
- let t = e.Ce;
1138
+ let t = e.ge;
1120
1139
  while (t) {
1121
1140
  if (t.We) {
1122
- t = t.De;
1141
+ t = t.Pe;
1123
1142
  continue;
1124
1143
  }
1125
1144
  if (t.L) {
@@ -1133,7 +1152,7 @@ function releaseSubtree(e) {
1133
1152
  }
1134
1153
  }
1135
1154
  releaseSubtree(t);
1136
- t = t.De;
1155
+ t = t.Pe;
1137
1156
  }
1138
1157
  }
1139
1158
  function clearSnapshots() {
@@ -1152,14 +1171,15 @@ function recompute(e, t = false) {
1152
1171
  if (e.K && (!n || activeTransition) && activeTransition !== e.K)
1153
1172
  globalQueue.initTransition(e.K);
1154
1173
  deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1174
+ e.Ce = null;
1155
1175
  if (e.K || n === EFFECT_TRACKED) disposeChildren(e);
1156
1176
  else {
1157
1177
  markDisposal(e);
1158
- e.we = e.be;
1159
- e.me = e.Ce;
1160
- e.be = null;
1161
- e.Ce = null;
1162
- e.ve = 0;
1178
+ e.me = e.ve;
1179
+ e.De = e.ge;
1180
+ e.ve = null;
1181
+ e.ge = null;
1182
+ e.ye = 0;
1163
1183
  }
1164
1184
  }
1165
1185
  const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
@@ -1167,7 +1187,7 @@ function recompute(e, t = false) {
1167
1187
  const s = !!(e.Se & STATUS_PENDING);
1168
1188
  const o = context;
1169
1189
  context = e;
1170
- e.ye = null;
1190
+ e.Ne = null;
1171
1191
  e.O = REACTIVE_RECOMPUTING_DEPS;
1172
1192
  e.Ee = clock;
1173
1193
  let u = e.X === NOT_PENDING ? e.J : e.X;
@@ -1196,7 +1216,7 @@ function recompute(e, t = false) {
1196
1216
  updatePendingSignal(t.te);
1197
1217
  }
1198
1218
  }
1199
- if (t instanceof NotReadyError) e.he = true;
1219
+ if (t instanceof NotReadyError) e.Ue = true;
1200
1220
  notifyStatus(
1201
1221
  e,
1202
1222
  t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
@@ -1210,7 +1230,7 @@ function recompute(e, t = false) {
1210
1230
  context = o;
1211
1231
  }
1212
1232
  if (!e.le) {
1213
- const o = e.ye;
1233
+ const o = e.Ne;
1214
1234
  let a = o !== null ? o.D : e.C;
1215
1235
  if (a !== null) {
1216
1236
  do {
@@ -1220,7 +1240,7 @@ function recompute(e, t = false) {
1220
1240
  else e.C = null;
1221
1241
  }
1222
1242
  const f = r ? e.ee : e.X === NOT_PENDING ? e.J : e.X;
1223
- const l = !e.Ne || !e.Ne(f, u);
1243
+ const l = !e.ke || !e.ke(f, u);
1224
1244
  if (l) {
1225
1245
  const o = r ? e.ee : undefined;
1226
1246
  if (t || (n && activeTransition !== e.K) || i) {
@@ -1257,7 +1277,7 @@ function updateIfNecessary(e) {
1257
1277
  }
1258
1278
  }
1259
1279
  }
1260
- if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.le && e.Ee < clock && !e.Ae)) {
1280
+ if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.le && e.Ee < clock && !e.Ce)) {
1261
1281
  recompute(e);
1262
1282
  }
1263
1283
  e.O = REACTIVE_NONE | (e.O & REACTIVE_SNAPSHOT_STALE);
@@ -1266,14 +1286,14 @@ function computed(e, t, n) {
1266
1286
  const i = n?.transparent ?? false;
1267
1287
  const r = {
1268
1288
  id: n?.id ?? (i ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
1269
- Ve: i || undefined,
1270
- Ne: n?.equals != null ? n.equals : isEqual,
1289
+ we: i || undefined,
1290
+ ke: n?.equals != null ? n.equals : isEqual,
1271
1291
  fe: !!n?.pureWrite,
1272
- Ge: n?.unobserved,
1273
- be: null,
1292
+ he: n?.unobserved,
1293
+ ve: null,
1274
1294
  F: context?.F ?? globalQueue,
1275
- Le: context?.Le ?? defaultContext,
1276
- ve: 0,
1295
+ be: context?.be ?? defaultContext,
1296
+ ye: 0,
1277
1297
  L: e,
1278
1298
  J: t,
1279
1299
  o: 0,
@@ -1281,30 +1301,30 @@ function computed(e, t, n) {
1281
1301
  S: undefined,
1282
1302
  T: null,
1283
1303
  C: null,
1284
- ye: null,
1304
+ Ne: null,
1285
1305
  I: null,
1286
- ke: null,
1306
+ pe: null,
1287
1307
  i: context,
1288
- De: null,
1289
- Ce: null,
1308
+ Pe: null,
1309
+ ge: null,
1290
1310
  O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
1291
1311
  Se: STATUS_UNINITIALIZED,
1292
1312
  Ee: clock,
1293
1313
  X: NOT_PENDING,
1294
- we: null,
1295
1314
  me: null,
1296
- Ae: null,
1315
+ De: null,
1316
+ Ce: null,
1297
1317
  K: null
1298
1318
  };
1299
1319
  r.T = r;
1300
1320
  const s = context?.t ? context.u : context;
1301
1321
  if (context) {
1302
- const e = context.Ce;
1322
+ const e = context.ge;
1303
1323
  if (e === null) {
1304
- context.Ce = r;
1324
+ context.ge = r;
1305
1325
  } else {
1306
- r.De = e;
1307
- context.Ce = r;
1326
+ r.Pe = e;
1327
+ context.ge = r;
1308
1328
  }
1309
1329
  }
1310
1330
  if (s) r.o = s.o + 1;
@@ -1331,13 +1351,13 @@ function computed(e, t, n) {
1331
1351
  }
1332
1352
  function signal(e, t, n = null) {
1333
1353
  const i = {
1334
- Ne: t?.equals != null ? t.equals : isEqual,
1354
+ ke: t?.equals != null ? t.equals : isEqual,
1335
1355
  fe: !!t?.pureWrite,
1336
1356
  He: !!t?.He,
1337
- Ge: t?.unobserved,
1357
+ he: t?.unobserved,
1338
1358
  J: e,
1339
1359
  I: null,
1340
- ke: null,
1360
+ pe: null,
1341
1361
  Ee: clock,
1342
1362
  V: n,
1343
1363
  N: n?.A || null,
@@ -1404,9 +1424,14 @@ function read(e) {
1404
1424
  const n = pendingCheckActive;
1405
1425
  pendingCheckActive = false;
1406
1426
  if (t && e.ee !== undefined) {
1407
- if (e.ee !== NOT_PENDING && (t.Ae || !!(t.Se & STATUS_PENDING))) {
1427
+ if (e.ee !== NOT_PENDING && (t.Ce || !!(t.Se & STATUS_PENDING))) {
1408
1428
  foundPending = true;
1409
1429
  }
1430
+ let n = context;
1431
+ if (n?.t) n = n.u;
1432
+ if (n && tracking) link(e, n);
1433
+ read(getPendingSignal(e));
1434
+ read(getPendingSignal(t));
1410
1435
  } else {
1411
1436
  if (read(getPendingSignal(e))) foundPending = true;
1412
1437
  if (t && read(getPendingSignal(t))) foundPending = true;
@@ -1491,7 +1516,7 @@ function setSignal(e, t) {
1491
1516
  const i = e.ee !== undefined && e.ee !== NOT_PENDING;
1492
1517
  const r = n ? (i ? e.ee : e.J) : e.X === NOT_PENDING ? e.J : e.X;
1493
1518
  if (typeof t === "function") t = t(r);
1494
- const s = !e.Ne || !e.Ne(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
1519
+ const s = !e.ke || !e.ke(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
1495
1520
  if (!s) {
1496
1521
  if (n && i && e.L) {
1497
1522
  insertSubs(e, true);
@@ -1515,8 +1540,8 @@ function setSignal(e, t) {
1515
1540
  e.X = t;
1516
1541
  }
1517
1542
  updatePendingSignal(e);
1518
- if (e.Pe) {
1519
- setSignal(e.Pe, t);
1543
+ if (e.Ge) {
1544
+ setSignal(e.Ge, t);
1520
1545
  }
1521
1546
  e.Ee = clock;
1522
1547
  insertSubs(e, n);
@@ -1549,7 +1574,7 @@ function computePendingState(e) {
1549
1574
  const t = e;
1550
1575
  const n = e.V;
1551
1576
  if (n && e.X !== NOT_PENDING) {
1552
- return !n.Ae && !(n.Se & STATUS_PENDING);
1577
+ return !n.Ce && !(n.Se & STATUS_PENDING);
1553
1578
  }
1554
1579
  if (e.ee !== undefined && e.ee !== NOT_PENDING) {
1555
1580
  if (t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
@@ -1584,20 +1609,20 @@ function updatePendingSignal(e) {
1584
1609
  }
1585
1610
  }
1586
1611
  function getLatestValueComputed(e) {
1587
- if (!e.Pe) {
1612
+ if (!e.Ge) {
1588
1613
  const t = latestReadActive;
1589
1614
  latestReadActive = false;
1590
1615
  const n = pendingCheckActive;
1591
1616
  pendingCheckActive = false;
1592
1617
  const i = context;
1593
1618
  context = null;
1594
- e.Pe = optimisticComputed(() => read(e));
1595
- e.Pe.Re = e;
1619
+ e.Ge = optimisticComputed(() => read(e));
1620
+ e.Ge.Re = e;
1596
1621
  context = i;
1597
1622
  pendingCheckActive = n;
1598
1623
  latestReadActive = t;
1599
1624
  }
1600
- return e.Pe;
1625
+ return e.Ge;
1601
1626
  }
1602
1627
  function staleValues(e, t = true) {
1603
1628
  const n = stale;
@@ -1658,7 +1683,7 @@ function getContext(e, t = getOwner()) {
1658
1683
  if (!t) {
1659
1684
  throw new NoOwnerError();
1660
1685
  }
1661
- const n = hasContext(e, t) ? t.Le[e.id] : e.defaultValue;
1686
+ const n = hasContext(e, t) ? t.be[e.id] : e.defaultValue;
1662
1687
  if (isUndefined(n)) {
1663
1688
  throw new ContextNotFoundError();
1664
1689
  }
@@ -1668,10 +1693,10 @@ function setContext(e, t, n = getOwner()) {
1668
1693
  if (!n) {
1669
1694
  throw new NoOwnerError();
1670
1695
  }
1671
- n.Le = { ...n.Le, [e.id]: isUndefined(t) ? e.defaultValue : t };
1696
+ n.be = { ...n.be, [e.id]: isUndefined(t) ? e.defaultValue : t };
1672
1697
  }
1673
1698
  function hasContext(e, t) {
1674
- return !isUndefined(t?.Le[e.id]);
1699
+ return !isUndefined(t?.be[e.id]);
1675
1700
  }
1676
1701
  function isUndefined(e) {
1677
1702
  return typeof e === "undefined";
@@ -1692,7 +1717,7 @@ function effect(e, t, n, i, r) {
1692
1717
  o.$e = n;
1693
1718
  o.je = undefined;
1694
1719
  o.W = r?.render ? EFFECT_RENDER : EFFECT_USER;
1695
- o.ge = (e, t) => {
1720
+ o.xe = (e, t) => {
1696
1721
  const n = e !== undefined ? e : o.Se;
1697
1722
  const i = t !== undefined ? t : o.le;
1698
1723
  if (n & STATUS_ERROR) {
@@ -1725,7 +1750,9 @@ function runEffect() {
1725
1750
  this.je?.();
1726
1751
  this.je = undefined;
1727
1752
  try {
1728
- this.je = this.Me(this.J, this.Fe);
1753
+ const e = this.Me(this.J, this.Fe);
1754
+ if (false && e !== undefined && typeof e !== "function");
1755
+ this.je = e;
1729
1756
  } catch (e) {
1730
1757
  this.le = new StatusError(this, e);
1731
1758
  this.Se |= STATUS_ERROR;
@@ -1748,7 +1775,8 @@ function trackedEffect(e, t) {
1748
1775
  () => {
1749
1776
  n.je?.();
1750
1777
  n.je = undefined;
1751
- n.je = staleValues(e) || undefined;
1778
+ const t = staleValues(e);
1779
+ n.je = t;
1752
1780
  },
1753
1781
  undefined,
1754
1782
  { ...t, lazy: true }
@@ -1757,7 +1785,7 @@ function trackedEffect(e, t) {
1757
1785
  n.Ke = true;
1758
1786
  n.H = true;
1759
1787
  n.W = EFFECT_TRACKED;
1760
- n.ge = (e, t) => {
1788
+ n.xe = (e, t) => {
1761
1789
  const i = e !== undefined ? e : n.Se;
1762
1790
  if (i & STATUS_ERROR) {
1763
1791
  n.F.notify(n, STATUS_PENDING, 0);
@@ -1852,7 +1880,9 @@ function createReaction(e, t) {
1852
1880
  () => (r(), getOwner()),
1853
1881
  t => {
1854
1882
  n?.();
1855
- n = (e.effect || e)?.();
1883
+ const i = (e.effect || e)?.();
1884
+ if (false && i !== undefined && typeof i !== "function");
1885
+ n = i;
1856
1886
  dispose(t);
1857
1887
  },
1858
1888
  e.error,
@@ -1884,7 +1914,7 @@ function createOptimistic(e, t, n) {
1884
1914
  function onSettled(e) {
1885
1915
  const t = getOwner();
1886
1916
  t && !t.Ke
1887
- ? createTrackedEffect(() => untrack(e))
1917
+ ? createTrackedEffect(() => untrack(e), undefined)
1888
1918
  : globalQueue.enqueue(EFFECT_USER, () => {
1889
1919
  const t = e();
1890
1920
  t?.();
@@ -2053,7 +2083,7 @@ function createProjectionInternal(e, t = {}, n) {
2053
2083
  let r;
2054
2084
  const o = new Proxy(
2055
2085
  s,
2056
- createWriteTraps(() => !i || t.Ae === r)
2086
+ createWriteTraps(() => !i || t.Ce === r)
2057
2087
  );
2058
2088
  storeSetter(o, o => {
2059
2089
  r = e(o);
@@ -2064,7 +2094,7 @@ function createProjectionInternal(e, t = {}, n) {
2064
2094
  u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
2065
2095
  });
2066
2096
  });
2067
- i.xe = true;
2097
+ i.Ae = true;
2068
2098
  return { store: s, node: i };
2069
2099
  }
2070
2100
  function createProjection(e, t = {}, n) {
@@ -2488,7 +2518,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
2488
2518
  let r;
2489
2519
  const o = new Proxy(
2490
2520
  s,
2491
- createWriteTraps(() => !i || t.Ae === r)
2521
+ createWriteTraps(() => !i || t.Ce === r)
2492
2522
  );
2493
2523
  setProjectionWriteActive(true);
2494
2524
  try {
@@ -2509,7 +2539,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
2509
2539
  setProjectionWriteActive(false);
2510
2540
  }
2511
2541
  });
2512
- i.xe = true;
2542
+ i.Ae = true;
2513
2543
  }
2514
2544
  return { store: s, node: i };
2515
2545
  }
@@ -2966,14 +2996,14 @@ function compare(e, t, n) {
2966
2996
  }
2967
2997
  function boundaryComputed(e, t) {
2968
2998
  const n = computed(e, undefined, { lazy: true });
2969
- n.ge = (e, t) => {
2999
+ n.xe = (e, t) => {
2970
3000
  const i = e !== undefined ? e : n.Se;
2971
3001
  const r = t !== undefined ? t : n.le;
2972
3002
  n.Se &= ~n.ut;
2973
3003
  n.F.notify(n, n.ut, i, r);
2974
3004
  };
2975
3005
  n.ut = t;
2976
- n.xe = true;
3006
+ n.Ae = true;
2977
3007
  recompute(n, true);
2978
3008
  return n;
2979
3009
  }