@solidjs/signals 0.10.2 → 0.10.3
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 +13 -3
- package/dist/node.cjs +201 -195
- package/dist/prod.js +169 -163
- package/dist/types/core/owner.d.ts +4 -2
- package/dist/types/core/types.d.ts +2 -0
- package/dist/types/signals.d.ts +2 -0
- package/package.json +2 -2
package/dist/node.cjs
CHANGED
|
@@ -139,8 +139,8 @@ function adjustHeight(e, t) {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
const m = new Set();
|
|
142
|
-
const b = { l: new Array(2e3).fill(undefined), _: false, W: 0, S: 0 };
|
|
143
142
|
const _ = { l: new Array(2e3).fill(undefined), _: false, W: 0, S: 0 };
|
|
143
|
+
const b = { l: new Array(2e3).fill(undefined), _: false, W: 0, S: 0 };
|
|
144
144
|
let O = 0;
|
|
145
145
|
let x = null;
|
|
146
146
|
let v = false;
|
|
@@ -238,12 +238,12 @@ class GlobalQueue extends Queue {
|
|
|
238
238
|
if (this.q) return;
|
|
239
239
|
this.q = true;
|
|
240
240
|
try {
|
|
241
|
-
runHeap(
|
|
241
|
+
runHeap(_, GlobalQueue.K);
|
|
242
242
|
if (x) {
|
|
243
243
|
const e = transitionComplete(x);
|
|
244
244
|
if (!e) {
|
|
245
245
|
let e = x;
|
|
246
|
-
runHeap(
|
|
246
|
+
runHeap(b, GlobalQueue.K);
|
|
247
247
|
this.D = [];
|
|
248
248
|
this.B = [];
|
|
249
249
|
this.G = new Set();
|
|
@@ -251,7 +251,7 @@ class GlobalQueue extends Queue {
|
|
|
251
251
|
runLaneEffects(p);
|
|
252
252
|
this.stashQueues(x.X);
|
|
253
253
|
O++;
|
|
254
|
-
v =
|
|
254
|
+
v = _.S >= _.W;
|
|
255
255
|
reassignPendingTransition(x.D);
|
|
256
256
|
x = null;
|
|
257
257
|
finalizePureQueue(null, true);
|
|
@@ -265,11 +265,11 @@ class GlobalQueue extends Queue {
|
|
|
265
265
|
reassignPendingTransition(this.D);
|
|
266
266
|
finalizePureQueue(t);
|
|
267
267
|
} else {
|
|
268
|
-
if (m.size) runHeap(
|
|
268
|
+
if (m.size) runHeap(b, GlobalQueue.K);
|
|
269
269
|
finalizePureQueue();
|
|
270
270
|
}
|
|
271
271
|
O++;
|
|
272
|
-
v =
|
|
272
|
+
v = _.S >= _.W;
|
|
273
273
|
runLaneEffects(d);
|
|
274
274
|
this.run(d);
|
|
275
275
|
runLaneEffects(p);
|
|
@@ -359,7 +359,7 @@ function insertSubs(e, t = false) {
|
|
|
359
359
|
}
|
|
360
360
|
continue;
|
|
361
361
|
}
|
|
362
|
-
const i = r.A.m & o ?
|
|
362
|
+
const i = r.A.m & o ? b : _;
|
|
363
363
|
if (i.W > r.A.o) i.W = r.A.o;
|
|
364
364
|
insertIntoHeap(r.A, i);
|
|
365
365
|
}
|
|
@@ -367,7 +367,7 @@ function insertSubs(e, t = false) {
|
|
|
367
367
|
function finalizePureQueue(e = null, t = false) {
|
|
368
368
|
let n = !t;
|
|
369
369
|
if (!t) checkBoundaryChildren(A);
|
|
370
|
-
if (
|
|
370
|
+
if (_.S >= _.W) runHeap(_, GlobalQueue.K);
|
|
371
371
|
if (n) {
|
|
372
372
|
const t = A.D;
|
|
373
373
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -641,7 +641,7 @@ function clearStatus(e) {
|
|
|
641
641
|
e.ce = e.ce & a;
|
|
642
642
|
e.Y = null;
|
|
643
643
|
updatePendingSignal(e);
|
|
644
|
-
e.
|
|
644
|
+
e._e?.();
|
|
645
645
|
}
|
|
646
646
|
function notifyStatus(e, t, n, r, i) {
|
|
647
647
|
if (t === c && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
@@ -665,11 +665,11 @@ function notifyStatus(e, t, n, r, i) {
|
|
|
665
665
|
}
|
|
666
666
|
const f = r || u;
|
|
667
667
|
const d = r || o ? undefined : i;
|
|
668
|
-
if (e.
|
|
668
|
+
if (e._e) {
|
|
669
669
|
if (f) {
|
|
670
|
-
e.
|
|
670
|
+
e._e(t, n);
|
|
671
671
|
} else {
|
|
672
|
-
e.
|
|
672
|
+
e._e();
|
|
673
673
|
}
|
|
674
674
|
return;
|
|
675
675
|
}
|
|
@@ -701,12 +701,12 @@ function effect(e, t, n, r, i) {
|
|
|
701
701
|
},
|
|
702
702
|
lazy: true
|
|
703
703
|
});
|
|
704
|
-
o.
|
|
704
|
+
o.be = r;
|
|
705
705
|
o.Oe = t;
|
|
706
706
|
o.xe = n;
|
|
707
707
|
o.ve = undefined;
|
|
708
708
|
o.ie = i?.render ? d : p;
|
|
709
|
-
o.
|
|
709
|
+
o._e = (e, t) => {
|
|
710
710
|
const n = e !== undefined ? e : o.ce;
|
|
711
711
|
const r = t !== undefined ? t : o.Y;
|
|
712
712
|
if (n & c) {
|
|
@@ -737,11 +737,11 @@ function runEffect() {
|
|
|
737
737
|
this.ve?.();
|
|
738
738
|
this.ve = undefined;
|
|
739
739
|
try {
|
|
740
|
-
this.ve = this.Oe(this.le, this.
|
|
740
|
+
this.ve = this.Oe(this.le, this.be);
|
|
741
741
|
} catch (e) {
|
|
742
742
|
if (!this.oe.notify(this, c, c)) throw e;
|
|
743
743
|
} finally {
|
|
744
|
-
this.
|
|
744
|
+
this.be = this.le;
|
|
745
745
|
this.se = false;
|
|
746
746
|
}
|
|
747
747
|
}
|
|
@@ -776,8 +776,8 @@ function markDisposal(e) {
|
|
|
776
776
|
while (t) {
|
|
777
777
|
t.m |= o;
|
|
778
778
|
if (t.m & i) {
|
|
779
|
-
deleteFromHeap(t,
|
|
780
|
-
insertIntoHeap(t,
|
|
779
|
+
deleteFromHeap(t, _);
|
|
780
|
+
insertIntoHeap(t, b);
|
|
781
781
|
}
|
|
782
782
|
markDisposal(t);
|
|
783
783
|
t = t.Ae;
|
|
@@ -800,7 +800,7 @@ function disposeChildren(e, t = false, n) {
|
|
|
800
800
|
const e = r.Ae;
|
|
801
801
|
if (r.j) {
|
|
802
802
|
const e = r;
|
|
803
|
-
deleteFromHeap(e, e.m & o ?
|
|
803
|
+
deleteFromHeap(e, e.m & o ? b : _);
|
|
804
804
|
let t = e.j;
|
|
805
805
|
do {
|
|
806
806
|
t = unlinkSubs(t);
|
|
@@ -834,7 +834,9 @@ function runDisposal(e, t) {
|
|
|
834
834
|
t ? (e.Ee = null) : (e.je = null);
|
|
835
835
|
}
|
|
836
836
|
function getNextChildId(e) {
|
|
837
|
-
|
|
837
|
+
let t = e;
|
|
838
|
+
while (t.Ne && t.i) t = t.i;
|
|
839
|
+
if (t.id != null) return formatId(t.id, t.We++);
|
|
838
840
|
throw new Error("Cannot get child id from owner without an id");
|
|
839
841
|
}
|
|
840
842
|
function formatId(e, t) {
|
|
@@ -858,33 +860,35 @@ function onCleanup(e) {
|
|
|
858
860
|
}
|
|
859
861
|
function createOwner(e) {
|
|
860
862
|
const t = Q;
|
|
861
|
-
const n =
|
|
862
|
-
|
|
863
|
+
const n = e?.transparent ?? false;
|
|
864
|
+
const r = {
|
|
865
|
+
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
866
|
+
Ne: n || undefined,
|
|
863
867
|
t: true,
|
|
864
868
|
u: t?.t ? t.u : t,
|
|
865
869
|
Pe: null,
|
|
866
870
|
Ae: null,
|
|
867
871
|
je: null,
|
|
868
872
|
oe: t?.oe ?? A,
|
|
869
|
-
|
|
873
|
+
Le: t?.Le || w,
|
|
870
874
|
We: 0,
|
|
871
875
|
Ee: null,
|
|
872
876
|
Ce: null,
|
|
873
877
|
i: t,
|
|
874
878
|
dispose(e = true) {
|
|
875
|
-
disposeChildren(
|
|
879
|
+
disposeChildren(r, e);
|
|
876
880
|
}
|
|
877
881
|
};
|
|
878
882
|
if (t) {
|
|
879
883
|
const e = t.Pe;
|
|
880
884
|
if (e === null) {
|
|
881
|
-
t.Pe =
|
|
885
|
+
t.Pe = r;
|
|
882
886
|
} else {
|
|
883
|
-
|
|
884
|
-
t.Pe =
|
|
887
|
+
r.Ae = e;
|
|
888
|
+
t.Pe = r;
|
|
885
889
|
}
|
|
886
890
|
}
|
|
887
|
-
return
|
|
891
|
+
return r;
|
|
888
892
|
}
|
|
889
893
|
function createRoot(e, t) {
|
|
890
894
|
const n = createOwner(t);
|
|
@@ -894,21 +898,21 @@ function unlinkSubs(e) {
|
|
|
894
898
|
const t = e.L;
|
|
895
899
|
const n = e.N;
|
|
896
900
|
const r = e.P;
|
|
897
|
-
const i = e.
|
|
898
|
-
if (r !== null) r.
|
|
899
|
-
else t.
|
|
901
|
+
const i = e.Ie;
|
|
902
|
+
if (r !== null) r.Ie = i;
|
|
903
|
+
else t.He = i;
|
|
900
904
|
if (i !== null) i.P = r;
|
|
901
905
|
else {
|
|
902
906
|
t.O = r;
|
|
903
907
|
if (r === null) {
|
|
904
|
-
t.
|
|
905
|
-
t.H && !t.
|
|
908
|
+
t.Qe?.();
|
|
909
|
+
t.H && !t.Re && unobserved(t);
|
|
906
910
|
}
|
|
907
911
|
}
|
|
908
912
|
return n;
|
|
909
913
|
}
|
|
910
914
|
function unobserved(e) {
|
|
911
|
-
deleteFromHeap(e, e.m & o ?
|
|
915
|
+
deleteFromHeap(e, e.m & o ? b : _);
|
|
912
916
|
let t = e.j;
|
|
913
917
|
while (t !== null) {
|
|
914
918
|
t = unlinkSubs(t);
|
|
@@ -928,9 +932,9 @@ function link(e, t) {
|
|
|
928
932
|
return;
|
|
929
933
|
}
|
|
930
934
|
}
|
|
931
|
-
const o = e.
|
|
935
|
+
const o = e.He;
|
|
932
936
|
if (o !== null && o.A === t && (!s || isValidLink(o, t))) return;
|
|
933
|
-
const u = (t.ke = e.
|
|
937
|
+
const u = (t.ke = e.He = { L: e, A: t, N: i, Ie: o, P: null });
|
|
934
938
|
if (n !== null) n.N = u;
|
|
935
939
|
else t.j = u;
|
|
936
940
|
if (o !== null) o.P = u;
|
|
@@ -962,7 +966,7 @@ function recompute(t, n = false) {
|
|
|
962
966
|
const i = t.ie;
|
|
963
967
|
if (!n) {
|
|
964
968
|
if (t.ne && (!i || x) && x !== t.ne) A.initTransition(t.ne);
|
|
965
|
-
deleteFromHeap(t, t.m & o ?
|
|
969
|
+
deleteFromHeap(t, t.m & o ? b : _);
|
|
966
970
|
if (t.ne || i === h) disposeChildren(t);
|
|
967
971
|
else {
|
|
968
972
|
markDisposal(t);
|
|
@@ -1047,7 +1051,7 @@ function recompute(t, n = false) {
|
|
|
1047
1051
|
t.fe = p;
|
|
1048
1052
|
} else if (t.o != g) {
|
|
1049
1053
|
for (let e = t.O; e !== null; e = e.P) {
|
|
1050
|
-
insertIntoHeapHeight(e.A, e.A.m & o ?
|
|
1054
|
+
insertIntoHeapHeight(e.A, e.A.m & o ? b : _);
|
|
1051
1055
|
}
|
|
1052
1056
|
}
|
|
1053
1057
|
}
|
|
@@ -1074,14 +1078,16 @@ function updateIfNecessary(r) {
|
|
|
1074
1078
|
r.m = e;
|
|
1075
1079
|
}
|
|
1076
1080
|
function computed(t, n, r) {
|
|
1077
|
-
const i =
|
|
1078
|
-
|
|
1081
|
+
const i = r?.transparent ?? false;
|
|
1082
|
+
const s = {
|
|
1083
|
+
id: r?.id ?? (i ? Q?.id : Q?.id != null ? getNextChildId(Q) : undefined),
|
|
1084
|
+
Ne: i || undefined,
|
|
1079
1085
|
Se: r?.equals != null ? r.equals : isEqual,
|
|
1080
|
-
|
|
1081
|
-
|
|
1086
|
+
Te: !!r?.pureWrite,
|
|
1087
|
+
Qe: r?.unobserved,
|
|
1082
1088
|
je: null,
|
|
1083
1089
|
oe: Q?.oe ?? A,
|
|
1084
|
-
|
|
1090
|
+
Le: Q?.Le ?? w,
|
|
1085
1091
|
We: 0,
|
|
1086
1092
|
H: t,
|
|
1087
1093
|
le: n,
|
|
@@ -1092,7 +1098,7 @@ function computed(t, n, r) {
|
|
|
1092
1098
|
j: null,
|
|
1093
1099
|
ke: null,
|
|
1094
1100
|
O: null,
|
|
1095
|
-
|
|
1101
|
+
He: null,
|
|
1096
1102
|
i: Q,
|
|
1097
1103
|
Ae: null,
|
|
1098
1104
|
Pe: null,
|
|
@@ -1105,29 +1111,29 @@ function computed(t, n, r) {
|
|
|
1105
1111
|
we: null,
|
|
1106
1112
|
ne: null
|
|
1107
1113
|
};
|
|
1108
|
-
|
|
1109
|
-
const
|
|
1114
|
+
s.p = s;
|
|
1115
|
+
const o = Q?.t ? Q.u : Q;
|
|
1110
1116
|
if (Q) {
|
|
1111
1117
|
const e = Q.Pe;
|
|
1112
1118
|
if (e === null) {
|
|
1113
|
-
Q.Pe =
|
|
1119
|
+
Q.Pe = s;
|
|
1114
1120
|
} else {
|
|
1115
|
-
|
|
1116
|
-
Q.Pe =
|
|
1121
|
+
s.Ae = e;
|
|
1122
|
+
Q.Pe = s;
|
|
1117
1123
|
}
|
|
1118
1124
|
}
|
|
1119
|
-
if (
|
|
1120
|
-
!r?.lazy && recompute(
|
|
1121
|
-
return
|
|
1125
|
+
if (o) s.o = o.o + 1;
|
|
1126
|
+
!r?.lazy && recompute(s, true);
|
|
1127
|
+
return s;
|
|
1122
1128
|
}
|
|
1123
1129
|
function signal(e, t, n = null) {
|
|
1124
1130
|
const r = {
|
|
1125
1131
|
Se: t?.equals != null ? t.equals : isEqual,
|
|
1126
|
-
|
|
1127
|
-
|
|
1132
|
+
Te: !!t?.pureWrite,
|
|
1133
|
+
Qe: t?.unobserved,
|
|
1128
1134
|
le: e,
|
|
1129
1135
|
O: null,
|
|
1130
|
-
|
|
1136
|
+
He: null,
|
|
1131
1137
|
$: O,
|
|
1132
1138
|
I: n,
|
|
1133
1139
|
C: n?.k || null,
|
|
@@ -1195,9 +1201,9 @@ function read(e) {
|
|
|
1195
1201
|
const n = e.I || e;
|
|
1196
1202
|
if (n.H) {
|
|
1197
1203
|
const r = e.m & o;
|
|
1198
|
-
if (n.o >= (r ?
|
|
1204
|
+
if (n.o >= (r ? b.W : _.W)) {
|
|
1199
1205
|
markNode(t);
|
|
1200
|
-
markHeap(r ?
|
|
1206
|
+
markHeap(r ? b : _);
|
|
1201
1207
|
updateIfNecessary(n);
|
|
1202
1208
|
}
|
|
1203
1209
|
const i = n.o;
|
|
@@ -1282,14 +1288,14 @@ function runWithOwner(e, t) {
|
|
|
1282
1288
|
}
|
|
1283
1289
|
}
|
|
1284
1290
|
function getPendingSignal(e) {
|
|
1285
|
-
if (!e.
|
|
1286
|
-
e.
|
|
1291
|
+
if (!e.Me) {
|
|
1292
|
+
e.Me = optimisticSignal(false, { pureWrite: true });
|
|
1287
1293
|
if (e.de) {
|
|
1288
|
-
e.
|
|
1294
|
+
e.Me.de = e;
|
|
1289
1295
|
}
|
|
1290
|
-
if (computePendingState(e)) setSignal(e.
|
|
1296
|
+
if (computePendingState(e)) setSignal(e.Me, true);
|
|
1291
1297
|
}
|
|
1292
|
-
return e.
|
|
1298
|
+
return e.Me;
|
|
1293
1299
|
}
|
|
1294
1300
|
function computePendingState(e) {
|
|
1295
1301
|
const t = e;
|
|
@@ -1305,9 +1311,9 @@ function computePendingState(e) {
|
|
|
1305
1311
|
return !!(t.ce & l && !(t.ce & a));
|
|
1306
1312
|
}
|
|
1307
1313
|
function updatePendingSignal(e) {
|
|
1308
|
-
if (e.
|
|
1314
|
+
if (e.Me) {
|
|
1309
1315
|
const t = computePendingState(e);
|
|
1310
|
-
const n = e.
|
|
1316
|
+
const n = e.Me;
|
|
1311
1317
|
setSignal(n, t);
|
|
1312
1318
|
if (!t && n.re) {
|
|
1313
1319
|
const t = resolveLane(e);
|
|
@@ -1397,7 +1403,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1397
1403
|
if (!t) {
|
|
1398
1404
|
throw new NoOwnerError();
|
|
1399
1405
|
}
|
|
1400
|
-
const n = hasContext(e, t) ? t.
|
|
1406
|
+
const n = hasContext(e, t) ? t.Le[e.id] : e.defaultValue;
|
|
1401
1407
|
if (isUndefined(n)) {
|
|
1402
1408
|
throw new ContextNotFoundError();
|
|
1403
1409
|
}
|
|
@@ -1407,10 +1413,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1407
1413
|
if (!n) {
|
|
1408
1414
|
throw new NoOwnerError();
|
|
1409
1415
|
}
|
|
1410
|
-
n.
|
|
1416
|
+
n.Le = { ...n.Le, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1411
1417
|
}
|
|
1412
1418
|
function hasContext(e, t) {
|
|
1413
|
-
return !isUndefined(t?.
|
|
1419
|
+
return !isUndefined(t?.Le[e.id]);
|
|
1414
1420
|
}
|
|
1415
1421
|
function isUndefined(e) {
|
|
1416
1422
|
return typeof e === "undefined";
|
|
@@ -1692,7 +1698,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1692
1698
|
i !== r && i !== undefined && reconcile(i, n?.key || "id", n?.all)(s);
|
|
1693
1699
|
});
|
|
1694
1700
|
});
|
|
1695
|
-
r.
|
|
1701
|
+
r.Re = true;
|
|
1696
1702
|
return { store: s, node: r };
|
|
1697
1703
|
}
|
|
1698
1704
|
function createProjection(e, t = {}, n) {
|
|
@@ -2120,7 +2126,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2120
2126
|
setProjectionWriteActive(false);
|
|
2121
2127
|
}
|
|
2122
2128
|
});
|
|
2123
|
-
r.
|
|
2129
|
+
r.Re = true;
|
|
2124
2130
|
}
|
|
2125
2131
|
return { store: s, node: r };
|
|
2126
2132
|
}
|
|
@@ -2301,68 +2307,68 @@ function mapArray(e, t, n) {
|
|
|
2301
2307
|
const r = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2302
2308
|
return createMemo(
|
|
2303
2309
|
updateKeyedMap.bind({
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
Be: [],
|
|
2310
|
+
qe: createOwner(),
|
|
2311
|
+
Fe: 0,
|
|
2312
|
+
Ve: e,
|
|
2313
|
+
De: [],
|
|
2314
|
+
Be: t,
|
|
2310
2315
|
Ge: [],
|
|
2311
|
-
Ke:
|
|
2312
|
-
ze: r
|
|
2313
|
-
Ue:
|
|
2314
|
-
Je:
|
|
2316
|
+
Ke: [],
|
|
2317
|
+
ze: r,
|
|
2318
|
+
Ue: r || n?.keyed === false ? [] : undefined,
|
|
2319
|
+
Je: t.length > 1 ? [] : undefined,
|
|
2320
|
+
Xe: n?.fallback
|
|
2315
2321
|
})
|
|
2316
2322
|
);
|
|
2317
2323
|
}
|
|
2318
2324
|
const oe = { pureWrite: true };
|
|
2319
2325
|
function updateKeyedMap() {
|
|
2320
|
-
const e = this.
|
|
2326
|
+
const e = this.Ve() || [],
|
|
2321
2327
|
t = e.length;
|
|
2322
2328
|
e[M];
|
|
2323
|
-
runWithOwner(this.
|
|
2329
|
+
runWithOwner(this.qe, () => {
|
|
2324
2330
|
let n,
|
|
2325
2331
|
r,
|
|
2326
|
-
i = this.
|
|
2332
|
+
i = this.Ue
|
|
2327
2333
|
? () => {
|
|
2328
|
-
this.
|
|
2329
|
-
this.
|
|
2330
|
-
return this.
|
|
2331
|
-
read.bind(null, this.
|
|
2332
|
-
this.
|
|
2334
|
+
this.Ue[r] = signal(e[r], oe);
|
|
2335
|
+
this.Je && (this.Je[r] = signal(r, oe));
|
|
2336
|
+
return this.Be(
|
|
2337
|
+
read.bind(null, this.Ue[r]),
|
|
2338
|
+
this.Je ? read.bind(null, this.Je[r]) : undefined
|
|
2333
2339
|
);
|
|
2334
2340
|
}
|
|
2335
|
-
: this.
|
|
2341
|
+
: this.Je
|
|
2336
2342
|
? () => {
|
|
2337
2343
|
const t = e[r];
|
|
2338
|
-
this.
|
|
2339
|
-
return this.
|
|
2344
|
+
this.Je[r] = signal(r, oe);
|
|
2345
|
+
return this.Be(() => t, read.bind(null, this.Je[r]));
|
|
2340
2346
|
}
|
|
2341
2347
|
: () => {
|
|
2342
2348
|
const t = e[r];
|
|
2343
|
-
return this.
|
|
2349
|
+
return this.Be(() => t);
|
|
2344
2350
|
};
|
|
2345
2351
|
if (t === 0) {
|
|
2346
|
-
if (this.
|
|
2347
|
-
this.
|
|
2352
|
+
if (this.Fe !== 0) {
|
|
2353
|
+
this.qe.dispose(false);
|
|
2354
|
+
this.Ke = [];
|
|
2355
|
+
this.De = [];
|
|
2348
2356
|
this.Ge = [];
|
|
2349
|
-
this.
|
|
2350
|
-
this.Be = [];
|
|
2351
|
-
this.qe = 0;
|
|
2352
|
-
this.ze && (this.ze = []);
|
|
2357
|
+
this.Fe = 0;
|
|
2353
2358
|
this.Ue && (this.Ue = []);
|
|
2359
|
+
this.Je && (this.Je = []);
|
|
2354
2360
|
}
|
|
2355
|
-
if (this.
|
|
2356
|
-
this.
|
|
2361
|
+
if (this.Xe && !this.Ge[0]) {
|
|
2362
|
+
this.Ge[0] = runWithOwner((this.Ke[0] = createOwner()), this.Xe);
|
|
2357
2363
|
}
|
|
2358
|
-
} else if (this.
|
|
2359
|
-
if (this.
|
|
2360
|
-
this.
|
|
2364
|
+
} else if (this.Fe === 0) {
|
|
2365
|
+
if (this.Ke[0]) this.Ke[0].dispose();
|
|
2366
|
+
this.Ge = new Array(t);
|
|
2361
2367
|
for (r = 0; r < t; r++) {
|
|
2362
|
-
this.
|
|
2363
|
-
this.
|
|
2368
|
+
this.De[r] = e[r];
|
|
2369
|
+
this.Ge[r] = runWithOwner((this.Ke[r] = createOwner()), i);
|
|
2364
2370
|
}
|
|
2365
|
-
this.
|
|
2371
|
+
this.Fe = t;
|
|
2366
2372
|
} else {
|
|
2367
2373
|
let s,
|
|
2368
2374
|
o,
|
|
@@ -2373,144 +2379,144 @@ function updateKeyedMap() {
|
|
|
2373
2379
|
a,
|
|
2374
2380
|
d = new Array(t),
|
|
2375
2381
|
p = new Array(t),
|
|
2376
|
-
h = this.
|
|
2377
|
-
y = this.
|
|
2382
|
+
h = this.Ue ? new Array(t) : undefined,
|
|
2383
|
+
y = this.Je ? new Array(t) : undefined;
|
|
2378
2384
|
for (
|
|
2379
|
-
s = 0, o = Math.min(this.
|
|
2380
|
-
s < o && (this.
|
|
2385
|
+
s = 0, o = Math.min(this.Fe, t);
|
|
2386
|
+
s < o && (this.De[s] === e[s] || (this.Ue && compare(this.ze, this.De[s], e[s])));
|
|
2381
2387
|
s++
|
|
2382
2388
|
) {
|
|
2383
|
-
if (this.
|
|
2389
|
+
if (this.Ue) setSignal(this.Ue[s], e[s]);
|
|
2384
2390
|
}
|
|
2385
2391
|
for (
|
|
2386
|
-
o = this.
|
|
2392
|
+
o = this.Fe - 1, u = t - 1;
|
|
2387
2393
|
o >= s &&
|
|
2388
2394
|
u >= s &&
|
|
2389
|
-
(this.
|
|
2395
|
+
(this.De[o] === e[u] || (this.Ue && compare(this.ze, this.De[o], e[u])));
|
|
2390
2396
|
o--, u--
|
|
2391
2397
|
) {
|
|
2392
|
-
d[u] = this.
|
|
2393
|
-
p[u] = this.
|
|
2394
|
-
h && (h[u] = this.
|
|
2395
|
-
y && (y[u] = this.
|
|
2398
|
+
d[u] = this.Ge[o];
|
|
2399
|
+
p[u] = this.Ke[o];
|
|
2400
|
+
h && (h[u] = this.Ue[o]);
|
|
2401
|
+
y && (y[u] = this.Je[o]);
|
|
2396
2402
|
}
|
|
2397
2403
|
c = new Map();
|
|
2398
2404
|
a = new Array(u + 1);
|
|
2399
2405
|
for (r = u; r >= s; r--) {
|
|
2400
2406
|
f = e[r];
|
|
2401
|
-
l = this.
|
|
2407
|
+
l = this.ze ? this.ze(f) : f;
|
|
2402
2408
|
n = c.get(l);
|
|
2403
2409
|
a[r] = n === undefined ? -1 : n;
|
|
2404
2410
|
c.set(l, r);
|
|
2405
2411
|
}
|
|
2406
2412
|
for (n = s; n <= o; n++) {
|
|
2407
|
-
f = this.
|
|
2408
|
-
l = this.
|
|
2413
|
+
f = this.De[n];
|
|
2414
|
+
l = this.ze ? this.ze(f) : f;
|
|
2409
2415
|
r = c.get(l);
|
|
2410
2416
|
if (r !== undefined && r !== -1) {
|
|
2411
|
-
d[r] = this.
|
|
2412
|
-
p[r] = this.
|
|
2413
|
-
h && (h[r] = this.
|
|
2414
|
-
y && (y[r] = this.
|
|
2417
|
+
d[r] = this.Ge[n];
|
|
2418
|
+
p[r] = this.Ke[n];
|
|
2419
|
+
h && (h[r] = this.Ue[n]);
|
|
2420
|
+
y && (y[r] = this.Je[n]);
|
|
2415
2421
|
r = a[r];
|
|
2416
2422
|
c.set(l, r);
|
|
2417
|
-
} else this.
|
|
2423
|
+
} else this.Ke[n].dispose();
|
|
2418
2424
|
}
|
|
2419
2425
|
for (r = s; r < t; r++) {
|
|
2420
2426
|
if (r in d) {
|
|
2421
|
-
this.
|
|
2422
|
-
this.
|
|
2427
|
+
this.Ge[r] = d[r];
|
|
2428
|
+
this.Ke[r] = p[r];
|
|
2423
2429
|
if (h) {
|
|
2424
|
-
this.
|
|
2425
|
-
setSignal(this.
|
|
2430
|
+
this.Ue[r] = h[r];
|
|
2431
|
+
setSignal(this.Ue[r], e[r]);
|
|
2426
2432
|
}
|
|
2427
2433
|
if (y) {
|
|
2428
|
-
this.
|
|
2429
|
-
setSignal(this.
|
|
2434
|
+
this.Je[r] = y[r];
|
|
2435
|
+
setSignal(this.Je[r], r);
|
|
2430
2436
|
}
|
|
2431
2437
|
} else {
|
|
2432
|
-
this.
|
|
2438
|
+
this.Ge[r] = runWithOwner((this.Ke[r] = createOwner()), i);
|
|
2433
2439
|
}
|
|
2434
2440
|
}
|
|
2435
|
-
this.
|
|
2436
|
-
this.
|
|
2441
|
+
this.Ge = this.Ge.slice(0, (this.Fe = t));
|
|
2442
|
+
this.De = e.slice(0);
|
|
2437
2443
|
}
|
|
2438
2444
|
});
|
|
2439
|
-
return this.
|
|
2445
|
+
return this.Ge;
|
|
2440
2446
|
}
|
|
2441
2447
|
function repeat(e, t, n) {
|
|
2442
2448
|
return updateRepeat.bind({
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2449
|
+
qe: createOwner(),
|
|
2450
|
+
Fe: 0,
|
|
2451
|
+
Ye: 0,
|
|
2452
|
+
Ze: e,
|
|
2453
|
+
Be: t,
|
|
2454
|
+
Ke: [],
|
|
2448
2455
|
Ge: [],
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
Je: n?.fallback
|
|
2456
|
+
$e: n?.from,
|
|
2457
|
+
Xe: n?.fallback
|
|
2452
2458
|
});
|
|
2453
2459
|
}
|
|
2454
2460
|
function updateRepeat() {
|
|
2455
|
-
const e = this.
|
|
2456
|
-
const t = this
|
|
2457
|
-
runWithOwner(this.
|
|
2461
|
+
const e = this.Ze();
|
|
2462
|
+
const t = this.$e?.() || 0;
|
|
2463
|
+
runWithOwner(this.qe, () => {
|
|
2458
2464
|
if (e === 0) {
|
|
2459
|
-
if (this.
|
|
2460
|
-
this.
|
|
2465
|
+
if (this.Fe !== 0) {
|
|
2466
|
+
this.qe.dispose(false);
|
|
2467
|
+
this.Ke = [];
|
|
2461
2468
|
this.Ge = [];
|
|
2462
|
-
this.
|
|
2463
|
-
this.qe = 0;
|
|
2469
|
+
this.Fe = 0;
|
|
2464
2470
|
}
|
|
2465
|
-
if (this.
|
|
2466
|
-
this.
|
|
2471
|
+
if (this.Xe && !this.Ge[0]) {
|
|
2472
|
+
this.Ge[0] = runWithOwner((this.Ke[0] = createOwner()), this.Xe);
|
|
2467
2473
|
}
|
|
2468
2474
|
return;
|
|
2469
2475
|
}
|
|
2470
2476
|
const n = t + e;
|
|
2471
|
-
const r = this.
|
|
2472
|
-
if (this.
|
|
2473
|
-
for (let e = n; e < r; e++) this.
|
|
2474
|
-
if (this.
|
|
2475
|
-
let e = this.
|
|
2476
|
-
while (e < t && e < this.
|
|
2477
|
-
this.
|
|
2478
|
-
this.
|
|
2479
|
-
} else if (this.
|
|
2480
|
-
let n = r - this.
|
|
2481
|
-
let i = this.
|
|
2482
|
-
this.
|
|
2477
|
+
const r = this.Ye + this.Fe;
|
|
2478
|
+
if (this.Fe === 0 && this.Ke[0]) this.Ke[0].dispose();
|
|
2479
|
+
for (let e = n; e < r; e++) this.Ke[e - this.Ye].dispose();
|
|
2480
|
+
if (this.Ye < t) {
|
|
2481
|
+
let e = this.Ye;
|
|
2482
|
+
while (e < t && e < this.Fe) this.Ke[e++].dispose();
|
|
2483
|
+
this.Ke.splice(0, t - this.Ye);
|
|
2484
|
+
this.Ge.splice(0, t - this.Ye);
|
|
2485
|
+
} else if (this.Ye > t) {
|
|
2486
|
+
let n = r - this.Ye - 1;
|
|
2487
|
+
let i = this.Ye - t;
|
|
2488
|
+
this.Ke.length = this.Ge.length = e;
|
|
2483
2489
|
while (n >= i) {
|
|
2490
|
+
this.Ke[n] = this.Ke[n - i];
|
|
2484
2491
|
this.Ge[n] = this.Ge[n - i];
|
|
2485
|
-
this.Be[n] = this.Be[n - i];
|
|
2486
2492
|
n--;
|
|
2487
2493
|
}
|
|
2488
2494
|
for (let e = 0; e < i; e++) {
|
|
2489
|
-
this.
|
|
2495
|
+
this.Ge[e] = runWithOwner((this.Ke[e] = createOwner()), () => this.Be(e + t));
|
|
2490
2496
|
}
|
|
2491
2497
|
}
|
|
2492
2498
|
for (let e = r; e < n; e++) {
|
|
2493
|
-
this.
|
|
2499
|
+
this.Ge[e - t] = runWithOwner((this.Ke[e - t] = createOwner()), () => this.Be(e));
|
|
2494
2500
|
}
|
|
2495
|
-
this.
|
|
2496
|
-
this.
|
|
2497
|
-
this.
|
|
2501
|
+
this.Ge = this.Ge.slice(0, e);
|
|
2502
|
+
this.Ye = t;
|
|
2503
|
+
this.Fe = e;
|
|
2498
2504
|
});
|
|
2499
|
-
return this.
|
|
2505
|
+
return this.Ge;
|
|
2500
2506
|
}
|
|
2501
2507
|
function compare(e, t, n) {
|
|
2502
2508
|
return e ? e(t) === e(n) : true;
|
|
2503
2509
|
}
|
|
2504
2510
|
function boundaryComputed(e, t) {
|
|
2505
2511
|
const n = computed(e, undefined, { lazy: true });
|
|
2506
|
-
n.
|
|
2512
|
+
n._e = (e, t) => {
|
|
2507
2513
|
const r = e !== undefined ? e : n.ce;
|
|
2508
2514
|
const i = t !== undefined ? t : n.Y;
|
|
2509
|
-
n.ce &= ~n
|
|
2510
|
-
n.oe.notify(n, n
|
|
2515
|
+
n.ce &= ~n.et;
|
|
2516
|
+
n.oe.notify(n, n.et, r, i);
|
|
2511
2517
|
};
|
|
2512
|
-
n
|
|
2513
|
-
n.
|
|
2518
|
+
n.et = t;
|
|
2519
|
+
n.Re = true;
|
|
2514
2520
|
recompute(n, true);
|
|
2515
2521
|
return n;
|
|
2516
2522
|
}
|
|
@@ -2524,36 +2530,36 @@ function createBoundChildren(e, t, n, r) {
|
|
|
2524
2530
|
});
|
|
2525
2531
|
}
|
|
2526
2532
|
class CollectionQueue extends Queue {
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2533
|
+
tt;
|
|
2534
|
+
nt = new Set();
|
|
2535
|
+
rt = signal(false, { pureWrite: true });
|
|
2536
|
+
it = false;
|
|
2531
2537
|
constructor(e) {
|
|
2532
2538
|
super();
|
|
2533
|
-
this.
|
|
2539
|
+
this.tt = e;
|
|
2534
2540
|
}
|
|
2535
2541
|
run(e) {
|
|
2536
|
-
if (!e || read(this.
|
|
2542
|
+
if (!e || read(this.rt)) return;
|
|
2537
2543
|
return super.run(e);
|
|
2538
2544
|
}
|
|
2539
2545
|
notify(e, t, n, r) {
|
|
2540
|
-
if (!(t & this.
|
|
2541
|
-
if (n & this.
|
|
2546
|
+
if (!(t & this.tt) || (this.tt & l && this.it)) return super.notify(e, t, n, r);
|
|
2547
|
+
if (n & this.tt) {
|
|
2542
2548
|
const t = r?.source || e.Y?.source;
|
|
2543
2549
|
if (t) {
|
|
2544
|
-
const e = this.
|
|
2545
|
-
this.
|
|
2546
|
-
if (e) setSignal(this.
|
|
2550
|
+
const e = this.nt.size === 0;
|
|
2551
|
+
this.nt.add(t);
|
|
2552
|
+
if (e) setSignal(this.rt, true);
|
|
2547
2553
|
}
|
|
2548
2554
|
}
|
|
2549
|
-
t &= ~this.
|
|
2555
|
+
t &= ~this.tt;
|
|
2550
2556
|
return t ? super.notify(e, t, n, r) : true;
|
|
2551
2557
|
}
|
|
2552
2558
|
checkSources() {
|
|
2553
|
-
for (const e of this.
|
|
2554
|
-
if (!(e.ce & this.
|
|
2559
|
+
for (const e of this.nt) {
|
|
2560
|
+
if (!(e.ce & this.tt)) this.nt.delete(e);
|
|
2555
2561
|
}
|
|
2556
|
-
if (!this.
|
|
2562
|
+
if (!this.nt.size) setSignal(this.rt, false);
|
|
2557
2563
|
}
|
|
2558
2564
|
}
|
|
2559
2565
|
function createCollectionBoundary(e, t, n) {
|
|
@@ -2561,10 +2567,10 @@ function createCollectionBoundary(e, t, n) {
|
|
|
2561
2567
|
const i = new CollectionQueue(e);
|
|
2562
2568
|
const s = createBoundChildren(r, t, i, e);
|
|
2563
2569
|
const o = computed(() => {
|
|
2564
|
-
if (!read(i.
|
|
2570
|
+
if (!read(i.rt)) {
|
|
2565
2571
|
const e = read(s);
|
|
2566
|
-
if (!untrack(() => read(i.
|
|
2567
|
-
i.
|
|
2572
|
+
if (!untrack(() => read(i.rt))) {
|
|
2573
|
+
i.it = true;
|
|
2568
2574
|
return e;
|
|
2569
2575
|
}
|
|
2570
2576
|
}
|
|
@@ -2577,10 +2583,10 @@ function createLoadBoundary(e, t) {
|
|
|
2577
2583
|
}
|
|
2578
2584
|
function createErrorBoundary(e, t) {
|
|
2579
2585
|
return createCollectionBoundary(c, e, e => {
|
|
2580
|
-
let n = e.
|
|
2586
|
+
let n = e.nt.values().next().value;
|
|
2581
2587
|
const r = n.Y?.cause ?? n.Y;
|
|
2582
2588
|
return t(r, () => {
|
|
2583
|
-
for (const t of e.
|
|
2589
|
+
for (const t of e.nt) recompute(t);
|
|
2584
2590
|
schedule();
|
|
2585
2591
|
});
|
|
2586
2592
|
});
|