@solidjs/signals 0.13.8 → 0.13.9
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 +2 -2
- package/dist/node.cjs +10 -10
- package/dist/prod.js +59 -59
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -1361,7 +1361,7 @@ function updateIfNecessary(el) {
|
|
|
1361
1361
|
) {
|
|
1362
1362
|
recompute(el);
|
|
1363
1363
|
}
|
|
1364
|
-
el._flags =
|
|
1364
|
+
el._flags = el._flags & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
|
|
1365
1365
|
}
|
|
1366
1366
|
function computed(fn, initialValue, options) {
|
|
1367
1367
|
const transparent = options?.transparent ?? false;
|
|
@@ -1606,7 +1606,7 @@ function read(el) {
|
|
|
1606
1606
|
}
|
|
1607
1607
|
if (el._fn && el._statusFlags & STATUS_ERROR) {
|
|
1608
1608
|
if (el._time < clock) {
|
|
1609
|
-
recompute(el
|
|
1609
|
+
recompute(el);
|
|
1610
1610
|
return read(el);
|
|
1611
1611
|
} else throw el._error;
|
|
1612
1612
|
}
|
package/dist/node.cjs
CHANGED
|
@@ -1264,23 +1264,23 @@ function recompute(t, n = false) {
|
|
|
1264
1264
|
(!n || t.ge & a) && !t.K && !(k && u) && A.se.push(t);
|
|
1265
1265
|
t.K && i && k !== t.K && runInTransition(t.K, () => recompute(t));
|
|
1266
1266
|
}
|
|
1267
|
-
function updateIfNecessary(
|
|
1268
|
-
if (
|
|
1269
|
-
for (let
|
|
1270
|
-
const
|
|
1271
|
-
const i =
|
|
1267
|
+
function updateIfNecessary(e) {
|
|
1268
|
+
if (e.m & t) {
|
|
1269
|
+
for (let t = e.A; t; t = t.N) {
|
|
1270
|
+
const r = t.L;
|
|
1271
|
+
const i = r.I || r;
|
|
1272
1272
|
if (i.R) {
|
|
1273
1273
|
updateIfNecessary(i);
|
|
1274
1274
|
}
|
|
1275
|
-
if (
|
|
1275
|
+
if (e.m & n) {
|
|
1276
1276
|
break;
|
|
1277
1277
|
}
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
|
-
if (
|
|
1281
|
-
recompute(
|
|
1280
|
+
if (e.m & (n | f) || (e.ae && e.de < E && !e.Ee)) {
|
|
1281
|
+
recompute(e);
|
|
1282
1282
|
}
|
|
1283
|
-
|
|
1283
|
+
e.m = e.m & (c | i | s);
|
|
1284
1284
|
}
|
|
1285
1285
|
function computed(t, n, r) {
|
|
1286
1286
|
const i = r?.transparent ?? false;
|
|
@@ -1485,7 +1485,7 @@ function read(e) {
|
|
|
1485
1485
|
}
|
|
1486
1486
|
if (e.R && e.ge & d) {
|
|
1487
1487
|
if (e.de < E) {
|
|
1488
|
-
recompute(e
|
|
1488
|
+
recompute(e);
|
|
1489
1489
|
return read(e);
|
|
1490
1490
|
} else throw e.ae;
|
|
1491
1491
|
}
|
package/dist/prod.js
CHANGED
|
@@ -424,9 +424,9 @@ class GlobalQueue extends Queue {
|
|
|
424
424
|
}
|
|
425
425
|
function insertSubs(e, t = false) {
|
|
426
426
|
const n = e.q || currentOptimisticLane;
|
|
427
|
-
const i = e.
|
|
427
|
+
const i = e.Te !== undefined;
|
|
428
428
|
for (let r = e.I; r !== null; r = r.p) {
|
|
429
|
-
if (i && r.h.
|
|
429
|
+
if (i && r.h.de) {
|
|
430
430
|
r.h.O |= REACTIVE_SNAPSHOT_STALE;
|
|
431
431
|
continue;
|
|
432
432
|
}
|
|
@@ -1143,7 +1143,7 @@ function releaseSubtree(e) {
|
|
|
1143
1143
|
}
|
|
1144
1144
|
if (t.L) {
|
|
1145
1145
|
const e = t;
|
|
1146
|
-
e.
|
|
1146
|
+
e.de = false;
|
|
1147
1147
|
if (e.O & REACTIVE_SNAPSHOT_STALE) {
|
|
1148
1148
|
e.O &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1149
1149
|
e.O |= REACTIVE_DIRTY;
|
|
@@ -1158,7 +1158,7 @@ function releaseSubtree(e) {
|
|
|
1158
1158
|
function clearSnapshots() {
|
|
1159
1159
|
if (snapshotSources) {
|
|
1160
1160
|
for (const e of snapshotSources) {
|
|
1161
|
-
delete e.
|
|
1161
|
+
delete e.Te;
|
|
1162
1162
|
delete e[STORE_SNAPSHOT_PROPS];
|
|
1163
1163
|
}
|
|
1164
1164
|
snapshotSources = null;
|
|
@@ -1280,7 +1280,7 @@ function updateIfNecessary(e) {
|
|
|
1280
1280
|
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.le && e.Ee < clock && !e.Ce)) {
|
|
1281
1281
|
recompute(e);
|
|
1282
1282
|
}
|
|
1283
|
-
e.O =
|
|
1283
|
+
e.O = e.O & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
|
|
1284
1284
|
}
|
|
1285
1285
|
function computed(e, t, n) {
|
|
1286
1286
|
const i = n?.transparent ?? false;
|
|
@@ -1328,7 +1328,7 @@ function computed(e, t, n) {
|
|
|
1328
1328
|
}
|
|
1329
1329
|
}
|
|
1330
1330
|
if (s) r.o = s.o + 1;
|
|
1331
|
-
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.
|
|
1331
|
+
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.de = true;
|
|
1332
1332
|
if (externalSourceConfig) {
|
|
1333
1333
|
const e = signal(undefined, { equals: false, pureWrite: true });
|
|
1334
1334
|
const t = externalSourceConfig.factory(r.L, () => {
|
|
@@ -1343,7 +1343,7 @@ function computed(e, t, n) {
|
|
|
1343
1343
|
!n?.lazy && recompute(r, true);
|
|
1344
1344
|
if (snapshotCaptureActive && !n?.lazy) {
|
|
1345
1345
|
if (!(r.Se & STATUS_PENDING)) {
|
|
1346
|
-
r.
|
|
1346
|
+
r.Te = r.J === undefined ? NO_SNAPSHOT : r.J;
|
|
1347
1347
|
snapshotSources.add(r);
|
|
1348
1348
|
}
|
|
1349
1349
|
}
|
|
@@ -1365,7 +1365,7 @@ function signal(e, t, n = null) {
|
|
|
1365
1365
|
};
|
|
1366
1366
|
n && (n.A = i);
|
|
1367
1367
|
if (snapshotCaptureActive && !i.He && !((n?.Se ?? 0) & STATUS_PENDING)) {
|
|
1368
|
-
i.
|
|
1368
|
+
i.Te = e === undefined ? NO_SNAPSHOT : e;
|
|
1369
1369
|
snapshotSources.add(i);
|
|
1370
1370
|
}
|
|
1371
1371
|
return i;
|
|
@@ -1485,12 +1485,12 @@ function read(e) {
|
|
|
1485
1485
|
}
|
|
1486
1486
|
if (e.L && e.Se & STATUS_ERROR) {
|
|
1487
1487
|
if (e.Ee < clock) {
|
|
1488
|
-
recompute(e
|
|
1488
|
+
recompute(e);
|
|
1489
1489
|
return read(e);
|
|
1490
1490
|
} else throw e.le;
|
|
1491
1491
|
}
|
|
1492
|
-
if (snapshotCaptureActive && t && t.
|
|
1493
|
-
const n = e.
|
|
1492
|
+
if (snapshotCaptureActive && t && t.de) {
|
|
1493
|
+
const n = e.Te;
|
|
1494
1494
|
if (n !== undefined) {
|
|
1495
1495
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1496
1496
|
const r = e.X !== NOT_PENDING ? e.X : e.J;
|
|
@@ -1947,28 +1947,28 @@ function applyState(e, t, n) {
|
|
|
1947
1947
|
let t = false;
|
|
1948
1948
|
const c = getOverrideValue(r, s, u, "length", o);
|
|
1949
1949
|
if (e.length && c && e[0] && n(e[0]) != null) {
|
|
1950
|
-
let a, f, l, E,
|
|
1950
|
+
let a, f, l, E, T, d, S, R;
|
|
1951
1951
|
for (
|
|
1952
1952
|
l = 0, E = Math.min(c, e.length);
|
|
1953
1953
|
l < E &&
|
|
1954
|
-
((
|
|
1954
|
+
((d = getOverrideValue(r, s, u, l, o)) === e[l] || (d && e[l] && n(d) === n(e[l])));
|
|
1955
1955
|
l++
|
|
1956
1956
|
) {
|
|
1957
|
-
applyState(e[l], wrap(
|
|
1957
|
+
applyState(e[l], wrap(d, i), n);
|
|
1958
1958
|
}
|
|
1959
1959
|
const O = new Array(e.length),
|
|
1960
1960
|
_ = new Map();
|
|
1961
1961
|
for (
|
|
1962
|
-
E = c - 1,
|
|
1962
|
+
E = c - 1, T = e.length - 1;
|
|
1963
1963
|
E >= l &&
|
|
1964
|
-
|
|
1965
|
-
((
|
|
1966
|
-
E--,
|
|
1964
|
+
T >= l &&
|
|
1965
|
+
((d = getOverrideValue(r, s, u, E, o)) === e[T] || (d && e[T] && n(d) === n(e[T])));
|
|
1966
|
+
E--, T--
|
|
1967
1967
|
) {
|
|
1968
|
-
O[
|
|
1968
|
+
O[T] = d;
|
|
1969
1969
|
}
|
|
1970
|
-
if (l >
|
|
1971
|
-
for (f = l; f <=
|
|
1970
|
+
if (l > T || l > E) {
|
|
1971
|
+
for (f = l; f <= T; f++) {
|
|
1972
1972
|
t = true;
|
|
1973
1973
|
i[STORE_NODE][f] && setSignal(i[STORE_NODE][f], wrap(e[f], i));
|
|
1974
1974
|
}
|
|
@@ -1982,20 +1982,20 @@ function applyState(e, t, n) {
|
|
|
1982
1982
|
c !== e.length && i[STORE_NODE].length && setSignal(i[STORE_NODE].length, e.length);
|
|
1983
1983
|
return;
|
|
1984
1984
|
}
|
|
1985
|
-
S = new Array(
|
|
1986
|
-
for (f =
|
|
1987
|
-
|
|
1988
|
-
R =
|
|
1985
|
+
S = new Array(T + 1);
|
|
1986
|
+
for (f = T; f >= l; f--) {
|
|
1987
|
+
d = e[f];
|
|
1988
|
+
R = d ? n(d) : d;
|
|
1989
1989
|
a = _.get(R);
|
|
1990
1990
|
S[f] = a === undefined ? -1 : a;
|
|
1991
1991
|
_.set(R, f);
|
|
1992
1992
|
}
|
|
1993
1993
|
for (a = l; a <= E; a++) {
|
|
1994
|
-
|
|
1995
|
-
R =
|
|
1994
|
+
d = getOverrideValue(r, s, u, a, o);
|
|
1995
|
+
R = d ? n(d) : d;
|
|
1996
1996
|
f = _.get(R);
|
|
1997
1997
|
if (f !== undefined && f !== -1) {
|
|
1998
|
-
O[f] =
|
|
1998
|
+
O[f] = d;
|
|
1999
1999
|
f = S[f];
|
|
2000
2000
|
_.set(R, f);
|
|
2001
2001
|
}
|
|
@@ -2030,12 +2030,12 @@ function applyState(e, t, n) {
|
|
|
2030
2030
|
const f = c[a];
|
|
2031
2031
|
const l = u[f];
|
|
2032
2032
|
const E = unwrap(getOverrideValue(r, s, u, f, o));
|
|
2033
|
-
let
|
|
2034
|
-
if (E ===
|
|
2035
|
-
if (!E || !isWrappable(E) || !isWrappable(
|
|
2033
|
+
let T = unwrap(e[f]);
|
|
2034
|
+
if (E === T) continue;
|
|
2035
|
+
if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
|
|
2036
2036
|
t && setSignal(t, void 0);
|
|
2037
|
-
l && setSignal(l, isWrappable(
|
|
2038
|
-
} else applyState(
|
|
2037
|
+
l && setSignal(l, isWrappable(T) ? wrap(T, i) : T);
|
|
2038
|
+
} else applyState(T, wrap(E, i), n);
|
|
2039
2039
|
}
|
|
2040
2040
|
}
|
|
2041
2041
|
if ((u = i[STORE_HAS])) {
|
|
@@ -2219,7 +2219,7 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
|
2219
2219
|
}
|
|
2220
2220
|
if (o && t in o) {
|
|
2221
2221
|
const e = o[t];
|
|
2222
|
-
u.
|
|
2222
|
+
u.Te = e === undefined ? NO_SNAPSHOT : e;
|
|
2223
2223
|
snapshotSources?.add(u);
|
|
2224
2224
|
}
|
|
2225
2225
|
return (e[t] = u);
|
|
@@ -2374,20 +2374,20 @@ const storeTraps = {
|
|
|
2374
2374
|
: e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
|
|
2375
2375
|
? e[STORE_OVERRIDE].length
|
|
2376
2376
|
: r.length);
|
|
2377
|
-
const
|
|
2378
|
-
if (c === a &&
|
|
2379
|
-
if (a !== undefined && a === s &&
|
|
2377
|
+
const T = f && l > E ? l : undefined;
|
|
2378
|
+
if (c === a && T === undefined) return true;
|
|
2379
|
+
if (a !== undefined && a === s && T === undefined) delete e[u]?.[t];
|
|
2380
2380
|
else {
|
|
2381
2381
|
const n = e[u] || (e[u] = Object.create(null));
|
|
2382
2382
|
n[t] = a;
|
|
2383
|
-
if (
|
|
2383
|
+
if (T !== undefined) n.length = T;
|
|
2384
2384
|
}
|
|
2385
|
-
const
|
|
2385
|
+
const d = isWrappable(a);
|
|
2386
2386
|
e[STORE_HAS]?.[t] && setSignal(e[STORE_HAS][t], true);
|
|
2387
2387
|
const S = getNodes(e, STORE_NODE);
|
|
2388
|
-
S[t] && setSignal(S[t], () => (
|
|
2388
|
+
S[t] && setSignal(S[t], () => (d ? wrap(a, e) : a));
|
|
2389
2389
|
if (Array.isArray(r)) {
|
|
2390
|
-
const e = t === "length" ? a :
|
|
2390
|
+
const e = t === "length" ? a : T;
|
|
2391
2391
|
e !== undefined && S.length && setSignal(S.length, e);
|
|
2392
2392
|
}
|
|
2393
2393
|
S[$TRACK] && setSignal(S[$TRACK], undefined);
|
|
@@ -2894,8 +2894,8 @@ function updateKeyedMap() {
|
|
|
2894
2894
|
f,
|
|
2895
2895
|
l,
|
|
2896
2896
|
E = new Array(t),
|
|
2897
|
-
|
|
2898
|
-
|
|
2897
|
+
T = new Array(t),
|
|
2898
|
+
d = this.tt ? new Array(t) : undefined,
|
|
2899
2899
|
S = this.nt ? new Array(t) : undefined;
|
|
2900
2900
|
for (
|
|
2901
2901
|
s = 0, o = Math.min(this.Ze, t);
|
|
@@ -2912,8 +2912,8 @@ function updateKeyedMap() {
|
|
|
2912
2912
|
o--, u--
|
|
2913
2913
|
) {
|
|
2914
2914
|
E[u] = this.Xe[o];
|
|
2915
|
-
|
|
2916
|
-
|
|
2915
|
+
T[u] = this.Je[o];
|
|
2916
|
+
d && (d[u] = this.tt[o]);
|
|
2917
2917
|
S && (S[u] = this.nt[o]);
|
|
2918
2918
|
}
|
|
2919
2919
|
f = new Map();
|
|
@@ -2931,8 +2931,8 @@ function updateKeyedMap() {
|
|
|
2931
2931
|
i = f.get(a);
|
|
2932
2932
|
if (i !== undefined && i !== -1) {
|
|
2933
2933
|
E[i] = this.Xe[n];
|
|
2934
|
-
|
|
2935
|
-
|
|
2934
|
+
T[i] = this.Je[n];
|
|
2935
|
+
d && (d[i] = this.tt[n]);
|
|
2936
2936
|
S && (S[i] = this.nt[n]);
|
|
2937
2937
|
i = l[i];
|
|
2938
2938
|
f.set(a, i);
|
|
@@ -2941,9 +2941,9 @@ function updateKeyedMap() {
|
|
|
2941
2941
|
for (i = s; i < t; i++) {
|
|
2942
2942
|
if (i in E) {
|
|
2943
2943
|
this.Xe[i] = E[i];
|
|
2944
|
-
this.Je[i] =
|
|
2945
|
-
if (
|
|
2946
|
-
this.tt[i] =
|
|
2944
|
+
this.Je[i] = T[i];
|
|
2945
|
+
if (d) {
|
|
2946
|
+
this.tt[i] = d[i];
|
|
2947
2947
|
setSignal(this.tt[i], e[i]);
|
|
2948
2948
|
}
|
|
2949
2949
|
if (S) {
|
|
@@ -3052,8 +3052,8 @@ class CollectionQueue extends Queue {
|
|
|
3052
3052
|
ft = new Set();
|
|
3053
3053
|
lt = signal(false, { pureWrite: true, He: true });
|
|
3054
3054
|
Et = false;
|
|
3055
|
-
|
|
3056
|
-
|
|
3055
|
+
Tt;
|
|
3056
|
+
dt = ON_INIT;
|
|
3057
3057
|
constructor(e) {
|
|
3058
3058
|
super();
|
|
3059
3059
|
this.ct = e;
|
|
@@ -3064,16 +3064,16 @@ class CollectionQueue extends Queue {
|
|
|
3064
3064
|
}
|
|
3065
3065
|
notify(e, t, n, i) {
|
|
3066
3066
|
if (!(t & this.ct)) return super.notify(e, t, n, i);
|
|
3067
|
-
if (this.Et && this.
|
|
3067
|
+
if (this.Et && this.Tt) {
|
|
3068
3068
|
const e = untrack(() => {
|
|
3069
3069
|
try {
|
|
3070
|
-
return this.
|
|
3070
|
+
return this.Tt();
|
|
3071
3071
|
} catch {
|
|
3072
3072
|
return ON_INIT;
|
|
3073
3073
|
}
|
|
3074
3074
|
});
|
|
3075
|
-
if (e !== this.
|
|
3076
|
-
this.
|
|
3075
|
+
if (e !== this.dt) {
|
|
3076
|
+
this.dt = e;
|
|
3077
3077
|
this.Et = false;
|
|
3078
3078
|
this.ft.clear();
|
|
3079
3079
|
}
|
|
@@ -3103,9 +3103,9 @@ class CollectionQueue extends Queue {
|
|
|
3103
3103
|
}
|
|
3104
3104
|
if (!this.ft.size) {
|
|
3105
3105
|
setSignal(this.lt, false);
|
|
3106
|
-
if (this.
|
|
3106
|
+
if (this.Tt) {
|
|
3107
3107
|
try {
|
|
3108
|
-
this.
|
|
3108
|
+
this.dt = untrack(() => this.Tt());
|
|
3109
3109
|
} catch {}
|
|
3110
3110
|
}
|
|
3111
3111
|
}
|
|
@@ -3114,7 +3114,7 @@ class CollectionQueue extends Queue {
|
|
|
3114
3114
|
function createCollectionBoundary(e, t, n, i) {
|
|
3115
3115
|
const r = createOwner();
|
|
3116
3116
|
const s = new CollectionQueue(e);
|
|
3117
|
-
if (i) s.
|
|
3117
|
+
if (i) s.Tt = i;
|
|
3118
3118
|
const o = createBoundChildren(r, t, s, e);
|
|
3119
3119
|
const u = computed(() => {
|
|
3120
3120
|
if (!read(s.lt)) {
|