@solidjs/signals 0.10.3 → 0.10.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/dev.js +157 -149
- package/dist/node.cjs +241 -234
- package/dist/prod.js +183 -176
- package/dist/types/core/core.d.ts +1 -6
- package/dist/types/core/index.d.ts +3 -1
- package/dist/types/core/owner.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -103,7 +103,7 @@ function markNode(e, t = REACTIVE_DIRTY) {
|
|
|
103
103
|
markNode(t.h, REACTIVE_CHECK);
|
|
104
104
|
}
|
|
105
105
|
if (e.A !== null) {
|
|
106
|
-
for (let t = e.A; t !== null; t = t.
|
|
106
|
+
for (let t = e.A; t !== null; t = t.C) {
|
|
107
107
|
for (let e = t.I; e !== null; e = e.p) {
|
|
108
108
|
markNode(e.h, REACTIVE_CHECK);
|
|
109
109
|
}
|
|
@@ -112,12 +112,12 @@ function markNode(e, t = REACTIVE_DIRTY) {
|
|
|
112
112
|
}
|
|
113
113
|
function runHeap(e, t) {
|
|
114
114
|
e._ = false;
|
|
115
|
-
for (e.
|
|
116
|
-
let n = e.l[e.
|
|
115
|
+
for (e.P = 0; e.P <= e.O; e.P++) {
|
|
116
|
+
let n = e.l[e.P];
|
|
117
117
|
while (n !== undefined) {
|
|
118
118
|
if (n.S & REACTIVE_IN_HEAP) t(n);
|
|
119
119
|
else adjustHeight(n, e);
|
|
120
|
-
n = e.l[e.
|
|
120
|
+
n = e.l[e.P];
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
e.O = 0;
|
|
@@ -138,8 +138,8 @@ function adjustHeight(e, t) {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
const transitions = new Set();
|
|
141
|
-
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false,
|
|
142
|
-
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false,
|
|
141
|
+
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, O: 0 };
|
|
142
|
+
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, O: 0 };
|
|
143
143
|
let clock = 0;
|
|
144
144
|
let activeTransition = null;
|
|
145
145
|
let scheduled = false;
|
|
@@ -250,7 +250,7 @@ class GlobalQueue extends Queue {
|
|
|
250
250
|
runLaneEffects(EFFECT_USER);
|
|
251
251
|
this.stashQueues(activeTransition.X);
|
|
252
252
|
clock++;
|
|
253
|
-
scheduled = dirtyQueue.O >= dirtyQueue.
|
|
253
|
+
scheduled = dirtyQueue.O >= dirtyQueue.P;
|
|
254
254
|
reassignPendingTransition(activeTransition.$);
|
|
255
255
|
activeTransition = null;
|
|
256
256
|
finalizePureQueue(null, true);
|
|
@@ -268,7 +268,7 @@ class GlobalQueue extends Queue {
|
|
|
268
268
|
finalizePureQueue();
|
|
269
269
|
}
|
|
270
270
|
clock++;
|
|
271
|
-
scheduled = dirtyQueue.O >= dirtyQueue.
|
|
271
|
+
scheduled = dirtyQueue.O >= dirtyQueue.P;
|
|
272
272
|
runLaneEffects(EFFECT_RENDER);
|
|
273
273
|
this.run(EFFECT_RENDER);
|
|
274
274
|
runLaneEffects(EFFECT_USER);
|
|
@@ -359,14 +359,14 @@ function insertSubs(e, t = false) {
|
|
|
359
359
|
continue;
|
|
360
360
|
}
|
|
361
361
|
const r = i.h.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
362
|
-
if (r.
|
|
362
|
+
if (r.P > i.h.o) r.P = i.h.o;
|
|
363
363
|
insertIntoHeap(i.h, r);
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
function finalizePureQueue(e = null, t = false) {
|
|
367
367
|
let n = !t;
|
|
368
368
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
369
|
-
if (dirtyQueue.O >= dirtyQueue.
|
|
369
|
+
if (dirtyQueue.O >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.K);
|
|
370
370
|
if (n) {
|
|
371
371
|
const t = globalQueue.$;
|
|
372
372
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -679,7 +679,7 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
679
679
|
notifyStatus(i.h, t, n, c, l);
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
|
-
for (let i = e.A; i !== null; i = i.
|
|
682
|
+
for (let i = e.A; i !== null; i = i.C) {
|
|
683
683
|
for (let e = i.I; e !== null; e = e.p) {
|
|
684
684
|
e.h.J = clock;
|
|
685
685
|
if (e.h.q !== n) {
|
|
@@ -689,89 +689,67 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
|
-
function
|
|
693
|
-
|
|
694
|
-
const
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
s.pe = (e, t) => {
|
|
709
|
-
const n = e !== undefined ? e : s.ae;
|
|
710
|
-
const i = t !== undefined ? t : s.q;
|
|
711
|
-
if (n & STATUS_ERROR) {
|
|
712
|
-
let e = i;
|
|
713
|
-
s.se.notify(s, STATUS_PENDING, 0);
|
|
714
|
-
if (s.re === EFFECT_USER) {
|
|
715
|
-
try {
|
|
716
|
-
return s.ge
|
|
717
|
-
? s.ge(e, () => {
|
|
718
|
-
s.Pe?.();
|
|
719
|
-
s.Pe = undefined;
|
|
720
|
-
})
|
|
721
|
-
: console.error(e);
|
|
722
|
-
} catch (t) {
|
|
723
|
-
e = t;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
if (!s.se.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
727
|
-
} else if (s.re === EFFECT_RENDER) s.se.notify(s, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
728
|
-
};
|
|
729
|
-
recompute(s, true);
|
|
730
|
-
!r?.defer && (s.re === EFFECT_USER ? s.se.enqueue(s.re, runEffect.bind(s)) : runEffect.call(s));
|
|
731
|
-
o = true;
|
|
732
|
-
onCleanup(() => s.Pe?.());
|
|
692
|
+
function unlinkSubs(e) {
|
|
693
|
+
const t = e.V;
|
|
694
|
+
const n = e.D;
|
|
695
|
+
const i = e.p;
|
|
696
|
+
const r = e.he;
|
|
697
|
+
if (i !== null) i.he = r;
|
|
698
|
+
else t.Ae = r;
|
|
699
|
+
if (r !== null) r.p = i;
|
|
700
|
+
else {
|
|
701
|
+
t.I = i;
|
|
702
|
+
if (i === null) {
|
|
703
|
+
t.ge?.();
|
|
704
|
+
t.L && !t.Ce && unobserved(t);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return n;
|
|
733
708
|
}
|
|
734
|
-
function
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
this.Pe = this.Ae(this.le, this.he);
|
|
740
|
-
} catch (e) {
|
|
741
|
-
if (!this.se.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
742
|
-
} finally {
|
|
743
|
-
this.he = this.le;
|
|
744
|
-
this.oe = false;
|
|
709
|
+
function unobserved(e) {
|
|
710
|
+
deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
711
|
+
let t = e.N;
|
|
712
|
+
while (t !== null) {
|
|
713
|
+
t = unlinkSubs(t);
|
|
745
714
|
}
|
|
715
|
+
e.N = null;
|
|
716
|
+
disposeChildren(e, true);
|
|
746
717
|
}
|
|
747
|
-
function
|
|
748
|
-
const
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
()
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
);
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
n
|
|
769
|
-
n
|
|
770
|
-
|
|
718
|
+
function link(e, t) {
|
|
719
|
+
const n = t.Pe;
|
|
720
|
+
if (n !== null && n.V === e) return;
|
|
721
|
+
let i = null;
|
|
722
|
+
const r = t.S & REACTIVE_RECOMPUTING_DEPS;
|
|
723
|
+
if (r) {
|
|
724
|
+
i = n !== null ? n.D : t.N;
|
|
725
|
+
if (i !== null && i.V === e) {
|
|
726
|
+
t.Pe = i;
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
const o = e.Ae;
|
|
731
|
+
if (o !== null && o.h === t && (!r || isValidLink(o, t))) return;
|
|
732
|
+
const s = (t.Pe = e.Ae = { V: e, h: t, D: i, he: o, p: null });
|
|
733
|
+
if (n !== null) n.D = s;
|
|
734
|
+
else t.N = s;
|
|
735
|
+
if (o !== null) o.p = s;
|
|
736
|
+
else e.I = s;
|
|
737
|
+
}
|
|
738
|
+
function isValidLink(e, t) {
|
|
739
|
+
const n = t.Pe;
|
|
740
|
+
if (n !== null) {
|
|
741
|
+
let i = t.N;
|
|
742
|
+
do {
|
|
743
|
+
if (i === e) return true;
|
|
744
|
+
if (i === n) break;
|
|
745
|
+
i = i.D;
|
|
746
|
+
} while (i !== null);
|
|
747
|
+
}
|
|
748
|
+
return false;
|
|
771
749
|
}
|
|
772
750
|
const PENDING_OWNER = {};
|
|
773
751
|
function markDisposal(e) {
|
|
774
|
-
let t = e.
|
|
752
|
+
let t = e.Ne;
|
|
775
753
|
while (t) {
|
|
776
754
|
t.S |= REACTIVE_ZOMBIE;
|
|
777
755
|
if (t.S & REACTIVE_IN_HEAP) {
|
|
@@ -779,7 +757,7 @@ function markDisposal(e) {
|
|
|
779
757
|
insertIntoHeap(t, zombieQueue);
|
|
780
758
|
}
|
|
781
759
|
markDisposal(t);
|
|
782
|
-
t = t.
|
|
760
|
+
t = t.ye;
|
|
783
761
|
}
|
|
784
762
|
}
|
|
785
763
|
function dispose(e) {
|
|
@@ -788,15 +766,15 @@ function dispose(e) {
|
|
|
788
766
|
t = unlinkSubs(t);
|
|
789
767
|
} while (t !== null);
|
|
790
768
|
e.N = null;
|
|
791
|
-
e.
|
|
769
|
+
e.Pe = null;
|
|
792
770
|
disposeChildren(e, true);
|
|
793
771
|
}
|
|
794
772
|
function disposeChildren(e, t = false, n) {
|
|
795
773
|
if (e.S & REACTIVE_DISPOSED) return;
|
|
796
774
|
if (t) e.S = REACTIVE_DISPOSED;
|
|
797
|
-
let i = n ? e.De : e.
|
|
775
|
+
let i = n ? e.De : e.Ne;
|
|
798
776
|
while (i) {
|
|
799
|
-
const e = i.
|
|
777
|
+
const e = i.ye;
|
|
800
778
|
if (i.N) {
|
|
801
779
|
const e = i;
|
|
802
780
|
deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
@@ -805,7 +783,7 @@ function disposeChildren(e, t = false, n) {
|
|
|
805
783
|
t = unlinkSubs(t);
|
|
806
784
|
} while (t !== null);
|
|
807
785
|
e.N = null;
|
|
808
|
-
e.
|
|
786
|
+
e.Pe = null;
|
|
809
787
|
}
|
|
810
788
|
disposeChildren(i, true);
|
|
811
789
|
i = e;
|
|
@@ -813,8 +791,8 @@ function disposeChildren(e, t = false, n) {
|
|
|
813
791
|
if (n) {
|
|
814
792
|
e.De = null;
|
|
815
793
|
} else {
|
|
816
|
-
e.Ce = null;
|
|
817
794
|
e.Ne = null;
|
|
795
|
+
e.ye = null;
|
|
818
796
|
e.ve = 0;
|
|
819
797
|
}
|
|
820
798
|
runDisposal(e, n);
|
|
@@ -832,12 +810,18 @@ function runDisposal(e, t) {
|
|
|
832
810
|
}
|
|
833
811
|
t ? (e.we = null) : (e.be = null);
|
|
834
812
|
}
|
|
835
|
-
function
|
|
836
|
-
let
|
|
837
|
-
while (
|
|
838
|
-
if (
|
|
813
|
+
function childId(e, t) {
|
|
814
|
+
let n = e;
|
|
815
|
+
while (n.Ve && n.i) n = n.i;
|
|
816
|
+
if (n.id != null) return formatId(n.id, t ? n.ve++ : n.ve);
|
|
839
817
|
throw new Error("Cannot get child id from owner without an id");
|
|
840
818
|
}
|
|
819
|
+
function getNextChildId(e) {
|
|
820
|
+
return childId(e, true);
|
|
821
|
+
}
|
|
822
|
+
function peekNextChildId(e) {
|
|
823
|
+
return childId(e, false);
|
|
824
|
+
}
|
|
841
825
|
function formatId(e, t) {
|
|
842
826
|
const n = t.toString(36),
|
|
843
827
|
i = n.length - 1;
|
|
@@ -865,8 +849,8 @@ function createOwner(e) {
|
|
|
865
849
|
Ve: n || undefined,
|
|
866
850
|
t: true,
|
|
867
851
|
u: t?.t ? t.u : t,
|
|
868
|
-
Ce: null,
|
|
869
852
|
Ne: null,
|
|
853
|
+
ye: null,
|
|
870
854
|
be: null,
|
|
871
855
|
se: t?.se ?? globalQueue,
|
|
872
856
|
me: t?.me || defaultContext,
|
|
@@ -879,12 +863,12 @@ function createOwner(e) {
|
|
|
879
863
|
}
|
|
880
864
|
};
|
|
881
865
|
if (t) {
|
|
882
|
-
const e = t.
|
|
866
|
+
const e = t.Ne;
|
|
883
867
|
if (e === null) {
|
|
884
|
-
t.
|
|
868
|
+
t.Ne = i;
|
|
885
869
|
} else {
|
|
886
|
-
i.
|
|
887
|
-
t.
|
|
870
|
+
i.ye = e;
|
|
871
|
+
t.Ne = i;
|
|
888
872
|
}
|
|
889
873
|
}
|
|
890
874
|
return i;
|
|
@@ -893,63 +877,85 @@ function createRoot(e, t) {
|
|
|
893
877
|
const n = createOwner(t);
|
|
894
878
|
return runWithOwner(n, () => e(n.dispose));
|
|
895
879
|
}
|
|
896
|
-
function
|
|
897
|
-
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
880
|
+
function effect(e, t, n, i, r) {
|
|
881
|
+
let o = false;
|
|
882
|
+
const s = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
883
|
+
...r,
|
|
884
|
+
equals: () => {
|
|
885
|
+
s.oe = !s.q;
|
|
886
|
+
if (o) s.se.enqueue(s.re, runEffect.bind(s));
|
|
887
|
+
return false;
|
|
888
|
+
},
|
|
889
|
+
lazy: true
|
|
890
|
+
});
|
|
891
|
+
s.Le = i;
|
|
892
|
+
s.ke = t;
|
|
893
|
+
s.Ue = n;
|
|
894
|
+
s.We = undefined;
|
|
895
|
+
s.re = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
896
|
+
s.pe = (e, t) => {
|
|
897
|
+
const n = e !== undefined ? e : s.ae;
|
|
898
|
+
const i = t !== undefined ? t : s.q;
|
|
899
|
+
if (n & STATUS_ERROR) {
|
|
900
|
+
let e = i;
|
|
901
|
+
s.se.notify(s, STATUS_PENDING, 0);
|
|
902
|
+
if (s.re === EFFECT_USER) {
|
|
903
|
+
try {
|
|
904
|
+
return s.Ue
|
|
905
|
+
? s.Ue(e, () => {
|
|
906
|
+
s.We?.();
|
|
907
|
+
s.We = undefined;
|
|
908
|
+
})
|
|
909
|
+
: console.error(e);
|
|
910
|
+
} catch (t) {
|
|
911
|
+
e = t;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
if (!s.se.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
915
|
+
} else if (s.re === EFFECT_RENDER) s.se.notify(s, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
916
|
+
};
|
|
917
|
+
recompute(s, true);
|
|
918
|
+
!r?.defer && (s.re === EFFECT_USER ? s.se.enqueue(s.re, runEffect.bind(s)) : runEffect.call(s));
|
|
919
|
+
o = true;
|
|
920
|
+
onCleanup(() => s.We?.());
|
|
921
921
|
}
|
|
922
|
-
function
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
if (
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
922
|
+
function runEffect() {
|
|
923
|
+
if (!this.oe || this.S & REACTIVE_DISPOSED) return;
|
|
924
|
+
this.We?.();
|
|
925
|
+
this.We = undefined;
|
|
926
|
+
try {
|
|
927
|
+
this.We = this.ke(this.le, this.Le);
|
|
928
|
+
} catch (e) {
|
|
929
|
+
if (!this.se.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
930
|
+
} finally {
|
|
931
|
+
this.Le = this.le;
|
|
932
|
+
this.oe = false;
|
|
933
933
|
}
|
|
934
|
-
const o = e.ke;
|
|
935
|
-
if (o !== null && o.h === t && (!r || isValidLink(o, t))) return;
|
|
936
|
-
const s = (t.ye = e.ke = { V: e, h: t, D: i, Le: o, p: null });
|
|
937
|
-
if (n !== null) n.D = s;
|
|
938
|
-
else t.N = s;
|
|
939
|
-
if (o !== null) o.p = s;
|
|
940
|
-
else e.I = s;
|
|
941
934
|
}
|
|
942
|
-
function
|
|
943
|
-
const
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
935
|
+
function trackedEffect(e, t) {
|
|
936
|
+
const run = () => {
|
|
937
|
+
if (!n.oe || n.S & REACTIVE_DISPOSED) return;
|
|
938
|
+
n.oe = false;
|
|
939
|
+
recompute(n);
|
|
940
|
+
};
|
|
941
|
+
const n = computed(
|
|
942
|
+
() => {
|
|
943
|
+
try {
|
|
944
|
+
n.We?.();
|
|
945
|
+
n.We = undefined;
|
|
946
|
+
n.We = staleValues(e) || undefined;
|
|
947
|
+
} finally {
|
|
948
|
+
}
|
|
949
|
+
},
|
|
950
|
+
undefined,
|
|
951
|
+
{ ...t, lazy: true, pureWrite: true }
|
|
952
|
+
);
|
|
953
|
+
n.We = undefined;
|
|
954
|
+
n.oe = true;
|
|
955
|
+
n.re = EFFECT_TRACKED;
|
|
956
|
+
n.ue = run;
|
|
957
|
+
n.se.enqueue(EFFECT_USER, run);
|
|
958
|
+
onCleanup(() => n.We?.());
|
|
953
959
|
}
|
|
954
960
|
GlobalQueue.K = recompute;
|
|
955
961
|
GlobalQueue.Y = disposeChildren;
|
|
@@ -971,9 +977,9 @@ function recompute(e, t = false) {
|
|
|
971
977
|
else {
|
|
972
978
|
markDisposal(e);
|
|
973
979
|
e.we = e.be;
|
|
974
|
-
e.De = e.
|
|
980
|
+
e.De = e.Ne;
|
|
975
981
|
e.be = null;
|
|
976
|
-
e.
|
|
982
|
+
e.Ne = null;
|
|
977
983
|
e.ve = 0;
|
|
978
984
|
}
|
|
979
985
|
}
|
|
@@ -982,7 +988,7 @@ function recompute(e, t = false) {
|
|
|
982
988
|
const o = !!(e.ae & STATUS_PENDING);
|
|
983
989
|
const s = context;
|
|
984
990
|
context = e;
|
|
985
|
-
e.
|
|
991
|
+
e.Pe = null;
|
|
986
992
|
e.S = REACTIVE_RECOMPUTING_DEPS;
|
|
987
993
|
e.J = clock;
|
|
988
994
|
let u = e.ce === NOT_PENDING ? e.le : e.ce;
|
|
@@ -1024,7 +1030,7 @@ function recompute(e, t = false) {
|
|
|
1024
1030
|
context = s;
|
|
1025
1031
|
}
|
|
1026
1032
|
if (!e.q) {
|
|
1027
|
-
const s = e.
|
|
1033
|
+
const s = e.Pe;
|
|
1028
1034
|
let l = s !== null ? s.D : e.N;
|
|
1029
1035
|
if (l !== null) {
|
|
1030
1036
|
do {
|
|
@@ -1084,7 +1090,7 @@ function computed(e, t, n) {
|
|
|
1084
1090
|
Ve: i || undefined,
|
|
1085
1091
|
_e: n?.equals != null ? n.equals : isEqual,
|
|
1086
1092
|
xe: !!n?.pureWrite,
|
|
1087
|
-
|
|
1093
|
+
ge: n?.unobserved,
|
|
1088
1094
|
be: null,
|
|
1089
1095
|
se: context?.se ?? globalQueue,
|
|
1090
1096
|
me: context?.me ?? defaultContext,
|
|
@@ -1096,12 +1102,12 @@ function computed(e, t, n) {
|
|
|
1096
1102
|
R: undefined,
|
|
1097
1103
|
T: null,
|
|
1098
1104
|
N: null,
|
|
1099
|
-
|
|
1105
|
+
Pe: null,
|
|
1100
1106
|
I: null,
|
|
1101
|
-
|
|
1107
|
+
Ae: null,
|
|
1102
1108
|
i: context,
|
|
1109
|
+
ye: null,
|
|
1103
1110
|
Ne: null,
|
|
1104
|
-
Ce: null,
|
|
1105
1111
|
S: REACTIVE_NONE,
|
|
1106
1112
|
ae: STATUS_UNINITIALIZED,
|
|
1107
1113
|
J: clock,
|
|
@@ -1114,12 +1120,12 @@ function computed(e, t, n) {
|
|
|
1114
1120
|
r.T = r;
|
|
1115
1121
|
const o = context?.t ? context.u : context;
|
|
1116
1122
|
if (context) {
|
|
1117
|
-
const e = context.
|
|
1123
|
+
const e = context.Ne;
|
|
1118
1124
|
if (e === null) {
|
|
1119
|
-
context.
|
|
1125
|
+
context.Ne = r;
|
|
1120
1126
|
} else {
|
|
1121
|
-
r.
|
|
1122
|
-
context.
|
|
1127
|
+
r.ye = e;
|
|
1128
|
+
context.Ne = r;
|
|
1123
1129
|
}
|
|
1124
1130
|
}
|
|
1125
1131
|
if (o) r.o = o.o + 1;
|
|
@@ -1130,13 +1136,13 @@ function signal(e, t, n = null) {
|
|
|
1130
1136
|
const i = {
|
|
1131
1137
|
_e: t?.equals != null ? t.equals : isEqual,
|
|
1132
1138
|
xe: !!t?.pureWrite,
|
|
1133
|
-
|
|
1139
|
+
ge: t?.unobserved,
|
|
1134
1140
|
le: e,
|
|
1135
1141
|
I: null,
|
|
1136
|
-
|
|
1142
|
+
Ae: null,
|
|
1137
1143
|
J: clock,
|
|
1138
1144
|
m: n,
|
|
1139
|
-
|
|
1145
|
+
C: n?.A || null,
|
|
1140
1146
|
ce: NOT_PENDING
|
|
1141
1147
|
};
|
|
1142
1148
|
n && (n.A = i);
|
|
@@ -1201,7 +1207,7 @@ function read(e) {
|
|
|
1201
1207
|
const n = e.m || e;
|
|
1202
1208
|
if (n.L) {
|
|
1203
1209
|
const i = e.S & REACTIVE_ZOMBIE;
|
|
1204
|
-
if (n.o >= (i ? zombieQueue.
|
|
1210
|
+
if (n.o >= (i ? zombieQueue.P : dirtyQueue.P)) {
|
|
1205
1211
|
markNode(t);
|
|
1206
1212
|
markHeap(i ? zombieQueue : dirtyQueue);
|
|
1207
1213
|
updateIfNecessary(n);
|
|
@@ -1705,7 +1711,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1705
1711
|
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(o);
|
|
1706
1712
|
});
|
|
1707
1713
|
});
|
|
1708
|
-
i.
|
|
1714
|
+
i.Ce = true;
|
|
1709
1715
|
return { store: o, node: i };
|
|
1710
1716
|
}
|
|
1711
1717
|
function createProjection(e, t = {}, n) {
|
|
@@ -2173,7 +2179,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2173
2179
|
setProjectionWriteActive(false);
|
|
2174
2180
|
}
|
|
2175
2181
|
});
|
|
2176
|
-
i.
|
|
2182
|
+
i.Ce = true;
|
|
2177
2183
|
}
|
|
2178
2184
|
return { store: o, node: i };
|
|
2179
2185
|
}
|
|
@@ -2566,7 +2572,7 @@ function boundaryComputed(e, t) {
|
|
|
2566
2572
|
n.se.notify(n, n.et, i, r);
|
|
2567
2573
|
};
|
|
2568
2574
|
n.et = t;
|
|
2569
|
-
n.
|
|
2575
|
+
n.Ce = true;
|
|
2570
2576
|
recompute(n, true);
|
|
2571
2577
|
return n;
|
|
2572
2578
|
}
|
|
@@ -2730,6 +2736,7 @@ export {
|
|
|
2730
2736
|
omit,
|
|
2731
2737
|
onCleanup,
|
|
2732
2738
|
onSettled,
|
|
2739
|
+
peekNextChildId,
|
|
2733
2740
|
pending,
|
|
2734
2741
|
reconcile,
|
|
2735
2742
|
refresh,
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { handleAsync } from "./async.js";
|
|
2
1
|
import { $REFRESH } from "./constants.js";
|
|
3
2
|
import { type OptimisticLane } from "./lanes.js";
|
|
4
|
-
import {
|
|
5
|
-
import type { Computed, Disposable, FirewallSignal, Link, NodeOptions, Owner, Root, Signal } from "./types.js";
|
|
6
|
-
export { handleAsync };
|
|
7
|
-
export type { Computed, Disposable, FirewallSignal, Link, Owner, Root, Signal, NodeOptions };
|
|
8
|
-
export { createOwner, createRoot, dispose, getNextChildId, getObserver, getOwner, onCleanup };
|
|
3
|
+
import type { Computed, FirewallSignal, NodeOptions, Owner, Signal } from "./types.js";
|
|
9
4
|
export declare let tracking: boolean;
|
|
10
5
|
export declare let stale: boolean;
|
|
11
6
|
export declare let refreshing: boolean;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { ContextNotFoundError, NoOwnerError, NotReadyError } from "./error.js";
|
|
2
|
+
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, optimisticSignal, optimisticComputed, isPending, pending, refresh, isRefreshing, staleValues } from "./core.js";
|
|
3
|
+
export { createOwner, createRoot, dispose, getNextChildId, getObserver, getOwner, onCleanup, peekNextChildId } from "./owner.js";
|
|
2
4
|
export { createContext, getContext, setContext, type Context, type ContextRecord } from "./context.js";
|
|
3
|
-
export {
|
|
5
|
+
export { handleAsync } from "./async.js";
|
|
4
6
|
export type { Computed, Disposable, FirewallSignal, Link, Owner, Root, Signal, NodeOptions } from "./types.js";
|
|
5
7
|
export { effect, trackedEffect, type Effect, type TrackedEffect } from "./effect.js";
|
|
6
8
|
export { action } from "./action.js";
|
|
@@ -3,6 +3,7 @@ export declare function markDisposal(el: Owner): void;
|
|
|
3
3
|
export declare function dispose(node: Computed<unknown>): void;
|
|
4
4
|
export declare function disposeChildren(node: Owner, self?: boolean, zombie?: boolean): void;
|
|
5
5
|
export declare function getNextChildId(owner: Owner): string;
|
|
6
|
+
export declare function peekNextChildId(owner: Owner): string;
|
|
6
7
|
export declare function getObserver(): Owner | null;
|
|
7
8
|
export declare function getOwner(): Owner | null;
|
|
8
9
|
export declare function onCleanup(fn: Disposable): Disposable;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ContextNotFoundError, NoOwnerError, NotReadyError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, getContext, setContext, getOwner, onCleanup, getObserver, isEqual, untrack, isPending, pending, isRefreshing, refresh, SUPPORTS_PROXY } from "./core/index.js";
|
|
1
|
+
export { ContextNotFoundError, NoOwnerError, NotReadyError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, onCleanup, getObserver, isEqual, untrack, isPending, pending, isRefreshing, refresh, SUPPORTS_PROXY } from "./core/index.js";
|
|
2
2
|
export type { Owner, Context, ContextRecord, IQueue } from "./core/index.js";
|
|
3
3
|
export * from "./signals.js";
|
|
4
4
|
export { mapArray, repeat, type Maybe } from "./map.js";
|