@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/node.cjs
CHANGED
|
@@ -246,7 +246,10 @@ class GlobalQueue extends Queue {
|
|
|
246
246
|
notify(e, t, n) {
|
|
247
247
|
if (t & f) {
|
|
248
248
|
if (n & f) {
|
|
249
|
-
if (m && !m.asyncNodes.includes(e.L.cause))
|
|
249
|
+
if (m && !m.asyncNodes.includes(e.L.cause)) {
|
|
250
|
+
m.asyncNodes.push(e.L.cause);
|
|
251
|
+
schedule();
|
|
252
|
+
}
|
|
250
253
|
}
|
|
251
254
|
return true;
|
|
252
255
|
}
|
|
@@ -325,73 +328,76 @@ function notifySubs(e) {
|
|
|
325
328
|
}
|
|
326
329
|
}
|
|
327
330
|
function recompute(t, n = false) {
|
|
328
|
-
|
|
329
|
-
if (
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
331
|
+
const i = t.T && t.J != m;
|
|
332
|
+
if (!n) {
|
|
333
|
+
if (t.J && m !== t.J && !i) O.initTransition(t);
|
|
334
|
+
deleteFromHeap(t, t.S & o ? S : _);
|
|
335
|
+
if (t.J) disposeChildren(t);
|
|
336
|
+
else {
|
|
337
|
+
markDisposal(t);
|
|
338
|
+
t.ee = t.te;
|
|
339
|
+
t.ne = t.re;
|
|
340
|
+
t.te = null;
|
|
341
|
+
t.re = null;
|
|
342
|
+
}
|
|
337
343
|
}
|
|
338
|
-
const
|
|
344
|
+
const s = E;
|
|
339
345
|
E = t;
|
|
340
346
|
t.ie = null;
|
|
341
347
|
t.S = r;
|
|
342
348
|
t.se = b;
|
|
343
|
-
let
|
|
344
|
-
let
|
|
345
|
-
let
|
|
346
|
-
let
|
|
347
|
-
let
|
|
348
|
-
setStatusFlags(t, l | (
|
|
349
|
+
let u = t.K === p ? t.G : t.K;
|
|
350
|
+
let d = t.o;
|
|
351
|
+
let h = t.$;
|
|
352
|
+
let y = t.L;
|
|
353
|
+
let g = C;
|
|
354
|
+
setStatusFlags(t, l | (h & a));
|
|
349
355
|
C = true;
|
|
350
356
|
try {
|
|
351
|
-
|
|
357
|
+
u = t.F(u);
|
|
352
358
|
t.$ &= ~a;
|
|
353
359
|
} catch (e) {
|
|
354
360
|
if (e instanceof NotReadyError) {
|
|
355
361
|
if (e.cause !== t) link(e.cause, t);
|
|
356
|
-
setStatusFlags(t, (
|
|
362
|
+
setStatusFlags(t, (h & ~c) | f, e);
|
|
357
363
|
} else setStatusFlags(t, c, e);
|
|
358
364
|
} finally {
|
|
359
|
-
C =
|
|
365
|
+
C = g;
|
|
360
366
|
}
|
|
361
367
|
t.S = e;
|
|
362
|
-
E =
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
t.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
if (t.Z) t.Z.Y(s);
|
|
368
|
+
E = s;
|
|
369
|
+
if (!(t.$ & f)) {
|
|
370
|
+
const e = t.ie;
|
|
371
|
+
let n = e !== null ? e.P : t.W;
|
|
372
|
+
if (n !== null) {
|
|
373
|
+
do {
|
|
374
|
+
n = unlinkSubs(n);
|
|
375
|
+
} while (n !== null);
|
|
376
|
+
if (e !== null) e.P = null;
|
|
377
|
+
else t.W = null;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
const w = !t.oe || !t.oe(t.K === p || t.ue || i ? t.G : t.K, u);
|
|
381
|
+
const x = t.$ !== h || t.L !== y;
|
|
382
|
+
t.le?.(x, h);
|
|
383
|
+
if (w || x) {
|
|
384
|
+
if (w) {
|
|
385
|
+
if (n || t.ue || i) t.G = u;
|
|
386
|
+
else t.K = u;
|
|
387
|
+
if (t.Z) t.Z.K = u;
|
|
383
388
|
}
|
|
384
389
|
for (let e = t.O; e !== null; e = e.C) {
|
|
385
390
|
const n = e.N.S & o ? S : _;
|
|
386
391
|
if (e.N.o < t.o && n.A > e.N.o) n.A = e.N.o;
|
|
387
392
|
insertIntoHeap(e.N, n);
|
|
388
393
|
}
|
|
389
|
-
} else if (t.o !=
|
|
394
|
+
} else if (t.o != d) {
|
|
390
395
|
for (let e = t.O; e !== null; e = e.C) {
|
|
391
396
|
insertIntoHeapHeight(e.N, e.N.S & o ? S : _);
|
|
392
397
|
}
|
|
393
398
|
}
|
|
394
|
-
if (t
|
|
399
|
+
if ((!n || t.$ & f) && !t.ue && !i && !t.J) O.M.push(t);
|
|
400
|
+
if (t.J && i) runInTransition(t, recompute);
|
|
395
401
|
}
|
|
396
402
|
function updateIfNecessary(r) {
|
|
397
403
|
if (r.S & t) {
|
|
@@ -423,7 +429,7 @@ function unlinkSubs(e) {
|
|
|
423
429
|
t.O = r;
|
|
424
430
|
if (r === null) {
|
|
425
431
|
t.ae?.();
|
|
426
|
-
t.F && unobserved(t);
|
|
432
|
+
t.F && !t.de && unobserved(t);
|
|
427
433
|
}
|
|
428
434
|
}
|
|
429
435
|
return n;
|
|
@@ -435,7 +441,7 @@ function unobserved(e) {
|
|
|
435
441
|
t = unlinkSubs(t);
|
|
436
442
|
}
|
|
437
443
|
e.W = null;
|
|
438
|
-
|
|
444
|
+
disposeChildren(e, true);
|
|
439
445
|
}
|
|
440
446
|
function link(e, t) {
|
|
441
447
|
const n = t.ie;
|
|
@@ -482,7 +488,7 @@ function markDisposal(e) {
|
|
|
482
488
|
insertIntoHeap(t, S);
|
|
483
489
|
}
|
|
484
490
|
markDisposal(t);
|
|
485
|
-
t = t.
|
|
491
|
+
t = t.he;
|
|
486
492
|
}
|
|
487
493
|
}
|
|
488
494
|
function dispose(e) {
|
|
@@ -497,9 +503,9 @@ function dispose(e) {
|
|
|
497
503
|
function disposeChildren(e, t = false, n) {
|
|
498
504
|
if (e.S & u) return;
|
|
499
505
|
if (t) e.S = u;
|
|
500
|
-
let r = n ? e.
|
|
506
|
+
let r = n ? e.ne : e.re;
|
|
501
507
|
while (r) {
|
|
502
|
-
const e = r.
|
|
508
|
+
const e = r.he;
|
|
503
509
|
if (r.W) {
|
|
504
510
|
const e = r;
|
|
505
511
|
deleteFromHeap(e, e.S & o ? S : _);
|
|
@@ -514,15 +520,15 @@ function disposeChildren(e, t = false, n) {
|
|
|
514
520
|
r = e;
|
|
515
521
|
}
|
|
516
522
|
if (n) {
|
|
517
|
-
e.
|
|
523
|
+
e.ne = null;
|
|
518
524
|
} else {
|
|
519
525
|
e.re = null;
|
|
520
|
-
e.
|
|
526
|
+
e.he = null;
|
|
521
527
|
}
|
|
522
528
|
runDisposal(e, n);
|
|
523
529
|
}
|
|
524
530
|
function runDisposal(e, t) {
|
|
525
|
-
let n = t ? e.
|
|
531
|
+
let n = t ? e.ee : e.te;
|
|
526
532
|
if (!n) return;
|
|
527
533
|
if (Array.isArray(n)) {
|
|
528
534
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -532,10 +538,10 @@ function runDisposal(e, t) {
|
|
|
532
538
|
} else {
|
|
533
539
|
n.call(n);
|
|
534
540
|
}
|
|
535
|
-
t ? (e.
|
|
541
|
+
t ? (e.ee = null) : (e.te = null);
|
|
536
542
|
}
|
|
537
543
|
function getNextChildId(e) {
|
|
538
|
-
if (e.id != null) return formatId(e.id, e.
|
|
544
|
+
if (e.id != null) return formatId(e.id, e.pe++);
|
|
539
545
|
throw new Error("Cannot get child id from owner without an id");
|
|
540
546
|
}
|
|
541
547
|
function formatId(e, t) {
|
|
@@ -547,12 +553,12 @@ function computed(t, n, r) {
|
|
|
547
553
|
const i = {
|
|
548
554
|
id: r?.id ?? (E?.id != null ? getNextChildId(E) : undefined),
|
|
549
555
|
oe: r?.equals != null ? r.equals : isEqual,
|
|
550
|
-
|
|
556
|
+
ye: !!r?.pureWrite,
|
|
551
557
|
ae: r?.unobserved,
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
558
|
+
te: null,
|
|
559
|
+
ge: E?.ge ?? O,
|
|
560
|
+
we: E?.we ?? g,
|
|
561
|
+
pe: 0,
|
|
556
562
|
F: t,
|
|
557
563
|
G: n,
|
|
558
564
|
o: 0,
|
|
@@ -564,16 +570,17 @@ function computed(t, n, r) {
|
|
|
564
570
|
O: null,
|
|
565
571
|
ce: null,
|
|
566
572
|
i: E,
|
|
567
|
-
|
|
573
|
+
he: null,
|
|
568
574
|
re: null,
|
|
569
575
|
S: e,
|
|
570
576
|
$: a,
|
|
571
577
|
se: b,
|
|
572
578
|
K: p,
|
|
573
|
-
|
|
574
|
-
|
|
579
|
+
ee: null,
|
|
580
|
+
ne: null,
|
|
581
|
+
J: null
|
|
575
582
|
};
|
|
576
|
-
if (r?.
|
|
583
|
+
if (r?._e) Object.assign(i, r._e);
|
|
577
584
|
i.h = i;
|
|
578
585
|
const s = E?.t ? E.u : E;
|
|
579
586
|
if (E) {
|
|
@@ -581,7 +588,7 @@ function computed(t, n, r) {
|
|
|
581
588
|
if (e === null) {
|
|
582
589
|
E.re = i;
|
|
583
590
|
} else {
|
|
584
|
-
i.
|
|
591
|
+
i.he = e;
|
|
585
592
|
E.re = i;
|
|
586
593
|
}
|
|
587
594
|
}
|
|
@@ -640,7 +647,7 @@ function asyncComputed(e, t, n) {
|
|
|
640
647
|
throw new NotReadyError(E);
|
|
641
648
|
};
|
|
642
649
|
const s = computed(fn, t, n);
|
|
643
|
-
s.
|
|
650
|
+
s.Se = () => {
|
|
644
651
|
i = true;
|
|
645
652
|
recompute(s);
|
|
646
653
|
schedule();
|
|
@@ -652,7 +659,7 @@ function signal(e, t, n = null) {
|
|
|
652
659
|
const r = {
|
|
653
660
|
id: t?.id ?? (E?.id != null ? getNextChildId(E) : undefined),
|
|
654
661
|
oe: t?.equals != null ? t.equals : isEqual,
|
|
655
|
-
|
|
662
|
+
ye: !!t?.pureWrite,
|
|
656
663
|
ae: t?.unobserved,
|
|
657
664
|
G: e,
|
|
658
665
|
O: null,
|
|
@@ -682,6 +689,7 @@ function read(e) {
|
|
|
682
689
|
let t = E;
|
|
683
690
|
if (t?.t) t = t.u;
|
|
684
691
|
if (t && C && !k && !N) {
|
|
692
|
+
if (e.F && e.S & u) recompute(e);
|
|
685
693
|
link(e, t);
|
|
686
694
|
const n = e.I || e;
|
|
687
695
|
if (n.F) {
|
|
@@ -721,9 +729,9 @@ function read(e) {
|
|
|
721
729
|
N = true;
|
|
722
730
|
}
|
|
723
731
|
}
|
|
724
|
-
if (e.$ & f) {
|
|
732
|
+
if (e.$ & f && !k) {
|
|
725
733
|
if ((t && !v) || e.$ & a) throw e.L;
|
|
726
|
-
else if (t && v
|
|
734
|
+
else if (t && v) {
|
|
727
735
|
setStatusFlags(t, t.$ | 1, e.L);
|
|
728
736
|
}
|
|
729
737
|
}
|
|
@@ -766,12 +774,12 @@ function getOwner() {
|
|
|
766
774
|
function onCleanup(e) {
|
|
767
775
|
if (!E) return e;
|
|
768
776
|
const t = E;
|
|
769
|
-
if (!t.
|
|
770
|
-
t.
|
|
771
|
-
} else if (Array.isArray(t.
|
|
772
|
-
t.
|
|
777
|
+
if (!t.te) {
|
|
778
|
+
t.te = e;
|
|
779
|
+
} else if (Array.isArray(t.te)) {
|
|
780
|
+
t.te.push(e);
|
|
773
781
|
} else {
|
|
774
|
-
t.
|
|
782
|
+
t.te = [t.te, e];
|
|
775
783
|
}
|
|
776
784
|
return e;
|
|
777
785
|
}
|
|
@@ -781,14 +789,14 @@ function createOwner(e) {
|
|
|
781
789
|
t: true,
|
|
782
790
|
u: t?.t ? t.u : t,
|
|
783
791
|
re: null,
|
|
784
|
-
|
|
785
|
-
ne: null,
|
|
786
|
-
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
787
|
-
ye: t?.ye ?? O,
|
|
788
|
-
ge: t?.ge || g,
|
|
789
|
-
he: 0,
|
|
792
|
+
he: null,
|
|
790
793
|
te: null,
|
|
794
|
+
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
795
|
+
ge: t?.ge ?? O,
|
|
796
|
+
we: t?.we || g,
|
|
797
|
+
pe: 0,
|
|
791
798
|
ee: null,
|
|
799
|
+
ne: null,
|
|
792
800
|
i: t,
|
|
793
801
|
dispose(e = true) {
|
|
794
802
|
disposeChildren(n, e);
|
|
@@ -799,7 +807,7 @@ function createOwner(e) {
|
|
|
799
807
|
if (e === null) {
|
|
800
808
|
t.re = n;
|
|
801
809
|
} else {
|
|
802
|
-
n.
|
|
810
|
+
n.he = e;
|
|
803
811
|
t.re = n;
|
|
804
812
|
}
|
|
805
813
|
}
|
|
@@ -836,18 +844,17 @@ function pending(e) {
|
|
|
836
844
|
N = t;
|
|
837
845
|
}
|
|
838
846
|
}
|
|
839
|
-
function isPending(e
|
|
840
|
-
const
|
|
847
|
+
function isPending(e) {
|
|
848
|
+
const t = k;
|
|
841
849
|
k = { G: false };
|
|
842
850
|
try {
|
|
843
851
|
staleValues(e);
|
|
844
852
|
return k.G;
|
|
845
853
|
} catch (e) {
|
|
846
854
|
if (!(e instanceof NotReadyError)) return false;
|
|
847
|
-
if (t !== undefined) return t;
|
|
848
855
|
throw e;
|
|
849
856
|
} finally {
|
|
850
|
-
k =
|
|
857
|
+
k = t;
|
|
851
858
|
}
|
|
852
859
|
}
|
|
853
860
|
function createContext(e, t) {
|
|
@@ -857,7 +864,7 @@ function getContext(e, t = getOwner()) {
|
|
|
857
864
|
if (!t) {
|
|
858
865
|
throw new NoOwnerError();
|
|
859
866
|
}
|
|
860
|
-
const n = hasContext(e, t) ? t.
|
|
867
|
+
const n = hasContext(e, t) ? t.we[e.id] : e.defaultValue;
|
|
861
868
|
if (isUndefined(n)) {
|
|
862
869
|
throw new ContextNotFoundError();
|
|
863
870
|
}
|
|
@@ -867,10 +874,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
867
874
|
if (!n) {
|
|
868
875
|
throw new NoOwnerError();
|
|
869
876
|
}
|
|
870
|
-
n.
|
|
877
|
+
n.we = { ...n.we, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
871
878
|
}
|
|
872
879
|
function hasContext(e, t) {
|
|
873
|
-
return !isUndefined(t?.
|
|
880
|
+
return !isUndefined(t?.we[e.id]);
|
|
874
881
|
}
|
|
875
882
|
function isUndefined(e) {
|
|
876
883
|
return typeof e === "undefined";
|
|
@@ -879,37 +886,37 @@ function effect(e, t, n, r, i) {
|
|
|
879
886
|
let s = false;
|
|
880
887
|
const o = computed(e, r, {
|
|
881
888
|
...i,
|
|
882
|
-
|
|
889
|
+
_e: {
|
|
883
890
|
U: true,
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
891
|
+
be: r,
|
|
892
|
+
me: t,
|
|
893
|
+
xe: n,
|
|
894
|
+
Oe: undefined,
|
|
888
895
|
T: i?.render ? d : h,
|
|
889
896
|
le(e, t) {
|
|
890
897
|
if (s) {
|
|
891
898
|
const n = this.$ && this.$ === t && e;
|
|
892
899
|
this.U = !(this.$ & c) && !(this.$ & f & ~t) && !n;
|
|
893
|
-
if (this.U) this.
|
|
900
|
+
if (this.U) this.ge.enqueue(this.T, runEffect.bind(this));
|
|
894
901
|
}
|
|
895
902
|
if (this.$ & c) {
|
|
896
903
|
let e = this.L;
|
|
897
|
-
this.
|
|
904
|
+
this.ge.notify(this, f, 0);
|
|
898
905
|
if (this.T === h) {
|
|
899
906
|
try {
|
|
900
|
-
return this.
|
|
901
|
-
? this.
|
|
902
|
-
this.
|
|
903
|
-
this.
|
|
907
|
+
return this.xe
|
|
908
|
+
? this.xe(e, () => {
|
|
909
|
+
this.Oe?.();
|
|
910
|
+
this.Oe = undefined;
|
|
904
911
|
})
|
|
905
912
|
: console.error(e);
|
|
906
913
|
} catch (t) {
|
|
907
914
|
e = t;
|
|
908
915
|
}
|
|
909
916
|
}
|
|
910
|
-
if (!this.
|
|
917
|
+
if (!this.ge.notify(this, c, c)) throw e;
|
|
911
918
|
} else if (this.T === d) {
|
|
912
|
-
this.
|
|
919
|
+
this.ge.notify(this, f | c, this.$);
|
|
913
920
|
}
|
|
914
921
|
}
|
|
915
922
|
}
|
|
@@ -918,19 +925,19 @@ function effect(e, t, n, r, i) {
|
|
|
918
925
|
if (o.T === d) o.F = t => staleValues(() => e(t));
|
|
919
926
|
!i?.defer &&
|
|
920
927
|
!(o.$ & (c | f)) &&
|
|
921
|
-
(o.T === h ? o.
|
|
922
|
-
onCleanup(() => o.
|
|
928
|
+
(o.T === h ? o.ge.enqueue(o.T, runEffect.bind(o)) : runEffect.call(o));
|
|
929
|
+
onCleanup(() => o.Oe?.());
|
|
923
930
|
}
|
|
924
931
|
function runEffect() {
|
|
925
932
|
if (!this.U || this.S & u) return;
|
|
926
|
-
this.
|
|
927
|
-
this.
|
|
933
|
+
this.Oe?.();
|
|
934
|
+
this.Oe = undefined;
|
|
928
935
|
try {
|
|
929
|
-
this.
|
|
936
|
+
this.Oe = this.me(this.G, this.be);
|
|
930
937
|
} catch (e) {
|
|
931
|
-
if (!this.
|
|
938
|
+
if (!this.ge.notify(this, c, c)) throw e;
|
|
932
939
|
} finally {
|
|
933
|
-
this.
|
|
940
|
+
this.be = this.G;
|
|
934
941
|
this.U = false;
|
|
935
942
|
}
|
|
936
943
|
}
|
|
@@ -951,7 +958,7 @@ function createMemo(e, t, n) {
|
|
|
951
958
|
function createAsync(e, t, n) {
|
|
952
959
|
const r = asyncComputed(e, t, n);
|
|
953
960
|
const i = read.bind(null, r);
|
|
954
|
-
i.refresh = r.
|
|
961
|
+
i.refresh = r.Se;
|
|
955
962
|
return i;
|
|
956
963
|
}
|
|
957
964
|
function createEffect(e, t, n, r) {
|
|
@@ -1611,68 +1618,68 @@ function mapArray(e, t, n) {
|
|
|
1611
1618
|
const r = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
1612
1619
|
return createMemo(
|
|
1613
1620
|
updateKeyedMap.bind({
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
Ee: [],
|
|
1621
|
+
Ce: createOwner(),
|
|
1622
|
+
ve: 0,
|
|
1623
|
+
Ne: e,
|
|
1624
|
+
ke: [],
|
|
1625
|
+
Ee: t,
|
|
1620
1626
|
je: [],
|
|
1621
|
-
Ae:
|
|
1622
|
-
We: r
|
|
1623
|
-
Pe:
|
|
1624
|
-
He:
|
|
1627
|
+
Ae: [],
|
|
1628
|
+
We: r,
|
|
1629
|
+
Pe: r || n?.keyed === false ? [] : undefined,
|
|
1630
|
+
He: t.length > 1 ? [] : undefined,
|
|
1631
|
+
Ie: n?.fallback
|
|
1625
1632
|
})
|
|
1626
1633
|
);
|
|
1627
1634
|
}
|
|
1628
1635
|
const L = { pureWrite: true };
|
|
1629
1636
|
function updateKeyedMap() {
|
|
1630
|
-
const e = this.
|
|
1637
|
+
const e = this.Ne() || [],
|
|
1631
1638
|
t = e.length;
|
|
1632
1639
|
e[j];
|
|
1633
|
-
runWithOwner(this.
|
|
1640
|
+
runWithOwner(this.Ce, () => {
|
|
1634
1641
|
let n,
|
|
1635
1642
|
r,
|
|
1636
|
-
i = this.
|
|
1643
|
+
i = this.Pe
|
|
1637
1644
|
? () => {
|
|
1638
|
-
this.
|
|
1639
|
-
this.
|
|
1640
|
-
return this.
|
|
1641
|
-
read.bind(null, this.
|
|
1642
|
-
this.
|
|
1645
|
+
this.Pe[r] = signal(e[r], L);
|
|
1646
|
+
this.He && (this.He[r] = signal(r, L));
|
|
1647
|
+
return this.Ee(
|
|
1648
|
+
read.bind(null, this.Pe[r]),
|
|
1649
|
+
this.He ? read.bind(null, this.He[r]) : undefined
|
|
1643
1650
|
);
|
|
1644
1651
|
}
|
|
1645
|
-
: this.
|
|
1652
|
+
: this.He
|
|
1646
1653
|
? () => {
|
|
1647
1654
|
const t = e[r];
|
|
1648
|
-
this.
|
|
1649
|
-
return this.
|
|
1655
|
+
this.He[r] = signal(r, L);
|
|
1656
|
+
return this.Ee(() => t, read.bind(null, this.He[r]));
|
|
1650
1657
|
}
|
|
1651
1658
|
: () => {
|
|
1652
1659
|
const t = e[r];
|
|
1653
|
-
return this.
|
|
1660
|
+
return this.Ee(() => t);
|
|
1654
1661
|
};
|
|
1655
1662
|
if (t === 0) {
|
|
1656
|
-
if (this.
|
|
1657
|
-
this.
|
|
1663
|
+
if (this.ve !== 0) {
|
|
1664
|
+
this.Ce.dispose(false);
|
|
1665
|
+
this.Ae = [];
|
|
1666
|
+
this.ke = [];
|
|
1658
1667
|
this.je = [];
|
|
1659
|
-
this.
|
|
1660
|
-
this.Ee = [];
|
|
1661
|
-
this.Ce = 0;
|
|
1662
|
-
this.We && (this.We = []);
|
|
1668
|
+
this.ve = 0;
|
|
1663
1669
|
this.Pe && (this.Pe = []);
|
|
1670
|
+
this.He && (this.He = []);
|
|
1664
1671
|
}
|
|
1665
|
-
if (this.
|
|
1666
|
-
this.
|
|
1672
|
+
if (this.Ie && !this.je[0]) {
|
|
1673
|
+
this.je[0] = runWithOwner((this.Ae[0] = createOwner()), this.Ie);
|
|
1667
1674
|
}
|
|
1668
|
-
} else if (this.
|
|
1669
|
-
if (this.
|
|
1670
|
-
this.
|
|
1675
|
+
} else if (this.ve === 0) {
|
|
1676
|
+
if (this.Ae[0]) this.Ae[0].dispose();
|
|
1677
|
+
this.je = new Array(t);
|
|
1671
1678
|
for (r = 0; r < t; r++) {
|
|
1672
|
-
this.
|
|
1673
|
-
this.
|
|
1679
|
+
this.ke[r] = e[r];
|
|
1680
|
+
this.je[r] = runWithOwner((this.Ae[r] = createOwner()), i);
|
|
1674
1681
|
}
|
|
1675
|
-
this.
|
|
1682
|
+
this.ve = t;
|
|
1676
1683
|
} else {
|
|
1677
1684
|
let s,
|
|
1678
1685
|
o,
|
|
@@ -1683,174 +1690,175 @@ function updateKeyedMap() {
|
|
|
1683
1690
|
a,
|
|
1684
1691
|
d = new Array(t),
|
|
1685
1692
|
h = new Array(t),
|
|
1686
|
-
p = this.
|
|
1687
|
-
y = this.
|
|
1693
|
+
p = this.Pe ? new Array(t) : undefined,
|
|
1694
|
+
y = this.He ? new Array(t) : undefined;
|
|
1688
1695
|
for (
|
|
1689
|
-
s = 0, o = Math.min(this.
|
|
1690
|
-
s < o && (this.
|
|
1696
|
+
s = 0, o = Math.min(this.ve, t);
|
|
1697
|
+
s < o && (this.ke[s] === e[s] || (this.Pe && compare(this.We, this.ke[s], e[s])));
|
|
1691
1698
|
s++
|
|
1692
1699
|
) {
|
|
1693
|
-
if (this.
|
|
1700
|
+
if (this.Pe) setSignal(this.Pe[s], e[s]);
|
|
1694
1701
|
}
|
|
1695
1702
|
for (
|
|
1696
|
-
o = this.
|
|
1703
|
+
o = this.ve - 1, u = t - 1;
|
|
1697
1704
|
o >= s &&
|
|
1698
1705
|
u >= s &&
|
|
1699
|
-
(this.
|
|
1706
|
+
(this.ke[o] === e[u] || (this.Pe && compare(this.We, this.ke[o], e[u])));
|
|
1700
1707
|
o--, u--
|
|
1701
1708
|
) {
|
|
1702
|
-
d[u] = this.
|
|
1703
|
-
h[u] = this.
|
|
1704
|
-
p && (p[u] = this.
|
|
1705
|
-
y && (y[u] = this.
|
|
1709
|
+
d[u] = this.je[o];
|
|
1710
|
+
h[u] = this.Ae[o];
|
|
1711
|
+
p && (p[u] = this.Pe[o]);
|
|
1712
|
+
y && (y[u] = this.He[o]);
|
|
1706
1713
|
}
|
|
1707
1714
|
c = new Map();
|
|
1708
1715
|
a = new Array(u + 1);
|
|
1709
1716
|
for (r = u; r >= s; r--) {
|
|
1710
1717
|
l = e[r];
|
|
1711
|
-
f = this.
|
|
1718
|
+
f = this.We ? this.We(l) : l;
|
|
1712
1719
|
n = c.get(f);
|
|
1713
1720
|
a[r] = n === undefined ? -1 : n;
|
|
1714
1721
|
c.set(f, r);
|
|
1715
1722
|
}
|
|
1716
1723
|
for (n = s; n <= o; n++) {
|
|
1717
|
-
l = this.
|
|
1718
|
-
f = this.
|
|
1724
|
+
l = this.ke[n];
|
|
1725
|
+
f = this.We ? this.We(l) : l;
|
|
1719
1726
|
r = c.get(f);
|
|
1720
1727
|
if (r !== undefined && r !== -1) {
|
|
1721
|
-
d[r] = this.
|
|
1722
|
-
h[r] = this.
|
|
1723
|
-
p && (p[r] = this.
|
|
1724
|
-
y && (y[r] = this.
|
|
1728
|
+
d[r] = this.je[n];
|
|
1729
|
+
h[r] = this.Ae[n];
|
|
1730
|
+
p && (p[r] = this.Pe[n]);
|
|
1731
|
+
y && (y[r] = this.He[n]);
|
|
1725
1732
|
r = a[r];
|
|
1726
1733
|
c.set(f, r);
|
|
1727
|
-
} else this.
|
|
1734
|
+
} else this.Ae[n].dispose();
|
|
1728
1735
|
}
|
|
1729
1736
|
for (r = s; r < t; r++) {
|
|
1730
1737
|
if (r in d) {
|
|
1731
|
-
this.
|
|
1732
|
-
this.
|
|
1738
|
+
this.je[r] = d[r];
|
|
1739
|
+
this.Ae[r] = h[r];
|
|
1733
1740
|
if (p) {
|
|
1734
|
-
this.
|
|
1735
|
-
setSignal(this.
|
|
1741
|
+
this.Pe[r] = p[r];
|
|
1742
|
+
setSignal(this.Pe[r], e[r]);
|
|
1736
1743
|
}
|
|
1737
1744
|
if (y) {
|
|
1738
|
-
this.
|
|
1739
|
-
setSignal(this.
|
|
1745
|
+
this.He[r] = y[r];
|
|
1746
|
+
setSignal(this.He[r], r);
|
|
1740
1747
|
}
|
|
1741
1748
|
} else {
|
|
1742
|
-
this.
|
|
1749
|
+
this.je[r] = runWithOwner((this.Ae[r] = createOwner()), i);
|
|
1743
1750
|
}
|
|
1744
1751
|
}
|
|
1745
|
-
this.
|
|
1746
|
-
this.
|
|
1752
|
+
this.je = this.je.slice(0, (this.ve = t));
|
|
1753
|
+
this.ke = e.slice(0);
|
|
1747
1754
|
}
|
|
1748
1755
|
});
|
|
1749
|
-
return this.
|
|
1756
|
+
return this.je;
|
|
1750
1757
|
}
|
|
1751
1758
|
function repeat(e, t, n) {
|
|
1752
1759
|
return updateRepeat.bind({
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1760
|
+
Ce: createOwner(),
|
|
1761
|
+
ve: 0,
|
|
1762
|
+
Fe: 0,
|
|
1763
|
+
Qe: e,
|
|
1764
|
+
Ee: t,
|
|
1765
|
+
Ae: [],
|
|
1758
1766
|
je: [],
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
He: n?.fallback
|
|
1767
|
+
Re: n?.from,
|
|
1768
|
+
Ie: n?.fallback
|
|
1762
1769
|
});
|
|
1763
1770
|
}
|
|
1764
1771
|
function updateRepeat() {
|
|
1765
|
-
const e = this.
|
|
1766
|
-
const t = this.
|
|
1767
|
-
runWithOwner(this.
|
|
1772
|
+
const e = this.Qe();
|
|
1773
|
+
const t = this.Re?.() || 0;
|
|
1774
|
+
runWithOwner(this.Ce, () => {
|
|
1768
1775
|
if (e === 0) {
|
|
1769
|
-
if (this.
|
|
1770
|
-
this.
|
|
1776
|
+
if (this.ve !== 0) {
|
|
1777
|
+
this.Ce.dispose(false);
|
|
1778
|
+
this.Ae = [];
|
|
1771
1779
|
this.je = [];
|
|
1772
|
-
this.
|
|
1773
|
-
this.Ce = 0;
|
|
1780
|
+
this.ve = 0;
|
|
1774
1781
|
}
|
|
1775
|
-
if (this.
|
|
1776
|
-
this.
|
|
1782
|
+
if (this.Ie && !this.je[0]) {
|
|
1783
|
+
this.je[0] = runWithOwner((this.Ae[0] = createOwner()), this.Ie);
|
|
1777
1784
|
}
|
|
1778
1785
|
return;
|
|
1779
1786
|
}
|
|
1780
1787
|
const n = t + e;
|
|
1781
|
-
const r = this.
|
|
1782
|
-
if (this.
|
|
1783
|
-
for (let e = n; e < r; e++) this.
|
|
1784
|
-
if (this.
|
|
1785
|
-
let e = this.
|
|
1786
|
-
while (e < t && e < this.
|
|
1787
|
-
this.
|
|
1788
|
-
this.
|
|
1789
|
-
} else if (this.
|
|
1790
|
-
let n = r - this.
|
|
1791
|
-
let i = this.
|
|
1792
|
-
this.
|
|
1788
|
+
const r = this.Fe + this.ve;
|
|
1789
|
+
if (this.ve === 0 && this.Ae[0]) this.Ae[0].dispose();
|
|
1790
|
+
for (let e = n; e < r; e++) this.Ae[e - this.Fe].dispose();
|
|
1791
|
+
if (this.Fe < t) {
|
|
1792
|
+
let e = this.Fe;
|
|
1793
|
+
while (e < t && e < this.ve) this.Ae[e++].dispose();
|
|
1794
|
+
this.Ae.splice(0, t - this.Fe);
|
|
1795
|
+
this.je.splice(0, t - this.Fe);
|
|
1796
|
+
} else if (this.Fe > t) {
|
|
1797
|
+
let n = r - this.Fe - 1;
|
|
1798
|
+
let i = this.Fe - t;
|
|
1799
|
+
this.Ae.length = this.je.length = e;
|
|
1793
1800
|
while (n >= i) {
|
|
1801
|
+
this.Ae[n] = this.Ae[n - i];
|
|
1794
1802
|
this.je[n] = this.je[n - i];
|
|
1795
|
-
this.Ee[n] = this.Ee[n - i];
|
|
1796
1803
|
n--;
|
|
1797
1804
|
}
|
|
1798
1805
|
for (let e = 0; e < i; e++) {
|
|
1799
|
-
this.
|
|
1806
|
+
this.je[e] = runWithOwner((this.Ae[e] = createOwner()), () => this.Ee(e + t));
|
|
1800
1807
|
}
|
|
1801
1808
|
}
|
|
1802
1809
|
for (let e = r; e < n; e++) {
|
|
1803
|
-
this.
|
|
1810
|
+
this.je[e - t] = runWithOwner((this.Ae[e - t] = createOwner()), () => this.Ee(e));
|
|
1804
1811
|
}
|
|
1805
|
-
this.
|
|
1806
|
-
this.
|
|
1807
|
-
this.
|
|
1812
|
+
this.je = this.je.slice(0, e);
|
|
1813
|
+
this.Fe = t;
|
|
1814
|
+
this.ve = e;
|
|
1808
1815
|
});
|
|
1809
|
-
return this.
|
|
1816
|
+
return this.je;
|
|
1810
1817
|
}
|
|
1811
1818
|
function compare(e, t, n) {
|
|
1812
1819
|
return e ? e(t) === e(n) : true;
|
|
1813
1820
|
}
|
|
1814
1821
|
function boundaryComputed(e, t) {
|
|
1815
1822
|
const n = computed(e, undefined, {
|
|
1816
|
-
|
|
1823
|
+
_e: {
|
|
1817
1824
|
le() {
|
|
1818
1825
|
let e = this.$;
|
|
1819
|
-
this.$ &= ~this.
|
|
1820
|
-
if (this.
|
|
1826
|
+
this.$ &= ~this.Ve;
|
|
1827
|
+
if (this.Ve & f && !(this.$ & a)) {
|
|
1821
1828
|
e &= ~f;
|
|
1822
1829
|
}
|
|
1823
|
-
this.
|
|
1830
|
+
this.ge.notify(this, this.Ve, e);
|
|
1824
1831
|
},
|
|
1825
|
-
|
|
1832
|
+
Ve: t
|
|
1826
1833
|
}
|
|
1827
1834
|
});
|
|
1828
|
-
n.
|
|
1835
|
+
n.Ve = t;
|
|
1836
|
+
n.de = true;
|
|
1829
1837
|
return n;
|
|
1830
1838
|
}
|
|
1831
1839
|
function createBoundChildren(e, t, n, r) {
|
|
1832
|
-
const i = e.
|
|
1833
|
-
i.addChild((e.
|
|
1834
|
-
onCleanup(() => i.removeChild(e.
|
|
1840
|
+
const i = e.ge;
|
|
1841
|
+
i.addChild((e.ge = n));
|
|
1842
|
+
onCleanup(() => i.removeChild(e.ge));
|
|
1835
1843
|
return runWithOwner(e, () => {
|
|
1836
1844
|
const e = computed(t);
|
|
1837
1845
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), r);
|
|
1838
1846
|
});
|
|
1839
1847
|
}
|
|
1840
1848
|
class ConditionalQueue extends Queue {
|
|
1841
|
-
|
|
1842
|
-
|
|
1849
|
+
qe;
|
|
1850
|
+
Me = new Set();
|
|
1843
1851
|
M = new Set();
|
|
1844
1852
|
constructor(e) {
|
|
1845
1853
|
super();
|
|
1846
|
-
this.
|
|
1854
|
+
this.qe = e;
|
|
1847
1855
|
}
|
|
1848
1856
|
run(e) {
|
|
1849
|
-
if (!e || read(this.
|
|
1857
|
+
if (!e || read(this.qe)) return;
|
|
1850
1858
|
return super.run(e);
|
|
1851
1859
|
}
|
|
1852
1860
|
notify(e, t, n) {
|
|
1853
|
-
if (read(this.
|
|
1861
|
+
if (read(this.qe)) {
|
|
1854
1862
|
if (t & f) {
|
|
1855
1863
|
if (n & f) {
|
|
1856
1864
|
this.M.add(e);
|
|
@@ -1859,37 +1867,37 @@ class ConditionalQueue extends Queue {
|
|
|
1859
1867
|
}
|
|
1860
1868
|
if (t & c) {
|
|
1861
1869
|
if (n & c) {
|
|
1862
|
-
this.
|
|
1870
|
+
this.Me.add(e);
|
|
1863
1871
|
t &= ~c;
|
|
1864
|
-
} else if (this.
|
|
1872
|
+
} else if (this.Me.delete(e)) t &= ~c;
|
|
1865
1873
|
}
|
|
1866
1874
|
}
|
|
1867
1875
|
return t ? super.notify(e, t, n) : true;
|
|
1868
1876
|
}
|
|
1869
1877
|
}
|
|
1870
1878
|
class CollectionQueue extends Queue {
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1879
|
+
De;
|
|
1880
|
+
Ae = new Set();
|
|
1881
|
+
qe = signal(false, { pureWrite: true });
|
|
1882
|
+
Be = false;
|
|
1875
1883
|
constructor(e) {
|
|
1876
1884
|
super();
|
|
1877
|
-
this.
|
|
1885
|
+
this.De = e;
|
|
1878
1886
|
}
|
|
1879
1887
|
run(e) {
|
|
1880
|
-
if (!e || read(this.
|
|
1888
|
+
if (!e || read(this.qe)) return;
|
|
1881
1889
|
return super.run(e);
|
|
1882
1890
|
}
|
|
1883
1891
|
notify(e, t, n) {
|
|
1884
|
-
if (!(t & this.
|
|
1885
|
-
if (n & this.
|
|
1886
|
-
this.
|
|
1887
|
-
if (this.
|
|
1888
|
-
} else if (this.
|
|
1889
|
-
this.
|
|
1890
|
-
if (this.
|
|
1891
|
-
}
|
|
1892
|
-
t &= ~this.
|
|
1892
|
+
if (!(t & this.De) || (this.De & f && this.Be)) return super.notify(e, t, n);
|
|
1893
|
+
if (n & this.De) {
|
|
1894
|
+
this.Ae.add(e);
|
|
1895
|
+
if (this.Ae.size === 1) setSignal(this.qe, true);
|
|
1896
|
+
} else if (this.Ae.size > 0) {
|
|
1897
|
+
this.Ae.delete(e);
|
|
1898
|
+
if (this.Ae.size === 0) setSignal(this.qe, false);
|
|
1899
|
+
}
|
|
1900
|
+
t &= ~this.De;
|
|
1893
1901
|
return t ? super.notify(e, t, n) : true;
|
|
1894
1902
|
}
|
|
1895
1903
|
}
|
|
@@ -1903,25 +1911,25 @@ function createBoundary(e, t) {
|
|
|
1903
1911
|
const r = new ConditionalQueue(computed(() => t() === z.HIDDEN));
|
|
1904
1912
|
const i = createBoundChildren(n, e, r, 0);
|
|
1905
1913
|
computed(() => {
|
|
1906
|
-
const e = read(r.
|
|
1907
|
-
i.
|
|
1914
|
+
const e = read(r.qe);
|
|
1915
|
+
i.Ve = e ? c | f : 0;
|
|
1908
1916
|
if (!e) {
|
|
1909
1917
|
r.M.forEach(e => r.notify(e, f, f));
|
|
1910
|
-
r.
|
|
1918
|
+
r.Me.forEach(e => r.notify(e, c, c));
|
|
1911
1919
|
r.M.clear();
|
|
1912
|
-
r.
|
|
1920
|
+
r.Me.clear();
|
|
1913
1921
|
}
|
|
1914
1922
|
});
|
|
1915
|
-
return () => (read(r.
|
|
1923
|
+
return () => (read(r.qe) ? undefined : read(i));
|
|
1916
1924
|
}
|
|
1917
1925
|
function createCollectionBoundary(e, t, n) {
|
|
1918
1926
|
const r = createOwner();
|
|
1919
1927
|
const i = new CollectionQueue(e);
|
|
1920
1928
|
const s = createBoundChildren(r, t, i, e);
|
|
1921
1929
|
const o = computed(() => {
|
|
1922
|
-
if (!read(i.
|
|
1930
|
+
if (!read(i.qe)) {
|
|
1923
1931
|
const e = read(s);
|
|
1924
|
-
if (!untrack(() => read(i.
|
|
1932
|
+
if (!untrack(() => read(i.qe))) i.Be = true;
|
|
1925
1933
|
return e;
|
|
1926
1934
|
}
|
|
1927
1935
|
return n(i);
|
|
@@ -1946,10 +1954,10 @@ function collectErrorSources(e, t) {
|
|
|
1946
1954
|
}
|
|
1947
1955
|
function createErrorBoundary(e, t) {
|
|
1948
1956
|
return createCollectionBoundary(c, e, e => {
|
|
1949
|
-
let n = e.
|
|
1957
|
+
let n = e.Ae.values().next().value;
|
|
1950
1958
|
return t(n.L, () => {
|
|
1951
1959
|
const t = [];
|
|
1952
|
-
for (const n of e.
|
|
1960
|
+
for (const n of e.Ae) collectErrorSources(n, t);
|
|
1953
1961
|
for (const e of t) recompute(e);
|
|
1954
1962
|
schedule();
|
|
1955
1963
|
});
|