@solidjs/signals 0.11.0 → 0.11.2
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/README.md +252 -2
- package/dist/dev.js +28 -18
- package/dist/node.cjs +520 -516
- package/dist/prod.js +141 -137
- package/dist/types/core/constants.d.ts +1 -0
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -32,6 +32,7 @@ const REACTIVE_ZOMBIE = 1 << 5;
|
|
|
32
32
|
const REACTIVE_DISPOSED = 1 << 6;
|
|
33
33
|
const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
|
|
34
34
|
const REACTIVE_SNAPSHOT_STALE = 1 << 8;
|
|
35
|
+
const REACTIVE_LAZY = 1 << 9;
|
|
35
36
|
const STATUS_PENDING = 1 << 0;
|
|
36
37
|
const STATUS_ERROR = 1 << 1;
|
|
37
38
|
const STATUS_UNINITIALIZED = 1 << 2;
|
|
@@ -167,17 +168,17 @@ function schedule() {
|
|
|
167
168
|
}
|
|
168
169
|
class Queue {
|
|
169
170
|
i = null;
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
G = [[], []];
|
|
172
|
+
M = [];
|
|
172
173
|
created = clock;
|
|
173
174
|
addChild(e) {
|
|
174
|
-
this.
|
|
175
|
+
this.M.push(e);
|
|
175
176
|
e.i = this;
|
|
176
177
|
}
|
|
177
178
|
removeChild(e) {
|
|
178
|
-
const t = this.
|
|
179
|
+
const t = this.M.indexOf(e);
|
|
179
180
|
if (t >= 0) {
|
|
180
|
-
this.
|
|
181
|
+
this.M.splice(t, 1);
|
|
181
182
|
e.i = null;
|
|
182
183
|
}
|
|
183
184
|
}
|
|
@@ -186,12 +187,12 @@ class Queue {
|
|
|
186
187
|
return false;
|
|
187
188
|
}
|
|
188
189
|
run(e) {
|
|
189
|
-
if (this.
|
|
190
|
-
const t = this.
|
|
191
|
-
this.
|
|
190
|
+
if (this.G[e - 1].length) {
|
|
191
|
+
const t = this.G[e - 1];
|
|
192
|
+
this.G[e - 1] = [];
|
|
192
193
|
runQueue(t, e);
|
|
193
194
|
}
|
|
194
|
-
for (let t = 0; t < this.
|
|
195
|
+
for (let t = 0; t < this.M.length; t++) this.M[t].run?.(e);
|
|
195
196
|
}
|
|
196
197
|
enqueue(e, t) {
|
|
197
198
|
if (e) {
|
|
@@ -199,31 +200,31 @@ class Queue {
|
|
|
199
200
|
const n = findLane(currentOptimisticLane);
|
|
200
201
|
n.W[e - 1].push(t);
|
|
201
202
|
} else {
|
|
202
|
-
this.
|
|
203
|
+
this.G[e - 1].push(t);
|
|
203
204
|
}
|
|
204
205
|
}
|
|
205
206
|
schedule();
|
|
206
207
|
}
|
|
207
208
|
stashQueues(e) {
|
|
208
|
-
e.
|
|
209
|
-
e.
|
|
210
|
-
this.
|
|
211
|
-
for (let t = 0; t < this.
|
|
212
|
-
let n = this.
|
|
213
|
-
let i = e.
|
|
209
|
+
e.G[0].push(...this.G[0]);
|
|
210
|
+
e.G[1].push(...this.G[1]);
|
|
211
|
+
this.G = [[], []];
|
|
212
|
+
for (let t = 0; t < this.M.length; t++) {
|
|
213
|
+
let n = this.M[t];
|
|
214
|
+
let i = e.M[t];
|
|
214
215
|
if (!i) {
|
|
215
|
-
i = {
|
|
216
|
-
e.
|
|
216
|
+
i = { G: [[], []], M: [] };
|
|
217
|
+
e.M[t] = i;
|
|
217
218
|
}
|
|
218
219
|
n.stashQueues(i);
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
222
|
restoreQueues(e) {
|
|
222
|
-
this.
|
|
223
|
-
this.
|
|
224
|
-
for (let t = 0; t < e.
|
|
225
|
-
const n = e.
|
|
226
|
-
let i = this.
|
|
223
|
+
this.G[0].push(...e.G[0]);
|
|
224
|
+
this.G[1].push(...e.G[1]);
|
|
225
|
+
for (let t = 0; t < e.M.length; t++) {
|
|
226
|
+
const n = e.M[t];
|
|
227
|
+
let i = this.M[t];
|
|
227
228
|
if (i) i.restoreQueues(n);
|
|
228
229
|
}
|
|
229
230
|
}
|
|
@@ -235,7 +236,7 @@ class GlobalQueue extends Queue {
|
|
|
235
236
|
j = new Set();
|
|
236
237
|
static K;
|
|
237
238
|
static Y;
|
|
238
|
-
static
|
|
239
|
+
static Z = null;
|
|
239
240
|
flush() {
|
|
240
241
|
if (this.H) return;
|
|
241
242
|
this.H = true;
|
|
@@ -251,7 +252,7 @@ class GlobalQueue extends Queue {
|
|
|
251
252
|
this.j = new Set();
|
|
252
253
|
runLaneEffects(EFFECT_RENDER);
|
|
253
254
|
runLaneEffects(EFFECT_USER);
|
|
254
|
-
this.stashQueues(activeTransition.
|
|
255
|
+
this.stashQueues(activeTransition.B);
|
|
255
256
|
clock++;
|
|
256
257
|
scheduled = dirtyQueue.R >= dirtyQueue.N;
|
|
257
258
|
reassignPendingTransition(activeTransition.F);
|
|
@@ -260,7 +261,7 @@ class GlobalQueue extends Queue {
|
|
|
260
261
|
return;
|
|
261
262
|
}
|
|
262
263
|
this.F !== activeTransition.F && this.F.push(...activeTransition.F);
|
|
263
|
-
this.restoreQueues(activeTransition.
|
|
264
|
+
this.restoreQueues(activeTransition.B);
|
|
264
265
|
transitions.delete(activeTransition);
|
|
265
266
|
const t = activeTransition;
|
|
266
267
|
activeTransition = null;
|
|
@@ -283,9 +284,9 @@ class GlobalQueue extends Queue {
|
|
|
283
284
|
notify(e, t, n, i) {
|
|
284
285
|
if (t & STATUS_PENDING) {
|
|
285
286
|
if (n & STATUS_PENDING) {
|
|
286
|
-
const t = i !== undefined ? i : e.
|
|
287
|
-
if (activeTransition && t && !activeTransition.
|
|
288
|
-
activeTransition.
|
|
287
|
+
const t = i !== undefined ? i : e.X;
|
|
288
|
+
if (activeTransition && t && !activeTransition.q.includes(t.source)) {
|
|
289
|
+
activeTransition.q.push(t.source);
|
|
289
290
|
schedule();
|
|
290
291
|
}
|
|
291
292
|
}
|
|
@@ -301,11 +302,11 @@ class GlobalQueue extends Queue {
|
|
|
301
302
|
activeTransition = e ?? {
|
|
302
303
|
J: clock,
|
|
303
304
|
F: [],
|
|
304
|
-
|
|
305
|
+
q: [],
|
|
305
306
|
$: [],
|
|
306
307
|
j: new Set(),
|
|
307
308
|
ee: [],
|
|
308
|
-
|
|
309
|
+
B: { G: [[], []], M: [] },
|
|
309
310
|
te: false
|
|
310
311
|
};
|
|
311
312
|
} else if (e) {
|
|
@@ -384,7 +385,7 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
384
385
|
n.ae = NOT_PENDING;
|
|
385
386
|
if (n.oe && n.oe !== EFFECT_TRACKED) n.ue = true;
|
|
386
387
|
}
|
|
387
|
-
n.Ee &= ~STATUS_UNINITIALIZED;
|
|
388
|
+
if (!(n.Ee & STATUS_PENDING)) n.Ee &= ~STATUS_UNINITIALIZED;
|
|
388
389
|
if (n.L) GlobalQueue.Y(n, false, true);
|
|
389
390
|
}
|
|
390
391
|
t.length = 0;
|
|
@@ -402,9 +403,9 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
402
403
|
}
|
|
403
404
|
n.length = 0;
|
|
404
405
|
const i = e ? e.j : globalQueue.j;
|
|
405
|
-
if (GlobalQueue.
|
|
406
|
+
if (GlobalQueue.Z && i.size) {
|
|
406
407
|
for (const e of i) {
|
|
407
|
-
GlobalQueue.
|
|
408
|
+
GlobalQueue.Z(e);
|
|
408
409
|
}
|
|
409
410
|
i.clear();
|
|
410
411
|
schedule();
|
|
@@ -426,7 +427,7 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
426
427
|
}
|
|
427
428
|
}
|
|
428
429
|
function checkBoundaryChildren(e) {
|
|
429
|
-
for (const t of e.
|
|
430
|
+
for (const t of e.M) {
|
|
430
431
|
t.checkSources?.();
|
|
431
432
|
checkBoundaryChildren(t);
|
|
432
433
|
}
|
|
@@ -453,9 +454,9 @@ function transitionComplete(e) {
|
|
|
453
454
|
if (e.te) return true;
|
|
454
455
|
if (e.ee.length) return false;
|
|
455
456
|
let t = true;
|
|
456
|
-
for (let n = 0; n < e.
|
|
457
|
-
const i = e.
|
|
458
|
-
if (i.Ee & STATUS_PENDING && i.
|
|
457
|
+
for (let n = 0; n < e.q.length; n++) {
|
|
458
|
+
const i = e.q[n];
|
|
459
|
+
if (i.Ee & STATUS_PENDING && i.X?.source === i) {
|
|
459
460
|
t = false;
|
|
460
461
|
break;
|
|
461
462
|
}
|
|
@@ -646,7 +647,7 @@ function handleAsync(e, t, n) {
|
|
|
646
647
|
}
|
|
647
648
|
function clearStatus(e) {
|
|
648
649
|
e.Ee = e.Ee & STATUS_UNINITIALIZED;
|
|
649
|
-
e.
|
|
650
|
+
e.X = null;
|
|
650
651
|
updatePendingSignal(e);
|
|
651
652
|
e.Ae?.();
|
|
652
653
|
}
|
|
@@ -658,7 +659,7 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
658
659
|
const u = o && hasActiveOverride(e);
|
|
659
660
|
if (!i) {
|
|
660
661
|
e.Ee = t | (t !== STATUS_ERROR ? e.Ee & STATUS_UNINITIALIZED : 0);
|
|
661
|
-
e.
|
|
662
|
+
e.X = n;
|
|
662
663
|
updatePendingSignal(e);
|
|
663
664
|
}
|
|
664
665
|
if (r && !i) {
|
|
@@ -666,8 +667,8 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
666
667
|
}
|
|
667
668
|
if (u && activeTransition && n instanceof NotReadyError) {
|
|
668
669
|
const e = n.source;
|
|
669
|
-
if (!activeTransition.
|
|
670
|
-
activeTransition.
|
|
670
|
+
if (!activeTransition.q.includes(e)) {
|
|
671
|
+
activeTransition.q.push(e);
|
|
671
672
|
}
|
|
672
673
|
}
|
|
673
674
|
const c = i || u;
|
|
@@ -682,7 +683,7 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
682
683
|
}
|
|
683
684
|
for (let i = e.I; i !== null; i = i.p) {
|
|
684
685
|
i.h.J = clock;
|
|
685
|
-
if (i.h.
|
|
686
|
+
if (i.h.X !== n) {
|
|
686
687
|
!i.h.ne && globalQueue.F.push(i.h);
|
|
687
688
|
notifyStatus(i.h, t, n, c, l);
|
|
688
689
|
}
|
|
@@ -690,7 +691,7 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
690
691
|
for (let i = e.A; i !== null; i = i.P) {
|
|
691
692
|
for (let e = i.I; e !== null; e = e.p) {
|
|
692
693
|
e.h.J = clock;
|
|
693
|
-
if (e.h.
|
|
694
|
+
if (e.h.X !== n) {
|
|
694
695
|
!e.h.ne && globalQueue.F.push(e.h);
|
|
695
696
|
notifyStatus(e.h, t, n, c, l);
|
|
696
697
|
}
|
|
@@ -703,12 +704,12 @@ function unlinkSubs(e) {
|
|
|
703
704
|
const i = e.p;
|
|
704
705
|
const r = e.Pe;
|
|
705
706
|
if (i !== null) i.Pe = r;
|
|
706
|
-
else t.
|
|
707
|
+
else t.Ne = r;
|
|
707
708
|
if (r !== null) r.p = i;
|
|
708
709
|
else {
|
|
709
710
|
t.I = i;
|
|
710
711
|
if (i === null) {
|
|
711
|
-
t.
|
|
712
|
+
t.ge?.();
|
|
712
713
|
t.L && !t.Ce && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
713
714
|
}
|
|
714
715
|
}
|
|
@@ -735,9 +736,9 @@ function link(e, t) {
|
|
|
735
736
|
return;
|
|
736
737
|
}
|
|
737
738
|
}
|
|
738
|
-
const s = e.
|
|
739
|
+
const s = e.Ne;
|
|
739
740
|
if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
|
|
740
|
-
const o = (t.ye = e.
|
|
741
|
+
const o = (t.ye = e.Ne = { V: e, h: t, D: i, Pe: s, p: null });
|
|
741
742
|
if (n !== null) n.D = o;
|
|
742
743
|
else t.C = o;
|
|
743
744
|
if (s !== null) s.p = o;
|
|
@@ -893,7 +894,7 @@ function effect(e, t, n, i, r) {
|
|
|
893
894
|
const o = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
894
895
|
...r,
|
|
895
896
|
equals: () => {
|
|
896
|
-
o.ue = !o.
|
|
897
|
+
o.ue = !o.X;
|
|
897
898
|
if (s) o.ce.enqueue(o.oe, runEffect.bind(o));
|
|
898
899
|
return false;
|
|
899
900
|
},
|
|
@@ -906,7 +907,7 @@ function effect(e, t, n, i, r) {
|
|
|
906
907
|
o.oe = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
907
908
|
o.Ae = (e, t) => {
|
|
908
909
|
const n = e !== undefined ? e : o.Ee;
|
|
909
|
-
const i = t !== undefined ? t : o.
|
|
910
|
+
const i = t !== undefined ? t : o.X;
|
|
910
911
|
if (n & STATUS_ERROR) {
|
|
911
912
|
let e = i;
|
|
912
913
|
o.ce.notify(o, STATUS_PENDING, 0);
|
|
@@ -1092,7 +1093,7 @@ function recompute(e, t = false) {
|
|
|
1092
1093
|
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1093
1094
|
context = o;
|
|
1094
1095
|
}
|
|
1095
|
-
if (!e.
|
|
1096
|
+
if (!e.X) {
|
|
1096
1097
|
const o = e.ye;
|
|
1097
1098
|
let l = o !== null ? o.D : e.C;
|
|
1098
1099
|
if (l !== null) {
|
|
@@ -1141,7 +1142,7 @@ function updateIfNecessary(e) {
|
|
|
1141
1142
|
}
|
|
1142
1143
|
}
|
|
1143
1144
|
}
|
|
1144
|
-
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.
|
|
1145
|
+
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.X && e.J < clock)) {
|
|
1145
1146
|
recompute(e);
|
|
1146
1147
|
}
|
|
1147
1148
|
e.O = REACTIVE_NONE | (e.O & REACTIVE_SNAPSHOT_STALE);
|
|
@@ -1152,8 +1153,8 @@ function computed(e, t, n) {
|
|
|
1152
1153
|
id: n?.id ?? (i ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1153
1154
|
Le: i || undefined,
|
|
1154
1155
|
pe: n?.equals != null ? n.equals : isEqual,
|
|
1155
|
-
|
|
1156
|
-
|
|
1156
|
+
Ge: !!n?.pureWrite,
|
|
1157
|
+
ge: n?.unobserved,
|
|
1157
1158
|
me: null,
|
|
1158
1159
|
ce: context?.ce ?? globalQueue,
|
|
1159
1160
|
ke: context?.ke ?? defaultContext,
|
|
@@ -1167,11 +1168,11 @@ function computed(e, t, n) {
|
|
|
1167
1168
|
C: null,
|
|
1168
1169
|
ye: null,
|
|
1169
1170
|
I: null,
|
|
1170
|
-
|
|
1171
|
+
Ne: null,
|
|
1171
1172
|
i: context,
|
|
1172
1173
|
ve: null,
|
|
1173
1174
|
De: null,
|
|
1174
|
-
O: REACTIVE_NONE,
|
|
1175
|
+
O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1175
1176
|
Ee: STATUS_UNINITIALIZED,
|
|
1176
1177
|
J: clock,
|
|
1177
1178
|
ae: NOT_PENDING,
|
|
@@ -1205,18 +1206,18 @@ function computed(e, t, n) {
|
|
|
1205
1206
|
function signal(e, t, n = null) {
|
|
1206
1207
|
const i = {
|
|
1207
1208
|
pe: t?.equals != null ? t.equals : isEqual,
|
|
1208
|
-
|
|
1209
|
-
|
|
1209
|
+
Ge: !!t?.pureWrite,
|
|
1210
|
+
ge: t?.unobserved,
|
|
1210
1211
|
fe: e,
|
|
1211
1212
|
I: null,
|
|
1212
|
-
|
|
1213
|
+
Ne: null,
|
|
1213
1214
|
J: clock,
|
|
1214
1215
|
m: n,
|
|
1215
1216
|
P: n?.A || null,
|
|
1216
1217
|
ae: NOT_PENDING
|
|
1217
1218
|
};
|
|
1218
1219
|
n && (n.A = i);
|
|
1219
|
-
if (snapshotCaptureActive && !i.
|
|
1220
|
+
if (snapshotCaptureActive && !i.Ge) {
|
|
1220
1221
|
i.re = e === undefined ? NO_SNAPSHOT : e;
|
|
1221
1222
|
snapshotSources.add(i);
|
|
1222
1223
|
}
|
|
@@ -1288,10 +1289,14 @@ function read(e) {
|
|
|
1288
1289
|
let t = context;
|
|
1289
1290
|
if (t?.t) t = t.u;
|
|
1290
1291
|
if (refreshing && e.L) recompute(e);
|
|
1292
|
+
if (e.O & REACTIVE_LAZY) {
|
|
1293
|
+
e.O &= ~REACTIVE_LAZY;
|
|
1294
|
+
recompute(e, true);
|
|
1295
|
+
}
|
|
1296
|
+
const n = e.m || e;
|
|
1291
1297
|
if (t && tracking) {
|
|
1292
1298
|
if (e.L && e.O & REACTIVE_DISPOSED) recompute(e);
|
|
1293
1299
|
link(e, t);
|
|
1294
|
-
const n = e.m || e;
|
|
1295
1300
|
if (n.L) {
|
|
1296
1301
|
const i = e.O & REACTIVE_ZOMBIE;
|
|
1297
1302
|
if (n.o >= (i ? zombieQueue.N : dirtyQueue.N)) {
|
|
@@ -1305,7 +1310,6 @@ function read(e) {
|
|
|
1305
1310
|
}
|
|
1306
1311
|
}
|
|
1307
1312
|
}
|
|
1308
|
-
const n = e.m || e;
|
|
1309
1313
|
if (n.Ee & STATUS_PENDING) {
|
|
1310
1314
|
if (t && !(stale && n.ne && activeTransition !== n.ne)) {
|
|
1311
1315
|
if (currentOptimisticLane) {
|
|
@@ -1313,21 +1317,21 @@ function read(e) {
|
|
|
1313
1317
|
const r = findLane(currentOptimisticLane);
|
|
1314
1318
|
if (i && findLane(i) === r && !hasActiveOverride(n)) {
|
|
1315
1319
|
if (!tracking) link(e, t);
|
|
1316
|
-
throw n.
|
|
1320
|
+
throw n.X;
|
|
1317
1321
|
}
|
|
1318
1322
|
} else {
|
|
1319
1323
|
if (!tracking) link(e, t);
|
|
1320
|
-
throw n.
|
|
1324
|
+
throw n.X;
|
|
1321
1325
|
}
|
|
1322
1326
|
} else if (!t && n.Ee & STATUS_UNINITIALIZED) {
|
|
1323
|
-
throw n.
|
|
1327
|
+
throw n.X;
|
|
1324
1328
|
}
|
|
1325
1329
|
}
|
|
1326
1330
|
if (e.L && e.Ee & STATUS_ERROR) {
|
|
1327
1331
|
if (e.J < clock) {
|
|
1328
1332
|
recompute(e, true);
|
|
1329
1333
|
return read(e);
|
|
1330
|
-
} else throw e.
|
|
1334
|
+
} else throw e.X;
|
|
1331
1335
|
}
|
|
1332
1336
|
if (snapshotCaptureActive && t && t.se) {
|
|
1333
1337
|
const n = e.re;
|
|
@@ -1350,7 +1354,7 @@ function setSignal(e, t) {
|
|
|
1350
1354
|
const n = e._e && !projectionWriteActive;
|
|
1351
1355
|
const i = n ? e.fe : e.ae === NOT_PENDING ? e.fe : e.ae;
|
|
1352
1356
|
if (typeof t === "function") t = t(i);
|
|
1353
|
-
const r = !e.pe || !e.pe(i, t);
|
|
1357
|
+
const r = !e.pe || !e.pe(i, t) || !!(e.Ee & STATUS_UNINITIALIZED);
|
|
1354
1358
|
if (!r) {
|
|
1355
1359
|
if (n && e.ae !== NOT_PENDING && e.L) {
|
|
1356
1360
|
insertSubs(e, true);
|
|
@@ -1399,14 +1403,14 @@ function runWithOwner(e, t) {
|
|
|
1399
1403
|
}
|
|
1400
1404
|
}
|
|
1401
1405
|
function getPendingSignal(e) {
|
|
1402
|
-
if (!e.
|
|
1403
|
-
e.
|
|
1406
|
+
if (!e.Me) {
|
|
1407
|
+
e.Me = optimisticSignal(false, { pureWrite: true });
|
|
1404
1408
|
if (e.de) {
|
|
1405
|
-
e.
|
|
1409
|
+
e.Me.de = e;
|
|
1406
1410
|
}
|
|
1407
|
-
if (computePendingState(e)) setSignal(e.
|
|
1411
|
+
if (computePendingState(e)) setSignal(e.Me, true);
|
|
1408
1412
|
}
|
|
1409
|
-
return e.
|
|
1413
|
+
return e.Me;
|
|
1410
1414
|
}
|
|
1411
1415
|
function computePendingState(e) {
|
|
1412
1416
|
const t = e;
|
|
@@ -1422,9 +1426,9 @@ function computePendingState(e) {
|
|
|
1422
1426
|
return !!(t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED));
|
|
1423
1427
|
}
|
|
1424
1428
|
function updatePendingSignal(e) {
|
|
1425
|
-
if (e.
|
|
1429
|
+
if (e.Me) {
|
|
1426
1430
|
const t = computePendingState(e);
|
|
1427
|
-
const n = e.
|
|
1431
|
+
const n = e.Me;
|
|
1428
1432
|
setSignal(n, t);
|
|
1429
1433
|
if (!t && n.ie) {
|
|
1430
1434
|
const t = resolveLane(e);
|
|
@@ -2218,7 +2222,7 @@ function deep(e) {
|
|
|
2218
2222
|
return e[$DEEP];
|
|
2219
2223
|
}
|
|
2220
2224
|
function createOptimisticStore(e, t, n) {
|
|
2221
|
-
GlobalQueue.
|
|
2225
|
+
GlobalQueue.Z ||= clearOptimisticStore;
|
|
2222
2226
|
const i = typeof e === "function";
|
|
2223
2227
|
const r = (i ? t : e) ?? {};
|
|
2224
2228
|
const s = i ? e : undefined;
|
|
@@ -2547,11 +2551,11 @@ function mapArray(e, t, n) {
|
|
|
2547
2551
|
je: e,
|
|
2548
2552
|
Ke: [],
|
|
2549
2553
|
Ye: s,
|
|
2554
|
+
Ze: [],
|
|
2550
2555
|
Be: [],
|
|
2551
|
-
Xe:
|
|
2552
|
-
qe: i,
|
|
2553
|
-
ze:
|
|
2554
|
-
Ze: r ? [] : undefined,
|
|
2556
|
+
Xe: i,
|
|
2557
|
+
qe: i || n?.keyed === false ? [] : undefined,
|
|
2558
|
+
ze: r ? [] : undefined,
|
|
2555
2559
|
Je: n?.fallback
|
|
2556
2560
|
})
|
|
2557
2561
|
);
|
|
@@ -2564,20 +2568,20 @@ function updateKeyedMap() {
|
|
|
2564
2568
|
runWithOwner(this.Fe, () => {
|
|
2565
2569
|
let n,
|
|
2566
2570
|
i,
|
|
2567
|
-
r = this.
|
|
2571
|
+
r = this.qe
|
|
2568
2572
|
? () => {
|
|
2569
|
-
this.
|
|
2570
|
-
this.
|
|
2573
|
+
this.qe[i] = signal(e[i], pureOptions);
|
|
2574
|
+
this.ze && (this.ze[i] = signal(i, pureOptions));
|
|
2571
2575
|
return this.Ye(
|
|
2572
|
-
read.bind(null, this.
|
|
2573
|
-
this.
|
|
2576
|
+
read.bind(null, this.qe[i]),
|
|
2577
|
+
this.ze ? read.bind(null, this.ze[i]) : undefined
|
|
2574
2578
|
);
|
|
2575
2579
|
}
|
|
2576
|
-
: this.
|
|
2580
|
+
: this.ze
|
|
2577
2581
|
? () => {
|
|
2578
2582
|
const t = e[i];
|
|
2579
|
-
this.
|
|
2580
|
-
return this.Ye(() => t, read.bind(null, this.
|
|
2583
|
+
this.ze[i] = signal(i, pureOptions);
|
|
2584
|
+
return this.Ye(() => t, read.bind(null, this.ze[i]));
|
|
2581
2585
|
}
|
|
2582
2586
|
: () => {
|
|
2583
2587
|
const t = e[i];
|
|
@@ -2586,22 +2590,22 @@ function updateKeyedMap() {
|
|
|
2586
2590
|
if (t === 0) {
|
|
2587
2591
|
if (this.$e !== 0) {
|
|
2588
2592
|
this.Fe.dispose(false);
|
|
2589
|
-
this.Xe = [];
|
|
2590
|
-
this.Ke = [];
|
|
2591
2593
|
this.Be = [];
|
|
2594
|
+
this.Ke = [];
|
|
2595
|
+
this.Ze = [];
|
|
2592
2596
|
this.$e = 0;
|
|
2597
|
+
this.qe && (this.qe = []);
|
|
2593
2598
|
this.ze && (this.ze = []);
|
|
2594
|
-
this.Ze && (this.Ze = []);
|
|
2595
2599
|
}
|
|
2596
|
-
if (this.Je && !this.
|
|
2597
|
-
this.
|
|
2600
|
+
if (this.Je && !this.Ze[0]) {
|
|
2601
|
+
this.Ze[0] = runWithOwner((this.Be[0] = createOwner()), this.Je);
|
|
2598
2602
|
}
|
|
2599
2603
|
} else if (this.$e === 0) {
|
|
2600
|
-
if (this.
|
|
2601
|
-
this.
|
|
2604
|
+
if (this.Be[0]) this.Be[0].dispose();
|
|
2605
|
+
this.Ze = new Array(t);
|
|
2602
2606
|
for (i = 0; i < t; i++) {
|
|
2603
2607
|
this.Ke[i] = e[i];
|
|
2604
|
-
this.
|
|
2608
|
+
this.Ze[i] = runWithOwner((this.Be[i] = createOwner()), r);
|
|
2605
2609
|
}
|
|
2606
2610
|
this.$e = t;
|
|
2607
2611
|
} else {
|
|
@@ -2614,70 +2618,70 @@ function updateKeyedMap() {
|
|
|
2614
2618
|
f,
|
|
2615
2619
|
E = new Array(t),
|
|
2616
2620
|
T = new Array(t),
|
|
2617
|
-
d = this.
|
|
2618
|
-
S = this.
|
|
2621
|
+
d = this.qe ? new Array(t) : undefined,
|
|
2622
|
+
S = this.ze ? new Array(t) : undefined;
|
|
2619
2623
|
for (
|
|
2620
2624
|
s = 0, o = Math.min(this.$e, t);
|
|
2621
|
-
s < o && (this.Ke[s] === e[s] || (this.
|
|
2625
|
+
s < o && (this.Ke[s] === e[s] || (this.qe && compare(this.Xe, this.Ke[s], e[s])));
|
|
2622
2626
|
s++
|
|
2623
2627
|
) {
|
|
2624
|
-
if (this.
|
|
2628
|
+
if (this.qe) setSignal(this.qe[s], e[s]);
|
|
2625
2629
|
}
|
|
2626
2630
|
for (
|
|
2627
2631
|
o = this.$e - 1, u = t - 1;
|
|
2628
2632
|
o >= s &&
|
|
2629
2633
|
u >= s &&
|
|
2630
|
-
(this.Ke[o] === e[u] || (this.
|
|
2634
|
+
(this.Ke[o] === e[u] || (this.qe && compare(this.Xe, this.Ke[o], e[u])));
|
|
2631
2635
|
o--, u--
|
|
2632
2636
|
) {
|
|
2633
|
-
E[u] = this.
|
|
2634
|
-
T[u] = this.
|
|
2635
|
-
d && (d[u] = this.
|
|
2636
|
-
S && (S[u] = this.
|
|
2637
|
+
E[u] = this.Ze[o];
|
|
2638
|
+
T[u] = this.Be[o];
|
|
2639
|
+
d && (d[u] = this.qe[o]);
|
|
2640
|
+
S && (S[u] = this.ze[o]);
|
|
2637
2641
|
}
|
|
2638
2642
|
a = new Map();
|
|
2639
2643
|
f = new Array(u + 1);
|
|
2640
2644
|
for (i = u; i >= s; i--) {
|
|
2641
2645
|
c = e[i];
|
|
2642
|
-
l = this.
|
|
2646
|
+
l = this.Xe ? this.Xe(c) : c;
|
|
2643
2647
|
n = a.get(l);
|
|
2644
2648
|
f[i] = n === undefined ? -1 : n;
|
|
2645
2649
|
a.set(l, i);
|
|
2646
2650
|
}
|
|
2647
2651
|
for (n = s; n <= o; n++) {
|
|
2648
2652
|
c = this.Ke[n];
|
|
2649
|
-
l = this.
|
|
2653
|
+
l = this.Xe ? this.Xe(c) : c;
|
|
2650
2654
|
i = a.get(l);
|
|
2651
2655
|
if (i !== undefined && i !== -1) {
|
|
2652
|
-
E[i] = this.
|
|
2653
|
-
T[i] = this.
|
|
2654
|
-
d && (d[i] = this.
|
|
2655
|
-
S && (S[i] = this.
|
|
2656
|
+
E[i] = this.Ze[n];
|
|
2657
|
+
T[i] = this.Be[n];
|
|
2658
|
+
d && (d[i] = this.qe[n]);
|
|
2659
|
+
S && (S[i] = this.ze[n]);
|
|
2656
2660
|
i = f[i];
|
|
2657
2661
|
a.set(l, i);
|
|
2658
|
-
} else this.
|
|
2662
|
+
} else this.Be[n].dispose();
|
|
2659
2663
|
}
|
|
2660
2664
|
for (i = s; i < t; i++) {
|
|
2661
2665
|
if (i in E) {
|
|
2662
|
-
this.
|
|
2663
|
-
this.
|
|
2666
|
+
this.Ze[i] = E[i];
|
|
2667
|
+
this.Be[i] = T[i];
|
|
2664
2668
|
if (d) {
|
|
2665
|
-
this.
|
|
2666
|
-
setSignal(this.
|
|
2669
|
+
this.qe[i] = d[i];
|
|
2670
|
+
setSignal(this.qe[i], e[i]);
|
|
2667
2671
|
}
|
|
2668
2672
|
if (S) {
|
|
2669
|
-
this.
|
|
2670
|
-
setSignal(this.
|
|
2673
|
+
this.ze[i] = S[i];
|
|
2674
|
+
setSignal(this.ze[i], i);
|
|
2671
2675
|
}
|
|
2672
2676
|
} else {
|
|
2673
|
-
this.
|
|
2677
|
+
this.Ze[i] = runWithOwner((this.Be[i] = createOwner()), r);
|
|
2674
2678
|
}
|
|
2675
2679
|
}
|
|
2676
|
-
this.
|
|
2680
|
+
this.Ze = this.Ze.slice(0, (this.$e = t));
|
|
2677
2681
|
this.Ke = e.slice(0);
|
|
2678
2682
|
}
|
|
2679
2683
|
});
|
|
2680
|
-
return this.
|
|
2684
|
+
return this.Ze;
|
|
2681
2685
|
}
|
|
2682
2686
|
function repeat(e, t, n) {
|
|
2683
2687
|
const i = t;
|
|
@@ -2687,8 +2691,8 @@ function repeat(e, t, n) {
|
|
|
2687
2691
|
et: 0,
|
|
2688
2692
|
tt: e,
|
|
2689
2693
|
Ye: i,
|
|
2690
|
-
Xe: [],
|
|
2691
2694
|
Be: [],
|
|
2695
|
+
Ze: [],
|
|
2692
2696
|
nt: n?.from,
|
|
2693
2697
|
Je: n?.fallback
|
|
2694
2698
|
});
|
|
@@ -2700,45 +2704,45 @@ function updateRepeat() {
|
|
|
2700
2704
|
if (e === 0) {
|
|
2701
2705
|
if (this.$e !== 0) {
|
|
2702
2706
|
this.Fe.dispose(false);
|
|
2703
|
-
this.Xe = [];
|
|
2704
2707
|
this.Be = [];
|
|
2708
|
+
this.Ze = [];
|
|
2705
2709
|
this.$e = 0;
|
|
2706
2710
|
}
|
|
2707
|
-
if (this.Je && !this.
|
|
2708
|
-
this.
|
|
2711
|
+
if (this.Je && !this.Ze[0]) {
|
|
2712
|
+
this.Ze[0] = runWithOwner((this.Be[0] = createOwner()), this.Je);
|
|
2709
2713
|
}
|
|
2710
2714
|
return;
|
|
2711
2715
|
}
|
|
2712
2716
|
const n = t + e;
|
|
2713
2717
|
const i = this.et + this.$e;
|
|
2714
|
-
if (this.$e === 0 && this.
|
|
2715
|
-
for (let e = n; e < i; e++) this.
|
|
2718
|
+
if (this.$e === 0 && this.Be[0]) this.Be[0].dispose();
|
|
2719
|
+
for (let e = n; e < i; e++) this.Be[e - this.et].dispose();
|
|
2716
2720
|
if (this.et < t) {
|
|
2717
2721
|
let e = this.et;
|
|
2718
|
-
while (e < t && e < this.$e) this.
|
|
2719
|
-
this.Xe.splice(0, t - this.et);
|
|
2722
|
+
while (e < t && e < this.$e) this.Be[e++].dispose();
|
|
2720
2723
|
this.Be.splice(0, t - this.et);
|
|
2724
|
+
this.Ze.splice(0, t - this.et);
|
|
2721
2725
|
} else if (this.et > t) {
|
|
2722
2726
|
let n = i - this.et - 1;
|
|
2723
2727
|
let r = this.et - t;
|
|
2724
|
-
this.
|
|
2728
|
+
this.Be.length = this.Ze.length = e;
|
|
2725
2729
|
while (n >= r) {
|
|
2726
|
-
this.Xe[n] = this.Xe[n - r];
|
|
2727
2730
|
this.Be[n] = this.Be[n - r];
|
|
2731
|
+
this.Ze[n] = this.Ze[n - r];
|
|
2728
2732
|
n--;
|
|
2729
2733
|
}
|
|
2730
2734
|
for (let e = 0; e < r; e++) {
|
|
2731
|
-
this.
|
|
2735
|
+
this.Ze[e] = runWithOwner((this.Be[e] = createOwner()), () => this.Ye(e + t));
|
|
2732
2736
|
}
|
|
2733
2737
|
}
|
|
2734
2738
|
for (let e = i; e < n; e++) {
|
|
2735
|
-
this.
|
|
2739
|
+
this.Ze[e - t] = runWithOwner((this.Be[e - t] = createOwner()), () => this.Ye(e));
|
|
2736
2740
|
}
|
|
2737
|
-
this.
|
|
2741
|
+
this.Ze = this.Ze.slice(0, e);
|
|
2738
2742
|
this.et = t;
|
|
2739
2743
|
this.$e = e;
|
|
2740
2744
|
});
|
|
2741
|
-
return this.
|
|
2745
|
+
return this.Ze;
|
|
2742
2746
|
}
|
|
2743
2747
|
function compare(e, t, n) {
|
|
2744
2748
|
return e ? e(t) === e(n) : true;
|
|
@@ -2747,7 +2751,7 @@ function boundaryComputed(e, t) {
|
|
|
2747
2751
|
const n = computed(e, undefined, { lazy: true });
|
|
2748
2752
|
n.Ae = (e, t) => {
|
|
2749
2753
|
const i = e !== undefined ? e : n.Ee;
|
|
2750
|
-
const r = t !== undefined ? t : n.
|
|
2754
|
+
const r = t !== undefined ? t : n.X;
|
|
2751
2755
|
n.Ee &= ~n.it;
|
|
2752
2756
|
n.ce.notify(n, n.it, i, r);
|
|
2753
2757
|
};
|
|
@@ -2781,7 +2785,7 @@ class CollectionQueue extends Queue {
|
|
|
2781
2785
|
notify(e, t, n, i) {
|
|
2782
2786
|
if (!(t & this.rt) || (this.rt & STATUS_PENDING && this.ut)) return super.notify(e, t, n, i);
|
|
2783
2787
|
if (n & this.rt) {
|
|
2784
|
-
const t = i?.source || e.
|
|
2788
|
+
const t = i?.source || e.X?.source;
|
|
2785
2789
|
if (t) {
|
|
2786
2790
|
const e = this.st.size === 0;
|
|
2787
2791
|
this.st.add(t);
|
|
@@ -2820,7 +2824,7 @@ function createLoadBoundary(e, t) {
|
|
|
2820
2824
|
function createErrorBoundary(e, t) {
|
|
2821
2825
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2822
2826
|
let n = e.st.values().next().value;
|
|
2823
|
-
const i = n.
|
|
2827
|
+
const i = n.X?.cause ?? n.X;
|
|
2824
2828
|
return t(i, () => {
|
|
2825
2829
|
for (const t of e.st) recompute(t);
|
|
2826
2830
|
schedule();
|