@vue/runtime-dom 3.4.26 → 3.5.0-alpha.1
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/runtime-dom.cjs.js +4 -2
- package/dist/runtime-dom.cjs.prod.js +4 -2
- package/dist/runtime-dom.d.ts +114 -76
- package/dist/runtime-dom.esm-browser.js +824 -439
- package/dist/runtime-dom.esm-browser.prod.js +6 -6
- package/dist/runtime-dom.esm-bundler.js +4 -2
- package/dist/runtime-dom.global.js +824 -439
- package/dist/runtime-dom.global.prod.js +6 -6
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.
|
|
2
|
+
* @vue/runtime-dom v3.5.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -81,11 +81,10 @@ const invokeArrayFns = (fns, arg) => {
|
|
|
81
81
|
fns[i](arg);
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
const def = (obj, key, value
|
|
84
|
+
const def = (obj, key, value) => {
|
|
85
85
|
Object.defineProperty(obj, key, {
|
|
86
86
|
configurable: true,
|
|
87
87
|
enumerable: false,
|
|
88
|
-
writable,
|
|
89
88
|
value
|
|
90
89
|
});
|
|
91
90
|
};
|
|
@@ -385,156 +384,280 @@ class EffectScope {
|
|
|
385
384
|
function effectScope(detached) {
|
|
386
385
|
return new EffectScope(detached);
|
|
387
386
|
}
|
|
388
|
-
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
389
|
-
if (scope && scope.active) {
|
|
390
|
-
scope.effects.push(effect);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
387
|
function getCurrentScope() {
|
|
394
388
|
return activeEffectScope;
|
|
395
389
|
}
|
|
396
|
-
function onScopeDispose(fn) {
|
|
390
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
397
391
|
if (activeEffectScope) {
|
|
398
392
|
activeEffectScope.cleanups.push(fn);
|
|
399
|
-
} else {
|
|
393
|
+
} else if (!failSilently) {
|
|
400
394
|
warn$2(
|
|
401
395
|
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
402
396
|
);
|
|
403
397
|
}
|
|
404
398
|
}
|
|
405
399
|
|
|
406
|
-
let
|
|
400
|
+
let activeSub;
|
|
407
401
|
class ReactiveEffect {
|
|
408
|
-
constructor(fn
|
|
402
|
+
constructor(fn) {
|
|
409
403
|
this.fn = fn;
|
|
410
|
-
this.trigger = trigger;
|
|
411
|
-
this.scheduler = scheduler;
|
|
412
|
-
this.active = true;
|
|
413
|
-
this.deps = [];
|
|
414
404
|
/**
|
|
415
405
|
* @internal
|
|
416
406
|
*/
|
|
417
|
-
this.
|
|
407
|
+
this.deps = void 0;
|
|
418
408
|
/**
|
|
419
409
|
* @internal
|
|
420
410
|
*/
|
|
421
|
-
this.
|
|
411
|
+
this.depsTail = void 0;
|
|
422
412
|
/**
|
|
423
413
|
* @internal
|
|
424
414
|
*/
|
|
425
|
-
this.
|
|
415
|
+
this.flags = 1 | 4;
|
|
426
416
|
/**
|
|
427
417
|
* @internal
|
|
428
418
|
*/
|
|
429
|
-
this.
|
|
419
|
+
this.nextEffect = void 0;
|
|
430
420
|
/**
|
|
431
421
|
* @internal
|
|
432
422
|
*/
|
|
433
|
-
this.
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
|
438
|
-
this._dirtyLevel = 1;
|
|
439
|
-
pauseTracking();
|
|
440
|
-
for (let i = 0; i < this._depsLength; i++) {
|
|
441
|
-
const dep = this.deps[i];
|
|
442
|
-
if (dep.computed) {
|
|
443
|
-
triggerComputed(dep.computed);
|
|
444
|
-
if (this._dirtyLevel >= 4) {
|
|
445
|
-
break;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
if (this._dirtyLevel === 1) {
|
|
450
|
-
this._dirtyLevel = 0;
|
|
451
|
-
}
|
|
452
|
-
resetTracking();
|
|
423
|
+
this.cleanup = void 0;
|
|
424
|
+
this.scheduler = void 0;
|
|
425
|
+
if (activeEffectScope && activeEffectScope.active) {
|
|
426
|
+
activeEffectScope.effects.push(this);
|
|
453
427
|
}
|
|
454
|
-
return this._dirtyLevel >= 4;
|
|
455
428
|
}
|
|
456
|
-
|
|
457
|
-
|
|
429
|
+
/**
|
|
430
|
+
* @internal
|
|
431
|
+
*/
|
|
432
|
+
notify() {
|
|
433
|
+
if (this.flags & 2 && !(this.flags & 32)) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
if (this.flags & 64) {
|
|
437
|
+
return this.trigger();
|
|
438
|
+
}
|
|
439
|
+
if (!(this.flags & 8)) {
|
|
440
|
+
this.flags |= 8;
|
|
441
|
+
this.nextEffect = batchedEffect;
|
|
442
|
+
batchedEffect = this;
|
|
443
|
+
}
|
|
458
444
|
}
|
|
459
445
|
run() {
|
|
460
|
-
this.
|
|
461
|
-
if (!this.active) {
|
|
446
|
+
if (!(this.flags & 1)) {
|
|
462
447
|
return this.fn();
|
|
463
448
|
}
|
|
464
|
-
|
|
465
|
-
|
|
449
|
+
this.flags |= 2;
|
|
450
|
+
cleanupEffect(this);
|
|
451
|
+
prepareDeps(this);
|
|
452
|
+
const prevEffect = activeSub;
|
|
453
|
+
const prevShouldTrack = shouldTrack;
|
|
454
|
+
activeSub = this;
|
|
455
|
+
shouldTrack = true;
|
|
466
456
|
try {
|
|
467
|
-
shouldTrack = true;
|
|
468
|
-
activeEffect = this;
|
|
469
|
-
this._runnings++;
|
|
470
|
-
preCleanupEffect(this);
|
|
471
457
|
return this.fn();
|
|
472
458
|
} finally {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
459
|
+
if (activeSub !== this) {
|
|
460
|
+
warn$2(
|
|
461
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
cleanupDeps(this);
|
|
465
|
+
activeSub = prevEffect;
|
|
466
|
+
shouldTrack = prevShouldTrack;
|
|
467
|
+
this.flags &= ~2;
|
|
477
468
|
}
|
|
478
469
|
}
|
|
479
470
|
stop() {
|
|
480
|
-
if (this.
|
|
481
|
-
|
|
482
|
-
|
|
471
|
+
if (this.flags & 1) {
|
|
472
|
+
for (let link = this.deps; link; link = link.nextDep) {
|
|
473
|
+
removeSub(link);
|
|
474
|
+
}
|
|
475
|
+
this.deps = this.depsTail = void 0;
|
|
476
|
+
cleanupEffect(this);
|
|
483
477
|
this.onStop && this.onStop();
|
|
484
|
-
this.
|
|
478
|
+
this.flags &= ~1;
|
|
485
479
|
}
|
|
486
480
|
}
|
|
481
|
+
trigger() {
|
|
482
|
+
if (this.scheduler) {
|
|
483
|
+
this.scheduler();
|
|
484
|
+
} else {
|
|
485
|
+
this.runIfDirty();
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* @internal
|
|
490
|
+
*/
|
|
491
|
+
runIfDirty() {
|
|
492
|
+
if (isDirty(this)) {
|
|
493
|
+
this.run();
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
get dirty() {
|
|
497
|
+
return isDirty(this);
|
|
498
|
+
}
|
|
487
499
|
}
|
|
488
|
-
|
|
489
|
-
|
|
500
|
+
let batchDepth = 0;
|
|
501
|
+
let batchedEffect;
|
|
502
|
+
function startBatch() {
|
|
503
|
+
batchDepth++;
|
|
490
504
|
}
|
|
491
|
-
function
|
|
492
|
-
|
|
493
|
-
|
|
505
|
+
function endBatch() {
|
|
506
|
+
if (batchDepth > 1) {
|
|
507
|
+
batchDepth--;
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
let error;
|
|
511
|
+
while (batchedEffect) {
|
|
512
|
+
let e = batchedEffect;
|
|
513
|
+
batchedEffect = void 0;
|
|
514
|
+
while (e) {
|
|
515
|
+
const next = e.nextEffect;
|
|
516
|
+
e.nextEffect = void 0;
|
|
517
|
+
e.flags &= ~8;
|
|
518
|
+
if (e.flags & 1) {
|
|
519
|
+
try {
|
|
520
|
+
e.trigger();
|
|
521
|
+
} catch (err) {
|
|
522
|
+
if (!error)
|
|
523
|
+
error = err;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
e = next;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
batchDepth--;
|
|
530
|
+
if (error)
|
|
531
|
+
throw error;
|
|
494
532
|
}
|
|
495
|
-
function
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
533
|
+
function prepareDeps(sub) {
|
|
534
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
535
|
+
link.version = -1;
|
|
536
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
537
|
+
link.dep.activeLink = link;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
function cleanupDeps(sub) {
|
|
541
|
+
let head;
|
|
542
|
+
let tail = sub.depsTail;
|
|
543
|
+
for (let link = tail; link; link = link.prevDep) {
|
|
544
|
+
if (link.version === -1) {
|
|
545
|
+
if (link === tail)
|
|
546
|
+
tail = link.prevDep;
|
|
547
|
+
removeSub(link);
|
|
548
|
+
removeDep(link);
|
|
549
|
+
} else {
|
|
550
|
+
head = link;
|
|
499
551
|
}
|
|
500
|
-
|
|
552
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
553
|
+
link.prevActiveLink = void 0;
|
|
501
554
|
}
|
|
555
|
+
sub.deps = head;
|
|
556
|
+
sub.depsTail = tail;
|
|
502
557
|
}
|
|
503
|
-
function
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
if (dep.size === 0) {
|
|
508
|
-
dep.cleanup();
|
|
558
|
+
function isDirty(sub) {
|
|
559
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
560
|
+
if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
|
|
561
|
+
return true;
|
|
509
562
|
}
|
|
510
563
|
}
|
|
564
|
+
if (sub._dirty) {
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
567
|
+
return false;
|
|
568
|
+
}
|
|
569
|
+
function refreshComputed(computed) {
|
|
570
|
+
if (computed.flags & 2) {
|
|
571
|
+
return false;
|
|
572
|
+
}
|
|
573
|
+
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
computed.flags &= ~16;
|
|
577
|
+
if (computed.globalVersion === globalVersion) {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
computed.globalVersion = globalVersion;
|
|
581
|
+
const dep = computed.dep;
|
|
582
|
+
computed.flags |= 2;
|
|
583
|
+
if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
|
|
584
|
+
computed.flags &= ~2;
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
const prevSub = activeSub;
|
|
588
|
+
const prevShouldTrack = shouldTrack;
|
|
589
|
+
activeSub = computed;
|
|
590
|
+
shouldTrack = true;
|
|
591
|
+
try {
|
|
592
|
+
prepareDeps(computed);
|
|
593
|
+
const value = computed.fn();
|
|
594
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
595
|
+
computed._value = value;
|
|
596
|
+
dep.version++;
|
|
597
|
+
}
|
|
598
|
+
} catch (err) {
|
|
599
|
+
dep.version++;
|
|
600
|
+
throw err;
|
|
601
|
+
} finally {
|
|
602
|
+
activeSub = prevSub;
|
|
603
|
+
shouldTrack = prevShouldTrack;
|
|
604
|
+
cleanupDeps(computed);
|
|
605
|
+
computed.flags &= ~2;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
function removeSub(link) {
|
|
609
|
+
const { dep, prevSub, nextSub } = link;
|
|
610
|
+
if (prevSub) {
|
|
611
|
+
prevSub.nextSub = nextSub;
|
|
612
|
+
link.prevSub = void 0;
|
|
613
|
+
}
|
|
614
|
+
if (nextSub) {
|
|
615
|
+
nextSub.prevSub = prevSub;
|
|
616
|
+
link.nextSub = void 0;
|
|
617
|
+
}
|
|
618
|
+
if (dep.subs === link) {
|
|
619
|
+
dep.subs = prevSub;
|
|
620
|
+
}
|
|
621
|
+
if (!dep.subs && dep.computed) {
|
|
622
|
+
dep.computed.flags &= ~4;
|
|
623
|
+
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
624
|
+
removeSub(l);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
function removeDep(link) {
|
|
629
|
+
const { prevDep, nextDep } = link;
|
|
630
|
+
if (prevDep) {
|
|
631
|
+
prevDep.nextDep = nextDep;
|
|
632
|
+
link.prevDep = void 0;
|
|
633
|
+
}
|
|
634
|
+
if (nextDep) {
|
|
635
|
+
nextDep.prevDep = prevDep;
|
|
636
|
+
link.nextDep = void 0;
|
|
637
|
+
}
|
|
511
638
|
}
|
|
512
639
|
function effect(fn, options) {
|
|
513
640
|
if (fn.effect instanceof ReactiveEffect) {
|
|
514
641
|
fn = fn.effect.fn;
|
|
515
642
|
}
|
|
516
|
-
const
|
|
517
|
-
if (_effect.dirty) {
|
|
518
|
-
_effect.run();
|
|
519
|
-
}
|
|
520
|
-
});
|
|
643
|
+
const e = new ReactiveEffect(fn);
|
|
521
644
|
if (options) {
|
|
522
|
-
extend(
|
|
523
|
-
if (options.scope)
|
|
524
|
-
recordEffectScope(_effect, options.scope);
|
|
645
|
+
extend(e, options);
|
|
525
646
|
}
|
|
526
|
-
|
|
527
|
-
|
|
647
|
+
try {
|
|
648
|
+
e.run();
|
|
649
|
+
} catch (err) {
|
|
650
|
+
e.stop();
|
|
651
|
+
throw err;
|
|
528
652
|
}
|
|
529
|
-
const runner =
|
|
530
|
-
runner.effect =
|
|
653
|
+
const runner = e.run.bind(e);
|
|
654
|
+
runner.effect = e;
|
|
531
655
|
return runner;
|
|
532
656
|
}
|
|
533
657
|
function stop(runner) {
|
|
534
658
|
runner.effect.stop();
|
|
535
659
|
}
|
|
536
660
|
let shouldTrack = true;
|
|
537
|
-
let pauseScheduleStack = 0;
|
|
538
661
|
const trackStack = [];
|
|
539
662
|
function pauseTracking() {
|
|
540
663
|
trackStack.push(shouldTrack);
|
|
@@ -544,192 +667,414 @@ function resetTracking() {
|
|
|
544
667
|
const last = trackStack.pop();
|
|
545
668
|
shouldTrack = last === void 0 ? true : last;
|
|
546
669
|
}
|
|
547
|
-
function
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
670
|
+
function cleanupEffect(e) {
|
|
671
|
+
const { cleanup } = e;
|
|
672
|
+
e.cleanup = void 0;
|
|
673
|
+
if (cleanup) {
|
|
674
|
+
const prevSub = activeSub;
|
|
675
|
+
activeSub = void 0;
|
|
676
|
+
try {
|
|
677
|
+
cleanup();
|
|
678
|
+
} finally {
|
|
679
|
+
activeSub = prevSub;
|
|
680
|
+
}
|
|
554
681
|
}
|
|
555
682
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
683
|
+
|
|
684
|
+
let globalVersion = 0;
|
|
685
|
+
class Dep {
|
|
686
|
+
constructor(computed) {
|
|
687
|
+
this.computed = computed;
|
|
688
|
+
this.version = 0;
|
|
689
|
+
/**
|
|
690
|
+
* Link between this dep and the current active effect
|
|
691
|
+
*/
|
|
692
|
+
this.activeLink = void 0;
|
|
693
|
+
/**
|
|
694
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
695
|
+
*/
|
|
696
|
+
this.subs = void 0;
|
|
569
697
|
{
|
|
570
|
-
|
|
698
|
+
this.subsHead = void 0;
|
|
571
699
|
}
|
|
572
700
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
701
|
+
track(debugInfo) {
|
|
702
|
+
if (!activeSub || !shouldTrack) {
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
let link = this.activeLink;
|
|
706
|
+
if (link === void 0 || link.sub !== activeSub) {
|
|
707
|
+
link = this.activeLink = {
|
|
708
|
+
dep: this,
|
|
709
|
+
sub: activeSub,
|
|
710
|
+
version: this.version,
|
|
711
|
+
nextDep: void 0,
|
|
712
|
+
prevDep: void 0,
|
|
713
|
+
nextSub: void 0,
|
|
714
|
+
prevSub: void 0,
|
|
715
|
+
prevActiveLink: void 0
|
|
716
|
+
};
|
|
717
|
+
if (!activeSub.deps) {
|
|
718
|
+
activeSub.deps = activeSub.depsTail = link;
|
|
719
|
+
} else {
|
|
720
|
+
link.prevDep = activeSub.depsTail;
|
|
721
|
+
activeSub.depsTail.nextDep = link;
|
|
722
|
+
activeSub.depsTail = link;
|
|
723
|
+
}
|
|
724
|
+
if (activeSub.flags & 4) {
|
|
725
|
+
addSub(link);
|
|
587
726
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
727
|
+
} else if (link.version === -1) {
|
|
728
|
+
link.version = this.version;
|
|
729
|
+
if (link.nextDep) {
|
|
730
|
+
const next = link.nextDep;
|
|
731
|
+
next.prevDep = link.prevDep;
|
|
732
|
+
if (link.prevDep) {
|
|
733
|
+
link.prevDep.nextDep = next;
|
|
734
|
+
}
|
|
735
|
+
link.prevDep = activeSub.depsTail;
|
|
736
|
+
link.nextDep = void 0;
|
|
737
|
+
activeSub.depsTail.nextDep = link;
|
|
738
|
+
activeSub.depsTail = link;
|
|
739
|
+
if (activeSub.deps === link) {
|
|
740
|
+
activeSub.deps = next;
|
|
593
741
|
}
|
|
594
742
|
}
|
|
595
743
|
}
|
|
744
|
+
if (activeSub.onTrack) {
|
|
745
|
+
activeSub.onTrack(
|
|
746
|
+
extend(
|
|
747
|
+
{
|
|
748
|
+
effect: activeSub
|
|
749
|
+
},
|
|
750
|
+
debugInfo
|
|
751
|
+
)
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
return link;
|
|
755
|
+
}
|
|
756
|
+
trigger(debugInfo) {
|
|
757
|
+
this.version++;
|
|
758
|
+
globalVersion++;
|
|
759
|
+
this.notify(debugInfo);
|
|
760
|
+
}
|
|
761
|
+
notify(debugInfo) {
|
|
762
|
+
startBatch();
|
|
763
|
+
try {
|
|
764
|
+
if (true) {
|
|
765
|
+
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
766
|
+
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
767
|
+
head.sub.onTrigger(
|
|
768
|
+
extend(
|
|
769
|
+
{
|
|
770
|
+
effect: head.sub
|
|
771
|
+
},
|
|
772
|
+
debugInfo
|
|
773
|
+
)
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
for (let link = this.subs; link; link = link.prevSub) {
|
|
779
|
+
link.sub.notify();
|
|
780
|
+
}
|
|
781
|
+
} finally {
|
|
782
|
+
endBatch();
|
|
783
|
+
}
|
|
596
784
|
}
|
|
597
|
-
resetScheduling();
|
|
598
785
|
}
|
|
599
|
-
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
}
|
|
606
|
-
|
|
786
|
+
function addSub(link) {
|
|
787
|
+
const computed = link.dep.computed;
|
|
788
|
+
if (computed && !link.dep.subs) {
|
|
789
|
+
computed.flags |= 4 | 16;
|
|
790
|
+
for (let l = computed.deps; l; l = l.nextDep) {
|
|
791
|
+
addSub(l);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
const currentTail = link.dep.subs;
|
|
795
|
+
if (currentTail !== link) {
|
|
796
|
+
link.prevSub = currentTail;
|
|
797
|
+
if (currentTail)
|
|
798
|
+
currentTail.nextSub = link;
|
|
799
|
+
}
|
|
800
|
+
if (link.dep.subsHead === void 0) {
|
|
801
|
+
link.dep.subsHead = link;
|
|
802
|
+
}
|
|
803
|
+
link.dep.subs = link;
|
|
804
|
+
}
|
|
607
805
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
608
|
-
const ITERATE_KEY = Symbol("iterate" );
|
|
609
|
-
const MAP_KEY_ITERATE_KEY = Symbol("Map
|
|
806
|
+
const ITERATE_KEY = Symbol("Object iterate" );
|
|
807
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
|
|
808
|
+
const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
|
|
610
809
|
function track(target, type, key) {
|
|
611
|
-
if (shouldTrack &&
|
|
810
|
+
if (shouldTrack && activeSub) {
|
|
612
811
|
let depsMap = targetMap.get(target);
|
|
613
812
|
if (!depsMap) {
|
|
614
813
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
615
814
|
}
|
|
616
815
|
let dep = depsMap.get(key);
|
|
617
816
|
if (!dep) {
|
|
618
|
-
depsMap.set(key, dep =
|
|
817
|
+
depsMap.set(key, dep = new Dep());
|
|
619
818
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
dep,
|
|
623
|
-
{
|
|
819
|
+
{
|
|
820
|
+
dep.track({
|
|
624
821
|
target,
|
|
625
822
|
type,
|
|
626
823
|
key
|
|
627
|
-
}
|
|
628
|
-
|
|
824
|
+
});
|
|
825
|
+
}
|
|
629
826
|
}
|
|
630
827
|
}
|
|
631
828
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
632
829
|
const depsMap = targetMap.get(target);
|
|
633
830
|
if (!depsMap) {
|
|
831
|
+
globalVersion++;
|
|
634
832
|
return;
|
|
635
833
|
}
|
|
636
834
|
let deps = [];
|
|
637
835
|
if (type === "clear") {
|
|
638
836
|
deps = [...depsMap.values()];
|
|
639
|
-
} else if (key === "length" && isArray(target)) {
|
|
640
|
-
const newLength = Number(newValue);
|
|
641
|
-
depsMap.forEach((dep, key2) => {
|
|
642
|
-
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
|
|
643
|
-
deps.push(dep);
|
|
644
|
-
}
|
|
645
|
-
});
|
|
646
837
|
} else {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
if (!
|
|
653
|
-
deps.push(
|
|
654
|
-
if (isMap(target)) {
|
|
655
|
-
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
656
|
-
}
|
|
657
|
-
} else if (isIntegerKey(key)) {
|
|
658
|
-
deps.push(depsMap.get("length"));
|
|
838
|
+
const targetIsArray = isArray(target);
|
|
839
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
840
|
+
if (targetIsArray && key === "length") {
|
|
841
|
+
const newLength = Number(newValue);
|
|
842
|
+
depsMap.forEach((dep, key2) => {
|
|
843
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
844
|
+
deps.push(dep);
|
|
659
845
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
846
|
+
});
|
|
847
|
+
} else {
|
|
848
|
+
const push = (dep) => dep && deps.push(dep);
|
|
849
|
+
if (key !== void 0) {
|
|
850
|
+
push(depsMap.get(key));
|
|
851
|
+
}
|
|
852
|
+
if (isArrayIndex) {
|
|
853
|
+
push(depsMap.get(ARRAY_ITERATE_KEY));
|
|
854
|
+
}
|
|
855
|
+
switch (type) {
|
|
856
|
+
case "add":
|
|
857
|
+
if (!targetIsArray) {
|
|
858
|
+
push(depsMap.get(ITERATE_KEY));
|
|
859
|
+
if (isMap(target)) {
|
|
860
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
861
|
+
}
|
|
862
|
+
} else if (isArrayIndex) {
|
|
863
|
+
push(depsMap.get("length"));
|
|
864
|
+
}
|
|
865
|
+
break;
|
|
866
|
+
case "delete":
|
|
867
|
+
if (!targetIsArray) {
|
|
868
|
+
push(depsMap.get(ITERATE_KEY));
|
|
869
|
+
if (isMap(target)) {
|
|
870
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
break;
|
|
874
|
+
case "set":
|
|
664
875
|
if (isMap(target)) {
|
|
665
|
-
|
|
876
|
+
push(depsMap.get(ITERATE_KEY));
|
|
666
877
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
case "set":
|
|
670
|
-
if (isMap(target)) {
|
|
671
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
672
|
-
}
|
|
673
|
-
break;
|
|
878
|
+
break;
|
|
879
|
+
}
|
|
674
880
|
}
|
|
675
881
|
}
|
|
676
|
-
|
|
882
|
+
startBatch();
|
|
677
883
|
for (const dep of deps) {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
oldValue,
|
|
688
|
-
oldTarget
|
|
689
|
-
}
|
|
690
|
-
);
|
|
884
|
+
{
|
|
885
|
+
dep.trigger({
|
|
886
|
+
target,
|
|
887
|
+
type,
|
|
888
|
+
key,
|
|
889
|
+
newValue,
|
|
890
|
+
oldValue,
|
|
891
|
+
oldTarget
|
|
892
|
+
});
|
|
691
893
|
}
|
|
692
894
|
}
|
|
693
|
-
|
|
895
|
+
endBatch();
|
|
694
896
|
}
|
|
695
897
|
function getDepFromReactive(object, key) {
|
|
696
|
-
|
|
697
|
-
return
|
|
898
|
+
var _a;
|
|
899
|
+
return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
function reactiveReadArray(array) {
|
|
903
|
+
const raw = toRaw(array);
|
|
904
|
+
if (raw === array)
|
|
905
|
+
return raw;
|
|
906
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
907
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
908
|
+
}
|
|
909
|
+
function shallowReadArray(arr) {
|
|
910
|
+
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
911
|
+
return arr;
|
|
912
|
+
}
|
|
913
|
+
const arrayInstrumentations = {
|
|
914
|
+
__proto__: null,
|
|
915
|
+
[Symbol.iterator]() {
|
|
916
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
917
|
+
},
|
|
918
|
+
concat(...args) {
|
|
919
|
+
return reactiveReadArray(this).concat(
|
|
920
|
+
...args.map((x) => reactiveReadArray(x))
|
|
921
|
+
);
|
|
922
|
+
},
|
|
923
|
+
entries() {
|
|
924
|
+
return iterator(this, "entries", (value) => {
|
|
925
|
+
value[1] = toReactive(value[1]);
|
|
926
|
+
return value;
|
|
927
|
+
});
|
|
928
|
+
},
|
|
929
|
+
every(fn, thisArg) {
|
|
930
|
+
return apply(this, "every", fn, thisArg);
|
|
931
|
+
},
|
|
932
|
+
filter(fn, thisArg) {
|
|
933
|
+
const result = apply(this, "filter", fn, thisArg);
|
|
934
|
+
return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
|
|
935
|
+
},
|
|
936
|
+
find(fn, thisArg) {
|
|
937
|
+
const result = apply(this, "find", fn, thisArg);
|
|
938
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
939
|
+
},
|
|
940
|
+
findIndex(fn, thisArg) {
|
|
941
|
+
return apply(this, "findIndex", fn, thisArg);
|
|
942
|
+
},
|
|
943
|
+
findLast(fn, thisArg) {
|
|
944
|
+
const result = apply(this, "findLast", fn, thisArg);
|
|
945
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
946
|
+
},
|
|
947
|
+
findLastIndex(fn, thisArg) {
|
|
948
|
+
return apply(this, "findLastIndex", fn, thisArg);
|
|
949
|
+
},
|
|
950
|
+
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
951
|
+
forEach(fn, thisArg) {
|
|
952
|
+
return apply(this, "forEach", fn, thisArg);
|
|
953
|
+
},
|
|
954
|
+
includes(...args) {
|
|
955
|
+
return searchProxy(this, "includes", args);
|
|
956
|
+
},
|
|
957
|
+
indexOf(...args) {
|
|
958
|
+
return searchProxy(this, "indexOf", args);
|
|
959
|
+
},
|
|
960
|
+
join(separator) {
|
|
961
|
+
return reactiveReadArray(this).join(separator);
|
|
962
|
+
},
|
|
963
|
+
// keys() iterator only reads `length`, no optimisation required
|
|
964
|
+
lastIndexOf(...args) {
|
|
965
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
966
|
+
},
|
|
967
|
+
map(fn, thisArg) {
|
|
968
|
+
return apply(this, "map", fn, thisArg);
|
|
969
|
+
},
|
|
970
|
+
pop() {
|
|
971
|
+
return noTracking(this, "pop");
|
|
972
|
+
},
|
|
973
|
+
push(...args) {
|
|
974
|
+
return noTracking(this, "push", args);
|
|
975
|
+
},
|
|
976
|
+
reduce(fn, ...args) {
|
|
977
|
+
return reduce(this, "reduce", fn, args);
|
|
978
|
+
},
|
|
979
|
+
reduceRight(fn, ...args) {
|
|
980
|
+
return reduce(this, "reduceRight", fn, args);
|
|
981
|
+
},
|
|
982
|
+
shift() {
|
|
983
|
+
return noTracking(this, "shift");
|
|
984
|
+
},
|
|
985
|
+
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
986
|
+
some(fn, thisArg) {
|
|
987
|
+
return apply(this, "some", fn, thisArg);
|
|
988
|
+
},
|
|
989
|
+
splice(...args) {
|
|
990
|
+
return noTracking(this, "splice", args);
|
|
991
|
+
},
|
|
992
|
+
toReversed() {
|
|
993
|
+
return reactiveReadArray(this).toReversed();
|
|
994
|
+
},
|
|
995
|
+
toSorted(comparer) {
|
|
996
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
997
|
+
},
|
|
998
|
+
toSpliced(...args) {
|
|
999
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
1000
|
+
},
|
|
1001
|
+
unshift(...args) {
|
|
1002
|
+
return noTracking(this, "unshift", args);
|
|
1003
|
+
},
|
|
1004
|
+
values() {
|
|
1005
|
+
return iterator(this, "values", toReactive);
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
function iterator(self, method, wrapValue) {
|
|
1009
|
+
const arr = shallowReadArray(self);
|
|
1010
|
+
const iter = arr[method]();
|
|
1011
|
+
if (arr !== self && !isShallow(self)) {
|
|
1012
|
+
iter._next = iter.next;
|
|
1013
|
+
iter.next = () => {
|
|
1014
|
+
const result = iter._next();
|
|
1015
|
+
if (result.value) {
|
|
1016
|
+
result.value = wrapValue(result.value);
|
|
1017
|
+
}
|
|
1018
|
+
return result;
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
1021
|
+
return iter;
|
|
1022
|
+
}
|
|
1023
|
+
function apply(self, method, fn, thisArg) {
|
|
1024
|
+
const arr = shallowReadArray(self);
|
|
1025
|
+
let wrappedFn = fn;
|
|
1026
|
+
if (arr !== self) {
|
|
1027
|
+
if (!isShallow(self)) {
|
|
1028
|
+
wrappedFn = function(item, index) {
|
|
1029
|
+
return fn.call(this, toReactive(item), index, self);
|
|
1030
|
+
};
|
|
1031
|
+
} else if (fn.length > 2) {
|
|
1032
|
+
wrappedFn = function(item, index) {
|
|
1033
|
+
return fn.call(this, item, index, self);
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
return arr[method](wrappedFn, thisArg);
|
|
1038
|
+
}
|
|
1039
|
+
function reduce(self, method, fn, args) {
|
|
1040
|
+
const arr = shallowReadArray(self);
|
|
1041
|
+
let wrappedFn = fn;
|
|
1042
|
+
if (arr !== self) {
|
|
1043
|
+
if (!isShallow(self)) {
|
|
1044
|
+
wrappedFn = function(acc, item, index) {
|
|
1045
|
+
return fn.call(this, acc, toReactive(item), index, self);
|
|
1046
|
+
};
|
|
1047
|
+
} else if (fn.length > 3) {
|
|
1048
|
+
wrappedFn = function(acc, item, index) {
|
|
1049
|
+
return fn.call(this, acc, item, index, self);
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
return arr[method](wrappedFn, ...args);
|
|
1054
|
+
}
|
|
1055
|
+
function searchProxy(self, method, args) {
|
|
1056
|
+
const arr = toRaw(self);
|
|
1057
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
1058
|
+
const res = arr[method](...args);
|
|
1059
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1060
|
+
args[0] = toRaw(args[0]);
|
|
1061
|
+
return arr[method](...args);
|
|
1062
|
+
}
|
|
1063
|
+
return res;
|
|
1064
|
+
}
|
|
1065
|
+
function noTracking(self, method, args = []) {
|
|
1066
|
+
pauseTracking();
|
|
1067
|
+
startBatch();
|
|
1068
|
+
const res = toRaw(self)[method].apply(self, args);
|
|
1069
|
+
endBatch();
|
|
1070
|
+
resetTracking();
|
|
1071
|
+
return res;
|
|
698
1072
|
}
|
|
699
1073
|
|
|
700
1074
|
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
701
1075
|
const builtInSymbols = new Set(
|
|
702
1076
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
703
1077
|
);
|
|
704
|
-
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
705
|
-
function createArrayInstrumentations() {
|
|
706
|
-
const instrumentations = {};
|
|
707
|
-
["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
|
708
|
-
instrumentations[key] = function(...args) {
|
|
709
|
-
const arr = toRaw(this);
|
|
710
|
-
for (let i = 0, l = this.length; i < l; i++) {
|
|
711
|
-
track(arr, "get", i + "");
|
|
712
|
-
}
|
|
713
|
-
const res = arr[key](...args);
|
|
714
|
-
if (res === -1 || res === false) {
|
|
715
|
-
return arr[key](...args.map(toRaw));
|
|
716
|
-
} else {
|
|
717
|
-
return res;
|
|
718
|
-
}
|
|
719
|
-
};
|
|
720
|
-
});
|
|
721
|
-
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
722
|
-
instrumentations[key] = function(...args) {
|
|
723
|
-
pauseTracking();
|
|
724
|
-
pauseScheduling();
|
|
725
|
-
const res = toRaw(this)[key].apply(this, args);
|
|
726
|
-
resetScheduling();
|
|
727
|
-
resetTracking();
|
|
728
|
-
return res;
|
|
729
|
-
};
|
|
730
|
-
});
|
|
731
|
-
return instrumentations;
|
|
732
|
-
}
|
|
733
1078
|
function hasOwnProperty(key) {
|
|
734
1079
|
if (!isSymbol(key))
|
|
735
1080
|
key = String(key);
|
|
@@ -760,14 +1105,22 @@ class BaseReactiveHandler {
|
|
|
760
1105
|
}
|
|
761
1106
|
const targetIsArray = isArray(target);
|
|
762
1107
|
if (!isReadonly2) {
|
|
763
|
-
|
|
764
|
-
|
|
1108
|
+
let fn;
|
|
1109
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1110
|
+
return fn;
|
|
765
1111
|
}
|
|
766
1112
|
if (key === "hasOwnProperty") {
|
|
767
1113
|
return hasOwnProperty;
|
|
768
1114
|
}
|
|
769
1115
|
}
|
|
770
|
-
const res = Reflect.get(
|
|
1116
|
+
const res = Reflect.get(
|
|
1117
|
+
target,
|
|
1118
|
+
key,
|
|
1119
|
+
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1120
|
+
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1121
|
+
// its class methods
|
|
1122
|
+
isRef(target) ? target : receiver
|
|
1123
|
+
);
|
|
771
1124
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
772
1125
|
return res;
|
|
773
1126
|
}
|
|
@@ -1266,110 +1619,8 @@ function markRaw(value) {
|
|
|
1266
1619
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1267
1620
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1268
1621
|
|
|
1269
|
-
const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
|
|
1270
|
-
class ComputedRefImpl {
|
|
1271
|
-
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1272
|
-
this.getter = getter;
|
|
1273
|
-
this._setter = _setter;
|
|
1274
|
-
this.dep = void 0;
|
|
1275
|
-
this.__v_isRef = true;
|
|
1276
|
-
this["__v_isReadonly"] = false;
|
|
1277
|
-
this.effect = new ReactiveEffect(
|
|
1278
|
-
() => getter(this._value),
|
|
1279
|
-
() => triggerRefValue(
|
|
1280
|
-
this,
|
|
1281
|
-
this.effect._dirtyLevel === 2 ? 2 : 3
|
|
1282
|
-
)
|
|
1283
|
-
);
|
|
1284
|
-
this.effect.computed = this;
|
|
1285
|
-
this.effect.active = this._cacheable = !isSSR;
|
|
1286
|
-
this["__v_isReadonly"] = isReadonly;
|
|
1287
|
-
}
|
|
1288
|
-
get value() {
|
|
1289
|
-
const self = toRaw(this);
|
|
1290
|
-
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
|
|
1291
|
-
triggerRefValue(self, 4);
|
|
1292
|
-
}
|
|
1293
|
-
trackRefValue(self);
|
|
1294
|
-
if (self.effect._dirtyLevel >= 2) {
|
|
1295
|
-
if (this._warnRecursive) {
|
|
1296
|
-
warn$2(COMPUTED_SIDE_EFFECT_WARN, `
|
|
1297
|
-
|
|
1298
|
-
getter: `, this.getter);
|
|
1299
|
-
}
|
|
1300
|
-
triggerRefValue(self, 2);
|
|
1301
|
-
}
|
|
1302
|
-
return self._value;
|
|
1303
|
-
}
|
|
1304
|
-
set value(newValue) {
|
|
1305
|
-
this._setter(newValue);
|
|
1306
|
-
}
|
|
1307
|
-
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1308
|
-
get _dirty() {
|
|
1309
|
-
return this.effect.dirty;
|
|
1310
|
-
}
|
|
1311
|
-
set _dirty(v) {
|
|
1312
|
-
this.effect.dirty = v;
|
|
1313
|
-
}
|
|
1314
|
-
// #endregion
|
|
1315
|
-
}
|
|
1316
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1317
|
-
let getter;
|
|
1318
|
-
let setter;
|
|
1319
|
-
const onlyGetter = isFunction(getterOrOptions);
|
|
1320
|
-
if (onlyGetter) {
|
|
1321
|
-
getter = getterOrOptions;
|
|
1322
|
-
setter = () => {
|
|
1323
|
-
warn$2("Write operation failed: computed value is readonly");
|
|
1324
|
-
} ;
|
|
1325
|
-
} else {
|
|
1326
|
-
getter = getterOrOptions.get;
|
|
1327
|
-
setter = getterOrOptions.set;
|
|
1328
|
-
}
|
|
1329
|
-
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1330
|
-
if (debugOptions && !isSSR) {
|
|
1331
|
-
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1332
|
-
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1333
|
-
}
|
|
1334
|
-
return cRef;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
function trackRefValue(ref2) {
|
|
1338
|
-
var _a;
|
|
1339
|
-
if (shouldTrack && activeEffect) {
|
|
1340
|
-
ref2 = toRaw(ref2);
|
|
1341
|
-
trackEffect(
|
|
1342
|
-
activeEffect,
|
|
1343
|
-
(_a = ref2.dep) != null ? _a : ref2.dep = createDep(
|
|
1344
|
-
() => ref2.dep = void 0,
|
|
1345
|
-
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1346
|
-
),
|
|
1347
|
-
{
|
|
1348
|
-
target: ref2,
|
|
1349
|
-
type: "get",
|
|
1350
|
-
key: "value"
|
|
1351
|
-
}
|
|
1352
|
-
);
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
|
|
1356
|
-
ref2 = toRaw(ref2);
|
|
1357
|
-
const dep = ref2.dep;
|
|
1358
|
-
if (dep) {
|
|
1359
|
-
triggerEffects(
|
|
1360
|
-
dep,
|
|
1361
|
-
dirtyLevel,
|
|
1362
|
-
{
|
|
1363
|
-
target: ref2,
|
|
1364
|
-
type: "set",
|
|
1365
|
-
key: "value",
|
|
1366
|
-
newValue: newVal
|
|
1367
|
-
}
|
|
1368
|
-
);
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
1622
|
function isRef(r) {
|
|
1372
|
-
return
|
|
1623
|
+
return r ? r.__v_isRef === true : false;
|
|
1373
1624
|
}
|
|
1374
1625
|
function ref(value) {
|
|
1375
1626
|
return createRef(value, false);
|
|
@@ -1386,27 +1637,49 @@ function createRef(rawValue, shallow) {
|
|
|
1386
1637
|
class RefImpl {
|
|
1387
1638
|
constructor(value, __v_isShallow) {
|
|
1388
1639
|
this.__v_isShallow = __v_isShallow;
|
|
1389
|
-
this.dep =
|
|
1640
|
+
this.dep = new Dep();
|
|
1390
1641
|
this.__v_isRef = true;
|
|
1391
1642
|
this._rawValue = __v_isShallow ? value : toRaw(value);
|
|
1392
1643
|
this._value = __v_isShallow ? value : toReactive(value);
|
|
1393
1644
|
}
|
|
1394
1645
|
get value() {
|
|
1395
|
-
|
|
1646
|
+
{
|
|
1647
|
+
this.dep.track({
|
|
1648
|
+
target: this,
|
|
1649
|
+
type: "get",
|
|
1650
|
+
key: "value"
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1396
1653
|
return this._value;
|
|
1397
1654
|
}
|
|
1398
|
-
set value(
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
this.
|
|
1404
|
-
|
|
1655
|
+
set value(newValue) {
|
|
1656
|
+
const oldValue = this._rawValue;
|
|
1657
|
+
const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
|
|
1658
|
+
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1659
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1660
|
+
this._rawValue = newValue;
|
|
1661
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1662
|
+
{
|
|
1663
|
+
this.dep.trigger({
|
|
1664
|
+
target: this,
|
|
1665
|
+
type: "set",
|
|
1666
|
+
key: "value",
|
|
1667
|
+
newValue,
|
|
1668
|
+
oldValue
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1405
1671
|
}
|
|
1406
1672
|
}
|
|
1407
1673
|
}
|
|
1408
1674
|
function triggerRef(ref2) {
|
|
1409
|
-
|
|
1675
|
+
{
|
|
1676
|
+
ref2.dep.trigger({
|
|
1677
|
+
target: ref2,
|
|
1678
|
+
type: "set",
|
|
1679
|
+
key: "value",
|
|
1680
|
+
newValue: ref2._value
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1410
1683
|
}
|
|
1411
1684
|
function unref(ref2) {
|
|
1412
1685
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1431,12 +1704,9 @@ function proxyRefs(objectWithRefs) {
|
|
|
1431
1704
|
}
|
|
1432
1705
|
class CustomRefImpl {
|
|
1433
1706
|
constructor(factory) {
|
|
1434
|
-
this.dep = void 0;
|
|
1435
1707
|
this.__v_isRef = true;
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1438
|
-
() => triggerRefValue(this)
|
|
1439
|
-
);
|
|
1708
|
+
const dep = this.dep = new Dep();
|
|
1709
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1440
1710
|
this._get = get;
|
|
1441
1711
|
this._set = set;
|
|
1442
1712
|
}
|
|
@@ -1504,6 +1774,90 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1504
1774
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1505
1775
|
}
|
|
1506
1776
|
|
|
1777
|
+
class ComputedRefImpl {
|
|
1778
|
+
constructor(fn, setter, isSSR) {
|
|
1779
|
+
this.fn = fn;
|
|
1780
|
+
this.setter = setter;
|
|
1781
|
+
/**
|
|
1782
|
+
* @internal
|
|
1783
|
+
*/
|
|
1784
|
+
this._value = void 0;
|
|
1785
|
+
/**
|
|
1786
|
+
* @internal
|
|
1787
|
+
*/
|
|
1788
|
+
this.dep = new Dep(this);
|
|
1789
|
+
/**
|
|
1790
|
+
* @internal
|
|
1791
|
+
*/
|
|
1792
|
+
this.__v_isRef = true;
|
|
1793
|
+
// A computed is also a subscriber that tracks other deps
|
|
1794
|
+
/**
|
|
1795
|
+
* @internal
|
|
1796
|
+
*/
|
|
1797
|
+
this.deps = void 0;
|
|
1798
|
+
/**
|
|
1799
|
+
* @internal
|
|
1800
|
+
*/
|
|
1801
|
+
this.depsTail = void 0;
|
|
1802
|
+
/**
|
|
1803
|
+
* @internal
|
|
1804
|
+
*/
|
|
1805
|
+
this.flags = 16;
|
|
1806
|
+
/**
|
|
1807
|
+
* @internal
|
|
1808
|
+
*/
|
|
1809
|
+
this.globalVersion = globalVersion - 1;
|
|
1810
|
+
// for backwards compat
|
|
1811
|
+
this.effect = this;
|
|
1812
|
+
this.__v_isReadonly = !setter;
|
|
1813
|
+
this.isSSR = isSSR;
|
|
1814
|
+
}
|
|
1815
|
+
/**
|
|
1816
|
+
* @internal
|
|
1817
|
+
*/
|
|
1818
|
+
notify() {
|
|
1819
|
+
if (activeSub !== this) {
|
|
1820
|
+
this.flags |= 16;
|
|
1821
|
+
this.dep.notify();
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
get value() {
|
|
1825
|
+
const link = this.dep.track({
|
|
1826
|
+
target: this,
|
|
1827
|
+
type: "get",
|
|
1828
|
+
key: "value"
|
|
1829
|
+
}) ;
|
|
1830
|
+
refreshComputed(this);
|
|
1831
|
+
if (link) {
|
|
1832
|
+
link.version = this.dep.version;
|
|
1833
|
+
}
|
|
1834
|
+
return this._value;
|
|
1835
|
+
}
|
|
1836
|
+
set value(newValue) {
|
|
1837
|
+
if (this.setter) {
|
|
1838
|
+
this.setter(newValue);
|
|
1839
|
+
} else {
|
|
1840
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1845
|
+
let getter;
|
|
1846
|
+
let setter;
|
|
1847
|
+
if (isFunction(getterOrOptions)) {
|
|
1848
|
+
getter = getterOrOptions;
|
|
1849
|
+
} else {
|
|
1850
|
+
getter = getterOrOptions.get;
|
|
1851
|
+
setter = getterOrOptions.set;
|
|
1852
|
+
}
|
|
1853
|
+
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1854
|
+
if (debugOptions && !isSSR) {
|
|
1855
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1856
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1857
|
+
}
|
|
1858
|
+
return cRef;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1507
1861
|
const TrackOpTypes = {
|
|
1508
1862
|
"GET": "get",
|
|
1509
1863
|
"HAS": "has",
|
|
@@ -1796,7 +2150,7 @@ function findInsertionIndex(id) {
|
|
|
1796
2150
|
const middle = start + end >>> 1;
|
|
1797
2151
|
const middleJob = queue[middle];
|
|
1798
2152
|
const middleJobId = getId(middleJob);
|
|
1799
|
-
if (middleJobId < id || middleJobId === id && middleJob.
|
|
2153
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1800
2154
|
start = middle + 1;
|
|
1801
2155
|
} else {
|
|
1802
2156
|
end = middle;
|
|
@@ -1805,15 +2159,21 @@ function findInsertionIndex(id) {
|
|
|
1805
2159
|
return start;
|
|
1806
2160
|
}
|
|
1807
2161
|
function queueJob(job) {
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1811
|
-
)) {
|
|
2162
|
+
var _a;
|
|
2163
|
+
if (!(job.flags & 1)) {
|
|
1812
2164
|
if (job.id == null) {
|
|
1813
2165
|
queue.push(job);
|
|
2166
|
+
} else if (
|
|
2167
|
+
// fast path when the job id is larger than the tail
|
|
2168
|
+
!(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
|
|
2169
|
+
) {
|
|
2170
|
+
queue.push(job);
|
|
1814
2171
|
} else {
|
|
1815
2172
|
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1816
2173
|
}
|
|
2174
|
+
if (!(job.flags & 4)) {
|
|
2175
|
+
job.flags |= 1;
|
|
2176
|
+
}
|
|
1817
2177
|
queueFlush();
|
|
1818
2178
|
}
|
|
1819
2179
|
}
|
|
@@ -1831,11 +2191,11 @@ function invalidateJob(job) {
|
|
|
1831
2191
|
}
|
|
1832
2192
|
function queuePostFlushCb(cb) {
|
|
1833
2193
|
if (!isArray(cb)) {
|
|
1834
|
-
if (!
|
|
1835
|
-
cb,
|
|
1836
|
-
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1837
|
-
)) {
|
|
2194
|
+
if (!(cb.flags & 1)) {
|
|
1838
2195
|
pendingPostFlushCbs.push(cb);
|
|
2196
|
+
if (!(cb.flags & 4)) {
|
|
2197
|
+
cb.flags |= 1;
|
|
2198
|
+
}
|
|
1839
2199
|
}
|
|
1840
2200
|
} else {
|
|
1841
2201
|
pendingPostFlushCbs.push(...cb);
|
|
@@ -1848,7 +2208,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1848
2208
|
}
|
|
1849
2209
|
for (; i < queue.length; i++) {
|
|
1850
2210
|
const cb = queue[i];
|
|
1851
|
-
if (cb && cb.
|
|
2211
|
+
if (cb && cb.flags & 2) {
|
|
1852
2212
|
if (instance && cb.id !== instance.uid) {
|
|
1853
2213
|
continue;
|
|
1854
2214
|
}
|
|
@@ -1858,6 +2218,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1858
2218
|
queue.splice(i, 1);
|
|
1859
2219
|
i--;
|
|
1860
2220
|
cb();
|
|
2221
|
+
cb.flags &= ~1;
|
|
1861
2222
|
}
|
|
1862
2223
|
}
|
|
1863
2224
|
}
|
|
@@ -1880,6 +2241,7 @@ function flushPostFlushCbs(seen) {
|
|
|
1880
2241
|
continue;
|
|
1881
2242
|
}
|
|
1882
2243
|
activePostFlushCbs[postFlushIndex]();
|
|
2244
|
+
activePostFlushCbs[postFlushIndex].flags &= ~1;
|
|
1883
2245
|
}
|
|
1884
2246
|
activePostFlushCbs = null;
|
|
1885
2247
|
postFlushIndex = 0;
|
|
@@ -1889,9 +2251,11 @@ const getId = (job) => job.id == null ? Infinity : job.id;
|
|
|
1889
2251
|
const comparator = (a, b) => {
|
|
1890
2252
|
const diff = getId(a) - getId(b);
|
|
1891
2253
|
if (diff === 0) {
|
|
1892
|
-
|
|
2254
|
+
const isAPre = a.flags & 2;
|
|
2255
|
+
const isBPre = b.flags & 2;
|
|
2256
|
+
if (isAPre && !isBPre)
|
|
1893
2257
|
return -1;
|
|
1894
|
-
if (
|
|
2258
|
+
if (isBPre && !isAPre)
|
|
1895
2259
|
return 1;
|
|
1896
2260
|
}
|
|
1897
2261
|
return diff;
|
|
@@ -1907,11 +2271,12 @@ function flushJobs(seen) {
|
|
|
1907
2271
|
try {
|
|
1908
2272
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1909
2273
|
const job = queue[flushIndex];
|
|
1910
|
-
if (job && job.
|
|
2274
|
+
if (job && !(job.flags & 8)) {
|
|
1911
2275
|
if (check(job)) {
|
|
1912
2276
|
continue;
|
|
1913
2277
|
}
|
|
1914
2278
|
callWithErrorHandling(job, null, 14);
|
|
2279
|
+
job.flags &= ~1;
|
|
1915
2280
|
}
|
|
1916
2281
|
}
|
|
1917
2282
|
} finally {
|
|
@@ -1993,7 +2358,6 @@ function rerender(id, newRender) {
|
|
|
1993
2358
|
}
|
|
1994
2359
|
instance.renderCache = [];
|
|
1995
2360
|
isHmrUpdating = true;
|
|
1996
|
-
instance.effect.dirty = true;
|
|
1997
2361
|
instance.update();
|
|
1998
2362
|
isHmrUpdating = false;
|
|
1999
2363
|
});
|
|
@@ -2021,7 +2385,6 @@ function reload(id, newComp) {
|
|
|
2021
2385
|
instance.ceReload(newComp.styles);
|
|
2022
2386
|
hmrDirtyComponents.delete(oldComp);
|
|
2023
2387
|
} else if (instance.parent) {
|
|
2024
|
-
instance.parent.effect.dirty = true;
|
|
2025
2388
|
queueJob(instance.parent.update);
|
|
2026
2389
|
} else if (instance.appContext.reload) {
|
|
2027
2390
|
instance.appContext.reload();
|
|
@@ -2410,7 +2773,7 @@ function renderComponentRoot(instance) {
|
|
|
2410
2773
|
true ? {
|
|
2411
2774
|
get attrs() {
|
|
2412
2775
|
markAttrsAccessed();
|
|
2413
|
-
return
|
|
2776
|
+
return attrs;
|
|
2414
2777
|
},
|
|
2415
2778
|
slots,
|
|
2416
2779
|
emit
|
|
@@ -2443,7 +2806,7 @@ function renderComponentRoot(instance) {
|
|
|
2443
2806
|
propsOptions
|
|
2444
2807
|
);
|
|
2445
2808
|
}
|
|
2446
|
-
root = cloneVNode(root, fallthroughAttrs
|
|
2809
|
+
root = cloneVNode(root, fallthroughAttrs);
|
|
2447
2810
|
} else if (!accessedAttrs && root.type !== Comment) {
|
|
2448
2811
|
const allAttrs = Object.keys(attrs);
|
|
2449
2812
|
const eventAttrs = [];
|
|
@@ -2477,7 +2840,7 @@ function renderComponentRoot(instance) {
|
|
|
2477
2840
|
`Runtime directive used on component with non-element root node. The directives will not function as intended.`
|
|
2478
2841
|
);
|
|
2479
2842
|
}
|
|
2480
|
-
root = cloneVNode(root
|
|
2843
|
+
root = cloneVNode(root);
|
|
2481
2844
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
2482
2845
|
}
|
|
2483
2846
|
if (vnode.transition) {
|
|
@@ -2968,7 +3331,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
2968
3331
|
let parentSuspenseId;
|
|
2969
3332
|
const isSuspensible = isVNodeSuspensible(vnode);
|
|
2970
3333
|
if (isSuspensible) {
|
|
2971
|
-
if (parentSuspense
|
|
3334
|
+
if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
|
|
2972
3335
|
parentSuspenseId = parentSuspense.pendingId;
|
|
2973
3336
|
parentSuspense.deps++;
|
|
2974
3337
|
}
|
|
@@ -3280,8 +3643,8 @@ function setActiveBranch(suspense, branch) {
|
|
|
3280
3643
|
}
|
|
3281
3644
|
}
|
|
3282
3645
|
function isVNodeSuspensible(vnode) {
|
|
3283
|
-
|
|
3284
|
-
return suspensible != null && suspensible !== false;
|
|
3646
|
+
var _a;
|
|
3647
|
+
return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
|
|
3285
3648
|
}
|
|
3286
3649
|
|
|
3287
3650
|
const ssrContextKey = Symbol.for("v-scx");
|
|
@@ -3427,8 +3790,8 @@ function doWatch(source, cb, {
|
|
|
3427
3790
|
};
|
|
3428
3791
|
};
|
|
3429
3792
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
3430
|
-
const job = () => {
|
|
3431
|
-
if (!effect.
|
|
3793
|
+
const job = (immediateFirstRun) => {
|
|
3794
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
3432
3795
|
return;
|
|
3433
3796
|
}
|
|
3434
3797
|
if (cb) {
|
|
@@ -3449,19 +3812,22 @@ function doWatch(source, cb, {
|
|
|
3449
3812
|
effect.run();
|
|
3450
3813
|
}
|
|
3451
3814
|
};
|
|
3452
|
-
|
|
3815
|
+
if (cb)
|
|
3816
|
+
job.flags |= 4;
|
|
3817
|
+
const effect = new ReactiveEffect(getter);
|
|
3453
3818
|
let scheduler;
|
|
3454
3819
|
if (flush === "sync") {
|
|
3820
|
+
effect.flags |= 64;
|
|
3455
3821
|
scheduler = job;
|
|
3456
3822
|
} else if (flush === "post") {
|
|
3457
3823
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
3458
3824
|
} else {
|
|
3459
|
-
job.
|
|
3825
|
+
job.flags |= 2;
|
|
3460
3826
|
if (instance)
|
|
3461
3827
|
job.id = instance.uid;
|
|
3462
3828
|
scheduler = () => queueJob(job);
|
|
3463
3829
|
}
|
|
3464
|
-
|
|
3830
|
+
effect.scheduler = scheduler;
|
|
3465
3831
|
const scope = getCurrentScope();
|
|
3466
3832
|
const unwatch = () => {
|
|
3467
3833
|
effect.stop();
|
|
@@ -3475,7 +3841,7 @@ function doWatch(source, cb, {
|
|
|
3475
3841
|
}
|
|
3476
3842
|
if (cb) {
|
|
3477
3843
|
if (immediate) {
|
|
3478
|
-
job();
|
|
3844
|
+
job(true);
|
|
3479
3845
|
} else {
|
|
3480
3846
|
oldValue = effect.run();
|
|
3481
3847
|
}
|
|
@@ -3514,29 +3880,34 @@ function createPathGetter(ctx, path) {
|
|
|
3514
3880
|
return cur;
|
|
3515
3881
|
};
|
|
3516
3882
|
}
|
|
3517
|
-
function traverse(value, depth =
|
|
3518
|
-
if (
|
|
3883
|
+
function traverse(value, depth, currentDepth = 0, seen) {
|
|
3884
|
+
if (!isObject(value) || value["__v_skip"]) {
|
|
3519
3885
|
return value;
|
|
3520
3886
|
}
|
|
3887
|
+
if (depth && depth > 0) {
|
|
3888
|
+
if (currentDepth >= depth) {
|
|
3889
|
+
return value;
|
|
3890
|
+
}
|
|
3891
|
+
currentDepth++;
|
|
3892
|
+
}
|
|
3521
3893
|
seen = seen || /* @__PURE__ */ new Set();
|
|
3522
3894
|
if (seen.has(value)) {
|
|
3523
3895
|
return value;
|
|
3524
3896
|
}
|
|
3525
3897
|
seen.add(value);
|
|
3526
|
-
depth--;
|
|
3527
3898
|
if (isRef(value)) {
|
|
3528
|
-
traverse(value.value, depth, seen);
|
|
3899
|
+
traverse(value.value, depth, currentDepth, seen);
|
|
3529
3900
|
} else if (isArray(value)) {
|
|
3530
3901
|
for (let i = 0; i < value.length; i++) {
|
|
3531
|
-
traverse(value[i], depth, seen);
|
|
3902
|
+
traverse(value[i], depth, currentDepth, seen);
|
|
3532
3903
|
}
|
|
3533
3904
|
} else if (isSet(value) || isMap(value)) {
|
|
3534
3905
|
value.forEach((v) => {
|
|
3535
|
-
traverse(v, depth, seen);
|
|
3906
|
+
traverse(v, depth, currentDepth, seen);
|
|
3536
3907
|
});
|
|
3537
3908
|
} else if (isPlainObject(value)) {
|
|
3538
3909
|
for (const key in value) {
|
|
3539
|
-
traverse(value[key], depth, seen);
|
|
3910
|
+
traverse(value[key], depth, currentDepth, seen);
|
|
3540
3911
|
}
|
|
3541
3912
|
}
|
|
3542
3913
|
return value;
|
|
@@ -3649,22 +4020,7 @@ const BaseTransitionImpl = {
|
|
|
3649
4020
|
if (!children || !children.length) {
|
|
3650
4021
|
return;
|
|
3651
4022
|
}
|
|
3652
|
-
|
|
3653
|
-
if (children.length > 1) {
|
|
3654
|
-
let hasFound = false;
|
|
3655
|
-
for (const c of children) {
|
|
3656
|
-
if (c.type !== Comment) {
|
|
3657
|
-
if (hasFound) {
|
|
3658
|
-
warn$1(
|
|
3659
|
-
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
3660
|
-
);
|
|
3661
|
-
break;
|
|
3662
|
-
}
|
|
3663
|
-
child = c;
|
|
3664
|
-
hasFound = true;
|
|
3665
|
-
}
|
|
3666
|
-
}
|
|
3667
|
-
}
|
|
4023
|
+
const child = findNonCommentChild(children);
|
|
3668
4024
|
const rawProps = toRaw(props);
|
|
3669
4025
|
const { mode } = rawProps;
|
|
3670
4026
|
if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
|
@@ -3673,7 +4029,7 @@ const BaseTransitionImpl = {
|
|
|
3673
4029
|
if (state.isLeaving) {
|
|
3674
4030
|
return emptyPlaceholder(child);
|
|
3675
4031
|
}
|
|
3676
|
-
const innerChild =
|
|
4032
|
+
const innerChild = getInnerChild$1(child);
|
|
3677
4033
|
if (!innerChild) {
|
|
3678
4034
|
return emptyPlaceholder(child);
|
|
3679
4035
|
}
|
|
@@ -3685,7 +4041,7 @@ const BaseTransitionImpl = {
|
|
|
3685
4041
|
);
|
|
3686
4042
|
setTransitionHooks(innerChild, enterHooks);
|
|
3687
4043
|
const oldChild = instance.subTree;
|
|
3688
|
-
const oldInnerChild = oldChild &&
|
|
4044
|
+
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
|
|
3689
4045
|
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
|
3690
4046
|
const leavingHooks = resolveTransitionHooks(
|
|
3691
4047
|
oldInnerChild,
|
|
@@ -3694,12 +4050,11 @@ const BaseTransitionImpl = {
|
|
|
3694
4050
|
instance
|
|
3695
4051
|
);
|
|
3696
4052
|
setTransitionHooks(oldInnerChild, leavingHooks);
|
|
3697
|
-
if (mode === "out-in"
|
|
4053
|
+
if (mode === "out-in") {
|
|
3698
4054
|
state.isLeaving = true;
|
|
3699
4055
|
leavingHooks.afterLeave = () => {
|
|
3700
4056
|
state.isLeaving = false;
|
|
3701
|
-
if (instance.
|
|
3702
|
-
instance.effect.dirty = true;
|
|
4057
|
+
if (!(instance.job.flags & 8)) {
|
|
3703
4058
|
instance.update();
|
|
3704
4059
|
}
|
|
3705
4060
|
};
|
|
@@ -3724,6 +4079,25 @@ const BaseTransitionImpl = {
|
|
|
3724
4079
|
};
|
|
3725
4080
|
}
|
|
3726
4081
|
};
|
|
4082
|
+
function findNonCommentChild(children) {
|
|
4083
|
+
let child = children[0];
|
|
4084
|
+
if (children.length > 1) {
|
|
4085
|
+
let hasFound = false;
|
|
4086
|
+
for (const c of children) {
|
|
4087
|
+
if (c.type !== Comment) {
|
|
4088
|
+
if (hasFound) {
|
|
4089
|
+
warn$1(
|
|
4090
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4091
|
+
);
|
|
4092
|
+
break;
|
|
4093
|
+
}
|
|
4094
|
+
child = c;
|
|
4095
|
+
hasFound = true;
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
4099
|
+
return child;
|
|
4100
|
+
}
|
|
3727
4101
|
const BaseTransition = BaseTransitionImpl;
|
|
3728
4102
|
function getLeavingNodesForType(state, vnode) {
|
|
3729
4103
|
const { leavingVNodes } = state;
|
|
@@ -3878,8 +4252,11 @@ function emptyPlaceholder(vnode) {
|
|
|
3878
4252
|
return vnode;
|
|
3879
4253
|
}
|
|
3880
4254
|
}
|
|
3881
|
-
function
|
|
4255
|
+
function getInnerChild$1(vnode) {
|
|
3882
4256
|
if (!isKeepAlive(vnode)) {
|
|
4257
|
+
if (isTeleport(vnode.type) && vnode.children) {
|
|
4258
|
+
return findNonCommentChild(vnode.children);
|
|
4259
|
+
}
|
|
3883
4260
|
return vnode;
|
|
3884
4261
|
}
|
|
3885
4262
|
if (vnode.component) {
|
|
@@ -4048,7 +4425,6 @@ function defineAsyncComponent(source) {
|
|
|
4048
4425
|
load().then(() => {
|
|
4049
4426
|
loaded.value = true;
|
|
4050
4427
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4051
|
-
instance.parent.effect.dirty = true;
|
|
4052
4428
|
queueJob(instance.parent.update);
|
|
4053
4429
|
}
|
|
4054
4430
|
}).catch((err) => {
|
|
@@ -4209,7 +4585,7 @@ const KeepAliveImpl = {
|
|
|
4209
4585
|
return () => {
|
|
4210
4586
|
pendingCacheKey = null;
|
|
4211
4587
|
if (!slots.default) {
|
|
4212
|
-
return null;
|
|
4588
|
+
return current = null;
|
|
4213
4589
|
}
|
|
4214
4590
|
const children = slots.default();
|
|
4215
4591
|
const rawVNode = children[0];
|
|
@@ -4373,10 +4749,20 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
4373
4749
|
function renderList(source, renderItem, cache, index) {
|
|
4374
4750
|
let ret;
|
|
4375
4751
|
const cached = cache && cache[index];
|
|
4376
|
-
|
|
4752
|
+
const sourceIsArray = isArray(source);
|
|
4753
|
+
const sourceIsReactiveArray = sourceIsArray && isReactive(source);
|
|
4754
|
+
if (sourceIsArray || isString(source)) {
|
|
4755
|
+
if (sourceIsReactiveArray) {
|
|
4756
|
+
source = shallowReadArray(source);
|
|
4757
|
+
}
|
|
4377
4758
|
ret = new Array(source.length);
|
|
4378
4759
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
4379
|
-
ret[i] = renderItem(
|
|
4760
|
+
ret[i] = renderItem(
|
|
4761
|
+
sourceIsReactiveArray ? toReactive(source[i]) : source[i],
|
|
4762
|
+
i,
|
|
4763
|
+
void 0,
|
|
4764
|
+
cached && cached[i]
|
|
4765
|
+
);
|
|
4380
4766
|
}
|
|
4381
4767
|
} else if (typeof source === "number") {
|
|
4382
4768
|
if (!Number.isInteger(source)) {
|
|
@@ -4511,7 +4897,6 @@ const publicPropertiesMap = (
|
|
|
4511
4897
|
$emit: (i) => i.emit,
|
|
4512
4898
|
$options: (i) => resolveMergedOptions(i) ,
|
|
4513
4899
|
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
4514
|
-
i.effect.dirty = true;
|
|
4515
4900
|
queueJob(i.update);
|
|
4516
4901
|
}),
|
|
4517
4902
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
@@ -5844,7 +6229,9 @@ const isSimpleType = /* @__PURE__ */ makeMap(
|
|
|
5844
6229
|
function assertType(value, type) {
|
|
5845
6230
|
let valid;
|
|
5846
6231
|
const expectedType = getType(type);
|
|
5847
|
-
if (
|
|
6232
|
+
if (expectedType === "null") {
|
|
6233
|
+
valid = value === null;
|
|
6234
|
+
} else if (isSimpleType(expectedType)) {
|
|
5848
6235
|
const t = typeof value;
|
|
5849
6236
|
valid = t === expectedType.toLowerCase();
|
|
5850
6237
|
if (!valid && t === "object") {
|
|
@@ -5854,8 +6241,6 @@ function assertType(value, type) {
|
|
|
5854
6241
|
valid = isObject(value);
|
|
5855
6242
|
} else if (expectedType === "Array") {
|
|
5856
6243
|
valid = isArray(value);
|
|
5857
|
-
} else if (expectedType === "null") {
|
|
5858
|
-
valid = value === null;
|
|
5859
6244
|
} else {
|
|
5860
6245
|
valid = value instanceof type;
|
|
5861
6246
|
}
|
|
@@ -5950,7 +6335,7 @@ const initSlots = (instance, children) => {
|
|
|
5950
6335
|
const type = children._;
|
|
5951
6336
|
if (type) {
|
|
5952
6337
|
extend(slots, children);
|
|
5953
|
-
def(slots, "_", type
|
|
6338
|
+
def(slots, "_", type);
|
|
5954
6339
|
} else {
|
|
5955
6340
|
normalizeObjectSlots(children, slots);
|
|
5956
6341
|
}
|
|
@@ -7379,7 +7764,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7379
7764
|
} else {
|
|
7380
7765
|
instance.next = n2;
|
|
7381
7766
|
invalidateJob(instance.update);
|
|
7382
|
-
instance.effect.dirty = true;
|
|
7383
7767
|
instance.update();
|
|
7384
7768
|
}
|
|
7385
7769
|
} else {
|
|
@@ -7562,24 +7946,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7562
7946
|
}
|
|
7563
7947
|
}
|
|
7564
7948
|
};
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
);
|
|
7572
|
-
const update = instance.update = () => {
|
|
7573
|
-
if (effect.dirty) {
|
|
7574
|
-
effect.run();
|
|
7575
|
-
}
|
|
7576
|
-
};
|
|
7577
|
-
update.id = instance.uid;
|
|
7949
|
+
instance.scope.on();
|
|
7950
|
+
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
7951
|
+
instance.scope.off();
|
|
7952
|
+
const update = instance.update = effect.run.bind(effect);
|
|
7953
|
+
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
7954
|
+
job.id = instance.uid;
|
|
7955
|
+
effect.scheduler = () => queueJob(job);
|
|
7578
7956
|
toggleRecurse(instance, true);
|
|
7579
7957
|
{
|
|
7580
7958
|
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
7581
7959
|
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
7582
|
-
|
|
7960
|
+
job.ownerInstance = instance;
|
|
7583
7961
|
}
|
|
7584
7962
|
update();
|
|
7585
7963
|
};
|
|
@@ -8046,13 +8424,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8046
8424
|
if (instance.type.__hmrId) {
|
|
8047
8425
|
unregisterHMR(instance);
|
|
8048
8426
|
}
|
|
8049
|
-
const { bum, scope,
|
|
8427
|
+
const { bum, scope, job, subTree, um } = instance;
|
|
8050
8428
|
if (bum) {
|
|
8051
8429
|
invokeArrayFns(bum);
|
|
8052
8430
|
}
|
|
8053
8431
|
scope.stop();
|
|
8054
|
-
if (
|
|
8055
|
-
|
|
8432
|
+
if (job) {
|
|
8433
|
+
job.flags |= 8;
|
|
8056
8434
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
8057
8435
|
}
|
|
8058
8436
|
if (um) {
|
|
@@ -8138,8 +8516,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8138
8516
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
8139
8517
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
8140
8518
|
}
|
|
8141
|
-
function toggleRecurse({ effect,
|
|
8142
|
-
|
|
8519
|
+
function toggleRecurse({ effect, job }, allowed) {
|
|
8520
|
+
if (allowed) {
|
|
8521
|
+
effect.flags |= 32;
|
|
8522
|
+
job.flags |= 4;
|
|
8523
|
+
} else {
|
|
8524
|
+
effect.flags &= ~32;
|
|
8525
|
+
job.flags &= ~4;
|
|
8526
|
+
}
|
|
8143
8527
|
}
|
|
8144
8528
|
function needTransition(parentSuspense, transition) {
|
|
8145
8529
|
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
|
@@ -8697,8 +9081,8 @@ function guardReactiveProps(props) {
|
|
|
8697
9081
|
return null;
|
|
8698
9082
|
return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
|
|
8699
9083
|
}
|
|
8700
|
-
function cloneVNode(vnode, extraProps, mergeRef = false
|
|
8701
|
-
const { props, ref, patchFlag, children
|
|
9084
|
+
function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
9085
|
+
const { props, ref, patchFlag, children } = vnode;
|
|
8702
9086
|
const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
|
8703
9087
|
const cloned = {
|
|
8704
9088
|
__v_isVNode: true,
|
|
@@ -8728,7 +9112,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
8728
9112
|
dynamicChildren: vnode.dynamicChildren,
|
|
8729
9113
|
appContext: vnode.appContext,
|
|
8730
9114
|
dirs: vnode.dirs,
|
|
8731
|
-
transition,
|
|
9115
|
+
transition: vnode.transition,
|
|
8732
9116
|
// These should technically only be non-null on mounted VNodes. However,
|
|
8733
9117
|
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
8734
9118
|
// them since them being non-null during a mount doesn't affect the logic as
|
|
@@ -8742,9 +9126,6 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
8742
9126
|
ctx: vnode.ctx,
|
|
8743
9127
|
ce: vnode.ce
|
|
8744
9128
|
};
|
|
8745
|
-
if (transition && cloneTransition) {
|
|
8746
|
-
cloned.transition = transition.clone(cloned);
|
|
8747
|
-
}
|
|
8748
9129
|
return cloned;
|
|
8749
9130
|
}
|
|
8750
9131
|
function deepCloneVNode(vnode) {
|
|
@@ -8879,6 +9260,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
8879
9260
|
effect: null,
|
|
8880
9261
|
update: null,
|
|
8881
9262
|
// will be set synchronously right after creation
|
|
9263
|
+
job: null,
|
|
8882
9264
|
scope: new EffectScope(
|
|
8883
9265
|
true
|
|
8884
9266
|
/* detached */
|
|
@@ -9372,7 +9754,8 @@ function initCustomFormatter() {
|
|
|
9372
9754
|
{},
|
|
9373
9755
|
["span", vueStyle, genRefFlag(obj)],
|
|
9374
9756
|
"<",
|
|
9375
|
-
|
|
9757
|
+
// avoid debugger accessing value affecting behavior
|
|
9758
|
+
formatValue("_value" in obj ? obj._value : obj),
|
|
9376
9759
|
`>`
|
|
9377
9760
|
];
|
|
9378
9761
|
} else if (isReactive(obj)) {
|
|
@@ -9552,7 +9935,7 @@ function isMemoSame(cached, memo) {
|
|
|
9552
9935
|
return true;
|
|
9553
9936
|
}
|
|
9554
9937
|
|
|
9555
|
-
const version = "3.
|
|
9938
|
+
const version = "3.5.0-alpha.1";
|
|
9556
9939
|
const warn = warn$1 ;
|
|
9557
9940
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
9558
9941
|
const devtools = devtools$1 ;
|
|
@@ -11007,7 +11390,9 @@ const withKeys = (fn, modifiers) => {
|
|
|
11007
11390
|
return;
|
|
11008
11391
|
}
|
|
11009
11392
|
const eventKey = hyphenate(event.key);
|
|
11010
|
-
if (modifiers.some(
|
|
11393
|
+
if (modifiers.some(
|
|
11394
|
+
(k) => k === eventKey || keyNames[k] === eventKey
|
|
11395
|
+
)) {
|
|
11011
11396
|
return fn(event);
|
|
11012
11397
|
}
|
|
11013
11398
|
});
|