@solidjs/signals 0.10.7 → 0.11.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 +142 -30
- package/dist/node.cjs +438 -365
- package/dist/prod.js +313 -240
- package/dist/types/core/core.d.ts +4 -2
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/types.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/map.d.ts +2 -0
- package/dist/types/store/index.d.ts +2 -0
- package/dist/types/store/storePath.d.ts +30 -0
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -81,10 +81,10 @@ function deleteFromHeap(e, t) {
|
|
|
81
81
|
else {
|
|
82
82
|
const n = e.S;
|
|
83
83
|
const r = t.l[i];
|
|
84
|
-
const
|
|
84
|
+
const s = n ?? r;
|
|
85
85
|
if (e === r) t.l[i] = n;
|
|
86
86
|
else e.T.S = n;
|
|
87
|
-
|
|
87
|
+
s.T = e.T;
|
|
88
88
|
}
|
|
89
89
|
e.T = e;
|
|
90
90
|
e.S = undefined;
|
|
@@ -347,7 +347,7 @@ function insertSubs(e, t = false) {
|
|
|
347
347
|
const n = e.ie || currentOptimisticLane;
|
|
348
348
|
const i = e.re !== undefined;
|
|
349
349
|
for (let r = e.I; r !== null; r = r.p) {
|
|
350
|
-
if (i && r.h.
|
|
350
|
+
if (i && r.h.se) {
|
|
351
351
|
r.h.O |= REACTIVE_SNAPSHOT_STALE;
|
|
352
352
|
continue;
|
|
353
353
|
}
|
|
@@ -359,16 +359,16 @@ function insertSubs(e, t = false) {
|
|
|
359
359
|
r.h.ie = undefined;
|
|
360
360
|
}
|
|
361
361
|
const e = r.h;
|
|
362
|
-
if (e.
|
|
362
|
+
if (e.oe === EFFECT_TRACKED) {
|
|
363
363
|
if (!e.ue) {
|
|
364
364
|
e.ue = true;
|
|
365
365
|
e.ce.enqueue(EFFECT_USER, e.le);
|
|
366
366
|
}
|
|
367
367
|
continue;
|
|
368
368
|
}
|
|
369
|
-
const
|
|
370
|
-
if (
|
|
371
|
-
insertIntoHeap(r.h,
|
|
369
|
+
const s = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
370
|
+
if (s.N > r.h.o) s.N = r.h.o;
|
|
371
|
+
insertIntoHeap(r.h, s);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
function finalizePureQueue(e = null, t = false) {
|
|
@@ -382,7 +382,7 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
382
382
|
if (n.ae !== NOT_PENDING) {
|
|
383
383
|
n.fe = n.ae;
|
|
384
384
|
n.ae = NOT_PENDING;
|
|
385
|
-
if (n.
|
|
385
|
+
if (n.oe && n.oe !== EFFECT_TRACKED) n.ue = true;
|
|
386
386
|
}
|
|
387
387
|
n.Ee &= ~STATUS_UNINITIALIZED;
|
|
388
388
|
if (n.L) GlobalQueue.Y(n, false, true);
|
|
@@ -543,13 +543,13 @@ function assignOrMergeLane(e, t) {
|
|
|
543
543
|
function handleAsync(e, t, n) {
|
|
544
544
|
const i = typeof t === "object" && t !== null;
|
|
545
545
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
546
|
-
const
|
|
547
|
-
if (!
|
|
546
|
+
const s = !r && i && untrack(() => typeof t.then === "function");
|
|
547
|
+
if (!s && !r) {
|
|
548
548
|
e.Ie = null;
|
|
549
549
|
return t;
|
|
550
550
|
}
|
|
551
551
|
e.Ie = t;
|
|
552
|
-
let
|
|
552
|
+
let o;
|
|
553
553
|
const handleError = n => {
|
|
554
554
|
if (e.Ie !== t) return;
|
|
555
555
|
globalQueue.initTransition(e.ne);
|
|
@@ -561,8 +561,8 @@ function handleAsync(e, t, n) {
|
|
|
561
561
|
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
562
562
|
globalQueue.initTransition(e.ne);
|
|
563
563
|
clearStatus(e);
|
|
564
|
-
const
|
|
565
|
-
if (
|
|
564
|
+
const s = resolveLane(e);
|
|
565
|
+
if (s) s.U.delete(e);
|
|
566
566
|
if (n) n(i);
|
|
567
567
|
else if (e._e) {
|
|
568
568
|
const t = e.ae !== NOT_PENDING;
|
|
@@ -572,7 +572,7 @@ function handleAsync(e, t, n) {
|
|
|
572
572
|
insertSubs(e);
|
|
573
573
|
}
|
|
574
574
|
e.J = clock;
|
|
575
|
-
} else if (
|
|
575
|
+
} else if (s) {
|
|
576
576
|
const t = e.fe;
|
|
577
577
|
const n = e.pe;
|
|
578
578
|
if (!n || !n(i, t)) {
|
|
@@ -590,13 +590,13 @@ function handleAsync(e, t, n) {
|
|
|
590
590
|
flush();
|
|
591
591
|
r?.();
|
|
592
592
|
};
|
|
593
|
-
if (
|
|
593
|
+
if (s) {
|
|
594
594
|
let n = false,
|
|
595
595
|
i = true;
|
|
596
596
|
t.then(
|
|
597
597
|
e => {
|
|
598
598
|
if (i) {
|
|
599
|
-
|
|
599
|
+
o = e;
|
|
600
600
|
n = true;
|
|
601
601
|
} else asyncWrite(e);
|
|
602
602
|
},
|
|
@@ -630,7 +630,7 @@ function handleAsync(e, t, n) {
|
|
|
630
630
|
);
|
|
631
631
|
r = false;
|
|
632
632
|
if (t && !e.done) {
|
|
633
|
-
|
|
633
|
+
o = e.value;
|
|
634
634
|
i = true;
|
|
635
635
|
return iterate();
|
|
636
636
|
}
|
|
@@ -642,7 +642,7 @@ function handleAsync(e, t, n) {
|
|
|
642
642
|
throw new NotReadyError(context);
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
|
-
return
|
|
645
|
+
return o;
|
|
646
646
|
}
|
|
647
647
|
function clearStatus(e) {
|
|
648
648
|
e.Ee = e.Ee & STATUS_UNINITIALIZED;
|
|
@@ -653,9 +653,9 @@ function clearStatus(e) {
|
|
|
653
653
|
function notifyStatus(e, t, n, i, r) {
|
|
654
654
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
655
655
|
n = new StatusError(e, n);
|
|
656
|
-
const
|
|
657
|
-
const
|
|
658
|
-
const u =
|
|
656
|
+
const s = n instanceof NotReadyError && n.source === e;
|
|
657
|
+
const o = t === STATUS_PENDING && e._e && !s;
|
|
658
|
+
const u = o && hasActiveOverride(e);
|
|
659
659
|
if (!i) {
|
|
660
660
|
e.Ee = t | (t !== STATUS_ERROR ? e.Ee & STATUS_UNINITIALIZED : 0);
|
|
661
661
|
e.q = n;
|
|
@@ -671,7 +671,7 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
673
|
const c = i || u;
|
|
674
|
-
const l = i ||
|
|
674
|
+
const l = i || o ? undefined : r;
|
|
675
675
|
if (e.Ae) {
|
|
676
676
|
if (c) {
|
|
677
677
|
e.Ae(t, n);
|
|
@@ -701,9 +701,9 @@ function unlinkSubs(e) {
|
|
|
701
701
|
const t = e.V;
|
|
702
702
|
const n = e.D;
|
|
703
703
|
const i = e.p;
|
|
704
|
-
const r = e.
|
|
705
|
-
if (i !== null) i.
|
|
706
|
-
else t.
|
|
704
|
+
const r = e.Pe;
|
|
705
|
+
if (i !== null) i.Pe = r;
|
|
706
|
+
else t.ge = r;
|
|
707
707
|
if (r !== null) r.p = i;
|
|
708
708
|
else {
|
|
709
709
|
t.I = i;
|
|
@@ -735,13 +735,13 @@ function link(e, t) {
|
|
|
735
735
|
return;
|
|
736
736
|
}
|
|
737
737
|
}
|
|
738
|
-
const
|
|
739
|
-
if (
|
|
740
|
-
const
|
|
741
|
-
if (n !== null) n.D =
|
|
742
|
-
else t.C =
|
|
743
|
-
if (
|
|
744
|
-
else e.I =
|
|
738
|
+
const s = e.ge;
|
|
739
|
+
if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
|
|
740
|
+
const o = (t.ye = e.ge = { V: e, h: t, D: i, Pe: s, p: null });
|
|
741
|
+
if (n !== null) n.D = o;
|
|
742
|
+
else t.C = o;
|
|
743
|
+
if (s !== null) s.p = o;
|
|
744
|
+
else e.I = o;
|
|
745
745
|
}
|
|
746
746
|
function isValidLink(e, t) {
|
|
747
747
|
const n = t.ye;
|
|
@@ -780,7 +780,7 @@ function dispose(e) {
|
|
|
780
780
|
function disposeChildren(e, t = false, n) {
|
|
781
781
|
if (e.O & REACTIVE_DISPOSED) return;
|
|
782
782
|
if (t) e.O = REACTIVE_DISPOSED;
|
|
783
|
-
let i = n ? e.
|
|
783
|
+
let i = n ? e.be : e.De;
|
|
784
784
|
while (i) {
|
|
785
785
|
const e = i.ve;
|
|
786
786
|
if (i.C) {
|
|
@@ -797,16 +797,16 @@ function disposeChildren(e, t = false, n) {
|
|
|
797
797
|
i = e;
|
|
798
798
|
}
|
|
799
799
|
if (n) {
|
|
800
|
-
e.
|
|
800
|
+
e.be = null;
|
|
801
801
|
} else {
|
|
802
802
|
e.De = null;
|
|
803
803
|
e.ve = null;
|
|
804
|
-
e.
|
|
804
|
+
e.we = 0;
|
|
805
805
|
}
|
|
806
806
|
runDisposal(e, n);
|
|
807
807
|
}
|
|
808
808
|
function runDisposal(e, t) {
|
|
809
|
-
let n = t ? e.
|
|
809
|
+
let n = t ? e.Ve : e.me;
|
|
810
810
|
if (!n) return;
|
|
811
811
|
if (Array.isArray(n)) {
|
|
812
812
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -816,12 +816,12 @@ function runDisposal(e, t) {
|
|
|
816
816
|
} else {
|
|
817
817
|
n.call(n);
|
|
818
818
|
}
|
|
819
|
-
t ? (e.
|
|
819
|
+
t ? (e.Ve = null) : (e.me = null);
|
|
820
820
|
}
|
|
821
821
|
function childId(e, t) {
|
|
822
822
|
let n = e;
|
|
823
823
|
while (n.Le && n.i) n = n.i;
|
|
824
|
-
if (n.id != null) return formatId(n.id, t ? n.
|
|
824
|
+
if (n.id != null) return formatId(n.id, t ? n.we++ : n.we);
|
|
825
825
|
throw new Error("Cannot get child id from owner without an id");
|
|
826
826
|
}
|
|
827
827
|
function getNextChildId(e) {
|
|
@@ -836,7 +836,7 @@ function formatId(e, t) {
|
|
|
836
836
|
return e + (i ? String.fromCharCode(64 + i) : "") + n;
|
|
837
837
|
}
|
|
838
838
|
function getObserver() {
|
|
839
|
-
if (pendingCheckActive ||
|
|
839
|
+
if (pendingCheckActive || latestReadActive) return PENDING_OWNER;
|
|
840
840
|
return tracking ? context : null;
|
|
841
841
|
}
|
|
842
842
|
function getOwner() {
|
|
@@ -865,9 +865,9 @@ function createOwner(e) {
|
|
|
865
865
|
me: null,
|
|
866
866
|
ce: t?.ce ?? globalQueue,
|
|
867
867
|
ke: t?.ke || defaultContext,
|
|
868
|
-
|
|
868
|
+
we: 0,
|
|
869
|
+
Ve: null,
|
|
869
870
|
be: null,
|
|
870
|
-
we: null,
|
|
871
871
|
i: t,
|
|
872
872
|
dispose(e = true) {
|
|
873
873
|
disposeChildren(i, e);
|
|
@@ -889,46 +889,46 @@ function createRoot(e, t) {
|
|
|
889
889
|
return runWithOwner(n, () => e(n.dispose));
|
|
890
890
|
}
|
|
891
891
|
function effect(e, t, n, i, r) {
|
|
892
|
-
let
|
|
893
|
-
const
|
|
892
|
+
let s = false;
|
|
893
|
+
const o = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
894
894
|
...r,
|
|
895
895
|
equals: () => {
|
|
896
|
-
|
|
897
|
-
if (
|
|
896
|
+
o.ue = !o.q;
|
|
897
|
+
if (s) o.ce.enqueue(o.oe, runEffect.bind(o));
|
|
898
898
|
return false;
|
|
899
899
|
},
|
|
900
900
|
lazy: true
|
|
901
901
|
});
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
const n = e !== undefined ? e :
|
|
909
|
-
const i = t !== undefined ? t :
|
|
902
|
+
o.Ue = i;
|
|
903
|
+
o.We = t;
|
|
904
|
+
o.He = n;
|
|
905
|
+
o.xe = undefined;
|
|
906
|
+
o.oe = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
907
|
+
o.Ae = (e, t) => {
|
|
908
|
+
const n = e !== undefined ? e : o.Ee;
|
|
909
|
+
const i = t !== undefined ? t : o.q;
|
|
910
910
|
if (n & STATUS_ERROR) {
|
|
911
911
|
let e = i;
|
|
912
|
-
|
|
913
|
-
if (
|
|
912
|
+
o.ce.notify(o, STATUS_PENDING, 0);
|
|
913
|
+
if (o.oe === EFFECT_USER) {
|
|
914
914
|
try {
|
|
915
|
-
return
|
|
916
|
-
?
|
|
917
|
-
|
|
918
|
-
|
|
915
|
+
return o.He
|
|
916
|
+
? o.He(e, () => {
|
|
917
|
+
o.xe?.();
|
|
918
|
+
o.xe = undefined;
|
|
919
919
|
})
|
|
920
920
|
: console.error(e);
|
|
921
921
|
} catch (t) {
|
|
922
922
|
e = t;
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
|
-
if (!
|
|
926
|
-
} else if (
|
|
925
|
+
if (!o.ce.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
926
|
+
} else if (o.oe === EFFECT_RENDER) o.ce.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
927
927
|
};
|
|
928
|
-
recompute(
|
|
929
|
-
!r?.defer && (
|
|
930
|
-
|
|
931
|
-
onCleanup(() =>
|
|
928
|
+
recompute(o, true);
|
|
929
|
+
!r?.defer && (o.oe === EFFECT_USER ? o.ce.enqueue(o.oe, runEffect.bind(o)) : runEffect.call(o));
|
|
930
|
+
s = true;
|
|
931
|
+
onCleanup(() => o.xe?.());
|
|
932
932
|
}
|
|
933
933
|
function runEffect() {
|
|
934
934
|
if (!this.ue || this.O & REACTIVE_DISPOSED) return;
|
|
@@ -959,11 +959,11 @@ function trackedEffect(e, t) {
|
|
|
959
959
|
}
|
|
960
960
|
},
|
|
961
961
|
undefined,
|
|
962
|
-
{ ...t, lazy: true
|
|
962
|
+
{ ...t, lazy: true }
|
|
963
963
|
);
|
|
964
964
|
n.xe = undefined;
|
|
965
965
|
n.ue = true;
|
|
966
|
-
n.
|
|
966
|
+
n.oe = EFFECT_TRACKED;
|
|
967
967
|
n.le = run;
|
|
968
968
|
n.ce.enqueue(EFFECT_USER, run);
|
|
969
969
|
onCleanup(() => n.xe?.());
|
|
@@ -975,7 +975,7 @@ let stale = false;
|
|
|
975
975
|
let refreshing = false;
|
|
976
976
|
let pendingCheckActive = false;
|
|
977
977
|
let foundPending = false;
|
|
978
|
-
let
|
|
978
|
+
let latestReadActive = false;
|
|
979
979
|
let context = null;
|
|
980
980
|
let currentOptimisticLane = null;
|
|
981
981
|
let snapshotCaptureActive = false;
|
|
@@ -1008,7 +1008,7 @@ function releaseSubtree(e) {
|
|
|
1008
1008
|
}
|
|
1009
1009
|
if (t.L) {
|
|
1010
1010
|
const e = t;
|
|
1011
|
-
e.
|
|
1011
|
+
e.se = false;
|
|
1012
1012
|
if (e.O & REACTIVE_SNAPSHOT_STALE) {
|
|
1013
1013
|
e.O &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1014
1014
|
e.O |= REACTIVE_DIRTY;
|
|
@@ -1031,7 +1031,7 @@ function clearSnapshots() {
|
|
|
1031
1031
|
snapshotCaptureActive = false;
|
|
1032
1032
|
}
|
|
1033
1033
|
function recompute(e, t = false) {
|
|
1034
|
-
const n = e.
|
|
1034
|
+
const n = e.oe;
|
|
1035
1035
|
if (!t) {
|
|
1036
1036
|
if (e.ne && (!n || activeTransition) && activeTransition !== e.ne)
|
|
1037
1037
|
globalQueue.initTransition(e.ne);
|
|
@@ -1039,17 +1039,17 @@ function recompute(e, t = false) {
|
|
|
1039
1039
|
if (e.ne || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1040
1040
|
else {
|
|
1041
1041
|
markDisposal(e);
|
|
1042
|
-
e.
|
|
1043
|
-
e.
|
|
1042
|
+
e.Ve = e.me;
|
|
1043
|
+
e.be = e.De;
|
|
1044
1044
|
e.me = null;
|
|
1045
1045
|
e.De = null;
|
|
1046
|
-
e.
|
|
1046
|
+
e.we = 0;
|
|
1047
1047
|
}
|
|
1048
1048
|
}
|
|
1049
1049
|
const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1050
1050
|
const r = hasActiveOverride(e);
|
|
1051
|
-
const
|
|
1052
|
-
const
|
|
1051
|
+
const s = !!(e.Ee & STATUS_PENDING);
|
|
1052
|
+
const o = context;
|
|
1053
1053
|
context = e;
|
|
1054
1054
|
e.ye = null;
|
|
1055
1055
|
e.O = REACTIVE_RECOMPUTING_DEPS;
|
|
@@ -1090,30 +1090,30 @@ function recompute(e, t = false) {
|
|
|
1090
1090
|
} finally {
|
|
1091
1091
|
tracking = l;
|
|
1092
1092
|
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1093
|
-
context =
|
|
1093
|
+
context = o;
|
|
1094
1094
|
}
|
|
1095
1095
|
if (!e.q) {
|
|
1096
|
-
const
|
|
1097
|
-
let l =
|
|
1096
|
+
const o = e.ye;
|
|
1097
|
+
let l = o !== null ? o.D : e.C;
|
|
1098
1098
|
if (l !== null) {
|
|
1099
1099
|
do {
|
|
1100
1100
|
l = unlinkSubs(l);
|
|
1101
1101
|
} while (l !== null);
|
|
1102
|
-
if (
|
|
1102
|
+
if (o !== null) o.D = null;
|
|
1103
1103
|
else e.C = null;
|
|
1104
1104
|
}
|
|
1105
1105
|
const a = r ? e.fe : e.ae === NOT_PENDING ? e.fe : e.ae;
|
|
1106
1106
|
const f = !e.pe || !e.pe(a, u);
|
|
1107
1107
|
if (f) {
|
|
1108
|
-
const
|
|
1108
|
+
const o = r ? e.fe : undefined;
|
|
1109
1109
|
if (t || (n && activeTransition !== e.ne) || i) e.fe = u;
|
|
1110
1110
|
else e.ae = u;
|
|
1111
|
-
if (r && !i &&
|
|
1111
|
+
if (r && !i && s) {
|
|
1112
1112
|
const t = e.Oe || 0;
|
|
1113
1113
|
const n = e.Re || 0;
|
|
1114
1114
|
if (t <= n) e.fe = u;
|
|
1115
1115
|
}
|
|
1116
|
-
if (!r || i || e.fe !==
|
|
1116
|
+
if (!r || i || e.fe !== o) {
|
|
1117
1117
|
insertSubs(e, i || r);
|
|
1118
1118
|
}
|
|
1119
1119
|
} else if (r) {
|
|
@@ -1157,7 +1157,7 @@ function computed(e, t, n) {
|
|
|
1157
1157
|
me: null,
|
|
1158
1158
|
ce: context?.ce ?? globalQueue,
|
|
1159
1159
|
ke: context?.ke ?? defaultContext,
|
|
1160
|
-
|
|
1160
|
+
we: 0,
|
|
1161
1161
|
L: e,
|
|
1162
1162
|
fe: t,
|
|
1163
1163
|
o: 0,
|
|
@@ -1167,7 +1167,7 @@ function computed(e, t, n) {
|
|
|
1167
1167
|
C: null,
|
|
1168
1168
|
ye: null,
|
|
1169
1169
|
I: null,
|
|
1170
|
-
|
|
1170
|
+
ge: null,
|
|
1171
1171
|
i: context,
|
|
1172
1172
|
ve: null,
|
|
1173
1173
|
De: null,
|
|
@@ -1175,13 +1175,13 @@ function computed(e, t, n) {
|
|
|
1175
1175
|
Ee: STATUS_UNINITIALIZED,
|
|
1176
1176
|
J: clock,
|
|
1177
1177
|
ae: NOT_PENDING,
|
|
1178
|
+
Ve: null,
|
|
1178
1179
|
be: null,
|
|
1179
|
-
we: null,
|
|
1180
1180
|
Ie: null,
|
|
1181
1181
|
ne: null
|
|
1182
1182
|
};
|
|
1183
1183
|
r.T = r;
|
|
1184
|
-
const
|
|
1184
|
+
const s = context?.t ? context.u : context;
|
|
1185
1185
|
if (context) {
|
|
1186
1186
|
const e = context.De;
|
|
1187
1187
|
if (e === null) {
|
|
@@ -1191,8 +1191,8 @@ function computed(e, t, n) {
|
|
|
1191
1191
|
context.De = r;
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
1194
|
-
if (
|
|
1195
|
-
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.
|
|
1194
|
+
if (s) r.o = s.o + 1;
|
|
1195
|
+
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.se = true;
|
|
1196
1196
|
!n?.lazy && recompute(r, true);
|
|
1197
1197
|
if (snapshotCaptureActive && !n?.lazy) {
|
|
1198
1198
|
if (!(r.Ee & STATUS_PENDING)) {
|
|
@@ -1209,7 +1209,7 @@ function signal(e, t, n = null) {
|
|
|
1209
1209
|
Ne: t?.unobserved,
|
|
1210
1210
|
fe: e,
|
|
1211
1211
|
I: null,
|
|
1212
|
-
|
|
1212
|
+
ge: null,
|
|
1213
1213
|
J: clock,
|
|
1214
1214
|
m: n,
|
|
1215
1215
|
P: n?.A || null,
|
|
@@ -1235,8 +1235,14 @@ function optimisticComputed(e, t, n) {
|
|
|
1235
1235
|
function isEqual(e, t) {
|
|
1236
1236
|
return e === t;
|
|
1237
1237
|
}
|
|
1238
|
+
let strictRead = false;
|
|
1239
|
+
function setStrictRead(e) {
|
|
1240
|
+
const t = strictRead;
|
|
1241
|
+
strictRead = e;
|
|
1242
|
+
return t;
|
|
1243
|
+
}
|
|
1238
1244
|
function untrack(e) {
|
|
1239
|
-
if (!tracking) return e();
|
|
1245
|
+
if (!tracking && true) return e();
|
|
1240
1246
|
tracking = false;
|
|
1241
1247
|
try {
|
|
1242
1248
|
return e();
|
|
@@ -1245,10 +1251,10 @@ function untrack(e) {
|
|
|
1245
1251
|
}
|
|
1246
1252
|
}
|
|
1247
1253
|
function read(e) {
|
|
1248
|
-
if (
|
|
1249
|
-
const t =
|
|
1250
|
-
const n =
|
|
1251
|
-
|
|
1254
|
+
if (latestReadActive) {
|
|
1255
|
+
const t = getLatestValueComputed(e);
|
|
1256
|
+
const n = latestReadActive;
|
|
1257
|
+
latestReadActive = false;
|
|
1252
1258
|
let i;
|
|
1253
1259
|
try {
|
|
1254
1260
|
i = read(t);
|
|
@@ -1256,7 +1262,7 @@ function read(e) {
|
|
|
1256
1262
|
if (!context && t instanceof NotReadyError) return e.fe;
|
|
1257
1263
|
throw t;
|
|
1258
1264
|
} finally {
|
|
1259
|
-
|
|
1265
|
+
latestReadActive = n;
|
|
1260
1266
|
}
|
|
1261
1267
|
if (t.Ee & STATUS_PENDING) return e.fe;
|
|
1262
1268
|
if (stale && currentOptimisticLane && t.ie) {
|
|
@@ -1323,7 +1329,7 @@ function read(e) {
|
|
|
1323
1329
|
return read(e);
|
|
1324
1330
|
} else throw e.q;
|
|
1325
1331
|
}
|
|
1326
|
-
if (snapshotCaptureActive && t && t.
|
|
1332
|
+
if (snapshotCaptureActive && t && t.se) {
|
|
1327
1333
|
const n = e.re;
|
|
1328
1334
|
if (n !== undefined) {
|
|
1329
1335
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
@@ -1433,10 +1439,10 @@ function updatePendingSignal(e) {
|
|
|
1433
1439
|
}
|
|
1434
1440
|
}
|
|
1435
1441
|
}
|
|
1436
|
-
function
|
|
1442
|
+
function getLatestValueComputed(e) {
|
|
1437
1443
|
if (!e.he) {
|
|
1438
|
-
const t =
|
|
1439
|
-
|
|
1444
|
+
const t = latestReadActive;
|
|
1445
|
+
latestReadActive = false;
|
|
1440
1446
|
const n = pendingCheckActive;
|
|
1441
1447
|
pendingCheckActive = false;
|
|
1442
1448
|
const i = context;
|
|
@@ -1445,7 +1451,7 @@ function getPendingValueComputed(e) {
|
|
|
1445
1451
|
e.he.de = e;
|
|
1446
1452
|
context = i;
|
|
1447
1453
|
pendingCheckActive = n;
|
|
1448
|
-
|
|
1454
|
+
latestReadActive = t;
|
|
1449
1455
|
}
|
|
1450
1456
|
return e.he;
|
|
1451
1457
|
}
|
|
@@ -1458,13 +1464,13 @@ function staleValues(e, t = true) {
|
|
|
1458
1464
|
stale = n;
|
|
1459
1465
|
}
|
|
1460
1466
|
}
|
|
1461
|
-
function
|
|
1462
|
-
const t =
|
|
1463
|
-
|
|
1467
|
+
function latest(e) {
|
|
1468
|
+
const t = latestReadActive;
|
|
1469
|
+
latestReadActive = true;
|
|
1464
1470
|
try {
|
|
1465
1471
|
return e();
|
|
1466
1472
|
} finally {
|
|
1467
|
-
|
|
1473
|
+
latestReadActive = t;
|
|
1468
1474
|
}
|
|
1469
1475
|
}
|
|
1470
1476
|
function isPending(e) {
|
|
@@ -1537,13 +1543,13 @@ function action(e) {
|
|
|
1537
1543
|
new Promise((n, i) => {
|
|
1538
1544
|
const r = e(...t);
|
|
1539
1545
|
globalQueue.initTransition();
|
|
1540
|
-
let
|
|
1541
|
-
|
|
1546
|
+
let s = activeTransition;
|
|
1547
|
+
s.ee.push(r);
|
|
1542
1548
|
const done = (e, t) => {
|
|
1543
|
-
|
|
1544
|
-
const
|
|
1545
|
-
if (
|
|
1546
|
-
setActiveTransition(
|
|
1549
|
+
s = currentTransition(s);
|
|
1550
|
+
const o = s.ee.indexOf(r);
|
|
1551
|
+
if (o >= 0) s.ee.splice(o, 1);
|
|
1552
|
+
setActiveTransition(s);
|
|
1547
1553
|
schedule();
|
|
1548
1554
|
t ? i(t) : n(e);
|
|
1549
1555
|
};
|
|
@@ -1555,17 +1561,17 @@ function action(e) {
|
|
|
1555
1561
|
return done(undefined, e);
|
|
1556
1562
|
}
|
|
1557
1563
|
if (n instanceof Promise)
|
|
1558
|
-
return void n.then(run, e => restoreTransition(
|
|
1564
|
+
return void n.then(run, e => restoreTransition(s, () => step(e, true)));
|
|
1559
1565
|
run(n);
|
|
1560
1566
|
};
|
|
1561
1567
|
const run = e => {
|
|
1562
1568
|
if (e.done) return done(e.value);
|
|
1563
1569
|
if (e.value instanceof Promise)
|
|
1564
1570
|
return void e.value.then(
|
|
1565
|
-
e => restoreTransition(
|
|
1566
|
-
e => restoreTransition(
|
|
1571
|
+
e => restoreTransition(s, () => step(e)),
|
|
1572
|
+
e => restoreTransition(s, () => step(e, true))
|
|
1567
1573
|
);
|
|
1568
|
-
restoreTransition(
|
|
1574
|
+
restoreTransition(s, () => step(e.value));
|
|
1569
1575
|
};
|
|
1570
1576
|
step();
|
|
1571
1577
|
});
|
|
@@ -1653,23 +1659,23 @@ function getAllKeys(e, t, n) {
|
|
|
1653
1659
|
function applyState(e, t, n, i) {
|
|
1654
1660
|
const r = t?.[$TARGET];
|
|
1655
1661
|
if (!r) return;
|
|
1656
|
-
const
|
|
1657
|
-
const
|
|
1662
|
+
const s = r[STORE_VALUE];
|
|
1663
|
+
const o = r[STORE_OVERRIDE];
|
|
1658
1664
|
const u = r[STORE_OPTIMISTIC_OVERRIDE];
|
|
1659
1665
|
let c = r[STORE_NODE];
|
|
1660
|
-
if (e ===
|
|
1666
|
+
if (e === s && !o && !u) return;
|
|
1661
1667
|
(r[STORE_LOOKUP] || storeLookup).set(e, r[$PROXY]);
|
|
1662
1668
|
r[STORE_VALUE] = e;
|
|
1663
1669
|
r[STORE_OVERRIDE] = undefined;
|
|
1664
|
-
if (Array.isArray(
|
|
1670
|
+
if (Array.isArray(s)) {
|
|
1665
1671
|
let t = false;
|
|
1666
|
-
const l = getOverrideValue(
|
|
1672
|
+
const l = getOverrideValue(s, o, c, "length", u);
|
|
1667
1673
|
if (e.length && l && e[0] && n(e[0]) != null) {
|
|
1668
1674
|
let a, f, E, T, d, S, R, O;
|
|
1669
1675
|
for (
|
|
1670
1676
|
E = 0, T = Math.min(l, e.length);
|
|
1671
1677
|
E < T &&
|
|
1672
|
-
((S = getOverrideValue(
|
|
1678
|
+
((S = getOverrideValue(s, o, c, E, u)) === e[E] || (S && e[E] && n(S) === n(e[E])));
|
|
1673
1679
|
E++
|
|
1674
1680
|
) {
|
|
1675
1681
|
applyState(e[E], wrap(S, r), n, i);
|
|
@@ -1680,7 +1686,7 @@ function applyState(e, t, n, i) {
|
|
|
1680
1686
|
T = l - 1, d = e.length - 1;
|
|
1681
1687
|
T >= E &&
|
|
1682
1688
|
d >= E &&
|
|
1683
|
-
((S = getOverrideValue(
|
|
1689
|
+
((S = getOverrideValue(s, o, c, T, u)) === e[d] || (S && e[d] && n(S) === n(e[d])));
|
|
1684
1690
|
T--, d--
|
|
1685
1691
|
) {
|
|
1686
1692
|
_[d] = S;
|
|
@@ -1692,9 +1698,9 @@ function applyState(e, t, n, i) {
|
|
|
1692
1698
|
}
|
|
1693
1699
|
for (; f < e.length; f++) {
|
|
1694
1700
|
t = true;
|
|
1695
|
-
const
|
|
1696
|
-
r[STORE_NODE][f] && setSignal(r[STORE_NODE][f],
|
|
1697
|
-
applyState(e[f],
|
|
1701
|
+
const s = wrap(_[f], r);
|
|
1702
|
+
r[STORE_NODE][f] && setSignal(r[STORE_NODE][f], s);
|
|
1703
|
+
applyState(e[f], s, n, i);
|
|
1698
1704
|
}
|
|
1699
1705
|
t && r[STORE_NODE][$TRACK] && setSignal(r[STORE_NODE][$TRACK], void 0);
|
|
1700
1706
|
l !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
|
|
@@ -1709,7 +1715,7 @@ function applyState(e, t, n, i) {
|
|
|
1709
1715
|
I.set(O, f);
|
|
1710
1716
|
}
|
|
1711
1717
|
for (a = E; a <= T; a++) {
|
|
1712
|
-
S = getOverrideValue(
|
|
1718
|
+
S = getOverrideValue(s, o, c, a, u);
|
|
1713
1719
|
O = S ? n(S) : S;
|
|
1714
1720
|
f = I.get(O);
|
|
1715
1721
|
if (f !== undefined && f !== -1) {
|
|
@@ -1728,7 +1734,7 @@ function applyState(e, t, n, i) {
|
|
|
1728
1734
|
if (E < e.length) t = true;
|
|
1729
1735
|
} else if (e.length) {
|
|
1730
1736
|
for (let t = 0, l = e.length; t < l; t++) {
|
|
1731
|
-
const l = getOverrideValue(
|
|
1737
|
+
const l = getOverrideValue(s, o, c, t, u);
|
|
1732
1738
|
isWrappable(l)
|
|
1733
1739
|
? applyState(e[t], wrap(l, r), n, i)
|
|
1734
1740
|
: r[STORE_NODE][t] && setSignal(r[STORE_NODE][t], e[t]);
|
|
@@ -1743,11 +1749,11 @@ function applyState(e, t, n, i) {
|
|
|
1743
1749
|
}
|
|
1744
1750
|
if (c) {
|
|
1745
1751
|
const t = c[$TRACK];
|
|
1746
|
-
const l = t || i ? getAllKeys(
|
|
1752
|
+
const l = t || i ? getAllKeys(s, o, e) : Object.keys(c);
|
|
1747
1753
|
for (let a = 0, f = l.length; a < f; a++) {
|
|
1748
1754
|
const f = l[a];
|
|
1749
1755
|
const E = c[f];
|
|
1750
|
-
const T = unwrap(getOverrideValue(
|
|
1756
|
+
const T = unwrap(getOverrideValue(s, o, c, f, u));
|
|
1751
1757
|
let d = unwrap(e[f]);
|
|
1752
1758
|
if (T === d) continue;
|
|
1753
1759
|
if (!T || !isWrappable(T) || !isWrappable(d) || (n(T) != null && n(T) !== n(d))) {
|
|
@@ -1768,8 +1774,8 @@ function reconcile(e, t, n = false) {
|
|
|
1768
1774
|
return i => {
|
|
1769
1775
|
if (i == null) throw new Error("Cannot reconcile null or undefined state");
|
|
1770
1776
|
const r = typeof t === "string" ? e => e[t] : t;
|
|
1771
|
-
const
|
|
1772
|
-
if (
|
|
1777
|
+
const s = r(i);
|
|
1778
|
+
if (s !== undefined && r(e) !== r(i))
|
|
1773
1779
|
throw new Error("Cannot reconcile states with different identity");
|
|
1774
1780
|
applyState(e, i, r, n);
|
|
1775
1781
|
};
|
|
@@ -1794,19 +1800,19 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1794
1800
|
r.set(e, t);
|
|
1795
1801
|
return t;
|
|
1796
1802
|
};
|
|
1797
|
-
const
|
|
1803
|
+
const s = wrapProjection(t);
|
|
1798
1804
|
i = computed(() => {
|
|
1799
1805
|
const t = getOwner();
|
|
1800
|
-
storeSetter(new Proxy(
|
|
1806
|
+
storeSetter(new Proxy(s, writeTraps), i => {
|
|
1801
1807
|
const r = handleAsync(t, e(i), e => {
|
|
1802
|
-
e !== i && e !== undefined && storeSetter(
|
|
1808
|
+
e !== i && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
|
|
1803
1809
|
setSignal(t, undefined);
|
|
1804
1810
|
});
|
|
1805
|
-
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(
|
|
1811
|
+
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(s);
|
|
1806
1812
|
});
|
|
1807
1813
|
});
|
|
1808
1814
|
i.Ce = true;
|
|
1809
|
-
return { store:
|
|
1815
|
+
return { store: s, node: i };
|
|
1810
1816
|
}
|
|
1811
1817
|
function createProjection(e, t = {}, n) {
|
|
1812
1818
|
return createProjectionInternal(e, t, n).store;
|
|
@@ -1893,7 +1899,7 @@ function getNodes(e, t) {
|
|
|
1893
1899
|
if (!n) e[t] = n = Object.create(null);
|
|
1894
1900
|
return n;
|
|
1895
1901
|
}
|
|
1896
|
-
function getNode(e, t, n, i, r = isEqual,
|
|
1902
|
+
function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
1897
1903
|
if (e[t]) return e[t];
|
|
1898
1904
|
const u = signal(
|
|
1899
1905
|
n,
|
|
@@ -1905,9 +1911,9 @@ function getNode(e, t, n, i, r = isEqual, o, s) {
|
|
|
1905
1911
|
},
|
|
1906
1912
|
i
|
|
1907
1913
|
);
|
|
1908
|
-
if (
|
|
1909
|
-
if (
|
|
1910
|
-
const e =
|
|
1914
|
+
if (s) u._e = true;
|
|
1915
|
+
if (o && t in o) {
|
|
1916
|
+
const e = o[t];
|
|
1911
1917
|
u.re = e === undefined ? NO_SNAPSHOT : e;
|
|
1912
1918
|
snapshotSources?.add(u);
|
|
1913
1919
|
}
|
|
@@ -1923,8 +1929,8 @@ function getKeys(e, t, n = true) {
|
|
|
1923
1929
|
const i = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
|
|
1924
1930
|
if (!t) return i;
|
|
1925
1931
|
const r = new Set(i);
|
|
1926
|
-
const
|
|
1927
|
-
for (const e of
|
|
1932
|
+
const s = Reflect.ownKeys(t);
|
|
1933
|
+
for (const e of s) {
|
|
1928
1934
|
if (t[e] !== $DELETED) r.add(e);
|
|
1929
1935
|
else r.delete(e);
|
|
1930
1936
|
}
|
|
@@ -1950,10 +1956,10 @@ const storeTraps = {
|
|
|
1950
1956
|
}
|
|
1951
1957
|
const i = getNodes(e, STORE_NODE);
|
|
1952
1958
|
const r = i[t];
|
|
1953
|
-
const
|
|
1954
|
-
const
|
|
1959
|
+
const s = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
|
|
1960
|
+
const o = s || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
|
|
1955
1961
|
const u = !!e[STORE_VALUE][$TARGET];
|
|
1956
|
-
const c =
|
|
1962
|
+
const c = s
|
|
1957
1963
|
? e[STORE_OPTIMISTIC_OVERRIDE]
|
|
1958
1964
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
1959
1965
|
? e[STORE_OVERRIDE]
|
|
@@ -1963,17 +1969,17 @@ const storeTraps = {
|
|
|
1963
1969
|
if (e && e.get) return e.get.call(n);
|
|
1964
1970
|
}
|
|
1965
1971
|
if (writeOnly(n)) {
|
|
1966
|
-
let n = r && (
|
|
1972
|
+
let n = r && (o || !u) ? (r.ae !== NOT_PENDING ? (r._e ? r.fe : r.ae) : r.fe) : c[t];
|
|
1967
1973
|
n === $DELETED && (n = undefined);
|
|
1968
1974
|
if (!isWrappable(n)) return n;
|
|
1969
1975
|
const i = wrap(n, e);
|
|
1970
1976
|
Writing?.add(i);
|
|
1971
1977
|
return i;
|
|
1972
1978
|
}
|
|
1973
|
-
let l = r ? (
|
|
1979
|
+
let l = r ? (o || !u ? read(i[t]) : (read(i[t]), c[t])) : c[t];
|
|
1974
1980
|
l === $DELETED && (l = undefined);
|
|
1975
1981
|
if (!r) {
|
|
1976
|
-
if (!
|
|
1982
|
+
if (!o && typeof l === "function" && !c.hasOwnProperty(t)) {
|
|
1977
1983
|
let t;
|
|
1978
1984
|
return !Array.isArray(e[STORE_VALUE]) &&
|
|
1979
1985
|
(t = Object.getPrototypeOf(e[STORE_VALUE])) &&
|
|
@@ -2019,29 +2025,29 @@ const storeTraps = {
|
|
|
2019
2025
|
}
|
|
2020
2026
|
untrack(() => {
|
|
2021
2027
|
const r = e[STORE_VALUE];
|
|
2022
|
-
const
|
|
2028
|
+
const s = r[t];
|
|
2023
2029
|
if (snapshotCaptureActive && typeof t !== "symbol") {
|
|
2024
2030
|
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2025
2031
|
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
2026
2032
|
snapshotSources?.add(e);
|
|
2027
2033
|
}
|
|
2028
2034
|
if (!(t in e[STORE_SNAPSHOT_PROPS])) {
|
|
2029
|
-
e[STORE_SNAPSHOT_PROPS][t] =
|
|
2035
|
+
e[STORE_SNAPSHOT_PROPS][t] = s;
|
|
2030
2036
|
}
|
|
2031
2037
|
}
|
|
2032
|
-
const
|
|
2033
|
-
const u =
|
|
2034
|
-
if (
|
|
2038
|
+
const o = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
2039
|
+
const u = o ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
2040
|
+
if (o) trackOptimisticStore(i);
|
|
2035
2041
|
const c =
|
|
2036
2042
|
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2037
2043
|
? e[STORE_OPTIMISTIC_OVERRIDE][t]
|
|
2038
2044
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2039
2045
|
? e[STORE_OVERRIDE][t]
|
|
2040
|
-
:
|
|
2046
|
+
: s;
|
|
2041
2047
|
const l = n?.[$TARGET]?.[STORE_VALUE] ?? n;
|
|
2042
2048
|
if (c === l) return true;
|
|
2043
2049
|
const a = e[STORE_OPTIMISTIC_OVERRIDE]?.length || e[STORE_OVERRIDE]?.length || r.length;
|
|
2044
|
-
if (l !== undefined && l ===
|
|
2050
|
+
if (l !== undefined && l === s) delete e[u][t];
|
|
2045
2051
|
else (e[u] || (e[u] = Object.create(null)))[t] = l;
|
|
2046
2052
|
const f = isWrappable(l);
|
|
2047
2053
|
if (isWrappable(c)) {
|
|
@@ -2089,9 +2095,9 @@ const storeTraps = {
|
|
|
2089
2095
|
t && (t instanceof Set ? t.delete(e) : PARENTS.delete(r));
|
|
2090
2096
|
}
|
|
2091
2097
|
if (e[STORE_HAS]?.[t]) setSignal(e[STORE_HAS][t], false);
|
|
2092
|
-
const
|
|
2093
|
-
|
|
2094
|
-
|
|
2098
|
+
const s = getNodes(e, STORE_NODE);
|
|
2099
|
+
s[t] && setSignal(s[t], undefined);
|
|
2100
|
+
s[$TRACK] && setSignal(s[$TRACK], undefined);
|
|
2095
2101
|
});
|
|
2096
2102
|
}
|
|
2097
2103
|
return true;
|
|
@@ -2202,8 +2208,8 @@ function recursivelyAddParent(e, t) {
|
|
|
2202
2208
|
const t = getKeys(e, n);
|
|
2203
2209
|
for (let i = 0; i < t.length; i++) {
|
|
2204
2210
|
const r = t[i];
|
|
2205
|
-
const
|
|
2206
|
-
isWrappable(
|
|
2211
|
+
const s = n && r in n ? n[r] : e[r];
|
|
2212
|
+
isWrappable(s) && recursivelyAddParent(s, e);
|
|
2207
2213
|
}
|
|
2208
2214
|
}
|
|
2209
2215
|
}
|
|
@@ -2215,9 +2221,9 @@ function createOptimisticStore(e, t, n) {
|
|
|
2215
2221
|
GlobalQueue.B ||= clearOptimisticStore;
|
|
2216
2222
|
const i = typeof e === "function";
|
|
2217
2223
|
const r = (i ? t : e) ?? {};
|
|
2218
|
-
const
|
|
2219
|
-
const { store:
|
|
2220
|
-
return [
|
|
2224
|
+
const s = i ? e : undefined;
|
|
2225
|
+
const { store: o } = createOptimisticProjectionInternal(s, r, n);
|
|
2226
|
+
return [o, e => storeSetter(o, e)];
|
|
2221
2227
|
}
|
|
2222
2228
|
function clearOptimisticStore(e) {
|
|
2223
2229
|
const t = e[$TARGET];
|
|
@@ -2267,22 +2273,22 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2267
2273
|
r.set(e, t);
|
|
2268
2274
|
return t;
|
|
2269
2275
|
};
|
|
2270
|
-
const
|
|
2276
|
+
const s = wrapProjection(t);
|
|
2271
2277
|
if (e) {
|
|
2272
2278
|
i = computed(() => {
|
|
2273
2279
|
const t = getOwner();
|
|
2274
2280
|
setProjectionWriteActive(true);
|
|
2275
2281
|
try {
|
|
2276
|
-
storeSetter(new Proxy(
|
|
2282
|
+
storeSetter(new Proxy(s, writeTraps), i => {
|
|
2277
2283
|
const r = handleAsync(t, e(i), e => {
|
|
2278
2284
|
setProjectionWriteActive(true);
|
|
2279
2285
|
try {
|
|
2280
|
-
e !== i && e !== undefined && storeSetter(
|
|
2286
|
+
e !== i && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
|
|
2281
2287
|
} finally {
|
|
2282
2288
|
setProjectionWriteActive(false);
|
|
2283
2289
|
}
|
|
2284
2290
|
});
|
|
2285
|
-
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(
|
|
2291
|
+
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(s);
|
|
2286
2292
|
});
|
|
2287
2293
|
} finally {
|
|
2288
2294
|
setProjectionWriteActive(false);
|
|
@@ -2290,19 +2296,81 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2290
2296
|
});
|
|
2291
2297
|
i.Ce = true;
|
|
2292
2298
|
}
|
|
2293
|
-
return { store:
|
|
2299
|
+
return { store: s, node: i };
|
|
2300
|
+
}
|
|
2301
|
+
const DELETE = Symbol(0);
|
|
2302
|
+
function updatePath(e, t, n = 0) {
|
|
2303
|
+
let i,
|
|
2304
|
+
r = e;
|
|
2305
|
+
if (n < t.length - 1) {
|
|
2306
|
+
i = t[n];
|
|
2307
|
+
const s = typeof i;
|
|
2308
|
+
const o = Array.isArray(e);
|
|
2309
|
+
if (Array.isArray(i)) {
|
|
2310
|
+
for (let r = 0; r < i.length; r++) {
|
|
2311
|
+
t[n] = i[r];
|
|
2312
|
+
updatePath(e, t, n);
|
|
2313
|
+
}
|
|
2314
|
+
t[n] = i;
|
|
2315
|
+
return;
|
|
2316
|
+
} else if (o && s === "function") {
|
|
2317
|
+
for (let r = 0; r < e.length; r++) {
|
|
2318
|
+
if (i(e[r], r)) {
|
|
2319
|
+
t[n] = r;
|
|
2320
|
+
updatePath(e, t, n);
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
t[n] = i;
|
|
2324
|
+
return;
|
|
2325
|
+
} else if (o && s === "object") {
|
|
2326
|
+
const { from: r = 0, to: s = e.length - 1, by: o = 1 } = i;
|
|
2327
|
+
for (let i = r; i <= s; i += o) {
|
|
2328
|
+
t[n] = i;
|
|
2329
|
+
updatePath(e, t, n);
|
|
2330
|
+
}
|
|
2331
|
+
t[n] = i;
|
|
2332
|
+
return;
|
|
2333
|
+
} else if (n < t.length - 2) {
|
|
2334
|
+
updatePath(e[i], t, n + 1);
|
|
2335
|
+
return;
|
|
2336
|
+
}
|
|
2337
|
+
r = e[i];
|
|
2338
|
+
}
|
|
2339
|
+
let s = t[t.length - 1];
|
|
2340
|
+
if (typeof s === "function") {
|
|
2341
|
+
s = s(r);
|
|
2342
|
+
if (s === r) return;
|
|
2343
|
+
}
|
|
2344
|
+
if (i === undefined && s == undefined) return;
|
|
2345
|
+
if (s === DELETE) {
|
|
2346
|
+
delete e[i];
|
|
2347
|
+
} else if (i === undefined || (isWrappable(r) && isWrappable(s) && !Array.isArray(s))) {
|
|
2348
|
+
const t = i !== undefined ? e[i] : e;
|
|
2349
|
+
const n = Object.keys(s);
|
|
2350
|
+
for (let e = 0; e < n.length; e++) t[n[e]] = s[n[e]];
|
|
2351
|
+
} else {
|
|
2352
|
+
e[i] = s;
|
|
2353
|
+
}
|
|
2294
2354
|
}
|
|
2355
|
+
const storePath = Object.assign(
|
|
2356
|
+
function storePath(...e) {
|
|
2357
|
+
return t => {
|
|
2358
|
+
updatePath(t, e);
|
|
2359
|
+
};
|
|
2360
|
+
},
|
|
2361
|
+
{ DELETE: DELETE }
|
|
2362
|
+
);
|
|
2295
2363
|
function snapshot(e, t, n) {
|
|
2296
|
-
let i, r,
|
|
2364
|
+
let i, r, s, o, u, c;
|
|
2297
2365
|
if (!isWrappable(e)) return e;
|
|
2298
2366
|
if (t && t.has(e)) return t.get(e);
|
|
2299
2367
|
if (!t) t = new Map();
|
|
2300
2368
|
if ((i = e[$TARGET] || n?.get(e)?.[$TARGET])) {
|
|
2301
|
-
|
|
2369
|
+
s = i[STORE_OVERRIDE];
|
|
2302
2370
|
r = Array.isArray(i[STORE_VALUE]);
|
|
2303
2371
|
t.set(
|
|
2304
2372
|
e,
|
|
2305
|
-
|
|
2373
|
+
s ? (o = r ? [] : Object.create(Object.getPrototypeOf(i[STORE_VALUE]))) : i[STORE_VALUE]
|
|
2306
2374
|
);
|
|
2307
2375
|
e = i[STORE_VALUE];
|
|
2308
2376
|
n = storeLookup;
|
|
@@ -2311,32 +2379,32 @@ function snapshot(e, t, n) {
|
|
|
2311
2379
|
t.set(e, e);
|
|
2312
2380
|
}
|
|
2313
2381
|
if (r) {
|
|
2314
|
-
const i =
|
|
2382
|
+
const i = s?.length || e.length;
|
|
2315
2383
|
for (let r = 0; r < i; r++) {
|
|
2316
|
-
c =
|
|
2384
|
+
c = s && r in s ? s[r] : e[r];
|
|
2317
2385
|
if (c === $DELETED) continue;
|
|
2318
|
-
if ((u = snapshot(c, t, n)) !== c ||
|
|
2319
|
-
if (!
|
|
2320
|
-
|
|
2386
|
+
if ((u = snapshot(c, t, n)) !== c || o) {
|
|
2387
|
+
if (!o) t.set(e, (o = [...e]));
|
|
2388
|
+
o[r] = u;
|
|
2321
2389
|
}
|
|
2322
2390
|
}
|
|
2323
2391
|
} else {
|
|
2324
|
-
const i = getKeys(e,
|
|
2392
|
+
const i = getKeys(e, s);
|
|
2325
2393
|
for (let r = 0, l = i.length; r < l; r++) {
|
|
2326
2394
|
let l = i[r];
|
|
2327
|
-
const a = getPropertyDescriptor(e,
|
|
2395
|
+
const a = getPropertyDescriptor(e, s, l);
|
|
2328
2396
|
if (a.get) continue;
|
|
2329
|
-
c =
|
|
2330
|
-
if ((u = snapshot(c, t, n)) !== e[l] ||
|
|
2331
|
-
if (!
|
|
2332
|
-
|
|
2333
|
-
Object.assign(
|
|
2397
|
+
c = s && l in s ? s[l] : e[l];
|
|
2398
|
+
if ((u = snapshot(c, t, n)) !== e[l] || o) {
|
|
2399
|
+
if (!o) {
|
|
2400
|
+
o = Object.create(Object.getPrototypeOf(e));
|
|
2401
|
+
Object.assign(o, e);
|
|
2334
2402
|
}
|
|
2335
|
-
|
|
2403
|
+
o[l] = u;
|
|
2336
2404
|
}
|
|
2337
2405
|
}
|
|
2338
2406
|
}
|
|
2339
|
-
return
|
|
2407
|
+
return o || e;
|
|
2340
2408
|
}
|
|
2341
2409
|
function trueFn() {
|
|
2342
2410
|
return true;
|
|
@@ -2378,8 +2446,8 @@ function merge(...e) {
|
|
|
2378
2446
|
for (let i = 0; i < e.length; i++) {
|
|
2379
2447
|
const r = e[i];
|
|
2380
2448
|
t = t || (!!r && $PROXY in r);
|
|
2381
|
-
const
|
|
2382
|
-
if (
|
|
2449
|
+
const s = !!r && r[$SOURCES];
|
|
2450
|
+
if (s) n.push(...s);
|
|
2383
2451
|
else n.push(typeof r === "function" ? ((t = true), createMemo(r)) : r);
|
|
2384
2452
|
}
|
|
2385
2453
|
if (SUPPORTS_PROXY && t) {
|
|
@@ -2409,35 +2477,35 @@ function merge(...e) {
|
|
|
2409
2477
|
}
|
|
2410
2478
|
const i = Object.create(null);
|
|
2411
2479
|
let r = false;
|
|
2412
|
-
let
|
|
2413
|
-
for (let e =
|
|
2480
|
+
let s = n.length - 1;
|
|
2481
|
+
for (let e = s; e >= 0; e--) {
|
|
2414
2482
|
const t = n[e];
|
|
2415
2483
|
if (!t) {
|
|
2416
|
-
e ===
|
|
2484
|
+
e === s && s--;
|
|
2417
2485
|
continue;
|
|
2418
2486
|
}
|
|
2419
|
-
const
|
|
2420
|
-
for (let n =
|
|
2421
|
-
const u =
|
|
2487
|
+
const o = Object.getOwnPropertyNames(t);
|
|
2488
|
+
for (let n = o.length - 1; n >= 0; n--) {
|
|
2489
|
+
const u = o[n];
|
|
2422
2490
|
if (u === "__proto__" || u === "constructor") continue;
|
|
2423
2491
|
if (!i[u]) {
|
|
2424
|
-
r = r || e !==
|
|
2492
|
+
r = r || e !== s;
|
|
2425
2493
|
const n = Object.getOwnPropertyDescriptor(t, u);
|
|
2426
2494
|
i[u] = n.get ? { enumerable: true, configurable: true, get: n.get.bind(t) } : n;
|
|
2427
2495
|
}
|
|
2428
2496
|
}
|
|
2429
2497
|
}
|
|
2430
|
-
if (!r) return n[
|
|
2431
|
-
const
|
|
2498
|
+
if (!r) return n[s];
|
|
2499
|
+
const o = {};
|
|
2432
2500
|
const u = Object.keys(i);
|
|
2433
2501
|
for (let e = u.length - 1; e >= 0; e--) {
|
|
2434
2502
|
const t = u[e],
|
|
2435
2503
|
n = i[t];
|
|
2436
|
-
if (n.get) Object.defineProperty(
|
|
2437
|
-
else
|
|
2504
|
+
if (n.get) Object.defineProperty(o, t, n);
|
|
2505
|
+
else o[t] = n.value;
|
|
2438
2506
|
}
|
|
2439
|
-
|
|
2440
|
-
return
|
|
2507
|
+
o[$SOURCES] = n;
|
|
2508
|
+
return o;
|
|
2441
2509
|
}
|
|
2442
2510
|
function omit(e, ...t) {
|
|
2443
2511
|
const n = new Set(t);
|
|
@@ -2470,18 +2538,20 @@ function omit(e, ...t) {
|
|
|
2470
2538
|
}
|
|
2471
2539
|
function mapArray(e, t, n) {
|
|
2472
2540
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2541
|
+
const r = t.length > 1;
|
|
2542
|
+
const s = t;
|
|
2473
2543
|
return createMemo(
|
|
2474
2544
|
updateKeyedMap.bind({
|
|
2475
2545
|
Fe: createOwner(),
|
|
2476
2546
|
$e: 0,
|
|
2477
2547
|
je: e,
|
|
2478
2548
|
Ke: [],
|
|
2479
|
-
Ye:
|
|
2549
|
+
Ye: s,
|
|
2480
2550
|
Be: [],
|
|
2481
2551
|
Xe: [],
|
|
2482
2552
|
qe: i,
|
|
2483
2553
|
ze: i || n?.keyed === false ? [] : undefined,
|
|
2484
|
-
Ze:
|
|
2554
|
+
Ze: r ? [] : undefined,
|
|
2485
2555
|
Je: n?.fallback
|
|
2486
2556
|
})
|
|
2487
2557
|
);
|
|
@@ -2535,8 +2605,8 @@ function updateKeyedMap() {
|
|
|
2535
2605
|
}
|
|
2536
2606
|
this.$e = t;
|
|
2537
2607
|
} else {
|
|
2538
|
-
let
|
|
2539
|
-
|
|
2608
|
+
let s,
|
|
2609
|
+
o,
|
|
2540
2610
|
u,
|
|
2541
2611
|
c,
|
|
2542
2612
|
l,
|
|
@@ -2547,34 +2617,34 @@ function updateKeyedMap() {
|
|
|
2547
2617
|
d = this.ze ? new Array(t) : undefined,
|
|
2548
2618
|
S = this.Ze ? new Array(t) : undefined;
|
|
2549
2619
|
for (
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2620
|
+
s = 0, o = Math.min(this.$e, t);
|
|
2621
|
+
s < o && (this.Ke[s] === e[s] || (this.ze && compare(this.qe, this.Ke[s], e[s])));
|
|
2622
|
+
s++
|
|
2553
2623
|
) {
|
|
2554
|
-
if (this.ze) setSignal(this.ze[
|
|
2624
|
+
if (this.ze) setSignal(this.ze[s], e[s]);
|
|
2555
2625
|
}
|
|
2556
2626
|
for (
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
u >=
|
|
2560
|
-
(this.Ke[
|
|
2561
|
-
|
|
2627
|
+
o = this.$e - 1, u = t - 1;
|
|
2628
|
+
o >= s &&
|
|
2629
|
+
u >= s &&
|
|
2630
|
+
(this.Ke[o] === e[u] || (this.ze && compare(this.qe, this.Ke[o], e[u])));
|
|
2631
|
+
o--, u--
|
|
2562
2632
|
) {
|
|
2563
|
-
E[u] = this.Be[
|
|
2564
|
-
T[u] = this.Xe[
|
|
2565
|
-
d && (d[u] = this.ze[
|
|
2566
|
-
S && (S[u] = this.Ze[
|
|
2633
|
+
E[u] = this.Be[o];
|
|
2634
|
+
T[u] = this.Xe[o];
|
|
2635
|
+
d && (d[u] = this.ze[o]);
|
|
2636
|
+
S && (S[u] = this.Ze[o]);
|
|
2567
2637
|
}
|
|
2568
2638
|
a = new Map();
|
|
2569
2639
|
f = new Array(u + 1);
|
|
2570
|
-
for (i = u; i >=
|
|
2640
|
+
for (i = u; i >= s; i--) {
|
|
2571
2641
|
c = e[i];
|
|
2572
2642
|
l = this.qe ? this.qe(c) : c;
|
|
2573
2643
|
n = a.get(l);
|
|
2574
2644
|
f[i] = n === undefined ? -1 : n;
|
|
2575
2645
|
a.set(l, i);
|
|
2576
2646
|
}
|
|
2577
|
-
for (n =
|
|
2647
|
+
for (n = s; n <= o; n++) {
|
|
2578
2648
|
c = this.Ke[n];
|
|
2579
2649
|
l = this.qe ? this.qe(c) : c;
|
|
2580
2650
|
i = a.get(l);
|
|
@@ -2587,7 +2657,7 @@ function updateKeyedMap() {
|
|
|
2587
2657
|
a.set(l, i);
|
|
2588
2658
|
} else this.Xe[n].dispose();
|
|
2589
2659
|
}
|
|
2590
|
-
for (i =
|
|
2660
|
+
for (i = s; i < t; i++) {
|
|
2591
2661
|
if (i in E) {
|
|
2592
2662
|
this.Be[i] = E[i];
|
|
2593
2663
|
this.Xe[i] = T[i];
|
|
@@ -2610,12 +2680,13 @@ function updateKeyedMap() {
|
|
|
2610
2680
|
return this.Be;
|
|
2611
2681
|
}
|
|
2612
2682
|
function repeat(e, t, n) {
|
|
2683
|
+
const i = t;
|
|
2613
2684
|
return updateRepeat.bind({
|
|
2614
2685
|
Fe: createOwner(),
|
|
2615
2686
|
$e: 0,
|
|
2616
2687
|
et: 0,
|
|
2617
2688
|
tt: e,
|
|
2618
|
-
Ye:
|
|
2689
|
+
Ye: i,
|
|
2619
2690
|
Xe: [],
|
|
2620
2691
|
Be: [],
|
|
2621
2692
|
nt: n?.from,
|
|
@@ -2696,15 +2767,15 @@ function createBoundChildren(e, t, n, i) {
|
|
|
2696
2767
|
}
|
|
2697
2768
|
class CollectionQueue extends Queue {
|
|
2698
2769
|
rt;
|
|
2699
|
-
|
|
2700
|
-
|
|
2770
|
+
st = new Set();
|
|
2771
|
+
ot = signal(false, { pureWrite: true });
|
|
2701
2772
|
ut = false;
|
|
2702
2773
|
constructor(e) {
|
|
2703
2774
|
super();
|
|
2704
2775
|
this.rt = e;
|
|
2705
2776
|
}
|
|
2706
2777
|
run(e) {
|
|
2707
|
-
if (!e || read(this.
|
|
2778
|
+
if (!e || read(this.ot)) return;
|
|
2708
2779
|
return super.run(e);
|
|
2709
2780
|
}
|
|
2710
2781
|
notify(e, t, n, i) {
|
|
@@ -2712,46 +2783,46 @@ class CollectionQueue extends Queue {
|
|
|
2712
2783
|
if (n & this.rt) {
|
|
2713
2784
|
const t = i?.source || e.q?.source;
|
|
2714
2785
|
if (t) {
|
|
2715
|
-
const e = this.
|
|
2716
|
-
this.
|
|
2717
|
-
if (e) setSignal(this.
|
|
2786
|
+
const e = this.st.size === 0;
|
|
2787
|
+
this.st.add(t);
|
|
2788
|
+
if (e) setSignal(this.ot, true);
|
|
2718
2789
|
}
|
|
2719
2790
|
}
|
|
2720
2791
|
t &= ~this.rt;
|
|
2721
2792
|
return t ? super.notify(e, t, n, i) : true;
|
|
2722
2793
|
}
|
|
2723
2794
|
checkSources() {
|
|
2724
|
-
for (const e of this.
|
|
2725
|
-
if (!(e.Ee & this.rt)) this.
|
|
2795
|
+
for (const e of this.st) {
|
|
2796
|
+
if (!(e.Ee & this.rt)) this.st.delete(e);
|
|
2726
2797
|
}
|
|
2727
|
-
if (!this.
|
|
2798
|
+
if (!this.st.size) setSignal(this.ot, false);
|
|
2728
2799
|
}
|
|
2729
2800
|
}
|
|
2730
2801
|
function createCollectionBoundary(e, t, n) {
|
|
2731
2802
|
const i = createOwner();
|
|
2732
2803
|
const r = new CollectionQueue(e);
|
|
2733
|
-
const
|
|
2734
|
-
const
|
|
2735
|
-
if (!read(r.
|
|
2736
|
-
const e = read(
|
|
2737
|
-
if (!untrack(() => read(r.
|
|
2804
|
+
const s = createBoundChildren(i, t, r, e);
|
|
2805
|
+
const o = computed(() => {
|
|
2806
|
+
if (!read(r.ot)) {
|
|
2807
|
+
const e = read(s);
|
|
2808
|
+
if (!untrack(() => read(r.ot))) {
|
|
2738
2809
|
r.ut = true;
|
|
2739
2810
|
return e;
|
|
2740
2811
|
}
|
|
2741
2812
|
}
|
|
2742
2813
|
return n(r);
|
|
2743
2814
|
});
|
|
2744
|
-
return read.bind(null,
|
|
2815
|
+
return read.bind(null, o);
|
|
2745
2816
|
}
|
|
2746
2817
|
function createLoadBoundary(e, t) {
|
|
2747
2818
|
return createCollectionBoundary(STATUS_PENDING, e, () => t());
|
|
2748
2819
|
}
|
|
2749
2820
|
function createErrorBoundary(e, t) {
|
|
2750
2821
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2751
|
-
let n = e.
|
|
2822
|
+
let n = e.st.values().next().value;
|
|
2752
2823
|
const i = n.q?.cause ?? n.q;
|
|
2753
2824
|
return t(i, () => {
|
|
2754
|
-
for (const t of e.
|
|
2825
|
+
for (const t of e.st) recompute(t);
|
|
2755
2826
|
schedule();
|
|
2756
2827
|
});
|
|
2757
2828
|
});
|
|
@@ -2780,9 +2851,9 @@ function flatten(e, t) {
|
|
|
2780
2851
|
function flattenArray(e, t = [], n) {
|
|
2781
2852
|
let i = null;
|
|
2782
2853
|
let r = false;
|
|
2783
|
-
for (let
|
|
2854
|
+
for (let s = 0; s < e.length; s++) {
|
|
2784
2855
|
try {
|
|
2785
|
-
let i = e[
|
|
2856
|
+
let i = e[s];
|
|
2786
2857
|
if (typeof i === "function" && !i.length) {
|
|
2787
2858
|
if (n?.doNotUnwrap) {
|
|
2788
2859
|
t.push(i);
|
|
@@ -2842,6 +2913,7 @@ export {
|
|
|
2842
2913
|
isPending,
|
|
2843
2914
|
isRefreshing,
|
|
2844
2915
|
isWrappable,
|
|
2916
|
+
latest,
|
|
2845
2917
|
mapArray,
|
|
2846
2918
|
markSnapshotScope,
|
|
2847
2919
|
merge,
|
|
@@ -2849,7 +2921,6 @@ export {
|
|
|
2849
2921
|
onCleanup,
|
|
2850
2922
|
onSettled,
|
|
2851
2923
|
peekNextChildId,
|
|
2852
|
-
pending,
|
|
2853
2924
|
reconcile,
|
|
2854
2925
|
refresh,
|
|
2855
2926
|
releaseSnapshotScope,
|
|
@@ -2858,6 +2929,8 @@ export {
|
|
|
2858
2929
|
runWithOwner,
|
|
2859
2930
|
setContext,
|
|
2860
2931
|
setSnapshotCapture,
|
|
2932
|
+
setStrictRead,
|
|
2861
2933
|
snapshot,
|
|
2934
|
+
storePath,
|
|
2862
2935
|
untrack
|
|
2863
2936
|
};
|