@vue/compiler-sfc 2.7.4 → 2.7.5
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/compiler-sfc.js +1030 -1024
- package/package.json +1 -1
package/dist/compiler-sfc.js
CHANGED
|
@@ -3445,145 +3445,6 @@ function setCurrentInstance(vm = null) {
|
|
|
3445
3445
|
vm && vm._scope.on();
|
|
3446
3446
|
}
|
|
3447
3447
|
|
|
3448
|
-
let warn$3 = noop;
|
|
3449
|
-
let tip = noop;
|
|
3450
|
-
let generateComponentTrace; // work around flow check
|
|
3451
|
-
let formatComponentName;
|
|
3452
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3453
|
-
const hasConsole = typeof console !== 'undefined';
|
|
3454
|
-
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
3455
|
-
const classify = str => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
3456
|
-
warn$3 = (msg, vm = currentInstance) => {
|
|
3457
|
-
const trace = vm ? generateComponentTrace(vm) : '';
|
|
3458
|
-
if (hasConsole && !config.silent) {
|
|
3459
|
-
console.error(`[Vue warn]: ${msg}${trace}`);
|
|
3460
|
-
}
|
|
3461
|
-
};
|
|
3462
|
-
tip = (msg, vm) => {
|
|
3463
|
-
if (hasConsole && !config.silent) {
|
|
3464
|
-
console.warn(`[Vue tip]: ${msg}` + (vm ? generateComponentTrace(vm) : ''));
|
|
3465
|
-
}
|
|
3466
|
-
};
|
|
3467
|
-
formatComponentName = (vm, includeFile) => {
|
|
3468
|
-
if (vm.$root === vm) {
|
|
3469
|
-
return '<Root>';
|
|
3470
|
-
}
|
|
3471
|
-
const options = isFunction(vm) && vm.cid != null
|
|
3472
|
-
? vm.options
|
|
3473
|
-
: vm._isVue
|
|
3474
|
-
? vm.$options || vm.constructor.options
|
|
3475
|
-
: vm;
|
|
3476
|
-
let name = options.name || options._componentTag;
|
|
3477
|
-
const file = options.__file;
|
|
3478
|
-
if (!name && file) {
|
|
3479
|
-
const match = file.match(/([^/\\]+)\.vue$/);
|
|
3480
|
-
name = match && match[1];
|
|
3481
|
-
}
|
|
3482
|
-
return ((name ? `<${classify(name)}>` : `<Anonymous>`) +
|
|
3483
|
-
(file && includeFile !== false ? ` at ${file}` : ''));
|
|
3484
|
-
};
|
|
3485
|
-
const repeat = (str, n) => {
|
|
3486
|
-
let res = '';
|
|
3487
|
-
while (n) {
|
|
3488
|
-
if (n % 2 === 1)
|
|
3489
|
-
res += str;
|
|
3490
|
-
if (n > 1)
|
|
3491
|
-
str += str;
|
|
3492
|
-
n >>= 1;
|
|
3493
|
-
}
|
|
3494
|
-
return res;
|
|
3495
|
-
};
|
|
3496
|
-
generateComponentTrace = (vm) => {
|
|
3497
|
-
if (vm._isVue && vm.$parent) {
|
|
3498
|
-
const tree = [];
|
|
3499
|
-
let currentRecursiveSequence = 0;
|
|
3500
|
-
while (vm) {
|
|
3501
|
-
if (tree.length > 0) {
|
|
3502
|
-
const last = tree[tree.length - 1];
|
|
3503
|
-
if (last.constructor === vm.constructor) {
|
|
3504
|
-
currentRecursiveSequence++;
|
|
3505
|
-
vm = vm.$parent;
|
|
3506
|
-
continue;
|
|
3507
|
-
}
|
|
3508
|
-
else if (currentRecursiveSequence > 0) {
|
|
3509
|
-
tree[tree.length - 1] = [last, currentRecursiveSequence];
|
|
3510
|
-
currentRecursiveSequence = 0;
|
|
3511
|
-
}
|
|
3512
|
-
}
|
|
3513
|
-
tree.push(vm);
|
|
3514
|
-
vm = vm.$parent;
|
|
3515
|
-
}
|
|
3516
|
-
return ('\n\nfound in\n\n' +
|
|
3517
|
-
tree
|
|
3518
|
-
.map((vm, i) => `${i === 0 ? '---> ' : repeat(' ', 5 + i * 2)}${isArray(vm)
|
|
3519
|
-
? `${formatComponentName(vm[0])}... (${vm[1]} recursive calls)`
|
|
3520
|
-
: formatComponentName(vm)}`)
|
|
3521
|
-
.join('\n'));
|
|
3522
|
-
}
|
|
3523
|
-
else {
|
|
3524
|
-
return `\n\n(found in ${formatComponentName(vm)})`;
|
|
3525
|
-
}
|
|
3526
|
-
};
|
|
3527
|
-
}
|
|
3528
|
-
|
|
3529
|
-
let uid = 0;
|
|
3530
|
-
/**
|
|
3531
|
-
* A dep is an observable that can have multiple
|
|
3532
|
-
* directives subscribing to it.
|
|
3533
|
-
* @internal
|
|
3534
|
-
*/
|
|
3535
|
-
class Dep {
|
|
3536
|
-
constructor() {
|
|
3537
|
-
this.id = uid++;
|
|
3538
|
-
this.subs = [];
|
|
3539
|
-
}
|
|
3540
|
-
addSub(sub) {
|
|
3541
|
-
this.subs.push(sub);
|
|
3542
|
-
}
|
|
3543
|
-
removeSub(sub) {
|
|
3544
|
-
remove$1(this.subs, sub);
|
|
3545
|
-
}
|
|
3546
|
-
depend(info) {
|
|
3547
|
-
if (Dep.target) {
|
|
3548
|
-
Dep.target.addDep(this);
|
|
3549
|
-
if (process.env.NODE_ENV !== 'production' && info && Dep.target.onTrack) {
|
|
3550
|
-
Dep.target.onTrack(Object.assign({ effect: Dep.target }, info));
|
|
3551
|
-
}
|
|
3552
|
-
}
|
|
3553
|
-
}
|
|
3554
|
-
notify(info) {
|
|
3555
|
-
// stabilize the subscriber list first
|
|
3556
|
-
const subs = this.subs.slice();
|
|
3557
|
-
if (process.env.NODE_ENV !== 'production' && !config.async) {
|
|
3558
|
-
// subs aren't sorted in scheduler if not running async
|
|
3559
|
-
// we need to sort them now to make sure they fire in correct
|
|
3560
|
-
// order
|
|
3561
|
-
subs.sort((a, b) => a.id - b.id);
|
|
3562
|
-
}
|
|
3563
|
-
for (let i = 0, l = subs.length; i < l; i++) {
|
|
3564
|
-
if (process.env.NODE_ENV !== 'production' && info) {
|
|
3565
|
-
const sub = subs[i];
|
|
3566
|
-
sub.onTrigger &&
|
|
3567
|
-
sub.onTrigger(Object.assign({ effect: subs[i] }, info));
|
|
3568
|
-
}
|
|
3569
|
-
subs[i].update();
|
|
3570
|
-
}
|
|
3571
|
-
}
|
|
3572
|
-
}
|
|
3573
|
-
// The current target watcher being evaluated.
|
|
3574
|
-
// This is globally unique because only one watcher
|
|
3575
|
-
// can be evaluated at a time.
|
|
3576
|
-
Dep.target = null;
|
|
3577
|
-
const targetStack = [];
|
|
3578
|
-
function pushTarget(target) {
|
|
3579
|
-
targetStack.push(target);
|
|
3580
|
-
Dep.target = target;
|
|
3581
|
-
}
|
|
3582
|
-
function popTarget() {
|
|
3583
|
-
targetStack.pop();
|
|
3584
|
-
Dep.target = targetStack[targetStack.length - 1];
|
|
3585
|
-
}
|
|
3586
|
-
|
|
3587
3448
|
/**
|
|
3588
3449
|
* @internal
|
|
3589
3450
|
*/
|
|
@@ -3650,6 +3511,89 @@ function cloneVNode(vnode) {
|
|
|
3650
3511
|
return cloned;
|
|
3651
3512
|
}
|
|
3652
3513
|
|
|
3514
|
+
/* not type checking this file because flow doesn't play well with Proxy */
|
|
3515
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3516
|
+
makeMap('Infinity,undefined,NaN,isFinite,isNaN,' +
|
|
3517
|
+
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
|
3518
|
+
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
|
|
3519
|
+
'require' // for Webpack/Browserify
|
|
3520
|
+
);
|
|
3521
|
+
const hasProxy = typeof Proxy !== 'undefined' && isNative(Proxy);
|
|
3522
|
+
if (hasProxy) {
|
|
3523
|
+
const isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
|
|
3524
|
+
config.keyCodes = new Proxy(config.keyCodes, {
|
|
3525
|
+
set(target, key, value) {
|
|
3526
|
+
if (isBuiltInModifier(key)) {
|
|
3527
|
+
warn$3(`Avoid overwriting built-in modifier in config.keyCodes: .${key}`);
|
|
3528
|
+
return false;
|
|
3529
|
+
}
|
|
3530
|
+
else {
|
|
3531
|
+
target[key] = value;
|
|
3532
|
+
return true;
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
});
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
let uid = 0;
|
|
3540
|
+
/**
|
|
3541
|
+
* A dep is an observable that can have multiple
|
|
3542
|
+
* directives subscribing to it.
|
|
3543
|
+
* @internal
|
|
3544
|
+
*/
|
|
3545
|
+
class Dep {
|
|
3546
|
+
constructor() {
|
|
3547
|
+
this.id = uid++;
|
|
3548
|
+
this.subs = [];
|
|
3549
|
+
}
|
|
3550
|
+
addSub(sub) {
|
|
3551
|
+
this.subs.push(sub);
|
|
3552
|
+
}
|
|
3553
|
+
removeSub(sub) {
|
|
3554
|
+
remove$1(this.subs, sub);
|
|
3555
|
+
}
|
|
3556
|
+
depend(info) {
|
|
3557
|
+
if (Dep.target) {
|
|
3558
|
+
Dep.target.addDep(this);
|
|
3559
|
+
if (process.env.NODE_ENV !== 'production' && info && Dep.target.onTrack) {
|
|
3560
|
+
Dep.target.onTrack(Object.assign({ effect: Dep.target }, info));
|
|
3561
|
+
}
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
notify(info) {
|
|
3565
|
+
// stabilize the subscriber list first
|
|
3566
|
+
const subs = this.subs.slice();
|
|
3567
|
+
if (process.env.NODE_ENV !== 'production' && !config.async) {
|
|
3568
|
+
// subs aren't sorted in scheduler if not running async
|
|
3569
|
+
// we need to sort them now to make sure they fire in correct
|
|
3570
|
+
// order
|
|
3571
|
+
subs.sort((a, b) => a.id - b.id);
|
|
3572
|
+
}
|
|
3573
|
+
for (let i = 0, l = subs.length; i < l; i++) {
|
|
3574
|
+
if (process.env.NODE_ENV !== 'production' && info) {
|
|
3575
|
+
const sub = subs[i];
|
|
3576
|
+
sub.onTrigger &&
|
|
3577
|
+
sub.onTrigger(Object.assign({ effect: subs[i] }, info));
|
|
3578
|
+
}
|
|
3579
|
+
subs[i].update();
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3582
|
+
}
|
|
3583
|
+
// The current target watcher being evaluated.
|
|
3584
|
+
// This is globally unique because only one watcher
|
|
3585
|
+
// can be evaluated at a time.
|
|
3586
|
+
Dep.target = null;
|
|
3587
|
+
const targetStack = [];
|
|
3588
|
+
function pushTarget(target) {
|
|
3589
|
+
targetStack.push(target);
|
|
3590
|
+
Dep.target = target;
|
|
3591
|
+
}
|
|
3592
|
+
function popTarget() {
|
|
3593
|
+
targetStack.pop();
|
|
3594
|
+
Dep.target = targetStack[targetStack.length - 1];
|
|
3595
|
+
}
|
|
3596
|
+
|
|
3653
3597
|
/*
|
|
3654
3598
|
* not type checking this file because flow doesn't play well with
|
|
3655
3599
|
* dynamically accessing methods on Array prototype
|
|
@@ -3701,53 +3645,252 @@ methodsToPatch.forEach(function (method) {
|
|
|
3701
3645
|
});
|
|
3702
3646
|
});
|
|
3703
3647
|
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
}
|
|
3707
|
-
|
|
3708
|
-
function isRef(r) {
|
|
3709
|
-
return !!(r && r.__v_isRef === true);
|
|
3710
|
-
}
|
|
3711
|
-
|
|
3712
|
-
const seenObjects = new _Set();
|
|
3648
|
+
const arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
|
3649
|
+
const NO_INIITIAL_VALUE = {};
|
|
3713
3650
|
/**
|
|
3714
|
-
*
|
|
3715
|
-
*
|
|
3716
|
-
* is collected as a "deep" dependency.
|
|
3651
|
+
* In some cases we may want to disable observation inside a component's
|
|
3652
|
+
* update computation.
|
|
3717
3653
|
*/
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
return val;
|
|
3654
|
+
let shouldObserve = true;
|
|
3655
|
+
function toggleObserving(value) {
|
|
3656
|
+
shouldObserve = value;
|
|
3722
3657
|
}
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3658
|
+
// ssr mock dep
|
|
3659
|
+
const mockDep = {
|
|
3660
|
+
notify: noop,
|
|
3661
|
+
depend: noop,
|
|
3662
|
+
addSub: noop,
|
|
3663
|
+
removeSub: noop
|
|
3664
|
+
};
|
|
3665
|
+
/**
|
|
3666
|
+
* Observer class that is attached to each observed
|
|
3667
|
+
* object. Once attached, the observer converts the target
|
|
3668
|
+
* object's property keys into getter/setters that
|
|
3669
|
+
* collect dependencies and dispatch updates.
|
|
3670
|
+
*/
|
|
3671
|
+
class Observer {
|
|
3672
|
+
constructor(value, shallow = false, mock = false) {
|
|
3673
|
+
this.value = value;
|
|
3674
|
+
this.shallow = shallow;
|
|
3675
|
+
this.mock = mock;
|
|
3676
|
+
// this.value = value
|
|
3677
|
+
this.dep = mock ? mockDep : new Dep();
|
|
3678
|
+
this.vmCount = 0;
|
|
3679
|
+
def(value, '__ob__', this);
|
|
3680
|
+
if (isArray(value)) {
|
|
3681
|
+
if (!mock) {
|
|
3682
|
+
if (hasProto) {
|
|
3683
|
+
value.__proto__ = arrayMethods;
|
|
3684
|
+
/* eslint-enable no-proto */
|
|
3685
|
+
}
|
|
3686
|
+
else {
|
|
3687
|
+
for (let i = 0, l = arrayKeys.length; i < l; i++) {
|
|
3688
|
+
const key = arrayKeys[i];
|
|
3689
|
+
def(value, key, arrayMethods[key]);
|
|
3690
|
+
}
|
|
3691
|
+
}
|
|
3692
|
+
}
|
|
3693
|
+
if (!shallow) {
|
|
3694
|
+
this.observeArray(value);
|
|
3695
|
+
}
|
|
3696
|
+
}
|
|
3697
|
+
else {
|
|
3698
|
+
/**
|
|
3699
|
+
* Walk through all properties and convert them into
|
|
3700
|
+
* getter/setters. This method should only be called when
|
|
3701
|
+
* value type is Object.
|
|
3702
|
+
*/
|
|
3703
|
+
const keys = Object.keys(value);
|
|
3704
|
+
for (let i = 0; i < keys.length; i++) {
|
|
3705
|
+
const key = keys[i];
|
|
3706
|
+
defineReactive(value, key, NO_INIITIAL_VALUE, undefined, shallow, mock);
|
|
3707
|
+
}
|
|
3735
3708
|
}
|
|
3736
|
-
seen.add(depId);
|
|
3737
3709
|
}
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3710
|
+
/**
|
|
3711
|
+
* Observe a list of Array items.
|
|
3712
|
+
*/
|
|
3713
|
+
observeArray(value) {
|
|
3714
|
+
for (let i = 0, l = value.length; i < l; i++) {
|
|
3715
|
+
observe(value[i], false, this.mock);
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3719
|
+
// helpers
|
|
3720
|
+
/**
|
|
3721
|
+
* Attempt to create an observer instance for a value,
|
|
3722
|
+
* returns the new observer if successfully observed,
|
|
3723
|
+
* or the existing observer if the value already has one.
|
|
3724
|
+
*/
|
|
3725
|
+
function observe(value, shallow, ssrMockReactivity) {
|
|
3726
|
+
if (!isObject$1(value) || isRef(value) || value instanceof VNode) {
|
|
3727
|
+
return;
|
|
3728
|
+
}
|
|
3729
|
+
let ob;
|
|
3730
|
+
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
|
3731
|
+
ob = value.__ob__;
|
|
3732
|
+
}
|
|
3733
|
+
else if (shouldObserve &&
|
|
3734
|
+
(ssrMockReactivity || !isServerRendering()) &&
|
|
3735
|
+
(isArray(value) || isPlainObject(value)) &&
|
|
3736
|
+
Object.isExtensible(value) &&
|
|
3737
|
+
!value.__v_skip /* ReactiveFlags.SKIP */) {
|
|
3738
|
+
ob = new Observer(value, shallow, ssrMockReactivity);
|
|
3739
|
+
}
|
|
3740
|
+
return ob;
|
|
3741
|
+
}
|
|
3742
|
+
/**
|
|
3743
|
+
* Define a reactive property on an Object.
|
|
3744
|
+
*/
|
|
3745
|
+
function defineReactive(obj, key, val, customSetter, shallow, mock) {
|
|
3746
|
+
const dep = new Dep();
|
|
3747
|
+
const property = Object.getOwnPropertyDescriptor(obj, key);
|
|
3748
|
+
if (property && property.configurable === false) {
|
|
3749
|
+
return;
|
|
3750
|
+
}
|
|
3751
|
+
// cater for pre-defined getter/setters
|
|
3752
|
+
const getter = property && property.get;
|
|
3753
|
+
const setter = property && property.set;
|
|
3754
|
+
if ((!getter || setter) &&
|
|
3755
|
+
(val === NO_INIITIAL_VALUE || arguments.length === 2)) {
|
|
3756
|
+
val = obj[key];
|
|
3757
|
+
}
|
|
3758
|
+
let childOb = !shallow && observe(val, false, mock);
|
|
3759
|
+
Object.defineProperty(obj, key, {
|
|
3760
|
+
enumerable: true,
|
|
3761
|
+
configurable: true,
|
|
3762
|
+
get: function reactiveGetter() {
|
|
3763
|
+
const value = getter ? getter.call(obj) : val;
|
|
3764
|
+
if (Dep.target) {
|
|
3765
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3766
|
+
dep.depend({
|
|
3767
|
+
target: obj,
|
|
3768
|
+
type: "get" /* TrackOpTypes.GET */,
|
|
3769
|
+
key
|
|
3770
|
+
});
|
|
3771
|
+
}
|
|
3772
|
+
else {
|
|
3773
|
+
dep.depend();
|
|
3774
|
+
}
|
|
3775
|
+
if (childOb) {
|
|
3776
|
+
childOb.dep.depend();
|
|
3777
|
+
if (isArray(value)) {
|
|
3778
|
+
dependArray(value);
|
|
3779
|
+
}
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
return isRef(value) && !shallow ? value.value : value;
|
|
3783
|
+
},
|
|
3784
|
+
set: function reactiveSetter(newVal) {
|
|
3785
|
+
const value = getter ? getter.call(obj) : val;
|
|
3786
|
+
if (!hasChanged(value, newVal)) {
|
|
3787
|
+
return;
|
|
3788
|
+
}
|
|
3789
|
+
if (process.env.NODE_ENV !== 'production' && customSetter) {
|
|
3790
|
+
customSetter();
|
|
3791
|
+
}
|
|
3792
|
+
if (setter) {
|
|
3793
|
+
setter.call(obj, newVal);
|
|
3794
|
+
}
|
|
3795
|
+
else if (getter) {
|
|
3796
|
+
// #7981: for accessor properties without setter
|
|
3797
|
+
return;
|
|
3798
|
+
}
|
|
3799
|
+
else if (isRef(value) && !isRef(newVal)) {
|
|
3800
|
+
value.value = newVal;
|
|
3801
|
+
return;
|
|
3802
|
+
}
|
|
3803
|
+
else {
|
|
3804
|
+
val = newVal;
|
|
3805
|
+
}
|
|
3806
|
+
childOb = !shallow && observe(newVal, false, mock);
|
|
3807
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3808
|
+
dep.notify({
|
|
3809
|
+
type: "set" /* TriggerOpTypes.SET */,
|
|
3810
|
+
target: obj,
|
|
3811
|
+
key,
|
|
3812
|
+
newValue: newVal,
|
|
3813
|
+
oldValue: value
|
|
3814
|
+
});
|
|
3815
|
+
}
|
|
3816
|
+
else {
|
|
3817
|
+
dep.notify();
|
|
3818
|
+
}
|
|
3819
|
+
}
|
|
3820
|
+
});
|
|
3821
|
+
return dep;
|
|
3822
|
+
}
|
|
3823
|
+
function set(target, key, val) {
|
|
3824
|
+
if (process.env.NODE_ENV !== 'production' && (isUndef(target) || isPrimitive(target))) {
|
|
3825
|
+
warn$3(`Cannot set reactive property on undefined, null, or primitive value: ${target}`);
|
|
3826
|
+
}
|
|
3827
|
+
if (isReadonly(target)) {
|
|
3828
|
+
process.env.NODE_ENV !== 'production' && warn$3(`Set operation on key "${key}" failed: target is readonly.`);
|
|
3829
|
+
return;
|
|
3830
|
+
}
|
|
3831
|
+
const ob = target.__ob__;
|
|
3832
|
+
if (isArray(target) && isValidArrayIndex(key)) {
|
|
3833
|
+
target.length = Math.max(target.length, key);
|
|
3834
|
+
target.splice(key, 1, val);
|
|
3835
|
+
// when mocking for SSR, array methods are not hijacked
|
|
3836
|
+
if (ob && !ob.shallow && ob.mock) {
|
|
3837
|
+
observe(val, false, true);
|
|
3838
|
+
}
|
|
3839
|
+
return val;
|
|
3840
|
+
}
|
|
3841
|
+
if (key in target && !(key in Object.prototype)) {
|
|
3842
|
+
target[key] = val;
|
|
3843
|
+
return val;
|
|
3844
|
+
}
|
|
3845
|
+
if (target._isVue || (ob && ob.vmCount)) {
|
|
3846
|
+
process.env.NODE_ENV !== 'production' &&
|
|
3847
|
+
warn$3('Avoid adding reactive properties to a Vue instance or its root $data ' +
|
|
3848
|
+
'at runtime - declare it upfront in the data option.');
|
|
3849
|
+
return val;
|
|
3850
|
+
}
|
|
3851
|
+
if (!ob) {
|
|
3852
|
+
target[key] = val;
|
|
3853
|
+
return val;
|
|
3854
|
+
}
|
|
3855
|
+
defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock);
|
|
3856
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3857
|
+
ob.dep.notify({
|
|
3858
|
+
type: "add" /* TriggerOpTypes.ADD */,
|
|
3859
|
+
target: target,
|
|
3860
|
+
key,
|
|
3861
|
+
newValue: val,
|
|
3862
|
+
oldValue: undefined
|
|
3863
|
+
});
|
|
3742
3864
|
}
|
|
3743
3865
|
else {
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3866
|
+
ob.dep.notify();
|
|
3867
|
+
}
|
|
3868
|
+
return val;
|
|
3869
|
+
}
|
|
3870
|
+
/**
|
|
3871
|
+
* Collect dependencies on array elements when the array is touched, since
|
|
3872
|
+
* we cannot intercept array element access like property getters.
|
|
3873
|
+
*/
|
|
3874
|
+
function dependArray(value) {
|
|
3875
|
+
for (let e, i = 0, l = value.length; i < l; i++) {
|
|
3876
|
+
e = value[i];
|
|
3877
|
+
if (e && e.__ob__) {
|
|
3878
|
+
e.__ob__.dep.depend();
|
|
3879
|
+
}
|
|
3880
|
+
if (isArray(e)) {
|
|
3881
|
+
dependArray(e);
|
|
3882
|
+
}
|
|
3748
3883
|
}
|
|
3749
3884
|
}
|
|
3750
3885
|
|
|
3886
|
+
function isReadonly(value) {
|
|
3887
|
+
return !!(value && value.__v_isReadonly);
|
|
3888
|
+
}
|
|
3889
|
+
|
|
3890
|
+
function isRef(r) {
|
|
3891
|
+
return !!(r && r.__v_isRef === true);
|
|
3892
|
+
}
|
|
3893
|
+
|
|
3751
3894
|
if (process.env.NODE_ENV !== 'production') ;
|
|
3752
3895
|
|
|
3753
3896
|
const normalizeEvent = cached((name) => {
|
|
@@ -3951,295 +4094,156 @@ function normalizeArrayChildren(children, nestedIndex) {
|
|
|
3951
4094
|
return res;
|
|
3952
4095
|
}
|
|
3953
4096
|
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
const isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
|
|
3964
|
-
config.keyCodes = new Proxy(config.keyCodes, {
|
|
3965
|
-
set(target, key, value) {
|
|
3966
|
-
if (isBuiltInModifier(key)) {
|
|
3967
|
-
warn$3(`Avoid overwriting built-in modifier in config.keyCodes: .${key}`);
|
|
3968
|
-
return false;
|
|
3969
|
-
}
|
|
3970
|
-
else {
|
|
3971
|
-
target[key] = value;
|
|
3972
|
-
return true;
|
|
3973
|
-
}
|
|
3974
|
-
}
|
|
3975
|
-
});
|
|
4097
|
+
const SIMPLE_NORMALIZE = 1;
|
|
4098
|
+
const ALWAYS_NORMALIZE = 2;
|
|
4099
|
+
// wrapper function for providing a more flexible interface
|
|
4100
|
+
// without getting yelled at by flow
|
|
4101
|
+
function createElement(context, tag, data, children, normalizationType, alwaysNormalize) {
|
|
4102
|
+
if (isArray(data) || isPrimitive(data)) {
|
|
4103
|
+
normalizationType = children;
|
|
4104
|
+
children = data;
|
|
4105
|
+
data = undefined;
|
|
3976
4106
|
}
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
4107
|
+
if (isTrue(alwaysNormalize)) {
|
|
4108
|
+
normalizationType = ALWAYS_NORMALIZE;
|
|
4109
|
+
}
|
|
4110
|
+
return _createElement(context, tag, data, children, normalizationType);
|
|
4111
|
+
}
|
|
4112
|
+
function _createElement(context, tag, data, children, normalizationType) {
|
|
4113
|
+
if (isDef(data) && isDef(data.__ob__)) {
|
|
4114
|
+
process.env.NODE_ENV !== 'production' &&
|
|
4115
|
+
warn$3(`Avoid using observed data object as vnode data: ${JSON.stringify(data)}\n` + 'Always create fresh vnode data objects in each render!', context);
|
|
4116
|
+
return createEmptyVNode();
|
|
4117
|
+
}
|
|
4118
|
+
// object syntax in v-bind
|
|
4119
|
+
if (isDef(data) && isDef(data.is)) {
|
|
4120
|
+
tag = data.is;
|
|
4121
|
+
}
|
|
4122
|
+
if (!tag) {
|
|
4123
|
+
// in case of component :is set to falsy value
|
|
4124
|
+
return createEmptyVNode();
|
|
4125
|
+
}
|
|
4126
|
+
// warn against non-primitive key
|
|
4127
|
+
if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
|
|
4128
|
+
warn$3('Avoid using non-primitive value as key, ' +
|
|
4129
|
+
'use string/number value instead.', context);
|
|
4130
|
+
}
|
|
4131
|
+
// support single function children as default scoped slot
|
|
4132
|
+
if (isArray(children) && isFunction(children[0])) {
|
|
4133
|
+
data = data || {};
|
|
4134
|
+
data.scopedSlots = { default: children[0] };
|
|
4135
|
+
children.length = 0;
|
|
4136
|
+
}
|
|
4137
|
+
if (normalizationType === ALWAYS_NORMALIZE) {
|
|
4138
|
+
children = normalizeChildren(children);
|
|
4139
|
+
}
|
|
4140
|
+
else if (normalizationType === SIMPLE_NORMALIZE) {
|
|
4141
|
+
children = simpleNormalizeChildren(children);
|
|
4142
|
+
}
|
|
4143
|
+
let vnode, ns;
|
|
4144
|
+
if (typeof tag === 'string') {
|
|
4145
|
+
let Ctor;
|
|
4146
|
+
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
|
4147
|
+
if ((!data || !data.pre) &&
|
|
4148
|
+
isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) {
|
|
4149
|
+
// component
|
|
4150
|
+
vnode = createComponent(Ctor, data, context, children, tag);
|
|
3985
4151
|
}
|
|
3986
|
-
else
|
|
3987
|
-
|
|
4152
|
+
else {
|
|
4153
|
+
// unknown or unlisted namespaced elements
|
|
4154
|
+
// check at runtime because it may get assigned a namespace when its
|
|
4155
|
+
// parent normalizes children
|
|
4156
|
+
vnode = new VNode(tag, data, children, undefined, undefined, context);
|
|
3988
4157
|
}
|
|
3989
4158
|
}
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
4159
|
+
else {
|
|
4160
|
+
// direct component options / constructor
|
|
4161
|
+
vnode = createComponent(tag, data, context, children);
|
|
4162
|
+
}
|
|
4163
|
+
if (isArray(vnode)) {
|
|
4164
|
+
return vnode;
|
|
4165
|
+
}
|
|
4166
|
+
else if (isDef(vnode)) {
|
|
4167
|
+
if (isDef(ns))
|
|
4168
|
+
applyNS(vnode, ns);
|
|
4169
|
+
if (isDef(data))
|
|
4170
|
+
registerDeepBindings(data);
|
|
4171
|
+
return vnode;
|
|
4172
|
+
}
|
|
4173
|
+
else {
|
|
4174
|
+
return createEmptyVNode();
|
|
3995
4175
|
}
|
|
3996
|
-
return changed;
|
|
3997
4176
|
}
|
|
3998
|
-
function
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
}
|
|
4005
|
-
});
|
|
4006
|
-
}
|
|
4007
|
-
|
|
4008
|
-
function resolveInject(inject, vm) {
|
|
4009
|
-
if (inject) {
|
|
4010
|
-
// inject is :any because flow is not smart enough to figure out cached
|
|
4011
|
-
const result = Object.create(null);
|
|
4012
|
-
const keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
|
|
4013
|
-
for (let i = 0; i < keys.length; i++) {
|
|
4014
|
-
const key = keys[i];
|
|
4015
|
-
// #6574 in case the inject object is observed...
|
|
4016
|
-
if (key === '__ob__')
|
|
4017
|
-
continue;
|
|
4018
|
-
const provideKey = inject[key].from;
|
|
4019
|
-
if (provideKey in vm._provided) {
|
|
4020
|
-
result[key] = vm._provided[provideKey];
|
|
4021
|
-
}
|
|
4022
|
-
else if ('default' in inject[key]) {
|
|
4023
|
-
const provideDefault = inject[key].default;
|
|
4024
|
-
result[key] = isFunction(provideDefault)
|
|
4025
|
-
? provideDefault.call(vm)
|
|
4026
|
-
: provideDefault;
|
|
4027
|
-
}
|
|
4028
|
-
else if (process.env.NODE_ENV !== 'production') {
|
|
4029
|
-
warn$3(`Injection "${key}" not found`, vm);
|
|
4030
|
-
}
|
|
4031
|
-
}
|
|
4032
|
-
return result;
|
|
4177
|
+
function applyNS(vnode, ns, force) {
|
|
4178
|
+
vnode.ns = ns;
|
|
4179
|
+
if (vnode.tag === 'foreignObject') {
|
|
4180
|
+
// use default namespace inside foreignObject
|
|
4181
|
+
ns = undefined;
|
|
4182
|
+
force = true;
|
|
4033
4183
|
}
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
const cachedSuperOptions = Ctor.superOptions;
|
|
4041
|
-
if (superOptions !== cachedSuperOptions) {
|
|
4042
|
-
// super option changed,
|
|
4043
|
-
// need to resolve new options.
|
|
4044
|
-
Ctor.superOptions = superOptions;
|
|
4045
|
-
// check if there are any late-modified/attached options (#4976)
|
|
4046
|
-
const modifiedOptions = resolveModifiedOptions(Ctor);
|
|
4047
|
-
// update base extend options
|
|
4048
|
-
if (modifiedOptions) {
|
|
4049
|
-
extend(Ctor.extendOptions, modifiedOptions);
|
|
4050
|
-
}
|
|
4051
|
-
options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
|
|
4052
|
-
if (options.name) {
|
|
4053
|
-
options.components[options.name] = Ctor;
|
|
4184
|
+
if (isDef(vnode.children)) {
|
|
4185
|
+
for (let i = 0, l = vnode.children.length; i < l; i++) {
|
|
4186
|
+
const child = vnode.children[i];
|
|
4187
|
+
if (isDef(child.tag) &&
|
|
4188
|
+
(isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
|
4189
|
+
applyNS(child, ns, force);
|
|
4054
4190
|
}
|
|
4055
4191
|
}
|
|
4056
4192
|
}
|
|
4057
|
-
return options;
|
|
4058
4193
|
}
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
}
|
|
4194
|
+
// ref #5318
|
|
4195
|
+
// necessary to ensure parent re-render when deep bindings like :style and
|
|
4196
|
+
// :class are used on slot nodes
|
|
4197
|
+
function registerDeepBindings(data) {
|
|
4198
|
+
if (isObject$1(data.style)) {
|
|
4199
|
+
traverse(data.style);
|
|
4200
|
+
}
|
|
4201
|
+
if (isObject$1(data.class)) {
|
|
4202
|
+
traverse(data.class);
|
|
4069
4203
|
}
|
|
4070
|
-
return modified;
|
|
4071
4204
|
}
|
|
4072
4205
|
|
|
4073
4206
|
/**
|
|
4074
|
-
* Runtime helper for
|
|
4207
|
+
* Runtime helper for rendering v-for lists.
|
|
4075
4208
|
*/
|
|
4076
|
-
function
|
|
4077
|
-
|
|
4078
|
-
|
|
4209
|
+
function renderList(val, render) {
|
|
4210
|
+
let ret = null, i, l, keys, key;
|
|
4211
|
+
if (isArray(val) || typeof val === 'string') {
|
|
4212
|
+
ret = new Array(val.length);
|
|
4213
|
+
for (i = 0, l = val.length; i < l; i++) {
|
|
4214
|
+
ret[i] = render(val[i], i);
|
|
4215
|
+
}
|
|
4079
4216
|
}
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
// remove slot attribute if the node is resolved as a Vue slot node
|
|
4085
|
-
if (data && data.attrs && data.attrs.slot) {
|
|
4086
|
-
delete data.attrs.slot;
|
|
4217
|
+
else if (typeof val === 'number') {
|
|
4218
|
+
ret = new Array(val);
|
|
4219
|
+
for (i = 0; i < val; i++) {
|
|
4220
|
+
ret[i] = render(i + 1, i);
|
|
4087
4221
|
}
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
if (
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
}
|
|
4098
|
-
else {
|
|
4099
|
-
slot.push(child);
|
|
4222
|
+
}
|
|
4223
|
+
else if (isObject$1(val)) {
|
|
4224
|
+
if (hasSymbol && val[Symbol.iterator]) {
|
|
4225
|
+
ret = [];
|
|
4226
|
+
const iterator = val[Symbol.iterator]();
|
|
4227
|
+
let result = iterator.next();
|
|
4228
|
+
while (!result.done) {
|
|
4229
|
+
ret.push(render(result.value, ret.length));
|
|
4230
|
+
result = iterator.next();
|
|
4100
4231
|
}
|
|
4101
4232
|
}
|
|
4102
4233
|
else {
|
|
4103
|
-
|
|
4234
|
+
keys = Object.keys(val);
|
|
4235
|
+
ret = new Array(keys.length);
|
|
4236
|
+
for (i = 0, l = keys.length; i < l; i++) {
|
|
4237
|
+
key = keys[i];
|
|
4238
|
+
ret[i] = render(val[key], key, i);
|
|
4239
|
+
}
|
|
4104
4240
|
}
|
|
4105
4241
|
}
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
if (slots[name].every(isWhitespace)) {
|
|
4109
|
-
delete slots[name];
|
|
4110
|
-
}
|
|
4242
|
+
if (!isDef(ret)) {
|
|
4243
|
+
ret = [];
|
|
4111
4244
|
}
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
function isWhitespace(node) {
|
|
4115
|
-
return (node.isComment && !node.asyncFactory) || node.text === ' ';
|
|
4116
|
-
}
|
|
4117
|
-
|
|
4118
|
-
function isAsyncPlaceholder(node) {
|
|
4119
|
-
// @ts-expect-error not really boolean type
|
|
4120
|
-
return node.isComment && node.asyncFactory;
|
|
4121
|
-
}
|
|
4122
|
-
|
|
4123
|
-
function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {
|
|
4124
|
-
let res;
|
|
4125
|
-
const hasNormalSlots = Object.keys(normalSlots).length > 0;
|
|
4126
|
-
const isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;
|
|
4127
|
-
const key = scopedSlots && scopedSlots.$key;
|
|
4128
|
-
if (!scopedSlots) {
|
|
4129
|
-
res = {};
|
|
4130
|
-
}
|
|
4131
|
-
else if (scopedSlots._normalized) {
|
|
4132
|
-
// fast path 1: child component re-render only, parent did not change
|
|
4133
|
-
return scopedSlots._normalized;
|
|
4134
|
-
}
|
|
4135
|
-
else if (isStable &&
|
|
4136
|
-
prevScopedSlots &&
|
|
4137
|
-
prevScopedSlots !== emptyObject &&
|
|
4138
|
-
key === prevScopedSlots.$key &&
|
|
4139
|
-
!hasNormalSlots &&
|
|
4140
|
-
!prevScopedSlots.$hasNormal) {
|
|
4141
|
-
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
|
4142
|
-
// only need to normalize once
|
|
4143
|
-
return prevScopedSlots;
|
|
4144
|
-
}
|
|
4145
|
-
else {
|
|
4146
|
-
res = {};
|
|
4147
|
-
for (const key in scopedSlots) {
|
|
4148
|
-
if (scopedSlots[key] && key[0] !== '$') {
|
|
4149
|
-
res[key] = normalizeScopedSlot(ownerVm, normalSlots, key, scopedSlots[key]);
|
|
4150
|
-
}
|
|
4151
|
-
}
|
|
4152
|
-
}
|
|
4153
|
-
// expose normal slots on scopedSlots
|
|
4154
|
-
for (const key in normalSlots) {
|
|
4155
|
-
if (!(key in res)) {
|
|
4156
|
-
res[key] = proxyNormalSlot(normalSlots, key);
|
|
4157
|
-
}
|
|
4158
|
-
}
|
|
4159
|
-
// avoriaz seems to mock a non-extensible $scopedSlots object
|
|
4160
|
-
// and when that is passed down this would cause an error
|
|
4161
|
-
if (scopedSlots && Object.isExtensible(scopedSlots)) {
|
|
4162
|
-
scopedSlots._normalized = res;
|
|
4163
|
-
}
|
|
4164
|
-
def(res, '$stable', isStable);
|
|
4165
|
-
def(res, '$key', key);
|
|
4166
|
-
def(res, '$hasNormal', hasNormalSlots);
|
|
4167
|
-
return res;
|
|
4168
|
-
}
|
|
4169
|
-
function normalizeScopedSlot(vm, normalSlots, key, fn) {
|
|
4170
|
-
const normalized = function () {
|
|
4171
|
-
const cur = currentInstance;
|
|
4172
|
-
setCurrentInstance(vm);
|
|
4173
|
-
let res = arguments.length ? fn.apply(null, arguments) : fn({});
|
|
4174
|
-
res =
|
|
4175
|
-
res && typeof res === 'object' && !isArray(res)
|
|
4176
|
-
? [res] // single vnode
|
|
4177
|
-
: normalizeChildren(res);
|
|
4178
|
-
const vnode = res && res[0];
|
|
4179
|
-
setCurrentInstance(cur);
|
|
4180
|
-
return res &&
|
|
4181
|
-
(!vnode ||
|
|
4182
|
-
(res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
|
|
4183
|
-
? undefined
|
|
4184
|
-
: res;
|
|
4185
|
-
};
|
|
4186
|
-
// this is a slot using the new v-slot syntax without scope. although it is
|
|
4187
|
-
// compiled as a scoped slot, render fn users would expect it to be present
|
|
4188
|
-
// on this.$slots because the usage is semantically a normal slot.
|
|
4189
|
-
if (fn.proxy) {
|
|
4190
|
-
Object.defineProperty(normalSlots, key, {
|
|
4191
|
-
get: normalized,
|
|
4192
|
-
enumerable: true,
|
|
4193
|
-
configurable: true
|
|
4194
|
-
});
|
|
4195
|
-
}
|
|
4196
|
-
return normalized;
|
|
4197
|
-
}
|
|
4198
|
-
function proxyNormalSlot(slots, key) {
|
|
4199
|
-
return () => slots[key];
|
|
4200
|
-
}
|
|
4201
|
-
|
|
4202
|
-
/**
|
|
4203
|
-
* Runtime helper for rendering v-for lists.
|
|
4204
|
-
*/
|
|
4205
|
-
function renderList(val, render) {
|
|
4206
|
-
let ret = null, i, l, keys, key;
|
|
4207
|
-
if (isArray(val) || typeof val === 'string') {
|
|
4208
|
-
ret = new Array(val.length);
|
|
4209
|
-
for (i = 0, l = val.length; i < l; i++) {
|
|
4210
|
-
ret[i] = render(val[i], i);
|
|
4211
|
-
}
|
|
4212
|
-
}
|
|
4213
|
-
else if (typeof val === 'number') {
|
|
4214
|
-
ret = new Array(val);
|
|
4215
|
-
for (i = 0; i < val; i++) {
|
|
4216
|
-
ret[i] = render(i + 1, i);
|
|
4217
|
-
}
|
|
4218
|
-
}
|
|
4219
|
-
else if (isObject$1(val)) {
|
|
4220
|
-
if (hasSymbol && val[Symbol.iterator]) {
|
|
4221
|
-
ret = [];
|
|
4222
|
-
const iterator = val[Symbol.iterator]();
|
|
4223
|
-
let result = iterator.next();
|
|
4224
|
-
while (!result.done) {
|
|
4225
|
-
ret.push(render(result.value, ret.length));
|
|
4226
|
-
result = iterator.next();
|
|
4227
|
-
}
|
|
4228
|
-
}
|
|
4229
|
-
else {
|
|
4230
|
-
keys = Object.keys(val);
|
|
4231
|
-
ret = new Array(keys.length);
|
|
4232
|
-
for (i = 0, l = keys.length; i < l; i++) {
|
|
4233
|
-
key = keys[i];
|
|
4234
|
-
ret[i] = render(val[key], key, i);
|
|
4235
|
-
}
|
|
4236
|
-
}
|
|
4237
|
-
}
|
|
4238
|
-
if (!isDef(ret)) {
|
|
4239
|
-
ret = [];
|
|
4240
|
-
}
|
|
4241
|
-
ret._isVList = true;
|
|
4242
|
-
return ret;
|
|
4245
|
+
ret._isVList = true;
|
|
4246
|
+
return ret;
|
|
4243
4247
|
}
|
|
4244
4248
|
|
|
4245
4249
|
/**
|
|
@@ -4477,417 +4481,162 @@ function installRenderHelpers(target) {
|
|
|
4477
4481
|
target._p = prependModifier;
|
|
4478
4482
|
}
|
|
4479
4483
|
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
contextVm = Object.create(parent);
|
|
4487
|
-
contextVm._original = parent;
|
|
4488
|
-
}
|
|
4489
|
-
else {
|
|
4490
|
-
// the context vm passed in is a functional context as well.
|
|
4491
|
-
// in this case we want to make sure we are able to get a hold to the
|
|
4492
|
-
// real context instance.
|
|
4493
|
-
contextVm = parent;
|
|
4494
|
-
// @ts-ignore
|
|
4495
|
-
parent = parent._original;
|
|
4484
|
+
/**
|
|
4485
|
+
* Runtime helper for resolving raw children VNodes into a slot object.
|
|
4486
|
+
*/
|
|
4487
|
+
function resolveSlots(children, context) {
|
|
4488
|
+
if (!children || !children.length) {
|
|
4489
|
+
return {};
|
|
4496
4490
|
}
|
|
4497
|
-
const
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
this.injections = resolveInject(options.inject, parent);
|
|
4505
|
-
this.slots = () => {
|
|
4506
|
-
if (!this.$slots) {
|
|
4507
|
-
normalizeScopedSlots(parent, data.scopedSlots, (this.$slots = resolveSlots(children, parent)));
|
|
4508
|
-
}
|
|
4509
|
-
return this.$slots;
|
|
4510
|
-
};
|
|
4511
|
-
Object.defineProperty(this, 'scopedSlots', {
|
|
4512
|
-
enumerable: true,
|
|
4513
|
-
get() {
|
|
4514
|
-
return normalizeScopedSlots(parent, data.scopedSlots, this.slots());
|
|
4491
|
+
const slots = {};
|
|
4492
|
+
for (let i = 0, l = children.length; i < l; i++) {
|
|
4493
|
+
const child = children[i];
|
|
4494
|
+
const data = child.data;
|
|
4495
|
+
// remove slot attribute if the node is resolved as a Vue slot node
|
|
4496
|
+
if (data && data.attrs && data.attrs.slot) {
|
|
4497
|
+
delete data.attrs.slot;
|
|
4515
4498
|
}
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
if (vnode && !isArray(vnode)) {
|
|
4529
|
-
vnode.fnScopeId = options._scopeId;
|
|
4530
|
-
vnode.fnContext = parent;
|
|
4499
|
+
// named slots should only be respected if the vnode was rendered in the
|
|
4500
|
+
// same context.
|
|
4501
|
+
if ((child.context === context || child.fnContext === context) &&
|
|
4502
|
+
data &&
|
|
4503
|
+
data.slot != null) {
|
|
4504
|
+
const name = data.slot;
|
|
4505
|
+
const slot = slots[name] || (slots[name] = []);
|
|
4506
|
+
if (child.tag === 'template') {
|
|
4507
|
+
slot.push.apply(slot, child.children || []);
|
|
4508
|
+
}
|
|
4509
|
+
else {
|
|
4510
|
+
slot.push(child);
|
|
4531
4511
|
}
|
|
4532
|
-
return vnode;
|
|
4533
|
-
};
|
|
4534
|
-
}
|
|
4535
|
-
else {
|
|
4536
|
-
this._c = (a, b, c, d) => createElement(contextVm, a, b, c, d, needNormalization);
|
|
4537
|
-
}
|
|
4538
|
-
}
|
|
4539
|
-
installRenderHelpers(FunctionalRenderContext.prototype);
|
|
4540
|
-
function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
|
|
4541
|
-
const options = Ctor.options;
|
|
4542
|
-
const props = {};
|
|
4543
|
-
const propOptions = options.props;
|
|
4544
|
-
if (isDef(propOptions)) {
|
|
4545
|
-
for (const key in propOptions) {
|
|
4546
|
-
props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
|
4547
4512
|
}
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
if (isDef(data.attrs))
|
|
4551
|
-
mergeProps(props, data.attrs);
|
|
4552
|
-
if (isDef(data.props))
|
|
4553
|
-
mergeProps(props, data.props);
|
|
4554
|
-
}
|
|
4555
|
-
const renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
|
|
4556
|
-
const vnode = options.render.call(null, renderContext._c, renderContext);
|
|
4557
|
-
if (vnode instanceof VNode) {
|
|
4558
|
-
return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
|
|
4559
|
-
}
|
|
4560
|
-
else if (isArray(vnode)) {
|
|
4561
|
-
const vnodes = normalizeChildren(vnode) || [];
|
|
4562
|
-
const res = new Array(vnodes.length);
|
|
4563
|
-
for (let i = 0; i < vnodes.length; i++) {
|
|
4564
|
-
res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
|
4513
|
+
else {
|
|
4514
|
+
(slots.default || (slots.default = [])).push(child);
|
|
4565
4515
|
}
|
|
4566
|
-
return res;
|
|
4567
|
-
}
|
|
4568
|
-
}
|
|
4569
|
-
function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
|
|
4570
|
-
// #7817 clone node before setting fnContext, otherwise if the node is reused
|
|
4571
|
-
// (e.g. it was from a cached normal slot) the fnContext causes named slots
|
|
4572
|
-
// that should not be matched to match.
|
|
4573
|
-
const clone = cloneVNode(vnode);
|
|
4574
|
-
clone.fnContext = contextVm;
|
|
4575
|
-
clone.fnOptions = options;
|
|
4576
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4577
|
-
(clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext =
|
|
4578
|
-
renderContext;
|
|
4579
4516
|
}
|
|
4580
|
-
|
|
4581
|
-
|
|
4517
|
+
// ignore slots that contains only whitespace
|
|
4518
|
+
for (const name in slots) {
|
|
4519
|
+
if (slots[name].every(isWhitespace)) {
|
|
4520
|
+
delete slots[name];
|
|
4521
|
+
}
|
|
4582
4522
|
}
|
|
4583
|
-
return
|
|
4523
|
+
return slots;
|
|
4584
4524
|
}
|
|
4585
|
-
function
|
|
4586
|
-
|
|
4587
|
-
to[camelize(key)] = from[key];
|
|
4588
|
-
}
|
|
4525
|
+
function isWhitespace(node) {
|
|
4526
|
+
return (node.isComment && !node.asyncFactory) || node.text === ' ';
|
|
4589
4527
|
}
|
|
4590
4528
|
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
|
4604
|
-
}
|
|
4605
|
-
},
|
|
4606
|
-
prepatch(oldVnode, vnode) {
|
|
4607
|
-
const options = vnode.componentOptions;
|
|
4608
|
-
const child = (vnode.componentInstance = oldVnode.componentInstance);
|
|
4609
|
-
updateChildComponent(child, options.propsData, // updated props
|
|
4610
|
-
options.listeners, // updated listeners
|
|
4611
|
-
vnode, // new parent vnode
|
|
4612
|
-
options.children // new children
|
|
4613
|
-
);
|
|
4614
|
-
},
|
|
4615
|
-
insert(vnode) {
|
|
4616
|
-
const { context, componentInstance } = vnode;
|
|
4617
|
-
if (!componentInstance._isMounted) {
|
|
4618
|
-
componentInstance._isMounted = true;
|
|
4619
|
-
callHook(componentInstance, 'mounted');
|
|
4620
|
-
}
|
|
4621
|
-
if (vnode.data.keepAlive) {
|
|
4622
|
-
if (context._isMounted) {
|
|
4623
|
-
// vue-router#1212
|
|
4624
|
-
// During updates, a kept-alive component's child components may
|
|
4625
|
-
// change, so directly walking the tree here may call activated hooks
|
|
4626
|
-
// on incorrect children. Instead we push them into a queue which will
|
|
4627
|
-
// be processed after the whole patch process ended.
|
|
4628
|
-
queueActivatedComponent(componentInstance);
|
|
4629
|
-
}
|
|
4630
|
-
else {
|
|
4631
|
-
activateChildComponent(componentInstance, true /* direct */);
|
|
4632
|
-
}
|
|
4633
|
-
}
|
|
4634
|
-
},
|
|
4635
|
-
destroy(vnode) {
|
|
4636
|
-
const { componentInstance } = vnode;
|
|
4637
|
-
if (!componentInstance._isDestroyed) {
|
|
4638
|
-
if (!vnode.data.keepAlive) {
|
|
4639
|
-
componentInstance.$destroy();
|
|
4640
|
-
}
|
|
4641
|
-
else {
|
|
4642
|
-
deactivateChildComponent(componentInstance, true /* direct */);
|
|
4643
|
-
}
|
|
4644
|
-
}
|
|
4529
|
+
function isAsyncPlaceholder(node) {
|
|
4530
|
+
// @ts-expect-error not really boolean type
|
|
4531
|
+
return node.isComment && node.asyncFactory;
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4534
|
+
function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {
|
|
4535
|
+
let res;
|
|
4536
|
+
const hasNormalSlots = Object.keys(normalSlots).length > 0;
|
|
4537
|
+
const isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;
|
|
4538
|
+
const key = scopedSlots && scopedSlots.$key;
|
|
4539
|
+
if (!scopedSlots) {
|
|
4540
|
+
res = {};
|
|
4645
4541
|
}
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
if (isUndef(Ctor)) {
|
|
4650
|
-
return;
|
|
4542
|
+
else if (scopedSlots._normalized) {
|
|
4543
|
+
// fast path 1: child component re-render only, parent did not change
|
|
4544
|
+
return scopedSlots._normalized;
|
|
4651
4545
|
}
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4546
|
+
else if (isStable &&
|
|
4547
|
+
prevScopedSlots &&
|
|
4548
|
+
prevScopedSlots !== emptyObject &&
|
|
4549
|
+
key === prevScopedSlots.$key &&
|
|
4550
|
+
!hasNormalSlots &&
|
|
4551
|
+
!prevScopedSlots.$hasNormal) {
|
|
4552
|
+
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
|
4553
|
+
// only need to normalize once
|
|
4554
|
+
return prevScopedSlots;
|
|
4656
4555
|
}
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4556
|
+
else {
|
|
4557
|
+
res = {};
|
|
4558
|
+
for (const key in scopedSlots) {
|
|
4559
|
+
if (scopedSlots[key] && key[0] !== '$') {
|
|
4560
|
+
res[key] = normalizeScopedSlot(ownerVm, normalSlots, key, scopedSlots[key]);
|
|
4561
|
+
}
|
|
4662
4562
|
}
|
|
4663
|
-
return;
|
|
4664
4563
|
}
|
|
4665
|
-
//
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
asyncFactory = Ctor;
|
|
4670
|
-
Ctor = resolveAsyncComponent(asyncFactory);
|
|
4671
|
-
if (Ctor === undefined) {
|
|
4672
|
-
// return a placeholder node for async component, which is rendered
|
|
4673
|
-
// as a comment node but preserves all the raw information for the node.
|
|
4674
|
-
// the information will be used for async server-rendering and hydration.
|
|
4675
|
-
return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
|
|
4564
|
+
// expose normal slots on scopedSlots
|
|
4565
|
+
for (const key in normalSlots) {
|
|
4566
|
+
if (!(key in res)) {
|
|
4567
|
+
res[key] = proxyNormalSlot(normalSlots, key);
|
|
4676
4568
|
}
|
|
4677
4569
|
}
|
|
4678
|
-
|
|
4679
|
-
//
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
// transform component v-model data into props & events
|
|
4683
|
-
if (isDef(data.model)) {
|
|
4684
|
-
// @ts-expect-error
|
|
4685
|
-
transformModel(Ctor.options, data);
|
|
4686
|
-
}
|
|
4687
|
-
// extract props
|
|
4688
|
-
// @ts-expect-error
|
|
4689
|
-
const propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
|
4690
|
-
// functional component
|
|
4691
|
-
// @ts-expect-error
|
|
4692
|
-
if (isTrue(Ctor.options.functional)) {
|
|
4693
|
-
return createFunctionalComponent(Ctor, propsData, data, context, children);
|
|
4694
|
-
}
|
|
4695
|
-
// extract listeners, since these needs to be treated as
|
|
4696
|
-
// child component listeners instead of DOM listeners
|
|
4697
|
-
const listeners = data.on;
|
|
4698
|
-
// replace with listeners with .native modifier
|
|
4699
|
-
// so it gets processed during parent component patch.
|
|
4700
|
-
data.on = data.nativeOn;
|
|
4701
|
-
// @ts-expect-error
|
|
4702
|
-
if (isTrue(Ctor.options.abstract)) {
|
|
4703
|
-
// abstract components do not keep anything
|
|
4704
|
-
// other than props & listeners & slot
|
|
4705
|
-
// work around flow
|
|
4706
|
-
const slot = data.slot;
|
|
4707
|
-
data = {};
|
|
4708
|
-
if (slot) {
|
|
4709
|
-
data.slot = slot;
|
|
4710
|
-
}
|
|
4570
|
+
// avoriaz seems to mock a non-extensible $scopedSlots object
|
|
4571
|
+
// and when that is passed down this would cause an error
|
|
4572
|
+
if (scopedSlots && Object.isExtensible(scopedSlots)) {
|
|
4573
|
+
scopedSlots._normalized = res;
|
|
4711
4574
|
}
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
const name = Ctor.options.name || tag;
|
|
4717
|
-
const vnode = new VNode(
|
|
4718
|
-
// @ts-expect-error
|
|
4719
|
-
`vue-component-${Ctor.cid}${name ? `-${name}` : ''}`, data, undefined, undefined, undefined, context,
|
|
4720
|
-
// @ts-expect-error
|
|
4721
|
-
{ Ctor, propsData, listeners, tag, children }, asyncFactory);
|
|
4722
|
-
return vnode;
|
|
4575
|
+
def(res, '$stable', isStable);
|
|
4576
|
+
def(res, '$key', key);
|
|
4577
|
+
def(res, '$hasNormal', hasNormalSlots);
|
|
4578
|
+
return res;
|
|
4723
4579
|
}
|
|
4724
|
-
function
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4580
|
+
function normalizeScopedSlot(vm, normalSlots, key, fn) {
|
|
4581
|
+
const normalized = function () {
|
|
4582
|
+
const cur = currentInstance;
|
|
4583
|
+
setCurrentInstance(vm);
|
|
4584
|
+
let res = arguments.length ? fn.apply(null, arguments) : fn({});
|
|
4585
|
+
res =
|
|
4586
|
+
res && typeof res === 'object' && !isArray(res)
|
|
4587
|
+
? [res] // single vnode
|
|
4588
|
+
: normalizeChildren(res);
|
|
4589
|
+
const vnode = res && res[0];
|
|
4590
|
+
setCurrentInstance(cur);
|
|
4591
|
+
return res &&
|
|
4592
|
+
(!vnode ||
|
|
4593
|
+
(res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
|
|
4594
|
+
? undefined
|
|
4595
|
+
: res;
|
|
4733
4596
|
};
|
|
4734
|
-
//
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4597
|
+
// this is a slot using the new v-slot syntax without scope. although it is
|
|
4598
|
+
// compiled as a scoped slot, render fn users would expect it to be present
|
|
4599
|
+
// on this.$slots because the usage is semantically a normal slot.
|
|
4600
|
+
if (fn.proxy) {
|
|
4601
|
+
Object.defineProperty(normalSlots, key, {
|
|
4602
|
+
get: normalized,
|
|
4603
|
+
enumerable: true,
|
|
4604
|
+
configurable: true
|
|
4605
|
+
});
|
|
4739
4606
|
}
|
|
4740
|
-
return
|
|
4607
|
+
return normalized;
|
|
4741
4608
|
}
|
|
4742
|
-
function
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
if (
|
|
4750
|
-
|
|
4609
|
+
function proxyNormalSlot(slots, key) {
|
|
4610
|
+
return () => slots[key];
|
|
4611
|
+
}
|
|
4612
|
+
|
|
4613
|
+
function syncSetupAttrs(to, from, prev, instance) {
|
|
4614
|
+
let changed = false;
|
|
4615
|
+
for (const key in from) {
|
|
4616
|
+
if (!(key in to)) {
|
|
4617
|
+
changed = true;
|
|
4618
|
+
defineProxyAttr(to, key, instance);
|
|
4751
4619
|
}
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
function mergeHook(f1, f2) {
|
|
4755
|
-
const merged = (a, b) => {
|
|
4756
|
-
// flow complains about extra args which is why we use any
|
|
4757
|
-
f1(a, b);
|
|
4758
|
-
f2(a, b);
|
|
4759
|
-
};
|
|
4760
|
-
merged._merged = true;
|
|
4761
|
-
return merged;
|
|
4762
|
-
}
|
|
4763
|
-
// transform component v-model info (value and callback) into
|
|
4764
|
-
// prop and event handler respectively.
|
|
4765
|
-
function transformModel(options, data) {
|
|
4766
|
-
const prop = (options.model && options.model.prop) || 'value';
|
|
4767
|
-
const event = (options.model && options.model.event) || 'input';
|
|
4768
|
-
(data.attrs || (data.attrs = {}))[prop] = data.model.value;
|
|
4769
|
-
const on = data.on || (data.on = {});
|
|
4770
|
-
const existing = on[event];
|
|
4771
|
-
const callback = data.model.callback;
|
|
4772
|
-
if (isDef(existing)) {
|
|
4773
|
-
if (isArray(existing)
|
|
4774
|
-
? existing.indexOf(callback) === -1
|
|
4775
|
-
: existing !== callback) {
|
|
4776
|
-
on[event] = [callback].concat(existing);
|
|
4620
|
+
else if (from[key] !== prev[key]) {
|
|
4621
|
+
changed = true;
|
|
4777
4622
|
}
|
|
4778
4623
|
}
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
const SIMPLE_NORMALIZE = 1;
|
|
4785
|
-
const ALWAYS_NORMALIZE = 2;
|
|
4786
|
-
// wrapper function for providing a more flexible interface
|
|
4787
|
-
// without getting yelled at by flow
|
|
4788
|
-
function createElement(context, tag, data, children, normalizationType, alwaysNormalize) {
|
|
4789
|
-
if (isArray(data) || isPrimitive(data)) {
|
|
4790
|
-
normalizationType = children;
|
|
4791
|
-
children = data;
|
|
4792
|
-
data = undefined;
|
|
4793
|
-
}
|
|
4794
|
-
if (isTrue(alwaysNormalize)) {
|
|
4795
|
-
normalizationType = ALWAYS_NORMALIZE;
|
|
4796
|
-
}
|
|
4797
|
-
return _createElement(context, tag, data, children, normalizationType);
|
|
4798
|
-
}
|
|
4799
|
-
function _createElement(context, tag, data, children, normalizationType) {
|
|
4800
|
-
if (isDef(data) && isDef(data.__ob__)) {
|
|
4801
|
-
process.env.NODE_ENV !== 'production' &&
|
|
4802
|
-
warn$3(`Avoid using observed data object as vnode data: ${JSON.stringify(data)}\n` + 'Always create fresh vnode data objects in each render!', context);
|
|
4803
|
-
return createEmptyVNode();
|
|
4804
|
-
}
|
|
4805
|
-
// object syntax in v-bind
|
|
4806
|
-
if (isDef(data) && isDef(data.is)) {
|
|
4807
|
-
tag = data.is;
|
|
4808
|
-
}
|
|
4809
|
-
if (!tag) {
|
|
4810
|
-
// in case of component :is set to falsy value
|
|
4811
|
-
return createEmptyVNode();
|
|
4812
|
-
}
|
|
4813
|
-
// warn against non-primitive key
|
|
4814
|
-
if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
|
|
4815
|
-
warn$3('Avoid using non-primitive value as key, ' +
|
|
4816
|
-
'use string/number value instead.', context);
|
|
4817
|
-
}
|
|
4818
|
-
// support single function children as default scoped slot
|
|
4819
|
-
if (isArray(children) && isFunction(children[0])) {
|
|
4820
|
-
data = data || {};
|
|
4821
|
-
data.scopedSlots = { default: children[0] };
|
|
4822
|
-
children.length = 0;
|
|
4823
|
-
}
|
|
4824
|
-
if (normalizationType === ALWAYS_NORMALIZE) {
|
|
4825
|
-
children = normalizeChildren(children);
|
|
4826
|
-
}
|
|
4827
|
-
else if (normalizationType === SIMPLE_NORMALIZE) {
|
|
4828
|
-
children = simpleNormalizeChildren(children);
|
|
4829
|
-
}
|
|
4830
|
-
let vnode, ns;
|
|
4831
|
-
if (typeof tag === 'string') {
|
|
4832
|
-
let Ctor;
|
|
4833
|
-
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
|
4834
|
-
if ((!data || !data.pre) &&
|
|
4835
|
-
isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) {
|
|
4836
|
-
// component
|
|
4837
|
-
vnode = createComponent(Ctor, data, context, children, tag);
|
|
4838
|
-
}
|
|
4839
|
-
else {
|
|
4840
|
-
// unknown or unlisted namespaced elements
|
|
4841
|
-
// check at runtime because it may get assigned a namespace when its
|
|
4842
|
-
// parent normalizes children
|
|
4843
|
-
vnode = new VNode(tag, data, children, undefined, undefined, context);
|
|
4844
|
-
}
|
|
4845
|
-
}
|
|
4846
|
-
else {
|
|
4847
|
-
// direct component options / constructor
|
|
4848
|
-
vnode = createComponent(tag, data, context, children);
|
|
4849
|
-
}
|
|
4850
|
-
if (isArray(vnode)) {
|
|
4851
|
-
return vnode;
|
|
4852
|
-
}
|
|
4853
|
-
else if (isDef(vnode)) {
|
|
4854
|
-
if (isDef(ns))
|
|
4855
|
-
applyNS(vnode, ns);
|
|
4856
|
-
if (isDef(data))
|
|
4857
|
-
registerDeepBindings(data);
|
|
4858
|
-
return vnode;
|
|
4859
|
-
}
|
|
4860
|
-
else {
|
|
4861
|
-
return createEmptyVNode();
|
|
4624
|
+
for (const key in to) {
|
|
4625
|
+
if (!(key in from)) {
|
|
4626
|
+
changed = true;
|
|
4627
|
+
delete to[key];
|
|
4628
|
+
}
|
|
4862
4629
|
}
|
|
4630
|
+
return changed;
|
|
4863
4631
|
}
|
|
4864
|
-
function
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
}
|
|
4871
|
-
if (isDef(vnode.children)) {
|
|
4872
|
-
for (let i = 0, l = vnode.children.length; i < l; i++) {
|
|
4873
|
-
const child = vnode.children[i];
|
|
4874
|
-
if (isDef(child.tag) &&
|
|
4875
|
-
(isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
|
4876
|
-
applyNS(child, ns, force);
|
|
4877
|
-
}
|
|
4632
|
+
function defineProxyAttr(proxy, key, instance) {
|
|
4633
|
+
Object.defineProperty(proxy, key, {
|
|
4634
|
+
enumerable: true,
|
|
4635
|
+
configurable: true,
|
|
4636
|
+
get() {
|
|
4637
|
+
return instance.$attrs[key];
|
|
4878
4638
|
}
|
|
4879
|
-
}
|
|
4880
|
-
}
|
|
4881
|
-
// ref #5318
|
|
4882
|
-
// necessary to ensure parent re-render when deep bindings like :style and
|
|
4883
|
-
// :class are used on slot nodes
|
|
4884
|
-
function registerDeepBindings(data) {
|
|
4885
|
-
if (isObject$1(data.style)) {
|
|
4886
|
-
traverse(data.style);
|
|
4887
|
-
}
|
|
4888
|
-
if (isObject$1(data.class)) {
|
|
4889
|
-
traverse(data.class);
|
|
4890
|
-
}
|
|
4639
|
+
});
|
|
4891
4640
|
}
|
|
4892
4641
|
|
|
4893
4642
|
function createAsyncPlaceholder(factory, data, context, children, tag) {
|
|
@@ -5037,11 +4786,11 @@ function deactivateChildComponent(vm, direct) {
|
|
|
5037
4786
|
callHook(vm, 'deactivated');
|
|
5038
4787
|
}
|
|
5039
4788
|
}
|
|
5040
|
-
function callHook(vm, hook, args) {
|
|
4789
|
+
function callHook(vm, hook, args, setContext = true) {
|
|
5041
4790
|
// #7573 disable dep collection when invoking lifecycle hooks
|
|
5042
4791
|
pushTarget();
|
|
5043
4792
|
const prev = currentInstance;
|
|
5044
|
-
setCurrentInstance(vm);
|
|
4793
|
+
setContext && setCurrentInstance(vm);
|
|
5045
4794
|
const handlers = vm.$options[hook];
|
|
5046
4795
|
const info = `${hook} hook`;
|
|
5047
4796
|
if (handlers) {
|
|
@@ -5052,7 +4801,7 @@ function callHook(vm, hook, args) {
|
|
|
5052
4801
|
if (vm._hasHookEvent) {
|
|
5053
4802
|
vm.$emit('hook:' + hook);
|
|
5054
4803
|
}
|
|
5055
|
-
setCurrentInstance(prev);
|
|
4804
|
+
setContext && setCurrentInstance(prev);
|
|
5056
4805
|
popTarget();
|
|
5057
4806
|
}
|
|
5058
4807
|
|
|
@@ -5182,242 +4931,499 @@ else if (!isIE &&
|
|
|
5182
4931
|
else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) ;
|
|
5183
4932
|
else ;
|
|
5184
4933
|
|
|
5185
|
-
const
|
|
5186
|
-
const NO_INIITIAL_VALUE = {};
|
|
4934
|
+
const seenObjects = new _Set();
|
|
5187
4935
|
/**
|
|
5188
|
-
*
|
|
5189
|
-
*
|
|
4936
|
+
* Recursively traverse an object to evoke all converted
|
|
4937
|
+
* getters, so that every nested property inside the object
|
|
4938
|
+
* is collected as a "deep" dependency.
|
|
5190
4939
|
*/
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
4940
|
+
function traverse(val) {
|
|
4941
|
+
_traverse(val, seenObjects);
|
|
4942
|
+
seenObjects.clear();
|
|
4943
|
+
return val;
|
|
5194
4944
|
}
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
4945
|
+
function _traverse(val, seen) {
|
|
4946
|
+
let i, keys;
|
|
4947
|
+
const isA = isArray(val);
|
|
4948
|
+
if ((!isA && !isObject$1(val)) ||
|
|
4949
|
+
Object.isFrozen(val) ||
|
|
4950
|
+
val instanceof VNode) {
|
|
4951
|
+
return;
|
|
4952
|
+
}
|
|
4953
|
+
if (val.__ob__) {
|
|
4954
|
+
const depId = val.__ob__.dep.id;
|
|
4955
|
+
if (seen.has(depId)) {
|
|
4956
|
+
return;
|
|
4957
|
+
}
|
|
4958
|
+
seen.add(depId);
|
|
4959
|
+
}
|
|
4960
|
+
if (isA) {
|
|
4961
|
+
i = val.length;
|
|
4962
|
+
while (i--)
|
|
4963
|
+
_traverse(val[i], seen);
|
|
4964
|
+
}
|
|
4965
|
+
else if (isRef(val)) {
|
|
4966
|
+
_traverse(val.value, seen);
|
|
4967
|
+
}
|
|
4968
|
+
else {
|
|
4969
|
+
keys = Object.keys(val);
|
|
4970
|
+
i = keys.length;
|
|
4971
|
+
while (i--)
|
|
4972
|
+
_traverse(val[keys[i]], seen);
|
|
4973
|
+
}
|
|
4974
|
+
}
|
|
4975
|
+
|
|
4976
|
+
function resolveInject(inject, vm) {
|
|
4977
|
+
if (inject) {
|
|
4978
|
+
// inject is :any because flow is not smart enough to figure out cached
|
|
4979
|
+
const result = Object.create(null);
|
|
4980
|
+
const keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
|
|
4981
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4982
|
+
const key = keys[i];
|
|
4983
|
+
// #6574 in case the inject object is observed...
|
|
4984
|
+
if (key === '__ob__')
|
|
4985
|
+
continue;
|
|
4986
|
+
const provideKey = inject[key].from;
|
|
4987
|
+
if (provideKey in vm._provided) {
|
|
4988
|
+
result[key] = vm._provided[provideKey];
|
|
5229
4989
|
}
|
|
5230
|
-
if (
|
|
5231
|
-
|
|
4990
|
+
else if ('default' in inject[key]) {
|
|
4991
|
+
const provideDefault = inject[key].default;
|
|
4992
|
+
result[key] = isFunction(provideDefault)
|
|
4993
|
+
? provideDefault.call(vm)
|
|
4994
|
+
: provideDefault;
|
|
4995
|
+
}
|
|
4996
|
+
else if (process.env.NODE_ENV !== 'production') {
|
|
4997
|
+
warn$3(`Injection "${key}" not found`, vm);
|
|
5232
4998
|
}
|
|
5233
4999
|
}
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5000
|
+
return result;
|
|
5001
|
+
}
|
|
5002
|
+
}
|
|
5003
|
+
|
|
5004
|
+
function resolveConstructorOptions(Ctor) {
|
|
5005
|
+
let options = Ctor.options;
|
|
5006
|
+
if (Ctor.super) {
|
|
5007
|
+
const superOptions = resolveConstructorOptions(Ctor.super);
|
|
5008
|
+
const cachedSuperOptions = Ctor.superOptions;
|
|
5009
|
+
if (superOptions !== cachedSuperOptions) {
|
|
5010
|
+
// super option changed,
|
|
5011
|
+
// need to resolve new options.
|
|
5012
|
+
Ctor.superOptions = superOptions;
|
|
5013
|
+
// check if there are any late-modified/attached options (#4976)
|
|
5014
|
+
const modifiedOptions = resolveModifiedOptions(Ctor);
|
|
5015
|
+
// update base extend options
|
|
5016
|
+
if (modifiedOptions) {
|
|
5017
|
+
extend(Ctor.extendOptions, modifiedOptions);
|
|
5018
|
+
}
|
|
5019
|
+
options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
|
|
5020
|
+
if (options.name) {
|
|
5021
|
+
options.components[options.name] = Ctor;
|
|
5244
5022
|
}
|
|
5245
5023
|
}
|
|
5246
5024
|
}
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5025
|
+
return options;
|
|
5026
|
+
}
|
|
5027
|
+
function resolveModifiedOptions(Ctor) {
|
|
5028
|
+
let modified;
|
|
5029
|
+
const latest = Ctor.options;
|
|
5030
|
+
const sealed = Ctor.sealedOptions;
|
|
5031
|
+
for (const key in latest) {
|
|
5032
|
+
if (latest[key] !== sealed[key]) {
|
|
5033
|
+
if (!modified)
|
|
5034
|
+
modified = {};
|
|
5035
|
+
modified[key] = latest[key];
|
|
5253
5036
|
}
|
|
5254
5037
|
}
|
|
5038
|
+
return modified;
|
|
5039
|
+
}
|
|
5040
|
+
|
|
5041
|
+
function FunctionalRenderContext(data, props, children, parent, Ctor) {
|
|
5042
|
+
const options = Ctor.options;
|
|
5043
|
+
// ensure the createElement function in functional components
|
|
5044
|
+
// gets a unique context - this is necessary for correct named slot check
|
|
5045
|
+
let contextVm;
|
|
5046
|
+
if (hasOwn(parent, '_uid')) {
|
|
5047
|
+
contextVm = Object.create(parent);
|
|
5048
|
+
contextVm._original = parent;
|
|
5049
|
+
}
|
|
5050
|
+
else {
|
|
5051
|
+
// the context vm passed in is a functional context as well.
|
|
5052
|
+
// in this case we want to make sure we are able to get a hold to the
|
|
5053
|
+
// real context instance.
|
|
5054
|
+
contextVm = parent;
|
|
5055
|
+
// @ts-ignore
|
|
5056
|
+
parent = parent._original;
|
|
5057
|
+
}
|
|
5058
|
+
const isCompiled = isTrue(options._compiled);
|
|
5059
|
+
const needNormalization = !isCompiled;
|
|
5060
|
+
this.data = data;
|
|
5061
|
+
this.props = props;
|
|
5062
|
+
this.children = children;
|
|
5063
|
+
this.parent = parent;
|
|
5064
|
+
this.listeners = data.on || emptyObject;
|
|
5065
|
+
this.injections = resolveInject(options.inject, parent);
|
|
5066
|
+
this.slots = () => {
|
|
5067
|
+
if (!this.$slots) {
|
|
5068
|
+
normalizeScopedSlots(parent, data.scopedSlots, (this.$slots = resolveSlots(children, parent)));
|
|
5069
|
+
}
|
|
5070
|
+
return this.$slots;
|
|
5071
|
+
};
|
|
5072
|
+
Object.defineProperty(this, 'scopedSlots', {
|
|
5073
|
+
enumerable: true,
|
|
5074
|
+
get() {
|
|
5075
|
+
return normalizeScopedSlots(parent, data.scopedSlots, this.slots());
|
|
5076
|
+
}
|
|
5077
|
+
});
|
|
5078
|
+
// support for compiled functional template
|
|
5079
|
+
if (isCompiled) {
|
|
5080
|
+
// exposing $options for renderStatic()
|
|
5081
|
+
this.$options = options;
|
|
5082
|
+
// pre-resolve slots for renderSlot()
|
|
5083
|
+
this.$slots = this.slots();
|
|
5084
|
+
this.$scopedSlots = normalizeScopedSlots(parent, data.scopedSlots, this.$slots);
|
|
5085
|
+
}
|
|
5086
|
+
if (options._scopeId) {
|
|
5087
|
+
this._c = (a, b, c, d) => {
|
|
5088
|
+
const vnode = createElement(contextVm, a, b, c, d, needNormalization);
|
|
5089
|
+
if (vnode && !isArray(vnode)) {
|
|
5090
|
+
vnode.fnScopeId = options._scopeId;
|
|
5091
|
+
vnode.fnContext = parent;
|
|
5092
|
+
}
|
|
5093
|
+
return vnode;
|
|
5094
|
+
};
|
|
5095
|
+
}
|
|
5096
|
+
else {
|
|
5097
|
+
this._c = (a, b, c, d) => createElement(contextVm, a, b, c, d, needNormalization);
|
|
5098
|
+
}
|
|
5255
5099
|
}
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5100
|
+
installRenderHelpers(FunctionalRenderContext.prototype);
|
|
5101
|
+
function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
|
|
5102
|
+
const options = Ctor.options;
|
|
5103
|
+
const props = {};
|
|
5104
|
+
const propOptions = options.props;
|
|
5105
|
+
if (isDef(propOptions)) {
|
|
5106
|
+
for (const key in propOptions) {
|
|
5107
|
+
props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
|
5108
|
+
}
|
|
5265
5109
|
}
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5110
|
+
else {
|
|
5111
|
+
if (isDef(data.attrs))
|
|
5112
|
+
mergeProps(props, data.attrs);
|
|
5113
|
+
if (isDef(data.props))
|
|
5114
|
+
mergeProps(props, data.props);
|
|
5269
5115
|
}
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5116
|
+
const renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
|
|
5117
|
+
const vnode = options.render.call(null, renderContext._c, renderContext);
|
|
5118
|
+
if (vnode instanceof VNode) {
|
|
5119
|
+
return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
|
|
5120
|
+
}
|
|
5121
|
+
else if (isArray(vnode)) {
|
|
5122
|
+
const vnodes = normalizeChildren(vnode) || [];
|
|
5123
|
+
const res = new Array(vnodes.length);
|
|
5124
|
+
for (let i = 0; i < vnodes.length; i++) {
|
|
5125
|
+
res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
|
5126
|
+
}
|
|
5127
|
+
return res;
|
|
5276
5128
|
}
|
|
5277
|
-
return ob;
|
|
5278
5129
|
}
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
const
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5130
|
+
function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
|
|
5131
|
+
// #7817 clone node before setting fnContext, otherwise if the node is reused
|
|
5132
|
+
// (e.g. it was from a cached normal slot) the fnContext causes named slots
|
|
5133
|
+
// that should not be matched to match.
|
|
5134
|
+
const clone = cloneVNode(vnode);
|
|
5135
|
+
clone.fnContext = contextVm;
|
|
5136
|
+
clone.fnOptions = options;
|
|
5137
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5138
|
+
(clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext =
|
|
5139
|
+
renderContext;
|
|
5287
5140
|
}
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
const setter = property && property.set;
|
|
5291
|
-
if ((!getter || setter) &&
|
|
5292
|
-
(val === NO_INIITIAL_VALUE || arguments.length === 2)) {
|
|
5293
|
-
val = obj[key];
|
|
5141
|
+
if (data.slot) {
|
|
5142
|
+
(clone.data || (clone.data = {})).slot = data.slot;
|
|
5294
5143
|
}
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5144
|
+
return clone;
|
|
5145
|
+
}
|
|
5146
|
+
function mergeProps(to, from) {
|
|
5147
|
+
for (const key in from) {
|
|
5148
|
+
to[camelize(key)] = from[key];
|
|
5149
|
+
}
|
|
5150
|
+
}
|
|
5151
|
+
|
|
5152
|
+
function getComponentName(options) {
|
|
5153
|
+
return options.name || options.__name || options._componentTag;
|
|
5154
|
+
}
|
|
5155
|
+
// inline hooks to be invoked on component VNodes during patch
|
|
5156
|
+
const componentVNodeHooks = {
|
|
5157
|
+
init(vnode, hydrating) {
|
|
5158
|
+
if (vnode.componentInstance &&
|
|
5159
|
+
!vnode.componentInstance._isDestroyed &&
|
|
5160
|
+
vnode.data.keepAlive) {
|
|
5161
|
+
// kept-alive components, treat as a patch
|
|
5162
|
+
const mountedNode = vnode; // work around flow
|
|
5163
|
+
componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
|
5164
|
+
}
|
|
5165
|
+
else {
|
|
5166
|
+
const child = (vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance));
|
|
5167
|
+
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
|
5168
|
+
}
|
|
5169
|
+
},
|
|
5170
|
+
prepatch(oldVnode, vnode) {
|
|
5171
|
+
const options = vnode.componentOptions;
|
|
5172
|
+
const child = (vnode.componentInstance = oldVnode.componentInstance);
|
|
5173
|
+
updateChildComponent(child, options.propsData, // updated props
|
|
5174
|
+
options.listeners, // updated listeners
|
|
5175
|
+
vnode, // new parent vnode
|
|
5176
|
+
options.children // new children
|
|
5177
|
+
);
|
|
5178
|
+
},
|
|
5179
|
+
insert(vnode) {
|
|
5180
|
+
const { context, componentInstance } = vnode;
|
|
5181
|
+
if (!componentInstance._isMounted) {
|
|
5182
|
+
componentInstance._isMounted = true;
|
|
5183
|
+
callHook(componentInstance, 'mounted');
|
|
5184
|
+
}
|
|
5185
|
+
if (vnode.data.keepAlive) {
|
|
5186
|
+
if (context._isMounted) {
|
|
5187
|
+
// vue-router#1212
|
|
5188
|
+
// During updates, a kept-alive component's child components may
|
|
5189
|
+
// change, so directly walking the tree here may call activated hooks
|
|
5190
|
+
// on incorrect children. Instead we push them into a queue which will
|
|
5191
|
+
// be processed after the whole patch process ended.
|
|
5192
|
+
queueActivatedComponent(componentInstance);
|
|
5339
5193
|
}
|
|
5340
5194
|
else {
|
|
5341
|
-
|
|
5195
|
+
activateChildComponent(componentInstance, true /* direct */);
|
|
5342
5196
|
}
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
oldValue: value
|
|
5351
|
-
});
|
|
5197
|
+
}
|
|
5198
|
+
},
|
|
5199
|
+
destroy(vnode) {
|
|
5200
|
+
const { componentInstance } = vnode;
|
|
5201
|
+
if (!componentInstance._isDestroyed) {
|
|
5202
|
+
if (!vnode.data.keepAlive) {
|
|
5203
|
+
componentInstance.$destroy();
|
|
5352
5204
|
}
|
|
5353
5205
|
else {
|
|
5354
|
-
|
|
5206
|
+
deactivateChildComponent(componentInstance, true /* direct */);
|
|
5355
5207
|
}
|
|
5356
5208
|
}
|
|
5357
|
-
});
|
|
5358
|
-
return dep;
|
|
5359
|
-
}
|
|
5360
|
-
function set(target, key, val) {
|
|
5361
|
-
if (process.env.NODE_ENV !== 'production' && (isUndef(target) || isPrimitive(target))) {
|
|
5362
|
-
warn$3(`Cannot set reactive property on undefined, null, or primitive value: ${target}`);
|
|
5363
5209
|
}
|
|
5364
|
-
|
|
5365
|
-
|
|
5210
|
+
};
|
|
5211
|
+
const hooksToMerge = Object.keys(componentVNodeHooks);
|
|
5212
|
+
function createComponent(Ctor, data, context, children, tag) {
|
|
5213
|
+
if (isUndef(Ctor)) {
|
|
5366
5214
|
return;
|
|
5367
5215
|
}
|
|
5368
|
-
const
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5216
|
+
const baseCtor = context.$options._base;
|
|
5217
|
+
// plain options object: turn it into a constructor
|
|
5218
|
+
if (isObject$1(Ctor)) {
|
|
5219
|
+
Ctor = baseCtor.extend(Ctor);
|
|
5220
|
+
}
|
|
5221
|
+
// if at this stage it's not a constructor or an async component factory,
|
|
5222
|
+
// reject.
|
|
5223
|
+
if (typeof Ctor !== 'function') {
|
|
5224
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5225
|
+
warn$3(`Invalid Component definition: ${String(Ctor)}`, context);
|
|
5375
5226
|
}
|
|
5376
|
-
return
|
|
5227
|
+
return;
|
|
5377
5228
|
}
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5229
|
+
// async component
|
|
5230
|
+
let asyncFactory;
|
|
5231
|
+
// @ts-expect-error
|
|
5232
|
+
if (isUndef(Ctor.cid)) {
|
|
5233
|
+
asyncFactory = Ctor;
|
|
5234
|
+
Ctor = resolveAsyncComponent(asyncFactory);
|
|
5235
|
+
if (Ctor === undefined) {
|
|
5236
|
+
// return a placeholder node for async component, which is rendered
|
|
5237
|
+
// as a comment node but preserves all the raw information for the node.
|
|
5238
|
+
// the information will be used for async server-rendering and hydration.
|
|
5239
|
+
return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
|
|
5240
|
+
}
|
|
5381
5241
|
}
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5242
|
+
data = data || {};
|
|
5243
|
+
// resolve constructor options in case global mixins are applied after
|
|
5244
|
+
// component constructor creation
|
|
5245
|
+
resolveConstructorOptions(Ctor);
|
|
5246
|
+
// transform component v-model data into props & events
|
|
5247
|
+
if (isDef(data.model)) {
|
|
5248
|
+
// @ts-expect-error
|
|
5249
|
+
transformModel(Ctor.options, data);
|
|
5387
5250
|
}
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5251
|
+
// extract props
|
|
5252
|
+
// @ts-expect-error
|
|
5253
|
+
const propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
|
5254
|
+
// functional component
|
|
5255
|
+
// @ts-expect-error
|
|
5256
|
+
if (isTrue(Ctor.options.functional)) {
|
|
5257
|
+
return createFunctionalComponent(Ctor, propsData, data, context, children);
|
|
5391
5258
|
}
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5259
|
+
// extract listeners, since these needs to be treated as
|
|
5260
|
+
// child component listeners instead of DOM listeners
|
|
5261
|
+
const listeners = data.on;
|
|
5262
|
+
// replace with listeners with .native modifier
|
|
5263
|
+
// so it gets processed during parent component patch.
|
|
5264
|
+
data.on = data.nativeOn;
|
|
5265
|
+
// @ts-expect-error
|
|
5266
|
+
if (isTrue(Ctor.options.abstract)) {
|
|
5267
|
+
// abstract components do not keep anything
|
|
5268
|
+
// other than props & listeners & slot
|
|
5269
|
+
// work around flow
|
|
5270
|
+
const slot = data.slot;
|
|
5271
|
+
data = {};
|
|
5272
|
+
if (slot) {
|
|
5273
|
+
data.slot = slot;
|
|
5274
|
+
}
|
|
5401
5275
|
}
|
|
5402
|
-
|
|
5403
|
-
|
|
5276
|
+
// install component management hooks onto the placeholder node
|
|
5277
|
+
installComponentHooks(data);
|
|
5278
|
+
// return a placeholder vnode
|
|
5279
|
+
// @ts-expect-error
|
|
5280
|
+
const name = getComponentName(Ctor.options) || tag;
|
|
5281
|
+
const vnode = new VNode(
|
|
5282
|
+
// @ts-expect-error
|
|
5283
|
+
`vue-component-${Ctor.cid}${name ? `-${name}` : ''}`, data, undefined, undefined, undefined, context,
|
|
5284
|
+
// @ts-expect-error
|
|
5285
|
+
{ Ctor, propsData, listeners, tag, children }, asyncFactory);
|
|
5286
|
+
return vnode;
|
|
5287
|
+
}
|
|
5288
|
+
function createComponentInstanceForVnode(
|
|
5289
|
+
// we know it's MountedComponentVNode but flow doesn't
|
|
5290
|
+
vnode,
|
|
5291
|
+
// activeInstance in lifecycle state
|
|
5292
|
+
parent) {
|
|
5293
|
+
const options = {
|
|
5294
|
+
_isComponent: true,
|
|
5295
|
+
_parentVnode: vnode,
|
|
5296
|
+
parent
|
|
5297
|
+
};
|
|
5298
|
+
// check inline-template render functions
|
|
5299
|
+
const inlineTemplate = vnode.data.inlineTemplate;
|
|
5300
|
+
if (isDef(inlineTemplate)) {
|
|
5301
|
+
options.render = inlineTemplate.render;
|
|
5302
|
+
options.staticRenderFns = inlineTemplate.staticRenderFns;
|
|
5404
5303
|
}
|
|
5405
|
-
return
|
|
5304
|
+
return new vnode.componentOptions.Ctor(options);
|
|
5406
5305
|
}
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
if (
|
|
5415
|
-
|
|
5306
|
+
function installComponentHooks(data) {
|
|
5307
|
+
const hooks = data.hook || (data.hook = {});
|
|
5308
|
+
for (let i = 0; i < hooksToMerge.length; i++) {
|
|
5309
|
+
const key = hooksToMerge[i];
|
|
5310
|
+
const existing = hooks[key];
|
|
5311
|
+
const toMerge = componentVNodeHooks[key];
|
|
5312
|
+
// @ts-expect-error
|
|
5313
|
+
if (existing !== toMerge && !(existing && existing._merged)) {
|
|
5314
|
+
hooks[key] = existing ? mergeHook(toMerge, existing) : toMerge;
|
|
5416
5315
|
}
|
|
5417
|
-
|
|
5418
|
-
|
|
5316
|
+
}
|
|
5317
|
+
}
|
|
5318
|
+
function mergeHook(f1, f2) {
|
|
5319
|
+
const merged = (a, b) => {
|
|
5320
|
+
// flow complains about extra args which is why we use any
|
|
5321
|
+
f1(a, b);
|
|
5322
|
+
f2(a, b);
|
|
5323
|
+
};
|
|
5324
|
+
merged._merged = true;
|
|
5325
|
+
return merged;
|
|
5326
|
+
}
|
|
5327
|
+
// transform component v-model info (value and callback) into
|
|
5328
|
+
// prop and event handler respectively.
|
|
5329
|
+
function transformModel(options, data) {
|
|
5330
|
+
const prop = (options.model && options.model.prop) || 'value';
|
|
5331
|
+
const event = (options.model && options.model.event) || 'input';
|
|
5332
|
+
(data.attrs || (data.attrs = {}))[prop] = data.model.value;
|
|
5333
|
+
const on = data.on || (data.on = {});
|
|
5334
|
+
const existing = on[event];
|
|
5335
|
+
const callback = data.model.callback;
|
|
5336
|
+
if (isDef(existing)) {
|
|
5337
|
+
if (isArray(existing)
|
|
5338
|
+
? existing.indexOf(callback) === -1
|
|
5339
|
+
: existing !== callback) {
|
|
5340
|
+
on[event] = [callback].concat(existing);
|
|
5419
5341
|
}
|
|
5420
5342
|
}
|
|
5343
|
+
else {
|
|
5344
|
+
on[event] = callback;
|
|
5345
|
+
}
|
|
5346
|
+
}
|
|
5347
|
+
|
|
5348
|
+
let warn$3 = noop;
|
|
5349
|
+
let tip = noop;
|
|
5350
|
+
let generateComponentTrace; // work around flow check
|
|
5351
|
+
let formatComponentName;
|
|
5352
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5353
|
+
const hasConsole = typeof console !== 'undefined';
|
|
5354
|
+
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
5355
|
+
const classify = str => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
5356
|
+
warn$3 = (msg, vm = currentInstance) => {
|
|
5357
|
+
const trace = vm ? generateComponentTrace(vm) : '';
|
|
5358
|
+
if (hasConsole && !config.silent) {
|
|
5359
|
+
console.error(`[Vue warn]: ${msg}${trace}`);
|
|
5360
|
+
}
|
|
5361
|
+
};
|
|
5362
|
+
tip = (msg, vm) => {
|
|
5363
|
+
if (hasConsole && !config.silent) {
|
|
5364
|
+
console.warn(`[Vue tip]: ${msg}` + (vm ? generateComponentTrace(vm) : ''));
|
|
5365
|
+
}
|
|
5366
|
+
};
|
|
5367
|
+
formatComponentName = (vm, includeFile) => {
|
|
5368
|
+
if (vm.$root === vm) {
|
|
5369
|
+
return '<Root>';
|
|
5370
|
+
}
|
|
5371
|
+
const options = isFunction(vm) && vm.cid != null
|
|
5372
|
+
? vm.options
|
|
5373
|
+
: vm._isVue
|
|
5374
|
+
? vm.$options || vm.constructor.options
|
|
5375
|
+
: vm;
|
|
5376
|
+
let name = getComponentName(options);
|
|
5377
|
+
const file = options.__file;
|
|
5378
|
+
if (!name && file) {
|
|
5379
|
+
const match = file.match(/([^/\\]+)\.vue$/);
|
|
5380
|
+
name = match && match[1];
|
|
5381
|
+
}
|
|
5382
|
+
return ((name ? `<${classify(name)}>` : `<Anonymous>`) +
|
|
5383
|
+
(file && includeFile !== false ? ` at ${file}` : ''));
|
|
5384
|
+
};
|
|
5385
|
+
const repeat = (str, n) => {
|
|
5386
|
+
let res = '';
|
|
5387
|
+
while (n) {
|
|
5388
|
+
if (n % 2 === 1)
|
|
5389
|
+
res += str;
|
|
5390
|
+
if (n > 1)
|
|
5391
|
+
str += str;
|
|
5392
|
+
n >>= 1;
|
|
5393
|
+
}
|
|
5394
|
+
return res;
|
|
5395
|
+
};
|
|
5396
|
+
generateComponentTrace = (vm) => {
|
|
5397
|
+
if (vm._isVue && vm.$parent) {
|
|
5398
|
+
const tree = [];
|
|
5399
|
+
let currentRecursiveSequence = 0;
|
|
5400
|
+
while (vm) {
|
|
5401
|
+
if (tree.length > 0) {
|
|
5402
|
+
const last = tree[tree.length - 1];
|
|
5403
|
+
if (last.constructor === vm.constructor) {
|
|
5404
|
+
currentRecursiveSequence++;
|
|
5405
|
+
vm = vm.$parent;
|
|
5406
|
+
continue;
|
|
5407
|
+
}
|
|
5408
|
+
else if (currentRecursiveSequence > 0) {
|
|
5409
|
+
tree[tree.length - 1] = [last, currentRecursiveSequence];
|
|
5410
|
+
currentRecursiveSequence = 0;
|
|
5411
|
+
}
|
|
5412
|
+
}
|
|
5413
|
+
tree.push(vm);
|
|
5414
|
+
vm = vm.$parent;
|
|
5415
|
+
}
|
|
5416
|
+
return ('\n\nfound in\n\n' +
|
|
5417
|
+
tree
|
|
5418
|
+
.map((vm, i) => `${i === 0 ? '---> ' : repeat(' ', 5 + i * 2)}${isArray(vm)
|
|
5419
|
+
? `${formatComponentName(vm[0])}... (${vm[1]} recursive calls)`
|
|
5420
|
+
: formatComponentName(vm)}`)
|
|
5421
|
+
.join('\n'));
|
|
5422
|
+
}
|
|
5423
|
+
else {
|
|
5424
|
+
return `\n\n(found in ${formatComponentName(vm)})`;
|
|
5425
|
+
}
|
|
5426
|
+
};
|
|
5421
5427
|
}
|
|
5422
5428
|
|
|
5423
5429
|
/**
|