@solidjs/signals 0.8.4 → 0.8.6
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 +49 -36
- package/dist/node.cjs +256 -248
- package/dist/prod.js +255 -248
- package/dist/types/core/core.d.ts +1 -2
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -245,8 +245,10 @@ class GlobalQueue extends Queue {
|
|
|
245
245
|
notify(e, t, n) {
|
|
246
246
|
if (t & STATUS_PENDING) {
|
|
247
247
|
if (n & STATUS_PENDING) {
|
|
248
|
-
if (activeTransition && !activeTransition.asyncNodes.includes(e.Y.cause))
|
|
248
|
+
if (activeTransition && !activeTransition.asyncNodes.includes(e.Y.cause)) {
|
|
249
249
|
activeTransition.asyncNodes.push(e.Y.cause);
|
|
250
|
+
schedule();
|
|
251
|
+
}
|
|
250
252
|
}
|
|
251
253
|
return true;
|
|
252
254
|
}
|
|
@@ -330,73 +332,76 @@ function notifySubs(e) {
|
|
|
330
332
|
}
|
|
331
333
|
}
|
|
332
334
|
function recompute(e, t = false) {
|
|
333
|
-
|
|
334
|
-
if (
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
335
|
+
const n = e.K && e.B != activeTransition;
|
|
336
|
+
if (!t) {
|
|
337
|
+
if (e.B && activeTransition !== e.B && !n) globalQueue.initTransition(e);
|
|
338
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
339
|
+
if (e.B) disposeChildren(e);
|
|
340
|
+
else {
|
|
341
|
+
markDisposal(e);
|
|
342
|
+
e.ee = e.te;
|
|
343
|
+
e.ne = e.ie;
|
|
344
|
+
e.te = null;
|
|
345
|
+
e.ie = null;
|
|
346
|
+
}
|
|
342
347
|
}
|
|
343
|
-
const
|
|
348
|
+
const i = context;
|
|
344
349
|
context = e;
|
|
345
350
|
e.re = null;
|
|
346
351
|
e._ = REACTIVE_RECOMPUTING_DEPS;
|
|
347
352
|
e.se = clock;
|
|
348
|
-
let
|
|
349
|
-
let
|
|
350
|
-
let
|
|
351
|
-
let
|
|
352
|
-
let
|
|
353
|
-
setStatusFlags(e, STATUS_NONE | (
|
|
353
|
+
let r = e.W === NOT_PENDING ? e.j : e.W;
|
|
354
|
+
let s = e.o;
|
|
355
|
+
let o = e.J;
|
|
356
|
+
let u = e.Y;
|
|
357
|
+
let l = tracking;
|
|
358
|
+
setStatusFlags(e, STATUS_NONE | (o & STATUS_UNINITIALIZED));
|
|
354
359
|
tracking = true;
|
|
355
360
|
try {
|
|
356
|
-
|
|
361
|
+
r = e.m(r);
|
|
357
362
|
e.J &= ~STATUS_UNINITIALIZED;
|
|
358
363
|
} catch (t) {
|
|
359
364
|
if (t instanceof NotReadyError) {
|
|
360
365
|
if (t.cause !== e) link(t.cause, e);
|
|
361
|
-
setStatusFlags(e, (
|
|
366
|
+
setStatusFlags(e, (o & ~STATUS_ERROR) | STATUS_PENDING, t);
|
|
362
367
|
} else setStatusFlags(e, STATUS_ERROR, t);
|
|
363
368
|
} finally {
|
|
364
|
-
tracking =
|
|
369
|
+
tracking = l;
|
|
365
370
|
}
|
|
366
371
|
e._ = REACTIVE_NONE;
|
|
367
|
-
context =
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
e.
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if (e.Z) e.Z.q(i);
|
|
372
|
+
context = i;
|
|
373
|
+
if (!(e.J & STATUS_PENDING)) {
|
|
374
|
+
const t = e.re;
|
|
375
|
+
let n = t !== null ? t.P : e.D;
|
|
376
|
+
if (n !== null) {
|
|
377
|
+
do {
|
|
378
|
+
n = unlinkSubs(n);
|
|
379
|
+
} while (n !== null);
|
|
380
|
+
if (t !== null) t.P = null;
|
|
381
|
+
else e.D = null;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
const c = !e.oe || !e.oe(e.W === NOT_PENDING || e.ue || n ? e.j : e.W, r);
|
|
385
|
+
const a = e.J !== o || e.Y !== u;
|
|
386
|
+
e.le?.(a, o);
|
|
387
|
+
if (c || a) {
|
|
388
|
+
if (c) {
|
|
389
|
+
if (t || e.ue || n) e.j = r;
|
|
390
|
+
else e.W = r;
|
|
391
|
+
if (e.Z) e.Z.W = r;
|
|
388
392
|
}
|
|
389
393
|
for (let t = e.O; t !== null; t = t.p) {
|
|
390
394
|
const n = t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
391
395
|
if (t.A.o < e.o && n.C > t.A.o) n.C = t.A.o;
|
|
392
396
|
insertIntoHeap(t.A, n);
|
|
393
397
|
}
|
|
394
|
-
} else if (e.o !=
|
|
398
|
+
} else if (e.o != s) {
|
|
395
399
|
for (let t = e.O; t !== null; t = t.p) {
|
|
396
400
|
insertIntoHeapHeight(t.A, t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
397
401
|
}
|
|
398
402
|
}
|
|
399
|
-
if (e.
|
|
403
|
+
if ((!t || e.J & STATUS_PENDING) && !e.ue && !n && !e.B) globalQueue.$.push(e);
|
|
404
|
+
if (e.B && n) runInTransition(e, recompute);
|
|
400
405
|
}
|
|
401
406
|
function updateIfNecessary(e) {
|
|
402
407
|
if (e._ & REACTIVE_CHECK) {
|
|
@@ -428,7 +433,7 @@ function unlinkSubs(e) {
|
|
|
428
433
|
t.O = i;
|
|
429
434
|
if (i === null) {
|
|
430
435
|
t.fe?.();
|
|
431
|
-
t.m && unobserved(t);
|
|
436
|
+
t.m && !t.Ee && unobserved(t);
|
|
432
437
|
}
|
|
433
438
|
}
|
|
434
439
|
return n;
|
|
@@ -440,7 +445,7 @@ function unobserved(e) {
|
|
|
440
445
|
t = unlinkSubs(t);
|
|
441
446
|
}
|
|
442
447
|
e.D = null;
|
|
443
|
-
|
|
448
|
+
disposeChildren(e, true);
|
|
444
449
|
}
|
|
445
450
|
function link(e, t) {
|
|
446
451
|
const n = t.re;
|
|
@@ -487,7 +492,7 @@ function markDisposal(e) {
|
|
|
487
492
|
insertIntoHeap(t, zombieQueue);
|
|
488
493
|
}
|
|
489
494
|
markDisposal(t);
|
|
490
|
-
t = t.
|
|
495
|
+
t = t.de;
|
|
491
496
|
}
|
|
492
497
|
}
|
|
493
498
|
function dispose(e) {
|
|
@@ -502,9 +507,9 @@ function dispose(e) {
|
|
|
502
507
|
function disposeChildren(e, t = false, n) {
|
|
503
508
|
if (e._ & REACTIVE_DISPOSED) return;
|
|
504
509
|
if (t) e._ = REACTIVE_DISPOSED;
|
|
505
|
-
let i = n ? e.
|
|
510
|
+
let i = n ? e.ne : e.ie;
|
|
506
511
|
while (i) {
|
|
507
|
-
const e = i.
|
|
512
|
+
const e = i.de;
|
|
508
513
|
if (i.D) {
|
|
509
514
|
const e = i;
|
|
510
515
|
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
@@ -519,15 +524,15 @@ function disposeChildren(e, t = false, n) {
|
|
|
519
524
|
i = e;
|
|
520
525
|
}
|
|
521
526
|
if (n) {
|
|
522
|
-
e.
|
|
527
|
+
e.ne = null;
|
|
523
528
|
} else {
|
|
524
529
|
e.ie = null;
|
|
525
|
-
e.
|
|
530
|
+
e.de = null;
|
|
526
531
|
}
|
|
527
532
|
runDisposal(e, n);
|
|
528
533
|
}
|
|
529
534
|
function runDisposal(e, t) {
|
|
530
|
-
let n = t ? e.
|
|
535
|
+
let n = t ? e.ee : e.te;
|
|
531
536
|
if (!n) return;
|
|
532
537
|
if (Array.isArray(n)) {
|
|
533
538
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -537,10 +542,10 @@ function runDisposal(e, t) {
|
|
|
537
542
|
} else {
|
|
538
543
|
n.call(n);
|
|
539
544
|
}
|
|
540
|
-
t ? (e.
|
|
545
|
+
t ? (e.ee = null) : (e.te = null);
|
|
541
546
|
}
|
|
542
547
|
function getNextChildId(e) {
|
|
543
|
-
if (e.id != null) return formatId(e.id, e.
|
|
548
|
+
if (e.id != null) return formatId(e.id, e.Te++);
|
|
544
549
|
throw new Error("Cannot get child id from owner without an id");
|
|
545
550
|
}
|
|
546
551
|
function formatId(e, t) {
|
|
@@ -552,12 +557,12 @@ function computed(e, t, n) {
|
|
|
552
557
|
const i = {
|
|
553
558
|
id: n?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
|
|
554
559
|
oe: n?.equals != null ? n.equals : isEqual,
|
|
555
|
-
|
|
560
|
+
Re: !!n?.pureWrite,
|
|
556
561
|
fe: n?.unobserved,
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
562
|
+
te: null,
|
|
563
|
+
he: context?.he ?? globalQueue,
|
|
564
|
+
_e: context?._e ?? defaultContext,
|
|
565
|
+
Te: 0,
|
|
561
566
|
m: e,
|
|
562
567
|
j: t,
|
|
563
568
|
o: 0,
|
|
@@ -569,16 +574,17 @@ function computed(e, t, n) {
|
|
|
569
574
|
O: null,
|
|
570
575
|
ae: null,
|
|
571
576
|
i: context,
|
|
572
|
-
|
|
577
|
+
de: null,
|
|
573
578
|
ie: null,
|
|
574
579
|
_: REACTIVE_NONE,
|
|
575
580
|
J: STATUS_UNINITIALIZED,
|
|
576
581
|
se: clock,
|
|
577
582
|
W: NOT_PENDING,
|
|
578
|
-
|
|
579
|
-
|
|
583
|
+
ee: null,
|
|
584
|
+
ne: null,
|
|
585
|
+
B: null
|
|
580
586
|
};
|
|
581
|
-
if (n?.
|
|
587
|
+
if (n?.Se) Object.assign(i, n.Se);
|
|
582
588
|
i.T = i;
|
|
583
589
|
const r = context?.t ? context.u : context;
|
|
584
590
|
if (context) {
|
|
@@ -586,7 +592,7 @@ function computed(e, t, n) {
|
|
|
586
592
|
if (e === null) {
|
|
587
593
|
context.ie = i;
|
|
588
594
|
} else {
|
|
589
|
-
i.
|
|
595
|
+
i.de = e;
|
|
590
596
|
context.ie = i;
|
|
591
597
|
}
|
|
592
598
|
}
|
|
@@ -645,7 +651,7 @@ function asyncComputed(e, t, n) {
|
|
|
645
651
|
throw new NotReadyError(context);
|
|
646
652
|
};
|
|
647
653
|
const s = computed(fn, t, n);
|
|
648
|
-
s.
|
|
654
|
+
s.Oe = () => {
|
|
649
655
|
r = true;
|
|
650
656
|
recompute(s);
|
|
651
657
|
schedule();
|
|
@@ -657,7 +663,7 @@ function signal(e, t, n = null) {
|
|
|
657
663
|
const i = {
|
|
658
664
|
id: t?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
|
|
659
665
|
oe: t?.equals != null ? t.equals : isEqual,
|
|
660
|
-
|
|
666
|
+
Re: !!t?.pureWrite,
|
|
661
667
|
fe: t?.unobserved,
|
|
662
668
|
j: e,
|
|
663
669
|
O: null,
|
|
@@ -687,6 +693,7 @@ function read(e) {
|
|
|
687
693
|
let t = context;
|
|
688
694
|
if (t?.t) t = t.u;
|
|
689
695
|
if (t && tracking && !pendingCheck && !pendingValueCheck) {
|
|
696
|
+
if (e.m && e._ & REACTIVE_DISPOSED) recompute(e);
|
|
690
697
|
link(e, t);
|
|
691
698
|
const n = e.U || e;
|
|
692
699
|
if (n.m) {
|
|
@@ -726,9 +733,9 @@ function read(e) {
|
|
|
726
733
|
pendingValueCheck = true;
|
|
727
734
|
}
|
|
728
735
|
}
|
|
729
|
-
if (e.J & STATUS_PENDING) {
|
|
736
|
+
if (e.J & STATUS_PENDING && !pendingCheck) {
|
|
730
737
|
if ((t && !stale) || e.J & STATUS_UNINITIALIZED) throw e.Y;
|
|
731
|
-
else if (t && stale
|
|
738
|
+
else if (t && stale) {
|
|
732
739
|
setStatusFlags(t, t.J | 1, e.Y);
|
|
733
740
|
}
|
|
734
741
|
}
|
|
@@ -776,12 +783,12 @@ function getOwner() {
|
|
|
776
783
|
function onCleanup(e) {
|
|
777
784
|
if (!context) return e;
|
|
778
785
|
const t = context;
|
|
779
|
-
if (!t.
|
|
780
|
-
t.
|
|
781
|
-
} else if (Array.isArray(t.
|
|
782
|
-
t.
|
|
786
|
+
if (!t.te) {
|
|
787
|
+
t.te = e;
|
|
788
|
+
} else if (Array.isArray(t.te)) {
|
|
789
|
+
t.te.push(e);
|
|
783
790
|
} else {
|
|
784
|
-
t.
|
|
791
|
+
t.te = [t.te, e];
|
|
785
792
|
}
|
|
786
793
|
return e;
|
|
787
794
|
}
|
|
@@ -791,14 +798,14 @@ function createOwner(e) {
|
|
|
791
798
|
t: true,
|
|
792
799
|
u: t?.t ? t.u : t,
|
|
793
800
|
ie: null,
|
|
794
|
-
|
|
795
|
-
ne: null,
|
|
796
|
-
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
797
|
-
Re: t?.Re ?? globalQueue,
|
|
798
|
-
he: t?.he || defaultContext,
|
|
799
|
-
de: 0,
|
|
801
|
+
de: null,
|
|
800
802
|
te: null,
|
|
803
|
+
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
804
|
+
he: t?.he ?? globalQueue,
|
|
805
|
+
_e: t?._e || defaultContext,
|
|
806
|
+
Te: 0,
|
|
801
807
|
ee: null,
|
|
808
|
+
ne: null,
|
|
802
809
|
i: t,
|
|
803
810
|
dispose(e = true) {
|
|
804
811
|
disposeChildren(n, e);
|
|
@@ -809,7 +816,7 @@ function createOwner(e) {
|
|
|
809
816
|
if (e === null) {
|
|
810
817
|
t.ie = n;
|
|
811
818
|
} else {
|
|
812
|
-
n.
|
|
819
|
+
n.de = e;
|
|
813
820
|
t.ie = n;
|
|
814
821
|
}
|
|
815
822
|
}
|
|
@@ -846,18 +853,17 @@ function pending(e) {
|
|
|
846
853
|
pendingValueCheck = t;
|
|
847
854
|
}
|
|
848
855
|
}
|
|
849
|
-
function isPending(e
|
|
850
|
-
const
|
|
856
|
+
function isPending(e) {
|
|
857
|
+
const t = pendingCheck;
|
|
851
858
|
pendingCheck = { j: false };
|
|
852
859
|
try {
|
|
853
860
|
staleValues(e);
|
|
854
861
|
return pendingCheck.j;
|
|
855
862
|
} catch (e) {
|
|
856
863
|
if (!(e instanceof NotReadyError)) return false;
|
|
857
|
-
if (t !== undefined) return t;
|
|
858
864
|
throw e;
|
|
859
865
|
} finally {
|
|
860
|
-
pendingCheck =
|
|
866
|
+
pendingCheck = t;
|
|
861
867
|
}
|
|
862
868
|
}
|
|
863
869
|
function createContext(e, t) {
|
|
@@ -867,7 +873,7 @@ function getContext(e, t = getOwner()) {
|
|
|
867
873
|
if (!t) {
|
|
868
874
|
throw new NoOwnerError();
|
|
869
875
|
}
|
|
870
|
-
const n = hasContext(e, t) ? t.
|
|
876
|
+
const n = hasContext(e, t) ? t._e[e.id] : e.defaultValue;
|
|
871
877
|
if (isUndefined(n)) {
|
|
872
878
|
throw new ContextNotFoundError();
|
|
873
879
|
}
|
|
@@ -877,10 +883,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
877
883
|
if (!n) {
|
|
878
884
|
throw new NoOwnerError();
|
|
879
885
|
}
|
|
880
|
-
n.
|
|
886
|
+
n._e = { ...n._e, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
881
887
|
}
|
|
882
888
|
function hasContext(e, t) {
|
|
883
|
-
return !isUndefined(t?.
|
|
889
|
+
return !isUndefined(t?._e[e.id]);
|
|
884
890
|
}
|
|
885
891
|
function isUndefined(e) {
|
|
886
892
|
return typeof e === "undefined";
|
|
@@ -889,37 +895,37 @@ function effect(e, t, n, i, r) {
|
|
|
889
895
|
let s = false;
|
|
890
896
|
const o = computed(e, i, {
|
|
891
897
|
...r,
|
|
892
|
-
|
|
898
|
+
Se: {
|
|
893
899
|
M: true,
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
900
|
+
pe: i,
|
|
901
|
+
Ae: t,
|
|
902
|
+
Ne: n,
|
|
903
|
+
Ie: undefined,
|
|
898
904
|
K: r?.render ? EFFECT_RENDER : EFFECT_USER,
|
|
899
905
|
le(e, t) {
|
|
900
906
|
if (s) {
|
|
901
907
|
const n = this.J && this.J === t && e;
|
|
902
908
|
this.M = !(this.J & STATUS_ERROR) && !(this.J & STATUS_PENDING & ~t) && !n;
|
|
903
|
-
if (this.M) this.
|
|
909
|
+
if (this.M) this.he.enqueue(this.K, runEffect.bind(this));
|
|
904
910
|
}
|
|
905
911
|
if (this.J & STATUS_ERROR) {
|
|
906
912
|
let e = this.Y;
|
|
907
|
-
this.
|
|
913
|
+
this.he.notify(this, STATUS_PENDING, 0);
|
|
908
914
|
if (this.K === EFFECT_USER) {
|
|
909
915
|
try {
|
|
910
|
-
return this.
|
|
911
|
-
? this.
|
|
912
|
-
this.
|
|
913
|
-
this.
|
|
916
|
+
return this.Ne
|
|
917
|
+
? this.Ne(e, () => {
|
|
918
|
+
this.Ie?.();
|
|
919
|
+
this.Ie = undefined;
|
|
914
920
|
})
|
|
915
921
|
: console.error(e);
|
|
916
922
|
} catch (t) {
|
|
917
923
|
e = t;
|
|
918
924
|
}
|
|
919
925
|
}
|
|
920
|
-
if (!this.
|
|
926
|
+
if (!this.he.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
921
927
|
} else if (this.K === EFFECT_RENDER) {
|
|
922
|
-
this.
|
|
928
|
+
this.he.notify(this, STATUS_PENDING | STATUS_ERROR, this.J);
|
|
923
929
|
}
|
|
924
930
|
}
|
|
925
931
|
}
|
|
@@ -928,19 +934,19 @@ function effect(e, t, n, i, r) {
|
|
|
928
934
|
if (o.K === EFFECT_RENDER) o.m = t => staleValues(() => e(t));
|
|
929
935
|
!r?.defer &&
|
|
930
936
|
!(o.J & (STATUS_ERROR | STATUS_PENDING)) &&
|
|
931
|
-
(o.K === EFFECT_USER ? o.
|
|
932
|
-
onCleanup(() => o.
|
|
937
|
+
(o.K === EFFECT_USER ? o.he.enqueue(o.K, runEffect.bind(o)) : runEffect.call(o));
|
|
938
|
+
onCleanup(() => o.Ie?.());
|
|
933
939
|
}
|
|
934
940
|
function runEffect() {
|
|
935
941
|
if (!this.M || this._ & REACTIVE_DISPOSED) return;
|
|
936
|
-
this.
|
|
937
|
-
this.
|
|
942
|
+
this.Ie?.();
|
|
943
|
+
this.Ie = undefined;
|
|
938
944
|
try {
|
|
939
|
-
this.
|
|
945
|
+
this.Ie = this.Ae(this.j, this.pe);
|
|
940
946
|
} catch (e) {
|
|
941
|
-
if (!this.
|
|
947
|
+
if (!this.he.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
942
948
|
} finally {
|
|
943
|
-
this.
|
|
949
|
+
this.pe = this.j;
|
|
944
950
|
this.M = false;
|
|
945
951
|
}
|
|
946
952
|
}
|
|
@@ -961,7 +967,7 @@ function createMemo(e, t, n) {
|
|
|
961
967
|
function createAsync(e, t, n) {
|
|
962
968
|
const i = asyncComputed(e, t, n);
|
|
963
969
|
const r = read.bind(null, i);
|
|
964
|
-
r.refresh = i.
|
|
970
|
+
r.refresh = i.Oe;
|
|
965
971
|
return r;
|
|
966
972
|
}
|
|
967
973
|
function createEffect(e, t, n, i) {
|
|
@@ -1631,68 +1637,68 @@ function mapArray(e, t, n) {
|
|
|
1631
1637
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
1632
1638
|
return createMemo(
|
|
1633
1639
|
updateKeyedMap.bind({
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
Pe: [],
|
|
1640
|
+
ge: createOwner(),
|
|
1641
|
+
ye: 0,
|
|
1642
|
+
Ce: e,
|
|
1643
|
+
De: [],
|
|
1644
|
+
Pe: t,
|
|
1640
1645
|
we: [],
|
|
1641
|
-
be:
|
|
1642
|
-
Ve: i
|
|
1643
|
-
Ue:
|
|
1644
|
-
me:
|
|
1646
|
+
be: [],
|
|
1647
|
+
Ve: i,
|
|
1648
|
+
Ue: i || n?.keyed === false ? [] : undefined,
|
|
1649
|
+
me: t.length > 1 ? [] : undefined,
|
|
1650
|
+
ke: n?.fallback
|
|
1645
1651
|
})
|
|
1646
1652
|
);
|
|
1647
1653
|
}
|
|
1648
1654
|
const pureOptions = { pureWrite: true };
|
|
1649
1655
|
function updateKeyedMap() {
|
|
1650
|
-
const e = this.
|
|
1656
|
+
const e = this.Ce() || [],
|
|
1651
1657
|
t = e.length;
|
|
1652
1658
|
e[$TRACK];
|
|
1653
|
-
runWithOwner(this.
|
|
1659
|
+
runWithOwner(this.ge, () => {
|
|
1654
1660
|
let n,
|
|
1655
1661
|
i,
|
|
1656
|
-
r = this.
|
|
1662
|
+
r = this.Ue
|
|
1657
1663
|
? () => {
|
|
1658
|
-
this.
|
|
1659
|
-
this.
|
|
1660
|
-
return this.
|
|
1661
|
-
read.bind(null, this.
|
|
1662
|
-
this.
|
|
1664
|
+
this.Ue[i] = signal(e[i], pureOptions);
|
|
1665
|
+
this.me && (this.me[i] = signal(i, pureOptions));
|
|
1666
|
+
return this.Pe(
|
|
1667
|
+
read.bind(null, this.Ue[i]),
|
|
1668
|
+
this.me ? read.bind(null, this.me[i]) : undefined
|
|
1663
1669
|
);
|
|
1664
1670
|
}
|
|
1665
|
-
: this.
|
|
1671
|
+
: this.me
|
|
1666
1672
|
? () => {
|
|
1667
1673
|
const t = e[i];
|
|
1668
|
-
this.
|
|
1669
|
-
return this.
|
|
1674
|
+
this.me[i] = signal(i, pureOptions);
|
|
1675
|
+
return this.Pe(() => t, read.bind(null, this.me[i]));
|
|
1670
1676
|
}
|
|
1671
1677
|
: () => {
|
|
1672
1678
|
const t = e[i];
|
|
1673
|
-
return this.
|
|
1679
|
+
return this.Pe(() => t);
|
|
1674
1680
|
};
|
|
1675
1681
|
if (t === 0) {
|
|
1676
|
-
if (this.
|
|
1677
|
-
this.
|
|
1682
|
+
if (this.ye !== 0) {
|
|
1683
|
+
this.ge.dispose(false);
|
|
1684
|
+
this.be = [];
|
|
1685
|
+
this.De = [];
|
|
1678
1686
|
this.we = [];
|
|
1679
|
-
this.
|
|
1680
|
-
this.Pe = [];
|
|
1681
|
-
this.ge = 0;
|
|
1682
|
-
this.Ve && (this.Ve = []);
|
|
1687
|
+
this.ye = 0;
|
|
1683
1688
|
this.Ue && (this.Ue = []);
|
|
1689
|
+
this.me && (this.me = []);
|
|
1684
1690
|
}
|
|
1685
|
-
if (this.
|
|
1686
|
-
this.
|
|
1691
|
+
if (this.ke && !this.we[0]) {
|
|
1692
|
+
this.we[0] = runWithOwner((this.be[0] = createOwner()), this.ke);
|
|
1687
1693
|
}
|
|
1688
|
-
} else if (this.
|
|
1689
|
-
if (this.
|
|
1690
|
-
this.
|
|
1694
|
+
} else if (this.ye === 0) {
|
|
1695
|
+
if (this.be[0]) this.be[0].dispose();
|
|
1696
|
+
this.we = new Array(t);
|
|
1691
1697
|
for (i = 0; i < t; i++) {
|
|
1692
|
-
this.
|
|
1693
|
-
this.
|
|
1698
|
+
this.De[i] = e[i];
|
|
1699
|
+
this.we[i] = runWithOwner((this.be[i] = createOwner()), r);
|
|
1694
1700
|
}
|
|
1695
|
-
this.
|
|
1701
|
+
this.ye = t;
|
|
1696
1702
|
} else {
|
|
1697
1703
|
let s,
|
|
1698
1704
|
o,
|
|
@@ -1703,174 +1709,175 @@ function updateKeyedMap() {
|
|
|
1703
1709
|
f,
|
|
1704
1710
|
E = new Array(t),
|
|
1705
1711
|
d = new Array(t),
|
|
1706
|
-
T = this.
|
|
1707
|
-
R = this.
|
|
1712
|
+
T = this.Ue ? new Array(t) : undefined,
|
|
1713
|
+
R = this.me ? new Array(t) : undefined;
|
|
1708
1714
|
for (
|
|
1709
|
-
s = 0, o = Math.min(this.
|
|
1710
|
-
s < o && (this.
|
|
1715
|
+
s = 0, o = Math.min(this.ye, t);
|
|
1716
|
+
s < o && (this.De[s] === e[s] || (this.Ue && compare(this.Ve, this.De[s], e[s])));
|
|
1711
1717
|
s++
|
|
1712
1718
|
) {
|
|
1713
|
-
if (this.
|
|
1719
|
+
if (this.Ue) setSignal(this.Ue[s], e[s]);
|
|
1714
1720
|
}
|
|
1715
1721
|
for (
|
|
1716
|
-
o = this.
|
|
1722
|
+
o = this.ye - 1, u = t - 1;
|
|
1717
1723
|
o >= s &&
|
|
1718
1724
|
u >= s &&
|
|
1719
|
-
(this.
|
|
1725
|
+
(this.De[o] === e[u] || (this.Ue && compare(this.Ve, this.De[o], e[u])));
|
|
1720
1726
|
o--, u--
|
|
1721
1727
|
) {
|
|
1722
|
-
E[u] = this.
|
|
1723
|
-
d[u] = this.
|
|
1724
|
-
T && (T[u] = this.
|
|
1725
|
-
R && (R[u] = this.
|
|
1728
|
+
E[u] = this.we[o];
|
|
1729
|
+
d[u] = this.be[o];
|
|
1730
|
+
T && (T[u] = this.Ue[o]);
|
|
1731
|
+
R && (R[u] = this.me[o]);
|
|
1726
1732
|
}
|
|
1727
1733
|
a = new Map();
|
|
1728
1734
|
f = new Array(u + 1);
|
|
1729
1735
|
for (i = u; i >= s; i--) {
|
|
1730
1736
|
l = e[i];
|
|
1731
|
-
c = this.
|
|
1737
|
+
c = this.Ve ? this.Ve(l) : l;
|
|
1732
1738
|
n = a.get(c);
|
|
1733
1739
|
f[i] = n === undefined ? -1 : n;
|
|
1734
1740
|
a.set(c, i);
|
|
1735
1741
|
}
|
|
1736
1742
|
for (n = s; n <= o; n++) {
|
|
1737
|
-
l = this.
|
|
1738
|
-
c = this.
|
|
1743
|
+
l = this.De[n];
|
|
1744
|
+
c = this.Ve ? this.Ve(l) : l;
|
|
1739
1745
|
i = a.get(c);
|
|
1740
1746
|
if (i !== undefined && i !== -1) {
|
|
1741
|
-
E[i] = this.
|
|
1742
|
-
d[i] = this.
|
|
1743
|
-
T && (T[i] = this.
|
|
1744
|
-
R && (R[i] = this.
|
|
1747
|
+
E[i] = this.we[n];
|
|
1748
|
+
d[i] = this.be[n];
|
|
1749
|
+
T && (T[i] = this.Ue[n]);
|
|
1750
|
+
R && (R[i] = this.me[n]);
|
|
1745
1751
|
i = f[i];
|
|
1746
1752
|
a.set(c, i);
|
|
1747
|
-
} else this.
|
|
1753
|
+
} else this.be[n].dispose();
|
|
1748
1754
|
}
|
|
1749
1755
|
for (i = s; i < t; i++) {
|
|
1750
1756
|
if (i in E) {
|
|
1751
|
-
this.
|
|
1752
|
-
this.
|
|
1757
|
+
this.we[i] = E[i];
|
|
1758
|
+
this.be[i] = d[i];
|
|
1753
1759
|
if (T) {
|
|
1754
|
-
this.
|
|
1755
|
-
setSignal(this.
|
|
1760
|
+
this.Ue[i] = T[i];
|
|
1761
|
+
setSignal(this.Ue[i], e[i]);
|
|
1756
1762
|
}
|
|
1757
1763
|
if (R) {
|
|
1758
|
-
this.
|
|
1759
|
-
setSignal(this.
|
|
1764
|
+
this.me[i] = R[i];
|
|
1765
|
+
setSignal(this.me[i], i);
|
|
1760
1766
|
}
|
|
1761
1767
|
} else {
|
|
1762
|
-
this.
|
|
1768
|
+
this.we[i] = runWithOwner((this.be[i] = createOwner()), r);
|
|
1763
1769
|
}
|
|
1764
1770
|
}
|
|
1765
|
-
this.
|
|
1766
|
-
this.
|
|
1771
|
+
this.we = this.we.slice(0, (this.ye = t));
|
|
1772
|
+
this.De = e.slice(0);
|
|
1767
1773
|
}
|
|
1768
1774
|
});
|
|
1769
|
-
return this.
|
|
1775
|
+
return this.we;
|
|
1770
1776
|
}
|
|
1771
1777
|
function repeat(e, t, n) {
|
|
1772
1778
|
return updateRepeat.bind({
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1779
|
+
ge: createOwner(),
|
|
1780
|
+
ye: 0,
|
|
1781
|
+
ve: 0,
|
|
1782
|
+
xe: e,
|
|
1783
|
+
Pe: t,
|
|
1784
|
+
be: [],
|
|
1778
1785
|
we: [],
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
me: n?.fallback
|
|
1786
|
+
Ge: n?.from,
|
|
1787
|
+
ke: n?.fallback
|
|
1782
1788
|
});
|
|
1783
1789
|
}
|
|
1784
1790
|
function updateRepeat() {
|
|
1785
|
-
const e = this.
|
|
1786
|
-
const t = this.
|
|
1787
|
-
runWithOwner(this.
|
|
1791
|
+
const e = this.xe();
|
|
1792
|
+
const t = this.Ge?.() || 0;
|
|
1793
|
+
runWithOwner(this.ge, () => {
|
|
1788
1794
|
if (e === 0) {
|
|
1789
|
-
if (this.
|
|
1790
|
-
this.
|
|
1795
|
+
if (this.ye !== 0) {
|
|
1796
|
+
this.ge.dispose(false);
|
|
1797
|
+
this.be = [];
|
|
1791
1798
|
this.we = [];
|
|
1792
|
-
this.
|
|
1793
|
-
this.ge = 0;
|
|
1799
|
+
this.ye = 0;
|
|
1794
1800
|
}
|
|
1795
|
-
if (this.
|
|
1796
|
-
this.
|
|
1801
|
+
if (this.ke && !this.we[0]) {
|
|
1802
|
+
this.we[0] = runWithOwner((this.be[0] = createOwner()), this.ke);
|
|
1797
1803
|
}
|
|
1798
1804
|
return;
|
|
1799
1805
|
}
|
|
1800
1806
|
const n = t + e;
|
|
1801
|
-
const i = this.
|
|
1802
|
-
if (this.
|
|
1803
|
-
for (let e = n; e < i; e++) this.
|
|
1804
|
-
if (this.
|
|
1805
|
-
let e = this.
|
|
1806
|
-
while (e < t && e < this.
|
|
1807
|
-
this.
|
|
1808
|
-
this.
|
|
1809
|
-
} else if (this.
|
|
1810
|
-
let n = i - this.
|
|
1811
|
-
let r = this.
|
|
1812
|
-
this.
|
|
1807
|
+
const i = this.ve + this.ye;
|
|
1808
|
+
if (this.ye === 0 && this.be[0]) this.be[0].dispose();
|
|
1809
|
+
for (let e = n; e < i; e++) this.be[e - this.ve].dispose();
|
|
1810
|
+
if (this.ve < t) {
|
|
1811
|
+
let e = this.ve;
|
|
1812
|
+
while (e < t && e < this.ye) this.be[e++].dispose();
|
|
1813
|
+
this.be.splice(0, t - this.ve);
|
|
1814
|
+
this.we.splice(0, t - this.ve);
|
|
1815
|
+
} else if (this.ve > t) {
|
|
1816
|
+
let n = i - this.ve - 1;
|
|
1817
|
+
let r = this.ve - t;
|
|
1818
|
+
this.be.length = this.we.length = e;
|
|
1813
1819
|
while (n >= r) {
|
|
1820
|
+
this.be[n] = this.be[n - r];
|
|
1814
1821
|
this.we[n] = this.we[n - r];
|
|
1815
|
-
this.Pe[n] = this.Pe[n - r];
|
|
1816
1822
|
n--;
|
|
1817
1823
|
}
|
|
1818
1824
|
for (let e = 0; e < r; e++) {
|
|
1819
|
-
this.
|
|
1825
|
+
this.we[e] = runWithOwner((this.be[e] = createOwner()), () => this.Pe(e + t));
|
|
1820
1826
|
}
|
|
1821
1827
|
}
|
|
1822
1828
|
for (let e = i; e < n; e++) {
|
|
1823
|
-
this.
|
|
1829
|
+
this.we[e - t] = runWithOwner((this.be[e - t] = createOwner()), () => this.Pe(e));
|
|
1824
1830
|
}
|
|
1825
|
-
this.
|
|
1826
|
-
this.
|
|
1827
|
-
this.
|
|
1831
|
+
this.we = this.we.slice(0, e);
|
|
1832
|
+
this.ve = t;
|
|
1833
|
+
this.ye = e;
|
|
1828
1834
|
});
|
|
1829
|
-
return this.
|
|
1835
|
+
return this.we;
|
|
1830
1836
|
}
|
|
1831
1837
|
function compare(e, t, n) {
|
|
1832
1838
|
return e ? e(t) === e(n) : true;
|
|
1833
1839
|
}
|
|
1834
1840
|
function boundaryComputed(e, t) {
|
|
1835
1841
|
const n = computed(e, undefined, {
|
|
1836
|
-
|
|
1842
|
+
Se: {
|
|
1837
1843
|
le() {
|
|
1838
1844
|
let e = this.J;
|
|
1839
|
-
this.J &= ~this.
|
|
1840
|
-
if (this.
|
|
1845
|
+
this.J &= ~this.He;
|
|
1846
|
+
if (this.He & STATUS_PENDING && !(this.J & STATUS_UNINITIALIZED)) {
|
|
1841
1847
|
e &= ~STATUS_PENDING;
|
|
1842
1848
|
}
|
|
1843
|
-
this.
|
|
1849
|
+
this.he.notify(this, this.He, e);
|
|
1844
1850
|
},
|
|
1845
|
-
|
|
1851
|
+
He: t
|
|
1846
1852
|
}
|
|
1847
1853
|
});
|
|
1848
|
-
n.
|
|
1854
|
+
n.He = t;
|
|
1855
|
+
n.Ee = true;
|
|
1849
1856
|
return n;
|
|
1850
1857
|
}
|
|
1851
1858
|
function createBoundChildren(e, t, n, i) {
|
|
1852
|
-
const r = e.
|
|
1853
|
-
r.addChild((e.
|
|
1854
|
-
onCleanup(() => r.removeChild(e.
|
|
1859
|
+
const r = e.he;
|
|
1860
|
+
r.addChild((e.he = n));
|
|
1861
|
+
onCleanup(() => r.removeChild(e.he));
|
|
1855
1862
|
return runWithOwner(e, () => {
|
|
1856
1863
|
const e = computed(t);
|
|
1857
1864
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
1858
1865
|
});
|
|
1859
1866
|
}
|
|
1860
1867
|
class ConditionalQueue extends Queue {
|
|
1861
|
-
|
|
1862
|
-
|
|
1868
|
+
Qe;
|
|
1869
|
+
$e = new Set();
|
|
1863
1870
|
$ = new Set();
|
|
1864
1871
|
constructor(e) {
|
|
1865
1872
|
super();
|
|
1866
|
-
this.
|
|
1873
|
+
this.Qe = e;
|
|
1867
1874
|
}
|
|
1868
1875
|
run(e) {
|
|
1869
|
-
if (!e || read(this.
|
|
1876
|
+
if (!e || read(this.Qe)) return;
|
|
1870
1877
|
return super.run(e);
|
|
1871
1878
|
}
|
|
1872
1879
|
notify(e, t, n) {
|
|
1873
|
-
if (read(this.
|
|
1880
|
+
if (read(this.Qe)) {
|
|
1874
1881
|
if (t & STATUS_PENDING) {
|
|
1875
1882
|
if (n & STATUS_PENDING) {
|
|
1876
1883
|
this.$.add(e);
|
|
@@ -1879,37 +1886,37 @@ class ConditionalQueue extends Queue {
|
|
|
1879
1886
|
}
|
|
1880
1887
|
if (t & STATUS_ERROR) {
|
|
1881
1888
|
if (n & STATUS_ERROR) {
|
|
1882
|
-
this.
|
|
1889
|
+
this.$e.add(e);
|
|
1883
1890
|
t &= ~STATUS_ERROR;
|
|
1884
|
-
} else if (this.
|
|
1891
|
+
} else if (this.$e.delete(e)) t &= ~STATUS_ERROR;
|
|
1885
1892
|
}
|
|
1886
1893
|
}
|
|
1887
1894
|
return t ? super.notify(e, t, n) : true;
|
|
1888
1895
|
}
|
|
1889
1896
|
}
|
|
1890
1897
|
class CollectionQueue extends Queue {
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1898
|
+
Le;
|
|
1899
|
+
be = new Set();
|
|
1900
|
+
Qe = signal(false, { pureWrite: true });
|
|
1901
|
+
Fe = false;
|
|
1895
1902
|
constructor(e) {
|
|
1896
1903
|
super();
|
|
1897
|
-
this
|
|
1904
|
+
this.Le = e;
|
|
1898
1905
|
}
|
|
1899
1906
|
run(e) {
|
|
1900
|
-
if (!e || read(this.
|
|
1907
|
+
if (!e || read(this.Qe)) return;
|
|
1901
1908
|
return super.run(e);
|
|
1902
1909
|
}
|
|
1903
1910
|
notify(e, t, n) {
|
|
1904
|
-
if (!(t & this
|
|
1905
|
-
if (n & this
|
|
1906
|
-
this.
|
|
1907
|
-
if (this.
|
|
1908
|
-
} else if (this.
|
|
1909
|
-
this.
|
|
1910
|
-
if (this.
|
|
1911
|
-
}
|
|
1912
|
-
t &= ~this
|
|
1911
|
+
if (!(t & this.Le) || (this.Le & STATUS_PENDING && this.Fe)) return super.notify(e, t, n);
|
|
1912
|
+
if (n & this.Le) {
|
|
1913
|
+
this.be.add(e);
|
|
1914
|
+
if (this.be.size === 1) setSignal(this.Qe, true);
|
|
1915
|
+
} else if (this.be.size > 0) {
|
|
1916
|
+
this.be.delete(e);
|
|
1917
|
+
if (this.be.size === 0) setSignal(this.Qe, false);
|
|
1918
|
+
}
|
|
1919
|
+
t &= ~this.Le;
|
|
1913
1920
|
return t ? super.notify(e, t, n) : true;
|
|
1914
1921
|
}
|
|
1915
1922
|
}
|
|
@@ -1923,25 +1930,25 @@ function createBoundary(e, t) {
|
|
|
1923
1930
|
const i = new ConditionalQueue(computed(() => t() === BoundaryMode.HIDDEN));
|
|
1924
1931
|
const r = createBoundChildren(n, e, i, 0);
|
|
1925
1932
|
computed(() => {
|
|
1926
|
-
const e = read(i.
|
|
1927
|
-
r.
|
|
1933
|
+
const e = read(i.Qe);
|
|
1934
|
+
r.He = e ? STATUS_ERROR | STATUS_PENDING : 0;
|
|
1928
1935
|
if (!e) {
|
|
1929
1936
|
i.$.forEach(e => i.notify(e, STATUS_PENDING, STATUS_PENDING));
|
|
1930
|
-
i.
|
|
1937
|
+
i.$e.forEach(e => i.notify(e, STATUS_ERROR, STATUS_ERROR));
|
|
1931
1938
|
i.$.clear();
|
|
1932
|
-
i.
|
|
1939
|
+
i.$e.clear();
|
|
1933
1940
|
}
|
|
1934
1941
|
});
|
|
1935
|
-
return () => (read(i.
|
|
1942
|
+
return () => (read(i.Qe) ? undefined : read(r));
|
|
1936
1943
|
}
|
|
1937
1944
|
function createCollectionBoundary(e, t, n) {
|
|
1938
1945
|
const i = createOwner();
|
|
1939
1946
|
const r = new CollectionQueue(e);
|
|
1940
1947
|
const s = createBoundChildren(i, t, r, e);
|
|
1941
1948
|
const o = computed(() => {
|
|
1942
|
-
if (!read(r.
|
|
1949
|
+
if (!read(r.Qe)) {
|
|
1943
1950
|
const e = read(s);
|
|
1944
|
-
if (!untrack(() => read(r.
|
|
1951
|
+
if (!untrack(() => read(r.Qe))) r.Fe = true;
|
|
1945
1952
|
return e;
|
|
1946
1953
|
}
|
|
1947
1954
|
return n(r);
|
|
@@ -1966,10 +1973,10 @@ function collectErrorSources(e, t) {
|
|
|
1966
1973
|
}
|
|
1967
1974
|
function createErrorBoundary(e, t) {
|
|
1968
1975
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
1969
|
-
let n = e.
|
|
1976
|
+
let n = e.be.values().next().value;
|
|
1970
1977
|
return t(n.Y, () => {
|
|
1971
1978
|
const t = [];
|
|
1972
|
-
for (const n of e.
|
|
1979
|
+
for (const n of e.be) collectErrorSources(n, t);
|
|
1973
1980
|
for (const e of t) recompute(e);
|
|
1974
1981
|
schedule();
|
|
1975
1982
|
});
|