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