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