@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/prod.js
CHANGED
|
@@ -82,10 +82,10 @@ function deleteFromHeap(e, t) {
|
|
|
82
82
|
else {
|
|
83
83
|
const n = e.S;
|
|
84
84
|
const r = t.l[i];
|
|
85
|
-
const
|
|
85
|
+
const s = n ?? r;
|
|
86
86
|
if (e === r) t.l[i] = n;
|
|
87
87
|
else e.T.S = n;
|
|
88
|
-
|
|
88
|
+
s.T = e.T;
|
|
89
89
|
}
|
|
90
90
|
e.T = e;
|
|
91
91
|
e.S = undefined;
|
|
@@ -166,10 +166,10 @@ function runLaneEffects(e) {
|
|
|
166
166
|
function queueStashedOptimisticEffects(e) {
|
|
167
167
|
for (let t = e.I; t !== null; t = t.p) {
|
|
168
168
|
const e = t.h;
|
|
169
|
-
if (!e.
|
|
170
|
-
if (e.
|
|
171
|
-
if (!e.
|
|
172
|
-
e.
|
|
169
|
+
if (!e.W) continue;
|
|
170
|
+
if (e.W === EFFECT_TRACKED) {
|
|
171
|
+
if (!e.H) {
|
|
172
|
+
e.H = true;
|
|
173
173
|
e.F.enqueue(EFFECT_USER, e.M);
|
|
174
174
|
}
|
|
175
175
|
continue;
|
|
@@ -189,9 +189,9 @@ function mergeTransitionState(e, t) {
|
|
|
189
189
|
if (n.K === t) n.K = e;
|
|
190
190
|
}
|
|
191
191
|
e.Y.push(...t.Y);
|
|
192
|
-
for (const n of t.
|
|
193
|
-
for (const n of t.
|
|
194
|
-
if (!e.
|
|
192
|
+
for (const n of t.Z) e.Z.add(n);
|
|
193
|
+
for (const n of t.B) {
|
|
194
|
+
if (!e.B.includes(n)) e.B.push(n);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
function resolveOptimisticNodes(e) {
|
|
@@ -230,20 +230,6 @@ function schedule() {
|
|
|
230
230
|
scheduled = true;
|
|
231
231
|
if (!globalQueue.ne && !projectionWriteActive) queueMicrotask(flush);
|
|
232
232
|
}
|
|
233
|
-
function addTransitionBlocker(e) {
|
|
234
|
-
if (activeTransition && !activeTransition.Z.includes(e)) {
|
|
235
|
-
activeTransition.Z.push(e);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
function removeTransitionBlocker(e) {
|
|
239
|
-
const remove = t => {
|
|
240
|
-
if (!t) return;
|
|
241
|
-
const n = t.indexOf(e);
|
|
242
|
-
if (n >= 0) t.splice(n, 1);
|
|
243
|
-
};
|
|
244
|
-
remove(e.K?.Z);
|
|
245
|
-
remove(activeTransition?.Z);
|
|
246
|
-
}
|
|
247
233
|
class Queue {
|
|
248
234
|
i = null;
|
|
249
235
|
ie = [[], []];
|
|
@@ -309,31 +295,31 @@ class Queue {
|
|
|
309
295
|
}
|
|
310
296
|
class GlobalQueue extends Queue {
|
|
311
297
|
ne = false;
|
|
312
|
-
|
|
298
|
+
se = [];
|
|
313
299
|
Y = [];
|
|
314
|
-
|
|
315
|
-
static
|
|
300
|
+
Z = new Set();
|
|
301
|
+
static oe;
|
|
316
302
|
static ue;
|
|
317
303
|
static ce = null;
|
|
318
304
|
flush() {
|
|
319
305
|
if (this.ne) return;
|
|
320
306
|
this.ne = true;
|
|
321
307
|
try {
|
|
322
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
308
|
+
runHeap(dirtyQueue, GlobalQueue.oe);
|
|
323
309
|
if (activeTransition) {
|
|
324
310
|
const e = transitionComplete(activeTransition);
|
|
325
311
|
if (!e) {
|
|
326
312
|
const e = activeTransition;
|
|
327
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
328
|
-
this.
|
|
313
|
+
runHeap(zombieQueue, GlobalQueue.oe);
|
|
314
|
+
this.se = [];
|
|
329
315
|
this.Y = [];
|
|
330
|
-
this.
|
|
316
|
+
this.Z = new Set();
|
|
331
317
|
runLaneEffects(EFFECT_RENDER);
|
|
332
318
|
runLaneEffects(EFFECT_USER);
|
|
333
319
|
this.stashQueues(e.ae);
|
|
334
320
|
clock++;
|
|
335
321
|
scheduled = dirtyQueue.R >= dirtyQueue.P;
|
|
336
|
-
reassignPendingTransition(e.
|
|
322
|
+
reassignPendingTransition(e.se);
|
|
337
323
|
activeTransition = null;
|
|
338
324
|
if (!e.j.length && e.Y.length) {
|
|
339
325
|
stashedOptimisticReads = new Set();
|
|
@@ -351,15 +337,15 @@ class GlobalQueue extends Queue {
|
|
|
351
337
|
}
|
|
352
338
|
return;
|
|
353
339
|
}
|
|
354
|
-
this.
|
|
340
|
+
this.se !== activeTransition.se && this.se.push(...activeTransition.se);
|
|
355
341
|
this.restoreQueues(activeTransition.ae);
|
|
356
342
|
transitions.delete(activeTransition);
|
|
357
343
|
const t = activeTransition;
|
|
358
344
|
activeTransition = null;
|
|
359
|
-
reassignPendingTransition(this.
|
|
345
|
+
reassignPendingTransition(this.se);
|
|
360
346
|
finalizePureQueue(t);
|
|
361
347
|
} else {
|
|
362
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
348
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.oe);
|
|
363
349
|
finalizePureQueue();
|
|
364
350
|
}
|
|
365
351
|
clock++;
|
|
@@ -378,8 +364,8 @@ class GlobalQueue extends Queue {
|
|
|
378
364
|
const t = i !== undefined ? i : e.le;
|
|
379
365
|
if (activeTransition && t) {
|
|
380
366
|
const e = t.source;
|
|
381
|
-
if (!activeTransition.
|
|
382
|
-
activeTransition.
|
|
367
|
+
if (!activeTransition.B.includes(e)) {
|
|
368
|
+
activeTransition.B.push(e);
|
|
383
369
|
schedule();
|
|
384
370
|
}
|
|
385
371
|
}
|
|
@@ -395,10 +381,10 @@ class GlobalQueue extends Queue {
|
|
|
395
381
|
if (!activeTransition) {
|
|
396
382
|
activeTransition = e ?? {
|
|
397
383
|
Ee: clock,
|
|
398
|
-
|
|
399
|
-
|
|
384
|
+
se: [],
|
|
385
|
+
B: [],
|
|
400
386
|
Y: [],
|
|
401
|
-
|
|
387
|
+
Z: new Set(),
|
|
402
388
|
j: [],
|
|
403
389
|
ae: { ie: [[], []], re: [] },
|
|
404
390
|
$: false
|
|
@@ -411,13 +397,13 @@ class GlobalQueue extends Queue {
|
|
|
411
397
|
}
|
|
412
398
|
transitions.add(activeTransition);
|
|
413
399
|
activeTransition.Ee = clock;
|
|
414
|
-
if (this.
|
|
415
|
-
for (let e = 0; e < this.
|
|
416
|
-
const t = this.
|
|
400
|
+
if (this.se !== activeTransition.se) {
|
|
401
|
+
for (let e = 0; e < this.se.length; e++) {
|
|
402
|
+
const t = this.se[e];
|
|
417
403
|
t.K = activeTransition;
|
|
418
|
-
activeTransition.
|
|
404
|
+
activeTransition.se.push(t);
|
|
419
405
|
}
|
|
420
|
-
this.
|
|
406
|
+
this.se = activeTransition.se;
|
|
421
407
|
}
|
|
422
408
|
if (this.Y !== activeTransition.Y) {
|
|
423
409
|
for (let e = 0; e < this.Y.length; e++) {
|
|
@@ -430,9 +416,9 @@ class GlobalQueue extends Queue {
|
|
|
430
416
|
for (const e of activeLanes) {
|
|
431
417
|
if (!e.K) e.K = activeTransition;
|
|
432
418
|
}
|
|
433
|
-
if (this.
|
|
434
|
-
for (const e of this.
|
|
435
|
-
this.
|
|
419
|
+
if (this.Z !== activeTransition.Z) {
|
|
420
|
+
for (const e of this.Z) activeTransition.Z.add(e);
|
|
421
|
+
this.Z = activeTransition.Z;
|
|
436
422
|
}
|
|
437
423
|
}
|
|
438
424
|
}
|
|
@@ -452,26 +438,26 @@ function insertSubs(e, t = false) {
|
|
|
452
438
|
r.h.q = undefined;
|
|
453
439
|
}
|
|
454
440
|
const e = r.h;
|
|
455
|
-
if (e.
|
|
456
|
-
if (!e.
|
|
457
|
-
e.
|
|
441
|
+
if (e.W === EFFECT_TRACKED) {
|
|
442
|
+
if (!e.H) {
|
|
443
|
+
e.H = true;
|
|
458
444
|
e.F.enqueue(EFFECT_USER, e.M);
|
|
459
445
|
}
|
|
460
446
|
continue;
|
|
461
447
|
}
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
464
|
-
insertIntoHeap(r.h,
|
|
448
|
+
const s = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
449
|
+
if (s.P > r.h.o) s.P = r.h.o;
|
|
450
|
+
insertIntoHeap(r.h, s);
|
|
465
451
|
}
|
|
466
452
|
}
|
|
467
453
|
function commitPendingNodes() {
|
|
468
|
-
const e = globalQueue.
|
|
454
|
+
const e = globalQueue.se;
|
|
469
455
|
for (let t = 0; t < e.length; t++) {
|
|
470
456
|
const n = e[t];
|
|
471
457
|
if (n.X !== NOT_PENDING) {
|
|
472
458
|
n.J = n.X;
|
|
473
459
|
n.X = NOT_PENDING;
|
|
474
|
-
if (n.
|
|
460
|
+
if (n.W && n.W !== EFFECT_TRACKED) n.H = true;
|
|
475
461
|
}
|
|
476
462
|
if (!(n.Se & STATUS_PENDING)) n.Se &= ~STATUS_UNINITIALIZED;
|
|
477
463
|
if (n.L) GlobalQueue.ue(n, false, true);
|
|
@@ -482,11 +468,11 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
482
468
|
const n = !t;
|
|
483
469
|
if (n) commitPendingNodes();
|
|
484
470
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
485
|
-
if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.
|
|
471
|
+
if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.oe);
|
|
486
472
|
if (n) {
|
|
487
473
|
commitPendingNodes();
|
|
488
474
|
resolveOptimisticNodes(e ? e.Y : globalQueue.Y);
|
|
489
|
-
const t = e ? e.
|
|
475
|
+
const t = e ? e.Z : globalQueue.Z;
|
|
490
476
|
if (GlobalQueue.ce && t.size) {
|
|
491
477
|
for (const e of t) {
|
|
492
478
|
GlobalQueue.ce(e);
|
|
@@ -504,7 +490,7 @@ function checkBoundaryChildren(e) {
|
|
|
504
490
|
}
|
|
505
491
|
}
|
|
506
492
|
function trackOptimisticStore(e) {
|
|
507
|
-
globalQueue.
|
|
493
|
+
globalQueue.Z.add(e);
|
|
508
494
|
schedule();
|
|
509
495
|
}
|
|
510
496
|
function reassignPendingTransition(e) {
|
|
@@ -514,6 +500,9 @@ function reassignPendingTransition(e) {
|
|
|
514
500
|
}
|
|
515
501
|
const globalQueue = new GlobalQueue();
|
|
516
502
|
function flush() {
|
|
503
|
+
if (globalQueue.ne) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
517
506
|
while (scheduled || activeTransition) {
|
|
518
507
|
globalQueue.flush();
|
|
519
508
|
}
|
|
@@ -525,13 +514,28 @@ function transitionComplete(e) {
|
|
|
525
514
|
if (e.$) return true;
|
|
526
515
|
if (e.j.length) return false;
|
|
527
516
|
let t = true;
|
|
528
|
-
for (let n = 0; n < e.
|
|
529
|
-
const i = e.
|
|
517
|
+
for (let n = 0; n < e.B.length; n++) {
|
|
518
|
+
const i = e.B[n];
|
|
530
519
|
if (i.Se & STATUS_PENDING && i.le?.source === i) {
|
|
531
520
|
t = false;
|
|
532
521
|
break;
|
|
533
522
|
}
|
|
534
523
|
}
|
|
524
|
+
if (t) {
|
|
525
|
+
for (let n = 0; n < e.Y.length; n++) {
|
|
526
|
+
const i = e.Y[n];
|
|
527
|
+
if (
|
|
528
|
+
hasActiveOverride(i) &&
|
|
529
|
+
"Se" in i &&
|
|
530
|
+
i.Se & STATUS_PENDING &&
|
|
531
|
+
i.le instanceof NotReadyError &&
|
|
532
|
+
i.le.source !== i
|
|
533
|
+
) {
|
|
534
|
+
t = false;
|
|
535
|
+
break;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
535
539
|
t && (e.$ = true);
|
|
536
540
|
return t;
|
|
537
541
|
}
|
|
@@ -685,10 +689,10 @@ function settlePendingSource(e) {
|
|
|
685
689
|
setPendingError(i);
|
|
686
690
|
updatePendingSignal(i);
|
|
687
691
|
if (i.he) {
|
|
688
|
-
if (i.
|
|
692
|
+
if (i.W === EFFECT_TRACKED) {
|
|
689
693
|
const e = i;
|
|
690
|
-
if (!e.
|
|
691
|
-
e.
|
|
694
|
+
if (!e.H) {
|
|
695
|
+
e.H = true;
|
|
692
696
|
e.F.enqueue(EFFECT_USER, e.M);
|
|
693
697
|
}
|
|
694
698
|
} else {
|
|
@@ -708,13 +712,13 @@ function settlePendingSource(e) {
|
|
|
708
712
|
function handleAsync(e, t, n) {
|
|
709
713
|
const i = typeof t === "object" && t !== null;
|
|
710
714
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
711
|
-
const
|
|
712
|
-
if (!
|
|
715
|
+
const s = !r && i && untrack(() => typeof t.then === "function");
|
|
716
|
+
if (!s && !r) {
|
|
713
717
|
e.Ae = null;
|
|
714
718
|
return t;
|
|
715
719
|
}
|
|
716
720
|
e.Ae = t;
|
|
717
|
-
let
|
|
721
|
+
let o;
|
|
718
722
|
const handleError = n => {
|
|
719
723
|
if (e.Ae !== t) return;
|
|
720
724
|
globalQueue.initTransition(resolveTransition(e));
|
|
@@ -726,8 +730,8 @@ function handleAsync(e, t, n) {
|
|
|
726
730
|
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
727
731
|
globalQueue.initTransition(resolveTransition(e));
|
|
728
732
|
clearStatus(e);
|
|
729
|
-
const
|
|
730
|
-
if (
|
|
733
|
+
const s = resolveLane(e);
|
|
734
|
+
if (s) s.k.delete(e);
|
|
731
735
|
if (n) n(i);
|
|
732
736
|
else if (e.ee !== undefined) {
|
|
733
737
|
if (e.ee !== undefined && e.ee !== NOT_PENDING) e.X = i;
|
|
@@ -736,7 +740,7 @@ function handleAsync(e, t, n) {
|
|
|
736
740
|
insertSubs(e);
|
|
737
741
|
}
|
|
738
742
|
e.Ee = clock;
|
|
739
|
-
} else if (
|
|
743
|
+
} else if (s) {
|
|
740
744
|
const t = e.J;
|
|
741
745
|
const n = e.Ne;
|
|
742
746
|
if (!n || !n(i, t)) {
|
|
@@ -755,13 +759,13 @@ function handleAsync(e, t, n) {
|
|
|
755
759
|
flush();
|
|
756
760
|
r?.();
|
|
757
761
|
};
|
|
758
|
-
if (
|
|
762
|
+
if (s) {
|
|
759
763
|
let n = false,
|
|
760
764
|
i = true;
|
|
761
765
|
t.then(
|
|
762
766
|
e => {
|
|
763
767
|
if (i) {
|
|
764
|
-
|
|
768
|
+
o = e;
|
|
765
769
|
n = true;
|
|
766
770
|
} else asyncWrite(e);
|
|
767
771
|
},
|
|
@@ -799,7 +803,7 @@ function handleAsync(e, t, n) {
|
|
|
799
803
|
);
|
|
800
804
|
r = false;
|
|
801
805
|
if (t && !e.done) {
|
|
802
|
-
|
|
806
|
+
o = e.value;
|
|
803
807
|
i = true;
|
|
804
808
|
return iterate();
|
|
805
809
|
}
|
|
@@ -811,11 +815,10 @@ function handleAsync(e, t, n) {
|
|
|
811
815
|
throw new NotReadyError(context);
|
|
812
816
|
}
|
|
813
817
|
}
|
|
814
|
-
return
|
|
818
|
+
return o;
|
|
815
819
|
}
|
|
816
820
|
function clearStatus(e, t = false) {
|
|
817
821
|
clearPendingSources(e);
|
|
818
|
-
removeTransitionBlocker(e);
|
|
819
822
|
e.he = false;
|
|
820
823
|
e.Se = t ? 0 : e.Se & STATUS_UNINITIALIZED;
|
|
821
824
|
setPendingError(e);
|
|
@@ -825,19 +828,17 @@ function clearStatus(e, t = false) {
|
|
|
825
828
|
function notifyStatus(e, t, n, i, r) {
|
|
826
829
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
827
830
|
n = new StatusError(e, n);
|
|
828
|
-
const
|
|
829
|
-
const
|
|
830
|
-
const u = t === STATUS_PENDING && e.ee !== undefined && !
|
|
831
|
+
const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
832
|
+
const o = s === e;
|
|
833
|
+
const u = t === STATUS_PENDING && e.ee !== undefined && !o;
|
|
831
834
|
const c = u && hasActiveOverride(e);
|
|
832
835
|
if (!i) {
|
|
833
|
-
if (t === STATUS_PENDING &&
|
|
834
|
-
addPendingSource(e,
|
|
836
|
+
if (t === STATUS_PENDING && s) {
|
|
837
|
+
addPendingSource(e, s);
|
|
835
838
|
e.Se = STATUS_PENDING | (e.Se & STATUS_UNINITIALIZED);
|
|
836
|
-
setPendingError(e,
|
|
837
|
-
if (o === e) addTransitionBlocker(e);
|
|
839
|
+
setPendingError(e, s, n);
|
|
838
840
|
} else {
|
|
839
841
|
clearPendingSources(e);
|
|
840
|
-
removeTransitionBlocker(e);
|
|
841
842
|
e.Se = t | (t !== STATUS_ERROR ? e.Se & STATUS_UNINITIALIZED : 0);
|
|
842
843
|
e.le = n;
|
|
843
844
|
}
|
|
@@ -849,6 +850,9 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
849
850
|
const a = i || c;
|
|
850
851
|
const f = i || u ? undefined : r;
|
|
851
852
|
if (e.ge) {
|
|
853
|
+
if (i && t === STATUS_PENDING) {
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
852
856
|
if (a) {
|
|
853
857
|
e.ge(t, n);
|
|
854
858
|
} else {
|
|
@@ -859,10 +863,10 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
859
863
|
forEachDependent(e, e => {
|
|
860
864
|
e.Ee = clock;
|
|
861
865
|
if (
|
|
862
|
-
(t === STATUS_PENDING &&
|
|
866
|
+
(t === STATUS_PENDING && s && e.Ie !== s && !e.pe?.has(s)) ||
|
|
863
867
|
(t !== STATUS_PENDING && (e.le !== n || e.Ie || e.pe))
|
|
864
868
|
) {
|
|
865
|
-
!e.K
|
|
869
|
+
if (!a && !e.K) globalQueue.se.push(e);
|
|
866
870
|
notifyStatus(e, t, n, a, f);
|
|
867
871
|
}
|
|
868
872
|
});
|
|
@@ -875,11 +879,11 @@ function enableExternalSource(e) {
|
|
|
875
879
|
externalSourceConfig = {
|
|
876
880
|
factory: (n, i) => {
|
|
877
881
|
const r = e(n, i);
|
|
878
|
-
const
|
|
882
|
+
const s = t(e => r.track(e), i);
|
|
879
883
|
return {
|
|
880
|
-
track: e =>
|
|
884
|
+
track: e => s.track(e),
|
|
881
885
|
dispose() {
|
|
882
|
-
|
|
886
|
+
s.dispose();
|
|
883
887
|
r.dispose();
|
|
884
888
|
}
|
|
885
889
|
};
|
|
@@ -976,10 +980,8 @@ function getObserver() {
|
|
|
976
980
|
function getOwner() {
|
|
977
981
|
return context;
|
|
978
982
|
}
|
|
979
|
-
function
|
|
980
|
-
if (!context)
|
|
981
|
-
return e;
|
|
982
|
-
}
|
|
983
|
+
function cleanup(e) {
|
|
984
|
+
if (!context) return e;
|
|
983
985
|
if (!context.be) context.be = e;
|
|
984
986
|
else if (Array.isArray(context.be)) context.be.push(e);
|
|
985
987
|
else context.be = [context.be, e];
|
|
@@ -1035,8 +1037,8 @@ function unlinkSubs(e) {
|
|
|
1035
1037
|
else {
|
|
1036
1038
|
t.I = i;
|
|
1037
1039
|
if (i === null) {
|
|
1038
|
-
t.
|
|
1039
|
-
t.L && !t.
|
|
1040
|
+
t.Ge?.();
|
|
1041
|
+
t.L && !t.xe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
1040
1042
|
}
|
|
1041
1043
|
}
|
|
1042
1044
|
return n;
|
|
@@ -1062,13 +1064,13 @@ function link(e, t) {
|
|
|
1062
1064
|
return;
|
|
1063
1065
|
}
|
|
1064
1066
|
}
|
|
1065
|
-
const
|
|
1066
|
-
if (
|
|
1067
|
-
const
|
|
1068
|
-
if (n !== null) n.D =
|
|
1069
|
-
else t.C =
|
|
1070
|
-
if (
|
|
1071
|
-
else e.I =
|
|
1067
|
+
const s = e.ke;
|
|
1068
|
+
if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
|
|
1069
|
+
const o = (t.ye = e.ke = { m: e, h: t, D: i, Ue: s, p: null });
|
|
1070
|
+
if (n !== null) n.D = o;
|
|
1071
|
+
else t.C = o;
|
|
1072
|
+
if (s !== null) s.p = o;
|
|
1073
|
+
else e.I = o;
|
|
1072
1074
|
}
|
|
1073
1075
|
function isValidLink(e, t) {
|
|
1074
1076
|
const n = t.ye;
|
|
@@ -1082,7 +1084,7 @@ function isValidLink(e, t) {
|
|
|
1082
1084
|
}
|
|
1083
1085
|
return false;
|
|
1084
1086
|
}
|
|
1085
|
-
GlobalQueue.
|
|
1087
|
+
GlobalQueue.oe = recompute;
|
|
1086
1088
|
GlobalQueue.ue = disposeChildren;
|
|
1087
1089
|
let tracking = false;
|
|
1088
1090
|
let stale = false;
|
|
@@ -1096,7 +1098,7 @@ let snapshotCaptureActive = false;
|
|
|
1096
1098
|
let snapshotSources = null;
|
|
1097
1099
|
function ownerInSnapshotScope(e) {
|
|
1098
1100
|
while (e) {
|
|
1099
|
-
if (e.
|
|
1101
|
+
if (e.We) return true;
|
|
1100
1102
|
e = e.i;
|
|
1101
1103
|
}
|
|
1102
1104
|
return false;
|
|
@@ -1106,17 +1108,17 @@ function setSnapshotCapture(e) {
|
|
|
1106
1108
|
if (e && !snapshotSources) snapshotSources = new Set();
|
|
1107
1109
|
}
|
|
1108
1110
|
function markSnapshotScope(e) {
|
|
1109
|
-
e.
|
|
1111
|
+
e.We = true;
|
|
1110
1112
|
}
|
|
1111
1113
|
function releaseSnapshotScope(e) {
|
|
1112
|
-
e.
|
|
1114
|
+
e.We = false;
|
|
1113
1115
|
releaseSubtree(e);
|
|
1114
1116
|
schedule();
|
|
1115
1117
|
}
|
|
1116
1118
|
function releaseSubtree(e) {
|
|
1117
1119
|
let t = e.Ce;
|
|
1118
1120
|
while (t) {
|
|
1119
|
-
if (t.
|
|
1121
|
+
if (t.We) {
|
|
1120
1122
|
t = t.De;
|
|
1121
1123
|
continue;
|
|
1122
1124
|
}
|
|
@@ -1145,7 +1147,7 @@ function clearSnapshots() {
|
|
|
1145
1147
|
snapshotCaptureActive = false;
|
|
1146
1148
|
}
|
|
1147
1149
|
function recompute(e, t = false) {
|
|
1148
|
-
const n = e.
|
|
1150
|
+
const n = e.W;
|
|
1149
1151
|
if (!t) {
|
|
1150
1152
|
if (e.K && (!n || activeTransition) && activeTransition !== e.K)
|
|
1151
1153
|
globalQueue.initTransition(e.K);
|
|
@@ -1162,8 +1164,8 @@ function recompute(e, t = false) {
|
|
|
1162
1164
|
}
|
|
1163
1165
|
const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1164
1166
|
const r = e.ee !== undefined && e.ee !== NOT_PENDING;
|
|
1165
|
-
const
|
|
1166
|
-
const
|
|
1167
|
+
const s = !!(e.Se & STATUS_PENDING);
|
|
1168
|
+
const o = context;
|
|
1167
1169
|
context = e;
|
|
1168
1170
|
e.ye = null;
|
|
1169
1171
|
e.O = REACTIVE_RECOMPUTING_DEPS;
|
|
@@ -1205,22 +1207,22 @@ function recompute(e, t = false) {
|
|
|
1205
1207
|
} finally {
|
|
1206
1208
|
tracking = a;
|
|
1207
1209
|
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1208
|
-
context =
|
|
1210
|
+
context = o;
|
|
1209
1211
|
}
|
|
1210
1212
|
if (!e.le) {
|
|
1211
|
-
const
|
|
1212
|
-
let a =
|
|
1213
|
+
const o = e.ye;
|
|
1214
|
+
let a = o !== null ? o.D : e.C;
|
|
1213
1215
|
if (a !== null) {
|
|
1214
1216
|
do {
|
|
1215
1217
|
a = unlinkSubs(a);
|
|
1216
1218
|
} while (a !== null);
|
|
1217
|
-
if (
|
|
1219
|
+
if (o !== null) o.D = null;
|
|
1218
1220
|
else e.C = null;
|
|
1219
1221
|
}
|
|
1220
1222
|
const f = r ? e.ee : e.X === NOT_PENDING ? e.J : e.X;
|
|
1221
1223
|
const l = !e.Ne || !e.Ne(f, u);
|
|
1222
1224
|
if (l) {
|
|
1223
|
-
const
|
|
1225
|
+
const o = r ? e.ee : undefined;
|
|
1224
1226
|
if (t || (n && activeTransition !== e.K) || i) {
|
|
1225
1227
|
e.J = u;
|
|
1226
1228
|
if (r && i) {
|
|
@@ -1228,8 +1230,8 @@ function recompute(e, t = false) {
|
|
|
1228
1230
|
e.X = u;
|
|
1229
1231
|
}
|
|
1230
1232
|
} else e.X = u;
|
|
1231
|
-
if (r && !i &&
|
|
1232
|
-
if (!r || i || e.ee !==
|
|
1233
|
+
if (r && !i && s && !e._e) e.ee = u;
|
|
1234
|
+
if (!r || i || e.ee !== o) insertSubs(e, i || r);
|
|
1233
1235
|
} else if (r) {
|
|
1234
1236
|
e.X = u;
|
|
1235
1237
|
} else if (e.o != c) {
|
|
@@ -1239,7 +1241,7 @@ function recompute(e, t = false) {
|
|
|
1239
1241
|
}
|
|
1240
1242
|
}
|
|
1241
1243
|
currentOptimisticLane = f;
|
|
1242
|
-
(!t || e.Se & STATUS_PENDING) && !e.K && !(activeTransition && r) && globalQueue.
|
|
1244
|
+
(!t || e.Se & STATUS_PENDING) && !e.K && !(activeTransition && r) && globalQueue.se.push(e);
|
|
1243
1245
|
e.K && n && activeTransition !== e.K && runInTransition(e.K, () => recompute(e));
|
|
1244
1246
|
}
|
|
1245
1247
|
function updateIfNecessary(e) {
|
|
@@ -1267,7 +1269,7 @@ function computed(e, t, n) {
|
|
|
1267
1269
|
Ve: i || undefined,
|
|
1268
1270
|
Ne: n?.equals != null ? n.equals : isEqual,
|
|
1269
1271
|
fe: !!n?.pureWrite,
|
|
1270
|
-
|
|
1272
|
+
Ge: n?.unobserved,
|
|
1271
1273
|
be: null,
|
|
1272
1274
|
F: context?.F ?? globalQueue,
|
|
1273
1275
|
Le: context?.Le ?? defaultContext,
|
|
@@ -1295,7 +1297,7 @@ function computed(e, t, n) {
|
|
|
1295
1297
|
K: null
|
|
1296
1298
|
};
|
|
1297
1299
|
r.T = r;
|
|
1298
|
-
const
|
|
1300
|
+
const s = context?.t ? context.u : context;
|
|
1299
1301
|
if (context) {
|
|
1300
1302
|
const e = context.Ce;
|
|
1301
1303
|
if (e === null) {
|
|
@@ -1305,14 +1307,14 @@ function computed(e, t, n) {
|
|
|
1305
1307
|
context.Ce = r;
|
|
1306
1308
|
}
|
|
1307
1309
|
}
|
|
1308
|
-
if (
|
|
1310
|
+
if (s) r.o = s.o + 1;
|
|
1309
1311
|
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.de = true;
|
|
1310
1312
|
if (externalSourceConfig) {
|
|
1311
1313
|
const e = signal(undefined, { equals: false, pureWrite: true });
|
|
1312
1314
|
const t = externalSourceConfig.factory(r.L, () => {
|
|
1313
1315
|
setSignal(e, undefined);
|
|
1314
1316
|
});
|
|
1315
|
-
|
|
1317
|
+
cleanup(() => t.dispose());
|
|
1316
1318
|
r.L = n => {
|
|
1317
1319
|
read(e);
|
|
1318
1320
|
return t.track(n);
|
|
@@ -1331,8 +1333,8 @@ function signal(e, t, n = null) {
|
|
|
1331
1333
|
const i = {
|
|
1332
1334
|
Ne: t?.equals != null ? t.equals : isEqual,
|
|
1333
1335
|
fe: !!t?.pureWrite,
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
+
He: !!t?.He,
|
|
1337
|
+
Ge: t?.unobserved,
|
|
1336
1338
|
J: e,
|
|
1337
1339
|
I: null,
|
|
1338
1340
|
ke: null,
|
|
@@ -1342,7 +1344,7 @@ function signal(e, t, n = null) {
|
|
|
1342
1344
|
X: NOT_PENDING
|
|
1343
1345
|
};
|
|
1344
1346
|
n && (n.A = i);
|
|
1345
|
-
if (snapshotCaptureActive && !i.
|
|
1347
|
+
if (snapshotCaptureActive && !i.He && !((n?.Se ?? 0) & STATUS_PENDING)) {
|
|
1346
1348
|
i.Te = e === undefined ? NO_SNAPSHOT : e;
|
|
1347
1349
|
snapshotSources.add(i);
|
|
1348
1350
|
}
|
|
@@ -1401,8 +1403,14 @@ function read(e) {
|
|
|
1401
1403
|
const t = e.V;
|
|
1402
1404
|
const n = pendingCheckActive;
|
|
1403
1405
|
pendingCheckActive = false;
|
|
1404
|
-
if (
|
|
1405
|
-
|
|
1406
|
+
if (t && e.ee !== undefined) {
|
|
1407
|
+
if (e.ee !== NOT_PENDING && (t.Ae || !!(t.Se & STATUS_PENDING))) {
|
|
1408
|
+
foundPending = true;
|
|
1409
|
+
}
|
|
1410
|
+
} else {
|
|
1411
|
+
if (read(getPendingSignal(e))) foundPending = true;
|
|
1412
|
+
if (t && read(getPendingSignal(t))) foundPending = true;
|
|
1413
|
+
}
|
|
1406
1414
|
pendingCheckActive = n;
|
|
1407
1415
|
return e.J;
|
|
1408
1416
|
}
|
|
@@ -1443,6 +1451,9 @@ function read(e) {
|
|
|
1443
1451
|
if (!tracking && e !== t) link(e, t);
|
|
1444
1452
|
throw n.le;
|
|
1445
1453
|
}
|
|
1454
|
+
} else if (t && n !== e && n.Se & STATUS_UNINITIALIZED) {
|
|
1455
|
+
if (!tracking && e !== t) link(e, t);
|
|
1456
|
+
throw n.le;
|
|
1446
1457
|
} else if (!t && n.Se & STATUS_UNINITIALIZED) {
|
|
1447
1458
|
throw n.le;
|
|
1448
1459
|
}
|
|
@@ -1480,8 +1491,8 @@ function setSignal(e, t) {
|
|
|
1480
1491
|
const i = e.ee !== undefined && e.ee !== NOT_PENDING;
|
|
1481
1492
|
const r = n ? (i ? e.ee : e.J) : e.X === NOT_PENDING ? e.J : e.X;
|
|
1482
1493
|
if (typeof t === "function") t = t(r);
|
|
1483
|
-
const
|
|
1484
|
-
if (!
|
|
1494
|
+
const s = !e.Ne || !e.Ne(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
|
|
1495
|
+
if (!s) {
|
|
1485
1496
|
if (n && i && e.L) {
|
|
1486
1497
|
insertSubs(e, true);
|
|
1487
1498
|
schedule();
|
|
@@ -1500,7 +1511,7 @@ function setSignal(e, t) {
|
|
|
1500
1511
|
e.q = i;
|
|
1501
1512
|
e.ee = t;
|
|
1502
1513
|
} else {
|
|
1503
|
-
if (e.X === NOT_PENDING) globalQueue.
|
|
1514
|
+
if (e.X === NOT_PENDING) globalQueue.se.push(e);
|
|
1504
1515
|
e.X = t;
|
|
1505
1516
|
}
|
|
1506
1517
|
updatePendingSignal(e);
|
|
@@ -1548,6 +1559,9 @@ function computePendingState(e) {
|
|
|
1548
1559
|
}
|
|
1549
1560
|
return true;
|
|
1550
1561
|
}
|
|
1562
|
+
if (e.ee !== undefined && e.ee === NOT_PENDING && !e.Re) {
|
|
1563
|
+
return false;
|
|
1564
|
+
}
|
|
1551
1565
|
if (e.X !== NOT_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
|
|
1552
1566
|
return !!(t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED));
|
|
1553
1567
|
}
|
|
@@ -1663,51 +1677,51 @@ function isUndefined(e) {
|
|
|
1663
1677
|
return typeof e === "undefined";
|
|
1664
1678
|
}
|
|
1665
1679
|
function effect(e, t, n, i, r) {
|
|
1666
|
-
let
|
|
1667
|
-
const
|
|
1680
|
+
let s = false;
|
|
1681
|
+
const o = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
1668
1682
|
...r,
|
|
1669
1683
|
equals: () => {
|
|
1670
|
-
|
|
1671
|
-
if (
|
|
1684
|
+
o.H = !o.le;
|
|
1685
|
+
if (s) o.F.enqueue(o.W, runEffect.bind(o));
|
|
1672
1686
|
return false;
|
|
1673
1687
|
},
|
|
1674
1688
|
lazy: true
|
|
1675
1689
|
});
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
const n = e !== undefined ? e :
|
|
1683
|
-
const i = t !== undefined ? t :
|
|
1690
|
+
o.Fe = i;
|
|
1691
|
+
o.Me = t;
|
|
1692
|
+
o.$e = n;
|
|
1693
|
+
o.je = undefined;
|
|
1694
|
+
o.W = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
1695
|
+
o.ge = (e, t) => {
|
|
1696
|
+
const n = e !== undefined ? e : o.Se;
|
|
1697
|
+
const i = t !== undefined ? t : o.le;
|
|
1684
1698
|
if (n & STATUS_ERROR) {
|
|
1685
1699
|
let e = i;
|
|
1686
|
-
|
|
1687
|
-
if (
|
|
1700
|
+
o.F.notify(o, STATUS_PENDING, 0);
|
|
1701
|
+
if (o.W === EFFECT_USER) {
|
|
1688
1702
|
try {
|
|
1689
|
-
return
|
|
1690
|
-
?
|
|
1691
|
-
|
|
1692
|
-
|
|
1703
|
+
return o.$e
|
|
1704
|
+
? o.$e(e, () => {
|
|
1705
|
+
o.je?.();
|
|
1706
|
+
o.je = undefined;
|
|
1693
1707
|
})
|
|
1694
1708
|
: console.error(e);
|
|
1695
1709
|
} catch (t) {
|
|
1696
1710
|
e = t;
|
|
1697
1711
|
}
|
|
1698
1712
|
}
|
|
1699
|
-
if (!
|
|
1700
|
-
} else if (
|
|
1701
|
-
|
|
1713
|
+
if (!o.F.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1714
|
+
} else if (o.W === EFFECT_RENDER) {
|
|
1715
|
+
o.F.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
1702
1716
|
}
|
|
1703
1717
|
};
|
|
1704
|
-
recompute(
|
|
1705
|
-
!r?.defer && (
|
|
1706
|
-
|
|
1707
|
-
|
|
1718
|
+
recompute(o, true);
|
|
1719
|
+
!r?.defer && (o.W === EFFECT_USER ? o.F.enqueue(o.W, runEffect.bind(o)) : runEffect.call(o));
|
|
1720
|
+
s = true;
|
|
1721
|
+
cleanup(() => o.je?.());
|
|
1708
1722
|
}
|
|
1709
1723
|
function runEffect() {
|
|
1710
|
-
if (!this.
|
|
1724
|
+
if (!this.H || this.O & REACTIVE_DISPOSED) return;
|
|
1711
1725
|
this.je?.();
|
|
1712
1726
|
this.je = undefined;
|
|
1713
1727
|
try {
|
|
@@ -1718,14 +1732,17 @@ function runEffect() {
|
|
|
1718
1732
|
if (!this.F.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1719
1733
|
} finally {
|
|
1720
1734
|
this.Fe = this.J;
|
|
1721
|
-
this.
|
|
1735
|
+
this.H = false;
|
|
1722
1736
|
}
|
|
1723
1737
|
}
|
|
1724
1738
|
function trackedEffect(e, t) {
|
|
1725
1739
|
const run = () => {
|
|
1726
|
-
if (!n.
|
|
1727
|
-
|
|
1728
|
-
|
|
1740
|
+
if (!n.H || n.O & REACTIVE_DISPOSED) return;
|
|
1741
|
+
try {
|
|
1742
|
+
n.H = false;
|
|
1743
|
+
recompute(n);
|
|
1744
|
+
} finally {
|
|
1745
|
+
}
|
|
1729
1746
|
};
|
|
1730
1747
|
const n = computed(
|
|
1731
1748
|
() => {
|
|
@@ -1738,8 +1755,8 @@ function trackedEffect(e, t) {
|
|
|
1738
1755
|
);
|
|
1739
1756
|
n.je = undefined;
|
|
1740
1757
|
n.Ke = true;
|
|
1741
|
-
n.
|
|
1742
|
-
n.
|
|
1758
|
+
n.H = true;
|
|
1759
|
+
n.W = EFFECT_TRACKED;
|
|
1743
1760
|
n.ge = (e, t) => {
|
|
1744
1761
|
const i = e !== undefined ? e : n.Se;
|
|
1745
1762
|
if (i & STATUS_ERROR) {
|
|
@@ -1750,7 +1767,7 @@ function trackedEffect(e, t) {
|
|
|
1750
1767
|
};
|
|
1751
1768
|
n.M = run;
|
|
1752
1769
|
n.F.enqueue(EFFECT_USER, run);
|
|
1753
|
-
|
|
1770
|
+
cleanup(() => n.je?.());
|
|
1754
1771
|
}
|
|
1755
1772
|
function restoreTransition(e, t) {
|
|
1756
1773
|
globalQueue.initTransition(e);
|
|
@@ -1763,13 +1780,13 @@ function action(e) {
|
|
|
1763
1780
|
new Promise((n, i) => {
|
|
1764
1781
|
const r = e(...t);
|
|
1765
1782
|
globalQueue.initTransition();
|
|
1766
|
-
let
|
|
1767
|
-
|
|
1783
|
+
let s = activeTransition;
|
|
1784
|
+
s.j.push(r);
|
|
1768
1785
|
const done = (e, t) => {
|
|
1769
|
-
|
|
1770
|
-
const
|
|
1771
|
-
if (
|
|
1772
|
-
setActiveTransition(
|
|
1786
|
+
s = currentTransition(s);
|
|
1787
|
+
const o = s.j.indexOf(r);
|
|
1788
|
+
if (o >= 0) s.j.splice(o, 1);
|
|
1789
|
+
setActiveTransition(s);
|
|
1773
1790
|
schedule();
|
|
1774
1791
|
t ? i(t) : n(e);
|
|
1775
1792
|
};
|
|
@@ -1781,21 +1798,24 @@ function action(e) {
|
|
|
1781
1798
|
return done(undefined, e);
|
|
1782
1799
|
}
|
|
1783
1800
|
if (n instanceof Promise)
|
|
1784
|
-
return void n.then(run, e => restoreTransition(
|
|
1801
|
+
return void n.then(run, e => restoreTransition(s, () => step(e, true)));
|
|
1785
1802
|
run(n);
|
|
1786
1803
|
};
|
|
1787
1804
|
const run = e => {
|
|
1788
1805
|
if (e.done) return done(e.value);
|
|
1789
1806
|
if (e.value instanceof Promise)
|
|
1790
1807
|
return void e.value.then(
|
|
1791
|
-
e => restoreTransition(
|
|
1792
|
-
e => restoreTransition(
|
|
1808
|
+
e => restoreTransition(s, () => step(e)),
|
|
1809
|
+
e => restoreTransition(s, () => step(e, true))
|
|
1793
1810
|
);
|
|
1794
|
-
restoreTransition(
|
|
1811
|
+
restoreTransition(s, () => step(e.value));
|
|
1795
1812
|
};
|
|
1796
1813
|
step();
|
|
1797
1814
|
});
|
|
1798
1815
|
}
|
|
1816
|
+
function onCleanup(e) {
|
|
1817
|
+
return cleanup(e);
|
|
1818
|
+
}
|
|
1799
1819
|
function accessor(e) {
|
|
1800
1820
|
const t = read.bind(null, e);
|
|
1801
1821
|
t.$r = true;
|
|
@@ -1824,7 +1844,7 @@ function createTrackedEffect(e, t) {
|
|
|
1824
1844
|
}
|
|
1825
1845
|
function createReaction(e, t) {
|
|
1826
1846
|
let n = undefined;
|
|
1827
|
-
|
|
1847
|
+
cleanup(() => n?.());
|
|
1828
1848
|
const i = getOwner();
|
|
1829
1849
|
return r => {
|
|
1830
1850
|
runWithOwner(i, () => {
|
|
@@ -1886,22 +1906,22 @@ function applyState(e, t, n) {
|
|
|
1886
1906
|
const i = t?.[$TARGET];
|
|
1887
1907
|
if (!i) return;
|
|
1888
1908
|
const r = i[STORE_VALUE];
|
|
1889
|
-
const
|
|
1890
|
-
const
|
|
1909
|
+
const s = i[STORE_OVERRIDE];
|
|
1910
|
+
const o = i[STORE_OPTIMISTIC_OVERRIDE];
|
|
1891
1911
|
let u = i[STORE_NODE];
|
|
1892
|
-
if (e === r && !
|
|
1912
|
+
if (e === r && !s && !o) return;
|
|
1893
1913
|
(i[STORE_LOOKUP] || storeLookup).set(e, i[$PROXY]);
|
|
1894
1914
|
i[STORE_VALUE] = e;
|
|
1895
1915
|
i[STORE_OVERRIDE] = undefined;
|
|
1896
1916
|
if (Array.isArray(r)) {
|
|
1897
1917
|
let t = false;
|
|
1898
|
-
const c = getOverrideValue(r,
|
|
1918
|
+
const c = getOverrideValue(r, s, u, "length", o);
|
|
1899
1919
|
if (e.length && c && e[0] && n(e[0]) != null) {
|
|
1900
1920
|
let a, f, l, E, T, d, S, R;
|
|
1901
1921
|
for (
|
|
1902
1922
|
l = 0, E = Math.min(c, e.length);
|
|
1903
1923
|
l < E &&
|
|
1904
|
-
((d = getOverrideValue(r,
|
|
1924
|
+
((d = getOverrideValue(r, s, u, l, o)) === e[l] || (d && e[l] && n(d) === n(e[l])));
|
|
1905
1925
|
l++
|
|
1906
1926
|
) {
|
|
1907
1927
|
applyState(e[l], wrap(d, i), n);
|
|
@@ -1912,7 +1932,7 @@ function applyState(e, t, n) {
|
|
|
1912
1932
|
E = c - 1, T = e.length - 1;
|
|
1913
1933
|
E >= l &&
|
|
1914
1934
|
T >= l &&
|
|
1915
|
-
((d = getOverrideValue(r,
|
|
1935
|
+
((d = getOverrideValue(r, s, u, E, o)) === e[T] || (d && e[T] && n(d) === n(e[T])));
|
|
1916
1936
|
E--, T--
|
|
1917
1937
|
) {
|
|
1918
1938
|
O[T] = d;
|
|
@@ -1941,7 +1961,7 @@ function applyState(e, t, n) {
|
|
|
1941
1961
|
_.set(R, f);
|
|
1942
1962
|
}
|
|
1943
1963
|
for (a = l; a <= E; a++) {
|
|
1944
|
-
d = getOverrideValue(r,
|
|
1964
|
+
d = getOverrideValue(r, s, u, a, o);
|
|
1945
1965
|
R = d ? n(d) : d;
|
|
1946
1966
|
f = _.get(R);
|
|
1947
1967
|
if (f !== undefined && f !== -1) {
|
|
@@ -1960,7 +1980,7 @@ function applyState(e, t, n) {
|
|
|
1960
1980
|
if (l < e.length) t = true;
|
|
1961
1981
|
} else if (e.length) {
|
|
1962
1982
|
for (let t = 0, c = e.length; t < c; t++) {
|
|
1963
|
-
const c = getOverrideValue(r,
|
|
1983
|
+
const c = getOverrideValue(r, s, u, t, o);
|
|
1964
1984
|
isWrappable(c)
|
|
1965
1985
|
? applyState(e[t], wrap(c, i), n)
|
|
1966
1986
|
: i[STORE_NODE][t] && setSignal(i[STORE_NODE][t], e[t]);
|
|
@@ -1975,11 +1995,11 @@ function applyState(e, t, n) {
|
|
|
1975
1995
|
}
|
|
1976
1996
|
if (u) {
|
|
1977
1997
|
const t = u[$TRACK];
|
|
1978
|
-
const c = t ? getAllKeys(r,
|
|
1998
|
+
const c = t ? getAllKeys(r, s, e) : Object.keys(u);
|
|
1979
1999
|
for (let a = 0, f = c.length; a < f; a++) {
|
|
1980
2000
|
const f = c[a];
|
|
1981
2001
|
const l = u[f];
|
|
1982
|
-
const E = unwrap(getOverrideValue(r,
|
|
2002
|
+
const E = unwrap(getOverrideValue(r, s, u, f, o));
|
|
1983
2003
|
let T = unwrap(e[f]);
|
|
1984
2004
|
if (E === T) continue;
|
|
1985
2005
|
if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
|
|
@@ -2026,58 +2046,71 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2026
2046
|
r.set(e, t);
|
|
2027
2047
|
return t;
|
|
2028
2048
|
};
|
|
2029
|
-
const
|
|
2049
|
+
const s = wrapProjection(t);
|
|
2030
2050
|
i = computed(() => {
|
|
2031
2051
|
const t = getOwner();
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2052
|
+
let i = false;
|
|
2053
|
+
let r;
|
|
2054
|
+
const o = new Proxy(
|
|
2055
|
+
s,
|
|
2056
|
+
createWriteTraps(() => !i || t.Ae === r)
|
|
2057
|
+
);
|
|
2058
|
+
storeSetter(o, o => {
|
|
2059
|
+
r = e(o);
|
|
2060
|
+
i = true;
|
|
2061
|
+
const u = handleAsync(t, r, e => {
|
|
2062
|
+
e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
|
|
2035
2063
|
});
|
|
2036
|
-
|
|
2064
|
+
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2037
2065
|
});
|
|
2038
2066
|
});
|
|
2039
|
-
i.
|
|
2040
|
-
return { store:
|
|
2067
|
+
i.xe = true;
|
|
2068
|
+
return { store: s, node: i };
|
|
2041
2069
|
}
|
|
2042
2070
|
function createProjection(e, t = {}, n) {
|
|
2043
2071
|
return createProjectionInternal(e, t, n).store;
|
|
2044
2072
|
}
|
|
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
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2073
|
+
function createWriteTraps(e) {
|
|
2074
|
+
const t = {
|
|
2075
|
+
get(e, n) {
|
|
2076
|
+
let i;
|
|
2077
|
+
setWriteOverride(true);
|
|
2078
|
+
setProjectionWriteActive(true);
|
|
2079
|
+
try {
|
|
2080
|
+
i = e[n];
|
|
2081
|
+
} finally {
|
|
2082
|
+
setWriteOverride(false);
|
|
2083
|
+
setProjectionWriteActive(false);
|
|
2084
|
+
}
|
|
2085
|
+
return typeof i === "object" && i !== null ? new Proxy(i, t) : i;
|
|
2086
|
+
},
|
|
2087
|
+
set(t, n, i) {
|
|
2088
|
+
if (e && !e()) return true;
|
|
2089
|
+
setWriteOverride(true);
|
|
2090
|
+
setProjectionWriteActive(true);
|
|
2091
|
+
try {
|
|
2092
|
+
t[n] = i;
|
|
2093
|
+
} finally {
|
|
2094
|
+
setWriteOverride(false);
|
|
2095
|
+
setProjectionWriteActive(false);
|
|
2096
|
+
}
|
|
2097
|
+
return true;
|
|
2098
|
+
},
|
|
2099
|
+
deleteProperty(t, n) {
|
|
2100
|
+
if (e && !e()) return true;
|
|
2101
|
+
setWriteOverride(true);
|
|
2102
|
+
setProjectionWriteActive(true);
|
|
2103
|
+
try {
|
|
2104
|
+
delete t[n];
|
|
2105
|
+
} finally {
|
|
2106
|
+
setWriteOverride(false);
|
|
2107
|
+
setProjectionWriteActive(false);
|
|
2108
|
+
}
|
|
2109
|
+
return true;
|
|
2077
2110
|
}
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
}
|
|
2111
|
+
};
|
|
2112
|
+
return t;
|
|
2113
|
+
}
|
|
2081
2114
|
const $TRACK = Symbol(0),
|
|
2082
2115
|
$TARGET = Symbol(0),
|
|
2083
2116
|
$PROXY = Symbol(0),
|
|
@@ -2122,7 +2155,7 @@ function getNodes(e, t) {
|
|
|
2122
2155
|
if (!n) e[t] = n = Object.create(null);
|
|
2123
2156
|
return n;
|
|
2124
2157
|
}
|
|
2125
|
-
function getNode(e, t, n, i, r = isEqual,
|
|
2158
|
+
function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
2126
2159
|
if (e[t]) return e[t];
|
|
2127
2160
|
const u = signal(
|
|
2128
2161
|
n,
|
|
@@ -2134,11 +2167,11 @@ function getNode(e, t, n, i, r = isEqual, o, s) {
|
|
|
2134
2167
|
},
|
|
2135
2168
|
i
|
|
2136
2169
|
);
|
|
2137
|
-
if (
|
|
2170
|
+
if (s) {
|
|
2138
2171
|
u.ee = NOT_PENDING;
|
|
2139
2172
|
}
|
|
2140
|
-
if (
|
|
2141
|
-
const e =
|
|
2173
|
+
if (o && t in o) {
|
|
2174
|
+
const e = o[t];
|
|
2142
2175
|
u.Te = e === undefined ? NO_SNAPSHOT : e;
|
|
2143
2176
|
snapshotSources?.add(u);
|
|
2144
2177
|
}
|
|
@@ -2154,8 +2187,8 @@ function getKeys(e, t, n = true) {
|
|
|
2154
2187
|
const i = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
|
|
2155
2188
|
if (!t) return i;
|
|
2156
2189
|
const r = new Set(i);
|
|
2157
|
-
const
|
|
2158
|
-
for (const e of
|
|
2190
|
+
const s = Reflect.ownKeys(t);
|
|
2191
|
+
for (const e of s) {
|
|
2159
2192
|
if (t[e] !== $DELETED) r.add(e);
|
|
2160
2193
|
else r.delete(e);
|
|
2161
2194
|
}
|
|
@@ -2181,10 +2214,10 @@ const storeTraps = {
|
|
|
2181
2214
|
}
|
|
2182
2215
|
const i = getNodes(e, STORE_NODE);
|
|
2183
2216
|
const r = i[t];
|
|
2184
|
-
const
|
|
2185
|
-
const
|
|
2217
|
+
const s = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
|
|
2218
|
+
const o = s || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
|
|
2186
2219
|
const u = !!e[STORE_VALUE][$TARGET];
|
|
2187
|
-
const c =
|
|
2220
|
+
const c = s
|
|
2188
2221
|
? e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2189
2222
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2190
2223
|
? e[STORE_OVERRIDE]
|
|
@@ -2195,7 +2228,7 @@ const storeTraps = {
|
|
|
2195
2228
|
}
|
|
2196
2229
|
if (writeOnly(n)) {
|
|
2197
2230
|
let n =
|
|
2198
|
-
r && (
|
|
2231
|
+
r && (o || !u)
|
|
2199
2232
|
? r.ee !== undefined && r.ee !== NOT_PENDING
|
|
2200
2233
|
? r.ee
|
|
2201
2234
|
: r.X !== NOT_PENDING
|
|
@@ -2208,10 +2241,10 @@ const storeTraps = {
|
|
|
2208
2241
|
Writing?.add(i);
|
|
2209
2242
|
return i;
|
|
2210
2243
|
}
|
|
2211
|
-
let a = r ? (
|
|
2244
|
+
let a = r ? (o || !u ? read(i[t]) : (read(i[t]), c[t])) : c[t];
|
|
2212
2245
|
a === $DELETED && (a = undefined);
|
|
2213
2246
|
if (!r) {
|
|
2214
|
-
if (!
|
|
2247
|
+
if (!o && typeof a === "function" && !c.hasOwnProperty(t)) {
|
|
2215
2248
|
let t;
|
|
2216
2249
|
return !Array.isArray(e[STORE_VALUE]) &&
|
|
2217
2250
|
(t = Object.getPrototypeOf(e[STORE_VALUE])) &&
|
|
@@ -2257,7 +2290,7 @@ const storeTraps = {
|
|
|
2257
2290
|
}
|
|
2258
2291
|
untrack(() => {
|
|
2259
2292
|
const r = e[STORE_VALUE];
|
|
2260
|
-
const
|
|
2293
|
+
const s = r[t];
|
|
2261
2294
|
if (
|
|
2262
2295
|
snapshotCaptureActive &&
|
|
2263
2296
|
typeof t !== "symbol" &&
|
|
@@ -2268,22 +2301,22 @@ const storeTraps = {
|
|
|
2268
2301
|
snapshotSources?.add(e);
|
|
2269
2302
|
}
|
|
2270
2303
|
if (!(t in e[STORE_SNAPSHOT_PROPS])) {
|
|
2271
|
-
e[STORE_SNAPSHOT_PROPS][t] =
|
|
2304
|
+
e[STORE_SNAPSHOT_PROPS][t] = s;
|
|
2272
2305
|
}
|
|
2273
2306
|
}
|
|
2274
|
-
const
|
|
2275
|
-
const u =
|
|
2276
|
-
if (
|
|
2307
|
+
const o = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
2308
|
+
const u = o ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
2309
|
+
if (o) trackOptimisticStore(i);
|
|
2277
2310
|
const c =
|
|
2278
2311
|
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2279
2312
|
? e[STORE_OPTIMISTIC_OVERRIDE][t]
|
|
2280
2313
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2281
2314
|
? e[STORE_OVERRIDE][t]
|
|
2282
|
-
:
|
|
2315
|
+
: s;
|
|
2283
2316
|
const a = n?.[$TARGET]?.[STORE_VALUE] ?? n;
|
|
2284
2317
|
if (c === a) return true;
|
|
2285
2318
|
const f = e[STORE_OPTIMISTIC_OVERRIDE]?.length || e[STORE_OVERRIDE]?.length || r.length;
|
|
2286
|
-
if (a !== undefined && a ===
|
|
2319
|
+
if (a !== undefined && a === s) delete e[u][t];
|
|
2287
2320
|
else (e[u] || (e[u] = Object.create(null)))[t] = a;
|
|
2288
2321
|
const l = isWrappable(a);
|
|
2289
2322
|
e[STORE_HAS]?.[t] && setSignal(e[STORE_HAS][t], true);
|
|
@@ -2322,9 +2355,9 @@ const storeTraps = {
|
|
|
2322
2355
|
delete e[i][t];
|
|
2323
2356
|
} else return true;
|
|
2324
2357
|
if (e[STORE_HAS]?.[t]) setSignal(e[STORE_HAS][t], false);
|
|
2325
|
-
const
|
|
2326
|
-
|
|
2327
|
-
|
|
2358
|
+
const s = getNodes(e, STORE_NODE);
|
|
2359
|
+
s[t] && setSignal(s[t], undefined);
|
|
2360
|
+
s[$TRACK] && setSignal(s[$TRACK], undefined);
|
|
2328
2361
|
});
|
|
2329
2362
|
}
|
|
2330
2363
|
return true;
|
|
@@ -2395,9 +2428,9 @@ function createOptimisticStore(e, t, n) {
|
|
|
2395
2428
|
GlobalQueue.ce ||= clearOptimisticStore;
|
|
2396
2429
|
const i = typeof e === "function";
|
|
2397
2430
|
const r = (i ? t : e) ?? {};
|
|
2398
|
-
const
|
|
2399
|
-
const { store:
|
|
2400
|
-
return [
|
|
2431
|
+
const s = i ? e : undefined;
|
|
2432
|
+
const { store: o } = createOptimisticProjectionInternal(s, r, n);
|
|
2433
|
+
return [o, e => storeSetter(o, e)];
|
|
2401
2434
|
}
|
|
2402
2435
|
function clearOptimisticStore(e) {
|
|
2403
2436
|
const t = e[$TARGET];
|
|
@@ -2447,30 +2480,38 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2447
2480
|
r.set(e, t);
|
|
2448
2481
|
return t;
|
|
2449
2482
|
};
|
|
2450
|
-
const
|
|
2483
|
+
const s = wrapProjection(t);
|
|
2451
2484
|
if (e) {
|
|
2452
2485
|
i = computed(() => {
|
|
2453
2486
|
const t = getOwner();
|
|
2487
|
+
let i = false;
|
|
2488
|
+
let r;
|
|
2489
|
+
const o = new Proxy(
|
|
2490
|
+
s,
|
|
2491
|
+
createWriteTraps(() => !i || t.Ae === r)
|
|
2492
|
+
);
|
|
2454
2493
|
setProjectionWriteActive(true);
|
|
2455
2494
|
try {
|
|
2456
|
-
storeSetter(
|
|
2457
|
-
|
|
2495
|
+
storeSetter(o, o => {
|
|
2496
|
+
r = e(o);
|
|
2497
|
+
i = true;
|
|
2498
|
+
const u = handleAsync(t, r, e => {
|
|
2458
2499
|
setProjectionWriteActive(true);
|
|
2459
2500
|
try {
|
|
2460
|
-
e !==
|
|
2501
|
+
e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
|
|
2461
2502
|
} finally {
|
|
2462
2503
|
setProjectionWriteActive(false);
|
|
2463
2504
|
}
|
|
2464
2505
|
});
|
|
2465
|
-
|
|
2506
|
+
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2466
2507
|
});
|
|
2467
2508
|
} finally {
|
|
2468
2509
|
setProjectionWriteActive(false);
|
|
2469
2510
|
}
|
|
2470
2511
|
});
|
|
2471
|
-
i.
|
|
2512
|
+
i.xe = true;
|
|
2472
2513
|
}
|
|
2473
|
-
return { store:
|
|
2514
|
+
return { store: s, node: i };
|
|
2474
2515
|
}
|
|
2475
2516
|
const DELETE = Symbol(0);
|
|
2476
2517
|
function updatePath(e, t, n = 0) {
|
|
@@ -2478,8 +2519,8 @@ function updatePath(e, t, n = 0) {
|
|
|
2478
2519
|
r = e;
|
|
2479
2520
|
if (n < t.length - 1) {
|
|
2480
2521
|
i = t[n];
|
|
2481
|
-
const
|
|
2482
|
-
const
|
|
2522
|
+
const s = typeof i;
|
|
2523
|
+
const o = Array.isArray(e);
|
|
2483
2524
|
if (Array.isArray(i)) {
|
|
2484
2525
|
for (let r = 0; r < i.length; r++) {
|
|
2485
2526
|
t[n] = i[r];
|
|
@@ -2487,7 +2528,7 @@ function updatePath(e, t, n = 0) {
|
|
|
2487
2528
|
}
|
|
2488
2529
|
t[n] = i;
|
|
2489
2530
|
return;
|
|
2490
|
-
} else if (
|
|
2531
|
+
} else if (o && s === "function") {
|
|
2491
2532
|
for (let r = 0; r < e.length; r++) {
|
|
2492
2533
|
if (i(e[r], r)) {
|
|
2493
2534
|
t[n] = r;
|
|
@@ -2496,9 +2537,9 @@ function updatePath(e, t, n = 0) {
|
|
|
2496
2537
|
}
|
|
2497
2538
|
t[n] = i;
|
|
2498
2539
|
return;
|
|
2499
|
-
} else if (
|
|
2500
|
-
const { from: r = 0, to:
|
|
2501
|
-
for (let i = r; i <=
|
|
2540
|
+
} else if (o && s === "object") {
|
|
2541
|
+
const { from: r = 0, to: s = e.length - 1, by: o = 1 } = i;
|
|
2542
|
+
for (let i = r; i <= s; i += o) {
|
|
2502
2543
|
t[n] = i;
|
|
2503
2544
|
updatePath(e, t, n);
|
|
2504
2545
|
}
|
|
@@ -2510,20 +2551,20 @@ function updatePath(e, t, n = 0) {
|
|
|
2510
2551
|
}
|
|
2511
2552
|
r = e[i];
|
|
2512
2553
|
}
|
|
2513
|
-
let
|
|
2514
|
-
if (typeof
|
|
2515
|
-
|
|
2516
|
-
if (
|
|
2554
|
+
let s = t[t.length - 1];
|
|
2555
|
+
if (typeof s === "function") {
|
|
2556
|
+
s = s(r);
|
|
2557
|
+
if (s === r) return;
|
|
2517
2558
|
}
|
|
2518
|
-
if (i === undefined &&
|
|
2519
|
-
if (
|
|
2559
|
+
if (i === undefined && s == undefined) return;
|
|
2560
|
+
if (s === DELETE) {
|
|
2520
2561
|
delete e[i];
|
|
2521
|
-
} else if (i === undefined || (isWrappable(r) && isWrappable(
|
|
2562
|
+
} else if (i === undefined || (isWrappable(r) && isWrappable(s) && !Array.isArray(s))) {
|
|
2522
2563
|
const t = i !== undefined ? e[i] : e;
|
|
2523
|
-
const n = Object.keys(
|
|
2524
|
-
for (let e = 0; e < n.length; e++) t[n[e]] =
|
|
2564
|
+
const n = Object.keys(s);
|
|
2565
|
+
for (let e = 0; e < n.length; e++) t[n[e]] = s[n[e]];
|
|
2525
2566
|
} else {
|
|
2526
|
-
e[i] =
|
|
2567
|
+
e[i] = s;
|
|
2527
2568
|
}
|
|
2528
2569
|
}
|
|
2529
2570
|
const storePath = Object.assign(
|
|
@@ -2535,28 +2576,28 @@ const storePath = Object.assign(
|
|
|
2535
2576
|
{ DELETE: DELETE }
|
|
2536
2577
|
);
|
|
2537
2578
|
function snapshotImpl(e, t, n, i) {
|
|
2538
|
-
let r,
|
|
2579
|
+
let r, s, o, u, c, a;
|
|
2539
2580
|
if (!isWrappable(e)) return e;
|
|
2540
2581
|
if (n && n.has(e)) return n.get(e);
|
|
2541
2582
|
if (!n) n = new Map();
|
|
2542
2583
|
if ((r = e[$TARGET] || i?.get(e)?.[$TARGET])) {
|
|
2543
2584
|
if (t) trackSelf(r, $TRACK);
|
|
2544
|
-
|
|
2545
|
-
|
|
2585
|
+
o = r[STORE_OVERRIDE];
|
|
2586
|
+
s = Array.isArray(r[STORE_VALUE]);
|
|
2546
2587
|
n.set(
|
|
2547
2588
|
e,
|
|
2548
|
-
|
|
2589
|
+
o ? (u = s ? [] : Object.create(Object.getPrototypeOf(r[STORE_VALUE]))) : r[STORE_VALUE]
|
|
2549
2590
|
);
|
|
2550
2591
|
e = r[STORE_VALUE];
|
|
2551
2592
|
i = storeLookup;
|
|
2552
2593
|
} else {
|
|
2553
|
-
|
|
2594
|
+
s = Array.isArray(e);
|
|
2554
2595
|
n.set(e, e);
|
|
2555
2596
|
}
|
|
2556
|
-
if (
|
|
2557
|
-
const
|
|
2558
|
-
for (let f = 0; f <
|
|
2559
|
-
a =
|
|
2597
|
+
if (s) {
|
|
2598
|
+
const s = o?.length || e.length;
|
|
2599
|
+
for (let f = 0; f < s; f++) {
|
|
2600
|
+
a = o && f in o ? o[f] : e[f];
|
|
2560
2601
|
if (a === $DELETED) continue;
|
|
2561
2602
|
if (t && isWrappable(a)) wrap(a, r);
|
|
2562
2603
|
if ((c = snapshotImpl(a, t, n, i)) !== a || u) {
|
|
@@ -2565,12 +2606,12 @@ function snapshotImpl(e, t, n, i) {
|
|
|
2565
2606
|
}
|
|
2566
2607
|
}
|
|
2567
2608
|
} else {
|
|
2568
|
-
const
|
|
2569
|
-
for (let f = 0, l =
|
|
2570
|
-
let l =
|
|
2571
|
-
const E = getPropertyDescriptor(e,
|
|
2609
|
+
const s = getKeys(e, o);
|
|
2610
|
+
for (let f = 0, l = s.length; f < l; f++) {
|
|
2611
|
+
let l = s[f];
|
|
2612
|
+
const E = getPropertyDescriptor(e, o, l);
|
|
2572
2613
|
if (E.get) continue;
|
|
2573
|
-
a =
|
|
2614
|
+
a = o && l in o ? o[l] : e[l];
|
|
2574
2615
|
if (t && isWrappable(a)) wrap(a, r);
|
|
2575
2616
|
if ((c = snapshotImpl(a, t, n, i)) !== e[l] || u) {
|
|
2576
2617
|
if (!u) {
|
|
@@ -2629,8 +2670,8 @@ function merge(...e) {
|
|
|
2629
2670
|
for (let i = 0; i < e.length; i++) {
|
|
2630
2671
|
const r = e[i];
|
|
2631
2672
|
t = t || (!!r && $PROXY in r);
|
|
2632
|
-
const
|
|
2633
|
-
if (
|
|
2673
|
+
const s = !!r && r[$SOURCES];
|
|
2674
|
+
if (s) n.push(...s);
|
|
2634
2675
|
else n.push(typeof r === "function" ? ((t = true), createMemo(r)) : r);
|
|
2635
2676
|
}
|
|
2636
2677
|
if (SUPPORTS_PROXY && t) {
|
|
@@ -2660,35 +2701,35 @@ function merge(...e) {
|
|
|
2660
2701
|
}
|
|
2661
2702
|
const i = Object.create(null);
|
|
2662
2703
|
let r = false;
|
|
2663
|
-
let
|
|
2664
|
-
for (let e =
|
|
2704
|
+
let s = n.length - 1;
|
|
2705
|
+
for (let e = s; e >= 0; e--) {
|
|
2665
2706
|
const t = n[e];
|
|
2666
2707
|
if (!t) {
|
|
2667
|
-
e ===
|
|
2708
|
+
e === s && s--;
|
|
2668
2709
|
continue;
|
|
2669
2710
|
}
|
|
2670
|
-
const
|
|
2671
|
-
for (let n =
|
|
2672
|
-
const u =
|
|
2711
|
+
const o = Object.getOwnPropertyNames(t);
|
|
2712
|
+
for (let n = o.length - 1; n >= 0; n--) {
|
|
2713
|
+
const u = o[n];
|
|
2673
2714
|
if (u === "__proto__" || u === "constructor") continue;
|
|
2674
2715
|
if (!i[u]) {
|
|
2675
|
-
r = r || e !==
|
|
2716
|
+
r = r || e !== s;
|
|
2676
2717
|
const n = Object.getOwnPropertyDescriptor(t, u);
|
|
2677
2718
|
i[u] = n.get ? { enumerable: true, configurable: true, get: n.get.bind(t) } : n;
|
|
2678
2719
|
}
|
|
2679
2720
|
}
|
|
2680
2721
|
}
|
|
2681
|
-
if (!r) return n[
|
|
2682
|
-
const
|
|
2722
|
+
if (!r) return n[s];
|
|
2723
|
+
const o = {};
|
|
2683
2724
|
const u = Object.keys(i);
|
|
2684
2725
|
for (let e = u.length - 1; e >= 0; e--) {
|
|
2685
2726
|
const t = u[e],
|
|
2686
2727
|
n = i[t];
|
|
2687
|
-
if (n.get) Object.defineProperty(
|
|
2688
|
-
else
|
|
2728
|
+
if (n.get) Object.defineProperty(o, t, n);
|
|
2729
|
+
else o[t] = n.value;
|
|
2689
2730
|
}
|
|
2690
|
-
|
|
2691
|
-
return
|
|
2731
|
+
o[$SOURCES] = n;
|
|
2732
|
+
return o;
|
|
2692
2733
|
}
|
|
2693
2734
|
function omit(e, ...t) {
|
|
2694
2735
|
const n = new Set(t);
|
|
@@ -2722,14 +2763,14 @@ function omit(e, ...t) {
|
|
|
2722
2763
|
function mapArray(e, t, n) {
|
|
2723
2764
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2724
2765
|
const r = t.length > 1;
|
|
2725
|
-
const
|
|
2766
|
+
const s = t;
|
|
2726
2767
|
return createMemo(
|
|
2727
2768
|
updateKeyedMap.bind({
|
|
2728
2769
|
Ye: createOwner(),
|
|
2729
|
-
|
|
2730
|
-
|
|
2770
|
+
Ze: 0,
|
|
2771
|
+
Be: e,
|
|
2731
2772
|
qe: [],
|
|
2732
|
-
ze:
|
|
2773
|
+
ze: s,
|
|
2733
2774
|
Xe: [],
|
|
2734
2775
|
Je: [],
|
|
2735
2776
|
et: i,
|
|
@@ -2741,7 +2782,7 @@ function mapArray(e, t, n) {
|
|
|
2741
2782
|
}
|
|
2742
2783
|
const pureOptions = { pureWrite: true };
|
|
2743
2784
|
function updateKeyedMap() {
|
|
2744
|
-
const e = this.
|
|
2785
|
+
const e = this.Be() || [],
|
|
2745
2786
|
t = e.length;
|
|
2746
2787
|
e[$TRACK];
|
|
2747
2788
|
runWithOwner(this.Ye, () => {
|
|
@@ -2764,29 +2805,29 @@ function updateKeyedMap() {
|
|
|
2764
2805
|
return this.ze(() => t);
|
|
2765
2806
|
};
|
|
2766
2807
|
if (t === 0) {
|
|
2767
|
-
if (this.
|
|
2808
|
+
if (this.Ze !== 0) {
|
|
2768
2809
|
this.Ye.dispose(false);
|
|
2769
2810
|
this.Je = [];
|
|
2770
2811
|
this.qe = [];
|
|
2771
2812
|
this.Xe = [];
|
|
2772
|
-
this.
|
|
2813
|
+
this.Ze = 0;
|
|
2773
2814
|
this.tt && (this.tt = []);
|
|
2774
2815
|
this.nt && (this.nt = []);
|
|
2775
2816
|
}
|
|
2776
2817
|
if (this.it && !this.Xe[0]) {
|
|
2777
2818
|
this.Xe[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
|
|
2778
2819
|
}
|
|
2779
|
-
} else if (this.
|
|
2820
|
+
} else if (this.Ze === 0) {
|
|
2780
2821
|
if (this.Je[0]) this.Je[0].dispose();
|
|
2781
2822
|
this.Xe = new Array(t);
|
|
2782
2823
|
for (i = 0; i < t; i++) {
|
|
2783
2824
|
this.qe[i] = e[i];
|
|
2784
2825
|
this.Xe[i] = runWithOwner((this.Je[i] = createOwner()), r);
|
|
2785
2826
|
}
|
|
2786
|
-
this.
|
|
2827
|
+
this.Ze = t;
|
|
2787
2828
|
} else {
|
|
2788
|
-
let
|
|
2789
|
-
|
|
2829
|
+
let s,
|
|
2830
|
+
o,
|
|
2790
2831
|
u,
|
|
2791
2832
|
c,
|
|
2792
2833
|
a,
|
|
@@ -2797,34 +2838,34 @@ function updateKeyedMap() {
|
|
|
2797
2838
|
d = this.tt ? new Array(t) : undefined,
|
|
2798
2839
|
S = this.nt ? new Array(t) : undefined;
|
|
2799
2840
|
for (
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2841
|
+
s = 0, o = Math.min(this.Ze, t);
|
|
2842
|
+
s < o && (this.qe[s] === e[s] || (this.tt && compare(this.et, this.qe[s], e[s])));
|
|
2843
|
+
s++
|
|
2803
2844
|
) {
|
|
2804
|
-
if (this.tt) setSignal(this.tt[
|
|
2845
|
+
if (this.tt) setSignal(this.tt[s], e[s]);
|
|
2805
2846
|
}
|
|
2806
2847
|
for (
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
u >=
|
|
2810
|
-
(this.qe[
|
|
2811
|
-
|
|
2848
|
+
o = this.Ze - 1, u = t - 1;
|
|
2849
|
+
o >= s &&
|
|
2850
|
+
u >= s &&
|
|
2851
|
+
(this.qe[o] === e[u] || (this.tt && compare(this.et, this.qe[o], e[u])));
|
|
2852
|
+
o--, u--
|
|
2812
2853
|
) {
|
|
2813
|
-
E[u] = this.Xe[
|
|
2814
|
-
T[u] = this.Je[
|
|
2815
|
-
d && (d[u] = this.tt[
|
|
2816
|
-
S && (S[u] = this.nt[
|
|
2854
|
+
E[u] = this.Xe[o];
|
|
2855
|
+
T[u] = this.Je[o];
|
|
2856
|
+
d && (d[u] = this.tt[o]);
|
|
2857
|
+
S && (S[u] = this.nt[o]);
|
|
2817
2858
|
}
|
|
2818
2859
|
f = new Map();
|
|
2819
2860
|
l = new Array(u + 1);
|
|
2820
|
-
for (i = u; i >=
|
|
2861
|
+
for (i = u; i >= s; i--) {
|
|
2821
2862
|
c = e[i];
|
|
2822
2863
|
a = this.et ? this.et(c) : c;
|
|
2823
2864
|
n = f.get(a);
|
|
2824
2865
|
l[i] = n === undefined ? -1 : n;
|
|
2825
2866
|
f.set(a, i);
|
|
2826
2867
|
}
|
|
2827
|
-
for (n =
|
|
2868
|
+
for (n = s; n <= o; n++) {
|
|
2828
2869
|
c = this.qe[n];
|
|
2829
2870
|
a = this.et ? this.et(c) : c;
|
|
2830
2871
|
i = f.get(a);
|
|
@@ -2837,7 +2878,7 @@ function updateKeyedMap() {
|
|
|
2837
2878
|
f.set(a, i);
|
|
2838
2879
|
} else this.Je[n].dispose();
|
|
2839
2880
|
}
|
|
2840
|
-
for (i =
|
|
2881
|
+
for (i = s; i < t; i++) {
|
|
2841
2882
|
if (i in E) {
|
|
2842
2883
|
this.Xe[i] = E[i];
|
|
2843
2884
|
this.Je[i] = T[i];
|
|
@@ -2853,7 +2894,7 @@ function updateKeyedMap() {
|
|
|
2853
2894
|
this.Xe[i] = runWithOwner((this.Je[i] = createOwner()), r);
|
|
2854
2895
|
}
|
|
2855
2896
|
}
|
|
2856
|
-
this.Xe = this.Xe.slice(0, (this.
|
|
2897
|
+
this.Xe = this.Xe.slice(0, (this.Ze = t));
|
|
2857
2898
|
this.qe = e.slice(0);
|
|
2858
2899
|
}
|
|
2859
2900
|
});
|
|
@@ -2863,26 +2904,26 @@ function repeat(e, t, n) {
|
|
|
2863
2904
|
const i = t;
|
|
2864
2905
|
return updateRepeat.bind({
|
|
2865
2906
|
Ye: createOwner(),
|
|
2866
|
-
|
|
2907
|
+
Ze: 0,
|
|
2867
2908
|
rt: 0,
|
|
2868
|
-
|
|
2909
|
+
st: e,
|
|
2869
2910
|
ze: i,
|
|
2870
2911
|
Je: [],
|
|
2871
2912
|
Xe: [],
|
|
2872
|
-
|
|
2913
|
+
ot: n?.from,
|
|
2873
2914
|
it: n?.fallback
|
|
2874
2915
|
});
|
|
2875
2916
|
}
|
|
2876
2917
|
function updateRepeat() {
|
|
2877
|
-
const e = this.
|
|
2878
|
-
const t = this.
|
|
2918
|
+
const e = this.st();
|
|
2919
|
+
const t = this.ot?.() || 0;
|
|
2879
2920
|
runWithOwner(this.Ye, () => {
|
|
2880
2921
|
if (e === 0) {
|
|
2881
|
-
if (this.
|
|
2922
|
+
if (this.Ze !== 0) {
|
|
2882
2923
|
this.Ye.dispose(false);
|
|
2883
2924
|
this.Je = [];
|
|
2884
2925
|
this.Xe = [];
|
|
2885
|
-
this.
|
|
2926
|
+
this.Ze = 0;
|
|
2886
2927
|
}
|
|
2887
2928
|
if (this.it && !this.Xe[0]) {
|
|
2888
2929
|
this.Xe[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
|
|
@@ -2890,12 +2931,12 @@ function updateRepeat() {
|
|
|
2890
2931
|
return;
|
|
2891
2932
|
}
|
|
2892
2933
|
const n = t + e;
|
|
2893
|
-
const i = this.rt + this.
|
|
2894
|
-
if (this.
|
|
2934
|
+
const i = this.rt + this.Ze;
|
|
2935
|
+
if (this.Ze === 0 && this.Je[0]) this.Je[0].dispose();
|
|
2895
2936
|
for (let e = n; e < i; e++) this.Je[e - this.rt].dispose();
|
|
2896
2937
|
if (this.rt < t) {
|
|
2897
2938
|
let e = this.rt;
|
|
2898
|
-
while (e < t && e < this.
|
|
2939
|
+
while (e < t && e < this.Ze) this.Je[e++].dispose();
|
|
2899
2940
|
this.Je.splice(0, t - this.rt);
|
|
2900
2941
|
this.Xe.splice(0, t - this.rt);
|
|
2901
2942
|
} else if (this.rt > t) {
|
|
@@ -2916,7 +2957,7 @@ function updateRepeat() {
|
|
|
2916
2957
|
}
|
|
2917
2958
|
this.Xe = this.Xe.slice(0, e);
|
|
2918
2959
|
this.rt = t;
|
|
2919
|
-
this.
|
|
2960
|
+
this.Ze = e;
|
|
2920
2961
|
});
|
|
2921
2962
|
return this.Xe;
|
|
2922
2963
|
}
|
|
@@ -2932,14 +2973,14 @@ function boundaryComputed(e, t) {
|
|
|
2932
2973
|
n.F.notify(n, n.ut, i, r);
|
|
2933
2974
|
};
|
|
2934
2975
|
n.ut = t;
|
|
2935
|
-
n.
|
|
2976
|
+
n.xe = true;
|
|
2936
2977
|
recompute(n, true);
|
|
2937
2978
|
return n;
|
|
2938
2979
|
}
|
|
2939
2980
|
function createBoundChildren(e, t, n, i) {
|
|
2940
2981
|
const r = e.F;
|
|
2941
2982
|
r.addChild((e.F = n));
|
|
2942
|
-
|
|
2983
|
+
cleanup(() => r.removeChild(e.F));
|
|
2943
2984
|
return runWithOwner(e, () => {
|
|
2944
2985
|
const e = computed(t);
|
|
2945
2986
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
@@ -2949,7 +2990,7 @@ const ON_INIT = Symbol();
|
|
|
2949
2990
|
class CollectionQueue extends Queue {
|
|
2950
2991
|
ct;
|
|
2951
2992
|
ft = new Set();
|
|
2952
|
-
lt = signal(false, { pureWrite: true,
|
|
2993
|
+
lt = signal(false, { pureWrite: true, He: true });
|
|
2953
2994
|
Et = false;
|
|
2954
2995
|
Tt;
|
|
2955
2996
|
dt = ON_INIT;
|
|
@@ -3009,18 +3050,18 @@ class CollectionQueue extends Queue {
|
|
|
3009
3050
|
}
|
|
3010
3051
|
function createCollectionBoundary(e, t, n, i) {
|
|
3011
3052
|
const r = createOwner();
|
|
3012
|
-
const
|
|
3013
|
-
if (i)
|
|
3014
|
-
const
|
|
3053
|
+
const s = new CollectionQueue(e);
|
|
3054
|
+
if (i) s.Tt = i;
|
|
3055
|
+
const o = createBoundChildren(r, t, s, e);
|
|
3015
3056
|
const u = computed(() => {
|
|
3016
|
-
if (!read(
|
|
3017
|
-
const e = read(
|
|
3018
|
-
if (!untrack(() => read(
|
|
3019
|
-
|
|
3057
|
+
if (!read(s.lt)) {
|
|
3058
|
+
const e = read(o);
|
|
3059
|
+
if (!untrack(() => read(s.lt))) {
|
|
3060
|
+
s.Et = true;
|
|
3020
3061
|
return e;
|
|
3021
3062
|
}
|
|
3022
3063
|
}
|
|
3023
|
-
return n(
|
|
3064
|
+
return n(s);
|
|
3024
3065
|
});
|
|
3025
3066
|
return accessor(u);
|
|
3026
3067
|
}
|
|
@@ -3061,9 +3102,9 @@ function flatten(e, t) {
|
|
|
3061
3102
|
function flattenArray(e, t = [], n) {
|
|
3062
3103
|
let i = null;
|
|
3063
3104
|
let r = false;
|
|
3064
|
-
for (let
|
|
3105
|
+
for (let s = 0; s < e.length; s++) {
|
|
3065
3106
|
try {
|
|
3066
|
-
let i = e[
|
|
3107
|
+
let i = e[s];
|
|
3067
3108
|
if (typeof i === "function" && !i.length) {
|
|
3068
3109
|
if (n?.doNotUnwrap) {
|
|
3069
3110
|
t.push(i);
|