@vue/compiler-sfc 2.7.3 → 2.7.6
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 +1036 -1029
- package/package.json +1 -1
package/dist/compiler-sfc.js
CHANGED
|
@@ -646,7 +646,6 @@ const DEFAULT_FILENAME = 'anonymous.vue';
|
|
|
646
646
|
const splitRE$1 = /\r?\n/g;
|
|
647
647
|
const replaceRE = /./g;
|
|
648
648
|
const isSpecialTag = makeMap('script,style,template', true);
|
|
649
|
-
const isNeedIndentLang = makeMap('pug,jade');
|
|
650
649
|
/**
|
|
651
650
|
* Parse a single-file component (*.vue) file into an SFC Descriptor Object.
|
|
652
651
|
*/
|
|
@@ -741,9 +740,11 @@ function parseComponent(source, options = {}) {
|
|
|
741
740
|
if (depth === 1 && currentBlock) {
|
|
742
741
|
currentBlock.end = start;
|
|
743
742
|
let text = source.slice(currentBlock.start, currentBlock.end);
|
|
744
|
-
if (options.deindent ||
|
|
745
|
-
//
|
|
746
|
-
(
|
|
743
|
+
if (options.deindent === true ||
|
|
744
|
+
// by default, deindent unless it's script with default lang or ts
|
|
745
|
+
(options.deindent !== false &&
|
|
746
|
+
!(currentBlock.type === 'script' &&
|
|
747
|
+
(!currentBlock.lang || currentBlock.lang === 'ts')))) {
|
|
747
748
|
text = deIndent(text);
|
|
748
749
|
}
|
|
749
750
|
// pad content so that linters and pre-processors can output correct
|
|
@@ -3444,145 +3445,6 @@ function setCurrentInstance(vm = null) {
|
|
|
3444
3445
|
vm && vm._scope.on();
|
|
3445
3446
|
}
|
|
3446
3447
|
|
|
3447
|
-
let warn$3 = noop;
|
|
3448
|
-
let tip = noop;
|
|
3449
|
-
let generateComponentTrace; // work around flow check
|
|
3450
|
-
let formatComponentName;
|
|
3451
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3452
|
-
const hasConsole = typeof console !== 'undefined';
|
|
3453
|
-
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
3454
|
-
const classify = str => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
3455
|
-
warn$3 = (msg, vm = currentInstance) => {
|
|
3456
|
-
const trace = vm ? generateComponentTrace(vm) : '';
|
|
3457
|
-
if (hasConsole && !config.silent) {
|
|
3458
|
-
console.error(`[Vue warn]: ${msg}${trace}`);
|
|
3459
|
-
}
|
|
3460
|
-
};
|
|
3461
|
-
tip = (msg, vm) => {
|
|
3462
|
-
if (hasConsole && !config.silent) {
|
|
3463
|
-
console.warn(`[Vue tip]: ${msg}` + (vm ? generateComponentTrace(vm) : ''));
|
|
3464
|
-
}
|
|
3465
|
-
};
|
|
3466
|
-
formatComponentName = (vm, includeFile) => {
|
|
3467
|
-
if (vm.$root === vm) {
|
|
3468
|
-
return '<Root>';
|
|
3469
|
-
}
|
|
3470
|
-
const options = isFunction(vm) && vm.cid != null
|
|
3471
|
-
? vm.options
|
|
3472
|
-
: vm._isVue
|
|
3473
|
-
? vm.$options || vm.constructor.options
|
|
3474
|
-
: vm;
|
|
3475
|
-
let name = options.name || options._componentTag;
|
|
3476
|
-
const file = options.__file;
|
|
3477
|
-
if (!name && file) {
|
|
3478
|
-
const match = file.match(/([^/\\]+)\.vue$/);
|
|
3479
|
-
name = match && match[1];
|
|
3480
|
-
}
|
|
3481
|
-
return ((name ? `<${classify(name)}>` : `<Anonymous>`) +
|
|
3482
|
-
(file && includeFile !== false ? ` at ${file}` : ''));
|
|
3483
|
-
};
|
|
3484
|
-
const repeat = (str, n) => {
|
|
3485
|
-
let res = '';
|
|
3486
|
-
while (n) {
|
|
3487
|
-
if (n % 2 === 1)
|
|
3488
|
-
res += str;
|
|
3489
|
-
if (n > 1)
|
|
3490
|
-
str += str;
|
|
3491
|
-
n >>= 1;
|
|
3492
|
-
}
|
|
3493
|
-
return res;
|
|
3494
|
-
};
|
|
3495
|
-
generateComponentTrace = (vm) => {
|
|
3496
|
-
if (vm._isVue && vm.$parent) {
|
|
3497
|
-
const tree = [];
|
|
3498
|
-
let currentRecursiveSequence = 0;
|
|
3499
|
-
while (vm) {
|
|
3500
|
-
if (tree.length > 0) {
|
|
3501
|
-
const last = tree[tree.length - 1];
|
|
3502
|
-
if (last.constructor === vm.constructor) {
|
|
3503
|
-
currentRecursiveSequence++;
|
|
3504
|
-
vm = vm.$parent;
|
|
3505
|
-
continue;
|
|
3506
|
-
}
|
|
3507
|
-
else if (currentRecursiveSequence > 0) {
|
|
3508
|
-
tree[tree.length - 1] = [last, currentRecursiveSequence];
|
|
3509
|
-
currentRecursiveSequence = 0;
|
|
3510
|
-
}
|
|
3511
|
-
}
|
|
3512
|
-
tree.push(vm);
|
|
3513
|
-
vm = vm.$parent;
|
|
3514
|
-
}
|
|
3515
|
-
return ('\n\nfound in\n\n' +
|
|
3516
|
-
tree
|
|
3517
|
-
.map((vm, i) => `${i === 0 ? '---> ' : repeat(' ', 5 + i * 2)}${isArray(vm)
|
|
3518
|
-
? `${formatComponentName(vm[0])}... (${vm[1]} recursive calls)`
|
|
3519
|
-
: formatComponentName(vm)}`)
|
|
3520
|
-
.join('\n'));
|
|
3521
|
-
}
|
|
3522
|
-
else {
|
|
3523
|
-
return `\n\n(found in ${formatComponentName(vm)})`;
|
|
3524
|
-
}
|
|
3525
|
-
};
|
|
3526
|
-
}
|
|
3527
|
-
|
|
3528
|
-
let uid = 0;
|
|
3529
|
-
/**
|
|
3530
|
-
* A dep is an observable that can have multiple
|
|
3531
|
-
* directives subscribing to it.
|
|
3532
|
-
* @internal
|
|
3533
|
-
*/
|
|
3534
|
-
class Dep {
|
|
3535
|
-
constructor() {
|
|
3536
|
-
this.id = uid++;
|
|
3537
|
-
this.subs = [];
|
|
3538
|
-
}
|
|
3539
|
-
addSub(sub) {
|
|
3540
|
-
this.subs.push(sub);
|
|
3541
|
-
}
|
|
3542
|
-
removeSub(sub) {
|
|
3543
|
-
remove$1(this.subs, sub);
|
|
3544
|
-
}
|
|
3545
|
-
depend(info) {
|
|
3546
|
-
if (Dep.target) {
|
|
3547
|
-
Dep.target.addDep(this);
|
|
3548
|
-
if (process.env.NODE_ENV !== 'production' && info && Dep.target.onTrack) {
|
|
3549
|
-
Dep.target.onTrack(Object.assign({ effect: Dep.target }, info));
|
|
3550
|
-
}
|
|
3551
|
-
}
|
|
3552
|
-
}
|
|
3553
|
-
notify(info) {
|
|
3554
|
-
// stabilize the subscriber list first
|
|
3555
|
-
const subs = this.subs.slice();
|
|
3556
|
-
if (process.env.NODE_ENV !== 'production' && !config.async) {
|
|
3557
|
-
// subs aren't sorted in scheduler if not running async
|
|
3558
|
-
// we need to sort them now to make sure they fire in correct
|
|
3559
|
-
// order
|
|
3560
|
-
subs.sort((a, b) => a.id - b.id);
|
|
3561
|
-
}
|
|
3562
|
-
for (let i = 0, l = subs.length; i < l; i++) {
|
|
3563
|
-
if (process.env.NODE_ENV !== 'production' && info) {
|
|
3564
|
-
const sub = subs[i];
|
|
3565
|
-
sub.onTrigger &&
|
|
3566
|
-
sub.onTrigger(Object.assign({ effect: subs[i] }, info));
|
|
3567
|
-
}
|
|
3568
|
-
subs[i].update();
|
|
3569
|
-
}
|
|
3570
|
-
}
|
|
3571
|
-
}
|
|
3572
|
-
// The current target watcher being evaluated.
|
|
3573
|
-
// This is globally unique because only one watcher
|
|
3574
|
-
// can be evaluated at a time.
|
|
3575
|
-
Dep.target = null;
|
|
3576
|
-
const targetStack = [];
|
|
3577
|
-
function pushTarget(target) {
|
|
3578
|
-
targetStack.push(target);
|
|
3579
|
-
Dep.target = target;
|
|
3580
|
-
}
|
|
3581
|
-
function popTarget() {
|
|
3582
|
-
targetStack.pop();
|
|
3583
|
-
Dep.target = targetStack[targetStack.length - 1];
|
|
3584
|
-
}
|
|
3585
|
-
|
|
3586
3448
|
/**
|
|
3587
3449
|
* @internal
|
|
3588
3450
|
*/
|
|
@@ -3649,6 +3511,89 @@ function cloneVNode(vnode) {
|
|
|
3649
3511
|
return cloned;
|
|
3650
3512
|
}
|
|
3651
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
|
+
|
|
3652
3597
|
/*
|
|
3653
3598
|
* not type checking this file because flow doesn't play well with
|
|
3654
3599
|
* dynamically accessing methods on Array prototype
|
|
@@ -3700,53 +3645,252 @@ methodsToPatch.forEach(function (method) {
|
|
|
3700
3645
|
});
|
|
3701
3646
|
});
|
|
3702
3647
|
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
}
|
|
3706
|
-
|
|
3707
|
-
function isRef(r) {
|
|
3708
|
-
return !!(r && r.__v_isRef === true);
|
|
3709
|
-
}
|
|
3710
|
-
|
|
3711
|
-
const seenObjects = new _Set();
|
|
3648
|
+
const arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
|
3649
|
+
const NO_INIITIAL_VALUE = {};
|
|
3712
3650
|
/**
|
|
3713
|
-
*
|
|
3714
|
-
*
|
|
3715
|
-
* is collected as a "deep" dependency.
|
|
3651
|
+
* In some cases we may want to disable observation inside a component's
|
|
3652
|
+
* update computation.
|
|
3716
3653
|
*/
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
return val;
|
|
3654
|
+
let shouldObserve = true;
|
|
3655
|
+
function toggleObserving(value) {
|
|
3656
|
+
shouldObserve = value;
|
|
3721
3657
|
}
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
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
|
+
}
|
|
3734
3708
|
}
|
|
3735
|
-
seen.add(depId);
|
|
3736
3709
|
}
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
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
|
+
});
|
|
3741
3864
|
}
|
|
3742
3865
|
else {
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
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
|
+
}
|
|
3747
3883
|
}
|
|
3748
3884
|
}
|
|
3749
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
|
+
|
|
3750
3894
|
if (process.env.NODE_ENV !== 'production') ;
|
|
3751
3895
|
|
|
3752
3896
|
const normalizeEvent = cached((name) => {
|
|
@@ -3950,295 +4094,156 @@ function normalizeArrayChildren(children, nestedIndex) {
|
|
|
3950
4094
|
return res;
|
|
3951
4095
|
}
|
|
3952
4096
|
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
const isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
|
|
3963
|
-
config.keyCodes = new Proxy(config.keyCodes, {
|
|
3964
|
-
set(target, key, value) {
|
|
3965
|
-
if (isBuiltInModifier(key)) {
|
|
3966
|
-
warn$3(`Avoid overwriting built-in modifier in config.keyCodes: .${key}`);
|
|
3967
|
-
return false;
|
|
3968
|
-
}
|
|
3969
|
-
else {
|
|
3970
|
-
target[key] = value;
|
|
3971
|
-
return true;
|
|
3972
|
-
}
|
|
3973
|
-
}
|
|
3974
|
-
});
|
|
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;
|
|
3975
4106
|
}
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
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);
|
|
3984
4151
|
}
|
|
3985
|
-
else
|
|
3986
|
-
|
|
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);
|
|
3987
4157
|
}
|
|
3988
4158
|
}
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
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();
|
|
3994
4175
|
}
|
|
3995
|
-
return changed;
|
|
3996
4176
|
}
|
|
3997
|
-
function
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
}
|
|
4004
|
-
});
|
|
4005
|
-
}
|
|
4006
|
-
|
|
4007
|
-
function resolveInject(inject, vm) {
|
|
4008
|
-
if (inject) {
|
|
4009
|
-
// inject is :any because flow is not smart enough to figure out cached
|
|
4010
|
-
const result = Object.create(null);
|
|
4011
|
-
const keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
|
|
4012
|
-
for (let i = 0; i < keys.length; i++) {
|
|
4013
|
-
const key = keys[i];
|
|
4014
|
-
// #6574 in case the inject object is observed...
|
|
4015
|
-
if (key === '__ob__')
|
|
4016
|
-
continue;
|
|
4017
|
-
const provideKey = inject[key].from;
|
|
4018
|
-
if (provideKey in vm._provided) {
|
|
4019
|
-
result[key] = vm._provided[provideKey];
|
|
4020
|
-
}
|
|
4021
|
-
else if ('default' in inject[key]) {
|
|
4022
|
-
const provideDefault = inject[key].default;
|
|
4023
|
-
result[key] = isFunction(provideDefault)
|
|
4024
|
-
? provideDefault.call(vm)
|
|
4025
|
-
: provideDefault;
|
|
4026
|
-
}
|
|
4027
|
-
else if (process.env.NODE_ENV !== 'production') {
|
|
4028
|
-
warn$3(`Injection "${key}" not found`, vm);
|
|
4029
|
-
}
|
|
4030
|
-
}
|
|
4031
|
-
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;
|
|
4032
4183
|
}
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
const cachedSuperOptions = Ctor.superOptions;
|
|
4040
|
-
if (superOptions !== cachedSuperOptions) {
|
|
4041
|
-
// super option changed,
|
|
4042
|
-
// need to resolve new options.
|
|
4043
|
-
Ctor.superOptions = superOptions;
|
|
4044
|
-
// check if there are any late-modified/attached options (#4976)
|
|
4045
|
-
const modifiedOptions = resolveModifiedOptions(Ctor);
|
|
4046
|
-
// update base extend options
|
|
4047
|
-
if (modifiedOptions) {
|
|
4048
|
-
extend(Ctor.extendOptions, modifiedOptions);
|
|
4049
|
-
}
|
|
4050
|
-
options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
|
|
4051
|
-
if (options.name) {
|
|
4052
|
-
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);
|
|
4053
4190
|
}
|
|
4054
4191
|
}
|
|
4055
4192
|
}
|
|
4056
|
-
return options;
|
|
4057
4193
|
}
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
}
|
|
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);
|
|
4068
4203
|
}
|
|
4069
|
-
return modified;
|
|
4070
4204
|
}
|
|
4071
4205
|
|
|
4072
4206
|
/**
|
|
4073
|
-
* Runtime helper for
|
|
4207
|
+
* Runtime helper for rendering v-for lists.
|
|
4074
4208
|
*/
|
|
4075
|
-
function
|
|
4076
|
-
|
|
4077
|
-
|
|
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
|
+
}
|
|
4078
4216
|
}
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
// remove slot attribute if the node is resolved as a Vue slot node
|
|
4084
|
-
if (data && data.attrs && data.attrs.slot) {
|
|
4085
|
-
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);
|
|
4086
4221
|
}
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
if (
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
}
|
|
4097
|
-
else {
|
|
4098
|
-
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();
|
|
4099
4231
|
}
|
|
4100
4232
|
}
|
|
4101
4233
|
else {
|
|
4102
|
-
|
|
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
|
+
}
|
|
4103
4240
|
}
|
|
4104
4241
|
}
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
if (slots[name].every(isWhitespace)) {
|
|
4108
|
-
delete slots[name];
|
|
4109
|
-
}
|
|
4242
|
+
if (!isDef(ret)) {
|
|
4243
|
+
ret = [];
|
|
4110
4244
|
}
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
function isWhitespace(node) {
|
|
4114
|
-
return (node.isComment && !node.asyncFactory) || node.text === ' ';
|
|
4115
|
-
}
|
|
4116
|
-
|
|
4117
|
-
function isAsyncPlaceholder(node) {
|
|
4118
|
-
// @ts-expect-error not really boolean type
|
|
4119
|
-
return node.isComment && node.asyncFactory;
|
|
4120
|
-
}
|
|
4121
|
-
|
|
4122
|
-
function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {
|
|
4123
|
-
let res;
|
|
4124
|
-
const hasNormalSlots = Object.keys(normalSlots).length > 0;
|
|
4125
|
-
const isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;
|
|
4126
|
-
const key = scopedSlots && scopedSlots.$key;
|
|
4127
|
-
if (!scopedSlots) {
|
|
4128
|
-
res = {};
|
|
4129
|
-
}
|
|
4130
|
-
else if (scopedSlots._normalized) {
|
|
4131
|
-
// fast path 1: child component re-render only, parent did not change
|
|
4132
|
-
return scopedSlots._normalized;
|
|
4133
|
-
}
|
|
4134
|
-
else if (isStable &&
|
|
4135
|
-
prevScopedSlots &&
|
|
4136
|
-
prevScopedSlots !== emptyObject &&
|
|
4137
|
-
key === prevScopedSlots.$key &&
|
|
4138
|
-
!hasNormalSlots &&
|
|
4139
|
-
!prevScopedSlots.$hasNormal) {
|
|
4140
|
-
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
|
4141
|
-
// only need to normalize once
|
|
4142
|
-
return prevScopedSlots;
|
|
4143
|
-
}
|
|
4144
|
-
else {
|
|
4145
|
-
res = {};
|
|
4146
|
-
for (const key in scopedSlots) {
|
|
4147
|
-
if (scopedSlots[key] && key[0] !== '$') {
|
|
4148
|
-
res[key] = normalizeScopedSlot(ownerVm, normalSlots, key, scopedSlots[key]);
|
|
4149
|
-
}
|
|
4150
|
-
}
|
|
4151
|
-
}
|
|
4152
|
-
// expose normal slots on scopedSlots
|
|
4153
|
-
for (const key in normalSlots) {
|
|
4154
|
-
if (!(key in res)) {
|
|
4155
|
-
res[key] = proxyNormalSlot(normalSlots, key);
|
|
4156
|
-
}
|
|
4157
|
-
}
|
|
4158
|
-
// avoriaz seems to mock a non-extensible $scopedSlots object
|
|
4159
|
-
// and when that is passed down this would cause an error
|
|
4160
|
-
if (scopedSlots && Object.isExtensible(scopedSlots)) {
|
|
4161
|
-
scopedSlots._normalized = res;
|
|
4162
|
-
}
|
|
4163
|
-
def(res, '$stable', isStable);
|
|
4164
|
-
def(res, '$key', key);
|
|
4165
|
-
def(res, '$hasNormal', hasNormalSlots);
|
|
4166
|
-
return res;
|
|
4167
|
-
}
|
|
4168
|
-
function normalizeScopedSlot(vm, normalSlots, key, fn) {
|
|
4169
|
-
const normalized = function () {
|
|
4170
|
-
const cur = currentInstance;
|
|
4171
|
-
setCurrentInstance(vm);
|
|
4172
|
-
let res = arguments.length ? fn.apply(null, arguments) : fn({});
|
|
4173
|
-
res =
|
|
4174
|
-
res && typeof res === 'object' && !isArray(res)
|
|
4175
|
-
? [res] // single vnode
|
|
4176
|
-
: normalizeChildren(res);
|
|
4177
|
-
const vnode = res && res[0];
|
|
4178
|
-
setCurrentInstance(cur);
|
|
4179
|
-
return res &&
|
|
4180
|
-
(!vnode ||
|
|
4181
|
-
(res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
|
|
4182
|
-
? undefined
|
|
4183
|
-
: res;
|
|
4184
|
-
};
|
|
4185
|
-
// this is a slot using the new v-slot syntax without scope. although it is
|
|
4186
|
-
// compiled as a scoped slot, render fn users would expect it to be present
|
|
4187
|
-
// on this.$slots because the usage is semantically a normal slot.
|
|
4188
|
-
if (fn.proxy) {
|
|
4189
|
-
Object.defineProperty(normalSlots, key, {
|
|
4190
|
-
get: normalized,
|
|
4191
|
-
enumerable: true,
|
|
4192
|
-
configurable: true
|
|
4193
|
-
});
|
|
4194
|
-
}
|
|
4195
|
-
return normalized;
|
|
4196
|
-
}
|
|
4197
|
-
function proxyNormalSlot(slots, key) {
|
|
4198
|
-
return () => slots[key];
|
|
4199
|
-
}
|
|
4200
|
-
|
|
4201
|
-
/**
|
|
4202
|
-
* Runtime helper for rendering v-for lists.
|
|
4203
|
-
*/
|
|
4204
|
-
function renderList(val, render) {
|
|
4205
|
-
let ret = null, i, l, keys, key;
|
|
4206
|
-
if (isArray(val) || typeof val === 'string') {
|
|
4207
|
-
ret = new Array(val.length);
|
|
4208
|
-
for (i = 0, l = val.length; i < l; i++) {
|
|
4209
|
-
ret[i] = render(val[i], i);
|
|
4210
|
-
}
|
|
4211
|
-
}
|
|
4212
|
-
else if (typeof val === 'number') {
|
|
4213
|
-
ret = new Array(val);
|
|
4214
|
-
for (i = 0; i < val; i++) {
|
|
4215
|
-
ret[i] = render(i + 1, i);
|
|
4216
|
-
}
|
|
4217
|
-
}
|
|
4218
|
-
else if (isObject$1(val)) {
|
|
4219
|
-
if (hasSymbol && val[Symbol.iterator]) {
|
|
4220
|
-
ret = [];
|
|
4221
|
-
const iterator = val[Symbol.iterator]();
|
|
4222
|
-
let result = iterator.next();
|
|
4223
|
-
while (!result.done) {
|
|
4224
|
-
ret.push(render(result.value, ret.length));
|
|
4225
|
-
result = iterator.next();
|
|
4226
|
-
}
|
|
4227
|
-
}
|
|
4228
|
-
else {
|
|
4229
|
-
keys = Object.keys(val);
|
|
4230
|
-
ret = new Array(keys.length);
|
|
4231
|
-
for (i = 0, l = keys.length; i < l; i++) {
|
|
4232
|
-
key = keys[i];
|
|
4233
|
-
ret[i] = render(val[key], key, i);
|
|
4234
|
-
}
|
|
4235
|
-
}
|
|
4236
|
-
}
|
|
4237
|
-
if (!isDef(ret)) {
|
|
4238
|
-
ret = [];
|
|
4239
|
-
}
|
|
4240
|
-
ret._isVList = true;
|
|
4241
|
-
return ret;
|
|
4245
|
+
ret._isVList = true;
|
|
4246
|
+
return ret;
|
|
4242
4247
|
}
|
|
4243
4248
|
|
|
4244
4249
|
/**
|
|
@@ -4362,7 +4367,7 @@ function renderStatic(index, isInFor) {
|
|
|
4362
4367
|
return tree;
|
|
4363
4368
|
}
|
|
4364
4369
|
// otherwise, render a fresh tree.
|
|
4365
|
-
tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy,
|
|
4370
|
+
tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
|
|
4366
4371
|
);
|
|
4367
4372
|
markStatic$1(tree, `__static__${index}`, false);
|
|
4368
4373
|
return tree;
|
|
@@ -4476,417 +4481,162 @@ function installRenderHelpers(target) {
|
|
|
4476
4481
|
target._p = prependModifier;
|
|
4477
4482
|
}
|
|
4478
4483
|
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
contextVm = Object.create(parent);
|
|
4486
|
-
contextVm._original = parent;
|
|
4487
|
-
}
|
|
4488
|
-
else {
|
|
4489
|
-
// the context vm passed in is a functional context as well.
|
|
4490
|
-
// in this case we want to make sure we are able to get a hold to the
|
|
4491
|
-
// real context instance.
|
|
4492
|
-
contextVm = parent;
|
|
4493
|
-
// @ts-ignore
|
|
4494
|
-
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 {};
|
|
4495
4490
|
}
|
|
4496
|
-
const
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
this.injections = resolveInject(options.inject, parent);
|
|
4504
|
-
this.slots = () => {
|
|
4505
|
-
if (!this.$slots) {
|
|
4506
|
-
normalizeScopedSlots(parent, data.scopedSlots, (this.$slots = resolveSlots(children, parent)));
|
|
4507
|
-
}
|
|
4508
|
-
return this.$slots;
|
|
4509
|
-
};
|
|
4510
|
-
Object.defineProperty(this, 'scopedSlots', {
|
|
4511
|
-
enumerable: true,
|
|
4512
|
-
get() {
|
|
4513
|
-
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;
|
|
4514
4498
|
}
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
if (vnode && !isArray(vnode)) {
|
|
4528
|
-
vnode.fnScopeId = options._scopeId;
|
|
4529
|
-
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);
|
|
4530
4511
|
}
|
|
4531
|
-
return vnode;
|
|
4532
|
-
};
|
|
4533
|
-
}
|
|
4534
|
-
else {
|
|
4535
|
-
this._c = (a, b, c, d) => createElement(contextVm, a, b, c, d, needNormalization);
|
|
4536
|
-
}
|
|
4537
|
-
}
|
|
4538
|
-
installRenderHelpers(FunctionalRenderContext.prototype);
|
|
4539
|
-
function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
|
|
4540
|
-
const options = Ctor.options;
|
|
4541
|
-
const props = {};
|
|
4542
|
-
const propOptions = options.props;
|
|
4543
|
-
if (isDef(propOptions)) {
|
|
4544
|
-
for (const key in propOptions) {
|
|
4545
|
-
props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
|
4546
4512
|
}
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
if (isDef(data.attrs))
|
|
4550
|
-
mergeProps(props, data.attrs);
|
|
4551
|
-
if (isDef(data.props))
|
|
4552
|
-
mergeProps(props, data.props);
|
|
4553
|
-
}
|
|
4554
|
-
const renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
|
|
4555
|
-
const vnode = options.render.call(null, renderContext._c, renderContext);
|
|
4556
|
-
if (vnode instanceof VNode) {
|
|
4557
|
-
return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
|
|
4558
|
-
}
|
|
4559
|
-
else if (isArray(vnode)) {
|
|
4560
|
-
const vnodes = normalizeChildren(vnode) || [];
|
|
4561
|
-
const res = new Array(vnodes.length);
|
|
4562
|
-
for (let i = 0; i < vnodes.length; i++) {
|
|
4563
|
-
res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
|
4513
|
+
else {
|
|
4514
|
+
(slots.default || (slots.default = [])).push(child);
|
|
4564
4515
|
}
|
|
4565
|
-
return res;
|
|
4566
|
-
}
|
|
4567
|
-
}
|
|
4568
|
-
function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
|
|
4569
|
-
// #7817 clone node before setting fnContext, otherwise if the node is reused
|
|
4570
|
-
// (e.g. it was from a cached normal slot) the fnContext causes named slots
|
|
4571
|
-
// that should not be matched to match.
|
|
4572
|
-
const clone = cloneVNode(vnode);
|
|
4573
|
-
clone.fnContext = contextVm;
|
|
4574
|
-
clone.fnOptions = options;
|
|
4575
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4576
|
-
(clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext =
|
|
4577
|
-
renderContext;
|
|
4578
4516
|
}
|
|
4579
|
-
|
|
4580
|
-
|
|
4517
|
+
// ignore slots that contains only whitespace
|
|
4518
|
+
for (const name in slots) {
|
|
4519
|
+
if (slots[name].every(isWhitespace)) {
|
|
4520
|
+
delete slots[name];
|
|
4521
|
+
}
|
|
4581
4522
|
}
|
|
4582
|
-
return
|
|
4523
|
+
return slots;
|
|
4583
4524
|
}
|
|
4584
|
-
function
|
|
4585
|
-
|
|
4586
|
-
to[camelize(key)] = from[key];
|
|
4587
|
-
}
|
|
4525
|
+
function isWhitespace(node) {
|
|
4526
|
+
return (node.isComment && !node.asyncFactory) || node.text === ' ';
|
|
4588
4527
|
}
|
|
4589
4528
|
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
|
4603
|
-
}
|
|
4604
|
-
},
|
|
4605
|
-
prepatch(oldVnode, vnode) {
|
|
4606
|
-
const options = vnode.componentOptions;
|
|
4607
|
-
const child = (vnode.componentInstance = oldVnode.componentInstance);
|
|
4608
|
-
updateChildComponent(child, options.propsData, // updated props
|
|
4609
|
-
options.listeners, // updated listeners
|
|
4610
|
-
vnode, // new parent vnode
|
|
4611
|
-
options.children // new children
|
|
4612
|
-
);
|
|
4613
|
-
},
|
|
4614
|
-
insert(vnode) {
|
|
4615
|
-
const { context, componentInstance } = vnode;
|
|
4616
|
-
if (!componentInstance._isMounted) {
|
|
4617
|
-
componentInstance._isMounted = true;
|
|
4618
|
-
callHook(componentInstance, 'mounted');
|
|
4619
|
-
}
|
|
4620
|
-
if (vnode.data.keepAlive) {
|
|
4621
|
-
if (context._isMounted) {
|
|
4622
|
-
// vue-router#1212
|
|
4623
|
-
// During updates, a kept-alive component's child components may
|
|
4624
|
-
// change, so directly walking the tree here may call activated hooks
|
|
4625
|
-
// on incorrect children. Instead we push them into a queue which will
|
|
4626
|
-
// be processed after the whole patch process ended.
|
|
4627
|
-
queueActivatedComponent(componentInstance);
|
|
4628
|
-
}
|
|
4629
|
-
else {
|
|
4630
|
-
activateChildComponent(componentInstance, true /* direct */);
|
|
4631
|
-
}
|
|
4632
|
-
}
|
|
4633
|
-
},
|
|
4634
|
-
destroy(vnode) {
|
|
4635
|
-
const { componentInstance } = vnode;
|
|
4636
|
-
if (!componentInstance._isDestroyed) {
|
|
4637
|
-
if (!vnode.data.keepAlive) {
|
|
4638
|
-
componentInstance.$destroy();
|
|
4639
|
-
}
|
|
4640
|
-
else {
|
|
4641
|
-
deactivateChildComponent(componentInstance, true /* direct */);
|
|
4642
|
-
}
|
|
4643
|
-
}
|
|
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 = {};
|
|
4644
4541
|
}
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
if (isUndef(Ctor)) {
|
|
4649
|
-
return;
|
|
4542
|
+
else if (scopedSlots._normalized) {
|
|
4543
|
+
// fast path 1: child component re-render only, parent did not change
|
|
4544
|
+
return scopedSlots._normalized;
|
|
4650
4545
|
}
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
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;
|
|
4655
4555
|
}
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
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
|
+
}
|
|
4661
4562
|
}
|
|
4662
|
-
return;
|
|
4663
4563
|
}
|
|
4664
|
-
//
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
asyncFactory = Ctor;
|
|
4669
|
-
Ctor = resolveAsyncComponent(asyncFactory);
|
|
4670
|
-
if (Ctor === undefined) {
|
|
4671
|
-
// return a placeholder node for async component, which is rendered
|
|
4672
|
-
// as a comment node but preserves all the raw information for the node.
|
|
4673
|
-
// the information will be used for async server-rendering and hydration.
|
|
4674
|
-
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);
|
|
4675
4568
|
}
|
|
4676
4569
|
}
|
|
4677
|
-
|
|
4678
|
-
//
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
// transform component v-model data into props & events
|
|
4682
|
-
if (isDef(data.model)) {
|
|
4683
|
-
// @ts-expect-error
|
|
4684
|
-
transformModel(Ctor.options, data);
|
|
4685
|
-
}
|
|
4686
|
-
// extract props
|
|
4687
|
-
// @ts-expect-error
|
|
4688
|
-
const propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
|
4689
|
-
// functional component
|
|
4690
|
-
// @ts-expect-error
|
|
4691
|
-
if (isTrue(Ctor.options.functional)) {
|
|
4692
|
-
return createFunctionalComponent(Ctor, propsData, data, context, children);
|
|
4693
|
-
}
|
|
4694
|
-
// extract listeners, since these needs to be treated as
|
|
4695
|
-
// child component listeners instead of DOM listeners
|
|
4696
|
-
const listeners = data.on;
|
|
4697
|
-
// replace with listeners with .native modifier
|
|
4698
|
-
// so it gets processed during parent component patch.
|
|
4699
|
-
data.on = data.nativeOn;
|
|
4700
|
-
// @ts-expect-error
|
|
4701
|
-
if (isTrue(Ctor.options.abstract)) {
|
|
4702
|
-
// abstract components do not keep anything
|
|
4703
|
-
// other than props & listeners & slot
|
|
4704
|
-
// work around flow
|
|
4705
|
-
const slot = data.slot;
|
|
4706
|
-
data = {};
|
|
4707
|
-
if (slot) {
|
|
4708
|
-
data.slot = slot;
|
|
4709
|
-
}
|
|
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;
|
|
4710
4574
|
}
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
const name = Ctor.options.name || tag;
|
|
4716
|
-
const vnode = new VNode(
|
|
4717
|
-
// @ts-expect-error
|
|
4718
|
-
`vue-component-${Ctor.cid}${name ? `-${name}` : ''}`, data, undefined, undefined, undefined, context,
|
|
4719
|
-
// @ts-expect-error
|
|
4720
|
-
{ Ctor, propsData, listeners, tag, children }, asyncFactory);
|
|
4721
|
-
return vnode;
|
|
4575
|
+
def(res, '$stable', isStable);
|
|
4576
|
+
def(res, '$key', key);
|
|
4577
|
+
def(res, '$hasNormal', hasNormalSlots);
|
|
4578
|
+
return res;
|
|
4722
4579
|
}
|
|
4723
|
-
function
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
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;
|
|
4732
4596
|
};
|
|
4733
|
-
//
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
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
|
+
});
|
|
4738
4606
|
}
|
|
4739
|
-
return
|
|
4607
|
+
return normalized;
|
|
4740
4608
|
}
|
|
4741
|
-
function
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
if (
|
|
4749
|
-
|
|
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);
|
|
4750
4619
|
}
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
function mergeHook(f1, f2) {
|
|
4754
|
-
const merged = (a, b) => {
|
|
4755
|
-
// flow complains about extra args which is why we use any
|
|
4756
|
-
f1(a, b);
|
|
4757
|
-
f2(a, b);
|
|
4758
|
-
};
|
|
4759
|
-
merged._merged = true;
|
|
4760
|
-
return merged;
|
|
4761
|
-
}
|
|
4762
|
-
// transform component v-model info (value and callback) into
|
|
4763
|
-
// prop and event handler respectively.
|
|
4764
|
-
function transformModel(options, data) {
|
|
4765
|
-
const prop = (options.model && options.model.prop) || 'value';
|
|
4766
|
-
const event = (options.model && options.model.event) || 'input';
|
|
4767
|
-
(data.attrs || (data.attrs = {}))[prop] = data.model.value;
|
|
4768
|
-
const on = data.on || (data.on = {});
|
|
4769
|
-
const existing = on[event];
|
|
4770
|
-
const callback = data.model.callback;
|
|
4771
|
-
if (isDef(existing)) {
|
|
4772
|
-
if (isArray(existing)
|
|
4773
|
-
? existing.indexOf(callback) === -1
|
|
4774
|
-
: existing !== callback) {
|
|
4775
|
-
on[event] = [callback].concat(existing);
|
|
4620
|
+
else if (from[key] !== prev[key]) {
|
|
4621
|
+
changed = true;
|
|
4776
4622
|
}
|
|
4777
4623
|
}
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
const SIMPLE_NORMALIZE = 1;
|
|
4784
|
-
const ALWAYS_NORMALIZE = 2;
|
|
4785
|
-
// wrapper function for providing a more flexible interface
|
|
4786
|
-
// without getting yelled at by flow
|
|
4787
|
-
function createElement(context, tag, data, children, normalizationType, alwaysNormalize) {
|
|
4788
|
-
if (isArray(data) || isPrimitive(data)) {
|
|
4789
|
-
normalizationType = children;
|
|
4790
|
-
children = data;
|
|
4791
|
-
data = undefined;
|
|
4792
|
-
}
|
|
4793
|
-
if (isTrue(alwaysNormalize)) {
|
|
4794
|
-
normalizationType = ALWAYS_NORMALIZE;
|
|
4795
|
-
}
|
|
4796
|
-
return _createElement(context, tag, data, children, normalizationType);
|
|
4797
|
-
}
|
|
4798
|
-
function _createElement(context, tag, data, children, normalizationType) {
|
|
4799
|
-
if (isDef(data) && isDef(data.__ob__)) {
|
|
4800
|
-
process.env.NODE_ENV !== 'production' &&
|
|
4801
|
-
warn$3(`Avoid using observed data object as vnode data: ${JSON.stringify(data)}\n` + 'Always create fresh vnode data objects in each render!', context);
|
|
4802
|
-
return createEmptyVNode();
|
|
4803
|
-
}
|
|
4804
|
-
// object syntax in v-bind
|
|
4805
|
-
if (isDef(data) && isDef(data.is)) {
|
|
4806
|
-
tag = data.is;
|
|
4807
|
-
}
|
|
4808
|
-
if (!tag) {
|
|
4809
|
-
// in case of component :is set to falsy value
|
|
4810
|
-
return createEmptyVNode();
|
|
4811
|
-
}
|
|
4812
|
-
// warn against non-primitive key
|
|
4813
|
-
if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
|
|
4814
|
-
warn$3('Avoid using non-primitive value as key, ' +
|
|
4815
|
-
'use string/number value instead.', context);
|
|
4816
|
-
}
|
|
4817
|
-
// support single function children as default scoped slot
|
|
4818
|
-
if (isArray(children) && isFunction(children[0])) {
|
|
4819
|
-
data = data || {};
|
|
4820
|
-
data.scopedSlots = { default: children[0] };
|
|
4821
|
-
children.length = 0;
|
|
4822
|
-
}
|
|
4823
|
-
if (normalizationType === ALWAYS_NORMALIZE) {
|
|
4824
|
-
children = normalizeChildren(children);
|
|
4825
|
-
}
|
|
4826
|
-
else if (normalizationType === SIMPLE_NORMALIZE) {
|
|
4827
|
-
children = simpleNormalizeChildren(children);
|
|
4828
|
-
}
|
|
4829
|
-
let vnode, ns;
|
|
4830
|
-
if (typeof tag === 'string') {
|
|
4831
|
-
let Ctor;
|
|
4832
|
-
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
|
4833
|
-
if ((!data || !data.pre) &&
|
|
4834
|
-
isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) {
|
|
4835
|
-
// component
|
|
4836
|
-
vnode = createComponent(Ctor, data, context, children, tag);
|
|
4837
|
-
}
|
|
4838
|
-
else {
|
|
4839
|
-
// unknown or unlisted namespaced elements
|
|
4840
|
-
// check at runtime because it may get assigned a namespace when its
|
|
4841
|
-
// parent normalizes children
|
|
4842
|
-
vnode = new VNode(tag, data, children, undefined, undefined, context);
|
|
4843
|
-
}
|
|
4844
|
-
}
|
|
4845
|
-
else {
|
|
4846
|
-
// direct component options / constructor
|
|
4847
|
-
vnode = createComponent(tag, data, context, children);
|
|
4848
|
-
}
|
|
4849
|
-
if (isArray(vnode)) {
|
|
4850
|
-
return vnode;
|
|
4851
|
-
}
|
|
4852
|
-
else if (isDef(vnode)) {
|
|
4853
|
-
if (isDef(ns))
|
|
4854
|
-
applyNS(vnode, ns);
|
|
4855
|
-
if (isDef(data))
|
|
4856
|
-
registerDeepBindings(data);
|
|
4857
|
-
return vnode;
|
|
4858
|
-
}
|
|
4859
|
-
else {
|
|
4860
|
-
return createEmptyVNode();
|
|
4624
|
+
for (const key in to) {
|
|
4625
|
+
if (!(key in from)) {
|
|
4626
|
+
changed = true;
|
|
4627
|
+
delete to[key];
|
|
4628
|
+
}
|
|
4861
4629
|
}
|
|
4630
|
+
return changed;
|
|
4862
4631
|
}
|
|
4863
|
-
function
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
}
|
|
4870
|
-
if (isDef(vnode.children)) {
|
|
4871
|
-
for (let i = 0, l = vnode.children.length; i < l; i++) {
|
|
4872
|
-
const child = vnode.children[i];
|
|
4873
|
-
if (isDef(child.tag) &&
|
|
4874
|
-
(isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
|
4875
|
-
applyNS(child, ns, force);
|
|
4876
|
-
}
|
|
4632
|
+
function defineProxyAttr(proxy, key, instance) {
|
|
4633
|
+
Object.defineProperty(proxy, key, {
|
|
4634
|
+
enumerable: true,
|
|
4635
|
+
configurable: true,
|
|
4636
|
+
get() {
|
|
4637
|
+
return instance.$attrs[key];
|
|
4877
4638
|
}
|
|
4878
|
-
}
|
|
4879
|
-
}
|
|
4880
|
-
// ref #5318
|
|
4881
|
-
// necessary to ensure parent re-render when deep bindings like :style and
|
|
4882
|
-
// :class are used on slot nodes
|
|
4883
|
-
function registerDeepBindings(data) {
|
|
4884
|
-
if (isObject$1(data.style)) {
|
|
4885
|
-
traverse(data.style);
|
|
4886
|
-
}
|
|
4887
|
-
if (isObject$1(data.class)) {
|
|
4888
|
-
traverse(data.class);
|
|
4889
|
-
}
|
|
4639
|
+
});
|
|
4890
4640
|
}
|
|
4891
4641
|
|
|
4892
4642
|
function createAsyncPlaceholder(factory, data, context, children, tag) {
|
|
@@ -5036,11 +4786,11 @@ function deactivateChildComponent(vm, direct) {
|
|
|
5036
4786
|
callHook(vm, 'deactivated');
|
|
5037
4787
|
}
|
|
5038
4788
|
}
|
|
5039
|
-
function callHook(vm, hook, args) {
|
|
4789
|
+
function callHook(vm, hook, args, setContext = true) {
|
|
5040
4790
|
// #7573 disable dep collection when invoking lifecycle hooks
|
|
5041
4791
|
pushTarget();
|
|
5042
4792
|
const prev = currentInstance;
|
|
5043
|
-
setCurrentInstance(vm);
|
|
4793
|
+
setContext && setCurrentInstance(vm);
|
|
5044
4794
|
const handlers = vm.$options[hook];
|
|
5045
4795
|
const info = `${hook} hook`;
|
|
5046
4796
|
if (handlers) {
|
|
@@ -5051,7 +4801,7 @@ function callHook(vm, hook, args) {
|
|
|
5051
4801
|
if (vm._hasHookEvent) {
|
|
5052
4802
|
vm.$emit('hook:' + hook);
|
|
5053
4803
|
}
|
|
5054
|
-
setCurrentInstance(prev);
|
|
4804
|
+
setContext && setCurrentInstance(prev);
|
|
5055
4805
|
popTarget();
|
|
5056
4806
|
}
|
|
5057
4807
|
|
|
@@ -5181,242 +4931,499 @@ else if (!isIE &&
|
|
|
5181
4931
|
else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) ;
|
|
5182
4932
|
else ;
|
|
5183
4933
|
|
|
5184
|
-
const
|
|
5185
|
-
const NO_INIITIAL_VALUE = {};
|
|
4934
|
+
const seenObjects = new _Set();
|
|
5186
4935
|
/**
|
|
5187
|
-
*
|
|
5188
|
-
*
|
|
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.
|
|
5189
4939
|
*/
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
4940
|
+
function traverse(val) {
|
|
4941
|
+
_traverse(val, seenObjects);
|
|
4942
|
+
seenObjects.clear();
|
|
4943
|
+
return val;
|
|
5193
4944
|
}
|
|
5194
|
-
|
|
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
|
-
|
|
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];
|
|
5228
4989
|
}
|
|
5229
|
-
if (
|
|
5230
|
-
|
|
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);
|
|
5231
4998
|
}
|
|
5232
4999
|
}
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
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;
|
|
5243
5022
|
}
|
|
5244
5023
|
}
|
|
5245
5024
|
}
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
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];
|
|
5252
5036
|
}
|
|
5253
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
|
+
}
|
|
5254
5099
|
}
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
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
|
+
}
|
|
5264
5109
|
}
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5110
|
+
else {
|
|
5111
|
+
if (isDef(data.attrs))
|
|
5112
|
+
mergeProps(props, data.attrs);
|
|
5113
|
+
if (isDef(data.props))
|
|
5114
|
+
mergeProps(props, data.props);
|
|
5268
5115
|
}
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
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;
|
|
5275
5128
|
}
|
|
5276
|
-
return ob;
|
|
5277
5129
|
}
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
const
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
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;
|
|
5286
5140
|
}
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
const setter = property && property.set;
|
|
5290
|
-
if ((!getter || setter) &&
|
|
5291
|
-
(val === NO_INIITIAL_VALUE || arguments.length === 2)) {
|
|
5292
|
-
val = obj[key];
|
|
5141
|
+
if (data.slot) {
|
|
5142
|
+
(clone.data || (clone.data = {})).slot = data.slot;
|
|
5293
5143
|
}
|
|
5294
|
-
|
|
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
|
-
|
|
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);
|
|
5338
5193
|
}
|
|
5339
5194
|
else {
|
|
5340
|
-
|
|
5195
|
+
activateChildComponent(componentInstance, true /* direct */);
|
|
5341
5196
|
}
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
oldValue: value
|
|
5350
|
-
});
|
|
5197
|
+
}
|
|
5198
|
+
},
|
|
5199
|
+
destroy(vnode) {
|
|
5200
|
+
const { componentInstance } = vnode;
|
|
5201
|
+
if (!componentInstance._isDestroyed) {
|
|
5202
|
+
if (!vnode.data.keepAlive) {
|
|
5203
|
+
componentInstance.$destroy();
|
|
5351
5204
|
}
|
|
5352
5205
|
else {
|
|
5353
|
-
|
|
5206
|
+
deactivateChildComponent(componentInstance, true /* direct */);
|
|
5354
5207
|
}
|
|
5355
5208
|
}
|
|
5356
|
-
});
|
|
5357
|
-
return dep;
|
|
5358
|
-
}
|
|
5359
|
-
function set(target, key, val) {
|
|
5360
|
-
if (process.env.NODE_ENV !== 'production' && (isUndef(target) || isPrimitive(target))) {
|
|
5361
|
-
warn$3(`Cannot set reactive property on undefined, null, or primitive value: ${target}`);
|
|
5362
5209
|
}
|
|
5363
|
-
|
|
5364
|
-
|
|
5210
|
+
};
|
|
5211
|
+
const hooksToMerge = Object.keys(componentVNodeHooks);
|
|
5212
|
+
function createComponent(Ctor, data, context, children, tag) {
|
|
5213
|
+
if (isUndef(Ctor)) {
|
|
5365
5214
|
return;
|
|
5366
5215
|
}
|
|
5367
|
-
const
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
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);
|
|
5374
5226
|
}
|
|
5375
|
-
return
|
|
5227
|
+
return;
|
|
5376
5228
|
}
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
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
|
+
}
|
|
5380
5241
|
}
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
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);
|
|
5386
5250
|
}
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
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);
|
|
5390
5258
|
}
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
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
|
+
}
|
|
5400
5275
|
}
|
|
5401
|
-
|
|
5402
|
-
|
|
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;
|
|
5403
5303
|
}
|
|
5404
|
-
return
|
|
5304
|
+
return new vnode.componentOptions.Ctor(options);
|
|
5405
5305
|
}
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
if (
|
|
5414
|
-
|
|
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;
|
|
5415
5315
|
}
|
|
5416
|
-
|
|
5417
|
-
|
|
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);
|
|
5418
5341
|
}
|
|
5419
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
|
+
};
|
|
5420
5427
|
}
|
|
5421
5428
|
|
|
5422
5429
|
/**
|