@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.cjs.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
|
**/
|
|
@@ -501,156 +501,280 @@ class EffectScope {
|
|
|
501
501
|
function effectScope(detached) {
|
|
502
502
|
return new EffectScope(detached);
|
|
503
503
|
}
|
|
504
|
-
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
505
|
-
if (scope && scope.active) {
|
|
506
|
-
scope.effects.push(effect);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
504
|
function getCurrentScope() {
|
|
510
505
|
return activeEffectScope;
|
|
511
506
|
}
|
|
512
|
-
function onScopeDispose(fn) {
|
|
507
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
513
508
|
if (activeEffectScope) {
|
|
514
509
|
activeEffectScope.cleanups.push(fn);
|
|
515
|
-
} else {
|
|
510
|
+
} else if (!failSilently) {
|
|
516
511
|
warn$2(
|
|
517
512
|
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
518
513
|
);
|
|
519
514
|
}
|
|
520
515
|
}
|
|
521
516
|
|
|
522
|
-
let
|
|
517
|
+
let activeSub;
|
|
523
518
|
class ReactiveEffect {
|
|
524
|
-
constructor(fn
|
|
519
|
+
constructor(fn) {
|
|
525
520
|
this.fn = fn;
|
|
526
|
-
this.trigger = trigger;
|
|
527
|
-
this.scheduler = scheduler;
|
|
528
|
-
this.active = true;
|
|
529
|
-
this.deps = [];
|
|
530
521
|
/**
|
|
531
522
|
* @internal
|
|
532
523
|
*/
|
|
533
|
-
this.
|
|
524
|
+
this.deps = void 0;
|
|
534
525
|
/**
|
|
535
526
|
* @internal
|
|
536
527
|
*/
|
|
537
|
-
this.
|
|
528
|
+
this.depsTail = void 0;
|
|
538
529
|
/**
|
|
539
530
|
* @internal
|
|
540
531
|
*/
|
|
541
|
-
this.
|
|
532
|
+
this.flags = 1 | 4;
|
|
542
533
|
/**
|
|
543
534
|
* @internal
|
|
544
535
|
*/
|
|
545
|
-
this.
|
|
536
|
+
this.nextEffect = void 0;
|
|
546
537
|
/**
|
|
547
538
|
* @internal
|
|
548
539
|
*/
|
|
549
|
-
this.
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
|
554
|
-
this._dirtyLevel = 1;
|
|
555
|
-
pauseTracking();
|
|
556
|
-
for (let i = 0; i < this._depsLength; i++) {
|
|
557
|
-
const dep = this.deps[i];
|
|
558
|
-
if (dep.computed) {
|
|
559
|
-
triggerComputed(dep.computed);
|
|
560
|
-
if (this._dirtyLevel >= 4) {
|
|
561
|
-
break;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
if (this._dirtyLevel === 1) {
|
|
566
|
-
this._dirtyLevel = 0;
|
|
567
|
-
}
|
|
568
|
-
resetTracking();
|
|
540
|
+
this.cleanup = void 0;
|
|
541
|
+
this.scheduler = void 0;
|
|
542
|
+
if (activeEffectScope && activeEffectScope.active) {
|
|
543
|
+
activeEffectScope.effects.push(this);
|
|
569
544
|
}
|
|
570
|
-
return this._dirtyLevel >= 4;
|
|
571
545
|
}
|
|
572
|
-
|
|
573
|
-
|
|
546
|
+
/**
|
|
547
|
+
* @internal
|
|
548
|
+
*/
|
|
549
|
+
notify() {
|
|
550
|
+
if (this.flags & 2 && !(this.flags & 32)) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
if (this.flags & 64) {
|
|
554
|
+
return this.trigger();
|
|
555
|
+
}
|
|
556
|
+
if (!(this.flags & 8)) {
|
|
557
|
+
this.flags |= 8;
|
|
558
|
+
this.nextEffect = batchedEffect;
|
|
559
|
+
batchedEffect = this;
|
|
560
|
+
}
|
|
574
561
|
}
|
|
575
562
|
run() {
|
|
576
|
-
this.
|
|
577
|
-
if (!this.active) {
|
|
563
|
+
if (!(this.flags & 1)) {
|
|
578
564
|
return this.fn();
|
|
579
565
|
}
|
|
580
|
-
|
|
581
|
-
|
|
566
|
+
this.flags |= 2;
|
|
567
|
+
cleanupEffect(this);
|
|
568
|
+
prepareDeps(this);
|
|
569
|
+
const prevEffect = activeSub;
|
|
570
|
+
const prevShouldTrack = shouldTrack;
|
|
571
|
+
activeSub = this;
|
|
572
|
+
shouldTrack = true;
|
|
582
573
|
try {
|
|
583
|
-
shouldTrack = true;
|
|
584
|
-
activeEffect = this;
|
|
585
|
-
this._runnings++;
|
|
586
|
-
preCleanupEffect(this);
|
|
587
574
|
return this.fn();
|
|
588
575
|
} finally {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
576
|
+
if (activeSub !== this) {
|
|
577
|
+
warn$2(
|
|
578
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
cleanupDeps(this);
|
|
582
|
+
activeSub = prevEffect;
|
|
583
|
+
shouldTrack = prevShouldTrack;
|
|
584
|
+
this.flags &= ~2;
|
|
593
585
|
}
|
|
594
586
|
}
|
|
595
587
|
stop() {
|
|
596
|
-
if (this.
|
|
597
|
-
|
|
598
|
-
|
|
588
|
+
if (this.flags & 1) {
|
|
589
|
+
for (let link = this.deps; link; link = link.nextDep) {
|
|
590
|
+
removeSub(link);
|
|
591
|
+
}
|
|
592
|
+
this.deps = this.depsTail = void 0;
|
|
593
|
+
cleanupEffect(this);
|
|
599
594
|
this.onStop && this.onStop();
|
|
600
|
-
this.
|
|
595
|
+
this.flags &= ~1;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
trigger() {
|
|
599
|
+
if (this.scheduler) {
|
|
600
|
+
this.scheduler();
|
|
601
|
+
} else {
|
|
602
|
+
this.runIfDirty();
|
|
601
603
|
}
|
|
602
604
|
}
|
|
605
|
+
/**
|
|
606
|
+
* @internal
|
|
607
|
+
*/
|
|
608
|
+
runIfDirty() {
|
|
609
|
+
if (isDirty(this)) {
|
|
610
|
+
this.run();
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
get dirty() {
|
|
614
|
+
return isDirty(this);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
let batchDepth = 0;
|
|
618
|
+
let batchedEffect;
|
|
619
|
+
function startBatch() {
|
|
620
|
+
batchDepth++;
|
|
621
|
+
}
|
|
622
|
+
function endBatch() {
|
|
623
|
+
if (batchDepth > 1) {
|
|
624
|
+
batchDepth--;
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
let error;
|
|
628
|
+
while (batchedEffect) {
|
|
629
|
+
let e = batchedEffect;
|
|
630
|
+
batchedEffect = void 0;
|
|
631
|
+
while (e) {
|
|
632
|
+
const next = e.nextEffect;
|
|
633
|
+
e.nextEffect = void 0;
|
|
634
|
+
e.flags &= ~8;
|
|
635
|
+
if (e.flags & 1) {
|
|
636
|
+
try {
|
|
637
|
+
e.trigger();
|
|
638
|
+
} catch (err) {
|
|
639
|
+
if (!error)
|
|
640
|
+
error = err;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
e = next;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
batchDepth--;
|
|
647
|
+
if (error)
|
|
648
|
+
throw error;
|
|
649
|
+
}
|
|
650
|
+
function prepareDeps(sub) {
|
|
651
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
652
|
+
link.version = -1;
|
|
653
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
654
|
+
link.dep.activeLink = link;
|
|
655
|
+
}
|
|
603
656
|
}
|
|
604
|
-
function
|
|
605
|
-
|
|
657
|
+
function cleanupDeps(sub) {
|
|
658
|
+
let head;
|
|
659
|
+
let tail = sub.depsTail;
|
|
660
|
+
for (let link = tail; link; link = link.prevDep) {
|
|
661
|
+
if (link.version === -1) {
|
|
662
|
+
if (link === tail)
|
|
663
|
+
tail = link.prevDep;
|
|
664
|
+
removeSub(link);
|
|
665
|
+
removeDep(link);
|
|
666
|
+
} else {
|
|
667
|
+
head = link;
|
|
668
|
+
}
|
|
669
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
670
|
+
link.prevActiveLink = void 0;
|
|
671
|
+
}
|
|
672
|
+
sub.deps = head;
|
|
673
|
+
sub.depsTail = tail;
|
|
606
674
|
}
|
|
607
|
-
function
|
|
608
|
-
|
|
609
|
-
|
|
675
|
+
function isDirty(sub) {
|
|
676
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
677
|
+
if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
|
|
678
|
+
return true;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
if (sub._dirty) {
|
|
682
|
+
return true;
|
|
683
|
+
}
|
|
684
|
+
return false;
|
|
610
685
|
}
|
|
611
|
-
function
|
|
612
|
-
if (
|
|
613
|
-
|
|
614
|
-
|
|
686
|
+
function refreshComputed(computed) {
|
|
687
|
+
if (computed.flags & 2) {
|
|
688
|
+
return false;
|
|
689
|
+
}
|
|
690
|
+
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
computed.flags &= ~16;
|
|
694
|
+
if (computed.globalVersion === globalVersion) {
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
computed.globalVersion = globalVersion;
|
|
698
|
+
const dep = computed.dep;
|
|
699
|
+
computed.flags |= 2;
|
|
700
|
+
if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
|
|
701
|
+
computed.flags &= ~2;
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
const prevSub = activeSub;
|
|
705
|
+
const prevShouldTrack = shouldTrack;
|
|
706
|
+
activeSub = computed;
|
|
707
|
+
shouldTrack = true;
|
|
708
|
+
try {
|
|
709
|
+
prepareDeps(computed);
|
|
710
|
+
const value = computed.fn();
|
|
711
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
712
|
+
computed._value = value;
|
|
713
|
+
dep.version++;
|
|
615
714
|
}
|
|
616
|
-
|
|
715
|
+
} catch (err) {
|
|
716
|
+
dep.version++;
|
|
717
|
+
throw err;
|
|
718
|
+
} finally {
|
|
719
|
+
activeSub = prevSub;
|
|
720
|
+
shouldTrack = prevShouldTrack;
|
|
721
|
+
cleanupDeps(computed);
|
|
722
|
+
computed.flags &= ~2;
|
|
617
723
|
}
|
|
618
724
|
}
|
|
619
|
-
function
|
|
620
|
-
const
|
|
621
|
-
if (
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
725
|
+
function removeSub(link) {
|
|
726
|
+
const { dep, prevSub, nextSub } = link;
|
|
727
|
+
if (prevSub) {
|
|
728
|
+
prevSub.nextSub = nextSub;
|
|
729
|
+
link.prevSub = void 0;
|
|
730
|
+
}
|
|
731
|
+
if (nextSub) {
|
|
732
|
+
nextSub.prevSub = prevSub;
|
|
733
|
+
link.nextSub = void 0;
|
|
734
|
+
}
|
|
735
|
+
if (dep.subs === link) {
|
|
736
|
+
dep.subs = prevSub;
|
|
737
|
+
}
|
|
738
|
+
if (!dep.subs && dep.computed) {
|
|
739
|
+
dep.computed.flags &= ~4;
|
|
740
|
+
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
741
|
+
removeSub(l);
|
|
625
742
|
}
|
|
626
743
|
}
|
|
627
744
|
}
|
|
745
|
+
function removeDep(link) {
|
|
746
|
+
const { prevDep, nextDep } = link;
|
|
747
|
+
if (prevDep) {
|
|
748
|
+
prevDep.nextDep = nextDep;
|
|
749
|
+
link.prevDep = void 0;
|
|
750
|
+
}
|
|
751
|
+
if (nextDep) {
|
|
752
|
+
nextDep.prevDep = prevDep;
|
|
753
|
+
link.nextDep = void 0;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
628
756
|
function effect(fn, options) {
|
|
629
757
|
if (fn.effect instanceof ReactiveEffect) {
|
|
630
758
|
fn = fn.effect.fn;
|
|
631
759
|
}
|
|
632
|
-
const
|
|
633
|
-
if (_effect.dirty) {
|
|
634
|
-
_effect.run();
|
|
635
|
-
}
|
|
636
|
-
});
|
|
760
|
+
const e = new ReactiveEffect(fn);
|
|
637
761
|
if (options) {
|
|
638
|
-
extend(
|
|
639
|
-
if (options.scope)
|
|
640
|
-
recordEffectScope(_effect, options.scope);
|
|
762
|
+
extend(e, options);
|
|
641
763
|
}
|
|
642
|
-
|
|
643
|
-
|
|
764
|
+
try {
|
|
765
|
+
e.run();
|
|
766
|
+
} catch (err) {
|
|
767
|
+
e.stop();
|
|
768
|
+
throw err;
|
|
644
769
|
}
|
|
645
|
-
const runner =
|
|
646
|
-
runner.effect =
|
|
770
|
+
const runner = e.run.bind(e);
|
|
771
|
+
runner.effect = e;
|
|
647
772
|
return runner;
|
|
648
773
|
}
|
|
649
774
|
function stop(runner) {
|
|
650
775
|
runner.effect.stop();
|
|
651
776
|
}
|
|
652
777
|
let shouldTrack = true;
|
|
653
|
-
let pauseScheduleStack = 0;
|
|
654
778
|
const trackStack = [];
|
|
655
779
|
function pauseTracking() {
|
|
656
780
|
trackStack.push(shouldTrack);
|
|
@@ -660,192 +784,414 @@ function resetTracking() {
|
|
|
660
784
|
const last = trackStack.pop();
|
|
661
785
|
shouldTrack = last === void 0 ? true : last;
|
|
662
786
|
}
|
|
663
|
-
function
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
787
|
+
function cleanupEffect(e) {
|
|
788
|
+
const { cleanup } = e;
|
|
789
|
+
e.cleanup = void 0;
|
|
790
|
+
if (cleanup) {
|
|
791
|
+
const prevSub = activeSub;
|
|
792
|
+
activeSub = void 0;
|
|
793
|
+
try {
|
|
794
|
+
cleanup();
|
|
795
|
+
} finally {
|
|
796
|
+
activeSub = prevSub;
|
|
797
|
+
}
|
|
670
798
|
}
|
|
671
799
|
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
800
|
+
|
|
801
|
+
let globalVersion = 0;
|
|
802
|
+
class Dep {
|
|
803
|
+
constructor(computed) {
|
|
804
|
+
this.computed = computed;
|
|
805
|
+
this.version = 0;
|
|
806
|
+
/**
|
|
807
|
+
* Link between this dep and the current active effect
|
|
808
|
+
*/
|
|
809
|
+
this.activeLink = void 0;
|
|
810
|
+
/**
|
|
811
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
812
|
+
*/
|
|
813
|
+
this.subs = void 0;
|
|
685
814
|
{
|
|
686
|
-
|
|
815
|
+
this.subsHead = void 0;
|
|
687
816
|
}
|
|
688
817
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
818
|
+
track(debugInfo) {
|
|
819
|
+
if (!activeSub || !shouldTrack) {
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
let link = this.activeLink;
|
|
823
|
+
if (link === void 0 || link.sub !== activeSub) {
|
|
824
|
+
link = this.activeLink = {
|
|
825
|
+
dep: this,
|
|
826
|
+
sub: activeSub,
|
|
827
|
+
version: this.version,
|
|
828
|
+
nextDep: void 0,
|
|
829
|
+
prevDep: void 0,
|
|
830
|
+
nextSub: void 0,
|
|
831
|
+
prevSub: void 0,
|
|
832
|
+
prevActiveLink: void 0
|
|
833
|
+
};
|
|
834
|
+
if (!activeSub.deps) {
|
|
835
|
+
activeSub.deps = activeSub.depsTail = link;
|
|
836
|
+
} else {
|
|
837
|
+
link.prevDep = activeSub.depsTail;
|
|
838
|
+
activeSub.depsTail.nextDep = link;
|
|
839
|
+
activeSub.depsTail = link;
|
|
703
840
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
841
|
+
if (activeSub.flags & 4) {
|
|
842
|
+
addSub(link);
|
|
843
|
+
}
|
|
844
|
+
} else if (link.version === -1) {
|
|
845
|
+
link.version = this.version;
|
|
846
|
+
if (link.nextDep) {
|
|
847
|
+
const next = link.nextDep;
|
|
848
|
+
next.prevDep = link.prevDep;
|
|
849
|
+
if (link.prevDep) {
|
|
850
|
+
link.prevDep.nextDep = next;
|
|
851
|
+
}
|
|
852
|
+
link.prevDep = activeSub.depsTail;
|
|
853
|
+
link.nextDep = void 0;
|
|
854
|
+
activeSub.depsTail.nextDep = link;
|
|
855
|
+
activeSub.depsTail = link;
|
|
856
|
+
if (activeSub.deps === link) {
|
|
857
|
+
activeSub.deps = next;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
if (activeSub.onTrack) {
|
|
862
|
+
activeSub.onTrack(
|
|
863
|
+
extend(
|
|
864
|
+
{
|
|
865
|
+
effect: activeSub
|
|
866
|
+
},
|
|
867
|
+
debugInfo
|
|
868
|
+
)
|
|
869
|
+
);
|
|
870
|
+
}
|
|
871
|
+
return link;
|
|
872
|
+
}
|
|
873
|
+
trigger(debugInfo) {
|
|
874
|
+
this.version++;
|
|
875
|
+
globalVersion++;
|
|
876
|
+
this.notify(debugInfo);
|
|
877
|
+
}
|
|
878
|
+
notify(debugInfo) {
|
|
879
|
+
startBatch();
|
|
880
|
+
try {
|
|
881
|
+
if (true) {
|
|
882
|
+
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
883
|
+
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
884
|
+
head.sub.onTrigger(
|
|
885
|
+
extend(
|
|
886
|
+
{
|
|
887
|
+
effect: head.sub
|
|
888
|
+
},
|
|
889
|
+
debugInfo
|
|
890
|
+
)
|
|
891
|
+
);
|
|
892
|
+
}
|
|
709
893
|
}
|
|
710
894
|
}
|
|
895
|
+
for (let link = this.subs; link; link = link.prevSub) {
|
|
896
|
+
link.sub.notify();
|
|
897
|
+
}
|
|
898
|
+
} finally {
|
|
899
|
+
endBatch();
|
|
711
900
|
}
|
|
712
901
|
}
|
|
713
|
-
resetScheduling();
|
|
714
902
|
}
|
|
715
|
-
|
|
716
|
-
const
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
}
|
|
722
|
-
|
|
903
|
+
function addSub(link) {
|
|
904
|
+
const computed = link.dep.computed;
|
|
905
|
+
if (computed && !link.dep.subs) {
|
|
906
|
+
computed.flags |= 4 | 16;
|
|
907
|
+
for (let l = computed.deps; l; l = l.nextDep) {
|
|
908
|
+
addSub(l);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
const currentTail = link.dep.subs;
|
|
912
|
+
if (currentTail !== link) {
|
|
913
|
+
link.prevSub = currentTail;
|
|
914
|
+
if (currentTail)
|
|
915
|
+
currentTail.nextSub = link;
|
|
916
|
+
}
|
|
917
|
+
if (link.dep.subsHead === void 0) {
|
|
918
|
+
link.dep.subsHead = link;
|
|
919
|
+
}
|
|
920
|
+
link.dep.subs = link;
|
|
921
|
+
}
|
|
723
922
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
724
|
-
const ITERATE_KEY = Symbol("iterate" );
|
|
725
|
-
const MAP_KEY_ITERATE_KEY = Symbol("Map
|
|
923
|
+
const ITERATE_KEY = Symbol("Object iterate" );
|
|
924
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
|
|
925
|
+
const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
|
|
726
926
|
function track(target, type, key) {
|
|
727
|
-
if (shouldTrack &&
|
|
927
|
+
if (shouldTrack && activeSub) {
|
|
728
928
|
let depsMap = targetMap.get(target);
|
|
729
929
|
if (!depsMap) {
|
|
730
930
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
731
931
|
}
|
|
732
932
|
let dep = depsMap.get(key);
|
|
733
933
|
if (!dep) {
|
|
734
|
-
depsMap.set(key, dep =
|
|
934
|
+
depsMap.set(key, dep = new Dep());
|
|
735
935
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
dep,
|
|
739
|
-
{
|
|
936
|
+
{
|
|
937
|
+
dep.track({
|
|
740
938
|
target,
|
|
741
939
|
type,
|
|
742
940
|
key
|
|
743
|
-
}
|
|
744
|
-
|
|
941
|
+
});
|
|
942
|
+
}
|
|
745
943
|
}
|
|
746
944
|
}
|
|
747
945
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
748
946
|
const depsMap = targetMap.get(target);
|
|
749
947
|
if (!depsMap) {
|
|
948
|
+
globalVersion++;
|
|
750
949
|
return;
|
|
751
950
|
}
|
|
752
951
|
let deps = [];
|
|
753
952
|
if (type === "clear") {
|
|
754
953
|
deps = [...depsMap.values()];
|
|
755
|
-
} else if (key === "length" && isArray(target)) {
|
|
756
|
-
const newLength = Number(newValue);
|
|
757
|
-
depsMap.forEach((dep, key2) => {
|
|
758
|
-
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
|
|
759
|
-
deps.push(dep);
|
|
760
|
-
}
|
|
761
|
-
});
|
|
762
954
|
} else {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
if (!
|
|
769
|
-
deps.push(
|
|
770
|
-
if (isMap(target)) {
|
|
771
|
-
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
772
|
-
}
|
|
773
|
-
} else if (isIntegerKey(key)) {
|
|
774
|
-
deps.push(depsMap.get("length"));
|
|
955
|
+
const targetIsArray = isArray(target);
|
|
956
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
957
|
+
if (targetIsArray && key === "length") {
|
|
958
|
+
const newLength = Number(newValue);
|
|
959
|
+
depsMap.forEach((dep, key2) => {
|
|
960
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
961
|
+
deps.push(dep);
|
|
775
962
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
963
|
+
});
|
|
964
|
+
} else {
|
|
965
|
+
const push = (dep) => dep && deps.push(dep);
|
|
966
|
+
if (key !== void 0) {
|
|
967
|
+
push(depsMap.get(key));
|
|
968
|
+
}
|
|
969
|
+
if (isArrayIndex) {
|
|
970
|
+
push(depsMap.get(ARRAY_ITERATE_KEY));
|
|
971
|
+
}
|
|
972
|
+
switch (type) {
|
|
973
|
+
case "add":
|
|
974
|
+
if (!targetIsArray) {
|
|
975
|
+
push(depsMap.get(ITERATE_KEY));
|
|
976
|
+
if (isMap(target)) {
|
|
977
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
978
|
+
}
|
|
979
|
+
} else if (isArrayIndex) {
|
|
980
|
+
push(depsMap.get("length"));
|
|
981
|
+
}
|
|
982
|
+
break;
|
|
983
|
+
case "delete":
|
|
984
|
+
if (!targetIsArray) {
|
|
985
|
+
push(depsMap.get(ITERATE_KEY));
|
|
986
|
+
if (isMap(target)) {
|
|
987
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
break;
|
|
991
|
+
case "set":
|
|
780
992
|
if (isMap(target)) {
|
|
781
|
-
|
|
993
|
+
push(depsMap.get(ITERATE_KEY));
|
|
782
994
|
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
case "set":
|
|
786
|
-
if (isMap(target)) {
|
|
787
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
788
|
-
}
|
|
789
|
-
break;
|
|
995
|
+
break;
|
|
996
|
+
}
|
|
790
997
|
}
|
|
791
998
|
}
|
|
792
|
-
|
|
999
|
+
startBatch();
|
|
793
1000
|
for (const dep of deps) {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
oldValue,
|
|
804
|
-
oldTarget
|
|
805
|
-
}
|
|
806
|
-
);
|
|
1001
|
+
{
|
|
1002
|
+
dep.trigger({
|
|
1003
|
+
target,
|
|
1004
|
+
type,
|
|
1005
|
+
key,
|
|
1006
|
+
newValue,
|
|
1007
|
+
oldValue,
|
|
1008
|
+
oldTarget
|
|
1009
|
+
});
|
|
807
1010
|
}
|
|
808
1011
|
}
|
|
809
|
-
|
|
1012
|
+
endBatch();
|
|
810
1013
|
}
|
|
811
1014
|
function getDepFromReactive(object, key) {
|
|
812
|
-
|
|
813
|
-
return
|
|
1015
|
+
var _a;
|
|
1016
|
+
return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
function reactiveReadArray(array) {
|
|
1020
|
+
const raw = toRaw(array);
|
|
1021
|
+
if (raw === array)
|
|
1022
|
+
return raw;
|
|
1023
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
1024
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
1025
|
+
}
|
|
1026
|
+
function shallowReadArray(arr) {
|
|
1027
|
+
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
1028
|
+
return arr;
|
|
1029
|
+
}
|
|
1030
|
+
const arrayInstrumentations = {
|
|
1031
|
+
__proto__: null,
|
|
1032
|
+
[Symbol.iterator]() {
|
|
1033
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
1034
|
+
},
|
|
1035
|
+
concat(...args) {
|
|
1036
|
+
return reactiveReadArray(this).concat(
|
|
1037
|
+
...args.map((x) => reactiveReadArray(x))
|
|
1038
|
+
);
|
|
1039
|
+
},
|
|
1040
|
+
entries() {
|
|
1041
|
+
return iterator(this, "entries", (value) => {
|
|
1042
|
+
value[1] = toReactive(value[1]);
|
|
1043
|
+
return value;
|
|
1044
|
+
});
|
|
1045
|
+
},
|
|
1046
|
+
every(fn, thisArg) {
|
|
1047
|
+
return apply(this, "every", fn, thisArg);
|
|
1048
|
+
},
|
|
1049
|
+
filter(fn, thisArg) {
|
|
1050
|
+
const result = apply(this, "filter", fn, thisArg);
|
|
1051
|
+
return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
|
|
1052
|
+
},
|
|
1053
|
+
find(fn, thisArg) {
|
|
1054
|
+
const result = apply(this, "find", fn, thisArg);
|
|
1055
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
1056
|
+
},
|
|
1057
|
+
findIndex(fn, thisArg) {
|
|
1058
|
+
return apply(this, "findIndex", fn, thisArg);
|
|
1059
|
+
},
|
|
1060
|
+
findLast(fn, thisArg) {
|
|
1061
|
+
const result = apply(this, "findLast", fn, thisArg);
|
|
1062
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
1063
|
+
},
|
|
1064
|
+
findLastIndex(fn, thisArg) {
|
|
1065
|
+
return apply(this, "findLastIndex", fn, thisArg);
|
|
1066
|
+
},
|
|
1067
|
+
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
1068
|
+
forEach(fn, thisArg) {
|
|
1069
|
+
return apply(this, "forEach", fn, thisArg);
|
|
1070
|
+
},
|
|
1071
|
+
includes(...args) {
|
|
1072
|
+
return searchProxy(this, "includes", args);
|
|
1073
|
+
},
|
|
1074
|
+
indexOf(...args) {
|
|
1075
|
+
return searchProxy(this, "indexOf", args);
|
|
1076
|
+
},
|
|
1077
|
+
join(separator) {
|
|
1078
|
+
return reactiveReadArray(this).join(separator);
|
|
1079
|
+
},
|
|
1080
|
+
// keys() iterator only reads `length`, no optimisation required
|
|
1081
|
+
lastIndexOf(...args) {
|
|
1082
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
1083
|
+
},
|
|
1084
|
+
map(fn, thisArg) {
|
|
1085
|
+
return apply(this, "map", fn, thisArg);
|
|
1086
|
+
},
|
|
1087
|
+
pop() {
|
|
1088
|
+
return noTracking(this, "pop");
|
|
1089
|
+
},
|
|
1090
|
+
push(...args) {
|
|
1091
|
+
return noTracking(this, "push", args);
|
|
1092
|
+
},
|
|
1093
|
+
reduce(fn, ...args) {
|
|
1094
|
+
return reduce(this, "reduce", fn, args);
|
|
1095
|
+
},
|
|
1096
|
+
reduceRight(fn, ...args) {
|
|
1097
|
+
return reduce(this, "reduceRight", fn, args);
|
|
1098
|
+
},
|
|
1099
|
+
shift() {
|
|
1100
|
+
return noTracking(this, "shift");
|
|
1101
|
+
},
|
|
1102
|
+
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
1103
|
+
some(fn, thisArg) {
|
|
1104
|
+
return apply(this, "some", fn, thisArg);
|
|
1105
|
+
},
|
|
1106
|
+
splice(...args) {
|
|
1107
|
+
return noTracking(this, "splice", args);
|
|
1108
|
+
},
|
|
1109
|
+
toReversed() {
|
|
1110
|
+
return reactiveReadArray(this).toReversed();
|
|
1111
|
+
},
|
|
1112
|
+
toSorted(comparer) {
|
|
1113
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
1114
|
+
},
|
|
1115
|
+
toSpliced(...args) {
|
|
1116
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
1117
|
+
},
|
|
1118
|
+
unshift(...args) {
|
|
1119
|
+
return noTracking(this, "unshift", args);
|
|
1120
|
+
},
|
|
1121
|
+
values() {
|
|
1122
|
+
return iterator(this, "values", toReactive);
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
function iterator(self, method, wrapValue) {
|
|
1126
|
+
const arr = shallowReadArray(self);
|
|
1127
|
+
const iter = arr[method]();
|
|
1128
|
+
if (arr !== self && !isShallow(self)) {
|
|
1129
|
+
iter._next = iter.next;
|
|
1130
|
+
iter.next = () => {
|
|
1131
|
+
const result = iter._next();
|
|
1132
|
+
if (result.value) {
|
|
1133
|
+
result.value = wrapValue(result.value);
|
|
1134
|
+
}
|
|
1135
|
+
return result;
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
return iter;
|
|
1139
|
+
}
|
|
1140
|
+
function apply(self, method, fn, thisArg) {
|
|
1141
|
+
const arr = shallowReadArray(self);
|
|
1142
|
+
let wrappedFn = fn;
|
|
1143
|
+
if (arr !== self) {
|
|
1144
|
+
if (!isShallow(self)) {
|
|
1145
|
+
wrappedFn = function(item, index) {
|
|
1146
|
+
return fn.call(this, toReactive(item), index, self);
|
|
1147
|
+
};
|
|
1148
|
+
} else if (fn.length > 2) {
|
|
1149
|
+
wrappedFn = function(item, index) {
|
|
1150
|
+
return fn.call(this, item, index, self);
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
return arr[method](wrappedFn, thisArg);
|
|
1155
|
+
}
|
|
1156
|
+
function reduce(self, method, fn, args) {
|
|
1157
|
+
const arr = shallowReadArray(self);
|
|
1158
|
+
let wrappedFn = fn;
|
|
1159
|
+
if (arr !== self) {
|
|
1160
|
+
if (!isShallow(self)) {
|
|
1161
|
+
wrappedFn = function(acc, item, index) {
|
|
1162
|
+
return fn.call(this, acc, toReactive(item), index, self);
|
|
1163
|
+
};
|
|
1164
|
+
} else if (fn.length > 3) {
|
|
1165
|
+
wrappedFn = function(acc, item, index) {
|
|
1166
|
+
return fn.call(this, acc, item, index, self);
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
return arr[method](wrappedFn, ...args);
|
|
1171
|
+
}
|
|
1172
|
+
function searchProxy(self, method, args) {
|
|
1173
|
+
const arr = toRaw(self);
|
|
1174
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
1175
|
+
const res = arr[method](...args);
|
|
1176
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1177
|
+
args[0] = toRaw(args[0]);
|
|
1178
|
+
return arr[method](...args);
|
|
1179
|
+
}
|
|
1180
|
+
return res;
|
|
1181
|
+
}
|
|
1182
|
+
function noTracking(self, method, args = []) {
|
|
1183
|
+
pauseTracking();
|
|
1184
|
+
startBatch();
|
|
1185
|
+
const res = toRaw(self)[method].apply(self, args);
|
|
1186
|
+
endBatch();
|
|
1187
|
+
resetTracking();
|
|
1188
|
+
return res;
|
|
814
1189
|
}
|
|
815
1190
|
|
|
816
1191
|
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
817
1192
|
const builtInSymbols = new Set(
|
|
818
1193
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
819
1194
|
);
|
|
820
|
-
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
821
|
-
function createArrayInstrumentations() {
|
|
822
|
-
const instrumentations = {};
|
|
823
|
-
["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
|
824
|
-
instrumentations[key] = function(...args) {
|
|
825
|
-
const arr = toRaw(this);
|
|
826
|
-
for (let i = 0, l = this.length; i < l; i++) {
|
|
827
|
-
track(arr, "get", i + "");
|
|
828
|
-
}
|
|
829
|
-
const res = arr[key](...args);
|
|
830
|
-
if (res === -1 || res === false) {
|
|
831
|
-
return arr[key](...args.map(toRaw));
|
|
832
|
-
} else {
|
|
833
|
-
return res;
|
|
834
|
-
}
|
|
835
|
-
};
|
|
836
|
-
});
|
|
837
|
-
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
838
|
-
instrumentations[key] = function(...args) {
|
|
839
|
-
pauseTracking();
|
|
840
|
-
pauseScheduling();
|
|
841
|
-
const res = toRaw(this)[key].apply(this, args);
|
|
842
|
-
resetScheduling();
|
|
843
|
-
resetTracking();
|
|
844
|
-
return res;
|
|
845
|
-
};
|
|
846
|
-
});
|
|
847
|
-
return instrumentations;
|
|
848
|
-
}
|
|
849
1195
|
function hasOwnProperty(key) {
|
|
850
1196
|
if (!isSymbol(key))
|
|
851
1197
|
key = String(key);
|
|
@@ -876,14 +1222,22 @@ class BaseReactiveHandler {
|
|
|
876
1222
|
}
|
|
877
1223
|
const targetIsArray = isArray(target);
|
|
878
1224
|
if (!isReadonly2) {
|
|
879
|
-
|
|
880
|
-
|
|
1225
|
+
let fn;
|
|
1226
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1227
|
+
return fn;
|
|
881
1228
|
}
|
|
882
1229
|
if (key === "hasOwnProperty") {
|
|
883
1230
|
return hasOwnProperty;
|
|
884
1231
|
}
|
|
885
1232
|
}
|
|
886
|
-
const res = Reflect.get(
|
|
1233
|
+
const res = Reflect.get(
|
|
1234
|
+
target,
|
|
1235
|
+
key,
|
|
1236
|
+
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1237
|
+
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1238
|
+
// its class methods
|
|
1239
|
+
isRef(target) ? target : receiver
|
|
1240
|
+
);
|
|
887
1241
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
888
1242
|
return res;
|
|
889
1243
|
}
|
|
@@ -1382,110 +1736,8 @@ function markRaw(value) {
|
|
|
1382
1736
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1383
1737
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1384
1738
|
|
|
1385
|
-
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`;
|
|
1386
|
-
class ComputedRefImpl {
|
|
1387
|
-
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1388
|
-
this.getter = getter;
|
|
1389
|
-
this._setter = _setter;
|
|
1390
|
-
this.dep = void 0;
|
|
1391
|
-
this.__v_isRef = true;
|
|
1392
|
-
this["__v_isReadonly"] = false;
|
|
1393
|
-
this.effect = new ReactiveEffect(
|
|
1394
|
-
() => getter(this._value),
|
|
1395
|
-
() => triggerRefValue(
|
|
1396
|
-
this,
|
|
1397
|
-
this.effect._dirtyLevel === 2 ? 2 : 3
|
|
1398
|
-
)
|
|
1399
|
-
);
|
|
1400
|
-
this.effect.computed = this;
|
|
1401
|
-
this.effect.active = this._cacheable = !isSSR;
|
|
1402
|
-
this["__v_isReadonly"] = isReadonly;
|
|
1403
|
-
}
|
|
1404
|
-
get value() {
|
|
1405
|
-
const self = toRaw(this);
|
|
1406
|
-
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
|
|
1407
|
-
triggerRefValue(self, 4);
|
|
1408
|
-
}
|
|
1409
|
-
trackRefValue(self);
|
|
1410
|
-
if (self.effect._dirtyLevel >= 2) {
|
|
1411
|
-
if (this._warnRecursive) {
|
|
1412
|
-
warn$2(COMPUTED_SIDE_EFFECT_WARN, `
|
|
1413
|
-
|
|
1414
|
-
getter: `, this.getter);
|
|
1415
|
-
}
|
|
1416
|
-
triggerRefValue(self, 2);
|
|
1417
|
-
}
|
|
1418
|
-
return self._value;
|
|
1419
|
-
}
|
|
1420
|
-
set value(newValue) {
|
|
1421
|
-
this._setter(newValue);
|
|
1422
|
-
}
|
|
1423
|
-
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1424
|
-
get _dirty() {
|
|
1425
|
-
return this.effect.dirty;
|
|
1426
|
-
}
|
|
1427
|
-
set _dirty(v) {
|
|
1428
|
-
this.effect.dirty = v;
|
|
1429
|
-
}
|
|
1430
|
-
// #endregion
|
|
1431
|
-
}
|
|
1432
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1433
|
-
let getter;
|
|
1434
|
-
let setter;
|
|
1435
|
-
const onlyGetter = isFunction(getterOrOptions);
|
|
1436
|
-
if (onlyGetter) {
|
|
1437
|
-
getter = getterOrOptions;
|
|
1438
|
-
setter = () => {
|
|
1439
|
-
warn$2("Write operation failed: computed value is readonly");
|
|
1440
|
-
} ;
|
|
1441
|
-
} else {
|
|
1442
|
-
getter = getterOrOptions.get;
|
|
1443
|
-
setter = getterOrOptions.set;
|
|
1444
|
-
}
|
|
1445
|
-
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1446
|
-
if (debugOptions && !isSSR) {
|
|
1447
|
-
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1448
|
-
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1449
|
-
}
|
|
1450
|
-
return cRef;
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
function trackRefValue(ref2) {
|
|
1454
|
-
var _a;
|
|
1455
|
-
if (shouldTrack && activeEffect) {
|
|
1456
|
-
ref2 = toRaw(ref2);
|
|
1457
|
-
trackEffect(
|
|
1458
|
-
activeEffect,
|
|
1459
|
-
(_a = ref2.dep) != null ? _a : ref2.dep = createDep(
|
|
1460
|
-
() => ref2.dep = void 0,
|
|
1461
|
-
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1462
|
-
),
|
|
1463
|
-
{
|
|
1464
|
-
target: ref2,
|
|
1465
|
-
type: "get",
|
|
1466
|
-
key: "value"
|
|
1467
|
-
}
|
|
1468
|
-
);
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
|
|
1472
|
-
ref2 = toRaw(ref2);
|
|
1473
|
-
const dep = ref2.dep;
|
|
1474
|
-
if (dep) {
|
|
1475
|
-
triggerEffects(
|
|
1476
|
-
dep,
|
|
1477
|
-
dirtyLevel,
|
|
1478
|
-
{
|
|
1479
|
-
target: ref2,
|
|
1480
|
-
type: "set",
|
|
1481
|
-
key: "value",
|
|
1482
|
-
newValue: newVal
|
|
1483
|
-
}
|
|
1484
|
-
);
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
1739
|
function isRef(r) {
|
|
1488
|
-
return
|
|
1740
|
+
return r ? r.__v_isRef === true : false;
|
|
1489
1741
|
}
|
|
1490
1742
|
function ref(value) {
|
|
1491
1743
|
return createRef(value, false);
|
|
@@ -1502,27 +1754,49 @@ function createRef(rawValue, shallow) {
|
|
|
1502
1754
|
class RefImpl {
|
|
1503
1755
|
constructor(value, __v_isShallow) {
|
|
1504
1756
|
this.__v_isShallow = __v_isShallow;
|
|
1505
|
-
this.dep =
|
|
1757
|
+
this.dep = new Dep();
|
|
1506
1758
|
this.__v_isRef = true;
|
|
1507
1759
|
this._rawValue = __v_isShallow ? value : toRaw(value);
|
|
1508
1760
|
this._value = __v_isShallow ? value : toReactive(value);
|
|
1509
1761
|
}
|
|
1510
1762
|
get value() {
|
|
1511
|
-
|
|
1763
|
+
{
|
|
1764
|
+
this.dep.track({
|
|
1765
|
+
target: this,
|
|
1766
|
+
type: "get",
|
|
1767
|
+
key: "value"
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1512
1770
|
return this._value;
|
|
1513
1771
|
}
|
|
1514
|
-
set value(
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
this.
|
|
1520
|
-
|
|
1772
|
+
set value(newValue) {
|
|
1773
|
+
const oldValue = this._rawValue;
|
|
1774
|
+
const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
|
|
1775
|
+
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1776
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1777
|
+
this._rawValue = newValue;
|
|
1778
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1779
|
+
{
|
|
1780
|
+
this.dep.trigger({
|
|
1781
|
+
target: this,
|
|
1782
|
+
type: "set",
|
|
1783
|
+
key: "value",
|
|
1784
|
+
newValue,
|
|
1785
|
+
oldValue
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1521
1788
|
}
|
|
1522
1789
|
}
|
|
1523
1790
|
}
|
|
1524
1791
|
function triggerRef(ref2) {
|
|
1525
|
-
|
|
1792
|
+
{
|
|
1793
|
+
ref2.dep.trigger({
|
|
1794
|
+
target: ref2,
|
|
1795
|
+
type: "set",
|
|
1796
|
+
key: "value",
|
|
1797
|
+
newValue: ref2._value
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1526
1800
|
}
|
|
1527
1801
|
function unref(ref2) {
|
|
1528
1802
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1547,12 +1821,9 @@ function proxyRefs(objectWithRefs) {
|
|
|
1547
1821
|
}
|
|
1548
1822
|
class CustomRefImpl {
|
|
1549
1823
|
constructor(factory) {
|
|
1550
|
-
this.dep = void 0;
|
|
1551
1824
|
this.__v_isRef = true;
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1554
|
-
() => triggerRefValue(this)
|
|
1555
|
-
);
|
|
1825
|
+
const dep = this.dep = new Dep();
|
|
1826
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1556
1827
|
this._get = get;
|
|
1557
1828
|
this._set = set;
|
|
1558
1829
|
}
|
|
@@ -1620,6 +1891,90 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1620
1891
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1621
1892
|
}
|
|
1622
1893
|
|
|
1894
|
+
class ComputedRefImpl {
|
|
1895
|
+
constructor(fn, setter, isSSR) {
|
|
1896
|
+
this.fn = fn;
|
|
1897
|
+
this.setter = setter;
|
|
1898
|
+
/**
|
|
1899
|
+
* @internal
|
|
1900
|
+
*/
|
|
1901
|
+
this._value = void 0;
|
|
1902
|
+
/**
|
|
1903
|
+
* @internal
|
|
1904
|
+
*/
|
|
1905
|
+
this.dep = new Dep(this);
|
|
1906
|
+
/**
|
|
1907
|
+
* @internal
|
|
1908
|
+
*/
|
|
1909
|
+
this.__v_isRef = true;
|
|
1910
|
+
// A computed is also a subscriber that tracks other deps
|
|
1911
|
+
/**
|
|
1912
|
+
* @internal
|
|
1913
|
+
*/
|
|
1914
|
+
this.deps = void 0;
|
|
1915
|
+
/**
|
|
1916
|
+
* @internal
|
|
1917
|
+
*/
|
|
1918
|
+
this.depsTail = void 0;
|
|
1919
|
+
/**
|
|
1920
|
+
* @internal
|
|
1921
|
+
*/
|
|
1922
|
+
this.flags = 16;
|
|
1923
|
+
/**
|
|
1924
|
+
* @internal
|
|
1925
|
+
*/
|
|
1926
|
+
this.globalVersion = globalVersion - 1;
|
|
1927
|
+
// for backwards compat
|
|
1928
|
+
this.effect = this;
|
|
1929
|
+
this.__v_isReadonly = !setter;
|
|
1930
|
+
this.isSSR = isSSR;
|
|
1931
|
+
}
|
|
1932
|
+
/**
|
|
1933
|
+
* @internal
|
|
1934
|
+
*/
|
|
1935
|
+
notify() {
|
|
1936
|
+
if (activeSub !== this) {
|
|
1937
|
+
this.flags |= 16;
|
|
1938
|
+
this.dep.notify();
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
get value() {
|
|
1942
|
+
const link = this.dep.track({
|
|
1943
|
+
target: this,
|
|
1944
|
+
type: "get",
|
|
1945
|
+
key: "value"
|
|
1946
|
+
}) ;
|
|
1947
|
+
refreshComputed(this);
|
|
1948
|
+
if (link) {
|
|
1949
|
+
link.version = this.dep.version;
|
|
1950
|
+
}
|
|
1951
|
+
return this._value;
|
|
1952
|
+
}
|
|
1953
|
+
set value(newValue) {
|
|
1954
|
+
if (this.setter) {
|
|
1955
|
+
this.setter(newValue);
|
|
1956
|
+
} else {
|
|
1957
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1962
|
+
let getter;
|
|
1963
|
+
let setter;
|
|
1964
|
+
if (isFunction(getterOrOptions)) {
|
|
1965
|
+
getter = getterOrOptions;
|
|
1966
|
+
} else {
|
|
1967
|
+
getter = getterOrOptions.get;
|
|
1968
|
+
setter = getterOrOptions.set;
|
|
1969
|
+
}
|
|
1970
|
+
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1971
|
+
if (debugOptions && !isSSR) {
|
|
1972
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1973
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1974
|
+
}
|
|
1975
|
+
return cRef;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1623
1978
|
const TrackOpTypes = {
|
|
1624
1979
|
"GET": "get",
|
|
1625
1980
|
"HAS": "has",
|
|
@@ -1779,7 +2134,9 @@ const ErrorCodes = {
|
|
|
1779
2134
|
"ASYNC_COMPONENT_LOADER": 13,
|
|
1780
2135
|
"13": "ASYNC_COMPONENT_LOADER",
|
|
1781
2136
|
"SCHEDULER": 14,
|
|
1782
|
-
"14": "SCHEDULER"
|
|
2137
|
+
"14": "SCHEDULER",
|
|
2138
|
+
"APP_UNMOUNT_CLEANUP": 15,
|
|
2139
|
+
"15": "APP_UNMOUNT_CLEANUP"
|
|
1783
2140
|
};
|
|
1784
2141
|
const ErrorTypeStrings$1 = {
|
|
1785
2142
|
["sp"]: "serverPrefetch hook",
|
|
@@ -1810,7 +2167,8 @@ const ErrorTypeStrings$1 = {
|
|
|
1810
2167
|
[11]: "app warnHandler",
|
|
1811
2168
|
[12]: "ref function",
|
|
1812
2169
|
[13]: "async component loader",
|
|
1813
|
-
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
2170
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core .",
|
|
2171
|
+
[15]: "app unmount cleanup function"
|
|
1814
2172
|
};
|
|
1815
2173
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
1816
2174
|
try {
|
|
@@ -1912,7 +2270,7 @@ function findInsertionIndex(id) {
|
|
|
1912
2270
|
const middle = start + end >>> 1;
|
|
1913
2271
|
const middleJob = queue[middle];
|
|
1914
2272
|
const middleJobId = getId(middleJob);
|
|
1915
|
-
if (middleJobId < id || middleJobId === id && middleJob.
|
|
2273
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1916
2274
|
start = middle + 1;
|
|
1917
2275
|
} else {
|
|
1918
2276
|
end = middle;
|
|
@@ -1921,15 +2279,21 @@ function findInsertionIndex(id) {
|
|
|
1921
2279
|
return start;
|
|
1922
2280
|
}
|
|
1923
2281
|
function queueJob(job) {
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1927
|
-
)) {
|
|
2282
|
+
var _a;
|
|
2283
|
+
if (!(job.flags & 1)) {
|
|
1928
2284
|
if (job.id == null) {
|
|
1929
2285
|
queue.push(job);
|
|
2286
|
+
} else if (
|
|
2287
|
+
// fast path when the job id is larger than the tail
|
|
2288
|
+
!(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
|
|
2289
|
+
) {
|
|
2290
|
+
queue.push(job);
|
|
1930
2291
|
} else {
|
|
1931
2292
|
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1932
2293
|
}
|
|
2294
|
+
if (!(job.flags & 4)) {
|
|
2295
|
+
job.flags |= 1;
|
|
2296
|
+
}
|
|
1933
2297
|
queueFlush();
|
|
1934
2298
|
}
|
|
1935
2299
|
}
|
|
@@ -1947,11 +2311,11 @@ function invalidateJob(job) {
|
|
|
1947
2311
|
}
|
|
1948
2312
|
function queuePostFlushCb(cb) {
|
|
1949
2313
|
if (!isArray(cb)) {
|
|
1950
|
-
if (!
|
|
1951
|
-
cb,
|
|
1952
|
-
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1953
|
-
)) {
|
|
2314
|
+
if (!(cb.flags & 1)) {
|
|
1954
2315
|
pendingPostFlushCbs.push(cb);
|
|
2316
|
+
if (!(cb.flags & 4)) {
|
|
2317
|
+
cb.flags |= 1;
|
|
2318
|
+
}
|
|
1955
2319
|
}
|
|
1956
2320
|
} else {
|
|
1957
2321
|
pendingPostFlushCbs.push(...cb);
|
|
@@ -1964,7 +2328,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1964
2328
|
}
|
|
1965
2329
|
for (; i < queue.length; i++) {
|
|
1966
2330
|
const cb = queue[i];
|
|
1967
|
-
if (cb && cb.
|
|
2331
|
+
if (cb && cb.flags & 2) {
|
|
1968
2332
|
if (instance && cb.id !== instance.uid) {
|
|
1969
2333
|
continue;
|
|
1970
2334
|
}
|
|
@@ -1974,6 +2338,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1974
2338
|
queue.splice(i, 1);
|
|
1975
2339
|
i--;
|
|
1976
2340
|
cb();
|
|
2341
|
+
cb.flags &= ~1;
|
|
1977
2342
|
}
|
|
1978
2343
|
}
|
|
1979
2344
|
}
|
|
@@ -1996,6 +2361,7 @@ function flushPostFlushCbs(seen) {
|
|
|
1996
2361
|
continue;
|
|
1997
2362
|
}
|
|
1998
2363
|
activePostFlushCbs[postFlushIndex]();
|
|
2364
|
+
activePostFlushCbs[postFlushIndex].flags &= ~1;
|
|
1999
2365
|
}
|
|
2000
2366
|
activePostFlushCbs = null;
|
|
2001
2367
|
postFlushIndex = 0;
|
|
@@ -2005,9 +2371,11 @@ const getId = (job) => job.id == null ? Infinity : job.id;
|
|
|
2005
2371
|
const comparator = (a, b) => {
|
|
2006
2372
|
const diff = getId(a) - getId(b);
|
|
2007
2373
|
if (diff === 0) {
|
|
2008
|
-
|
|
2374
|
+
const isAPre = a.flags & 2;
|
|
2375
|
+
const isBPre = b.flags & 2;
|
|
2376
|
+
if (isAPre && !isBPre)
|
|
2009
2377
|
return -1;
|
|
2010
|
-
if (
|
|
2378
|
+
if (isBPre && !isAPre)
|
|
2011
2379
|
return 1;
|
|
2012
2380
|
}
|
|
2013
2381
|
return diff;
|
|
@@ -2023,11 +2391,12 @@ function flushJobs(seen) {
|
|
|
2023
2391
|
try {
|
|
2024
2392
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
2025
2393
|
const job = queue[flushIndex];
|
|
2026
|
-
if (job && job.
|
|
2394
|
+
if (job && !(job.flags & 8)) {
|
|
2027
2395
|
if (check(job)) {
|
|
2028
2396
|
continue;
|
|
2029
2397
|
}
|
|
2030
2398
|
callWithErrorHandling(job, null, 14);
|
|
2399
|
+
job.flags &= ~1;
|
|
2031
2400
|
}
|
|
2032
2401
|
}
|
|
2033
2402
|
} finally {
|
|
@@ -2109,7 +2478,6 @@ function rerender(id, newRender) {
|
|
|
2109
2478
|
}
|
|
2110
2479
|
instance.renderCache = [];
|
|
2111
2480
|
isHmrUpdating = true;
|
|
2112
|
-
instance.effect.dirty = true;
|
|
2113
2481
|
instance.update();
|
|
2114
2482
|
isHmrUpdating = false;
|
|
2115
2483
|
});
|
|
@@ -2137,7 +2505,6 @@ function reload(id, newComp) {
|
|
|
2137
2505
|
instance.ceReload(newComp.styles);
|
|
2138
2506
|
hmrDirtyComponents.delete(oldComp);
|
|
2139
2507
|
} else if (instance.parent) {
|
|
2140
|
-
instance.parent.effect.dirty = true;
|
|
2141
2508
|
queueJob(instance.parent.update);
|
|
2142
2509
|
} else if (instance.appContext.reload) {
|
|
2143
2510
|
instance.appContext.reload();
|
|
@@ -4131,8 +4498,8 @@ function doWatch(source, cb, {
|
|
|
4131
4498
|
}
|
|
4132
4499
|
}
|
|
4133
4500
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
4134
|
-
const job = () => {
|
|
4135
|
-
if (!effect.
|
|
4501
|
+
const job = (immediateFirstRun) => {
|
|
4502
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
4136
4503
|
return;
|
|
4137
4504
|
}
|
|
4138
4505
|
if (cb) {
|
|
@@ -4153,19 +4520,22 @@ function doWatch(source, cb, {
|
|
|
4153
4520
|
effect.run();
|
|
4154
4521
|
}
|
|
4155
4522
|
};
|
|
4156
|
-
|
|
4523
|
+
if (cb)
|
|
4524
|
+
job.flags |= 4;
|
|
4525
|
+
const effect = new ReactiveEffect(getter);
|
|
4157
4526
|
let scheduler;
|
|
4158
4527
|
if (flush === "sync") {
|
|
4528
|
+
effect.flags |= 64;
|
|
4159
4529
|
scheduler = job;
|
|
4160
4530
|
} else if (flush === "post") {
|
|
4161
4531
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
4162
4532
|
} else {
|
|
4163
|
-
job.
|
|
4533
|
+
job.flags |= 2;
|
|
4164
4534
|
if (instance)
|
|
4165
4535
|
job.id = instance.uid;
|
|
4166
4536
|
scheduler = () => queueJob(job);
|
|
4167
4537
|
}
|
|
4168
|
-
|
|
4538
|
+
effect.scheduler = scheduler;
|
|
4169
4539
|
const scope = getCurrentScope();
|
|
4170
4540
|
const unwatch = () => {
|
|
4171
4541
|
effect.stop();
|
|
@@ -4179,7 +4549,7 @@ function doWatch(source, cb, {
|
|
|
4179
4549
|
}
|
|
4180
4550
|
if (cb) {
|
|
4181
4551
|
if (immediate) {
|
|
4182
|
-
job();
|
|
4552
|
+
job(true);
|
|
4183
4553
|
} else {
|
|
4184
4554
|
oldValue = effect.run();
|
|
4185
4555
|
}
|
|
@@ -4358,22 +4728,7 @@ const BaseTransitionImpl = {
|
|
|
4358
4728
|
if (!children || !children.length) {
|
|
4359
4729
|
return;
|
|
4360
4730
|
}
|
|
4361
|
-
|
|
4362
|
-
if (children.length > 1) {
|
|
4363
|
-
let hasFound = false;
|
|
4364
|
-
for (const c of children) {
|
|
4365
|
-
if (c.type !== Comment) {
|
|
4366
|
-
if (hasFound) {
|
|
4367
|
-
warn$1(
|
|
4368
|
-
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4369
|
-
);
|
|
4370
|
-
break;
|
|
4371
|
-
}
|
|
4372
|
-
child = c;
|
|
4373
|
-
hasFound = true;
|
|
4374
|
-
}
|
|
4375
|
-
}
|
|
4376
|
-
}
|
|
4731
|
+
const child = findNonCommentChild(children);
|
|
4377
4732
|
const rawProps = toRaw(props);
|
|
4378
4733
|
const { mode } = rawProps;
|
|
4379
4734
|
if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
|
@@ -4382,7 +4737,7 @@ const BaseTransitionImpl = {
|
|
|
4382
4737
|
if (state.isLeaving) {
|
|
4383
4738
|
return emptyPlaceholder(child);
|
|
4384
4739
|
}
|
|
4385
|
-
const innerChild =
|
|
4740
|
+
const innerChild = getInnerChild$1(child);
|
|
4386
4741
|
if (!innerChild) {
|
|
4387
4742
|
return emptyPlaceholder(child);
|
|
4388
4743
|
}
|
|
@@ -4394,7 +4749,7 @@ const BaseTransitionImpl = {
|
|
|
4394
4749
|
);
|
|
4395
4750
|
setTransitionHooks(innerChild, enterHooks);
|
|
4396
4751
|
const oldChild = instance.subTree;
|
|
4397
|
-
const oldInnerChild = oldChild &&
|
|
4752
|
+
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
|
|
4398
4753
|
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
|
4399
4754
|
const leavingHooks = resolveTransitionHooks(
|
|
4400
4755
|
oldInnerChild,
|
|
@@ -4407,8 +4762,7 @@ const BaseTransitionImpl = {
|
|
|
4407
4762
|
state.isLeaving = true;
|
|
4408
4763
|
leavingHooks.afterLeave = () => {
|
|
4409
4764
|
state.isLeaving = false;
|
|
4410
|
-
if (instance.
|
|
4411
|
-
instance.effect.dirty = true;
|
|
4765
|
+
if (!(instance.job.flags & 8)) {
|
|
4412
4766
|
instance.update();
|
|
4413
4767
|
}
|
|
4414
4768
|
};
|
|
@@ -4436,6 +4790,25 @@ const BaseTransitionImpl = {
|
|
|
4436
4790
|
{
|
|
4437
4791
|
BaseTransitionImpl.__isBuiltIn = true;
|
|
4438
4792
|
}
|
|
4793
|
+
function findNonCommentChild(children) {
|
|
4794
|
+
let child = children[0];
|
|
4795
|
+
if (children.length > 1) {
|
|
4796
|
+
let hasFound = false;
|
|
4797
|
+
for (const c of children) {
|
|
4798
|
+
if (c.type !== Comment) {
|
|
4799
|
+
if (hasFound) {
|
|
4800
|
+
warn$1(
|
|
4801
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4802
|
+
);
|
|
4803
|
+
break;
|
|
4804
|
+
}
|
|
4805
|
+
child = c;
|
|
4806
|
+
hasFound = true;
|
|
4807
|
+
}
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
return child;
|
|
4811
|
+
}
|
|
4439
4812
|
const BaseTransition = BaseTransitionImpl;
|
|
4440
4813
|
function getLeavingNodesForType(state, vnode) {
|
|
4441
4814
|
const { leavingVNodes } = state;
|
|
@@ -4590,8 +4963,11 @@ function emptyPlaceholder(vnode) {
|
|
|
4590
4963
|
return vnode;
|
|
4591
4964
|
}
|
|
4592
4965
|
}
|
|
4593
|
-
function
|
|
4966
|
+
function getInnerChild$1(vnode) {
|
|
4594
4967
|
if (!isKeepAlive(vnode)) {
|
|
4968
|
+
if (isTeleport(vnode.type) && vnode.children) {
|
|
4969
|
+
return findNonCommentChild(vnode.children);
|
|
4970
|
+
}
|
|
4595
4971
|
return vnode;
|
|
4596
4972
|
}
|
|
4597
4973
|
if (vnode.component) {
|
|
@@ -4760,7 +5136,6 @@ function defineAsyncComponent(source) {
|
|
|
4760
5136
|
load().then(() => {
|
|
4761
5137
|
loaded.value = true;
|
|
4762
5138
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4763
|
-
instance.parent.effect.dirty = true;
|
|
4764
5139
|
queueJob(instance.parent.update);
|
|
4765
5140
|
}
|
|
4766
5141
|
}).catch((err) => {
|
|
@@ -5378,10 +5753,20 @@ function convertLegacyFunctionalComponent(comp) {
|
|
|
5378
5753
|
function renderList(source, renderItem, cache, index) {
|
|
5379
5754
|
let ret;
|
|
5380
5755
|
const cached = cache && cache[index];
|
|
5381
|
-
|
|
5756
|
+
const sourceIsArray = isArray(source);
|
|
5757
|
+
const sourceIsReactiveArray = sourceIsArray && isReactive(source);
|
|
5758
|
+
if (sourceIsArray || isString(source)) {
|
|
5759
|
+
if (sourceIsReactiveArray) {
|
|
5760
|
+
source = shallowReadArray(source);
|
|
5761
|
+
}
|
|
5382
5762
|
ret = new Array(source.length);
|
|
5383
5763
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
5384
|
-
ret[i] = renderItem(
|
|
5764
|
+
ret[i] = renderItem(
|
|
5765
|
+
sourceIsReactiveArray ? toReactive(source[i]) : source[i],
|
|
5766
|
+
i,
|
|
5767
|
+
void 0,
|
|
5768
|
+
cached && cached[i]
|
|
5769
|
+
);
|
|
5385
5770
|
}
|
|
5386
5771
|
} else if (typeof source === "number") {
|
|
5387
5772
|
if (!Number.isInteger(source)) {
|
|
@@ -5752,7 +6137,6 @@ const publicPropertiesMap = (
|
|
|
5752
6137
|
$emit: (i) => i.emit,
|
|
5753
6138
|
$options: (i) => resolveMergedOptions(i) ,
|
|
5754
6139
|
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
5755
|
-
i.effect.dirty = true;
|
|
5756
6140
|
queueJob(i.update);
|
|
5757
6141
|
}),
|
|
5758
6142
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
@@ -6623,7 +7007,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6623
7007
|
return vm;
|
|
6624
7008
|
}
|
|
6625
7009
|
}
|
|
6626
|
-
Vue.version = `2.6.14-compat:${"3.
|
|
7010
|
+
Vue.version = `2.6.14-compat:${"3.5.0-alpha.2"}`;
|
|
6627
7011
|
Vue.config = singletonApp.config;
|
|
6628
7012
|
Vue.use = (plugin, ...options) => {
|
|
6629
7013
|
if (plugin && isFunction(plugin.install)) {
|
|
@@ -7028,6 +7412,7 @@ function createAppAPI(render, hydrate) {
|
|
|
7028
7412
|
}
|
|
7029
7413
|
const context = createAppContext();
|
|
7030
7414
|
const installedPlugins = /* @__PURE__ */ new WeakSet();
|
|
7415
|
+
const pluginCleanupFns = [];
|
|
7031
7416
|
let isMounted = false;
|
|
7032
7417
|
const app = context.app = {
|
|
7033
7418
|
_uid: uid$1++,
|
|
@@ -7145,8 +7530,21 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7145
7530
|
);
|
|
7146
7531
|
}
|
|
7147
7532
|
},
|
|
7533
|
+
onUnmount(cleanupFn) {
|
|
7534
|
+
if (typeof cleanupFn !== "function") {
|
|
7535
|
+
warn$1(
|
|
7536
|
+
`Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
|
|
7537
|
+
);
|
|
7538
|
+
}
|
|
7539
|
+
pluginCleanupFns.push(cleanupFn);
|
|
7540
|
+
},
|
|
7148
7541
|
unmount() {
|
|
7149
7542
|
if (isMounted) {
|
|
7543
|
+
callWithAsyncErrorHandling(
|
|
7544
|
+
pluginCleanupFns,
|
|
7545
|
+
app._instance,
|
|
7546
|
+
15
|
|
7547
|
+
);
|
|
7150
7548
|
render(null, app._container);
|
|
7151
7549
|
{
|
|
7152
7550
|
app._instance = null;
|
|
@@ -7641,7 +8039,9 @@ const isSimpleType = /* @__PURE__ */ makeMap(
|
|
|
7641
8039
|
function assertType(value, type) {
|
|
7642
8040
|
let valid;
|
|
7643
8041
|
const expectedType = getType(type);
|
|
7644
|
-
if (
|
|
8042
|
+
if (expectedType === "null") {
|
|
8043
|
+
valid = value === null;
|
|
8044
|
+
} else if (isSimpleType(expectedType)) {
|
|
7645
8045
|
const t = typeof value;
|
|
7646
8046
|
valid = t === expectedType.toLowerCase();
|
|
7647
8047
|
if (!valid && t === "object") {
|
|
@@ -7651,8 +8051,6 @@ function assertType(value, type) {
|
|
|
7651
8051
|
valid = isObject(value);
|
|
7652
8052
|
} else if (expectedType === "Array") {
|
|
7653
8053
|
valid = isArray(value);
|
|
7654
|
-
} else if (expectedType === "null") {
|
|
7655
|
-
valid = value === null;
|
|
7656
8054
|
} else {
|
|
7657
8055
|
valid = value instanceof type;
|
|
7658
8056
|
}
|
|
@@ -9177,7 +9575,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9177
9575
|
} else {
|
|
9178
9576
|
instance.next = n2;
|
|
9179
9577
|
invalidateJob(instance.update);
|
|
9180
|
-
instance.effect.dirty = true;
|
|
9181
9578
|
instance.update();
|
|
9182
9579
|
}
|
|
9183
9580
|
} else {
|
|
@@ -9384,24 +9781,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9384
9781
|
}
|
|
9385
9782
|
}
|
|
9386
9783
|
};
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
);
|
|
9394
|
-
const update = instance.update = () => {
|
|
9395
|
-
if (effect.dirty) {
|
|
9396
|
-
effect.run();
|
|
9397
|
-
}
|
|
9398
|
-
};
|
|
9399
|
-
update.id = instance.uid;
|
|
9784
|
+
instance.scope.on();
|
|
9785
|
+
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
9786
|
+
instance.scope.off();
|
|
9787
|
+
const update = instance.update = effect.run.bind(effect);
|
|
9788
|
+
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
9789
|
+
job.id = instance.uid;
|
|
9790
|
+
effect.scheduler = () => queueJob(job);
|
|
9400
9791
|
toggleRecurse(instance, true);
|
|
9401
9792
|
{
|
|
9402
9793
|
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
9403
9794
|
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
9404
|
-
|
|
9795
|
+
job.ownerInstance = instance;
|
|
9405
9796
|
}
|
|
9406
9797
|
update();
|
|
9407
9798
|
};
|
|
@@ -9868,7 +10259,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9868
10259
|
if (instance.type.__hmrId) {
|
|
9869
10260
|
unregisterHMR(instance);
|
|
9870
10261
|
}
|
|
9871
|
-
const { bum, scope,
|
|
10262
|
+
const { bum, scope, job, subTree, um } = instance;
|
|
9872
10263
|
if (bum) {
|
|
9873
10264
|
invokeArrayFns(bum);
|
|
9874
10265
|
}
|
|
@@ -9876,8 +10267,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9876
10267
|
instance.emit("hook:beforeDestroy");
|
|
9877
10268
|
}
|
|
9878
10269
|
scope.stop();
|
|
9879
|
-
if (
|
|
9880
|
-
|
|
10270
|
+
if (job) {
|
|
10271
|
+
job.flags |= 8;
|
|
9881
10272
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
9882
10273
|
}
|
|
9883
10274
|
if (um) {
|
|
@@ -9969,8 +10360,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9969
10360
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
9970
10361
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
9971
10362
|
}
|
|
9972
|
-
function toggleRecurse({ effect,
|
|
9973
|
-
|
|
10363
|
+
function toggleRecurse({ effect, job }, allowed) {
|
|
10364
|
+
if (allowed) {
|
|
10365
|
+
effect.flags |= 32;
|
|
10366
|
+
job.flags |= 4;
|
|
10367
|
+
} else {
|
|
10368
|
+
effect.flags &= ~32;
|
|
10369
|
+
job.flags &= ~4;
|
|
10370
|
+
}
|
|
9974
10371
|
}
|
|
9975
10372
|
function needTransition(parentSuspense, transition) {
|
|
9976
10373
|
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
|
@@ -10771,6 +11168,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
10771
11168
|
effect: null,
|
|
10772
11169
|
update: null,
|
|
10773
11170
|
// will be set synchronously right after creation
|
|
11171
|
+
job: null,
|
|
10774
11172
|
scope: new EffectScope(
|
|
10775
11173
|
true
|
|
10776
11174
|
/* detached */
|
|
@@ -11293,7 +11691,8 @@ function initCustomFormatter() {
|
|
|
11293
11691
|
{},
|
|
11294
11692
|
["span", vueStyle, genRefFlag(obj)],
|
|
11295
11693
|
"<",
|
|
11296
|
-
|
|
11694
|
+
// avoid debugger accessing value affecting behavior
|
|
11695
|
+
formatValue("_value" in obj ? obj._value : obj),
|
|
11297
11696
|
`>`
|
|
11298
11697
|
];
|
|
11299
11698
|
} else if (isReactive(obj)) {
|
|
@@ -11473,7 +11872,7 @@ function isMemoSame(cached, memo) {
|
|
|
11473
11872
|
return true;
|
|
11474
11873
|
}
|
|
11475
11874
|
|
|
11476
|
-
const version = "3.
|
|
11875
|
+
const version = "3.5.0-alpha.2";
|
|
11477
11876
|
const warn = warn$1 ;
|
|
11478
11877
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
11479
11878
|
const devtools = devtools$1 ;
|
|
@@ -13028,7 +13427,9 @@ const withKeys = (fn, modifiers) => {
|
|
|
13028
13427
|
return;
|
|
13029
13428
|
}
|
|
13030
13429
|
const eventKey = hyphenate(event.key);
|
|
13031
|
-
if (modifiers.some(
|
|
13430
|
+
if (modifiers.some(
|
|
13431
|
+
(k) => k === eventKey || keyNames[k] === eventKey
|
|
13432
|
+
)) {
|
|
13032
13433
|
return fn(event);
|
|
13033
13434
|
}
|
|
13034
13435
|
{
|
|
@@ -20165,9 +20566,183 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
20165
20566
|
}
|
|
20166
20567
|
};
|
|
20167
20568
|
|
|
20569
|
+
function isValidHTMLNesting(parent, child) {
|
|
20570
|
+
if (parent in onlyValidChildren) {
|
|
20571
|
+
return onlyValidChildren[parent].has(child);
|
|
20572
|
+
}
|
|
20573
|
+
if (child in onlyValidParents) {
|
|
20574
|
+
return onlyValidParents[child].has(parent);
|
|
20575
|
+
}
|
|
20576
|
+
if (parent in knownInvalidChildren) {
|
|
20577
|
+
if (knownInvalidChildren[parent].has(child))
|
|
20578
|
+
return false;
|
|
20579
|
+
}
|
|
20580
|
+
if (child in knownInvalidParents) {
|
|
20581
|
+
if (knownInvalidParents[child].has(parent))
|
|
20582
|
+
return false;
|
|
20583
|
+
}
|
|
20584
|
+
return true;
|
|
20585
|
+
}
|
|
20586
|
+
const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
20587
|
+
const emptySet = /* @__PURE__ */ new Set([]);
|
|
20588
|
+
const onlyValidChildren = {
|
|
20589
|
+
head: /* @__PURE__ */ new Set([
|
|
20590
|
+
"base",
|
|
20591
|
+
"basefront",
|
|
20592
|
+
"bgsound",
|
|
20593
|
+
"link",
|
|
20594
|
+
"meta",
|
|
20595
|
+
"title",
|
|
20596
|
+
"noscript",
|
|
20597
|
+
"noframes",
|
|
20598
|
+
"style",
|
|
20599
|
+
"script",
|
|
20600
|
+
"template"
|
|
20601
|
+
]),
|
|
20602
|
+
optgroup: /* @__PURE__ */ new Set(["option"]),
|
|
20603
|
+
select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
|
|
20604
|
+
// table
|
|
20605
|
+
table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
|
|
20606
|
+
tr: /* @__PURE__ */ new Set(["td", "th"]),
|
|
20607
|
+
colgroup: /* @__PURE__ */ new Set(["col"]),
|
|
20608
|
+
tbody: /* @__PURE__ */ new Set(["tr"]),
|
|
20609
|
+
thead: /* @__PURE__ */ new Set(["tr"]),
|
|
20610
|
+
tfoot: /* @__PURE__ */ new Set(["tr"]),
|
|
20611
|
+
// these elements can not have any children elements
|
|
20612
|
+
script: emptySet,
|
|
20613
|
+
iframe: emptySet,
|
|
20614
|
+
option: emptySet,
|
|
20615
|
+
textarea: emptySet,
|
|
20616
|
+
style: emptySet,
|
|
20617
|
+
title: emptySet
|
|
20618
|
+
};
|
|
20619
|
+
const onlyValidParents = {
|
|
20620
|
+
// sections
|
|
20621
|
+
html: emptySet,
|
|
20622
|
+
body: /* @__PURE__ */ new Set(["html"]),
|
|
20623
|
+
head: /* @__PURE__ */ new Set(["html"]),
|
|
20624
|
+
// table
|
|
20625
|
+
td: /* @__PURE__ */ new Set(["tr"]),
|
|
20626
|
+
colgroup: /* @__PURE__ */ new Set(["table"]),
|
|
20627
|
+
caption: /* @__PURE__ */ new Set(["table"]),
|
|
20628
|
+
tbody: /* @__PURE__ */ new Set(["table"]),
|
|
20629
|
+
tfoot: /* @__PURE__ */ new Set(["table"]),
|
|
20630
|
+
col: /* @__PURE__ */ new Set(["colgroup"]),
|
|
20631
|
+
th: /* @__PURE__ */ new Set(["tr"]),
|
|
20632
|
+
thead: /* @__PURE__ */ new Set(["table"]),
|
|
20633
|
+
tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
|
|
20634
|
+
// data list
|
|
20635
|
+
dd: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
20636
|
+
dt: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
20637
|
+
// other
|
|
20638
|
+
figcaption: /* @__PURE__ */ new Set(["figure"]),
|
|
20639
|
+
// li: new Set(["ul", "ol"]),
|
|
20640
|
+
summary: /* @__PURE__ */ new Set(["details"]),
|
|
20641
|
+
area: /* @__PURE__ */ new Set(["map"])
|
|
20642
|
+
};
|
|
20643
|
+
const knownInvalidChildren = {
|
|
20644
|
+
p: /* @__PURE__ */ new Set([
|
|
20645
|
+
"address",
|
|
20646
|
+
"article",
|
|
20647
|
+
"aside",
|
|
20648
|
+
"blockquote",
|
|
20649
|
+
"center",
|
|
20650
|
+
"details",
|
|
20651
|
+
"dialog",
|
|
20652
|
+
"dir",
|
|
20653
|
+
"div",
|
|
20654
|
+
"dl",
|
|
20655
|
+
"fieldset",
|
|
20656
|
+
"figure",
|
|
20657
|
+
"footer",
|
|
20658
|
+
"form",
|
|
20659
|
+
"h1",
|
|
20660
|
+
"h2",
|
|
20661
|
+
"h3",
|
|
20662
|
+
"h4",
|
|
20663
|
+
"h5",
|
|
20664
|
+
"h6",
|
|
20665
|
+
"header",
|
|
20666
|
+
"hgroup",
|
|
20667
|
+
"hr",
|
|
20668
|
+
"li",
|
|
20669
|
+
"main",
|
|
20670
|
+
"nav",
|
|
20671
|
+
"menu",
|
|
20672
|
+
"ol",
|
|
20673
|
+
"p",
|
|
20674
|
+
"pre",
|
|
20675
|
+
"section",
|
|
20676
|
+
"table",
|
|
20677
|
+
"ul"
|
|
20678
|
+
]),
|
|
20679
|
+
svg: /* @__PURE__ */ new Set([
|
|
20680
|
+
"b",
|
|
20681
|
+
"blockquote",
|
|
20682
|
+
"br",
|
|
20683
|
+
"code",
|
|
20684
|
+
"dd",
|
|
20685
|
+
"div",
|
|
20686
|
+
"dl",
|
|
20687
|
+
"dt",
|
|
20688
|
+
"em",
|
|
20689
|
+
"embed",
|
|
20690
|
+
"h1",
|
|
20691
|
+
"h2",
|
|
20692
|
+
"h3",
|
|
20693
|
+
"h4",
|
|
20694
|
+
"h5",
|
|
20695
|
+
"h6",
|
|
20696
|
+
"hr",
|
|
20697
|
+
"i",
|
|
20698
|
+
"img",
|
|
20699
|
+
"li",
|
|
20700
|
+
"menu",
|
|
20701
|
+
"meta",
|
|
20702
|
+
"ol",
|
|
20703
|
+
"p",
|
|
20704
|
+
"pre",
|
|
20705
|
+
"ruby",
|
|
20706
|
+
"s",
|
|
20707
|
+
"small",
|
|
20708
|
+
"span",
|
|
20709
|
+
"strong",
|
|
20710
|
+
"sub",
|
|
20711
|
+
"sup",
|
|
20712
|
+
"table",
|
|
20713
|
+
"u",
|
|
20714
|
+
"ul",
|
|
20715
|
+
"var"
|
|
20716
|
+
])
|
|
20717
|
+
};
|
|
20718
|
+
const knownInvalidParents = {
|
|
20719
|
+
a: /* @__PURE__ */ new Set(["a"]),
|
|
20720
|
+
button: /* @__PURE__ */ new Set(["button"]),
|
|
20721
|
+
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
20722
|
+
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
20723
|
+
form: /* @__PURE__ */ new Set(["form"]),
|
|
20724
|
+
li: /* @__PURE__ */ new Set(["li"]),
|
|
20725
|
+
h1: headings,
|
|
20726
|
+
h2: headings,
|
|
20727
|
+
h3: headings,
|
|
20728
|
+
h4: headings,
|
|
20729
|
+
h5: headings,
|
|
20730
|
+
h6: headings
|
|
20731
|
+
};
|
|
20732
|
+
|
|
20733
|
+
const validateHtmlNesting = (node, context) => {
|
|
20734
|
+
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
|
|
20735
|
+
const error = new SyntaxError(
|
|
20736
|
+
`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
|
|
20737
|
+
);
|
|
20738
|
+
error.loc = node.loc;
|
|
20739
|
+
context.onWarn(error);
|
|
20740
|
+
}
|
|
20741
|
+
};
|
|
20742
|
+
|
|
20168
20743
|
const DOMNodeTransforms = [
|
|
20169
20744
|
transformStyle,
|
|
20170
|
-
...[transformTransition]
|
|
20745
|
+
...[transformTransition, validateHtmlNesting]
|
|
20171
20746
|
];
|
|
20172
20747
|
const DOMDirectiveTransforms = {
|
|
20173
20748
|
cloak: noopDirectiveTransform,
|