@solidjs/signals 0.13.6 → 0.13.8
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 +308 -233
- package/dist/node.cjs +418 -360
- package/dist/prod.js +427 -364
- package/dist/types/store/utils.d.ts +1 -2
- package/package.json +1 -1
package/dist/node.cjs
CHANGED
|
@@ -44,8 +44,8 @@ const S = {};
|
|
|
44
44
|
const w = {};
|
|
45
45
|
const m = "sp";
|
|
46
46
|
const b = typeof Proxy === "function";
|
|
47
|
-
const
|
|
48
|
-
const
|
|
47
|
+
const O = {};
|
|
48
|
+
const _ = Symbol("refresh");
|
|
49
49
|
function actualInsertIntoHeap(e, t) {
|
|
50
50
|
const n = (e.i?.t ? e.i.u?.o : e.i?.o) ?? -1;
|
|
51
51
|
if (n >= e.o) e.o = n + 1;
|
|
@@ -92,8 +92,8 @@ function deleteFromHeap(e, t) {
|
|
|
92
92
|
e.h = undefined;
|
|
93
93
|
}
|
|
94
94
|
function markHeap(e) {
|
|
95
|
-
if (e.
|
|
96
|
-
e.
|
|
95
|
+
if (e.O) return;
|
|
96
|
+
e.O = true;
|
|
97
97
|
for (let t = 0; t <= e.S; t++) {
|
|
98
98
|
for (let n = e.l[t]; n !== undefined; n = n.h) {
|
|
99
99
|
if (n.m & i) markNode(n);
|
|
@@ -104,19 +104,19 @@ function markNode(e, r = n) {
|
|
|
104
104
|
const i = e.m;
|
|
105
105
|
if ((i & (t | n)) >= r) return;
|
|
106
106
|
e.m = (i & -4) | r;
|
|
107
|
-
for (let n = e.
|
|
107
|
+
for (let n = e._; n !== null; n = n.P) {
|
|
108
108
|
markNode(n.k, t);
|
|
109
109
|
}
|
|
110
|
-
if (e.
|
|
111
|
-
for (let n = e.
|
|
112
|
-
for (let e = n.
|
|
110
|
+
if (e.W !== null) {
|
|
111
|
+
for (let n = e.W; n !== null; n = n.C) {
|
|
112
|
+
for (let e = n._; e !== null; e = e.P) {
|
|
113
113
|
markNode(e.k, t);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
function runHeap(e, t) {
|
|
119
|
-
e.
|
|
119
|
+
e.O = false;
|
|
120
120
|
for (e.j = 0; e.j <= e.S; e.j++) {
|
|
121
121
|
let n = e.l[e.j];
|
|
122
122
|
while (n !== undefined) {
|
|
@@ -137,18 +137,18 @@ function adjustHeight(e, t) {
|
|
|
137
137
|
}
|
|
138
138
|
if (e.o !== n) {
|
|
139
139
|
e.o = n;
|
|
140
|
-
for (let n = e.
|
|
140
|
+
for (let n = e._; n !== null; n = n.P) {
|
|
141
141
|
insertIntoHeapHeight(n.k, t);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
const x = new Set();
|
|
146
|
-
const P = { l: new Array(2e3).fill(undefined),
|
|
147
|
-
const v = { l: new Array(2e3).fill(undefined),
|
|
146
|
+
const P = { l: new Array(2e3).fill(undefined), O: false, j: 0, S: 0 };
|
|
147
|
+
const v = { l: new Array(2e3).fill(undefined), O: false, j: 0, S: 0 };
|
|
148
148
|
let E = 0;
|
|
149
149
|
let k = null;
|
|
150
|
-
let C = false;
|
|
151
150
|
let W = false;
|
|
151
|
+
let C = false;
|
|
152
152
|
let j = null;
|
|
153
153
|
function enforceLoadingBoundary(e) {}
|
|
154
154
|
function shouldReadStashedOptimisticValue(e) {
|
|
@@ -165,7 +165,7 @@ function runLaneEffects(e) {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
function queueStashedOptimisticEffects(e) {
|
|
168
|
-
for (let t = e.
|
|
168
|
+
for (let t = e._; t !== null; t = t.P) {
|
|
169
169
|
const e = t.k;
|
|
170
170
|
if (!e.D) continue;
|
|
171
171
|
if (e.D === y) {
|
|
@@ -181,7 +181,7 @@ function queueStashedOptimisticEffects(e) {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
function setProjectionWriteActive(e) {
|
|
184
|
-
|
|
184
|
+
C = e;
|
|
185
185
|
}
|
|
186
186
|
function mergeTransitionState(e, t) {
|
|
187
187
|
t.B = e;
|
|
@@ -227,9 +227,9 @@ function cleanupCompletedLanes(e) {
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
function schedule() {
|
|
230
|
-
if (
|
|
231
|
-
|
|
232
|
-
if (!A.ne && !
|
|
230
|
+
if (W) return;
|
|
231
|
+
W = true;
|
|
232
|
+
if (!A.ne && !C) queueMicrotask(flush);
|
|
233
233
|
}
|
|
234
234
|
class Queue {
|
|
235
235
|
i = null;
|
|
@@ -319,7 +319,7 @@ class GlobalQueue extends Queue {
|
|
|
319
319
|
runLaneEffects(g);
|
|
320
320
|
this.stashQueues(e.ce);
|
|
321
321
|
E++;
|
|
322
|
-
|
|
322
|
+
W = P.S >= P.j;
|
|
323
323
|
reassignPendingTransition(e.se);
|
|
324
324
|
k = null;
|
|
325
325
|
if (!e.G.length && e.U.length) {
|
|
@@ -350,7 +350,7 @@ class GlobalQueue extends Queue {
|
|
|
350
350
|
finalizePureQueue();
|
|
351
351
|
}
|
|
352
352
|
E++;
|
|
353
|
-
|
|
353
|
+
W = P.S >= P.j;
|
|
354
354
|
runLaneEffects(h);
|
|
355
355
|
this.run(h);
|
|
356
356
|
runLaneEffects(g);
|
|
@@ -426,7 +426,7 @@ class GlobalQueue extends Queue {
|
|
|
426
426
|
function insertSubs(e, t = false) {
|
|
427
427
|
const n = e.Y || M;
|
|
428
428
|
const r = e.pe !== undefined;
|
|
429
|
-
for (let i = e.
|
|
429
|
+
for (let i = e._; i !== null; i = i.P) {
|
|
430
430
|
if (r && i.k.he) {
|
|
431
431
|
i.k.m |= c;
|
|
432
432
|
continue;
|
|
@@ -504,7 +504,7 @@ function flush() {
|
|
|
504
504
|
if (A.ne) {
|
|
505
505
|
return;
|
|
506
506
|
}
|
|
507
|
-
while (
|
|
507
|
+
while (W || k) {
|
|
508
508
|
A.flush();
|
|
509
509
|
}
|
|
510
510
|
}
|
|
@@ -620,39 +620,230 @@ function assignOrMergeLane(e, t) {
|
|
|
620
620
|
}
|
|
621
621
|
e.Y = t;
|
|
622
622
|
}
|
|
623
|
+
function unlinkSubs(e) {
|
|
624
|
+
const t = e.L;
|
|
625
|
+
const n = e.N;
|
|
626
|
+
const r = e.P;
|
|
627
|
+
const i = e.me;
|
|
628
|
+
if (r !== null) r.me = i;
|
|
629
|
+
else t.be = i;
|
|
630
|
+
if (i !== null) i.P = r;
|
|
631
|
+
else {
|
|
632
|
+
t._ = r;
|
|
633
|
+
if (r === null) {
|
|
634
|
+
t.Oe?.();
|
|
635
|
+
t.R && !t._e && !(t.m & o) && unobserved(t);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
return n;
|
|
639
|
+
}
|
|
640
|
+
function unobserved(e) {
|
|
641
|
+
deleteFromHeap(e, e.m & o ? v : P);
|
|
642
|
+
let t = e.A;
|
|
643
|
+
while (t !== null) {
|
|
644
|
+
t = unlinkSubs(t);
|
|
645
|
+
}
|
|
646
|
+
e.A = null;
|
|
647
|
+
disposeChildren(e, true);
|
|
648
|
+
}
|
|
649
|
+
function link(e, t) {
|
|
650
|
+
const n = t.xe;
|
|
651
|
+
if (n !== null && n.L === e) return;
|
|
652
|
+
let i = null;
|
|
653
|
+
const s = t.m & r;
|
|
654
|
+
if (s) {
|
|
655
|
+
i = n !== null ? n.N : t.A;
|
|
656
|
+
if (i !== null && i.L === e) {
|
|
657
|
+
t.xe = i;
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
const o = e.be;
|
|
662
|
+
if (o !== null && o.k === t && (!s || isValidLink(o, t))) return;
|
|
663
|
+
const u = (t.xe = e.be = { L: e, k: t, N: i, me: o, P: null });
|
|
664
|
+
if (n !== null) n.N = u;
|
|
665
|
+
else t.A = u;
|
|
666
|
+
if (o !== null) o.P = u;
|
|
667
|
+
else e._ = u;
|
|
668
|
+
}
|
|
669
|
+
function isValidLink(e, t) {
|
|
670
|
+
const n = t.xe;
|
|
671
|
+
if (n !== null) {
|
|
672
|
+
let r = t.A;
|
|
673
|
+
do {
|
|
674
|
+
if (r === e) return true;
|
|
675
|
+
if (r === n) break;
|
|
676
|
+
r = r.N;
|
|
677
|
+
} while (r !== null);
|
|
678
|
+
}
|
|
679
|
+
return false;
|
|
680
|
+
}
|
|
681
|
+
const I = {};
|
|
682
|
+
function markDisposal(e) {
|
|
683
|
+
let t = e.Pe;
|
|
684
|
+
while (t) {
|
|
685
|
+
t.m |= o;
|
|
686
|
+
if (t.m & i) {
|
|
687
|
+
deleteFromHeap(t, P);
|
|
688
|
+
insertIntoHeap(t, v);
|
|
689
|
+
}
|
|
690
|
+
markDisposal(t);
|
|
691
|
+
t = t.ve;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
function dispose(e) {
|
|
695
|
+
let t = e.A || null;
|
|
696
|
+
do {
|
|
697
|
+
t = unlinkSubs(t);
|
|
698
|
+
} while (t !== null);
|
|
699
|
+
e.A = null;
|
|
700
|
+
e.xe = null;
|
|
701
|
+
disposeChildren(e, true);
|
|
702
|
+
}
|
|
703
|
+
function disposeChildren(e, t = false, n) {
|
|
704
|
+
if (e.m & u) return;
|
|
705
|
+
if (t) e.m = u;
|
|
706
|
+
if (t && e.R) e.Ee = null;
|
|
707
|
+
let r = n ? e.ke : e.Pe;
|
|
708
|
+
while (r) {
|
|
709
|
+
const e = r.ve;
|
|
710
|
+
if (r.A) {
|
|
711
|
+
const e = r;
|
|
712
|
+
deleteFromHeap(e, e.m & o ? v : P);
|
|
713
|
+
let t = e.A;
|
|
714
|
+
do {
|
|
715
|
+
t = unlinkSubs(t);
|
|
716
|
+
} while (t !== null);
|
|
717
|
+
e.A = null;
|
|
718
|
+
e.xe = null;
|
|
719
|
+
}
|
|
720
|
+
disposeChildren(r, true);
|
|
721
|
+
r = e;
|
|
722
|
+
}
|
|
723
|
+
if (n) {
|
|
724
|
+
e.ke = null;
|
|
725
|
+
} else {
|
|
726
|
+
e.Pe = null;
|
|
727
|
+
e.We = 0;
|
|
728
|
+
}
|
|
729
|
+
runDisposal(e, n);
|
|
730
|
+
}
|
|
731
|
+
function runDisposal(e, t) {
|
|
732
|
+
let n = t ? e.Ce : e.je;
|
|
733
|
+
if (!n) return;
|
|
734
|
+
if (Array.isArray(n)) {
|
|
735
|
+
for (let e = 0; e < n.length; e++) {
|
|
736
|
+
const t = n[e];
|
|
737
|
+
t.call(t);
|
|
738
|
+
}
|
|
739
|
+
} else {
|
|
740
|
+
n.call(n);
|
|
741
|
+
}
|
|
742
|
+
t ? (e.Ce = null) : (e.je = null);
|
|
743
|
+
}
|
|
744
|
+
function childId(e, t) {
|
|
745
|
+
let n = e;
|
|
746
|
+
while (n.Ae && n.i) n = n.i;
|
|
747
|
+
if (n.id != null) return formatId(n.id, t ? n.We++ : n.We);
|
|
748
|
+
throw new Error("Cannot get child id from owner without an id");
|
|
749
|
+
}
|
|
750
|
+
function getNextChildId(e) {
|
|
751
|
+
return childId(e, true);
|
|
752
|
+
}
|
|
753
|
+
function peekNextChildId(e) {
|
|
754
|
+
return childId(e, false);
|
|
755
|
+
}
|
|
756
|
+
function formatId(e, t) {
|
|
757
|
+
const n = t.toString(36),
|
|
758
|
+
r = n.length - 1;
|
|
759
|
+
return e + (r ? String.fromCharCode(64 + r) : "") + n;
|
|
760
|
+
}
|
|
761
|
+
function getObserver() {
|
|
762
|
+
if (q || F) return I;
|
|
763
|
+
return T ? V : null;
|
|
764
|
+
}
|
|
765
|
+
function getOwner() {
|
|
766
|
+
return V;
|
|
767
|
+
}
|
|
768
|
+
function cleanup(e) {
|
|
769
|
+
if (!V) return e;
|
|
770
|
+
if (!V.je) V.je = e;
|
|
771
|
+
else if (Array.isArray(V.je)) V.je.push(e);
|
|
772
|
+
else V.je = [V.je, e];
|
|
773
|
+
return e;
|
|
774
|
+
}
|
|
775
|
+
function isDisposed(e) {
|
|
776
|
+
return !!(e.m & (u | o));
|
|
777
|
+
}
|
|
778
|
+
function createOwner(e) {
|
|
779
|
+
const t = V;
|
|
780
|
+
const n = e?.transparent ?? false;
|
|
781
|
+
const r = {
|
|
782
|
+
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
783
|
+
Ae: n || undefined,
|
|
784
|
+
t: true,
|
|
785
|
+
u: t?.t ? t.u : t,
|
|
786
|
+
Pe: null,
|
|
787
|
+
ve: null,
|
|
788
|
+
je: null,
|
|
789
|
+
V: t?.V ?? A,
|
|
790
|
+
Ne: t?.Ne || O,
|
|
791
|
+
We: 0,
|
|
792
|
+
Ce: null,
|
|
793
|
+
ke: null,
|
|
794
|
+
i: t,
|
|
795
|
+
dispose(e = true) {
|
|
796
|
+
disposeChildren(r, e);
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
if (t) {
|
|
800
|
+
const e = t.Pe;
|
|
801
|
+
if (e === null) {
|
|
802
|
+
t.Pe = r;
|
|
803
|
+
} else {
|
|
804
|
+
r.ve = e;
|
|
805
|
+
t.Pe = r;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
return r;
|
|
809
|
+
}
|
|
810
|
+
function createRoot(e, t) {
|
|
811
|
+
const n = createOwner(t);
|
|
812
|
+
return runWithOwner(n, () => e(n.dispose));
|
|
813
|
+
}
|
|
623
814
|
function addPendingSource(e, t) {
|
|
624
|
-
if (e.
|
|
625
|
-
if (!e.
|
|
626
|
-
e.
|
|
815
|
+
if (e.Le === t || e.Ie?.has(t)) return false;
|
|
816
|
+
if (!e.Le) {
|
|
817
|
+
e.Le = t;
|
|
627
818
|
return true;
|
|
628
819
|
}
|
|
629
|
-
if (!e.
|
|
630
|
-
e.
|
|
820
|
+
if (!e.Ie) {
|
|
821
|
+
e.Ie = new Set([e.Le, t]);
|
|
631
822
|
} else {
|
|
632
|
-
e.
|
|
823
|
+
e.Ie.add(t);
|
|
633
824
|
}
|
|
634
|
-
e.
|
|
825
|
+
e.Le = undefined;
|
|
635
826
|
return true;
|
|
636
827
|
}
|
|
637
828
|
function removePendingSource(e, t) {
|
|
638
|
-
if (e.
|
|
639
|
-
if (e.
|
|
640
|
-
e.
|
|
829
|
+
if (e.Le) {
|
|
830
|
+
if (e.Le !== t) return false;
|
|
831
|
+
e.Le = undefined;
|
|
641
832
|
return true;
|
|
642
833
|
}
|
|
643
|
-
if (!e.
|
|
644
|
-
if (e.
|
|
645
|
-
e.
|
|
646
|
-
e.
|
|
647
|
-
} else if (e.
|
|
648
|
-
e.
|
|
834
|
+
if (!e.Ie?.delete(t)) return false;
|
|
835
|
+
if (e.Ie.size === 1) {
|
|
836
|
+
e.Le = e.Ie.values().next().value;
|
|
837
|
+
e.Ie = undefined;
|
|
838
|
+
} else if (e.Ie.size === 0) {
|
|
839
|
+
e.Ie = undefined;
|
|
649
840
|
}
|
|
650
841
|
return true;
|
|
651
842
|
}
|
|
652
843
|
function clearPendingSources(e) {
|
|
653
|
-
e.
|
|
654
|
-
e.
|
|
655
|
-
e.
|
|
844
|
+
e.Le = undefined;
|
|
845
|
+
e.Ie?.clear();
|
|
846
|
+
e.Ie = undefined;
|
|
656
847
|
}
|
|
657
848
|
function setPendingError(e, t, n) {
|
|
658
849
|
if (!t) {
|
|
@@ -669,9 +860,9 @@ function setPendingError(e, t, n) {
|
|
|
669
860
|
}
|
|
670
861
|
}
|
|
671
862
|
function forEachDependent(e, t) {
|
|
672
|
-
for (let n = e.
|
|
673
|
-
for (let n = e.
|
|
674
|
-
for (let e = n.
|
|
863
|
+
for (let n = e._; n !== null; n = n.P) t(n.k);
|
|
864
|
+
for (let n = e.W; n !== null; n = n.C) {
|
|
865
|
+
for (let e = n._; e !== null; e = e.P) t(e.k);
|
|
675
866
|
}
|
|
676
867
|
}
|
|
677
868
|
function settlePendingSource(e) {
|
|
@@ -681,7 +872,7 @@ function settlePendingSource(e) {
|
|
|
681
872
|
if (n.has(r) || !removePendingSource(r, e)) return;
|
|
682
873
|
n.add(r);
|
|
683
874
|
r.de = E;
|
|
684
|
-
const i = r.
|
|
875
|
+
const i = r.Le ?? r.Ie?.values().next().value;
|
|
685
876
|
if (i) {
|
|
686
877
|
setPendingError(r, i);
|
|
687
878
|
updatePendingSignal(r);
|
|
@@ -689,7 +880,7 @@ function settlePendingSource(e) {
|
|
|
689
880
|
r.ge &= ~a;
|
|
690
881
|
setPendingError(r);
|
|
691
882
|
updatePendingSignal(r);
|
|
692
|
-
if (r.
|
|
883
|
+
if (r.Re) {
|
|
693
884
|
if (r.D === y) {
|
|
694
885
|
const e = r;
|
|
695
886
|
if (!e.F) {
|
|
@@ -703,7 +894,7 @@ function settlePendingSource(e) {
|
|
|
703
894
|
}
|
|
704
895
|
t = true;
|
|
705
896
|
}
|
|
706
|
-
r.
|
|
897
|
+
r.Re = false;
|
|
707
898
|
}
|
|
708
899
|
forEachDependent(r, settle);
|
|
709
900
|
};
|
|
@@ -715,19 +906,19 @@ function handleAsync(e, t, r) {
|
|
|
715
906
|
const s = i && untrack(() => t[Symbol.asyncIterator]);
|
|
716
907
|
const o = !s && i && untrack(() => typeof t.then === "function");
|
|
717
908
|
if (!o && !s) {
|
|
718
|
-
e.
|
|
909
|
+
e.Ee = null;
|
|
719
910
|
return t;
|
|
720
911
|
}
|
|
721
|
-
e.
|
|
912
|
+
e.Ee = t;
|
|
722
913
|
let u;
|
|
723
914
|
const handleError = n => {
|
|
724
|
-
if (e.
|
|
915
|
+
if (e.Ee !== t) return;
|
|
725
916
|
A.initTransition(resolveTransition(e));
|
|
726
917
|
notifyStatus(e, n instanceof NotReadyError ? a : d, n);
|
|
727
918
|
e.de = E;
|
|
728
919
|
};
|
|
729
920
|
const asyncWrite = (i, s) => {
|
|
730
|
-
if (e.
|
|
921
|
+
if (e.Ee !== t) return;
|
|
731
922
|
if (e.m & (n | f)) return;
|
|
732
923
|
A.initTransition(resolveTransition(e));
|
|
733
924
|
clearStatus(e);
|
|
@@ -743,12 +934,12 @@ function handleAsync(e, t, r) {
|
|
|
743
934
|
e.de = E;
|
|
744
935
|
} else if (o) {
|
|
745
936
|
const t = e.$;
|
|
746
|
-
const n = e.
|
|
937
|
+
const n = e.Te;
|
|
747
938
|
if (!n || !n(i, t)) {
|
|
748
939
|
e.$ = i;
|
|
749
940
|
e.de = E;
|
|
750
|
-
if (e.
|
|
751
|
-
setSignal(e.
|
|
941
|
+
if (e.He) {
|
|
942
|
+
setSignal(e.He, i);
|
|
752
943
|
}
|
|
753
944
|
insertSubs(e, true);
|
|
754
945
|
}
|
|
@@ -783,35 +974,53 @@ function handleAsync(e, t, r) {
|
|
|
783
974
|
if (s) {
|
|
784
975
|
const n = t[Symbol.asyncIterator]();
|
|
785
976
|
let r = false;
|
|
977
|
+
let i = false;
|
|
978
|
+
cleanup(() => {
|
|
979
|
+
if (i) return;
|
|
980
|
+
i = true;
|
|
981
|
+
try {
|
|
982
|
+
const e = n.return?.();
|
|
983
|
+
if (e && typeof e.then === "function") {
|
|
984
|
+
e.then(undefined, () => {});
|
|
985
|
+
}
|
|
986
|
+
} catch {}
|
|
987
|
+
});
|
|
786
988
|
const iterate = () => {
|
|
787
|
-
let
|
|
788
|
-
|
|
789
|
-
|
|
989
|
+
let s,
|
|
990
|
+
o = false,
|
|
991
|
+
f = true;
|
|
790
992
|
n.next().then(
|
|
791
993
|
n => {
|
|
792
|
-
if (
|
|
793
|
-
|
|
794
|
-
|
|
994
|
+
if (f) {
|
|
995
|
+
s = n;
|
|
996
|
+
o = true;
|
|
997
|
+
if (n.done) i = true;
|
|
998
|
+
} else if (e.Ee !== t) {
|
|
999
|
+
return;
|
|
795
1000
|
} else if (!n.done) asyncWrite(n.value, iterate);
|
|
796
1001
|
else {
|
|
1002
|
+
i = true;
|
|
797
1003
|
schedule();
|
|
798
1004
|
flush();
|
|
799
1005
|
}
|
|
800
1006
|
},
|
|
801
|
-
|
|
802
|
-
if (!
|
|
1007
|
+
n => {
|
|
1008
|
+
if (!f && e.Ee === t) {
|
|
1009
|
+
i = true;
|
|
1010
|
+
handleError(n);
|
|
1011
|
+
}
|
|
803
1012
|
}
|
|
804
1013
|
);
|
|
805
|
-
|
|
806
|
-
if (
|
|
807
|
-
u =
|
|
1014
|
+
f = false;
|
|
1015
|
+
if (o && !s.done) {
|
|
1016
|
+
u = s.value;
|
|
808
1017
|
r = true;
|
|
809
1018
|
return iterate();
|
|
810
1019
|
}
|
|
811
|
-
return
|
|
1020
|
+
return o && s.done;
|
|
812
1021
|
};
|
|
813
|
-
const
|
|
814
|
-
if (!r && !
|
|
1022
|
+
const s = iterate();
|
|
1023
|
+
if (!r && !s) {
|
|
815
1024
|
A.initTransition(resolveTransition(e));
|
|
816
1025
|
throw new NotReadyError(V);
|
|
817
1026
|
}
|
|
@@ -820,11 +1029,11 @@ function handleAsync(e, t, r) {
|
|
|
820
1029
|
}
|
|
821
1030
|
function clearStatus(e, t = false) {
|
|
822
1031
|
clearPendingSources(e);
|
|
823
|
-
e.
|
|
1032
|
+
e.Re = false;
|
|
824
1033
|
e.ge = t ? 0 : e.ge & p;
|
|
825
1034
|
setPendingError(e);
|
|
826
1035
|
updatePendingSignal(e);
|
|
827
|
-
e.
|
|
1036
|
+
e.Qe?.();
|
|
828
1037
|
}
|
|
829
1038
|
function notifyStatus(e, t, n, r, i) {
|
|
830
1039
|
if (t === d && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
@@ -850,34 +1059,34 @@ function notifyStatus(e, t, n, r, i) {
|
|
|
850
1059
|
}
|
|
851
1060
|
const c = r || f;
|
|
852
1061
|
const l = r || u ? undefined : i;
|
|
853
|
-
if (e.
|
|
1062
|
+
if (e.Qe) {
|
|
854
1063
|
if (r && t === a) {
|
|
855
1064
|
return;
|
|
856
1065
|
}
|
|
857
1066
|
if (c) {
|
|
858
|
-
e.
|
|
1067
|
+
e.Qe(t, n);
|
|
859
1068
|
} else {
|
|
860
|
-
e.
|
|
1069
|
+
e.Qe();
|
|
861
1070
|
}
|
|
862
1071
|
return;
|
|
863
1072
|
}
|
|
864
1073
|
forEachDependent(e, e => {
|
|
865
1074
|
e.de = E;
|
|
866
1075
|
if (
|
|
867
|
-
(t === a && s && e.
|
|
868
|
-
(t !== a && (e.ae !== n || e.
|
|
1076
|
+
(t === a && s && e.Le !== s && !e.Ie?.has(s)) ||
|
|
1077
|
+
(t !== a && (e.ae !== n || e.Le || e.Ie))
|
|
869
1078
|
) {
|
|
870
1079
|
if (!c && !e.K) A.se.push(e);
|
|
871
1080
|
notifyStatus(e, t, n, c, l);
|
|
872
1081
|
}
|
|
873
1082
|
});
|
|
874
1083
|
}
|
|
875
|
-
let
|
|
1084
|
+
let R = null;
|
|
876
1085
|
function enableExternalSource(e) {
|
|
877
1086
|
const { factory: t, untrack: n = e => e() } = e;
|
|
878
|
-
if (
|
|
879
|
-
const { factory: e, untrack: r } =
|
|
880
|
-
|
|
1087
|
+
if (R) {
|
|
1088
|
+
const { factory: e, untrack: r } = R;
|
|
1089
|
+
R = {
|
|
881
1090
|
factory: (n, r) => {
|
|
882
1091
|
const i = e(n, r);
|
|
883
1092
|
const s = t(e => i.track(e), r);
|
|
@@ -892,199 +1101,9 @@ function enableExternalSource(e) {
|
|
|
892
1101
|
untrack: e => r(() => n(e))
|
|
893
1102
|
};
|
|
894
1103
|
} else {
|
|
895
|
-
|
|
1104
|
+
R = { factory: t, untrack: n };
|
|
896
1105
|
}
|
|
897
1106
|
}
|
|
898
|
-
const R = {};
|
|
899
|
-
function markDisposal(e) {
|
|
900
|
-
let t = e.Ee;
|
|
901
|
-
while (t) {
|
|
902
|
-
t.m |= o;
|
|
903
|
-
if (t.m & i) {
|
|
904
|
-
deleteFromHeap(t, P);
|
|
905
|
-
insertIntoHeap(t, v);
|
|
906
|
-
}
|
|
907
|
-
markDisposal(t);
|
|
908
|
-
t = t.ke;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
function dispose(e) {
|
|
912
|
-
let t = e.A || null;
|
|
913
|
-
do {
|
|
914
|
-
t = unlinkSubs(t);
|
|
915
|
-
} while (t !== null);
|
|
916
|
-
e.A = null;
|
|
917
|
-
e.Ce = null;
|
|
918
|
-
disposeChildren(e, true);
|
|
919
|
-
}
|
|
920
|
-
function disposeChildren(e, t = false, n) {
|
|
921
|
-
if (e.m & u) return;
|
|
922
|
-
if (t) e.m = u;
|
|
923
|
-
let r = n ? e.We : e.Ee;
|
|
924
|
-
while (r) {
|
|
925
|
-
const e = r.ke;
|
|
926
|
-
if (r.A) {
|
|
927
|
-
const e = r;
|
|
928
|
-
deleteFromHeap(e, e.m & o ? v : P);
|
|
929
|
-
let t = e.A;
|
|
930
|
-
do {
|
|
931
|
-
t = unlinkSubs(t);
|
|
932
|
-
} while (t !== null);
|
|
933
|
-
e.A = null;
|
|
934
|
-
e.Ce = null;
|
|
935
|
-
}
|
|
936
|
-
disposeChildren(r, true);
|
|
937
|
-
r = e;
|
|
938
|
-
}
|
|
939
|
-
if (n) {
|
|
940
|
-
e.We = null;
|
|
941
|
-
} else {
|
|
942
|
-
e.Ee = null;
|
|
943
|
-
e.je = 0;
|
|
944
|
-
}
|
|
945
|
-
runDisposal(e, n);
|
|
946
|
-
}
|
|
947
|
-
function runDisposal(e, t) {
|
|
948
|
-
let n = t ? e.Ae : e.Ne;
|
|
949
|
-
if (!n) return;
|
|
950
|
-
if (Array.isArray(n)) {
|
|
951
|
-
for (let e = 0; e < n.length; e++) {
|
|
952
|
-
const t = n[e];
|
|
953
|
-
t.call(t);
|
|
954
|
-
}
|
|
955
|
-
} else {
|
|
956
|
-
n.call(n);
|
|
957
|
-
}
|
|
958
|
-
t ? (e.Ae = null) : (e.Ne = null);
|
|
959
|
-
}
|
|
960
|
-
function childId(e, t) {
|
|
961
|
-
let n = e;
|
|
962
|
-
while (n.Le && n.i) n = n.i;
|
|
963
|
-
if (n.id != null) return formatId(n.id, t ? n.je++ : n.je);
|
|
964
|
-
throw new Error("Cannot get child id from owner without an id");
|
|
965
|
-
}
|
|
966
|
-
function getNextChildId(e) {
|
|
967
|
-
return childId(e, true);
|
|
968
|
-
}
|
|
969
|
-
function peekNextChildId(e) {
|
|
970
|
-
return childId(e, false);
|
|
971
|
-
}
|
|
972
|
-
function formatId(e, t) {
|
|
973
|
-
const n = t.toString(36),
|
|
974
|
-
r = n.length - 1;
|
|
975
|
-
return e + (r ? String.fromCharCode(64 + r) : "") + n;
|
|
976
|
-
}
|
|
977
|
-
function getObserver() {
|
|
978
|
-
if (q || F) return R;
|
|
979
|
-
return T ? V : null;
|
|
980
|
-
}
|
|
981
|
-
function getOwner() {
|
|
982
|
-
return V;
|
|
983
|
-
}
|
|
984
|
-
function cleanup(e) {
|
|
985
|
-
if (!V) return e;
|
|
986
|
-
if (!V.Ne) V.Ne = e;
|
|
987
|
-
else if (Array.isArray(V.Ne)) V.Ne.push(e);
|
|
988
|
-
else V.Ne = [V.Ne, e];
|
|
989
|
-
return e;
|
|
990
|
-
}
|
|
991
|
-
function isDisposed(e) {
|
|
992
|
-
return !!(e.m & (u | o));
|
|
993
|
-
}
|
|
994
|
-
function createOwner(e) {
|
|
995
|
-
const t = V;
|
|
996
|
-
const n = e?.transparent ?? false;
|
|
997
|
-
const r = {
|
|
998
|
-
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
999
|
-
Le: n || undefined,
|
|
1000
|
-
t: true,
|
|
1001
|
-
u: t?.t ? t.u : t,
|
|
1002
|
-
Ee: null,
|
|
1003
|
-
ke: null,
|
|
1004
|
-
Ne: null,
|
|
1005
|
-
V: t?.V ?? A,
|
|
1006
|
-
Ie: t?.Ie || _,
|
|
1007
|
-
je: 0,
|
|
1008
|
-
Ae: null,
|
|
1009
|
-
We: null,
|
|
1010
|
-
i: t,
|
|
1011
|
-
dispose(e = true) {
|
|
1012
|
-
disposeChildren(r, e);
|
|
1013
|
-
}
|
|
1014
|
-
};
|
|
1015
|
-
if (t) {
|
|
1016
|
-
const e = t.Ee;
|
|
1017
|
-
if (e === null) {
|
|
1018
|
-
t.Ee = r;
|
|
1019
|
-
} else {
|
|
1020
|
-
r.ke = e;
|
|
1021
|
-
t.Ee = r;
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
return r;
|
|
1025
|
-
}
|
|
1026
|
-
function createRoot(e, t) {
|
|
1027
|
-
const n = createOwner(t);
|
|
1028
|
-
return runWithOwner(n, () => e(n.dispose));
|
|
1029
|
-
}
|
|
1030
|
-
function unlinkSubs(e) {
|
|
1031
|
-
const t = e.L;
|
|
1032
|
-
const n = e.N;
|
|
1033
|
-
const r = e.P;
|
|
1034
|
-
const i = e.Re;
|
|
1035
|
-
if (r !== null) r.Re = i;
|
|
1036
|
-
else t.Te = i;
|
|
1037
|
-
if (i !== null) i.P = r;
|
|
1038
|
-
else {
|
|
1039
|
-
t.O = r;
|
|
1040
|
-
if (r === null) {
|
|
1041
|
-
t.He?.();
|
|
1042
|
-
t.R && !t.Qe && !(t.m & o) && unobserved(t);
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
return n;
|
|
1046
|
-
}
|
|
1047
|
-
function unobserved(e) {
|
|
1048
|
-
deleteFromHeap(e, e.m & o ? v : P);
|
|
1049
|
-
let t = e.A;
|
|
1050
|
-
while (t !== null) {
|
|
1051
|
-
t = unlinkSubs(t);
|
|
1052
|
-
}
|
|
1053
|
-
e.A = null;
|
|
1054
|
-
disposeChildren(e, true);
|
|
1055
|
-
}
|
|
1056
|
-
function link(e, t) {
|
|
1057
|
-
const n = t.Ce;
|
|
1058
|
-
if (n !== null && n.L === e) return;
|
|
1059
|
-
let i = null;
|
|
1060
|
-
const s = t.m & r;
|
|
1061
|
-
if (s) {
|
|
1062
|
-
i = n !== null ? n.N : t.A;
|
|
1063
|
-
if (i !== null && i.L === e) {
|
|
1064
|
-
t.Ce = i;
|
|
1065
|
-
return;
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
const o = e.Te;
|
|
1069
|
-
if (o !== null && o.k === t && (!s || isValidLink(o, t))) return;
|
|
1070
|
-
const u = (t.Ce = e.Te = { L: e, k: t, N: i, Re: o, P: null });
|
|
1071
|
-
if (n !== null) n.N = u;
|
|
1072
|
-
else t.A = u;
|
|
1073
|
-
if (o !== null) o.P = u;
|
|
1074
|
-
else e.O = u;
|
|
1075
|
-
}
|
|
1076
|
-
function isValidLink(e, t) {
|
|
1077
|
-
const n = t.Ce;
|
|
1078
|
-
if (n !== null) {
|
|
1079
|
-
let r = t.A;
|
|
1080
|
-
do {
|
|
1081
|
-
if (r === e) return true;
|
|
1082
|
-
if (r === n) break;
|
|
1083
|
-
r = r.N;
|
|
1084
|
-
} while (r !== null);
|
|
1085
|
-
}
|
|
1086
|
-
return false;
|
|
1087
|
-
}
|
|
1088
1107
|
GlobalQueue.oe = recompute;
|
|
1089
1108
|
GlobalQueue.ue = disposeChildren;
|
|
1090
1109
|
let T = false;
|
|
@@ -1117,10 +1136,10 @@ function releaseSnapshotScope(e) {
|
|
|
1117
1136
|
schedule();
|
|
1118
1137
|
}
|
|
1119
1138
|
function releaseSubtree(e) {
|
|
1120
|
-
let t = e.
|
|
1139
|
+
let t = e.Pe;
|
|
1121
1140
|
while (t) {
|
|
1122
1141
|
if (t.qe) {
|
|
1123
|
-
t = t.
|
|
1142
|
+
t = t.ve;
|
|
1124
1143
|
continue;
|
|
1125
1144
|
}
|
|
1126
1145
|
if (t.R) {
|
|
@@ -1134,7 +1153,7 @@ function releaseSubtree(e) {
|
|
|
1134
1153
|
}
|
|
1135
1154
|
}
|
|
1136
1155
|
releaseSubtree(t);
|
|
1137
|
-
t = t.
|
|
1156
|
+
t = t.ve;
|
|
1138
1157
|
}
|
|
1139
1158
|
}
|
|
1140
1159
|
function clearSnapshots() {
|
|
@@ -1152,14 +1171,15 @@ function recompute(t, n = false) {
|
|
|
1152
1171
|
if (!n) {
|
|
1153
1172
|
if (t.K && (!i || k) && k !== t.K) A.initTransition(t.K);
|
|
1154
1173
|
deleteFromHeap(t, t.m & o ? v : P);
|
|
1174
|
+
t.Ee = null;
|
|
1155
1175
|
if (t.K || i === y) disposeChildren(t);
|
|
1156
1176
|
else {
|
|
1157
1177
|
markDisposal(t);
|
|
1158
|
-
t.
|
|
1159
|
-
t.
|
|
1160
|
-
t.
|
|
1161
|
-
t.
|
|
1162
|
-
t.
|
|
1178
|
+
t.Ce = t.je;
|
|
1179
|
+
t.ke = t.Pe;
|
|
1180
|
+
t.je = null;
|
|
1181
|
+
t.Pe = null;
|
|
1182
|
+
t.We = 0;
|
|
1163
1183
|
}
|
|
1164
1184
|
}
|
|
1165
1185
|
const s = !!(t.m & f);
|
|
@@ -1167,7 +1187,7 @@ function recompute(t, n = false) {
|
|
|
1167
1187
|
const l = !!(t.ge & a);
|
|
1168
1188
|
const p = V;
|
|
1169
1189
|
V = t;
|
|
1170
|
-
t.
|
|
1190
|
+
t.xe = null;
|
|
1171
1191
|
t.m = r;
|
|
1172
1192
|
t.de = E;
|
|
1173
1193
|
let h = t.Z === S ? t.$ : t.Z;
|
|
@@ -1196,7 +1216,7 @@ function recompute(t, n = false) {
|
|
|
1196
1216
|
updatePendingSignal(e.te);
|
|
1197
1217
|
}
|
|
1198
1218
|
}
|
|
1199
|
-
if (e instanceof NotReadyError) t.
|
|
1219
|
+
if (e instanceof NotReadyError) t.Re = true;
|
|
1200
1220
|
notifyStatus(
|
|
1201
1221
|
t,
|
|
1202
1222
|
e instanceof NotReadyError ? a : d,
|
|
@@ -1210,7 +1230,7 @@ function recompute(t, n = false) {
|
|
|
1210
1230
|
V = p;
|
|
1211
1231
|
}
|
|
1212
1232
|
if (!t.ae) {
|
|
1213
|
-
const e = t.
|
|
1233
|
+
const e = t.xe;
|
|
1214
1234
|
let r = e !== null ? e.N : t.A;
|
|
1215
1235
|
if (r !== null) {
|
|
1216
1236
|
do {
|
|
@@ -1220,7 +1240,7 @@ function recompute(t, n = false) {
|
|
|
1220
1240
|
else t.A = null;
|
|
1221
1241
|
}
|
|
1222
1242
|
const f = u ? t.ee : t.Z === S ? t.$ : t.Z;
|
|
1223
|
-
const c = !t.
|
|
1243
|
+
const c = !t.Te || !t.Te(f, h);
|
|
1224
1244
|
if (c) {
|
|
1225
1245
|
const e = u ? t.ee : undefined;
|
|
1226
1246
|
if (n || (i && k !== t.K) || s) {
|
|
@@ -1235,7 +1255,7 @@ function recompute(t, n = false) {
|
|
|
1235
1255
|
} else if (u) {
|
|
1236
1256
|
t.Z = h;
|
|
1237
1257
|
} else if (t.o != g) {
|
|
1238
|
-
for (let e = t.
|
|
1258
|
+
for (let e = t._; e !== null; e = e.P) {
|
|
1239
1259
|
insertIntoHeapHeight(e.k, e.k.m & o ? v : P);
|
|
1240
1260
|
}
|
|
1241
1261
|
}
|
|
@@ -1257,7 +1277,7 @@ function updateIfNecessary(r) {
|
|
|
1257
1277
|
}
|
|
1258
1278
|
}
|
|
1259
1279
|
}
|
|
1260
|
-
if (r.m & (n | f) || (r.ae && r.de < E && !r.
|
|
1280
|
+
if (r.m & (n | f) || (r.ae && r.de < E && !r.Ee)) {
|
|
1261
1281
|
recompute(r);
|
|
1262
1282
|
}
|
|
1263
1283
|
r.m = e | (r.m & c);
|
|
@@ -1266,52 +1286,52 @@ function computed(t, n, r) {
|
|
|
1266
1286
|
const i = r?.transparent ?? false;
|
|
1267
1287
|
const s = {
|
|
1268
1288
|
id: r?.id ?? (i ? V?.id : V?.id != null ? getNextChildId(V) : undefined),
|
|
1269
|
-
|
|
1270
|
-
|
|
1289
|
+
Ae: i || undefined,
|
|
1290
|
+
Te: r?.equals != null ? r.equals : isEqual,
|
|
1271
1291
|
le: !!r?.pureWrite,
|
|
1272
|
-
|
|
1273
|
-
|
|
1292
|
+
Oe: r?.unobserved,
|
|
1293
|
+
je: null,
|
|
1274
1294
|
V: V?.V ?? A,
|
|
1275
|
-
|
|
1276
|
-
|
|
1295
|
+
Ne: V?.Ne ?? O,
|
|
1296
|
+
We: 0,
|
|
1277
1297
|
R: t,
|
|
1278
1298
|
$: n,
|
|
1279
1299
|
o: 0,
|
|
1280
|
-
|
|
1300
|
+
W: null,
|
|
1281
1301
|
h: undefined,
|
|
1282
1302
|
p: null,
|
|
1283
1303
|
A: null,
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1304
|
+
xe: null,
|
|
1305
|
+
_: null,
|
|
1306
|
+
be: null,
|
|
1287
1307
|
i: V,
|
|
1288
|
-
|
|
1289
|
-
|
|
1308
|
+
ve: null,
|
|
1309
|
+
Pe: null,
|
|
1290
1310
|
m: r?.lazy ? l : e,
|
|
1291
1311
|
ge: p,
|
|
1292
1312
|
de: E,
|
|
1293
1313
|
Z: S,
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1314
|
+
Ce: null,
|
|
1315
|
+
ke: null,
|
|
1316
|
+
Ee: null,
|
|
1297
1317
|
K: null
|
|
1298
1318
|
};
|
|
1299
1319
|
s.p = s;
|
|
1300
1320
|
const o = V?.t ? V.u : V;
|
|
1301
1321
|
if (V) {
|
|
1302
|
-
const e = V.
|
|
1322
|
+
const e = V.Pe;
|
|
1303
1323
|
if (e === null) {
|
|
1304
|
-
V.
|
|
1324
|
+
V.Pe = s;
|
|
1305
1325
|
} else {
|
|
1306
|
-
s.
|
|
1307
|
-
V.
|
|
1326
|
+
s.ve = e;
|
|
1327
|
+
V.Pe = s;
|
|
1308
1328
|
}
|
|
1309
1329
|
}
|
|
1310
1330
|
if (o) s.o = o.o + 1;
|
|
1311
1331
|
if (B && ownerInSnapshotScope(V)) s.he = true;
|
|
1312
|
-
if (
|
|
1332
|
+
if (R) {
|
|
1313
1333
|
const e = signal(undefined, { equals: false, pureWrite: true });
|
|
1314
|
-
const t =
|
|
1334
|
+
const t = R.factory(s.R, () => {
|
|
1315
1335
|
setSignal(e, undefined);
|
|
1316
1336
|
});
|
|
1317
1337
|
cleanup(() => t.dispose());
|
|
@@ -1331,19 +1351,19 @@ function computed(t, n, r) {
|
|
|
1331
1351
|
}
|
|
1332
1352
|
function signal(e, t, n = null) {
|
|
1333
1353
|
const r = {
|
|
1334
|
-
|
|
1354
|
+
Te: t?.equals != null ? t.equals : isEqual,
|
|
1335
1355
|
le: !!t?.pureWrite,
|
|
1336
1356
|
De: !!t?.De,
|
|
1337
|
-
|
|
1357
|
+
Oe: t?.unobserved,
|
|
1338
1358
|
$: e,
|
|
1339
|
-
|
|
1340
|
-
|
|
1359
|
+
_: null,
|
|
1360
|
+
be: null,
|
|
1341
1361
|
de: E,
|
|
1342
1362
|
I: n,
|
|
1343
|
-
|
|
1363
|
+
C: n?.W || null,
|
|
1344
1364
|
Z: S
|
|
1345
1365
|
};
|
|
1346
|
-
n && (n.
|
|
1366
|
+
n && (n.W = r);
|
|
1347
1367
|
if (B && !r.De && !((n?.ge ?? 0) & a)) {
|
|
1348
1368
|
r.pe = e === undefined ? w : e;
|
|
1349
1369
|
G.add(r);
|
|
@@ -1364,11 +1384,11 @@ function isEqual(e, t) {
|
|
|
1364
1384
|
return e === t;
|
|
1365
1385
|
}
|
|
1366
1386
|
function untrack(e, t) {
|
|
1367
|
-
if (!
|
|
1387
|
+
if (!R && !T && true) return e();
|
|
1368
1388
|
const n = T;
|
|
1369
1389
|
T = false;
|
|
1370
1390
|
try {
|
|
1371
|
-
if (
|
|
1391
|
+
if (R) return R.untrack(e);
|
|
1372
1392
|
return e();
|
|
1373
1393
|
} finally {
|
|
1374
1394
|
T = n;
|
|
@@ -1404,9 +1424,14 @@ function read(e) {
|
|
|
1404
1424
|
const n = q;
|
|
1405
1425
|
q = false;
|
|
1406
1426
|
if (t && e.ee !== undefined) {
|
|
1407
|
-
if (e.ee !== S && (t.
|
|
1427
|
+
if (e.ee !== S && (t.Ee || !!(t.ge & a))) {
|
|
1408
1428
|
D = true;
|
|
1409
1429
|
}
|
|
1430
|
+
let n = V;
|
|
1431
|
+
if (n?.t) n = n.u;
|
|
1432
|
+
if (n && T) link(e, n);
|
|
1433
|
+
read(getPendingSignal(e));
|
|
1434
|
+
read(getPendingSignal(t));
|
|
1410
1435
|
} else {
|
|
1411
1436
|
if (read(getPendingSignal(e))) D = true;
|
|
1412
1437
|
if (t && read(getPendingSignal(t))) D = true;
|
|
@@ -1486,11 +1511,11 @@ function read(e) {
|
|
|
1486
1511
|
}
|
|
1487
1512
|
function setSignal(e, t) {
|
|
1488
1513
|
if (e.K && k !== e.K) A.initTransition(e.K);
|
|
1489
|
-
const n = e.ee !== undefined && !
|
|
1514
|
+
const n = e.ee !== undefined && !C;
|
|
1490
1515
|
const r = e.ee !== undefined && e.ee !== S;
|
|
1491
1516
|
const i = n ? (r ? e.ee : e.$) : e.Z === S ? e.$ : e.Z;
|
|
1492
1517
|
if (typeof t === "function") t = t(i);
|
|
1493
|
-
const s = !e.
|
|
1518
|
+
const s = !e.Te || !e.Te(i, t) || !!(e.ge & p);
|
|
1494
1519
|
if (!s) {
|
|
1495
1520
|
if (n && r && e.R) {
|
|
1496
1521
|
insertSubs(e, true);
|
|
@@ -1514,8 +1539,8 @@ function setSignal(e, t) {
|
|
|
1514
1539
|
e.Z = t;
|
|
1515
1540
|
}
|
|
1516
1541
|
updatePendingSignal(e);
|
|
1517
|
-
if (e.
|
|
1518
|
-
setSignal(e.
|
|
1542
|
+
if (e.He) {
|
|
1543
|
+
setSignal(e.He, t);
|
|
1519
1544
|
}
|
|
1520
1545
|
e.de = E;
|
|
1521
1546
|
insertSubs(e, n);
|
|
@@ -1548,7 +1573,7 @@ function computePendingState(e) {
|
|
|
1548
1573
|
const t = e;
|
|
1549
1574
|
const n = e.I;
|
|
1550
1575
|
if (n && e.Z !== S) {
|
|
1551
|
-
return !n.
|
|
1576
|
+
return !n.Ee && !(n.ge & a);
|
|
1552
1577
|
}
|
|
1553
1578
|
if (e.ee !== undefined && e.ee !== S) {
|
|
1554
1579
|
if (t.ge & a && !(t.ge & p)) return true;
|
|
@@ -1583,20 +1608,20 @@ function updatePendingSignal(e) {
|
|
|
1583
1608
|
}
|
|
1584
1609
|
}
|
|
1585
1610
|
function getLatestValueComputed(e) {
|
|
1586
|
-
if (!e.
|
|
1611
|
+
if (!e.He) {
|
|
1587
1612
|
const t = F;
|
|
1588
1613
|
F = false;
|
|
1589
1614
|
const n = q;
|
|
1590
1615
|
q = false;
|
|
1591
1616
|
const r = V;
|
|
1592
1617
|
V = null;
|
|
1593
|
-
e.
|
|
1594
|
-
e.
|
|
1618
|
+
e.He = optimisticComputed(() => read(e));
|
|
1619
|
+
e.He.ye = e;
|
|
1595
1620
|
V = r;
|
|
1596
1621
|
q = n;
|
|
1597
1622
|
F = t;
|
|
1598
1623
|
}
|
|
1599
|
-
return e.
|
|
1624
|
+
return e.He;
|
|
1600
1625
|
}
|
|
1601
1626
|
function staleValues(e, t = true) {
|
|
1602
1627
|
const n = H;
|
|
@@ -1636,7 +1661,7 @@ function refresh(e) {
|
|
|
1636
1661
|
Q = true;
|
|
1637
1662
|
try {
|
|
1638
1663
|
if (typeof e !== "function") {
|
|
1639
|
-
recompute(e[
|
|
1664
|
+
recompute(e[_]);
|
|
1640
1665
|
return e;
|
|
1641
1666
|
}
|
|
1642
1667
|
return untrack(e);
|
|
@@ -1657,7 +1682,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1657
1682
|
if (!t) {
|
|
1658
1683
|
throw new NoOwnerError();
|
|
1659
1684
|
}
|
|
1660
|
-
const n = hasContext(e, t) ? t.
|
|
1685
|
+
const n = hasContext(e, t) ? t.Ne[e.id] : e.defaultValue;
|
|
1661
1686
|
if (isUndefined(n)) {
|
|
1662
1687
|
throw new ContextNotFoundError();
|
|
1663
1688
|
}
|
|
@@ -1667,10 +1692,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1667
1692
|
if (!n) {
|
|
1668
1693
|
throw new NoOwnerError();
|
|
1669
1694
|
}
|
|
1670
|
-
n.
|
|
1695
|
+
n.Ne = { ...n.Ne, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1671
1696
|
}
|
|
1672
1697
|
function hasContext(e, t) {
|
|
1673
|
-
return !isUndefined(t?.
|
|
1698
|
+
return !isUndefined(t?.Ne[e.id]);
|
|
1674
1699
|
}
|
|
1675
1700
|
function isUndefined(e) {
|
|
1676
1701
|
return typeof e === "undefined";
|
|
@@ -1691,7 +1716,7 @@ function effect(e, t, n, r, i) {
|
|
|
1691
1716
|
o.Be = n;
|
|
1692
1717
|
o.Ge = undefined;
|
|
1693
1718
|
o.D = i?.render ? h : g;
|
|
1694
|
-
o.
|
|
1719
|
+
o.Qe = (e, t) => {
|
|
1695
1720
|
const n = e !== undefined ? e : o.ge;
|
|
1696
1721
|
const r = t !== undefined ? t : o.ae;
|
|
1697
1722
|
if (n & d) {
|
|
@@ -1724,7 +1749,9 @@ function runEffect() {
|
|
|
1724
1749
|
this.Ge?.();
|
|
1725
1750
|
this.Ge = undefined;
|
|
1726
1751
|
try {
|
|
1727
|
-
|
|
1752
|
+
const e = this.Me(this.$, this.Ve);
|
|
1753
|
+
if (false && e !== undefined && typeof e !== "function");
|
|
1754
|
+
this.Ge = e;
|
|
1728
1755
|
} catch (e) {
|
|
1729
1756
|
this.ae = new StatusError(this, e);
|
|
1730
1757
|
this.ge |= d;
|
|
@@ -1747,7 +1774,8 @@ function trackedEffect(e, t) {
|
|
|
1747
1774
|
() => {
|
|
1748
1775
|
n.Ge?.();
|
|
1749
1776
|
n.Ge = undefined;
|
|
1750
|
-
|
|
1777
|
+
const t = staleValues(e);
|
|
1778
|
+
n.Ge = t;
|
|
1751
1779
|
},
|
|
1752
1780
|
undefined,
|
|
1753
1781
|
{ ...t, lazy: true }
|
|
@@ -1756,7 +1784,7 @@ function trackedEffect(e, t) {
|
|
|
1756
1784
|
n.Ke = true;
|
|
1757
1785
|
n.F = true;
|
|
1758
1786
|
n.D = y;
|
|
1759
|
-
n.
|
|
1787
|
+
n.Qe = (e, t) => {
|
|
1760
1788
|
const r = e !== undefined ? e : n.ge;
|
|
1761
1789
|
if (r & d) {
|
|
1762
1790
|
n.V.notify(n, a, 0);
|
|
@@ -1851,7 +1879,9 @@ function createReaction(e, t) {
|
|
|
1851
1879
|
() => (i(), getOwner()),
|
|
1852
1880
|
t => {
|
|
1853
1881
|
n?.();
|
|
1854
|
-
|
|
1882
|
+
const r = (e.effect || e)?.();
|
|
1883
|
+
if (false && r !== undefined && typeof r !== "function");
|
|
1884
|
+
n = r;
|
|
1855
1885
|
dispose(t);
|
|
1856
1886
|
},
|
|
1857
1887
|
e.error,
|
|
@@ -1883,7 +1913,7 @@ function createOptimistic(e, t, n) {
|
|
|
1883
1913
|
function onSettled(e) {
|
|
1884
1914
|
const t = getOwner();
|
|
1885
1915
|
t && !t.Ke
|
|
1886
|
-
? createTrackedEffect(() => untrack(e))
|
|
1916
|
+
? createTrackedEffect(() => untrack(e), undefined)
|
|
1887
1917
|
: A.enqueue(g, () => {
|
|
1888
1918
|
const t = e();
|
|
1889
1919
|
t?.();
|
|
@@ -2050,7 +2080,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2050
2080
|
let i;
|
|
2051
2081
|
const o = new Proxy(
|
|
2052
2082
|
s,
|
|
2053
|
-
createWriteTraps(() => !r || t.
|
|
2083
|
+
createWriteTraps(() => !r || t.Ee === i)
|
|
2054
2084
|
);
|
|
2055
2085
|
storeSetter(o, o => {
|
|
2056
2086
|
i = e(o);
|
|
@@ -2061,7 +2091,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2061
2091
|
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2062
2092
|
});
|
|
2063
2093
|
});
|
|
2064
|
-
r.
|
|
2094
|
+
r._e = true;
|
|
2065
2095
|
return { store: s, node: r };
|
|
2066
2096
|
}
|
|
2067
2097
|
function createProjection(e, t = {}, n) {
|
|
@@ -2081,6 +2111,18 @@ function createWriteTraps(e) {
|
|
|
2081
2111
|
}
|
|
2082
2112
|
return typeof r === "object" && r !== null ? new Proxy(r, t) : r;
|
|
2083
2113
|
},
|
|
2114
|
+
has(e, t) {
|
|
2115
|
+
let n;
|
|
2116
|
+
setWriteOverride(true);
|
|
2117
|
+
setProjectionWriteActive(true);
|
|
2118
|
+
try {
|
|
2119
|
+
n = t in e;
|
|
2120
|
+
} finally {
|
|
2121
|
+
setWriteOverride(false);
|
|
2122
|
+
setProjectionWriteActive(false);
|
|
2123
|
+
}
|
|
2124
|
+
return n;
|
|
2125
|
+
},
|
|
2084
2126
|
set(t, n, r) {
|
|
2085
2127
|
if (e && !e()) return true;
|
|
2086
2128
|
setWriteOverride(true);
|
|
@@ -2138,7 +2180,12 @@ function wrap(e, t) {
|
|
|
2138
2180
|
return n;
|
|
2139
2181
|
}
|
|
2140
2182
|
function isWrappable(e) {
|
|
2141
|
-
return
|
|
2183
|
+
return (
|
|
2184
|
+
e != null &&
|
|
2185
|
+
typeof e === "object" &&
|
|
2186
|
+
!Object.isFrozen(e) &&
|
|
2187
|
+
!(typeof Node !== "undefined" && e instanceof Node)
|
|
2188
|
+
);
|
|
2142
2189
|
}
|
|
2143
2190
|
let oe = false;
|
|
2144
2191
|
function setWriteOverride(e) {
|
|
@@ -2201,7 +2248,7 @@ const fe = {
|
|
|
2201
2248
|
get(e, t, n) {
|
|
2202
2249
|
if (t === z) return e;
|
|
2203
2250
|
if (t === U) return n;
|
|
2204
|
-
if (t ===
|
|
2251
|
+
if (t === _) return e[re];
|
|
2205
2252
|
if (t === K) {
|
|
2206
2253
|
trackSelf(e);
|
|
2207
2254
|
return n;
|
|
@@ -2242,7 +2289,9 @@ const fe = {
|
|
|
2242
2289
|
has(e, t) {
|
|
2243
2290
|
if (t === U || t === K || t === "__proto__") return true;
|
|
2244
2291
|
const n = e[Z] && t in e[Z] ? e[Z][t] !== J : e[Y] && t in e[Y] ? e[Y][t] !== J : t in e[X];
|
|
2245
|
-
|
|
2292
|
+
if (!writeOnly(e[U])) {
|
|
2293
|
+
getObserver() && read(getNode(getNodes(e, ee), t, n, e[re], isEqual, e[ie]));
|
|
2294
|
+
}
|
|
2246
2295
|
return n;
|
|
2247
2296
|
},
|
|
2248
2297
|
set(e, t, n) {
|
|
@@ -2266,28 +2315,37 @@ const fe = {
|
|
|
2266
2315
|
e[m][t] = s;
|
|
2267
2316
|
}
|
|
2268
2317
|
}
|
|
2269
|
-
const o = e[ie] && !
|
|
2318
|
+
const o = e[ie] && !C;
|
|
2270
2319
|
const u = o ? Z : Y;
|
|
2271
2320
|
if (o) trackOptimisticStore(r);
|
|
2272
2321
|
const f = e[Z] && t in e[Z] ? e[Z][t] : e[Y] && t in e[Y] ? e[Y][t] : s;
|
|
2273
2322
|
const c = n?.[z]?.[X] ?? n;
|
|
2274
|
-
|
|
2275
|
-
const
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2323
|
+
const l = Array.isArray(i) && t !== "length";
|
|
2324
|
+
const d = l ? parseInt(t) + 1 : 0;
|
|
2325
|
+
const p =
|
|
2326
|
+
l &&
|
|
2327
|
+
(e[Z] && "length" in e[Z]
|
|
2328
|
+
? e[Z].length
|
|
2329
|
+
: e[Y] && "length" in e[Y]
|
|
2330
|
+
? e[Y].length
|
|
2331
|
+
: i.length);
|
|
2332
|
+
const h = l && d > p ? d : undefined;
|
|
2333
|
+
if (f === c && h === undefined) return true;
|
|
2334
|
+
if (c !== undefined && c === s && h === undefined) delete e[u]?.[t];
|
|
2335
|
+
else {
|
|
2336
|
+
const n = e[u] || (e[u] = Object.create(null));
|
|
2337
|
+
n[t] = c;
|
|
2338
|
+
if (h !== undefined) n.length = h;
|
|
2339
|
+
}
|
|
2340
|
+
const g = isWrappable(c);
|
|
2279
2341
|
e[ee]?.[t] && setSignal(e[ee][t], true);
|
|
2280
|
-
const
|
|
2281
|
-
|
|
2342
|
+
const y = getNodes(e, $);
|
|
2343
|
+
y[t] && setSignal(y[t], () => (g ? wrap(c, e) : c));
|
|
2282
2344
|
if (Array.isArray(i)) {
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
} else {
|
|
2286
|
-
const e = parseInt(t) + 1;
|
|
2287
|
-
if (e > l) p.length && setSignal(p.length, e);
|
|
2288
|
-
}
|
|
2345
|
+
const e = t === "length" ? c : h;
|
|
2346
|
+
e !== undefined && y.length && setSignal(y.length, e);
|
|
2289
2347
|
}
|
|
2290
|
-
|
|
2348
|
+
y[K] && setSignal(y[K], undefined);
|
|
2291
2349
|
});
|
|
2292
2350
|
}
|
|
2293
2351
|
return true;
|
|
@@ -2297,7 +2355,7 @@ const fe = {
|
|
|
2297
2355
|
const r = e[Y]?.[t] === J;
|
|
2298
2356
|
if (writeOnly(e[U]) && !n && !r) {
|
|
2299
2357
|
untrack(() => {
|
|
2300
|
-
const n = e[ie] && !
|
|
2358
|
+
const n = e[ie] && !C;
|
|
2301
2359
|
const r = n ? Z : Y;
|
|
2302
2360
|
if (n) trackOptimisticStore(e[U]);
|
|
2303
2361
|
const i = e[Z] && t in e[Z] ? e[Z][t] : e[Y] && t in e[Y] ? e[Y][t] : e[X][t];
|
|
@@ -2434,7 +2492,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2434
2492
|
let i;
|
|
2435
2493
|
const o = new Proxy(
|
|
2436
2494
|
s,
|
|
2437
|
-
createWriteTraps(() => !r || t.
|
|
2495
|
+
createWriteTraps(() => !r || t.Ee === i)
|
|
2438
2496
|
);
|
|
2439
2497
|
setProjectionWriteActive(true);
|
|
2440
2498
|
try {
|
|
@@ -2455,7 +2513,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2455
2513
|
setProjectionWriteActive(false);
|
|
2456
2514
|
}
|
|
2457
2515
|
});
|
|
2458
|
-
r.
|
|
2516
|
+
r._e = true;
|
|
2459
2517
|
}
|
|
2460
2518
|
return { store: s, node: r };
|
|
2461
2519
|
}
|
|
@@ -2909,14 +2967,14 @@ function compare(e, t, n) {
|
|
|
2909
2967
|
}
|
|
2910
2968
|
function boundaryComputed(e, t) {
|
|
2911
2969
|
const n = computed(e, undefined, { lazy: true });
|
|
2912
|
-
n.
|
|
2970
|
+
n.Qe = (e, t) => {
|
|
2913
2971
|
const r = e !== undefined ? e : n.ge;
|
|
2914
2972
|
const i = t !== undefined ? t : n.ae;
|
|
2915
2973
|
n.ge &= ~n.ut;
|
|
2916
2974
|
n.V.notify(n, n.ut, r, i);
|
|
2917
2975
|
};
|
|
2918
2976
|
n.ut = t;
|
|
2919
|
-
n.
|
|
2977
|
+
n._e = true;
|
|
2920
2978
|
recompute(n, true);
|
|
2921
2979
|
return n;
|
|
2922
2980
|
}
|
|
@@ -2978,7 +3036,7 @@ class CollectionQueue extends Queue {
|
|
|
2978
3036
|
}
|
|
2979
3037
|
checkSources() {
|
|
2980
3038
|
for (const e of this.ct) {
|
|
2981
|
-
if (!(e.ge & this.ft) && !(this.ft & d && e.ge & a)) this.ct.delete(e);
|
|
3039
|
+
if (e.m & u || (!(e.ge & this.ft) && !(this.ft & d && e.ge & a))) this.ct.delete(e);
|
|
2982
3040
|
}
|
|
2983
3041
|
if (!this.ct.size) {
|
|
2984
3042
|
setSignal(this.lt, false);
|
|
@@ -3070,7 +3128,7 @@ function flattenArray(e, t = [], n) {
|
|
|
3070
3128
|
return i;
|
|
3071
3129
|
}
|
|
3072
3130
|
exports.$PROXY = U;
|
|
3073
|
-
exports.$REFRESH =
|
|
3131
|
+
exports.$REFRESH = _;
|
|
3074
3132
|
exports.$TARGET = z;
|
|
3075
3133
|
exports.$TRACK = K;
|
|
3076
3134
|
exports.ContextNotFoundError = ContextNotFoundError;
|