vue 3.2.32 → 3.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue.esm-browser.js +1949 -1813
- package/dist/vue.esm-browser.prod.js +1 -1
- package/dist/vue.global.js +1949 -1813
- package/dist/vue.global.prod.js +1 -1
- package/dist/vue.runtime.esm-browser.js +1911 -1791
- package/dist/vue.runtime.esm-browser.prod.js +1 -1
- package/dist/vue.runtime.global.js +1911 -1791
- package/dist/vue.runtime.global.prod.js +1 -1
- package/macros.d.ts +12 -8
- package/package.json +6 -6
package/dist/vue.esm-browser.js
CHANGED
|
@@ -239,6 +239,11 @@ function looseEqual(a, b) {
|
|
|
239
239
|
if (aValidType || bValidType) {
|
|
240
240
|
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
|
241
241
|
}
|
|
242
|
+
aValidType = isSymbol(a);
|
|
243
|
+
bValidType = isSymbol(b);
|
|
244
|
+
if (aValidType || bValidType) {
|
|
245
|
+
return a === b;
|
|
246
|
+
}
|
|
242
247
|
aValidType = isArray(a);
|
|
243
248
|
bValidType = isArray(b);
|
|
244
249
|
if (aValidType || bValidType) {
|
|
@@ -334,7 +339,7 @@ const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
|
334
339
|
const isArray = Array.isArray;
|
|
335
340
|
const isMap = (val) => toTypeString(val) === '[object Map]';
|
|
336
341
|
const isSet = (val) => toTypeString(val) === '[object Set]';
|
|
337
|
-
const isDate = (val) => val
|
|
342
|
+
const isDate = (val) => toTypeString(val) === '[object Date]';
|
|
338
343
|
const isFunction = (val) => typeof val === 'function';
|
|
339
344
|
const isString = (val) => typeof val === 'string';
|
|
340
345
|
const isSymbol = (val) => typeof val === 'symbol';
|
|
@@ -612,10 +617,17 @@ class ReactiveEffect {
|
|
|
612
617
|
activeEffect = this.parent;
|
|
613
618
|
shouldTrack = lastShouldTrack;
|
|
614
619
|
this.parent = undefined;
|
|
620
|
+
if (this.deferStop) {
|
|
621
|
+
this.stop();
|
|
622
|
+
}
|
|
615
623
|
}
|
|
616
624
|
}
|
|
617
625
|
stop() {
|
|
618
|
-
|
|
626
|
+
// stopped while running itself - defer the cleanup
|
|
627
|
+
if (activeEffect === this) {
|
|
628
|
+
this.deferStop = true;
|
|
629
|
+
}
|
|
630
|
+
else if (this.active) {
|
|
619
631
|
cleanupEffect(this);
|
|
620
632
|
if (this.onStop) {
|
|
621
633
|
this.onStop();
|
|
@@ -774,23 +786,40 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
774
786
|
}
|
|
775
787
|
function triggerEffects(dep, debuggerEventExtraInfo) {
|
|
776
788
|
// spread into array for stabilization
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
789
|
+
const effects = isArray(dep) ? dep : [...dep];
|
|
790
|
+
for (const effect of effects) {
|
|
791
|
+
if (effect.computed) {
|
|
792
|
+
triggerEffect(effect, debuggerEventExtraInfo);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
for (const effect of effects) {
|
|
796
|
+
if (!effect.computed) {
|
|
797
|
+
triggerEffect(effect, debuggerEventExtraInfo);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
function triggerEffect(effect, debuggerEventExtraInfo) {
|
|
802
|
+
if (effect !== activeEffect || effect.allowRecurse) {
|
|
803
|
+
if (effect.onTrigger) {
|
|
804
|
+
effect.onTrigger(extend({ effect }, debuggerEventExtraInfo));
|
|
805
|
+
}
|
|
806
|
+
if (effect.scheduler) {
|
|
807
|
+
effect.scheduler();
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
effect.run();
|
|
788
811
|
}
|
|
789
812
|
}
|
|
790
813
|
}
|
|
791
814
|
|
|
792
815
|
const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
793
|
-
const builtInSymbols = new Set(
|
|
816
|
+
const builtInSymbols = new Set(
|
|
817
|
+
/*#__PURE__*/
|
|
818
|
+
Object.getOwnPropertyNames(Symbol)
|
|
819
|
+
// ios10.x Object.getOwnPropertyNames(Symbol) can enumerate 'arguments' and 'caller'
|
|
820
|
+
// but accessing them on Symbol leads to TypeError because Symbol is a strict mode
|
|
821
|
+
// function
|
|
822
|
+
.filter(key => key !== 'arguments' && key !== 'caller')
|
|
794
823
|
.map(key => Symbol[key])
|
|
795
824
|
.filter(isSymbol));
|
|
796
825
|
const get = /*#__PURE__*/ createGetter();
|
|
@@ -864,9 +893,8 @@ function createGetter(isReadonly = false, shallow = false) {
|
|
|
864
893
|
return res;
|
|
865
894
|
}
|
|
866
895
|
if (isRef(res)) {
|
|
867
|
-
// ref unwrapping -
|
|
868
|
-
|
|
869
|
-
return shouldUnwrap ? res.value : res;
|
|
896
|
+
// ref unwrapping - skip unwrap for Array + integer key.
|
|
897
|
+
return targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
870
898
|
}
|
|
871
899
|
if (isObject(res)) {
|
|
872
900
|
// Convert returned value into a proxy as well. we do the isObject check
|
|
@@ -942,13 +970,13 @@ const readonlyHandlers = {
|
|
|
942
970
|
get: readonlyGet,
|
|
943
971
|
set(target, key) {
|
|
944
972
|
{
|
|
945
|
-
|
|
973
|
+
warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
946
974
|
}
|
|
947
975
|
return true;
|
|
948
976
|
},
|
|
949
977
|
deleteProperty(target, key) {
|
|
950
978
|
{
|
|
951
|
-
|
|
979
|
+
warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
952
980
|
}
|
|
953
981
|
return true;
|
|
954
982
|
}
|
|
@@ -972,10 +1000,12 @@ function get$1(target, key, isReadonly = false, isShallow = false) {
|
|
|
972
1000
|
target = target["__v_raw" /* RAW */];
|
|
973
1001
|
const rawTarget = toRaw(target);
|
|
974
1002
|
const rawKey = toRaw(key);
|
|
975
|
-
if (
|
|
976
|
-
|
|
1003
|
+
if (!isReadonly) {
|
|
1004
|
+
if (key !== rawKey) {
|
|
1005
|
+
track(rawTarget, "get" /* GET */, key);
|
|
1006
|
+
}
|
|
1007
|
+
track(rawTarget, "get" /* GET */, rawKey);
|
|
977
1008
|
}
|
|
978
|
-
!isReadonly && track(rawTarget, "get" /* GET */, rawKey);
|
|
979
1009
|
const { has } = getProto(rawTarget);
|
|
980
1010
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
981
1011
|
if (has.call(rawTarget, key)) {
|
|
@@ -994,10 +1024,12 @@ function has$1(key, isReadonly = false) {
|
|
|
994
1024
|
const target = this["__v_raw" /* RAW */];
|
|
995
1025
|
const rawTarget = toRaw(target);
|
|
996
1026
|
const rawKey = toRaw(key);
|
|
997
|
-
if (
|
|
998
|
-
|
|
1027
|
+
if (!isReadonly) {
|
|
1028
|
+
if (key !== rawKey) {
|
|
1029
|
+
track(rawTarget, "has" /* HAS */, key);
|
|
1030
|
+
}
|
|
1031
|
+
track(rawTarget, "has" /* HAS */, rawKey);
|
|
999
1032
|
}
|
|
1000
|
-
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
|
|
1001
1033
|
return key === rawKey
|
|
1002
1034
|
? target.has(key)
|
|
1003
1035
|
: target.has(key) || target.has(rawKey);
|
|
@@ -1323,7 +1355,7 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1323
1355
|
if (existingProxy) {
|
|
1324
1356
|
return existingProxy;
|
|
1325
1357
|
}
|
|
1326
|
-
// only
|
|
1358
|
+
// only specific value types can be observed.
|
|
1327
1359
|
const targetType = getTargetType(target);
|
|
1328
1360
|
if (targetType === 0 /* INVALID */) {
|
|
1329
1361
|
return target;
|
|
@@ -1776,7 +1808,7 @@ let preFlushIndex = 0;
|
|
|
1776
1808
|
const pendingPostFlushCbs = [];
|
|
1777
1809
|
let activePostFlushCbs = null;
|
|
1778
1810
|
let postFlushIndex = 0;
|
|
1779
|
-
const resolvedPromise = Promise.resolve();
|
|
1811
|
+
const resolvedPromise = /*#__PURE__*/ Promise.resolve();
|
|
1780
1812
|
let currentFlushPromise = null;
|
|
1781
1813
|
let currentPreFlushParentJob = null;
|
|
1782
1814
|
const RECURSION_LIMIT = 100;
|
|
@@ -1873,6 +1905,8 @@ function flushPreFlushCbs(seen, parentJob = null) {
|
|
|
1873
1905
|
}
|
|
1874
1906
|
}
|
|
1875
1907
|
function flushPostFlushCbs(seen) {
|
|
1908
|
+
// flush any pre cbs queued during the flush (e.g. pre watchers)
|
|
1909
|
+
flushPreFlushCbs();
|
|
1876
1910
|
if (pendingPostFlushCbs.length) {
|
|
1877
1911
|
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
1878
1912
|
pendingPostFlushCbs.length = 0;
|
|
@@ -2132,7 +2166,6 @@ function setDevtoolsHook(hook, target) {
|
|
|
2132
2166
|
// handle late devtools injection - only do this if we are in an actual
|
|
2133
2167
|
// browser environment to avoid the timer handle stalling test runner exit
|
|
2134
2168
|
// (#4815)
|
|
2135
|
-
// eslint-disable-next-line no-restricted-globals
|
|
2136
2169
|
typeof window !== 'undefined' &&
|
|
2137
2170
|
// some envs mock window but not fully
|
|
2138
2171
|
window.HTMLElement &&
|
|
@@ -2192,6 +2225,8 @@ function devtoolsComponentEmit(component, event, params) {
|
|
|
2192
2225
|
}
|
|
2193
2226
|
|
|
2194
2227
|
function emit$1(instance, event, ...rawArgs) {
|
|
2228
|
+
if (instance.isUnmounted)
|
|
2229
|
+
return;
|
|
2195
2230
|
const props = instance.vnode.props || EMPTY_OBJ;
|
|
2196
2231
|
{
|
|
2197
2232
|
const { emitsOptions, propsOptions: [propsOptions] } = instance;
|
|
@@ -2224,7 +2259,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
2224
2259
|
if (trim) {
|
|
2225
2260
|
args = rawArgs.map(a => a.trim());
|
|
2226
2261
|
}
|
|
2227
|
-
|
|
2262
|
+
if (number) {
|
|
2228
2263
|
args = rawArgs.map(toNumber);
|
|
2229
2264
|
}
|
|
2230
2265
|
}
|
|
@@ -2522,6 +2557,8 @@ function renderComponentRoot(instance) {
|
|
|
2522
2557
|
warn$1(`Runtime directive used on component with non-element root node. ` +
|
|
2523
2558
|
`The directives will not function as intended.`);
|
|
2524
2559
|
}
|
|
2560
|
+
// clone before mutating since the root may be a hoisted vnode
|
|
2561
|
+
root = cloneVNode(root);
|
|
2525
2562
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
2526
2563
|
}
|
|
2527
2564
|
// inherit transition data
|
|
@@ -3224,7 +3261,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3224
3261
|
}
|
|
3225
3262
|
else if (isArray(source)) {
|
|
3226
3263
|
isMultiSource = true;
|
|
3227
|
-
forceTrigger = source.some(isReactive);
|
|
3264
|
+
forceTrigger = source.some(s => isReactive(s) || isShallow(s));
|
|
3228
3265
|
getter = () => source.map(s => {
|
|
3229
3266
|
if (isRef(s)) {
|
|
3230
3267
|
return s.value;
|
|
@@ -3316,16 +3353,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3316
3353
|
}
|
|
3317
3354
|
else {
|
|
3318
3355
|
// default: 'pre'
|
|
3319
|
-
scheduler = () =>
|
|
3320
|
-
if (!instance || instance.isMounted) {
|
|
3321
|
-
queuePreFlushCb(job);
|
|
3322
|
-
}
|
|
3323
|
-
else {
|
|
3324
|
-
// with 'pre' option, the first call must happen before
|
|
3325
|
-
// the component is mounted so it is called synchronously.
|
|
3326
|
-
job();
|
|
3327
|
-
}
|
|
3328
|
-
};
|
|
3356
|
+
scheduler = () => queuePreFlushCb(job);
|
|
3329
3357
|
}
|
|
3330
3358
|
const effect = new ReactiveEffect(getter, scheduler);
|
|
3331
3359
|
{
|
|
@@ -3468,10 +3496,22 @@ const BaseTransitionImpl = {
|
|
|
3468
3496
|
if (!children || !children.length) {
|
|
3469
3497
|
return;
|
|
3470
3498
|
}
|
|
3471
|
-
|
|
3499
|
+
let child = children[0];
|
|
3472
3500
|
if (children.length > 1) {
|
|
3473
|
-
|
|
3474
|
-
|
|
3501
|
+
let hasFound = false;
|
|
3502
|
+
// locate first non-comment child
|
|
3503
|
+
for (const c of children) {
|
|
3504
|
+
if (c.type !== Comment) {
|
|
3505
|
+
if (hasFound) {
|
|
3506
|
+
// warn more than one non-comment child
|
|
3507
|
+
warn$1('<transition> can only be used on a single element or component. ' +
|
|
3508
|
+
'Use <transition-group> for lists.');
|
|
3509
|
+
break;
|
|
3510
|
+
}
|
|
3511
|
+
child = c;
|
|
3512
|
+
hasFound = true;
|
|
3513
|
+
}
|
|
3514
|
+
}
|
|
3475
3515
|
}
|
|
3476
3516
|
// there's no need to track reactivity for these props so use the raw
|
|
3477
3517
|
// props for a bit better perf
|
|
@@ -3484,8 +3524,6 @@ const BaseTransitionImpl = {
|
|
|
3484
3524
|
mode !== 'default') {
|
|
3485
3525
|
warn$1(`invalid <transition> mode: ${mode}`);
|
|
3486
3526
|
}
|
|
3487
|
-
// at this point children has a guaranteed length of 1.
|
|
3488
|
-
const child = children[0];
|
|
3489
3527
|
if (state.isLeaving) {
|
|
3490
3528
|
return emptyPlaceholder(child);
|
|
3491
3529
|
}
|
|
@@ -3568,6 +3606,17 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
3568
3606
|
hook &&
|
|
3569
3607
|
callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
|
|
3570
3608
|
};
|
|
3609
|
+
const callAsyncHook = (hook, args) => {
|
|
3610
|
+
const done = args[1];
|
|
3611
|
+
callHook(hook, args);
|
|
3612
|
+
if (isArray(hook)) {
|
|
3613
|
+
if (hook.every(hook => hook.length <= 1))
|
|
3614
|
+
done();
|
|
3615
|
+
}
|
|
3616
|
+
else if (hook.length <= 1) {
|
|
3617
|
+
done();
|
|
3618
|
+
}
|
|
3619
|
+
};
|
|
3571
3620
|
const hooks = {
|
|
3572
3621
|
mode,
|
|
3573
3622
|
persisted,
|
|
@@ -3626,10 +3675,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
3626
3675
|
el._enterCb = undefined;
|
|
3627
3676
|
});
|
|
3628
3677
|
if (hook) {
|
|
3629
|
-
hook
|
|
3630
|
-
if (hook.length <= 1) {
|
|
3631
|
-
done();
|
|
3632
|
-
}
|
|
3678
|
+
callAsyncHook(hook, [el, done]);
|
|
3633
3679
|
}
|
|
3634
3680
|
else {
|
|
3635
3681
|
done();
|
|
@@ -3663,10 +3709,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
3663
3709
|
});
|
|
3664
3710
|
leavingVNodesCache[key] = vnode;
|
|
3665
3711
|
if (onLeave) {
|
|
3666
|
-
onLeave
|
|
3667
|
-
if (onLeave.length <= 1) {
|
|
3668
|
-
done();
|
|
3669
|
-
}
|
|
3712
|
+
callAsyncHook(onLeave, [el, done]);
|
|
3670
3713
|
}
|
|
3671
3714
|
else {
|
|
3672
3715
|
done();
|
|
@@ -3876,7 +3919,7 @@ function defineAsyncComponent(source) {
|
|
|
3876
3919
|
}
|
|
3877
3920
|
});
|
|
3878
3921
|
}
|
|
3879
|
-
function createInnerComp(comp, { vnode: { ref, props, children } }) {
|
|
3922
|
+
function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
|
|
3880
3923
|
const vnode = createVNode(comp, props, children);
|
|
3881
3924
|
// ensure inner component inherits the async wrapper's ref owner
|
|
3882
3925
|
vnode.ref = ref;
|
|
@@ -3903,11 +3946,6 @@ const KeepAliveImpl = {
|
|
|
3903
3946
|
// The whole point of this is to avoid importing KeepAlive directly in the
|
|
3904
3947
|
// renderer to facilitate tree-shaking.
|
|
3905
3948
|
const sharedContext = instance.ctx;
|
|
3906
|
-
// if the internal renderer is not registered, it indicates that this is server-side rendering,
|
|
3907
|
-
// for KeepAlive, we just need to render its children
|
|
3908
|
-
if (!sharedContext.renderer) {
|
|
3909
|
-
return slots.default;
|
|
3910
|
-
}
|
|
3911
3949
|
const cache = new Map();
|
|
3912
3950
|
const keys = new Set();
|
|
3913
3951
|
let current = null;
|
|
@@ -4085,7 +4123,7 @@ const KeepAliveImpl = {
|
|
|
4085
4123
|
// avoid vnode being unmounted
|
|
4086
4124
|
vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4087
4125
|
current = vnode;
|
|
4088
|
-
return rawVNode;
|
|
4126
|
+
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
4089
4127
|
};
|
|
4090
4128
|
}
|
|
4091
4129
|
};
|
|
@@ -4223,1111 +4261,1598 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
4223
4261
|
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
4224
4262
|
}
|
|
4225
4263
|
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4264
|
+
/**
|
|
4265
|
+
Runtime helper for applying directives to a vnode. Example usage:
|
|
4266
|
+
|
|
4267
|
+
const comp = resolveComponent('comp')
|
|
4268
|
+
const foo = resolveDirective('foo')
|
|
4269
|
+
const bar = resolveDirective('bar')
|
|
4270
|
+
|
|
4271
|
+
return withDirectives(h(comp), [
|
|
4272
|
+
[foo, this.x],
|
|
4273
|
+
[bar, this.y]
|
|
4274
|
+
])
|
|
4275
|
+
*/
|
|
4276
|
+
function validateDirectiveName(name) {
|
|
4277
|
+
if (isBuiltInDirective(name)) {
|
|
4278
|
+
warn$1('Do not use built-in directive ids as custom directive id: ' + name);
|
|
4279
|
+
}
|
|
4280
|
+
}
|
|
4281
|
+
/**
|
|
4282
|
+
* Adds directives to a VNode.
|
|
4283
|
+
*/
|
|
4284
|
+
function withDirectives(vnode, directives) {
|
|
4285
|
+
const internalInstance = currentRenderingInstance;
|
|
4286
|
+
if (internalInstance === null) {
|
|
4287
|
+
warn$1(`withDirectives can only be used inside render functions.`);
|
|
4288
|
+
return vnode;
|
|
4289
|
+
}
|
|
4290
|
+
const instance = getExposeProxy(internalInstance) ||
|
|
4291
|
+
internalInstance.proxy;
|
|
4292
|
+
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
4293
|
+
for (let i = 0; i < directives.length; i++) {
|
|
4294
|
+
let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
|
|
4295
|
+
if (isFunction(dir)) {
|
|
4296
|
+
dir = {
|
|
4297
|
+
mounted: dir,
|
|
4298
|
+
updated: dir
|
|
4299
|
+
};
|
|
4231
4300
|
}
|
|
4232
|
-
|
|
4233
|
-
|
|
4301
|
+
if (dir.deep) {
|
|
4302
|
+
traverse(value);
|
|
4234
4303
|
}
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
shouldCacheAccess = false;
|
|
4244
|
-
// call beforeCreate first before accessing other options since
|
|
4245
|
-
// the hook may mutate resolved options (#2791)
|
|
4246
|
-
if (options.beforeCreate) {
|
|
4247
|
-
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
4304
|
+
bindings.push({
|
|
4305
|
+
dir,
|
|
4306
|
+
instance,
|
|
4307
|
+
value,
|
|
4308
|
+
oldValue: void 0,
|
|
4309
|
+
arg,
|
|
4310
|
+
modifiers
|
|
4311
|
+
});
|
|
4248
4312
|
}
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4313
|
+
return vnode;
|
|
4314
|
+
}
|
|
4315
|
+
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
4316
|
+
const bindings = vnode.dirs;
|
|
4317
|
+
const oldBindings = prevVNode && prevVNode.dirs;
|
|
4318
|
+
for (let i = 0; i < bindings.length; i++) {
|
|
4319
|
+
const binding = bindings[i];
|
|
4320
|
+
if (oldBindings) {
|
|
4321
|
+
binding.oldValue = oldBindings[i].value;
|
|
4322
|
+
}
|
|
4323
|
+
let hook = binding.dir[name];
|
|
4324
|
+
if (hook) {
|
|
4325
|
+
// disable tracking inside all lifecycle hooks
|
|
4326
|
+
// since they can potentially be called inside effects.
|
|
4327
|
+
pauseTracking();
|
|
4328
|
+
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
4329
|
+
vnode.el,
|
|
4330
|
+
binding,
|
|
4331
|
+
vnode,
|
|
4332
|
+
prevVNode
|
|
4333
|
+
]);
|
|
4334
|
+
resetTracking();
|
|
4265
4335
|
}
|
|
4266
4336
|
}
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4337
|
+
}
|
|
4338
|
+
|
|
4339
|
+
const COMPONENTS = 'components';
|
|
4340
|
+
const DIRECTIVES = 'directives';
|
|
4341
|
+
/**
|
|
4342
|
+
* @private
|
|
4343
|
+
*/
|
|
4344
|
+
function resolveComponent(name, maybeSelfReference) {
|
|
4345
|
+
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
4346
|
+
}
|
|
4347
|
+
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
4348
|
+
/**
|
|
4349
|
+
* @private
|
|
4350
|
+
*/
|
|
4351
|
+
function resolveDynamicComponent(component) {
|
|
4352
|
+
if (isString(component)) {
|
|
4353
|
+
return resolveAsset(COMPONENTS, component, false) || component;
|
|
4276
4354
|
}
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
if (isFunction(methodHandler)) {
|
|
4281
|
-
// In dev mode, we use the `createRenderContext` function to define
|
|
4282
|
-
// methods to the proxy target, and those are read-only but
|
|
4283
|
-
// reconfigurable, so it needs to be redefined here
|
|
4284
|
-
{
|
|
4285
|
-
Object.defineProperty(ctx, key, {
|
|
4286
|
-
value: methodHandler.bind(publicThis),
|
|
4287
|
-
configurable: true,
|
|
4288
|
-
enumerable: true,
|
|
4289
|
-
writable: true
|
|
4290
|
-
});
|
|
4291
|
-
}
|
|
4292
|
-
{
|
|
4293
|
-
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
4294
|
-
}
|
|
4295
|
-
}
|
|
4296
|
-
else {
|
|
4297
|
-
warn$1(`Method "${key}" has type "${typeof methodHandler}" in the component definition. ` +
|
|
4298
|
-
`Did you reference the function correctly?`);
|
|
4299
|
-
}
|
|
4300
|
-
}
|
|
4355
|
+
else {
|
|
4356
|
+
// invalid types will fallthrough to createVNode and raise warning
|
|
4357
|
+
return (component || NULL_DYNAMIC_COMPONENT);
|
|
4301
4358
|
}
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4359
|
+
}
|
|
4360
|
+
/**
|
|
4361
|
+
* @private
|
|
4362
|
+
*/
|
|
4363
|
+
function resolveDirective(name) {
|
|
4364
|
+
return resolveAsset(DIRECTIVES, name);
|
|
4365
|
+
}
|
|
4366
|
+
// implementation
|
|
4367
|
+
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
4368
|
+
const instance = currentRenderingInstance || currentInstance;
|
|
4369
|
+
if (instance) {
|
|
4370
|
+
const Component = instance.type;
|
|
4371
|
+
// explicit self name has highest priority
|
|
4372
|
+
if (type === COMPONENTS) {
|
|
4373
|
+
const selfName = getComponentName(Component);
|
|
4374
|
+
if (selfName &&
|
|
4375
|
+
(selfName === name ||
|
|
4376
|
+
selfName === camelize(name) ||
|
|
4377
|
+
selfName === capitalize(camelize(name)))) {
|
|
4378
|
+
return Component;
|
|
4379
|
+
}
|
|
4306
4380
|
}
|
|
4307
|
-
const
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4381
|
+
const res =
|
|
4382
|
+
// local registration
|
|
4383
|
+
// check instance[type] first which is resolved for options API
|
|
4384
|
+
resolve(instance[type] || Component[type], name) ||
|
|
4385
|
+
// global registration
|
|
4386
|
+
resolve(instance.appContext[type], name);
|
|
4387
|
+
if (!res && maybeSelfReference) {
|
|
4388
|
+
// fallback to implicit self-reference
|
|
4389
|
+
return Component;
|
|
4312
4390
|
}
|
|
4313
|
-
if (!
|
|
4314
|
-
|
|
4391
|
+
if (warnMissing && !res) {
|
|
4392
|
+
const extra = type === COMPONENTS
|
|
4393
|
+
? `\nIf this is a native custom element, make sure to exclude it from ` +
|
|
4394
|
+
`component resolution via compilerOptions.isCustomElement.`
|
|
4395
|
+
: ``;
|
|
4396
|
+
warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
|
4315
4397
|
}
|
|
4316
|
-
|
|
4317
|
-
instance.data = reactive(data);
|
|
4318
|
-
{
|
|
4319
|
-
for (const key in data) {
|
|
4320
|
-
checkDuplicateProperties("Data" /* DATA */, key);
|
|
4321
|
-
// expose data on ctx during dev
|
|
4322
|
-
if (key[0] !== '$' && key[0] !== '_') {
|
|
4323
|
-
Object.defineProperty(ctx, key, {
|
|
4324
|
-
configurable: true,
|
|
4325
|
-
enumerable: true,
|
|
4326
|
-
get: () => data[key],
|
|
4327
|
-
set: NOOP
|
|
4328
|
-
});
|
|
4329
|
-
}
|
|
4330
|
-
}
|
|
4331
|
-
}
|
|
4332
|
-
}
|
|
4333
|
-
}
|
|
4334
|
-
// state initialization complete at this point - start caching access
|
|
4335
|
-
shouldCacheAccess = true;
|
|
4336
|
-
if (computedOptions) {
|
|
4337
|
-
for (const key in computedOptions) {
|
|
4338
|
-
const opt = computedOptions[key];
|
|
4339
|
-
const get = isFunction(opt)
|
|
4340
|
-
? opt.bind(publicThis, publicThis)
|
|
4341
|
-
: isFunction(opt.get)
|
|
4342
|
-
? opt.get.bind(publicThis, publicThis)
|
|
4343
|
-
: NOOP;
|
|
4344
|
-
if (get === NOOP) {
|
|
4345
|
-
warn$1(`Computed property "${key}" has no getter.`);
|
|
4346
|
-
}
|
|
4347
|
-
const set = !isFunction(opt) && isFunction(opt.set)
|
|
4348
|
-
? opt.set.bind(publicThis)
|
|
4349
|
-
: () => {
|
|
4350
|
-
warn$1(`Write operation failed: computed property "${key}" is readonly.`);
|
|
4351
|
-
}
|
|
4352
|
-
;
|
|
4353
|
-
const c = computed$1({
|
|
4354
|
-
get,
|
|
4355
|
-
set
|
|
4356
|
-
});
|
|
4357
|
-
Object.defineProperty(ctx, key, {
|
|
4358
|
-
enumerable: true,
|
|
4359
|
-
configurable: true,
|
|
4360
|
-
get: () => c.value,
|
|
4361
|
-
set: v => (c.value = v)
|
|
4362
|
-
});
|
|
4363
|
-
{
|
|
4364
|
-
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
4365
|
-
}
|
|
4366
|
-
}
|
|
4367
|
-
}
|
|
4368
|
-
if (watchOptions) {
|
|
4369
|
-
for (const key in watchOptions) {
|
|
4370
|
-
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
4371
|
-
}
|
|
4372
|
-
}
|
|
4373
|
-
if (provideOptions) {
|
|
4374
|
-
const provides = isFunction(provideOptions)
|
|
4375
|
-
? provideOptions.call(publicThis)
|
|
4376
|
-
: provideOptions;
|
|
4377
|
-
Reflect.ownKeys(provides).forEach(key => {
|
|
4378
|
-
provide(key, provides[key]);
|
|
4379
|
-
});
|
|
4380
|
-
}
|
|
4381
|
-
if (created) {
|
|
4382
|
-
callHook(created, instance, "c" /* CREATED */);
|
|
4383
|
-
}
|
|
4384
|
-
function registerLifecycleHook(register, hook) {
|
|
4385
|
-
if (isArray(hook)) {
|
|
4386
|
-
hook.forEach(_hook => register(_hook.bind(publicThis)));
|
|
4387
|
-
}
|
|
4388
|
-
else if (hook) {
|
|
4389
|
-
register(hook.bind(publicThis));
|
|
4390
|
-
}
|
|
4391
|
-
}
|
|
4392
|
-
registerLifecycleHook(onBeforeMount, beforeMount);
|
|
4393
|
-
registerLifecycleHook(onMounted, mounted);
|
|
4394
|
-
registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
|
4395
|
-
registerLifecycleHook(onUpdated, updated);
|
|
4396
|
-
registerLifecycleHook(onActivated, activated);
|
|
4397
|
-
registerLifecycleHook(onDeactivated, deactivated);
|
|
4398
|
-
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
|
4399
|
-
registerLifecycleHook(onRenderTracked, renderTracked);
|
|
4400
|
-
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
|
4401
|
-
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
|
4402
|
-
registerLifecycleHook(onUnmounted, unmounted);
|
|
4403
|
-
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
4404
|
-
if (isArray(expose)) {
|
|
4405
|
-
if (expose.length) {
|
|
4406
|
-
const exposed = instance.exposed || (instance.exposed = {});
|
|
4407
|
-
expose.forEach(key => {
|
|
4408
|
-
Object.defineProperty(exposed, key, {
|
|
4409
|
-
get: () => publicThis[key],
|
|
4410
|
-
set: val => (publicThis[key] = val)
|
|
4411
|
-
});
|
|
4412
|
-
});
|
|
4413
|
-
}
|
|
4414
|
-
else if (!instance.exposed) {
|
|
4415
|
-
instance.exposed = {};
|
|
4416
|
-
}
|
|
4417
|
-
}
|
|
4418
|
-
// options that are handled when creating the instance but also need to be
|
|
4419
|
-
// applied from mixins
|
|
4420
|
-
if (render && instance.render === NOOP) {
|
|
4421
|
-
instance.render = render;
|
|
4398
|
+
return res;
|
|
4422
4399
|
}
|
|
4423
|
-
|
|
4424
|
-
|
|
4400
|
+
else {
|
|
4401
|
+
warn$1(`resolve${capitalize(type.slice(0, -1))} ` +
|
|
4402
|
+
`can only be used in render() or setup().`);
|
|
4425
4403
|
}
|
|
4426
|
-
// asset options.
|
|
4427
|
-
if (components)
|
|
4428
|
-
instance.components = components;
|
|
4429
|
-
if (directives)
|
|
4430
|
-
instance.directives = directives;
|
|
4431
4404
|
}
|
|
4432
|
-
function
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
}
|
|
4450
|
-
if (isRef(injected)) {
|
|
4451
|
-
// TODO remove the check in 3.3
|
|
4452
|
-
if (unwrapRef) {
|
|
4453
|
-
Object.defineProperty(ctx, key, {
|
|
4454
|
-
enumerable: true,
|
|
4455
|
-
configurable: true,
|
|
4456
|
-
get: () => injected.value,
|
|
4457
|
-
set: v => (injected.value = v)
|
|
4458
|
-
});
|
|
4459
|
-
}
|
|
4460
|
-
else {
|
|
4461
|
-
{
|
|
4462
|
-
warn$1(`injected property "${key}" is a ref and will be auto-unwrapped ` +
|
|
4463
|
-
`and no longer needs \`.value\` in the next minor release. ` +
|
|
4464
|
-
`To opt-in to the new behavior now, ` +
|
|
4465
|
-
`set \`app.config.unwrapInjectedRef = true\` (this config is ` +
|
|
4466
|
-
`temporary and will not be needed in the future.)`);
|
|
4467
|
-
}
|
|
4468
|
-
ctx[key] = injected;
|
|
4469
|
-
}
|
|
4470
|
-
}
|
|
4471
|
-
else {
|
|
4472
|
-
ctx[key] = injected;
|
|
4473
|
-
}
|
|
4474
|
-
{
|
|
4475
|
-
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
4405
|
+
function resolve(registry, name) {
|
|
4406
|
+
return (registry &&
|
|
4407
|
+
(registry[name] ||
|
|
4408
|
+
registry[camelize(name)] ||
|
|
4409
|
+
registry[capitalize(camelize(name))]));
|
|
4410
|
+
}
|
|
4411
|
+
|
|
4412
|
+
/**
|
|
4413
|
+
* Actual implementation
|
|
4414
|
+
*/
|
|
4415
|
+
function renderList(source, renderItem, cache, index) {
|
|
4416
|
+
let ret;
|
|
4417
|
+
const cached = (cache && cache[index]);
|
|
4418
|
+
if (isArray(source) || isString(source)) {
|
|
4419
|
+
ret = new Array(source.length);
|
|
4420
|
+
for (let i = 0, l = source.length; i < l; i++) {
|
|
4421
|
+
ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
|
|
4476
4422
|
}
|
|
4477
4423
|
}
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
? hook.map(h => h.bind(instance.proxy))
|
|
4482
|
-
: hook.bind(instance.proxy), instance, type);
|
|
4483
|
-
}
|
|
4484
|
-
function createWatcher(raw, ctx, publicThis, key) {
|
|
4485
|
-
const getter = key.includes('.')
|
|
4486
|
-
? createPathGetter(publicThis, key)
|
|
4487
|
-
: () => publicThis[key];
|
|
4488
|
-
if (isString(raw)) {
|
|
4489
|
-
const handler = ctx[raw];
|
|
4490
|
-
if (isFunction(handler)) {
|
|
4491
|
-
watch(getter, handler);
|
|
4424
|
+
else if (typeof source === 'number') {
|
|
4425
|
+
if (!Number.isInteger(source)) {
|
|
4426
|
+
warn$1(`The v-for range expect an integer value but got ${source}.`);
|
|
4492
4427
|
}
|
|
4493
|
-
|
|
4494
|
-
|
|
4428
|
+
ret = new Array(source);
|
|
4429
|
+
for (let i = 0; i < source; i++) {
|
|
4430
|
+
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
4495
4431
|
}
|
|
4496
4432
|
}
|
|
4497
|
-
else if (
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
else if (isObject(raw)) {
|
|
4501
|
-
if (isArray(raw)) {
|
|
4502
|
-
raw.forEach(r => createWatcher(r, ctx, publicThis, key));
|
|
4433
|
+
else if (isObject(source)) {
|
|
4434
|
+
if (source[Symbol.iterator]) {
|
|
4435
|
+
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
4503
4436
|
}
|
|
4504
4437
|
else {
|
|
4505
|
-
const
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
}
|
|
4511
|
-
else {
|
|
4512
|
-
warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
|
4438
|
+
const keys = Object.keys(source);
|
|
4439
|
+
ret = new Array(keys.length);
|
|
4440
|
+
for (let i = 0, l = keys.length; i < l; i++) {
|
|
4441
|
+
const key = keys[i];
|
|
4442
|
+
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
4513
4443
|
}
|
|
4514
4444
|
}
|
|
4515
4445
|
}
|
|
4516
4446
|
else {
|
|
4517
|
-
|
|
4447
|
+
ret = [];
|
|
4518
4448
|
}
|
|
4519
|
-
|
|
4449
|
+
if (cache) {
|
|
4450
|
+
cache[index] = ret;
|
|
4451
|
+
}
|
|
4452
|
+
return ret;
|
|
4453
|
+
}
|
|
4454
|
+
|
|
4520
4455
|
/**
|
|
4521
|
-
*
|
|
4522
|
-
*
|
|
4523
|
-
* instances.
|
|
4456
|
+
* Compiler runtime helper for creating dynamic slots object
|
|
4457
|
+
* @private
|
|
4524
4458
|
*/
|
|
4525
|
-
function
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
}
|
|
4534
|
-
else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
4535
|
-
{
|
|
4536
|
-
resolved = base;
|
|
4459
|
+
function createSlots(slots, dynamicSlots) {
|
|
4460
|
+
for (let i = 0; i < dynamicSlots.length; i++) {
|
|
4461
|
+
const slot = dynamicSlots[i];
|
|
4462
|
+
// array of dynamic slot generated by <template v-for="..." #[...]>
|
|
4463
|
+
if (isArray(slot)) {
|
|
4464
|
+
for (let j = 0; j < slot.length; j++) {
|
|
4465
|
+
slots[slot[j].name] = slot[j].fn;
|
|
4466
|
+
}
|
|
4537
4467
|
}
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
if (globalMixins.length) {
|
|
4542
|
-
globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
4468
|
+
else if (slot) {
|
|
4469
|
+
// conditional single slot generated by <template v-if="..." #foo>
|
|
4470
|
+
slots[slot.name] = slot.fn;
|
|
4543
4471
|
}
|
|
4544
|
-
mergeOptions(resolved, base, optionMergeStrategies);
|
|
4545
4472
|
}
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4473
|
+
return slots;
|
|
4474
|
+
}
|
|
4475
|
+
|
|
4476
|
+
/**
|
|
4477
|
+
* Compiler runtime helper for rendering `<slot/>`
|
|
4478
|
+
* @private
|
|
4479
|
+
*/
|
|
4480
|
+
function renderSlot(slots, name, props = {},
|
|
4481
|
+
// this is not a user-facing function, so the fallback is always generated by
|
|
4482
|
+
// the compiler and guaranteed to be a function returning an array
|
|
4483
|
+
fallback, noSlotted) {
|
|
4484
|
+
if (currentRenderingInstance.isCE ||
|
|
4485
|
+
(currentRenderingInstance.parent &&
|
|
4486
|
+
isAsyncWrapper(currentRenderingInstance.parent) &&
|
|
4487
|
+
currentRenderingInstance.parent.isCE)) {
|
|
4488
|
+
return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
|
|
4556
4489
|
}
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
const strat = internalOptionMergeStrats[key] || (strats && strats[key]);
|
|
4564
|
-
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
4565
|
-
}
|
|
4490
|
+
let slot = slots[name];
|
|
4491
|
+
if (slot && slot.length > 1) {
|
|
4492
|
+
warn$1(`SSR-optimized slot function detected in a non-SSR-optimized render ` +
|
|
4493
|
+
`function. You need to mark this component with $dynamic-slots in the ` +
|
|
4494
|
+
`parent template.`);
|
|
4495
|
+
slot = () => [];
|
|
4566
4496
|
}
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
// objects
|
|
4574
|
-
methods: mergeObjectOptions,
|
|
4575
|
-
computed: mergeObjectOptions,
|
|
4576
|
-
// lifecycle
|
|
4577
|
-
beforeCreate: mergeAsArray,
|
|
4578
|
-
created: mergeAsArray,
|
|
4579
|
-
beforeMount: mergeAsArray,
|
|
4580
|
-
mounted: mergeAsArray,
|
|
4581
|
-
beforeUpdate: mergeAsArray,
|
|
4582
|
-
updated: mergeAsArray,
|
|
4583
|
-
beforeDestroy: mergeAsArray,
|
|
4584
|
-
beforeUnmount: mergeAsArray,
|
|
4585
|
-
destroyed: mergeAsArray,
|
|
4586
|
-
unmounted: mergeAsArray,
|
|
4587
|
-
activated: mergeAsArray,
|
|
4588
|
-
deactivated: mergeAsArray,
|
|
4589
|
-
errorCaptured: mergeAsArray,
|
|
4590
|
-
serverPrefetch: mergeAsArray,
|
|
4591
|
-
// assets
|
|
4592
|
-
components: mergeObjectOptions,
|
|
4593
|
-
directives: mergeObjectOptions,
|
|
4594
|
-
// watch
|
|
4595
|
-
watch: mergeWatchOptions,
|
|
4596
|
-
// provide / inject
|
|
4597
|
-
provide: mergeDataFn,
|
|
4598
|
-
inject: mergeInject
|
|
4599
|
-
};
|
|
4600
|
-
function mergeDataFn(to, from) {
|
|
4601
|
-
if (!from) {
|
|
4602
|
-
return to;
|
|
4497
|
+
// a compiled slot disables block tracking by default to avoid manual
|
|
4498
|
+
// invocation interfering with template-based block tracking, but in
|
|
4499
|
+
// `renderSlot` we can be sure that it's template-based so we can force
|
|
4500
|
+
// enable it.
|
|
4501
|
+
if (slot && slot._c) {
|
|
4502
|
+
slot._d = false;
|
|
4603
4503
|
}
|
|
4604
|
-
|
|
4605
|
-
|
|
4504
|
+
openBlock();
|
|
4505
|
+
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
4506
|
+
const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
|
|
4507
|
+
? 64 /* STABLE_FRAGMENT */
|
|
4508
|
+
: -2 /* BAIL */);
|
|
4509
|
+
if (!noSlotted && rendered.scopeId) {
|
|
4510
|
+
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
4606
4511
|
}
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
};
|
|
4610
|
-
}
|
|
4611
|
-
function mergeInject(to, from) {
|
|
4612
|
-
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
4613
|
-
}
|
|
4614
|
-
function normalizeInject(raw) {
|
|
4615
|
-
if (isArray(raw)) {
|
|
4616
|
-
const res = {};
|
|
4617
|
-
for (let i = 0; i < raw.length; i++) {
|
|
4618
|
-
res[raw[i]] = raw[i];
|
|
4619
|
-
}
|
|
4620
|
-
return res;
|
|
4512
|
+
if (slot && slot._c) {
|
|
4513
|
+
slot._d = true;
|
|
4621
4514
|
}
|
|
4622
|
-
return
|
|
4623
|
-
}
|
|
4624
|
-
function mergeAsArray(to, from) {
|
|
4625
|
-
return to ? [...new Set([].concat(to, from))] : from;
|
|
4626
|
-
}
|
|
4627
|
-
function mergeObjectOptions(to, from) {
|
|
4628
|
-
return to ? extend(extend(Object.create(null), to), from) : from;
|
|
4515
|
+
return rendered;
|
|
4629
4516
|
}
|
|
4630
|
-
function
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4517
|
+
function ensureValidVNode(vnodes) {
|
|
4518
|
+
return vnodes.some(child => {
|
|
4519
|
+
if (!isVNode(child))
|
|
4520
|
+
return true;
|
|
4521
|
+
if (child.type === Comment)
|
|
4522
|
+
return false;
|
|
4523
|
+
if (child.type === Fragment &&
|
|
4524
|
+
!ensureValidVNode(child.children))
|
|
4525
|
+
return false;
|
|
4526
|
+
return true;
|
|
4527
|
+
})
|
|
4528
|
+
? vnodes
|
|
4529
|
+
: null;
|
|
4640
4530
|
}
|
|
4641
4531
|
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
if (!(key in props)) {
|
|
4652
|
-
props[key] = undefined;
|
|
4653
|
-
}
|
|
4654
|
-
}
|
|
4655
|
-
// validation
|
|
4656
|
-
{
|
|
4657
|
-
validateProps(rawProps || {}, props, instance);
|
|
4532
|
+
/**
|
|
4533
|
+
* For prefixing keys in v-on="obj" with "on"
|
|
4534
|
+
* @private
|
|
4535
|
+
*/
|
|
4536
|
+
function toHandlers(obj) {
|
|
4537
|
+
const ret = {};
|
|
4538
|
+
if (!isObject(obj)) {
|
|
4539
|
+
warn$1(`v-on with no argument expects an object value.`);
|
|
4540
|
+
return ret;
|
|
4658
4541
|
}
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
instance.props = isSSR ? props : shallowReactive(props);
|
|
4542
|
+
for (const key in obj) {
|
|
4543
|
+
ret[toHandlerKey(key)] = obj[key];
|
|
4662
4544
|
}
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4545
|
+
return ret;
|
|
4546
|
+
}
|
|
4547
|
+
|
|
4548
|
+
/**
|
|
4549
|
+
* #2437 In Vue 3, functional components do not have a public instance proxy but
|
|
4550
|
+
* they exist in the internal parent chain. For code that relies on traversing
|
|
4551
|
+
* public $parent chains, skip functional ones and go to the parent instead.
|
|
4552
|
+
*/
|
|
4553
|
+
const getPublicInstance = (i) => {
|
|
4554
|
+
if (!i)
|
|
4555
|
+
return null;
|
|
4556
|
+
if (isStatefulComponent(i))
|
|
4557
|
+
return getExposeProxy(i) || i.proxy;
|
|
4558
|
+
return getPublicInstance(i.parent);
|
|
4559
|
+
};
|
|
4560
|
+
const publicPropertiesMap =
|
|
4561
|
+
// Move PURE marker to new line to workaround compiler discarding it
|
|
4562
|
+
// due to type annotation
|
|
4563
|
+
/*#__PURE__*/ extend(Object.create(null), {
|
|
4564
|
+
$: i => i,
|
|
4565
|
+
$el: i => i.vnode.el,
|
|
4566
|
+
$data: i => i.data,
|
|
4567
|
+
$props: i => (shallowReadonly(i.props) ),
|
|
4568
|
+
$attrs: i => (shallowReadonly(i.attrs) ),
|
|
4569
|
+
$slots: i => (shallowReadonly(i.slots) ),
|
|
4570
|
+
$refs: i => (shallowReadonly(i.refs) ),
|
|
4571
|
+
$parent: i => getPublicInstance(i.parent),
|
|
4572
|
+
$root: i => getPublicInstance(i.root),
|
|
4573
|
+
$emit: i => i.emit,
|
|
4574
|
+
$options: i => (resolveMergedOptions(i) ),
|
|
4575
|
+
$forceUpdate: i => i.f || (i.f = () => queueJob(i.update)),
|
|
4576
|
+
$nextTick: i => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
4577
|
+
$watch: i => (instanceWatch.bind(i) )
|
|
4578
|
+
});
|
|
4579
|
+
const isReservedPrefix = (key) => key === '_' || key === '$';
|
|
4580
|
+
const PublicInstanceProxyHandlers = {
|
|
4581
|
+
get({ _: instance }, key) {
|
|
4582
|
+
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
|
4583
|
+
// for internal formatters to know that this is a Vue instance
|
|
4584
|
+
if (key === '__isVue') {
|
|
4585
|
+
return true;
|
|
4667
4586
|
}
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4587
|
+
// prioritize <script setup> bindings during dev.
|
|
4588
|
+
// this allows even properties that start with _ or $ to be used - so that
|
|
4589
|
+
// it aligns with the production behavior where the render fn is inlined and
|
|
4590
|
+
// indeed has access to all declared variables.
|
|
4591
|
+
if (setupState !== EMPTY_OBJ &&
|
|
4592
|
+
setupState.__isScriptSetup &&
|
|
4593
|
+
hasOwn(setupState, key)) {
|
|
4594
|
+
return setupState[key];
|
|
4671
4595
|
}
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
4693
|
-
let key = propsToUpdate[i];
|
|
4694
|
-
// skip if the prop key is a declared emit event listener
|
|
4695
|
-
if (isEmitListener(instance.emitsOptions, key)) {
|
|
4696
|
-
continue;
|
|
4697
|
-
}
|
|
4698
|
-
// PROPS flag guarantees rawProps to be non-null
|
|
4699
|
-
const value = rawProps[key];
|
|
4700
|
-
if (options) {
|
|
4701
|
-
// attr / props separation was done on init and will be consistent
|
|
4702
|
-
// in this code path, so just check if attrs have it.
|
|
4703
|
-
if (hasOwn(attrs, key)) {
|
|
4704
|
-
if (value !== attrs[key]) {
|
|
4705
|
-
attrs[key] = value;
|
|
4706
|
-
hasAttrsChanged = true;
|
|
4707
|
-
}
|
|
4708
|
-
}
|
|
4709
|
-
else {
|
|
4710
|
-
const camelizedKey = camelize(key);
|
|
4711
|
-
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
|
|
4712
|
-
}
|
|
4713
|
-
}
|
|
4714
|
-
else {
|
|
4715
|
-
if (value !== attrs[key]) {
|
|
4716
|
-
attrs[key] = value;
|
|
4717
|
-
hasAttrsChanged = true;
|
|
4718
|
-
}
|
|
4596
|
+
// data / props / ctx
|
|
4597
|
+
// This getter gets called for every property access on the render context
|
|
4598
|
+
// during render and is a major hotspot. The most expensive part of this
|
|
4599
|
+
// is the multiple hasOwn() calls. It's much faster to do a simple property
|
|
4600
|
+
// access on a plain object, so we use an accessCache object (with null
|
|
4601
|
+
// prototype) to memoize what access type a key corresponds to.
|
|
4602
|
+
let normalizedProps;
|
|
4603
|
+
if (key[0] !== '$') {
|
|
4604
|
+
const n = accessCache[key];
|
|
4605
|
+
if (n !== undefined) {
|
|
4606
|
+
switch (n) {
|
|
4607
|
+
case 1 /* SETUP */:
|
|
4608
|
+
return setupState[key];
|
|
4609
|
+
case 2 /* DATA */:
|
|
4610
|
+
return data[key];
|
|
4611
|
+
case 4 /* CONTEXT */:
|
|
4612
|
+
return ctx[key];
|
|
4613
|
+
case 3 /* PROPS */:
|
|
4614
|
+
return props[key];
|
|
4615
|
+
// default: just fallthrough
|
|
4719
4616
|
}
|
|
4720
4617
|
}
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
// full props update.
|
|
4725
|
-
if (setFullProps(instance, rawProps, props, attrs)) {
|
|
4726
|
-
hasAttrsChanged = true;
|
|
4727
|
-
}
|
|
4728
|
-
// in case of dynamic props, check if we need to delete keys from
|
|
4729
|
-
// the props object
|
|
4730
|
-
let kebabKey;
|
|
4731
|
-
for (const key in rawCurrentProps) {
|
|
4732
|
-
if (!rawProps ||
|
|
4733
|
-
// for camelCase
|
|
4734
|
-
(!hasOwn(rawProps, key) &&
|
|
4735
|
-
// it's possible the original props was passed in as kebab-case
|
|
4736
|
-
// and converted to camelCase (#955)
|
|
4737
|
-
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {
|
|
4738
|
-
if (options) {
|
|
4739
|
-
if (rawPrevProps &&
|
|
4740
|
-
// for camelCase
|
|
4741
|
-
(rawPrevProps[key] !== undefined ||
|
|
4742
|
-
// for kebab-case
|
|
4743
|
-
rawPrevProps[kebabKey] !== undefined)) {
|
|
4744
|
-
props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */);
|
|
4745
|
-
}
|
|
4746
|
-
}
|
|
4747
|
-
else {
|
|
4748
|
-
delete props[key];
|
|
4749
|
-
}
|
|
4618
|
+
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
4619
|
+
accessCache[key] = 1 /* SETUP */;
|
|
4620
|
+
return setupState[key];
|
|
4750
4621
|
}
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
if (attrs !== rawCurrentProps) {
|
|
4755
|
-
for (const key in attrs) {
|
|
4756
|
-
if (!rawProps ||
|
|
4757
|
-
(!hasOwn(rawProps, key) &&
|
|
4758
|
-
(!false ))) {
|
|
4759
|
-
delete attrs[key];
|
|
4760
|
-
hasAttrsChanged = true;
|
|
4761
|
-
}
|
|
4622
|
+
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
4623
|
+
accessCache[key] = 2 /* DATA */;
|
|
4624
|
+
return data[key];
|
|
4762
4625
|
}
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
validateProps(rawProps || {}, props, instance);
|
|
4771
|
-
}
|
|
4772
|
-
}
|
|
4773
|
-
function setFullProps(instance, rawProps, props, attrs) {
|
|
4774
|
-
const [options, needCastKeys] = instance.propsOptions;
|
|
4775
|
-
let hasAttrsChanged = false;
|
|
4776
|
-
let rawCastValues;
|
|
4777
|
-
if (rawProps) {
|
|
4778
|
-
for (let key in rawProps) {
|
|
4779
|
-
// key, ref are reserved and never passed down
|
|
4780
|
-
if (isReservedProp(key)) {
|
|
4781
|
-
continue;
|
|
4626
|
+
else if (
|
|
4627
|
+
// only cache other properties when instance has declared (thus stable)
|
|
4628
|
+
// props
|
|
4629
|
+
(normalizedProps = instance.propsOptions[0]) &&
|
|
4630
|
+
hasOwn(normalizedProps, key)) {
|
|
4631
|
+
accessCache[key] = 3 /* PROPS */;
|
|
4632
|
+
return props[key];
|
|
4782
4633
|
}
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
let camelKey;
|
|
4787
|
-
if (options && hasOwn(options, (camelKey = camelize(key)))) {
|
|
4788
|
-
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
|
4789
|
-
props[camelKey] = value;
|
|
4790
|
-
}
|
|
4791
|
-
else {
|
|
4792
|
-
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
|
4793
|
-
}
|
|
4634
|
+
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
4635
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
4636
|
+
return ctx[key];
|
|
4794
4637
|
}
|
|
4795
|
-
else if (
|
|
4796
|
-
|
|
4797
|
-
attrs[key] = value;
|
|
4798
|
-
hasAttrsChanged = true;
|
|
4799
|
-
}
|
|
4638
|
+
else if (shouldCacheAccess) {
|
|
4639
|
+
accessCache[key] = 0 /* OTHER */;
|
|
4800
4640
|
}
|
|
4801
4641
|
}
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
}
|
|
4810
|
-
}
|
|
4811
|
-
return hasAttrsChanged;
|
|
4812
|
-
}
|
|
4813
|
-
function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
4814
|
-
const opt = options[key];
|
|
4815
|
-
if (opt != null) {
|
|
4816
|
-
const hasDefault = hasOwn(opt, 'default');
|
|
4817
|
-
// default values
|
|
4818
|
-
if (hasDefault && value === undefined) {
|
|
4819
|
-
const defaultValue = opt.default;
|
|
4820
|
-
if (opt.type !== Function && isFunction(defaultValue)) {
|
|
4821
|
-
const { propsDefaults } = instance;
|
|
4822
|
-
if (key in propsDefaults) {
|
|
4823
|
-
value = propsDefaults[key];
|
|
4824
|
-
}
|
|
4825
|
-
else {
|
|
4826
|
-
setCurrentInstance(instance);
|
|
4827
|
-
value = propsDefaults[key] = defaultValue.call(null, props);
|
|
4828
|
-
unsetCurrentInstance();
|
|
4829
|
-
}
|
|
4642
|
+
const publicGetter = publicPropertiesMap[key];
|
|
4643
|
+
let cssModule, globalProperties;
|
|
4644
|
+
// public $xxx properties
|
|
4645
|
+
if (publicGetter) {
|
|
4646
|
+
if (key === '$attrs') {
|
|
4647
|
+
track(instance, "get" /* GET */, key);
|
|
4648
|
+
markAttrsAccessed();
|
|
4830
4649
|
}
|
|
4831
|
-
|
|
4832
|
-
|
|
4650
|
+
return publicGetter(instance);
|
|
4651
|
+
}
|
|
4652
|
+
else if (
|
|
4653
|
+
// css module (injected by vue-loader)
|
|
4654
|
+
(cssModule = type.__cssModules) &&
|
|
4655
|
+
(cssModule = cssModule[key])) {
|
|
4656
|
+
return cssModule;
|
|
4657
|
+
}
|
|
4658
|
+
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
4659
|
+
// user may set custom properties to `this` that start with `$`
|
|
4660
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
4661
|
+
return ctx[key];
|
|
4662
|
+
}
|
|
4663
|
+
else if (
|
|
4664
|
+
// global properties
|
|
4665
|
+
((globalProperties = appContext.config.globalProperties),
|
|
4666
|
+
hasOwn(globalProperties, key))) {
|
|
4667
|
+
{
|
|
4668
|
+
return globalProperties[key];
|
|
4833
4669
|
}
|
|
4834
4670
|
}
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4671
|
+
else if (currentRenderingInstance &&
|
|
4672
|
+
(!isString(key) ||
|
|
4673
|
+
// #1091 avoid internal isRef/isVNode checks on component instance leading
|
|
4674
|
+
// to infinite warning loop
|
|
4675
|
+
key.indexOf('__v') !== 0)) {
|
|
4676
|
+
if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
|
|
4677
|
+
warn$1(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved ` +
|
|
4678
|
+
`character ("$" or "_") and is not proxied on the render context.`);
|
|
4839
4679
|
}
|
|
4840
|
-
else if (
|
|
4841
|
-
(
|
|
4842
|
-
|
|
4680
|
+
else if (instance === currentRenderingInstance) {
|
|
4681
|
+
warn$1(`Property ${JSON.stringify(key)} was accessed during render ` +
|
|
4682
|
+
`but is not defined on instance.`);
|
|
4843
4683
|
}
|
|
4844
4684
|
}
|
|
4845
|
-
}
|
|
4846
|
-
|
|
4847
|
-
}
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
if (cached) {
|
|
4852
|
-
return cached;
|
|
4853
|
-
}
|
|
4854
|
-
const raw = comp.props;
|
|
4855
|
-
const normalized = {};
|
|
4856
|
-
const needCastKeys = [];
|
|
4857
|
-
// apply mixin/extends props
|
|
4858
|
-
let hasExtends = false;
|
|
4859
|
-
if (!isFunction(comp)) {
|
|
4860
|
-
const extendProps = (raw) => {
|
|
4861
|
-
hasExtends = true;
|
|
4862
|
-
const [props, keys] = normalizePropsOptions(raw, appContext, true);
|
|
4863
|
-
extend(normalized, props);
|
|
4864
|
-
if (keys)
|
|
4865
|
-
needCastKeys.push(...keys);
|
|
4866
|
-
};
|
|
4867
|
-
if (!asMixin && appContext.mixins.length) {
|
|
4868
|
-
appContext.mixins.forEach(extendProps);
|
|
4685
|
+
},
|
|
4686
|
+
set({ _: instance }, key, value) {
|
|
4687
|
+
const { data, setupState, ctx } = instance;
|
|
4688
|
+
if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
4689
|
+
setupState[key] = value;
|
|
4690
|
+
return true;
|
|
4869
4691
|
}
|
|
4870
|
-
if (
|
|
4871
|
-
|
|
4692
|
+
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
4693
|
+
data[key] = value;
|
|
4694
|
+
return true;
|
|
4872
4695
|
}
|
|
4873
|
-
if (
|
|
4874
|
-
|
|
4696
|
+
else if (hasOwn(instance.props, key)) {
|
|
4697
|
+
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
|
4698
|
+
return false;
|
|
4875
4699
|
}
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4700
|
+
if (key[0] === '$' && key.slice(1) in instance) {
|
|
4701
|
+
warn$1(`Attempting to mutate public property "${key}". ` +
|
|
4702
|
+
`Properties starting with $ are reserved and readonly.`, instance);
|
|
4703
|
+
return false;
|
|
4704
|
+
}
|
|
4705
|
+
else {
|
|
4706
|
+
if (key in instance.appContext.config.globalProperties) {
|
|
4707
|
+
Object.defineProperty(ctx, key, {
|
|
4708
|
+
enumerable: true,
|
|
4709
|
+
configurable: true,
|
|
4710
|
+
value
|
|
4711
|
+
});
|
|
4885
4712
|
}
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
normalized[normalizedKey] = EMPTY_OBJ;
|
|
4713
|
+
else {
|
|
4714
|
+
ctx[key] = value;
|
|
4889
4715
|
}
|
|
4890
4716
|
}
|
|
4891
|
-
}
|
|
4892
|
-
else if (raw) {
|
|
4893
|
-
if (!isObject(raw)) {
|
|
4894
|
-
warn$1(`invalid props options`, raw);
|
|
4895
|
-
}
|
|
4896
|
-
for (const key in raw) {
|
|
4897
|
-
const normalizedKey = camelize(key);
|
|
4898
|
-
if (validatePropName(normalizedKey)) {
|
|
4899
|
-
const opt = raw[key];
|
|
4900
|
-
const prop = (normalized[normalizedKey] =
|
|
4901
|
-
isArray(opt) || isFunction(opt) ? { type: opt } : opt);
|
|
4902
|
-
if (prop) {
|
|
4903
|
-
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
4904
|
-
const stringIndex = getTypeIndex(String, prop.type);
|
|
4905
|
-
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
4906
|
-
prop[1 /* shouldCastTrue */] =
|
|
4907
|
-
stringIndex < 0 || booleanIndex < stringIndex;
|
|
4908
|
-
// if the prop needs boolean casting or default value
|
|
4909
|
-
if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
|
4910
|
-
needCastKeys.push(normalizedKey);
|
|
4911
|
-
}
|
|
4912
|
-
}
|
|
4913
|
-
}
|
|
4914
|
-
}
|
|
4915
|
-
}
|
|
4916
|
-
const res = [normalized, needCastKeys];
|
|
4917
|
-
cache.set(comp, res);
|
|
4918
|
-
return res;
|
|
4919
|
-
}
|
|
4920
|
-
function validatePropName(key) {
|
|
4921
|
-
if (key[0] !== '$') {
|
|
4922
4717
|
return true;
|
|
4718
|
+
},
|
|
4719
|
+
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
4720
|
+
let normalizedProps;
|
|
4721
|
+
return (!!accessCache[key] ||
|
|
4722
|
+
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
4723
|
+
(setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
|
4724
|
+
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
4725
|
+
hasOwn(ctx, key) ||
|
|
4726
|
+
hasOwn(publicPropertiesMap, key) ||
|
|
4727
|
+
hasOwn(appContext.config.globalProperties, key));
|
|
4728
|
+
},
|
|
4729
|
+
defineProperty(target, key, descriptor) {
|
|
4730
|
+
if (descriptor.get != null) {
|
|
4731
|
+
// invalidate key cache of a getter based property #5417
|
|
4732
|
+
target._.accessCache[key] = 0;
|
|
4733
|
+
}
|
|
4734
|
+
else if (hasOwn(descriptor, 'value')) {
|
|
4735
|
+
this.set(target, key, descriptor.value, null);
|
|
4736
|
+
}
|
|
4737
|
+
return Reflect.defineProperty(target, key, descriptor);
|
|
4923
4738
|
}
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
function getType(ctor) {
|
|
4932
|
-
const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
|
|
4933
|
-
return match ? match[1] : ctor === null ? 'null' : '';
|
|
4934
|
-
}
|
|
4935
|
-
function isSameType(a, b) {
|
|
4936
|
-
return getType(a) === getType(b);
|
|
4739
|
+
};
|
|
4740
|
+
{
|
|
4741
|
+
PublicInstanceProxyHandlers.ownKeys = (target) => {
|
|
4742
|
+
warn$1(`Avoid app logic that relies on enumerating keys on a component instance. ` +
|
|
4743
|
+
`The keys will be empty in production mode to avoid performance overhead.`);
|
|
4744
|
+
return Reflect.ownKeys(target);
|
|
4745
|
+
};
|
|
4937
4746
|
}
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4747
|
+
const RuntimeCompiledPublicInstanceProxyHandlers = /*#__PURE__*/ extend({}, PublicInstanceProxyHandlers, {
|
|
4748
|
+
get(target, key) {
|
|
4749
|
+
// fast path for unscopables when using `with` block
|
|
4750
|
+
if (key === Symbol.unscopables) {
|
|
4751
|
+
return;
|
|
4752
|
+
}
|
|
4753
|
+
return PublicInstanceProxyHandlers.get(target, key, target);
|
|
4754
|
+
},
|
|
4755
|
+
has(_, key) {
|
|
4756
|
+
const has = key[0] !== '_' && !isGloballyWhitelisted(key);
|
|
4757
|
+
if (!has && PublicInstanceProxyHandlers.has(_, key)) {
|
|
4758
|
+
warn$1(`Property ${JSON.stringify(key)} should not start with _ which is a reserved prefix for Vue internals.`);
|
|
4759
|
+
}
|
|
4760
|
+
return has;
|
|
4944
4761
|
}
|
|
4945
|
-
|
|
4762
|
+
});
|
|
4763
|
+
// dev only
|
|
4764
|
+
// In dev mode, the proxy target exposes the same properties as seen on `this`
|
|
4765
|
+
// for easier console inspection. In prod mode it will be an empty object so
|
|
4766
|
+
// these properties definitions can be skipped.
|
|
4767
|
+
function createDevRenderContext(instance) {
|
|
4768
|
+
const target = {};
|
|
4769
|
+
// expose internal instance for proxy handlers
|
|
4770
|
+
Object.defineProperty(target, `_`, {
|
|
4771
|
+
configurable: true,
|
|
4772
|
+
enumerable: false,
|
|
4773
|
+
get: () => instance
|
|
4774
|
+
});
|
|
4775
|
+
// expose public properties
|
|
4776
|
+
Object.keys(publicPropertiesMap).forEach(key => {
|
|
4777
|
+
Object.defineProperty(target, key, {
|
|
4778
|
+
configurable: true,
|
|
4779
|
+
enumerable: false,
|
|
4780
|
+
get: () => publicPropertiesMap[key](instance),
|
|
4781
|
+
// intercepted by the proxy so no need for implementation,
|
|
4782
|
+
// but needed to prevent set errors
|
|
4783
|
+
set: NOOP
|
|
4784
|
+
});
|
|
4785
|
+
});
|
|
4786
|
+
return target;
|
|
4946
4787
|
}
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4788
|
+
// dev only
|
|
4789
|
+
function exposePropsOnRenderContext(instance) {
|
|
4790
|
+
const { ctx, propsOptions: [propsOptions] } = instance;
|
|
4791
|
+
if (propsOptions) {
|
|
4792
|
+
Object.keys(propsOptions).forEach(key => {
|
|
4793
|
+
Object.defineProperty(ctx, key, {
|
|
4794
|
+
enumerable: true,
|
|
4795
|
+
configurable: true,
|
|
4796
|
+
get: () => instance.props[key],
|
|
4797
|
+
set: NOOP
|
|
4798
|
+
});
|
|
4799
|
+
});
|
|
4958
4800
|
}
|
|
4959
4801
|
}
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
let isValid = false;
|
|
4977
|
-
const types = isArray(type) ? type : [type];
|
|
4978
|
-
const expectedTypes = [];
|
|
4979
|
-
// value is valid as long as one of the specified types match
|
|
4980
|
-
for (let i = 0; i < types.length && !isValid; i++) {
|
|
4981
|
-
const { valid, expectedType } = assertType(value, types[i]);
|
|
4982
|
-
expectedTypes.push(expectedType || '');
|
|
4983
|
-
isValid = valid;
|
|
4802
|
+
// dev only
|
|
4803
|
+
function exposeSetupStateOnRenderContext(instance) {
|
|
4804
|
+
const { ctx, setupState } = instance;
|
|
4805
|
+
Object.keys(toRaw(setupState)).forEach(key => {
|
|
4806
|
+
if (!setupState.__isScriptSetup) {
|
|
4807
|
+
if (isReservedPrefix(key[0])) {
|
|
4808
|
+
warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
|
|
4809
|
+
`which are reserved prefixes for Vue internals.`);
|
|
4810
|
+
return;
|
|
4811
|
+
}
|
|
4812
|
+
Object.defineProperty(ctx, key, {
|
|
4813
|
+
enumerable: true,
|
|
4814
|
+
configurable: true,
|
|
4815
|
+
get: () => setupState[key],
|
|
4816
|
+
set: NOOP
|
|
4817
|
+
});
|
|
4984
4818
|
}
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4819
|
+
});
|
|
4820
|
+
}
|
|
4821
|
+
|
|
4822
|
+
function createDuplicateChecker() {
|
|
4823
|
+
const cache = Object.create(null);
|
|
4824
|
+
return (type, key) => {
|
|
4825
|
+
if (cache[key]) {
|
|
4826
|
+
warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
|
4988
4827
|
}
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
if (validator && !validator(value)) {
|
|
4992
|
-
warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
|
4993
|
-
}
|
|
4994
|
-
}
|
|
4995
|
-
const isSimpleType = /*#__PURE__*/ makeMap('String,Number,Boolean,Function,Symbol,BigInt');
|
|
4996
|
-
/**
|
|
4997
|
-
* dev only
|
|
4998
|
-
*/
|
|
4999
|
-
function assertType(value, type) {
|
|
5000
|
-
let valid;
|
|
5001
|
-
const expectedType = getType(type);
|
|
5002
|
-
if (isSimpleType(expectedType)) {
|
|
5003
|
-
const t = typeof value;
|
|
5004
|
-
valid = t === expectedType.toLowerCase();
|
|
5005
|
-
// for primitive wrapper objects
|
|
5006
|
-
if (!valid && t === 'object') {
|
|
5007
|
-
valid = value instanceof type;
|
|
4828
|
+
else {
|
|
4829
|
+
cache[key] = type;
|
|
5008
4830
|
}
|
|
5009
|
-
}
|
|
5010
|
-
else if (expectedType === 'Object') {
|
|
5011
|
-
valid = isObject(value);
|
|
5012
|
-
}
|
|
5013
|
-
else if (expectedType === 'Array') {
|
|
5014
|
-
valid = isArray(value);
|
|
5015
|
-
}
|
|
5016
|
-
else if (expectedType === 'null') {
|
|
5017
|
-
valid = value === null;
|
|
5018
|
-
}
|
|
5019
|
-
else {
|
|
5020
|
-
valid = value instanceof type;
|
|
5021
|
-
}
|
|
5022
|
-
return {
|
|
5023
|
-
valid,
|
|
5024
|
-
expectedType
|
|
5025
4831
|
};
|
|
5026
4832
|
}
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
if (expectedTypes.length === 1 &&
|
|
5039
|
-
isExplicable(expectedType) &&
|
|
5040
|
-
!isBoolean(expectedType, receivedType)) {
|
|
5041
|
-
message += ` with value ${expectedValue}`;
|
|
5042
|
-
}
|
|
5043
|
-
message += `, got ${receivedType} `;
|
|
5044
|
-
// check if we need to specify received value
|
|
5045
|
-
if (isExplicable(receivedType)) {
|
|
5046
|
-
message += `with value ${receivedValue}.`;
|
|
4833
|
+
let shouldCacheAccess = true;
|
|
4834
|
+
function applyOptions(instance) {
|
|
4835
|
+
const options = resolveMergedOptions(instance);
|
|
4836
|
+
const publicThis = instance.proxy;
|
|
4837
|
+
const ctx = instance.ctx;
|
|
4838
|
+
// do not cache property access on public proxy during state initialization
|
|
4839
|
+
shouldCacheAccess = false;
|
|
4840
|
+
// call beforeCreate first before accessing other options since
|
|
4841
|
+
// the hook may mutate resolved options (#2791)
|
|
4842
|
+
if (options.beforeCreate) {
|
|
4843
|
+
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
5047
4844
|
}
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
}
|
|
5057
|
-
|
|
5058
|
-
|
|
4845
|
+
const {
|
|
4846
|
+
// state
|
|
4847
|
+
data: dataOptions, computed: computedOptions, methods, watch: watchOptions, provide: provideOptions, inject: injectOptions,
|
|
4848
|
+
// lifecycle
|
|
4849
|
+
created, beforeMount, mounted, beforeUpdate, updated, activated, deactivated, beforeDestroy, beforeUnmount, destroyed, unmounted, render, renderTracked, renderTriggered, errorCaptured, serverPrefetch,
|
|
4850
|
+
// public API
|
|
4851
|
+
expose, inheritAttrs,
|
|
4852
|
+
// assets
|
|
4853
|
+
components, directives, filters } = options;
|
|
4854
|
+
const checkDuplicateProperties = createDuplicateChecker() ;
|
|
4855
|
+
{
|
|
4856
|
+
const [propsOptions] = instance.propsOptions;
|
|
4857
|
+
if (propsOptions) {
|
|
4858
|
+
for (const key in propsOptions) {
|
|
4859
|
+
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
4860
|
+
}
|
|
4861
|
+
}
|
|
5059
4862
|
}
|
|
5060
|
-
|
|
5061
|
-
|
|
4863
|
+
// options initialization order (to be consistent with Vue 2):
|
|
4864
|
+
// - props (already done outside of this function)
|
|
4865
|
+
// - inject
|
|
4866
|
+
// - methods
|
|
4867
|
+
// - data (deferred since it relies on `this` access)
|
|
4868
|
+
// - computed
|
|
4869
|
+
// - watch (deferred since it relies on `this` access)
|
|
4870
|
+
if (injectOptions) {
|
|
4871
|
+
resolveInjections(injectOptions, ctx, checkDuplicateProperties, instance.appContext.config.unwrapInjectedRef);
|
|
5062
4872
|
}
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
function
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
}
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
warn$1(`Slot "${key}" invoked outside of the render function: ` +
|
|
5086
|
-
`this will not track dependencies used in the slot. ` +
|
|
5087
|
-
`Invoke the slot function inside the render function instead.`);
|
|
5088
|
-
}
|
|
5089
|
-
return normalizeSlotValue(rawSlot(...args));
|
|
5090
|
-
}, ctx);
|
|
5091
|
-
normalized._c = false;
|
|
5092
|
-
return normalized;
|
|
5093
|
-
};
|
|
5094
|
-
const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
5095
|
-
const ctx = rawSlots._ctx;
|
|
5096
|
-
for (const key in rawSlots) {
|
|
5097
|
-
if (isInternalKey(key))
|
|
5098
|
-
continue;
|
|
5099
|
-
const value = rawSlots[key];
|
|
5100
|
-
if (isFunction(value)) {
|
|
5101
|
-
slots[key] = normalizeSlot(key, value, ctx);
|
|
5102
|
-
}
|
|
5103
|
-
else if (value != null) {
|
|
5104
|
-
{
|
|
5105
|
-
warn$1(`Non-function value encountered for slot "${key}". ` +
|
|
5106
|
-
`Prefer function slots for better performance.`);
|
|
4873
|
+
if (methods) {
|
|
4874
|
+
for (const key in methods) {
|
|
4875
|
+
const methodHandler = methods[key];
|
|
4876
|
+
if (isFunction(methodHandler)) {
|
|
4877
|
+
// In dev mode, we use the `createRenderContext` function to define
|
|
4878
|
+
// methods to the proxy target, and those are read-only but
|
|
4879
|
+
// reconfigurable, so it needs to be redefined here
|
|
4880
|
+
{
|
|
4881
|
+
Object.defineProperty(ctx, key, {
|
|
4882
|
+
value: methodHandler.bind(publicThis),
|
|
4883
|
+
configurable: true,
|
|
4884
|
+
enumerable: true,
|
|
4885
|
+
writable: true
|
|
4886
|
+
});
|
|
4887
|
+
}
|
|
4888
|
+
{
|
|
4889
|
+
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
4890
|
+
}
|
|
4891
|
+
}
|
|
4892
|
+
else {
|
|
4893
|
+
warn$1(`Method "${key}" has type "${typeof methodHandler}" in the component definition. ` +
|
|
4894
|
+
`Did you reference the function correctly?`);
|
|
5107
4895
|
}
|
|
5108
|
-
const normalized = normalizeSlotValue(value);
|
|
5109
|
-
slots[key] = () => normalized;
|
|
5110
4896
|
}
|
|
5111
4897
|
}
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
warn$1(`Non-function value encountered for default slot. ` +
|
|
5117
|
-
`Prefer function slots for better performance.`);
|
|
5118
|
-
}
|
|
5119
|
-
const normalized = normalizeSlotValue(children);
|
|
5120
|
-
instance.slots.default = () => normalized;
|
|
5121
|
-
};
|
|
5122
|
-
const initSlots = (instance, children) => {
|
|
5123
|
-
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
5124
|
-
const type = children._;
|
|
5125
|
-
if (type) {
|
|
5126
|
-
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
5127
|
-
// we should avoid the proxy object polluting the slots of the internal instance
|
|
5128
|
-
instance.slots = toRaw(children);
|
|
5129
|
-
// make compiler marker non-enumerable
|
|
5130
|
-
def(children, '_', type);
|
|
4898
|
+
if (dataOptions) {
|
|
4899
|
+
if (!isFunction(dataOptions)) {
|
|
4900
|
+
warn$1(`The data option must be a function. ` +
|
|
4901
|
+
`Plain object usage is no longer supported.`);
|
|
5131
4902
|
}
|
|
5132
|
-
|
|
5133
|
-
|
|
4903
|
+
const data = dataOptions.call(publicThis, publicThis);
|
|
4904
|
+
if (isPromise(data)) {
|
|
4905
|
+
warn$1(`data() returned a Promise - note data() cannot be async; If you ` +
|
|
4906
|
+
`intend to perform data fetching before component renders, use ` +
|
|
4907
|
+
`async setup() + <Suspense>.`);
|
|
5134
4908
|
}
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
instance.slots = {};
|
|
5138
|
-
if (children) {
|
|
5139
|
-
normalizeVNodeSlots(instance, children);
|
|
4909
|
+
if (!isObject(data)) {
|
|
4910
|
+
warn$1(`data() should return an object.`);
|
|
5140
4911
|
}
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
const
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
4912
|
+
else {
|
|
4913
|
+
instance.data = reactive(data);
|
|
4914
|
+
{
|
|
4915
|
+
for (const key in data) {
|
|
4916
|
+
checkDuplicateProperties("Data" /* DATA */, key);
|
|
4917
|
+
// expose data on ctx during dev
|
|
4918
|
+
if (!isReservedPrefix(key[0])) {
|
|
4919
|
+
Object.defineProperty(ctx, key, {
|
|
4920
|
+
configurable: true,
|
|
4921
|
+
enumerable: true,
|
|
4922
|
+
get: () => data[key],
|
|
4923
|
+
set: NOOP
|
|
4924
|
+
});
|
|
4925
|
+
}
|
|
4926
|
+
}
|
|
5156
4927
|
}
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
4928
|
+
}
|
|
4929
|
+
}
|
|
4930
|
+
// state initialization complete at this point - start caching access
|
|
4931
|
+
shouldCacheAccess = true;
|
|
4932
|
+
if (computedOptions) {
|
|
4933
|
+
for (const key in computedOptions) {
|
|
4934
|
+
const opt = computedOptions[key];
|
|
4935
|
+
const get = isFunction(opt)
|
|
4936
|
+
? opt.bind(publicThis, publicThis)
|
|
4937
|
+
: isFunction(opt.get)
|
|
4938
|
+
? opt.get.bind(publicThis, publicThis)
|
|
4939
|
+
: NOOP;
|
|
4940
|
+
if (get === NOOP) {
|
|
4941
|
+
warn$1(`Computed property "${key}" has no getter.`);
|
|
5161
4942
|
}
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
4943
|
+
const set = !isFunction(opt) && isFunction(opt.set)
|
|
4944
|
+
? opt.set.bind(publicThis)
|
|
4945
|
+
: () => {
|
|
4946
|
+
warn$1(`Write operation failed: computed property "${key}" is readonly.`);
|
|
4947
|
+
}
|
|
4948
|
+
;
|
|
4949
|
+
const c = computed$1({
|
|
4950
|
+
get,
|
|
4951
|
+
set
|
|
4952
|
+
});
|
|
4953
|
+
Object.defineProperty(ctx, key, {
|
|
4954
|
+
enumerable: true,
|
|
4955
|
+
configurable: true,
|
|
4956
|
+
get: () => c.value,
|
|
4957
|
+
set: v => (c.value = v)
|
|
4958
|
+
});
|
|
4959
|
+
{
|
|
4960
|
+
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
5173
4961
|
}
|
|
5174
4962
|
}
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
4963
|
+
}
|
|
4964
|
+
if (watchOptions) {
|
|
4965
|
+
for (const key in watchOptions) {
|
|
4966
|
+
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
5178
4967
|
}
|
|
5179
|
-
deletionComparisonTarget = children;
|
|
5180
4968
|
}
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
4969
|
+
if (provideOptions) {
|
|
4970
|
+
const provides = isFunction(provideOptions)
|
|
4971
|
+
? provideOptions.call(publicThis)
|
|
4972
|
+
: provideOptions;
|
|
4973
|
+
Reflect.ownKeys(provides).forEach(key => {
|
|
4974
|
+
provide(key, provides[key]);
|
|
4975
|
+
});
|
|
5185
4976
|
}
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
4977
|
+
if (created) {
|
|
4978
|
+
callHook(created, instance, "c" /* CREATED */);
|
|
4979
|
+
}
|
|
4980
|
+
function registerLifecycleHook(register, hook) {
|
|
4981
|
+
if (isArray(hook)) {
|
|
4982
|
+
hook.forEach(_hook => register(_hook.bind(publicThis)));
|
|
4983
|
+
}
|
|
4984
|
+
else if (hook) {
|
|
4985
|
+
register(hook.bind(publicThis));
|
|
5192
4986
|
}
|
|
5193
4987
|
}
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
4988
|
+
registerLifecycleHook(onBeforeMount, beforeMount);
|
|
4989
|
+
registerLifecycleHook(onMounted, mounted);
|
|
4990
|
+
registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
|
4991
|
+
registerLifecycleHook(onUpdated, updated);
|
|
4992
|
+
registerLifecycleHook(onActivated, activated);
|
|
4993
|
+
registerLifecycleHook(onDeactivated, deactivated);
|
|
4994
|
+
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
|
4995
|
+
registerLifecycleHook(onRenderTracked, renderTracked);
|
|
4996
|
+
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
|
4997
|
+
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
|
4998
|
+
registerLifecycleHook(onUnmounted, unmounted);
|
|
4999
|
+
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
5000
|
+
if (isArray(expose)) {
|
|
5001
|
+
if (expose.length) {
|
|
5002
|
+
const exposed = instance.exposed || (instance.exposed = {});
|
|
5003
|
+
expose.forEach(key => {
|
|
5004
|
+
Object.defineProperty(exposed, key, {
|
|
5005
|
+
get: () => publicThis[key],
|
|
5006
|
+
set: val => (publicThis[key] = val)
|
|
5007
|
+
});
|
|
5008
|
+
});
|
|
5009
|
+
}
|
|
5010
|
+
else if (!instance.exposed) {
|
|
5011
|
+
instance.exposed = {};
|
|
5012
|
+
}
|
|
5013
|
+
}
|
|
5014
|
+
// options that are handled when creating the instance but also need to be
|
|
5015
|
+
// applied from mixins
|
|
5016
|
+
if (render && instance.render === NOOP) {
|
|
5017
|
+
instance.render = render;
|
|
5211
5018
|
}
|
|
5019
|
+
if (inheritAttrs != null) {
|
|
5020
|
+
instance.inheritAttrs = inheritAttrs;
|
|
5021
|
+
}
|
|
5022
|
+
// asset options.
|
|
5023
|
+
if (components)
|
|
5024
|
+
instance.components = components;
|
|
5025
|
+
if (directives)
|
|
5026
|
+
instance.directives = directives;
|
|
5212
5027
|
}
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
function withDirectives(vnode, directives) {
|
|
5217
|
-
const internalInstance = currentRenderingInstance;
|
|
5218
|
-
if (internalInstance === null) {
|
|
5219
|
-
warn$1(`withDirectives can only be used inside render functions.`);
|
|
5220
|
-
return vnode;
|
|
5028
|
+
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
|
|
5029
|
+
if (isArray(injectOptions)) {
|
|
5030
|
+
injectOptions = normalizeInject(injectOptions);
|
|
5221
5031
|
}
|
|
5222
|
-
const
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
}
|
|
5032
|
+
for (const key in injectOptions) {
|
|
5033
|
+
const opt = injectOptions[key];
|
|
5034
|
+
let injected;
|
|
5035
|
+
if (isObject(opt)) {
|
|
5036
|
+
if ('default' in opt) {
|
|
5037
|
+
injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
|
|
5038
|
+
}
|
|
5039
|
+
else {
|
|
5040
|
+
injected = inject(opt.from || key);
|
|
5041
|
+
}
|
|
5232
5042
|
}
|
|
5233
|
-
|
|
5234
|
-
|
|
5043
|
+
else {
|
|
5044
|
+
injected = inject(opt);
|
|
5045
|
+
}
|
|
5046
|
+
if (isRef(injected)) {
|
|
5047
|
+
// TODO remove the check in 3.3
|
|
5048
|
+
if (unwrapRef) {
|
|
5049
|
+
Object.defineProperty(ctx, key, {
|
|
5050
|
+
enumerable: true,
|
|
5051
|
+
configurable: true,
|
|
5052
|
+
get: () => injected.value,
|
|
5053
|
+
set: v => (injected.value = v)
|
|
5054
|
+
});
|
|
5055
|
+
}
|
|
5056
|
+
else {
|
|
5057
|
+
{
|
|
5058
|
+
warn$1(`injected property "${key}" is a ref and will be auto-unwrapped ` +
|
|
5059
|
+
`and no longer needs \`.value\` in the next minor release. ` +
|
|
5060
|
+
`To opt-in to the new behavior now, ` +
|
|
5061
|
+
`set \`app.config.unwrapInjectedRef = true\` (this config is ` +
|
|
5062
|
+
`temporary and will not be needed in the future.)`);
|
|
5063
|
+
}
|
|
5064
|
+
ctx[key] = injected;
|
|
5065
|
+
}
|
|
5066
|
+
}
|
|
5067
|
+
else {
|
|
5068
|
+
ctx[key] = injected;
|
|
5069
|
+
}
|
|
5070
|
+
{
|
|
5071
|
+
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
5235
5072
|
}
|
|
5236
|
-
bindings.push({
|
|
5237
|
-
dir,
|
|
5238
|
-
instance,
|
|
5239
|
-
value,
|
|
5240
|
-
oldValue: void 0,
|
|
5241
|
-
arg,
|
|
5242
|
-
modifiers
|
|
5243
|
-
});
|
|
5244
5073
|
}
|
|
5245
|
-
return vnode;
|
|
5246
5074
|
}
|
|
5247
|
-
function
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5075
|
+
function callHook(hook, instance, type) {
|
|
5076
|
+
callWithAsyncErrorHandling(isArray(hook)
|
|
5077
|
+
? hook.map(h => h.bind(instance.proxy))
|
|
5078
|
+
: hook.bind(instance.proxy), instance, type);
|
|
5079
|
+
}
|
|
5080
|
+
function createWatcher(raw, ctx, publicThis, key) {
|
|
5081
|
+
const getter = key.includes('.')
|
|
5082
|
+
? createPathGetter(publicThis, key)
|
|
5083
|
+
: () => publicThis[key];
|
|
5084
|
+
if (isString(raw)) {
|
|
5085
|
+
const handler = ctx[raw];
|
|
5086
|
+
if (isFunction(handler)) {
|
|
5087
|
+
watch(getter, handler);
|
|
5254
5088
|
}
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
// disable tracking inside all lifecycle hooks
|
|
5258
|
-
// since they can potentially be called inside effects.
|
|
5259
|
-
pauseTracking();
|
|
5260
|
-
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
5261
|
-
vnode.el,
|
|
5262
|
-
binding,
|
|
5263
|
-
vnode,
|
|
5264
|
-
prevVNode
|
|
5265
|
-
]);
|
|
5266
|
-
resetTracking();
|
|
5089
|
+
else {
|
|
5090
|
+
warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
5267
5091
|
}
|
|
5268
5092
|
}
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
}
|
|
5093
|
+
else if (isFunction(raw)) {
|
|
5094
|
+
watch(getter, raw.bind(publicThis));
|
|
5095
|
+
}
|
|
5096
|
+
else if (isObject(raw)) {
|
|
5097
|
+
if (isArray(raw)) {
|
|
5098
|
+
raw.forEach(r => createWatcher(r, ctx, publicThis, key));
|
|
5099
|
+
}
|
|
5100
|
+
else {
|
|
5101
|
+
const handler = isFunction(raw.handler)
|
|
5102
|
+
? raw.handler.bind(publicThis)
|
|
5103
|
+
: ctx[raw.handler];
|
|
5104
|
+
if (isFunction(handler)) {
|
|
5105
|
+
watch(getter, handler, raw);
|
|
5106
|
+
}
|
|
5107
|
+
else {
|
|
5108
|
+
warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
|
5109
|
+
}
|
|
5110
|
+
}
|
|
5111
|
+
}
|
|
5112
|
+
else {
|
|
5113
|
+
warn$1(`Invalid watch option: "${key}"`, raw);
|
|
5114
|
+
}
|
|
5291
5115
|
}
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5116
|
+
/**
|
|
5117
|
+
* Resolve merged options and cache it on the component.
|
|
5118
|
+
* This is done only once per-component since the merging does not involve
|
|
5119
|
+
* instances.
|
|
5120
|
+
*/
|
|
5121
|
+
function resolveMergedOptions(instance) {
|
|
5122
|
+
const base = instance.type;
|
|
5123
|
+
const { mixins, extends: extendsOptions } = base;
|
|
5124
|
+
const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;
|
|
5125
|
+
const cached = cache.get(base);
|
|
5126
|
+
let resolved;
|
|
5127
|
+
if (cached) {
|
|
5128
|
+
resolved = cached;
|
|
5129
|
+
}
|
|
5130
|
+
else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
5131
|
+
{
|
|
5132
|
+
resolved = base;
|
|
5297
5133
|
}
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5134
|
+
}
|
|
5135
|
+
else {
|
|
5136
|
+
resolved = {};
|
|
5137
|
+
if (globalMixins.length) {
|
|
5138
|
+
globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
5301
5139
|
}
|
|
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
|
-
|
|
5140
|
+
mergeOptions(resolved, base, optionMergeStrategies);
|
|
5141
|
+
}
|
|
5142
|
+
cache.set(base, resolved);
|
|
5143
|
+
return resolved;
|
|
5144
|
+
}
|
|
5145
|
+
function mergeOptions(to, from, strats, asMixin = false) {
|
|
5146
|
+
const { mixins, extends: extendsOptions } = from;
|
|
5147
|
+
if (extendsOptions) {
|
|
5148
|
+
mergeOptions(to, extendsOptions, strats, true);
|
|
5149
|
+
}
|
|
5150
|
+
if (mixins) {
|
|
5151
|
+
mixins.forEach((m) => mergeOptions(to, m, strats, true));
|
|
5152
|
+
}
|
|
5153
|
+
for (const key in from) {
|
|
5154
|
+
if (asMixin && key === 'expose') {
|
|
5155
|
+
warn$1(`"expose" option is ignored when declared in mixins or extends. ` +
|
|
5156
|
+
`It should only be declared in the base component itself.`);
|
|
5157
|
+
}
|
|
5158
|
+
else {
|
|
5159
|
+
const strat = internalOptionMergeStrats[key] || (strats && strats[key]);
|
|
5160
|
+
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
5161
|
+
}
|
|
5162
|
+
}
|
|
5163
|
+
return to;
|
|
5164
|
+
}
|
|
5165
|
+
const internalOptionMergeStrats = {
|
|
5166
|
+
data: mergeDataFn,
|
|
5167
|
+
props: mergeObjectOptions,
|
|
5168
|
+
emits: mergeObjectOptions,
|
|
5169
|
+
// objects
|
|
5170
|
+
methods: mergeObjectOptions,
|
|
5171
|
+
computed: mergeObjectOptions,
|
|
5172
|
+
// lifecycle
|
|
5173
|
+
beforeCreate: mergeAsArray,
|
|
5174
|
+
created: mergeAsArray,
|
|
5175
|
+
beforeMount: mergeAsArray,
|
|
5176
|
+
mounted: mergeAsArray,
|
|
5177
|
+
beforeUpdate: mergeAsArray,
|
|
5178
|
+
updated: mergeAsArray,
|
|
5179
|
+
beforeDestroy: mergeAsArray,
|
|
5180
|
+
beforeUnmount: mergeAsArray,
|
|
5181
|
+
destroyed: mergeAsArray,
|
|
5182
|
+
unmounted: mergeAsArray,
|
|
5183
|
+
activated: mergeAsArray,
|
|
5184
|
+
deactivated: mergeAsArray,
|
|
5185
|
+
errorCaptured: mergeAsArray,
|
|
5186
|
+
serverPrefetch: mergeAsArray,
|
|
5187
|
+
// assets
|
|
5188
|
+
components: mergeObjectOptions,
|
|
5189
|
+
directives: mergeObjectOptions,
|
|
5190
|
+
// watch
|
|
5191
|
+
watch: mergeWatchOptions,
|
|
5192
|
+
// provide / inject
|
|
5193
|
+
provide: mergeDataFn,
|
|
5194
|
+
inject: mergeInject
|
|
5195
|
+
};
|
|
5196
|
+
function mergeDataFn(to, from) {
|
|
5197
|
+
if (!from) {
|
|
5198
|
+
return to;
|
|
5199
|
+
}
|
|
5200
|
+
if (!to) {
|
|
5201
|
+
return from;
|
|
5202
|
+
}
|
|
5203
|
+
return function mergedDataFn() {
|
|
5204
|
+
return (extend)(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
|
|
5205
|
+
};
|
|
5206
|
+
}
|
|
5207
|
+
function mergeInject(to, from) {
|
|
5208
|
+
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
5209
|
+
}
|
|
5210
|
+
function normalizeInject(raw) {
|
|
5211
|
+
if (isArray(raw)) {
|
|
5212
|
+
const res = {};
|
|
5213
|
+
for (let i = 0; i < raw.length; i++) {
|
|
5214
|
+
res[raw[i]] = raw[i];
|
|
5215
|
+
}
|
|
5216
|
+
return res;
|
|
5217
|
+
}
|
|
5218
|
+
return raw;
|
|
5219
|
+
}
|
|
5220
|
+
function mergeAsArray(to, from) {
|
|
5221
|
+
return to ? [...new Set([].concat(to, from))] : from;
|
|
5222
|
+
}
|
|
5223
|
+
function mergeObjectOptions(to, from) {
|
|
5224
|
+
return to ? extend(extend(Object.create(null), to), from) : from;
|
|
5225
|
+
}
|
|
5226
|
+
function mergeWatchOptions(to, from) {
|
|
5227
|
+
if (!to)
|
|
5228
|
+
return from;
|
|
5229
|
+
if (!from)
|
|
5230
|
+
return to;
|
|
5231
|
+
const merged = extend(Object.create(null), to);
|
|
5232
|
+
for (const key in from) {
|
|
5233
|
+
merged[key] = mergeAsArray(to[key], from[key]);
|
|
5234
|
+
}
|
|
5235
|
+
return merged;
|
|
5236
|
+
}
|
|
5237
|
+
|
|
5238
|
+
function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison
|
|
5239
|
+
isSSR = false) {
|
|
5240
|
+
const props = {};
|
|
5241
|
+
const attrs = {};
|
|
5242
|
+
def(attrs, InternalObjectKey, 1);
|
|
5243
|
+
instance.propsDefaults = Object.create(null);
|
|
5244
|
+
setFullProps(instance, rawProps, props, attrs);
|
|
5245
|
+
// ensure all declared prop keys are present
|
|
5246
|
+
for (const key in instance.propsOptions[0]) {
|
|
5247
|
+
if (!(key in props)) {
|
|
5248
|
+
props[key] = undefined;
|
|
5249
|
+
}
|
|
5250
|
+
}
|
|
5251
|
+
// validation
|
|
5252
|
+
{
|
|
5253
|
+
validateProps(rawProps || {}, props, instance);
|
|
5254
|
+
}
|
|
5255
|
+
if (isStateful) {
|
|
5256
|
+
// stateful
|
|
5257
|
+
instance.props = isSSR ? props : shallowReactive(props);
|
|
5258
|
+
}
|
|
5259
|
+
else {
|
|
5260
|
+
if (!instance.type.props) {
|
|
5261
|
+
// functional w/ optional props, props === attrs
|
|
5262
|
+
instance.props = attrs;
|
|
5263
|
+
}
|
|
5264
|
+
else {
|
|
5265
|
+
// functional w/ declared props
|
|
5266
|
+
instance.props = props;
|
|
5267
|
+
}
|
|
5268
|
+
}
|
|
5269
|
+
instance.attrs = attrs;
|
|
5270
|
+
}
|
|
5271
|
+
function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
5272
|
+
const { props, attrs, vnode: { patchFlag } } = instance;
|
|
5273
|
+
const rawCurrentProps = toRaw(props);
|
|
5274
|
+
const [options] = instance.propsOptions;
|
|
5275
|
+
let hasAttrsChanged = false;
|
|
5276
|
+
if (
|
|
5277
|
+
// always force full diff in dev
|
|
5278
|
+
// - #1942 if hmr is enabled with sfc component
|
|
5279
|
+
// - vite#872 non-sfc component used by sfc component
|
|
5280
|
+
!((instance.type.__hmrId ||
|
|
5281
|
+
(instance.parent && instance.parent.type.__hmrId))) &&
|
|
5282
|
+
(optimized || patchFlag > 0) &&
|
|
5283
|
+
!(patchFlag & 16 /* FULL_PROPS */)) {
|
|
5284
|
+
if (patchFlag & 8 /* PROPS */) {
|
|
5285
|
+
// Compiler-generated props & no keys change, just set the updated
|
|
5286
|
+
// the props.
|
|
5287
|
+
const propsToUpdate = instance.vnode.dynamicProps;
|
|
5288
|
+
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
5289
|
+
let key = propsToUpdate[i];
|
|
5290
|
+
// skip if the prop key is a declared emit event listener
|
|
5291
|
+
if (isEmitListener(instance.emitsOptions, key)) {
|
|
5292
|
+
continue;
|
|
5293
|
+
}
|
|
5294
|
+
// PROPS flag guarantees rawProps to be non-null
|
|
5295
|
+
const value = rawProps[key];
|
|
5296
|
+
if (options) {
|
|
5297
|
+
// attr / props separation was done on init and will be consistent
|
|
5298
|
+
// in this code path, so just check if attrs have it.
|
|
5299
|
+
if (hasOwn(attrs, key)) {
|
|
5300
|
+
if (value !== attrs[key]) {
|
|
5301
|
+
attrs[key] = value;
|
|
5302
|
+
hasAttrsChanged = true;
|
|
5303
|
+
}
|
|
5304
|
+
}
|
|
5305
|
+
else {
|
|
5306
|
+
const camelizedKey = camelize(key);
|
|
5307
|
+
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
|
|
5308
|
+
}
|
|
5309
|
+
}
|
|
5310
|
+
else {
|
|
5311
|
+
if (value !== attrs[key]) {
|
|
5312
|
+
attrs[key] = value;
|
|
5313
|
+
hasAttrsChanged = true;
|
|
5314
|
+
}
|
|
5315
|
+
}
|
|
5316
|
+
}
|
|
5317
|
+
}
|
|
5318
|
+
}
|
|
5319
|
+
else {
|
|
5320
|
+
// full props update.
|
|
5321
|
+
if (setFullProps(instance, rawProps, props, attrs)) {
|
|
5322
|
+
hasAttrsChanged = true;
|
|
5323
|
+
}
|
|
5324
|
+
// in case of dynamic props, check if we need to delete keys from
|
|
5325
|
+
// the props object
|
|
5326
|
+
let kebabKey;
|
|
5327
|
+
for (const key in rawCurrentProps) {
|
|
5328
|
+
if (!rawProps ||
|
|
5329
|
+
// for camelCase
|
|
5330
|
+
(!hasOwn(rawProps, key) &&
|
|
5331
|
+
// it's possible the original props was passed in as kebab-case
|
|
5332
|
+
// and converted to camelCase (#955)
|
|
5333
|
+
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {
|
|
5334
|
+
if (options) {
|
|
5335
|
+
if (rawPrevProps &&
|
|
5336
|
+
// for camelCase
|
|
5337
|
+
(rawPrevProps[key] !== undefined ||
|
|
5338
|
+
// for kebab-case
|
|
5339
|
+
rawPrevProps[kebabKey] !== undefined)) {
|
|
5340
|
+
props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */);
|
|
5341
|
+
}
|
|
5342
|
+
}
|
|
5343
|
+
else {
|
|
5344
|
+
delete props[key];
|
|
5345
|
+
}
|
|
5346
|
+
}
|
|
5347
|
+
}
|
|
5348
|
+
// in the case of functional component w/o props declaration, props and
|
|
5349
|
+
// attrs point to the same object so it should already have been updated.
|
|
5350
|
+
if (attrs !== rawCurrentProps) {
|
|
5351
|
+
for (const key in attrs) {
|
|
5352
|
+
if (!rawProps ||
|
|
5353
|
+
(!hasOwn(rawProps, key) &&
|
|
5354
|
+
(!false ))) {
|
|
5355
|
+
delete attrs[key];
|
|
5356
|
+
hasAttrsChanged = true;
|
|
5357
|
+
}
|
|
5358
|
+
}
|
|
5359
|
+
}
|
|
5360
|
+
}
|
|
5361
|
+
// trigger updates for $attrs in case it's used in component slots
|
|
5362
|
+
if (hasAttrsChanged) {
|
|
5363
|
+
trigger(instance, "set" /* SET */, '$attrs');
|
|
5364
|
+
}
|
|
5365
|
+
{
|
|
5366
|
+
validateProps(rawProps || {}, props, instance);
|
|
5367
|
+
}
|
|
5368
|
+
}
|
|
5369
|
+
function setFullProps(instance, rawProps, props, attrs) {
|
|
5370
|
+
const [options, needCastKeys] = instance.propsOptions;
|
|
5371
|
+
let hasAttrsChanged = false;
|
|
5372
|
+
let rawCastValues;
|
|
5373
|
+
if (rawProps) {
|
|
5374
|
+
for (let key in rawProps) {
|
|
5375
|
+
// key, ref are reserved and never passed down
|
|
5376
|
+
if (isReservedProp(key)) {
|
|
5377
|
+
continue;
|
|
5378
|
+
}
|
|
5379
|
+
const value = rawProps[key];
|
|
5380
|
+
// prop option names are camelized during normalization, so to support
|
|
5381
|
+
// kebab -> camel conversion here we need to camelize the key.
|
|
5382
|
+
let camelKey;
|
|
5383
|
+
if (options && hasOwn(options, (camelKey = camelize(key)))) {
|
|
5384
|
+
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
|
5385
|
+
props[camelKey] = value;
|
|
5386
|
+
}
|
|
5387
|
+
else {
|
|
5388
|
+
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
|
5389
|
+
}
|
|
5390
|
+
}
|
|
5391
|
+
else if (!isEmitListener(instance.emitsOptions, key)) {
|
|
5392
|
+
if (!(key in attrs) || value !== attrs[key]) {
|
|
5393
|
+
attrs[key] = value;
|
|
5394
|
+
hasAttrsChanged = true;
|
|
5395
|
+
}
|
|
5396
|
+
}
|
|
5397
|
+
}
|
|
5398
|
+
}
|
|
5399
|
+
if (needCastKeys) {
|
|
5400
|
+
const rawCurrentProps = toRaw(props);
|
|
5401
|
+
const castValues = rawCastValues || EMPTY_OBJ;
|
|
5402
|
+
for (let i = 0; i < needCastKeys.length; i++) {
|
|
5403
|
+
const key = needCastKeys[i];
|
|
5404
|
+
props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn(castValues, key));
|
|
5405
|
+
}
|
|
5406
|
+
}
|
|
5407
|
+
return hasAttrsChanged;
|
|
5408
|
+
}
|
|
5409
|
+
function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
5410
|
+
const opt = options[key];
|
|
5411
|
+
if (opt != null) {
|
|
5412
|
+
const hasDefault = hasOwn(opt, 'default');
|
|
5413
|
+
// default values
|
|
5414
|
+
if (hasDefault && value === undefined) {
|
|
5415
|
+
const defaultValue = opt.default;
|
|
5416
|
+
if (opt.type !== Function && isFunction(defaultValue)) {
|
|
5417
|
+
const { propsDefaults } = instance;
|
|
5418
|
+
if (key in propsDefaults) {
|
|
5419
|
+
value = propsDefaults[key];
|
|
5420
|
+
}
|
|
5421
|
+
else {
|
|
5422
|
+
setCurrentInstance(instance);
|
|
5423
|
+
value = propsDefaults[key] = defaultValue.call(null, props);
|
|
5424
|
+
unsetCurrentInstance();
|
|
5425
|
+
}
|
|
5426
|
+
}
|
|
5427
|
+
else {
|
|
5428
|
+
value = defaultValue;
|
|
5429
|
+
}
|
|
5430
|
+
}
|
|
5431
|
+
// boolean casting
|
|
5432
|
+
if (opt[0 /* shouldCast */]) {
|
|
5433
|
+
if (isAbsent && !hasDefault) {
|
|
5434
|
+
value = false;
|
|
5435
|
+
}
|
|
5436
|
+
else if (opt[1 /* shouldCastTrue */] &&
|
|
5437
|
+
(value === '' || value === hyphenate(key))) {
|
|
5438
|
+
value = true;
|
|
5439
|
+
}
|
|
5440
|
+
}
|
|
5441
|
+
}
|
|
5442
|
+
return value;
|
|
5443
|
+
}
|
|
5444
|
+
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
5445
|
+
const cache = appContext.propsCache;
|
|
5446
|
+
const cached = cache.get(comp);
|
|
5447
|
+
if (cached) {
|
|
5448
|
+
return cached;
|
|
5449
|
+
}
|
|
5450
|
+
const raw = comp.props;
|
|
5451
|
+
const normalized = {};
|
|
5452
|
+
const needCastKeys = [];
|
|
5453
|
+
// apply mixin/extends props
|
|
5454
|
+
let hasExtends = false;
|
|
5455
|
+
if (!isFunction(comp)) {
|
|
5456
|
+
const extendProps = (raw) => {
|
|
5457
|
+
hasExtends = true;
|
|
5458
|
+
const [props, keys] = normalizePropsOptions(raw, appContext, true);
|
|
5459
|
+
extend(normalized, props);
|
|
5460
|
+
if (keys)
|
|
5461
|
+
needCastKeys.push(...keys);
|
|
5462
|
+
};
|
|
5463
|
+
if (!asMixin && appContext.mixins.length) {
|
|
5464
|
+
appContext.mixins.forEach(extendProps);
|
|
5465
|
+
}
|
|
5466
|
+
if (comp.extends) {
|
|
5467
|
+
extendProps(comp.extends);
|
|
5468
|
+
}
|
|
5469
|
+
if (comp.mixins) {
|
|
5470
|
+
comp.mixins.forEach(extendProps);
|
|
5471
|
+
}
|
|
5472
|
+
}
|
|
5473
|
+
if (!raw && !hasExtends) {
|
|
5474
|
+
cache.set(comp, EMPTY_ARR);
|
|
5475
|
+
return EMPTY_ARR;
|
|
5476
|
+
}
|
|
5477
|
+
if (isArray(raw)) {
|
|
5478
|
+
for (let i = 0; i < raw.length; i++) {
|
|
5479
|
+
if (!isString(raw[i])) {
|
|
5480
|
+
warn$1(`props must be strings when using array syntax.`, raw[i]);
|
|
5481
|
+
}
|
|
5482
|
+
const normalizedKey = camelize(raw[i]);
|
|
5483
|
+
if (validatePropName(normalizedKey)) {
|
|
5484
|
+
normalized[normalizedKey] = EMPTY_OBJ;
|
|
5485
|
+
}
|
|
5486
|
+
}
|
|
5487
|
+
}
|
|
5488
|
+
else if (raw) {
|
|
5489
|
+
if (!isObject(raw)) {
|
|
5490
|
+
warn$1(`invalid props options`, raw);
|
|
5491
|
+
}
|
|
5492
|
+
for (const key in raw) {
|
|
5493
|
+
const normalizedKey = camelize(key);
|
|
5494
|
+
if (validatePropName(normalizedKey)) {
|
|
5495
|
+
const opt = raw[key];
|
|
5496
|
+
const prop = (normalized[normalizedKey] =
|
|
5497
|
+
isArray(opt) || isFunction(opt) ? { type: opt } : opt);
|
|
5498
|
+
if (prop) {
|
|
5499
|
+
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
5500
|
+
const stringIndex = getTypeIndex(String, prop.type);
|
|
5501
|
+
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
5502
|
+
prop[1 /* shouldCastTrue */] =
|
|
5503
|
+
stringIndex < 0 || booleanIndex < stringIndex;
|
|
5504
|
+
// if the prop needs boolean casting or default value
|
|
5505
|
+
if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
|
5506
|
+
needCastKeys.push(normalizedKey);
|
|
5507
|
+
}
|
|
5508
|
+
}
|
|
5509
|
+
}
|
|
5510
|
+
}
|
|
5511
|
+
}
|
|
5512
|
+
const res = [normalized, needCastKeys];
|
|
5513
|
+
cache.set(comp, res);
|
|
5514
|
+
return res;
|
|
5515
|
+
}
|
|
5516
|
+
function validatePropName(key) {
|
|
5517
|
+
if (key[0] !== '$') {
|
|
5518
|
+
return true;
|
|
5519
|
+
}
|
|
5520
|
+
else {
|
|
5521
|
+
warn$1(`Invalid prop name: "${key}" is a reserved property.`);
|
|
5522
|
+
}
|
|
5523
|
+
return false;
|
|
5524
|
+
}
|
|
5525
|
+
// use function string name to check type constructors
|
|
5526
|
+
// so that it works across vms / iframes.
|
|
5527
|
+
function getType(ctor) {
|
|
5528
|
+
const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
|
|
5529
|
+
return match ? match[1] : ctor === null ? 'null' : '';
|
|
5530
|
+
}
|
|
5531
|
+
function isSameType(a, b) {
|
|
5532
|
+
return getType(a) === getType(b);
|
|
5533
|
+
}
|
|
5534
|
+
function getTypeIndex(type, expectedTypes) {
|
|
5535
|
+
if (isArray(expectedTypes)) {
|
|
5536
|
+
return expectedTypes.findIndex(t => isSameType(t, type));
|
|
5537
|
+
}
|
|
5538
|
+
else if (isFunction(expectedTypes)) {
|
|
5539
|
+
return isSameType(expectedTypes, type) ? 0 : -1;
|
|
5540
|
+
}
|
|
5541
|
+
return -1;
|
|
5542
|
+
}
|
|
5543
|
+
/**
|
|
5544
|
+
* dev only
|
|
5545
|
+
*/
|
|
5546
|
+
function validateProps(rawProps, props, instance) {
|
|
5547
|
+
const resolvedValues = toRaw(props);
|
|
5548
|
+
const options = instance.propsOptions[0];
|
|
5549
|
+
for (const key in options) {
|
|
5550
|
+
let opt = options[key];
|
|
5551
|
+
if (opt == null)
|
|
5552
|
+
continue;
|
|
5553
|
+
validateProp(key, resolvedValues[key], opt, !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key)));
|
|
5554
|
+
}
|
|
5555
|
+
}
|
|
5556
|
+
/**
|
|
5557
|
+
* dev only
|
|
5558
|
+
*/
|
|
5559
|
+
function validateProp(name, value, prop, isAbsent) {
|
|
5560
|
+
const { type, required, validator } = prop;
|
|
5561
|
+
// required!
|
|
5562
|
+
if (required && isAbsent) {
|
|
5563
|
+
warn$1('Missing required prop: "' + name + '"');
|
|
5564
|
+
return;
|
|
5565
|
+
}
|
|
5566
|
+
// missing but optional
|
|
5567
|
+
if (value == null && !prop.required) {
|
|
5568
|
+
return;
|
|
5569
|
+
}
|
|
5570
|
+
// type check
|
|
5571
|
+
if (type != null && type !== true) {
|
|
5572
|
+
let isValid = false;
|
|
5573
|
+
const types = isArray(type) ? type : [type];
|
|
5574
|
+
const expectedTypes = [];
|
|
5575
|
+
// value is valid as long as one of the specified types match
|
|
5576
|
+
for (let i = 0; i < types.length && !isValid; i++) {
|
|
5577
|
+
const { valid, expectedType } = assertType(value, types[i]);
|
|
5578
|
+
expectedTypes.push(expectedType || '');
|
|
5579
|
+
isValid = valid;
|
|
5580
|
+
}
|
|
5581
|
+
if (!isValid) {
|
|
5582
|
+
warn$1(getInvalidTypeMessage(name, value, expectedTypes));
|
|
5583
|
+
return;
|
|
5584
|
+
}
|
|
5585
|
+
}
|
|
5586
|
+
// custom validator
|
|
5587
|
+
if (validator && !validator(value)) {
|
|
5588
|
+
warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
|
5589
|
+
}
|
|
5590
|
+
}
|
|
5591
|
+
const isSimpleType = /*#__PURE__*/ makeMap('String,Number,Boolean,Function,Symbol,BigInt');
|
|
5592
|
+
/**
|
|
5593
|
+
* dev only
|
|
5594
|
+
*/
|
|
5595
|
+
function assertType(value, type) {
|
|
5596
|
+
let valid;
|
|
5597
|
+
const expectedType = getType(type);
|
|
5598
|
+
if (isSimpleType(expectedType)) {
|
|
5599
|
+
const t = typeof value;
|
|
5600
|
+
valid = t === expectedType.toLowerCase();
|
|
5601
|
+
// for primitive wrapper objects
|
|
5602
|
+
if (!valid && t === 'object') {
|
|
5603
|
+
valid = value instanceof type;
|
|
5604
|
+
}
|
|
5605
|
+
}
|
|
5606
|
+
else if (expectedType === 'Object') {
|
|
5607
|
+
valid = isObject(value);
|
|
5608
|
+
}
|
|
5609
|
+
else if (expectedType === 'Array') {
|
|
5610
|
+
valid = isArray(value);
|
|
5611
|
+
}
|
|
5612
|
+
else if (expectedType === 'null') {
|
|
5613
|
+
valid = value === null;
|
|
5614
|
+
}
|
|
5615
|
+
else {
|
|
5616
|
+
valid = value instanceof type;
|
|
5617
|
+
}
|
|
5618
|
+
return {
|
|
5619
|
+
valid,
|
|
5620
|
+
expectedType
|
|
5621
|
+
};
|
|
5622
|
+
}
|
|
5623
|
+
/**
|
|
5624
|
+
* dev only
|
|
5625
|
+
*/
|
|
5626
|
+
function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
5627
|
+
let message = `Invalid prop: type check failed for prop "${name}".` +
|
|
5628
|
+
` Expected ${expectedTypes.map(capitalize).join(' | ')}`;
|
|
5629
|
+
const expectedType = expectedTypes[0];
|
|
5630
|
+
const receivedType = toRawType(value);
|
|
5631
|
+
const expectedValue = styleValue(value, expectedType);
|
|
5632
|
+
const receivedValue = styleValue(value, receivedType);
|
|
5633
|
+
// check if we need to specify expected value
|
|
5634
|
+
if (expectedTypes.length === 1 &&
|
|
5635
|
+
isExplicable(expectedType) &&
|
|
5636
|
+
!isBoolean(expectedType, receivedType)) {
|
|
5637
|
+
message += ` with value ${expectedValue}`;
|
|
5638
|
+
}
|
|
5639
|
+
message += `, got ${receivedType} `;
|
|
5640
|
+
// check if we need to specify received value
|
|
5641
|
+
if (isExplicable(receivedType)) {
|
|
5642
|
+
message += `with value ${receivedValue}.`;
|
|
5643
|
+
}
|
|
5644
|
+
return message;
|
|
5645
|
+
}
|
|
5646
|
+
/**
|
|
5647
|
+
* dev only
|
|
5648
|
+
*/
|
|
5649
|
+
function styleValue(value, type) {
|
|
5650
|
+
if (type === 'String') {
|
|
5651
|
+
return `"${value}"`;
|
|
5652
|
+
}
|
|
5653
|
+
else if (type === 'Number') {
|
|
5654
|
+
return `${Number(value)}`;
|
|
5655
|
+
}
|
|
5656
|
+
else {
|
|
5657
|
+
return `${value}`;
|
|
5658
|
+
}
|
|
5659
|
+
}
|
|
5660
|
+
/**
|
|
5661
|
+
* dev only
|
|
5662
|
+
*/
|
|
5663
|
+
function isExplicable(type) {
|
|
5664
|
+
const explicitTypes = ['string', 'number', 'boolean'];
|
|
5665
|
+
return explicitTypes.some(elem => type.toLowerCase() === elem);
|
|
5666
|
+
}
|
|
5667
|
+
/**
|
|
5668
|
+
* dev only
|
|
5669
|
+
*/
|
|
5670
|
+
function isBoolean(...args) {
|
|
5671
|
+
return args.some(elem => elem.toLowerCase() === 'boolean');
|
|
5672
|
+
}
|
|
5673
|
+
|
|
5674
|
+
const isInternalKey = (key) => key[0] === '_' || key === '$stable';
|
|
5675
|
+
const normalizeSlotValue = (value) => isArray(value)
|
|
5676
|
+
? value.map(normalizeVNode)
|
|
5677
|
+
: [normalizeVNode(value)];
|
|
5678
|
+
const normalizeSlot = (key, rawSlot, ctx) => {
|
|
5679
|
+
if (rawSlot._n) {
|
|
5680
|
+
// already normalized - #5353
|
|
5681
|
+
return rawSlot;
|
|
5682
|
+
}
|
|
5683
|
+
const normalized = withCtx((...args) => {
|
|
5684
|
+
if (currentInstance) {
|
|
5685
|
+
warn$1(`Slot "${key}" invoked outside of the render function: ` +
|
|
5686
|
+
`this will not track dependencies used in the slot. ` +
|
|
5687
|
+
`Invoke the slot function inside the render function instead.`);
|
|
5688
|
+
}
|
|
5689
|
+
return normalizeSlotValue(rawSlot(...args));
|
|
5690
|
+
}, ctx);
|
|
5691
|
+
normalized._c = false;
|
|
5692
|
+
return normalized;
|
|
5693
|
+
};
|
|
5694
|
+
const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
5695
|
+
const ctx = rawSlots._ctx;
|
|
5696
|
+
for (const key in rawSlots) {
|
|
5697
|
+
if (isInternalKey(key))
|
|
5698
|
+
continue;
|
|
5699
|
+
const value = rawSlots[key];
|
|
5700
|
+
if (isFunction(value)) {
|
|
5701
|
+
slots[key] = normalizeSlot(key, value, ctx);
|
|
5702
|
+
}
|
|
5703
|
+
else if (value != null) {
|
|
5704
|
+
{
|
|
5705
|
+
warn$1(`Non-function value encountered for slot "${key}". ` +
|
|
5706
|
+
`Prefer function slots for better performance.`);
|
|
5707
|
+
}
|
|
5708
|
+
const normalized = normalizeSlotValue(value);
|
|
5709
|
+
slots[key] = () => normalized;
|
|
5710
|
+
}
|
|
5711
|
+
}
|
|
5712
|
+
};
|
|
5713
|
+
const normalizeVNodeSlots = (instance, children) => {
|
|
5714
|
+
if (!isKeepAlive(instance.vnode) &&
|
|
5715
|
+
!(false )) {
|
|
5716
|
+
warn$1(`Non-function value encountered for default slot. ` +
|
|
5717
|
+
`Prefer function slots for better performance.`);
|
|
5718
|
+
}
|
|
5719
|
+
const normalized = normalizeSlotValue(children);
|
|
5720
|
+
instance.slots.default = () => normalized;
|
|
5721
|
+
};
|
|
5722
|
+
const initSlots = (instance, children) => {
|
|
5723
|
+
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
5724
|
+
const type = children._;
|
|
5725
|
+
if (type) {
|
|
5726
|
+
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
5727
|
+
// we should avoid the proxy object polluting the slots of the internal instance
|
|
5728
|
+
instance.slots = toRaw(children);
|
|
5729
|
+
// make compiler marker non-enumerable
|
|
5730
|
+
def(children, '_', type);
|
|
5731
|
+
}
|
|
5732
|
+
else {
|
|
5733
|
+
normalizeObjectSlots(children, (instance.slots = {}));
|
|
5734
|
+
}
|
|
5735
|
+
}
|
|
5736
|
+
else {
|
|
5737
|
+
instance.slots = {};
|
|
5738
|
+
if (children) {
|
|
5739
|
+
normalizeVNodeSlots(instance, children);
|
|
5740
|
+
}
|
|
5741
|
+
}
|
|
5742
|
+
def(instance.slots, InternalObjectKey, 1);
|
|
5743
|
+
};
|
|
5744
|
+
const updateSlots = (instance, children, optimized) => {
|
|
5745
|
+
const { vnode, slots } = instance;
|
|
5746
|
+
let needDeletionCheck = true;
|
|
5747
|
+
let deletionComparisonTarget = EMPTY_OBJ;
|
|
5748
|
+
if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
5749
|
+
const type = children._;
|
|
5750
|
+
if (type) {
|
|
5751
|
+
// compiled slots.
|
|
5752
|
+
if (isHmrUpdating) {
|
|
5753
|
+
// Parent was HMR updated so slot content may have changed.
|
|
5754
|
+
// force update slots and mark instance for hmr as well
|
|
5755
|
+
extend(slots, children);
|
|
5756
|
+
}
|
|
5757
|
+
else if (optimized && type === 1 /* STABLE */) {
|
|
5758
|
+
// compiled AND stable.
|
|
5759
|
+
// no need to update, and skip stale slots removal.
|
|
5760
|
+
needDeletionCheck = false;
|
|
5761
|
+
}
|
|
5762
|
+
else {
|
|
5763
|
+
// compiled but dynamic (v-if/v-for on slots) - update slots, but skip
|
|
5764
|
+
// normalization.
|
|
5765
|
+
extend(slots, children);
|
|
5766
|
+
// #2893
|
|
5767
|
+
// when rendering the optimized slots by manually written render function,
|
|
5768
|
+
// we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
|
|
5769
|
+
// i.e. let the `renderSlot` create the bailed Fragment
|
|
5770
|
+
if (!optimized && type === 1 /* STABLE */) {
|
|
5771
|
+
delete slots._;
|
|
5772
|
+
}
|
|
5773
|
+
}
|
|
5774
|
+
}
|
|
5775
|
+
else {
|
|
5776
|
+
needDeletionCheck = !children.$stable;
|
|
5777
|
+
normalizeObjectSlots(children, slots);
|
|
5778
|
+
}
|
|
5779
|
+
deletionComparisonTarget = children;
|
|
5780
|
+
}
|
|
5781
|
+
else if (children) {
|
|
5782
|
+
// non slot object children (direct value) passed to a component
|
|
5783
|
+
normalizeVNodeSlots(instance, children);
|
|
5784
|
+
deletionComparisonTarget = { default: 1 };
|
|
5785
|
+
}
|
|
5786
|
+
// delete stale slots
|
|
5787
|
+
if (needDeletionCheck) {
|
|
5788
|
+
for (const key in slots) {
|
|
5789
|
+
if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
|
|
5790
|
+
delete slots[key];
|
|
5791
|
+
}
|
|
5792
|
+
}
|
|
5793
|
+
}
|
|
5794
|
+
};
|
|
5795
|
+
|
|
5796
|
+
function createAppContext() {
|
|
5797
|
+
return {
|
|
5798
|
+
app: null,
|
|
5799
|
+
config: {
|
|
5800
|
+
isNativeTag: NO,
|
|
5801
|
+
performance: false,
|
|
5802
|
+
globalProperties: {},
|
|
5803
|
+
optionMergeStrategies: {},
|
|
5804
|
+
errorHandler: undefined,
|
|
5805
|
+
warnHandler: undefined,
|
|
5806
|
+
compilerOptions: {}
|
|
5807
|
+
},
|
|
5808
|
+
mixins: [],
|
|
5809
|
+
components: {},
|
|
5810
|
+
directives: {},
|
|
5811
|
+
provides: Object.create(null),
|
|
5812
|
+
optionsCache: new WeakMap(),
|
|
5813
|
+
propsCache: new WeakMap(),
|
|
5814
|
+
emitsCache: new WeakMap()
|
|
5815
|
+
};
|
|
5816
|
+
}
|
|
5817
|
+
let uid = 0;
|
|
5818
|
+
function createAppAPI(render, hydrate) {
|
|
5819
|
+
return function createApp(rootComponent, rootProps = null) {
|
|
5820
|
+
if (!isFunction(rootComponent)) {
|
|
5821
|
+
rootComponent = Object.assign({}, rootComponent);
|
|
5822
|
+
}
|
|
5823
|
+
if (rootProps != null && !isObject(rootProps)) {
|
|
5824
|
+
warn$1(`root props passed to app.mount() must be an object.`);
|
|
5825
|
+
rootProps = null;
|
|
5826
|
+
}
|
|
5827
|
+
const context = createAppContext();
|
|
5828
|
+
const installedPlugins = new Set();
|
|
5829
|
+
let isMounted = false;
|
|
5830
|
+
const app = (context.app = {
|
|
5831
|
+
_uid: uid++,
|
|
5832
|
+
_component: rootComponent,
|
|
5833
|
+
_props: rootProps,
|
|
5834
|
+
_container: null,
|
|
5835
|
+
_context: context,
|
|
5836
|
+
_instance: null,
|
|
5837
|
+
version,
|
|
5838
|
+
get config() {
|
|
5839
|
+
return context.config;
|
|
5840
|
+
},
|
|
5841
|
+
set config(v) {
|
|
5842
|
+
{
|
|
5843
|
+
warn$1(`app.config cannot be replaced. Modify individual options instead.`);
|
|
5844
|
+
}
|
|
5845
|
+
},
|
|
5846
|
+
use(plugin, ...options) {
|
|
5847
|
+
if (installedPlugins.has(plugin)) {
|
|
5848
|
+
warn$1(`Plugin has already been applied to target app.`);
|
|
5849
|
+
}
|
|
5850
|
+
else if (plugin && isFunction(plugin.install)) {
|
|
5851
|
+
installedPlugins.add(plugin);
|
|
5852
|
+
plugin.install(app, ...options);
|
|
5853
|
+
}
|
|
5854
|
+
else if (isFunction(plugin)) {
|
|
5855
|
+
installedPlugins.add(plugin);
|
|
5331
5856
|
plugin(app, ...options);
|
|
5332
5857
|
}
|
|
5333
5858
|
else {
|
|
@@ -5376,6 +5901,12 @@ function createAppAPI(render, hydrate) {
|
|
|
5376
5901
|
},
|
|
5377
5902
|
mount(rootContainer, isHydrate, isSVG) {
|
|
5378
5903
|
if (!isMounted) {
|
|
5904
|
+
// #5571
|
|
5905
|
+
if (rootContainer.__vue_app__) {
|
|
5906
|
+
warn$1(`There is already an app instance mounted on the host container.\n` +
|
|
5907
|
+
` If you want to mount another app on the same host container,` +
|
|
5908
|
+
` you need to unmount the previous app by calling \`app.unmount()\` first.`);
|
|
5909
|
+
}
|
|
5379
5910
|
const vnode = createVNode(rootComponent, rootProps);
|
|
5380
5911
|
// store app context on the root VNode.
|
|
5381
5912
|
// this will be set on the root instance on initial mount.
|
|
@@ -5426,8 +5957,6 @@ function createAppAPI(render, hydrate) {
|
|
|
5426
5957
|
warn$1(`App already provides property with key "${String(key)}". ` +
|
|
5427
5958
|
`It will be overwritten with the new value.`);
|
|
5428
5959
|
}
|
|
5429
|
-
// TypeScript doesn't allow symbols as index type
|
|
5430
|
-
// https://github.com/Microsoft/TypeScript/issues/24587
|
|
5431
5960
|
context.provides[key] = value;
|
|
5432
5961
|
return app;
|
|
5433
5962
|
}
|
|
@@ -5544,7 +6073,7 @@ const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
|
5544
6073
|
// Hydration also depends on some renderer internal logic which needs to be
|
|
5545
6074
|
// passed in via arguments.
|
|
5546
6075
|
function createHydrationFunctions(rendererInternals) {
|
|
5547
|
-
const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
|
|
6076
|
+
const { mt: mountComponent, p: patch, o: { patchProp, createText, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
|
|
5548
6077
|
const hydrate = (vnode, container) => {
|
|
5549
6078
|
if (!container.hasChildNodes()) {
|
|
5550
6079
|
warn$1(`Attempting to hydrate existing markup but container is empty. ` +
|
|
@@ -5564,14 +6093,26 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
5564
6093
|
const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
|
5565
6094
|
const isFragmentStart = isComment(node) && node.data === '[';
|
|
5566
6095
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
5567
|
-
const { type, ref, shapeFlag } = vnode;
|
|
6096
|
+
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
5568
6097
|
const domType = node.nodeType;
|
|
5569
6098
|
vnode.el = node;
|
|
6099
|
+
if (patchFlag === -2 /* BAIL */) {
|
|
6100
|
+
optimized = false;
|
|
6101
|
+
vnode.dynamicChildren = null;
|
|
6102
|
+
}
|
|
5570
6103
|
let nextNode = null;
|
|
5571
6104
|
switch (type) {
|
|
5572
6105
|
case Text:
|
|
5573
6106
|
if (domType !== 3 /* TEXT */) {
|
|
5574
|
-
|
|
6107
|
+
// #5728 empty text node inside a slot can cause hydration failure
|
|
6108
|
+
// because the server rendered HTML won't contain a text node
|
|
6109
|
+
if (vnode.children === '') {
|
|
6110
|
+
insert((vnode.el = createText('')), node.parentElement, node);
|
|
6111
|
+
nextNode = node;
|
|
6112
|
+
}
|
|
6113
|
+
else {
|
|
6114
|
+
nextNode = onMismatch();
|
|
6115
|
+
}
|
|
5575
6116
|
}
|
|
5576
6117
|
else {
|
|
5577
6118
|
if (node.data !== vnode.children) {
|
|
@@ -5645,6 +6186,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
5645
6186
|
nextNode = isFragmentStart
|
|
5646
6187
|
? locateClosingAsyncAnchor(node)
|
|
5647
6188
|
: nextSibling(node);
|
|
6189
|
+
// #4293 teleport as component root
|
|
6190
|
+
if (nextNode &&
|
|
6191
|
+
isComment(nextNode) &&
|
|
6192
|
+
nextNode.data === 'teleport end') {
|
|
6193
|
+
nextNode = nextSibling(nextNode);
|
|
6194
|
+
}
|
|
5648
6195
|
// #3787
|
|
5649
6196
|
// if component is async, it may get moved / unmounted before its
|
|
5650
6197
|
// inner component is loaded, so we need to give it a placeholder
|
|
@@ -6308,8 +6855,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6308
6855
|
const fragmentStartAnchor = (n2.el = n1 ? n1.el : hostCreateText(''));
|
|
6309
6856
|
const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
|
|
6310
6857
|
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
|
6311
|
-
if (
|
|
6312
|
-
|
|
6858
|
+
if (// #5523 dev root fragment may inherit directives
|
|
6859
|
+
(isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
|
|
6860
|
+
// HMR updated / Dev root fragment (w/ comments), force full diff
|
|
6313
6861
|
patchFlag = 0;
|
|
6314
6862
|
optimized = false;
|
|
6315
6863
|
dynamicChildren = null;
|
|
@@ -6443,7 +6991,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6443
6991
|
}
|
|
6444
6992
|
else {
|
|
6445
6993
|
// no update needed. just copy over properties
|
|
6446
|
-
n2.component = n1.component;
|
|
6447
6994
|
n2.el = n1.el;
|
|
6448
6995
|
instance.vnode = n2;
|
|
6449
6996
|
}
|
|
@@ -6526,7 +7073,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6526
7073
|
// activated hook for keep-alive roots.
|
|
6527
7074
|
// #1742 activated hook must be accessed after first render
|
|
6528
7075
|
// since the hook may be injected by a child keep-alive
|
|
6529
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */
|
|
7076
|
+
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
7077
|
+
(parent &&
|
|
7078
|
+
isAsyncWrapper(parent.vnode) &&
|
|
7079
|
+
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
6530
7080
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
6531
7081
|
}
|
|
6532
7082
|
instance.isMounted = true;
|
|
@@ -6609,9 +7159,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6609
7159
|
}
|
|
6610
7160
|
};
|
|
6611
7161
|
// create reactive effect for rendering
|
|
6612
|
-
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(
|
|
7162
|
+
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(update), instance.scope // track it in component's effect scope
|
|
6613
7163
|
));
|
|
6614
|
-
const update = (instance.update = effect.run
|
|
7164
|
+
const update = (instance.update = () => effect.run());
|
|
6615
7165
|
update.id = instance.uid;
|
|
6616
7166
|
// allowRecurse
|
|
6617
7167
|
// #1801, #2043 component render effects should allow recursive updates
|
|
@@ -6623,7 +7173,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6623
7173
|
effect.onTrigger = instance.rtg
|
|
6624
7174
|
? e => invokeArrayFns(instance.rtg, e)
|
|
6625
7175
|
: void 0;
|
|
6626
|
-
// @ts-ignore (for scheduler)
|
|
6627
7176
|
update.ownerInstance = instance;
|
|
6628
7177
|
}
|
|
6629
7178
|
update();
|
|
@@ -7007,7 +7556,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7007
7556
|
const remove = vnode => {
|
|
7008
7557
|
const { type, el, anchor, transition } = vnode;
|
|
7009
7558
|
if (type === Fragment) {
|
|
7010
|
-
|
|
7559
|
+
if (vnode.patchFlag > 0 &&
|
|
7560
|
+
vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
|
|
7561
|
+
transition &&
|
|
7562
|
+
!transition.persisted) {
|
|
7563
|
+
vnode.children.forEach(child => {
|
|
7564
|
+
if (child.type === Comment) {
|
|
7565
|
+
hostRemove(child.el);
|
|
7566
|
+
}
|
|
7567
|
+
else {
|
|
7568
|
+
remove(child);
|
|
7569
|
+
}
|
|
7570
|
+
});
|
|
7571
|
+
}
|
|
7572
|
+
else {
|
|
7573
|
+
removeFragment(el, anchor);
|
|
7574
|
+
}
|
|
7011
7575
|
return;
|
|
7012
7576
|
}
|
|
7013
7577
|
if (type === Static) {
|
|
@@ -7397,92 +7961,32 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
7397
7961
|
if (isTeleportDisabled(vnode.props)) {
|
|
7398
7962
|
vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
7399
7963
|
vnode.targetAnchor = targetNode;
|
|
7400
|
-
}
|
|
7401
|
-
else {
|
|
7402
|
-
vnode.anchor = nextSibling(node);
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
7421
|
-
}
|
|
7422
|
-
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
7423
|
-
/**
|
|
7424
|
-
* @private
|
|
7425
|
-
*/
|
|
7426
|
-
function resolveDynamicComponent(component) {
|
|
7427
|
-
if (isString(component)) {
|
|
7428
|
-
return resolveAsset(COMPONENTS, component, false) || component;
|
|
7429
|
-
}
|
|
7430
|
-
else {
|
|
7431
|
-
// invalid types will fallthrough to createVNode and raise warning
|
|
7432
|
-
return (component || NULL_DYNAMIC_COMPONENT);
|
|
7433
|
-
}
|
|
7434
|
-
}
|
|
7435
|
-
/**
|
|
7436
|
-
* @private
|
|
7437
|
-
*/
|
|
7438
|
-
function resolveDirective(name) {
|
|
7439
|
-
return resolveAsset(DIRECTIVES, name);
|
|
7440
|
-
}
|
|
7441
|
-
// implementation
|
|
7442
|
-
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
7443
|
-
const instance = currentRenderingInstance || currentInstance;
|
|
7444
|
-
if (instance) {
|
|
7445
|
-
const Component = instance.type;
|
|
7446
|
-
// explicit self name has highest priority
|
|
7447
|
-
if (type === COMPONENTS) {
|
|
7448
|
-
const selfName = getComponentName(Component);
|
|
7449
|
-
if (selfName &&
|
|
7450
|
-
(selfName === name ||
|
|
7451
|
-
selfName === camelize(name) ||
|
|
7452
|
-
selfName === capitalize(camelize(name)))) {
|
|
7453
|
-
return Component;
|
|
7454
|
-
}
|
|
7455
|
-
}
|
|
7456
|
-
const res =
|
|
7457
|
-
// local registration
|
|
7458
|
-
// check instance[type] first which is resolved for options API
|
|
7459
|
-
resolve(instance[type] || Component[type], name) ||
|
|
7460
|
-
// global registration
|
|
7461
|
-
resolve(instance.appContext[type], name);
|
|
7462
|
-
if (!res && maybeSelfReference) {
|
|
7463
|
-
// fallback to implicit self-reference
|
|
7464
|
-
return Component;
|
|
7465
|
-
}
|
|
7466
|
-
if (warnMissing && !res) {
|
|
7467
|
-
const extra = type === COMPONENTS
|
|
7468
|
-
? `\nIf this is a native custom element, make sure to exclude it from ` +
|
|
7469
|
-
`component resolution via compilerOptions.isCustomElement.`
|
|
7470
|
-
: ``;
|
|
7471
|
-
warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
|
7964
|
+
}
|
|
7965
|
+
else {
|
|
7966
|
+
vnode.anchor = nextSibling(node);
|
|
7967
|
+
// lookahead until we find the target anchor
|
|
7968
|
+
// we cannot rely on return value of hydrateChildren() because there
|
|
7969
|
+
// could be nested teleports
|
|
7970
|
+
let targetAnchor = targetNode;
|
|
7971
|
+
while (targetAnchor) {
|
|
7972
|
+
targetAnchor = nextSibling(targetAnchor);
|
|
7973
|
+
if (targetAnchor &&
|
|
7974
|
+
targetAnchor.nodeType === 8 &&
|
|
7975
|
+
targetAnchor.data === 'teleport anchor') {
|
|
7976
|
+
vnode.targetAnchor = targetAnchor;
|
|
7977
|
+
target._lpa =
|
|
7978
|
+
vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
|
7979
|
+
break;
|
|
7980
|
+
}
|
|
7981
|
+
}
|
|
7982
|
+
hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
7983
|
+
}
|
|
7472
7984
|
}
|
|
7473
|
-
return res;
|
|
7474
|
-
}
|
|
7475
|
-
else {
|
|
7476
|
-
warn$1(`resolve${capitalize(type.slice(0, -1))} ` +
|
|
7477
|
-
`can only be used in render() or setup().`);
|
|
7478
7985
|
}
|
|
7986
|
+
return vnode.anchor && nextSibling(vnode.anchor);
|
|
7479
7987
|
}
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
(registry[name] ||
|
|
7483
|
-
registry[camelize(name)] ||
|
|
7484
|
-
registry[capitalize(camelize(name))]));
|
|
7485
|
-
}
|
|
7988
|
+
// Force-casted public typing for h and TSX props inference
|
|
7989
|
+
const Teleport = TeleportImpl;
|
|
7486
7990
|
|
|
7487
7991
|
const Fragment = Symbol('Fragment' );
|
|
7488
7992
|
const Text = Symbol('Text' );
|
|
@@ -7686,6 +8190,15 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
7686
8190
|
if (children) {
|
|
7687
8191
|
normalizeChildren(cloned, children);
|
|
7688
8192
|
}
|
|
8193
|
+
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
8194
|
+
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
8195
|
+
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
8196
|
+
}
|
|
8197
|
+
else {
|
|
8198
|
+
currentBlock.push(cloned);
|
|
8199
|
+
}
|
|
8200
|
+
}
|
|
8201
|
+
cloned.patchFlag |= -2 /* BAIL */;
|
|
7689
8202
|
return cloned;
|
|
7690
8203
|
}
|
|
7691
8204
|
// class component normalization.
|
|
@@ -7765,598 +8278,192 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
7765
8278
|
: children,
|
|
7766
8279
|
target: vnode.target,
|
|
7767
8280
|
targetAnchor: vnode.targetAnchor,
|
|
7768
|
-
staticCount: vnode.staticCount,
|
|
7769
|
-
shapeFlag: vnode.shapeFlag,
|
|
7770
|
-
// if the vnode is cloned with extra props, we can no longer assume its
|
|
7771
|
-
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
7772
|
-
// note: preserve flag for fragments since they use the flag for children
|
|
7773
|
-
// fast paths only.
|
|
7774
|
-
patchFlag: extraProps && vnode.type !== Fragment
|
|
7775
|
-
? patchFlag === -1 // hoisted node
|
|
7776
|
-
? 16 /* FULL_PROPS */
|
|
7777
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
7778
|
-
: patchFlag,
|
|
7779
|
-
dynamicProps: vnode.dynamicProps,
|
|
7780
|
-
dynamicChildren: vnode.dynamicChildren,
|
|
7781
|
-
appContext: vnode.appContext,
|
|
7782
|
-
dirs: vnode.dirs,
|
|
7783
|
-
transition: vnode.transition,
|
|
7784
|
-
// These should technically only be non-null on mounted VNodes. However,
|
|
7785
|
-
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
7786
|
-
// them since them being non-null during a mount doesn't affect the logic as
|
|
7787
|
-
// they will simply be overwritten.
|
|
7788
|
-
component: vnode.component,
|
|
7789
|
-
suspense: vnode.suspense,
|
|
7790
|
-
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
7791
|
-
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
7792
|
-
el: vnode.el,
|
|
7793
|
-
anchor: vnode.anchor
|
|
7794
|
-
};
|
|
7795
|
-
return cloned;
|
|
7796
|
-
}
|
|
7797
|
-
/**
|
|
7798
|
-
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
7799
|
-
* https://github.com/vitejs/vite/issues/2022
|
|
7800
|
-
*/
|
|
7801
|
-
function deepCloneVNode(vnode) {
|
|
7802
|
-
const cloned = cloneVNode(vnode);
|
|
7803
|
-
if (isArray(vnode.children)) {
|
|
7804
|
-
cloned.children = vnode.children.map(deepCloneVNode);
|
|
7805
|
-
}
|
|
7806
|
-
return cloned;
|
|
7807
|
-
}
|
|
7808
|
-
/**
|
|
7809
|
-
* @private
|
|
7810
|
-
*/
|
|
7811
|
-
function createTextVNode(text = ' ', flag = 0) {
|
|
7812
|
-
return createVNode(Text, null, text, flag);
|
|
7813
|
-
}
|
|
7814
|
-
/**
|
|
7815
|
-
* @private
|
|
7816
|
-
*/
|
|
7817
|
-
function createStaticVNode(content, numberOfNodes) {
|
|
7818
|
-
// A static vnode can contain multiple stringified elements, and the number
|
|
7819
|
-
// of elements is necessary for hydration.
|
|
7820
|
-
const vnode = createVNode(Static, null, content);
|
|
7821
|
-
vnode.staticCount = numberOfNodes;
|
|
7822
|
-
return vnode;
|
|
7823
|
-
}
|
|
7824
|
-
/**
|
|
7825
|
-
* @private
|
|
7826
|
-
*/
|
|
7827
|
-
function createCommentVNode(text = '',
|
|
7828
|
-
// when used as the v-else branch, the comment node must be created as a
|
|
7829
|
-
// block to ensure correct updates.
|
|
7830
|
-
asBlock = false) {
|
|
7831
|
-
return asBlock
|
|
7832
|
-
? (openBlock(), createBlock(Comment, null, text))
|
|
7833
|
-
: createVNode(Comment, null, text);
|
|
7834
|
-
}
|
|
7835
|
-
function normalizeVNode(child) {
|
|
7836
|
-
if (child == null || typeof child === 'boolean') {
|
|
7837
|
-
// empty placeholder
|
|
7838
|
-
return createVNode(Comment);
|
|
7839
|
-
}
|
|
7840
|
-
else if (isArray(child)) {
|
|
7841
|
-
// fragment
|
|
7842
|
-
return createVNode(Fragment, null,
|
|
7843
|
-
// #3666, avoid reference pollution when reusing vnode
|
|
7844
|
-
child.slice());
|
|
7845
|
-
}
|
|
7846
|
-
else if (typeof child === 'object') {
|
|
7847
|
-
// already vnode, this should be the most common since compiled templates
|
|
7848
|
-
// always produce all-vnode children arrays
|
|
7849
|
-
return cloneIfMounted(child);
|
|
7850
|
-
}
|
|
7851
|
-
else {
|
|
7852
|
-
// strings and numbers
|
|
7853
|
-
return createVNode(Text, null, String(child));
|
|
7854
|
-
}
|
|
7855
|
-
}
|
|
7856
|
-
// optimized normalization for template-compiled render fns
|
|
7857
|
-
function cloneIfMounted(child) {
|
|
7858
|
-
return child.el === null || child.memo ? child : cloneVNode(child);
|
|
7859
|
-
}
|
|
7860
|
-
function normalizeChildren(vnode, children) {
|
|
7861
|
-
let type = 0;
|
|
7862
|
-
const { shapeFlag } = vnode;
|
|
7863
|
-
if (children == null) {
|
|
7864
|
-
children = null;
|
|
7865
|
-
}
|
|
7866
|
-
else if (isArray(children)) {
|
|
7867
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
7868
|
-
}
|
|
7869
|
-
else if (typeof children === 'object') {
|
|
7870
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
7871
|
-
// Normalize slot to plain children for plain element and Teleport
|
|
7872
|
-
const slot = children.default;
|
|
7873
|
-
if (slot) {
|
|
7874
|
-
// _c marker is added by withCtx() indicating this is a compiled slot
|
|
7875
|
-
slot._c && (slot._d = false);
|
|
7876
|
-
normalizeChildren(vnode, slot());
|
|
7877
|
-
slot._c && (slot._d = true);
|
|
7878
|
-
}
|
|
7879
|
-
return;
|
|
7880
|
-
}
|
|
7881
|
-
else {
|
|
7882
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
7883
|
-
const slotFlag = children._;
|
|
7884
|
-
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
7885
|
-
children._ctx = currentRenderingInstance;
|
|
7886
|
-
}
|
|
7887
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
7888
|
-
// a child component receives forwarded slots from the parent.
|
|
7889
|
-
// its slot type is determined by its parent's slot type.
|
|
7890
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
7891
|
-
children._ = 1 /* STABLE */;
|
|
7892
|
-
}
|
|
7893
|
-
else {
|
|
7894
|
-
children._ = 2 /* DYNAMIC */;
|
|
7895
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
7896
|
-
}
|
|
7897
|
-
}
|
|
7898
|
-
}
|
|
7899
|
-
}
|
|
7900
|
-
else if (isFunction(children)) {
|
|
7901
|
-
children = { default: children, _ctx: currentRenderingInstance };
|
|
7902
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
7903
|
-
}
|
|
7904
|
-
else {
|
|
7905
|
-
children = String(children);
|
|
7906
|
-
// force teleport children to array so it can be moved around
|
|
7907
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
7908
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
7909
|
-
children = [createTextVNode(children)];
|
|
7910
|
-
}
|
|
7911
|
-
else {
|
|
7912
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
7913
|
-
}
|
|
7914
|
-
}
|
|
7915
|
-
vnode.children = children;
|
|
7916
|
-
vnode.shapeFlag |= type;
|
|
7917
|
-
}
|
|
7918
|
-
function mergeProps(...args) {
|
|
7919
|
-
const ret = {};
|
|
7920
|
-
for (let i = 0; i < args.length; i++) {
|
|
7921
|
-
const toMerge = args[i];
|
|
7922
|
-
for (const key in toMerge) {
|
|
7923
|
-
if (key === 'class') {
|
|
7924
|
-
if (ret.class !== toMerge.class) {
|
|
7925
|
-
ret.class = normalizeClass([ret.class, toMerge.class]);
|
|
7926
|
-
}
|
|
7927
|
-
}
|
|
7928
|
-
else if (key === 'style') {
|
|
7929
|
-
ret.style = normalizeStyle([ret.style, toMerge.style]);
|
|
7930
|
-
}
|
|
7931
|
-
else if (isOn(key)) {
|
|
7932
|
-
const existing = ret[key];
|
|
7933
|
-
const incoming = toMerge[key];
|
|
7934
|
-
if (incoming &&
|
|
7935
|
-
existing !== incoming &&
|
|
7936
|
-
!(isArray(existing) && existing.includes(incoming))) {
|
|
7937
|
-
ret[key] = existing
|
|
7938
|
-
? [].concat(existing, incoming)
|
|
7939
|
-
: incoming;
|
|
7940
|
-
}
|
|
7941
|
-
}
|
|
7942
|
-
else if (key !== '') {
|
|
7943
|
-
ret[key] = toMerge[key];
|
|
7944
|
-
}
|
|
7945
|
-
}
|
|
7946
|
-
}
|
|
7947
|
-
return ret;
|
|
7948
|
-
}
|
|
7949
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
7950
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
7951
|
-
vnode,
|
|
7952
|
-
prevVNode
|
|
7953
|
-
]);
|
|
7954
|
-
}
|
|
7955
|
-
|
|
7956
|
-
/**
|
|
7957
|
-
* Actual implementation
|
|
7958
|
-
*/
|
|
7959
|
-
function renderList(source, renderItem, cache, index) {
|
|
7960
|
-
let ret;
|
|
7961
|
-
const cached = (cache && cache[index]);
|
|
7962
|
-
if (isArray(source) || isString(source)) {
|
|
7963
|
-
ret = new Array(source.length);
|
|
7964
|
-
for (let i = 0, l = source.length; i < l; i++) {
|
|
7965
|
-
ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
|
|
7966
|
-
}
|
|
7967
|
-
}
|
|
7968
|
-
else if (typeof source === 'number') {
|
|
7969
|
-
if (!Number.isInteger(source)) {
|
|
7970
|
-
warn$1(`The v-for range expect an integer value but got ${source}.`);
|
|
7971
|
-
return [];
|
|
7972
|
-
}
|
|
7973
|
-
ret = new Array(source);
|
|
7974
|
-
for (let i = 0; i < source; i++) {
|
|
7975
|
-
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
7976
|
-
}
|
|
7977
|
-
}
|
|
7978
|
-
else if (isObject(source)) {
|
|
7979
|
-
if (source[Symbol.iterator]) {
|
|
7980
|
-
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
7981
|
-
}
|
|
7982
|
-
else {
|
|
7983
|
-
const keys = Object.keys(source);
|
|
7984
|
-
ret = new Array(keys.length);
|
|
7985
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
7986
|
-
const key = keys[i];
|
|
7987
|
-
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
7988
|
-
}
|
|
7989
|
-
}
|
|
7990
|
-
}
|
|
7991
|
-
else {
|
|
7992
|
-
ret = [];
|
|
7993
|
-
}
|
|
7994
|
-
if (cache) {
|
|
7995
|
-
cache[index] = ret;
|
|
7996
|
-
}
|
|
7997
|
-
return ret;
|
|
7998
|
-
}
|
|
7999
|
-
|
|
8281
|
+
staticCount: vnode.staticCount,
|
|
8282
|
+
shapeFlag: vnode.shapeFlag,
|
|
8283
|
+
// if the vnode is cloned with extra props, we can no longer assume its
|
|
8284
|
+
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
8285
|
+
// note: preserve flag for fragments since they use the flag for children
|
|
8286
|
+
// fast paths only.
|
|
8287
|
+
patchFlag: extraProps && vnode.type !== Fragment
|
|
8288
|
+
? patchFlag === -1 // hoisted node
|
|
8289
|
+
? 16 /* FULL_PROPS */
|
|
8290
|
+
: patchFlag | 16 /* FULL_PROPS */
|
|
8291
|
+
: patchFlag,
|
|
8292
|
+
dynamicProps: vnode.dynamicProps,
|
|
8293
|
+
dynamicChildren: vnode.dynamicChildren,
|
|
8294
|
+
appContext: vnode.appContext,
|
|
8295
|
+
dirs: vnode.dirs,
|
|
8296
|
+
transition: vnode.transition,
|
|
8297
|
+
// These should technically only be non-null on mounted VNodes. However,
|
|
8298
|
+
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
8299
|
+
// them since them being non-null during a mount doesn't affect the logic as
|
|
8300
|
+
// they will simply be overwritten.
|
|
8301
|
+
component: vnode.component,
|
|
8302
|
+
suspense: vnode.suspense,
|
|
8303
|
+
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
8304
|
+
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
8305
|
+
el: vnode.el,
|
|
8306
|
+
anchor: vnode.anchor
|
|
8307
|
+
};
|
|
8308
|
+
return cloned;
|
|
8309
|
+
}
|
|
8000
8310
|
/**
|
|
8001
|
-
*
|
|
8002
|
-
*
|
|
8311
|
+
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
8312
|
+
* https://github.com/vitejs/vite/issues/2022
|
|
8003
8313
|
*/
|
|
8004
|
-
function
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
if (isArray(slot)) {
|
|
8009
|
-
for (let j = 0; j < slot.length; j++) {
|
|
8010
|
-
slots[slot[j].name] = slot[j].fn;
|
|
8011
|
-
}
|
|
8012
|
-
}
|
|
8013
|
-
else if (slot) {
|
|
8014
|
-
// conditional single slot generated by <template v-if="..." #foo>
|
|
8015
|
-
slots[slot.name] = slot.fn;
|
|
8016
|
-
}
|
|
8314
|
+
function deepCloneVNode(vnode) {
|
|
8315
|
+
const cloned = cloneVNode(vnode);
|
|
8316
|
+
if (isArray(vnode.children)) {
|
|
8317
|
+
cloned.children = vnode.children.map(deepCloneVNode);
|
|
8017
8318
|
}
|
|
8018
|
-
return
|
|
8019
|
-
}
|
|
8020
|
-
|
|
8319
|
+
return cloned;
|
|
8320
|
+
}
|
|
8021
8321
|
/**
|
|
8022
|
-
* Compiler runtime helper for rendering `<slot/>`
|
|
8023
8322
|
* @private
|
|
8024
8323
|
*/
|
|
8025
|
-
function
|
|
8026
|
-
|
|
8027
|
-
// the compiler and guaranteed to be a function returning an array
|
|
8028
|
-
fallback, noSlotted) {
|
|
8029
|
-
if (currentRenderingInstance.isCE) {
|
|
8030
|
-
return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
|
|
8031
|
-
}
|
|
8032
|
-
let slot = slots[name];
|
|
8033
|
-
if (slot && slot.length > 1) {
|
|
8034
|
-
warn$1(`SSR-optimized slot function detected in a non-SSR-optimized render ` +
|
|
8035
|
-
`function. You need to mark this component with $dynamic-slots in the ` +
|
|
8036
|
-
`parent template.`);
|
|
8037
|
-
slot = () => [];
|
|
8038
|
-
}
|
|
8039
|
-
// a compiled slot disables block tracking by default to avoid manual
|
|
8040
|
-
// invocation interfering with template-based block tracking, but in
|
|
8041
|
-
// `renderSlot` we can be sure that it's template-based so we can force
|
|
8042
|
-
// enable it.
|
|
8043
|
-
if (slot && slot._c) {
|
|
8044
|
-
slot._d = false;
|
|
8045
|
-
}
|
|
8046
|
-
openBlock();
|
|
8047
|
-
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
8048
|
-
const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
|
|
8049
|
-
? 64 /* STABLE_FRAGMENT */
|
|
8050
|
-
: -2 /* BAIL */);
|
|
8051
|
-
if (!noSlotted && rendered.scopeId) {
|
|
8052
|
-
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
8053
|
-
}
|
|
8054
|
-
if (slot && slot._c) {
|
|
8055
|
-
slot._d = true;
|
|
8056
|
-
}
|
|
8057
|
-
return rendered;
|
|
8324
|
+
function createTextVNode(text = ' ', flag = 0) {
|
|
8325
|
+
return createVNode(Text, null, text, flag);
|
|
8058
8326
|
}
|
|
8059
|
-
function ensureValidVNode(vnodes) {
|
|
8060
|
-
return vnodes.some(child => {
|
|
8061
|
-
if (!isVNode(child))
|
|
8062
|
-
return true;
|
|
8063
|
-
if (child.type === Comment)
|
|
8064
|
-
return false;
|
|
8065
|
-
if (child.type === Fragment &&
|
|
8066
|
-
!ensureValidVNode(child.children))
|
|
8067
|
-
return false;
|
|
8068
|
-
return true;
|
|
8069
|
-
})
|
|
8070
|
-
? vnodes
|
|
8071
|
-
: null;
|
|
8072
|
-
}
|
|
8073
|
-
|
|
8074
8327
|
/**
|
|
8075
|
-
* For prefixing keys in v-on="obj" with "on"
|
|
8076
8328
|
* @private
|
|
8077
8329
|
*/
|
|
8078
|
-
function
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
ret[toHandlerKey(key)] = obj[key];
|
|
8086
|
-
}
|
|
8087
|
-
return ret;
|
|
8088
|
-
}
|
|
8089
|
-
|
|
8330
|
+
function createStaticVNode(content, numberOfNodes) {
|
|
8331
|
+
// A static vnode can contain multiple stringified elements, and the number
|
|
8332
|
+
// of elements is necessary for hydration.
|
|
8333
|
+
const vnode = createVNode(Static, null, content);
|
|
8334
|
+
vnode.staticCount = numberOfNodes;
|
|
8335
|
+
return vnode;
|
|
8336
|
+
}
|
|
8090
8337
|
/**
|
|
8091
|
-
*
|
|
8092
|
-
* they exist in the internal parent chain. For code that relies on traversing
|
|
8093
|
-
* public $parent chains, skip functional ones and go to the parent instead.
|
|
8338
|
+
* @private
|
|
8094
8339
|
*/
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
return setupState[key];
|
|
8147
|
-
case 2 /* DATA */:
|
|
8148
|
-
return data[key];
|
|
8149
|
-
case 4 /* CONTEXT */:
|
|
8150
|
-
return ctx[key];
|
|
8151
|
-
case 3 /* PROPS */:
|
|
8152
|
-
return props[key];
|
|
8153
|
-
// default: just fallthrough
|
|
8154
|
-
}
|
|
8155
|
-
}
|
|
8156
|
-
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
8157
|
-
accessCache[key] = 1 /* SETUP */;
|
|
8158
|
-
return setupState[key];
|
|
8159
|
-
}
|
|
8160
|
-
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
8161
|
-
accessCache[key] = 2 /* DATA */;
|
|
8162
|
-
return data[key];
|
|
8163
|
-
}
|
|
8164
|
-
else if (
|
|
8165
|
-
// only cache other properties when instance has declared (thus stable)
|
|
8166
|
-
// props
|
|
8167
|
-
(normalizedProps = instance.propsOptions[0]) &&
|
|
8168
|
-
hasOwn(normalizedProps, key)) {
|
|
8169
|
-
accessCache[key] = 3 /* PROPS */;
|
|
8170
|
-
return props[key];
|
|
8171
|
-
}
|
|
8172
|
-
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
8173
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
8174
|
-
return ctx[key];
|
|
8175
|
-
}
|
|
8176
|
-
else if (shouldCacheAccess) {
|
|
8177
|
-
accessCache[key] = 0 /* OTHER */;
|
|
8178
|
-
}
|
|
8179
|
-
}
|
|
8180
|
-
const publicGetter = publicPropertiesMap[key];
|
|
8181
|
-
let cssModule, globalProperties;
|
|
8182
|
-
// public $xxx properties
|
|
8183
|
-
if (publicGetter) {
|
|
8184
|
-
if (key === '$attrs') {
|
|
8185
|
-
track(instance, "get" /* GET */, key);
|
|
8186
|
-
markAttrsAccessed();
|
|
8187
|
-
}
|
|
8188
|
-
return publicGetter(instance);
|
|
8189
|
-
}
|
|
8190
|
-
else if (
|
|
8191
|
-
// css module (injected by vue-loader)
|
|
8192
|
-
(cssModule = type.__cssModules) &&
|
|
8193
|
-
(cssModule = cssModule[key])) {
|
|
8194
|
-
return cssModule;
|
|
8195
|
-
}
|
|
8196
|
-
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
8197
|
-
// user may set custom properties to `this` that start with `$`
|
|
8198
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
8199
|
-
return ctx[key];
|
|
8200
|
-
}
|
|
8201
|
-
else if (
|
|
8202
|
-
// global properties
|
|
8203
|
-
((globalProperties = appContext.config.globalProperties),
|
|
8204
|
-
hasOwn(globalProperties, key))) {
|
|
8205
|
-
{
|
|
8206
|
-
return globalProperties[key];
|
|
8207
|
-
}
|
|
8208
|
-
}
|
|
8209
|
-
else if (currentRenderingInstance &&
|
|
8210
|
-
(!isString(key) ||
|
|
8211
|
-
// #1091 avoid internal isRef/isVNode checks on component instance leading
|
|
8212
|
-
// to infinite warning loop
|
|
8213
|
-
key.indexOf('__v') !== 0)) {
|
|
8214
|
-
if (data !== EMPTY_OBJ &&
|
|
8215
|
-
(key[0] === '$' || key[0] === '_') &&
|
|
8216
|
-
hasOwn(data, key)) {
|
|
8217
|
-
warn$1(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved ` +
|
|
8218
|
-
`character ("$" or "_") and is not proxied on the render context.`);
|
|
8219
|
-
}
|
|
8220
|
-
else if (instance === currentRenderingInstance) {
|
|
8221
|
-
warn$1(`Property ${JSON.stringify(key)} was accessed during render ` +
|
|
8222
|
-
`but is not defined on instance.`);
|
|
8340
|
+
function createCommentVNode(text = '',
|
|
8341
|
+
// when used as the v-else branch, the comment node must be created as a
|
|
8342
|
+
// block to ensure correct updates.
|
|
8343
|
+
asBlock = false) {
|
|
8344
|
+
return asBlock
|
|
8345
|
+
? (openBlock(), createBlock(Comment, null, text))
|
|
8346
|
+
: createVNode(Comment, null, text);
|
|
8347
|
+
}
|
|
8348
|
+
function normalizeVNode(child) {
|
|
8349
|
+
if (child == null || typeof child === 'boolean') {
|
|
8350
|
+
// empty placeholder
|
|
8351
|
+
return createVNode(Comment);
|
|
8352
|
+
}
|
|
8353
|
+
else if (isArray(child)) {
|
|
8354
|
+
// fragment
|
|
8355
|
+
return createVNode(Fragment, null,
|
|
8356
|
+
// #3666, avoid reference pollution when reusing vnode
|
|
8357
|
+
child.slice());
|
|
8358
|
+
}
|
|
8359
|
+
else if (typeof child === 'object') {
|
|
8360
|
+
// already vnode, this should be the most common since compiled templates
|
|
8361
|
+
// always produce all-vnode children arrays
|
|
8362
|
+
return cloneIfMounted(child);
|
|
8363
|
+
}
|
|
8364
|
+
else {
|
|
8365
|
+
// strings and numbers
|
|
8366
|
+
return createVNode(Text, null, String(child));
|
|
8367
|
+
}
|
|
8368
|
+
}
|
|
8369
|
+
// optimized normalization for template-compiled render fns
|
|
8370
|
+
function cloneIfMounted(child) {
|
|
8371
|
+
return child.el === null || child.memo ? child : cloneVNode(child);
|
|
8372
|
+
}
|
|
8373
|
+
function normalizeChildren(vnode, children) {
|
|
8374
|
+
let type = 0;
|
|
8375
|
+
const { shapeFlag } = vnode;
|
|
8376
|
+
if (children == null) {
|
|
8377
|
+
children = null;
|
|
8378
|
+
}
|
|
8379
|
+
else if (isArray(children)) {
|
|
8380
|
+
type = 16 /* ARRAY_CHILDREN */;
|
|
8381
|
+
}
|
|
8382
|
+
else if (typeof children === 'object') {
|
|
8383
|
+
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
8384
|
+
// Normalize slot to plain children for plain element and Teleport
|
|
8385
|
+
const slot = children.default;
|
|
8386
|
+
if (slot) {
|
|
8387
|
+
// _c marker is added by withCtx() indicating this is a compiled slot
|
|
8388
|
+
slot._c && (slot._d = false);
|
|
8389
|
+
normalizeChildren(vnode, slot());
|
|
8390
|
+
slot._c && (slot._d = true);
|
|
8223
8391
|
}
|
|
8224
|
-
|
|
8225
|
-
},
|
|
8226
|
-
set({ _: instance }, key, value) {
|
|
8227
|
-
const { data, setupState, ctx } = instance;
|
|
8228
|
-
if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
8229
|
-
setupState[key] = value;
|
|
8230
|
-
return true;
|
|
8231
|
-
}
|
|
8232
|
-
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
8233
|
-
data[key] = value;
|
|
8234
|
-
return true;
|
|
8235
|
-
}
|
|
8236
|
-
else if (hasOwn(instance.props, key)) {
|
|
8237
|
-
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
|
8238
|
-
return false;
|
|
8239
|
-
}
|
|
8240
|
-
if (key[0] === '$' && key.slice(1) in instance) {
|
|
8241
|
-
warn$1(`Attempting to mutate public property "${key}". ` +
|
|
8242
|
-
`Properties starting with $ are reserved and readonly.`, instance);
|
|
8243
|
-
return false;
|
|
8392
|
+
return;
|
|
8244
8393
|
}
|
|
8245
8394
|
else {
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
value
|
|
8251
|
-
});
|
|
8395
|
+
type = 32 /* SLOTS_CHILDREN */;
|
|
8396
|
+
const slotFlag = children._;
|
|
8397
|
+
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
8398
|
+
children._ctx = currentRenderingInstance;
|
|
8252
8399
|
}
|
|
8253
|
-
else {
|
|
8254
|
-
|
|
8400
|
+
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
8401
|
+
// a child component receives forwarded slots from the parent.
|
|
8402
|
+
// its slot type is determined by its parent's slot type.
|
|
8403
|
+
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
8404
|
+
children._ = 1 /* STABLE */;
|
|
8405
|
+
}
|
|
8406
|
+
else {
|
|
8407
|
+
children._ = 2 /* DYNAMIC */;
|
|
8408
|
+
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
8409
|
+
}
|
|
8255
8410
|
}
|
|
8256
8411
|
}
|
|
8257
|
-
return true;
|
|
8258
|
-
},
|
|
8259
|
-
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
8260
|
-
let normalizedProps;
|
|
8261
|
-
return (!!accessCache[key] ||
|
|
8262
|
-
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
8263
|
-
(setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
|
8264
|
-
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
8265
|
-
hasOwn(ctx, key) ||
|
|
8266
|
-
hasOwn(publicPropertiesMap, key) ||
|
|
8267
|
-
hasOwn(appContext.config.globalProperties, key));
|
|
8268
|
-
},
|
|
8269
|
-
defineProperty(target, key, descriptor) {
|
|
8270
|
-
if (descriptor.get != null) {
|
|
8271
|
-
// invalidate key cache of a getter based property #5417
|
|
8272
|
-
target.$.accessCache[key] = 0;
|
|
8273
|
-
}
|
|
8274
|
-
else if (hasOwn(descriptor, 'value')) {
|
|
8275
|
-
this.set(target, key, descriptor.value, null);
|
|
8276
|
-
}
|
|
8277
|
-
return Reflect.defineProperty(target, key, descriptor);
|
|
8278
8412
|
}
|
|
8279
|
-
|
|
8280
|
-
{
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
// fast path for unscopables when using `with` block
|
|
8290
|
-
if (key === Symbol.unscopables) {
|
|
8291
|
-
return;
|
|
8413
|
+
else if (isFunction(children)) {
|
|
8414
|
+
children = { default: children, _ctx: currentRenderingInstance };
|
|
8415
|
+
type = 32 /* SLOTS_CHILDREN */;
|
|
8416
|
+
}
|
|
8417
|
+
else {
|
|
8418
|
+
children = String(children);
|
|
8419
|
+
// force teleport children to array so it can be moved around
|
|
8420
|
+
if (shapeFlag & 64 /* TELEPORT */) {
|
|
8421
|
+
type = 16 /* ARRAY_CHILDREN */;
|
|
8422
|
+
children = [createTextVNode(children)];
|
|
8292
8423
|
}
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
has(_, key) {
|
|
8296
|
-
const has = key[0] !== '_' && !isGloballyWhitelisted(key);
|
|
8297
|
-
if (!has && PublicInstanceProxyHandlers.has(_, key)) {
|
|
8298
|
-
warn$1(`Property ${JSON.stringify(key)} should not start with _ which is a reserved prefix for Vue internals.`);
|
|
8424
|
+
else {
|
|
8425
|
+
type = 8 /* TEXT_CHILDREN */;
|
|
8299
8426
|
}
|
|
8300
|
-
return has;
|
|
8301
|
-
}
|
|
8302
|
-
});
|
|
8303
|
-
// dev only
|
|
8304
|
-
// In dev mode, the proxy target exposes the same properties as seen on `this`
|
|
8305
|
-
// for easier console inspection. In prod mode it will be an empty object so
|
|
8306
|
-
// these properties definitions can be skipped.
|
|
8307
|
-
function createDevRenderContext(instance) {
|
|
8308
|
-
const target = {};
|
|
8309
|
-
// expose internal instance for proxy handlers
|
|
8310
|
-
Object.defineProperty(target, `_`, {
|
|
8311
|
-
configurable: true,
|
|
8312
|
-
enumerable: false,
|
|
8313
|
-
get: () => instance
|
|
8314
|
-
});
|
|
8315
|
-
// expose public properties
|
|
8316
|
-
Object.keys(publicPropertiesMap).forEach(key => {
|
|
8317
|
-
Object.defineProperty(target, key, {
|
|
8318
|
-
configurable: true,
|
|
8319
|
-
enumerable: false,
|
|
8320
|
-
get: () => publicPropertiesMap[key](instance),
|
|
8321
|
-
// intercepted by the proxy so no need for implementation,
|
|
8322
|
-
// but needed to prevent set errors
|
|
8323
|
-
set: NOOP
|
|
8324
|
-
});
|
|
8325
|
-
});
|
|
8326
|
-
return target;
|
|
8327
|
-
}
|
|
8328
|
-
// dev only
|
|
8329
|
-
function exposePropsOnRenderContext(instance) {
|
|
8330
|
-
const { ctx, propsOptions: [propsOptions] } = instance;
|
|
8331
|
-
if (propsOptions) {
|
|
8332
|
-
Object.keys(propsOptions).forEach(key => {
|
|
8333
|
-
Object.defineProperty(ctx, key, {
|
|
8334
|
-
enumerable: true,
|
|
8335
|
-
configurable: true,
|
|
8336
|
-
get: () => instance.props[key],
|
|
8337
|
-
set: NOOP
|
|
8338
|
-
});
|
|
8339
|
-
});
|
|
8340
8427
|
}
|
|
8428
|
+
vnode.children = children;
|
|
8429
|
+
vnode.shapeFlag |= type;
|
|
8341
8430
|
}
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
if (key
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8431
|
+
function mergeProps(...args) {
|
|
8432
|
+
const ret = {};
|
|
8433
|
+
for (let i = 0; i < args.length; i++) {
|
|
8434
|
+
const toMerge = args[i];
|
|
8435
|
+
for (const key in toMerge) {
|
|
8436
|
+
if (key === 'class') {
|
|
8437
|
+
if (ret.class !== toMerge.class) {
|
|
8438
|
+
ret.class = normalizeClass([ret.class, toMerge.class]);
|
|
8439
|
+
}
|
|
8440
|
+
}
|
|
8441
|
+
else if (key === 'style') {
|
|
8442
|
+
ret.style = normalizeStyle([ret.style, toMerge.style]);
|
|
8443
|
+
}
|
|
8444
|
+
else if (isOn(key)) {
|
|
8445
|
+
const existing = ret[key];
|
|
8446
|
+
const incoming = toMerge[key];
|
|
8447
|
+
if (incoming &&
|
|
8448
|
+
existing !== incoming &&
|
|
8449
|
+
!(isArray(existing) && existing.includes(incoming))) {
|
|
8450
|
+
ret[key] = existing
|
|
8451
|
+
? [].concat(existing, incoming)
|
|
8452
|
+
: incoming;
|
|
8453
|
+
}
|
|
8454
|
+
}
|
|
8455
|
+
else if (key !== '') {
|
|
8456
|
+
ret[key] = toMerge[key];
|
|
8351
8457
|
}
|
|
8352
|
-
Object.defineProperty(ctx, key, {
|
|
8353
|
-
enumerable: true,
|
|
8354
|
-
configurable: true,
|
|
8355
|
-
get: () => setupState[key],
|
|
8356
|
-
set: NOOP
|
|
8357
|
-
});
|
|
8358
8458
|
}
|
|
8359
|
-
}
|
|
8459
|
+
}
|
|
8460
|
+
return ret;
|
|
8461
|
+
}
|
|
8462
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
8463
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
8464
|
+
vnode,
|
|
8465
|
+
prevVNode
|
|
8466
|
+
]);
|
|
8360
8467
|
}
|
|
8361
8468
|
|
|
8362
8469
|
const emptyAppContext = createAppContext();
|
|
@@ -8385,7 +8492,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
8385
8492
|
provides: parent ? parent.provides : Object.create(appContext.provides),
|
|
8386
8493
|
accessCache: null,
|
|
8387
8494
|
renderCache: [],
|
|
8388
|
-
// local
|
|
8495
|
+
// local resolved assets
|
|
8389
8496
|
components: null,
|
|
8390
8497
|
directives: null,
|
|
8391
8498
|
// resolved props and emits options
|
|
@@ -8477,6 +8584,7 @@ function setupComponent(instance, isSSR = false) {
|
|
|
8477
8584
|
return setupResult;
|
|
8478
8585
|
}
|
|
8479
8586
|
function setupStatefulComponent(instance, isSSR) {
|
|
8587
|
+
var _a;
|
|
8480
8588
|
const Component = instance.type;
|
|
8481
8589
|
{
|
|
8482
8590
|
if (Component.name) {
|
|
@@ -8534,6 +8642,13 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
8534
8642
|
// async setup returned Promise.
|
|
8535
8643
|
// bail here and wait for re-entry.
|
|
8536
8644
|
instance.asyncDep = setupResult;
|
|
8645
|
+
if (!instance.suspense) {
|
|
8646
|
+
const name = (_a = Component.name) !== null && _a !== void 0 ? _a : 'Anonymous';
|
|
8647
|
+
warn$1(`Component <${name}>: setup function returned a promise, but no ` +
|
|
8648
|
+
`<Suspense> boundary was found in the parent component tree. ` +
|
|
8649
|
+
`A component with async setup() must be nested in a <Suspense> ` +
|
|
8650
|
+
`in order to be rendered.`);
|
|
8651
|
+
}
|
|
8537
8652
|
}
|
|
8538
8653
|
}
|
|
8539
8654
|
else {
|
|
@@ -9138,7 +9253,7 @@ function isMemoSame(cached, memo) {
|
|
|
9138
9253
|
return false;
|
|
9139
9254
|
}
|
|
9140
9255
|
for (let i = 0; i < prev.length; i++) {
|
|
9141
|
-
if (prev[i]
|
|
9256
|
+
if (hasChanged(prev[i], memo[i])) {
|
|
9142
9257
|
return false;
|
|
9143
9258
|
}
|
|
9144
9259
|
}
|
|
@@ -9150,7 +9265,7 @@ function isMemoSame(cached, memo) {
|
|
|
9150
9265
|
}
|
|
9151
9266
|
|
|
9152
9267
|
// Core API ------------------------------------------------------------------
|
|
9153
|
-
const version = "3.2.
|
|
9268
|
+
const version = "3.2.34";
|
|
9154
9269
|
/**
|
|
9155
9270
|
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
|
9156
9271
|
* @internal
|
|
@@ -9167,7 +9282,7 @@ const compatUtils = (null);
|
|
|
9167
9282
|
|
|
9168
9283
|
const svgNS = 'http://www.w3.org/2000/svg';
|
|
9169
9284
|
const doc = (typeof document !== 'undefined' ? document : null);
|
|
9170
|
-
const templateContainer = doc && doc.createElement('template');
|
|
9285
|
+
const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
|
|
9171
9286
|
const nodeOps = {
|
|
9172
9287
|
insert: (child, parent, anchor) => {
|
|
9173
9288
|
parent.insertBefore(child, anchor || null);
|
|
@@ -9318,6 +9433,8 @@ function setStyle(style, name, val) {
|
|
|
9318
9433
|
val.forEach(v => setStyle(style, name, v));
|
|
9319
9434
|
}
|
|
9320
9435
|
else {
|
|
9436
|
+
if (val == null)
|
|
9437
|
+
val = '';
|
|
9321
9438
|
if (name.startsWith('--')) {
|
|
9322
9439
|
// custom property definition
|
|
9323
9440
|
style.setProperty(name, val);
|
|
@@ -9412,31 +9529,28 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
9412
9529
|
}
|
|
9413
9530
|
return;
|
|
9414
9531
|
}
|
|
9532
|
+
let needRemove = false;
|
|
9415
9533
|
if (value === '' || value == null) {
|
|
9416
9534
|
const type = typeof el[key];
|
|
9417
9535
|
if (type === 'boolean') {
|
|
9418
9536
|
// e.g. <select multiple> compiles to { multiple: '' }
|
|
9419
|
-
|
|
9420
|
-
return;
|
|
9537
|
+
value = includeBooleanAttr(value);
|
|
9421
9538
|
}
|
|
9422
9539
|
else if (value == null && type === 'string') {
|
|
9423
9540
|
// e.g. <div :id="null">
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
return;
|
|
9541
|
+
value = '';
|
|
9542
|
+
needRemove = true;
|
|
9427
9543
|
}
|
|
9428
9544
|
else if (type === 'number') {
|
|
9429
9545
|
// e.g. <img :width="null">
|
|
9430
9546
|
// the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
}
|
|
9434
|
-
catch (_a) { }
|
|
9435
|
-
el.removeAttribute(key);
|
|
9436
|
-
return;
|
|
9547
|
+
value = 0;
|
|
9548
|
+
needRemove = true;
|
|
9437
9549
|
}
|
|
9438
9550
|
}
|
|
9439
|
-
// some properties perform value validation and throw
|
|
9551
|
+
// some properties perform value validation and throw,
|
|
9552
|
+
// some properties has getter, no setter, will error in 'use strict'
|
|
9553
|
+
// eg. <select :type="null"></select> <select :willValidate="null"></select>
|
|
9440
9554
|
try {
|
|
9441
9555
|
el[key] = value;
|
|
9442
9556
|
}
|
|
@@ -9446,31 +9560,35 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
9446
9560
|
`value ${value} is invalid.`, e);
|
|
9447
9561
|
}
|
|
9448
9562
|
}
|
|
9563
|
+
needRemove && el.removeAttribute(key);
|
|
9449
9564
|
}
|
|
9450
9565
|
|
|
9451
9566
|
// Async edge case fix requires storing an event listener's attach timestamp.
|
|
9452
|
-
|
|
9453
|
-
let
|
|
9454
|
-
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9567
|
+
const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
|
|
9568
|
+
let _getNow = Date.now;
|
|
9569
|
+
let skipTimestampCheck = false;
|
|
9570
|
+
if (typeof window !== 'undefined') {
|
|
9571
|
+
// Determine what event timestamp the browser is using. Annoyingly, the
|
|
9572
|
+
// timestamp can either be hi-res (relative to page load) or low-res
|
|
9573
|
+
// (relative to UNIX epoch), so in order to compare time we have to use the
|
|
9574
|
+
// same timestamp type when saving the flush timestamp.
|
|
9575
|
+
if (Date.now() > document.createEvent('Event').timeStamp) {
|
|
9576
|
+
// if the low-res timestamp which is bigger than the event timestamp
|
|
9577
|
+
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
|
9578
|
+
// and we need to use the hi-res version for event listeners as well.
|
|
9579
|
+
_getNow = () => performance.now();
|
|
9580
|
+
}
|
|
9581
|
+
// #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
|
|
9582
|
+
// and does not fire microtasks in between event propagation, so safe to exclude.
|
|
9583
|
+
const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
|
|
9584
|
+
skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
|
|
9585
|
+
}
|
|
9586
|
+
return [_getNow, skipTimestampCheck];
|
|
9587
|
+
})();
|
|
9470
9588
|
// To avoid the overhead of repeatedly calling performance.now(), we cache
|
|
9471
9589
|
// and use the same timestamp for all event listeners attached in the same tick.
|
|
9472
9590
|
let cachedNow = 0;
|
|
9473
|
-
const p = Promise.resolve();
|
|
9591
|
+
const p = /*#__PURE__*/ Promise.resolve();
|
|
9474
9592
|
const reset = () => {
|
|
9475
9593
|
cachedNow = 0;
|
|
9476
9594
|
};
|
|
@@ -9595,13 +9713,13 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
9595
9713
|
}
|
|
9596
9714
|
return false;
|
|
9597
9715
|
}
|
|
9598
|
-
//
|
|
9599
|
-
//
|
|
9600
|
-
//
|
|
9601
|
-
//
|
|
9716
|
+
// these are enumerated attrs, however their corresponding DOM properties
|
|
9717
|
+
// are actually booleans - this leads to setting it with a string "false"
|
|
9718
|
+
// value leading it to be coerced to `true`, so we need to always treat
|
|
9719
|
+
// them as attributes.
|
|
9602
9720
|
// Note that `contentEditable` doesn't have this problem: its DOM
|
|
9603
9721
|
// property is also enumerated string values.
|
|
9604
|
-
if (key === 'spellcheck' || key === 'draggable') {
|
|
9722
|
+
if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
|
|
9605
9723
|
return false;
|
|
9606
9724
|
}
|
|
9607
9725
|
// #1787, #2840 form property on form elements is readonly and must be set as
|
|
@@ -9624,11 +9742,11 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
9624
9742
|
return key in el;
|
|
9625
9743
|
}
|
|
9626
9744
|
|
|
9627
|
-
function defineCustomElement(options,
|
|
9745
|
+
function defineCustomElement(options, hydrate) {
|
|
9628
9746
|
const Comp = defineComponent(options);
|
|
9629
9747
|
class VueCustomElement extends VueElement {
|
|
9630
9748
|
constructor(initialProps) {
|
|
9631
|
-
super(Comp, initialProps,
|
|
9749
|
+
super(Comp, initialProps, hydrate);
|
|
9632
9750
|
}
|
|
9633
9751
|
}
|
|
9634
9752
|
VueCustomElement.def = Comp;
|
|
@@ -9988,7 +10106,10 @@ function resolveTransitionProps(rawProps) {
|
|
|
9988
10106
|
removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
|
9989
10107
|
done && done();
|
|
9990
10108
|
};
|
|
10109
|
+
let isLeaving = false;
|
|
9991
10110
|
const finishLeave = (el, done) => {
|
|
10111
|
+
isLeaving = false;
|
|
10112
|
+
removeTransitionClass(el, leaveFromClass);
|
|
9992
10113
|
removeTransitionClass(el, leaveToClass);
|
|
9993
10114
|
removeTransitionClass(el, leaveActiveClass);
|
|
9994
10115
|
done && done();
|
|
@@ -10021,12 +10142,17 @@ function resolveTransitionProps(rawProps) {
|
|
|
10021
10142
|
onEnter: makeEnterHook(false),
|
|
10022
10143
|
onAppear: makeEnterHook(true),
|
|
10023
10144
|
onLeave(el, done) {
|
|
10145
|
+
isLeaving = true;
|
|
10024
10146
|
const resolve = () => finishLeave(el, done);
|
|
10025
10147
|
addTransitionClass(el, leaveFromClass);
|
|
10026
10148
|
// force reflow so *-leave-from classes immediately take effect (#2593)
|
|
10027
10149
|
forceReflow();
|
|
10028
10150
|
addTransitionClass(el, leaveActiveClass);
|
|
10029
10151
|
nextFrame(() => {
|
|
10152
|
+
if (!isLeaving) {
|
|
10153
|
+
// cancelled
|
|
10154
|
+
return;
|
|
10155
|
+
}
|
|
10030
10156
|
removeTransitionClass(el, leaveFromClass);
|
|
10031
10157
|
addTransitionClass(el, leaveToClass);
|
|
10032
10158
|
if (!hasExplicitCallback(onLeave)) {
|
|
@@ -10318,7 +10444,8 @@ function hasCSSTransform(el, root, moveClass) {
|
|
|
10318
10444
|
}
|
|
10319
10445
|
|
|
10320
10446
|
const getModelAssigner = (vnode) => {
|
|
10321
|
-
const fn = vnode.props['onUpdate:modelValue']
|
|
10447
|
+
const fn = vnode.props['onUpdate:modelValue'] ||
|
|
10448
|
+
(false );
|
|
10322
10449
|
return isArray(fn) ? value => invokeArrayFns(fn, value) : fn;
|
|
10323
10450
|
};
|
|
10324
10451
|
function onCompositionStart(e) {
|
|
@@ -10328,14 +10455,9 @@ function onCompositionEnd(e) {
|
|
|
10328
10455
|
const target = e.target;
|
|
10329
10456
|
if (target.composing) {
|
|
10330
10457
|
target.composing = false;
|
|
10331
|
-
|
|
10458
|
+
target.dispatchEvent(new Event('input'));
|
|
10332
10459
|
}
|
|
10333
10460
|
}
|
|
10334
|
-
function trigger$1(el, type) {
|
|
10335
|
-
const e = document.createEvent('HTMLEvents');
|
|
10336
|
-
e.initEvent(type, true, true);
|
|
10337
|
-
el.dispatchEvent(e);
|
|
10338
|
-
}
|
|
10339
10461
|
// We are exporting the v-model runtime directly as vnode hooks so that it can
|
|
10340
10462
|
// be tree-shaken in case v-model is never used.
|
|
10341
10463
|
const vModelText = {
|
|
@@ -10349,7 +10471,7 @@ const vModelText = {
|
|
|
10349
10471
|
if (trim) {
|
|
10350
10472
|
domValue = domValue.trim();
|
|
10351
10473
|
}
|
|
10352
|
-
|
|
10474
|
+
if (castToNumber) {
|
|
10353
10475
|
domValue = toNumber(domValue);
|
|
10354
10476
|
}
|
|
10355
10477
|
el._assign(domValue);
|
|
@@ -10378,7 +10500,7 @@ const vModelText = {
|
|
|
10378
10500
|
// avoid clearing unresolved text. #2302
|
|
10379
10501
|
if (el.composing)
|
|
10380
10502
|
return;
|
|
10381
|
-
if (document.activeElement === el) {
|
|
10503
|
+
if (document.activeElement === el && el.type !== 'range') {
|
|
10382
10504
|
if (lazy) {
|
|
10383
10505
|
return;
|
|
10384
10506
|
}
|
|
@@ -10548,27 +10670,25 @@ const vModelDynamic = {
|
|
|
10548
10670
|
callModelHook(el, binding, vnode, prevVNode, 'updated');
|
|
10549
10671
|
}
|
|
10550
10672
|
};
|
|
10551
|
-
function
|
|
10552
|
-
|
|
10553
|
-
switch (el.tagName) {
|
|
10673
|
+
function resolveDynamicModel(tagName, type) {
|
|
10674
|
+
switch (tagName) {
|
|
10554
10675
|
case 'SELECT':
|
|
10555
|
-
|
|
10556
|
-
break;
|
|
10676
|
+
return vModelSelect;
|
|
10557
10677
|
case 'TEXTAREA':
|
|
10558
|
-
|
|
10559
|
-
break;
|
|
10678
|
+
return vModelText;
|
|
10560
10679
|
default:
|
|
10561
|
-
switch (
|
|
10680
|
+
switch (type) {
|
|
10562
10681
|
case 'checkbox':
|
|
10563
|
-
|
|
10564
|
-
break;
|
|
10682
|
+
return vModelCheckbox;
|
|
10565
10683
|
case 'radio':
|
|
10566
|
-
|
|
10567
|
-
break;
|
|
10684
|
+
return vModelRadio;
|
|
10568
10685
|
default:
|
|
10569
|
-
|
|
10686
|
+
return vModelText;
|
|
10570
10687
|
}
|
|
10571
10688
|
}
|
|
10689
|
+
}
|
|
10690
|
+
function callModelHook(el, binding, vnode, prevVNode, hook) {
|
|
10691
|
+
const modelToUse = resolveDynamicModel(el.tagName, vnode.props && vnode.props.type);
|
|
10572
10692
|
const fn = modelToUse[hook];
|
|
10573
10693
|
fn && fn(el, binding, vnode, prevVNode);
|
|
10574
10694
|
}
|
|
@@ -10668,7 +10788,7 @@ function setDisplay(el, value) {
|
|
|
10668
10788
|
el.style.display = value ? el._vod : 'none';
|
|
10669
10789
|
}
|
|
10670
10790
|
|
|
10671
|
-
const rendererOptions = extend({ patchProp }, nodeOps);
|
|
10791
|
+
const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
|
|
10672
10792
|
// lazy create the renderer - this makes core renderer logic tree-shakable
|
|
10673
10793
|
// in case the user only imports reactivity utilities from Vue.
|
|
10674
10794
|
let renderer;
|
|
@@ -12982,6 +13102,7 @@ function createStructuralDirectiveTransform(name, fn) {
|
|
|
12982
13102
|
}
|
|
12983
13103
|
|
|
12984
13104
|
const PURE_ANNOTATION = `/*#__PURE__*/`;
|
|
13105
|
+
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
12985
13106
|
function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssrRuntimeModuleName = 'vue/server-renderer', ssr = false, isTS = false, inSSR = false }) {
|
|
12986
13107
|
const context = {
|
|
12987
13108
|
mode,
|
|
@@ -13058,9 +13179,7 @@ function generate(ast, options = {}) {
|
|
|
13058
13179
|
// function mode const declarations should be inside with block
|
|
13059
13180
|
// also they should be renamed to avoid collision with user properties
|
|
13060
13181
|
if (hasHelpers) {
|
|
13061
|
-
push(`const { ${ast.helpers
|
|
13062
|
-
.map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
|
|
13063
|
-
.join(', ')} } = _Vue`);
|
|
13182
|
+
push(`const { ${ast.helpers.map(aliasHelper).join(', ')} } = _Vue`);
|
|
13064
13183
|
push(`\n`);
|
|
13065
13184
|
newline();
|
|
13066
13185
|
}
|
|
@@ -13115,7 +13234,6 @@ function generate(ast, options = {}) {
|
|
|
13115
13234
|
function genFunctionPreamble(ast, context) {
|
|
13116
13235
|
const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName, ssrRuntimeModuleName } = context;
|
|
13117
13236
|
const VueBinding = runtimeGlobalName;
|
|
13118
|
-
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
13119
13237
|
// Generate const declaration for helpers
|
|
13120
13238
|
// In prefix mode, we place the const declaration at top so it's done
|
|
13121
13239
|
// only once; But if we not prefixing, we place the declaration inside the
|
|
@@ -13728,14 +13846,14 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
13728
13846
|
}
|
|
13729
13847
|
}
|
|
13730
13848
|
function createIfBranch(node, dir) {
|
|
13849
|
+
const isTemplateIf = node.tagType === 3 /* TEMPLATE */;
|
|
13731
13850
|
return {
|
|
13732
13851
|
type: 10 /* IF_BRANCH */,
|
|
13733
13852
|
loc: node.loc,
|
|
13734
13853
|
condition: dir.name === 'else' ? undefined : dir.exp,
|
|
13735
|
-
children:
|
|
13736
|
-
|
|
13737
|
-
|
|
13738
|
-
userKey: findProp(node, `key`)
|
|
13854
|
+
children: isTemplateIf && !findDir(node, 'for') ? node.children : [node],
|
|
13855
|
+
userKey: findProp(node, `key`),
|
|
13856
|
+
isTemplateIf
|
|
13739
13857
|
};
|
|
13740
13858
|
}
|
|
13741
13859
|
function createCodegenNodeForBranch(branch, keyIndex, context) {
|
|
@@ -13770,7 +13888,8 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
13770
13888
|
let patchFlagText = PatchFlagNames[64 /* STABLE_FRAGMENT */];
|
|
13771
13889
|
// check if the fragment actually contains a single valid child with
|
|
13772
13890
|
// the rest being comments
|
|
13773
|
-
if (
|
|
13891
|
+
if (!branch.isTemplateIf &&
|
|
13892
|
+
children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
|
|
13774
13893
|
patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
|
|
13775
13894
|
patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
|
|
13776
13895
|
}
|
|
@@ -14321,7 +14440,7 @@ const transformElement = (node, context) => {
|
|
|
14321
14440
|
(tag === 'svg' || tag === 'foreignObject'));
|
|
14322
14441
|
// props
|
|
14323
14442
|
if (props.length > 0) {
|
|
14324
|
-
const propsBuildResult = buildProps(node, context);
|
|
14443
|
+
const propsBuildResult = buildProps(node, context, undefined, isComponent, isDynamicComponent);
|
|
14325
14444
|
vnodeProps = propsBuildResult.props;
|
|
14326
14445
|
patchFlag = propsBuildResult.patchFlag;
|
|
14327
14446
|
dynamicPropNames = propsBuildResult.dynamicPropNames;
|
|
@@ -14460,9 +14579,8 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
14460
14579
|
context.components.add(tag);
|
|
14461
14580
|
return toValidAssetId(tag, `component`);
|
|
14462
14581
|
}
|
|
14463
|
-
function buildProps(node, context, props = node.props, ssr = false) {
|
|
14582
|
+
function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
|
|
14464
14583
|
const { tag, loc: elementLoc, children } = node;
|
|
14465
|
-
const isComponent = node.tagType === 1 /* COMPONENT */;
|
|
14466
14584
|
let properties = [];
|
|
14467
14585
|
const mergeArgs = [];
|
|
14468
14586
|
const runtimeDirectives = [];
|
|
@@ -14481,8 +14599,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
14481
14599
|
if (isStaticExp(key)) {
|
|
14482
14600
|
const name = key.content;
|
|
14483
14601
|
const isEventHandler = isOn(name);
|
|
14484
|
-
if (
|
|
14485
|
-
|
|
14602
|
+
if (isEventHandler &&
|
|
14603
|
+
(!isComponent || isDynamicComponent) &&
|
|
14486
14604
|
// omit the flag for click handlers because hydration gives click
|
|
14487
14605
|
// dedicated fast path.
|
|
14488
14606
|
name.toLowerCase() !== 'onclick' &&
|
|
@@ -14708,10 +14826,11 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
14708
14826
|
classProp.value = createCallExpression(context.helper(NORMALIZE_CLASS), [classProp.value]);
|
|
14709
14827
|
}
|
|
14710
14828
|
if (styleProp &&
|
|
14711
|
-
!isStaticExp(styleProp.value) &&
|
|
14712
14829
|
// the static style is compiled into an object,
|
|
14713
14830
|
// so use `hasStyleBinding` to ensure that it is a dynamic style binding
|
|
14714
14831
|
(hasStyleBinding ||
|
|
14832
|
+
(styleProp.value.type === 4 /* SIMPLE_EXPRESSION */ &&
|
|
14833
|
+
styleProp.value.content.trim()[0] === `[`) ||
|
|
14715
14834
|
// v-bind:style and style both exist,
|
|
14716
14835
|
// v-bind:style with static literal object
|
|
14717
14836
|
styleProp.value.type === 17 /* JS_ARRAY_EXPRESSION */)) {
|
|
@@ -14890,7 +15009,7 @@ function processSlotOutlet(node, context) {
|
|
|
14890
15009
|
}
|
|
14891
15010
|
}
|
|
14892
15011
|
if (nonNameProps.length > 0) {
|
|
14893
|
-
const { props, directives } = buildProps(node, context, nonNameProps);
|
|
15012
|
+
const { props, directives } = buildProps(node, context, nonNameProps, false, false);
|
|
14894
15013
|
slotProps = props;
|
|
14895
15014
|
if (directives.length) {
|
|
14896
15015
|
context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
|
|
@@ -15061,11 +15180,7 @@ const transformText = (node, context) => {
|
|
|
15061
15180
|
const next = children[j];
|
|
15062
15181
|
if (isText(next)) {
|
|
15063
15182
|
if (!currentContainer) {
|
|
15064
|
-
currentContainer = children[i] =
|
|
15065
|
-
type: 8 /* COMPOUND_EXPRESSION */,
|
|
15066
|
-
loc: child.loc,
|
|
15067
|
-
children: [child]
|
|
15068
|
-
};
|
|
15183
|
+
currentContainer = children[i] = createCompoundExpression([child], child.loc);
|
|
15069
15184
|
}
|
|
15070
15185
|
// merge adjacent text node into current
|
|
15071
15186
|
currentContainer.children.push(` + `, next);
|
|
@@ -15472,7 +15587,9 @@ const transformVText = (dir, node, context) => {
|
|
|
15472
15587
|
return {
|
|
15473
15588
|
props: [
|
|
15474
15589
|
createObjectProperty(createSimpleExpression(`textContent`, true), exp
|
|
15475
|
-
?
|
|
15590
|
+
? getConstantType(exp, context) > 0
|
|
15591
|
+
? exp
|
|
15592
|
+
: createCallExpression(context.helperString(TO_DISPLAY_STRING), [exp], loc)
|
|
15476
15593
|
: createSimpleExpression('', true))
|
|
15477
15594
|
]
|
|
15478
15595
|
};
|
|
@@ -15680,19 +15797,38 @@ const transformShow = (dir, node, context) => {
|
|
|
15680
15797
|
};
|
|
15681
15798
|
};
|
|
15682
15799
|
|
|
15683
|
-
const
|
|
15800
|
+
const transformTransition = (node, context) => {
|
|
15684
15801
|
if (node.type === 1 /* ELEMENT */ &&
|
|
15685
15802
|
node.tagType === 1 /* COMPONENT */) {
|
|
15686
15803
|
const component = context.isBuiltInComponent(node.tag);
|
|
15687
15804
|
if (component === TRANSITION$1) {
|
|
15688
15805
|
return () => {
|
|
15689
|
-
if (node.children.length
|
|
15806
|
+
if (!node.children.length) {
|
|
15807
|
+
return;
|
|
15808
|
+
}
|
|
15809
|
+
// warn multiple transition children
|
|
15810
|
+
if (hasMultipleChildren(node)) {
|
|
15690
15811
|
context.onError(createDOMCompilerError(59 /* X_TRANSITION_INVALID_CHILDREN */, {
|
|
15691
15812
|
start: node.children[0].loc.start,
|
|
15692
15813
|
end: node.children[node.children.length - 1].loc.end,
|
|
15693
15814
|
source: ''
|
|
15694
15815
|
}));
|
|
15695
15816
|
}
|
|
15817
|
+
// check if it's s single child w/ v-show
|
|
15818
|
+
// if yes, inject "persisted: true" to the transition props
|
|
15819
|
+
const child = node.children[0];
|
|
15820
|
+
if (child.type === 1 /* ELEMENT */) {
|
|
15821
|
+
for (const p of child.props) {
|
|
15822
|
+
if (p.type === 7 /* DIRECTIVE */ && p.name === 'show') {
|
|
15823
|
+
node.props.push({
|
|
15824
|
+
type: 6 /* ATTRIBUTE */,
|
|
15825
|
+
name: 'persisted',
|
|
15826
|
+
value: undefined,
|
|
15827
|
+
loc: node.loc
|
|
15828
|
+
});
|
|
15829
|
+
}
|
|
15830
|
+
}
|
|
15831
|
+
}
|
|
15696
15832
|
};
|
|
15697
15833
|
}
|
|
15698
15834
|
}
|
|
@@ -15718,7 +15854,7 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
15718
15854
|
|
|
15719
15855
|
const DOMNodeTransforms = [
|
|
15720
15856
|
transformStyle,
|
|
15721
|
-
...([
|
|
15857
|
+
...([transformTransition] )
|
|
15722
15858
|
];
|
|
15723
15859
|
const DOMDirectiveTransforms = {
|
|
15724
15860
|
cloak: noopDirectiveTransform,
|