@vue/compat 3.4.26 → 3.5.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue.cjs.js +1022 -463
- package/dist/vue.cjs.prod.js +813 -449
- package/dist/vue.esm-browser.js +1020 -462
- package/dist/vue.esm-browser.prod.js +6 -6
- package/dist/vue.esm-bundler.js +1032 -464
- package/dist/vue.global.js +1020 -462
- package/dist/vue.global.prod.js +6 -6
- package/dist/vue.runtime.esm-browser.js +834 -454
- package/dist/vue.runtime.esm-browser.prod.js +6 -6
- package/dist/vue.runtime.esm-bundler.js +846 -456
- package/dist/vue.runtime.global.js +834 -454
- 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.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -88,11 +88,10 @@ const invokeArrayFns = (fns, arg) => {
|
|
|
88
88
|
fns[i](arg);
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
const def = (obj, key, value
|
|
91
|
+
const def = (obj, key, value) => {
|
|
92
92
|
Object.defineProperty(obj, key, {
|
|
93
93
|
configurable: true,
|
|
94
94
|
enumerable: false,
|
|
95
|
-
writable,
|
|
96
95
|
value
|
|
97
96
|
});
|
|
98
97
|
};
|
|
@@ -501,156 +500,280 @@ class EffectScope {
|
|
|
501
500
|
function effectScope(detached) {
|
|
502
501
|
return new EffectScope(detached);
|
|
503
502
|
}
|
|
504
|
-
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
505
|
-
if (scope && scope.active) {
|
|
506
|
-
scope.effects.push(effect);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
503
|
function getCurrentScope() {
|
|
510
504
|
return activeEffectScope;
|
|
511
505
|
}
|
|
512
|
-
function onScopeDispose(fn) {
|
|
506
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
513
507
|
if (activeEffectScope) {
|
|
514
508
|
activeEffectScope.cleanups.push(fn);
|
|
515
|
-
} else {
|
|
509
|
+
} else if (!failSilently) {
|
|
516
510
|
warn$2(
|
|
517
511
|
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
518
512
|
);
|
|
519
513
|
}
|
|
520
514
|
}
|
|
521
515
|
|
|
522
|
-
let
|
|
516
|
+
let activeSub;
|
|
523
517
|
class ReactiveEffect {
|
|
524
|
-
constructor(fn
|
|
518
|
+
constructor(fn) {
|
|
525
519
|
this.fn = fn;
|
|
526
|
-
this.trigger = trigger;
|
|
527
|
-
this.scheduler = scheduler;
|
|
528
|
-
this.active = true;
|
|
529
|
-
this.deps = [];
|
|
530
520
|
/**
|
|
531
521
|
* @internal
|
|
532
522
|
*/
|
|
533
|
-
this.
|
|
523
|
+
this.deps = void 0;
|
|
534
524
|
/**
|
|
535
525
|
* @internal
|
|
536
526
|
*/
|
|
537
|
-
this.
|
|
527
|
+
this.depsTail = void 0;
|
|
538
528
|
/**
|
|
539
529
|
* @internal
|
|
540
530
|
*/
|
|
541
|
-
this.
|
|
531
|
+
this.flags = 1 | 4;
|
|
542
532
|
/**
|
|
543
533
|
* @internal
|
|
544
534
|
*/
|
|
545
|
-
this.
|
|
535
|
+
this.nextEffect = void 0;
|
|
546
536
|
/**
|
|
547
537
|
* @internal
|
|
548
538
|
*/
|
|
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();
|
|
539
|
+
this.cleanup = void 0;
|
|
540
|
+
this.scheduler = void 0;
|
|
541
|
+
if (activeEffectScope && activeEffectScope.active) {
|
|
542
|
+
activeEffectScope.effects.push(this);
|
|
569
543
|
}
|
|
570
|
-
return this._dirtyLevel >= 4;
|
|
571
544
|
}
|
|
572
|
-
|
|
573
|
-
|
|
545
|
+
/**
|
|
546
|
+
* @internal
|
|
547
|
+
*/
|
|
548
|
+
notify() {
|
|
549
|
+
if (this.flags & 2 && !(this.flags & 32)) {
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
if (this.flags & 64) {
|
|
553
|
+
return this.trigger();
|
|
554
|
+
}
|
|
555
|
+
if (!(this.flags & 8)) {
|
|
556
|
+
this.flags |= 8;
|
|
557
|
+
this.nextEffect = batchedEffect;
|
|
558
|
+
batchedEffect = this;
|
|
559
|
+
}
|
|
574
560
|
}
|
|
575
561
|
run() {
|
|
576
|
-
this.
|
|
577
|
-
if (!this.active) {
|
|
562
|
+
if (!(this.flags & 1)) {
|
|
578
563
|
return this.fn();
|
|
579
564
|
}
|
|
580
|
-
|
|
581
|
-
|
|
565
|
+
this.flags |= 2;
|
|
566
|
+
cleanupEffect(this);
|
|
567
|
+
prepareDeps(this);
|
|
568
|
+
const prevEffect = activeSub;
|
|
569
|
+
const prevShouldTrack = shouldTrack;
|
|
570
|
+
activeSub = this;
|
|
571
|
+
shouldTrack = true;
|
|
582
572
|
try {
|
|
583
|
-
shouldTrack = true;
|
|
584
|
-
activeEffect = this;
|
|
585
|
-
this._runnings++;
|
|
586
|
-
preCleanupEffect(this);
|
|
587
573
|
return this.fn();
|
|
588
574
|
} finally {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
575
|
+
if (activeSub !== this) {
|
|
576
|
+
warn$2(
|
|
577
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
cleanupDeps(this);
|
|
581
|
+
activeSub = prevEffect;
|
|
582
|
+
shouldTrack = prevShouldTrack;
|
|
583
|
+
this.flags &= ~2;
|
|
593
584
|
}
|
|
594
585
|
}
|
|
595
586
|
stop() {
|
|
596
|
-
if (this.
|
|
597
|
-
|
|
598
|
-
|
|
587
|
+
if (this.flags & 1) {
|
|
588
|
+
for (let link = this.deps; link; link = link.nextDep) {
|
|
589
|
+
removeSub(link);
|
|
590
|
+
}
|
|
591
|
+
this.deps = this.depsTail = void 0;
|
|
592
|
+
cleanupEffect(this);
|
|
599
593
|
this.onStop && this.onStop();
|
|
600
|
-
this.
|
|
594
|
+
this.flags &= ~1;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
trigger() {
|
|
598
|
+
if (this.scheduler) {
|
|
599
|
+
this.scheduler();
|
|
600
|
+
} else {
|
|
601
|
+
this.runIfDirty();
|
|
601
602
|
}
|
|
602
603
|
}
|
|
604
|
+
/**
|
|
605
|
+
* @internal
|
|
606
|
+
*/
|
|
607
|
+
runIfDirty() {
|
|
608
|
+
if (isDirty(this)) {
|
|
609
|
+
this.run();
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
get dirty() {
|
|
613
|
+
return isDirty(this);
|
|
614
|
+
}
|
|
603
615
|
}
|
|
604
|
-
|
|
605
|
-
|
|
616
|
+
let batchDepth = 0;
|
|
617
|
+
let batchedEffect;
|
|
618
|
+
function startBatch() {
|
|
619
|
+
batchDepth++;
|
|
606
620
|
}
|
|
607
|
-
function
|
|
608
|
-
|
|
609
|
-
|
|
621
|
+
function endBatch() {
|
|
622
|
+
if (batchDepth > 1) {
|
|
623
|
+
batchDepth--;
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
let error;
|
|
627
|
+
while (batchedEffect) {
|
|
628
|
+
let e = batchedEffect;
|
|
629
|
+
batchedEffect = void 0;
|
|
630
|
+
while (e) {
|
|
631
|
+
const next = e.nextEffect;
|
|
632
|
+
e.nextEffect = void 0;
|
|
633
|
+
e.flags &= ~8;
|
|
634
|
+
if (e.flags & 1) {
|
|
635
|
+
try {
|
|
636
|
+
e.trigger();
|
|
637
|
+
} catch (err) {
|
|
638
|
+
if (!error)
|
|
639
|
+
error = err;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
e = next;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
batchDepth--;
|
|
646
|
+
if (error)
|
|
647
|
+
throw error;
|
|
648
|
+
}
|
|
649
|
+
function prepareDeps(sub) {
|
|
650
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
651
|
+
link.version = -1;
|
|
652
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
653
|
+
link.dep.activeLink = link;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
function cleanupDeps(sub) {
|
|
657
|
+
let head;
|
|
658
|
+
let tail = sub.depsTail;
|
|
659
|
+
for (let link = tail; link; link = link.prevDep) {
|
|
660
|
+
if (link.version === -1) {
|
|
661
|
+
if (link === tail)
|
|
662
|
+
tail = link.prevDep;
|
|
663
|
+
removeSub(link);
|
|
664
|
+
removeDep(link);
|
|
665
|
+
} else {
|
|
666
|
+
head = link;
|
|
667
|
+
}
|
|
668
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
669
|
+
link.prevActiveLink = void 0;
|
|
670
|
+
}
|
|
671
|
+
sub.deps = head;
|
|
672
|
+
sub.depsTail = tail;
|
|
673
|
+
}
|
|
674
|
+
function isDirty(sub) {
|
|
675
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
676
|
+
if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
|
|
677
|
+
return true;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
if (sub._dirty) {
|
|
681
|
+
return true;
|
|
682
|
+
}
|
|
683
|
+
return false;
|
|
610
684
|
}
|
|
611
|
-
function
|
|
612
|
-
if (
|
|
613
|
-
|
|
614
|
-
|
|
685
|
+
function refreshComputed(computed) {
|
|
686
|
+
if (computed.flags & 2) {
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
computed.flags &= ~16;
|
|
693
|
+
if (computed.globalVersion === globalVersion) {
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
computed.globalVersion = globalVersion;
|
|
697
|
+
const dep = computed.dep;
|
|
698
|
+
computed.flags |= 2;
|
|
699
|
+
if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
|
|
700
|
+
computed.flags &= ~2;
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
const prevSub = activeSub;
|
|
704
|
+
const prevShouldTrack = shouldTrack;
|
|
705
|
+
activeSub = computed;
|
|
706
|
+
shouldTrack = true;
|
|
707
|
+
try {
|
|
708
|
+
prepareDeps(computed);
|
|
709
|
+
const value = computed.fn();
|
|
710
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
711
|
+
computed._value = value;
|
|
712
|
+
dep.version++;
|
|
615
713
|
}
|
|
616
|
-
|
|
714
|
+
} catch (err) {
|
|
715
|
+
dep.version++;
|
|
716
|
+
throw err;
|
|
717
|
+
} finally {
|
|
718
|
+
activeSub = prevSub;
|
|
719
|
+
shouldTrack = prevShouldTrack;
|
|
720
|
+
cleanupDeps(computed);
|
|
721
|
+
computed.flags &= ~2;
|
|
617
722
|
}
|
|
618
723
|
}
|
|
619
|
-
function
|
|
620
|
-
const
|
|
621
|
-
if (
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
724
|
+
function removeSub(link) {
|
|
725
|
+
const { dep, prevSub, nextSub } = link;
|
|
726
|
+
if (prevSub) {
|
|
727
|
+
prevSub.nextSub = nextSub;
|
|
728
|
+
link.prevSub = void 0;
|
|
729
|
+
}
|
|
730
|
+
if (nextSub) {
|
|
731
|
+
nextSub.prevSub = prevSub;
|
|
732
|
+
link.nextSub = void 0;
|
|
733
|
+
}
|
|
734
|
+
if (dep.subs === link) {
|
|
735
|
+
dep.subs = prevSub;
|
|
736
|
+
}
|
|
737
|
+
if (!dep.subs && dep.computed) {
|
|
738
|
+
dep.computed.flags &= ~4;
|
|
739
|
+
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
740
|
+
removeSub(l);
|
|
625
741
|
}
|
|
626
742
|
}
|
|
627
743
|
}
|
|
744
|
+
function removeDep(link) {
|
|
745
|
+
const { prevDep, nextDep } = link;
|
|
746
|
+
if (prevDep) {
|
|
747
|
+
prevDep.nextDep = nextDep;
|
|
748
|
+
link.prevDep = void 0;
|
|
749
|
+
}
|
|
750
|
+
if (nextDep) {
|
|
751
|
+
nextDep.prevDep = prevDep;
|
|
752
|
+
link.nextDep = void 0;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
628
755
|
function effect(fn, options) {
|
|
629
756
|
if (fn.effect instanceof ReactiveEffect) {
|
|
630
757
|
fn = fn.effect.fn;
|
|
631
758
|
}
|
|
632
|
-
const
|
|
633
|
-
if (_effect.dirty) {
|
|
634
|
-
_effect.run();
|
|
635
|
-
}
|
|
636
|
-
});
|
|
759
|
+
const e = new ReactiveEffect(fn);
|
|
637
760
|
if (options) {
|
|
638
|
-
extend(
|
|
639
|
-
if (options.scope)
|
|
640
|
-
recordEffectScope(_effect, options.scope);
|
|
761
|
+
extend(e, options);
|
|
641
762
|
}
|
|
642
|
-
|
|
643
|
-
|
|
763
|
+
try {
|
|
764
|
+
e.run();
|
|
765
|
+
} catch (err) {
|
|
766
|
+
e.stop();
|
|
767
|
+
throw err;
|
|
644
768
|
}
|
|
645
|
-
const runner =
|
|
646
|
-
runner.effect =
|
|
769
|
+
const runner = e.run.bind(e);
|
|
770
|
+
runner.effect = e;
|
|
647
771
|
return runner;
|
|
648
772
|
}
|
|
649
773
|
function stop(runner) {
|
|
650
774
|
runner.effect.stop();
|
|
651
775
|
}
|
|
652
776
|
let shouldTrack = true;
|
|
653
|
-
let pauseScheduleStack = 0;
|
|
654
777
|
const trackStack = [];
|
|
655
778
|
function pauseTracking() {
|
|
656
779
|
trackStack.push(shouldTrack);
|
|
@@ -660,192 +783,414 @@ function resetTracking() {
|
|
|
660
783
|
const last = trackStack.pop();
|
|
661
784
|
shouldTrack = last === void 0 ? true : last;
|
|
662
785
|
}
|
|
663
|
-
function
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
786
|
+
function cleanupEffect(e) {
|
|
787
|
+
const { cleanup } = e;
|
|
788
|
+
e.cleanup = void 0;
|
|
789
|
+
if (cleanup) {
|
|
790
|
+
const prevSub = activeSub;
|
|
791
|
+
activeSub = void 0;
|
|
792
|
+
try {
|
|
793
|
+
cleanup();
|
|
794
|
+
} finally {
|
|
795
|
+
activeSub = prevSub;
|
|
796
|
+
}
|
|
670
797
|
}
|
|
671
798
|
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
799
|
+
|
|
800
|
+
let globalVersion = 0;
|
|
801
|
+
class Dep {
|
|
802
|
+
constructor(computed) {
|
|
803
|
+
this.computed = computed;
|
|
804
|
+
this.version = 0;
|
|
805
|
+
/**
|
|
806
|
+
* Link between this dep and the current active effect
|
|
807
|
+
*/
|
|
808
|
+
this.activeLink = void 0;
|
|
809
|
+
/**
|
|
810
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
811
|
+
*/
|
|
812
|
+
this.subs = void 0;
|
|
685
813
|
{
|
|
686
|
-
|
|
814
|
+
this.subsHead = void 0;
|
|
687
815
|
}
|
|
688
816
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
817
|
+
track(debugInfo) {
|
|
818
|
+
if (!activeSub || !shouldTrack) {
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
let link = this.activeLink;
|
|
822
|
+
if (link === void 0 || link.sub !== activeSub) {
|
|
823
|
+
link = this.activeLink = {
|
|
824
|
+
dep: this,
|
|
825
|
+
sub: activeSub,
|
|
826
|
+
version: this.version,
|
|
827
|
+
nextDep: void 0,
|
|
828
|
+
prevDep: void 0,
|
|
829
|
+
nextSub: void 0,
|
|
830
|
+
prevSub: void 0,
|
|
831
|
+
prevActiveLink: void 0
|
|
832
|
+
};
|
|
833
|
+
if (!activeSub.deps) {
|
|
834
|
+
activeSub.deps = activeSub.depsTail = link;
|
|
835
|
+
} else {
|
|
836
|
+
link.prevDep = activeSub.depsTail;
|
|
837
|
+
activeSub.depsTail.nextDep = link;
|
|
838
|
+
activeSub.depsTail = link;
|
|
839
|
+
}
|
|
840
|
+
if (activeSub.flags & 4) {
|
|
841
|
+
addSub(link);
|
|
842
|
+
}
|
|
843
|
+
} else if (link.version === -1) {
|
|
844
|
+
link.version = this.version;
|
|
845
|
+
if (link.nextDep) {
|
|
846
|
+
const next = link.nextDep;
|
|
847
|
+
next.prevDep = link.prevDep;
|
|
848
|
+
if (link.prevDep) {
|
|
849
|
+
link.prevDep.nextDep = next;
|
|
850
|
+
}
|
|
851
|
+
link.prevDep = activeSub.depsTail;
|
|
852
|
+
link.nextDep = void 0;
|
|
853
|
+
activeSub.depsTail.nextDep = link;
|
|
854
|
+
activeSub.depsTail = link;
|
|
855
|
+
if (activeSub.deps === link) {
|
|
856
|
+
activeSub.deps = next;
|
|
857
|
+
}
|
|
703
858
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
859
|
+
}
|
|
860
|
+
if (activeSub.onTrack) {
|
|
861
|
+
activeSub.onTrack(
|
|
862
|
+
extend(
|
|
863
|
+
{
|
|
864
|
+
effect: activeSub
|
|
865
|
+
},
|
|
866
|
+
debugInfo
|
|
867
|
+
)
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
return link;
|
|
871
|
+
}
|
|
872
|
+
trigger(debugInfo) {
|
|
873
|
+
this.version++;
|
|
874
|
+
globalVersion++;
|
|
875
|
+
this.notify(debugInfo);
|
|
876
|
+
}
|
|
877
|
+
notify(debugInfo) {
|
|
878
|
+
startBatch();
|
|
879
|
+
try {
|
|
880
|
+
if (true) {
|
|
881
|
+
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
882
|
+
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
883
|
+
head.sub.onTrigger(
|
|
884
|
+
extend(
|
|
885
|
+
{
|
|
886
|
+
effect: head.sub
|
|
887
|
+
},
|
|
888
|
+
debugInfo
|
|
889
|
+
)
|
|
890
|
+
);
|
|
891
|
+
}
|
|
709
892
|
}
|
|
710
893
|
}
|
|
894
|
+
for (let link = this.subs; link; link = link.prevSub) {
|
|
895
|
+
link.sub.notify();
|
|
896
|
+
}
|
|
897
|
+
} finally {
|
|
898
|
+
endBatch();
|
|
711
899
|
}
|
|
712
900
|
}
|
|
713
|
-
resetScheduling();
|
|
714
901
|
}
|
|
715
|
-
|
|
716
|
-
const
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
}
|
|
722
|
-
|
|
902
|
+
function addSub(link) {
|
|
903
|
+
const computed = link.dep.computed;
|
|
904
|
+
if (computed && !link.dep.subs) {
|
|
905
|
+
computed.flags |= 4 | 16;
|
|
906
|
+
for (let l = computed.deps; l; l = l.nextDep) {
|
|
907
|
+
addSub(l);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
const currentTail = link.dep.subs;
|
|
911
|
+
if (currentTail !== link) {
|
|
912
|
+
link.prevSub = currentTail;
|
|
913
|
+
if (currentTail)
|
|
914
|
+
currentTail.nextSub = link;
|
|
915
|
+
}
|
|
916
|
+
if (link.dep.subsHead === void 0) {
|
|
917
|
+
link.dep.subsHead = link;
|
|
918
|
+
}
|
|
919
|
+
link.dep.subs = link;
|
|
920
|
+
}
|
|
723
921
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
724
|
-
const ITERATE_KEY = Symbol("iterate" );
|
|
725
|
-
const MAP_KEY_ITERATE_KEY = Symbol("Map
|
|
922
|
+
const ITERATE_KEY = Symbol("Object iterate" );
|
|
923
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
|
|
924
|
+
const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
|
|
726
925
|
function track(target, type, key) {
|
|
727
|
-
if (shouldTrack &&
|
|
926
|
+
if (shouldTrack && activeSub) {
|
|
728
927
|
let depsMap = targetMap.get(target);
|
|
729
928
|
if (!depsMap) {
|
|
730
929
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
731
930
|
}
|
|
732
931
|
let dep = depsMap.get(key);
|
|
733
932
|
if (!dep) {
|
|
734
|
-
depsMap.set(key, dep =
|
|
933
|
+
depsMap.set(key, dep = new Dep());
|
|
735
934
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
dep,
|
|
739
|
-
{
|
|
935
|
+
{
|
|
936
|
+
dep.track({
|
|
740
937
|
target,
|
|
741
938
|
type,
|
|
742
939
|
key
|
|
743
|
-
}
|
|
744
|
-
|
|
940
|
+
});
|
|
941
|
+
}
|
|
745
942
|
}
|
|
746
943
|
}
|
|
747
944
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
748
945
|
const depsMap = targetMap.get(target);
|
|
749
946
|
if (!depsMap) {
|
|
947
|
+
globalVersion++;
|
|
750
948
|
return;
|
|
751
949
|
}
|
|
752
950
|
let deps = [];
|
|
753
951
|
if (type === "clear") {
|
|
754
952
|
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
953
|
} 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"));
|
|
954
|
+
const targetIsArray = isArray(target);
|
|
955
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
956
|
+
if (targetIsArray && key === "length") {
|
|
957
|
+
const newLength = Number(newValue);
|
|
958
|
+
depsMap.forEach((dep, key2) => {
|
|
959
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
960
|
+
deps.push(dep);
|
|
775
961
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
962
|
+
});
|
|
963
|
+
} else {
|
|
964
|
+
const push = (dep) => dep && deps.push(dep);
|
|
965
|
+
if (key !== void 0) {
|
|
966
|
+
push(depsMap.get(key));
|
|
967
|
+
}
|
|
968
|
+
if (isArrayIndex) {
|
|
969
|
+
push(depsMap.get(ARRAY_ITERATE_KEY));
|
|
970
|
+
}
|
|
971
|
+
switch (type) {
|
|
972
|
+
case "add":
|
|
973
|
+
if (!targetIsArray) {
|
|
974
|
+
push(depsMap.get(ITERATE_KEY));
|
|
975
|
+
if (isMap(target)) {
|
|
976
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
977
|
+
}
|
|
978
|
+
} else if (isArrayIndex) {
|
|
979
|
+
push(depsMap.get("length"));
|
|
980
|
+
}
|
|
981
|
+
break;
|
|
982
|
+
case "delete":
|
|
983
|
+
if (!targetIsArray) {
|
|
984
|
+
push(depsMap.get(ITERATE_KEY));
|
|
985
|
+
if (isMap(target)) {
|
|
986
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
break;
|
|
990
|
+
case "set":
|
|
780
991
|
if (isMap(target)) {
|
|
781
|
-
|
|
992
|
+
push(depsMap.get(ITERATE_KEY));
|
|
782
993
|
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
case "set":
|
|
786
|
-
if (isMap(target)) {
|
|
787
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
788
|
-
}
|
|
789
|
-
break;
|
|
994
|
+
break;
|
|
995
|
+
}
|
|
790
996
|
}
|
|
791
997
|
}
|
|
792
|
-
|
|
998
|
+
startBatch();
|
|
793
999
|
for (const dep of deps) {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
oldValue,
|
|
804
|
-
oldTarget
|
|
805
|
-
}
|
|
806
|
-
);
|
|
1000
|
+
{
|
|
1001
|
+
dep.trigger({
|
|
1002
|
+
target,
|
|
1003
|
+
type,
|
|
1004
|
+
key,
|
|
1005
|
+
newValue,
|
|
1006
|
+
oldValue,
|
|
1007
|
+
oldTarget
|
|
1008
|
+
});
|
|
807
1009
|
}
|
|
808
1010
|
}
|
|
809
|
-
|
|
1011
|
+
endBatch();
|
|
810
1012
|
}
|
|
811
1013
|
function getDepFromReactive(object, key) {
|
|
812
|
-
|
|
813
|
-
return
|
|
1014
|
+
var _a;
|
|
1015
|
+
return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
function reactiveReadArray(array) {
|
|
1019
|
+
const raw = toRaw(array);
|
|
1020
|
+
if (raw === array)
|
|
1021
|
+
return raw;
|
|
1022
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
1023
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
1024
|
+
}
|
|
1025
|
+
function shallowReadArray(arr) {
|
|
1026
|
+
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
1027
|
+
return arr;
|
|
1028
|
+
}
|
|
1029
|
+
const arrayInstrumentations = {
|
|
1030
|
+
__proto__: null,
|
|
1031
|
+
[Symbol.iterator]() {
|
|
1032
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
1033
|
+
},
|
|
1034
|
+
concat(...args) {
|
|
1035
|
+
return reactiveReadArray(this).concat(
|
|
1036
|
+
...args.map((x) => reactiveReadArray(x))
|
|
1037
|
+
);
|
|
1038
|
+
},
|
|
1039
|
+
entries() {
|
|
1040
|
+
return iterator(this, "entries", (value) => {
|
|
1041
|
+
value[1] = toReactive(value[1]);
|
|
1042
|
+
return value;
|
|
1043
|
+
});
|
|
1044
|
+
},
|
|
1045
|
+
every(fn, thisArg) {
|
|
1046
|
+
return apply(this, "every", fn, thisArg);
|
|
1047
|
+
},
|
|
1048
|
+
filter(fn, thisArg) {
|
|
1049
|
+
const result = apply(this, "filter", fn, thisArg);
|
|
1050
|
+
return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
|
|
1051
|
+
},
|
|
1052
|
+
find(fn, thisArg) {
|
|
1053
|
+
const result = apply(this, "find", fn, thisArg);
|
|
1054
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
1055
|
+
},
|
|
1056
|
+
findIndex(fn, thisArg) {
|
|
1057
|
+
return apply(this, "findIndex", fn, thisArg);
|
|
1058
|
+
},
|
|
1059
|
+
findLast(fn, thisArg) {
|
|
1060
|
+
const result = apply(this, "findLast", fn, thisArg);
|
|
1061
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
1062
|
+
},
|
|
1063
|
+
findLastIndex(fn, thisArg) {
|
|
1064
|
+
return apply(this, "findLastIndex", fn, thisArg);
|
|
1065
|
+
},
|
|
1066
|
+
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
1067
|
+
forEach(fn, thisArg) {
|
|
1068
|
+
return apply(this, "forEach", fn, thisArg);
|
|
1069
|
+
},
|
|
1070
|
+
includes(...args) {
|
|
1071
|
+
return searchProxy(this, "includes", args);
|
|
1072
|
+
},
|
|
1073
|
+
indexOf(...args) {
|
|
1074
|
+
return searchProxy(this, "indexOf", args);
|
|
1075
|
+
},
|
|
1076
|
+
join(separator) {
|
|
1077
|
+
return reactiveReadArray(this).join(separator);
|
|
1078
|
+
},
|
|
1079
|
+
// keys() iterator only reads `length`, no optimisation required
|
|
1080
|
+
lastIndexOf(...args) {
|
|
1081
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
1082
|
+
},
|
|
1083
|
+
map(fn, thisArg) {
|
|
1084
|
+
return apply(this, "map", fn, thisArg);
|
|
1085
|
+
},
|
|
1086
|
+
pop() {
|
|
1087
|
+
return noTracking(this, "pop");
|
|
1088
|
+
},
|
|
1089
|
+
push(...args) {
|
|
1090
|
+
return noTracking(this, "push", args);
|
|
1091
|
+
},
|
|
1092
|
+
reduce(fn, ...args) {
|
|
1093
|
+
return reduce(this, "reduce", fn, args);
|
|
1094
|
+
},
|
|
1095
|
+
reduceRight(fn, ...args) {
|
|
1096
|
+
return reduce(this, "reduceRight", fn, args);
|
|
1097
|
+
},
|
|
1098
|
+
shift() {
|
|
1099
|
+
return noTracking(this, "shift");
|
|
1100
|
+
},
|
|
1101
|
+
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
1102
|
+
some(fn, thisArg) {
|
|
1103
|
+
return apply(this, "some", fn, thisArg);
|
|
1104
|
+
},
|
|
1105
|
+
splice(...args) {
|
|
1106
|
+
return noTracking(this, "splice", args);
|
|
1107
|
+
},
|
|
1108
|
+
toReversed() {
|
|
1109
|
+
return reactiveReadArray(this).toReversed();
|
|
1110
|
+
},
|
|
1111
|
+
toSorted(comparer) {
|
|
1112
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
1113
|
+
},
|
|
1114
|
+
toSpliced(...args) {
|
|
1115
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
1116
|
+
},
|
|
1117
|
+
unshift(...args) {
|
|
1118
|
+
return noTracking(this, "unshift", args);
|
|
1119
|
+
},
|
|
1120
|
+
values() {
|
|
1121
|
+
return iterator(this, "values", toReactive);
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1124
|
+
function iterator(self, method, wrapValue) {
|
|
1125
|
+
const arr = shallowReadArray(self);
|
|
1126
|
+
const iter = arr[method]();
|
|
1127
|
+
if (arr !== self && !isShallow(self)) {
|
|
1128
|
+
iter._next = iter.next;
|
|
1129
|
+
iter.next = () => {
|
|
1130
|
+
const result = iter._next();
|
|
1131
|
+
if (result.value) {
|
|
1132
|
+
result.value = wrapValue(result.value);
|
|
1133
|
+
}
|
|
1134
|
+
return result;
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
return iter;
|
|
1138
|
+
}
|
|
1139
|
+
function apply(self, method, fn, thisArg) {
|
|
1140
|
+
const arr = shallowReadArray(self);
|
|
1141
|
+
let wrappedFn = fn;
|
|
1142
|
+
if (arr !== self) {
|
|
1143
|
+
if (!isShallow(self)) {
|
|
1144
|
+
wrappedFn = function(item, index) {
|
|
1145
|
+
return fn.call(this, toReactive(item), index, self);
|
|
1146
|
+
};
|
|
1147
|
+
} else if (fn.length > 2) {
|
|
1148
|
+
wrappedFn = function(item, index) {
|
|
1149
|
+
return fn.call(this, item, index, self);
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
return arr[method](wrappedFn, thisArg);
|
|
1154
|
+
}
|
|
1155
|
+
function reduce(self, method, fn, args) {
|
|
1156
|
+
const arr = shallowReadArray(self);
|
|
1157
|
+
let wrappedFn = fn;
|
|
1158
|
+
if (arr !== self) {
|
|
1159
|
+
if (!isShallow(self)) {
|
|
1160
|
+
wrappedFn = function(acc, item, index) {
|
|
1161
|
+
return fn.call(this, acc, toReactive(item), index, self);
|
|
1162
|
+
};
|
|
1163
|
+
} else if (fn.length > 3) {
|
|
1164
|
+
wrappedFn = function(acc, item, index) {
|
|
1165
|
+
return fn.call(this, acc, item, index, self);
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
return arr[method](wrappedFn, ...args);
|
|
1170
|
+
}
|
|
1171
|
+
function searchProxy(self, method, args) {
|
|
1172
|
+
const arr = toRaw(self);
|
|
1173
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
1174
|
+
const res = arr[method](...args);
|
|
1175
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1176
|
+
args[0] = toRaw(args[0]);
|
|
1177
|
+
return arr[method](...args);
|
|
1178
|
+
}
|
|
1179
|
+
return res;
|
|
1180
|
+
}
|
|
1181
|
+
function noTracking(self, method, args = []) {
|
|
1182
|
+
pauseTracking();
|
|
1183
|
+
startBatch();
|
|
1184
|
+
const res = toRaw(self)[method].apply(self, args);
|
|
1185
|
+
endBatch();
|
|
1186
|
+
resetTracking();
|
|
1187
|
+
return res;
|
|
814
1188
|
}
|
|
815
1189
|
|
|
816
1190
|
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
817
1191
|
const builtInSymbols = new Set(
|
|
818
1192
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
819
1193
|
);
|
|
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
1194
|
function hasOwnProperty(key) {
|
|
850
1195
|
if (!isSymbol(key))
|
|
851
1196
|
key = String(key);
|
|
@@ -876,14 +1221,22 @@ class BaseReactiveHandler {
|
|
|
876
1221
|
}
|
|
877
1222
|
const targetIsArray = isArray(target);
|
|
878
1223
|
if (!isReadonly2) {
|
|
879
|
-
|
|
880
|
-
|
|
1224
|
+
let fn;
|
|
1225
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1226
|
+
return fn;
|
|
881
1227
|
}
|
|
882
1228
|
if (key === "hasOwnProperty") {
|
|
883
1229
|
return hasOwnProperty;
|
|
884
1230
|
}
|
|
885
1231
|
}
|
|
886
|
-
const res = Reflect.get(
|
|
1232
|
+
const res = Reflect.get(
|
|
1233
|
+
target,
|
|
1234
|
+
key,
|
|
1235
|
+
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1236
|
+
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1237
|
+
// its class methods
|
|
1238
|
+
isRef(target) ? target : receiver
|
|
1239
|
+
);
|
|
887
1240
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
888
1241
|
return res;
|
|
889
1242
|
}
|
|
@@ -1382,110 +1735,8 @@ function markRaw(value) {
|
|
|
1382
1735
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1383
1736
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1384
1737
|
|
|
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
1738
|
function isRef(r) {
|
|
1488
|
-
return
|
|
1739
|
+
return r ? r.__v_isRef === true : false;
|
|
1489
1740
|
}
|
|
1490
1741
|
function ref(value) {
|
|
1491
1742
|
return createRef(value, false);
|
|
@@ -1502,27 +1753,49 @@ function createRef(rawValue, shallow) {
|
|
|
1502
1753
|
class RefImpl {
|
|
1503
1754
|
constructor(value, __v_isShallow) {
|
|
1504
1755
|
this.__v_isShallow = __v_isShallow;
|
|
1505
|
-
this.dep =
|
|
1756
|
+
this.dep = new Dep();
|
|
1506
1757
|
this.__v_isRef = true;
|
|
1507
1758
|
this._rawValue = __v_isShallow ? value : toRaw(value);
|
|
1508
1759
|
this._value = __v_isShallow ? value : toReactive(value);
|
|
1509
1760
|
}
|
|
1510
1761
|
get value() {
|
|
1511
|
-
|
|
1762
|
+
{
|
|
1763
|
+
this.dep.track({
|
|
1764
|
+
target: this,
|
|
1765
|
+
type: "get",
|
|
1766
|
+
key: "value"
|
|
1767
|
+
});
|
|
1768
|
+
}
|
|
1512
1769
|
return this._value;
|
|
1513
1770
|
}
|
|
1514
|
-
set value(
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
this.
|
|
1520
|
-
|
|
1771
|
+
set value(newValue) {
|
|
1772
|
+
const oldValue = this._rawValue;
|
|
1773
|
+
const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
|
|
1774
|
+
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1775
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1776
|
+
this._rawValue = newValue;
|
|
1777
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1778
|
+
{
|
|
1779
|
+
this.dep.trigger({
|
|
1780
|
+
target: this,
|
|
1781
|
+
type: "set",
|
|
1782
|
+
key: "value",
|
|
1783
|
+
newValue,
|
|
1784
|
+
oldValue
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1521
1787
|
}
|
|
1522
1788
|
}
|
|
1523
1789
|
}
|
|
1524
1790
|
function triggerRef(ref2) {
|
|
1525
|
-
|
|
1791
|
+
{
|
|
1792
|
+
ref2.dep.trigger({
|
|
1793
|
+
target: ref2,
|
|
1794
|
+
type: "set",
|
|
1795
|
+
key: "value",
|
|
1796
|
+
newValue: ref2._value
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1526
1799
|
}
|
|
1527
1800
|
function unref(ref2) {
|
|
1528
1801
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1547,12 +1820,9 @@ function proxyRefs(objectWithRefs) {
|
|
|
1547
1820
|
}
|
|
1548
1821
|
class CustomRefImpl {
|
|
1549
1822
|
constructor(factory) {
|
|
1550
|
-
this.dep = void 0;
|
|
1551
1823
|
this.__v_isRef = true;
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1554
|
-
() => triggerRefValue(this)
|
|
1555
|
-
);
|
|
1824
|
+
const dep = this.dep = new Dep();
|
|
1825
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1556
1826
|
this._get = get;
|
|
1557
1827
|
this._set = set;
|
|
1558
1828
|
}
|
|
@@ -1620,6 +1890,90 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1620
1890
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1621
1891
|
}
|
|
1622
1892
|
|
|
1893
|
+
class ComputedRefImpl {
|
|
1894
|
+
constructor(fn, setter, isSSR) {
|
|
1895
|
+
this.fn = fn;
|
|
1896
|
+
this.setter = setter;
|
|
1897
|
+
/**
|
|
1898
|
+
* @internal
|
|
1899
|
+
*/
|
|
1900
|
+
this._value = void 0;
|
|
1901
|
+
/**
|
|
1902
|
+
* @internal
|
|
1903
|
+
*/
|
|
1904
|
+
this.dep = new Dep(this);
|
|
1905
|
+
/**
|
|
1906
|
+
* @internal
|
|
1907
|
+
*/
|
|
1908
|
+
this.__v_isRef = true;
|
|
1909
|
+
// A computed is also a subscriber that tracks other deps
|
|
1910
|
+
/**
|
|
1911
|
+
* @internal
|
|
1912
|
+
*/
|
|
1913
|
+
this.deps = void 0;
|
|
1914
|
+
/**
|
|
1915
|
+
* @internal
|
|
1916
|
+
*/
|
|
1917
|
+
this.depsTail = void 0;
|
|
1918
|
+
/**
|
|
1919
|
+
* @internal
|
|
1920
|
+
*/
|
|
1921
|
+
this.flags = 16;
|
|
1922
|
+
/**
|
|
1923
|
+
* @internal
|
|
1924
|
+
*/
|
|
1925
|
+
this.globalVersion = globalVersion - 1;
|
|
1926
|
+
// for backwards compat
|
|
1927
|
+
this.effect = this;
|
|
1928
|
+
this.__v_isReadonly = !setter;
|
|
1929
|
+
this.isSSR = isSSR;
|
|
1930
|
+
}
|
|
1931
|
+
/**
|
|
1932
|
+
* @internal
|
|
1933
|
+
*/
|
|
1934
|
+
notify() {
|
|
1935
|
+
if (activeSub !== this) {
|
|
1936
|
+
this.flags |= 16;
|
|
1937
|
+
this.dep.notify();
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
get value() {
|
|
1941
|
+
const link = this.dep.track({
|
|
1942
|
+
target: this,
|
|
1943
|
+
type: "get",
|
|
1944
|
+
key: "value"
|
|
1945
|
+
}) ;
|
|
1946
|
+
refreshComputed(this);
|
|
1947
|
+
if (link) {
|
|
1948
|
+
link.version = this.dep.version;
|
|
1949
|
+
}
|
|
1950
|
+
return this._value;
|
|
1951
|
+
}
|
|
1952
|
+
set value(newValue) {
|
|
1953
|
+
if (this.setter) {
|
|
1954
|
+
this.setter(newValue);
|
|
1955
|
+
} else {
|
|
1956
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1961
|
+
let getter;
|
|
1962
|
+
let setter;
|
|
1963
|
+
if (isFunction(getterOrOptions)) {
|
|
1964
|
+
getter = getterOrOptions;
|
|
1965
|
+
} else {
|
|
1966
|
+
getter = getterOrOptions.get;
|
|
1967
|
+
setter = getterOrOptions.set;
|
|
1968
|
+
}
|
|
1969
|
+
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1970
|
+
if (debugOptions && !isSSR) {
|
|
1971
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1972
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1973
|
+
}
|
|
1974
|
+
return cRef;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1623
1977
|
const TrackOpTypes = {
|
|
1624
1978
|
"GET": "get",
|
|
1625
1979
|
"HAS": "has",
|
|
@@ -1912,7 +2266,7 @@ function findInsertionIndex(id) {
|
|
|
1912
2266
|
const middle = start + end >>> 1;
|
|
1913
2267
|
const middleJob = queue[middle];
|
|
1914
2268
|
const middleJobId = getId(middleJob);
|
|
1915
|
-
if (middleJobId < id || middleJobId === id && middleJob.
|
|
2269
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1916
2270
|
start = middle + 1;
|
|
1917
2271
|
} else {
|
|
1918
2272
|
end = middle;
|
|
@@ -1921,15 +2275,21 @@ function findInsertionIndex(id) {
|
|
|
1921
2275
|
return start;
|
|
1922
2276
|
}
|
|
1923
2277
|
function queueJob(job) {
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1927
|
-
)) {
|
|
2278
|
+
var _a;
|
|
2279
|
+
if (!(job.flags & 1)) {
|
|
1928
2280
|
if (job.id == null) {
|
|
1929
2281
|
queue.push(job);
|
|
2282
|
+
} else if (
|
|
2283
|
+
// fast path when the job id is larger than the tail
|
|
2284
|
+
!(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
|
|
2285
|
+
) {
|
|
2286
|
+
queue.push(job);
|
|
1930
2287
|
} else {
|
|
1931
2288
|
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1932
2289
|
}
|
|
2290
|
+
if (!(job.flags & 4)) {
|
|
2291
|
+
job.flags |= 1;
|
|
2292
|
+
}
|
|
1933
2293
|
queueFlush();
|
|
1934
2294
|
}
|
|
1935
2295
|
}
|
|
@@ -1947,11 +2307,11 @@ function invalidateJob(job) {
|
|
|
1947
2307
|
}
|
|
1948
2308
|
function queuePostFlushCb(cb) {
|
|
1949
2309
|
if (!isArray(cb)) {
|
|
1950
|
-
if (!
|
|
1951
|
-
cb,
|
|
1952
|
-
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1953
|
-
)) {
|
|
2310
|
+
if (!(cb.flags & 1)) {
|
|
1954
2311
|
pendingPostFlushCbs.push(cb);
|
|
2312
|
+
if (!(cb.flags & 4)) {
|
|
2313
|
+
cb.flags |= 1;
|
|
2314
|
+
}
|
|
1955
2315
|
}
|
|
1956
2316
|
} else {
|
|
1957
2317
|
pendingPostFlushCbs.push(...cb);
|
|
@@ -1964,7 +2324,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1964
2324
|
}
|
|
1965
2325
|
for (; i < queue.length; i++) {
|
|
1966
2326
|
const cb = queue[i];
|
|
1967
|
-
if (cb && cb.
|
|
2327
|
+
if (cb && cb.flags & 2) {
|
|
1968
2328
|
if (instance && cb.id !== instance.uid) {
|
|
1969
2329
|
continue;
|
|
1970
2330
|
}
|
|
@@ -1974,6 +2334,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1974
2334
|
queue.splice(i, 1);
|
|
1975
2335
|
i--;
|
|
1976
2336
|
cb();
|
|
2337
|
+
cb.flags &= ~1;
|
|
1977
2338
|
}
|
|
1978
2339
|
}
|
|
1979
2340
|
}
|
|
@@ -1996,6 +2357,7 @@ function flushPostFlushCbs(seen) {
|
|
|
1996
2357
|
continue;
|
|
1997
2358
|
}
|
|
1998
2359
|
activePostFlushCbs[postFlushIndex]();
|
|
2360
|
+
activePostFlushCbs[postFlushIndex].flags &= ~1;
|
|
1999
2361
|
}
|
|
2000
2362
|
activePostFlushCbs = null;
|
|
2001
2363
|
postFlushIndex = 0;
|
|
@@ -2005,9 +2367,11 @@ const getId = (job) => job.id == null ? Infinity : job.id;
|
|
|
2005
2367
|
const comparator = (a, b) => {
|
|
2006
2368
|
const diff = getId(a) - getId(b);
|
|
2007
2369
|
if (diff === 0) {
|
|
2008
|
-
|
|
2370
|
+
const isAPre = a.flags & 2;
|
|
2371
|
+
const isBPre = b.flags & 2;
|
|
2372
|
+
if (isAPre && !isBPre)
|
|
2009
2373
|
return -1;
|
|
2010
|
-
if (
|
|
2374
|
+
if (isBPre && !isAPre)
|
|
2011
2375
|
return 1;
|
|
2012
2376
|
}
|
|
2013
2377
|
return diff;
|
|
@@ -2023,11 +2387,12 @@ function flushJobs(seen) {
|
|
|
2023
2387
|
try {
|
|
2024
2388
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
2025
2389
|
const job = queue[flushIndex];
|
|
2026
|
-
if (job && job.
|
|
2390
|
+
if (job && !(job.flags & 8)) {
|
|
2027
2391
|
if (check(job)) {
|
|
2028
2392
|
continue;
|
|
2029
2393
|
}
|
|
2030
2394
|
callWithErrorHandling(job, null, 14);
|
|
2395
|
+
job.flags &= ~1;
|
|
2031
2396
|
}
|
|
2032
2397
|
}
|
|
2033
2398
|
} finally {
|
|
@@ -2109,7 +2474,6 @@ function rerender(id, newRender) {
|
|
|
2109
2474
|
}
|
|
2110
2475
|
instance.renderCache = [];
|
|
2111
2476
|
isHmrUpdating = true;
|
|
2112
|
-
instance.effect.dirty = true;
|
|
2113
2477
|
instance.update();
|
|
2114
2478
|
isHmrUpdating = false;
|
|
2115
2479
|
});
|
|
@@ -2137,7 +2501,6 @@ function reload(id, newComp) {
|
|
|
2137
2501
|
instance.ceReload(newComp.styles);
|
|
2138
2502
|
hmrDirtyComponents.delete(oldComp);
|
|
2139
2503
|
} else if (instance.parent) {
|
|
2140
|
-
instance.parent.effect.dirty = true;
|
|
2141
2504
|
queueJob(instance.parent.update);
|
|
2142
2505
|
} else if (instance.appContext.reload) {
|
|
2143
2506
|
instance.appContext.reload();
|
|
@@ -3022,7 +3385,7 @@ function renderComponentRoot(instance) {
|
|
|
3022
3385
|
true ? {
|
|
3023
3386
|
get attrs() {
|
|
3024
3387
|
markAttrsAccessed();
|
|
3025
|
-
return
|
|
3388
|
+
return attrs;
|
|
3026
3389
|
},
|
|
3027
3390
|
slots,
|
|
3028
3391
|
emit
|
|
@@ -3055,7 +3418,7 @@ function renderComponentRoot(instance) {
|
|
|
3055
3418
|
propsOptions
|
|
3056
3419
|
);
|
|
3057
3420
|
}
|
|
3058
|
-
root = cloneVNode(root, fallthroughAttrs
|
|
3421
|
+
root = cloneVNode(root, fallthroughAttrs);
|
|
3059
3422
|
} else if (!accessedAttrs && root.type !== Comment) {
|
|
3060
3423
|
const allAttrs = Object.keys(attrs);
|
|
3061
3424
|
const eventAttrs = [];
|
|
@@ -3093,15 +3456,10 @@ function renderComponentRoot(instance) {
|
|
|
3093
3456
|
getComponentName(instance.type)
|
|
3094
3457
|
);
|
|
3095
3458
|
}
|
|
3096
|
-
root = cloneVNode(
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
style
|
|
3101
|
-
},
|
|
3102
|
-
false,
|
|
3103
|
-
true
|
|
3104
|
-
);
|
|
3459
|
+
root = cloneVNode(root, {
|
|
3460
|
+
class: cls,
|
|
3461
|
+
style
|
|
3462
|
+
});
|
|
3105
3463
|
}
|
|
3106
3464
|
}
|
|
3107
3465
|
if (vnode.dirs) {
|
|
@@ -3110,7 +3468,7 @@ function renderComponentRoot(instance) {
|
|
|
3110
3468
|
`Runtime directive used on component with non-element root node. The directives will not function as intended.`
|
|
3111
3469
|
);
|
|
3112
3470
|
}
|
|
3113
|
-
root = cloneVNode(root
|
|
3471
|
+
root = cloneVNode(root);
|
|
3114
3472
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
3115
3473
|
}
|
|
3116
3474
|
if (vnode.transition) {
|
|
@@ -3605,7 +3963,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
3605
3963
|
let parentSuspenseId;
|
|
3606
3964
|
const isSuspensible = isVNodeSuspensible(vnode);
|
|
3607
3965
|
if (isSuspensible) {
|
|
3608
|
-
if (parentSuspense
|
|
3966
|
+
if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
|
|
3609
3967
|
parentSuspenseId = parentSuspense.pendingId;
|
|
3610
3968
|
parentSuspense.deps++;
|
|
3611
3969
|
}
|
|
@@ -3917,8 +4275,8 @@ function setActiveBranch(suspense, branch) {
|
|
|
3917
4275
|
}
|
|
3918
4276
|
}
|
|
3919
4277
|
function isVNodeSuspensible(vnode) {
|
|
3920
|
-
|
|
3921
|
-
return suspensible != null && suspensible !== false;
|
|
4278
|
+
var _a;
|
|
4279
|
+
return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
|
|
3922
4280
|
}
|
|
3923
4281
|
|
|
3924
4282
|
const legacyDirectiveHookMap = {
|
|
@@ -4131,8 +4489,8 @@ function doWatch(source, cb, {
|
|
|
4131
4489
|
}
|
|
4132
4490
|
}
|
|
4133
4491
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
4134
|
-
const job = () => {
|
|
4135
|
-
if (!effect.
|
|
4492
|
+
const job = (immediateFirstRun) => {
|
|
4493
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
4136
4494
|
return;
|
|
4137
4495
|
}
|
|
4138
4496
|
if (cb) {
|
|
@@ -4153,19 +4511,22 @@ function doWatch(source, cb, {
|
|
|
4153
4511
|
effect.run();
|
|
4154
4512
|
}
|
|
4155
4513
|
};
|
|
4156
|
-
|
|
4514
|
+
if (cb)
|
|
4515
|
+
job.flags |= 4;
|
|
4516
|
+
const effect = new ReactiveEffect(getter);
|
|
4157
4517
|
let scheduler;
|
|
4158
4518
|
if (flush === "sync") {
|
|
4519
|
+
effect.flags |= 64;
|
|
4159
4520
|
scheduler = job;
|
|
4160
4521
|
} else if (flush === "post") {
|
|
4161
4522
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
4162
4523
|
} else {
|
|
4163
|
-
job.
|
|
4524
|
+
job.flags |= 2;
|
|
4164
4525
|
if (instance)
|
|
4165
4526
|
job.id = instance.uid;
|
|
4166
4527
|
scheduler = () => queueJob(job);
|
|
4167
4528
|
}
|
|
4168
|
-
|
|
4529
|
+
effect.scheduler = scheduler;
|
|
4169
4530
|
const scope = getCurrentScope();
|
|
4170
4531
|
const unwatch = () => {
|
|
4171
4532
|
effect.stop();
|
|
@@ -4179,7 +4540,7 @@ function doWatch(source, cb, {
|
|
|
4179
4540
|
}
|
|
4180
4541
|
if (cb) {
|
|
4181
4542
|
if (immediate) {
|
|
4182
|
-
job();
|
|
4543
|
+
job(true);
|
|
4183
4544
|
} else {
|
|
4184
4545
|
oldValue = effect.run();
|
|
4185
4546
|
}
|
|
@@ -4220,29 +4581,34 @@ function createPathGetter(ctx, path) {
|
|
|
4220
4581
|
return cur;
|
|
4221
4582
|
};
|
|
4222
4583
|
}
|
|
4223
|
-
function traverse(value, depth =
|
|
4224
|
-
if (
|
|
4584
|
+
function traverse(value, depth, currentDepth = 0, seen) {
|
|
4585
|
+
if (!isObject(value) || value["__v_skip"]) {
|
|
4225
4586
|
return value;
|
|
4226
4587
|
}
|
|
4588
|
+
if (depth && depth > 0) {
|
|
4589
|
+
if (currentDepth >= depth) {
|
|
4590
|
+
return value;
|
|
4591
|
+
}
|
|
4592
|
+
currentDepth++;
|
|
4593
|
+
}
|
|
4227
4594
|
seen = seen || /* @__PURE__ */ new Set();
|
|
4228
4595
|
if (seen.has(value)) {
|
|
4229
4596
|
return value;
|
|
4230
4597
|
}
|
|
4231
4598
|
seen.add(value);
|
|
4232
|
-
depth--;
|
|
4233
4599
|
if (isRef(value)) {
|
|
4234
|
-
traverse(value.value, depth, seen);
|
|
4600
|
+
traverse(value.value, depth, currentDepth, seen);
|
|
4235
4601
|
} else if (isArray(value)) {
|
|
4236
4602
|
for (let i = 0; i < value.length; i++) {
|
|
4237
|
-
traverse(value[i], depth, seen);
|
|
4603
|
+
traverse(value[i], depth, currentDepth, seen);
|
|
4238
4604
|
}
|
|
4239
4605
|
} else if (isSet(value) || isMap(value)) {
|
|
4240
4606
|
value.forEach((v) => {
|
|
4241
|
-
traverse(v, depth, seen);
|
|
4607
|
+
traverse(v, depth, currentDepth, seen);
|
|
4242
4608
|
});
|
|
4243
4609
|
} else if (isPlainObject(value)) {
|
|
4244
4610
|
for (const key in value) {
|
|
4245
|
-
traverse(value[key], depth, seen);
|
|
4611
|
+
traverse(value[key], depth, currentDepth, seen);
|
|
4246
4612
|
}
|
|
4247
4613
|
}
|
|
4248
4614
|
return value;
|
|
@@ -4358,22 +4724,7 @@ const BaseTransitionImpl = {
|
|
|
4358
4724
|
if (!children || !children.length) {
|
|
4359
4725
|
return;
|
|
4360
4726
|
}
|
|
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
|
-
}
|
|
4727
|
+
const child = findNonCommentChild(children);
|
|
4377
4728
|
const rawProps = toRaw(props);
|
|
4378
4729
|
const { mode } = rawProps;
|
|
4379
4730
|
if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
|
@@ -4382,7 +4733,7 @@ const BaseTransitionImpl = {
|
|
|
4382
4733
|
if (state.isLeaving) {
|
|
4383
4734
|
return emptyPlaceholder(child);
|
|
4384
4735
|
}
|
|
4385
|
-
const innerChild =
|
|
4736
|
+
const innerChild = getInnerChild$1(child);
|
|
4386
4737
|
if (!innerChild) {
|
|
4387
4738
|
return emptyPlaceholder(child);
|
|
4388
4739
|
}
|
|
@@ -4394,7 +4745,7 @@ const BaseTransitionImpl = {
|
|
|
4394
4745
|
);
|
|
4395
4746
|
setTransitionHooks(innerChild, enterHooks);
|
|
4396
4747
|
const oldChild = instance.subTree;
|
|
4397
|
-
const oldInnerChild = oldChild &&
|
|
4748
|
+
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
|
|
4398
4749
|
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
|
4399
4750
|
const leavingHooks = resolveTransitionHooks(
|
|
4400
4751
|
oldInnerChild,
|
|
@@ -4403,12 +4754,11 @@ const BaseTransitionImpl = {
|
|
|
4403
4754
|
instance
|
|
4404
4755
|
);
|
|
4405
4756
|
setTransitionHooks(oldInnerChild, leavingHooks);
|
|
4406
|
-
if (mode === "out-in"
|
|
4757
|
+
if (mode === "out-in") {
|
|
4407
4758
|
state.isLeaving = true;
|
|
4408
4759
|
leavingHooks.afterLeave = () => {
|
|
4409
4760
|
state.isLeaving = false;
|
|
4410
|
-
if (instance.
|
|
4411
|
-
instance.effect.dirty = true;
|
|
4761
|
+
if (!(instance.job.flags & 8)) {
|
|
4412
4762
|
instance.update();
|
|
4413
4763
|
}
|
|
4414
4764
|
};
|
|
@@ -4436,6 +4786,25 @@ const BaseTransitionImpl = {
|
|
|
4436
4786
|
{
|
|
4437
4787
|
BaseTransitionImpl.__isBuiltIn = true;
|
|
4438
4788
|
}
|
|
4789
|
+
function findNonCommentChild(children) {
|
|
4790
|
+
let child = children[0];
|
|
4791
|
+
if (children.length > 1) {
|
|
4792
|
+
let hasFound = false;
|
|
4793
|
+
for (const c of children) {
|
|
4794
|
+
if (c.type !== Comment) {
|
|
4795
|
+
if (hasFound) {
|
|
4796
|
+
warn$1(
|
|
4797
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4798
|
+
);
|
|
4799
|
+
break;
|
|
4800
|
+
}
|
|
4801
|
+
child = c;
|
|
4802
|
+
hasFound = true;
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
return child;
|
|
4807
|
+
}
|
|
4439
4808
|
const BaseTransition = BaseTransitionImpl;
|
|
4440
4809
|
function getLeavingNodesForType(state, vnode) {
|
|
4441
4810
|
const { leavingVNodes } = state;
|
|
@@ -4590,8 +4959,11 @@ function emptyPlaceholder(vnode) {
|
|
|
4590
4959
|
return vnode;
|
|
4591
4960
|
}
|
|
4592
4961
|
}
|
|
4593
|
-
function
|
|
4962
|
+
function getInnerChild$1(vnode) {
|
|
4594
4963
|
if (!isKeepAlive(vnode)) {
|
|
4964
|
+
if (isTeleport(vnode.type) && vnode.children) {
|
|
4965
|
+
return findNonCommentChild(vnode.children);
|
|
4966
|
+
}
|
|
4595
4967
|
return vnode;
|
|
4596
4968
|
}
|
|
4597
4969
|
if (vnode.component) {
|
|
@@ -4760,7 +5132,6 @@ function defineAsyncComponent(source) {
|
|
|
4760
5132
|
load().then(() => {
|
|
4761
5133
|
loaded.value = true;
|
|
4762
5134
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4763
|
-
instance.parent.effect.dirty = true;
|
|
4764
5135
|
queueJob(instance.parent.update);
|
|
4765
5136
|
}
|
|
4766
5137
|
}).catch((err) => {
|
|
@@ -4927,7 +5298,7 @@ const KeepAliveImpl = {
|
|
|
4927
5298
|
return () => {
|
|
4928
5299
|
pendingCacheKey = null;
|
|
4929
5300
|
if (!slots.default) {
|
|
4930
|
-
return null;
|
|
5301
|
+
return current = null;
|
|
4931
5302
|
}
|
|
4932
5303
|
const children = slots.default();
|
|
4933
5304
|
const rawVNode = children[0];
|
|
@@ -5378,10 +5749,20 @@ function convertLegacyFunctionalComponent(comp) {
|
|
|
5378
5749
|
function renderList(source, renderItem, cache, index) {
|
|
5379
5750
|
let ret;
|
|
5380
5751
|
const cached = cache && cache[index];
|
|
5381
|
-
|
|
5752
|
+
const sourceIsArray = isArray(source);
|
|
5753
|
+
const sourceIsReactiveArray = sourceIsArray && isReactive(source);
|
|
5754
|
+
if (sourceIsArray || isString(source)) {
|
|
5755
|
+
if (sourceIsReactiveArray) {
|
|
5756
|
+
source = shallowReadArray(source);
|
|
5757
|
+
}
|
|
5382
5758
|
ret = new Array(source.length);
|
|
5383
5759
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
5384
|
-
ret[i] = renderItem(
|
|
5760
|
+
ret[i] = renderItem(
|
|
5761
|
+
sourceIsReactiveArray ? toReactive(source[i]) : source[i],
|
|
5762
|
+
i,
|
|
5763
|
+
void 0,
|
|
5764
|
+
cached && cached[i]
|
|
5765
|
+
);
|
|
5385
5766
|
}
|
|
5386
5767
|
} else if (typeof source === "number") {
|
|
5387
5768
|
if (!Number.isInteger(source)) {
|
|
@@ -5752,7 +6133,6 @@ const publicPropertiesMap = (
|
|
|
5752
6133
|
$emit: (i) => i.emit,
|
|
5753
6134
|
$options: (i) => resolveMergedOptions(i) ,
|
|
5754
6135
|
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
5755
|
-
i.effect.dirty = true;
|
|
5756
6136
|
queueJob(i.update);
|
|
5757
6137
|
}),
|
|
5758
6138
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
@@ -6623,13 +7003,13 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6623
7003
|
return vm;
|
|
6624
7004
|
}
|
|
6625
7005
|
}
|
|
6626
|
-
Vue.version = `2.6.14-compat:${"3.
|
|
7006
|
+
Vue.version = `2.6.14-compat:${"3.5.0-alpha.1"}`;
|
|
6627
7007
|
Vue.config = singletonApp.config;
|
|
6628
|
-
Vue.use = (
|
|
6629
|
-
if (
|
|
6630
|
-
|
|
6631
|
-
} else if (isFunction(
|
|
6632
|
-
|
|
7008
|
+
Vue.use = (p, ...options) => {
|
|
7009
|
+
if (p && isFunction(p.install)) {
|
|
7010
|
+
p.install(Vue, ...options);
|
|
7011
|
+
} else if (isFunction(p)) {
|
|
7012
|
+
p(Vue, ...options);
|
|
6633
7013
|
}
|
|
6634
7014
|
return Vue;
|
|
6635
7015
|
};
|
|
@@ -7641,7 +8021,9 @@ const isSimpleType = /* @__PURE__ */ makeMap(
|
|
|
7641
8021
|
function assertType(value, type) {
|
|
7642
8022
|
let valid;
|
|
7643
8023
|
const expectedType = getType(type);
|
|
7644
|
-
if (
|
|
8024
|
+
if (expectedType === "null") {
|
|
8025
|
+
valid = value === null;
|
|
8026
|
+
} else if (isSimpleType(expectedType)) {
|
|
7645
8027
|
const t = typeof value;
|
|
7646
8028
|
valid = t === expectedType.toLowerCase();
|
|
7647
8029
|
if (!valid && t === "object") {
|
|
@@ -7651,8 +8033,6 @@ function assertType(value, type) {
|
|
|
7651
8033
|
valid = isObject(value);
|
|
7652
8034
|
} else if (expectedType === "Array") {
|
|
7653
8035
|
valid = isArray(value);
|
|
7654
|
-
} else if (expectedType === "null") {
|
|
7655
|
-
valid = value === null;
|
|
7656
8036
|
} else {
|
|
7657
8037
|
valid = value instanceof type;
|
|
7658
8038
|
}
|
|
@@ -7747,7 +8127,7 @@ const initSlots = (instance, children) => {
|
|
|
7747
8127
|
const type = children._;
|
|
7748
8128
|
if (type) {
|
|
7749
8129
|
extend(slots, children);
|
|
7750
|
-
def(slots, "_", type
|
|
8130
|
+
def(slots, "_", type);
|
|
7751
8131
|
} else {
|
|
7752
8132
|
normalizeObjectSlots(children, slots, instance);
|
|
7753
8133
|
}
|
|
@@ -9177,7 +9557,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9177
9557
|
} else {
|
|
9178
9558
|
instance.next = n2;
|
|
9179
9559
|
invalidateJob(instance.update);
|
|
9180
|
-
instance.effect.dirty = true;
|
|
9181
9560
|
instance.update();
|
|
9182
9561
|
}
|
|
9183
9562
|
} else {
|
|
@@ -9384,24 +9763,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9384
9763
|
}
|
|
9385
9764
|
}
|
|
9386
9765
|
};
|
|
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;
|
|
9766
|
+
instance.scope.on();
|
|
9767
|
+
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
9768
|
+
instance.scope.off();
|
|
9769
|
+
const update = instance.update = effect.run.bind(effect);
|
|
9770
|
+
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
9771
|
+
job.id = instance.uid;
|
|
9772
|
+
effect.scheduler = () => queueJob(job);
|
|
9400
9773
|
toggleRecurse(instance, true);
|
|
9401
9774
|
{
|
|
9402
9775
|
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
9403
9776
|
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
9404
|
-
|
|
9777
|
+
job.ownerInstance = instance;
|
|
9405
9778
|
}
|
|
9406
9779
|
update();
|
|
9407
9780
|
};
|
|
@@ -9868,7 +10241,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9868
10241
|
if (instance.type.__hmrId) {
|
|
9869
10242
|
unregisterHMR(instance);
|
|
9870
10243
|
}
|
|
9871
|
-
const { bum, scope,
|
|
10244
|
+
const { bum, scope, job, subTree, um } = instance;
|
|
9872
10245
|
if (bum) {
|
|
9873
10246
|
invokeArrayFns(bum);
|
|
9874
10247
|
}
|
|
@@ -9876,8 +10249,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9876
10249
|
instance.emit("hook:beforeDestroy");
|
|
9877
10250
|
}
|
|
9878
10251
|
scope.stop();
|
|
9879
|
-
if (
|
|
9880
|
-
|
|
10252
|
+
if (job) {
|
|
10253
|
+
job.flags |= 8;
|
|
9881
10254
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
9882
10255
|
}
|
|
9883
10256
|
if (um) {
|
|
@@ -9969,8 +10342,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9969
10342
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
9970
10343
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
9971
10344
|
}
|
|
9972
|
-
function toggleRecurse({ effect,
|
|
9973
|
-
|
|
10345
|
+
function toggleRecurse({ effect, job }, allowed) {
|
|
10346
|
+
if (allowed) {
|
|
10347
|
+
effect.flags |= 32;
|
|
10348
|
+
job.flags |= 4;
|
|
10349
|
+
} else {
|
|
10350
|
+
effect.flags &= ~32;
|
|
10351
|
+
job.flags &= ~4;
|
|
10352
|
+
}
|
|
9974
10353
|
}
|
|
9975
10354
|
function needTransition(parentSuspense, transition) {
|
|
9976
10355
|
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
|
@@ -10586,8 +10965,8 @@ function guardReactiveProps(props) {
|
|
|
10586
10965
|
return null;
|
|
10587
10966
|
return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
|
|
10588
10967
|
}
|
|
10589
|
-
function cloneVNode(vnode, extraProps, mergeRef = false
|
|
10590
|
-
const { props, ref, patchFlag, children
|
|
10968
|
+
function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
10969
|
+
const { props, ref, patchFlag, children } = vnode;
|
|
10591
10970
|
const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
|
10592
10971
|
const cloned = {
|
|
10593
10972
|
__v_isVNode: true,
|
|
@@ -10617,7 +10996,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
10617
10996
|
dynamicChildren: vnode.dynamicChildren,
|
|
10618
10997
|
appContext: vnode.appContext,
|
|
10619
10998
|
dirs: vnode.dirs,
|
|
10620
|
-
transition,
|
|
10999
|
+
transition: vnode.transition,
|
|
10621
11000
|
// These should technically only be non-null on mounted VNodes. However,
|
|
10622
11001
|
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
10623
11002
|
// them since them being non-null during a mount doesn't affect the logic as
|
|
@@ -10631,9 +11010,6 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
10631
11010
|
ctx: vnode.ctx,
|
|
10632
11011
|
ce: vnode.ce
|
|
10633
11012
|
};
|
|
10634
|
-
if (transition && cloneTransition) {
|
|
10635
|
-
cloned.transition = transition.clone(cloned);
|
|
10636
|
-
}
|
|
10637
11013
|
{
|
|
10638
11014
|
defineLegacyVNodeProperties(cloned);
|
|
10639
11015
|
}
|
|
@@ -10771,6 +11147,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
10771
11147
|
effect: null,
|
|
10772
11148
|
update: null,
|
|
10773
11149
|
// will be set synchronously right after creation
|
|
11150
|
+
job: null,
|
|
10774
11151
|
scope: new EffectScope(
|
|
10775
11152
|
true
|
|
10776
11153
|
/* detached */
|
|
@@ -11293,7 +11670,8 @@ function initCustomFormatter() {
|
|
|
11293
11670
|
{},
|
|
11294
11671
|
["span", vueStyle, genRefFlag(obj)],
|
|
11295
11672
|
"<",
|
|
11296
|
-
|
|
11673
|
+
// avoid debugger accessing value affecting behavior
|
|
11674
|
+
formatValue("_value" in obj ? obj._value : obj),
|
|
11297
11675
|
`>`
|
|
11298
11676
|
];
|
|
11299
11677
|
} else if (isReactive(obj)) {
|
|
@@ -11473,7 +11851,7 @@ function isMemoSame(cached, memo) {
|
|
|
11473
11851
|
return true;
|
|
11474
11852
|
}
|
|
11475
11853
|
|
|
11476
|
-
const version = "3.
|
|
11854
|
+
const version = "3.5.0-alpha.1";
|
|
11477
11855
|
const warn = warn$1 ;
|
|
11478
11856
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
11479
11857
|
const devtools = devtools$1 ;
|
|
@@ -13028,7 +13406,9 @@ const withKeys = (fn, modifiers) => {
|
|
|
13028
13406
|
return;
|
|
13029
13407
|
}
|
|
13030
13408
|
const eventKey = hyphenate(event.key);
|
|
13031
|
-
if (modifiers.some(
|
|
13409
|
+
if (modifiers.some(
|
|
13410
|
+
(k) => k === eventKey || keyNames[k] === eventKey
|
|
13411
|
+
)) {
|
|
13032
13412
|
return fn(event);
|
|
13033
13413
|
}
|
|
13034
13414
|
{
|
|
@@ -15239,10 +15619,11 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
15239
15619
|
}
|
|
15240
15620
|
},
|
|
15241
15621
|
onselfclosingtag(end) {
|
|
15622
|
+
var _a;
|
|
15242
15623
|
const name = currentOpenTag.tag;
|
|
15243
15624
|
currentOpenTag.isSelfClosing = true;
|
|
15244
15625
|
endOpenTag(end);
|
|
15245
|
-
if (stack[0]
|
|
15626
|
+
if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
|
|
15246
15627
|
onCloseTag(stack.shift(), end);
|
|
15247
15628
|
}
|
|
15248
15629
|
},
|
|
@@ -15558,7 +15939,7 @@ function endOpenTag(end) {
|
|
|
15558
15939
|
function onText(content, start, end) {
|
|
15559
15940
|
const parent = stack[0] || currentRoot;
|
|
15560
15941
|
const lastNode = parent.children[parent.children.length - 1];
|
|
15561
|
-
if (lastNode
|
|
15942
|
+
if ((lastNode == null ? void 0 : lastNode.type) === 2) {
|
|
15562
15943
|
lastNode.content += content;
|
|
15563
15944
|
setLocEnd(lastNode.loc, end);
|
|
15564
15945
|
} else {
|
|
@@ -15692,10 +16073,11 @@ function isFragmentTemplate({ tag, props }) {
|
|
|
15692
16073
|
return false;
|
|
15693
16074
|
}
|
|
15694
16075
|
function isComponent({ tag, props }) {
|
|
16076
|
+
var _a;
|
|
15695
16077
|
if (currentOptions.isCustomElement(tag)) {
|
|
15696
16078
|
return false;
|
|
15697
16079
|
}
|
|
15698
|
-
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent
|
|
16080
|
+
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
|
|
15699
16081
|
return true;
|
|
15700
16082
|
}
|
|
15701
16083
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -15728,6 +16110,7 @@ function isUpperCase(c) {
|
|
|
15728
16110
|
}
|
|
15729
16111
|
const windowsNewlineRE = /\r\n/g;
|
|
15730
16112
|
function condenseWhitespace(nodes, tag) {
|
|
16113
|
+
var _a, _b;
|
|
15731
16114
|
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
15732
16115
|
let removedWhitespace = false;
|
|
15733
16116
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -15735,8 +16118,8 @@ function condenseWhitespace(nodes, tag) {
|
|
|
15735
16118
|
if (node.type === 2) {
|
|
15736
16119
|
if (!inPre) {
|
|
15737
16120
|
if (isAllWhitespace(node.content)) {
|
|
15738
|
-
const prev = nodes[i - 1]
|
|
15739
|
-
const next = nodes[i + 1]
|
|
16121
|
+
const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
|
|
16122
|
+
const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
|
|
15740
16123
|
if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
|
|
15741
16124
|
removedWhitespace = true;
|
|
15742
16125
|
nodes[i] = null;
|
|
@@ -15896,7 +16279,7 @@ function baseParse(input, options) {
|
|
|
15896
16279
|
}
|
|
15897
16280
|
tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
15898
16281
|
tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
|
|
15899
|
-
const delimiters = options
|
|
16282
|
+
const delimiters = options == null ? void 0 : options.delimiters;
|
|
15900
16283
|
if (delimiters) {
|
|
15901
16284
|
tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
|
|
15902
16285
|
tokenizer.delimiterClose = toCharCodes(delimiters[1]);
|
|
@@ -17254,6 +17637,7 @@ function genReturnStatement({ returns }, context) {
|
|
|
17254
17637
|
}
|
|
17255
17638
|
|
|
17256
17639
|
const isLiteralWhitelisted = /* @__PURE__ */ makeMap("true,false,null,this");
|
|
17640
|
+
const constantBailRE = /\w\s*\(|\.[^\d]/;
|
|
17257
17641
|
const transformExpression = (node, context) => {
|
|
17258
17642
|
if (node.type === 5) {
|
|
17259
17643
|
node.content = processExpression(
|
|
@@ -17348,6 +17732,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
17348
17732
|
return `_ctx.${raw}`;
|
|
17349
17733
|
};
|
|
17350
17734
|
const rawExp = node.content;
|
|
17735
|
+
const bailConstant = constantBailRE.test(rawExp);
|
|
17351
17736
|
let ast = node.ast;
|
|
17352
17737
|
if (ast === false) {
|
|
17353
17738
|
return node;
|
|
@@ -17409,7 +17794,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
17409
17794
|
node2.name = rewriteIdentifier(node2.name, parent, node2);
|
|
17410
17795
|
ids.push(node2);
|
|
17411
17796
|
} else {
|
|
17412
|
-
if (!(needPrefix && isLocal) &&
|
|
17797
|
+
if (!(needPrefix && isLocal) && !bailConstant) {
|
|
17413
17798
|
node2.isConstant = true;
|
|
17414
17799
|
}
|
|
17415
17800
|
ids.push(node2);
|
|
@@ -17453,7 +17838,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
17453
17838
|
ret.ast = ast;
|
|
17454
17839
|
} else {
|
|
17455
17840
|
ret = node;
|
|
17456
|
-
ret.constType = 3;
|
|
17841
|
+
ret.constType = bailConstant ? 0 : 3;
|
|
17457
17842
|
}
|
|
17458
17843
|
ret.identifiers = Object.keys(knownIds);
|
|
17459
17844
|
return ret;
|
|
@@ -20165,9 +20550,183 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
20165
20550
|
}
|
|
20166
20551
|
};
|
|
20167
20552
|
|
|
20553
|
+
function isValidHTMLNesting(parent, child) {
|
|
20554
|
+
if (parent in onlyValidChildren) {
|
|
20555
|
+
return onlyValidChildren[parent].has(child);
|
|
20556
|
+
}
|
|
20557
|
+
if (child in onlyValidParents) {
|
|
20558
|
+
return onlyValidParents[child].has(parent);
|
|
20559
|
+
}
|
|
20560
|
+
if (parent in knownInvalidChildren) {
|
|
20561
|
+
if (knownInvalidChildren[parent].has(child))
|
|
20562
|
+
return false;
|
|
20563
|
+
}
|
|
20564
|
+
if (child in knownInvalidParents) {
|
|
20565
|
+
if (knownInvalidParents[child].has(parent))
|
|
20566
|
+
return false;
|
|
20567
|
+
}
|
|
20568
|
+
return true;
|
|
20569
|
+
}
|
|
20570
|
+
const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
20571
|
+
const emptySet = /* @__PURE__ */ new Set([]);
|
|
20572
|
+
const onlyValidChildren = {
|
|
20573
|
+
head: /* @__PURE__ */ new Set([
|
|
20574
|
+
"base",
|
|
20575
|
+
"basefront",
|
|
20576
|
+
"bgsound",
|
|
20577
|
+
"link",
|
|
20578
|
+
"meta",
|
|
20579
|
+
"title",
|
|
20580
|
+
"noscript",
|
|
20581
|
+
"noframes",
|
|
20582
|
+
"style",
|
|
20583
|
+
"script",
|
|
20584
|
+
"template"
|
|
20585
|
+
]),
|
|
20586
|
+
optgroup: /* @__PURE__ */ new Set(["option"]),
|
|
20587
|
+
select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
|
|
20588
|
+
// table
|
|
20589
|
+
table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
|
|
20590
|
+
tr: /* @__PURE__ */ new Set(["td", "th"]),
|
|
20591
|
+
colgroup: /* @__PURE__ */ new Set(["col"]),
|
|
20592
|
+
tbody: /* @__PURE__ */ new Set(["tr"]),
|
|
20593
|
+
thead: /* @__PURE__ */ new Set(["tr"]),
|
|
20594
|
+
tfoot: /* @__PURE__ */ new Set(["tr"]),
|
|
20595
|
+
// these elements can not have any children elements
|
|
20596
|
+
script: emptySet,
|
|
20597
|
+
iframe: emptySet,
|
|
20598
|
+
option: emptySet,
|
|
20599
|
+
textarea: emptySet,
|
|
20600
|
+
style: emptySet,
|
|
20601
|
+
title: emptySet
|
|
20602
|
+
};
|
|
20603
|
+
const onlyValidParents = {
|
|
20604
|
+
// sections
|
|
20605
|
+
html: emptySet,
|
|
20606
|
+
body: /* @__PURE__ */ new Set(["html"]),
|
|
20607
|
+
head: /* @__PURE__ */ new Set(["html"]),
|
|
20608
|
+
// table
|
|
20609
|
+
td: /* @__PURE__ */ new Set(["tr"]),
|
|
20610
|
+
colgroup: /* @__PURE__ */ new Set(["table"]),
|
|
20611
|
+
caption: /* @__PURE__ */ new Set(["table"]),
|
|
20612
|
+
tbody: /* @__PURE__ */ new Set(["table"]),
|
|
20613
|
+
tfoot: /* @__PURE__ */ new Set(["table"]),
|
|
20614
|
+
col: /* @__PURE__ */ new Set(["colgroup"]),
|
|
20615
|
+
th: /* @__PURE__ */ new Set(["tr"]),
|
|
20616
|
+
thead: /* @__PURE__ */ new Set(["table"]),
|
|
20617
|
+
tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
|
|
20618
|
+
// data list
|
|
20619
|
+
dd: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
20620
|
+
dt: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
20621
|
+
// other
|
|
20622
|
+
figcaption: /* @__PURE__ */ new Set(["figure"]),
|
|
20623
|
+
// li: new Set(["ul", "ol"]),
|
|
20624
|
+
summary: /* @__PURE__ */ new Set(["details"]),
|
|
20625
|
+
area: /* @__PURE__ */ new Set(["map"])
|
|
20626
|
+
};
|
|
20627
|
+
const knownInvalidChildren = {
|
|
20628
|
+
p: /* @__PURE__ */ new Set([
|
|
20629
|
+
"address",
|
|
20630
|
+
"article",
|
|
20631
|
+
"aside",
|
|
20632
|
+
"blockquote",
|
|
20633
|
+
"center",
|
|
20634
|
+
"details",
|
|
20635
|
+
"dialog",
|
|
20636
|
+
"dir",
|
|
20637
|
+
"div",
|
|
20638
|
+
"dl",
|
|
20639
|
+
"fieldset",
|
|
20640
|
+
"figure",
|
|
20641
|
+
"footer",
|
|
20642
|
+
"form",
|
|
20643
|
+
"h1",
|
|
20644
|
+
"h2",
|
|
20645
|
+
"h3",
|
|
20646
|
+
"h4",
|
|
20647
|
+
"h5",
|
|
20648
|
+
"h6",
|
|
20649
|
+
"header",
|
|
20650
|
+
"hgroup",
|
|
20651
|
+
"hr",
|
|
20652
|
+
"li",
|
|
20653
|
+
"main",
|
|
20654
|
+
"nav",
|
|
20655
|
+
"menu",
|
|
20656
|
+
"ol",
|
|
20657
|
+
"p",
|
|
20658
|
+
"pre",
|
|
20659
|
+
"section",
|
|
20660
|
+
"table",
|
|
20661
|
+
"ul"
|
|
20662
|
+
]),
|
|
20663
|
+
svg: /* @__PURE__ */ new Set([
|
|
20664
|
+
"b",
|
|
20665
|
+
"blockquote",
|
|
20666
|
+
"br",
|
|
20667
|
+
"code",
|
|
20668
|
+
"dd",
|
|
20669
|
+
"div",
|
|
20670
|
+
"dl",
|
|
20671
|
+
"dt",
|
|
20672
|
+
"em",
|
|
20673
|
+
"embed",
|
|
20674
|
+
"h1",
|
|
20675
|
+
"h2",
|
|
20676
|
+
"h3",
|
|
20677
|
+
"h4",
|
|
20678
|
+
"h5",
|
|
20679
|
+
"h6",
|
|
20680
|
+
"hr",
|
|
20681
|
+
"i",
|
|
20682
|
+
"img",
|
|
20683
|
+
"li",
|
|
20684
|
+
"menu",
|
|
20685
|
+
"meta",
|
|
20686
|
+
"ol",
|
|
20687
|
+
"p",
|
|
20688
|
+
"pre",
|
|
20689
|
+
"ruby",
|
|
20690
|
+
"s",
|
|
20691
|
+
"small",
|
|
20692
|
+
"span",
|
|
20693
|
+
"strong",
|
|
20694
|
+
"sub",
|
|
20695
|
+
"sup",
|
|
20696
|
+
"table",
|
|
20697
|
+
"u",
|
|
20698
|
+
"ul",
|
|
20699
|
+
"var"
|
|
20700
|
+
])
|
|
20701
|
+
};
|
|
20702
|
+
const knownInvalidParents = {
|
|
20703
|
+
a: /* @__PURE__ */ new Set(["a"]),
|
|
20704
|
+
button: /* @__PURE__ */ new Set(["button"]),
|
|
20705
|
+
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
20706
|
+
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
20707
|
+
form: /* @__PURE__ */ new Set(["form"]),
|
|
20708
|
+
li: /* @__PURE__ */ new Set(["li"]),
|
|
20709
|
+
h1: headings,
|
|
20710
|
+
h2: headings,
|
|
20711
|
+
h3: headings,
|
|
20712
|
+
h4: headings,
|
|
20713
|
+
h5: headings,
|
|
20714
|
+
h6: headings
|
|
20715
|
+
};
|
|
20716
|
+
|
|
20717
|
+
const validateHtmlNesting = (node, context) => {
|
|
20718
|
+
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
|
|
20719
|
+
const error = new SyntaxError(
|
|
20720
|
+
`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
|
|
20721
|
+
);
|
|
20722
|
+
error.loc = node.loc;
|
|
20723
|
+
context.onWarn(error);
|
|
20724
|
+
}
|
|
20725
|
+
};
|
|
20726
|
+
|
|
20168
20727
|
const DOMNodeTransforms = [
|
|
20169
20728
|
transformStyle,
|
|
20170
|
-
...[transformTransition]
|
|
20729
|
+
...[transformTransition, validateHtmlNesting]
|
|
20171
20730
|
];
|
|
20172
20731
|
const DOMDirectiveTransforms = {
|
|
20173
20732
|
cloak: noopDirectiveTransform,
|