@solidjs/signals 0.13.5 → 0.13.7
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 +297 -228
- package/dist/node.cjs +497 -457
- package/dist/prod.js +605 -565
- package/dist/types/core/scheduler.d.ts +5 -5
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -82,10 +82,10 @@ function deleteFromHeap(e, t) {
|
|
|
82
82
|
else {
|
|
83
83
|
const n = e.S;
|
|
84
84
|
const r = t.l[i];
|
|
85
|
-
const
|
|
85
|
+
const s = n ?? r;
|
|
86
86
|
if (e === r) t.l[i] = n;
|
|
87
87
|
else e.T.S = n;
|
|
88
|
-
|
|
88
|
+
s.T = e.T;
|
|
89
89
|
}
|
|
90
90
|
e.T = e;
|
|
91
91
|
e.S = undefined;
|
|
@@ -189,9 +189,9 @@ function mergeTransitionState(e, t) {
|
|
|
189
189
|
if (n.K === t) n.K = e;
|
|
190
190
|
}
|
|
191
191
|
e.Y.push(...t.Y);
|
|
192
|
-
for (const n of t.
|
|
193
|
-
for (const n of t.
|
|
194
|
-
if (!e.
|
|
192
|
+
for (const n of t.Z) e.Z.add(n);
|
|
193
|
+
for (const n of t.B) {
|
|
194
|
+
if (!e.B.includes(n)) e.B.push(n);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
function resolveOptimisticNodes(e) {
|
|
@@ -230,20 +230,6 @@ function schedule() {
|
|
|
230
230
|
scheduled = true;
|
|
231
231
|
if (!globalQueue.ne && !projectionWriteActive) queueMicrotask(flush);
|
|
232
232
|
}
|
|
233
|
-
function addTransitionBlocker(e) {
|
|
234
|
-
if (activeTransition && !activeTransition.Z.includes(e)) {
|
|
235
|
-
activeTransition.Z.push(e);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
function removeTransitionBlocker(e) {
|
|
239
|
-
const remove = t => {
|
|
240
|
-
if (!t) return;
|
|
241
|
-
const n = t.indexOf(e);
|
|
242
|
-
if (n >= 0) t.splice(n, 1);
|
|
243
|
-
};
|
|
244
|
-
remove(e.K?.Z);
|
|
245
|
-
remove(activeTransition?.Z);
|
|
246
|
-
}
|
|
247
233
|
class Queue {
|
|
248
234
|
i = null;
|
|
249
235
|
ie = [[], []];
|
|
@@ -309,31 +295,31 @@ class Queue {
|
|
|
309
295
|
}
|
|
310
296
|
class GlobalQueue extends Queue {
|
|
311
297
|
ne = false;
|
|
312
|
-
|
|
298
|
+
se = [];
|
|
313
299
|
Y = [];
|
|
314
|
-
|
|
315
|
-
static
|
|
300
|
+
Z = new Set();
|
|
301
|
+
static oe;
|
|
316
302
|
static ue;
|
|
317
303
|
static ce = null;
|
|
318
304
|
flush() {
|
|
319
305
|
if (this.ne) return;
|
|
320
306
|
this.ne = true;
|
|
321
307
|
try {
|
|
322
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
308
|
+
runHeap(dirtyQueue, GlobalQueue.oe);
|
|
323
309
|
if (activeTransition) {
|
|
324
310
|
const e = transitionComplete(activeTransition);
|
|
325
311
|
if (!e) {
|
|
326
312
|
const e = activeTransition;
|
|
327
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
328
|
-
this.
|
|
313
|
+
runHeap(zombieQueue, GlobalQueue.oe);
|
|
314
|
+
this.se = [];
|
|
329
315
|
this.Y = [];
|
|
330
|
-
this.
|
|
316
|
+
this.Z = new Set();
|
|
331
317
|
runLaneEffects(EFFECT_RENDER);
|
|
332
318
|
runLaneEffects(EFFECT_USER);
|
|
333
319
|
this.stashQueues(e.ae);
|
|
334
320
|
clock++;
|
|
335
321
|
scheduled = dirtyQueue.R >= dirtyQueue.P;
|
|
336
|
-
reassignPendingTransition(e.
|
|
322
|
+
reassignPendingTransition(e.se);
|
|
337
323
|
activeTransition = null;
|
|
338
324
|
if (!e.j.length && e.Y.length) {
|
|
339
325
|
stashedOptimisticReads = new Set();
|
|
@@ -351,15 +337,15 @@ class GlobalQueue extends Queue {
|
|
|
351
337
|
}
|
|
352
338
|
return;
|
|
353
339
|
}
|
|
354
|
-
this.
|
|
340
|
+
this.se !== activeTransition.se && this.se.push(...activeTransition.se);
|
|
355
341
|
this.restoreQueues(activeTransition.ae);
|
|
356
342
|
transitions.delete(activeTransition);
|
|
357
343
|
const t = activeTransition;
|
|
358
344
|
activeTransition = null;
|
|
359
|
-
reassignPendingTransition(this.
|
|
345
|
+
reassignPendingTransition(this.se);
|
|
360
346
|
finalizePureQueue(t);
|
|
361
347
|
} else {
|
|
362
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
348
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.oe);
|
|
363
349
|
finalizePureQueue();
|
|
364
350
|
}
|
|
365
351
|
clock++;
|
|
@@ -378,8 +364,8 @@ class GlobalQueue extends Queue {
|
|
|
378
364
|
const t = i !== undefined ? i : e.le;
|
|
379
365
|
if (activeTransition && t) {
|
|
380
366
|
const e = t.source;
|
|
381
|
-
if (!activeTransition.
|
|
382
|
-
activeTransition.
|
|
367
|
+
if (!activeTransition.B.includes(e)) {
|
|
368
|
+
activeTransition.B.push(e);
|
|
383
369
|
schedule();
|
|
384
370
|
}
|
|
385
371
|
}
|
|
@@ -395,10 +381,10 @@ class GlobalQueue extends Queue {
|
|
|
395
381
|
if (!activeTransition) {
|
|
396
382
|
activeTransition = e ?? {
|
|
397
383
|
Ee: clock,
|
|
398
|
-
|
|
399
|
-
|
|
384
|
+
se: [],
|
|
385
|
+
B: [],
|
|
400
386
|
Y: [],
|
|
401
|
-
|
|
387
|
+
Z: new Set(),
|
|
402
388
|
j: [],
|
|
403
389
|
ae: { ie: [[], []], re: [] },
|
|
404
390
|
$: false
|
|
@@ -411,13 +397,13 @@ class GlobalQueue extends Queue {
|
|
|
411
397
|
}
|
|
412
398
|
transitions.add(activeTransition);
|
|
413
399
|
activeTransition.Ee = clock;
|
|
414
|
-
if (this.
|
|
415
|
-
for (let e = 0; e < this.
|
|
416
|
-
const t = this.
|
|
400
|
+
if (this.se !== activeTransition.se) {
|
|
401
|
+
for (let e = 0; e < this.se.length; e++) {
|
|
402
|
+
const t = this.se[e];
|
|
417
403
|
t.K = activeTransition;
|
|
418
|
-
activeTransition.
|
|
404
|
+
activeTransition.se.push(t);
|
|
419
405
|
}
|
|
420
|
-
this.
|
|
406
|
+
this.se = activeTransition.se;
|
|
421
407
|
}
|
|
422
408
|
if (this.Y !== activeTransition.Y) {
|
|
423
409
|
for (let e = 0; e < this.Y.length; e++) {
|
|
@@ -430,9 +416,9 @@ class GlobalQueue extends Queue {
|
|
|
430
416
|
for (const e of activeLanes) {
|
|
431
417
|
if (!e.K) e.K = activeTransition;
|
|
432
418
|
}
|
|
433
|
-
if (this.
|
|
434
|
-
for (const e of this.
|
|
435
|
-
this.
|
|
419
|
+
if (this.Z !== activeTransition.Z) {
|
|
420
|
+
for (const e of this.Z) activeTransition.Z.add(e);
|
|
421
|
+
this.Z = activeTransition.Z;
|
|
436
422
|
}
|
|
437
423
|
}
|
|
438
424
|
}
|
|
@@ -459,13 +445,13 @@ function insertSubs(e, t = false) {
|
|
|
459
445
|
}
|
|
460
446
|
continue;
|
|
461
447
|
}
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
464
|
-
insertIntoHeap(r.h,
|
|
448
|
+
const s = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
449
|
+
if (s.P > r.h.o) s.P = r.h.o;
|
|
450
|
+
insertIntoHeap(r.h, s);
|
|
465
451
|
}
|
|
466
452
|
}
|
|
467
453
|
function commitPendingNodes() {
|
|
468
|
-
const e = globalQueue.
|
|
454
|
+
const e = globalQueue.se;
|
|
469
455
|
for (let t = 0; t < e.length; t++) {
|
|
470
456
|
const n = e[t];
|
|
471
457
|
if (n.X !== NOT_PENDING) {
|
|
@@ -482,11 +468,11 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
482
468
|
const n = !t;
|
|
483
469
|
if (n) commitPendingNodes();
|
|
484
470
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
485
|
-
if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.
|
|
471
|
+
if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.oe);
|
|
486
472
|
if (n) {
|
|
487
473
|
commitPendingNodes();
|
|
488
474
|
resolveOptimisticNodes(e ? e.Y : globalQueue.Y);
|
|
489
|
-
const t = e ? e.
|
|
475
|
+
const t = e ? e.Z : globalQueue.Z;
|
|
490
476
|
if (GlobalQueue.ce && t.size) {
|
|
491
477
|
for (const e of t) {
|
|
492
478
|
GlobalQueue.ce(e);
|
|
@@ -504,7 +490,7 @@ function checkBoundaryChildren(e) {
|
|
|
504
490
|
}
|
|
505
491
|
}
|
|
506
492
|
function trackOptimisticStore(e) {
|
|
507
|
-
globalQueue.
|
|
493
|
+
globalQueue.Z.add(e);
|
|
508
494
|
schedule();
|
|
509
495
|
}
|
|
510
496
|
function reassignPendingTransition(e) {
|
|
@@ -514,6 +500,9 @@ function reassignPendingTransition(e) {
|
|
|
514
500
|
}
|
|
515
501
|
const globalQueue = new GlobalQueue();
|
|
516
502
|
function flush() {
|
|
503
|
+
if (globalQueue.ne) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
517
506
|
while (scheduled || activeTransition) {
|
|
518
507
|
globalQueue.flush();
|
|
519
508
|
}
|
|
@@ -525,13 +514,28 @@ function transitionComplete(e) {
|
|
|
525
514
|
if (e.$) return true;
|
|
526
515
|
if (e.j.length) return false;
|
|
527
516
|
let t = true;
|
|
528
|
-
for (let n = 0; n < e.
|
|
529
|
-
const i = e.
|
|
517
|
+
for (let n = 0; n < e.B.length; n++) {
|
|
518
|
+
const i = e.B[n];
|
|
530
519
|
if (i.Se & STATUS_PENDING && i.le?.source === i) {
|
|
531
520
|
t = false;
|
|
532
521
|
break;
|
|
533
522
|
}
|
|
534
523
|
}
|
|
524
|
+
if (t) {
|
|
525
|
+
for (let n = 0; n < e.Y.length; n++) {
|
|
526
|
+
const i = e.Y[n];
|
|
527
|
+
if (
|
|
528
|
+
hasActiveOverride(i) &&
|
|
529
|
+
"Se" in i &&
|
|
530
|
+
i.Se & STATUS_PENDING &&
|
|
531
|
+
i.le instanceof NotReadyError &&
|
|
532
|
+
i.le.source !== i
|
|
533
|
+
) {
|
|
534
|
+
t = false;
|
|
535
|
+
break;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
535
539
|
t && (e.$ = true);
|
|
536
540
|
return t;
|
|
537
541
|
}
|
|
@@ -615,39 +619,230 @@ function assignOrMergeLane(e, t) {
|
|
|
615
619
|
}
|
|
616
620
|
e.q = t;
|
|
617
621
|
}
|
|
622
|
+
function unlinkSubs(e) {
|
|
623
|
+
const t = e.m;
|
|
624
|
+
const n = e.D;
|
|
625
|
+
const i = e.p;
|
|
626
|
+
const r = e.Ie;
|
|
627
|
+
if (i !== null) i.Ie = r;
|
|
628
|
+
else t.pe = r;
|
|
629
|
+
if (r !== null) r.p = i;
|
|
630
|
+
else {
|
|
631
|
+
t.I = i;
|
|
632
|
+
if (i === null) {
|
|
633
|
+
t.he?.();
|
|
634
|
+
t.L && !t.Ae && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return n;
|
|
638
|
+
}
|
|
639
|
+
function unobserved(e) {
|
|
640
|
+
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
641
|
+
let t = e.C;
|
|
642
|
+
while (t !== null) {
|
|
643
|
+
t = unlinkSubs(t);
|
|
644
|
+
}
|
|
645
|
+
e.C = null;
|
|
646
|
+
disposeChildren(e, true);
|
|
647
|
+
}
|
|
648
|
+
function link(e, t) {
|
|
649
|
+
const n = t.Ne;
|
|
650
|
+
if (n !== null && n.m === e) return;
|
|
651
|
+
let i = null;
|
|
652
|
+
const r = t.O & REACTIVE_RECOMPUTING_DEPS;
|
|
653
|
+
if (r) {
|
|
654
|
+
i = n !== null ? n.D : t.C;
|
|
655
|
+
if (i !== null && i.m === e) {
|
|
656
|
+
t.Ne = i;
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
const s = e.pe;
|
|
661
|
+
if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
|
|
662
|
+
const o = (t.Ne = e.pe = { m: e, h: t, D: i, Ie: s, p: null });
|
|
663
|
+
if (n !== null) n.D = o;
|
|
664
|
+
else t.C = o;
|
|
665
|
+
if (s !== null) s.p = o;
|
|
666
|
+
else e.I = o;
|
|
667
|
+
}
|
|
668
|
+
function isValidLink(e, t) {
|
|
669
|
+
const n = t.Ne;
|
|
670
|
+
if (n !== null) {
|
|
671
|
+
let i = t.C;
|
|
672
|
+
do {
|
|
673
|
+
if (i === e) return true;
|
|
674
|
+
if (i === n) break;
|
|
675
|
+
i = i.D;
|
|
676
|
+
} while (i !== null);
|
|
677
|
+
}
|
|
678
|
+
return false;
|
|
679
|
+
}
|
|
680
|
+
const PENDING_OWNER = {};
|
|
681
|
+
function markDisposal(e) {
|
|
682
|
+
let t = e.ge;
|
|
683
|
+
while (t) {
|
|
684
|
+
t.O |= REACTIVE_ZOMBIE;
|
|
685
|
+
if (t.O & REACTIVE_IN_HEAP) {
|
|
686
|
+
deleteFromHeap(t, dirtyQueue);
|
|
687
|
+
insertIntoHeap(t, zombieQueue);
|
|
688
|
+
}
|
|
689
|
+
markDisposal(t);
|
|
690
|
+
t = t.Pe;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
function dispose(e) {
|
|
694
|
+
let t = e.C || null;
|
|
695
|
+
do {
|
|
696
|
+
t = unlinkSubs(t);
|
|
697
|
+
} while (t !== null);
|
|
698
|
+
e.C = null;
|
|
699
|
+
e.Ne = null;
|
|
700
|
+
disposeChildren(e, true);
|
|
701
|
+
}
|
|
702
|
+
function disposeChildren(e, t = false, n) {
|
|
703
|
+
if (e.O & REACTIVE_DISPOSED) return;
|
|
704
|
+
if (t) e.O = REACTIVE_DISPOSED;
|
|
705
|
+
if (t && e.L) e.Ce = null;
|
|
706
|
+
let i = n ? e.De : e.ge;
|
|
707
|
+
while (i) {
|
|
708
|
+
const e = i.Pe;
|
|
709
|
+
if (i.C) {
|
|
710
|
+
const e = i;
|
|
711
|
+
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
712
|
+
let t = e.C;
|
|
713
|
+
do {
|
|
714
|
+
t = unlinkSubs(t);
|
|
715
|
+
} while (t !== null);
|
|
716
|
+
e.C = null;
|
|
717
|
+
e.Ne = null;
|
|
718
|
+
}
|
|
719
|
+
disposeChildren(i, true);
|
|
720
|
+
i = e;
|
|
721
|
+
}
|
|
722
|
+
if (n) {
|
|
723
|
+
e.De = null;
|
|
724
|
+
} else {
|
|
725
|
+
e.ge = null;
|
|
726
|
+
e.ye = 0;
|
|
727
|
+
}
|
|
728
|
+
runDisposal(e, n);
|
|
729
|
+
}
|
|
730
|
+
function runDisposal(e, t) {
|
|
731
|
+
let n = t ? e.me : e.ve;
|
|
732
|
+
if (!n) return;
|
|
733
|
+
if (Array.isArray(n)) {
|
|
734
|
+
for (let e = 0; e < n.length; e++) {
|
|
735
|
+
const t = n[e];
|
|
736
|
+
t.call(t);
|
|
737
|
+
}
|
|
738
|
+
} else {
|
|
739
|
+
n.call(n);
|
|
740
|
+
}
|
|
741
|
+
t ? (e.me = null) : (e.ve = null);
|
|
742
|
+
}
|
|
743
|
+
function childId(e, t) {
|
|
744
|
+
let n = e;
|
|
745
|
+
while (n.we && n.i) n = n.i;
|
|
746
|
+
if (n.id != null) return formatId(n.id, t ? n.ye++ : n.ye);
|
|
747
|
+
throw new Error("Cannot get child id from owner without an id");
|
|
748
|
+
}
|
|
749
|
+
function getNextChildId(e) {
|
|
750
|
+
return childId(e, true);
|
|
751
|
+
}
|
|
752
|
+
function peekNextChildId(e) {
|
|
753
|
+
return childId(e, false);
|
|
754
|
+
}
|
|
755
|
+
function formatId(e, t) {
|
|
756
|
+
const n = t.toString(36),
|
|
757
|
+
i = n.length - 1;
|
|
758
|
+
return e + (i ? String.fromCharCode(64 + i) : "") + n;
|
|
759
|
+
}
|
|
760
|
+
function getObserver() {
|
|
761
|
+
if (pendingCheckActive || latestReadActive) return PENDING_OWNER;
|
|
762
|
+
return tracking ? context : null;
|
|
763
|
+
}
|
|
764
|
+
function getOwner() {
|
|
765
|
+
return context;
|
|
766
|
+
}
|
|
767
|
+
function cleanup(e) {
|
|
768
|
+
if (!context) return e;
|
|
769
|
+
if (!context.ve) context.ve = e;
|
|
770
|
+
else if (Array.isArray(context.ve)) context.ve.push(e);
|
|
771
|
+
else context.ve = [context.ve, e];
|
|
772
|
+
return e;
|
|
773
|
+
}
|
|
774
|
+
function isDisposed(e) {
|
|
775
|
+
return !!(e.O & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
|
|
776
|
+
}
|
|
777
|
+
function createOwner(e) {
|
|
778
|
+
const t = context;
|
|
779
|
+
const n = e?.transparent ?? false;
|
|
780
|
+
const i = {
|
|
781
|
+
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
782
|
+
we: n || undefined,
|
|
783
|
+
t: true,
|
|
784
|
+
u: t?.t ? t.u : t,
|
|
785
|
+
ge: null,
|
|
786
|
+
Pe: null,
|
|
787
|
+
ve: null,
|
|
788
|
+
F: t?.F ?? globalQueue,
|
|
789
|
+
be: t?.be || defaultContext,
|
|
790
|
+
ye: 0,
|
|
791
|
+
me: null,
|
|
792
|
+
De: null,
|
|
793
|
+
i: t,
|
|
794
|
+
dispose(e = true) {
|
|
795
|
+
disposeChildren(i, e);
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
if (t) {
|
|
799
|
+
const e = t.ge;
|
|
800
|
+
if (e === null) {
|
|
801
|
+
t.ge = i;
|
|
802
|
+
} else {
|
|
803
|
+
i.Pe = e;
|
|
804
|
+
t.ge = i;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
return i;
|
|
808
|
+
}
|
|
809
|
+
function createRoot(e, t) {
|
|
810
|
+
const n = createOwner(t);
|
|
811
|
+
return runWithOwner(n, () => e(n.dispose));
|
|
812
|
+
}
|
|
618
813
|
function addPendingSource(e, t) {
|
|
619
|
-
if (e.
|
|
620
|
-
if (!e.
|
|
621
|
-
e.
|
|
814
|
+
if (e.Ve === t || e.Le?.has(t)) return false;
|
|
815
|
+
if (!e.Ve) {
|
|
816
|
+
e.Ve = t;
|
|
622
817
|
return true;
|
|
623
818
|
}
|
|
624
|
-
if (!e.
|
|
625
|
-
e.
|
|
819
|
+
if (!e.Le) {
|
|
820
|
+
e.Le = new Set([e.Ve, t]);
|
|
626
821
|
} else {
|
|
627
|
-
e.
|
|
822
|
+
e.Le.add(t);
|
|
628
823
|
}
|
|
629
|
-
e.
|
|
824
|
+
e.Ve = undefined;
|
|
630
825
|
return true;
|
|
631
826
|
}
|
|
632
827
|
function removePendingSource(e, t) {
|
|
633
|
-
if (e.
|
|
634
|
-
if (e.
|
|
635
|
-
e.
|
|
828
|
+
if (e.Ve) {
|
|
829
|
+
if (e.Ve !== t) return false;
|
|
830
|
+
e.Ve = undefined;
|
|
636
831
|
return true;
|
|
637
832
|
}
|
|
638
|
-
if (!e.
|
|
639
|
-
if (e.
|
|
640
|
-
e.
|
|
641
|
-
e.
|
|
642
|
-
} else if (e.
|
|
643
|
-
e.
|
|
833
|
+
if (!e.Le?.delete(t)) return false;
|
|
834
|
+
if (e.Le.size === 1) {
|
|
835
|
+
e.Ve = e.Le.values().next().value;
|
|
836
|
+
e.Le = undefined;
|
|
837
|
+
} else if (e.Le.size === 0) {
|
|
838
|
+
e.Le = undefined;
|
|
644
839
|
}
|
|
645
840
|
return true;
|
|
646
841
|
}
|
|
647
842
|
function clearPendingSources(e) {
|
|
648
|
-
e.
|
|
649
|
-
e.
|
|
650
|
-
e.
|
|
843
|
+
e.Ve = undefined;
|
|
844
|
+
e.Le?.clear();
|
|
845
|
+
e.Le = undefined;
|
|
651
846
|
}
|
|
652
847
|
function setPendingError(e, t, n) {
|
|
653
848
|
if (!t) {
|
|
@@ -676,7 +871,7 @@ function settlePendingSource(e) {
|
|
|
676
871
|
if (n.has(i) || !removePendingSource(i, e)) return;
|
|
677
872
|
n.add(i);
|
|
678
873
|
i.Ee = clock;
|
|
679
|
-
const r = i.
|
|
874
|
+
const r = i.Ve ?? i.Le?.values().next().value;
|
|
680
875
|
if (r) {
|
|
681
876
|
setPendingError(i, r);
|
|
682
877
|
updatePendingSignal(i);
|
|
@@ -684,7 +879,7 @@ function settlePendingSource(e) {
|
|
|
684
879
|
i.Se &= ~STATUS_PENDING;
|
|
685
880
|
setPendingError(i);
|
|
686
881
|
updatePendingSignal(i);
|
|
687
|
-
if (i.
|
|
882
|
+
if (i.Ue) {
|
|
688
883
|
if (i.W === EFFECT_TRACKED) {
|
|
689
884
|
const e = i;
|
|
690
885
|
if (!e.H) {
|
|
@@ -698,7 +893,7 @@ function settlePendingSource(e) {
|
|
|
698
893
|
}
|
|
699
894
|
t = true;
|
|
700
895
|
}
|
|
701
|
-
i.
|
|
896
|
+
i.Ue = false;
|
|
702
897
|
}
|
|
703
898
|
forEachDependent(i, settle);
|
|
704
899
|
};
|
|
@@ -708,26 +903,26 @@ function settlePendingSource(e) {
|
|
|
708
903
|
function handleAsync(e, t, n) {
|
|
709
904
|
const i = typeof t === "object" && t !== null;
|
|
710
905
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
711
|
-
const
|
|
712
|
-
if (!
|
|
713
|
-
e.
|
|
906
|
+
const s = !r && i && untrack(() => typeof t.then === "function");
|
|
907
|
+
if (!s && !r) {
|
|
908
|
+
e.Ce = null;
|
|
714
909
|
return t;
|
|
715
910
|
}
|
|
716
|
-
e.
|
|
717
|
-
let
|
|
911
|
+
e.Ce = t;
|
|
912
|
+
let o;
|
|
718
913
|
const handleError = n => {
|
|
719
|
-
if (e.
|
|
914
|
+
if (e.Ce !== t) return;
|
|
720
915
|
globalQueue.initTransition(resolveTransition(e));
|
|
721
916
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
722
917
|
e.Ee = clock;
|
|
723
918
|
};
|
|
724
919
|
const asyncWrite = (i, r) => {
|
|
725
|
-
if (e.
|
|
920
|
+
if (e.Ce !== t) return;
|
|
726
921
|
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
727
922
|
globalQueue.initTransition(resolveTransition(e));
|
|
728
923
|
clearStatus(e);
|
|
729
|
-
const
|
|
730
|
-
if (
|
|
924
|
+
const s = resolveLane(e);
|
|
925
|
+
if (s) s.k.delete(e);
|
|
731
926
|
if (n) n(i);
|
|
732
927
|
else if (e.ee !== undefined) {
|
|
733
928
|
if (e.ee !== undefined && e.ee !== NOT_PENDING) e.X = i;
|
|
@@ -736,14 +931,14 @@ function handleAsync(e, t, n) {
|
|
|
736
931
|
insertSubs(e);
|
|
737
932
|
}
|
|
738
933
|
e.Ee = clock;
|
|
739
|
-
} else if (
|
|
934
|
+
} else if (s) {
|
|
740
935
|
const t = e.J;
|
|
741
|
-
const n = e.
|
|
936
|
+
const n = e.ke;
|
|
742
937
|
if (!n || !n(i, t)) {
|
|
743
938
|
e.J = i;
|
|
744
939
|
e.Ee = clock;
|
|
745
|
-
if (e.
|
|
746
|
-
setSignal(e.
|
|
940
|
+
if (e.Ge) {
|
|
941
|
+
setSignal(e.Ge, i);
|
|
747
942
|
}
|
|
748
943
|
insertSubs(e, true);
|
|
749
944
|
}
|
|
@@ -755,13 +950,13 @@ function handleAsync(e, t, n) {
|
|
|
755
950
|
flush();
|
|
756
951
|
r?.();
|
|
757
952
|
};
|
|
758
|
-
if (
|
|
953
|
+
if (s) {
|
|
759
954
|
let n = false,
|
|
760
955
|
i = true;
|
|
761
956
|
t.then(
|
|
762
957
|
e => {
|
|
763
958
|
if (i) {
|
|
764
|
-
|
|
959
|
+
o = e;
|
|
765
960
|
n = true;
|
|
766
961
|
} else asyncWrite(e);
|
|
767
962
|
},
|
|
@@ -778,66 +973,81 @@ function handleAsync(e, t, n) {
|
|
|
778
973
|
if (r) {
|
|
779
974
|
const n = t[Symbol.asyncIterator]();
|
|
780
975
|
let i = false;
|
|
976
|
+
let r = false;
|
|
977
|
+
cleanup(() => {
|
|
978
|
+
if (r) return;
|
|
979
|
+
r = true;
|
|
980
|
+
try {
|
|
981
|
+
const e = n.return?.();
|
|
982
|
+
if (e && typeof e.then === "function") {
|
|
983
|
+
e.then(undefined, () => {});
|
|
984
|
+
}
|
|
985
|
+
} catch {}
|
|
986
|
+
});
|
|
781
987
|
const iterate = () => {
|
|
782
|
-
let
|
|
783
|
-
|
|
784
|
-
|
|
988
|
+
let s,
|
|
989
|
+
u = false,
|
|
990
|
+
c = true;
|
|
785
991
|
n.next().then(
|
|
786
992
|
n => {
|
|
787
|
-
if (
|
|
788
|
-
|
|
789
|
-
|
|
993
|
+
if (c) {
|
|
994
|
+
s = n;
|
|
995
|
+
u = true;
|
|
996
|
+
if (n.done) r = true;
|
|
997
|
+
} else if (e.Ce !== t) {
|
|
998
|
+
return;
|
|
790
999
|
} else if (!n.done) asyncWrite(n.value, iterate);
|
|
791
1000
|
else {
|
|
1001
|
+
r = true;
|
|
792
1002
|
schedule();
|
|
793
1003
|
flush();
|
|
794
1004
|
}
|
|
795
1005
|
},
|
|
796
|
-
|
|
797
|
-
if (!
|
|
1006
|
+
n => {
|
|
1007
|
+
if (!c && e.Ce === t) {
|
|
1008
|
+
r = true;
|
|
1009
|
+
handleError(n);
|
|
1010
|
+
}
|
|
798
1011
|
}
|
|
799
1012
|
);
|
|
800
|
-
|
|
801
|
-
if (
|
|
802
|
-
|
|
1013
|
+
c = false;
|
|
1014
|
+
if (u && !s.done) {
|
|
1015
|
+
o = s.value;
|
|
803
1016
|
i = true;
|
|
804
1017
|
return iterate();
|
|
805
1018
|
}
|
|
806
|
-
return
|
|
1019
|
+
return u && s.done;
|
|
807
1020
|
};
|
|
808
|
-
const
|
|
809
|
-
if (!i && !
|
|
1021
|
+
const s = iterate();
|
|
1022
|
+
if (!i && !s) {
|
|
810
1023
|
globalQueue.initTransition(resolveTransition(e));
|
|
811
1024
|
throw new NotReadyError(context);
|
|
812
1025
|
}
|
|
813
1026
|
}
|
|
814
|
-
return
|
|
1027
|
+
return o;
|
|
815
1028
|
}
|
|
816
1029
|
function clearStatus(e, t = false) {
|
|
817
1030
|
clearPendingSources(e);
|
|
818
|
-
|
|
819
|
-
e.he = false;
|
|
1031
|
+
e.Ue = false;
|
|
820
1032
|
e.Se = t ? 0 : e.Se & STATUS_UNINITIALIZED;
|
|
821
1033
|
setPendingError(e);
|
|
822
1034
|
updatePendingSignal(e);
|
|
823
|
-
e.
|
|
1035
|
+
e.xe?.();
|
|
824
1036
|
}
|
|
825
1037
|
function notifyStatus(e, t, n, i, r) {
|
|
826
1038
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
827
1039
|
n = new StatusError(e, n);
|
|
828
|
-
const
|
|
829
|
-
const
|
|
830
|
-
const u = t === STATUS_PENDING && e.ee !== undefined && !
|
|
1040
|
+
const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
1041
|
+
const o = s === e;
|
|
1042
|
+
const u = t === STATUS_PENDING && e.ee !== undefined && !o;
|
|
831
1043
|
const c = u && hasActiveOverride(e);
|
|
832
1044
|
if (!i) {
|
|
833
|
-
if (t === STATUS_PENDING &&
|
|
834
|
-
addPendingSource(e,
|
|
1045
|
+
if (t === STATUS_PENDING && s) {
|
|
1046
|
+
addPendingSource(e, s);
|
|
835
1047
|
e.Se = STATUS_PENDING | (e.Se & STATUS_UNINITIALIZED);
|
|
836
|
-
setPendingError(e,
|
|
837
|
-
if (o === e) addTransitionBlocker(e);
|
|
1048
|
+
setPendingError(e, s, n);
|
|
838
1049
|
} else {
|
|
839
1050
|
clearPendingSources(e);
|
|
840
|
-
removeTransitionBlocker(e);
|
|
841
1051
|
e.Se = t | (t !== STATUS_ERROR ? e.Se & STATUS_UNINITIALIZED : 0);
|
|
842
1052
|
e.le = n;
|
|
843
1053
|
}
|
|
@@ -848,21 +1058,24 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
848
1058
|
}
|
|
849
1059
|
const a = i || c;
|
|
850
1060
|
const f = i || u ? undefined : r;
|
|
851
|
-
if (e.
|
|
1061
|
+
if (e.xe) {
|
|
1062
|
+
if (i && t === STATUS_PENDING) {
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
852
1065
|
if (a) {
|
|
853
|
-
e.
|
|
1066
|
+
e.xe(t, n);
|
|
854
1067
|
} else {
|
|
855
|
-
e.
|
|
1068
|
+
e.xe();
|
|
856
1069
|
}
|
|
857
1070
|
return;
|
|
858
1071
|
}
|
|
859
1072
|
forEachDependent(e, e => {
|
|
860
1073
|
e.Ee = clock;
|
|
861
1074
|
if (
|
|
862
|
-
(t === STATUS_PENDING &&
|
|
863
|
-
(t !== STATUS_PENDING && (e.le !== n || e.
|
|
1075
|
+
(t === STATUS_PENDING && s && e.Ve !== s && !e.Le?.has(s)) ||
|
|
1076
|
+
(t !== STATUS_PENDING && (e.le !== n || e.Ve || e.Le))
|
|
864
1077
|
) {
|
|
865
|
-
!e.K
|
|
1078
|
+
if (!a && !e.K) globalQueue.se.push(e);
|
|
866
1079
|
notifyStatus(e, t, n, a, f);
|
|
867
1080
|
}
|
|
868
1081
|
});
|
|
@@ -875,11 +1088,11 @@ function enableExternalSource(e) {
|
|
|
875
1088
|
externalSourceConfig = {
|
|
876
1089
|
factory: (n, i) => {
|
|
877
1090
|
const r = e(n, i);
|
|
878
|
-
const
|
|
1091
|
+
const s = t(e => r.track(e), i);
|
|
879
1092
|
return {
|
|
880
|
-
track: e =>
|
|
1093
|
+
track: e => s.track(e),
|
|
881
1094
|
dispose() {
|
|
882
|
-
|
|
1095
|
+
s.dispose();
|
|
883
1096
|
r.dispose();
|
|
884
1097
|
}
|
|
885
1098
|
};
|
|
@@ -890,197 +1103,7 @@ function enableExternalSource(e) {
|
|
|
890
1103
|
externalSourceConfig = { factory: t, untrack: n };
|
|
891
1104
|
}
|
|
892
1105
|
}
|
|
893
|
-
|
|
894
|
-
function markDisposal(e) {
|
|
895
|
-
let t = e.Ce;
|
|
896
|
-
while (t) {
|
|
897
|
-
t.O |= REACTIVE_ZOMBIE;
|
|
898
|
-
if (t.O & REACTIVE_IN_HEAP) {
|
|
899
|
-
deleteFromHeap(t, dirtyQueue);
|
|
900
|
-
insertIntoHeap(t, zombieQueue);
|
|
901
|
-
}
|
|
902
|
-
markDisposal(t);
|
|
903
|
-
t = t.De;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
function dispose(e) {
|
|
907
|
-
let t = e.C || null;
|
|
908
|
-
do {
|
|
909
|
-
t = unlinkSubs(t);
|
|
910
|
-
} while (t !== null);
|
|
911
|
-
e.C = null;
|
|
912
|
-
e.ye = null;
|
|
913
|
-
disposeChildren(e, true);
|
|
914
|
-
}
|
|
915
|
-
function disposeChildren(e, t = false, n) {
|
|
916
|
-
if (e.O & REACTIVE_DISPOSED) return;
|
|
917
|
-
if (t) e.O = REACTIVE_DISPOSED;
|
|
918
|
-
let i = n ? e.me : e.Ce;
|
|
919
|
-
while (i) {
|
|
920
|
-
const e = i.De;
|
|
921
|
-
if (i.C) {
|
|
922
|
-
const e = i;
|
|
923
|
-
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
924
|
-
let t = e.C;
|
|
925
|
-
do {
|
|
926
|
-
t = unlinkSubs(t);
|
|
927
|
-
} while (t !== null);
|
|
928
|
-
e.C = null;
|
|
929
|
-
e.ye = null;
|
|
930
|
-
}
|
|
931
|
-
disposeChildren(i, true);
|
|
932
|
-
i = e;
|
|
933
|
-
}
|
|
934
|
-
if (n) {
|
|
935
|
-
e.me = null;
|
|
936
|
-
} else {
|
|
937
|
-
e.Ce = null;
|
|
938
|
-
e.ve = 0;
|
|
939
|
-
}
|
|
940
|
-
runDisposal(e, n);
|
|
941
|
-
}
|
|
942
|
-
function runDisposal(e, t) {
|
|
943
|
-
let n = t ? e.we : e.be;
|
|
944
|
-
if (!n) return;
|
|
945
|
-
if (Array.isArray(n)) {
|
|
946
|
-
for (let e = 0; e < n.length; e++) {
|
|
947
|
-
const t = n[e];
|
|
948
|
-
t.call(t);
|
|
949
|
-
}
|
|
950
|
-
} else {
|
|
951
|
-
n.call(n);
|
|
952
|
-
}
|
|
953
|
-
t ? (e.we = null) : (e.be = null);
|
|
954
|
-
}
|
|
955
|
-
function childId(e, t) {
|
|
956
|
-
let n = e;
|
|
957
|
-
while (n.Ve && n.i) n = n.i;
|
|
958
|
-
if (n.id != null) return formatId(n.id, t ? n.ve++ : n.ve);
|
|
959
|
-
throw new Error("Cannot get child id from owner without an id");
|
|
960
|
-
}
|
|
961
|
-
function getNextChildId(e) {
|
|
962
|
-
return childId(e, true);
|
|
963
|
-
}
|
|
964
|
-
function peekNextChildId(e) {
|
|
965
|
-
return childId(e, false);
|
|
966
|
-
}
|
|
967
|
-
function formatId(e, t) {
|
|
968
|
-
const n = t.toString(36),
|
|
969
|
-
i = n.length - 1;
|
|
970
|
-
return e + (i ? String.fromCharCode(64 + i) : "") + n;
|
|
971
|
-
}
|
|
972
|
-
function getObserver() {
|
|
973
|
-
if (pendingCheckActive || latestReadActive) return PENDING_OWNER;
|
|
974
|
-
return tracking ? context : null;
|
|
975
|
-
}
|
|
976
|
-
function getOwner() {
|
|
977
|
-
return context;
|
|
978
|
-
}
|
|
979
|
-
function cleanup(e) {
|
|
980
|
-
if (!context) return e;
|
|
981
|
-
if (!context.be) context.be = e;
|
|
982
|
-
else if (Array.isArray(context.be)) context.be.push(e);
|
|
983
|
-
else context.be = [context.be, e];
|
|
984
|
-
return e;
|
|
985
|
-
}
|
|
986
|
-
function isDisposed(e) {
|
|
987
|
-
return !!(e.O & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
|
|
988
|
-
}
|
|
989
|
-
function createOwner(e) {
|
|
990
|
-
const t = context;
|
|
991
|
-
const n = e?.transparent ?? false;
|
|
992
|
-
const i = {
|
|
993
|
-
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
994
|
-
Ve: n || undefined,
|
|
995
|
-
t: true,
|
|
996
|
-
u: t?.t ? t.u : t,
|
|
997
|
-
Ce: null,
|
|
998
|
-
De: null,
|
|
999
|
-
be: null,
|
|
1000
|
-
F: t?.F ?? globalQueue,
|
|
1001
|
-
Le: t?.Le || defaultContext,
|
|
1002
|
-
ve: 0,
|
|
1003
|
-
we: null,
|
|
1004
|
-
me: null,
|
|
1005
|
-
i: t,
|
|
1006
|
-
dispose(e = true) {
|
|
1007
|
-
disposeChildren(i, e);
|
|
1008
|
-
}
|
|
1009
|
-
};
|
|
1010
|
-
if (t) {
|
|
1011
|
-
const e = t.Ce;
|
|
1012
|
-
if (e === null) {
|
|
1013
|
-
t.Ce = i;
|
|
1014
|
-
} else {
|
|
1015
|
-
i.De = e;
|
|
1016
|
-
t.Ce = i;
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
return i;
|
|
1020
|
-
}
|
|
1021
|
-
function createRoot(e, t) {
|
|
1022
|
-
const n = createOwner(t);
|
|
1023
|
-
return runWithOwner(n, () => e(n.dispose));
|
|
1024
|
-
}
|
|
1025
|
-
function unlinkSubs(e) {
|
|
1026
|
-
const t = e.m;
|
|
1027
|
-
const n = e.D;
|
|
1028
|
-
const i = e.p;
|
|
1029
|
-
const r = e.Ue;
|
|
1030
|
-
if (i !== null) i.Ue = r;
|
|
1031
|
-
else t.ke = r;
|
|
1032
|
-
if (r !== null) r.p = i;
|
|
1033
|
-
else {
|
|
1034
|
-
t.I = i;
|
|
1035
|
-
if (i === null) {
|
|
1036
|
-
t.Ge?.();
|
|
1037
|
-
t.L && !t.xe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
return n;
|
|
1041
|
-
}
|
|
1042
|
-
function unobserved(e) {
|
|
1043
|
-
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1044
|
-
let t = e.C;
|
|
1045
|
-
while (t !== null) {
|
|
1046
|
-
t = unlinkSubs(t);
|
|
1047
|
-
}
|
|
1048
|
-
e.C = null;
|
|
1049
|
-
disposeChildren(e, true);
|
|
1050
|
-
}
|
|
1051
|
-
function link(e, t) {
|
|
1052
|
-
const n = t.ye;
|
|
1053
|
-
if (n !== null && n.m === e) return;
|
|
1054
|
-
let i = null;
|
|
1055
|
-
const r = t.O & REACTIVE_RECOMPUTING_DEPS;
|
|
1056
|
-
if (r) {
|
|
1057
|
-
i = n !== null ? n.D : t.C;
|
|
1058
|
-
if (i !== null && i.m === e) {
|
|
1059
|
-
t.ye = i;
|
|
1060
|
-
return;
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
const o = e.ke;
|
|
1064
|
-
if (o !== null && o.h === t && (!r || isValidLink(o, t))) return;
|
|
1065
|
-
const s = (t.ye = e.ke = { m: e, h: t, D: i, Ue: o, p: null });
|
|
1066
|
-
if (n !== null) n.D = s;
|
|
1067
|
-
else t.C = s;
|
|
1068
|
-
if (o !== null) o.p = s;
|
|
1069
|
-
else e.I = s;
|
|
1070
|
-
}
|
|
1071
|
-
function isValidLink(e, t) {
|
|
1072
|
-
const n = t.ye;
|
|
1073
|
-
if (n !== null) {
|
|
1074
|
-
let i = t.C;
|
|
1075
|
-
do {
|
|
1076
|
-
if (i === e) return true;
|
|
1077
|
-
if (i === n) break;
|
|
1078
|
-
i = i.D;
|
|
1079
|
-
} while (i !== null);
|
|
1080
|
-
}
|
|
1081
|
-
return false;
|
|
1082
|
-
}
|
|
1083
|
-
GlobalQueue.se = recompute;
|
|
1106
|
+
GlobalQueue.oe = recompute;
|
|
1084
1107
|
GlobalQueue.ue = disposeChildren;
|
|
1085
1108
|
let tracking = false;
|
|
1086
1109
|
let stale = false;
|
|
@@ -1112,10 +1135,10 @@ function releaseSnapshotScope(e) {
|
|
|
1112
1135
|
schedule();
|
|
1113
1136
|
}
|
|
1114
1137
|
function releaseSubtree(e) {
|
|
1115
|
-
let t = e.
|
|
1138
|
+
let t = e.ge;
|
|
1116
1139
|
while (t) {
|
|
1117
1140
|
if (t.We) {
|
|
1118
|
-
t = t.
|
|
1141
|
+
t = t.Pe;
|
|
1119
1142
|
continue;
|
|
1120
1143
|
}
|
|
1121
1144
|
if (t.L) {
|
|
@@ -1129,7 +1152,7 @@ function releaseSubtree(e) {
|
|
|
1129
1152
|
}
|
|
1130
1153
|
}
|
|
1131
1154
|
releaseSubtree(t);
|
|
1132
|
-
t = t.
|
|
1155
|
+
t = t.Pe;
|
|
1133
1156
|
}
|
|
1134
1157
|
}
|
|
1135
1158
|
function clearSnapshots() {
|
|
@@ -1148,22 +1171,23 @@ function recompute(e, t = false) {
|
|
|
1148
1171
|
if (e.K && (!n || activeTransition) && activeTransition !== e.K)
|
|
1149
1172
|
globalQueue.initTransition(e.K);
|
|
1150
1173
|
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1174
|
+
e.Ce = null;
|
|
1151
1175
|
if (e.K || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1152
1176
|
else {
|
|
1153
1177
|
markDisposal(e);
|
|
1154
|
-
e.
|
|
1155
|
-
e.
|
|
1156
|
-
e.
|
|
1157
|
-
e.
|
|
1158
|
-
e.
|
|
1178
|
+
e.me = e.ve;
|
|
1179
|
+
e.De = e.ge;
|
|
1180
|
+
e.ve = null;
|
|
1181
|
+
e.ge = null;
|
|
1182
|
+
e.ye = 0;
|
|
1159
1183
|
}
|
|
1160
1184
|
}
|
|
1161
1185
|
const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1162
1186
|
const r = e.ee !== undefined && e.ee !== NOT_PENDING;
|
|
1163
|
-
const
|
|
1164
|
-
const
|
|
1187
|
+
const s = !!(e.Se & STATUS_PENDING);
|
|
1188
|
+
const o = context;
|
|
1165
1189
|
context = e;
|
|
1166
|
-
e.
|
|
1190
|
+
e.Ne = null;
|
|
1167
1191
|
e.O = REACTIVE_RECOMPUTING_DEPS;
|
|
1168
1192
|
e.Ee = clock;
|
|
1169
1193
|
let u = e.X === NOT_PENDING ? e.J : e.X;
|
|
@@ -1192,7 +1216,7 @@ function recompute(e, t = false) {
|
|
|
1192
1216
|
updatePendingSignal(t.te);
|
|
1193
1217
|
}
|
|
1194
1218
|
}
|
|
1195
|
-
if (t instanceof NotReadyError) e.
|
|
1219
|
+
if (t instanceof NotReadyError) e.Ue = true;
|
|
1196
1220
|
notifyStatus(
|
|
1197
1221
|
e,
|
|
1198
1222
|
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
@@ -1203,22 +1227,22 @@ function recompute(e, t = false) {
|
|
|
1203
1227
|
} finally {
|
|
1204
1228
|
tracking = a;
|
|
1205
1229
|
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1206
|
-
context =
|
|
1230
|
+
context = o;
|
|
1207
1231
|
}
|
|
1208
1232
|
if (!e.le) {
|
|
1209
|
-
const
|
|
1210
|
-
let a =
|
|
1233
|
+
const o = e.Ne;
|
|
1234
|
+
let a = o !== null ? o.D : e.C;
|
|
1211
1235
|
if (a !== null) {
|
|
1212
1236
|
do {
|
|
1213
1237
|
a = unlinkSubs(a);
|
|
1214
1238
|
} while (a !== null);
|
|
1215
|
-
if (
|
|
1239
|
+
if (o !== null) o.D = null;
|
|
1216
1240
|
else e.C = null;
|
|
1217
1241
|
}
|
|
1218
1242
|
const f = r ? e.ee : e.X === NOT_PENDING ? e.J : e.X;
|
|
1219
|
-
const l = !e.
|
|
1243
|
+
const l = !e.ke || !e.ke(f, u);
|
|
1220
1244
|
if (l) {
|
|
1221
|
-
const
|
|
1245
|
+
const o = r ? e.ee : undefined;
|
|
1222
1246
|
if (t || (n && activeTransition !== e.K) || i) {
|
|
1223
1247
|
e.J = u;
|
|
1224
1248
|
if (r && i) {
|
|
@@ -1226,8 +1250,8 @@ function recompute(e, t = false) {
|
|
|
1226
1250
|
e.X = u;
|
|
1227
1251
|
}
|
|
1228
1252
|
} else e.X = u;
|
|
1229
|
-
if (r && !i &&
|
|
1230
|
-
if (!r || i || e.ee !==
|
|
1253
|
+
if (r && !i && s && !e._e) e.ee = u;
|
|
1254
|
+
if (!r || i || e.ee !== o) insertSubs(e, i || r);
|
|
1231
1255
|
} else if (r) {
|
|
1232
1256
|
e.X = u;
|
|
1233
1257
|
} else if (e.o != c) {
|
|
@@ -1237,7 +1261,7 @@ function recompute(e, t = false) {
|
|
|
1237
1261
|
}
|
|
1238
1262
|
}
|
|
1239
1263
|
currentOptimisticLane = f;
|
|
1240
|
-
(!t || e.Se & STATUS_PENDING) && !e.K && !(activeTransition && r) && globalQueue.
|
|
1264
|
+
(!t || e.Se & STATUS_PENDING) && !e.K && !(activeTransition && r) && globalQueue.se.push(e);
|
|
1241
1265
|
e.K && n && activeTransition !== e.K && runInTransition(e.K, () => recompute(e));
|
|
1242
1266
|
}
|
|
1243
1267
|
function updateIfNecessary(e) {
|
|
@@ -1253,7 +1277,7 @@ function updateIfNecessary(e) {
|
|
|
1253
1277
|
}
|
|
1254
1278
|
}
|
|
1255
1279
|
}
|
|
1256
|
-
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.le && e.Ee < clock && !e.
|
|
1280
|
+
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.le && e.Ee < clock && !e.Ce)) {
|
|
1257
1281
|
recompute(e);
|
|
1258
1282
|
}
|
|
1259
1283
|
e.O = REACTIVE_NONE | (e.O & REACTIVE_SNAPSHOT_STALE);
|
|
@@ -1262,14 +1286,14 @@ function computed(e, t, n) {
|
|
|
1262
1286
|
const i = n?.transparent ?? false;
|
|
1263
1287
|
const r = {
|
|
1264
1288
|
id: n?.id ?? (i ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1265
|
-
|
|
1266
|
-
|
|
1289
|
+
we: i || undefined,
|
|
1290
|
+
ke: n?.equals != null ? n.equals : isEqual,
|
|
1267
1291
|
fe: !!n?.pureWrite,
|
|
1268
|
-
|
|
1269
|
-
|
|
1292
|
+
he: n?.unobserved,
|
|
1293
|
+
ve: null,
|
|
1270
1294
|
F: context?.F ?? globalQueue,
|
|
1271
|
-
|
|
1272
|
-
|
|
1295
|
+
be: context?.be ?? defaultContext,
|
|
1296
|
+
ye: 0,
|
|
1273
1297
|
L: e,
|
|
1274
1298
|
J: t,
|
|
1275
1299
|
o: 0,
|
|
@@ -1277,33 +1301,33 @@ function computed(e, t, n) {
|
|
|
1277
1301
|
S: undefined,
|
|
1278
1302
|
T: null,
|
|
1279
1303
|
C: null,
|
|
1280
|
-
|
|
1304
|
+
Ne: null,
|
|
1281
1305
|
I: null,
|
|
1282
|
-
|
|
1306
|
+
pe: null,
|
|
1283
1307
|
i: context,
|
|
1284
|
-
|
|
1285
|
-
|
|
1308
|
+
Pe: null,
|
|
1309
|
+
ge: null,
|
|
1286
1310
|
O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1287
1311
|
Se: STATUS_UNINITIALIZED,
|
|
1288
1312
|
Ee: clock,
|
|
1289
1313
|
X: NOT_PENDING,
|
|
1290
|
-
we: null,
|
|
1291
1314
|
me: null,
|
|
1292
|
-
|
|
1315
|
+
De: null,
|
|
1316
|
+
Ce: null,
|
|
1293
1317
|
K: null
|
|
1294
1318
|
};
|
|
1295
1319
|
r.T = r;
|
|
1296
|
-
const
|
|
1320
|
+
const s = context?.t ? context.u : context;
|
|
1297
1321
|
if (context) {
|
|
1298
|
-
const e = context.
|
|
1322
|
+
const e = context.ge;
|
|
1299
1323
|
if (e === null) {
|
|
1300
|
-
context.
|
|
1324
|
+
context.ge = r;
|
|
1301
1325
|
} else {
|
|
1302
|
-
r.
|
|
1303
|
-
context.
|
|
1326
|
+
r.Pe = e;
|
|
1327
|
+
context.ge = r;
|
|
1304
1328
|
}
|
|
1305
1329
|
}
|
|
1306
|
-
if (
|
|
1330
|
+
if (s) r.o = s.o + 1;
|
|
1307
1331
|
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.de = true;
|
|
1308
1332
|
if (externalSourceConfig) {
|
|
1309
1333
|
const e = signal(undefined, { equals: false, pureWrite: true });
|
|
@@ -1327,13 +1351,13 @@ function computed(e, t, n) {
|
|
|
1327
1351
|
}
|
|
1328
1352
|
function signal(e, t, n = null) {
|
|
1329
1353
|
const i = {
|
|
1330
|
-
|
|
1354
|
+
ke: t?.equals != null ? t.equals : isEqual,
|
|
1331
1355
|
fe: !!t?.pureWrite,
|
|
1332
1356
|
He: !!t?.He,
|
|
1333
|
-
|
|
1357
|
+
he: t?.unobserved,
|
|
1334
1358
|
J: e,
|
|
1335
1359
|
I: null,
|
|
1336
|
-
|
|
1360
|
+
pe: null,
|
|
1337
1361
|
Ee: clock,
|
|
1338
1362
|
V: n,
|
|
1339
1363
|
N: n?.A || null,
|
|
@@ -1400,9 +1424,14 @@ function read(e) {
|
|
|
1400
1424
|
const n = pendingCheckActive;
|
|
1401
1425
|
pendingCheckActive = false;
|
|
1402
1426
|
if (t && e.ee !== undefined) {
|
|
1403
|
-
if (e.ee !== NOT_PENDING && (t.
|
|
1427
|
+
if (e.ee !== NOT_PENDING && (t.Ce || !!(t.Se & STATUS_PENDING))) {
|
|
1404
1428
|
foundPending = true;
|
|
1405
1429
|
}
|
|
1430
|
+
let n = context;
|
|
1431
|
+
if (n?.t) n = n.u;
|
|
1432
|
+
if (n && tracking) link(e, n);
|
|
1433
|
+
read(getPendingSignal(e));
|
|
1434
|
+
read(getPendingSignal(t));
|
|
1406
1435
|
} else {
|
|
1407
1436
|
if (read(getPendingSignal(e))) foundPending = true;
|
|
1408
1437
|
if (t && read(getPendingSignal(t))) foundPending = true;
|
|
@@ -1447,6 +1476,9 @@ function read(e) {
|
|
|
1447
1476
|
if (!tracking && e !== t) link(e, t);
|
|
1448
1477
|
throw n.le;
|
|
1449
1478
|
}
|
|
1479
|
+
} else if (t && n !== e && n.Se & STATUS_UNINITIALIZED) {
|
|
1480
|
+
if (!tracking && e !== t) link(e, t);
|
|
1481
|
+
throw n.le;
|
|
1450
1482
|
} else if (!t && n.Se & STATUS_UNINITIALIZED) {
|
|
1451
1483
|
throw n.le;
|
|
1452
1484
|
}
|
|
@@ -1484,8 +1516,8 @@ function setSignal(e, t) {
|
|
|
1484
1516
|
const i = e.ee !== undefined && e.ee !== NOT_PENDING;
|
|
1485
1517
|
const r = n ? (i ? e.ee : e.J) : e.X === NOT_PENDING ? e.J : e.X;
|
|
1486
1518
|
if (typeof t === "function") t = t(r);
|
|
1487
|
-
const
|
|
1488
|
-
if (!
|
|
1519
|
+
const s = !e.ke || !e.ke(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
|
|
1520
|
+
if (!s) {
|
|
1489
1521
|
if (n && i && e.L) {
|
|
1490
1522
|
insertSubs(e, true);
|
|
1491
1523
|
schedule();
|
|
@@ -1504,12 +1536,12 @@ function setSignal(e, t) {
|
|
|
1504
1536
|
e.q = i;
|
|
1505
1537
|
e.ee = t;
|
|
1506
1538
|
} else {
|
|
1507
|
-
if (e.X === NOT_PENDING) globalQueue.
|
|
1539
|
+
if (e.X === NOT_PENDING) globalQueue.se.push(e);
|
|
1508
1540
|
e.X = t;
|
|
1509
1541
|
}
|
|
1510
1542
|
updatePendingSignal(e);
|
|
1511
|
-
if (e.
|
|
1512
|
-
setSignal(e.
|
|
1543
|
+
if (e.Ge) {
|
|
1544
|
+
setSignal(e.Ge, t);
|
|
1513
1545
|
}
|
|
1514
1546
|
e.Ee = clock;
|
|
1515
1547
|
insertSubs(e, n);
|
|
@@ -1542,7 +1574,7 @@ function computePendingState(e) {
|
|
|
1542
1574
|
const t = e;
|
|
1543
1575
|
const n = e.V;
|
|
1544
1576
|
if (n && e.X !== NOT_PENDING) {
|
|
1545
|
-
return !n.
|
|
1577
|
+
return !n.Ce && !(n.Se & STATUS_PENDING);
|
|
1546
1578
|
}
|
|
1547
1579
|
if (e.ee !== undefined && e.ee !== NOT_PENDING) {
|
|
1548
1580
|
if (t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
|
|
@@ -1577,20 +1609,20 @@ function updatePendingSignal(e) {
|
|
|
1577
1609
|
}
|
|
1578
1610
|
}
|
|
1579
1611
|
function getLatestValueComputed(e) {
|
|
1580
|
-
if (!e.
|
|
1612
|
+
if (!e.Ge) {
|
|
1581
1613
|
const t = latestReadActive;
|
|
1582
1614
|
latestReadActive = false;
|
|
1583
1615
|
const n = pendingCheckActive;
|
|
1584
1616
|
pendingCheckActive = false;
|
|
1585
1617
|
const i = context;
|
|
1586
1618
|
context = null;
|
|
1587
|
-
e.
|
|
1588
|
-
e.
|
|
1619
|
+
e.Ge = optimisticComputed(() => read(e));
|
|
1620
|
+
e.Ge.Re = e;
|
|
1589
1621
|
context = i;
|
|
1590
1622
|
pendingCheckActive = n;
|
|
1591
1623
|
latestReadActive = t;
|
|
1592
1624
|
}
|
|
1593
|
-
return e.
|
|
1625
|
+
return e.Ge;
|
|
1594
1626
|
}
|
|
1595
1627
|
function staleValues(e, t = true) {
|
|
1596
1628
|
const n = stale;
|
|
@@ -1651,7 +1683,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1651
1683
|
if (!t) {
|
|
1652
1684
|
throw new NoOwnerError();
|
|
1653
1685
|
}
|
|
1654
|
-
const n = hasContext(e, t) ? t.
|
|
1686
|
+
const n = hasContext(e, t) ? t.be[e.id] : e.defaultValue;
|
|
1655
1687
|
if (isUndefined(n)) {
|
|
1656
1688
|
throw new ContextNotFoundError();
|
|
1657
1689
|
}
|
|
@@ -1661,64 +1693,66 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1661
1693
|
if (!n) {
|
|
1662
1694
|
throw new NoOwnerError();
|
|
1663
1695
|
}
|
|
1664
|
-
n.
|
|
1696
|
+
n.be = { ...n.be, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1665
1697
|
}
|
|
1666
1698
|
function hasContext(e, t) {
|
|
1667
|
-
return !isUndefined(t?.
|
|
1699
|
+
return !isUndefined(t?.be[e.id]);
|
|
1668
1700
|
}
|
|
1669
1701
|
function isUndefined(e) {
|
|
1670
1702
|
return typeof e === "undefined";
|
|
1671
1703
|
}
|
|
1672
1704
|
function effect(e, t, n, i, r) {
|
|
1673
|
-
let
|
|
1674
|
-
const
|
|
1705
|
+
let s = false;
|
|
1706
|
+
const o = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
1675
1707
|
...r,
|
|
1676
1708
|
equals: () => {
|
|
1677
|
-
|
|
1678
|
-
if (
|
|
1709
|
+
o.H = !o.le;
|
|
1710
|
+
if (s) o.F.enqueue(o.W, runEffect.bind(o));
|
|
1679
1711
|
return false;
|
|
1680
1712
|
},
|
|
1681
1713
|
lazy: true
|
|
1682
1714
|
});
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
const n = e !== undefined ? e :
|
|
1690
|
-
const i = t !== undefined ? t :
|
|
1715
|
+
o.Fe = i;
|
|
1716
|
+
o.Me = t;
|
|
1717
|
+
o.$e = n;
|
|
1718
|
+
o.je = undefined;
|
|
1719
|
+
o.W = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
1720
|
+
o.xe = (e, t) => {
|
|
1721
|
+
const n = e !== undefined ? e : o.Se;
|
|
1722
|
+
const i = t !== undefined ? t : o.le;
|
|
1691
1723
|
if (n & STATUS_ERROR) {
|
|
1692
1724
|
let e = i;
|
|
1693
|
-
|
|
1694
|
-
if (
|
|
1725
|
+
o.F.notify(o, STATUS_PENDING, 0);
|
|
1726
|
+
if (o.W === EFFECT_USER) {
|
|
1695
1727
|
try {
|
|
1696
|
-
return
|
|
1697
|
-
?
|
|
1698
|
-
|
|
1699
|
-
|
|
1728
|
+
return o.$e
|
|
1729
|
+
? o.$e(e, () => {
|
|
1730
|
+
o.je?.();
|
|
1731
|
+
o.je = undefined;
|
|
1700
1732
|
})
|
|
1701
1733
|
: console.error(e);
|
|
1702
1734
|
} catch (t) {
|
|
1703
1735
|
e = t;
|
|
1704
1736
|
}
|
|
1705
1737
|
}
|
|
1706
|
-
if (!
|
|
1707
|
-
} else if (
|
|
1708
|
-
|
|
1738
|
+
if (!o.F.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1739
|
+
} else if (o.W === EFFECT_RENDER) {
|
|
1740
|
+
o.F.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
1709
1741
|
}
|
|
1710
1742
|
};
|
|
1711
|
-
recompute(
|
|
1712
|
-
!r?.defer && (
|
|
1713
|
-
|
|
1714
|
-
cleanup(() =>
|
|
1743
|
+
recompute(o, true);
|
|
1744
|
+
!r?.defer && (o.W === EFFECT_USER ? o.F.enqueue(o.W, runEffect.bind(o)) : runEffect.call(o));
|
|
1745
|
+
s = true;
|
|
1746
|
+
cleanup(() => o.je?.());
|
|
1715
1747
|
}
|
|
1716
1748
|
function runEffect() {
|
|
1717
1749
|
if (!this.H || this.O & REACTIVE_DISPOSED) return;
|
|
1718
1750
|
this.je?.();
|
|
1719
1751
|
this.je = undefined;
|
|
1720
1752
|
try {
|
|
1721
|
-
|
|
1753
|
+
const e = this.Me(this.J, this.Fe);
|
|
1754
|
+
if (false && e !== undefined && typeof e !== "function");
|
|
1755
|
+
this.je = e;
|
|
1722
1756
|
} catch (e) {
|
|
1723
1757
|
this.le = new StatusError(this, e);
|
|
1724
1758
|
this.Se |= STATUS_ERROR;
|
|
@@ -1731,14 +1765,18 @@ function runEffect() {
|
|
|
1731
1765
|
function trackedEffect(e, t) {
|
|
1732
1766
|
const run = () => {
|
|
1733
1767
|
if (!n.H || n.O & REACTIVE_DISPOSED) return;
|
|
1734
|
-
|
|
1735
|
-
|
|
1768
|
+
try {
|
|
1769
|
+
n.H = false;
|
|
1770
|
+
recompute(n);
|
|
1771
|
+
} finally {
|
|
1772
|
+
}
|
|
1736
1773
|
};
|
|
1737
1774
|
const n = computed(
|
|
1738
1775
|
() => {
|
|
1739
1776
|
n.je?.();
|
|
1740
1777
|
n.je = undefined;
|
|
1741
|
-
|
|
1778
|
+
const t = staleValues(e);
|
|
1779
|
+
n.je = t;
|
|
1742
1780
|
},
|
|
1743
1781
|
undefined,
|
|
1744
1782
|
{ ...t, lazy: true }
|
|
@@ -1747,7 +1785,7 @@ function trackedEffect(e, t) {
|
|
|
1747
1785
|
n.Ke = true;
|
|
1748
1786
|
n.H = true;
|
|
1749
1787
|
n.W = EFFECT_TRACKED;
|
|
1750
|
-
n.
|
|
1788
|
+
n.xe = (e, t) => {
|
|
1751
1789
|
const i = e !== undefined ? e : n.Se;
|
|
1752
1790
|
if (i & STATUS_ERROR) {
|
|
1753
1791
|
n.F.notify(n, STATUS_PENDING, 0);
|
|
@@ -1770,13 +1808,13 @@ function action(e) {
|
|
|
1770
1808
|
new Promise((n, i) => {
|
|
1771
1809
|
const r = e(...t);
|
|
1772
1810
|
globalQueue.initTransition();
|
|
1773
|
-
let
|
|
1774
|
-
|
|
1811
|
+
let s = activeTransition;
|
|
1812
|
+
s.j.push(r);
|
|
1775
1813
|
const done = (e, t) => {
|
|
1776
|
-
|
|
1777
|
-
const
|
|
1778
|
-
if (
|
|
1779
|
-
setActiveTransition(
|
|
1814
|
+
s = currentTransition(s);
|
|
1815
|
+
const o = s.j.indexOf(r);
|
|
1816
|
+
if (o >= 0) s.j.splice(o, 1);
|
|
1817
|
+
setActiveTransition(s);
|
|
1780
1818
|
schedule();
|
|
1781
1819
|
t ? i(t) : n(e);
|
|
1782
1820
|
};
|
|
@@ -1788,17 +1826,17 @@ function action(e) {
|
|
|
1788
1826
|
return done(undefined, e);
|
|
1789
1827
|
}
|
|
1790
1828
|
if (n instanceof Promise)
|
|
1791
|
-
return void n.then(run, e => restoreTransition(
|
|
1829
|
+
return void n.then(run, e => restoreTransition(s, () => step(e, true)));
|
|
1792
1830
|
run(n);
|
|
1793
1831
|
};
|
|
1794
1832
|
const run = e => {
|
|
1795
1833
|
if (e.done) return done(e.value);
|
|
1796
1834
|
if (e.value instanceof Promise)
|
|
1797
1835
|
return void e.value.then(
|
|
1798
|
-
e => restoreTransition(
|
|
1799
|
-
e => restoreTransition(
|
|
1836
|
+
e => restoreTransition(s, () => step(e)),
|
|
1837
|
+
e => restoreTransition(s, () => step(e, true))
|
|
1800
1838
|
);
|
|
1801
|
-
restoreTransition(
|
|
1839
|
+
restoreTransition(s, () => step(e.value));
|
|
1802
1840
|
};
|
|
1803
1841
|
step();
|
|
1804
1842
|
});
|
|
@@ -1842,7 +1880,9 @@ function createReaction(e, t) {
|
|
|
1842
1880
|
() => (r(), getOwner()),
|
|
1843
1881
|
t => {
|
|
1844
1882
|
n?.();
|
|
1845
|
-
|
|
1883
|
+
const i = (e.effect || e)?.();
|
|
1884
|
+
if (false && i !== undefined && typeof i !== "function");
|
|
1885
|
+
n = i;
|
|
1846
1886
|
dispose(t);
|
|
1847
1887
|
},
|
|
1848
1888
|
e.error,
|
|
@@ -1874,7 +1914,7 @@ function createOptimistic(e, t, n) {
|
|
|
1874
1914
|
function onSettled(e) {
|
|
1875
1915
|
const t = getOwner();
|
|
1876
1916
|
t && !t.Ke
|
|
1877
|
-
? createTrackedEffect(() => untrack(e))
|
|
1917
|
+
? createTrackedEffect(() => untrack(e), undefined)
|
|
1878
1918
|
: globalQueue.enqueue(EFFECT_USER, () => {
|
|
1879
1919
|
const t = e();
|
|
1880
1920
|
t?.();
|
|
@@ -1896,22 +1936,22 @@ function applyState(e, t, n) {
|
|
|
1896
1936
|
const i = t?.[$TARGET];
|
|
1897
1937
|
if (!i) return;
|
|
1898
1938
|
const r = i[STORE_VALUE];
|
|
1899
|
-
const
|
|
1900
|
-
const
|
|
1939
|
+
const s = i[STORE_OVERRIDE];
|
|
1940
|
+
const o = i[STORE_OPTIMISTIC_OVERRIDE];
|
|
1901
1941
|
let u = i[STORE_NODE];
|
|
1902
|
-
if (e === r && !
|
|
1942
|
+
if (e === r && !s && !o) return;
|
|
1903
1943
|
(i[STORE_LOOKUP] || storeLookup).set(e, i[$PROXY]);
|
|
1904
1944
|
i[STORE_VALUE] = e;
|
|
1905
1945
|
i[STORE_OVERRIDE] = undefined;
|
|
1906
1946
|
if (Array.isArray(r)) {
|
|
1907
1947
|
let t = false;
|
|
1908
|
-
const c = getOverrideValue(r,
|
|
1948
|
+
const c = getOverrideValue(r, s, u, "length", o);
|
|
1909
1949
|
if (e.length && c && e[0] && n(e[0]) != null) {
|
|
1910
1950
|
let a, f, l, E, T, d, S, R;
|
|
1911
1951
|
for (
|
|
1912
1952
|
l = 0, E = Math.min(c, e.length);
|
|
1913
1953
|
l < E &&
|
|
1914
|
-
((d = getOverrideValue(r,
|
|
1954
|
+
((d = getOverrideValue(r, s, u, l, o)) === e[l] || (d && e[l] && n(d) === n(e[l])));
|
|
1915
1955
|
l++
|
|
1916
1956
|
) {
|
|
1917
1957
|
applyState(e[l], wrap(d, i), n);
|
|
@@ -1922,7 +1962,7 @@ function applyState(e, t, n) {
|
|
|
1922
1962
|
E = c - 1, T = e.length - 1;
|
|
1923
1963
|
E >= l &&
|
|
1924
1964
|
T >= l &&
|
|
1925
|
-
((d = getOverrideValue(r,
|
|
1965
|
+
((d = getOverrideValue(r, s, u, E, o)) === e[T] || (d && e[T] && n(d) === n(e[T])));
|
|
1926
1966
|
E--, T--
|
|
1927
1967
|
) {
|
|
1928
1968
|
O[T] = d;
|
|
@@ -1951,7 +1991,7 @@ function applyState(e, t, n) {
|
|
|
1951
1991
|
_.set(R, f);
|
|
1952
1992
|
}
|
|
1953
1993
|
for (a = l; a <= E; a++) {
|
|
1954
|
-
d = getOverrideValue(r,
|
|
1994
|
+
d = getOverrideValue(r, s, u, a, o);
|
|
1955
1995
|
R = d ? n(d) : d;
|
|
1956
1996
|
f = _.get(R);
|
|
1957
1997
|
if (f !== undefined && f !== -1) {
|
|
@@ -1970,7 +2010,7 @@ function applyState(e, t, n) {
|
|
|
1970
2010
|
if (l < e.length) t = true;
|
|
1971
2011
|
} else if (e.length) {
|
|
1972
2012
|
for (let t = 0, c = e.length; t < c; t++) {
|
|
1973
|
-
const c = getOverrideValue(r,
|
|
2013
|
+
const c = getOverrideValue(r, s, u, t, o);
|
|
1974
2014
|
isWrappable(c)
|
|
1975
2015
|
? applyState(e[t], wrap(c, i), n)
|
|
1976
2016
|
: i[STORE_NODE][t] && setSignal(i[STORE_NODE][t], e[t]);
|
|
@@ -1985,11 +2025,11 @@ function applyState(e, t, n) {
|
|
|
1985
2025
|
}
|
|
1986
2026
|
if (u) {
|
|
1987
2027
|
const t = u[$TRACK];
|
|
1988
|
-
const c = t ? getAllKeys(r,
|
|
2028
|
+
const c = t ? getAllKeys(r, s, e) : Object.keys(u);
|
|
1989
2029
|
for (let a = 0, f = c.length; a < f; a++) {
|
|
1990
2030
|
const f = c[a];
|
|
1991
2031
|
const l = u[f];
|
|
1992
|
-
const E = unwrap(getOverrideValue(r,
|
|
2032
|
+
const E = unwrap(getOverrideValue(r, s, u, f, o));
|
|
1993
2033
|
let T = unwrap(e[f]);
|
|
1994
2034
|
if (E === T) continue;
|
|
1995
2035
|
if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
|
|
@@ -2036,26 +2076,26 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2036
2076
|
r.set(e, t);
|
|
2037
2077
|
return t;
|
|
2038
2078
|
};
|
|
2039
|
-
const
|
|
2079
|
+
const s = wrapProjection(t);
|
|
2040
2080
|
i = computed(() => {
|
|
2041
2081
|
const t = getOwner();
|
|
2042
2082
|
let i = false;
|
|
2043
2083
|
let r;
|
|
2044
|
-
const
|
|
2045
|
-
|
|
2046
|
-
createWriteTraps(() => !i || t.
|
|
2084
|
+
const o = new Proxy(
|
|
2085
|
+
s,
|
|
2086
|
+
createWriteTraps(() => !i || t.Ce === r)
|
|
2047
2087
|
);
|
|
2048
|
-
storeSetter(
|
|
2049
|
-
r = e(
|
|
2088
|
+
storeSetter(o, o => {
|
|
2089
|
+
r = e(o);
|
|
2050
2090
|
i = true;
|
|
2051
2091
|
const u = handleAsync(t, r, e => {
|
|
2052
|
-
e !==
|
|
2092
|
+
e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
|
|
2053
2093
|
});
|
|
2054
|
-
u !==
|
|
2094
|
+
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2055
2095
|
});
|
|
2056
2096
|
});
|
|
2057
|
-
i.
|
|
2058
|
-
return { store:
|
|
2097
|
+
i.Ae = true;
|
|
2098
|
+
return { store: s, node: i };
|
|
2059
2099
|
}
|
|
2060
2100
|
function createProjection(e, t = {}, n) {
|
|
2061
2101
|
return createProjectionInternal(e, t, n).store;
|
|
@@ -2145,7 +2185,7 @@ function getNodes(e, t) {
|
|
|
2145
2185
|
if (!n) e[t] = n = Object.create(null);
|
|
2146
2186
|
return n;
|
|
2147
2187
|
}
|
|
2148
|
-
function getNode(e, t, n, i, r = isEqual,
|
|
2188
|
+
function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
2149
2189
|
if (e[t]) return e[t];
|
|
2150
2190
|
const u = signal(
|
|
2151
2191
|
n,
|
|
@@ -2157,11 +2197,11 @@ function getNode(e, t, n, i, r = isEqual, o, s) {
|
|
|
2157
2197
|
},
|
|
2158
2198
|
i
|
|
2159
2199
|
);
|
|
2160
|
-
if (
|
|
2200
|
+
if (s) {
|
|
2161
2201
|
u.ee = NOT_PENDING;
|
|
2162
2202
|
}
|
|
2163
|
-
if (
|
|
2164
|
-
const e =
|
|
2203
|
+
if (o && t in o) {
|
|
2204
|
+
const e = o[t];
|
|
2165
2205
|
u.Te = e === undefined ? NO_SNAPSHOT : e;
|
|
2166
2206
|
snapshotSources?.add(u);
|
|
2167
2207
|
}
|
|
@@ -2177,8 +2217,8 @@ function getKeys(e, t, n = true) {
|
|
|
2177
2217
|
const i = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
|
|
2178
2218
|
if (!t) return i;
|
|
2179
2219
|
const r = new Set(i);
|
|
2180
|
-
const
|
|
2181
|
-
for (const e of
|
|
2220
|
+
const s = Reflect.ownKeys(t);
|
|
2221
|
+
for (const e of s) {
|
|
2182
2222
|
if (t[e] !== $DELETED) r.add(e);
|
|
2183
2223
|
else r.delete(e);
|
|
2184
2224
|
}
|
|
@@ -2204,10 +2244,10 @@ const storeTraps = {
|
|
|
2204
2244
|
}
|
|
2205
2245
|
const i = getNodes(e, STORE_NODE);
|
|
2206
2246
|
const r = i[t];
|
|
2207
|
-
const
|
|
2208
|
-
const
|
|
2247
|
+
const s = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
|
|
2248
|
+
const o = s || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
|
|
2209
2249
|
const u = !!e[STORE_VALUE][$TARGET];
|
|
2210
|
-
const c =
|
|
2250
|
+
const c = s
|
|
2211
2251
|
? e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2212
2252
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2213
2253
|
? e[STORE_OVERRIDE]
|
|
@@ -2218,7 +2258,7 @@ const storeTraps = {
|
|
|
2218
2258
|
}
|
|
2219
2259
|
if (writeOnly(n)) {
|
|
2220
2260
|
let n =
|
|
2221
|
-
r && (
|
|
2261
|
+
r && (o || !u)
|
|
2222
2262
|
? r.ee !== undefined && r.ee !== NOT_PENDING
|
|
2223
2263
|
? r.ee
|
|
2224
2264
|
: r.X !== NOT_PENDING
|
|
@@ -2231,10 +2271,10 @@ const storeTraps = {
|
|
|
2231
2271
|
Writing?.add(i);
|
|
2232
2272
|
return i;
|
|
2233
2273
|
}
|
|
2234
|
-
let a = r ? (
|
|
2274
|
+
let a = r ? (o || !u ? read(i[t]) : (read(i[t]), c[t])) : c[t];
|
|
2235
2275
|
a === $DELETED && (a = undefined);
|
|
2236
2276
|
if (!r) {
|
|
2237
|
-
if (!
|
|
2277
|
+
if (!o && typeof a === "function" && !c.hasOwnProperty(t)) {
|
|
2238
2278
|
let t;
|
|
2239
2279
|
return !Array.isArray(e[STORE_VALUE]) &&
|
|
2240
2280
|
(t = Object.getPrototypeOf(e[STORE_VALUE])) &&
|
|
@@ -2280,7 +2320,7 @@ const storeTraps = {
|
|
|
2280
2320
|
}
|
|
2281
2321
|
untrack(() => {
|
|
2282
2322
|
const r = e[STORE_VALUE];
|
|
2283
|
-
const
|
|
2323
|
+
const s = r[t];
|
|
2284
2324
|
if (
|
|
2285
2325
|
snapshotCaptureActive &&
|
|
2286
2326
|
typeof t !== "symbol" &&
|
|
@@ -2291,22 +2331,22 @@ const storeTraps = {
|
|
|
2291
2331
|
snapshotSources?.add(e);
|
|
2292
2332
|
}
|
|
2293
2333
|
if (!(t in e[STORE_SNAPSHOT_PROPS])) {
|
|
2294
|
-
e[STORE_SNAPSHOT_PROPS][t] =
|
|
2334
|
+
e[STORE_SNAPSHOT_PROPS][t] = s;
|
|
2295
2335
|
}
|
|
2296
2336
|
}
|
|
2297
|
-
const
|
|
2298
|
-
const u =
|
|
2299
|
-
if (
|
|
2337
|
+
const o = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
2338
|
+
const u = o ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
2339
|
+
if (o) trackOptimisticStore(i);
|
|
2300
2340
|
const c =
|
|
2301
2341
|
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2302
2342
|
? e[STORE_OPTIMISTIC_OVERRIDE][t]
|
|
2303
2343
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2304
2344
|
? e[STORE_OVERRIDE][t]
|
|
2305
|
-
:
|
|
2345
|
+
: s;
|
|
2306
2346
|
const a = n?.[$TARGET]?.[STORE_VALUE] ?? n;
|
|
2307
2347
|
if (c === a) return true;
|
|
2308
2348
|
const f = e[STORE_OPTIMISTIC_OVERRIDE]?.length || e[STORE_OVERRIDE]?.length || r.length;
|
|
2309
|
-
if (a !== undefined && a ===
|
|
2349
|
+
if (a !== undefined && a === s) delete e[u][t];
|
|
2310
2350
|
else (e[u] || (e[u] = Object.create(null)))[t] = a;
|
|
2311
2351
|
const l = isWrappable(a);
|
|
2312
2352
|
e[STORE_HAS]?.[t] && setSignal(e[STORE_HAS][t], true);
|
|
@@ -2345,9 +2385,9 @@ const storeTraps = {
|
|
|
2345
2385
|
delete e[i][t];
|
|
2346
2386
|
} else return true;
|
|
2347
2387
|
if (e[STORE_HAS]?.[t]) setSignal(e[STORE_HAS][t], false);
|
|
2348
|
-
const
|
|
2349
|
-
|
|
2350
|
-
|
|
2388
|
+
const s = getNodes(e, STORE_NODE);
|
|
2389
|
+
s[t] && setSignal(s[t], undefined);
|
|
2390
|
+
s[$TRACK] && setSignal(s[$TRACK], undefined);
|
|
2351
2391
|
});
|
|
2352
2392
|
}
|
|
2353
2393
|
return true;
|
|
@@ -2418,9 +2458,9 @@ function createOptimisticStore(e, t, n) {
|
|
|
2418
2458
|
GlobalQueue.ce ||= clearOptimisticStore;
|
|
2419
2459
|
const i = typeof e === "function";
|
|
2420
2460
|
const r = (i ? t : e) ?? {};
|
|
2421
|
-
const
|
|
2422
|
-
const { store:
|
|
2423
|
-
return [
|
|
2461
|
+
const s = i ? e : undefined;
|
|
2462
|
+
const { store: o } = createOptimisticProjectionInternal(s, r, n);
|
|
2463
|
+
return [o, e => storeSetter(o, e)];
|
|
2424
2464
|
}
|
|
2425
2465
|
function clearOptimisticStore(e) {
|
|
2426
2466
|
const t = e[$TARGET];
|
|
@@ -2470,38 +2510,38 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2470
2510
|
r.set(e, t);
|
|
2471
2511
|
return t;
|
|
2472
2512
|
};
|
|
2473
|
-
const
|
|
2513
|
+
const s = wrapProjection(t);
|
|
2474
2514
|
if (e) {
|
|
2475
2515
|
i = computed(() => {
|
|
2476
2516
|
const t = getOwner();
|
|
2477
2517
|
let i = false;
|
|
2478
2518
|
let r;
|
|
2479
|
-
const
|
|
2480
|
-
|
|
2481
|
-
createWriteTraps(() => !i || t.
|
|
2519
|
+
const o = new Proxy(
|
|
2520
|
+
s,
|
|
2521
|
+
createWriteTraps(() => !i || t.Ce === r)
|
|
2482
2522
|
);
|
|
2483
2523
|
setProjectionWriteActive(true);
|
|
2484
2524
|
try {
|
|
2485
|
-
storeSetter(
|
|
2486
|
-
r = e(
|
|
2525
|
+
storeSetter(o, o => {
|
|
2526
|
+
r = e(o);
|
|
2487
2527
|
i = true;
|
|
2488
2528
|
const u = handleAsync(t, r, e => {
|
|
2489
2529
|
setProjectionWriteActive(true);
|
|
2490
2530
|
try {
|
|
2491
|
-
e !==
|
|
2531
|
+
e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
|
|
2492
2532
|
} finally {
|
|
2493
2533
|
setProjectionWriteActive(false);
|
|
2494
2534
|
}
|
|
2495
2535
|
});
|
|
2496
|
-
u !==
|
|
2536
|
+
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2497
2537
|
});
|
|
2498
2538
|
} finally {
|
|
2499
2539
|
setProjectionWriteActive(false);
|
|
2500
2540
|
}
|
|
2501
2541
|
});
|
|
2502
|
-
i.
|
|
2542
|
+
i.Ae = true;
|
|
2503
2543
|
}
|
|
2504
|
-
return { store:
|
|
2544
|
+
return { store: s, node: i };
|
|
2505
2545
|
}
|
|
2506
2546
|
const DELETE = Symbol(0);
|
|
2507
2547
|
function updatePath(e, t, n = 0) {
|
|
@@ -2509,8 +2549,8 @@ function updatePath(e, t, n = 0) {
|
|
|
2509
2549
|
r = e;
|
|
2510
2550
|
if (n < t.length - 1) {
|
|
2511
2551
|
i = t[n];
|
|
2512
|
-
const
|
|
2513
|
-
const
|
|
2552
|
+
const s = typeof i;
|
|
2553
|
+
const o = Array.isArray(e);
|
|
2514
2554
|
if (Array.isArray(i)) {
|
|
2515
2555
|
for (let r = 0; r < i.length; r++) {
|
|
2516
2556
|
t[n] = i[r];
|
|
@@ -2518,7 +2558,7 @@ function updatePath(e, t, n = 0) {
|
|
|
2518
2558
|
}
|
|
2519
2559
|
t[n] = i;
|
|
2520
2560
|
return;
|
|
2521
|
-
} else if (
|
|
2561
|
+
} else if (o && s === "function") {
|
|
2522
2562
|
for (let r = 0; r < e.length; r++) {
|
|
2523
2563
|
if (i(e[r], r)) {
|
|
2524
2564
|
t[n] = r;
|
|
@@ -2527,9 +2567,9 @@ function updatePath(e, t, n = 0) {
|
|
|
2527
2567
|
}
|
|
2528
2568
|
t[n] = i;
|
|
2529
2569
|
return;
|
|
2530
|
-
} else if (
|
|
2531
|
-
const { from: r = 0, to:
|
|
2532
|
-
for (let i = r; i <=
|
|
2570
|
+
} else if (o && s === "object") {
|
|
2571
|
+
const { from: r = 0, to: s = e.length - 1, by: o = 1 } = i;
|
|
2572
|
+
for (let i = r; i <= s; i += o) {
|
|
2533
2573
|
t[n] = i;
|
|
2534
2574
|
updatePath(e, t, n);
|
|
2535
2575
|
}
|
|
@@ -2541,20 +2581,20 @@ function updatePath(e, t, n = 0) {
|
|
|
2541
2581
|
}
|
|
2542
2582
|
r = e[i];
|
|
2543
2583
|
}
|
|
2544
|
-
let
|
|
2545
|
-
if (typeof
|
|
2546
|
-
|
|
2547
|
-
if (
|
|
2584
|
+
let s = t[t.length - 1];
|
|
2585
|
+
if (typeof s === "function") {
|
|
2586
|
+
s = s(r);
|
|
2587
|
+
if (s === r) return;
|
|
2548
2588
|
}
|
|
2549
|
-
if (i === undefined &&
|
|
2550
|
-
if (
|
|
2589
|
+
if (i === undefined && s == undefined) return;
|
|
2590
|
+
if (s === DELETE) {
|
|
2551
2591
|
delete e[i];
|
|
2552
|
-
} else if (i === undefined || (isWrappable(r) && isWrappable(
|
|
2592
|
+
} else if (i === undefined || (isWrappable(r) && isWrappable(s) && !Array.isArray(s))) {
|
|
2553
2593
|
const t = i !== undefined ? e[i] : e;
|
|
2554
|
-
const n = Object.keys(
|
|
2555
|
-
for (let e = 0; e < n.length; e++) t[n[e]] =
|
|
2594
|
+
const n = Object.keys(s);
|
|
2595
|
+
for (let e = 0; e < n.length; e++) t[n[e]] = s[n[e]];
|
|
2556
2596
|
} else {
|
|
2557
|
-
e[i] =
|
|
2597
|
+
e[i] = s;
|
|
2558
2598
|
}
|
|
2559
2599
|
}
|
|
2560
2600
|
const storePath = Object.assign(
|
|
@@ -2566,28 +2606,28 @@ const storePath = Object.assign(
|
|
|
2566
2606
|
{ DELETE: DELETE }
|
|
2567
2607
|
);
|
|
2568
2608
|
function snapshotImpl(e, t, n, i) {
|
|
2569
|
-
let r,
|
|
2609
|
+
let r, s, o, u, c, a;
|
|
2570
2610
|
if (!isWrappable(e)) return e;
|
|
2571
2611
|
if (n && n.has(e)) return n.get(e);
|
|
2572
2612
|
if (!n) n = new Map();
|
|
2573
2613
|
if ((r = e[$TARGET] || i?.get(e)?.[$TARGET])) {
|
|
2574
2614
|
if (t) trackSelf(r, $TRACK);
|
|
2575
|
-
|
|
2576
|
-
|
|
2615
|
+
o = r[STORE_OVERRIDE];
|
|
2616
|
+
s = Array.isArray(r[STORE_VALUE]);
|
|
2577
2617
|
n.set(
|
|
2578
2618
|
e,
|
|
2579
|
-
|
|
2619
|
+
o ? (u = s ? [] : Object.create(Object.getPrototypeOf(r[STORE_VALUE]))) : r[STORE_VALUE]
|
|
2580
2620
|
);
|
|
2581
2621
|
e = r[STORE_VALUE];
|
|
2582
2622
|
i = storeLookup;
|
|
2583
2623
|
} else {
|
|
2584
|
-
|
|
2624
|
+
s = Array.isArray(e);
|
|
2585
2625
|
n.set(e, e);
|
|
2586
2626
|
}
|
|
2587
|
-
if (
|
|
2588
|
-
const
|
|
2589
|
-
for (let f = 0; f <
|
|
2590
|
-
a =
|
|
2627
|
+
if (s) {
|
|
2628
|
+
const s = o?.length || e.length;
|
|
2629
|
+
for (let f = 0; f < s; f++) {
|
|
2630
|
+
a = o && f in o ? o[f] : e[f];
|
|
2591
2631
|
if (a === $DELETED) continue;
|
|
2592
2632
|
if (t && isWrappable(a)) wrap(a, r);
|
|
2593
2633
|
if ((c = snapshotImpl(a, t, n, i)) !== a || u) {
|
|
@@ -2596,12 +2636,12 @@ function snapshotImpl(e, t, n, i) {
|
|
|
2596
2636
|
}
|
|
2597
2637
|
}
|
|
2598
2638
|
} else {
|
|
2599
|
-
const
|
|
2600
|
-
for (let f = 0, l =
|
|
2601
|
-
let l =
|
|
2602
|
-
const E = getPropertyDescriptor(e,
|
|
2639
|
+
const s = getKeys(e, o);
|
|
2640
|
+
for (let f = 0, l = s.length; f < l; f++) {
|
|
2641
|
+
let l = s[f];
|
|
2642
|
+
const E = getPropertyDescriptor(e, o, l);
|
|
2603
2643
|
if (E.get) continue;
|
|
2604
|
-
a =
|
|
2644
|
+
a = o && l in o ? o[l] : e[l];
|
|
2605
2645
|
if (t && isWrappable(a)) wrap(a, r);
|
|
2606
2646
|
if ((c = snapshotImpl(a, t, n, i)) !== e[l] || u) {
|
|
2607
2647
|
if (!u) {
|
|
@@ -2660,8 +2700,8 @@ function merge(...e) {
|
|
|
2660
2700
|
for (let i = 0; i < e.length; i++) {
|
|
2661
2701
|
const r = e[i];
|
|
2662
2702
|
t = t || (!!r && $PROXY in r);
|
|
2663
|
-
const
|
|
2664
|
-
if (
|
|
2703
|
+
const s = !!r && r[$SOURCES];
|
|
2704
|
+
if (s) n.push(...s);
|
|
2665
2705
|
else n.push(typeof r === "function" ? ((t = true), createMemo(r)) : r);
|
|
2666
2706
|
}
|
|
2667
2707
|
if (SUPPORTS_PROXY && t) {
|
|
@@ -2691,35 +2731,35 @@ function merge(...e) {
|
|
|
2691
2731
|
}
|
|
2692
2732
|
const i = Object.create(null);
|
|
2693
2733
|
let r = false;
|
|
2694
|
-
let
|
|
2695
|
-
for (let e =
|
|
2734
|
+
let s = n.length - 1;
|
|
2735
|
+
for (let e = s; e >= 0; e--) {
|
|
2696
2736
|
const t = n[e];
|
|
2697
2737
|
if (!t) {
|
|
2698
|
-
e ===
|
|
2738
|
+
e === s && s--;
|
|
2699
2739
|
continue;
|
|
2700
2740
|
}
|
|
2701
|
-
const
|
|
2702
|
-
for (let n =
|
|
2703
|
-
const u =
|
|
2741
|
+
const o = Object.getOwnPropertyNames(t);
|
|
2742
|
+
for (let n = o.length - 1; n >= 0; n--) {
|
|
2743
|
+
const u = o[n];
|
|
2704
2744
|
if (u === "__proto__" || u === "constructor") continue;
|
|
2705
2745
|
if (!i[u]) {
|
|
2706
|
-
r = r || e !==
|
|
2746
|
+
r = r || e !== s;
|
|
2707
2747
|
const n = Object.getOwnPropertyDescriptor(t, u);
|
|
2708
2748
|
i[u] = n.get ? { enumerable: true, configurable: true, get: n.get.bind(t) } : n;
|
|
2709
2749
|
}
|
|
2710
2750
|
}
|
|
2711
2751
|
}
|
|
2712
|
-
if (!r) return n[
|
|
2713
|
-
const
|
|
2752
|
+
if (!r) return n[s];
|
|
2753
|
+
const o = {};
|
|
2714
2754
|
const u = Object.keys(i);
|
|
2715
2755
|
for (let e = u.length - 1; e >= 0; e--) {
|
|
2716
2756
|
const t = u[e],
|
|
2717
2757
|
n = i[t];
|
|
2718
|
-
if (n.get) Object.defineProperty(
|
|
2719
|
-
else
|
|
2758
|
+
if (n.get) Object.defineProperty(o, t, n);
|
|
2759
|
+
else o[t] = n.value;
|
|
2720
2760
|
}
|
|
2721
|
-
|
|
2722
|
-
return
|
|
2761
|
+
o[$SOURCES] = n;
|
|
2762
|
+
return o;
|
|
2723
2763
|
}
|
|
2724
2764
|
function omit(e, ...t) {
|
|
2725
2765
|
const n = new Set(t);
|
|
@@ -2753,14 +2793,14 @@ function omit(e, ...t) {
|
|
|
2753
2793
|
function mapArray(e, t, n) {
|
|
2754
2794
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2755
2795
|
const r = t.length > 1;
|
|
2756
|
-
const
|
|
2796
|
+
const s = t;
|
|
2757
2797
|
return createMemo(
|
|
2758
2798
|
updateKeyedMap.bind({
|
|
2759
2799
|
Ye: createOwner(),
|
|
2760
|
-
|
|
2761
|
-
|
|
2800
|
+
Ze: 0,
|
|
2801
|
+
Be: e,
|
|
2762
2802
|
qe: [],
|
|
2763
|
-
ze:
|
|
2803
|
+
ze: s,
|
|
2764
2804
|
Xe: [],
|
|
2765
2805
|
Je: [],
|
|
2766
2806
|
et: i,
|
|
@@ -2772,7 +2812,7 @@ function mapArray(e, t, n) {
|
|
|
2772
2812
|
}
|
|
2773
2813
|
const pureOptions = { pureWrite: true };
|
|
2774
2814
|
function updateKeyedMap() {
|
|
2775
|
-
const e = this.
|
|
2815
|
+
const e = this.Be() || [],
|
|
2776
2816
|
t = e.length;
|
|
2777
2817
|
e[$TRACK];
|
|
2778
2818
|
runWithOwner(this.Ye, () => {
|
|
@@ -2795,29 +2835,29 @@ function updateKeyedMap() {
|
|
|
2795
2835
|
return this.ze(() => t);
|
|
2796
2836
|
};
|
|
2797
2837
|
if (t === 0) {
|
|
2798
|
-
if (this.
|
|
2838
|
+
if (this.Ze !== 0) {
|
|
2799
2839
|
this.Ye.dispose(false);
|
|
2800
2840
|
this.Je = [];
|
|
2801
2841
|
this.qe = [];
|
|
2802
2842
|
this.Xe = [];
|
|
2803
|
-
this.
|
|
2843
|
+
this.Ze = 0;
|
|
2804
2844
|
this.tt && (this.tt = []);
|
|
2805
2845
|
this.nt && (this.nt = []);
|
|
2806
2846
|
}
|
|
2807
2847
|
if (this.it && !this.Xe[0]) {
|
|
2808
2848
|
this.Xe[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
|
|
2809
2849
|
}
|
|
2810
|
-
} else if (this.
|
|
2850
|
+
} else if (this.Ze === 0) {
|
|
2811
2851
|
if (this.Je[0]) this.Je[0].dispose();
|
|
2812
2852
|
this.Xe = new Array(t);
|
|
2813
2853
|
for (i = 0; i < t; i++) {
|
|
2814
2854
|
this.qe[i] = e[i];
|
|
2815
2855
|
this.Xe[i] = runWithOwner((this.Je[i] = createOwner()), r);
|
|
2816
2856
|
}
|
|
2817
|
-
this.
|
|
2857
|
+
this.Ze = t;
|
|
2818
2858
|
} else {
|
|
2819
|
-
let
|
|
2820
|
-
|
|
2859
|
+
let s,
|
|
2860
|
+
o,
|
|
2821
2861
|
u,
|
|
2822
2862
|
c,
|
|
2823
2863
|
a,
|
|
@@ -2828,34 +2868,34 @@ function updateKeyedMap() {
|
|
|
2828
2868
|
d = this.tt ? new Array(t) : undefined,
|
|
2829
2869
|
S = this.nt ? new Array(t) : undefined;
|
|
2830
2870
|
for (
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2871
|
+
s = 0, o = Math.min(this.Ze, t);
|
|
2872
|
+
s < o && (this.qe[s] === e[s] || (this.tt && compare(this.et, this.qe[s], e[s])));
|
|
2873
|
+
s++
|
|
2834
2874
|
) {
|
|
2835
|
-
if (this.tt) setSignal(this.tt[
|
|
2875
|
+
if (this.tt) setSignal(this.tt[s], e[s]);
|
|
2836
2876
|
}
|
|
2837
2877
|
for (
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
u >=
|
|
2841
|
-
(this.qe[
|
|
2842
|
-
|
|
2878
|
+
o = this.Ze - 1, u = t - 1;
|
|
2879
|
+
o >= s &&
|
|
2880
|
+
u >= s &&
|
|
2881
|
+
(this.qe[o] === e[u] || (this.tt && compare(this.et, this.qe[o], e[u])));
|
|
2882
|
+
o--, u--
|
|
2843
2883
|
) {
|
|
2844
|
-
E[u] = this.Xe[
|
|
2845
|
-
T[u] = this.Je[
|
|
2846
|
-
d && (d[u] = this.tt[
|
|
2847
|
-
S && (S[u] = this.nt[
|
|
2884
|
+
E[u] = this.Xe[o];
|
|
2885
|
+
T[u] = this.Je[o];
|
|
2886
|
+
d && (d[u] = this.tt[o]);
|
|
2887
|
+
S && (S[u] = this.nt[o]);
|
|
2848
2888
|
}
|
|
2849
2889
|
f = new Map();
|
|
2850
2890
|
l = new Array(u + 1);
|
|
2851
|
-
for (i = u; i >=
|
|
2891
|
+
for (i = u; i >= s; i--) {
|
|
2852
2892
|
c = e[i];
|
|
2853
2893
|
a = this.et ? this.et(c) : c;
|
|
2854
2894
|
n = f.get(a);
|
|
2855
2895
|
l[i] = n === undefined ? -1 : n;
|
|
2856
2896
|
f.set(a, i);
|
|
2857
2897
|
}
|
|
2858
|
-
for (n =
|
|
2898
|
+
for (n = s; n <= o; n++) {
|
|
2859
2899
|
c = this.qe[n];
|
|
2860
2900
|
a = this.et ? this.et(c) : c;
|
|
2861
2901
|
i = f.get(a);
|
|
@@ -2868,7 +2908,7 @@ function updateKeyedMap() {
|
|
|
2868
2908
|
f.set(a, i);
|
|
2869
2909
|
} else this.Je[n].dispose();
|
|
2870
2910
|
}
|
|
2871
|
-
for (i =
|
|
2911
|
+
for (i = s; i < t; i++) {
|
|
2872
2912
|
if (i in E) {
|
|
2873
2913
|
this.Xe[i] = E[i];
|
|
2874
2914
|
this.Je[i] = T[i];
|
|
@@ -2884,7 +2924,7 @@ function updateKeyedMap() {
|
|
|
2884
2924
|
this.Xe[i] = runWithOwner((this.Je[i] = createOwner()), r);
|
|
2885
2925
|
}
|
|
2886
2926
|
}
|
|
2887
|
-
this.Xe = this.Xe.slice(0, (this.
|
|
2927
|
+
this.Xe = this.Xe.slice(0, (this.Ze = t));
|
|
2888
2928
|
this.qe = e.slice(0);
|
|
2889
2929
|
}
|
|
2890
2930
|
});
|
|
@@ -2894,26 +2934,26 @@ function repeat(e, t, n) {
|
|
|
2894
2934
|
const i = t;
|
|
2895
2935
|
return updateRepeat.bind({
|
|
2896
2936
|
Ye: createOwner(),
|
|
2897
|
-
|
|
2937
|
+
Ze: 0,
|
|
2898
2938
|
rt: 0,
|
|
2899
|
-
|
|
2939
|
+
st: e,
|
|
2900
2940
|
ze: i,
|
|
2901
2941
|
Je: [],
|
|
2902
2942
|
Xe: [],
|
|
2903
|
-
|
|
2943
|
+
ot: n?.from,
|
|
2904
2944
|
it: n?.fallback
|
|
2905
2945
|
});
|
|
2906
2946
|
}
|
|
2907
2947
|
function updateRepeat() {
|
|
2908
|
-
const e = this.
|
|
2909
|
-
const t = this.
|
|
2948
|
+
const e = this.st();
|
|
2949
|
+
const t = this.ot?.() || 0;
|
|
2910
2950
|
runWithOwner(this.Ye, () => {
|
|
2911
2951
|
if (e === 0) {
|
|
2912
|
-
if (this.
|
|
2952
|
+
if (this.Ze !== 0) {
|
|
2913
2953
|
this.Ye.dispose(false);
|
|
2914
2954
|
this.Je = [];
|
|
2915
2955
|
this.Xe = [];
|
|
2916
|
-
this.
|
|
2956
|
+
this.Ze = 0;
|
|
2917
2957
|
}
|
|
2918
2958
|
if (this.it && !this.Xe[0]) {
|
|
2919
2959
|
this.Xe[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
|
|
@@ -2921,12 +2961,12 @@ function updateRepeat() {
|
|
|
2921
2961
|
return;
|
|
2922
2962
|
}
|
|
2923
2963
|
const n = t + e;
|
|
2924
|
-
const i = this.rt + this.
|
|
2925
|
-
if (this.
|
|
2964
|
+
const i = this.rt + this.Ze;
|
|
2965
|
+
if (this.Ze === 0 && this.Je[0]) this.Je[0].dispose();
|
|
2926
2966
|
for (let e = n; e < i; e++) this.Je[e - this.rt].dispose();
|
|
2927
2967
|
if (this.rt < t) {
|
|
2928
2968
|
let e = this.rt;
|
|
2929
|
-
while (e < t && e < this.
|
|
2969
|
+
while (e < t && e < this.Ze) this.Je[e++].dispose();
|
|
2930
2970
|
this.Je.splice(0, t - this.rt);
|
|
2931
2971
|
this.Xe.splice(0, t - this.rt);
|
|
2932
2972
|
} else if (this.rt > t) {
|
|
@@ -2947,7 +2987,7 @@ function updateRepeat() {
|
|
|
2947
2987
|
}
|
|
2948
2988
|
this.Xe = this.Xe.slice(0, e);
|
|
2949
2989
|
this.rt = t;
|
|
2950
|
-
this.
|
|
2990
|
+
this.Ze = e;
|
|
2951
2991
|
});
|
|
2952
2992
|
return this.Xe;
|
|
2953
2993
|
}
|
|
@@ -2956,14 +2996,14 @@ function compare(e, t, n) {
|
|
|
2956
2996
|
}
|
|
2957
2997
|
function boundaryComputed(e, t) {
|
|
2958
2998
|
const n = computed(e, undefined, { lazy: true });
|
|
2959
|
-
n.
|
|
2999
|
+
n.xe = (e, t) => {
|
|
2960
3000
|
const i = e !== undefined ? e : n.Se;
|
|
2961
3001
|
const r = t !== undefined ? t : n.le;
|
|
2962
3002
|
n.Se &= ~n.ut;
|
|
2963
3003
|
n.F.notify(n, n.ut, i, r);
|
|
2964
3004
|
};
|
|
2965
3005
|
n.ut = t;
|
|
2966
|
-
n.
|
|
3006
|
+
n.Ae = true;
|
|
2967
3007
|
recompute(n, true);
|
|
2968
3008
|
return n;
|
|
2969
3009
|
}
|
|
@@ -3040,18 +3080,18 @@ class CollectionQueue extends Queue {
|
|
|
3040
3080
|
}
|
|
3041
3081
|
function createCollectionBoundary(e, t, n, i) {
|
|
3042
3082
|
const r = createOwner();
|
|
3043
|
-
const
|
|
3044
|
-
if (i)
|
|
3045
|
-
const
|
|
3083
|
+
const s = new CollectionQueue(e);
|
|
3084
|
+
if (i) s.Tt = i;
|
|
3085
|
+
const o = createBoundChildren(r, t, s, e);
|
|
3046
3086
|
const u = computed(() => {
|
|
3047
|
-
if (!read(
|
|
3048
|
-
const e = read(
|
|
3049
|
-
if (!untrack(() => read(
|
|
3050
|
-
|
|
3087
|
+
if (!read(s.lt)) {
|
|
3088
|
+
const e = read(o);
|
|
3089
|
+
if (!untrack(() => read(s.lt))) {
|
|
3090
|
+
s.Et = true;
|
|
3051
3091
|
return e;
|
|
3052
3092
|
}
|
|
3053
3093
|
}
|
|
3054
|
-
return n(
|
|
3094
|
+
return n(s);
|
|
3055
3095
|
});
|
|
3056
3096
|
return accessor(u);
|
|
3057
3097
|
}
|
|
@@ -3092,9 +3132,9 @@ function flatten(e, t) {
|
|
|
3092
3132
|
function flattenArray(e, t = [], n) {
|
|
3093
3133
|
let i = null;
|
|
3094
3134
|
let r = false;
|
|
3095
|
-
for (let
|
|
3135
|
+
for (let s = 0; s < e.length; s++) {
|
|
3096
3136
|
try {
|
|
3097
|
-
let i = e[
|
|
3137
|
+
let i = e[s];
|
|
3098
3138
|
if (typeof i === "function" && !i.length) {
|
|
3099
3139
|
if (n?.doNotUnwrap) {
|
|
3100
3140
|
t.push(i);
|