@solidjs/signals 0.10.7 → 0.10.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 +50 -4
- package/dist/node.cjs +230 -220
- package/dist/prod.js +215 -205
- package/dist/types/core/core.d.ts +2 -0
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/map.d.ts +2 -0
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -81,10 +81,10 @@ function deleteFromHeap(e, t) {
|
|
|
81
81
|
else {
|
|
82
82
|
const n = e.S;
|
|
83
83
|
const r = t.l[i];
|
|
84
|
-
const
|
|
84
|
+
const s = n ?? r;
|
|
85
85
|
if (e === r) t.l[i] = n;
|
|
86
86
|
else e.T.S = n;
|
|
87
|
-
|
|
87
|
+
s.T = e.T;
|
|
88
88
|
}
|
|
89
89
|
e.T = e;
|
|
90
90
|
e.S = undefined;
|
|
@@ -347,7 +347,7 @@ function insertSubs(e, t = false) {
|
|
|
347
347
|
const n = e.ie || currentOptimisticLane;
|
|
348
348
|
const i = e.re !== undefined;
|
|
349
349
|
for (let r = e.I; r !== null; r = r.p) {
|
|
350
|
-
if (i && r.h.
|
|
350
|
+
if (i && r.h.se) {
|
|
351
351
|
r.h.O |= REACTIVE_SNAPSHOT_STALE;
|
|
352
352
|
continue;
|
|
353
353
|
}
|
|
@@ -359,16 +359,16 @@ function insertSubs(e, t = false) {
|
|
|
359
359
|
r.h.ie = undefined;
|
|
360
360
|
}
|
|
361
361
|
const e = r.h;
|
|
362
|
-
if (e.
|
|
362
|
+
if (e.oe === EFFECT_TRACKED) {
|
|
363
363
|
if (!e.ue) {
|
|
364
364
|
e.ue = true;
|
|
365
365
|
e.ce.enqueue(EFFECT_USER, e.le);
|
|
366
366
|
}
|
|
367
367
|
continue;
|
|
368
368
|
}
|
|
369
|
-
const
|
|
370
|
-
if (
|
|
371
|
-
insertIntoHeap(r.h,
|
|
369
|
+
const s = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
370
|
+
if (s.N > r.h.o) s.N = r.h.o;
|
|
371
|
+
insertIntoHeap(r.h, s);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
function finalizePureQueue(e = null, t = false) {
|
|
@@ -382,7 +382,7 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
382
382
|
if (n.ae !== NOT_PENDING) {
|
|
383
383
|
n.fe = n.ae;
|
|
384
384
|
n.ae = NOT_PENDING;
|
|
385
|
-
if (n.
|
|
385
|
+
if (n.oe && n.oe !== EFFECT_TRACKED) n.ue = true;
|
|
386
386
|
}
|
|
387
387
|
n.Ee &= ~STATUS_UNINITIALIZED;
|
|
388
388
|
if (n.L) GlobalQueue.Y(n, false, true);
|
|
@@ -543,13 +543,13 @@ function assignOrMergeLane(e, t) {
|
|
|
543
543
|
function handleAsync(e, t, n) {
|
|
544
544
|
const i = typeof t === "object" && t !== null;
|
|
545
545
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
546
|
-
const
|
|
547
|
-
if (!
|
|
546
|
+
const s = !r && i && untrack(() => typeof t.then === "function");
|
|
547
|
+
if (!s && !r) {
|
|
548
548
|
e.Ie = null;
|
|
549
549
|
return t;
|
|
550
550
|
}
|
|
551
551
|
e.Ie = t;
|
|
552
|
-
let
|
|
552
|
+
let o;
|
|
553
553
|
const handleError = n => {
|
|
554
554
|
if (e.Ie !== t) return;
|
|
555
555
|
globalQueue.initTransition(e.ne);
|
|
@@ -561,8 +561,8 @@ function handleAsync(e, t, n) {
|
|
|
561
561
|
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
562
562
|
globalQueue.initTransition(e.ne);
|
|
563
563
|
clearStatus(e);
|
|
564
|
-
const
|
|
565
|
-
if (
|
|
564
|
+
const s = resolveLane(e);
|
|
565
|
+
if (s) s.U.delete(e);
|
|
566
566
|
if (n) n(i);
|
|
567
567
|
else if (e._e) {
|
|
568
568
|
const t = e.ae !== NOT_PENDING;
|
|
@@ -572,7 +572,7 @@ function handleAsync(e, t, n) {
|
|
|
572
572
|
insertSubs(e);
|
|
573
573
|
}
|
|
574
574
|
e.J = clock;
|
|
575
|
-
} else if (
|
|
575
|
+
} else if (s) {
|
|
576
576
|
const t = e.fe;
|
|
577
577
|
const n = e.pe;
|
|
578
578
|
if (!n || !n(i, t)) {
|
|
@@ -590,13 +590,13 @@ function handleAsync(e, t, n) {
|
|
|
590
590
|
flush();
|
|
591
591
|
r?.();
|
|
592
592
|
};
|
|
593
|
-
if (
|
|
593
|
+
if (s) {
|
|
594
594
|
let n = false,
|
|
595
595
|
i = true;
|
|
596
596
|
t.then(
|
|
597
597
|
e => {
|
|
598
598
|
if (i) {
|
|
599
|
-
|
|
599
|
+
o = e;
|
|
600
600
|
n = true;
|
|
601
601
|
} else asyncWrite(e);
|
|
602
602
|
},
|
|
@@ -630,7 +630,7 @@ function handleAsync(e, t, n) {
|
|
|
630
630
|
);
|
|
631
631
|
r = false;
|
|
632
632
|
if (t && !e.done) {
|
|
633
|
-
|
|
633
|
+
o = e.value;
|
|
634
634
|
i = true;
|
|
635
635
|
return iterate();
|
|
636
636
|
}
|
|
@@ -642,7 +642,7 @@ function handleAsync(e, t, n) {
|
|
|
642
642
|
throw new NotReadyError(context);
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
|
-
return
|
|
645
|
+
return o;
|
|
646
646
|
}
|
|
647
647
|
function clearStatus(e) {
|
|
648
648
|
e.Ee = e.Ee & STATUS_UNINITIALIZED;
|
|
@@ -653,9 +653,9 @@ function clearStatus(e) {
|
|
|
653
653
|
function notifyStatus(e, t, n, i, r) {
|
|
654
654
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
655
655
|
n = new StatusError(e, n);
|
|
656
|
-
const
|
|
657
|
-
const
|
|
658
|
-
const u =
|
|
656
|
+
const s = n instanceof NotReadyError && n.source === e;
|
|
657
|
+
const o = t === STATUS_PENDING && e._e && !s;
|
|
658
|
+
const u = o && hasActiveOverride(e);
|
|
659
659
|
if (!i) {
|
|
660
660
|
e.Ee = t | (t !== STATUS_ERROR ? e.Ee & STATUS_UNINITIALIZED : 0);
|
|
661
661
|
e.q = n;
|
|
@@ -671,7 +671,7 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
673
|
const c = i || u;
|
|
674
|
-
const l = i ||
|
|
674
|
+
const l = i || o ? undefined : r;
|
|
675
675
|
if (e.Ae) {
|
|
676
676
|
if (c) {
|
|
677
677
|
e.Ae(t, n);
|
|
@@ -735,13 +735,13 @@ function link(e, t) {
|
|
|
735
735
|
return;
|
|
736
736
|
}
|
|
737
737
|
}
|
|
738
|
-
const
|
|
739
|
-
if (
|
|
740
|
-
const
|
|
741
|
-
if (n !== null) n.D =
|
|
742
|
-
else t.C =
|
|
743
|
-
if (
|
|
744
|
-
else e.I =
|
|
738
|
+
const s = e.Pe;
|
|
739
|
+
if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
|
|
740
|
+
const o = (t.ye = e.Pe = { V: e, h: t, D: i, ge: s, p: null });
|
|
741
|
+
if (n !== null) n.D = o;
|
|
742
|
+
else t.C = o;
|
|
743
|
+
if (s !== null) s.p = o;
|
|
744
|
+
else e.I = o;
|
|
745
745
|
}
|
|
746
746
|
function isValidLink(e, t) {
|
|
747
747
|
const n = t.ye;
|
|
@@ -889,46 +889,46 @@ function createRoot(e, t) {
|
|
|
889
889
|
return runWithOwner(n, () => e(n.dispose));
|
|
890
890
|
}
|
|
891
891
|
function effect(e, t, n, i, r) {
|
|
892
|
-
let
|
|
893
|
-
const
|
|
892
|
+
let s = false;
|
|
893
|
+
const o = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
894
894
|
...r,
|
|
895
895
|
equals: () => {
|
|
896
|
-
|
|
897
|
-
if (
|
|
896
|
+
o.ue = !o.q;
|
|
897
|
+
if (s) o.ce.enqueue(o.oe, runEffect.bind(o));
|
|
898
898
|
return false;
|
|
899
899
|
},
|
|
900
900
|
lazy: true
|
|
901
901
|
});
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
const n = e !== undefined ? e :
|
|
909
|
-
const i = t !== undefined ? t :
|
|
902
|
+
o.Ue = i;
|
|
903
|
+
o.We = t;
|
|
904
|
+
o.He = n;
|
|
905
|
+
o.xe = undefined;
|
|
906
|
+
o.oe = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
907
|
+
o.Ae = (e, t) => {
|
|
908
|
+
const n = e !== undefined ? e : o.Ee;
|
|
909
|
+
const i = t !== undefined ? t : o.q;
|
|
910
910
|
if (n & STATUS_ERROR) {
|
|
911
911
|
let e = i;
|
|
912
|
-
|
|
913
|
-
if (
|
|
912
|
+
o.ce.notify(o, STATUS_PENDING, 0);
|
|
913
|
+
if (o.oe === EFFECT_USER) {
|
|
914
914
|
try {
|
|
915
|
-
return
|
|
916
|
-
?
|
|
917
|
-
|
|
918
|
-
|
|
915
|
+
return o.He
|
|
916
|
+
? o.He(e, () => {
|
|
917
|
+
o.xe?.();
|
|
918
|
+
o.xe = undefined;
|
|
919
919
|
})
|
|
920
920
|
: console.error(e);
|
|
921
921
|
} catch (t) {
|
|
922
922
|
e = t;
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
|
-
if (!
|
|
926
|
-
} else if (
|
|
925
|
+
if (!o.ce.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
926
|
+
} else if (o.oe === EFFECT_RENDER) o.ce.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
927
927
|
};
|
|
928
|
-
recompute(
|
|
929
|
-
!r?.defer && (
|
|
930
|
-
|
|
931
|
-
onCleanup(() =>
|
|
928
|
+
recompute(o, true);
|
|
929
|
+
!r?.defer && (o.oe === EFFECT_USER ? o.ce.enqueue(o.oe, runEffect.bind(o)) : runEffect.call(o));
|
|
930
|
+
s = true;
|
|
931
|
+
onCleanup(() => o.xe?.());
|
|
932
932
|
}
|
|
933
933
|
function runEffect() {
|
|
934
934
|
if (!this.ue || this.O & REACTIVE_DISPOSED) return;
|
|
@@ -963,7 +963,7 @@ function trackedEffect(e, t) {
|
|
|
963
963
|
);
|
|
964
964
|
n.xe = undefined;
|
|
965
965
|
n.ue = true;
|
|
966
|
-
n.
|
|
966
|
+
n.oe = EFFECT_TRACKED;
|
|
967
967
|
n.le = run;
|
|
968
968
|
n.ce.enqueue(EFFECT_USER, run);
|
|
969
969
|
onCleanup(() => n.xe?.());
|
|
@@ -1008,7 +1008,7 @@ function releaseSubtree(e) {
|
|
|
1008
1008
|
}
|
|
1009
1009
|
if (t.L) {
|
|
1010
1010
|
const e = t;
|
|
1011
|
-
e.
|
|
1011
|
+
e.se = false;
|
|
1012
1012
|
if (e.O & REACTIVE_SNAPSHOT_STALE) {
|
|
1013
1013
|
e.O &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1014
1014
|
e.O |= REACTIVE_DIRTY;
|
|
@@ -1031,7 +1031,7 @@ function clearSnapshots() {
|
|
|
1031
1031
|
snapshotCaptureActive = false;
|
|
1032
1032
|
}
|
|
1033
1033
|
function recompute(e, t = false) {
|
|
1034
|
-
const n = e.
|
|
1034
|
+
const n = e.oe;
|
|
1035
1035
|
if (!t) {
|
|
1036
1036
|
if (e.ne && (!n || activeTransition) && activeTransition !== e.ne)
|
|
1037
1037
|
globalQueue.initTransition(e.ne);
|
|
@@ -1048,8 +1048,8 @@ function recompute(e, t = false) {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1050
1050
|
const r = hasActiveOverride(e);
|
|
1051
|
-
const
|
|
1052
|
-
const
|
|
1051
|
+
const s = !!(e.Ee & STATUS_PENDING);
|
|
1052
|
+
const o = context;
|
|
1053
1053
|
context = e;
|
|
1054
1054
|
e.ye = null;
|
|
1055
1055
|
e.O = REACTIVE_RECOMPUTING_DEPS;
|
|
@@ -1090,30 +1090,30 @@ function recompute(e, t = false) {
|
|
|
1090
1090
|
} finally {
|
|
1091
1091
|
tracking = l;
|
|
1092
1092
|
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1093
|
-
context =
|
|
1093
|
+
context = o;
|
|
1094
1094
|
}
|
|
1095
1095
|
if (!e.q) {
|
|
1096
|
-
const
|
|
1097
|
-
let l =
|
|
1096
|
+
const o = e.ye;
|
|
1097
|
+
let l = o !== null ? o.D : e.C;
|
|
1098
1098
|
if (l !== null) {
|
|
1099
1099
|
do {
|
|
1100
1100
|
l = unlinkSubs(l);
|
|
1101
1101
|
} while (l !== null);
|
|
1102
|
-
if (
|
|
1102
|
+
if (o !== null) o.D = null;
|
|
1103
1103
|
else e.C = null;
|
|
1104
1104
|
}
|
|
1105
1105
|
const a = r ? e.fe : e.ae === NOT_PENDING ? e.fe : e.ae;
|
|
1106
1106
|
const f = !e.pe || !e.pe(a, u);
|
|
1107
1107
|
if (f) {
|
|
1108
|
-
const
|
|
1108
|
+
const o = r ? e.fe : undefined;
|
|
1109
1109
|
if (t || (n && activeTransition !== e.ne) || i) e.fe = u;
|
|
1110
1110
|
else e.ae = u;
|
|
1111
|
-
if (r && !i &&
|
|
1111
|
+
if (r && !i && s) {
|
|
1112
1112
|
const t = e.Oe || 0;
|
|
1113
1113
|
const n = e.Re || 0;
|
|
1114
1114
|
if (t <= n) e.fe = u;
|
|
1115
1115
|
}
|
|
1116
|
-
if (!r || i || e.fe !==
|
|
1116
|
+
if (!r || i || e.fe !== o) {
|
|
1117
1117
|
insertSubs(e, i || r);
|
|
1118
1118
|
}
|
|
1119
1119
|
} else if (r) {
|
|
@@ -1181,7 +1181,7 @@ function computed(e, t, n) {
|
|
|
1181
1181
|
ne: null
|
|
1182
1182
|
};
|
|
1183
1183
|
r.T = r;
|
|
1184
|
-
const
|
|
1184
|
+
const s = context?.t ? context.u : context;
|
|
1185
1185
|
if (context) {
|
|
1186
1186
|
const e = context.De;
|
|
1187
1187
|
if (e === null) {
|
|
@@ -1191,8 +1191,8 @@ function computed(e, t, n) {
|
|
|
1191
1191
|
context.De = r;
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
1194
|
-
if (
|
|
1195
|
-
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.
|
|
1194
|
+
if (s) r.o = s.o + 1;
|
|
1195
|
+
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.se = true;
|
|
1196
1196
|
!n?.lazy && recompute(r, true);
|
|
1197
1197
|
if (snapshotCaptureActive && !n?.lazy) {
|
|
1198
1198
|
if (!(r.Ee & STATUS_PENDING)) {
|
|
@@ -1235,8 +1235,14 @@ function optimisticComputed(e, t, n) {
|
|
|
1235
1235
|
function isEqual(e, t) {
|
|
1236
1236
|
return e === t;
|
|
1237
1237
|
}
|
|
1238
|
+
let strictRead = false;
|
|
1239
|
+
function setStrictRead(e) {
|
|
1240
|
+
const t = strictRead;
|
|
1241
|
+
strictRead = e;
|
|
1242
|
+
return t;
|
|
1243
|
+
}
|
|
1238
1244
|
function untrack(e) {
|
|
1239
|
-
if (!tracking) return e();
|
|
1245
|
+
if (!tracking && true) return e();
|
|
1240
1246
|
tracking = false;
|
|
1241
1247
|
try {
|
|
1242
1248
|
return e();
|
|
@@ -1323,7 +1329,7 @@ function read(e) {
|
|
|
1323
1329
|
return read(e);
|
|
1324
1330
|
} else throw e.q;
|
|
1325
1331
|
}
|
|
1326
|
-
if (snapshotCaptureActive && t && t.
|
|
1332
|
+
if (snapshotCaptureActive && t && t.se) {
|
|
1327
1333
|
const n = e.re;
|
|
1328
1334
|
if (n !== undefined) {
|
|
1329
1335
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
@@ -1537,13 +1543,13 @@ function action(e) {
|
|
|
1537
1543
|
new Promise((n, i) => {
|
|
1538
1544
|
const r = e(...t);
|
|
1539
1545
|
globalQueue.initTransition();
|
|
1540
|
-
let
|
|
1541
|
-
|
|
1546
|
+
let s = activeTransition;
|
|
1547
|
+
s.ee.push(r);
|
|
1542
1548
|
const done = (e, t) => {
|
|
1543
|
-
|
|
1544
|
-
const
|
|
1545
|
-
if (
|
|
1546
|
-
setActiveTransition(
|
|
1549
|
+
s = currentTransition(s);
|
|
1550
|
+
const o = s.ee.indexOf(r);
|
|
1551
|
+
if (o >= 0) s.ee.splice(o, 1);
|
|
1552
|
+
setActiveTransition(s);
|
|
1547
1553
|
schedule();
|
|
1548
1554
|
t ? i(t) : n(e);
|
|
1549
1555
|
};
|
|
@@ -1555,17 +1561,17 @@ function action(e) {
|
|
|
1555
1561
|
return done(undefined, e);
|
|
1556
1562
|
}
|
|
1557
1563
|
if (n instanceof Promise)
|
|
1558
|
-
return void n.then(run, e => restoreTransition(
|
|
1564
|
+
return void n.then(run, e => restoreTransition(s, () => step(e, true)));
|
|
1559
1565
|
run(n);
|
|
1560
1566
|
};
|
|
1561
1567
|
const run = e => {
|
|
1562
1568
|
if (e.done) return done(e.value);
|
|
1563
1569
|
if (e.value instanceof Promise)
|
|
1564
1570
|
return void e.value.then(
|
|
1565
|
-
e => restoreTransition(
|
|
1566
|
-
e => restoreTransition(
|
|
1571
|
+
e => restoreTransition(s, () => step(e)),
|
|
1572
|
+
e => restoreTransition(s, () => step(e, true))
|
|
1567
1573
|
);
|
|
1568
|
-
restoreTransition(
|
|
1574
|
+
restoreTransition(s, () => step(e.value));
|
|
1569
1575
|
};
|
|
1570
1576
|
step();
|
|
1571
1577
|
});
|
|
@@ -1653,23 +1659,23 @@ function getAllKeys(e, t, n) {
|
|
|
1653
1659
|
function applyState(e, t, n, i) {
|
|
1654
1660
|
const r = t?.[$TARGET];
|
|
1655
1661
|
if (!r) return;
|
|
1656
|
-
const
|
|
1657
|
-
const
|
|
1662
|
+
const s = r[STORE_VALUE];
|
|
1663
|
+
const o = r[STORE_OVERRIDE];
|
|
1658
1664
|
const u = r[STORE_OPTIMISTIC_OVERRIDE];
|
|
1659
1665
|
let c = r[STORE_NODE];
|
|
1660
|
-
if (e ===
|
|
1666
|
+
if (e === s && !o && !u) return;
|
|
1661
1667
|
(r[STORE_LOOKUP] || storeLookup).set(e, r[$PROXY]);
|
|
1662
1668
|
r[STORE_VALUE] = e;
|
|
1663
1669
|
r[STORE_OVERRIDE] = undefined;
|
|
1664
|
-
if (Array.isArray(
|
|
1670
|
+
if (Array.isArray(s)) {
|
|
1665
1671
|
let t = false;
|
|
1666
|
-
const l = getOverrideValue(
|
|
1672
|
+
const l = getOverrideValue(s, o, c, "length", u);
|
|
1667
1673
|
if (e.length && l && e[0] && n(e[0]) != null) {
|
|
1668
1674
|
let a, f, E, T, d, S, R, O;
|
|
1669
1675
|
for (
|
|
1670
1676
|
E = 0, T = Math.min(l, e.length);
|
|
1671
1677
|
E < T &&
|
|
1672
|
-
((S = getOverrideValue(
|
|
1678
|
+
((S = getOverrideValue(s, o, c, E, u)) === e[E] || (S && e[E] && n(S) === n(e[E])));
|
|
1673
1679
|
E++
|
|
1674
1680
|
) {
|
|
1675
1681
|
applyState(e[E], wrap(S, r), n, i);
|
|
@@ -1680,7 +1686,7 @@ function applyState(e, t, n, i) {
|
|
|
1680
1686
|
T = l - 1, d = e.length - 1;
|
|
1681
1687
|
T >= E &&
|
|
1682
1688
|
d >= E &&
|
|
1683
|
-
((S = getOverrideValue(
|
|
1689
|
+
((S = getOverrideValue(s, o, c, T, u)) === e[d] || (S && e[d] && n(S) === n(e[d])));
|
|
1684
1690
|
T--, d--
|
|
1685
1691
|
) {
|
|
1686
1692
|
_[d] = S;
|
|
@@ -1692,9 +1698,9 @@ function applyState(e, t, n, i) {
|
|
|
1692
1698
|
}
|
|
1693
1699
|
for (; f < e.length; f++) {
|
|
1694
1700
|
t = true;
|
|
1695
|
-
const
|
|
1696
|
-
r[STORE_NODE][f] && setSignal(r[STORE_NODE][f],
|
|
1697
|
-
applyState(e[f],
|
|
1701
|
+
const s = wrap(_[f], r);
|
|
1702
|
+
r[STORE_NODE][f] && setSignal(r[STORE_NODE][f], s);
|
|
1703
|
+
applyState(e[f], s, n, i);
|
|
1698
1704
|
}
|
|
1699
1705
|
t && r[STORE_NODE][$TRACK] && setSignal(r[STORE_NODE][$TRACK], void 0);
|
|
1700
1706
|
l !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
|
|
@@ -1709,7 +1715,7 @@ function applyState(e, t, n, i) {
|
|
|
1709
1715
|
I.set(O, f);
|
|
1710
1716
|
}
|
|
1711
1717
|
for (a = E; a <= T; a++) {
|
|
1712
|
-
S = getOverrideValue(
|
|
1718
|
+
S = getOverrideValue(s, o, c, a, u);
|
|
1713
1719
|
O = S ? n(S) : S;
|
|
1714
1720
|
f = I.get(O);
|
|
1715
1721
|
if (f !== undefined && f !== -1) {
|
|
@@ -1728,7 +1734,7 @@ function applyState(e, t, n, i) {
|
|
|
1728
1734
|
if (E < e.length) t = true;
|
|
1729
1735
|
} else if (e.length) {
|
|
1730
1736
|
for (let t = 0, l = e.length; t < l; t++) {
|
|
1731
|
-
const l = getOverrideValue(
|
|
1737
|
+
const l = getOverrideValue(s, o, c, t, u);
|
|
1732
1738
|
isWrappable(l)
|
|
1733
1739
|
? applyState(e[t], wrap(l, r), n, i)
|
|
1734
1740
|
: r[STORE_NODE][t] && setSignal(r[STORE_NODE][t], e[t]);
|
|
@@ -1743,11 +1749,11 @@ function applyState(e, t, n, i) {
|
|
|
1743
1749
|
}
|
|
1744
1750
|
if (c) {
|
|
1745
1751
|
const t = c[$TRACK];
|
|
1746
|
-
const l = t || i ? getAllKeys(
|
|
1752
|
+
const l = t || i ? getAllKeys(s, o, e) : Object.keys(c);
|
|
1747
1753
|
for (let a = 0, f = l.length; a < f; a++) {
|
|
1748
1754
|
const f = l[a];
|
|
1749
1755
|
const E = c[f];
|
|
1750
|
-
const T = unwrap(getOverrideValue(
|
|
1756
|
+
const T = unwrap(getOverrideValue(s, o, c, f, u));
|
|
1751
1757
|
let d = unwrap(e[f]);
|
|
1752
1758
|
if (T === d) continue;
|
|
1753
1759
|
if (!T || !isWrappable(T) || !isWrappable(d) || (n(T) != null && n(T) !== n(d))) {
|
|
@@ -1768,8 +1774,8 @@ function reconcile(e, t, n = false) {
|
|
|
1768
1774
|
return i => {
|
|
1769
1775
|
if (i == null) throw new Error("Cannot reconcile null or undefined state");
|
|
1770
1776
|
const r = typeof t === "string" ? e => e[t] : t;
|
|
1771
|
-
const
|
|
1772
|
-
if (
|
|
1777
|
+
const s = r(i);
|
|
1778
|
+
if (s !== undefined && r(e) !== r(i))
|
|
1773
1779
|
throw new Error("Cannot reconcile states with different identity");
|
|
1774
1780
|
applyState(e, i, r, n);
|
|
1775
1781
|
};
|
|
@@ -1794,19 +1800,19 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1794
1800
|
r.set(e, t);
|
|
1795
1801
|
return t;
|
|
1796
1802
|
};
|
|
1797
|
-
const
|
|
1803
|
+
const s = wrapProjection(t);
|
|
1798
1804
|
i = computed(() => {
|
|
1799
1805
|
const t = getOwner();
|
|
1800
|
-
storeSetter(new Proxy(
|
|
1806
|
+
storeSetter(new Proxy(s, writeTraps), i => {
|
|
1801
1807
|
const r = handleAsync(t, e(i), e => {
|
|
1802
|
-
e !== i && e !== undefined && storeSetter(
|
|
1808
|
+
e !== i && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
|
|
1803
1809
|
setSignal(t, undefined);
|
|
1804
1810
|
});
|
|
1805
|
-
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(
|
|
1811
|
+
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(s);
|
|
1806
1812
|
});
|
|
1807
1813
|
});
|
|
1808
1814
|
i.Ce = true;
|
|
1809
|
-
return { store:
|
|
1815
|
+
return { store: s, node: i };
|
|
1810
1816
|
}
|
|
1811
1817
|
function createProjection(e, t = {}, n) {
|
|
1812
1818
|
return createProjectionInternal(e, t, n).store;
|
|
@@ -1893,7 +1899,7 @@ function getNodes(e, t) {
|
|
|
1893
1899
|
if (!n) e[t] = n = Object.create(null);
|
|
1894
1900
|
return n;
|
|
1895
1901
|
}
|
|
1896
|
-
function getNode(e, t, n, i, r = isEqual,
|
|
1902
|
+
function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
1897
1903
|
if (e[t]) return e[t];
|
|
1898
1904
|
const u = signal(
|
|
1899
1905
|
n,
|
|
@@ -1905,9 +1911,9 @@ function getNode(e, t, n, i, r = isEqual, o, s) {
|
|
|
1905
1911
|
},
|
|
1906
1912
|
i
|
|
1907
1913
|
);
|
|
1908
|
-
if (
|
|
1909
|
-
if (
|
|
1910
|
-
const e =
|
|
1914
|
+
if (s) u._e = true;
|
|
1915
|
+
if (o && t in o) {
|
|
1916
|
+
const e = o[t];
|
|
1911
1917
|
u.re = e === undefined ? NO_SNAPSHOT : e;
|
|
1912
1918
|
snapshotSources?.add(u);
|
|
1913
1919
|
}
|
|
@@ -1923,8 +1929,8 @@ function getKeys(e, t, n = true) {
|
|
|
1923
1929
|
const i = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
|
|
1924
1930
|
if (!t) return i;
|
|
1925
1931
|
const r = new Set(i);
|
|
1926
|
-
const
|
|
1927
|
-
for (const e of
|
|
1932
|
+
const s = Reflect.ownKeys(t);
|
|
1933
|
+
for (const e of s) {
|
|
1928
1934
|
if (t[e] !== $DELETED) r.add(e);
|
|
1929
1935
|
else r.delete(e);
|
|
1930
1936
|
}
|
|
@@ -1950,10 +1956,10 @@ const storeTraps = {
|
|
|
1950
1956
|
}
|
|
1951
1957
|
const i = getNodes(e, STORE_NODE);
|
|
1952
1958
|
const r = i[t];
|
|
1953
|
-
const
|
|
1954
|
-
const
|
|
1959
|
+
const s = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
|
|
1960
|
+
const o = s || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
|
|
1955
1961
|
const u = !!e[STORE_VALUE][$TARGET];
|
|
1956
|
-
const c =
|
|
1962
|
+
const c = s
|
|
1957
1963
|
? e[STORE_OPTIMISTIC_OVERRIDE]
|
|
1958
1964
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
1959
1965
|
? e[STORE_OVERRIDE]
|
|
@@ -1963,17 +1969,17 @@ const storeTraps = {
|
|
|
1963
1969
|
if (e && e.get) return e.get.call(n);
|
|
1964
1970
|
}
|
|
1965
1971
|
if (writeOnly(n)) {
|
|
1966
|
-
let n = r && (
|
|
1972
|
+
let n = r && (o || !u) ? (r.ae !== NOT_PENDING ? (r._e ? r.fe : r.ae) : r.fe) : c[t];
|
|
1967
1973
|
n === $DELETED && (n = undefined);
|
|
1968
1974
|
if (!isWrappable(n)) return n;
|
|
1969
1975
|
const i = wrap(n, e);
|
|
1970
1976
|
Writing?.add(i);
|
|
1971
1977
|
return i;
|
|
1972
1978
|
}
|
|
1973
|
-
let l = r ? (
|
|
1979
|
+
let l = r ? (o || !u ? read(i[t]) : (read(i[t]), c[t])) : c[t];
|
|
1974
1980
|
l === $DELETED && (l = undefined);
|
|
1975
1981
|
if (!r) {
|
|
1976
|
-
if (!
|
|
1982
|
+
if (!o && typeof l === "function" && !c.hasOwnProperty(t)) {
|
|
1977
1983
|
let t;
|
|
1978
1984
|
return !Array.isArray(e[STORE_VALUE]) &&
|
|
1979
1985
|
(t = Object.getPrototypeOf(e[STORE_VALUE])) &&
|
|
@@ -2019,29 +2025,29 @@ const storeTraps = {
|
|
|
2019
2025
|
}
|
|
2020
2026
|
untrack(() => {
|
|
2021
2027
|
const r = e[STORE_VALUE];
|
|
2022
|
-
const
|
|
2028
|
+
const s = r[t];
|
|
2023
2029
|
if (snapshotCaptureActive && typeof t !== "symbol") {
|
|
2024
2030
|
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2025
2031
|
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
2026
2032
|
snapshotSources?.add(e);
|
|
2027
2033
|
}
|
|
2028
2034
|
if (!(t in e[STORE_SNAPSHOT_PROPS])) {
|
|
2029
|
-
e[STORE_SNAPSHOT_PROPS][t] =
|
|
2035
|
+
e[STORE_SNAPSHOT_PROPS][t] = s;
|
|
2030
2036
|
}
|
|
2031
2037
|
}
|
|
2032
|
-
const
|
|
2033
|
-
const u =
|
|
2034
|
-
if (
|
|
2038
|
+
const o = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
2039
|
+
const u = o ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
2040
|
+
if (o) trackOptimisticStore(i);
|
|
2035
2041
|
const c =
|
|
2036
2042
|
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2037
2043
|
? e[STORE_OPTIMISTIC_OVERRIDE][t]
|
|
2038
2044
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2039
2045
|
? e[STORE_OVERRIDE][t]
|
|
2040
|
-
:
|
|
2046
|
+
: s;
|
|
2041
2047
|
const l = n?.[$TARGET]?.[STORE_VALUE] ?? n;
|
|
2042
2048
|
if (c === l) return true;
|
|
2043
2049
|
const a = e[STORE_OPTIMISTIC_OVERRIDE]?.length || e[STORE_OVERRIDE]?.length || r.length;
|
|
2044
|
-
if (l !== undefined && l ===
|
|
2050
|
+
if (l !== undefined && l === s) delete e[u][t];
|
|
2045
2051
|
else (e[u] || (e[u] = Object.create(null)))[t] = l;
|
|
2046
2052
|
const f = isWrappable(l);
|
|
2047
2053
|
if (isWrappable(c)) {
|
|
@@ -2089,9 +2095,9 @@ const storeTraps = {
|
|
|
2089
2095
|
t && (t instanceof Set ? t.delete(e) : PARENTS.delete(r));
|
|
2090
2096
|
}
|
|
2091
2097
|
if (e[STORE_HAS]?.[t]) setSignal(e[STORE_HAS][t], false);
|
|
2092
|
-
const
|
|
2093
|
-
|
|
2094
|
-
|
|
2098
|
+
const s = getNodes(e, STORE_NODE);
|
|
2099
|
+
s[t] && setSignal(s[t], undefined);
|
|
2100
|
+
s[$TRACK] && setSignal(s[$TRACK], undefined);
|
|
2095
2101
|
});
|
|
2096
2102
|
}
|
|
2097
2103
|
return true;
|
|
@@ -2202,8 +2208,8 @@ function recursivelyAddParent(e, t) {
|
|
|
2202
2208
|
const t = getKeys(e, n);
|
|
2203
2209
|
for (let i = 0; i < t.length; i++) {
|
|
2204
2210
|
const r = t[i];
|
|
2205
|
-
const
|
|
2206
|
-
isWrappable(
|
|
2211
|
+
const s = n && r in n ? n[r] : e[r];
|
|
2212
|
+
isWrappable(s) && recursivelyAddParent(s, e);
|
|
2207
2213
|
}
|
|
2208
2214
|
}
|
|
2209
2215
|
}
|
|
@@ -2215,9 +2221,9 @@ function createOptimisticStore(e, t, n) {
|
|
|
2215
2221
|
GlobalQueue.B ||= clearOptimisticStore;
|
|
2216
2222
|
const i = typeof e === "function";
|
|
2217
2223
|
const r = (i ? t : e) ?? {};
|
|
2218
|
-
const
|
|
2219
|
-
const { store:
|
|
2220
|
-
return [
|
|
2224
|
+
const s = i ? e : undefined;
|
|
2225
|
+
const { store: o } = createOptimisticProjectionInternal(s, r, n);
|
|
2226
|
+
return [o, e => storeSetter(o, e)];
|
|
2221
2227
|
}
|
|
2222
2228
|
function clearOptimisticStore(e) {
|
|
2223
2229
|
const t = e[$TARGET];
|
|
@@ -2267,22 +2273,22 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2267
2273
|
r.set(e, t);
|
|
2268
2274
|
return t;
|
|
2269
2275
|
};
|
|
2270
|
-
const
|
|
2276
|
+
const s = wrapProjection(t);
|
|
2271
2277
|
if (e) {
|
|
2272
2278
|
i = computed(() => {
|
|
2273
2279
|
const t = getOwner();
|
|
2274
2280
|
setProjectionWriteActive(true);
|
|
2275
2281
|
try {
|
|
2276
|
-
storeSetter(new Proxy(
|
|
2282
|
+
storeSetter(new Proxy(s, writeTraps), i => {
|
|
2277
2283
|
const r = handleAsync(t, e(i), e => {
|
|
2278
2284
|
setProjectionWriteActive(true);
|
|
2279
2285
|
try {
|
|
2280
|
-
e !== i && e !== undefined && storeSetter(
|
|
2286
|
+
e !== i && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
|
|
2281
2287
|
} finally {
|
|
2282
2288
|
setProjectionWriteActive(false);
|
|
2283
2289
|
}
|
|
2284
2290
|
});
|
|
2285
|
-
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(
|
|
2291
|
+
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(s);
|
|
2286
2292
|
});
|
|
2287
2293
|
} finally {
|
|
2288
2294
|
setProjectionWriteActive(false);
|
|
@@ -2290,19 +2296,19 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2290
2296
|
});
|
|
2291
2297
|
i.Ce = true;
|
|
2292
2298
|
}
|
|
2293
|
-
return { store:
|
|
2299
|
+
return { store: s, node: i };
|
|
2294
2300
|
}
|
|
2295
2301
|
function snapshot(e, t, n) {
|
|
2296
|
-
let i, r,
|
|
2302
|
+
let i, r, s, o, u, c;
|
|
2297
2303
|
if (!isWrappable(e)) return e;
|
|
2298
2304
|
if (t && t.has(e)) return t.get(e);
|
|
2299
2305
|
if (!t) t = new Map();
|
|
2300
2306
|
if ((i = e[$TARGET] || n?.get(e)?.[$TARGET])) {
|
|
2301
|
-
|
|
2307
|
+
s = i[STORE_OVERRIDE];
|
|
2302
2308
|
r = Array.isArray(i[STORE_VALUE]);
|
|
2303
2309
|
t.set(
|
|
2304
2310
|
e,
|
|
2305
|
-
|
|
2311
|
+
s ? (o = r ? [] : Object.create(Object.getPrototypeOf(i[STORE_VALUE]))) : i[STORE_VALUE]
|
|
2306
2312
|
);
|
|
2307
2313
|
e = i[STORE_VALUE];
|
|
2308
2314
|
n = storeLookup;
|
|
@@ -2311,32 +2317,32 @@ function snapshot(e, t, n) {
|
|
|
2311
2317
|
t.set(e, e);
|
|
2312
2318
|
}
|
|
2313
2319
|
if (r) {
|
|
2314
|
-
const i =
|
|
2320
|
+
const i = s?.length || e.length;
|
|
2315
2321
|
for (let r = 0; r < i; r++) {
|
|
2316
|
-
c =
|
|
2322
|
+
c = s && r in s ? s[r] : e[r];
|
|
2317
2323
|
if (c === $DELETED) continue;
|
|
2318
|
-
if ((u = snapshot(c, t, n)) !== c ||
|
|
2319
|
-
if (!
|
|
2320
|
-
|
|
2324
|
+
if ((u = snapshot(c, t, n)) !== c || o) {
|
|
2325
|
+
if (!o) t.set(e, (o = [...e]));
|
|
2326
|
+
o[r] = u;
|
|
2321
2327
|
}
|
|
2322
2328
|
}
|
|
2323
2329
|
} else {
|
|
2324
|
-
const i = getKeys(e,
|
|
2330
|
+
const i = getKeys(e, s);
|
|
2325
2331
|
for (let r = 0, l = i.length; r < l; r++) {
|
|
2326
2332
|
let l = i[r];
|
|
2327
|
-
const a = getPropertyDescriptor(e,
|
|
2333
|
+
const a = getPropertyDescriptor(e, s, l);
|
|
2328
2334
|
if (a.get) continue;
|
|
2329
|
-
c =
|
|
2330
|
-
if ((u = snapshot(c, t, n)) !== e[l] ||
|
|
2331
|
-
if (!
|
|
2332
|
-
|
|
2333
|
-
Object.assign(
|
|
2335
|
+
c = s && l in s ? s[l] : e[l];
|
|
2336
|
+
if ((u = snapshot(c, t, n)) !== e[l] || o) {
|
|
2337
|
+
if (!o) {
|
|
2338
|
+
o = Object.create(Object.getPrototypeOf(e));
|
|
2339
|
+
Object.assign(o, e);
|
|
2334
2340
|
}
|
|
2335
|
-
|
|
2341
|
+
o[l] = u;
|
|
2336
2342
|
}
|
|
2337
2343
|
}
|
|
2338
2344
|
}
|
|
2339
|
-
return
|
|
2345
|
+
return o || e;
|
|
2340
2346
|
}
|
|
2341
2347
|
function trueFn() {
|
|
2342
2348
|
return true;
|
|
@@ -2378,8 +2384,8 @@ function merge(...e) {
|
|
|
2378
2384
|
for (let i = 0; i < e.length; i++) {
|
|
2379
2385
|
const r = e[i];
|
|
2380
2386
|
t = t || (!!r && $PROXY in r);
|
|
2381
|
-
const
|
|
2382
|
-
if (
|
|
2387
|
+
const s = !!r && r[$SOURCES];
|
|
2388
|
+
if (s) n.push(...s);
|
|
2383
2389
|
else n.push(typeof r === "function" ? ((t = true), createMemo(r)) : r);
|
|
2384
2390
|
}
|
|
2385
2391
|
if (SUPPORTS_PROXY && t) {
|
|
@@ -2409,35 +2415,35 @@ function merge(...e) {
|
|
|
2409
2415
|
}
|
|
2410
2416
|
const i = Object.create(null);
|
|
2411
2417
|
let r = false;
|
|
2412
|
-
let
|
|
2413
|
-
for (let e =
|
|
2418
|
+
let s = n.length - 1;
|
|
2419
|
+
for (let e = s; e >= 0; e--) {
|
|
2414
2420
|
const t = n[e];
|
|
2415
2421
|
if (!t) {
|
|
2416
|
-
e ===
|
|
2422
|
+
e === s && s--;
|
|
2417
2423
|
continue;
|
|
2418
2424
|
}
|
|
2419
|
-
const
|
|
2420
|
-
for (let n =
|
|
2421
|
-
const u =
|
|
2425
|
+
const o = Object.getOwnPropertyNames(t);
|
|
2426
|
+
for (let n = o.length - 1; n >= 0; n--) {
|
|
2427
|
+
const u = o[n];
|
|
2422
2428
|
if (u === "__proto__" || u === "constructor") continue;
|
|
2423
2429
|
if (!i[u]) {
|
|
2424
|
-
r = r || e !==
|
|
2430
|
+
r = r || e !== s;
|
|
2425
2431
|
const n = Object.getOwnPropertyDescriptor(t, u);
|
|
2426
2432
|
i[u] = n.get ? { enumerable: true, configurable: true, get: n.get.bind(t) } : n;
|
|
2427
2433
|
}
|
|
2428
2434
|
}
|
|
2429
2435
|
}
|
|
2430
|
-
if (!r) return n[
|
|
2431
|
-
const
|
|
2436
|
+
if (!r) return n[s];
|
|
2437
|
+
const o = {};
|
|
2432
2438
|
const u = Object.keys(i);
|
|
2433
2439
|
for (let e = u.length - 1; e >= 0; e--) {
|
|
2434
2440
|
const t = u[e],
|
|
2435
2441
|
n = i[t];
|
|
2436
|
-
if (n.get) Object.defineProperty(
|
|
2437
|
-
else
|
|
2442
|
+
if (n.get) Object.defineProperty(o, t, n);
|
|
2443
|
+
else o[t] = n.value;
|
|
2438
2444
|
}
|
|
2439
|
-
|
|
2440
|
-
return
|
|
2445
|
+
o[$SOURCES] = n;
|
|
2446
|
+
return o;
|
|
2441
2447
|
}
|
|
2442
2448
|
function omit(e, ...t) {
|
|
2443
2449
|
const n = new Set(t);
|
|
@@ -2470,18 +2476,20 @@ function omit(e, ...t) {
|
|
|
2470
2476
|
}
|
|
2471
2477
|
function mapArray(e, t, n) {
|
|
2472
2478
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2479
|
+
const r = t.length > 1;
|
|
2480
|
+
const s = t;
|
|
2473
2481
|
return createMemo(
|
|
2474
2482
|
updateKeyedMap.bind({
|
|
2475
2483
|
Fe: createOwner(),
|
|
2476
2484
|
$e: 0,
|
|
2477
2485
|
je: e,
|
|
2478
2486
|
Ke: [],
|
|
2479
|
-
Ye:
|
|
2487
|
+
Ye: s,
|
|
2480
2488
|
Be: [],
|
|
2481
2489
|
Xe: [],
|
|
2482
2490
|
qe: i,
|
|
2483
2491
|
ze: i || n?.keyed === false ? [] : undefined,
|
|
2484
|
-
Ze:
|
|
2492
|
+
Ze: r ? [] : undefined,
|
|
2485
2493
|
Je: n?.fallback
|
|
2486
2494
|
})
|
|
2487
2495
|
);
|
|
@@ -2535,8 +2543,8 @@ function updateKeyedMap() {
|
|
|
2535
2543
|
}
|
|
2536
2544
|
this.$e = t;
|
|
2537
2545
|
} else {
|
|
2538
|
-
let
|
|
2539
|
-
|
|
2546
|
+
let s,
|
|
2547
|
+
o,
|
|
2540
2548
|
u,
|
|
2541
2549
|
c,
|
|
2542
2550
|
l,
|
|
@@ -2547,34 +2555,34 @@ function updateKeyedMap() {
|
|
|
2547
2555
|
d = this.ze ? new Array(t) : undefined,
|
|
2548
2556
|
S = this.Ze ? new Array(t) : undefined;
|
|
2549
2557
|
for (
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2558
|
+
s = 0, o = Math.min(this.$e, t);
|
|
2559
|
+
s < o && (this.Ke[s] === e[s] || (this.ze && compare(this.qe, this.Ke[s], e[s])));
|
|
2560
|
+
s++
|
|
2553
2561
|
) {
|
|
2554
|
-
if (this.ze) setSignal(this.ze[
|
|
2562
|
+
if (this.ze) setSignal(this.ze[s], e[s]);
|
|
2555
2563
|
}
|
|
2556
2564
|
for (
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
u >=
|
|
2560
|
-
(this.Ke[
|
|
2561
|
-
|
|
2565
|
+
o = this.$e - 1, u = t - 1;
|
|
2566
|
+
o >= s &&
|
|
2567
|
+
u >= s &&
|
|
2568
|
+
(this.Ke[o] === e[u] || (this.ze && compare(this.qe, this.Ke[o], e[u])));
|
|
2569
|
+
o--, u--
|
|
2562
2570
|
) {
|
|
2563
|
-
E[u] = this.Be[
|
|
2564
|
-
T[u] = this.Xe[
|
|
2565
|
-
d && (d[u] = this.ze[
|
|
2566
|
-
S && (S[u] = this.Ze[
|
|
2571
|
+
E[u] = this.Be[o];
|
|
2572
|
+
T[u] = this.Xe[o];
|
|
2573
|
+
d && (d[u] = this.ze[o]);
|
|
2574
|
+
S && (S[u] = this.Ze[o]);
|
|
2567
2575
|
}
|
|
2568
2576
|
a = new Map();
|
|
2569
2577
|
f = new Array(u + 1);
|
|
2570
|
-
for (i = u; i >=
|
|
2578
|
+
for (i = u; i >= s; i--) {
|
|
2571
2579
|
c = e[i];
|
|
2572
2580
|
l = this.qe ? this.qe(c) : c;
|
|
2573
2581
|
n = a.get(l);
|
|
2574
2582
|
f[i] = n === undefined ? -1 : n;
|
|
2575
2583
|
a.set(l, i);
|
|
2576
2584
|
}
|
|
2577
|
-
for (n =
|
|
2585
|
+
for (n = s; n <= o; n++) {
|
|
2578
2586
|
c = this.Ke[n];
|
|
2579
2587
|
l = this.qe ? this.qe(c) : c;
|
|
2580
2588
|
i = a.get(l);
|
|
@@ -2587,7 +2595,7 @@ function updateKeyedMap() {
|
|
|
2587
2595
|
a.set(l, i);
|
|
2588
2596
|
} else this.Xe[n].dispose();
|
|
2589
2597
|
}
|
|
2590
|
-
for (i =
|
|
2598
|
+
for (i = s; i < t; i++) {
|
|
2591
2599
|
if (i in E) {
|
|
2592
2600
|
this.Be[i] = E[i];
|
|
2593
2601
|
this.Xe[i] = T[i];
|
|
@@ -2610,12 +2618,13 @@ function updateKeyedMap() {
|
|
|
2610
2618
|
return this.Be;
|
|
2611
2619
|
}
|
|
2612
2620
|
function repeat(e, t, n) {
|
|
2621
|
+
const i = t;
|
|
2613
2622
|
return updateRepeat.bind({
|
|
2614
2623
|
Fe: createOwner(),
|
|
2615
2624
|
$e: 0,
|
|
2616
2625
|
et: 0,
|
|
2617
2626
|
tt: e,
|
|
2618
|
-
Ye:
|
|
2627
|
+
Ye: i,
|
|
2619
2628
|
Xe: [],
|
|
2620
2629
|
Be: [],
|
|
2621
2630
|
nt: n?.from,
|
|
@@ -2696,15 +2705,15 @@ function createBoundChildren(e, t, n, i) {
|
|
|
2696
2705
|
}
|
|
2697
2706
|
class CollectionQueue extends Queue {
|
|
2698
2707
|
rt;
|
|
2699
|
-
|
|
2700
|
-
|
|
2708
|
+
st = new Set();
|
|
2709
|
+
ot = signal(false, { pureWrite: true });
|
|
2701
2710
|
ut = false;
|
|
2702
2711
|
constructor(e) {
|
|
2703
2712
|
super();
|
|
2704
2713
|
this.rt = e;
|
|
2705
2714
|
}
|
|
2706
2715
|
run(e) {
|
|
2707
|
-
if (!e || read(this.
|
|
2716
|
+
if (!e || read(this.ot)) return;
|
|
2708
2717
|
return super.run(e);
|
|
2709
2718
|
}
|
|
2710
2719
|
notify(e, t, n, i) {
|
|
@@ -2712,46 +2721,46 @@ class CollectionQueue extends Queue {
|
|
|
2712
2721
|
if (n & this.rt) {
|
|
2713
2722
|
const t = i?.source || e.q?.source;
|
|
2714
2723
|
if (t) {
|
|
2715
|
-
const e = this.
|
|
2716
|
-
this.
|
|
2717
|
-
if (e) setSignal(this.
|
|
2724
|
+
const e = this.st.size === 0;
|
|
2725
|
+
this.st.add(t);
|
|
2726
|
+
if (e) setSignal(this.ot, true);
|
|
2718
2727
|
}
|
|
2719
2728
|
}
|
|
2720
2729
|
t &= ~this.rt;
|
|
2721
2730
|
return t ? super.notify(e, t, n, i) : true;
|
|
2722
2731
|
}
|
|
2723
2732
|
checkSources() {
|
|
2724
|
-
for (const e of this.
|
|
2725
|
-
if (!(e.Ee & this.rt)) this.
|
|
2733
|
+
for (const e of this.st) {
|
|
2734
|
+
if (!(e.Ee & this.rt)) this.st.delete(e);
|
|
2726
2735
|
}
|
|
2727
|
-
if (!this.
|
|
2736
|
+
if (!this.st.size) setSignal(this.ot, false);
|
|
2728
2737
|
}
|
|
2729
2738
|
}
|
|
2730
2739
|
function createCollectionBoundary(e, t, n) {
|
|
2731
2740
|
const i = createOwner();
|
|
2732
2741
|
const r = new CollectionQueue(e);
|
|
2733
|
-
const
|
|
2734
|
-
const
|
|
2735
|
-
if (!read(r.
|
|
2736
|
-
const e = read(
|
|
2737
|
-
if (!untrack(() => read(r.
|
|
2742
|
+
const s = createBoundChildren(i, t, r, e);
|
|
2743
|
+
const o = computed(() => {
|
|
2744
|
+
if (!read(r.ot)) {
|
|
2745
|
+
const e = read(s);
|
|
2746
|
+
if (!untrack(() => read(r.ot))) {
|
|
2738
2747
|
r.ut = true;
|
|
2739
2748
|
return e;
|
|
2740
2749
|
}
|
|
2741
2750
|
}
|
|
2742
2751
|
return n(r);
|
|
2743
2752
|
});
|
|
2744
|
-
return read.bind(null,
|
|
2753
|
+
return read.bind(null, o);
|
|
2745
2754
|
}
|
|
2746
2755
|
function createLoadBoundary(e, t) {
|
|
2747
2756
|
return createCollectionBoundary(STATUS_PENDING, e, () => t());
|
|
2748
2757
|
}
|
|
2749
2758
|
function createErrorBoundary(e, t) {
|
|
2750
2759
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2751
|
-
let n = e.
|
|
2760
|
+
let n = e.st.values().next().value;
|
|
2752
2761
|
const i = n.q?.cause ?? n.q;
|
|
2753
2762
|
return t(i, () => {
|
|
2754
|
-
for (const t of e.
|
|
2763
|
+
for (const t of e.st) recompute(t);
|
|
2755
2764
|
schedule();
|
|
2756
2765
|
});
|
|
2757
2766
|
});
|
|
@@ -2780,9 +2789,9 @@ function flatten(e, t) {
|
|
|
2780
2789
|
function flattenArray(e, t = [], n) {
|
|
2781
2790
|
let i = null;
|
|
2782
2791
|
let r = false;
|
|
2783
|
-
for (let
|
|
2792
|
+
for (let s = 0; s < e.length; s++) {
|
|
2784
2793
|
try {
|
|
2785
|
-
let i = e[
|
|
2794
|
+
let i = e[s];
|
|
2786
2795
|
if (typeof i === "function" && !i.length) {
|
|
2787
2796
|
if (n?.doNotUnwrap) {
|
|
2788
2797
|
t.push(i);
|
|
@@ -2858,6 +2867,7 @@ export {
|
|
|
2858
2867
|
runWithOwner,
|
|
2859
2868
|
setContext,
|
|
2860
2869
|
setSnapshotCapture,
|
|
2870
|
+
setStrictRead,
|
|
2861
2871
|
snapshot,
|
|
2862
2872
|
untrack
|
|
2863
2873
|
};
|