@solidjs/signals 0.13.4 → 0.13.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +137 -80
- package/dist/node.cjs +519 -478
- package/dist/prod.js +394 -353
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/owner.d.ts +1 -1
- package/dist/types/core/scheduler.d.ts +5 -5
- package/dist/types/index.d.ts +2 -2
- package/dist/types/signals.d.ts +2 -0
- package/dist/types/store/projection.d.ts +1 -0
- package/package.json +1 -1
package/dist/node.cjs
CHANGED
|
@@ -108,7 +108,7 @@ function markNode(e, r = n) {
|
|
|
108
108
|
markNode(n.k, t);
|
|
109
109
|
}
|
|
110
110
|
if (e.C !== null) {
|
|
111
|
-
for (let n = e.C; n !== null; n = n.
|
|
111
|
+
for (let n = e.C; n !== null; n = n.W) {
|
|
112
112
|
for (let e = n.O; e !== null; e = e.P) {
|
|
113
113
|
markNode(e.k, t);
|
|
114
114
|
}
|
|
@@ -117,12 +117,12 @@ function markNode(e, r = n) {
|
|
|
117
117
|
}
|
|
118
118
|
function runHeap(e, t) {
|
|
119
119
|
e._ = false;
|
|
120
|
-
for (e.
|
|
121
|
-
let n = e.l[e.
|
|
120
|
+
for (e.j = 0; e.j <= e.S; e.j++) {
|
|
121
|
+
let n = e.l[e.j];
|
|
122
122
|
while (n !== undefined) {
|
|
123
123
|
if (n.m & i) t(n);
|
|
124
124
|
else adjustHeight(n, e);
|
|
125
|
-
n = e.l[e.
|
|
125
|
+
n = e.l[e.j];
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
e.S = 0;
|
|
@@ -130,10 +130,10 @@ function runHeap(e, t) {
|
|
|
130
130
|
function adjustHeight(e, t) {
|
|
131
131
|
deleteFromHeap(e, t);
|
|
132
132
|
let n = e.o;
|
|
133
|
-
for (let t = e.
|
|
133
|
+
for (let t = e.A; t; t = t.N) {
|
|
134
134
|
const e = t.L;
|
|
135
135
|
const r = e.I || e;
|
|
136
|
-
if (r.
|
|
136
|
+
if (r.R && r.o >= n) n = r.o + 1;
|
|
137
137
|
}
|
|
138
138
|
if (e.o !== n) {
|
|
139
139
|
e.o = n;
|
|
@@ -143,20 +143,20 @@ function adjustHeight(e, t) {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
const x = new Set();
|
|
146
|
-
const P = { l: new Array(2e3).fill(undefined), _: false,
|
|
147
|
-
const v = { l: new Array(2e3).fill(undefined), _: false,
|
|
146
|
+
const P = { l: new Array(2e3).fill(undefined), _: false, j: 0, S: 0 };
|
|
147
|
+
const v = { l: new Array(2e3).fill(undefined), _: false, j: 0, S: 0 };
|
|
148
148
|
let E = 0;
|
|
149
149
|
let k = null;
|
|
150
150
|
let C = false;
|
|
151
|
-
let
|
|
152
|
-
let
|
|
151
|
+
let W = false;
|
|
152
|
+
let j = null;
|
|
153
153
|
function enforceLoadingBoundary(e) {}
|
|
154
154
|
function shouldReadStashedOptimisticValue(e) {
|
|
155
|
-
return !!
|
|
155
|
+
return !!j?.has(e);
|
|
156
156
|
}
|
|
157
157
|
function runLaneEffects(e) {
|
|
158
158
|
for (const t of L) {
|
|
159
|
-
if (t.
|
|
159
|
+
if (t.T || t.H.size > 0) continue;
|
|
160
160
|
const n = t.q[e - 1];
|
|
161
161
|
if (n.length) {
|
|
162
162
|
t.q[e - 1] = [];
|
|
@@ -169,22 +169,22 @@ function queueStashedOptimisticEffects(e) {
|
|
|
169
169
|
const e = t.k;
|
|
170
170
|
if (!e.D) continue;
|
|
171
171
|
if (e.D === y) {
|
|
172
|
-
if (!e.
|
|
173
|
-
e.
|
|
174
|
-
e.
|
|
172
|
+
if (!e.F) {
|
|
173
|
+
e.F = true;
|
|
174
|
+
e.V.enqueue(g, e.M);
|
|
175
175
|
}
|
|
176
176
|
continue;
|
|
177
177
|
}
|
|
178
178
|
const n = e.m & o ? v : P;
|
|
179
|
-
if (n.
|
|
179
|
+
if (n.j > e.o) n.j = e.o;
|
|
180
180
|
insertIntoHeap(e, n);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
function setProjectionWriteActive(e) {
|
|
184
|
-
|
|
184
|
+
W = e;
|
|
185
185
|
}
|
|
186
186
|
function mergeTransitionState(e, t) {
|
|
187
|
-
t.
|
|
187
|
+
t.B = e;
|
|
188
188
|
e.G.push(...t.G);
|
|
189
189
|
for (const n of L) {
|
|
190
190
|
if (n.K === t) n.K = e;
|
|
@@ -214,7 +214,7 @@ function cleanupCompletedLanes(e) {
|
|
|
214
214
|
for (const t of L) {
|
|
215
215
|
const n = e ? t.K === e : !t.K;
|
|
216
216
|
if (!n) continue;
|
|
217
|
-
if (!t.
|
|
217
|
+
if (!t.T) {
|
|
218
218
|
if (t.q[0].length) runQueue(t.q[0], h);
|
|
219
219
|
if (t.q[1].length) runQueue(t.q[1], g);
|
|
220
220
|
}
|
|
@@ -223,27 +223,13 @@ function cleanupCompletedLanes(e) {
|
|
|
223
223
|
t.q[0].length = 0;
|
|
224
224
|
t.q[1].length = 0;
|
|
225
225
|
L.delete(t);
|
|
226
|
-
|
|
226
|
+
N.delete(t.te);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
function schedule() {
|
|
230
230
|
if (C) return;
|
|
231
231
|
C = true;
|
|
232
|
-
if (!
|
|
233
|
-
}
|
|
234
|
-
function addTransitionBlocker(e) {
|
|
235
|
-
if (k && !k.X.includes(e)) {
|
|
236
|
-
k.X.push(e);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function removeTransitionBlocker(e) {
|
|
240
|
-
const remove = t => {
|
|
241
|
-
if (!t) return;
|
|
242
|
-
const n = t.indexOf(e);
|
|
243
|
-
if (n >= 0) t.splice(n, 1);
|
|
244
|
-
};
|
|
245
|
-
remove(e.K?.X);
|
|
246
|
-
remove(k?.X);
|
|
232
|
+
if (!A.ne && !W) queueMicrotask(flush);
|
|
247
233
|
}
|
|
248
234
|
class Queue {
|
|
249
235
|
i = null;
|
|
@@ -275,8 +261,8 @@ class Queue {
|
|
|
275
261
|
}
|
|
276
262
|
enqueue(e, t) {
|
|
277
263
|
if (e) {
|
|
278
|
-
if (
|
|
279
|
-
const n = findLane(
|
|
264
|
+
if (M) {
|
|
265
|
+
const n = findLane(M);
|
|
280
266
|
n.q[e - 1].push(t);
|
|
281
267
|
} else {
|
|
282
268
|
this.re[e - 1].push(t);
|
|
@@ -333,22 +319,22 @@ class GlobalQueue extends Queue {
|
|
|
333
319
|
runLaneEffects(g);
|
|
334
320
|
this.stashQueues(e.ce);
|
|
335
321
|
E++;
|
|
336
|
-
C = P.S >= P.
|
|
322
|
+
C = P.S >= P.j;
|
|
337
323
|
reassignPendingTransition(e.se);
|
|
338
324
|
k = null;
|
|
339
325
|
if (!e.G.length && e.U.length) {
|
|
340
|
-
|
|
326
|
+
j = new Set();
|
|
341
327
|
for (let t = 0; t < e.U.length; t++) {
|
|
342
328
|
const n = e.U[t];
|
|
343
|
-
if (n.
|
|
344
|
-
|
|
329
|
+
if (n.R || n.le) continue;
|
|
330
|
+
j.add(n);
|
|
345
331
|
queueStashedOptimisticEffects(n);
|
|
346
332
|
}
|
|
347
333
|
}
|
|
348
334
|
try {
|
|
349
335
|
finalizePureQueue(null, true);
|
|
350
336
|
} finally {
|
|
351
|
-
|
|
337
|
+
j = null;
|
|
352
338
|
}
|
|
353
339
|
return;
|
|
354
340
|
}
|
|
@@ -364,7 +350,7 @@ class GlobalQueue extends Queue {
|
|
|
364
350
|
finalizePureQueue();
|
|
365
351
|
}
|
|
366
352
|
E++;
|
|
367
|
-
C = P.S >= P.
|
|
353
|
+
C = P.S >= P.j;
|
|
368
354
|
runLaneEffects(h);
|
|
369
355
|
this.run(h);
|
|
370
356
|
runLaneEffects(g);
|
|
@@ -402,7 +388,7 @@ class GlobalQueue extends Queue {
|
|
|
402
388
|
J: new Set(),
|
|
403
389
|
G: [],
|
|
404
390
|
ce: { re: [[], []], ie: [] },
|
|
405
|
-
|
|
391
|
+
B: false
|
|
406
392
|
};
|
|
407
393
|
} else if (e) {
|
|
408
394
|
const t = k;
|
|
@@ -438,7 +424,7 @@ class GlobalQueue extends Queue {
|
|
|
438
424
|
}
|
|
439
425
|
}
|
|
440
426
|
function insertSubs(e, t = false) {
|
|
441
|
-
const n = e.Y ||
|
|
427
|
+
const n = e.Y || M;
|
|
442
428
|
const r = e.pe !== undefined;
|
|
443
429
|
for (let i = e.O; i !== null; i = i.P) {
|
|
444
430
|
if (r && i.k.he) {
|
|
@@ -454,40 +440,40 @@ function insertSubs(e, t = false) {
|
|
|
454
440
|
}
|
|
455
441
|
const e = i.k;
|
|
456
442
|
if (e.D === y) {
|
|
457
|
-
if (!e.
|
|
458
|
-
e.
|
|
459
|
-
e.
|
|
443
|
+
if (!e.F) {
|
|
444
|
+
e.F = true;
|
|
445
|
+
e.V.enqueue(g, e.M);
|
|
460
446
|
}
|
|
461
447
|
continue;
|
|
462
448
|
}
|
|
463
449
|
const s = i.k.m & o ? v : P;
|
|
464
|
-
if (s.
|
|
450
|
+
if (s.j > i.k.o) s.j = i.k.o;
|
|
465
451
|
insertIntoHeap(i.k, s);
|
|
466
452
|
}
|
|
467
453
|
}
|
|
468
454
|
function commitPendingNodes() {
|
|
469
|
-
const e =
|
|
455
|
+
const e = A.se;
|
|
470
456
|
for (let t = 0; t < e.length; t++) {
|
|
471
457
|
const n = e[t];
|
|
472
458
|
if (n.Z !== S) {
|
|
473
459
|
n.$ = n.Z;
|
|
474
460
|
n.Z = S;
|
|
475
|
-
if (n.D && n.D !== y) n.
|
|
461
|
+
if (n.D && n.D !== y) n.F = true;
|
|
476
462
|
}
|
|
477
463
|
if (!(n.ge & a)) n.ge &= ~p;
|
|
478
|
-
if (n.
|
|
464
|
+
if (n.R) GlobalQueue.ue(n, false, true);
|
|
479
465
|
}
|
|
480
466
|
e.length = 0;
|
|
481
467
|
}
|
|
482
468
|
function finalizePureQueue(e = null, t = false) {
|
|
483
469
|
const n = !t;
|
|
484
470
|
if (n) commitPendingNodes();
|
|
485
|
-
if (!t) checkBoundaryChildren(
|
|
486
|
-
if (P.S >= P.
|
|
471
|
+
if (!t) checkBoundaryChildren(A);
|
|
472
|
+
if (P.S >= P.j) runHeap(P, GlobalQueue.oe);
|
|
487
473
|
if (n) {
|
|
488
474
|
commitPendingNodes();
|
|
489
|
-
resolveOptimisticNodes(e ? e.U :
|
|
490
|
-
const t = e ? e.J :
|
|
475
|
+
resolveOptimisticNodes(e ? e.U : A.U);
|
|
476
|
+
const t = e ? e.J : A.J;
|
|
491
477
|
if (GlobalQueue.fe && t.size) {
|
|
492
478
|
for (const e of t) {
|
|
493
479
|
GlobalQueue.fe(e);
|
|
@@ -505,7 +491,7 @@ function checkBoundaryChildren(e) {
|
|
|
505
491
|
}
|
|
506
492
|
}
|
|
507
493
|
function trackOptimisticStore(e) {
|
|
508
|
-
|
|
494
|
+
A.J.add(e);
|
|
509
495
|
schedule();
|
|
510
496
|
}
|
|
511
497
|
function reassignPendingTransition(e) {
|
|
@@ -513,17 +499,20 @@ function reassignPendingTransition(e) {
|
|
|
513
499
|
e[t].K = k;
|
|
514
500
|
}
|
|
515
501
|
}
|
|
516
|
-
const
|
|
502
|
+
const A = new GlobalQueue();
|
|
517
503
|
function flush() {
|
|
504
|
+
if (A.ne) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
518
507
|
while (C || k) {
|
|
519
|
-
|
|
508
|
+
A.flush();
|
|
520
509
|
}
|
|
521
510
|
}
|
|
522
511
|
function runQueue(e, t) {
|
|
523
512
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
524
513
|
}
|
|
525
514
|
function transitionComplete(e) {
|
|
526
|
-
if (e.
|
|
515
|
+
if (e.B) return true;
|
|
527
516
|
if (e.G.length) return false;
|
|
528
517
|
let t = true;
|
|
529
518
|
for (let n = 0; n < e.X.length; n++) {
|
|
@@ -533,11 +522,26 @@ function transitionComplete(e) {
|
|
|
533
522
|
break;
|
|
534
523
|
}
|
|
535
524
|
}
|
|
536
|
-
|
|
525
|
+
if (t) {
|
|
526
|
+
for (let n = 0; n < e.U.length; n++) {
|
|
527
|
+
const r = e.U[n];
|
|
528
|
+
if (
|
|
529
|
+
hasActiveOverride(r) &&
|
|
530
|
+
"ge" in r &&
|
|
531
|
+
r.ge & a &&
|
|
532
|
+
r.ae instanceof NotReadyError &&
|
|
533
|
+
r.ae.source !== r
|
|
534
|
+
) {
|
|
535
|
+
t = false;
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
t && (e.B = true);
|
|
537
541
|
return t;
|
|
538
542
|
}
|
|
539
543
|
function currentTransition(e) {
|
|
540
|
-
while (e.
|
|
544
|
+
while (e.B && typeof e.B === "object") e = e.B;
|
|
541
545
|
return e;
|
|
542
546
|
}
|
|
543
547
|
function setActiveTransition(e) {
|
|
@@ -552,30 +556,30 @@ function runInTransition(e, t) {
|
|
|
552
556
|
k = n;
|
|
553
557
|
}
|
|
554
558
|
}
|
|
555
|
-
const
|
|
559
|
+
const N = new WeakMap();
|
|
556
560
|
const L = new Set();
|
|
557
561
|
function getOrCreateLane(e) {
|
|
558
|
-
let t =
|
|
562
|
+
let t = N.get(e);
|
|
559
563
|
if (t) {
|
|
560
564
|
return findLane(t);
|
|
561
565
|
}
|
|
562
566
|
const n = e.ye;
|
|
563
567
|
const r = n?.Y ? findLane(n.Y) : null;
|
|
564
|
-
t = { te: e, H: new Set(), q: [[], []],
|
|
565
|
-
|
|
568
|
+
t = { te: e, H: new Set(), q: [[], []], T: null, K: k, Se: r };
|
|
569
|
+
N.set(e, t);
|
|
566
570
|
L.add(t);
|
|
567
571
|
e.we = false;
|
|
568
572
|
return t;
|
|
569
573
|
}
|
|
570
574
|
function findLane(e) {
|
|
571
|
-
while (e.
|
|
575
|
+
while (e.T) e = e.T;
|
|
572
576
|
return e;
|
|
573
577
|
}
|
|
574
578
|
function mergeLanes(e, t) {
|
|
575
579
|
e = findLane(e);
|
|
576
580
|
t = findLane(t);
|
|
577
581
|
if (e === t) return e;
|
|
578
|
-
t.
|
|
582
|
+
t.T = e;
|
|
579
583
|
for (const n of t.H) e.H.add(n);
|
|
580
584
|
e.q[0].push(...t.q[0]);
|
|
581
585
|
e.q[1].push(...t.q[1]);
|
|
@@ -599,7 +603,7 @@ function assignOrMergeLane(e, t) {
|
|
|
599
603
|
const n = findLane(t);
|
|
600
604
|
const r = e.Y;
|
|
601
605
|
if (r) {
|
|
602
|
-
if (r.
|
|
606
|
+
if (r.T) {
|
|
603
607
|
e.Y = t;
|
|
604
608
|
return;
|
|
605
609
|
}
|
|
@@ -666,7 +670,7 @@ function setPendingError(e, t, n) {
|
|
|
666
670
|
}
|
|
667
671
|
function forEachDependent(e, t) {
|
|
668
672
|
for (let n = e.O; n !== null; n = n.P) t(n.k);
|
|
669
|
-
for (let n = e.C; n !== null; n = n.
|
|
673
|
+
for (let n = e.C; n !== null; n = n.W) {
|
|
670
674
|
for (let e = n.O; e !== null; e = e.P) t(e.k);
|
|
671
675
|
}
|
|
672
676
|
}
|
|
@@ -688,13 +692,13 @@ function settlePendingSource(e) {
|
|
|
688
692
|
if (r._e) {
|
|
689
693
|
if (r.D === y) {
|
|
690
694
|
const e = r;
|
|
691
|
-
if (!e.
|
|
692
|
-
e.
|
|
693
|
-
e.
|
|
695
|
+
if (!e.F) {
|
|
696
|
+
e.F = true;
|
|
697
|
+
e.V.enqueue(g, e.M);
|
|
694
698
|
}
|
|
695
699
|
} else {
|
|
696
700
|
const e = r.m & o ? v : P;
|
|
697
|
-
if (e.
|
|
701
|
+
if (e.j > r.o) e.j = r.o;
|
|
698
702
|
insertIntoHeap(r, e);
|
|
699
703
|
}
|
|
700
704
|
t = true;
|
|
@@ -718,14 +722,14 @@ function handleAsync(e, t, r) {
|
|
|
718
722
|
let u;
|
|
719
723
|
const handleError = n => {
|
|
720
724
|
if (e.Oe !== t) return;
|
|
721
|
-
|
|
725
|
+
A.initTransition(resolveTransition(e));
|
|
722
726
|
notifyStatus(e, n instanceof NotReadyError ? a : d, n);
|
|
723
727
|
e.de = E;
|
|
724
728
|
};
|
|
725
729
|
const asyncWrite = (i, s) => {
|
|
726
730
|
if (e.Oe !== t) return;
|
|
727
731
|
if (e.m & (n | f)) return;
|
|
728
|
-
|
|
732
|
+
A.initTransition(resolveTransition(e));
|
|
729
733
|
clearStatus(e);
|
|
730
734
|
const o = resolveLane(e);
|
|
731
735
|
if (o) o.H.delete(e);
|
|
@@ -772,8 +776,8 @@ function handleAsync(e, t, r) {
|
|
|
772
776
|
);
|
|
773
777
|
r = false;
|
|
774
778
|
if (!n) {
|
|
775
|
-
|
|
776
|
-
throw new NotReadyError(
|
|
779
|
+
A.initTransition(resolveTransition(e));
|
|
780
|
+
throw new NotReadyError(V);
|
|
777
781
|
}
|
|
778
782
|
}
|
|
779
783
|
if (s) {
|
|
@@ -808,15 +812,14 @@ function handleAsync(e, t, r) {
|
|
|
808
812
|
};
|
|
809
813
|
const i = iterate();
|
|
810
814
|
if (!r && !i) {
|
|
811
|
-
|
|
812
|
-
throw new NotReadyError(
|
|
815
|
+
A.initTransition(resolveTransition(e));
|
|
816
|
+
throw new NotReadyError(V);
|
|
813
817
|
}
|
|
814
818
|
}
|
|
815
819
|
return u;
|
|
816
820
|
}
|
|
817
821
|
function clearStatus(e, t = false) {
|
|
818
822
|
clearPendingSources(e);
|
|
819
|
-
removeTransitionBlocker(e);
|
|
820
823
|
e._e = false;
|
|
821
824
|
e.ge = t ? 0 : e.ge & p;
|
|
822
825
|
setPendingError(e);
|
|
@@ -834,11 +837,9 @@ function notifyStatus(e, t, n, r, i) {
|
|
|
834
837
|
if (t === a && s) {
|
|
835
838
|
addPendingSource(e, s);
|
|
836
839
|
e.ge = a | (e.ge & p);
|
|
837
|
-
setPendingError(e,
|
|
838
|
-
if (s === e) addTransitionBlocker(e);
|
|
840
|
+
setPendingError(e, s, n);
|
|
839
841
|
} else {
|
|
840
842
|
clearPendingSources(e);
|
|
841
|
-
removeTransitionBlocker(e);
|
|
842
843
|
e.ge = t | (t !== d ? e.ge & p : 0);
|
|
843
844
|
e.ae = n;
|
|
844
845
|
}
|
|
@@ -850,6 +851,9 @@ function notifyStatus(e, t, n, r, i) {
|
|
|
850
851
|
const c = r || f;
|
|
851
852
|
const l = r || u ? undefined : i;
|
|
852
853
|
if (e.ve) {
|
|
854
|
+
if (r && t === a) {
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
853
857
|
if (c) {
|
|
854
858
|
e.ve(t, n);
|
|
855
859
|
} else {
|
|
@@ -863,7 +867,7 @@ function notifyStatus(e, t, n, r, i) {
|
|
|
863
867
|
(t === a && s && e.me !== s && !e.be?.has(s)) ||
|
|
864
868
|
(t !== a && (e.ae !== n || e.me || e.be))
|
|
865
869
|
) {
|
|
866
|
-
!e.K
|
|
870
|
+
if (!c && !e.K) A.se.push(e);
|
|
867
871
|
notifyStatus(e, t, n, c, l);
|
|
868
872
|
}
|
|
869
873
|
});
|
|
@@ -891,7 +895,7 @@ function enableExternalSource(e) {
|
|
|
891
895
|
I = { factory: t, untrack: n };
|
|
892
896
|
}
|
|
893
897
|
}
|
|
894
|
-
const
|
|
898
|
+
const R = {};
|
|
895
899
|
function markDisposal(e) {
|
|
896
900
|
let t = e.Ee;
|
|
897
901
|
while (t) {
|
|
@@ -905,43 +909,43 @@ function markDisposal(e) {
|
|
|
905
909
|
}
|
|
906
910
|
}
|
|
907
911
|
function dispose(e) {
|
|
908
|
-
let t = e.
|
|
912
|
+
let t = e.A || null;
|
|
909
913
|
do {
|
|
910
914
|
t = unlinkSubs(t);
|
|
911
915
|
} while (t !== null);
|
|
912
|
-
e.
|
|
916
|
+
e.A = null;
|
|
913
917
|
e.Ce = null;
|
|
914
918
|
disposeChildren(e, true);
|
|
915
919
|
}
|
|
916
920
|
function disposeChildren(e, t = false, n) {
|
|
917
921
|
if (e.m & u) return;
|
|
918
922
|
if (t) e.m = u;
|
|
919
|
-
let r = n ? e.
|
|
923
|
+
let r = n ? e.We : e.Ee;
|
|
920
924
|
while (r) {
|
|
921
925
|
const e = r.ke;
|
|
922
|
-
if (r.
|
|
926
|
+
if (r.A) {
|
|
923
927
|
const e = r;
|
|
924
928
|
deleteFromHeap(e, e.m & o ? v : P);
|
|
925
|
-
let t = e.
|
|
929
|
+
let t = e.A;
|
|
926
930
|
do {
|
|
927
931
|
t = unlinkSubs(t);
|
|
928
932
|
} while (t !== null);
|
|
929
|
-
e.
|
|
933
|
+
e.A = null;
|
|
930
934
|
e.Ce = null;
|
|
931
935
|
}
|
|
932
936
|
disposeChildren(r, true);
|
|
933
937
|
r = e;
|
|
934
938
|
}
|
|
935
939
|
if (n) {
|
|
936
|
-
e.
|
|
940
|
+
e.We = null;
|
|
937
941
|
} else {
|
|
938
942
|
e.Ee = null;
|
|
939
|
-
e.
|
|
943
|
+
e.je = 0;
|
|
940
944
|
}
|
|
941
945
|
runDisposal(e, n);
|
|
942
946
|
}
|
|
943
947
|
function runDisposal(e, t) {
|
|
944
|
-
let n = t ? e.
|
|
948
|
+
let n = t ? e.Ae : e.Ne;
|
|
945
949
|
if (!n) return;
|
|
946
950
|
if (Array.isArray(n)) {
|
|
947
951
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -951,12 +955,12 @@ function runDisposal(e, t) {
|
|
|
951
955
|
} else {
|
|
952
956
|
n.call(n);
|
|
953
957
|
}
|
|
954
|
-
t ? (e.
|
|
958
|
+
t ? (e.Ae = null) : (e.Ne = null);
|
|
955
959
|
}
|
|
956
960
|
function childId(e, t) {
|
|
957
961
|
let n = e;
|
|
958
962
|
while (n.Le && n.i) n = n.i;
|
|
959
|
-
if (n.id != null) return formatId(n.id, t ? n.
|
|
963
|
+
if (n.id != null) return formatId(n.id, t ? n.je++ : n.je);
|
|
960
964
|
throw new Error("Cannot get child id from owner without an id");
|
|
961
965
|
}
|
|
962
966
|
function getNextChildId(e) {
|
|
@@ -971,26 +975,24 @@ function formatId(e, t) {
|
|
|
971
975
|
return e + (r ? String.fromCharCode(64 + r) : "") + n;
|
|
972
976
|
}
|
|
973
977
|
function getObserver() {
|
|
974
|
-
if (q ||
|
|
975
|
-
return
|
|
978
|
+
if (q || F) return R;
|
|
979
|
+
return T ? V : null;
|
|
976
980
|
}
|
|
977
981
|
function getOwner() {
|
|
978
|
-
return
|
|
982
|
+
return V;
|
|
979
983
|
}
|
|
980
|
-
function
|
|
981
|
-
if (!
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
else if (Array.isArray(B.We)) B.We.push(e);
|
|
986
|
-
else B.We = [B.We, e];
|
|
984
|
+
function cleanup(e) {
|
|
985
|
+
if (!V) return e;
|
|
986
|
+
if (!V.Ne) V.Ne = e;
|
|
987
|
+
else if (Array.isArray(V.Ne)) V.Ne.push(e);
|
|
988
|
+
else V.Ne = [V.Ne, e];
|
|
987
989
|
return e;
|
|
988
990
|
}
|
|
989
991
|
function isDisposed(e) {
|
|
990
992
|
return !!(e.m & (u | o));
|
|
991
993
|
}
|
|
992
994
|
function createOwner(e) {
|
|
993
|
-
const t =
|
|
995
|
+
const t = V;
|
|
994
996
|
const n = e?.transparent ?? false;
|
|
995
997
|
const r = {
|
|
996
998
|
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
@@ -999,12 +1001,12 @@ function createOwner(e) {
|
|
|
999
1001
|
u: t?.t ? t.u : t,
|
|
1000
1002
|
Ee: null,
|
|
1001
1003
|
ke: null,
|
|
1002
|
-
We: null,
|
|
1003
|
-
B: t?.B ?? N,
|
|
1004
|
-
Ie: t?.Ie || _,
|
|
1005
|
-
Ae: 0,
|
|
1006
1004
|
Ne: null,
|
|
1007
|
-
|
|
1005
|
+
V: t?.V ?? A,
|
|
1006
|
+
Ie: t?.Ie || _,
|
|
1007
|
+
je: 0,
|
|
1008
|
+
Ae: null,
|
|
1009
|
+
We: null,
|
|
1008
1010
|
i: t,
|
|
1009
1011
|
dispose(e = true) {
|
|
1010
1012
|
disposeChildren(r, e);
|
|
@@ -1027,28 +1029,28 @@ function createRoot(e, t) {
|
|
|
1027
1029
|
}
|
|
1028
1030
|
function unlinkSubs(e) {
|
|
1029
1031
|
const t = e.L;
|
|
1030
|
-
const n = e.
|
|
1032
|
+
const n = e.N;
|
|
1031
1033
|
const r = e.P;
|
|
1032
|
-
const i = e.
|
|
1033
|
-
if (r !== null) r.
|
|
1034
|
-
else t.
|
|
1034
|
+
const i = e.Re;
|
|
1035
|
+
if (r !== null) r.Re = i;
|
|
1036
|
+
else t.Te = i;
|
|
1035
1037
|
if (i !== null) i.P = r;
|
|
1036
1038
|
else {
|
|
1037
1039
|
t.O = r;
|
|
1038
1040
|
if (r === null) {
|
|
1039
1041
|
t.He?.();
|
|
1040
|
-
t.
|
|
1042
|
+
t.R && !t.Qe && !(t.m & o) && unobserved(t);
|
|
1041
1043
|
}
|
|
1042
1044
|
}
|
|
1043
1045
|
return n;
|
|
1044
1046
|
}
|
|
1045
1047
|
function unobserved(e) {
|
|
1046
1048
|
deleteFromHeap(e, e.m & o ? v : P);
|
|
1047
|
-
let t = e.
|
|
1049
|
+
let t = e.A;
|
|
1048
1050
|
while (t !== null) {
|
|
1049
1051
|
t = unlinkSubs(t);
|
|
1050
1052
|
}
|
|
1051
|
-
e.
|
|
1053
|
+
e.A = null;
|
|
1052
1054
|
disposeChildren(e, true);
|
|
1053
1055
|
}
|
|
1054
1056
|
function link(e, t) {
|
|
@@ -1057,43 +1059,43 @@ function link(e, t) {
|
|
|
1057
1059
|
let i = null;
|
|
1058
1060
|
const s = t.m & r;
|
|
1059
1061
|
if (s) {
|
|
1060
|
-
i = n !== null ? n.
|
|
1062
|
+
i = n !== null ? n.N : t.A;
|
|
1061
1063
|
if (i !== null && i.L === e) {
|
|
1062
1064
|
t.Ce = i;
|
|
1063
1065
|
return;
|
|
1064
1066
|
}
|
|
1065
1067
|
}
|
|
1066
|
-
const o = e.
|
|
1068
|
+
const o = e.Te;
|
|
1067
1069
|
if (o !== null && o.k === t && (!s || isValidLink(o, t))) return;
|
|
1068
|
-
const u = (t.Ce = e.
|
|
1069
|
-
if (n !== null) n.
|
|
1070
|
-
else t.
|
|
1070
|
+
const u = (t.Ce = e.Te = { L: e, k: t, N: i, Re: o, P: null });
|
|
1071
|
+
if (n !== null) n.N = u;
|
|
1072
|
+
else t.A = u;
|
|
1071
1073
|
if (o !== null) o.P = u;
|
|
1072
1074
|
else e.O = u;
|
|
1073
1075
|
}
|
|
1074
1076
|
function isValidLink(e, t) {
|
|
1075
1077
|
const n = t.Ce;
|
|
1076
1078
|
if (n !== null) {
|
|
1077
|
-
let r = t.
|
|
1079
|
+
let r = t.A;
|
|
1078
1080
|
do {
|
|
1079
1081
|
if (r === e) return true;
|
|
1080
1082
|
if (r === n) break;
|
|
1081
|
-
r = r.
|
|
1083
|
+
r = r.N;
|
|
1082
1084
|
} while (r !== null);
|
|
1083
1085
|
}
|
|
1084
1086
|
return false;
|
|
1085
1087
|
}
|
|
1086
1088
|
GlobalQueue.oe = recompute;
|
|
1087
1089
|
GlobalQueue.ue = disposeChildren;
|
|
1088
|
-
let
|
|
1090
|
+
let T = false;
|
|
1089
1091
|
let H = false;
|
|
1090
1092
|
let Q = false;
|
|
1091
1093
|
let q = false;
|
|
1092
1094
|
let D = false;
|
|
1093
|
-
let
|
|
1094
|
-
let
|
|
1095
|
-
let
|
|
1096
|
-
let
|
|
1095
|
+
let F = false;
|
|
1096
|
+
let V = null;
|
|
1097
|
+
let M = null;
|
|
1098
|
+
let B = false;
|
|
1097
1099
|
let G = null;
|
|
1098
1100
|
function ownerInSnapshotScope(e) {
|
|
1099
1101
|
while (e) {
|
|
@@ -1103,7 +1105,7 @@ function ownerInSnapshotScope(e) {
|
|
|
1103
1105
|
return false;
|
|
1104
1106
|
}
|
|
1105
1107
|
function setSnapshotCapture(e) {
|
|
1106
|
-
|
|
1108
|
+
B = e;
|
|
1107
1109
|
if (e && !G) G = new Set();
|
|
1108
1110
|
}
|
|
1109
1111
|
function markSnapshotScope(e) {
|
|
@@ -1121,13 +1123,13 @@ function releaseSubtree(e) {
|
|
|
1121
1123
|
t = t.ke;
|
|
1122
1124
|
continue;
|
|
1123
1125
|
}
|
|
1124
|
-
if (t.
|
|
1126
|
+
if (t.R) {
|
|
1125
1127
|
const e = t;
|
|
1126
1128
|
e.he = false;
|
|
1127
1129
|
if (e.m & c) {
|
|
1128
1130
|
e.m &= ~c;
|
|
1129
1131
|
e.m |= n;
|
|
1130
|
-
if (P.
|
|
1132
|
+
if (P.j > e.o) P.j = e.o;
|
|
1131
1133
|
insertIntoHeap(e, P);
|
|
1132
1134
|
}
|
|
1133
1135
|
}
|
|
@@ -1143,42 +1145,42 @@ function clearSnapshots() {
|
|
|
1143
1145
|
}
|
|
1144
1146
|
G = null;
|
|
1145
1147
|
}
|
|
1146
|
-
|
|
1148
|
+
B = false;
|
|
1147
1149
|
}
|
|
1148
1150
|
function recompute(t, n = false) {
|
|
1149
1151
|
const i = t.D;
|
|
1150
1152
|
if (!n) {
|
|
1151
|
-
if (t.K && (!i || k) && k !== t.K)
|
|
1153
|
+
if (t.K && (!i || k) && k !== t.K) A.initTransition(t.K);
|
|
1152
1154
|
deleteFromHeap(t, t.m & o ? v : P);
|
|
1153
1155
|
if (t.K || i === y) disposeChildren(t);
|
|
1154
1156
|
else {
|
|
1155
1157
|
markDisposal(t);
|
|
1156
|
-
t.
|
|
1157
|
-
t.
|
|
1158
|
-
t.
|
|
1158
|
+
t.Ae = t.Ne;
|
|
1159
|
+
t.We = t.Ee;
|
|
1160
|
+
t.Ne = null;
|
|
1159
1161
|
t.Ee = null;
|
|
1160
|
-
t.
|
|
1162
|
+
t.je = 0;
|
|
1161
1163
|
}
|
|
1162
1164
|
}
|
|
1163
1165
|
const s = !!(t.m & f);
|
|
1164
1166
|
const u = t.ee !== undefined && t.ee !== S;
|
|
1165
1167
|
const l = !!(t.ge & a);
|
|
1166
|
-
const p =
|
|
1167
|
-
|
|
1168
|
+
const p = V;
|
|
1169
|
+
V = t;
|
|
1168
1170
|
t.Ce = null;
|
|
1169
1171
|
t.m = r;
|
|
1170
1172
|
t.de = E;
|
|
1171
1173
|
let h = t.Z === S ? t.$ : t.Z;
|
|
1172
1174
|
let g = t.o;
|
|
1173
|
-
let w =
|
|
1174
|
-
let m =
|
|
1175
|
-
|
|
1175
|
+
let w = T;
|
|
1176
|
+
let m = M;
|
|
1177
|
+
T = true;
|
|
1176
1178
|
if (s) {
|
|
1177
1179
|
const e = resolveLane(t);
|
|
1178
|
-
if (e)
|
|
1180
|
+
if (e) M = e;
|
|
1179
1181
|
}
|
|
1180
1182
|
try {
|
|
1181
|
-
h = handleAsync(t, t.
|
|
1183
|
+
h = handleAsync(t, t.R(h));
|
|
1182
1184
|
clearStatus(t, n);
|
|
1183
1185
|
const e = resolveLane(t);
|
|
1184
1186
|
if (e) {
|
|
@@ -1186,8 +1188,8 @@ function recompute(t, n = false) {
|
|
|
1186
1188
|
updatePendingSignal(e.te);
|
|
1187
1189
|
}
|
|
1188
1190
|
} catch (e) {
|
|
1189
|
-
if (e instanceof NotReadyError &&
|
|
1190
|
-
const e = findLane(
|
|
1191
|
+
if (e instanceof NotReadyError && M) {
|
|
1192
|
+
const e = findLane(M);
|
|
1191
1193
|
if (e.te !== t) {
|
|
1192
1194
|
e.H.add(t);
|
|
1193
1195
|
t.Y = e;
|
|
@@ -1203,19 +1205,19 @@ function recompute(t, n = false) {
|
|
|
1203
1205
|
e instanceof NotReadyError ? t.Y : undefined
|
|
1204
1206
|
);
|
|
1205
1207
|
} finally {
|
|
1206
|
-
|
|
1208
|
+
T = w;
|
|
1207
1209
|
t.m = e | (n ? t.m & c : 0);
|
|
1208
|
-
|
|
1210
|
+
V = p;
|
|
1209
1211
|
}
|
|
1210
1212
|
if (!t.ae) {
|
|
1211
1213
|
const e = t.Ce;
|
|
1212
|
-
let r = e !== null ? e.
|
|
1214
|
+
let r = e !== null ? e.N : t.A;
|
|
1213
1215
|
if (r !== null) {
|
|
1214
1216
|
do {
|
|
1215
1217
|
r = unlinkSubs(r);
|
|
1216
1218
|
} while (r !== null);
|
|
1217
|
-
if (e !== null) e.
|
|
1218
|
-
else t.
|
|
1219
|
+
if (e !== null) e.N = null;
|
|
1220
|
+
else t.A = null;
|
|
1219
1221
|
}
|
|
1220
1222
|
const f = u ? t.ee : t.Z === S ? t.$ : t.Z;
|
|
1221
1223
|
const c = !t.xe || !t.xe(f, h);
|
|
@@ -1238,16 +1240,16 @@ function recompute(t, n = false) {
|
|
|
1238
1240
|
}
|
|
1239
1241
|
}
|
|
1240
1242
|
}
|
|
1241
|
-
|
|
1242
|
-
(!n || t.ge & a) && !t.K && !(k && u) &&
|
|
1243
|
+
M = m;
|
|
1244
|
+
(!n || t.ge & a) && !t.K && !(k && u) && A.se.push(t);
|
|
1243
1245
|
t.K && i && k !== t.K && runInTransition(t.K, () => recompute(t));
|
|
1244
1246
|
}
|
|
1245
1247
|
function updateIfNecessary(r) {
|
|
1246
1248
|
if (r.m & t) {
|
|
1247
|
-
for (let e = r.
|
|
1249
|
+
for (let e = r.A; e; e = e.N) {
|
|
1248
1250
|
const t = e.L;
|
|
1249
1251
|
const i = t.I || t;
|
|
1250
|
-
if (i.
|
|
1252
|
+
if (i.R) {
|
|
1251
1253
|
updateIfNecessary(i);
|
|
1252
1254
|
}
|
|
1253
1255
|
if (r.m & n) {
|
|
@@ -1263,63 +1265,63 @@ function updateIfNecessary(r) {
|
|
|
1263
1265
|
function computed(t, n, r) {
|
|
1264
1266
|
const i = r?.transparent ?? false;
|
|
1265
1267
|
const s = {
|
|
1266
|
-
id: r?.id ?? (i ?
|
|
1268
|
+
id: r?.id ?? (i ? V?.id : V?.id != null ? getNextChildId(V) : undefined),
|
|
1267
1269
|
Le: i || undefined,
|
|
1268
1270
|
xe: r?.equals != null ? r.equals : isEqual,
|
|
1269
1271
|
le: !!r?.pureWrite,
|
|
1270
1272
|
He: r?.unobserved,
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
Ie:
|
|
1274
|
-
|
|
1275
|
-
|
|
1273
|
+
Ne: null,
|
|
1274
|
+
V: V?.V ?? A,
|
|
1275
|
+
Ie: V?.Ie ?? _,
|
|
1276
|
+
je: 0,
|
|
1277
|
+
R: t,
|
|
1276
1278
|
$: n,
|
|
1277
1279
|
o: 0,
|
|
1278
1280
|
C: null,
|
|
1279
1281
|
h: undefined,
|
|
1280
1282
|
p: null,
|
|
1281
|
-
|
|
1283
|
+
A: null,
|
|
1282
1284
|
Ce: null,
|
|
1283
1285
|
O: null,
|
|
1284
|
-
|
|
1285
|
-
i:
|
|
1286
|
+
Te: null,
|
|
1287
|
+
i: V,
|
|
1286
1288
|
ke: null,
|
|
1287
1289
|
Ee: null,
|
|
1288
1290
|
m: r?.lazy ? l : e,
|
|
1289
1291
|
ge: p,
|
|
1290
1292
|
de: E,
|
|
1291
1293
|
Z: S,
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
+
Ae: null,
|
|
1295
|
+
We: null,
|
|
1294
1296
|
Oe: null,
|
|
1295
1297
|
K: null
|
|
1296
1298
|
};
|
|
1297
1299
|
s.p = s;
|
|
1298
|
-
const o =
|
|
1299
|
-
if (
|
|
1300
|
-
const e =
|
|
1300
|
+
const o = V?.t ? V.u : V;
|
|
1301
|
+
if (V) {
|
|
1302
|
+
const e = V.Ee;
|
|
1301
1303
|
if (e === null) {
|
|
1302
|
-
|
|
1304
|
+
V.Ee = s;
|
|
1303
1305
|
} else {
|
|
1304
1306
|
s.ke = e;
|
|
1305
|
-
|
|
1307
|
+
V.Ee = s;
|
|
1306
1308
|
}
|
|
1307
1309
|
}
|
|
1308
1310
|
if (o) s.o = o.o + 1;
|
|
1309
|
-
if (
|
|
1311
|
+
if (B && ownerInSnapshotScope(V)) s.he = true;
|
|
1310
1312
|
if (I) {
|
|
1311
1313
|
const e = signal(undefined, { equals: false, pureWrite: true });
|
|
1312
|
-
const t = I.factory(s.
|
|
1314
|
+
const t = I.factory(s.R, () => {
|
|
1313
1315
|
setSignal(e, undefined);
|
|
1314
1316
|
});
|
|
1315
|
-
|
|
1316
|
-
s.
|
|
1317
|
+
cleanup(() => t.dispose());
|
|
1318
|
+
s.R = n => {
|
|
1317
1319
|
read(e);
|
|
1318
1320
|
return t.track(n);
|
|
1319
1321
|
};
|
|
1320
1322
|
}
|
|
1321
1323
|
!r?.lazy && recompute(s, true);
|
|
1322
|
-
if (
|
|
1324
|
+
if (B && !r?.lazy) {
|
|
1323
1325
|
if (!(s.ge & a)) {
|
|
1324
1326
|
s.pe = s.$ === undefined ? w : s.$;
|
|
1325
1327
|
G.add(s);
|
|
@@ -1335,14 +1337,14 @@ function signal(e, t, n = null) {
|
|
|
1335
1337
|
He: t?.unobserved,
|
|
1336
1338
|
$: e,
|
|
1337
1339
|
O: null,
|
|
1338
|
-
|
|
1340
|
+
Te: null,
|
|
1339
1341
|
de: E,
|
|
1340
1342
|
I: n,
|
|
1341
|
-
|
|
1343
|
+
W: n?.C || null,
|
|
1342
1344
|
Z: S
|
|
1343
1345
|
};
|
|
1344
1346
|
n && (n.C = r);
|
|
1345
|
-
if (
|
|
1347
|
+
if (B && !r.De && !((n?.ge ?? 0) & a)) {
|
|
1346
1348
|
r.pe = e === undefined ? w : e;
|
|
1347
1349
|
G.add(r);
|
|
1348
1350
|
}
|
|
@@ -1362,35 +1364,35 @@ function isEqual(e, t) {
|
|
|
1362
1364
|
return e === t;
|
|
1363
1365
|
}
|
|
1364
1366
|
function untrack(e, t) {
|
|
1365
|
-
if (!I && !
|
|
1366
|
-
const n =
|
|
1367
|
-
|
|
1367
|
+
if (!I && !T && true) return e();
|
|
1368
|
+
const n = T;
|
|
1369
|
+
T = false;
|
|
1368
1370
|
try {
|
|
1369
1371
|
if (I) return I.untrack(e);
|
|
1370
1372
|
return e();
|
|
1371
1373
|
} finally {
|
|
1372
|
-
|
|
1374
|
+
T = n;
|
|
1373
1375
|
}
|
|
1374
1376
|
}
|
|
1375
1377
|
function read(e) {
|
|
1376
|
-
if (
|
|
1378
|
+
if (F) {
|
|
1377
1379
|
const t = getLatestValueComputed(e);
|
|
1378
|
-
const n =
|
|
1379
|
-
|
|
1380
|
+
const n = F;
|
|
1381
|
+
F = false;
|
|
1380
1382
|
const r = e.ee !== undefined && e.ee !== S ? e.ee : e.$;
|
|
1381
1383
|
let i;
|
|
1382
1384
|
try {
|
|
1383
1385
|
i = read(t);
|
|
1384
1386
|
} catch (e) {
|
|
1385
|
-
if (!
|
|
1387
|
+
if (!V && e instanceof NotReadyError) return r;
|
|
1386
1388
|
throw e;
|
|
1387
1389
|
} finally {
|
|
1388
|
-
|
|
1390
|
+
F = n;
|
|
1389
1391
|
}
|
|
1390
1392
|
if (t.ge & a) return r;
|
|
1391
|
-
if (H &&
|
|
1393
|
+
if (H && M && t.Y) {
|
|
1392
1394
|
const e = findLane(t.Y);
|
|
1393
|
-
const n = findLane(
|
|
1395
|
+
const n = findLane(M);
|
|
1394
1396
|
if (e !== n && e.H.size > 0) {
|
|
1395
1397
|
return r;
|
|
1396
1398
|
}
|
|
@@ -1401,25 +1403,31 @@ function read(e) {
|
|
|
1401
1403
|
const t = e.I;
|
|
1402
1404
|
const n = q;
|
|
1403
1405
|
q = false;
|
|
1404
|
-
if (
|
|
1405
|
-
|
|
1406
|
+
if (t && e.ee !== undefined) {
|
|
1407
|
+
if (e.ee !== S && (t.Oe || !!(t.ge & a))) {
|
|
1408
|
+
D = true;
|
|
1409
|
+
}
|
|
1410
|
+
} else {
|
|
1411
|
+
if (read(getPendingSignal(e))) D = true;
|
|
1412
|
+
if (t && read(getPendingSignal(t))) D = true;
|
|
1413
|
+
}
|
|
1406
1414
|
q = n;
|
|
1407
1415
|
return e.$;
|
|
1408
1416
|
}
|
|
1409
|
-
let t =
|
|
1417
|
+
let t = V;
|
|
1410
1418
|
if (t?.t) t = t.u;
|
|
1411
|
-
if (Q && e.
|
|
1419
|
+
if (Q && e.R) recompute(e);
|
|
1412
1420
|
if (e.m & l) {
|
|
1413
1421
|
e.m &= ~l;
|
|
1414
1422
|
recompute(e, true);
|
|
1415
1423
|
}
|
|
1416
1424
|
const n = e.I || e;
|
|
1417
|
-
if (t &&
|
|
1418
|
-
if (e.
|
|
1425
|
+
if (t && T) {
|
|
1426
|
+
if (e.R && e.m & u) recompute(e);
|
|
1419
1427
|
link(e, t);
|
|
1420
|
-
if (n.
|
|
1428
|
+
if (n.R) {
|
|
1421
1429
|
const r = e.m & o;
|
|
1422
|
-
if (n.o >= (r ? v.
|
|
1430
|
+
if (n.o >= (r ? v.j : P.j)) {
|
|
1423
1431
|
markNode(t);
|
|
1424
1432
|
markHeap(r ? v : P);
|
|
1425
1433
|
updateIfNecessary(n);
|
|
@@ -1432,28 +1440,31 @@ function read(e) {
|
|
|
1432
1440
|
}
|
|
1433
1441
|
if (n.ge & a) {
|
|
1434
1442
|
if (t && !(H && n.K && k !== n.K)) {
|
|
1435
|
-
if (
|
|
1443
|
+
if (M) {
|
|
1436
1444
|
const r = n.Y;
|
|
1437
|
-
const i = findLane(
|
|
1445
|
+
const i = findLane(M);
|
|
1438
1446
|
if (r && findLane(r) === i && !hasActiveOverride(n)) {
|
|
1439
|
-
if (!
|
|
1447
|
+
if (!T && e !== t) link(e, t);
|
|
1440
1448
|
throw n.ae;
|
|
1441
1449
|
}
|
|
1442
1450
|
} else {
|
|
1443
|
-
if (!
|
|
1451
|
+
if (!T && e !== t) link(e, t);
|
|
1444
1452
|
throw n.ae;
|
|
1445
1453
|
}
|
|
1454
|
+
} else if (t && n !== e && n.ge & p) {
|
|
1455
|
+
if (!T && e !== t) link(e, t);
|
|
1456
|
+
throw n.ae;
|
|
1446
1457
|
} else if (!t && n.ge & p) {
|
|
1447
1458
|
throw n.ae;
|
|
1448
1459
|
}
|
|
1449
1460
|
}
|
|
1450
|
-
if (e.
|
|
1461
|
+
if (e.R && e.ge & d) {
|
|
1451
1462
|
if (e.de < E) {
|
|
1452
1463
|
recompute(e, true);
|
|
1453
1464
|
return read(e);
|
|
1454
1465
|
} else throw e.ae;
|
|
1455
1466
|
}
|
|
1456
|
-
if (
|
|
1467
|
+
if (B && t && t.he) {
|
|
1457
1468
|
const n = e.pe;
|
|
1458
1469
|
if (n !== undefined) {
|
|
1459
1470
|
const r = n === w ? undefined : n;
|
|
@@ -1467,21 +1478,21 @@ function read(e) {
|
|
|
1467
1478
|
return e.ee;
|
|
1468
1479
|
}
|
|
1469
1480
|
return !t ||
|
|
1470
|
-
(
|
|
1481
|
+
(M !== null && (e.ee !== undefined || e.Y || (n === e && H) || !!(n.ge & a))) ||
|
|
1471
1482
|
e.Z === S ||
|
|
1472
1483
|
(H && e.K && k !== e.K)
|
|
1473
1484
|
? e.$
|
|
1474
1485
|
: e.Z;
|
|
1475
1486
|
}
|
|
1476
1487
|
function setSignal(e, t) {
|
|
1477
|
-
if (e.K && k !== e.K)
|
|
1478
|
-
const n = e.ee !== undefined && !
|
|
1488
|
+
if (e.K && k !== e.K) A.initTransition(e.K);
|
|
1489
|
+
const n = e.ee !== undefined && !W;
|
|
1479
1490
|
const r = e.ee !== undefined && e.ee !== S;
|
|
1480
1491
|
const i = n ? (r ? e.ee : e.$) : e.Z === S ? e.$ : e.Z;
|
|
1481
1492
|
if (typeof t === "function") t = t(i);
|
|
1482
1493
|
const s = !e.xe || !e.xe(i, t) || !!(e.ge & p);
|
|
1483
1494
|
if (!s) {
|
|
1484
|
-
if (n && r && e.
|
|
1495
|
+
if (n && r && e.R) {
|
|
1485
1496
|
insertSubs(e, true);
|
|
1486
1497
|
schedule();
|
|
1487
1498
|
}
|
|
@@ -1489,17 +1500,17 @@ function setSignal(e, t) {
|
|
|
1489
1500
|
}
|
|
1490
1501
|
if (n) {
|
|
1491
1502
|
const n = e.ee === S;
|
|
1492
|
-
if (!n)
|
|
1503
|
+
if (!n) A.initTransition(resolveTransition(e));
|
|
1493
1504
|
if (n) {
|
|
1494
1505
|
e.Z = e.$;
|
|
1495
|
-
|
|
1506
|
+
A.U.push(e);
|
|
1496
1507
|
}
|
|
1497
1508
|
e.we = true;
|
|
1498
1509
|
const r = getOrCreateLane(e);
|
|
1499
1510
|
e.Y = r;
|
|
1500
1511
|
e.ee = t;
|
|
1501
1512
|
} else {
|
|
1502
|
-
if (e.Z === S)
|
|
1513
|
+
if (e.Z === S) A.se.push(e);
|
|
1503
1514
|
e.Z = t;
|
|
1504
1515
|
}
|
|
1505
1516
|
updatePendingSignal(e);
|
|
@@ -1512,26 +1523,26 @@ function setSignal(e, t) {
|
|
|
1512
1523
|
return t;
|
|
1513
1524
|
}
|
|
1514
1525
|
function runWithOwner(e, t) {
|
|
1515
|
-
const n =
|
|
1516
|
-
const r =
|
|
1517
|
-
|
|
1518
|
-
|
|
1526
|
+
const n = V;
|
|
1527
|
+
const r = T;
|
|
1528
|
+
V = e;
|
|
1529
|
+
T = false;
|
|
1519
1530
|
try {
|
|
1520
1531
|
return t();
|
|
1521
1532
|
} finally {
|
|
1522
|
-
|
|
1523
|
-
|
|
1533
|
+
V = n;
|
|
1534
|
+
T = r;
|
|
1524
1535
|
}
|
|
1525
1536
|
}
|
|
1526
1537
|
function getPendingSignal(e) {
|
|
1527
|
-
if (!e.
|
|
1528
|
-
e.
|
|
1538
|
+
if (!e.Fe) {
|
|
1539
|
+
e.Fe = optimisticSignal(false, { pureWrite: true });
|
|
1529
1540
|
if (e.ye) {
|
|
1530
|
-
e.
|
|
1541
|
+
e.Fe.ye = e;
|
|
1531
1542
|
}
|
|
1532
|
-
if (computePendingState(e)) setSignal(e.
|
|
1543
|
+
if (computePendingState(e)) setSignal(e.Fe, true);
|
|
1533
1544
|
}
|
|
1534
|
-
return e.
|
|
1545
|
+
return e.Fe;
|
|
1535
1546
|
}
|
|
1536
1547
|
function computePendingState(e) {
|
|
1537
1548
|
const t = e;
|
|
@@ -1547,13 +1558,16 @@ function computePendingState(e) {
|
|
|
1547
1558
|
}
|
|
1548
1559
|
return true;
|
|
1549
1560
|
}
|
|
1561
|
+
if (e.ee !== undefined && e.ee === S && !e.ye) {
|
|
1562
|
+
return false;
|
|
1563
|
+
}
|
|
1550
1564
|
if (e.Z !== S && !(t.ge & p)) return true;
|
|
1551
1565
|
return !!(t.ge & a && !(t.ge & p));
|
|
1552
1566
|
}
|
|
1553
1567
|
function updatePendingSignal(e) {
|
|
1554
|
-
if (e.
|
|
1568
|
+
if (e.Fe) {
|
|
1555
1569
|
const t = computePendingState(e);
|
|
1556
|
-
const n = e.
|
|
1570
|
+
const n = e.Fe;
|
|
1557
1571
|
setSignal(n, t);
|
|
1558
1572
|
if (!t && n.Y) {
|
|
1559
1573
|
const t = resolveLane(e);
|
|
@@ -1563,24 +1577,24 @@ function updatePendingSignal(e) {
|
|
|
1563
1577
|
mergeLanes(t, e);
|
|
1564
1578
|
}
|
|
1565
1579
|
}
|
|
1566
|
-
|
|
1580
|
+
N.delete(n);
|
|
1567
1581
|
n.Y = undefined;
|
|
1568
1582
|
}
|
|
1569
1583
|
}
|
|
1570
1584
|
}
|
|
1571
1585
|
function getLatestValueComputed(e) {
|
|
1572
1586
|
if (!e.Pe) {
|
|
1573
|
-
const t =
|
|
1574
|
-
|
|
1587
|
+
const t = F;
|
|
1588
|
+
F = false;
|
|
1575
1589
|
const n = q;
|
|
1576
1590
|
q = false;
|
|
1577
|
-
const r =
|
|
1578
|
-
|
|
1591
|
+
const r = V;
|
|
1592
|
+
V = null;
|
|
1579
1593
|
e.Pe = optimisticComputed(() => read(e));
|
|
1580
1594
|
e.Pe.ye = e;
|
|
1581
|
-
|
|
1595
|
+
V = r;
|
|
1582
1596
|
q = n;
|
|
1583
|
-
|
|
1597
|
+
F = t;
|
|
1584
1598
|
}
|
|
1585
1599
|
return e.Pe;
|
|
1586
1600
|
}
|
|
@@ -1594,12 +1608,12 @@ function staleValues(e, t = true) {
|
|
|
1594
1608
|
}
|
|
1595
1609
|
}
|
|
1596
1610
|
function latest(e) {
|
|
1597
|
-
const t =
|
|
1598
|
-
|
|
1611
|
+
const t = F;
|
|
1612
|
+
F = true;
|
|
1599
1613
|
try {
|
|
1600
1614
|
return e();
|
|
1601
1615
|
} finally {
|
|
1602
|
-
|
|
1616
|
+
F = t;
|
|
1603
1617
|
}
|
|
1604
1618
|
}
|
|
1605
1619
|
function isPending(e) {
|
|
@@ -1666,15 +1680,15 @@ function effect(e, t, n, r, i) {
|
|
|
1666
1680
|
const o = computed(i?.render ? t => staleValues(() => e(t)) : e, r, {
|
|
1667
1681
|
...i,
|
|
1668
1682
|
equals: () => {
|
|
1669
|
-
o.
|
|
1670
|
-
if (s) o.
|
|
1683
|
+
o.F = !o.ae;
|
|
1684
|
+
if (s) o.V.enqueue(o.D, runEffect.bind(o));
|
|
1671
1685
|
return false;
|
|
1672
1686
|
},
|
|
1673
1687
|
lazy: true
|
|
1674
1688
|
});
|
|
1675
|
-
o.
|
|
1676
|
-
o.
|
|
1677
|
-
o.
|
|
1689
|
+
o.Ve = r;
|
|
1690
|
+
o.Me = t;
|
|
1691
|
+
o.Be = n;
|
|
1678
1692
|
o.Ge = undefined;
|
|
1679
1693
|
o.D = i?.render ? h : g;
|
|
1680
1694
|
o.ve = (e, t) => {
|
|
@@ -1682,11 +1696,11 @@ function effect(e, t, n, r, i) {
|
|
|
1682
1696
|
const r = t !== undefined ? t : o.ae;
|
|
1683
1697
|
if (n & d) {
|
|
1684
1698
|
let e = r;
|
|
1685
|
-
o.
|
|
1699
|
+
o.V.notify(o, a, 0);
|
|
1686
1700
|
if (o.D === g) {
|
|
1687
1701
|
try {
|
|
1688
|
-
return o.
|
|
1689
|
-
? o.
|
|
1702
|
+
return o.Be
|
|
1703
|
+
? o.Be(e, () => {
|
|
1690
1704
|
o.Ge?.();
|
|
1691
1705
|
o.Ge = undefined;
|
|
1692
1706
|
})
|
|
@@ -1695,36 +1709,39 @@ function effect(e, t, n, r, i) {
|
|
|
1695
1709
|
e = t;
|
|
1696
1710
|
}
|
|
1697
1711
|
}
|
|
1698
|
-
if (!o.
|
|
1712
|
+
if (!o.V.notify(o, d, d)) throw e;
|
|
1699
1713
|
} else if (o.D === h) {
|
|
1700
|
-
o.
|
|
1714
|
+
o.V.notify(o, a | d, n, r);
|
|
1701
1715
|
}
|
|
1702
1716
|
};
|
|
1703
1717
|
recompute(o, true);
|
|
1704
|
-
!i?.defer && (o.D === g ? o.
|
|
1718
|
+
!i?.defer && (o.D === g ? o.V.enqueue(o.D, runEffect.bind(o)) : runEffect.call(o));
|
|
1705
1719
|
s = true;
|
|
1706
|
-
|
|
1720
|
+
cleanup(() => o.Ge?.());
|
|
1707
1721
|
}
|
|
1708
1722
|
function runEffect() {
|
|
1709
|
-
if (!this.
|
|
1723
|
+
if (!this.F || this.m & u) return;
|
|
1710
1724
|
this.Ge?.();
|
|
1711
1725
|
this.Ge = undefined;
|
|
1712
1726
|
try {
|
|
1713
|
-
this.Ge = this.
|
|
1727
|
+
this.Ge = this.Me(this.$, this.Ve);
|
|
1714
1728
|
} catch (e) {
|
|
1715
1729
|
this.ae = new StatusError(this, e);
|
|
1716
1730
|
this.ge |= d;
|
|
1717
|
-
if (!this.
|
|
1731
|
+
if (!this.V.notify(this, d, d)) throw e;
|
|
1718
1732
|
} finally {
|
|
1719
|
-
this.
|
|
1720
|
-
this.
|
|
1733
|
+
this.Ve = this.$;
|
|
1734
|
+
this.F = false;
|
|
1721
1735
|
}
|
|
1722
1736
|
}
|
|
1723
1737
|
function trackedEffect(e, t) {
|
|
1724
1738
|
const run = () => {
|
|
1725
|
-
if (!n.
|
|
1726
|
-
|
|
1727
|
-
|
|
1739
|
+
if (!n.F || n.m & u) return;
|
|
1740
|
+
try {
|
|
1741
|
+
n.F = false;
|
|
1742
|
+
recompute(n);
|
|
1743
|
+
} finally {
|
|
1744
|
+
}
|
|
1728
1745
|
};
|
|
1729
1746
|
const n = computed(
|
|
1730
1747
|
() => {
|
|
@@ -1737,22 +1754,22 @@ function trackedEffect(e, t) {
|
|
|
1737
1754
|
);
|
|
1738
1755
|
n.Ge = undefined;
|
|
1739
1756
|
n.Ke = true;
|
|
1740
|
-
n.
|
|
1757
|
+
n.F = true;
|
|
1741
1758
|
n.D = y;
|
|
1742
1759
|
n.ve = (e, t) => {
|
|
1743
1760
|
const r = e !== undefined ? e : n.ge;
|
|
1744
1761
|
if (r & d) {
|
|
1745
|
-
n.
|
|
1762
|
+
n.V.notify(n, a, 0);
|
|
1746
1763
|
const e = t !== undefined ? t : n.ae;
|
|
1747
|
-
if (!n.
|
|
1764
|
+
if (!n.V.notify(n, d, d)) throw e;
|
|
1748
1765
|
}
|
|
1749
1766
|
};
|
|
1750
|
-
n.
|
|
1751
|
-
n.
|
|
1752
|
-
|
|
1767
|
+
n.M = run;
|
|
1768
|
+
n.V.enqueue(g, run);
|
|
1769
|
+
cleanup(() => n.Ge?.());
|
|
1753
1770
|
}
|
|
1754
1771
|
function restoreTransition(e, t) {
|
|
1755
|
-
|
|
1772
|
+
A.initTransition(e);
|
|
1756
1773
|
const n = t();
|
|
1757
1774
|
flush();
|
|
1758
1775
|
return n;
|
|
@@ -1761,7 +1778,7 @@ function action(e) {
|
|
|
1761
1778
|
return (...t) =>
|
|
1762
1779
|
new Promise((n, r) => {
|
|
1763
1780
|
const i = e(...t);
|
|
1764
|
-
|
|
1781
|
+
A.initTransition();
|
|
1765
1782
|
let s = k;
|
|
1766
1783
|
s.G.push(i);
|
|
1767
1784
|
const done = (e, t) => {
|
|
@@ -1795,6 +1812,9 @@ function action(e) {
|
|
|
1795
1812
|
step();
|
|
1796
1813
|
});
|
|
1797
1814
|
}
|
|
1815
|
+
function onCleanup(e) {
|
|
1816
|
+
return cleanup(e);
|
|
1817
|
+
}
|
|
1798
1818
|
function accessor(e) {
|
|
1799
1819
|
const t = read.bind(null, e);
|
|
1800
1820
|
t.$r = true;
|
|
@@ -1823,7 +1843,7 @@ function createTrackedEffect(e, t) {
|
|
|
1823
1843
|
}
|
|
1824
1844
|
function createReaction(e, t) {
|
|
1825
1845
|
let n = undefined;
|
|
1826
|
-
|
|
1846
|
+
cleanup(() => n?.());
|
|
1827
1847
|
const r = getOwner();
|
|
1828
1848
|
return i => {
|
|
1829
1849
|
runWithOwner(r, () => {
|
|
@@ -1864,13 +1884,13 @@ function onSettled(e) {
|
|
|
1864
1884
|
const t = getOwner();
|
|
1865
1885
|
t && !t.Ke
|
|
1866
1886
|
? createTrackedEffect(() => untrack(e))
|
|
1867
|
-
:
|
|
1887
|
+
: A.enqueue(g, () => {
|
|
1868
1888
|
const t = e();
|
|
1869
1889
|
t?.();
|
|
1870
1890
|
});
|
|
1871
1891
|
}
|
|
1872
1892
|
function unwrap(e) {
|
|
1873
|
-
return e?.[
|
|
1893
|
+
return e?.[z]?.[$] ?? e;
|
|
1874
1894
|
}
|
|
1875
1895
|
function getOverrideValue(e, t, n, r, i) {
|
|
1876
1896
|
if (i && r in i) return i[r];
|
|
@@ -1882,16 +1902,16 @@ function getAllKeys(e, t, n) {
|
|
|
1882
1902
|
return Array.from(new Set([...r, ...i]));
|
|
1883
1903
|
}
|
|
1884
1904
|
function applyState(e, t, n) {
|
|
1885
|
-
const r = t?.[
|
|
1905
|
+
const r = t?.[z];
|
|
1886
1906
|
if (!r) return;
|
|
1887
|
-
const i = r[
|
|
1888
|
-
const s = r[
|
|
1889
|
-
const o = r[
|
|
1890
|
-
let u = r[
|
|
1907
|
+
const i = r[X];
|
|
1908
|
+
const s = r[Y];
|
|
1909
|
+
const o = r[Z];
|
|
1910
|
+
let u = r[$];
|
|
1891
1911
|
if (e === i && !s && !o) return;
|
|
1892
|
-
(r[
|
|
1893
|
-
r[
|
|
1894
|
-
r[
|
|
1912
|
+
(r[ne] || se).set(e, r[U]);
|
|
1913
|
+
r[X] = e;
|
|
1914
|
+
r[Y] = undefined;
|
|
1895
1915
|
if (Array.isArray(i)) {
|
|
1896
1916
|
let t = false;
|
|
1897
1917
|
const f = getOverrideValue(i, s, u, "length", o);
|
|
@@ -1919,16 +1939,16 @@ function applyState(e, t, n) {
|
|
|
1919
1939
|
if (a > p || a > d) {
|
|
1920
1940
|
for (l = a; l <= p; l++) {
|
|
1921
1941
|
t = true;
|
|
1922
|
-
r[
|
|
1942
|
+
r[$][l] && setSignal(r[$][l], wrap(e[l], r));
|
|
1923
1943
|
}
|
|
1924
1944
|
for (; l < e.length; l++) {
|
|
1925
1945
|
t = true;
|
|
1926
1946
|
const i = wrap(S[l], r);
|
|
1927
|
-
r[
|
|
1947
|
+
r[$][l] && setSignal(r[$][l], i);
|
|
1928
1948
|
applyState(e[l], i, n);
|
|
1929
1949
|
}
|
|
1930
|
-
t && r[
|
|
1931
|
-
f !== e.length && r[
|
|
1950
|
+
t && r[$][K] && setSignal(r[$][K], void 0);
|
|
1951
|
+
f !== e.length && r[$].length && setSignal(r[$].length, e.length);
|
|
1932
1952
|
return;
|
|
1933
1953
|
}
|
|
1934
1954
|
g = new Array(p + 1);
|
|
@@ -1952,26 +1972,26 @@ function applyState(e, t, n) {
|
|
|
1952
1972
|
for (l = a; l < e.length; l++) {
|
|
1953
1973
|
if (l in S) {
|
|
1954
1974
|
const t = wrap(S[l], r);
|
|
1955
|
-
r[
|
|
1975
|
+
r[$][l] && setSignal(r[$][l], t);
|
|
1956
1976
|
applyState(e[l], t, n);
|
|
1957
|
-
} else r[
|
|
1977
|
+
} else r[$][l] && setSignal(r[$][l], wrap(e[l], r));
|
|
1958
1978
|
}
|
|
1959
1979
|
if (a < e.length) t = true;
|
|
1960
1980
|
} else if (e.length) {
|
|
1961
1981
|
for (let t = 0, f = e.length; t < f; t++) {
|
|
1962
1982
|
const f = getOverrideValue(i, s, u, t, o);
|
|
1963
|
-
isWrappable(f) ? applyState(e[t], wrap(f, r), n) : r[
|
|
1983
|
+
isWrappable(f) ? applyState(e[t], wrap(f, r), n) : r[$][t] && setSignal(r[$][t], e[t]);
|
|
1964
1984
|
}
|
|
1965
1985
|
}
|
|
1966
1986
|
if (f !== e.length) {
|
|
1967
1987
|
t = true;
|
|
1968
|
-
r[
|
|
1988
|
+
r[$].length && setSignal(r[$].length, e.length);
|
|
1969
1989
|
}
|
|
1970
|
-
t && r[
|
|
1990
|
+
t && r[$][K] && setSignal(r[$][K], void 0);
|
|
1971
1991
|
return;
|
|
1972
1992
|
}
|
|
1973
1993
|
if (u) {
|
|
1974
|
-
const t = u[
|
|
1994
|
+
const t = u[K];
|
|
1975
1995
|
const f = t ? getAllKeys(i, s, e) : Object.keys(u);
|
|
1976
1996
|
for (let c = 0, l = f.length; c < l; c++) {
|
|
1977
1997
|
const l = f[c];
|
|
@@ -1985,7 +2005,7 @@ function applyState(e, t, n) {
|
|
|
1985
2005
|
} else applyState(p, wrap(d, r), n);
|
|
1986
2006
|
}
|
|
1987
2007
|
}
|
|
1988
|
-
if ((u = r[
|
|
2008
|
+
if ((u = r[ee])) {
|
|
1989
2009
|
const t = Object.keys(u);
|
|
1990
2010
|
for (let n = 0, r = t.length; n < r; n++) {
|
|
1991
2011
|
const r = t[n];
|
|
@@ -2007,9 +2027,9 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2007
2027
|
let r;
|
|
2008
2028
|
const i = new WeakMap();
|
|
2009
2029
|
const wrapper = e => {
|
|
2010
|
-
e[
|
|
2011
|
-
e[
|
|
2012
|
-
Object.defineProperty(e,
|
|
2030
|
+
e[te] = wrapProjection;
|
|
2031
|
+
e[ne] = i;
|
|
2032
|
+
Object.defineProperty(e, re, {
|
|
2013
2033
|
get() {
|
|
2014
2034
|
return r;
|
|
2015
2035
|
},
|
|
@@ -2018,19 +2038,27 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2018
2038
|
};
|
|
2019
2039
|
const wrapProjection = e => {
|
|
2020
2040
|
if (i.has(e)) return i.get(e);
|
|
2021
|
-
if (e[
|
|
2022
|
-
const t = createStoreProxy(e,
|
|
2041
|
+
if (e[z]?.[te] === wrapProjection) return e;
|
|
2042
|
+
const t = createStoreProxy(e, fe, wrapper);
|
|
2023
2043
|
i.set(e, t);
|
|
2024
2044
|
return t;
|
|
2025
2045
|
};
|
|
2026
2046
|
const s = wrapProjection(t);
|
|
2027
2047
|
r = computed(() => {
|
|
2028
2048
|
const t = getOwner();
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2049
|
+
let r = false;
|
|
2050
|
+
let i;
|
|
2051
|
+
const o = new Proxy(
|
|
2052
|
+
s,
|
|
2053
|
+
createWriteTraps(() => !r || t.Oe === i)
|
|
2054
|
+
);
|
|
2055
|
+
storeSetter(o, o => {
|
|
2056
|
+
i = e(o);
|
|
2057
|
+
r = true;
|
|
2058
|
+
const u = handleAsync(t, i, e => {
|
|
2059
|
+
e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
|
|
2032
2060
|
});
|
|
2033
|
-
|
|
2061
|
+
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2034
2062
|
});
|
|
2035
2063
|
});
|
|
2036
2064
|
r.Qe = true;
|
|
@@ -2039,80 +2067,85 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2039
2067
|
function createProjection(e, t = {}, n) {
|
|
2040
2068
|
return createProjectionInternal(e, t, n).store;
|
|
2041
2069
|
}
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2070
|
+
function createWriteTraps(e) {
|
|
2071
|
+
const t = {
|
|
2072
|
+
get(e, n) {
|
|
2073
|
+
let r;
|
|
2074
|
+
setWriteOverride(true);
|
|
2075
|
+
setProjectionWriteActive(true);
|
|
2076
|
+
try {
|
|
2077
|
+
r = e[n];
|
|
2078
|
+
} finally {
|
|
2079
|
+
setWriteOverride(false);
|
|
2080
|
+
setProjectionWriteActive(false);
|
|
2081
|
+
}
|
|
2082
|
+
return typeof r === "object" && r !== null ? new Proxy(r, t) : r;
|
|
2083
|
+
},
|
|
2084
|
+
set(t, n, r) {
|
|
2085
|
+
if (e && !e()) return true;
|
|
2086
|
+
setWriteOverride(true);
|
|
2087
|
+
setProjectionWriteActive(true);
|
|
2088
|
+
try {
|
|
2089
|
+
t[n] = r;
|
|
2090
|
+
} finally {
|
|
2091
|
+
setWriteOverride(false);
|
|
2092
|
+
setProjectionWriteActive(false);
|
|
2093
|
+
}
|
|
2094
|
+
return true;
|
|
2095
|
+
},
|
|
2096
|
+
deleteProperty(t, n) {
|
|
2097
|
+
if (e && !e()) return true;
|
|
2098
|
+
setWriteOverride(true);
|
|
2099
|
+
setProjectionWriteActive(true);
|
|
2100
|
+
try {
|
|
2101
|
+
delete t[n];
|
|
2102
|
+
} finally {
|
|
2103
|
+
setWriteOverride(false);
|
|
2104
|
+
setProjectionWriteActive(false);
|
|
2105
|
+
}
|
|
2106
|
+
return true;
|
|
2074
2107
|
}
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
}
|
|
2078
|
-
const
|
|
2108
|
+
};
|
|
2109
|
+
return t;
|
|
2110
|
+
}
|
|
2111
|
+
const K = Symbol(0),
|
|
2112
|
+
z = Symbol(0),
|
|
2079
2113
|
U = Symbol(0),
|
|
2080
|
-
J = Symbol(0)
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
Z = "
|
|
2084
|
-
$ = "
|
|
2085
|
-
ee = "
|
|
2086
|
-
te = "
|
|
2087
|
-
ne = "
|
|
2088
|
-
re = "
|
|
2089
|
-
ie = "
|
|
2090
|
-
|
|
2091
|
-
function createStoreProxy(e, t = ce, n) {
|
|
2114
|
+
J = Symbol(0);
|
|
2115
|
+
const X = "v",
|
|
2116
|
+
Y = "o",
|
|
2117
|
+
Z = "x",
|
|
2118
|
+
$ = "n",
|
|
2119
|
+
ee = "h",
|
|
2120
|
+
te = "w",
|
|
2121
|
+
ne = "l",
|
|
2122
|
+
re = "f",
|
|
2123
|
+
ie = "p";
|
|
2124
|
+
function createStoreProxy(e, t = fe, n) {
|
|
2092
2125
|
let r;
|
|
2093
2126
|
if (Array.isArray(e)) {
|
|
2094
2127
|
r = [];
|
|
2095
2128
|
r.v = e;
|
|
2096
2129
|
} else r = { v: e };
|
|
2097
2130
|
n && n(r);
|
|
2098
|
-
return (r[
|
|
2131
|
+
return (r[U] = new Proxy(r, t));
|
|
2099
2132
|
}
|
|
2100
|
-
const
|
|
2133
|
+
const se = new WeakMap();
|
|
2101
2134
|
function wrap(e, t) {
|
|
2102
|
-
if (t?.[
|
|
2103
|
-
let n = e[
|
|
2104
|
-
if (!n)
|
|
2135
|
+
if (t?.[te]) return t[te](e, t);
|
|
2136
|
+
let n = e[U] || se.get(e);
|
|
2137
|
+
if (!n) se.set(e, (n = createStoreProxy(e)));
|
|
2105
2138
|
return n;
|
|
2106
2139
|
}
|
|
2107
2140
|
function isWrappable(e) {
|
|
2108
2141
|
return e != null && typeof e === "object" && !Object.isFrozen(e);
|
|
2109
2142
|
}
|
|
2110
|
-
let
|
|
2143
|
+
let oe = false;
|
|
2111
2144
|
function setWriteOverride(e) {
|
|
2112
|
-
|
|
2145
|
+
oe = e;
|
|
2113
2146
|
}
|
|
2114
2147
|
function writeOnly(e) {
|
|
2115
|
-
return
|
|
2148
|
+
return oe || !!ue?.has(e);
|
|
2116
2149
|
}
|
|
2117
2150
|
function getNodes(e, t) {
|
|
2118
2151
|
let n = e[t];
|
|
@@ -2141,8 +2174,8 @@ function getNode(e, t, n, r, i = isEqual, s, o) {
|
|
|
2141
2174
|
}
|
|
2142
2175
|
return (e[t] = u);
|
|
2143
2176
|
}
|
|
2144
|
-
function trackSelf(e, t =
|
|
2145
|
-
getObserver() && read(getNode(getNodes(e,
|
|
2177
|
+
function trackSelf(e, t = K) {
|
|
2178
|
+
getObserver() && read(getNode(getNodes(e, $), t, undefined, e[re], false, e[ie]));
|
|
2146
2179
|
}
|
|
2147
2180
|
function getKeys(e, t, n = true) {
|
|
2148
2181
|
const r = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
|
|
@@ -2150,7 +2183,7 @@ function getKeys(e, t, n = true) {
|
|
|
2150
2183
|
const i = new Set(r);
|
|
2151
2184
|
const s = Reflect.ownKeys(t);
|
|
2152
2185
|
for (const e of s) {
|
|
2153
|
-
if (t[e] !==
|
|
2186
|
+
if (t[e] !== J) i.add(e);
|
|
2154
2187
|
else i.delete(e);
|
|
2155
2188
|
}
|
|
2156
2189
|
return Array.from(i);
|
|
@@ -2158,27 +2191,27 @@ function getKeys(e, t, n = true) {
|
|
|
2158
2191
|
function getPropertyDescriptor(e, t, n) {
|
|
2159
2192
|
let r = e;
|
|
2160
2193
|
if (t && n in t) {
|
|
2161
|
-
if (r[n] ===
|
|
2194
|
+
if (r[n] === J) return void 0;
|
|
2162
2195
|
if (!(n in r)) r = t;
|
|
2163
2196
|
}
|
|
2164
2197
|
return Reflect.getOwnPropertyDescriptor(r, n);
|
|
2165
2198
|
}
|
|
2166
|
-
let
|
|
2167
|
-
const
|
|
2199
|
+
let ue = null;
|
|
2200
|
+
const fe = {
|
|
2168
2201
|
get(e, t, n) {
|
|
2169
|
-
if (t ===
|
|
2170
|
-
if (t ===
|
|
2171
|
-
if (t === O) return e[
|
|
2172
|
-
if (t ===
|
|
2202
|
+
if (t === z) return e;
|
|
2203
|
+
if (t === U) return n;
|
|
2204
|
+
if (t === O) return e[re];
|
|
2205
|
+
if (t === K) {
|
|
2173
2206
|
trackSelf(e);
|
|
2174
2207
|
return n;
|
|
2175
2208
|
}
|
|
2176
|
-
const r = getNodes(e,
|
|
2209
|
+
const r = getNodes(e, $);
|
|
2177
2210
|
const i = r[t];
|
|
2178
|
-
const s = e[
|
|
2179
|
-
const o = s || (e[
|
|
2180
|
-
const u = !!e[
|
|
2181
|
-
const f = s ? e[
|
|
2211
|
+
const s = e[Z] && t in e[Z];
|
|
2212
|
+
const o = s || (e[Y] && t in e[Y]);
|
|
2213
|
+
const u = !!e[X][z];
|
|
2214
|
+
const f = s ? e[Z] : e[Y] && t in e[Y] ? e[Y] : e[X];
|
|
2182
2215
|
if (!i) {
|
|
2183
2216
|
const e = Object.getOwnPropertyDescriptor(f, t);
|
|
2184
2217
|
if (e && e.get) return e.get.call(n);
|
|
@@ -2186,45 +2219,45 @@ const ce = {
|
|
|
2186
2219
|
if (writeOnly(n)) {
|
|
2187
2220
|
let n =
|
|
2188
2221
|
i && (o || !u) ? (i.ee !== undefined && i.ee !== S ? i.ee : i.Z !== S ? i.Z : i.$) : f[t];
|
|
2189
|
-
n ===
|
|
2222
|
+
n === J && (n = undefined);
|
|
2190
2223
|
if (!isWrappable(n)) return n;
|
|
2191
2224
|
const r = wrap(n, e);
|
|
2192
|
-
|
|
2225
|
+
ue?.add(r);
|
|
2193
2226
|
return r;
|
|
2194
2227
|
}
|
|
2195
2228
|
let c = i ? (o || !u ? read(r[t]) : (read(r[t]), f[t])) : f[t];
|
|
2196
|
-
c ===
|
|
2229
|
+
c === J && (c = undefined);
|
|
2197
2230
|
if (!i) {
|
|
2198
2231
|
if (!o && typeof c === "function" && !f.hasOwnProperty(t)) {
|
|
2199
2232
|
let t;
|
|
2200
|
-
return !Array.isArray(e[
|
|
2233
|
+
return !Array.isArray(e[X]) && (t = Object.getPrototypeOf(e[X])) && t !== Object.prototype
|
|
2201
2234
|
? c.bind(f)
|
|
2202
2235
|
: c;
|
|
2203
2236
|
} else if (getObserver()) {
|
|
2204
|
-
return read(getNode(r, t, isWrappable(c) ? wrap(c, e) : c, e[
|
|
2237
|
+
return read(getNode(r, t, isWrappable(c) ? wrap(c, e) : c, e[re], isEqual, e[ie], e[m]));
|
|
2205
2238
|
}
|
|
2206
2239
|
}
|
|
2207
2240
|
return isWrappable(c) ? wrap(c, e) : c;
|
|
2208
2241
|
},
|
|
2209
2242
|
has(e, t) {
|
|
2210
|
-
if (t ===
|
|
2211
|
-
const n = e[
|
|
2212
|
-
getObserver() && read(getNode(getNodes(e,
|
|
2243
|
+
if (t === U || t === K || t === "__proto__") return true;
|
|
2244
|
+
const n = e[Z] && t in e[Z] ? e[Z][t] !== J : e[Y] && t in e[Y] ? e[Y][t] !== J : t in e[X];
|
|
2245
|
+
getObserver() && read(getNode(getNodes(e, ee), t, n, e[re], isEqual, e[ie]));
|
|
2213
2246
|
return n;
|
|
2214
2247
|
},
|
|
2215
2248
|
set(e, t, n) {
|
|
2216
|
-
const r = e[
|
|
2249
|
+
const r = e[U];
|
|
2217
2250
|
if (writeOnly(r)) {
|
|
2218
|
-
if (e[
|
|
2219
|
-
const t = e[
|
|
2251
|
+
if (e[ie]) {
|
|
2252
|
+
const t = e[re];
|
|
2220
2253
|
if (t?.K) {
|
|
2221
|
-
|
|
2254
|
+
A.initTransition(t.K);
|
|
2222
2255
|
}
|
|
2223
2256
|
}
|
|
2224
2257
|
untrack(() => {
|
|
2225
|
-
const i = e[
|
|
2258
|
+
const i = e[X];
|
|
2226
2259
|
const s = i[t];
|
|
2227
|
-
if (
|
|
2260
|
+
if (B && typeof t !== "symbol" && !((e[re]?.ge ?? 0) & a)) {
|
|
2228
2261
|
if (!e[m]) {
|
|
2229
2262
|
e[m] = Object.create(null);
|
|
2230
2263
|
G?.add(e);
|
|
@@ -2233,18 +2266,18 @@ const ce = {
|
|
|
2233
2266
|
e[m][t] = s;
|
|
2234
2267
|
}
|
|
2235
2268
|
}
|
|
2236
|
-
const o = e[
|
|
2237
|
-
const u = o ?
|
|
2269
|
+
const o = e[ie] && !W;
|
|
2270
|
+
const u = o ? Z : Y;
|
|
2238
2271
|
if (o) trackOptimisticStore(r);
|
|
2239
|
-
const f = e[
|
|
2240
|
-
const c = n?.[
|
|
2272
|
+
const f = e[Z] && t in e[Z] ? e[Z][t] : e[Y] && t in e[Y] ? e[Y][t] : s;
|
|
2273
|
+
const c = n?.[z]?.[X] ?? n;
|
|
2241
2274
|
if (f === c) return true;
|
|
2242
|
-
const l = e[
|
|
2275
|
+
const l = e[Z]?.length || e[Y]?.length || i.length;
|
|
2243
2276
|
if (c !== undefined && c === s) delete e[u][t];
|
|
2244
2277
|
else (e[u] || (e[u] = Object.create(null)))[t] = c;
|
|
2245
2278
|
const d = isWrappable(c);
|
|
2246
|
-
e[
|
|
2247
|
-
const p = getNodes(e,
|
|
2279
|
+
e[ee]?.[t] && setSignal(e[ee][t], true);
|
|
2280
|
+
const p = getNodes(e, $);
|
|
2248
2281
|
p[t] && setSignal(p[t], () => (d ? wrap(c, e) : c));
|
|
2249
2282
|
if (Array.isArray(i)) {
|
|
2250
2283
|
if (t === "length") {
|
|
@@ -2254,40 +2287,40 @@ const ce = {
|
|
|
2254
2287
|
if (e > l) p.length && setSignal(p.length, e);
|
|
2255
2288
|
}
|
|
2256
2289
|
}
|
|
2257
|
-
p[
|
|
2290
|
+
p[K] && setSignal(p[K], undefined);
|
|
2258
2291
|
});
|
|
2259
2292
|
}
|
|
2260
2293
|
return true;
|
|
2261
2294
|
},
|
|
2262
2295
|
deleteProperty(e, t) {
|
|
2263
|
-
const n = e[
|
|
2264
|
-
const r = e[
|
|
2265
|
-
if (writeOnly(e[
|
|
2296
|
+
const n = e[Z]?.[t] === J;
|
|
2297
|
+
const r = e[Y]?.[t] === J;
|
|
2298
|
+
if (writeOnly(e[U]) && !n && !r) {
|
|
2266
2299
|
untrack(() => {
|
|
2267
|
-
const n = e[
|
|
2268
|
-
const r = n ?
|
|
2269
|
-
if (n) trackOptimisticStore(e[
|
|
2270
|
-
const i = e[
|
|
2271
|
-
if (t in e[
|
|
2272
|
-
(e[r] || (e[r] = Object.create(null)))[t] =
|
|
2300
|
+
const n = e[ie] && !W;
|
|
2301
|
+
const r = n ? Z : Y;
|
|
2302
|
+
if (n) trackOptimisticStore(e[U]);
|
|
2303
|
+
const i = e[Z] && t in e[Z] ? e[Z][t] : e[Y] && t in e[Y] ? e[Y][t] : e[X][t];
|
|
2304
|
+
if (t in e[X] || (e[Y] && t in e[Y])) {
|
|
2305
|
+
(e[r] || (e[r] = Object.create(null)))[t] = J;
|
|
2273
2306
|
} else if (e[r] && t in e[r]) {
|
|
2274
2307
|
delete e[r][t];
|
|
2275
2308
|
} else return true;
|
|
2276
|
-
if (e[
|
|
2277
|
-
const s = getNodes(e,
|
|
2309
|
+
if (e[ee]?.[t]) setSignal(e[ee][t], false);
|
|
2310
|
+
const s = getNodes(e, $);
|
|
2278
2311
|
s[t] && setSignal(s[t], undefined);
|
|
2279
|
-
s[
|
|
2312
|
+
s[K] && setSignal(s[K], undefined);
|
|
2280
2313
|
});
|
|
2281
2314
|
}
|
|
2282
2315
|
return true;
|
|
2283
2316
|
},
|
|
2284
2317
|
ownKeys(e) {
|
|
2285
2318
|
trackSelf(e);
|
|
2286
|
-
let t = getKeys(e[
|
|
2287
|
-
if (e[
|
|
2319
|
+
let t = getKeys(e[X], e[Y], false);
|
|
2320
|
+
if (e[Z]) {
|
|
2288
2321
|
const n = new Set(t);
|
|
2289
|
-
for (const t of Reflect.ownKeys(e[
|
|
2290
|
-
if (e[
|
|
2322
|
+
for (const t of Reflect.ownKeys(e[Z])) {
|
|
2323
|
+
if (e[Z][t] !== J) n.add(t);
|
|
2291
2324
|
else n.delete(t);
|
|
2292
2325
|
}
|
|
2293
2326
|
t = Array.from(n);
|
|
@@ -2295,25 +2328,25 @@ const ce = {
|
|
|
2295
2328
|
return t;
|
|
2296
2329
|
},
|
|
2297
2330
|
getOwnPropertyDescriptor(e, t) {
|
|
2298
|
-
if (t ===
|
|
2299
|
-
if (e[
|
|
2300
|
-
if (e[
|
|
2301
|
-
const n = getPropertyDescriptor(e[
|
|
2331
|
+
if (t === U) return { value: e[U], writable: true, configurable: true };
|
|
2332
|
+
if (e[Z] && t in e[Z]) {
|
|
2333
|
+
if (e[Z][t] === J) return undefined;
|
|
2334
|
+
const n = getPropertyDescriptor(e[X], e[Y], t);
|
|
2302
2335
|
if (n) {
|
|
2303
|
-
return { ...n, value: e[
|
|
2336
|
+
return { ...n, value: e[Z][t] };
|
|
2304
2337
|
}
|
|
2305
|
-
return { value: e[
|
|
2338
|
+
return { value: e[Z][t], writable: true, enumerable: true, configurable: true };
|
|
2306
2339
|
}
|
|
2307
|
-
return getPropertyDescriptor(e[
|
|
2340
|
+
return getPropertyDescriptor(e[X], e[Y], t);
|
|
2308
2341
|
},
|
|
2309
2342
|
getPrototypeOf(e) {
|
|
2310
|
-
return Object.getPrototypeOf(e[
|
|
2343
|
+
return Object.getPrototypeOf(e[X]);
|
|
2311
2344
|
}
|
|
2312
2345
|
};
|
|
2313
2346
|
function storeSetter(e, t) {
|
|
2314
|
-
const n =
|
|
2315
|
-
|
|
2316
|
-
|
|
2347
|
+
const n = ue;
|
|
2348
|
+
ue = new Set();
|
|
2349
|
+
ue.add(e);
|
|
2317
2350
|
try {
|
|
2318
2351
|
const n = t(e);
|
|
2319
2352
|
if (n !== e && n !== undefined) {
|
|
@@ -2329,8 +2362,8 @@ function storeSetter(e, t) {
|
|
|
2329
2362
|
}
|
|
2330
2363
|
}
|
|
2331
2364
|
} finally {
|
|
2332
|
-
|
|
2333
|
-
|
|
2365
|
+
ue.clear();
|
|
2366
|
+
ue = n;
|
|
2334
2367
|
}
|
|
2335
2368
|
}
|
|
2336
2369
|
function createStore(e, t, n) {
|
|
@@ -2347,39 +2380,39 @@ function createOptimisticStore(e, t, n) {
|
|
|
2347
2380
|
return [o, e => storeSetter(o, e)];
|
|
2348
2381
|
}
|
|
2349
2382
|
function clearOptimisticStore(e) {
|
|
2350
|
-
const t = e[
|
|
2351
|
-
if (!t || !t[
|
|
2352
|
-
const n = t[
|
|
2353
|
-
const r = t[
|
|
2383
|
+
const t = e[z];
|
|
2384
|
+
if (!t || !t[Z]) return;
|
|
2385
|
+
const n = t[Z];
|
|
2386
|
+
const r = t[$];
|
|
2354
2387
|
setProjectionWriteActive(true);
|
|
2355
2388
|
try {
|
|
2356
2389
|
if (r) {
|
|
2357
2390
|
for (const e of Reflect.ownKeys(n)) {
|
|
2358
2391
|
if (r[e]) {
|
|
2359
2392
|
r[e].Y = undefined;
|
|
2360
|
-
const n = t[
|
|
2361
|
-
const i = n ===
|
|
2393
|
+
const n = t[Y] && e in t[Y] ? t[Y][e] : t[X][e];
|
|
2394
|
+
const i = n === J ? undefined : n;
|
|
2362
2395
|
setSignal(r[e], isWrappable(i) ? wrap(i, t) : i);
|
|
2363
2396
|
}
|
|
2364
2397
|
}
|
|
2365
|
-
if (r[
|
|
2366
|
-
r[
|
|
2367
|
-
setSignal(r[
|
|
2398
|
+
if (r[K]) {
|
|
2399
|
+
r[K].Y = undefined;
|
|
2400
|
+
setSignal(r[K], undefined);
|
|
2368
2401
|
}
|
|
2369
2402
|
}
|
|
2370
2403
|
} finally {
|
|
2371
2404
|
setProjectionWriteActive(false);
|
|
2372
2405
|
}
|
|
2373
|
-
delete t[
|
|
2406
|
+
delete t[Z];
|
|
2374
2407
|
}
|
|
2375
2408
|
function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
2376
2409
|
let r;
|
|
2377
2410
|
const i = new WeakMap();
|
|
2378
2411
|
const wrapper = e => {
|
|
2379
|
-
e[
|
|
2380
|
-
e[
|
|
2381
|
-
e[
|
|
2382
|
-
Object.defineProperty(e,
|
|
2412
|
+
e[te] = wrapProjection;
|
|
2413
|
+
e[ne] = i;
|
|
2414
|
+
e[ie] = true;
|
|
2415
|
+
Object.defineProperty(e, re, {
|
|
2383
2416
|
get() {
|
|
2384
2417
|
return r;
|
|
2385
2418
|
},
|
|
@@ -2388,8 +2421,8 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2388
2421
|
};
|
|
2389
2422
|
const wrapProjection = e => {
|
|
2390
2423
|
if (i.has(e)) return i.get(e);
|
|
2391
|
-
if (e[
|
|
2392
|
-
const t = createStoreProxy(e,
|
|
2424
|
+
if (e[z]?.[te] === wrapProjection) return e;
|
|
2425
|
+
const t = createStoreProxy(e, fe, wrapper);
|
|
2393
2426
|
i.set(e, t);
|
|
2394
2427
|
return t;
|
|
2395
2428
|
};
|
|
@@ -2397,18 +2430,26 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2397
2430
|
if (e) {
|
|
2398
2431
|
r = computed(() => {
|
|
2399
2432
|
const t = getOwner();
|
|
2433
|
+
let r = false;
|
|
2434
|
+
let i;
|
|
2435
|
+
const o = new Proxy(
|
|
2436
|
+
s,
|
|
2437
|
+
createWriteTraps(() => !r || t.Oe === i)
|
|
2438
|
+
);
|
|
2400
2439
|
setProjectionWriteActive(true);
|
|
2401
2440
|
try {
|
|
2402
|
-
storeSetter(
|
|
2403
|
-
|
|
2441
|
+
storeSetter(o, o => {
|
|
2442
|
+
i = e(o);
|
|
2443
|
+
r = true;
|
|
2444
|
+
const u = handleAsync(t, i, e => {
|
|
2404
2445
|
setProjectionWriteActive(true);
|
|
2405
2446
|
try {
|
|
2406
|
-
e !==
|
|
2447
|
+
e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
|
|
2407
2448
|
} finally {
|
|
2408
2449
|
setProjectionWriteActive(false);
|
|
2409
2450
|
}
|
|
2410
2451
|
});
|
|
2411
|
-
|
|
2452
|
+
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2412
2453
|
});
|
|
2413
2454
|
} finally {
|
|
2414
2455
|
setProjectionWriteActive(false);
|
|
@@ -2418,7 +2459,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2418
2459
|
}
|
|
2419
2460
|
return { store: s, node: r };
|
|
2420
2461
|
}
|
|
2421
|
-
const
|
|
2462
|
+
const ce = Symbol(0);
|
|
2422
2463
|
function updatePath(e, t, n = 0) {
|
|
2423
2464
|
let r,
|
|
2424
2465
|
i = e;
|
|
@@ -2462,7 +2503,7 @@ function updatePath(e, t, n = 0) {
|
|
|
2462
2503
|
if (s === i) return;
|
|
2463
2504
|
}
|
|
2464
2505
|
if (r === undefined && s == undefined) return;
|
|
2465
|
-
if (s ===
|
|
2506
|
+
if (s === ce) {
|
|
2466
2507
|
delete e[r];
|
|
2467
2508
|
} else if (r === undefined || (isWrappable(i) && isWrappable(s) && !Array.isArray(s))) {
|
|
2468
2509
|
const t = r !== undefined ? e[r] : e;
|
|
@@ -2472,26 +2513,26 @@ function updatePath(e, t, n = 0) {
|
|
|
2472
2513
|
e[r] = s;
|
|
2473
2514
|
}
|
|
2474
2515
|
}
|
|
2475
|
-
const
|
|
2516
|
+
const le = Object.assign(
|
|
2476
2517
|
function storePath(...e) {
|
|
2477
2518
|
return t => {
|
|
2478
2519
|
updatePath(t, e);
|
|
2479
2520
|
};
|
|
2480
2521
|
},
|
|
2481
|
-
{ DELETE:
|
|
2522
|
+
{ DELETE: ce }
|
|
2482
2523
|
);
|
|
2483
2524
|
function snapshotImpl(e, t, n, r) {
|
|
2484
2525
|
let i, s, o, u, f, c;
|
|
2485
2526
|
if (!isWrappable(e)) return e;
|
|
2486
2527
|
if (n && n.has(e)) return n.get(e);
|
|
2487
2528
|
if (!n) n = new Map();
|
|
2488
|
-
if ((i = e[
|
|
2489
|
-
if (t) trackSelf(i,
|
|
2490
|
-
o = i[
|
|
2491
|
-
s = Array.isArray(i[
|
|
2492
|
-
n.set(e, o ? (u = s ? [] : Object.create(Object.getPrototypeOf(i[
|
|
2493
|
-
e = i[
|
|
2494
|
-
r =
|
|
2529
|
+
if ((i = e[z] || r?.get(e)?.[z])) {
|
|
2530
|
+
if (t) trackSelf(i, K);
|
|
2531
|
+
o = i[Y];
|
|
2532
|
+
s = Array.isArray(i[X]);
|
|
2533
|
+
n.set(e, o ? (u = s ? [] : Object.create(Object.getPrototypeOf(i[X]))) : i[X]);
|
|
2534
|
+
e = i[X];
|
|
2535
|
+
r = se;
|
|
2495
2536
|
} else {
|
|
2496
2537
|
s = Array.isArray(e);
|
|
2497
2538
|
n.set(e, e);
|
|
@@ -2500,7 +2541,7 @@ function snapshotImpl(e, t, n, r) {
|
|
|
2500
2541
|
const s = o?.length || e.length;
|
|
2501
2542
|
for (let l = 0; l < s; l++) {
|
|
2502
2543
|
c = o && l in o ? o[l] : e[l];
|
|
2503
|
-
if (c ===
|
|
2544
|
+
if (c === J) continue;
|
|
2504
2545
|
if (t && isWrappable(c)) wrap(c, i);
|
|
2505
2546
|
if ((f = snapshotImpl(c, t, n, r)) !== c || u) {
|
|
2506
2547
|
if (!u) n.set(e, (u = [...e]));
|
|
@@ -2535,13 +2576,13 @@ function deep(e) {
|
|
|
2535
2576
|
function trueFn() {
|
|
2536
2577
|
return true;
|
|
2537
2578
|
}
|
|
2538
|
-
const
|
|
2579
|
+
const ae = {
|
|
2539
2580
|
get(e, t, n) {
|
|
2540
|
-
if (t ===
|
|
2581
|
+
if (t === U) return n;
|
|
2541
2582
|
return e.get(t);
|
|
2542
2583
|
},
|
|
2543
2584
|
has(e, t) {
|
|
2544
|
-
if (t ===
|
|
2585
|
+
if (t === U) return true;
|
|
2545
2586
|
return e.has(t);
|
|
2546
2587
|
},
|
|
2547
2588
|
set: trueFn,
|
|
@@ -2564,15 +2605,15 @@ const de = {
|
|
|
2564
2605
|
function resolveSource(e) {
|
|
2565
2606
|
return !(e = typeof e === "function" ? e() : e) ? {} : e;
|
|
2566
2607
|
}
|
|
2567
|
-
const
|
|
2608
|
+
const de = Symbol(0);
|
|
2568
2609
|
function merge(...e) {
|
|
2569
2610
|
if (e.length === 1 && typeof e[0] !== "function") return e[0];
|
|
2570
2611
|
let t = false;
|
|
2571
2612
|
const n = [];
|
|
2572
2613
|
for (let r = 0; r < e.length; r++) {
|
|
2573
2614
|
const i = e[r];
|
|
2574
|
-
t = t || (!!i &&
|
|
2575
|
-
const s = !!i && i[
|
|
2615
|
+
t = t || (!!i && U in i);
|
|
2616
|
+
const s = !!i && i[de];
|
|
2576
2617
|
if (s) n.push(...s);
|
|
2577
2618
|
else n.push(typeof i === "function" ? ((t = true), createMemo(i)) : i);
|
|
2578
2619
|
}
|
|
@@ -2580,7 +2621,7 @@ function merge(...e) {
|
|
|
2580
2621
|
return new Proxy(
|
|
2581
2622
|
{
|
|
2582
2623
|
get(e) {
|
|
2583
|
-
if (e ===
|
|
2624
|
+
if (e === de) return n;
|
|
2584
2625
|
for (let t = n.length - 1; t >= 0; t--) {
|
|
2585
2626
|
const r = resolveSource(n[t]);
|
|
2586
2627
|
if (e in r) return r[e];
|
|
@@ -2598,7 +2639,7 @@ function merge(...e) {
|
|
|
2598
2639
|
return [...new Set(e)];
|
|
2599
2640
|
}
|
|
2600
2641
|
},
|
|
2601
|
-
|
|
2642
|
+
ae
|
|
2602
2643
|
);
|
|
2603
2644
|
}
|
|
2604
2645
|
const r = Object.create(null);
|
|
@@ -2630,12 +2671,12 @@ function merge(...e) {
|
|
|
2630
2671
|
if (n.get) Object.defineProperty(o, t, n);
|
|
2631
2672
|
else o[t] = n.value;
|
|
2632
2673
|
}
|
|
2633
|
-
o[
|
|
2674
|
+
o[de] = n;
|
|
2634
2675
|
return o;
|
|
2635
2676
|
}
|
|
2636
2677
|
function omit(e, ...t) {
|
|
2637
2678
|
const n = new Set(t);
|
|
2638
|
-
if (b &&
|
|
2679
|
+
if (b && U in e) {
|
|
2639
2680
|
return new Proxy(
|
|
2640
2681
|
{
|
|
2641
2682
|
get(t) {
|
|
@@ -2648,7 +2689,7 @@ function omit(e, ...t) {
|
|
|
2648
2689
|
return Object.keys(e).filter(e => !n.has(e));
|
|
2649
2690
|
}
|
|
2650
2691
|
},
|
|
2651
|
-
|
|
2692
|
+
ae
|
|
2652
2693
|
);
|
|
2653
2694
|
}
|
|
2654
2695
|
const r = {};
|
|
@@ -2682,24 +2723,24 @@ function mapArray(e, t, n) {
|
|
|
2682
2723
|
})
|
|
2683
2724
|
);
|
|
2684
2725
|
}
|
|
2685
|
-
const
|
|
2726
|
+
const pe = { pureWrite: true };
|
|
2686
2727
|
function updateKeyedMap() {
|
|
2687
2728
|
const e = this.Je() || [],
|
|
2688
2729
|
t = e.length;
|
|
2689
|
-
e[
|
|
2730
|
+
e[K];
|
|
2690
2731
|
runWithOwner(this.ze, () => {
|
|
2691
2732
|
let n,
|
|
2692
2733
|
r,
|
|
2693
2734
|
i = this.tt
|
|
2694
2735
|
? () => {
|
|
2695
|
-
this.tt[r] = signal(e[r],
|
|
2696
|
-
this.nt && (this.nt[r] = signal(r,
|
|
2736
|
+
this.tt[r] = signal(e[r], pe);
|
|
2737
|
+
this.nt && (this.nt[r] = signal(r, pe));
|
|
2697
2738
|
return this.Ye(accessor(this.tt[r]), this.nt ? accessor(this.nt[r]) : undefined);
|
|
2698
2739
|
}
|
|
2699
2740
|
: this.nt
|
|
2700
2741
|
? () => {
|
|
2701
2742
|
const t = e[r];
|
|
2702
|
-
this.nt[r] = signal(r,
|
|
2743
|
+
this.nt[r] = signal(r, pe);
|
|
2703
2744
|
return this.Ye(() => t, accessor(this.nt[r]));
|
|
2704
2745
|
}
|
|
2705
2746
|
: () => {
|
|
@@ -2872,7 +2913,7 @@ function boundaryComputed(e, t) {
|
|
|
2872
2913
|
const r = e !== undefined ? e : n.ge;
|
|
2873
2914
|
const i = t !== undefined ? t : n.ae;
|
|
2874
2915
|
n.ge &= ~n.ut;
|
|
2875
|
-
n.
|
|
2916
|
+
n.V.notify(n, n.ut, r, i);
|
|
2876
2917
|
};
|
|
2877
2918
|
n.ut = t;
|
|
2878
2919
|
n.Qe = true;
|
|
@@ -2880,22 +2921,22 @@ function boundaryComputed(e, t) {
|
|
|
2880
2921
|
return n;
|
|
2881
2922
|
}
|
|
2882
2923
|
function createBoundChildren(e, t, n, r) {
|
|
2883
|
-
const i = e.
|
|
2884
|
-
i.addChild((e.
|
|
2885
|
-
|
|
2924
|
+
const i = e.V;
|
|
2925
|
+
i.addChild((e.V = n));
|
|
2926
|
+
cleanup(() => i.removeChild(e.V));
|
|
2886
2927
|
return runWithOwner(e, () => {
|
|
2887
2928
|
const e = computed(t);
|
|
2888
2929
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), r);
|
|
2889
2930
|
});
|
|
2890
2931
|
}
|
|
2891
|
-
const
|
|
2932
|
+
const he = Symbol();
|
|
2892
2933
|
class CollectionQueue extends Queue {
|
|
2893
2934
|
ft;
|
|
2894
2935
|
ct = new Set();
|
|
2895
2936
|
lt = signal(false, { pureWrite: true, De: true });
|
|
2896
2937
|
dt = false;
|
|
2897
2938
|
ht;
|
|
2898
|
-
gt =
|
|
2939
|
+
gt = he;
|
|
2899
2940
|
constructor(e) {
|
|
2900
2941
|
super();
|
|
2901
2942
|
this.ft = e;
|
|
@@ -2911,7 +2952,7 @@ class CollectionQueue extends Queue {
|
|
|
2911
2952
|
try {
|
|
2912
2953
|
return this.ht();
|
|
2913
2954
|
} catch {
|
|
2914
|
-
return
|
|
2955
|
+
return he;
|
|
2915
2956
|
}
|
|
2916
2957
|
});
|
|
2917
2958
|
if (e !== this.gt) {
|
|
@@ -3028,10 +3069,10 @@ function flattenArray(e, t = [], n) {
|
|
|
3028
3069
|
if (r) throw r;
|
|
3029
3070
|
return i;
|
|
3030
3071
|
}
|
|
3031
|
-
exports.$PROXY =
|
|
3072
|
+
exports.$PROXY = U;
|
|
3032
3073
|
exports.$REFRESH = O;
|
|
3033
|
-
exports.$TARGET =
|
|
3034
|
-
exports.$TRACK =
|
|
3074
|
+
exports.$TARGET = z;
|
|
3075
|
+
exports.$TRACK = K;
|
|
3035
3076
|
exports.ContextNotFoundError = ContextNotFoundError;
|
|
3036
3077
|
exports.NoOwnerError = NoOwnerError;
|
|
3037
3078
|
exports.NotReadyError = NotReadyError;
|
|
@@ -3084,5 +3125,5 @@ exports.runWithOwner = runWithOwner;
|
|
|
3084
3125
|
exports.setContext = setContext;
|
|
3085
3126
|
exports.setSnapshotCapture = setSnapshotCapture;
|
|
3086
3127
|
exports.snapshot = snapshot;
|
|
3087
|
-
exports.storePath =
|
|
3128
|
+
exports.storePath = le;
|
|
3088
3129
|
exports.untrack = untrack;
|