@solidjs/signals 0.11.0 → 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 +6 -1
- package/dist/node.cjs +519 -514
- package/dist/prod.js +157 -152
- package/dist/types/core/constants.d.ts +1 -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
|
}
|
|
@@ -708,19 +709,19 @@ function unlinkSubs(e) {
|
|
|
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,7 +730,7 @@ 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;
|
|
@@ -739,14 +740,14 @@ function link(e, t) {
|
|
|
739
740
|
if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
|
|
740
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,11 +770,11 @@ 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
|
}
|
|
@@ -783,14 +784,14 @@ function disposeChildren(e, t = false, n) {
|
|
|
783
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);
|
|
@@ -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);
|
|
@@ -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
|
}
|
|
@@ -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,7 +1154,7 @@ 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,
|
|
@@ -1162,16 +1163,16 @@ function computed(e, t, n) {
|
|
|
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,
|
|
@@ -1206,7 +1207,7 @@ 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,
|
|
@@ -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;
|
|
@@ -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,7 +2299,7 @@ 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
|
}
|
|
@@ -2547,11 +2552,11 @@ function mapArray(e, t, n) {
|
|
|
2547
2552
|
je: e,
|
|
2548
2553
|
Ke: [],
|
|
2549
2554
|
Ye: s,
|
|
2555
|
+
Ze: [],
|
|
2550
2556
|
Be: [],
|
|
2551
|
-
Xe:
|
|
2552
|
-
qe: i,
|
|
2553
|
-
ze:
|
|
2554
|
-
Ze: r ? [] : undefined,
|
|
2557
|
+
Xe: i,
|
|
2558
|
+
qe: i || n?.keyed === false ? [] : undefined,
|
|
2559
|
+
ze: r ? [] : undefined,
|
|
2555
2560
|
Je: n?.fallback
|
|
2556
2561
|
})
|
|
2557
2562
|
);
|
|
@@ -2564,20 +2569,20 @@ function updateKeyedMap() {
|
|
|
2564
2569
|
runWithOwner(this.Fe, () => {
|
|
2565
2570
|
let n,
|
|
2566
2571
|
i,
|
|
2567
|
-
r = this.
|
|
2572
|
+
r = this.qe
|
|
2568
2573
|
? () => {
|
|
2569
|
-
this.
|
|
2570
|
-
this.
|
|
2574
|
+
this.qe[i] = signal(e[i], pureOptions);
|
|
2575
|
+
this.ze && (this.ze[i] = signal(i, pureOptions));
|
|
2571
2576
|
return this.Ye(
|
|
2572
|
-
read.bind(null, this.
|
|
2573
|
-
this.
|
|
2577
|
+
read.bind(null, this.qe[i]),
|
|
2578
|
+
this.ze ? read.bind(null, this.ze[i]) : undefined
|
|
2574
2579
|
);
|
|
2575
2580
|
}
|
|
2576
|
-
: this.
|
|
2581
|
+
: this.ze
|
|
2577
2582
|
? () => {
|
|
2578
2583
|
const t = e[i];
|
|
2579
|
-
this.
|
|
2580
|
-
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]));
|
|
2581
2586
|
}
|
|
2582
2587
|
: () => {
|
|
2583
2588
|
const t = e[i];
|
|
@@ -2586,22 +2591,22 @@ function updateKeyedMap() {
|
|
|
2586
2591
|
if (t === 0) {
|
|
2587
2592
|
if (this.$e !== 0) {
|
|
2588
2593
|
this.Fe.dispose(false);
|
|
2589
|
-
this.Xe = [];
|
|
2590
|
-
this.Ke = [];
|
|
2591
2594
|
this.Be = [];
|
|
2595
|
+
this.Ke = [];
|
|
2596
|
+
this.Ze = [];
|
|
2592
2597
|
this.$e = 0;
|
|
2598
|
+
this.qe && (this.qe = []);
|
|
2593
2599
|
this.ze && (this.ze = []);
|
|
2594
|
-
this.Ze && (this.Ze = []);
|
|
2595
2600
|
}
|
|
2596
|
-
if (this.Je && !this.
|
|
2597
|
-
this.
|
|
2601
|
+
if (this.Je && !this.Ze[0]) {
|
|
2602
|
+
this.Ze[0] = runWithOwner((this.Be[0] = createOwner()), this.Je);
|
|
2598
2603
|
}
|
|
2599
2604
|
} else if (this.$e === 0) {
|
|
2600
|
-
if (this.
|
|
2601
|
-
this.
|
|
2605
|
+
if (this.Be[0]) this.Be[0].dispose();
|
|
2606
|
+
this.Ze = new Array(t);
|
|
2602
2607
|
for (i = 0; i < t; i++) {
|
|
2603
2608
|
this.Ke[i] = e[i];
|
|
2604
|
-
this.
|
|
2609
|
+
this.Ze[i] = runWithOwner((this.Be[i] = createOwner()), r);
|
|
2605
2610
|
}
|
|
2606
2611
|
this.$e = t;
|
|
2607
2612
|
} else {
|
|
@@ -2614,70 +2619,70 @@ function updateKeyedMap() {
|
|
|
2614
2619
|
f,
|
|
2615
2620
|
E = new Array(t),
|
|
2616
2621
|
T = new Array(t),
|
|
2617
|
-
d = this.
|
|
2618
|
-
|
|
2622
|
+
d = this.qe ? new Array(t) : undefined,
|
|
2623
|
+
R = this.ze ? new Array(t) : undefined;
|
|
2619
2624
|
for (
|
|
2620
2625
|
s = 0, o = Math.min(this.$e, t);
|
|
2621
|
-
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])));
|
|
2622
2627
|
s++
|
|
2623
2628
|
) {
|
|
2624
|
-
if (this.
|
|
2629
|
+
if (this.qe) setSignal(this.qe[s], e[s]);
|
|
2625
2630
|
}
|
|
2626
2631
|
for (
|
|
2627
2632
|
o = this.$e - 1, u = t - 1;
|
|
2628
2633
|
o >= s &&
|
|
2629
2634
|
u >= s &&
|
|
2630
|
-
(this.Ke[o] === e[u] || (this.
|
|
2635
|
+
(this.Ke[o] === e[u] || (this.qe && compare(this.Xe, this.Ke[o], e[u])));
|
|
2631
2636
|
o--, u--
|
|
2632
2637
|
) {
|
|
2633
|
-
E[u] = this.
|
|
2634
|
-
T[u] = this.
|
|
2635
|
-
d && (d[u] = this.
|
|
2636
|
-
|
|
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]);
|
|
2637
2642
|
}
|
|
2638
2643
|
a = new Map();
|
|
2639
2644
|
f = new Array(u + 1);
|
|
2640
2645
|
for (i = u; i >= s; i--) {
|
|
2641
2646
|
c = e[i];
|
|
2642
|
-
l = this.
|
|
2647
|
+
l = this.Xe ? this.Xe(c) : c;
|
|
2643
2648
|
n = a.get(l);
|
|
2644
2649
|
f[i] = n === undefined ? -1 : n;
|
|
2645
2650
|
a.set(l, i);
|
|
2646
2651
|
}
|
|
2647
2652
|
for (n = s; n <= o; n++) {
|
|
2648
2653
|
c = this.Ke[n];
|
|
2649
|
-
l = this.
|
|
2654
|
+
l = this.Xe ? this.Xe(c) : c;
|
|
2650
2655
|
i = a.get(l);
|
|
2651
2656
|
if (i !== undefined && i !== -1) {
|
|
2652
|
-
E[i] = this.
|
|
2653
|
-
T[i] = this.
|
|
2654
|
-
d && (d[i] = this.
|
|
2655
|
-
|
|
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]);
|
|
2656
2661
|
i = f[i];
|
|
2657
2662
|
a.set(l, i);
|
|
2658
|
-
} else this.
|
|
2663
|
+
} else this.Be[n].dispose();
|
|
2659
2664
|
}
|
|
2660
2665
|
for (i = s; i < t; i++) {
|
|
2661
2666
|
if (i in E) {
|
|
2662
|
-
this.
|
|
2663
|
-
this.
|
|
2667
|
+
this.Ze[i] = E[i];
|
|
2668
|
+
this.Be[i] = T[i];
|
|
2664
2669
|
if (d) {
|
|
2665
|
-
this.
|
|
2666
|
-
setSignal(this.
|
|
2670
|
+
this.qe[i] = d[i];
|
|
2671
|
+
setSignal(this.qe[i], e[i]);
|
|
2667
2672
|
}
|
|
2668
|
-
if (
|
|
2669
|
-
this.
|
|
2670
|
-
setSignal(this.
|
|
2673
|
+
if (R) {
|
|
2674
|
+
this.ze[i] = R[i];
|
|
2675
|
+
setSignal(this.ze[i], i);
|
|
2671
2676
|
}
|
|
2672
2677
|
} else {
|
|
2673
|
-
this.
|
|
2678
|
+
this.Ze[i] = runWithOwner((this.Be[i] = createOwner()), r);
|
|
2674
2679
|
}
|
|
2675
2680
|
}
|
|
2676
|
-
this.
|
|
2681
|
+
this.Ze = this.Ze.slice(0, (this.$e = t));
|
|
2677
2682
|
this.Ke = e.slice(0);
|
|
2678
2683
|
}
|
|
2679
2684
|
});
|
|
2680
|
-
return this.
|
|
2685
|
+
return this.Ze;
|
|
2681
2686
|
}
|
|
2682
2687
|
function repeat(e, t, n) {
|
|
2683
2688
|
const i = t;
|
|
@@ -2687,8 +2692,8 @@ function repeat(e, t, n) {
|
|
|
2687
2692
|
et: 0,
|
|
2688
2693
|
tt: e,
|
|
2689
2694
|
Ye: i,
|
|
2690
|
-
Xe: [],
|
|
2691
2695
|
Be: [],
|
|
2696
|
+
Ze: [],
|
|
2692
2697
|
nt: n?.from,
|
|
2693
2698
|
Je: n?.fallback
|
|
2694
2699
|
});
|
|
@@ -2700,45 +2705,45 @@ function updateRepeat() {
|
|
|
2700
2705
|
if (e === 0) {
|
|
2701
2706
|
if (this.$e !== 0) {
|
|
2702
2707
|
this.Fe.dispose(false);
|
|
2703
|
-
this.Xe = [];
|
|
2704
2708
|
this.Be = [];
|
|
2709
|
+
this.Ze = [];
|
|
2705
2710
|
this.$e = 0;
|
|
2706
2711
|
}
|
|
2707
|
-
if (this.Je && !this.
|
|
2708
|
-
this.
|
|
2712
|
+
if (this.Je && !this.Ze[0]) {
|
|
2713
|
+
this.Ze[0] = runWithOwner((this.Be[0] = createOwner()), this.Je);
|
|
2709
2714
|
}
|
|
2710
2715
|
return;
|
|
2711
2716
|
}
|
|
2712
2717
|
const n = t + e;
|
|
2713
2718
|
const i = this.et + this.$e;
|
|
2714
|
-
if (this.$e === 0 && this.
|
|
2715
|
-
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();
|
|
2716
2721
|
if (this.et < t) {
|
|
2717
2722
|
let e = this.et;
|
|
2718
|
-
while (e < t && e < this.$e) this.
|
|
2719
|
-
this.Xe.splice(0, t - this.et);
|
|
2723
|
+
while (e < t && e < this.$e) this.Be[e++].dispose();
|
|
2720
2724
|
this.Be.splice(0, t - this.et);
|
|
2725
|
+
this.Ze.splice(0, t - this.et);
|
|
2721
2726
|
} else if (this.et > t) {
|
|
2722
2727
|
let n = i - this.et - 1;
|
|
2723
2728
|
let r = this.et - t;
|
|
2724
|
-
this.
|
|
2729
|
+
this.Be.length = this.Ze.length = e;
|
|
2725
2730
|
while (n >= r) {
|
|
2726
|
-
this.Xe[n] = this.Xe[n - r];
|
|
2727
2731
|
this.Be[n] = this.Be[n - r];
|
|
2732
|
+
this.Ze[n] = this.Ze[n - r];
|
|
2728
2733
|
n--;
|
|
2729
2734
|
}
|
|
2730
2735
|
for (let e = 0; e < r; e++) {
|
|
2731
|
-
this.
|
|
2736
|
+
this.Ze[e] = runWithOwner((this.Be[e] = createOwner()), () => this.Ye(e + t));
|
|
2732
2737
|
}
|
|
2733
2738
|
}
|
|
2734
2739
|
for (let e = i; e < n; e++) {
|
|
2735
|
-
this.
|
|
2740
|
+
this.Ze[e - t] = runWithOwner((this.Be[e - t] = createOwner()), () => this.Ye(e));
|
|
2736
2741
|
}
|
|
2737
|
-
this.
|
|
2742
|
+
this.Ze = this.Ze.slice(0, e);
|
|
2738
2743
|
this.et = t;
|
|
2739
2744
|
this.$e = e;
|
|
2740
2745
|
});
|
|
2741
|
-
return this.
|
|
2746
|
+
return this.Ze;
|
|
2742
2747
|
}
|
|
2743
2748
|
function compare(e, t, n) {
|
|
2744
2749
|
return e ? e(t) === e(n) : true;
|
|
@@ -2747,12 +2752,12 @@ function boundaryComputed(e, t) {
|
|
|
2747
2752
|
const n = computed(e, undefined, { lazy: true });
|
|
2748
2753
|
n.Ae = (e, t) => {
|
|
2749
2754
|
const i = e !== undefined ? e : n.Ee;
|
|
2750
|
-
const r = t !== undefined ? t : n.
|
|
2755
|
+
const r = t !== undefined ? t : n.X;
|
|
2751
2756
|
n.Ee &= ~n.it;
|
|
2752
2757
|
n.ce.notify(n, n.it, i, r);
|
|
2753
2758
|
};
|
|
2754
2759
|
n.it = t;
|
|
2755
|
-
n.
|
|
2760
|
+
n.Ne = true;
|
|
2756
2761
|
recompute(n, true);
|
|
2757
2762
|
return n;
|
|
2758
2763
|
}
|
|
@@ -2781,7 +2786,7 @@ class CollectionQueue extends Queue {
|
|
|
2781
2786
|
notify(e, t, n, i) {
|
|
2782
2787
|
if (!(t & this.rt) || (this.rt & STATUS_PENDING && this.ut)) return super.notify(e, t, n, i);
|
|
2783
2788
|
if (n & this.rt) {
|
|
2784
|
-
const t = i?.source || e.
|
|
2789
|
+
const t = i?.source || e.X?.source;
|
|
2785
2790
|
if (t) {
|
|
2786
2791
|
const e = this.st.size === 0;
|
|
2787
2792
|
this.st.add(t);
|
|
@@ -2820,7 +2825,7 @@ function createLoadBoundary(e, t) {
|
|
|
2820
2825
|
function createErrorBoundary(e, t) {
|
|
2821
2826
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2822
2827
|
let n = e.st.values().next().value;
|
|
2823
|
-
const i = n.
|
|
2828
|
+
const i = n.X?.cause ?? n.X;
|
|
2824
2829
|
return t(i, () => {
|
|
2825
2830
|
for (const t of e.st) recompute(t);
|
|
2826
2831
|
schedule();
|