@solidjs/signals 0.8.6 → 0.9.0
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 +79 -79
- package/dist/node.cjs +322 -319
- package/dist/prod.js +145 -142
- package/dist/types/core/core.d.ts +6 -8
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/signals.d.ts +1 -19
- package/dist/types/store/projection.d.ts +2 -2
- package/dist/types/store/store.d.ts +1 -1
- package/package.json +1 -1
package/dist/node.cjs
CHANGED
|
@@ -319,7 +319,8 @@ let C = false;
|
|
|
319
319
|
let v = false;
|
|
320
320
|
let N = false;
|
|
321
321
|
let k = null;
|
|
322
|
-
let
|
|
322
|
+
let j = false;
|
|
323
|
+
let A = null;
|
|
323
324
|
function notifySubs(e) {
|
|
324
325
|
for (let t = e.O; t !== null; t = t.C) {
|
|
325
326
|
const e = t.N.S & o ? S : _;
|
|
@@ -341,8 +342,8 @@ function recompute(t, n = false) {
|
|
|
341
342
|
t.re = null;
|
|
342
343
|
}
|
|
343
344
|
}
|
|
344
|
-
const s =
|
|
345
|
-
|
|
345
|
+
const s = A;
|
|
346
|
+
A = t;
|
|
346
347
|
t.ie = null;
|
|
347
348
|
t.S = r;
|
|
348
349
|
t.se = b;
|
|
@@ -354,7 +355,7 @@ function recompute(t, n = false) {
|
|
|
354
355
|
setStatusFlags(t, l | (h & a));
|
|
355
356
|
C = true;
|
|
356
357
|
try {
|
|
357
|
-
u = t.F(u);
|
|
358
|
+
u = handleAsync(t, t.F(u));
|
|
358
359
|
t.$ &= ~a;
|
|
359
360
|
} catch (e) {
|
|
360
361
|
if (e instanceof NotReadyError) {
|
|
@@ -365,7 +366,7 @@ function recompute(t, n = false) {
|
|
|
365
366
|
C = g;
|
|
366
367
|
}
|
|
367
368
|
t.S = e;
|
|
368
|
-
|
|
369
|
+
A = s;
|
|
369
370
|
if (!(t.$ & f)) {
|
|
370
371
|
const e = t.ie;
|
|
371
372
|
let n = e !== null ? e.P : t.W;
|
|
@@ -396,9 +397,56 @@ function recompute(t, n = false) {
|
|
|
396
397
|
insertIntoHeapHeight(e.N, e.N.S & o ? S : _);
|
|
397
398
|
}
|
|
398
399
|
}
|
|
399
|
-
if ((!n || t.$ & f) && !t.ue && !
|
|
400
|
+
if ((!n || t.$ & f) && !t.ue && !t.J) O.M.push(t);
|
|
400
401
|
if (t.J && i) runInTransition(t, recompute);
|
|
401
402
|
}
|
|
403
|
+
function handleAsync(e, t, n) {
|
|
404
|
+
const r = typeof t === "object" && t !== null;
|
|
405
|
+
const i = r && t instanceof Promise;
|
|
406
|
+
const s = r && untrack(() => t[Symbol.asyncIterator]);
|
|
407
|
+
if (!i && !s) {
|
|
408
|
+
e.fe = null;
|
|
409
|
+
return t;
|
|
410
|
+
}
|
|
411
|
+
e.fe = t;
|
|
412
|
+
if (i) {
|
|
413
|
+
t.then(r => {
|
|
414
|
+
if (e.fe !== t) return;
|
|
415
|
+
O.initTransition(e);
|
|
416
|
+
n?.(r) ?? setSignal(e, () => r);
|
|
417
|
+
flush();
|
|
418
|
+
}).catch(n => {
|
|
419
|
+
if (e.fe !== t) return;
|
|
420
|
+
O.initTransition(e);
|
|
421
|
+
setStatusFlags(e, c, n);
|
|
422
|
+
e.se = b;
|
|
423
|
+
notifySubs(e);
|
|
424
|
+
schedule();
|
|
425
|
+
flush();
|
|
426
|
+
});
|
|
427
|
+
} else {
|
|
428
|
+
(async () => {
|
|
429
|
+
try {
|
|
430
|
+
for await (let r of t) {
|
|
431
|
+
if (e.fe !== t) return;
|
|
432
|
+
O.initTransition(e);
|
|
433
|
+
n?.(r) ?? setSignal(e, () => r);
|
|
434
|
+
flush();
|
|
435
|
+
}
|
|
436
|
+
} catch (n) {
|
|
437
|
+
if (e.fe !== t) return;
|
|
438
|
+
O.initTransition(e);
|
|
439
|
+
setStatusFlags(e, c, n);
|
|
440
|
+
e.se = b;
|
|
441
|
+
notifySubs(e);
|
|
442
|
+
schedule();
|
|
443
|
+
flush();
|
|
444
|
+
}
|
|
445
|
+
})();
|
|
446
|
+
}
|
|
447
|
+
O.initTransition(e);
|
|
448
|
+
throw new NotReadyError(A);
|
|
449
|
+
}
|
|
402
450
|
function updateIfNecessary(r) {
|
|
403
451
|
if (r.S & t) {
|
|
404
452
|
for (let e = r.W; e; e = e.P) {
|
|
@@ -421,15 +469,15 @@ function unlinkSubs(e) {
|
|
|
421
469
|
const t = e.H;
|
|
422
470
|
const n = e.P;
|
|
423
471
|
const r = e.C;
|
|
424
|
-
const i = e.
|
|
425
|
-
if (r !== null) r.
|
|
426
|
-
else t.
|
|
472
|
+
const i = e.ce;
|
|
473
|
+
if (r !== null) r.ce = i;
|
|
474
|
+
else t.ae = i;
|
|
427
475
|
if (i !== null) i.C = r;
|
|
428
476
|
else {
|
|
429
477
|
t.O = r;
|
|
430
478
|
if (r === null) {
|
|
431
|
-
t.
|
|
432
|
-
t.F && !t.
|
|
479
|
+
t.de?.();
|
|
480
|
+
t.F && !t.he && unobserved(t);
|
|
433
481
|
}
|
|
434
482
|
}
|
|
435
483
|
return n;
|
|
@@ -455,9 +503,9 @@ function link(e, t) {
|
|
|
455
503
|
return;
|
|
456
504
|
}
|
|
457
505
|
}
|
|
458
|
-
const o = e.
|
|
506
|
+
const o = e.ae;
|
|
459
507
|
if (o !== null && o.N === t && (!s || isValidLink(o, t))) return;
|
|
460
|
-
const u = (t.ie = e.
|
|
508
|
+
const u = (t.ie = e.ae = { H: e, N: t, P: i, ce: o, C: null });
|
|
461
509
|
if (n !== null) n.P = u;
|
|
462
510
|
else t.W = u;
|
|
463
511
|
if (o !== null) o.C = u;
|
|
@@ -488,7 +536,7 @@ function markDisposal(e) {
|
|
|
488
536
|
insertIntoHeap(t, S);
|
|
489
537
|
}
|
|
490
538
|
markDisposal(t);
|
|
491
|
-
t = t.
|
|
539
|
+
t = t.pe;
|
|
492
540
|
}
|
|
493
541
|
}
|
|
494
542
|
function dispose(e) {
|
|
@@ -505,7 +553,7 @@ function disposeChildren(e, t = false, n) {
|
|
|
505
553
|
if (t) e.S = u;
|
|
506
554
|
let r = n ? e.ne : e.re;
|
|
507
555
|
while (r) {
|
|
508
|
-
const e = r.
|
|
556
|
+
const e = r.pe;
|
|
509
557
|
if (r.W) {
|
|
510
558
|
const e = r;
|
|
511
559
|
deleteFromHeap(e, e.S & o ? S : _);
|
|
@@ -523,7 +571,7 @@ function disposeChildren(e, t = false, n) {
|
|
|
523
571
|
e.ne = null;
|
|
524
572
|
} else {
|
|
525
573
|
e.re = null;
|
|
526
|
-
e.
|
|
574
|
+
e.pe = null;
|
|
527
575
|
}
|
|
528
576
|
runDisposal(e, n);
|
|
529
577
|
}
|
|
@@ -541,7 +589,7 @@ function runDisposal(e, t) {
|
|
|
541
589
|
t ? (e.ee = null) : (e.te = null);
|
|
542
590
|
}
|
|
543
591
|
function getNextChildId(e) {
|
|
544
|
-
if (e.id != null) return formatId(e.id, e.
|
|
592
|
+
if (e.id != null) return formatId(e.id, e.ye++);
|
|
545
593
|
throw new Error("Cannot get child id from owner without an id");
|
|
546
594
|
}
|
|
547
595
|
function formatId(e, t) {
|
|
@@ -551,14 +599,14 @@ function formatId(e, t) {
|
|
|
551
599
|
}
|
|
552
600
|
function computed(t, n, r) {
|
|
553
601
|
const i = {
|
|
554
|
-
id: r?.id ?? (
|
|
602
|
+
id: r?.id ?? (A?.id != null ? getNextChildId(A) : undefined),
|
|
555
603
|
oe: r?.equals != null ? r.equals : isEqual,
|
|
556
|
-
|
|
557
|
-
|
|
604
|
+
ge: !!r?.pureWrite,
|
|
605
|
+
de: r?.unobserved,
|
|
558
606
|
te: null,
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
607
|
+
we: A?.we ?? O,
|
|
608
|
+
_e: A?._e ?? g,
|
|
609
|
+
ye: 0,
|
|
562
610
|
F: t,
|
|
563
611
|
G: n,
|
|
564
612
|
o: 0,
|
|
@@ -568,9 +616,9 @@ function computed(t, n, r) {
|
|
|
568
616
|
W: null,
|
|
569
617
|
ie: null,
|
|
570
618
|
O: null,
|
|
571
|
-
|
|
572
|
-
i:
|
|
573
|
-
|
|
619
|
+
ae: null,
|
|
620
|
+
i: A,
|
|
621
|
+
pe: null,
|
|
574
622
|
re: null,
|
|
575
623
|
S: e,
|
|
576
624
|
$: a,
|
|
@@ -578,92 +626,34 @@ function computed(t, n, r) {
|
|
|
578
626
|
K: p,
|
|
579
627
|
ee: null,
|
|
580
628
|
ne: null,
|
|
629
|
+
fe: null,
|
|
581
630
|
J: null
|
|
582
631
|
};
|
|
583
|
-
if (r?.
|
|
632
|
+
if (r?.Se) Object.assign(i, r.Se);
|
|
584
633
|
i.h = i;
|
|
585
|
-
const s =
|
|
586
|
-
if (
|
|
587
|
-
const e =
|
|
634
|
+
const s = A?.t ? A.u : A;
|
|
635
|
+
if (A) {
|
|
636
|
+
const e = A.re;
|
|
588
637
|
if (e === null) {
|
|
589
|
-
|
|
638
|
+
A.re = i;
|
|
590
639
|
} else {
|
|
591
|
-
i.
|
|
592
|
-
|
|
640
|
+
i.pe = e;
|
|
641
|
+
A.re = i;
|
|
593
642
|
}
|
|
594
643
|
}
|
|
595
644
|
if (s) i.o = s.o + 1;
|
|
596
645
|
recompute(i, true);
|
|
597
646
|
return i;
|
|
598
647
|
}
|
|
599
|
-
function asyncComputed(e, t, n) {
|
|
600
|
-
let r = undefined;
|
|
601
|
-
let i = false;
|
|
602
|
-
const fn = t => {
|
|
603
|
-
const n = e(t, i);
|
|
604
|
-
i = false;
|
|
605
|
-
r = n;
|
|
606
|
-
const o = n instanceof Promise;
|
|
607
|
-
const u = n[Symbol.asyncIterator];
|
|
608
|
-
if (!o && !u) {
|
|
609
|
-
return n;
|
|
610
|
-
}
|
|
611
|
-
if (o) {
|
|
612
|
-
n.then(e => {
|
|
613
|
-
if (r !== n) return;
|
|
614
|
-
O.initTransition(s);
|
|
615
|
-
setSignal(s, () => e);
|
|
616
|
-
flush();
|
|
617
|
-
}).catch(e => {
|
|
618
|
-
if (r !== n) return;
|
|
619
|
-
O.initTransition(s);
|
|
620
|
-
setStatusFlags(s, c, e);
|
|
621
|
-
s.se = b;
|
|
622
|
-
notifySubs(s);
|
|
623
|
-
schedule();
|
|
624
|
-
flush();
|
|
625
|
-
});
|
|
626
|
-
} else {
|
|
627
|
-
(async () => {
|
|
628
|
-
try {
|
|
629
|
-
for await (let e of n) {
|
|
630
|
-
if (r !== n) return;
|
|
631
|
-
O.initTransition(s);
|
|
632
|
-
setSignal(s, () => e);
|
|
633
|
-
flush();
|
|
634
|
-
}
|
|
635
|
-
} catch (e) {
|
|
636
|
-
if (r !== n) return;
|
|
637
|
-
O.initTransition(s);
|
|
638
|
-
setStatusFlags(s, c, e);
|
|
639
|
-
s.se = b;
|
|
640
|
-
notifySubs(s);
|
|
641
|
-
schedule();
|
|
642
|
-
flush();
|
|
643
|
-
}
|
|
644
|
-
})();
|
|
645
|
-
}
|
|
646
|
-
O.initTransition(E);
|
|
647
|
-
throw new NotReadyError(E);
|
|
648
|
-
};
|
|
649
|
-
const s = computed(fn, t, n);
|
|
650
|
-
s.Se = () => {
|
|
651
|
-
i = true;
|
|
652
|
-
recompute(s);
|
|
653
|
-
schedule();
|
|
654
|
-
flush();
|
|
655
|
-
};
|
|
656
|
-
return s;
|
|
657
|
-
}
|
|
658
648
|
function signal(e, t, n = null) {
|
|
659
649
|
const r = {
|
|
660
|
-
id: t?.id ?? (
|
|
650
|
+
id: t?.id ?? (A?.id != null ? getNextChildId(A) : undefined),
|
|
661
651
|
oe: t?.equals != null ? t.equals : isEqual,
|
|
662
|
-
|
|
663
|
-
|
|
652
|
+
ge: !!t?.pureWrite,
|
|
653
|
+
de: t?.unobserved,
|
|
664
654
|
G: e,
|
|
665
655
|
O: null,
|
|
666
|
-
|
|
656
|
+
ae: null,
|
|
667
657
|
$: l,
|
|
668
658
|
se: b,
|
|
669
659
|
I: n,
|
|
@@ -686,8 +676,9 @@ function untrack(e) {
|
|
|
686
676
|
}
|
|
687
677
|
}
|
|
688
678
|
function read(e) {
|
|
689
|
-
let t =
|
|
679
|
+
let t = A;
|
|
690
680
|
if (t?.t) t = t.u;
|
|
681
|
+
if (j && e.F) recompute(e);
|
|
691
682
|
if (t && C && !k && !N) {
|
|
692
683
|
if (e.F && e.S & u) recompute(e);
|
|
693
684
|
link(e, t);
|
|
@@ -766,14 +757,14 @@ function setSignal(e, t) {
|
|
|
766
757
|
return t;
|
|
767
758
|
}
|
|
768
759
|
function getObserver() {
|
|
769
|
-
return C ?
|
|
760
|
+
return C ? A : null;
|
|
770
761
|
}
|
|
771
762
|
function getOwner() {
|
|
772
|
-
return
|
|
763
|
+
return A;
|
|
773
764
|
}
|
|
774
765
|
function onCleanup(e) {
|
|
775
|
-
if (!
|
|
776
|
-
const t =
|
|
766
|
+
if (!A) return e;
|
|
767
|
+
const t = A;
|
|
777
768
|
if (!t.te) {
|
|
778
769
|
t.te = e;
|
|
779
770
|
} else if (Array.isArray(t.te)) {
|
|
@@ -784,17 +775,17 @@ function onCleanup(e) {
|
|
|
784
775
|
return e;
|
|
785
776
|
}
|
|
786
777
|
function createOwner(e) {
|
|
787
|
-
const t =
|
|
778
|
+
const t = A;
|
|
788
779
|
const n = {
|
|
789
780
|
t: true,
|
|
790
781
|
u: t?.t ? t.u : t,
|
|
791
782
|
re: null,
|
|
792
|
-
|
|
783
|
+
pe: null,
|
|
793
784
|
te: null,
|
|
794
785
|
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
786
|
+
we: t?.we ?? O,
|
|
787
|
+
_e: t?._e || g,
|
|
788
|
+
ye: 0,
|
|
798
789
|
ee: null,
|
|
799
790
|
ne: null,
|
|
800
791
|
i: t,
|
|
@@ -807,7 +798,7 @@ function createOwner(e) {
|
|
|
807
798
|
if (e === null) {
|
|
808
799
|
t.re = n;
|
|
809
800
|
} else {
|
|
810
|
-
n.
|
|
801
|
+
n.pe = e;
|
|
811
802
|
t.re = n;
|
|
812
803
|
}
|
|
813
804
|
}
|
|
@@ -818,12 +809,12 @@ function createRoot(e, t) {
|
|
|
818
809
|
return runWithOwner(n, () => e(n.dispose));
|
|
819
810
|
}
|
|
820
811
|
function runWithOwner(e, t) {
|
|
821
|
-
const n =
|
|
822
|
-
|
|
812
|
+
const n = A;
|
|
813
|
+
A = e;
|
|
823
814
|
try {
|
|
824
815
|
return t();
|
|
825
816
|
} finally {
|
|
826
|
-
|
|
817
|
+
A = n;
|
|
827
818
|
}
|
|
828
819
|
}
|
|
829
820
|
function staleValues(e, t = true) {
|
|
@@ -857,6 +848,22 @@ function isPending(e) {
|
|
|
857
848
|
k = t;
|
|
858
849
|
}
|
|
859
850
|
}
|
|
851
|
+
function refresh(e) {
|
|
852
|
+
let t = j;
|
|
853
|
+
j = true;
|
|
854
|
+
try {
|
|
855
|
+
return untrack(e);
|
|
856
|
+
} finally {
|
|
857
|
+
j = t;
|
|
858
|
+
if (!t) {
|
|
859
|
+
schedule();
|
|
860
|
+
flush();
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
function isRefreshing() {
|
|
865
|
+
return j;
|
|
866
|
+
}
|
|
860
867
|
function createContext(e, t) {
|
|
861
868
|
return { id: Symbol(t), defaultValue: e };
|
|
862
869
|
}
|
|
@@ -864,7 +871,7 @@ function getContext(e, t = getOwner()) {
|
|
|
864
871
|
if (!t) {
|
|
865
872
|
throw new NoOwnerError();
|
|
866
873
|
}
|
|
867
|
-
const n = hasContext(e, t) ? t.
|
|
874
|
+
const n = hasContext(e, t) ? t._e[e.id] : e.defaultValue;
|
|
868
875
|
if (isUndefined(n)) {
|
|
869
876
|
throw new ContextNotFoundError();
|
|
870
877
|
}
|
|
@@ -874,10 +881,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
874
881
|
if (!n) {
|
|
875
882
|
throw new NoOwnerError();
|
|
876
883
|
}
|
|
877
|
-
n.
|
|
884
|
+
n._e = { ...n._e, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
878
885
|
}
|
|
879
886
|
function hasContext(e, t) {
|
|
880
|
-
return !isUndefined(t?.
|
|
887
|
+
return !isUndefined(t?._e[e.id]);
|
|
881
888
|
}
|
|
882
889
|
function isUndefined(e) {
|
|
883
890
|
return typeof e === "undefined";
|
|
@@ -886,7 +893,7 @@ function effect(e, t, n, r, i) {
|
|
|
886
893
|
let s = false;
|
|
887
894
|
const o = computed(e, r, {
|
|
888
895
|
...i,
|
|
889
|
-
|
|
896
|
+
Se: {
|
|
890
897
|
U: true,
|
|
891
898
|
be: r,
|
|
892
899
|
me: t,
|
|
@@ -897,11 +904,11 @@ function effect(e, t, n, r, i) {
|
|
|
897
904
|
if (s) {
|
|
898
905
|
const n = this.$ && this.$ === t && e;
|
|
899
906
|
this.U = !(this.$ & c) && !(this.$ & f & ~t) && !n;
|
|
900
|
-
if (this.U) this.
|
|
907
|
+
if (this.U) this.we.enqueue(this.T, runEffect.bind(this));
|
|
901
908
|
}
|
|
902
909
|
if (this.$ & c) {
|
|
903
910
|
let e = this.L;
|
|
904
|
-
this.
|
|
911
|
+
this.we.notify(this, f, 0);
|
|
905
912
|
if (this.T === h) {
|
|
906
913
|
try {
|
|
907
914
|
return this.xe
|
|
@@ -914,9 +921,9 @@ function effect(e, t, n, r, i) {
|
|
|
914
921
|
e = t;
|
|
915
922
|
}
|
|
916
923
|
}
|
|
917
|
-
if (!this.
|
|
924
|
+
if (!this.we.notify(this, c, c)) throw e;
|
|
918
925
|
} else if (this.T === d) {
|
|
919
|
-
this.
|
|
926
|
+
this.we.notify(this, f | c, this.$);
|
|
920
927
|
}
|
|
921
928
|
}
|
|
922
929
|
}
|
|
@@ -925,7 +932,7 @@ function effect(e, t, n, r, i) {
|
|
|
925
932
|
if (o.T === d) o.F = t => staleValues(() => e(t));
|
|
926
933
|
!i?.defer &&
|
|
927
934
|
!(o.$ & (c | f)) &&
|
|
928
|
-
(o.T === h ? o.
|
|
935
|
+
(o.T === h ? o.we.enqueue(o.T, runEffect.bind(o)) : runEffect.call(o));
|
|
929
936
|
onCleanup(() => o.Oe?.());
|
|
930
937
|
}
|
|
931
938
|
function runEffect() {
|
|
@@ -935,7 +942,7 @@ function runEffect() {
|
|
|
935
942
|
try {
|
|
936
943
|
this.Oe = this.me(this.G, this.be);
|
|
937
944
|
} catch (e) {
|
|
938
|
-
if (!this.
|
|
945
|
+
if (!this.we.notify(this, c, c)) throw e;
|
|
939
946
|
} finally {
|
|
940
947
|
this.be = this.G;
|
|
941
948
|
this.U = false;
|
|
@@ -955,12 +962,6 @@ function createMemo(e, t, n) {
|
|
|
955
962
|
let r = computed(e, t, n);
|
|
956
963
|
return read.bind(null, r);
|
|
957
964
|
}
|
|
958
|
-
function createAsync(e, t, n) {
|
|
959
|
-
const r = asyncComputed(e, t, n);
|
|
960
|
-
const i = read.bind(null, r);
|
|
961
|
-
i.refresh = r.Se;
|
|
962
|
-
return i;
|
|
963
|
-
}
|
|
964
965
|
function createEffect(e, t, n, r) {
|
|
965
966
|
void effect(e, t.effect || t, t.error, n, r);
|
|
966
967
|
}
|
|
@@ -1016,7 +1017,7 @@ function onSettled(e) {
|
|
|
1016
1017
|
});
|
|
1017
1018
|
}
|
|
1018
1019
|
function unwrap(e) {
|
|
1019
|
-
return e?.[
|
|
1020
|
+
return e?.[P]?.[V] ?? e;
|
|
1020
1021
|
}
|
|
1021
1022
|
function getOverrideValue(e, t, n, r) {
|
|
1022
1023
|
return n && r in n ? read(n[r]) : t && r in t ? t[r] : e[r];
|
|
@@ -1027,15 +1028,15 @@ function getAllKeys(e, t, n) {
|
|
|
1027
1028
|
return Array.from(new Set([...r, ...i]));
|
|
1028
1029
|
}
|
|
1029
1030
|
function applyState(e, t, n, r) {
|
|
1030
|
-
const i = t?.[
|
|
1031
|
+
const i = t?.[P];
|
|
1031
1032
|
if (!i) return;
|
|
1032
|
-
const s = i[
|
|
1033
|
-
const o = i[
|
|
1034
|
-
let u = i[
|
|
1033
|
+
const s = i[Q];
|
|
1034
|
+
const o = i[R];
|
|
1035
|
+
let u = i[V];
|
|
1035
1036
|
if (e === s && !o) return;
|
|
1036
|
-
(i[
|
|
1037
|
-
i[
|
|
1038
|
-
i[
|
|
1037
|
+
(i[D] || K).set(e, i[H]);
|
|
1038
|
+
i[Q] = e;
|
|
1039
|
+
i[R] = undefined;
|
|
1039
1040
|
if (Array.isArray(s)) {
|
|
1040
1041
|
let t = false;
|
|
1041
1042
|
const l = getOverrideValue(s, o, u, "length");
|
|
@@ -1062,16 +1063,16 @@ function applyState(e, t, n, r) {
|
|
|
1062
1063
|
if (a > h || a > d) {
|
|
1063
1064
|
for (c = a; c <= h; c++) {
|
|
1064
1065
|
t = true;
|
|
1065
|
-
i[
|
|
1066
|
+
i[V][c] && setSignal(i[V][c], wrap(e[c], i));
|
|
1066
1067
|
}
|
|
1067
1068
|
for (; c < e.length; c++) {
|
|
1068
1069
|
t = true;
|
|
1069
1070
|
const s = wrap(w[c], i);
|
|
1070
|
-
i[
|
|
1071
|
+
i[V][c] && setSignal(i[V][c], s);
|
|
1071
1072
|
applyState(e[c], s, n, r);
|
|
1072
1073
|
}
|
|
1073
|
-
t && i[
|
|
1074
|
-
l !== e.length && i[
|
|
1074
|
+
t && i[V][E] && setSignal(i[V][E], void 0);
|
|
1075
|
+
l !== e.length && i[V].length && setSignal(i[V].length, e.length);
|
|
1075
1076
|
return;
|
|
1076
1077
|
}
|
|
1077
1078
|
y = new Array(h + 1);
|
|
@@ -1095,9 +1096,9 @@ function applyState(e, t, n, r) {
|
|
|
1095
1096
|
for (c = a; c < e.length; c++) {
|
|
1096
1097
|
if (c in w) {
|
|
1097
1098
|
const t = wrap(w[c], i);
|
|
1098
|
-
i[
|
|
1099
|
+
i[V][c] && setSignal(i[V][c], t);
|
|
1099
1100
|
applyState(e[c], t, n, r);
|
|
1100
|
-
} else i[
|
|
1101
|
+
} else i[V][c] && setSignal(i[V][c], wrap(e[c], i));
|
|
1101
1102
|
}
|
|
1102
1103
|
if (a < e.length) t = true;
|
|
1103
1104
|
} else if (l && e.length) {
|
|
@@ -1108,13 +1109,13 @@ function applyState(e, t, n, r) {
|
|
|
1108
1109
|
}
|
|
1109
1110
|
if (l !== e.length) {
|
|
1110
1111
|
t = true;
|
|
1111
|
-
i[
|
|
1112
|
+
i[V].length && setSignal(i[V].length, e.length);
|
|
1112
1113
|
}
|
|
1113
|
-
t && i[
|
|
1114
|
+
t && i[V][E] && setSignal(i[V][E], void 0);
|
|
1114
1115
|
return;
|
|
1115
1116
|
}
|
|
1116
1117
|
if (u) {
|
|
1117
|
-
const t = u[
|
|
1118
|
+
const t = u[E];
|
|
1118
1119
|
const l = t || r ? getAllKeys(s, o, e) : Object.keys(u);
|
|
1119
1120
|
for (let f = 0, c = l.length; f < c; f++) {
|
|
1120
1121
|
const c = l[f];
|
|
@@ -1128,7 +1129,7 @@ function applyState(e, t, n, r) {
|
|
|
1128
1129
|
} else applyState(h, wrap(d, i), n, r);
|
|
1129
1130
|
}
|
|
1130
1131
|
}
|
|
1131
|
-
if ((u = i[
|
|
1132
|
+
if ((u = i[q])) {
|
|
1132
1133
|
const t = Object.keys(u);
|
|
1133
1134
|
for (let n = 0, r = t.length; n < r; n++) {
|
|
1134
1135
|
const r = t[n];
|
|
@@ -1151,11 +1152,11 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1151
1152
|
const i = new WeakMap();
|
|
1152
1153
|
const wrapProjection = e => {
|
|
1153
1154
|
if (i.has(e)) return i.get(e);
|
|
1154
|
-
if (e[
|
|
1155
|
-
const t = createStoreProxy(e,
|
|
1156
|
-
[
|
|
1157
|
-
[
|
|
1158
|
-
[
|
|
1155
|
+
if (e[P]?.[M] === wrapProjection) return e;
|
|
1156
|
+
const t = createStoreProxy(e, T, {
|
|
1157
|
+
[M]: wrapProjection,
|
|
1158
|
+
[D]: i,
|
|
1159
|
+
[B]() {
|
|
1159
1160
|
return r;
|
|
1160
1161
|
}
|
|
1161
1162
|
});
|
|
@@ -1164,11 +1165,12 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1164
1165
|
};
|
|
1165
1166
|
const s = wrapProjection(t);
|
|
1166
1167
|
r = computed(() => {
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
reconcile(
|
|
1171
|
-
}
|
|
1168
|
+
const t = r || getOwner();
|
|
1169
|
+
storeSetter(s, r => {
|
|
1170
|
+
const i = handleAsync(t, e(r), e => {
|
|
1171
|
+
e !== r && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
|
|
1172
|
+
});
|
|
1173
|
+
i !== r && i !== undefined && reconcile(i, n?.key || "id", n?.all)(r);
|
|
1172
1174
|
});
|
|
1173
1175
|
});
|
|
1174
1176
|
return { store: s, node: r };
|
|
@@ -1176,33 +1178,33 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1176
1178
|
function createProjection(e, t = {}, n) {
|
|
1177
1179
|
return createProjectionInternal(e, t, n).store;
|
|
1178
1180
|
}
|
|
1179
|
-
const
|
|
1180
|
-
A = Symbol(0),
|
|
1181
|
+
const E = Symbol(0),
|
|
1181
1182
|
W = Symbol(0),
|
|
1182
1183
|
P = Symbol(0),
|
|
1183
|
-
H = Symbol(0)
|
|
1184
|
-
|
|
1185
|
-
const F =
|
|
1186
|
-
|
|
1187
|
-
R = "
|
|
1188
|
-
V = "
|
|
1189
|
-
q = "
|
|
1190
|
-
M = "
|
|
1191
|
-
D = "
|
|
1192
|
-
|
|
1184
|
+
H = Symbol(0),
|
|
1185
|
+
I = Symbol(0);
|
|
1186
|
+
const F = new WeakMap();
|
|
1187
|
+
const Q = "v",
|
|
1188
|
+
R = "o",
|
|
1189
|
+
V = "n",
|
|
1190
|
+
q = "h",
|
|
1191
|
+
M = "w",
|
|
1192
|
+
D = "l",
|
|
1193
|
+
B = "f";
|
|
1194
|
+
function createStoreProxy(e, t = T, n) {
|
|
1193
1195
|
let r;
|
|
1194
1196
|
if (Array.isArray(e)) {
|
|
1195
1197
|
r = [];
|
|
1196
1198
|
r.v = e;
|
|
1197
1199
|
} else r = { v: e };
|
|
1198
1200
|
n && Object.assign(r, n);
|
|
1199
|
-
return (r[
|
|
1201
|
+
return (r[H] = new Proxy(r, t));
|
|
1200
1202
|
}
|
|
1201
|
-
const
|
|
1203
|
+
const K = new WeakMap();
|
|
1202
1204
|
function wrap(e, t) {
|
|
1203
|
-
if (t?.[
|
|
1204
|
-
let n = e[
|
|
1205
|
-
if (!n)
|
|
1205
|
+
if (t?.[M]) return t[M](e, t);
|
|
1206
|
+
let n = e[H] || K.get(e);
|
|
1207
|
+
if (!n) K.set(e, (n = createStoreProxy(e)));
|
|
1206
1208
|
return n;
|
|
1207
1209
|
}
|
|
1208
1210
|
function isWrappable(e) {
|
|
@@ -1226,8 +1228,8 @@ function getNode(e, t, n, r, i = isEqual) {
|
|
|
1226
1228
|
r
|
|
1227
1229
|
));
|
|
1228
1230
|
}
|
|
1229
|
-
function trackSelf(e, t =
|
|
1230
|
-
getObserver() && read(getNode(getNodes(e,
|
|
1231
|
+
function trackSelf(e, t = E) {
|
|
1232
|
+
getObserver() && read(getNode(getNodes(e, V), t, undefined, e[B]?.(), false));
|
|
1231
1233
|
}
|
|
1232
1234
|
function getKeys(e, t, n = true) {
|
|
1233
1235
|
const r = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
|
|
@@ -1235,7 +1237,7 @@ function getKeys(e, t, n = true) {
|
|
|
1235
1237
|
const i = new Set(r);
|
|
1236
1238
|
const s = Reflect.ownKeys(t);
|
|
1237
1239
|
for (const e of s) {
|
|
1238
|
-
if (t[e] !==
|
|
1240
|
+
if (t[e] !== I) i.add(e);
|
|
1239
1241
|
else i.delete(e);
|
|
1240
1242
|
}
|
|
1241
1243
|
return Array.from(i);
|
|
@@ -1243,124 +1245,124 @@ function getKeys(e, t, n = true) {
|
|
|
1243
1245
|
function getPropertyDescriptor(e, t, n) {
|
|
1244
1246
|
let r = e;
|
|
1245
1247
|
if (t && n in t) {
|
|
1246
|
-
if (r[n] ===
|
|
1248
|
+
if (r[n] === I) return void 0;
|
|
1247
1249
|
if (!(n in r)) r = t;
|
|
1248
1250
|
}
|
|
1249
1251
|
return Reflect.getOwnPropertyDescriptor(r, n);
|
|
1250
1252
|
}
|
|
1251
|
-
let
|
|
1252
|
-
const
|
|
1253
|
+
let G = null;
|
|
1254
|
+
const T = {
|
|
1253
1255
|
get(e, t, n) {
|
|
1254
|
-
if (t ===
|
|
1255
|
-
if (t ===
|
|
1256
|
-
if (t ===
|
|
1256
|
+
if (t === P) return e;
|
|
1257
|
+
if (t === H) return n;
|
|
1258
|
+
if (t === E || t === W) {
|
|
1257
1259
|
trackSelf(e, t);
|
|
1258
1260
|
return n;
|
|
1259
1261
|
}
|
|
1260
|
-
const r = getNodes(e,
|
|
1262
|
+
const r = getNodes(e, V);
|
|
1261
1263
|
const i = r[t];
|
|
1262
|
-
const s = e[
|
|
1263
|
-
const o = !!e[
|
|
1264
|
-
const u = s ? e[
|
|
1264
|
+
const s = e[R] && t in e[R];
|
|
1265
|
+
const o = !!e[Q][P];
|
|
1266
|
+
const u = s ? e[R] : e[Q];
|
|
1265
1267
|
if (!i) {
|
|
1266
1268
|
const e = Object.getOwnPropertyDescriptor(u, t);
|
|
1267
1269
|
if (e && e.get) return e.get.call(n);
|
|
1268
1270
|
}
|
|
1269
|
-
if (
|
|
1271
|
+
if (G?.has(n)) {
|
|
1270
1272
|
let n = i && (s || !o) ? (i.K !== p ? i.K : i.G) : u[t];
|
|
1271
|
-
n ===
|
|
1273
|
+
n === I && (n = undefined);
|
|
1272
1274
|
if (!isWrappable(n)) return n;
|
|
1273
1275
|
const r = wrap(n, e);
|
|
1274
|
-
|
|
1276
|
+
G.add(r);
|
|
1275
1277
|
return r;
|
|
1276
1278
|
}
|
|
1277
1279
|
let l = i ? (s || !o ? read(r[t]) : (read(r[t]), u[t])) : u[t];
|
|
1278
|
-
l ===
|
|
1280
|
+
l === I && (l = undefined);
|
|
1279
1281
|
if (!i) {
|
|
1280
1282
|
if (!s && typeof l === "function" && !u.hasOwnProperty(t)) {
|
|
1281
1283
|
let t;
|
|
1282
|
-
return !Array.isArray(e[
|
|
1284
|
+
return !Array.isArray(e[Q]) && (t = Object.getPrototypeOf(e[Q])) && t !== Object.prototype
|
|
1283
1285
|
? l.bind(u)
|
|
1284
1286
|
: l;
|
|
1285
1287
|
} else if (getObserver()) {
|
|
1286
|
-
return read(getNode(r, t, isWrappable(l) ? wrap(l, e) : l, e[
|
|
1288
|
+
return read(getNode(r, t, isWrappable(l) ? wrap(l, e) : l, e[B]?.()));
|
|
1287
1289
|
}
|
|
1288
1290
|
}
|
|
1289
1291
|
return isWrappable(l) ? wrap(l, e) : l;
|
|
1290
1292
|
},
|
|
1291
1293
|
has(e, t) {
|
|
1292
|
-
if (t ===
|
|
1293
|
-
const n = e[
|
|
1294
|
-
getObserver() && read(getNode(getNodes(e,
|
|
1294
|
+
if (t === H || t === E || t === "__proto__") return true;
|
|
1295
|
+
const n = e[R] && t in e[R] ? e[R][t] !== I : t in e[Q];
|
|
1296
|
+
getObserver() && read(getNode(getNodes(e, q), t, n, e[B]?.()));
|
|
1295
1297
|
return n;
|
|
1296
1298
|
},
|
|
1297
1299
|
set(e, t, n) {
|
|
1298
|
-
const r = e[
|
|
1299
|
-
if (
|
|
1300
|
+
const r = e[H];
|
|
1301
|
+
if (G?.has(e[H])) {
|
|
1300
1302
|
untrack(() => {
|
|
1301
|
-
const i = e[
|
|
1303
|
+
const i = e[Q];
|
|
1302
1304
|
const s = i[t];
|
|
1303
|
-
const o = e[
|
|
1304
|
-
const u = n?.[
|
|
1305
|
+
const o = e[R] && t in e[R] ? e[R][t] : s;
|
|
1306
|
+
const u = n?.[P]?.[Q] ?? n;
|
|
1305
1307
|
if (o === u) return true;
|
|
1306
|
-
const l = e[
|
|
1307
|
-
if (u !== undefined && u === s) delete e[
|
|
1308
|
-
else (e[
|
|
1308
|
+
const l = e[R]?.length || i.length;
|
|
1309
|
+
if (u !== undefined && u === s) delete e[R][t];
|
|
1310
|
+
else (e[R] || (e[R] = Object.create(null)))[t] = u;
|
|
1309
1311
|
const f = isWrappable(u);
|
|
1310
1312
|
if (isWrappable(o)) {
|
|
1311
|
-
const e =
|
|
1312
|
-
e && (e instanceof Set ? e.delete(r) :
|
|
1313
|
+
const e = F.get(o);
|
|
1314
|
+
e && (e instanceof Set ? e.delete(r) : F.delete(o));
|
|
1313
1315
|
}
|
|
1314
|
-
if (recursivelyNotify(r,
|
|
1315
|
-
e[
|
|
1316
|
-
const c = getNodes(e,
|
|
1316
|
+
if (recursivelyNotify(r, K) && f) recursivelyAddParent(u, r);
|
|
1317
|
+
e[q]?.[t] && setSignal(e[q][t], true);
|
|
1318
|
+
const c = getNodes(e, V);
|
|
1317
1319
|
c[t] && setSignal(c[t], () => (f ? wrap(u, e) : u));
|
|
1318
1320
|
if (Array.isArray(i)) {
|
|
1319
1321
|
const e = parseInt(t) + 1;
|
|
1320
1322
|
if (e > l) c.length && setSignal(c.length, e);
|
|
1321
1323
|
}
|
|
1322
|
-
c[
|
|
1324
|
+
c[E] && setSignal(c[E], undefined);
|
|
1323
1325
|
});
|
|
1324
1326
|
}
|
|
1325
1327
|
return true;
|
|
1326
1328
|
},
|
|
1327
1329
|
deleteProperty(e, t) {
|
|
1328
|
-
if (
|
|
1330
|
+
if (G?.has(e[H]) && e[R]?.[t] !== I) {
|
|
1329
1331
|
untrack(() => {
|
|
1330
|
-
const n = e[
|
|
1331
|
-
if (t in e[
|
|
1332
|
-
(e[
|
|
1333
|
-
} else if (e[
|
|
1334
|
-
delete e[
|
|
1332
|
+
const n = e[R] && t in e[R] ? e[R][t] : e[Q][t];
|
|
1333
|
+
if (t in e[Q]) {
|
|
1334
|
+
(e[R] || (e[R] = Object.create(null)))[t] = I;
|
|
1335
|
+
} else if (e[R] && t in e[R]) {
|
|
1336
|
+
delete e[R][t];
|
|
1335
1337
|
} else return true;
|
|
1336
1338
|
if (isWrappable(n)) {
|
|
1337
|
-
const t =
|
|
1338
|
-
t && (t instanceof Set ? t.delete(e) :
|
|
1339
|
+
const t = F.get(n);
|
|
1340
|
+
t && (t instanceof Set ? t.delete(e) : F.delete(n));
|
|
1339
1341
|
}
|
|
1340
|
-
if (e[
|
|
1341
|
-
const r = getNodes(e,
|
|
1342
|
+
if (e[q]?.[t]) setSignal(e[q][t], false);
|
|
1343
|
+
const r = getNodes(e, V);
|
|
1342
1344
|
r[t] && setSignal(r[t], undefined);
|
|
1343
|
-
r[
|
|
1345
|
+
r[E] && setSignal(r[E], undefined);
|
|
1344
1346
|
});
|
|
1345
1347
|
}
|
|
1346
1348
|
return true;
|
|
1347
1349
|
},
|
|
1348
1350
|
ownKeys(e) {
|
|
1349
1351
|
trackSelf(e);
|
|
1350
|
-
return getKeys(e[
|
|
1352
|
+
return getKeys(e[Q], e[R], false);
|
|
1351
1353
|
},
|
|
1352
1354
|
getOwnPropertyDescriptor(e, t) {
|
|
1353
|
-
if (t ===
|
|
1354
|
-
return getPropertyDescriptor(e[
|
|
1355
|
+
if (t === H) return { value: e[H], writable: true, configurable: true };
|
|
1356
|
+
return getPropertyDescriptor(e[Q], e[R], t);
|
|
1355
1357
|
},
|
|
1356
1358
|
getPrototypeOf(e) {
|
|
1357
|
-
return Object.getPrototypeOf(e[
|
|
1359
|
+
return Object.getPrototypeOf(e[Q]);
|
|
1358
1360
|
}
|
|
1359
1361
|
};
|
|
1360
1362
|
function storeSetter(e, t) {
|
|
1361
|
-
const n =
|
|
1362
|
-
|
|
1363
|
-
|
|
1363
|
+
const n = G;
|
|
1364
|
+
G = new Set();
|
|
1365
|
+
G.add(e);
|
|
1364
1366
|
try {
|
|
1365
1367
|
const n = t(e);
|
|
1366
1368
|
if (n !== e && n !== undefined) {
|
|
@@ -1376,8 +1378,8 @@ function storeSetter(e, t) {
|
|
|
1376
1378
|
}
|
|
1377
1379
|
}
|
|
1378
1380
|
} finally {
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
+
G.clear();
|
|
1382
|
+
G = n;
|
|
1381
1383
|
}
|
|
1382
1384
|
}
|
|
1383
1385
|
function createStore(e, t, n) {
|
|
@@ -1386,17 +1388,17 @@ function createStore(e, t, n) {
|
|
|
1386
1388
|
return [i, e => storeSetter(i, e)];
|
|
1387
1389
|
}
|
|
1388
1390
|
function recursivelyNotify(e, t) {
|
|
1389
|
-
let n = e[
|
|
1391
|
+
let n = e[P] || t?.get(e)?.[P];
|
|
1390
1392
|
let r = false;
|
|
1391
1393
|
if (n) {
|
|
1392
|
-
const e = getNodes(n,
|
|
1394
|
+
const e = getNodes(n, V)[W];
|
|
1393
1395
|
if (e) {
|
|
1394
1396
|
setSignal(e, undefined);
|
|
1395
1397
|
r = true;
|
|
1396
1398
|
}
|
|
1397
|
-
t = n[
|
|
1399
|
+
t = n[D] || t;
|
|
1398
1400
|
}
|
|
1399
|
-
const i =
|
|
1401
|
+
const i = F.get(n?.[Q] || e);
|
|
1400
1402
|
if (!i) return r;
|
|
1401
1403
|
if (i instanceof Set) {
|
|
1402
1404
|
for (let e of i) r = recursivelyNotify(e, t) || r;
|
|
@@ -1405,16 +1407,16 @@ function recursivelyNotify(e, t) {
|
|
|
1405
1407
|
}
|
|
1406
1408
|
function recursivelyAddParent(e, t) {
|
|
1407
1409
|
let n;
|
|
1408
|
-
const r = e[
|
|
1410
|
+
const r = e[P];
|
|
1409
1411
|
if (r) {
|
|
1410
|
-
n = r[
|
|
1411
|
-
e = r[
|
|
1412
|
+
n = r[R];
|
|
1413
|
+
e = r[Q];
|
|
1412
1414
|
}
|
|
1413
1415
|
if (t) {
|
|
1414
|
-
let n =
|
|
1415
|
-
if (!n)
|
|
1416
|
+
let n = F.get(e);
|
|
1417
|
+
if (!n) F.set(e, t);
|
|
1416
1418
|
else if (n !== t) {
|
|
1417
|
-
if (!(n instanceof Set))
|
|
1419
|
+
if (!(n instanceof Set)) F.set(e, (n = new Set([n])));
|
|
1418
1420
|
else if (n.has(t)) return;
|
|
1419
1421
|
n.add(t);
|
|
1420
1422
|
} else return;
|
|
@@ -1436,7 +1438,7 @@ function recursivelyAddParent(e, t) {
|
|
|
1436
1438
|
}
|
|
1437
1439
|
function deep(e) {
|
|
1438
1440
|
recursivelyAddParent(e);
|
|
1439
|
-
return e[
|
|
1441
|
+
return e[W];
|
|
1440
1442
|
}
|
|
1441
1443
|
function createOptimisticStore(e, t, n) {
|
|
1442
1444
|
return [];
|
|
@@ -1446,12 +1448,12 @@ function snapshot(e, t, n) {
|
|
|
1446
1448
|
if (!isWrappable(e)) return e;
|
|
1447
1449
|
if (t && t.has(e)) return t.get(e);
|
|
1448
1450
|
if (!t) t = new Map();
|
|
1449
|
-
if ((r = e[
|
|
1450
|
-
s = r[
|
|
1451
|
-
i = Array.isArray(r[
|
|
1452
|
-
t.set(e, s ? (o = i ? [] : Object.create(Object.getPrototypeOf(r[
|
|
1453
|
-
e = r[
|
|
1454
|
-
n =
|
|
1451
|
+
if ((r = e[P] || n?.get(e)?.[P])) {
|
|
1452
|
+
s = r[R];
|
|
1453
|
+
i = Array.isArray(r[Q]);
|
|
1454
|
+
t.set(e, s ? (o = i ? [] : Object.create(Object.getPrototypeOf(r[Q]))) : r[Q]);
|
|
1455
|
+
e = r[Q];
|
|
1456
|
+
n = K;
|
|
1455
1457
|
} else {
|
|
1456
1458
|
i = Array.isArray(e);
|
|
1457
1459
|
t.set(e, e);
|
|
@@ -1460,7 +1462,7 @@ function snapshot(e, t, n) {
|
|
|
1460
1462
|
const r = s?.length || e.length;
|
|
1461
1463
|
for (let i = 0; i < r; i++) {
|
|
1462
1464
|
l = s && i in s ? s[i] : e[i];
|
|
1463
|
-
if (l ===
|
|
1465
|
+
if (l === I) continue;
|
|
1464
1466
|
if ((u = snapshot(l, t, n)) !== l || o) {
|
|
1465
1467
|
if (!o) t.set(e, (o = [...e]));
|
|
1466
1468
|
o[i] = u;
|
|
@@ -1487,13 +1489,13 @@ function snapshot(e, t, n) {
|
|
|
1487
1489
|
function trueFn() {
|
|
1488
1490
|
return true;
|
|
1489
1491
|
}
|
|
1490
|
-
const
|
|
1492
|
+
const U = {
|
|
1491
1493
|
get(e, t, n) {
|
|
1492
|
-
if (t ===
|
|
1494
|
+
if (t === H) return n;
|
|
1493
1495
|
return e.get(t);
|
|
1494
1496
|
},
|
|
1495
1497
|
has(e, t) {
|
|
1496
|
-
if (t ===
|
|
1498
|
+
if (t === H) return true;
|
|
1497
1499
|
return e.has(t);
|
|
1498
1500
|
},
|
|
1499
1501
|
set: trueFn,
|
|
@@ -1516,15 +1518,15 @@ const T = {
|
|
|
1516
1518
|
function resolveSource(e) {
|
|
1517
1519
|
return !(e = typeof e === "function" ? e() : e) ? {} : e;
|
|
1518
1520
|
}
|
|
1519
|
-
const
|
|
1521
|
+
const L = Symbol(0);
|
|
1520
1522
|
function merge(...e) {
|
|
1521
1523
|
if (e.length === 1 && typeof e[0] !== "function") return e[0];
|
|
1522
1524
|
let t = false;
|
|
1523
1525
|
const n = [];
|
|
1524
1526
|
for (let r = 0; r < e.length; r++) {
|
|
1525
1527
|
const i = e[r];
|
|
1526
|
-
t = t || (!!i &&
|
|
1527
|
-
const s = !!i && i[
|
|
1528
|
+
t = t || (!!i && H in i);
|
|
1529
|
+
const s = !!i && i[L];
|
|
1528
1530
|
if (s) n.push(...s);
|
|
1529
1531
|
else n.push(typeof i === "function" ? ((t = true), createMemo(i)) : i);
|
|
1530
1532
|
}
|
|
@@ -1532,7 +1534,7 @@ function merge(...e) {
|
|
|
1532
1534
|
return new Proxy(
|
|
1533
1535
|
{
|
|
1534
1536
|
get(e) {
|
|
1535
|
-
if (e ===
|
|
1537
|
+
if (e === L) return n;
|
|
1536
1538
|
for (let t = n.length - 1; t >= 0; t--) {
|
|
1537
1539
|
const r = resolveSource(n[t]);
|
|
1538
1540
|
if (e in r) return r[e];
|
|
@@ -1550,7 +1552,7 @@ function merge(...e) {
|
|
|
1550
1552
|
return [...new Set(e)];
|
|
1551
1553
|
}
|
|
1552
1554
|
},
|
|
1553
|
-
|
|
1555
|
+
U
|
|
1554
1556
|
);
|
|
1555
1557
|
}
|
|
1556
1558
|
const r = Object.create(null);
|
|
@@ -1582,12 +1584,12 @@ function merge(...e) {
|
|
|
1582
1584
|
if (n.get) Object.defineProperty(o, t, n);
|
|
1583
1585
|
else o[t] = n.value;
|
|
1584
1586
|
}
|
|
1585
|
-
o[
|
|
1587
|
+
o[L] = n;
|
|
1586
1588
|
return o;
|
|
1587
1589
|
}
|
|
1588
1590
|
function omit(e, ...t) {
|
|
1589
1591
|
const n = new Set(t);
|
|
1590
|
-
if (y &&
|
|
1592
|
+
if (y && H in e) {
|
|
1591
1593
|
return new Proxy(
|
|
1592
1594
|
{
|
|
1593
1595
|
get(t) {
|
|
@@ -1600,7 +1602,7 @@ function omit(e, ...t) {
|
|
|
1600
1602
|
return Object.keys(e).filter(e => !n.has(e));
|
|
1601
1603
|
}
|
|
1602
1604
|
},
|
|
1603
|
-
|
|
1605
|
+
U
|
|
1604
1606
|
);
|
|
1605
1607
|
}
|
|
1606
1608
|
const r = {};
|
|
@@ -1622,9 +1624,9 @@ function mapArray(e, t, n) {
|
|
|
1622
1624
|
ve: 0,
|
|
1623
1625
|
Ne: e,
|
|
1624
1626
|
ke: [],
|
|
1625
|
-
|
|
1626
|
-
je: [],
|
|
1627
|
+
je: t,
|
|
1627
1628
|
Ae: [],
|
|
1629
|
+
Ee: [],
|
|
1628
1630
|
We: r,
|
|
1629
1631
|
Pe: r || n?.keyed === false ? [] : undefined,
|
|
1630
1632
|
He: t.length > 1 ? [] : undefined,
|
|
@@ -1632,19 +1634,19 @@ function mapArray(e, t, n) {
|
|
|
1632
1634
|
})
|
|
1633
1635
|
);
|
|
1634
1636
|
}
|
|
1635
|
-
const
|
|
1637
|
+
const z = { pureWrite: true };
|
|
1636
1638
|
function updateKeyedMap() {
|
|
1637
1639
|
const e = this.Ne() || [],
|
|
1638
1640
|
t = e.length;
|
|
1639
|
-
e[
|
|
1641
|
+
e[E];
|
|
1640
1642
|
runWithOwner(this.Ce, () => {
|
|
1641
1643
|
let n,
|
|
1642
1644
|
r,
|
|
1643
1645
|
i = this.Pe
|
|
1644
1646
|
? () => {
|
|
1645
|
-
this.Pe[r] = signal(e[r],
|
|
1646
|
-
this.He && (this.He[r] = signal(r,
|
|
1647
|
-
return this.
|
|
1647
|
+
this.Pe[r] = signal(e[r], z);
|
|
1648
|
+
this.He && (this.He[r] = signal(r, z));
|
|
1649
|
+
return this.je(
|
|
1648
1650
|
read.bind(null, this.Pe[r]),
|
|
1649
1651
|
this.He ? read.bind(null, this.He[r]) : undefined
|
|
1650
1652
|
);
|
|
@@ -1652,32 +1654,32 @@ function updateKeyedMap() {
|
|
|
1652
1654
|
: this.He
|
|
1653
1655
|
? () => {
|
|
1654
1656
|
const t = e[r];
|
|
1655
|
-
this.He[r] = signal(r,
|
|
1656
|
-
return this.
|
|
1657
|
+
this.He[r] = signal(r, z);
|
|
1658
|
+
return this.je(() => t, read.bind(null, this.He[r]));
|
|
1657
1659
|
}
|
|
1658
1660
|
: () => {
|
|
1659
1661
|
const t = e[r];
|
|
1660
|
-
return this.
|
|
1662
|
+
return this.je(() => t);
|
|
1661
1663
|
};
|
|
1662
1664
|
if (t === 0) {
|
|
1663
1665
|
if (this.ve !== 0) {
|
|
1664
1666
|
this.Ce.dispose(false);
|
|
1665
|
-
this.
|
|
1667
|
+
this.Ee = [];
|
|
1666
1668
|
this.ke = [];
|
|
1667
|
-
this.
|
|
1669
|
+
this.Ae = [];
|
|
1668
1670
|
this.ve = 0;
|
|
1669
1671
|
this.Pe && (this.Pe = []);
|
|
1670
1672
|
this.He && (this.He = []);
|
|
1671
1673
|
}
|
|
1672
|
-
if (this.Ie && !this.
|
|
1673
|
-
this.
|
|
1674
|
+
if (this.Ie && !this.Ae[0]) {
|
|
1675
|
+
this.Ae[0] = runWithOwner((this.Ee[0] = createOwner()), this.Ie);
|
|
1674
1676
|
}
|
|
1675
1677
|
} else if (this.ve === 0) {
|
|
1676
|
-
if (this.
|
|
1677
|
-
this.
|
|
1678
|
+
if (this.Ee[0]) this.Ee[0].dispose();
|
|
1679
|
+
this.Ae = new Array(t);
|
|
1678
1680
|
for (r = 0; r < t; r++) {
|
|
1679
1681
|
this.ke[r] = e[r];
|
|
1680
|
-
this.
|
|
1682
|
+
this.Ae[r] = runWithOwner((this.Ee[r] = createOwner()), i);
|
|
1681
1683
|
}
|
|
1682
1684
|
this.ve = t;
|
|
1683
1685
|
} else {
|
|
@@ -1706,8 +1708,8 @@ function updateKeyedMap() {
|
|
|
1706
1708
|
(this.ke[o] === e[u] || (this.Pe && compare(this.We, this.ke[o], e[u])));
|
|
1707
1709
|
o--, u--
|
|
1708
1710
|
) {
|
|
1709
|
-
d[u] = this.
|
|
1710
|
-
h[u] = this.
|
|
1711
|
+
d[u] = this.Ae[o];
|
|
1712
|
+
h[u] = this.Ee[o];
|
|
1711
1713
|
p && (p[u] = this.Pe[o]);
|
|
1712
1714
|
y && (y[u] = this.He[o]);
|
|
1713
1715
|
}
|
|
@@ -1725,18 +1727,18 @@ function updateKeyedMap() {
|
|
|
1725
1727
|
f = this.We ? this.We(l) : l;
|
|
1726
1728
|
r = c.get(f);
|
|
1727
1729
|
if (r !== undefined && r !== -1) {
|
|
1728
|
-
d[r] = this.
|
|
1729
|
-
h[r] = this.
|
|
1730
|
+
d[r] = this.Ae[n];
|
|
1731
|
+
h[r] = this.Ee[n];
|
|
1730
1732
|
p && (p[r] = this.Pe[n]);
|
|
1731
1733
|
y && (y[r] = this.He[n]);
|
|
1732
1734
|
r = a[r];
|
|
1733
1735
|
c.set(f, r);
|
|
1734
|
-
} else this.
|
|
1736
|
+
} else this.Ee[n].dispose();
|
|
1735
1737
|
}
|
|
1736
1738
|
for (r = s; r < t; r++) {
|
|
1737
1739
|
if (r in d) {
|
|
1738
|
-
this.
|
|
1739
|
-
this.
|
|
1740
|
+
this.Ae[r] = d[r];
|
|
1741
|
+
this.Ee[r] = h[r];
|
|
1740
1742
|
if (p) {
|
|
1741
1743
|
this.Pe[r] = p[r];
|
|
1742
1744
|
setSignal(this.Pe[r], e[r]);
|
|
@@ -1746,14 +1748,14 @@ function updateKeyedMap() {
|
|
|
1746
1748
|
setSignal(this.He[r], r);
|
|
1747
1749
|
}
|
|
1748
1750
|
} else {
|
|
1749
|
-
this.
|
|
1751
|
+
this.Ae[r] = runWithOwner((this.Ee[r] = createOwner()), i);
|
|
1750
1752
|
}
|
|
1751
1753
|
}
|
|
1752
|
-
this.
|
|
1754
|
+
this.Ae = this.Ae.slice(0, (this.ve = t));
|
|
1753
1755
|
this.ke = e.slice(0);
|
|
1754
1756
|
}
|
|
1755
1757
|
});
|
|
1756
|
-
return this.
|
|
1758
|
+
return this.Ae;
|
|
1757
1759
|
}
|
|
1758
1760
|
function repeat(e, t, n) {
|
|
1759
1761
|
return updateRepeat.bind({
|
|
@@ -1761,9 +1763,9 @@ function repeat(e, t, n) {
|
|
|
1761
1763
|
ve: 0,
|
|
1762
1764
|
Fe: 0,
|
|
1763
1765
|
Qe: e,
|
|
1764
|
-
|
|
1766
|
+
je: t,
|
|
1767
|
+
Ee: [],
|
|
1765
1768
|
Ae: [],
|
|
1766
|
-
je: [],
|
|
1767
1769
|
Re: n?.from,
|
|
1768
1770
|
Ie: n?.fallback
|
|
1769
1771
|
});
|
|
@@ -1775,71 +1777,71 @@ function updateRepeat() {
|
|
|
1775
1777
|
if (e === 0) {
|
|
1776
1778
|
if (this.ve !== 0) {
|
|
1777
1779
|
this.Ce.dispose(false);
|
|
1780
|
+
this.Ee = [];
|
|
1778
1781
|
this.Ae = [];
|
|
1779
|
-
this.je = [];
|
|
1780
1782
|
this.ve = 0;
|
|
1781
1783
|
}
|
|
1782
|
-
if (this.Ie && !this.
|
|
1783
|
-
this.
|
|
1784
|
+
if (this.Ie && !this.Ae[0]) {
|
|
1785
|
+
this.Ae[0] = runWithOwner((this.Ee[0] = createOwner()), this.Ie);
|
|
1784
1786
|
}
|
|
1785
1787
|
return;
|
|
1786
1788
|
}
|
|
1787
1789
|
const n = t + e;
|
|
1788
1790
|
const r = this.Fe + this.ve;
|
|
1789
|
-
if (this.ve === 0 && this.
|
|
1790
|
-
for (let e = n; e < r; e++) this.
|
|
1791
|
+
if (this.ve === 0 && this.Ee[0]) this.Ee[0].dispose();
|
|
1792
|
+
for (let e = n; e < r; e++) this.Ee[e - this.Fe].dispose();
|
|
1791
1793
|
if (this.Fe < t) {
|
|
1792
1794
|
let e = this.Fe;
|
|
1793
|
-
while (e < t && e < this.ve) this.
|
|
1795
|
+
while (e < t && e < this.ve) this.Ee[e++].dispose();
|
|
1796
|
+
this.Ee.splice(0, t - this.Fe);
|
|
1794
1797
|
this.Ae.splice(0, t - this.Fe);
|
|
1795
|
-
this.je.splice(0, t - this.Fe);
|
|
1796
1798
|
} else if (this.Fe > t) {
|
|
1797
1799
|
let n = r - this.Fe - 1;
|
|
1798
1800
|
let i = this.Fe - t;
|
|
1799
|
-
this.
|
|
1801
|
+
this.Ee.length = this.Ae.length = e;
|
|
1800
1802
|
while (n >= i) {
|
|
1803
|
+
this.Ee[n] = this.Ee[n - i];
|
|
1801
1804
|
this.Ae[n] = this.Ae[n - i];
|
|
1802
|
-
this.je[n] = this.je[n - i];
|
|
1803
1805
|
n--;
|
|
1804
1806
|
}
|
|
1805
1807
|
for (let e = 0; e < i; e++) {
|
|
1806
|
-
this.
|
|
1808
|
+
this.Ae[e] = runWithOwner((this.Ee[e] = createOwner()), () => this.je(e + t));
|
|
1807
1809
|
}
|
|
1808
1810
|
}
|
|
1809
1811
|
for (let e = r; e < n; e++) {
|
|
1810
|
-
this.
|
|
1812
|
+
this.Ae[e - t] = runWithOwner((this.Ee[e - t] = createOwner()), () => this.je(e));
|
|
1811
1813
|
}
|
|
1812
|
-
this.
|
|
1814
|
+
this.Ae = this.Ae.slice(0, e);
|
|
1813
1815
|
this.Fe = t;
|
|
1814
1816
|
this.ve = e;
|
|
1815
1817
|
});
|
|
1816
|
-
return this.
|
|
1818
|
+
return this.Ae;
|
|
1817
1819
|
}
|
|
1818
1820
|
function compare(e, t, n) {
|
|
1819
1821
|
return e ? e(t) === e(n) : true;
|
|
1820
1822
|
}
|
|
1821
1823
|
function boundaryComputed(e, t) {
|
|
1822
1824
|
const n = computed(e, undefined, {
|
|
1823
|
-
|
|
1825
|
+
Se: {
|
|
1824
1826
|
le() {
|
|
1825
1827
|
let e = this.$;
|
|
1826
1828
|
this.$ &= ~this.Ve;
|
|
1827
1829
|
if (this.Ve & f && !(this.$ & a)) {
|
|
1828
1830
|
e &= ~f;
|
|
1829
1831
|
}
|
|
1830
|
-
this.
|
|
1832
|
+
this.we.notify(this, this.Ve, e);
|
|
1831
1833
|
},
|
|
1832
1834
|
Ve: t
|
|
1833
1835
|
}
|
|
1834
1836
|
});
|
|
1835
1837
|
n.Ve = t;
|
|
1836
|
-
n.
|
|
1838
|
+
n.he = true;
|
|
1837
1839
|
return n;
|
|
1838
1840
|
}
|
|
1839
1841
|
function createBoundChildren(e, t, n, r) {
|
|
1840
|
-
const i = e.
|
|
1841
|
-
i.addChild((e.
|
|
1842
|
-
onCleanup(() => i.removeChild(e.
|
|
1842
|
+
const i = e.we;
|
|
1843
|
+
i.addChild((e.we = n));
|
|
1844
|
+
onCleanup(() => i.removeChild(e.we));
|
|
1843
1845
|
return runWithOwner(e, () => {
|
|
1844
1846
|
const e = computed(t);
|
|
1845
1847
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), r);
|
|
@@ -1877,7 +1879,7 @@ class ConditionalQueue extends Queue {
|
|
|
1877
1879
|
}
|
|
1878
1880
|
class CollectionQueue extends Queue {
|
|
1879
1881
|
De;
|
|
1880
|
-
|
|
1882
|
+
Ee = new Set();
|
|
1881
1883
|
qe = signal(false, { pureWrite: true });
|
|
1882
1884
|
Be = false;
|
|
1883
1885
|
constructor(e) {
|
|
@@ -1891,24 +1893,24 @@ class CollectionQueue extends Queue {
|
|
|
1891
1893
|
notify(e, t, n) {
|
|
1892
1894
|
if (!(t & this.De) || (this.De & f && this.Be)) return super.notify(e, t, n);
|
|
1893
1895
|
if (n & this.De) {
|
|
1894
|
-
this.
|
|
1895
|
-
if (this.
|
|
1896
|
-
} else if (this.
|
|
1897
|
-
this.
|
|
1898
|
-
if (this.
|
|
1896
|
+
this.Ee.add(e);
|
|
1897
|
+
if (this.Ee.size === 1) setSignal(this.qe, true);
|
|
1898
|
+
} else if (this.Ee.size > 0) {
|
|
1899
|
+
this.Ee.delete(e);
|
|
1900
|
+
if (this.Ee.size === 0) setSignal(this.qe, false);
|
|
1899
1901
|
}
|
|
1900
1902
|
t &= ~this.De;
|
|
1901
1903
|
return t ? super.notify(e, t, n) : true;
|
|
1902
1904
|
}
|
|
1903
1905
|
}
|
|
1904
|
-
var
|
|
1906
|
+
var J;
|
|
1905
1907
|
(function (e) {
|
|
1906
1908
|
e["VISIBLE"] = "visible";
|
|
1907
1909
|
e["HIDDEN"] = "hidden";
|
|
1908
|
-
})(
|
|
1910
|
+
})(J || (J = {}));
|
|
1909
1911
|
function createBoundary(e, t) {
|
|
1910
1912
|
const n = createOwner();
|
|
1911
|
-
const r = new ConditionalQueue(computed(() => t() ===
|
|
1913
|
+
const r = new ConditionalQueue(computed(() => t() === J.HIDDEN));
|
|
1912
1914
|
const i = createBoundChildren(n, e, r, 0);
|
|
1913
1915
|
computed(() => {
|
|
1914
1916
|
const e = read(r.qe);
|
|
@@ -1954,10 +1956,10 @@ function collectErrorSources(e, t) {
|
|
|
1954
1956
|
}
|
|
1955
1957
|
function createErrorBoundary(e, t) {
|
|
1956
1958
|
return createCollectionBoundary(c, e, e => {
|
|
1957
|
-
let n = e.
|
|
1959
|
+
let n = e.Ee.values().next().value;
|
|
1958
1960
|
return t(n.L, () => {
|
|
1959
1961
|
const t = [];
|
|
1960
|
-
for (const n of e.
|
|
1962
|
+
for (const n of e.Ee) collectErrorSources(n, t);
|
|
1961
1963
|
for (const e of t) recompute(e);
|
|
1962
1964
|
schedule();
|
|
1963
1965
|
});
|
|
@@ -2012,14 +2014,13 @@ function flattenArray(e, t = [], n) {
|
|
|
2012
2014
|
if (r) throw r;
|
|
2013
2015
|
return i;
|
|
2014
2016
|
}
|
|
2015
|
-
exports.$PROXY =
|
|
2016
|
-
exports.$TARGET =
|
|
2017
|
-
exports.$TRACK =
|
|
2017
|
+
exports.$PROXY = H;
|
|
2018
|
+
exports.$TARGET = P;
|
|
2019
|
+
exports.$TRACK = E;
|
|
2018
2020
|
exports.ContextNotFoundError = ContextNotFoundError;
|
|
2019
2021
|
exports.NoOwnerError = NoOwnerError;
|
|
2020
2022
|
exports.NotReadyError = NotReadyError;
|
|
2021
2023
|
exports.SUPPORTS_PROXY = y;
|
|
2022
|
-
exports.createAsync = createAsync;
|
|
2023
2024
|
exports.createBoundary = createBoundary;
|
|
2024
2025
|
exports.createContext = createContext;
|
|
2025
2026
|
exports.createEffect = createEffect;
|
|
@@ -2044,6 +2045,7 @@ exports.getObserver = getObserver;
|
|
|
2044
2045
|
exports.getOwner = getOwner;
|
|
2045
2046
|
exports.isEqual = isEqual;
|
|
2046
2047
|
exports.isPending = isPending;
|
|
2048
|
+
exports.isRefreshing = isRefreshing;
|
|
2047
2049
|
exports.isWrappable = isWrappable;
|
|
2048
2050
|
exports.mapArray = mapArray;
|
|
2049
2051
|
exports.merge = merge;
|
|
@@ -2052,6 +2054,7 @@ exports.onCleanup = onCleanup;
|
|
|
2052
2054
|
exports.onSettled = onSettled;
|
|
2053
2055
|
exports.pending = pending;
|
|
2054
2056
|
exports.reconcile = reconcile;
|
|
2057
|
+
exports.refresh = refresh;
|
|
2055
2058
|
exports.repeat = repeat;
|
|
2056
2059
|
exports.resolve = resolve;
|
|
2057
2060
|
exports.runWithOwner = runWithOwner;
|