@solidjs/signals 0.10.1 → 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 +15 -3
- package/dist/node.cjs +216 -208
- package/dist/prod.js +184 -176
- 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/prod.js
CHANGED
|
@@ -815,11 +815,12 @@ function disposeChildren(e, t = false, n) {
|
|
|
815
815
|
} else {
|
|
816
816
|
e.Ce = null;
|
|
817
817
|
e.Ne = null;
|
|
818
|
+
e.ve = 0;
|
|
818
819
|
}
|
|
819
820
|
runDisposal(e, n);
|
|
820
821
|
}
|
|
821
822
|
function runDisposal(e, t) {
|
|
822
|
-
let n = t ? e.
|
|
823
|
+
let n = t ? e.we : e.be;
|
|
823
824
|
if (!n) return;
|
|
824
825
|
if (Array.isArray(n)) {
|
|
825
826
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -829,10 +830,12 @@ function runDisposal(e, t) {
|
|
|
829
830
|
} else {
|
|
830
831
|
n.call(n);
|
|
831
832
|
}
|
|
832
|
-
t ? (e.
|
|
833
|
+
t ? (e.we = null) : (e.be = null);
|
|
833
834
|
}
|
|
834
835
|
function getNextChildId(e) {
|
|
835
|
-
|
|
836
|
+
let t = e;
|
|
837
|
+
while (t.Ve && t.i) t = t.i;
|
|
838
|
+
if (t.id != null) return formatId(t.id, t.ve++);
|
|
836
839
|
throw new Error("Cannot get child id from owner without an id");
|
|
837
840
|
}
|
|
838
841
|
function formatId(e, t) {
|
|
@@ -849,40 +852,42 @@ function getOwner() {
|
|
|
849
852
|
}
|
|
850
853
|
function onCleanup(e) {
|
|
851
854
|
if (!context) return e;
|
|
852
|
-
if (!context.
|
|
853
|
-
else if (Array.isArray(context.
|
|
854
|
-
else context.
|
|
855
|
+
if (!context.be) context.be = e;
|
|
856
|
+
else if (Array.isArray(context.be)) context.be.push(e);
|
|
857
|
+
else context.be = [context.be, e];
|
|
855
858
|
return e;
|
|
856
859
|
}
|
|
857
860
|
function createOwner(e) {
|
|
858
861
|
const t = context;
|
|
859
|
-
const n =
|
|
860
|
-
|
|
862
|
+
const n = e?.transparent ?? false;
|
|
863
|
+
const i = {
|
|
864
|
+
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
865
|
+
Ve: n || undefined,
|
|
861
866
|
t: true,
|
|
862
867
|
u: t?.t ? t.u : t,
|
|
863
868
|
Ce: null,
|
|
864
869
|
Ne: null,
|
|
865
|
-
|
|
870
|
+
be: null,
|
|
866
871
|
se: t?.se ?? globalQueue,
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
872
|
+
me: t?.me || defaultContext,
|
|
873
|
+
ve: 0,
|
|
874
|
+
we: null,
|
|
870
875
|
De: null,
|
|
871
876
|
i: t,
|
|
872
877
|
dispose(e = true) {
|
|
873
|
-
disposeChildren(
|
|
878
|
+
disposeChildren(i, e);
|
|
874
879
|
}
|
|
875
880
|
};
|
|
876
881
|
if (t) {
|
|
877
882
|
const e = t.Ce;
|
|
878
883
|
if (e === null) {
|
|
879
|
-
t.Ce =
|
|
884
|
+
t.Ce = i;
|
|
880
885
|
} else {
|
|
881
|
-
|
|
882
|
-
t.Ce =
|
|
886
|
+
i.Ne = e;
|
|
887
|
+
t.Ce = i;
|
|
883
888
|
}
|
|
884
889
|
}
|
|
885
|
-
return
|
|
890
|
+
return i;
|
|
886
891
|
}
|
|
887
892
|
function createRoot(e, t) {
|
|
888
893
|
const n = createOwner(t);
|
|
@@ -892,15 +897,15 @@ function unlinkSubs(e) {
|
|
|
892
897
|
const t = e.V;
|
|
893
898
|
const n = e.D;
|
|
894
899
|
const i = e.p;
|
|
895
|
-
const r = e.
|
|
896
|
-
if (i !== null) i.
|
|
897
|
-
else t.
|
|
900
|
+
const r = e.Le;
|
|
901
|
+
if (i !== null) i.Le = r;
|
|
902
|
+
else t.ke = r;
|
|
898
903
|
if (r !== null) r.p = i;
|
|
899
904
|
else {
|
|
900
905
|
t.I = i;
|
|
901
906
|
if (i === null) {
|
|
902
|
-
t.
|
|
903
|
-
t.L && !t.
|
|
907
|
+
t.Ue?.();
|
|
908
|
+
t.L && !t.We && unobserved(t);
|
|
904
909
|
}
|
|
905
910
|
}
|
|
906
911
|
return n;
|
|
@@ -926,9 +931,9 @@ function link(e, t) {
|
|
|
926
931
|
return;
|
|
927
932
|
}
|
|
928
933
|
}
|
|
929
|
-
const o = e.
|
|
934
|
+
const o = e.ke;
|
|
930
935
|
if (o !== null && o.h === t && (!r || isValidLink(o, t))) return;
|
|
931
|
-
const s = (t.ye = e.
|
|
936
|
+
const s = (t.ye = e.ke = { V: e, h: t, D: i, Le: o, p: null });
|
|
932
937
|
if (n !== null) n.D = s;
|
|
933
938
|
else t.N = s;
|
|
934
939
|
if (o !== null) o.p = s;
|
|
@@ -965,10 +970,11 @@ function recompute(e, t = false) {
|
|
|
965
970
|
if (e.ne || n === EFFECT_TRACKED) disposeChildren(e);
|
|
966
971
|
else {
|
|
967
972
|
markDisposal(e);
|
|
968
|
-
e.
|
|
973
|
+
e.we = e.be;
|
|
969
974
|
e.De = e.Ce;
|
|
970
|
-
e.
|
|
975
|
+
e.be = null;
|
|
971
976
|
e.Ce = null;
|
|
977
|
+
e.ve = 0;
|
|
972
978
|
}
|
|
973
979
|
}
|
|
974
980
|
const i = !!(e.S & REACTIVE_OPTIMISTIC_DIRTY);
|
|
@@ -1072,15 +1078,17 @@ function updateIfNecessary(e) {
|
|
|
1072
1078
|
e.S = REACTIVE_NONE;
|
|
1073
1079
|
}
|
|
1074
1080
|
function computed(e, t, n) {
|
|
1075
|
-
const i =
|
|
1076
|
-
|
|
1081
|
+
const i = n?.transparent ?? false;
|
|
1082
|
+
const r = {
|
|
1083
|
+
id: n?.id ?? (i ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1084
|
+
Ve: i || undefined,
|
|
1077
1085
|
_e: n?.equals != null ? n.equals : isEqual,
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1086
|
+
xe: !!n?.pureWrite,
|
|
1087
|
+
Ue: n?.unobserved,
|
|
1088
|
+
be: null,
|
|
1081
1089
|
se: context?.se ?? globalQueue,
|
|
1082
|
-
|
|
1083
|
-
|
|
1090
|
+
me: context?.me ?? defaultContext,
|
|
1091
|
+
ve: 0,
|
|
1084
1092
|
L: e,
|
|
1085
1093
|
le: t,
|
|
1086
1094
|
o: 0,
|
|
@@ -1090,7 +1098,7 @@ function computed(e, t, n) {
|
|
|
1090
1098
|
N: null,
|
|
1091
1099
|
ye: null,
|
|
1092
1100
|
I: null,
|
|
1093
|
-
|
|
1101
|
+
ke: null,
|
|
1094
1102
|
i: context,
|
|
1095
1103
|
Ne: null,
|
|
1096
1104
|
Ce: null,
|
|
@@ -1098,34 +1106,34 @@ function computed(e, t, n) {
|
|
|
1098
1106
|
ae: STATUS_UNINITIALIZED,
|
|
1099
1107
|
J: clock,
|
|
1100
1108
|
ce: NOT_PENDING,
|
|
1101
|
-
|
|
1109
|
+
we: null,
|
|
1102
1110
|
De: null,
|
|
1103
1111
|
Se: null,
|
|
1104
1112
|
ne: null
|
|
1105
1113
|
};
|
|
1106
|
-
|
|
1107
|
-
const
|
|
1114
|
+
r.T = r;
|
|
1115
|
+
const o = context?.t ? context.u : context;
|
|
1108
1116
|
if (context) {
|
|
1109
1117
|
const e = context.Ce;
|
|
1110
1118
|
if (e === null) {
|
|
1111
|
-
context.Ce =
|
|
1119
|
+
context.Ce = r;
|
|
1112
1120
|
} else {
|
|
1113
|
-
|
|
1114
|
-
context.Ce =
|
|
1121
|
+
r.Ne = e;
|
|
1122
|
+
context.Ce = r;
|
|
1115
1123
|
}
|
|
1116
1124
|
}
|
|
1117
|
-
if (
|
|
1118
|
-
!n?.lazy && recompute(
|
|
1119
|
-
return
|
|
1125
|
+
if (o) r.o = o.o + 1;
|
|
1126
|
+
!n?.lazy && recompute(r, true);
|
|
1127
|
+
return r;
|
|
1120
1128
|
}
|
|
1121
1129
|
function signal(e, t, n = null) {
|
|
1122
1130
|
const i = {
|
|
1123
1131
|
_e: t?.equals != null ? t.equals : isEqual,
|
|
1124
|
-
|
|
1125
|
-
|
|
1132
|
+
xe: !!t?.pureWrite,
|
|
1133
|
+
Ue: t?.unobserved,
|
|
1126
1134
|
le: e,
|
|
1127
1135
|
I: null,
|
|
1128
|
-
|
|
1136
|
+
ke: null,
|
|
1129
1137
|
J: clock,
|
|
1130
1138
|
m: n,
|
|
1131
1139
|
P: n?.A || null,
|
|
@@ -1400,7 +1408,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1400
1408
|
if (!t) {
|
|
1401
1409
|
throw new NoOwnerError();
|
|
1402
1410
|
}
|
|
1403
|
-
const n = hasContext(e, t) ? t.
|
|
1411
|
+
const n = hasContext(e, t) ? t.me[e.id] : e.defaultValue;
|
|
1404
1412
|
if (isUndefined(n)) {
|
|
1405
1413
|
throw new ContextNotFoundError();
|
|
1406
1414
|
}
|
|
@@ -1410,10 +1418,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1410
1418
|
if (!n) {
|
|
1411
1419
|
throw new NoOwnerError();
|
|
1412
1420
|
}
|
|
1413
|
-
n.
|
|
1421
|
+
n.me = { ...n.me, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1414
1422
|
}
|
|
1415
1423
|
function hasContext(e, t) {
|
|
1416
|
-
return !isUndefined(t?.
|
|
1424
|
+
return !isUndefined(t?.me[e.id]);
|
|
1417
1425
|
}
|
|
1418
1426
|
function isUndefined(e) {
|
|
1419
1427
|
return typeof e === "undefined";
|
|
@@ -1697,7 +1705,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1697
1705
|
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(o);
|
|
1698
1706
|
});
|
|
1699
1707
|
});
|
|
1700
|
-
i.
|
|
1708
|
+
i.We = true;
|
|
1701
1709
|
return { store: o, node: i };
|
|
1702
1710
|
}
|
|
1703
1711
|
function createProjection(e, t = {}, n) {
|
|
@@ -2165,7 +2173,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2165
2173
|
setProjectionWriteActive(false);
|
|
2166
2174
|
}
|
|
2167
2175
|
});
|
|
2168
|
-
i.
|
|
2176
|
+
i.We = true;
|
|
2169
2177
|
}
|
|
2170
2178
|
return { store: o, node: i };
|
|
2171
2179
|
}
|
|
@@ -2349,68 +2357,68 @@ function mapArray(e, t, n) {
|
|
|
2349
2357
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2350
2358
|
return createMemo(
|
|
2351
2359
|
updateKeyedMap.bind({
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
He: [],
|
|
2360
|
+
Me: createOwner(),
|
|
2361
|
+
Fe: 0,
|
|
2362
|
+
Ge: e,
|
|
2363
|
+
$e: [],
|
|
2364
|
+
He: t,
|
|
2358
2365
|
je: [],
|
|
2359
|
-
Ke:
|
|
2360
|
-
Ye: i
|
|
2361
|
-
Be:
|
|
2362
|
-
Xe:
|
|
2366
|
+
Ke: [],
|
|
2367
|
+
Ye: i,
|
|
2368
|
+
Be: i || n?.keyed === false ? [] : undefined,
|
|
2369
|
+
Xe: t.length > 1 ? [] : undefined,
|
|
2370
|
+
qe: n?.fallback
|
|
2363
2371
|
})
|
|
2364
2372
|
);
|
|
2365
2373
|
}
|
|
2366
2374
|
const pureOptions = { pureWrite: true };
|
|
2367
2375
|
function updateKeyedMap() {
|
|
2368
|
-
const e = this.
|
|
2376
|
+
const e = this.Ge() || [],
|
|
2369
2377
|
t = e.length;
|
|
2370
2378
|
e[$TRACK];
|
|
2371
|
-
runWithOwner(this.
|
|
2379
|
+
runWithOwner(this.Me, () => {
|
|
2372
2380
|
let n,
|
|
2373
2381
|
i,
|
|
2374
|
-
r = this.
|
|
2382
|
+
r = this.Be
|
|
2375
2383
|
? () => {
|
|
2376
|
-
this.
|
|
2377
|
-
this.
|
|
2378
|
-
return this
|
|
2379
|
-
read.bind(null, this.
|
|
2380
|
-
this.
|
|
2384
|
+
this.Be[i] = signal(e[i], pureOptions);
|
|
2385
|
+
this.Xe && (this.Xe[i] = signal(i, pureOptions));
|
|
2386
|
+
return this.He(
|
|
2387
|
+
read.bind(null, this.Be[i]),
|
|
2388
|
+
this.Xe ? read.bind(null, this.Xe[i]) : undefined
|
|
2381
2389
|
);
|
|
2382
2390
|
}
|
|
2383
|
-
: this.
|
|
2391
|
+
: this.Xe
|
|
2384
2392
|
? () => {
|
|
2385
2393
|
const t = e[i];
|
|
2386
|
-
this.
|
|
2387
|
-
return this
|
|
2394
|
+
this.Xe[i] = signal(i, pureOptions);
|
|
2395
|
+
return this.He(() => t, read.bind(null, this.Xe[i]));
|
|
2388
2396
|
}
|
|
2389
2397
|
: () => {
|
|
2390
2398
|
const t = e[i];
|
|
2391
|
-
return this
|
|
2399
|
+
return this.He(() => t);
|
|
2392
2400
|
};
|
|
2393
2401
|
if (t === 0) {
|
|
2394
|
-
if (this.
|
|
2395
|
-
this.
|
|
2402
|
+
if (this.Fe !== 0) {
|
|
2403
|
+
this.Me.dispose(false);
|
|
2404
|
+
this.Ke = [];
|
|
2405
|
+
this.$e = [];
|
|
2396
2406
|
this.je = [];
|
|
2397
|
-
this.
|
|
2398
|
-
this.He = [];
|
|
2399
|
-
this.Me = 0;
|
|
2400
|
-
this.Ye && (this.Ye = []);
|
|
2407
|
+
this.Fe = 0;
|
|
2401
2408
|
this.Be && (this.Be = []);
|
|
2409
|
+
this.Xe && (this.Xe = []);
|
|
2402
2410
|
}
|
|
2403
|
-
if (this.
|
|
2404
|
-
this.
|
|
2411
|
+
if (this.qe && !this.je[0]) {
|
|
2412
|
+
this.je[0] = runWithOwner((this.Ke[0] = createOwner()), this.qe);
|
|
2405
2413
|
}
|
|
2406
|
-
} else if (this.
|
|
2407
|
-
if (this.
|
|
2408
|
-
this.
|
|
2414
|
+
} else if (this.Fe === 0) {
|
|
2415
|
+
if (this.Ke[0]) this.Ke[0].dispose();
|
|
2416
|
+
this.je = new Array(t);
|
|
2409
2417
|
for (i = 0; i < t; i++) {
|
|
2410
|
-
this
|
|
2411
|
-
this.
|
|
2418
|
+
this.$e[i] = e[i];
|
|
2419
|
+
this.je[i] = runWithOwner((this.Ke[i] = createOwner()), r);
|
|
2412
2420
|
}
|
|
2413
|
-
this.
|
|
2421
|
+
this.Fe = t;
|
|
2414
2422
|
} else {
|
|
2415
2423
|
let o,
|
|
2416
2424
|
s,
|
|
@@ -2421,130 +2429,130 @@ function updateKeyedMap() {
|
|
|
2421
2429
|
f,
|
|
2422
2430
|
E = new Array(t),
|
|
2423
2431
|
T = new Array(t),
|
|
2424
|
-
d = this.
|
|
2425
|
-
R = this.
|
|
2432
|
+
d = this.Be ? new Array(t) : undefined,
|
|
2433
|
+
R = this.Xe ? new Array(t) : undefined;
|
|
2426
2434
|
for (
|
|
2427
|
-
o = 0, s = Math.min(this.
|
|
2428
|
-
o < s && (this
|
|
2435
|
+
o = 0, s = Math.min(this.Fe, t);
|
|
2436
|
+
o < s && (this.$e[o] === e[o] || (this.Be && compare(this.Ye, this.$e[o], e[o])));
|
|
2429
2437
|
o++
|
|
2430
2438
|
) {
|
|
2431
|
-
if (this.
|
|
2439
|
+
if (this.Be) setSignal(this.Be[o], e[o]);
|
|
2432
2440
|
}
|
|
2433
2441
|
for (
|
|
2434
|
-
s = this.
|
|
2442
|
+
s = this.Fe - 1, u = t - 1;
|
|
2435
2443
|
s >= o &&
|
|
2436
2444
|
u >= o &&
|
|
2437
|
-
(this
|
|
2445
|
+
(this.$e[s] === e[u] || (this.Be && compare(this.Ye, this.$e[s], e[u])));
|
|
2438
2446
|
s--, u--
|
|
2439
2447
|
) {
|
|
2440
|
-
E[u] = this.
|
|
2441
|
-
T[u] = this.
|
|
2442
|
-
d && (d[u] = this.
|
|
2443
|
-
R && (R[u] = this.
|
|
2448
|
+
E[u] = this.je[s];
|
|
2449
|
+
T[u] = this.Ke[s];
|
|
2450
|
+
d && (d[u] = this.Be[s]);
|
|
2451
|
+
R && (R[u] = this.Xe[s]);
|
|
2444
2452
|
}
|
|
2445
2453
|
a = new Map();
|
|
2446
2454
|
f = new Array(u + 1);
|
|
2447
2455
|
for (i = u; i >= o; i--) {
|
|
2448
2456
|
c = e[i];
|
|
2449
|
-
l = this.
|
|
2457
|
+
l = this.Ye ? this.Ye(c) : c;
|
|
2450
2458
|
n = a.get(l);
|
|
2451
2459
|
f[i] = n === undefined ? -1 : n;
|
|
2452
2460
|
a.set(l, i);
|
|
2453
2461
|
}
|
|
2454
2462
|
for (n = o; n <= s; n++) {
|
|
2455
|
-
c = this
|
|
2456
|
-
l = this.
|
|
2463
|
+
c = this.$e[n];
|
|
2464
|
+
l = this.Ye ? this.Ye(c) : c;
|
|
2457
2465
|
i = a.get(l);
|
|
2458
2466
|
if (i !== undefined && i !== -1) {
|
|
2459
|
-
E[i] = this.
|
|
2460
|
-
T[i] = this.
|
|
2461
|
-
d && (d[i] = this.
|
|
2462
|
-
R && (R[i] = this.
|
|
2467
|
+
E[i] = this.je[n];
|
|
2468
|
+
T[i] = this.Ke[n];
|
|
2469
|
+
d && (d[i] = this.Be[n]);
|
|
2470
|
+
R && (R[i] = this.Xe[n]);
|
|
2463
2471
|
i = f[i];
|
|
2464
2472
|
a.set(l, i);
|
|
2465
|
-
} else this.
|
|
2473
|
+
} else this.Ke[n].dispose();
|
|
2466
2474
|
}
|
|
2467
2475
|
for (i = o; i < t; i++) {
|
|
2468
2476
|
if (i in E) {
|
|
2469
|
-
this.
|
|
2470
|
-
this.
|
|
2477
|
+
this.je[i] = E[i];
|
|
2478
|
+
this.Ke[i] = T[i];
|
|
2471
2479
|
if (d) {
|
|
2472
|
-
this.
|
|
2473
|
-
setSignal(this.
|
|
2480
|
+
this.Be[i] = d[i];
|
|
2481
|
+
setSignal(this.Be[i], e[i]);
|
|
2474
2482
|
}
|
|
2475
2483
|
if (R) {
|
|
2476
|
-
this.
|
|
2477
|
-
setSignal(this.
|
|
2484
|
+
this.Xe[i] = R[i];
|
|
2485
|
+
setSignal(this.Xe[i], i);
|
|
2478
2486
|
}
|
|
2479
2487
|
} else {
|
|
2480
|
-
this.
|
|
2488
|
+
this.je[i] = runWithOwner((this.Ke[i] = createOwner()), r);
|
|
2481
2489
|
}
|
|
2482
2490
|
}
|
|
2483
|
-
this.
|
|
2484
|
-
this
|
|
2491
|
+
this.je = this.je.slice(0, (this.Fe = t));
|
|
2492
|
+
this.$e = e.slice(0);
|
|
2485
2493
|
}
|
|
2486
2494
|
});
|
|
2487
|
-
return this.
|
|
2495
|
+
return this.je;
|
|
2488
2496
|
}
|
|
2489
2497
|
function repeat(e, t, n) {
|
|
2490
2498
|
return updateRepeat.bind({
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2499
|
+
Me: createOwner(),
|
|
2500
|
+
Fe: 0,
|
|
2501
|
+
ze: 0,
|
|
2502
|
+
Ze: e,
|
|
2503
|
+
He: t,
|
|
2504
|
+
Ke: [],
|
|
2496
2505
|
je: [],
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
Xe: n?.fallback
|
|
2506
|
+
Je: n?.from,
|
|
2507
|
+
qe: n?.fallback
|
|
2500
2508
|
});
|
|
2501
2509
|
}
|
|
2502
2510
|
function updateRepeat() {
|
|
2503
|
-
const e = this.
|
|
2504
|
-
const t = this.
|
|
2505
|
-
runWithOwner(this.
|
|
2511
|
+
const e = this.Ze();
|
|
2512
|
+
const t = this.Je?.() || 0;
|
|
2513
|
+
runWithOwner(this.Me, () => {
|
|
2506
2514
|
if (e === 0) {
|
|
2507
|
-
if (this.
|
|
2508
|
-
this.
|
|
2515
|
+
if (this.Fe !== 0) {
|
|
2516
|
+
this.Me.dispose(false);
|
|
2517
|
+
this.Ke = [];
|
|
2509
2518
|
this.je = [];
|
|
2510
|
-
this.
|
|
2511
|
-
this.Me = 0;
|
|
2519
|
+
this.Fe = 0;
|
|
2512
2520
|
}
|
|
2513
|
-
if (this.
|
|
2514
|
-
this.
|
|
2521
|
+
if (this.qe && !this.je[0]) {
|
|
2522
|
+
this.je[0] = runWithOwner((this.Ke[0] = createOwner()), this.qe);
|
|
2515
2523
|
}
|
|
2516
2524
|
return;
|
|
2517
2525
|
}
|
|
2518
2526
|
const n = t + e;
|
|
2519
|
-
const i = this.
|
|
2520
|
-
if (this.
|
|
2521
|
-
for (let e = n; e < i; e++) this.
|
|
2522
|
-
if (this.
|
|
2523
|
-
let e = this.
|
|
2524
|
-
while (e < t && e < this.
|
|
2525
|
-
this.
|
|
2526
|
-
this.
|
|
2527
|
-
} else if (this.
|
|
2528
|
-
let n = i - this.
|
|
2529
|
-
let r = this.
|
|
2530
|
-
this.
|
|
2527
|
+
const i = this.ze + this.Fe;
|
|
2528
|
+
if (this.Fe === 0 && this.Ke[0]) this.Ke[0].dispose();
|
|
2529
|
+
for (let e = n; e < i; e++) this.Ke[e - this.ze].dispose();
|
|
2530
|
+
if (this.ze < t) {
|
|
2531
|
+
let e = this.ze;
|
|
2532
|
+
while (e < t && e < this.Fe) this.Ke[e++].dispose();
|
|
2533
|
+
this.Ke.splice(0, t - this.ze);
|
|
2534
|
+
this.je.splice(0, t - this.ze);
|
|
2535
|
+
} else if (this.ze > t) {
|
|
2536
|
+
let n = i - this.ze - 1;
|
|
2537
|
+
let r = this.ze - t;
|
|
2538
|
+
this.Ke.length = this.je.length = e;
|
|
2531
2539
|
while (n >= r) {
|
|
2540
|
+
this.Ke[n] = this.Ke[n - r];
|
|
2532
2541
|
this.je[n] = this.je[n - r];
|
|
2533
|
-
this.He[n] = this.He[n - r];
|
|
2534
2542
|
n--;
|
|
2535
2543
|
}
|
|
2536
2544
|
for (let e = 0; e < r; e++) {
|
|
2537
|
-
this.
|
|
2545
|
+
this.je[e] = runWithOwner((this.Ke[e] = createOwner()), () => this.He(e + t));
|
|
2538
2546
|
}
|
|
2539
2547
|
}
|
|
2540
2548
|
for (let e = i; e < n; e++) {
|
|
2541
|
-
this.
|
|
2549
|
+
this.je[e - t] = runWithOwner((this.Ke[e - t] = createOwner()), () => this.He(e));
|
|
2542
2550
|
}
|
|
2543
|
-
this.
|
|
2544
|
-
this.
|
|
2545
|
-
this.
|
|
2551
|
+
this.je = this.je.slice(0, e);
|
|
2552
|
+
this.ze = t;
|
|
2553
|
+
this.Fe = e;
|
|
2546
2554
|
});
|
|
2547
|
-
return this.
|
|
2555
|
+
return this.je;
|
|
2548
2556
|
}
|
|
2549
2557
|
function compare(e, t, n) {
|
|
2550
2558
|
return e ? e(t) === e(n) : true;
|
|
@@ -2554,11 +2562,11 @@ function boundaryComputed(e, t) {
|
|
|
2554
2562
|
n.pe = (e, t) => {
|
|
2555
2563
|
const i = e !== undefined ? e : n.ae;
|
|
2556
2564
|
const r = t !== undefined ? t : n.q;
|
|
2557
|
-
n.ae &= ~n.
|
|
2558
|
-
n.se.notify(n, n.
|
|
2565
|
+
n.ae &= ~n.et;
|
|
2566
|
+
n.se.notify(n, n.et, i, r);
|
|
2559
2567
|
};
|
|
2560
|
-
n.
|
|
2561
|
-
n.
|
|
2568
|
+
n.et = t;
|
|
2569
|
+
n.We = true;
|
|
2562
2570
|
recompute(n, true);
|
|
2563
2571
|
return n;
|
|
2564
2572
|
}
|
|
@@ -2572,36 +2580,36 @@ function createBoundChildren(e, t, n, i) {
|
|
|
2572
2580
|
});
|
|
2573
2581
|
}
|
|
2574
2582
|
class CollectionQueue extends Queue {
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2583
|
+
tt;
|
|
2584
|
+
nt = new Set();
|
|
2585
|
+
it = signal(false, { pureWrite: true });
|
|
2586
|
+
rt = false;
|
|
2579
2587
|
constructor(e) {
|
|
2580
2588
|
super();
|
|
2581
|
-
this.
|
|
2589
|
+
this.tt = e;
|
|
2582
2590
|
}
|
|
2583
2591
|
run(e) {
|
|
2584
|
-
if (!e || read(this.
|
|
2592
|
+
if (!e || read(this.it)) return;
|
|
2585
2593
|
return super.run(e);
|
|
2586
2594
|
}
|
|
2587
2595
|
notify(e, t, n, i) {
|
|
2588
|
-
if (!(t & this.
|
|
2589
|
-
if (n & this.
|
|
2596
|
+
if (!(t & this.tt) || (this.tt & STATUS_PENDING && this.rt)) return super.notify(e, t, n, i);
|
|
2597
|
+
if (n & this.tt) {
|
|
2590
2598
|
const t = i?.source || e.q?.source;
|
|
2591
2599
|
if (t) {
|
|
2592
|
-
const e = this.
|
|
2593
|
-
this.
|
|
2594
|
-
if (e) setSignal(this.
|
|
2600
|
+
const e = this.nt.size === 0;
|
|
2601
|
+
this.nt.add(t);
|
|
2602
|
+
if (e) setSignal(this.it, true);
|
|
2595
2603
|
}
|
|
2596
2604
|
}
|
|
2597
|
-
t &= ~this.
|
|
2605
|
+
t &= ~this.tt;
|
|
2598
2606
|
return t ? super.notify(e, t, n, i) : true;
|
|
2599
2607
|
}
|
|
2600
2608
|
checkSources() {
|
|
2601
|
-
for (const e of this.
|
|
2602
|
-
if (!(e.ae & this.
|
|
2609
|
+
for (const e of this.nt) {
|
|
2610
|
+
if (!(e.ae & this.tt)) this.nt.delete(e);
|
|
2603
2611
|
}
|
|
2604
|
-
if (!this.
|
|
2612
|
+
if (!this.nt.size) setSignal(this.it, false);
|
|
2605
2613
|
}
|
|
2606
2614
|
}
|
|
2607
2615
|
function createCollectionBoundary(e, t, n) {
|
|
@@ -2609,10 +2617,10 @@ function createCollectionBoundary(e, t, n) {
|
|
|
2609
2617
|
const r = new CollectionQueue(e);
|
|
2610
2618
|
const o = createBoundChildren(i, t, r, e);
|
|
2611
2619
|
const s = computed(() => {
|
|
2612
|
-
if (!read(r.
|
|
2620
|
+
if (!read(r.it)) {
|
|
2613
2621
|
const e = read(o);
|
|
2614
|
-
if (!untrack(() => read(r.
|
|
2615
|
-
r.
|
|
2622
|
+
if (!untrack(() => read(r.it))) {
|
|
2623
|
+
r.rt = true;
|
|
2616
2624
|
return e;
|
|
2617
2625
|
}
|
|
2618
2626
|
}
|
|
@@ -2625,10 +2633,10 @@ function createLoadBoundary(e, t) {
|
|
|
2625
2633
|
}
|
|
2626
2634
|
function createErrorBoundary(e, t) {
|
|
2627
2635
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2628
|
-
let n = e.
|
|
2636
|
+
let n = e.nt.values().next().value;
|
|
2629
2637
|
const i = n.q?.cause ?? n.q;
|
|
2630
2638
|
return t(i, () => {
|
|
2631
|
-
for (const t of e.
|
|
2639
|
+
for (const t of e.nt) recompute(t);
|
|
2632
2640
|
schedule();
|
|
2633
2641
|
});
|
|
2634
2642
|
});
|
|
@@ -7,7 +7,8 @@ export declare function getObserver(): Owner | null;
|
|
|
7
7
|
export declare function getOwner(): Owner | null;
|
|
8
8
|
export declare function onCleanup(fn: Disposable): Disposable;
|
|
9
9
|
export declare function createOwner(options?: {
|
|
10
|
-
id
|
|
10
|
+
id?: string;
|
|
11
|
+
transparent?: boolean;
|
|
11
12
|
}): Root;
|
|
12
13
|
/**
|
|
13
14
|
* Creates a new non-tracked reactive context with manual disposal
|
|
@@ -18,5 +19,6 @@ export declare function createOwner(options?: {
|
|
|
18
19
|
* @description https://docs.solidjs.com/reference/reactive-utilities/create-root
|
|
19
20
|
*/
|
|
20
21
|
export declare function createRoot<T>(init: ((dispose: () => void) => T) | (() => T), options?: {
|
|
21
|
-
id
|
|
22
|
+
id?: string;
|
|
23
|
+
transparent?: boolean;
|
|
22
24
|
}): T;
|
|
@@ -14,6 +14,7 @@ export interface Link {
|
|
|
14
14
|
export interface NodeOptions<T> {
|
|
15
15
|
id?: string;
|
|
16
16
|
name?: string;
|
|
17
|
+
transparent?: boolean;
|
|
17
18
|
equals?: ((prev: T, next: T) => boolean) | false;
|
|
18
19
|
pureWrite?: boolean;
|
|
19
20
|
unobserved?: () => void;
|
|
@@ -43,6 +44,7 @@ export interface FirewallSignal<T> extends RawSignal<T> {
|
|
|
43
44
|
export type Signal<T> = RawSignal<T> | FirewallSignal<T>;
|
|
44
45
|
export interface Owner {
|
|
45
46
|
id?: string;
|
|
47
|
+
_transparent?: boolean;
|
|
46
48
|
_disposal: Disposable | Disposable[] | null;
|
|
47
49
|
_parent: Owner | null;
|
|
48
50
|
_context: Record<symbol | string, unknown>;
|