@vue/compat 3.4.26 → 3.5.0-alpha.2
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/vue.cjs.js +994 -419
- package/dist/vue.cjs.prod.js +780 -405
- package/dist/vue.esm-browser.js +994 -419
- package/dist/vue.esm-browser.prod.js +6 -6
- package/dist/vue.esm-bundler.js +1006 -421
- package/dist/vue.global.js +994 -419
- package/dist/vue.global.prod.js +6 -6
- package/dist/vue.runtime.esm-browser.js +819 -418
- package/dist/vue.runtime.esm-browser.prod.js +6 -6
- package/dist/vue.runtime.esm-bundler.js +831 -420
- package/dist/vue.runtime.global.js +819 -418
- package/dist/vue.runtime.global.prod.js +6 -6
- package/package.json +2 -2
package/dist/vue.esm-browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compat v3.
|
|
2
|
+
* @vue/compat v3.5.0-alpha.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -450,156 +450,280 @@ class EffectScope {
|
|
|
450
450
|
function effectScope(detached) {
|
|
451
451
|
return new EffectScope(detached);
|
|
452
452
|
}
|
|
453
|
-
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
454
|
-
if (scope && scope.active) {
|
|
455
|
-
scope.effects.push(effect);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
453
|
function getCurrentScope() {
|
|
459
454
|
return activeEffectScope;
|
|
460
455
|
}
|
|
461
|
-
function onScopeDispose(fn) {
|
|
456
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
462
457
|
if (activeEffectScope) {
|
|
463
458
|
activeEffectScope.cleanups.push(fn);
|
|
464
|
-
} else {
|
|
459
|
+
} else if (!failSilently) {
|
|
465
460
|
warn$2(
|
|
466
461
|
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
467
462
|
);
|
|
468
463
|
}
|
|
469
464
|
}
|
|
470
465
|
|
|
471
|
-
let
|
|
466
|
+
let activeSub;
|
|
472
467
|
class ReactiveEffect {
|
|
473
|
-
constructor(fn
|
|
468
|
+
constructor(fn) {
|
|
474
469
|
this.fn = fn;
|
|
475
|
-
this.trigger = trigger;
|
|
476
|
-
this.scheduler = scheduler;
|
|
477
|
-
this.active = true;
|
|
478
|
-
this.deps = [];
|
|
479
470
|
/**
|
|
480
471
|
* @internal
|
|
481
472
|
*/
|
|
482
|
-
this.
|
|
473
|
+
this.deps = void 0;
|
|
483
474
|
/**
|
|
484
475
|
* @internal
|
|
485
476
|
*/
|
|
486
|
-
this.
|
|
477
|
+
this.depsTail = void 0;
|
|
487
478
|
/**
|
|
488
479
|
* @internal
|
|
489
480
|
*/
|
|
490
|
-
this.
|
|
481
|
+
this.flags = 1 | 4;
|
|
491
482
|
/**
|
|
492
483
|
* @internal
|
|
493
484
|
*/
|
|
494
|
-
this.
|
|
485
|
+
this.nextEffect = void 0;
|
|
495
486
|
/**
|
|
496
487
|
* @internal
|
|
497
488
|
*/
|
|
498
|
-
this.
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
|
503
|
-
this._dirtyLevel = 1;
|
|
504
|
-
pauseTracking();
|
|
505
|
-
for (let i = 0; i < this._depsLength; i++) {
|
|
506
|
-
const dep = this.deps[i];
|
|
507
|
-
if (dep.computed) {
|
|
508
|
-
triggerComputed(dep.computed);
|
|
509
|
-
if (this._dirtyLevel >= 4) {
|
|
510
|
-
break;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
if (this._dirtyLevel === 1) {
|
|
515
|
-
this._dirtyLevel = 0;
|
|
516
|
-
}
|
|
517
|
-
resetTracking();
|
|
489
|
+
this.cleanup = void 0;
|
|
490
|
+
this.scheduler = void 0;
|
|
491
|
+
if (activeEffectScope && activeEffectScope.active) {
|
|
492
|
+
activeEffectScope.effects.push(this);
|
|
518
493
|
}
|
|
519
|
-
return this._dirtyLevel >= 4;
|
|
520
494
|
}
|
|
521
|
-
|
|
522
|
-
|
|
495
|
+
/**
|
|
496
|
+
* @internal
|
|
497
|
+
*/
|
|
498
|
+
notify() {
|
|
499
|
+
if (this.flags & 2 && !(this.flags & 32)) {
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
if (this.flags & 64) {
|
|
503
|
+
return this.trigger();
|
|
504
|
+
}
|
|
505
|
+
if (!(this.flags & 8)) {
|
|
506
|
+
this.flags |= 8;
|
|
507
|
+
this.nextEffect = batchedEffect;
|
|
508
|
+
batchedEffect = this;
|
|
509
|
+
}
|
|
523
510
|
}
|
|
524
511
|
run() {
|
|
525
|
-
this.
|
|
526
|
-
if (!this.active) {
|
|
512
|
+
if (!(this.flags & 1)) {
|
|
527
513
|
return this.fn();
|
|
528
514
|
}
|
|
529
|
-
|
|
530
|
-
|
|
515
|
+
this.flags |= 2;
|
|
516
|
+
cleanupEffect(this);
|
|
517
|
+
prepareDeps(this);
|
|
518
|
+
const prevEffect = activeSub;
|
|
519
|
+
const prevShouldTrack = shouldTrack;
|
|
520
|
+
activeSub = this;
|
|
521
|
+
shouldTrack = true;
|
|
531
522
|
try {
|
|
532
|
-
shouldTrack = true;
|
|
533
|
-
activeEffect = this;
|
|
534
|
-
this._runnings++;
|
|
535
|
-
preCleanupEffect(this);
|
|
536
523
|
return this.fn();
|
|
537
524
|
} finally {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
525
|
+
if (activeSub !== this) {
|
|
526
|
+
warn$2(
|
|
527
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
cleanupDeps(this);
|
|
531
|
+
activeSub = prevEffect;
|
|
532
|
+
shouldTrack = prevShouldTrack;
|
|
533
|
+
this.flags &= ~2;
|
|
542
534
|
}
|
|
543
535
|
}
|
|
544
536
|
stop() {
|
|
545
|
-
if (this.
|
|
546
|
-
|
|
547
|
-
|
|
537
|
+
if (this.flags & 1) {
|
|
538
|
+
for (let link = this.deps; link; link = link.nextDep) {
|
|
539
|
+
removeSub(link);
|
|
540
|
+
}
|
|
541
|
+
this.deps = this.depsTail = void 0;
|
|
542
|
+
cleanupEffect(this);
|
|
548
543
|
this.onStop && this.onStop();
|
|
549
|
-
this.
|
|
544
|
+
this.flags &= ~1;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
trigger() {
|
|
548
|
+
if (this.scheduler) {
|
|
549
|
+
this.scheduler();
|
|
550
|
+
} else {
|
|
551
|
+
this.runIfDirty();
|
|
550
552
|
}
|
|
551
553
|
}
|
|
554
|
+
/**
|
|
555
|
+
* @internal
|
|
556
|
+
*/
|
|
557
|
+
runIfDirty() {
|
|
558
|
+
if (isDirty(this)) {
|
|
559
|
+
this.run();
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
get dirty() {
|
|
563
|
+
return isDirty(this);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
let batchDepth = 0;
|
|
567
|
+
let batchedEffect;
|
|
568
|
+
function startBatch() {
|
|
569
|
+
batchDepth++;
|
|
570
|
+
}
|
|
571
|
+
function endBatch() {
|
|
572
|
+
if (batchDepth > 1) {
|
|
573
|
+
batchDepth--;
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
let error;
|
|
577
|
+
while (batchedEffect) {
|
|
578
|
+
let e = batchedEffect;
|
|
579
|
+
batchedEffect = void 0;
|
|
580
|
+
while (e) {
|
|
581
|
+
const next = e.nextEffect;
|
|
582
|
+
e.nextEffect = void 0;
|
|
583
|
+
e.flags &= ~8;
|
|
584
|
+
if (e.flags & 1) {
|
|
585
|
+
try {
|
|
586
|
+
e.trigger();
|
|
587
|
+
} catch (err) {
|
|
588
|
+
if (!error)
|
|
589
|
+
error = err;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
e = next;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
batchDepth--;
|
|
596
|
+
if (error)
|
|
597
|
+
throw error;
|
|
598
|
+
}
|
|
599
|
+
function prepareDeps(sub) {
|
|
600
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
601
|
+
link.version = -1;
|
|
602
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
603
|
+
link.dep.activeLink = link;
|
|
604
|
+
}
|
|
552
605
|
}
|
|
553
|
-
function
|
|
554
|
-
|
|
606
|
+
function cleanupDeps(sub) {
|
|
607
|
+
let head;
|
|
608
|
+
let tail = sub.depsTail;
|
|
609
|
+
for (let link = tail; link; link = link.prevDep) {
|
|
610
|
+
if (link.version === -1) {
|
|
611
|
+
if (link === tail)
|
|
612
|
+
tail = link.prevDep;
|
|
613
|
+
removeSub(link);
|
|
614
|
+
removeDep(link);
|
|
615
|
+
} else {
|
|
616
|
+
head = link;
|
|
617
|
+
}
|
|
618
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
619
|
+
link.prevActiveLink = void 0;
|
|
620
|
+
}
|
|
621
|
+
sub.deps = head;
|
|
622
|
+
sub.depsTail = tail;
|
|
555
623
|
}
|
|
556
|
-
function
|
|
557
|
-
|
|
558
|
-
|
|
624
|
+
function isDirty(sub) {
|
|
625
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
626
|
+
if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
|
|
627
|
+
return true;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
if (sub._dirty) {
|
|
631
|
+
return true;
|
|
632
|
+
}
|
|
633
|
+
return false;
|
|
559
634
|
}
|
|
560
|
-
function
|
|
561
|
-
if (
|
|
562
|
-
|
|
563
|
-
|
|
635
|
+
function refreshComputed(computed) {
|
|
636
|
+
if (computed.flags & 2) {
|
|
637
|
+
return false;
|
|
638
|
+
}
|
|
639
|
+
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
computed.flags &= ~16;
|
|
643
|
+
if (computed.globalVersion === globalVersion) {
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
computed.globalVersion = globalVersion;
|
|
647
|
+
const dep = computed.dep;
|
|
648
|
+
computed.flags |= 2;
|
|
649
|
+
if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
|
|
650
|
+
computed.flags &= ~2;
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
const prevSub = activeSub;
|
|
654
|
+
const prevShouldTrack = shouldTrack;
|
|
655
|
+
activeSub = computed;
|
|
656
|
+
shouldTrack = true;
|
|
657
|
+
try {
|
|
658
|
+
prepareDeps(computed);
|
|
659
|
+
const value = computed.fn();
|
|
660
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
661
|
+
computed._value = value;
|
|
662
|
+
dep.version++;
|
|
564
663
|
}
|
|
565
|
-
|
|
664
|
+
} catch (err) {
|
|
665
|
+
dep.version++;
|
|
666
|
+
throw err;
|
|
667
|
+
} finally {
|
|
668
|
+
activeSub = prevSub;
|
|
669
|
+
shouldTrack = prevShouldTrack;
|
|
670
|
+
cleanupDeps(computed);
|
|
671
|
+
computed.flags &= ~2;
|
|
566
672
|
}
|
|
567
673
|
}
|
|
568
|
-
function
|
|
569
|
-
const
|
|
570
|
-
if (
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
674
|
+
function removeSub(link) {
|
|
675
|
+
const { dep, prevSub, nextSub } = link;
|
|
676
|
+
if (prevSub) {
|
|
677
|
+
prevSub.nextSub = nextSub;
|
|
678
|
+
link.prevSub = void 0;
|
|
679
|
+
}
|
|
680
|
+
if (nextSub) {
|
|
681
|
+
nextSub.prevSub = prevSub;
|
|
682
|
+
link.nextSub = void 0;
|
|
683
|
+
}
|
|
684
|
+
if (dep.subs === link) {
|
|
685
|
+
dep.subs = prevSub;
|
|
686
|
+
}
|
|
687
|
+
if (!dep.subs && dep.computed) {
|
|
688
|
+
dep.computed.flags &= ~4;
|
|
689
|
+
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
690
|
+
removeSub(l);
|
|
574
691
|
}
|
|
575
692
|
}
|
|
576
693
|
}
|
|
694
|
+
function removeDep(link) {
|
|
695
|
+
const { prevDep, nextDep } = link;
|
|
696
|
+
if (prevDep) {
|
|
697
|
+
prevDep.nextDep = nextDep;
|
|
698
|
+
link.prevDep = void 0;
|
|
699
|
+
}
|
|
700
|
+
if (nextDep) {
|
|
701
|
+
nextDep.prevDep = prevDep;
|
|
702
|
+
link.nextDep = void 0;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
577
705
|
function effect(fn, options) {
|
|
578
706
|
if (fn.effect instanceof ReactiveEffect) {
|
|
579
707
|
fn = fn.effect.fn;
|
|
580
708
|
}
|
|
581
|
-
const
|
|
582
|
-
if (_effect.dirty) {
|
|
583
|
-
_effect.run();
|
|
584
|
-
}
|
|
585
|
-
});
|
|
709
|
+
const e = new ReactiveEffect(fn);
|
|
586
710
|
if (options) {
|
|
587
|
-
extend(
|
|
588
|
-
if (options.scope)
|
|
589
|
-
recordEffectScope(_effect, options.scope);
|
|
711
|
+
extend(e, options);
|
|
590
712
|
}
|
|
591
|
-
|
|
592
|
-
|
|
713
|
+
try {
|
|
714
|
+
e.run();
|
|
715
|
+
} catch (err) {
|
|
716
|
+
e.stop();
|
|
717
|
+
throw err;
|
|
593
718
|
}
|
|
594
|
-
const runner =
|
|
595
|
-
runner.effect =
|
|
719
|
+
const runner = e.run.bind(e);
|
|
720
|
+
runner.effect = e;
|
|
596
721
|
return runner;
|
|
597
722
|
}
|
|
598
723
|
function stop(runner) {
|
|
599
724
|
runner.effect.stop();
|
|
600
725
|
}
|
|
601
726
|
let shouldTrack = true;
|
|
602
|
-
let pauseScheduleStack = 0;
|
|
603
727
|
const trackStack = [];
|
|
604
728
|
function pauseTracking() {
|
|
605
729
|
trackStack.push(shouldTrack);
|
|
@@ -609,192 +733,414 @@ function resetTracking() {
|
|
|
609
733
|
const last = trackStack.pop();
|
|
610
734
|
shouldTrack = last === void 0 ? true : last;
|
|
611
735
|
}
|
|
612
|
-
function
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
736
|
+
function cleanupEffect(e) {
|
|
737
|
+
const { cleanup } = e;
|
|
738
|
+
e.cleanup = void 0;
|
|
739
|
+
if (cleanup) {
|
|
740
|
+
const prevSub = activeSub;
|
|
741
|
+
activeSub = void 0;
|
|
742
|
+
try {
|
|
743
|
+
cleanup();
|
|
744
|
+
} finally {
|
|
745
|
+
activeSub = prevSub;
|
|
746
|
+
}
|
|
619
747
|
}
|
|
620
748
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
749
|
+
|
|
750
|
+
let globalVersion = 0;
|
|
751
|
+
class Dep {
|
|
752
|
+
constructor(computed) {
|
|
753
|
+
this.computed = computed;
|
|
754
|
+
this.version = 0;
|
|
755
|
+
/**
|
|
756
|
+
* Link between this dep and the current active effect
|
|
757
|
+
*/
|
|
758
|
+
this.activeLink = void 0;
|
|
759
|
+
/**
|
|
760
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
761
|
+
*/
|
|
762
|
+
this.subs = void 0;
|
|
634
763
|
{
|
|
635
|
-
|
|
764
|
+
this.subsHead = void 0;
|
|
636
765
|
}
|
|
637
766
|
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
767
|
+
track(debugInfo) {
|
|
768
|
+
if (!activeSub || !shouldTrack) {
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
let link = this.activeLink;
|
|
772
|
+
if (link === void 0 || link.sub !== activeSub) {
|
|
773
|
+
link = this.activeLink = {
|
|
774
|
+
dep: this,
|
|
775
|
+
sub: activeSub,
|
|
776
|
+
version: this.version,
|
|
777
|
+
nextDep: void 0,
|
|
778
|
+
prevDep: void 0,
|
|
779
|
+
nextSub: void 0,
|
|
780
|
+
prevSub: void 0,
|
|
781
|
+
prevActiveLink: void 0
|
|
782
|
+
};
|
|
783
|
+
if (!activeSub.deps) {
|
|
784
|
+
activeSub.deps = activeSub.depsTail = link;
|
|
785
|
+
} else {
|
|
786
|
+
link.prevDep = activeSub.depsTail;
|
|
787
|
+
activeSub.depsTail.nextDep = link;
|
|
788
|
+
activeSub.depsTail = link;
|
|
652
789
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
790
|
+
if (activeSub.flags & 4) {
|
|
791
|
+
addSub(link);
|
|
792
|
+
}
|
|
793
|
+
} else if (link.version === -1) {
|
|
794
|
+
link.version = this.version;
|
|
795
|
+
if (link.nextDep) {
|
|
796
|
+
const next = link.nextDep;
|
|
797
|
+
next.prevDep = link.prevDep;
|
|
798
|
+
if (link.prevDep) {
|
|
799
|
+
link.prevDep.nextDep = next;
|
|
800
|
+
}
|
|
801
|
+
link.prevDep = activeSub.depsTail;
|
|
802
|
+
link.nextDep = void 0;
|
|
803
|
+
activeSub.depsTail.nextDep = link;
|
|
804
|
+
activeSub.depsTail = link;
|
|
805
|
+
if (activeSub.deps === link) {
|
|
806
|
+
activeSub.deps = next;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
if (activeSub.onTrack) {
|
|
811
|
+
activeSub.onTrack(
|
|
812
|
+
extend(
|
|
813
|
+
{
|
|
814
|
+
effect: activeSub
|
|
815
|
+
},
|
|
816
|
+
debugInfo
|
|
817
|
+
)
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
return link;
|
|
821
|
+
}
|
|
822
|
+
trigger(debugInfo) {
|
|
823
|
+
this.version++;
|
|
824
|
+
globalVersion++;
|
|
825
|
+
this.notify(debugInfo);
|
|
826
|
+
}
|
|
827
|
+
notify(debugInfo) {
|
|
828
|
+
startBatch();
|
|
829
|
+
try {
|
|
830
|
+
if (true) {
|
|
831
|
+
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
832
|
+
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
833
|
+
head.sub.onTrigger(
|
|
834
|
+
extend(
|
|
835
|
+
{
|
|
836
|
+
effect: head.sub
|
|
837
|
+
},
|
|
838
|
+
debugInfo
|
|
839
|
+
)
|
|
840
|
+
);
|
|
841
|
+
}
|
|
658
842
|
}
|
|
659
843
|
}
|
|
844
|
+
for (let link = this.subs; link; link = link.prevSub) {
|
|
845
|
+
link.sub.notify();
|
|
846
|
+
}
|
|
847
|
+
} finally {
|
|
848
|
+
endBatch();
|
|
660
849
|
}
|
|
661
850
|
}
|
|
662
|
-
resetScheduling();
|
|
663
851
|
}
|
|
664
|
-
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
}
|
|
671
|
-
|
|
852
|
+
function addSub(link) {
|
|
853
|
+
const computed = link.dep.computed;
|
|
854
|
+
if (computed && !link.dep.subs) {
|
|
855
|
+
computed.flags |= 4 | 16;
|
|
856
|
+
for (let l = computed.deps; l; l = l.nextDep) {
|
|
857
|
+
addSub(l);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
const currentTail = link.dep.subs;
|
|
861
|
+
if (currentTail !== link) {
|
|
862
|
+
link.prevSub = currentTail;
|
|
863
|
+
if (currentTail)
|
|
864
|
+
currentTail.nextSub = link;
|
|
865
|
+
}
|
|
866
|
+
if (link.dep.subsHead === void 0) {
|
|
867
|
+
link.dep.subsHead = link;
|
|
868
|
+
}
|
|
869
|
+
link.dep.subs = link;
|
|
870
|
+
}
|
|
672
871
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
673
|
-
const ITERATE_KEY = Symbol("iterate" );
|
|
674
|
-
const MAP_KEY_ITERATE_KEY = Symbol("Map
|
|
872
|
+
const ITERATE_KEY = Symbol("Object iterate" );
|
|
873
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
|
|
874
|
+
const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
|
|
675
875
|
function track(target, type, key) {
|
|
676
|
-
if (shouldTrack &&
|
|
876
|
+
if (shouldTrack && activeSub) {
|
|
677
877
|
let depsMap = targetMap.get(target);
|
|
678
878
|
if (!depsMap) {
|
|
679
879
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
680
880
|
}
|
|
681
881
|
let dep = depsMap.get(key);
|
|
682
882
|
if (!dep) {
|
|
683
|
-
depsMap.set(key, dep =
|
|
883
|
+
depsMap.set(key, dep = new Dep());
|
|
684
884
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
dep,
|
|
688
|
-
{
|
|
885
|
+
{
|
|
886
|
+
dep.track({
|
|
689
887
|
target,
|
|
690
888
|
type,
|
|
691
889
|
key
|
|
692
|
-
}
|
|
693
|
-
|
|
890
|
+
});
|
|
891
|
+
}
|
|
694
892
|
}
|
|
695
893
|
}
|
|
696
894
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
697
895
|
const depsMap = targetMap.get(target);
|
|
698
896
|
if (!depsMap) {
|
|
897
|
+
globalVersion++;
|
|
699
898
|
return;
|
|
700
899
|
}
|
|
701
900
|
let deps = [];
|
|
702
901
|
if (type === "clear") {
|
|
703
902
|
deps = [...depsMap.values()];
|
|
704
|
-
} else if (key === "length" && isArray(target)) {
|
|
705
|
-
const newLength = Number(newValue);
|
|
706
|
-
depsMap.forEach((dep, key2) => {
|
|
707
|
-
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
|
|
708
|
-
deps.push(dep);
|
|
709
|
-
}
|
|
710
|
-
});
|
|
711
903
|
} else {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
if (!
|
|
718
|
-
deps.push(
|
|
719
|
-
if (isMap(target)) {
|
|
720
|
-
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
721
|
-
}
|
|
722
|
-
} else if (isIntegerKey(key)) {
|
|
723
|
-
deps.push(depsMap.get("length"));
|
|
904
|
+
const targetIsArray = isArray(target);
|
|
905
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
906
|
+
if (targetIsArray && key === "length") {
|
|
907
|
+
const newLength = Number(newValue);
|
|
908
|
+
depsMap.forEach((dep, key2) => {
|
|
909
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
910
|
+
deps.push(dep);
|
|
724
911
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
912
|
+
});
|
|
913
|
+
} else {
|
|
914
|
+
const push = (dep) => dep && deps.push(dep);
|
|
915
|
+
if (key !== void 0) {
|
|
916
|
+
push(depsMap.get(key));
|
|
917
|
+
}
|
|
918
|
+
if (isArrayIndex) {
|
|
919
|
+
push(depsMap.get(ARRAY_ITERATE_KEY));
|
|
920
|
+
}
|
|
921
|
+
switch (type) {
|
|
922
|
+
case "add":
|
|
923
|
+
if (!targetIsArray) {
|
|
924
|
+
push(depsMap.get(ITERATE_KEY));
|
|
925
|
+
if (isMap(target)) {
|
|
926
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
927
|
+
}
|
|
928
|
+
} else if (isArrayIndex) {
|
|
929
|
+
push(depsMap.get("length"));
|
|
930
|
+
}
|
|
931
|
+
break;
|
|
932
|
+
case "delete":
|
|
933
|
+
if (!targetIsArray) {
|
|
934
|
+
push(depsMap.get(ITERATE_KEY));
|
|
935
|
+
if (isMap(target)) {
|
|
936
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
break;
|
|
940
|
+
case "set":
|
|
729
941
|
if (isMap(target)) {
|
|
730
|
-
|
|
942
|
+
push(depsMap.get(ITERATE_KEY));
|
|
731
943
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
case "set":
|
|
735
|
-
if (isMap(target)) {
|
|
736
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
737
|
-
}
|
|
738
|
-
break;
|
|
944
|
+
break;
|
|
945
|
+
}
|
|
739
946
|
}
|
|
740
947
|
}
|
|
741
|
-
|
|
948
|
+
startBatch();
|
|
742
949
|
for (const dep of deps) {
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
oldValue,
|
|
753
|
-
oldTarget
|
|
754
|
-
}
|
|
755
|
-
);
|
|
950
|
+
{
|
|
951
|
+
dep.trigger({
|
|
952
|
+
target,
|
|
953
|
+
type,
|
|
954
|
+
key,
|
|
955
|
+
newValue,
|
|
956
|
+
oldValue,
|
|
957
|
+
oldTarget
|
|
958
|
+
});
|
|
756
959
|
}
|
|
757
960
|
}
|
|
758
|
-
|
|
961
|
+
endBatch();
|
|
759
962
|
}
|
|
760
963
|
function getDepFromReactive(object, key) {
|
|
761
|
-
|
|
762
|
-
return
|
|
964
|
+
var _a;
|
|
965
|
+
return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
function reactiveReadArray(array) {
|
|
969
|
+
const raw = toRaw(array);
|
|
970
|
+
if (raw === array)
|
|
971
|
+
return raw;
|
|
972
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
973
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
974
|
+
}
|
|
975
|
+
function shallowReadArray(arr) {
|
|
976
|
+
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
977
|
+
return arr;
|
|
978
|
+
}
|
|
979
|
+
const arrayInstrumentations = {
|
|
980
|
+
__proto__: null,
|
|
981
|
+
[Symbol.iterator]() {
|
|
982
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
983
|
+
},
|
|
984
|
+
concat(...args) {
|
|
985
|
+
return reactiveReadArray(this).concat(
|
|
986
|
+
...args.map((x) => reactiveReadArray(x))
|
|
987
|
+
);
|
|
988
|
+
},
|
|
989
|
+
entries() {
|
|
990
|
+
return iterator(this, "entries", (value) => {
|
|
991
|
+
value[1] = toReactive(value[1]);
|
|
992
|
+
return value;
|
|
993
|
+
});
|
|
994
|
+
},
|
|
995
|
+
every(fn, thisArg) {
|
|
996
|
+
return apply(this, "every", fn, thisArg);
|
|
997
|
+
},
|
|
998
|
+
filter(fn, thisArg) {
|
|
999
|
+
const result = apply(this, "filter", fn, thisArg);
|
|
1000
|
+
return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
|
|
1001
|
+
},
|
|
1002
|
+
find(fn, thisArg) {
|
|
1003
|
+
const result = apply(this, "find", fn, thisArg);
|
|
1004
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
1005
|
+
},
|
|
1006
|
+
findIndex(fn, thisArg) {
|
|
1007
|
+
return apply(this, "findIndex", fn, thisArg);
|
|
1008
|
+
},
|
|
1009
|
+
findLast(fn, thisArg) {
|
|
1010
|
+
const result = apply(this, "findLast", fn, thisArg);
|
|
1011
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
1012
|
+
},
|
|
1013
|
+
findLastIndex(fn, thisArg) {
|
|
1014
|
+
return apply(this, "findLastIndex", fn, thisArg);
|
|
1015
|
+
},
|
|
1016
|
+
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
1017
|
+
forEach(fn, thisArg) {
|
|
1018
|
+
return apply(this, "forEach", fn, thisArg);
|
|
1019
|
+
},
|
|
1020
|
+
includes(...args) {
|
|
1021
|
+
return searchProxy(this, "includes", args);
|
|
1022
|
+
},
|
|
1023
|
+
indexOf(...args) {
|
|
1024
|
+
return searchProxy(this, "indexOf", args);
|
|
1025
|
+
},
|
|
1026
|
+
join(separator) {
|
|
1027
|
+
return reactiveReadArray(this).join(separator);
|
|
1028
|
+
},
|
|
1029
|
+
// keys() iterator only reads `length`, no optimisation required
|
|
1030
|
+
lastIndexOf(...args) {
|
|
1031
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
1032
|
+
},
|
|
1033
|
+
map(fn, thisArg) {
|
|
1034
|
+
return apply(this, "map", fn, thisArg);
|
|
1035
|
+
},
|
|
1036
|
+
pop() {
|
|
1037
|
+
return noTracking(this, "pop");
|
|
1038
|
+
},
|
|
1039
|
+
push(...args) {
|
|
1040
|
+
return noTracking(this, "push", args);
|
|
1041
|
+
},
|
|
1042
|
+
reduce(fn, ...args) {
|
|
1043
|
+
return reduce(this, "reduce", fn, args);
|
|
1044
|
+
},
|
|
1045
|
+
reduceRight(fn, ...args) {
|
|
1046
|
+
return reduce(this, "reduceRight", fn, args);
|
|
1047
|
+
},
|
|
1048
|
+
shift() {
|
|
1049
|
+
return noTracking(this, "shift");
|
|
1050
|
+
},
|
|
1051
|
+
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
1052
|
+
some(fn, thisArg) {
|
|
1053
|
+
return apply(this, "some", fn, thisArg);
|
|
1054
|
+
},
|
|
1055
|
+
splice(...args) {
|
|
1056
|
+
return noTracking(this, "splice", args);
|
|
1057
|
+
},
|
|
1058
|
+
toReversed() {
|
|
1059
|
+
return reactiveReadArray(this).toReversed();
|
|
1060
|
+
},
|
|
1061
|
+
toSorted(comparer) {
|
|
1062
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
1063
|
+
},
|
|
1064
|
+
toSpliced(...args) {
|
|
1065
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
1066
|
+
},
|
|
1067
|
+
unshift(...args) {
|
|
1068
|
+
return noTracking(this, "unshift", args);
|
|
1069
|
+
},
|
|
1070
|
+
values() {
|
|
1071
|
+
return iterator(this, "values", toReactive);
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
function iterator(self, method, wrapValue) {
|
|
1075
|
+
const arr = shallowReadArray(self);
|
|
1076
|
+
const iter = arr[method]();
|
|
1077
|
+
if (arr !== self && !isShallow(self)) {
|
|
1078
|
+
iter._next = iter.next;
|
|
1079
|
+
iter.next = () => {
|
|
1080
|
+
const result = iter._next();
|
|
1081
|
+
if (result.value) {
|
|
1082
|
+
result.value = wrapValue(result.value);
|
|
1083
|
+
}
|
|
1084
|
+
return result;
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
return iter;
|
|
1088
|
+
}
|
|
1089
|
+
function apply(self, method, fn, thisArg) {
|
|
1090
|
+
const arr = shallowReadArray(self);
|
|
1091
|
+
let wrappedFn = fn;
|
|
1092
|
+
if (arr !== self) {
|
|
1093
|
+
if (!isShallow(self)) {
|
|
1094
|
+
wrappedFn = function(item, index) {
|
|
1095
|
+
return fn.call(this, toReactive(item), index, self);
|
|
1096
|
+
};
|
|
1097
|
+
} else if (fn.length > 2) {
|
|
1098
|
+
wrappedFn = function(item, index) {
|
|
1099
|
+
return fn.call(this, item, index, self);
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
return arr[method](wrappedFn, thisArg);
|
|
1104
|
+
}
|
|
1105
|
+
function reduce(self, method, fn, args) {
|
|
1106
|
+
const arr = shallowReadArray(self);
|
|
1107
|
+
let wrappedFn = fn;
|
|
1108
|
+
if (arr !== self) {
|
|
1109
|
+
if (!isShallow(self)) {
|
|
1110
|
+
wrappedFn = function(acc, item, index) {
|
|
1111
|
+
return fn.call(this, acc, toReactive(item), index, self);
|
|
1112
|
+
};
|
|
1113
|
+
} else if (fn.length > 3) {
|
|
1114
|
+
wrappedFn = function(acc, item, index) {
|
|
1115
|
+
return fn.call(this, acc, item, index, self);
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
return arr[method](wrappedFn, ...args);
|
|
1120
|
+
}
|
|
1121
|
+
function searchProxy(self, method, args) {
|
|
1122
|
+
const arr = toRaw(self);
|
|
1123
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
1124
|
+
const res = arr[method](...args);
|
|
1125
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1126
|
+
args[0] = toRaw(args[0]);
|
|
1127
|
+
return arr[method](...args);
|
|
1128
|
+
}
|
|
1129
|
+
return res;
|
|
1130
|
+
}
|
|
1131
|
+
function noTracking(self, method, args = []) {
|
|
1132
|
+
pauseTracking();
|
|
1133
|
+
startBatch();
|
|
1134
|
+
const res = toRaw(self)[method].apply(self, args);
|
|
1135
|
+
endBatch();
|
|
1136
|
+
resetTracking();
|
|
1137
|
+
return res;
|
|
763
1138
|
}
|
|
764
1139
|
|
|
765
1140
|
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
766
1141
|
const builtInSymbols = new Set(
|
|
767
1142
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
768
1143
|
);
|
|
769
|
-
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
770
|
-
function createArrayInstrumentations() {
|
|
771
|
-
const instrumentations = {};
|
|
772
|
-
["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
|
773
|
-
instrumentations[key] = function(...args) {
|
|
774
|
-
const arr = toRaw(this);
|
|
775
|
-
for (let i = 0, l = this.length; i < l; i++) {
|
|
776
|
-
track(arr, "get", i + "");
|
|
777
|
-
}
|
|
778
|
-
const res = arr[key](...args);
|
|
779
|
-
if (res === -1 || res === false) {
|
|
780
|
-
return arr[key](...args.map(toRaw));
|
|
781
|
-
} else {
|
|
782
|
-
return res;
|
|
783
|
-
}
|
|
784
|
-
};
|
|
785
|
-
});
|
|
786
|
-
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
787
|
-
instrumentations[key] = function(...args) {
|
|
788
|
-
pauseTracking();
|
|
789
|
-
pauseScheduling();
|
|
790
|
-
const res = toRaw(this)[key].apply(this, args);
|
|
791
|
-
resetScheduling();
|
|
792
|
-
resetTracking();
|
|
793
|
-
return res;
|
|
794
|
-
};
|
|
795
|
-
});
|
|
796
|
-
return instrumentations;
|
|
797
|
-
}
|
|
798
1144
|
function hasOwnProperty(key) {
|
|
799
1145
|
if (!isSymbol(key))
|
|
800
1146
|
key = String(key);
|
|
@@ -825,14 +1171,22 @@ class BaseReactiveHandler {
|
|
|
825
1171
|
}
|
|
826
1172
|
const targetIsArray = isArray(target);
|
|
827
1173
|
if (!isReadonly2) {
|
|
828
|
-
|
|
829
|
-
|
|
1174
|
+
let fn;
|
|
1175
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1176
|
+
return fn;
|
|
830
1177
|
}
|
|
831
1178
|
if (key === "hasOwnProperty") {
|
|
832
1179
|
return hasOwnProperty;
|
|
833
1180
|
}
|
|
834
1181
|
}
|
|
835
|
-
const res = Reflect.get(
|
|
1182
|
+
const res = Reflect.get(
|
|
1183
|
+
target,
|
|
1184
|
+
key,
|
|
1185
|
+
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1186
|
+
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1187
|
+
// its class methods
|
|
1188
|
+
isRef(target) ? target : receiver
|
|
1189
|
+
);
|
|
836
1190
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
837
1191
|
return res;
|
|
838
1192
|
}
|
|
@@ -1331,110 +1685,8 @@ function markRaw(value) {
|
|
|
1331
1685
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1332
1686
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1333
1687
|
|
|
1334
|
-
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`;
|
|
1335
|
-
class ComputedRefImpl {
|
|
1336
|
-
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1337
|
-
this.getter = getter;
|
|
1338
|
-
this._setter = _setter;
|
|
1339
|
-
this.dep = void 0;
|
|
1340
|
-
this.__v_isRef = true;
|
|
1341
|
-
this["__v_isReadonly"] = false;
|
|
1342
|
-
this.effect = new ReactiveEffect(
|
|
1343
|
-
() => getter(this._value),
|
|
1344
|
-
() => triggerRefValue(
|
|
1345
|
-
this,
|
|
1346
|
-
this.effect._dirtyLevel === 2 ? 2 : 3
|
|
1347
|
-
)
|
|
1348
|
-
);
|
|
1349
|
-
this.effect.computed = this;
|
|
1350
|
-
this.effect.active = this._cacheable = !isSSR;
|
|
1351
|
-
this["__v_isReadonly"] = isReadonly;
|
|
1352
|
-
}
|
|
1353
|
-
get value() {
|
|
1354
|
-
const self = toRaw(this);
|
|
1355
|
-
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
|
|
1356
|
-
triggerRefValue(self, 4);
|
|
1357
|
-
}
|
|
1358
|
-
trackRefValue(self);
|
|
1359
|
-
if (self.effect._dirtyLevel >= 2) {
|
|
1360
|
-
if (this._warnRecursive) {
|
|
1361
|
-
warn$2(COMPUTED_SIDE_EFFECT_WARN, `
|
|
1362
|
-
|
|
1363
|
-
getter: `, this.getter);
|
|
1364
|
-
}
|
|
1365
|
-
triggerRefValue(self, 2);
|
|
1366
|
-
}
|
|
1367
|
-
return self._value;
|
|
1368
|
-
}
|
|
1369
|
-
set value(newValue) {
|
|
1370
|
-
this._setter(newValue);
|
|
1371
|
-
}
|
|
1372
|
-
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1373
|
-
get _dirty() {
|
|
1374
|
-
return this.effect.dirty;
|
|
1375
|
-
}
|
|
1376
|
-
set _dirty(v) {
|
|
1377
|
-
this.effect.dirty = v;
|
|
1378
|
-
}
|
|
1379
|
-
// #endregion
|
|
1380
|
-
}
|
|
1381
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1382
|
-
let getter;
|
|
1383
|
-
let setter;
|
|
1384
|
-
const onlyGetter = isFunction(getterOrOptions);
|
|
1385
|
-
if (onlyGetter) {
|
|
1386
|
-
getter = getterOrOptions;
|
|
1387
|
-
setter = () => {
|
|
1388
|
-
warn$2("Write operation failed: computed value is readonly");
|
|
1389
|
-
} ;
|
|
1390
|
-
} else {
|
|
1391
|
-
getter = getterOrOptions.get;
|
|
1392
|
-
setter = getterOrOptions.set;
|
|
1393
|
-
}
|
|
1394
|
-
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1395
|
-
if (debugOptions && !isSSR) {
|
|
1396
|
-
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1397
|
-
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1398
|
-
}
|
|
1399
|
-
return cRef;
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
function trackRefValue(ref2) {
|
|
1403
|
-
var _a;
|
|
1404
|
-
if (shouldTrack && activeEffect) {
|
|
1405
|
-
ref2 = toRaw(ref2);
|
|
1406
|
-
trackEffect(
|
|
1407
|
-
activeEffect,
|
|
1408
|
-
(_a = ref2.dep) != null ? _a : ref2.dep = createDep(
|
|
1409
|
-
() => ref2.dep = void 0,
|
|
1410
|
-
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1411
|
-
),
|
|
1412
|
-
{
|
|
1413
|
-
target: ref2,
|
|
1414
|
-
type: "get",
|
|
1415
|
-
key: "value"
|
|
1416
|
-
}
|
|
1417
|
-
);
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
|
|
1421
|
-
ref2 = toRaw(ref2);
|
|
1422
|
-
const dep = ref2.dep;
|
|
1423
|
-
if (dep) {
|
|
1424
|
-
triggerEffects(
|
|
1425
|
-
dep,
|
|
1426
|
-
dirtyLevel,
|
|
1427
|
-
{
|
|
1428
|
-
target: ref2,
|
|
1429
|
-
type: "set",
|
|
1430
|
-
key: "value",
|
|
1431
|
-
newValue: newVal
|
|
1432
|
-
}
|
|
1433
|
-
);
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
1688
|
function isRef(r) {
|
|
1437
|
-
return
|
|
1689
|
+
return r ? r.__v_isRef === true : false;
|
|
1438
1690
|
}
|
|
1439
1691
|
function ref(value) {
|
|
1440
1692
|
return createRef(value, false);
|
|
@@ -1451,27 +1703,49 @@ function createRef(rawValue, shallow) {
|
|
|
1451
1703
|
class RefImpl {
|
|
1452
1704
|
constructor(value, __v_isShallow) {
|
|
1453
1705
|
this.__v_isShallow = __v_isShallow;
|
|
1454
|
-
this.dep =
|
|
1706
|
+
this.dep = new Dep();
|
|
1455
1707
|
this.__v_isRef = true;
|
|
1456
1708
|
this._rawValue = __v_isShallow ? value : toRaw(value);
|
|
1457
1709
|
this._value = __v_isShallow ? value : toReactive(value);
|
|
1458
1710
|
}
|
|
1459
1711
|
get value() {
|
|
1460
|
-
|
|
1712
|
+
{
|
|
1713
|
+
this.dep.track({
|
|
1714
|
+
target: this,
|
|
1715
|
+
type: "get",
|
|
1716
|
+
key: "value"
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1461
1719
|
return this._value;
|
|
1462
1720
|
}
|
|
1463
|
-
set value(
|
|
1464
|
-
const
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
this.
|
|
1469
|
-
|
|
1721
|
+
set value(newValue) {
|
|
1722
|
+
const oldValue = this._rawValue;
|
|
1723
|
+
const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
|
|
1724
|
+
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1725
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1726
|
+
this._rawValue = newValue;
|
|
1727
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1728
|
+
{
|
|
1729
|
+
this.dep.trigger({
|
|
1730
|
+
target: this,
|
|
1731
|
+
type: "set",
|
|
1732
|
+
key: "value",
|
|
1733
|
+
newValue,
|
|
1734
|
+
oldValue
|
|
1735
|
+
});
|
|
1736
|
+
}
|
|
1470
1737
|
}
|
|
1471
1738
|
}
|
|
1472
1739
|
}
|
|
1473
1740
|
function triggerRef(ref2) {
|
|
1474
|
-
|
|
1741
|
+
{
|
|
1742
|
+
ref2.dep.trigger({
|
|
1743
|
+
target: ref2,
|
|
1744
|
+
type: "set",
|
|
1745
|
+
key: "value",
|
|
1746
|
+
newValue: ref2._value
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1475
1749
|
}
|
|
1476
1750
|
function unref(ref2) {
|
|
1477
1751
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1496,12 +1770,9 @@ function proxyRefs(objectWithRefs) {
|
|
|
1496
1770
|
}
|
|
1497
1771
|
class CustomRefImpl {
|
|
1498
1772
|
constructor(factory) {
|
|
1499
|
-
this.dep = void 0;
|
|
1500
1773
|
this.__v_isRef = true;
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1503
|
-
() => triggerRefValue(this)
|
|
1504
|
-
);
|
|
1774
|
+
const dep = this.dep = new Dep();
|
|
1775
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1505
1776
|
this._get = get;
|
|
1506
1777
|
this._set = set;
|
|
1507
1778
|
}
|
|
@@ -1569,6 +1840,90 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1569
1840
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1570
1841
|
}
|
|
1571
1842
|
|
|
1843
|
+
class ComputedRefImpl {
|
|
1844
|
+
constructor(fn, setter, isSSR) {
|
|
1845
|
+
this.fn = fn;
|
|
1846
|
+
this.setter = setter;
|
|
1847
|
+
/**
|
|
1848
|
+
* @internal
|
|
1849
|
+
*/
|
|
1850
|
+
this._value = void 0;
|
|
1851
|
+
/**
|
|
1852
|
+
* @internal
|
|
1853
|
+
*/
|
|
1854
|
+
this.dep = new Dep(this);
|
|
1855
|
+
/**
|
|
1856
|
+
* @internal
|
|
1857
|
+
*/
|
|
1858
|
+
this.__v_isRef = true;
|
|
1859
|
+
// A computed is also a subscriber that tracks other deps
|
|
1860
|
+
/**
|
|
1861
|
+
* @internal
|
|
1862
|
+
*/
|
|
1863
|
+
this.deps = void 0;
|
|
1864
|
+
/**
|
|
1865
|
+
* @internal
|
|
1866
|
+
*/
|
|
1867
|
+
this.depsTail = void 0;
|
|
1868
|
+
/**
|
|
1869
|
+
* @internal
|
|
1870
|
+
*/
|
|
1871
|
+
this.flags = 16;
|
|
1872
|
+
/**
|
|
1873
|
+
* @internal
|
|
1874
|
+
*/
|
|
1875
|
+
this.globalVersion = globalVersion - 1;
|
|
1876
|
+
// for backwards compat
|
|
1877
|
+
this.effect = this;
|
|
1878
|
+
this.__v_isReadonly = !setter;
|
|
1879
|
+
this.isSSR = isSSR;
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* @internal
|
|
1883
|
+
*/
|
|
1884
|
+
notify() {
|
|
1885
|
+
if (activeSub !== this) {
|
|
1886
|
+
this.flags |= 16;
|
|
1887
|
+
this.dep.notify();
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
get value() {
|
|
1891
|
+
const link = this.dep.track({
|
|
1892
|
+
target: this,
|
|
1893
|
+
type: "get",
|
|
1894
|
+
key: "value"
|
|
1895
|
+
}) ;
|
|
1896
|
+
refreshComputed(this);
|
|
1897
|
+
if (link) {
|
|
1898
|
+
link.version = this.dep.version;
|
|
1899
|
+
}
|
|
1900
|
+
return this._value;
|
|
1901
|
+
}
|
|
1902
|
+
set value(newValue) {
|
|
1903
|
+
if (this.setter) {
|
|
1904
|
+
this.setter(newValue);
|
|
1905
|
+
} else {
|
|
1906
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1911
|
+
let getter;
|
|
1912
|
+
let setter;
|
|
1913
|
+
if (isFunction(getterOrOptions)) {
|
|
1914
|
+
getter = getterOrOptions;
|
|
1915
|
+
} else {
|
|
1916
|
+
getter = getterOrOptions.get;
|
|
1917
|
+
setter = getterOrOptions.set;
|
|
1918
|
+
}
|
|
1919
|
+
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1920
|
+
if (debugOptions && !isSSR) {
|
|
1921
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1922
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1923
|
+
}
|
|
1924
|
+
return cRef;
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1572
1927
|
const TrackOpTypes = {
|
|
1573
1928
|
"GET": "get",
|
|
1574
1929
|
"HAS": "has",
|
|
@@ -1728,7 +2083,9 @@ const ErrorCodes = {
|
|
|
1728
2083
|
"ASYNC_COMPONENT_LOADER": 13,
|
|
1729
2084
|
"13": "ASYNC_COMPONENT_LOADER",
|
|
1730
2085
|
"SCHEDULER": 14,
|
|
1731
|
-
"14": "SCHEDULER"
|
|
2086
|
+
"14": "SCHEDULER",
|
|
2087
|
+
"APP_UNMOUNT_CLEANUP": 15,
|
|
2088
|
+
"15": "APP_UNMOUNT_CLEANUP"
|
|
1732
2089
|
};
|
|
1733
2090
|
const ErrorTypeStrings$1 = {
|
|
1734
2091
|
["sp"]: "serverPrefetch hook",
|
|
@@ -1759,7 +2116,8 @@ const ErrorTypeStrings$1 = {
|
|
|
1759
2116
|
[11]: "app warnHandler",
|
|
1760
2117
|
[12]: "ref function",
|
|
1761
2118
|
[13]: "async component loader",
|
|
1762
|
-
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
2119
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core .",
|
|
2120
|
+
[15]: "app unmount cleanup function"
|
|
1763
2121
|
};
|
|
1764
2122
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
1765
2123
|
try {
|
|
@@ -1861,7 +2219,7 @@ function findInsertionIndex(id) {
|
|
|
1861
2219
|
const middle = start + end >>> 1;
|
|
1862
2220
|
const middleJob = queue[middle];
|
|
1863
2221
|
const middleJobId = getId(middleJob);
|
|
1864
|
-
if (middleJobId < id || middleJobId === id && middleJob.
|
|
2222
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1865
2223
|
start = middle + 1;
|
|
1866
2224
|
} else {
|
|
1867
2225
|
end = middle;
|
|
@@ -1870,15 +2228,21 @@ function findInsertionIndex(id) {
|
|
|
1870
2228
|
return start;
|
|
1871
2229
|
}
|
|
1872
2230
|
function queueJob(job) {
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1876
|
-
)) {
|
|
2231
|
+
var _a;
|
|
2232
|
+
if (!(job.flags & 1)) {
|
|
1877
2233
|
if (job.id == null) {
|
|
1878
2234
|
queue.push(job);
|
|
2235
|
+
} else if (
|
|
2236
|
+
// fast path when the job id is larger than the tail
|
|
2237
|
+
!(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
|
|
2238
|
+
) {
|
|
2239
|
+
queue.push(job);
|
|
1879
2240
|
} else {
|
|
1880
2241
|
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1881
2242
|
}
|
|
2243
|
+
if (!(job.flags & 4)) {
|
|
2244
|
+
job.flags |= 1;
|
|
2245
|
+
}
|
|
1882
2246
|
queueFlush();
|
|
1883
2247
|
}
|
|
1884
2248
|
}
|
|
@@ -1896,11 +2260,11 @@ function invalidateJob(job) {
|
|
|
1896
2260
|
}
|
|
1897
2261
|
function queuePostFlushCb(cb) {
|
|
1898
2262
|
if (!isArray(cb)) {
|
|
1899
|
-
if (!
|
|
1900
|
-
cb,
|
|
1901
|
-
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1902
|
-
)) {
|
|
2263
|
+
if (!(cb.flags & 1)) {
|
|
1903
2264
|
pendingPostFlushCbs.push(cb);
|
|
2265
|
+
if (!(cb.flags & 4)) {
|
|
2266
|
+
cb.flags |= 1;
|
|
2267
|
+
}
|
|
1904
2268
|
}
|
|
1905
2269
|
} else {
|
|
1906
2270
|
pendingPostFlushCbs.push(...cb);
|
|
@@ -1913,7 +2277,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1913
2277
|
}
|
|
1914
2278
|
for (; i < queue.length; i++) {
|
|
1915
2279
|
const cb = queue[i];
|
|
1916
|
-
if (cb && cb.
|
|
2280
|
+
if (cb && cb.flags & 2) {
|
|
1917
2281
|
if (instance && cb.id !== instance.uid) {
|
|
1918
2282
|
continue;
|
|
1919
2283
|
}
|
|
@@ -1923,6 +2287,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1923
2287
|
queue.splice(i, 1);
|
|
1924
2288
|
i--;
|
|
1925
2289
|
cb();
|
|
2290
|
+
cb.flags &= ~1;
|
|
1926
2291
|
}
|
|
1927
2292
|
}
|
|
1928
2293
|
}
|
|
@@ -1945,6 +2310,7 @@ function flushPostFlushCbs(seen) {
|
|
|
1945
2310
|
continue;
|
|
1946
2311
|
}
|
|
1947
2312
|
activePostFlushCbs[postFlushIndex]();
|
|
2313
|
+
activePostFlushCbs[postFlushIndex].flags &= ~1;
|
|
1948
2314
|
}
|
|
1949
2315
|
activePostFlushCbs = null;
|
|
1950
2316
|
postFlushIndex = 0;
|
|
@@ -1954,9 +2320,11 @@ const getId = (job) => job.id == null ? Infinity : job.id;
|
|
|
1954
2320
|
const comparator = (a, b) => {
|
|
1955
2321
|
const diff = getId(a) - getId(b);
|
|
1956
2322
|
if (diff === 0) {
|
|
1957
|
-
|
|
2323
|
+
const isAPre = a.flags & 2;
|
|
2324
|
+
const isBPre = b.flags & 2;
|
|
2325
|
+
if (isAPre && !isBPre)
|
|
1958
2326
|
return -1;
|
|
1959
|
-
if (
|
|
2327
|
+
if (isBPre && !isAPre)
|
|
1960
2328
|
return 1;
|
|
1961
2329
|
}
|
|
1962
2330
|
return diff;
|
|
@@ -1972,11 +2340,12 @@ function flushJobs(seen) {
|
|
|
1972
2340
|
try {
|
|
1973
2341
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1974
2342
|
const job = queue[flushIndex];
|
|
1975
|
-
if (job && job.
|
|
2343
|
+
if (job && !(job.flags & 8)) {
|
|
1976
2344
|
if (check(job)) {
|
|
1977
2345
|
continue;
|
|
1978
2346
|
}
|
|
1979
2347
|
callWithErrorHandling(job, null, 14);
|
|
2348
|
+
job.flags &= ~1;
|
|
1980
2349
|
}
|
|
1981
2350
|
}
|
|
1982
2351
|
} finally {
|
|
@@ -2058,7 +2427,6 @@ function rerender(id, newRender) {
|
|
|
2058
2427
|
}
|
|
2059
2428
|
instance.renderCache = [];
|
|
2060
2429
|
isHmrUpdating = true;
|
|
2061
|
-
instance.effect.dirty = true;
|
|
2062
2430
|
instance.update();
|
|
2063
2431
|
isHmrUpdating = false;
|
|
2064
2432
|
});
|
|
@@ -2086,7 +2454,6 @@ function reload(id, newComp) {
|
|
|
2086
2454
|
instance.ceReload(newComp.styles);
|
|
2087
2455
|
hmrDirtyComponents.delete(oldComp);
|
|
2088
2456
|
} else if (instance.parent) {
|
|
2089
|
-
instance.parent.effect.dirty = true;
|
|
2090
2457
|
queueJob(instance.parent.update);
|
|
2091
2458
|
} else if (instance.appContext.reload) {
|
|
2092
2459
|
instance.appContext.reload();
|
|
@@ -4061,8 +4428,8 @@ function doWatch(source, cb, {
|
|
|
4061
4428
|
};
|
|
4062
4429
|
};
|
|
4063
4430
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
4064
|
-
const job = () => {
|
|
4065
|
-
if (!effect.
|
|
4431
|
+
const job = (immediateFirstRun) => {
|
|
4432
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
4066
4433
|
return;
|
|
4067
4434
|
}
|
|
4068
4435
|
if (cb) {
|
|
@@ -4083,19 +4450,22 @@ function doWatch(source, cb, {
|
|
|
4083
4450
|
effect.run();
|
|
4084
4451
|
}
|
|
4085
4452
|
};
|
|
4086
|
-
|
|
4453
|
+
if (cb)
|
|
4454
|
+
job.flags |= 4;
|
|
4455
|
+
const effect = new ReactiveEffect(getter);
|
|
4087
4456
|
let scheduler;
|
|
4088
4457
|
if (flush === "sync") {
|
|
4458
|
+
effect.flags |= 64;
|
|
4089
4459
|
scheduler = job;
|
|
4090
4460
|
} else if (flush === "post") {
|
|
4091
4461
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
4092
4462
|
} else {
|
|
4093
|
-
job.
|
|
4463
|
+
job.flags |= 2;
|
|
4094
4464
|
if (instance)
|
|
4095
4465
|
job.id = instance.uid;
|
|
4096
4466
|
scheduler = () => queueJob(job);
|
|
4097
4467
|
}
|
|
4098
|
-
|
|
4468
|
+
effect.scheduler = scheduler;
|
|
4099
4469
|
const scope = getCurrentScope();
|
|
4100
4470
|
const unwatch = () => {
|
|
4101
4471
|
effect.stop();
|
|
@@ -4109,7 +4479,7 @@ function doWatch(source, cb, {
|
|
|
4109
4479
|
}
|
|
4110
4480
|
if (cb) {
|
|
4111
4481
|
if (immediate) {
|
|
4112
|
-
job();
|
|
4482
|
+
job(true);
|
|
4113
4483
|
} else {
|
|
4114
4484
|
oldValue = effect.run();
|
|
4115
4485
|
}
|
|
@@ -4286,22 +4656,7 @@ const BaseTransitionImpl = {
|
|
|
4286
4656
|
if (!children || !children.length) {
|
|
4287
4657
|
return;
|
|
4288
4658
|
}
|
|
4289
|
-
|
|
4290
|
-
if (children.length > 1) {
|
|
4291
|
-
let hasFound = false;
|
|
4292
|
-
for (const c of children) {
|
|
4293
|
-
if (c.type !== Comment) {
|
|
4294
|
-
if (hasFound) {
|
|
4295
|
-
warn$1(
|
|
4296
|
-
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4297
|
-
);
|
|
4298
|
-
break;
|
|
4299
|
-
}
|
|
4300
|
-
child = c;
|
|
4301
|
-
hasFound = true;
|
|
4302
|
-
}
|
|
4303
|
-
}
|
|
4304
|
-
}
|
|
4659
|
+
const child = findNonCommentChild(children);
|
|
4305
4660
|
const rawProps = toRaw(props);
|
|
4306
4661
|
const { mode } = rawProps;
|
|
4307
4662
|
if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
|
@@ -4310,7 +4665,7 @@ const BaseTransitionImpl = {
|
|
|
4310
4665
|
if (state.isLeaving) {
|
|
4311
4666
|
return emptyPlaceholder(child);
|
|
4312
4667
|
}
|
|
4313
|
-
const innerChild =
|
|
4668
|
+
const innerChild = getInnerChild$1(child);
|
|
4314
4669
|
if (!innerChild) {
|
|
4315
4670
|
return emptyPlaceholder(child);
|
|
4316
4671
|
}
|
|
@@ -4322,7 +4677,7 @@ const BaseTransitionImpl = {
|
|
|
4322
4677
|
);
|
|
4323
4678
|
setTransitionHooks(innerChild, enterHooks);
|
|
4324
4679
|
const oldChild = instance.subTree;
|
|
4325
|
-
const oldInnerChild = oldChild &&
|
|
4680
|
+
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
|
|
4326
4681
|
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
|
4327
4682
|
const leavingHooks = resolveTransitionHooks(
|
|
4328
4683
|
oldInnerChild,
|
|
@@ -4335,8 +4690,7 @@ const BaseTransitionImpl = {
|
|
|
4335
4690
|
state.isLeaving = true;
|
|
4336
4691
|
leavingHooks.afterLeave = () => {
|
|
4337
4692
|
state.isLeaving = false;
|
|
4338
|
-
if (instance.
|
|
4339
|
-
instance.effect.dirty = true;
|
|
4693
|
+
if (!(instance.job.flags & 8)) {
|
|
4340
4694
|
instance.update();
|
|
4341
4695
|
}
|
|
4342
4696
|
};
|
|
@@ -4364,6 +4718,25 @@ const BaseTransitionImpl = {
|
|
|
4364
4718
|
{
|
|
4365
4719
|
BaseTransitionImpl.__isBuiltIn = true;
|
|
4366
4720
|
}
|
|
4721
|
+
function findNonCommentChild(children) {
|
|
4722
|
+
let child = children[0];
|
|
4723
|
+
if (children.length > 1) {
|
|
4724
|
+
let hasFound = false;
|
|
4725
|
+
for (const c of children) {
|
|
4726
|
+
if (c.type !== Comment) {
|
|
4727
|
+
if (hasFound) {
|
|
4728
|
+
warn$1(
|
|
4729
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4730
|
+
);
|
|
4731
|
+
break;
|
|
4732
|
+
}
|
|
4733
|
+
child = c;
|
|
4734
|
+
hasFound = true;
|
|
4735
|
+
}
|
|
4736
|
+
}
|
|
4737
|
+
}
|
|
4738
|
+
return child;
|
|
4739
|
+
}
|
|
4367
4740
|
const BaseTransition = BaseTransitionImpl;
|
|
4368
4741
|
function getLeavingNodesForType(state, vnode) {
|
|
4369
4742
|
const { leavingVNodes } = state;
|
|
@@ -4518,8 +4891,11 @@ function emptyPlaceholder(vnode) {
|
|
|
4518
4891
|
return vnode;
|
|
4519
4892
|
}
|
|
4520
4893
|
}
|
|
4521
|
-
function
|
|
4894
|
+
function getInnerChild$1(vnode) {
|
|
4522
4895
|
if (!isKeepAlive(vnode)) {
|
|
4896
|
+
if (isTeleport(vnode.type) && vnode.children) {
|
|
4897
|
+
return findNonCommentChild(vnode.children);
|
|
4898
|
+
}
|
|
4523
4899
|
return vnode;
|
|
4524
4900
|
}
|
|
4525
4901
|
if (vnode.component) {
|
|
@@ -4688,7 +5064,6 @@ function defineAsyncComponent(source) {
|
|
|
4688
5064
|
load().then(() => {
|
|
4689
5065
|
loaded.value = true;
|
|
4690
5066
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4691
|
-
instance.parent.effect.dirty = true;
|
|
4692
5067
|
queueJob(instance.parent.update);
|
|
4693
5068
|
}
|
|
4694
5069
|
}).catch((err) => {
|
|
@@ -5300,10 +5675,20 @@ function convertLegacyFunctionalComponent(comp) {
|
|
|
5300
5675
|
function renderList(source, renderItem, cache, index) {
|
|
5301
5676
|
let ret;
|
|
5302
5677
|
const cached = cache && cache[index];
|
|
5303
|
-
|
|
5678
|
+
const sourceIsArray = isArray(source);
|
|
5679
|
+
const sourceIsReactiveArray = sourceIsArray && isReactive(source);
|
|
5680
|
+
if (sourceIsArray || isString(source)) {
|
|
5681
|
+
if (sourceIsReactiveArray) {
|
|
5682
|
+
source = shallowReadArray(source);
|
|
5683
|
+
}
|
|
5304
5684
|
ret = new Array(source.length);
|
|
5305
5685
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
5306
|
-
ret[i] = renderItem(
|
|
5686
|
+
ret[i] = renderItem(
|
|
5687
|
+
sourceIsReactiveArray ? toReactive(source[i]) : source[i],
|
|
5688
|
+
i,
|
|
5689
|
+
void 0,
|
|
5690
|
+
cached && cached[i]
|
|
5691
|
+
);
|
|
5307
5692
|
}
|
|
5308
5693
|
} else if (typeof source === "number") {
|
|
5309
5694
|
if (!Number.isInteger(source)) {
|
|
@@ -5674,7 +6059,6 @@ const publicPropertiesMap = (
|
|
|
5674
6059
|
$emit: (i) => i.emit,
|
|
5675
6060
|
$options: (i) => resolveMergedOptions(i) ,
|
|
5676
6061
|
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
5677
|
-
i.effect.dirty = true;
|
|
5678
6062
|
queueJob(i.update);
|
|
5679
6063
|
}),
|
|
5680
6064
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
@@ -6545,7 +6929,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6545
6929
|
return vm;
|
|
6546
6930
|
}
|
|
6547
6931
|
}
|
|
6548
|
-
Vue.version = `2.6.14-compat:${"3.
|
|
6932
|
+
Vue.version = `2.6.14-compat:${"3.5.0-alpha.2"}`;
|
|
6549
6933
|
Vue.config = singletonApp.config;
|
|
6550
6934
|
Vue.use = (plugin, ...options) => {
|
|
6551
6935
|
if (plugin && isFunction(plugin.install)) {
|
|
@@ -6950,6 +7334,7 @@ function createAppAPI(render, hydrate) {
|
|
|
6950
7334
|
}
|
|
6951
7335
|
const context = createAppContext();
|
|
6952
7336
|
const installedPlugins = /* @__PURE__ */ new WeakSet();
|
|
7337
|
+
const pluginCleanupFns = [];
|
|
6953
7338
|
let isMounted = false;
|
|
6954
7339
|
const app = context.app = {
|
|
6955
7340
|
_uid: uid$1++,
|
|
@@ -7067,8 +7452,21 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7067
7452
|
);
|
|
7068
7453
|
}
|
|
7069
7454
|
},
|
|
7455
|
+
onUnmount(cleanupFn) {
|
|
7456
|
+
if (typeof cleanupFn !== "function") {
|
|
7457
|
+
warn$1(
|
|
7458
|
+
`Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
|
|
7459
|
+
);
|
|
7460
|
+
}
|
|
7461
|
+
pluginCleanupFns.push(cleanupFn);
|
|
7462
|
+
},
|
|
7070
7463
|
unmount() {
|
|
7071
7464
|
if (isMounted) {
|
|
7465
|
+
callWithAsyncErrorHandling(
|
|
7466
|
+
pluginCleanupFns,
|
|
7467
|
+
app._instance,
|
|
7468
|
+
15
|
|
7469
|
+
);
|
|
7072
7470
|
render(null, app._container);
|
|
7073
7471
|
{
|
|
7074
7472
|
app._instance = null;
|
|
@@ -7563,7 +7961,9 @@ const isSimpleType = /* @__PURE__ */ makeMap(
|
|
|
7563
7961
|
function assertType(value, type) {
|
|
7564
7962
|
let valid;
|
|
7565
7963
|
const expectedType = getType(type);
|
|
7566
|
-
if (
|
|
7964
|
+
if (expectedType === "null") {
|
|
7965
|
+
valid = value === null;
|
|
7966
|
+
} else if (isSimpleType(expectedType)) {
|
|
7567
7967
|
const t = typeof value;
|
|
7568
7968
|
valid = t === expectedType.toLowerCase();
|
|
7569
7969
|
if (!valid && t === "object") {
|
|
@@ -7573,8 +7973,6 @@ function assertType(value, type) {
|
|
|
7573
7973
|
valid = isObject(value);
|
|
7574
7974
|
} else if (expectedType === "Array") {
|
|
7575
7975
|
valid = isArray(value);
|
|
7576
|
-
} else if (expectedType === "null") {
|
|
7577
|
-
valid = value === null;
|
|
7578
7976
|
} else {
|
|
7579
7977
|
valid = value instanceof type;
|
|
7580
7978
|
}
|
|
@@ -9099,7 +9497,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9099
9497
|
} else {
|
|
9100
9498
|
instance.next = n2;
|
|
9101
9499
|
invalidateJob(instance.update);
|
|
9102
|
-
instance.effect.dirty = true;
|
|
9103
9500
|
instance.update();
|
|
9104
9501
|
}
|
|
9105
9502
|
} else {
|
|
@@ -9306,24 +9703,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9306
9703
|
}
|
|
9307
9704
|
}
|
|
9308
9705
|
};
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
);
|
|
9316
|
-
const update = instance.update = () => {
|
|
9317
|
-
if (effect.dirty) {
|
|
9318
|
-
effect.run();
|
|
9319
|
-
}
|
|
9320
|
-
};
|
|
9321
|
-
update.id = instance.uid;
|
|
9706
|
+
instance.scope.on();
|
|
9707
|
+
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
9708
|
+
instance.scope.off();
|
|
9709
|
+
const update = instance.update = effect.run.bind(effect);
|
|
9710
|
+
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
9711
|
+
job.id = instance.uid;
|
|
9712
|
+
effect.scheduler = () => queueJob(job);
|
|
9322
9713
|
toggleRecurse(instance, true);
|
|
9323
9714
|
{
|
|
9324
9715
|
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
9325
9716
|
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
9326
|
-
|
|
9717
|
+
job.ownerInstance = instance;
|
|
9327
9718
|
}
|
|
9328
9719
|
update();
|
|
9329
9720
|
};
|
|
@@ -9790,7 +10181,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9790
10181
|
if (instance.type.__hmrId) {
|
|
9791
10182
|
unregisterHMR(instance);
|
|
9792
10183
|
}
|
|
9793
|
-
const { bum, scope,
|
|
10184
|
+
const { bum, scope, job, subTree, um } = instance;
|
|
9794
10185
|
if (bum) {
|
|
9795
10186
|
invokeArrayFns(bum);
|
|
9796
10187
|
}
|
|
@@ -9798,8 +10189,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9798
10189
|
instance.emit("hook:beforeDestroy");
|
|
9799
10190
|
}
|
|
9800
10191
|
scope.stop();
|
|
9801
|
-
if (
|
|
9802
|
-
|
|
10192
|
+
if (job) {
|
|
10193
|
+
job.flags |= 8;
|
|
9803
10194
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
9804
10195
|
}
|
|
9805
10196
|
if (um) {
|
|
@@ -9891,8 +10282,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9891
10282
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
9892
10283
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
9893
10284
|
}
|
|
9894
|
-
function toggleRecurse({ effect,
|
|
9895
|
-
|
|
10285
|
+
function toggleRecurse({ effect, job }, allowed) {
|
|
10286
|
+
if (allowed) {
|
|
10287
|
+
effect.flags |= 32;
|
|
10288
|
+
job.flags |= 4;
|
|
10289
|
+
} else {
|
|
10290
|
+
effect.flags &= ~32;
|
|
10291
|
+
job.flags &= ~4;
|
|
10292
|
+
}
|
|
9896
10293
|
}
|
|
9897
10294
|
function needTransition(parentSuspense, transition) {
|
|
9898
10295
|
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
|
@@ -10693,6 +11090,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
10693
11090
|
effect: null,
|
|
10694
11091
|
update: null,
|
|
10695
11092
|
// will be set synchronously right after creation
|
|
11093
|
+
job: null,
|
|
10696
11094
|
scope: new EffectScope(
|
|
10697
11095
|
true
|
|
10698
11096
|
/* detached */
|
|
@@ -11198,7 +11596,8 @@ function initCustomFormatter() {
|
|
|
11198
11596
|
{},
|
|
11199
11597
|
["span", vueStyle, genRefFlag(obj)],
|
|
11200
11598
|
"<",
|
|
11201
|
-
|
|
11599
|
+
// avoid debugger accessing value affecting behavior
|
|
11600
|
+
formatValue("_value" in obj ? obj._value : obj),
|
|
11202
11601
|
`>`
|
|
11203
11602
|
];
|
|
11204
11603
|
} else if (isReactive(obj)) {
|
|
@@ -11378,7 +11777,7 @@ function isMemoSame(cached, memo) {
|
|
|
11378
11777
|
return true;
|
|
11379
11778
|
}
|
|
11380
11779
|
|
|
11381
|
-
const version = "3.
|
|
11780
|
+
const version = "3.5.0-alpha.2";
|
|
11382
11781
|
const warn = warn$1 ;
|
|
11383
11782
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
11384
11783
|
const devtools = devtools$1 ;
|
|
@@ -12945,7 +13344,9 @@ const withKeys = (fn, modifiers) => {
|
|
|
12945
13344
|
return;
|
|
12946
13345
|
}
|
|
12947
13346
|
const eventKey = hyphenate(event.key);
|
|
12948
|
-
if (modifiers.some(
|
|
13347
|
+
if (modifiers.some(
|
|
13348
|
+
(k) => k === eventKey || keyNames[k] === eventKey
|
|
13349
|
+
)) {
|
|
12949
13350
|
return fn(event);
|
|
12950
13351
|
}
|
|
12951
13352
|
{
|
|
@@ -18922,9 +19323,183 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
18922
19323
|
}
|
|
18923
19324
|
};
|
|
18924
19325
|
|
|
19326
|
+
function isValidHTMLNesting(parent, child) {
|
|
19327
|
+
if (parent in onlyValidChildren) {
|
|
19328
|
+
return onlyValidChildren[parent].has(child);
|
|
19329
|
+
}
|
|
19330
|
+
if (child in onlyValidParents) {
|
|
19331
|
+
return onlyValidParents[child].has(parent);
|
|
19332
|
+
}
|
|
19333
|
+
if (parent in knownInvalidChildren) {
|
|
19334
|
+
if (knownInvalidChildren[parent].has(child))
|
|
19335
|
+
return false;
|
|
19336
|
+
}
|
|
19337
|
+
if (child in knownInvalidParents) {
|
|
19338
|
+
if (knownInvalidParents[child].has(parent))
|
|
19339
|
+
return false;
|
|
19340
|
+
}
|
|
19341
|
+
return true;
|
|
19342
|
+
}
|
|
19343
|
+
const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
19344
|
+
const emptySet = /* @__PURE__ */ new Set([]);
|
|
19345
|
+
const onlyValidChildren = {
|
|
19346
|
+
head: /* @__PURE__ */ new Set([
|
|
19347
|
+
"base",
|
|
19348
|
+
"basefront",
|
|
19349
|
+
"bgsound",
|
|
19350
|
+
"link",
|
|
19351
|
+
"meta",
|
|
19352
|
+
"title",
|
|
19353
|
+
"noscript",
|
|
19354
|
+
"noframes",
|
|
19355
|
+
"style",
|
|
19356
|
+
"script",
|
|
19357
|
+
"template"
|
|
19358
|
+
]),
|
|
19359
|
+
optgroup: /* @__PURE__ */ new Set(["option"]),
|
|
19360
|
+
select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
|
|
19361
|
+
// table
|
|
19362
|
+
table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
|
|
19363
|
+
tr: /* @__PURE__ */ new Set(["td", "th"]),
|
|
19364
|
+
colgroup: /* @__PURE__ */ new Set(["col"]),
|
|
19365
|
+
tbody: /* @__PURE__ */ new Set(["tr"]),
|
|
19366
|
+
thead: /* @__PURE__ */ new Set(["tr"]),
|
|
19367
|
+
tfoot: /* @__PURE__ */ new Set(["tr"]),
|
|
19368
|
+
// these elements can not have any children elements
|
|
19369
|
+
script: emptySet,
|
|
19370
|
+
iframe: emptySet,
|
|
19371
|
+
option: emptySet,
|
|
19372
|
+
textarea: emptySet,
|
|
19373
|
+
style: emptySet,
|
|
19374
|
+
title: emptySet
|
|
19375
|
+
};
|
|
19376
|
+
const onlyValidParents = {
|
|
19377
|
+
// sections
|
|
19378
|
+
html: emptySet,
|
|
19379
|
+
body: /* @__PURE__ */ new Set(["html"]),
|
|
19380
|
+
head: /* @__PURE__ */ new Set(["html"]),
|
|
19381
|
+
// table
|
|
19382
|
+
td: /* @__PURE__ */ new Set(["tr"]),
|
|
19383
|
+
colgroup: /* @__PURE__ */ new Set(["table"]),
|
|
19384
|
+
caption: /* @__PURE__ */ new Set(["table"]),
|
|
19385
|
+
tbody: /* @__PURE__ */ new Set(["table"]),
|
|
19386
|
+
tfoot: /* @__PURE__ */ new Set(["table"]),
|
|
19387
|
+
col: /* @__PURE__ */ new Set(["colgroup"]),
|
|
19388
|
+
th: /* @__PURE__ */ new Set(["tr"]),
|
|
19389
|
+
thead: /* @__PURE__ */ new Set(["table"]),
|
|
19390
|
+
tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
|
|
19391
|
+
// data list
|
|
19392
|
+
dd: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
19393
|
+
dt: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
19394
|
+
// other
|
|
19395
|
+
figcaption: /* @__PURE__ */ new Set(["figure"]),
|
|
19396
|
+
// li: new Set(["ul", "ol"]),
|
|
19397
|
+
summary: /* @__PURE__ */ new Set(["details"]),
|
|
19398
|
+
area: /* @__PURE__ */ new Set(["map"])
|
|
19399
|
+
};
|
|
19400
|
+
const knownInvalidChildren = {
|
|
19401
|
+
p: /* @__PURE__ */ new Set([
|
|
19402
|
+
"address",
|
|
19403
|
+
"article",
|
|
19404
|
+
"aside",
|
|
19405
|
+
"blockquote",
|
|
19406
|
+
"center",
|
|
19407
|
+
"details",
|
|
19408
|
+
"dialog",
|
|
19409
|
+
"dir",
|
|
19410
|
+
"div",
|
|
19411
|
+
"dl",
|
|
19412
|
+
"fieldset",
|
|
19413
|
+
"figure",
|
|
19414
|
+
"footer",
|
|
19415
|
+
"form",
|
|
19416
|
+
"h1",
|
|
19417
|
+
"h2",
|
|
19418
|
+
"h3",
|
|
19419
|
+
"h4",
|
|
19420
|
+
"h5",
|
|
19421
|
+
"h6",
|
|
19422
|
+
"header",
|
|
19423
|
+
"hgroup",
|
|
19424
|
+
"hr",
|
|
19425
|
+
"li",
|
|
19426
|
+
"main",
|
|
19427
|
+
"nav",
|
|
19428
|
+
"menu",
|
|
19429
|
+
"ol",
|
|
19430
|
+
"p",
|
|
19431
|
+
"pre",
|
|
19432
|
+
"section",
|
|
19433
|
+
"table",
|
|
19434
|
+
"ul"
|
|
19435
|
+
]),
|
|
19436
|
+
svg: /* @__PURE__ */ new Set([
|
|
19437
|
+
"b",
|
|
19438
|
+
"blockquote",
|
|
19439
|
+
"br",
|
|
19440
|
+
"code",
|
|
19441
|
+
"dd",
|
|
19442
|
+
"div",
|
|
19443
|
+
"dl",
|
|
19444
|
+
"dt",
|
|
19445
|
+
"em",
|
|
19446
|
+
"embed",
|
|
19447
|
+
"h1",
|
|
19448
|
+
"h2",
|
|
19449
|
+
"h3",
|
|
19450
|
+
"h4",
|
|
19451
|
+
"h5",
|
|
19452
|
+
"h6",
|
|
19453
|
+
"hr",
|
|
19454
|
+
"i",
|
|
19455
|
+
"img",
|
|
19456
|
+
"li",
|
|
19457
|
+
"menu",
|
|
19458
|
+
"meta",
|
|
19459
|
+
"ol",
|
|
19460
|
+
"p",
|
|
19461
|
+
"pre",
|
|
19462
|
+
"ruby",
|
|
19463
|
+
"s",
|
|
19464
|
+
"small",
|
|
19465
|
+
"span",
|
|
19466
|
+
"strong",
|
|
19467
|
+
"sub",
|
|
19468
|
+
"sup",
|
|
19469
|
+
"table",
|
|
19470
|
+
"u",
|
|
19471
|
+
"ul",
|
|
19472
|
+
"var"
|
|
19473
|
+
])
|
|
19474
|
+
};
|
|
19475
|
+
const knownInvalidParents = {
|
|
19476
|
+
a: /* @__PURE__ */ new Set(["a"]),
|
|
19477
|
+
button: /* @__PURE__ */ new Set(["button"]),
|
|
19478
|
+
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
19479
|
+
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
19480
|
+
form: /* @__PURE__ */ new Set(["form"]),
|
|
19481
|
+
li: /* @__PURE__ */ new Set(["li"]),
|
|
19482
|
+
h1: headings,
|
|
19483
|
+
h2: headings,
|
|
19484
|
+
h3: headings,
|
|
19485
|
+
h4: headings,
|
|
19486
|
+
h5: headings,
|
|
19487
|
+
h6: headings
|
|
19488
|
+
};
|
|
19489
|
+
|
|
19490
|
+
const validateHtmlNesting = (node, context) => {
|
|
19491
|
+
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
|
|
19492
|
+
const error = new SyntaxError(
|
|
19493
|
+
`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
|
|
19494
|
+
);
|
|
19495
|
+
error.loc = node.loc;
|
|
19496
|
+
context.onWarn(error);
|
|
19497
|
+
}
|
|
19498
|
+
};
|
|
19499
|
+
|
|
18925
19500
|
const DOMNodeTransforms = [
|
|
18926
19501
|
transformStyle,
|
|
18927
|
-
...[transformTransition]
|
|
19502
|
+
...[transformTransition, validateHtmlNesting]
|
|
18928
19503
|
];
|
|
18929
19504
|
const DOMDirectiveTransforms = {
|
|
18930
19505
|
cloak: noopDirectiveTransform,
|