@solidjs/signals 0.9.3 → 0.9.5
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 +47 -25
- package/dist/node.cjs +247 -228
- package/dist/prod.js +114 -95
- package/dist/types/core/scheduler.d.ts +1 -1
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -201,8 +201,8 @@ class Queue {
|
|
|
201
201
|
}
|
|
202
202
|
class GlobalQueue extends Queue {
|
|
203
203
|
k = false;
|
|
204
|
-
$ = [];
|
|
205
204
|
L = [];
|
|
205
|
+
$ = [];
|
|
206
206
|
static F;
|
|
207
207
|
static W;
|
|
208
208
|
flush() {
|
|
@@ -214,7 +214,7 @@ class GlobalQueue extends Queue {
|
|
|
214
214
|
if (!transitionComplete(activeTransition)) {
|
|
215
215
|
let e = activeTransition;
|
|
216
216
|
runHeap(zombieQueue, GlobalQueue.F);
|
|
217
|
-
this
|
|
217
|
+
this.L = [];
|
|
218
218
|
this.stashQueues(activeTransition.queueStash);
|
|
219
219
|
clock++;
|
|
220
220
|
scheduled = false;
|
|
@@ -223,13 +223,13 @@ class GlobalQueue extends Queue {
|
|
|
223
223
|
runOptimistic(e);
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
|
-
this
|
|
227
|
-
this
|
|
228
|
-
this
|
|
226
|
+
this.L !== activeTransition.pendingNodes && this.L.push(...activeTransition.pendingNodes);
|
|
227
|
+
this.$ !== activeTransition.optimisticNodes &&
|
|
228
|
+
this.$.push(...activeTransition.optimisticNodes);
|
|
229
229
|
this.restoreQueues(activeTransition.queueStash);
|
|
230
230
|
transitions.delete(activeTransition);
|
|
231
231
|
activeTransition = null;
|
|
232
|
-
runTransitionPending(this
|
|
232
|
+
runTransitionPending(this.L, false);
|
|
233
233
|
} else if (transitions.size) runHeap(zombieQueue, GlobalQueue.F);
|
|
234
234
|
runOptimistic();
|
|
235
235
|
clock++;
|
|
@@ -253,9 +253,11 @@ class GlobalQueue extends Queue {
|
|
|
253
253
|
return false;
|
|
254
254
|
}
|
|
255
255
|
initTransition(e) {
|
|
256
|
-
if (
|
|
256
|
+
if (e) e = currentTransition(e);
|
|
257
|
+
if (e && e === activeTransition) return;
|
|
258
|
+
if (!e && activeTransition && activeTransition.time === clock) return;
|
|
257
259
|
if (!activeTransition) {
|
|
258
|
-
activeTransition = e
|
|
260
|
+
activeTransition = e ?? {
|
|
259
261
|
time: clock,
|
|
260
262
|
pendingNodes: [],
|
|
261
263
|
asyncNodes: [],
|
|
@@ -264,21 +266,26 @@ class GlobalQueue extends Queue {
|
|
|
264
266
|
queueStash: { G: [[], []], H: [] },
|
|
265
267
|
done: false
|
|
266
268
|
};
|
|
269
|
+
} else if (e) {
|
|
270
|
+
activeTransition.done = e;
|
|
271
|
+
e.actions.push(...activeTransition.actions);
|
|
272
|
+
transitions.delete(activeTransition);
|
|
273
|
+
activeTransition = e;
|
|
267
274
|
}
|
|
268
275
|
transitions.add(activeTransition);
|
|
269
276
|
activeTransition.time = clock;
|
|
270
|
-
for (let e = 0; e < this
|
|
271
|
-
const t = this
|
|
277
|
+
for (let e = 0; e < this.L.length; e++) {
|
|
278
|
+
const t = this.L[e];
|
|
272
279
|
t.K = activeTransition;
|
|
273
280
|
activeTransition.pendingNodes.push(t);
|
|
274
281
|
}
|
|
275
|
-
for (let e = 0; e < this
|
|
276
|
-
const t = this
|
|
282
|
+
for (let e = 0; e < this.$.length; e++) {
|
|
283
|
+
const t = this.$[e];
|
|
277
284
|
t.K = activeTransition;
|
|
278
285
|
activeTransition.optimisticNodes.push(t);
|
|
279
286
|
}
|
|
280
|
-
this
|
|
281
|
-
this
|
|
287
|
+
this.L = activeTransition.pendingNodes;
|
|
288
|
+
this.$ = activeTransition.optimisticNodes;
|
|
282
289
|
}
|
|
283
290
|
}
|
|
284
291
|
function notifySubs(e) {
|
|
@@ -290,7 +297,7 @@ function notifySubs(e) {
|
|
|
290
297
|
}
|
|
291
298
|
function runOptimistic(e = null) {
|
|
292
299
|
let t = !e;
|
|
293
|
-
const n = globalQueue
|
|
300
|
+
const n = globalQueue.$;
|
|
294
301
|
optimisticRun = true;
|
|
295
302
|
for (let t = 0; t < n.length; t++) {
|
|
296
303
|
const i = n[t];
|
|
@@ -301,13 +308,13 @@ function runOptimistic(e = null) {
|
|
|
301
308
|
i.K = e;
|
|
302
309
|
notifySubs(i);
|
|
303
310
|
}
|
|
304
|
-
globalQueue
|
|
311
|
+
globalQueue.$ = [];
|
|
305
312
|
if (dirtyQueue.h >= dirtyQueue.C) {
|
|
306
313
|
t = true;
|
|
307
314
|
runHeap(dirtyQueue, GlobalQueue.F);
|
|
308
315
|
}
|
|
309
316
|
optimisticRun = false;
|
|
310
|
-
t && runPending(globalQueue
|
|
317
|
+
t && runPending(globalQueue.L);
|
|
311
318
|
}
|
|
312
319
|
function runPending(e) {
|
|
313
320
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -326,7 +333,10 @@ function runTransitionPending(e, t) {
|
|
|
326
333
|
for (let e = 0; e < n.length; e++) {
|
|
327
334
|
const i = n[e];
|
|
328
335
|
i.K = activeTransition;
|
|
329
|
-
if (i.q)
|
|
336
|
+
if (i.q) {
|
|
337
|
+
i.q.K = activeTransition;
|
|
338
|
+
i.q.Z(t);
|
|
339
|
+
}
|
|
330
340
|
}
|
|
331
341
|
}
|
|
332
342
|
const globalQueue = new GlobalQueue();
|
|
@@ -351,10 +361,15 @@ function transitionComplete(e) {
|
|
|
351
361
|
t && (e.done = true);
|
|
352
362
|
return t;
|
|
353
363
|
}
|
|
364
|
+
function currentTransition(e) {
|
|
365
|
+
while (e.done && typeof e.done === "object") e = e.done;
|
|
366
|
+
return e;
|
|
367
|
+
}
|
|
354
368
|
function runInTransition(e, t) {
|
|
355
369
|
const n = activeTransition;
|
|
370
|
+
activeTransition = null;
|
|
356
371
|
try {
|
|
357
|
-
activeTransition = e;
|
|
372
|
+
activeTransition = currentTransition(e);
|
|
358
373
|
return t();
|
|
359
374
|
} finally {
|
|
360
375
|
activeTransition = n;
|
|
@@ -373,6 +388,7 @@ function action(e) {
|
|
|
373
388
|
};
|
|
374
389
|
const process = e => {
|
|
375
390
|
if (e.done) {
|
|
391
|
+
i = currentTransition(i);
|
|
376
392
|
i.actions.splice(i.actions.indexOf(n), 1);
|
|
377
393
|
activeTransition = i;
|
|
378
394
|
schedule();
|
|
@@ -380,7 +396,7 @@ function action(e) {
|
|
|
380
396
|
return;
|
|
381
397
|
}
|
|
382
398
|
const t = e.value;
|
|
383
|
-
if (t instanceof Promise) return t.then(step);
|
|
399
|
+
if (t instanceof Promise) return t.then(e => runInTransition(i, () => step(e)));
|
|
384
400
|
runInTransition(i, () => step(t));
|
|
385
401
|
};
|
|
386
402
|
runInTransition(i, () => step());
|
|
@@ -397,7 +413,7 @@ let context = null;
|
|
|
397
413
|
function recompute(e, t = false) {
|
|
398
414
|
const n = e.B && e.K != activeTransition;
|
|
399
415
|
if (!t) {
|
|
400
|
-
if (e.K && activeTransition !== e.K && !n) globalQueue.initTransition(e);
|
|
416
|
+
if (e.K && activeTransition !== e.K && !n) globalQueue.initTransition(e.K);
|
|
401
417
|
deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
402
418
|
if (e.K) disposeChildren(e);
|
|
403
419
|
else {
|
|
@@ -446,6 +462,7 @@ function recompute(e, t = false) {
|
|
|
446
462
|
}
|
|
447
463
|
const c = !e.ue || !e.ue(e.M === NOT_PENDING || (e.oe && e.K) || n ? e.Y : e.M, r);
|
|
448
464
|
const a = e.J !== o || e.j !== u;
|
|
465
|
+
if (e.N && e.J & STATUS_PENDING && activeTransition) activeTransition.asyncNodes.push(e);
|
|
449
466
|
e.le?.(a, o);
|
|
450
467
|
if (c || a) {
|
|
451
468
|
if (c) {
|
|
@@ -459,8 +476,8 @@ function recompute(e, t = false) {
|
|
|
459
476
|
insertIntoHeapHeight(t.A, t.A.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
460
477
|
}
|
|
461
478
|
}
|
|
462
|
-
e.oe && !optimisticRun && globalQueue
|
|
463
|
-
(!t || e.J & STATUS_PENDING) && !e.K && globalQueue
|
|
479
|
+
e.oe && !optimisticRun && globalQueue.$.push(e);
|
|
480
|
+
(!t || e.J & STATUS_PENDING) && !e.K && globalQueue.L.push(e);
|
|
464
481
|
e.K && n && runInTransition(e.K, () => recompute(e));
|
|
465
482
|
}
|
|
466
483
|
function handleAsync(e, t, n) {
|
|
@@ -475,12 +492,12 @@ function handleAsync(e, t, n) {
|
|
|
475
492
|
if (r) {
|
|
476
493
|
t.then(i => {
|
|
477
494
|
if (e.ae !== t) return;
|
|
478
|
-
globalQueue.initTransition(e);
|
|
479
|
-
n
|
|
495
|
+
globalQueue.initTransition(e.K);
|
|
496
|
+
n ? n(i) : setSignal(e, () => i);
|
|
480
497
|
flush();
|
|
481
498
|
}).catch(n => {
|
|
482
499
|
if (e.ae !== t) return;
|
|
483
|
-
globalQueue.initTransition(e);
|
|
500
|
+
globalQueue.initTransition(e.K);
|
|
484
501
|
setStatusFlags(e, STATUS_ERROR, n);
|
|
485
502
|
e.se = clock;
|
|
486
503
|
notifySubs(e);
|
|
@@ -492,13 +509,13 @@ function handleAsync(e, t, n) {
|
|
|
492
509
|
try {
|
|
493
510
|
for await (let i of t) {
|
|
494
511
|
if (e.ae !== t) return;
|
|
495
|
-
globalQueue.initTransition(e);
|
|
496
|
-
n
|
|
512
|
+
globalQueue.initTransition(e.K);
|
|
513
|
+
n ? n(i) : setSignal(e, () => i);
|
|
497
514
|
flush();
|
|
498
515
|
}
|
|
499
516
|
} catch (n) {
|
|
500
517
|
if (e.ae !== t) return;
|
|
501
|
-
globalQueue.initTransition(e);
|
|
518
|
+
globalQueue.initTransition(e.K);
|
|
502
519
|
setStatusFlags(e, STATUS_ERROR, n);
|
|
503
520
|
e.se = clock;
|
|
504
521
|
notifySubs(e);
|
|
@@ -507,7 +524,7 @@ function handleAsync(e, t, n) {
|
|
|
507
524
|
}
|
|
508
525
|
})();
|
|
509
526
|
}
|
|
510
|
-
globalQueue.initTransition(e);
|
|
527
|
+
globalQueue.initTransition(e.K);
|
|
511
528
|
throw new NotReadyError(context);
|
|
512
529
|
}
|
|
513
530
|
function updateIfNecessary(e) {
|
|
@@ -805,6 +822,7 @@ function read(e) {
|
|
|
805
822
|
: e.M;
|
|
806
823
|
}
|
|
807
824
|
function setSignal(e, t) {
|
|
825
|
+
if (e.K && activeTransition !== e.K) globalQueue.initTransition(e.K);
|
|
808
826
|
if (typeof t === "function") {
|
|
809
827
|
t = t(e.M === NOT_PENDING || (e.oe && e.K) ? e.Y : e.M);
|
|
810
828
|
}
|
|
@@ -813,14 +831,14 @@ function setSignal(e, t) {
|
|
|
813
831
|
if (n) {
|
|
814
832
|
if (e.oe) e.Y = t;
|
|
815
833
|
else {
|
|
816
|
-
if (e.M === NOT_PENDING) globalQueue
|
|
834
|
+
if (e.M === NOT_PENDING) globalQueue.L.push(e);
|
|
817
835
|
e.M = t;
|
|
818
836
|
}
|
|
819
837
|
if (e.ce) setSignal(e.ce, t);
|
|
820
838
|
}
|
|
821
839
|
setStatusFlags(e, STATUS_NONE);
|
|
822
840
|
e.se = clock;
|
|
823
|
-
e.oe && !optimisticRun ? globalQueue
|
|
841
|
+
e.oe && !optimisticRun ? globalQueue.$.push(e) : notifySubs(e);
|
|
824
842
|
schedule();
|
|
825
843
|
return t;
|
|
826
844
|
}
|
|
@@ -878,11 +896,14 @@ function createRoot(e, t) {
|
|
|
878
896
|
}
|
|
879
897
|
function runWithOwner(e, t) {
|
|
880
898
|
const n = context;
|
|
899
|
+
const i = tracking;
|
|
881
900
|
context = e;
|
|
901
|
+
tracking = false;
|
|
882
902
|
try {
|
|
883
903
|
return t();
|
|
884
904
|
} finally {
|
|
885
905
|
context = n;
|
|
906
|
+
tracking = i;
|
|
886
907
|
}
|
|
887
908
|
}
|
|
888
909
|
function staleValues(e, t = true) {
|
|
@@ -968,8 +989,8 @@ function effect(e, t, n, i, r) {
|
|
|
968
989
|
pe: {
|
|
969
990
|
X: true,
|
|
970
991
|
Ae: i,
|
|
971
|
-
|
|
972
|
-
|
|
992
|
+
Ne: t,
|
|
993
|
+
ge: n,
|
|
973
994
|
Ie: undefined,
|
|
974
995
|
B: r?.render ? EFFECT_RENDER : EFFECT_USER,
|
|
975
996
|
le(e, t) {
|
|
@@ -983,8 +1004,8 @@ function effect(e, t, n, i, r) {
|
|
|
983
1004
|
this._e.notify(this, STATUS_PENDING, 0);
|
|
984
1005
|
if (this.B === EFFECT_USER) {
|
|
985
1006
|
try {
|
|
986
|
-
return this.
|
|
987
|
-
? this.
|
|
1007
|
+
return this.ge
|
|
1008
|
+
? this.ge(e, () => {
|
|
988
1009
|
this.Ie?.();
|
|
989
1010
|
this.Ie = undefined;
|
|
990
1011
|
})
|
|
@@ -1012,7 +1033,7 @@ function runEffect() {
|
|
|
1012
1033
|
this.Ie?.();
|
|
1013
1034
|
this.Ie = undefined;
|
|
1014
1035
|
try {
|
|
1015
|
-
this.Ie = this.
|
|
1036
|
+
this.Ie = this.Ne(this.Y, this.Ae);
|
|
1016
1037
|
} catch (e) {
|
|
1017
1038
|
if (!this._e.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1018
1039
|
} finally {
|
|
@@ -1025,10 +1046,8 @@ function createSignal(e, t, n) {
|
|
|
1025
1046
|
const i = computed(e, t, n);
|
|
1026
1047
|
return [read.bind(null, i), setSignal.bind(null, i)];
|
|
1027
1048
|
}
|
|
1028
|
-
const i =
|
|
1029
|
-
|
|
1030
|
-
const s = signal(e, r ? { id: getNextChildId(i), ...t } : t);
|
|
1031
|
-
return [read.bind(null, s), setSignal.bind(null, s)];
|
|
1049
|
+
const i = signal(e, t);
|
|
1050
|
+
return [read.bind(null, i), setSignal.bind(null, i)];
|
|
1032
1051
|
}
|
|
1033
1052
|
function createMemo(e, t, n) {
|
|
1034
1053
|
let i = computed(e, t, n);
|
|
@@ -1080,8 +1099,10 @@ function createOptimistic(e, t, n) {
|
|
|
1080
1099
|
if (typeof e === "function") {
|
|
1081
1100
|
const i = computed(
|
|
1082
1101
|
t => {
|
|
1083
|
-
|
|
1084
|
-
|
|
1102
|
+
const n = getOwner();
|
|
1103
|
+
const i = e(t);
|
|
1104
|
+
if (n.J & STATUS_UNINITIALIZED) return i;
|
|
1105
|
+
n.M = i;
|
|
1085
1106
|
return t;
|
|
1086
1107
|
},
|
|
1087
1108
|
t,
|
|
@@ -1090,15 +1111,13 @@ function createOptimistic(e, t, n) {
|
|
|
1090
1111
|
i.oe = true;
|
|
1091
1112
|
return [read.bind(null, i), setSignal.bind(null, i)];
|
|
1092
1113
|
}
|
|
1093
|
-
const i =
|
|
1094
|
-
|
|
1095
|
-
const s = signal(e, r ? { id: getNextChildId(i), ...t } : t);
|
|
1096
|
-
s.oe = true;
|
|
1114
|
+
const i = signal(e, t);
|
|
1115
|
+
i.oe = true;
|
|
1097
1116
|
return [
|
|
1098
|
-
read.bind(null,
|
|
1117
|
+
read.bind(null, i),
|
|
1099
1118
|
t => {
|
|
1100
|
-
|
|
1101
|
-
return setSignal(
|
|
1119
|
+
i.M = e;
|
|
1120
|
+
return setSignal(i, t);
|
|
1102
1121
|
}
|
|
1103
1122
|
];
|
|
1104
1123
|
}
|
|
@@ -1266,13 +1285,13 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1266
1285
|
};
|
|
1267
1286
|
const s = wrapProjection(t);
|
|
1268
1287
|
i = computed(() => {
|
|
1269
|
-
const t =
|
|
1270
|
-
storeSetter(new Proxy(s, writeTraps),
|
|
1271
|
-
const
|
|
1288
|
+
const t = getOwner();
|
|
1289
|
+
storeSetter(new Proxy(s, writeTraps), i => {
|
|
1290
|
+
const r = handleAsync(t, e(i), e => {
|
|
1272
1291
|
e !== s && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
|
|
1273
|
-
setSignal(
|
|
1292
|
+
setSignal(t, undefined);
|
|
1274
1293
|
});
|
|
1275
|
-
|
|
1294
|
+
r !== s && r !== undefined && reconcile(r, n?.key || "id", n?.all)(s);
|
|
1276
1295
|
});
|
|
1277
1296
|
});
|
|
1278
1297
|
i.Te = true;
|
|
@@ -1779,8 +1798,8 @@ function mapArray(e, t, n) {
|
|
|
1779
1798
|
Ve: [],
|
|
1780
1799
|
me: i,
|
|
1781
1800
|
Ue: i || n?.keyed === false ? [] : undefined,
|
|
1782
|
-
|
|
1783
|
-
|
|
1801
|
+
ve: t.length > 1 ? [] : undefined,
|
|
1802
|
+
ke: n?.fallback
|
|
1784
1803
|
})
|
|
1785
1804
|
);
|
|
1786
1805
|
}
|
|
@@ -1795,17 +1814,17 @@ function updateKeyedMap() {
|
|
|
1795
1814
|
r = this.Ue
|
|
1796
1815
|
? () => {
|
|
1797
1816
|
this.Ue[i] = signal(e[i], pureOptions);
|
|
1798
|
-
this.
|
|
1817
|
+
this.ve && (this.ve[i] = signal(i, pureOptions));
|
|
1799
1818
|
return this.we(
|
|
1800
1819
|
read.bind(null, this.Ue[i]),
|
|
1801
|
-
this.
|
|
1820
|
+
this.ve ? read.bind(null, this.ve[i]) : undefined
|
|
1802
1821
|
);
|
|
1803
1822
|
}
|
|
1804
|
-
: this.
|
|
1823
|
+
: this.ve
|
|
1805
1824
|
? () => {
|
|
1806
1825
|
const t = e[i];
|
|
1807
|
-
this.
|
|
1808
|
-
return this.we(() => t, read.bind(null, this.
|
|
1826
|
+
this.ve[i] = signal(i, pureOptions);
|
|
1827
|
+
return this.we(() => t, read.bind(null, this.ve[i]));
|
|
1809
1828
|
}
|
|
1810
1829
|
: () => {
|
|
1811
1830
|
const t = e[i];
|
|
@@ -1819,10 +1838,10 @@ function updateKeyedMap() {
|
|
|
1819
1838
|
this.be = [];
|
|
1820
1839
|
this.Ce = 0;
|
|
1821
1840
|
this.Ue && (this.Ue = []);
|
|
1822
|
-
this.
|
|
1841
|
+
this.ve && (this.ve = []);
|
|
1823
1842
|
}
|
|
1824
|
-
if (this.
|
|
1825
|
-
this.be[0] = runWithOwner((this.Ve[0] = createOwner()), this.
|
|
1843
|
+
if (this.ke && !this.be[0]) {
|
|
1844
|
+
this.be[0] = runWithOwner((this.Ve[0] = createOwner()), this.ke);
|
|
1826
1845
|
}
|
|
1827
1846
|
} else if (this.Ce === 0) {
|
|
1828
1847
|
if (this.Ve[0]) this.Ve[0].dispose();
|
|
@@ -1843,7 +1862,7 @@ function updateKeyedMap() {
|
|
|
1843
1862
|
E = new Array(t),
|
|
1844
1863
|
d = new Array(t),
|
|
1845
1864
|
T = this.Ue ? new Array(t) : undefined,
|
|
1846
|
-
R = this.
|
|
1865
|
+
R = this.ve ? new Array(t) : undefined;
|
|
1847
1866
|
for (
|
|
1848
1867
|
s = 0, o = Math.min(this.Ce, t);
|
|
1849
1868
|
s < o && (this.Pe[s] === e[s] || (this.Ue && compare(this.me, this.Pe[s], e[s])));
|
|
@@ -1861,7 +1880,7 @@ function updateKeyedMap() {
|
|
|
1861
1880
|
E[u] = this.be[o];
|
|
1862
1881
|
d[u] = this.Ve[o];
|
|
1863
1882
|
T && (T[u] = this.Ue[o]);
|
|
1864
|
-
R && (R[u] = this.
|
|
1883
|
+
R && (R[u] = this.ve[o]);
|
|
1865
1884
|
}
|
|
1866
1885
|
a = new Map();
|
|
1867
1886
|
f = new Array(u + 1);
|
|
@@ -1880,7 +1899,7 @@ function updateKeyedMap() {
|
|
|
1880
1899
|
E[i] = this.be[n];
|
|
1881
1900
|
d[i] = this.Ve[n];
|
|
1882
1901
|
T && (T[i] = this.Ue[n]);
|
|
1883
|
-
R && (R[i] = this.
|
|
1902
|
+
R && (R[i] = this.ve[n]);
|
|
1884
1903
|
i = f[i];
|
|
1885
1904
|
a.set(c, i);
|
|
1886
1905
|
} else this.Ve[n].dispose();
|
|
@@ -1894,8 +1913,8 @@ function updateKeyedMap() {
|
|
|
1894
1913
|
setSignal(this.Ue[i], e[i]);
|
|
1895
1914
|
}
|
|
1896
1915
|
if (R) {
|
|
1897
|
-
this.
|
|
1898
|
-
setSignal(this.
|
|
1916
|
+
this.ve[i] = R[i];
|
|
1917
|
+
setSignal(this.ve[i], i);
|
|
1899
1918
|
}
|
|
1900
1919
|
} else {
|
|
1901
1920
|
this.be[i] = runWithOwner((this.Ve[i] = createOwner()), r);
|
|
@@ -1917,7 +1936,7 @@ function repeat(e, t, n) {
|
|
|
1917
1936
|
Ve: [],
|
|
1918
1937
|
be: [],
|
|
1919
1938
|
He: n?.from,
|
|
1920
|
-
|
|
1939
|
+
ke: n?.fallback
|
|
1921
1940
|
});
|
|
1922
1941
|
}
|
|
1923
1942
|
function updateRepeat() {
|
|
@@ -1931,8 +1950,8 @@ function updateRepeat() {
|
|
|
1931
1950
|
this.be = [];
|
|
1932
1951
|
this.Ce = 0;
|
|
1933
1952
|
}
|
|
1934
|
-
if (this.
|
|
1935
|
-
this.be[0] = runWithOwner((this.Ve[0] = createOwner()), this.
|
|
1953
|
+
if (this.ke && !this.be[0]) {
|
|
1954
|
+
this.be[0] = runWithOwner((this.Ve[0] = createOwner()), this.ke);
|
|
1936
1955
|
}
|
|
1937
1956
|
return;
|
|
1938
1957
|
}
|
|
@@ -1998,30 +2017,30 @@ function createBoundChildren(e, t, n, i) {
|
|
|
1998
2017
|
});
|
|
1999
2018
|
}
|
|
2000
2019
|
class ConditionalQueue extends Queue {
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2020
|
+
Le;
|
|
2021
|
+
$e = new Set();
|
|
2022
|
+
L = new Set();
|
|
2004
2023
|
constructor(e) {
|
|
2005
2024
|
super();
|
|
2006
|
-
this
|
|
2025
|
+
this.Le = e;
|
|
2007
2026
|
}
|
|
2008
2027
|
run(e) {
|
|
2009
|
-
if (!e || read(this
|
|
2028
|
+
if (!e || read(this.Le)) return;
|
|
2010
2029
|
return super.run(e);
|
|
2011
2030
|
}
|
|
2012
2031
|
notify(e, t, n) {
|
|
2013
|
-
if (read(this
|
|
2032
|
+
if (read(this.Le)) {
|
|
2014
2033
|
if (t & STATUS_PENDING) {
|
|
2015
2034
|
if (n & STATUS_PENDING) {
|
|
2016
|
-
this
|
|
2035
|
+
this.L.add(e);
|
|
2017
2036
|
t &= ~STATUS_PENDING;
|
|
2018
|
-
} else if (this
|
|
2037
|
+
} else if (this.L.delete(e)) t &= ~STATUS_PENDING;
|
|
2019
2038
|
}
|
|
2020
2039
|
if (t & STATUS_ERROR) {
|
|
2021
2040
|
if (n & STATUS_ERROR) {
|
|
2022
|
-
this.
|
|
2041
|
+
this.$e.add(e);
|
|
2023
2042
|
t &= ~STATUS_ERROR;
|
|
2024
|
-
} else if (this.
|
|
2043
|
+
} else if (this.$e.delete(e)) t &= ~STATUS_ERROR;
|
|
2025
2044
|
}
|
|
2026
2045
|
}
|
|
2027
2046
|
return t ? super.notify(e, t, n) : true;
|
|
@@ -2030,24 +2049,24 @@ class ConditionalQueue extends Queue {
|
|
|
2030
2049
|
class CollectionQueue extends Queue {
|
|
2031
2050
|
Fe;
|
|
2032
2051
|
Ve = new Set();
|
|
2033
|
-
|
|
2052
|
+
Le = signal(false, { pureWrite: true });
|
|
2034
2053
|
We = false;
|
|
2035
2054
|
constructor(e) {
|
|
2036
2055
|
super();
|
|
2037
2056
|
this.Fe = e;
|
|
2038
2057
|
}
|
|
2039
2058
|
run(e) {
|
|
2040
|
-
if (!e || read(this
|
|
2059
|
+
if (!e || read(this.Le)) return;
|
|
2041
2060
|
return super.run(e);
|
|
2042
2061
|
}
|
|
2043
2062
|
notify(e, t, n) {
|
|
2044
2063
|
if (!(t & this.Fe) || (this.Fe & STATUS_PENDING && this.We)) return super.notify(e, t, n);
|
|
2045
2064
|
if (n & this.Fe) {
|
|
2046
2065
|
this.Ve.add(e);
|
|
2047
|
-
if (this.Ve.size === 1) setSignal(this
|
|
2066
|
+
if (this.Ve.size === 1) setSignal(this.Le, true);
|
|
2048
2067
|
} else if (this.Ve.size > 0) {
|
|
2049
2068
|
this.Ve.delete(e);
|
|
2050
|
-
if (this.Ve.size === 0) setSignal(this
|
|
2069
|
+
if (this.Ve.size === 0) setSignal(this.Le, false);
|
|
2051
2070
|
}
|
|
2052
2071
|
t &= ~this.Fe;
|
|
2053
2072
|
return t ? super.notify(e, t, n) : true;
|
|
@@ -2063,25 +2082,25 @@ function createBoundary(e, t) {
|
|
|
2063
2082
|
const i = new ConditionalQueue(computed(() => t() === BoundaryMode.HIDDEN));
|
|
2064
2083
|
const r = createBoundChildren(n, e, i, 0);
|
|
2065
2084
|
computed(() => {
|
|
2066
|
-
const e = read(i
|
|
2085
|
+
const e = read(i.Le);
|
|
2067
2086
|
r.Qe = e ? STATUS_ERROR | STATUS_PENDING : 0;
|
|
2068
2087
|
if (!e) {
|
|
2069
|
-
i
|
|
2070
|
-
i.
|
|
2071
|
-
i
|
|
2072
|
-
i.
|
|
2088
|
+
i.L.forEach(e => i.notify(e, STATUS_PENDING, STATUS_PENDING));
|
|
2089
|
+
i.$e.forEach(e => i.notify(e, STATUS_ERROR, STATUS_ERROR));
|
|
2090
|
+
i.L.clear();
|
|
2091
|
+
i.$e.clear();
|
|
2073
2092
|
}
|
|
2074
2093
|
});
|
|
2075
|
-
return () => (read(i
|
|
2094
|
+
return () => (read(i.Le) ? undefined : read(r));
|
|
2076
2095
|
}
|
|
2077
2096
|
function createCollectionBoundary(e, t, n) {
|
|
2078
2097
|
const i = createOwner();
|
|
2079
2098
|
const r = new CollectionQueue(e);
|
|
2080
2099
|
const s = createBoundChildren(i, t, r, e);
|
|
2081
2100
|
const o = computed(() => {
|
|
2082
|
-
if (!read(r
|
|
2101
|
+
if (!read(r.Le)) {
|
|
2083
2102
|
const e = read(s);
|
|
2084
|
-
if (!untrack(() => read(r
|
|
2103
|
+
if (!untrack(() => read(r.Le))) r.We = true;
|
|
2085
2104
|
return e;
|
|
2086
2105
|
}
|
|
2087
2106
|
return n(r);
|
|
@@ -52,7 +52,7 @@ export declare class GlobalQueue extends Queue {
|
|
|
52
52
|
static _dispose: (el: Computed<unknown>, self: boolean, zombie: boolean) => void;
|
|
53
53
|
flush(): void;
|
|
54
54
|
notify(node: Computed<any>, mask: number, flags: number): boolean;
|
|
55
|
-
initTransition(
|
|
55
|
+
initTransition(transition?: Transition | null): void;
|
|
56
56
|
}
|
|
57
57
|
export declare function notifySubs(node: Signal<any> | Computed<any>): void;
|
|
58
58
|
export declare function runOptimistic(activeTransition?: Transition | null): void;
|