@solidjs/signals 0.10.8 → 0.11.1
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 +98 -27
- package/dist/node.cjs +630 -562
- package/dist/prod.js +257 -189
- package/dist/types/core/constants.d.ts +1 -0
- package/dist/types/core/core.d.ts +2 -2
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/types.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/store/index.d.ts +2 -0
- package/dist/types/store/storePath.d.ts +30 -0
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -32,6 +32,7 @@ const REACTIVE_ZOMBIE = 1 << 5;
|
|
|
32
32
|
const REACTIVE_DISPOSED = 1 << 6;
|
|
33
33
|
const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
|
|
34
34
|
const REACTIVE_SNAPSHOT_STALE = 1 << 8;
|
|
35
|
+
const REACTIVE_LAZY = 1 << 9;
|
|
35
36
|
const STATUS_PENDING = 1 << 0;
|
|
36
37
|
const STATUS_ERROR = 1 << 1;
|
|
37
38
|
const STATUS_UNINITIALIZED = 1 << 2;
|
|
@@ -52,11 +53,11 @@ function actualInsertIntoHeap(e, t) {
|
|
|
52
53
|
if (r === undefined) t.l[i] = e;
|
|
53
54
|
else {
|
|
54
55
|
const t = r.T;
|
|
55
|
-
t.
|
|
56
|
+
t.R = e;
|
|
56
57
|
e.T = t;
|
|
57
58
|
r.T = e;
|
|
58
59
|
}
|
|
59
|
-
if (i > t.
|
|
60
|
+
if (i > t.S) t.S = i;
|
|
60
61
|
}
|
|
61
62
|
function insertIntoHeap(e, t) {
|
|
62
63
|
let n = e.O;
|
|
@@ -79,21 +80,21 @@ function deleteFromHeap(e, t) {
|
|
|
79
80
|
const i = e.o;
|
|
80
81
|
if (e.T === e) t.l[i] = undefined;
|
|
81
82
|
else {
|
|
82
|
-
const n = e.
|
|
83
|
+
const n = e.R;
|
|
83
84
|
const r = t.l[i];
|
|
84
85
|
const s = n ?? r;
|
|
85
86
|
if (e === r) t.l[i] = n;
|
|
86
|
-
else e.T.
|
|
87
|
+
else e.T.R = n;
|
|
87
88
|
s.T = e.T;
|
|
88
89
|
}
|
|
89
90
|
e.T = e;
|
|
90
|
-
e.
|
|
91
|
+
e.R = undefined;
|
|
91
92
|
}
|
|
92
93
|
function markHeap(e) {
|
|
93
94
|
if (e._) return;
|
|
94
95
|
e._ = true;
|
|
95
|
-
for (let t = 0; t <= e.
|
|
96
|
-
for (let n = e.l[t]; n !== undefined; n = n.
|
|
96
|
+
for (let t = 0; t <= e.S; t++) {
|
|
97
|
+
for (let n = e.l[t]; n !== undefined; n = n.R) {
|
|
97
98
|
if (n.O & REACTIVE_IN_HEAP) markNode(n);
|
|
98
99
|
}
|
|
99
100
|
}
|
|
@@ -115,20 +116,20 @@ function markNode(e, t = REACTIVE_DIRTY) {
|
|
|
115
116
|
}
|
|
116
117
|
function runHeap(e, t) {
|
|
117
118
|
e._ = false;
|
|
118
|
-
for (e.
|
|
119
|
-
let n = e.l[e.
|
|
119
|
+
for (e.C = 0; e.C <= e.S; e.C++) {
|
|
120
|
+
let n = e.l[e.C];
|
|
120
121
|
while (n !== undefined) {
|
|
121
122
|
if (n.O & REACTIVE_IN_HEAP) t(n);
|
|
122
123
|
else adjustHeight(n, e);
|
|
123
|
-
n = e.l[e.
|
|
124
|
+
n = e.l[e.C];
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
|
-
e.
|
|
127
|
+
e.S = 0;
|
|
127
128
|
}
|
|
128
129
|
function adjustHeight(e, t) {
|
|
129
130
|
deleteFromHeap(e, t);
|
|
130
131
|
let n = e.o;
|
|
131
|
-
for (let t = e.
|
|
132
|
+
for (let t = e.N; t; t = t.D) {
|
|
132
133
|
const e = t.V;
|
|
133
134
|
const i = e.m || e;
|
|
134
135
|
if (i.L && i.o >= n) n = i.o + 1;
|
|
@@ -141,8 +142,8 @@ function adjustHeight(e, t) {
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
const transitions = new Set();
|
|
144
|
-
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false,
|
|
145
|
-
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false,
|
|
145
|
+
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, C: 0, S: 0 };
|
|
146
|
+
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, C: 0, S: 0 };
|
|
146
147
|
let clock = 0;
|
|
147
148
|
let activeTransition = null;
|
|
148
149
|
let scheduled = false;
|
|
@@ -235,7 +236,7 @@ class GlobalQueue extends Queue {
|
|
|
235
236
|
j = new Set();
|
|
236
237
|
static K;
|
|
237
238
|
static Y;
|
|
238
|
-
static
|
|
239
|
+
static Z = null;
|
|
239
240
|
flush() {
|
|
240
241
|
if (this.H) return;
|
|
241
242
|
this.H = true;
|
|
@@ -251,16 +252,16 @@ class GlobalQueue extends Queue {
|
|
|
251
252
|
this.j = new Set();
|
|
252
253
|
runLaneEffects(EFFECT_RENDER);
|
|
253
254
|
runLaneEffects(EFFECT_USER);
|
|
254
|
-
this.stashQueues(activeTransition.
|
|
255
|
+
this.stashQueues(activeTransition.B);
|
|
255
256
|
clock++;
|
|
256
|
-
scheduled = dirtyQueue.
|
|
257
|
+
scheduled = dirtyQueue.S >= dirtyQueue.C;
|
|
257
258
|
reassignPendingTransition(activeTransition.F);
|
|
258
259
|
activeTransition = null;
|
|
259
260
|
finalizePureQueue(null, true);
|
|
260
261
|
return;
|
|
261
262
|
}
|
|
262
263
|
this.F !== activeTransition.F && this.F.push(...activeTransition.F);
|
|
263
|
-
this.restoreQueues(activeTransition.
|
|
264
|
+
this.restoreQueues(activeTransition.B);
|
|
264
265
|
transitions.delete(activeTransition);
|
|
265
266
|
const t = activeTransition;
|
|
266
267
|
activeTransition = null;
|
|
@@ -271,7 +272,7 @@ class GlobalQueue extends Queue {
|
|
|
271
272
|
finalizePureQueue();
|
|
272
273
|
}
|
|
273
274
|
clock++;
|
|
274
|
-
scheduled = dirtyQueue.
|
|
275
|
+
scheduled = dirtyQueue.S >= dirtyQueue.C;
|
|
275
276
|
runLaneEffects(EFFECT_RENDER);
|
|
276
277
|
this.run(EFFECT_RENDER);
|
|
277
278
|
runLaneEffects(EFFECT_USER);
|
|
@@ -283,9 +284,9 @@ class GlobalQueue extends Queue {
|
|
|
283
284
|
notify(e, t, n, i) {
|
|
284
285
|
if (t & STATUS_PENDING) {
|
|
285
286
|
if (n & STATUS_PENDING) {
|
|
286
|
-
const t = i !== undefined ? i : e.
|
|
287
|
-
if (activeTransition && t && !activeTransition.
|
|
288
|
-
activeTransition.
|
|
287
|
+
const t = i !== undefined ? i : e.X;
|
|
288
|
+
if (activeTransition && t && !activeTransition.q.includes(t.source)) {
|
|
289
|
+
activeTransition.q.push(t.source);
|
|
289
290
|
schedule();
|
|
290
291
|
}
|
|
291
292
|
}
|
|
@@ -301,11 +302,11 @@ class GlobalQueue extends Queue {
|
|
|
301
302
|
activeTransition = e ?? {
|
|
302
303
|
J: clock,
|
|
303
304
|
F: [],
|
|
304
|
-
|
|
305
|
+
q: [],
|
|
305
306
|
$: [],
|
|
306
307
|
j: new Set(),
|
|
307
308
|
ee: [],
|
|
308
|
-
|
|
309
|
+
B: { M: [[], []], G: [] },
|
|
309
310
|
te: false
|
|
310
311
|
};
|
|
311
312
|
} else if (e) {
|
|
@@ -367,14 +368,14 @@ function insertSubs(e, t = false) {
|
|
|
367
368
|
continue;
|
|
368
369
|
}
|
|
369
370
|
const s = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
370
|
-
if (s.
|
|
371
|
+
if (s.C > r.h.o) s.C = r.h.o;
|
|
371
372
|
insertIntoHeap(r.h, s);
|
|
372
373
|
}
|
|
373
374
|
}
|
|
374
375
|
function finalizePureQueue(e = null, t = false) {
|
|
375
376
|
let n = !t;
|
|
376
377
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
377
|
-
if (dirtyQueue.
|
|
378
|
+
if (dirtyQueue.S >= dirtyQueue.C) runHeap(dirtyQueue, GlobalQueue.K);
|
|
378
379
|
if (n) {
|
|
379
380
|
const t = globalQueue.F;
|
|
380
381
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -402,9 +403,9 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
402
403
|
}
|
|
403
404
|
n.length = 0;
|
|
404
405
|
const i = e ? e.j : globalQueue.j;
|
|
405
|
-
if (GlobalQueue.
|
|
406
|
+
if (GlobalQueue.Z && i.size) {
|
|
406
407
|
for (const e of i) {
|
|
407
|
-
GlobalQueue.
|
|
408
|
+
GlobalQueue.Z(e);
|
|
408
409
|
}
|
|
409
410
|
i.clear();
|
|
410
411
|
schedule();
|
|
@@ -453,9 +454,9 @@ function transitionComplete(e) {
|
|
|
453
454
|
if (e.te) return true;
|
|
454
455
|
if (e.ee.length) return false;
|
|
455
456
|
let t = true;
|
|
456
|
-
for (let n = 0; n < e.
|
|
457
|
-
const i = e.
|
|
458
|
-
if (i.Ee & STATUS_PENDING && i.
|
|
457
|
+
for (let n = 0; n < e.q.length; n++) {
|
|
458
|
+
const i = e.q[n];
|
|
459
|
+
if (i.Ee & STATUS_PENDING && i.X?.source === i) {
|
|
459
460
|
t = false;
|
|
460
461
|
break;
|
|
461
462
|
}
|
|
@@ -488,10 +489,10 @@ function getOrCreateLane(e) {
|
|
|
488
489
|
}
|
|
489
490
|
const n = e.de;
|
|
490
491
|
const i = n?.ie ? findLane(n.ie) : null;
|
|
491
|
-
t = { Te: e, U: new Set(), W: [[], []], k: null, ne: activeTransition,
|
|
492
|
+
t = { Te: e, U: new Set(), W: [[], []], k: null, ne: activeTransition, Re: i };
|
|
492
493
|
signalLanes.set(e, t);
|
|
493
494
|
activeLanes.add(t);
|
|
494
|
-
e.
|
|
495
|
+
e.Se = e.Oe || 0;
|
|
495
496
|
return t;
|
|
496
497
|
}
|
|
497
498
|
function findLane(e) {
|
|
@@ -530,9 +531,9 @@ function assignOrMergeLane(e, t) {
|
|
|
530
531
|
const r = findLane(i);
|
|
531
532
|
if (activeLanes.has(r)) {
|
|
532
533
|
if (r !== n && !hasActiveOverride(e)) {
|
|
533
|
-
if (n.
|
|
534
|
+
if (n.Re && findLane(n.Re) === r) {
|
|
534
535
|
e.ie = t;
|
|
535
|
-
} else if (r.
|
|
536
|
+
} else if (r.Re && findLane(r.Re) === n);
|
|
536
537
|
else mergeLanes(n, r);
|
|
537
538
|
}
|
|
538
539
|
return;
|
|
@@ -646,7 +647,7 @@ function handleAsync(e, t, n) {
|
|
|
646
647
|
}
|
|
647
648
|
function clearStatus(e) {
|
|
648
649
|
e.Ee = e.Ee & STATUS_UNINITIALIZED;
|
|
649
|
-
e.
|
|
650
|
+
e.X = null;
|
|
650
651
|
updatePendingSignal(e);
|
|
651
652
|
e.Ae?.();
|
|
652
653
|
}
|
|
@@ -658,7 +659,7 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
658
659
|
const u = o && hasActiveOverride(e);
|
|
659
660
|
if (!i) {
|
|
660
661
|
e.Ee = t | (t !== STATUS_ERROR ? e.Ee & STATUS_UNINITIALIZED : 0);
|
|
661
|
-
e.
|
|
662
|
+
e.X = n;
|
|
662
663
|
updatePendingSignal(e);
|
|
663
664
|
}
|
|
664
665
|
if (r && !i) {
|
|
@@ -666,8 +667,8 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
666
667
|
}
|
|
667
668
|
if (u && activeTransition && n instanceof NotReadyError) {
|
|
668
669
|
const e = n.source;
|
|
669
|
-
if (!activeTransition.
|
|
670
|
-
activeTransition.
|
|
670
|
+
if (!activeTransition.q.includes(e)) {
|
|
671
|
+
activeTransition.q.push(e);
|
|
671
672
|
}
|
|
672
673
|
}
|
|
673
674
|
const c = i || u;
|
|
@@ -682,7 +683,7 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
682
683
|
}
|
|
683
684
|
for (let i = e.I; i !== null; i = i.p) {
|
|
684
685
|
i.h.J = clock;
|
|
685
|
-
if (i.h.
|
|
686
|
+
if (i.h.X !== n) {
|
|
686
687
|
!i.h.ne && globalQueue.F.push(i.h);
|
|
687
688
|
notifyStatus(i.h, t, n, c, l);
|
|
688
689
|
}
|
|
@@ -690,7 +691,7 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
690
691
|
for (let i = e.A; i !== null; i = i.P) {
|
|
691
692
|
for (let e = i.I; e !== null; e = e.p) {
|
|
692
693
|
e.h.J = clock;
|
|
693
|
-
if (e.h.
|
|
694
|
+
if (e.h.X !== n) {
|
|
694
695
|
!e.h.ne && globalQueue.F.push(e.h);
|
|
695
696
|
notifyStatus(e.h, t, n, c, l);
|
|
696
697
|
}
|
|
@@ -701,26 +702,26 @@ function unlinkSubs(e) {
|
|
|
701
702
|
const t = e.V;
|
|
702
703
|
const n = e.D;
|
|
703
704
|
const i = e.p;
|
|
704
|
-
const r = e.
|
|
705
|
-
if (i !== null) i.
|
|
706
|
-
else t.
|
|
705
|
+
const r = e.Pe;
|
|
706
|
+
if (i !== null) i.Pe = r;
|
|
707
|
+
else t.ge = r;
|
|
707
708
|
if (r !== null) r.p = i;
|
|
708
709
|
else {
|
|
709
710
|
t.I = i;
|
|
710
711
|
if (i === null) {
|
|
711
|
-
t.
|
|
712
|
-
t.L && !t.
|
|
712
|
+
t.Ce?.();
|
|
713
|
+
t.L && !t.Ne && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
713
714
|
}
|
|
714
715
|
}
|
|
715
716
|
return n;
|
|
716
717
|
}
|
|
717
718
|
function unobserved(e) {
|
|
718
719
|
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
719
|
-
let t = e.
|
|
720
|
+
let t = e.N;
|
|
720
721
|
while (t !== null) {
|
|
721
722
|
t = unlinkSubs(t);
|
|
722
723
|
}
|
|
723
|
-
e.
|
|
724
|
+
e.N = null;
|
|
724
725
|
disposeChildren(e, true);
|
|
725
726
|
}
|
|
726
727
|
function link(e, t) {
|
|
@@ -729,24 +730,24 @@ function link(e, t) {
|
|
|
729
730
|
let i = null;
|
|
730
731
|
const r = t.O & REACTIVE_RECOMPUTING_DEPS;
|
|
731
732
|
if (r) {
|
|
732
|
-
i = n !== null ? n.D : t.
|
|
733
|
+
i = n !== null ? n.D : t.N;
|
|
733
734
|
if (i !== null && i.V === e) {
|
|
734
735
|
t.ye = i;
|
|
735
736
|
return;
|
|
736
737
|
}
|
|
737
738
|
}
|
|
738
|
-
const s = e.
|
|
739
|
+
const s = e.ge;
|
|
739
740
|
if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
|
|
740
|
-
const o = (t.ye = e.
|
|
741
|
+
const o = (t.ye = e.ge = { V: e, h: t, D: i, Pe: s, p: null });
|
|
741
742
|
if (n !== null) n.D = o;
|
|
742
|
-
else t.
|
|
743
|
+
else t.N = o;
|
|
743
744
|
if (s !== null) s.p = o;
|
|
744
745
|
else e.I = o;
|
|
745
746
|
}
|
|
746
747
|
function isValidLink(e, t) {
|
|
747
748
|
const n = t.ye;
|
|
748
749
|
if (n !== null) {
|
|
749
|
-
let i = t.
|
|
750
|
+
let i = t.N;
|
|
750
751
|
do {
|
|
751
752
|
if (i === e) return true;
|
|
752
753
|
if (i === n) break;
|
|
@@ -769,44 +770,44 @@ function markDisposal(e) {
|
|
|
769
770
|
}
|
|
770
771
|
}
|
|
771
772
|
function dispose(e) {
|
|
772
|
-
let t = e.
|
|
773
|
+
let t = e.N || null;
|
|
773
774
|
do {
|
|
774
775
|
t = unlinkSubs(t);
|
|
775
776
|
} while (t !== null);
|
|
776
|
-
e.
|
|
777
|
+
e.N = null;
|
|
777
778
|
e.ye = null;
|
|
778
779
|
disposeChildren(e, true);
|
|
779
780
|
}
|
|
780
781
|
function disposeChildren(e, t = false, n) {
|
|
781
782
|
if (e.O & REACTIVE_DISPOSED) return;
|
|
782
783
|
if (t) e.O = REACTIVE_DISPOSED;
|
|
783
|
-
let i = n ? e.
|
|
784
|
+
let i = n ? e.be : e.De;
|
|
784
785
|
while (i) {
|
|
785
786
|
const e = i.ve;
|
|
786
|
-
if (i.
|
|
787
|
+
if (i.N) {
|
|
787
788
|
const e = i;
|
|
788
789
|
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
789
|
-
let t = e.
|
|
790
|
+
let t = e.N;
|
|
790
791
|
do {
|
|
791
792
|
t = unlinkSubs(t);
|
|
792
793
|
} while (t !== null);
|
|
793
|
-
e.
|
|
794
|
+
e.N = null;
|
|
794
795
|
e.ye = null;
|
|
795
796
|
}
|
|
796
797
|
disposeChildren(i, true);
|
|
797
798
|
i = e;
|
|
798
799
|
}
|
|
799
800
|
if (n) {
|
|
800
|
-
e.
|
|
801
|
+
e.be = null;
|
|
801
802
|
} else {
|
|
802
803
|
e.De = null;
|
|
803
804
|
e.ve = null;
|
|
804
|
-
e.
|
|
805
|
+
e.we = 0;
|
|
805
806
|
}
|
|
806
807
|
runDisposal(e, n);
|
|
807
808
|
}
|
|
808
809
|
function runDisposal(e, t) {
|
|
809
|
-
let n = t ? e.
|
|
810
|
+
let n = t ? e.Ve : e.me;
|
|
810
811
|
if (!n) return;
|
|
811
812
|
if (Array.isArray(n)) {
|
|
812
813
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -816,12 +817,12 @@ function runDisposal(e, t) {
|
|
|
816
817
|
} else {
|
|
817
818
|
n.call(n);
|
|
818
819
|
}
|
|
819
|
-
t ? (e.
|
|
820
|
+
t ? (e.Ve = null) : (e.me = null);
|
|
820
821
|
}
|
|
821
822
|
function childId(e, t) {
|
|
822
823
|
let n = e;
|
|
823
824
|
while (n.Le && n.i) n = n.i;
|
|
824
|
-
if (n.id != null) return formatId(n.id, t ? n.
|
|
825
|
+
if (n.id != null) return formatId(n.id, t ? n.we++ : n.we);
|
|
825
826
|
throw new Error("Cannot get child id from owner without an id");
|
|
826
827
|
}
|
|
827
828
|
function getNextChildId(e) {
|
|
@@ -836,7 +837,7 @@ function formatId(e, t) {
|
|
|
836
837
|
return e + (i ? String.fromCharCode(64 + i) : "") + n;
|
|
837
838
|
}
|
|
838
839
|
function getObserver() {
|
|
839
|
-
if (pendingCheckActive ||
|
|
840
|
+
if (pendingCheckActive || latestReadActive) return PENDING_OWNER;
|
|
840
841
|
return tracking ? context : null;
|
|
841
842
|
}
|
|
842
843
|
function getOwner() {
|
|
@@ -865,9 +866,9 @@ function createOwner(e) {
|
|
|
865
866
|
me: null,
|
|
866
867
|
ce: t?.ce ?? globalQueue,
|
|
867
868
|
ke: t?.ke || defaultContext,
|
|
868
|
-
|
|
869
|
+
we: 0,
|
|
870
|
+
Ve: null,
|
|
869
871
|
be: null,
|
|
870
|
-
we: null,
|
|
871
872
|
i: t,
|
|
872
873
|
dispose(e = true) {
|
|
873
874
|
disposeChildren(i, e);
|
|
@@ -893,7 +894,7 @@ function effect(e, t, n, i, r) {
|
|
|
893
894
|
const o = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
894
895
|
...r,
|
|
895
896
|
equals: () => {
|
|
896
|
-
o.ue = !o.
|
|
897
|
+
o.ue = !o.X;
|
|
897
898
|
if (s) o.ce.enqueue(o.oe, runEffect.bind(o));
|
|
898
899
|
return false;
|
|
899
900
|
},
|
|
@@ -906,7 +907,7 @@ function effect(e, t, n, i, r) {
|
|
|
906
907
|
o.oe = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
907
908
|
o.Ae = (e, t) => {
|
|
908
909
|
const n = e !== undefined ? e : o.Ee;
|
|
909
|
-
const i = t !== undefined ? t : o.
|
|
910
|
+
const i = t !== undefined ? t : o.X;
|
|
910
911
|
if (n & STATUS_ERROR) {
|
|
911
912
|
let e = i;
|
|
912
913
|
o.ce.notify(o, STATUS_PENDING, 0);
|
|
@@ -959,7 +960,7 @@ function trackedEffect(e, t) {
|
|
|
959
960
|
}
|
|
960
961
|
},
|
|
961
962
|
undefined,
|
|
962
|
-
{ ...t, lazy: true
|
|
963
|
+
{ ...t, lazy: true }
|
|
963
964
|
);
|
|
964
965
|
n.xe = undefined;
|
|
965
966
|
n.ue = true;
|
|
@@ -975,7 +976,7 @@ let stale = false;
|
|
|
975
976
|
let refreshing = false;
|
|
976
977
|
let pendingCheckActive = false;
|
|
977
978
|
let foundPending = false;
|
|
978
|
-
let
|
|
979
|
+
let latestReadActive = false;
|
|
979
980
|
let context = null;
|
|
980
981
|
let currentOptimisticLane = null;
|
|
981
982
|
let snapshotCaptureActive = false;
|
|
@@ -1012,7 +1013,7 @@ function releaseSubtree(e) {
|
|
|
1012
1013
|
if (e.O & REACTIVE_SNAPSHOT_STALE) {
|
|
1013
1014
|
e.O &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1014
1015
|
e.O |= REACTIVE_DIRTY;
|
|
1015
|
-
if (dirtyQueue.
|
|
1016
|
+
if (dirtyQueue.C > e.o) dirtyQueue.C = e.o;
|
|
1016
1017
|
insertIntoHeap(e, dirtyQueue);
|
|
1017
1018
|
}
|
|
1018
1019
|
}
|
|
@@ -1039,11 +1040,11 @@ function recompute(e, t = false) {
|
|
|
1039
1040
|
if (e.ne || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1040
1041
|
else {
|
|
1041
1042
|
markDisposal(e);
|
|
1042
|
-
e.
|
|
1043
|
-
e.
|
|
1043
|
+
e.Ve = e.me;
|
|
1044
|
+
e.be = e.De;
|
|
1044
1045
|
e.me = null;
|
|
1045
1046
|
e.De = null;
|
|
1046
|
-
e.
|
|
1047
|
+
e.we = 0;
|
|
1047
1048
|
}
|
|
1048
1049
|
}
|
|
1049
1050
|
const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
|
|
@@ -1092,15 +1093,15 @@ function recompute(e, t = false) {
|
|
|
1092
1093
|
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1093
1094
|
context = o;
|
|
1094
1095
|
}
|
|
1095
|
-
if (!e.
|
|
1096
|
+
if (!e.X) {
|
|
1096
1097
|
const o = e.ye;
|
|
1097
|
-
let l = o !== null ? o.D : e.
|
|
1098
|
+
let l = o !== null ? o.D : e.N;
|
|
1098
1099
|
if (l !== null) {
|
|
1099
1100
|
do {
|
|
1100
1101
|
l = unlinkSubs(l);
|
|
1101
1102
|
} while (l !== null);
|
|
1102
1103
|
if (o !== null) o.D = null;
|
|
1103
|
-
else e.
|
|
1104
|
+
else e.N = null;
|
|
1104
1105
|
}
|
|
1105
1106
|
const a = r ? e.fe : e.ae === NOT_PENDING ? e.fe : e.ae;
|
|
1106
1107
|
const f = !e.pe || !e.pe(a, u);
|
|
@@ -1110,7 +1111,7 @@ function recompute(e, t = false) {
|
|
|
1110
1111
|
else e.ae = u;
|
|
1111
1112
|
if (r && !i && s) {
|
|
1112
1113
|
const t = e.Oe || 0;
|
|
1113
|
-
const n = e.
|
|
1114
|
+
const n = e.Se || 0;
|
|
1114
1115
|
if (t <= n) e.fe = u;
|
|
1115
1116
|
}
|
|
1116
1117
|
if (!r || i || e.fe !== o) {
|
|
@@ -1130,7 +1131,7 @@ function recompute(e, t = false) {
|
|
|
1130
1131
|
}
|
|
1131
1132
|
function updateIfNecessary(e) {
|
|
1132
1133
|
if (e.O & REACTIVE_CHECK) {
|
|
1133
|
-
for (let t = e.
|
|
1134
|
+
for (let t = e.N; t; t = t.D) {
|
|
1134
1135
|
const n = t.V;
|
|
1135
1136
|
const i = n.m || n;
|
|
1136
1137
|
if (i.L) {
|
|
@@ -1141,7 +1142,7 @@ function updateIfNecessary(e) {
|
|
|
1141
1142
|
}
|
|
1142
1143
|
}
|
|
1143
1144
|
}
|
|
1144
|
-
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.
|
|
1145
|
+
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.X && e.J < clock)) {
|
|
1145
1146
|
recompute(e);
|
|
1146
1147
|
}
|
|
1147
1148
|
e.O = REACTIVE_NONE | (e.O & REACTIVE_SNAPSHOT_STALE);
|
|
@@ -1153,30 +1154,30 @@ function computed(e, t, n) {
|
|
|
1153
1154
|
Le: i || undefined,
|
|
1154
1155
|
pe: n?.equals != null ? n.equals : isEqual,
|
|
1155
1156
|
Me: !!n?.pureWrite,
|
|
1156
|
-
|
|
1157
|
+
Ce: n?.unobserved,
|
|
1157
1158
|
me: null,
|
|
1158
1159
|
ce: context?.ce ?? globalQueue,
|
|
1159
1160
|
ke: context?.ke ?? defaultContext,
|
|
1160
|
-
|
|
1161
|
+
we: 0,
|
|
1161
1162
|
L: e,
|
|
1162
1163
|
fe: t,
|
|
1163
1164
|
o: 0,
|
|
1164
1165
|
A: null,
|
|
1165
|
-
|
|
1166
|
+
R: undefined,
|
|
1166
1167
|
T: null,
|
|
1167
|
-
|
|
1168
|
+
N: null,
|
|
1168
1169
|
ye: null,
|
|
1169
1170
|
I: null,
|
|
1170
|
-
|
|
1171
|
+
ge: null,
|
|
1171
1172
|
i: context,
|
|
1172
1173
|
ve: null,
|
|
1173
1174
|
De: null,
|
|
1174
|
-
O: REACTIVE_NONE,
|
|
1175
|
+
O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1175
1176
|
Ee: STATUS_UNINITIALIZED,
|
|
1176
1177
|
J: clock,
|
|
1177
1178
|
ae: NOT_PENDING,
|
|
1179
|
+
Ve: null,
|
|
1178
1180
|
be: null,
|
|
1179
|
-
we: null,
|
|
1180
1181
|
Ie: null,
|
|
1181
1182
|
ne: null
|
|
1182
1183
|
};
|
|
@@ -1206,10 +1207,10 @@ function signal(e, t, n = null) {
|
|
|
1206
1207
|
const i = {
|
|
1207
1208
|
pe: t?.equals != null ? t.equals : isEqual,
|
|
1208
1209
|
Me: !!t?.pureWrite,
|
|
1209
|
-
|
|
1210
|
+
Ce: t?.unobserved,
|
|
1210
1211
|
fe: e,
|
|
1211
1212
|
I: null,
|
|
1212
|
-
|
|
1213
|
+
ge: null,
|
|
1213
1214
|
J: clock,
|
|
1214
1215
|
m: n,
|
|
1215
1216
|
P: n?.A || null,
|
|
@@ -1251,10 +1252,10 @@ function untrack(e) {
|
|
|
1251
1252
|
}
|
|
1252
1253
|
}
|
|
1253
1254
|
function read(e) {
|
|
1254
|
-
if (
|
|
1255
|
-
const t =
|
|
1256
|
-
const n =
|
|
1257
|
-
|
|
1255
|
+
if (latestReadActive) {
|
|
1256
|
+
const t = getLatestValueComputed(e);
|
|
1257
|
+
const n = latestReadActive;
|
|
1258
|
+
latestReadActive = false;
|
|
1258
1259
|
let i;
|
|
1259
1260
|
try {
|
|
1260
1261
|
i = read(t);
|
|
@@ -1262,7 +1263,7 @@ function read(e) {
|
|
|
1262
1263
|
if (!context && t instanceof NotReadyError) return e.fe;
|
|
1263
1264
|
throw t;
|
|
1264
1265
|
} finally {
|
|
1265
|
-
|
|
1266
|
+
latestReadActive = n;
|
|
1266
1267
|
}
|
|
1267
1268
|
if (t.Ee & STATUS_PENDING) return e.fe;
|
|
1268
1269
|
if (stale && currentOptimisticLane && t.ie) {
|
|
@@ -1288,13 +1289,17 @@ function read(e) {
|
|
|
1288
1289
|
let t = context;
|
|
1289
1290
|
if (t?.t) t = t.u;
|
|
1290
1291
|
if (refreshing && e.L) recompute(e);
|
|
1292
|
+
if (e.O & REACTIVE_LAZY) {
|
|
1293
|
+
e.O &= ~REACTIVE_LAZY;
|
|
1294
|
+
recompute(e, true);
|
|
1295
|
+
}
|
|
1291
1296
|
if (t && tracking) {
|
|
1292
1297
|
if (e.L && e.O & REACTIVE_DISPOSED) recompute(e);
|
|
1293
1298
|
link(e, t);
|
|
1294
1299
|
const n = e.m || e;
|
|
1295
1300
|
if (n.L) {
|
|
1296
1301
|
const i = e.O & REACTIVE_ZOMBIE;
|
|
1297
|
-
if (n.o >= (i ? zombieQueue.
|
|
1302
|
+
if (n.o >= (i ? zombieQueue.C : dirtyQueue.C)) {
|
|
1298
1303
|
markNode(t);
|
|
1299
1304
|
markHeap(i ? zombieQueue : dirtyQueue);
|
|
1300
1305
|
updateIfNecessary(n);
|
|
@@ -1313,21 +1318,21 @@ function read(e) {
|
|
|
1313
1318
|
const r = findLane(currentOptimisticLane);
|
|
1314
1319
|
if (i && findLane(i) === r && !hasActiveOverride(n)) {
|
|
1315
1320
|
if (!tracking) link(e, t);
|
|
1316
|
-
throw n.
|
|
1321
|
+
throw n.X;
|
|
1317
1322
|
}
|
|
1318
1323
|
} else {
|
|
1319
1324
|
if (!tracking) link(e, t);
|
|
1320
|
-
throw n.
|
|
1325
|
+
throw n.X;
|
|
1321
1326
|
}
|
|
1322
1327
|
} else if (!t && n.Ee & STATUS_UNINITIALIZED) {
|
|
1323
|
-
throw n.
|
|
1328
|
+
throw n.X;
|
|
1324
1329
|
}
|
|
1325
1330
|
}
|
|
1326
1331
|
if (e.L && e.Ee & STATUS_ERROR) {
|
|
1327
1332
|
if (e.J < clock) {
|
|
1328
1333
|
recompute(e, true);
|
|
1329
1334
|
return read(e);
|
|
1330
|
-
} else throw e.
|
|
1335
|
+
} else throw e.X;
|
|
1331
1336
|
}
|
|
1332
1337
|
if (snapshotCaptureActive && t && t.se) {
|
|
1333
1338
|
const n = e.re;
|
|
@@ -1439,10 +1444,10 @@ function updatePendingSignal(e) {
|
|
|
1439
1444
|
}
|
|
1440
1445
|
}
|
|
1441
1446
|
}
|
|
1442
|
-
function
|
|
1447
|
+
function getLatestValueComputed(e) {
|
|
1443
1448
|
if (!e.he) {
|
|
1444
|
-
const t =
|
|
1445
|
-
|
|
1449
|
+
const t = latestReadActive;
|
|
1450
|
+
latestReadActive = false;
|
|
1446
1451
|
const n = pendingCheckActive;
|
|
1447
1452
|
pendingCheckActive = false;
|
|
1448
1453
|
const i = context;
|
|
@@ -1451,7 +1456,7 @@ function getPendingValueComputed(e) {
|
|
|
1451
1456
|
e.he.de = e;
|
|
1452
1457
|
context = i;
|
|
1453
1458
|
pendingCheckActive = n;
|
|
1454
|
-
|
|
1459
|
+
latestReadActive = t;
|
|
1455
1460
|
}
|
|
1456
1461
|
return e.he;
|
|
1457
1462
|
}
|
|
@@ -1464,13 +1469,13 @@ function staleValues(e, t = true) {
|
|
|
1464
1469
|
stale = n;
|
|
1465
1470
|
}
|
|
1466
1471
|
}
|
|
1467
|
-
function
|
|
1468
|
-
const t =
|
|
1469
|
-
|
|
1472
|
+
function latest(e) {
|
|
1473
|
+
const t = latestReadActive;
|
|
1474
|
+
latestReadActive = true;
|
|
1470
1475
|
try {
|
|
1471
1476
|
return e();
|
|
1472
1477
|
} finally {
|
|
1473
|
-
|
|
1478
|
+
latestReadActive = t;
|
|
1474
1479
|
}
|
|
1475
1480
|
}
|
|
1476
1481
|
function isPending(e) {
|
|
@@ -1671,14 +1676,14 @@ function applyState(e, t, n, i) {
|
|
|
1671
1676
|
let t = false;
|
|
1672
1677
|
const l = getOverrideValue(s, o, c, "length", u);
|
|
1673
1678
|
if (e.length && l && e[0] && n(e[0]) != null) {
|
|
1674
|
-
let a, f, E, T, d,
|
|
1679
|
+
let a, f, E, T, d, R, S, O;
|
|
1675
1680
|
for (
|
|
1676
1681
|
E = 0, T = Math.min(l, e.length);
|
|
1677
1682
|
E < T &&
|
|
1678
|
-
((
|
|
1683
|
+
((R = getOverrideValue(s, o, c, E, u)) === e[E] || (R && e[E] && n(R) === n(e[E])));
|
|
1679
1684
|
E++
|
|
1680
1685
|
) {
|
|
1681
|
-
applyState(e[E], wrap(
|
|
1686
|
+
applyState(e[E], wrap(R, r), n, i);
|
|
1682
1687
|
}
|
|
1683
1688
|
const _ = new Array(e.length),
|
|
1684
1689
|
I = new Map();
|
|
@@ -1686,10 +1691,10 @@ function applyState(e, t, n, i) {
|
|
|
1686
1691
|
T = l - 1, d = e.length - 1;
|
|
1687
1692
|
T >= E &&
|
|
1688
1693
|
d >= E &&
|
|
1689
|
-
((
|
|
1694
|
+
((R = getOverrideValue(s, o, c, T, u)) === e[d] || (R && e[d] && n(R) === n(e[d])));
|
|
1690
1695
|
T--, d--
|
|
1691
1696
|
) {
|
|
1692
|
-
_[d] =
|
|
1697
|
+
_[d] = R;
|
|
1693
1698
|
}
|
|
1694
1699
|
if (E > d || E > T) {
|
|
1695
1700
|
for (f = E; f <= d; f++) {
|
|
@@ -1706,21 +1711,21 @@ function applyState(e, t, n, i) {
|
|
|
1706
1711
|
l !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
|
|
1707
1712
|
return;
|
|
1708
1713
|
}
|
|
1709
|
-
|
|
1714
|
+
S = new Array(d + 1);
|
|
1710
1715
|
for (f = d; f >= E; f--) {
|
|
1711
|
-
|
|
1712
|
-
O =
|
|
1716
|
+
R = e[f];
|
|
1717
|
+
O = R ? n(R) : R;
|
|
1713
1718
|
a = I.get(O);
|
|
1714
|
-
|
|
1719
|
+
S[f] = a === undefined ? -1 : a;
|
|
1715
1720
|
I.set(O, f);
|
|
1716
1721
|
}
|
|
1717
1722
|
for (a = E; a <= T; a++) {
|
|
1718
|
-
|
|
1719
|
-
O =
|
|
1723
|
+
R = getOverrideValue(s, o, c, a, u);
|
|
1724
|
+
O = R ? n(R) : R;
|
|
1720
1725
|
f = I.get(O);
|
|
1721
1726
|
if (f !== undefined && f !== -1) {
|
|
1722
|
-
_[f] =
|
|
1723
|
-
f =
|
|
1727
|
+
_[f] = R;
|
|
1728
|
+
f = S[f];
|
|
1724
1729
|
I.set(O, f);
|
|
1725
1730
|
}
|
|
1726
1731
|
}
|
|
@@ -1811,7 +1816,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1811
1816
|
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(s);
|
|
1812
1817
|
});
|
|
1813
1818
|
});
|
|
1814
|
-
i.
|
|
1819
|
+
i.Ne = true;
|
|
1815
1820
|
return { store: s, node: i };
|
|
1816
1821
|
}
|
|
1817
1822
|
function createProjection(e, t = {}, n) {
|
|
@@ -2218,7 +2223,7 @@ function deep(e) {
|
|
|
2218
2223
|
return e[$DEEP];
|
|
2219
2224
|
}
|
|
2220
2225
|
function createOptimisticStore(e, t, n) {
|
|
2221
|
-
GlobalQueue.
|
|
2226
|
+
GlobalQueue.Z ||= clearOptimisticStore;
|
|
2222
2227
|
const i = typeof e === "function";
|
|
2223
2228
|
const r = (i ? t : e) ?? {};
|
|
2224
2229
|
const s = i ? e : undefined;
|
|
@@ -2294,10 +2299,72 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2294
2299
|
setProjectionWriteActive(false);
|
|
2295
2300
|
}
|
|
2296
2301
|
});
|
|
2297
|
-
i.
|
|
2302
|
+
i.Ne = true;
|
|
2298
2303
|
}
|
|
2299
2304
|
return { store: s, node: i };
|
|
2300
2305
|
}
|
|
2306
|
+
const DELETE = Symbol(0);
|
|
2307
|
+
function updatePath(e, t, n = 0) {
|
|
2308
|
+
let i,
|
|
2309
|
+
r = e;
|
|
2310
|
+
if (n < t.length - 1) {
|
|
2311
|
+
i = t[n];
|
|
2312
|
+
const s = typeof i;
|
|
2313
|
+
const o = Array.isArray(e);
|
|
2314
|
+
if (Array.isArray(i)) {
|
|
2315
|
+
for (let r = 0; r < i.length; r++) {
|
|
2316
|
+
t[n] = i[r];
|
|
2317
|
+
updatePath(e, t, n);
|
|
2318
|
+
}
|
|
2319
|
+
t[n] = i;
|
|
2320
|
+
return;
|
|
2321
|
+
} else if (o && s === "function") {
|
|
2322
|
+
for (let r = 0; r < e.length; r++) {
|
|
2323
|
+
if (i(e[r], r)) {
|
|
2324
|
+
t[n] = r;
|
|
2325
|
+
updatePath(e, t, n);
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
t[n] = i;
|
|
2329
|
+
return;
|
|
2330
|
+
} else if (o && s === "object") {
|
|
2331
|
+
const { from: r = 0, to: s = e.length - 1, by: o = 1 } = i;
|
|
2332
|
+
for (let i = r; i <= s; i += o) {
|
|
2333
|
+
t[n] = i;
|
|
2334
|
+
updatePath(e, t, n);
|
|
2335
|
+
}
|
|
2336
|
+
t[n] = i;
|
|
2337
|
+
return;
|
|
2338
|
+
} else if (n < t.length - 2) {
|
|
2339
|
+
updatePath(e[i], t, n + 1);
|
|
2340
|
+
return;
|
|
2341
|
+
}
|
|
2342
|
+
r = e[i];
|
|
2343
|
+
}
|
|
2344
|
+
let s = t[t.length - 1];
|
|
2345
|
+
if (typeof s === "function") {
|
|
2346
|
+
s = s(r);
|
|
2347
|
+
if (s === r) return;
|
|
2348
|
+
}
|
|
2349
|
+
if (i === undefined && s == undefined) return;
|
|
2350
|
+
if (s === DELETE) {
|
|
2351
|
+
delete e[i];
|
|
2352
|
+
} else if (i === undefined || (isWrappable(r) && isWrappable(s) && !Array.isArray(s))) {
|
|
2353
|
+
const t = i !== undefined ? e[i] : e;
|
|
2354
|
+
const n = Object.keys(s);
|
|
2355
|
+
for (let e = 0; e < n.length; e++) t[n[e]] = s[n[e]];
|
|
2356
|
+
} else {
|
|
2357
|
+
e[i] = s;
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
const storePath = Object.assign(
|
|
2361
|
+
function storePath(...e) {
|
|
2362
|
+
return t => {
|
|
2363
|
+
updatePath(t, e);
|
|
2364
|
+
};
|
|
2365
|
+
},
|
|
2366
|
+
{ DELETE: DELETE }
|
|
2367
|
+
);
|
|
2301
2368
|
function snapshot(e, t, n) {
|
|
2302
2369
|
let i, r, s, o, u, c;
|
|
2303
2370
|
if (!isWrappable(e)) return e;
|
|
@@ -2485,11 +2552,11 @@ function mapArray(e, t, n) {
|
|
|
2485
2552
|
je: e,
|
|
2486
2553
|
Ke: [],
|
|
2487
2554
|
Ye: s,
|
|
2555
|
+
Ze: [],
|
|
2488
2556
|
Be: [],
|
|
2489
|
-
Xe:
|
|
2490
|
-
qe: i,
|
|
2491
|
-
ze:
|
|
2492
|
-
Ze: r ? [] : undefined,
|
|
2557
|
+
Xe: i,
|
|
2558
|
+
qe: i || n?.keyed === false ? [] : undefined,
|
|
2559
|
+
ze: r ? [] : undefined,
|
|
2493
2560
|
Je: n?.fallback
|
|
2494
2561
|
})
|
|
2495
2562
|
);
|
|
@@ -2502,20 +2569,20 @@ function updateKeyedMap() {
|
|
|
2502
2569
|
runWithOwner(this.Fe, () => {
|
|
2503
2570
|
let n,
|
|
2504
2571
|
i,
|
|
2505
|
-
r = this.
|
|
2572
|
+
r = this.qe
|
|
2506
2573
|
? () => {
|
|
2507
|
-
this.
|
|
2508
|
-
this.
|
|
2574
|
+
this.qe[i] = signal(e[i], pureOptions);
|
|
2575
|
+
this.ze && (this.ze[i] = signal(i, pureOptions));
|
|
2509
2576
|
return this.Ye(
|
|
2510
|
-
read.bind(null, this.
|
|
2511
|
-
this.
|
|
2577
|
+
read.bind(null, this.qe[i]),
|
|
2578
|
+
this.ze ? read.bind(null, this.ze[i]) : undefined
|
|
2512
2579
|
);
|
|
2513
2580
|
}
|
|
2514
|
-
: this.
|
|
2581
|
+
: this.ze
|
|
2515
2582
|
? () => {
|
|
2516
2583
|
const t = e[i];
|
|
2517
|
-
this.
|
|
2518
|
-
return this.Ye(() => t, read.bind(null, this.
|
|
2584
|
+
this.ze[i] = signal(i, pureOptions);
|
|
2585
|
+
return this.Ye(() => t, read.bind(null, this.ze[i]));
|
|
2519
2586
|
}
|
|
2520
2587
|
: () => {
|
|
2521
2588
|
const t = e[i];
|
|
@@ -2524,22 +2591,22 @@ function updateKeyedMap() {
|
|
|
2524
2591
|
if (t === 0) {
|
|
2525
2592
|
if (this.$e !== 0) {
|
|
2526
2593
|
this.Fe.dispose(false);
|
|
2527
|
-
this.Xe = [];
|
|
2528
|
-
this.Ke = [];
|
|
2529
2594
|
this.Be = [];
|
|
2595
|
+
this.Ke = [];
|
|
2596
|
+
this.Ze = [];
|
|
2530
2597
|
this.$e = 0;
|
|
2598
|
+
this.qe && (this.qe = []);
|
|
2531
2599
|
this.ze && (this.ze = []);
|
|
2532
|
-
this.Ze && (this.Ze = []);
|
|
2533
2600
|
}
|
|
2534
|
-
if (this.Je && !this.
|
|
2535
|
-
this.
|
|
2601
|
+
if (this.Je && !this.Ze[0]) {
|
|
2602
|
+
this.Ze[0] = runWithOwner((this.Be[0] = createOwner()), this.Je);
|
|
2536
2603
|
}
|
|
2537
2604
|
} else if (this.$e === 0) {
|
|
2538
|
-
if (this.
|
|
2539
|
-
this.
|
|
2605
|
+
if (this.Be[0]) this.Be[0].dispose();
|
|
2606
|
+
this.Ze = new Array(t);
|
|
2540
2607
|
for (i = 0; i < t; i++) {
|
|
2541
2608
|
this.Ke[i] = e[i];
|
|
2542
|
-
this.
|
|
2609
|
+
this.Ze[i] = runWithOwner((this.Be[i] = createOwner()), r);
|
|
2543
2610
|
}
|
|
2544
2611
|
this.$e = t;
|
|
2545
2612
|
} else {
|
|
@@ -2552,70 +2619,70 @@ function updateKeyedMap() {
|
|
|
2552
2619
|
f,
|
|
2553
2620
|
E = new Array(t),
|
|
2554
2621
|
T = new Array(t),
|
|
2555
|
-
d = this.
|
|
2556
|
-
|
|
2622
|
+
d = this.qe ? new Array(t) : undefined,
|
|
2623
|
+
R = this.ze ? new Array(t) : undefined;
|
|
2557
2624
|
for (
|
|
2558
2625
|
s = 0, o = Math.min(this.$e, t);
|
|
2559
|
-
s < o && (this.Ke[s] === e[s] || (this.
|
|
2626
|
+
s < o && (this.Ke[s] === e[s] || (this.qe && compare(this.Xe, this.Ke[s], e[s])));
|
|
2560
2627
|
s++
|
|
2561
2628
|
) {
|
|
2562
|
-
if (this.
|
|
2629
|
+
if (this.qe) setSignal(this.qe[s], e[s]);
|
|
2563
2630
|
}
|
|
2564
2631
|
for (
|
|
2565
2632
|
o = this.$e - 1, u = t - 1;
|
|
2566
2633
|
o >= s &&
|
|
2567
2634
|
u >= s &&
|
|
2568
|
-
(this.Ke[o] === e[u] || (this.
|
|
2635
|
+
(this.Ke[o] === e[u] || (this.qe && compare(this.Xe, this.Ke[o], e[u])));
|
|
2569
2636
|
o--, u--
|
|
2570
2637
|
) {
|
|
2571
|
-
E[u] = this.
|
|
2572
|
-
T[u] = this.
|
|
2573
|
-
d && (d[u] = this.
|
|
2574
|
-
|
|
2638
|
+
E[u] = this.Ze[o];
|
|
2639
|
+
T[u] = this.Be[o];
|
|
2640
|
+
d && (d[u] = this.qe[o]);
|
|
2641
|
+
R && (R[u] = this.ze[o]);
|
|
2575
2642
|
}
|
|
2576
2643
|
a = new Map();
|
|
2577
2644
|
f = new Array(u + 1);
|
|
2578
2645
|
for (i = u; i >= s; i--) {
|
|
2579
2646
|
c = e[i];
|
|
2580
|
-
l = this.
|
|
2647
|
+
l = this.Xe ? this.Xe(c) : c;
|
|
2581
2648
|
n = a.get(l);
|
|
2582
2649
|
f[i] = n === undefined ? -1 : n;
|
|
2583
2650
|
a.set(l, i);
|
|
2584
2651
|
}
|
|
2585
2652
|
for (n = s; n <= o; n++) {
|
|
2586
2653
|
c = this.Ke[n];
|
|
2587
|
-
l = this.
|
|
2654
|
+
l = this.Xe ? this.Xe(c) : c;
|
|
2588
2655
|
i = a.get(l);
|
|
2589
2656
|
if (i !== undefined && i !== -1) {
|
|
2590
|
-
E[i] = this.
|
|
2591
|
-
T[i] = this.
|
|
2592
|
-
d && (d[i] = this.
|
|
2593
|
-
|
|
2657
|
+
E[i] = this.Ze[n];
|
|
2658
|
+
T[i] = this.Be[n];
|
|
2659
|
+
d && (d[i] = this.qe[n]);
|
|
2660
|
+
R && (R[i] = this.ze[n]);
|
|
2594
2661
|
i = f[i];
|
|
2595
2662
|
a.set(l, i);
|
|
2596
|
-
} else this.
|
|
2663
|
+
} else this.Be[n].dispose();
|
|
2597
2664
|
}
|
|
2598
2665
|
for (i = s; i < t; i++) {
|
|
2599
2666
|
if (i in E) {
|
|
2600
|
-
this.
|
|
2601
|
-
this.
|
|
2667
|
+
this.Ze[i] = E[i];
|
|
2668
|
+
this.Be[i] = T[i];
|
|
2602
2669
|
if (d) {
|
|
2603
|
-
this.
|
|
2604
|
-
setSignal(this.
|
|
2670
|
+
this.qe[i] = d[i];
|
|
2671
|
+
setSignal(this.qe[i], e[i]);
|
|
2605
2672
|
}
|
|
2606
|
-
if (
|
|
2607
|
-
this.
|
|
2608
|
-
setSignal(this.
|
|
2673
|
+
if (R) {
|
|
2674
|
+
this.ze[i] = R[i];
|
|
2675
|
+
setSignal(this.ze[i], i);
|
|
2609
2676
|
}
|
|
2610
2677
|
} else {
|
|
2611
|
-
this.
|
|
2678
|
+
this.Ze[i] = runWithOwner((this.Be[i] = createOwner()), r);
|
|
2612
2679
|
}
|
|
2613
2680
|
}
|
|
2614
|
-
this.
|
|
2681
|
+
this.Ze = this.Ze.slice(0, (this.$e = t));
|
|
2615
2682
|
this.Ke = e.slice(0);
|
|
2616
2683
|
}
|
|
2617
2684
|
});
|
|
2618
|
-
return this.
|
|
2685
|
+
return this.Ze;
|
|
2619
2686
|
}
|
|
2620
2687
|
function repeat(e, t, n) {
|
|
2621
2688
|
const i = t;
|
|
@@ -2625,8 +2692,8 @@ function repeat(e, t, n) {
|
|
|
2625
2692
|
et: 0,
|
|
2626
2693
|
tt: e,
|
|
2627
2694
|
Ye: i,
|
|
2628
|
-
Xe: [],
|
|
2629
2695
|
Be: [],
|
|
2696
|
+
Ze: [],
|
|
2630
2697
|
nt: n?.from,
|
|
2631
2698
|
Je: n?.fallback
|
|
2632
2699
|
});
|
|
@@ -2638,45 +2705,45 @@ function updateRepeat() {
|
|
|
2638
2705
|
if (e === 0) {
|
|
2639
2706
|
if (this.$e !== 0) {
|
|
2640
2707
|
this.Fe.dispose(false);
|
|
2641
|
-
this.Xe = [];
|
|
2642
2708
|
this.Be = [];
|
|
2709
|
+
this.Ze = [];
|
|
2643
2710
|
this.$e = 0;
|
|
2644
2711
|
}
|
|
2645
|
-
if (this.Je && !this.
|
|
2646
|
-
this.
|
|
2712
|
+
if (this.Je && !this.Ze[0]) {
|
|
2713
|
+
this.Ze[0] = runWithOwner((this.Be[0] = createOwner()), this.Je);
|
|
2647
2714
|
}
|
|
2648
2715
|
return;
|
|
2649
2716
|
}
|
|
2650
2717
|
const n = t + e;
|
|
2651
2718
|
const i = this.et + this.$e;
|
|
2652
|
-
if (this.$e === 0 && this.
|
|
2653
|
-
for (let e = n; e < i; e++) this.
|
|
2719
|
+
if (this.$e === 0 && this.Be[0]) this.Be[0].dispose();
|
|
2720
|
+
for (let e = n; e < i; e++) this.Be[e - this.et].dispose();
|
|
2654
2721
|
if (this.et < t) {
|
|
2655
2722
|
let e = this.et;
|
|
2656
|
-
while (e < t && e < this.$e) this.
|
|
2657
|
-
this.Xe.splice(0, t - this.et);
|
|
2723
|
+
while (e < t && e < this.$e) this.Be[e++].dispose();
|
|
2658
2724
|
this.Be.splice(0, t - this.et);
|
|
2725
|
+
this.Ze.splice(0, t - this.et);
|
|
2659
2726
|
} else if (this.et > t) {
|
|
2660
2727
|
let n = i - this.et - 1;
|
|
2661
2728
|
let r = this.et - t;
|
|
2662
|
-
this.
|
|
2729
|
+
this.Be.length = this.Ze.length = e;
|
|
2663
2730
|
while (n >= r) {
|
|
2664
|
-
this.Xe[n] = this.Xe[n - r];
|
|
2665
2731
|
this.Be[n] = this.Be[n - r];
|
|
2732
|
+
this.Ze[n] = this.Ze[n - r];
|
|
2666
2733
|
n--;
|
|
2667
2734
|
}
|
|
2668
2735
|
for (let e = 0; e < r; e++) {
|
|
2669
|
-
this.
|
|
2736
|
+
this.Ze[e] = runWithOwner((this.Be[e] = createOwner()), () => this.Ye(e + t));
|
|
2670
2737
|
}
|
|
2671
2738
|
}
|
|
2672
2739
|
for (let e = i; e < n; e++) {
|
|
2673
|
-
this.
|
|
2740
|
+
this.Ze[e - t] = runWithOwner((this.Be[e - t] = createOwner()), () => this.Ye(e));
|
|
2674
2741
|
}
|
|
2675
|
-
this.
|
|
2742
|
+
this.Ze = this.Ze.slice(0, e);
|
|
2676
2743
|
this.et = t;
|
|
2677
2744
|
this.$e = e;
|
|
2678
2745
|
});
|
|
2679
|
-
return this.
|
|
2746
|
+
return this.Ze;
|
|
2680
2747
|
}
|
|
2681
2748
|
function compare(e, t, n) {
|
|
2682
2749
|
return e ? e(t) === e(n) : true;
|
|
@@ -2685,12 +2752,12 @@ function boundaryComputed(e, t) {
|
|
|
2685
2752
|
const n = computed(e, undefined, { lazy: true });
|
|
2686
2753
|
n.Ae = (e, t) => {
|
|
2687
2754
|
const i = e !== undefined ? e : n.Ee;
|
|
2688
|
-
const r = t !== undefined ? t : n.
|
|
2755
|
+
const r = t !== undefined ? t : n.X;
|
|
2689
2756
|
n.Ee &= ~n.it;
|
|
2690
2757
|
n.ce.notify(n, n.it, i, r);
|
|
2691
2758
|
};
|
|
2692
2759
|
n.it = t;
|
|
2693
|
-
n.
|
|
2760
|
+
n.Ne = true;
|
|
2694
2761
|
recompute(n, true);
|
|
2695
2762
|
return n;
|
|
2696
2763
|
}
|
|
@@ -2719,7 +2786,7 @@ class CollectionQueue extends Queue {
|
|
|
2719
2786
|
notify(e, t, n, i) {
|
|
2720
2787
|
if (!(t & this.rt) || (this.rt & STATUS_PENDING && this.ut)) return super.notify(e, t, n, i);
|
|
2721
2788
|
if (n & this.rt) {
|
|
2722
|
-
const t = i?.source || e.
|
|
2789
|
+
const t = i?.source || e.X?.source;
|
|
2723
2790
|
if (t) {
|
|
2724
2791
|
const e = this.st.size === 0;
|
|
2725
2792
|
this.st.add(t);
|
|
@@ -2758,7 +2825,7 @@ function createLoadBoundary(e, t) {
|
|
|
2758
2825
|
function createErrorBoundary(e, t) {
|
|
2759
2826
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2760
2827
|
let n = e.st.values().next().value;
|
|
2761
|
-
const i = n.
|
|
2828
|
+
const i = n.X?.cause ?? n.X;
|
|
2762
2829
|
return t(i, () => {
|
|
2763
2830
|
for (const t of e.st) recompute(t);
|
|
2764
2831
|
schedule();
|
|
@@ -2851,6 +2918,7 @@ export {
|
|
|
2851
2918
|
isPending,
|
|
2852
2919
|
isRefreshing,
|
|
2853
2920
|
isWrappable,
|
|
2921
|
+
latest,
|
|
2854
2922
|
mapArray,
|
|
2855
2923
|
markSnapshotScope,
|
|
2856
2924
|
merge,
|
|
@@ -2858,7 +2926,6 @@ export {
|
|
|
2858
2926
|
onCleanup,
|
|
2859
2927
|
onSettled,
|
|
2860
2928
|
peekNextChildId,
|
|
2861
|
-
pending,
|
|
2862
2929
|
reconcile,
|
|
2863
2930
|
refresh,
|
|
2864
2931
|
releaseSnapshotScope,
|
|
@@ -2869,5 +2936,6 @@ export {
|
|
|
2869
2936
|
setSnapshotCapture,
|
|
2870
2937
|
setStrictRead,
|
|
2871
2938
|
snapshot,
|
|
2939
|
+
storePath,
|
|
2872
2940
|
untrack
|
|
2873
2941
|
};
|