@vue/runtime-dom 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/runtime-dom.cjs.js +78 -62
- package/dist/runtime-dom.cjs.prod.js +78 -62
- package/dist/runtime-dom.d.ts +5 -2
- package/dist/runtime-dom.esm-browser.js +1911 -1791
- package/dist/runtime-dom.esm-browser.prod.js +1 -1
- package/dist/runtime-dom.esm-bundler.js +78 -62
- package/dist/runtime-dom.global.js +1911 -1791
- package/dist/runtime-dom.global.prod.js +1 -1
- package/package.json +3 -3
|
@@ -163,6 +163,11 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
163
163
|
if (aValidType || bValidType) {
|
|
164
164
|
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
|
165
165
|
}
|
|
166
|
+
aValidType = isSymbol(a);
|
|
167
|
+
bValidType = isSymbol(b);
|
|
168
|
+
if (aValidType || bValidType) {
|
|
169
|
+
return a === b;
|
|
170
|
+
}
|
|
166
171
|
aValidType = isArray(a);
|
|
167
172
|
bValidType = isArray(b);
|
|
168
173
|
if (aValidType || bValidType) {
|
|
@@ -258,7 +263,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
258
263
|
const isArray = Array.isArray;
|
|
259
264
|
const isMap = (val) => toTypeString(val) === '[object Map]';
|
|
260
265
|
const isSet = (val) => toTypeString(val) === '[object Set]';
|
|
261
|
-
const isDate = (val) => val
|
|
266
|
+
const isDate = (val) => toTypeString(val) === '[object Date]';
|
|
262
267
|
const isFunction = (val) => typeof val === 'function';
|
|
263
268
|
const isString = (val) => typeof val === 'string';
|
|
264
269
|
const isSymbol = (val) => typeof val === 'symbol';
|
|
@@ -536,10 +541,17 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
536
541
|
activeEffect = this.parent;
|
|
537
542
|
shouldTrack = lastShouldTrack;
|
|
538
543
|
this.parent = undefined;
|
|
544
|
+
if (this.deferStop) {
|
|
545
|
+
this.stop();
|
|
546
|
+
}
|
|
539
547
|
}
|
|
540
548
|
}
|
|
541
549
|
stop() {
|
|
542
|
-
|
|
550
|
+
// stopped while running itself - defer the cleanup
|
|
551
|
+
if (activeEffect === this) {
|
|
552
|
+
this.deferStop = true;
|
|
553
|
+
}
|
|
554
|
+
else if (this.active) {
|
|
543
555
|
cleanupEffect(this);
|
|
544
556
|
if (this.onStop) {
|
|
545
557
|
this.onStop();
|
|
@@ -698,23 +710,40 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
698
710
|
}
|
|
699
711
|
function triggerEffects(dep, debuggerEventExtraInfo) {
|
|
700
712
|
// spread into array for stabilization
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
713
|
+
const effects = isArray(dep) ? dep : [...dep];
|
|
714
|
+
for (const effect of effects) {
|
|
715
|
+
if (effect.computed) {
|
|
716
|
+
triggerEffect(effect, debuggerEventExtraInfo);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
for (const effect of effects) {
|
|
720
|
+
if (!effect.computed) {
|
|
721
|
+
triggerEffect(effect, debuggerEventExtraInfo);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
function triggerEffect(effect, debuggerEventExtraInfo) {
|
|
726
|
+
if (effect !== activeEffect || effect.allowRecurse) {
|
|
727
|
+
if (effect.onTrigger) {
|
|
728
|
+
effect.onTrigger(extend({ effect }, debuggerEventExtraInfo));
|
|
729
|
+
}
|
|
730
|
+
if (effect.scheduler) {
|
|
731
|
+
effect.scheduler();
|
|
732
|
+
}
|
|
733
|
+
else {
|
|
734
|
+
effect.run();
|
|
712
735
|
}
|
|
713
736
|
}
|
|
714
737
|
}
|
|
715
738
|
|
|
716
739
|
const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
717
|
-
const builtInSymbols = new Set(
|
|
740
|
+
const builtInSymbols = new Set(
|
|
741
|
+
/*#__PURE__*/
|
|
742
|
+
Object.getOwnPropertyNames(Symbol)
|
|
743
|
+
// ios10.x Object.getOwnPropertyNames(Symbol) can enumerate 'arguments' and 'caller'
|
|
744
|
+
// but accessing them on Symbol leads to TypeError because Symbol is a strict mode
|
|
745
|
+
// function
|
|
746
|
+
.filter(key => key !== 'arguments' && key !== 'caller')
|
|
718
747
|
.map(key => Symbol[key])
|
|
719
748
|
.filter(isSymbol));
|
|
720
749
|
const get = /*#__PURE__*/ createGetter();
|
|
@@ -788,9 +817,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
788
817
|
return res;
|
|
789
818
|
}
|
|
790
819
|
if (isRef(res)) {
|
|
791
|
-
// ref unwrapping -
|
|
792
|
-
|
|
793
|
-
return shouldUnwrap ? res.value : res;
|
|
820
|
+
// ref unwrapping - skip unwrap for Array + integer key.
|
|
821
|
+
return targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
794
822
|
}
|
|
795
823
|
if (isObject(res)) {
|
|
796
824
|
// Convert returned value into a proxy as well. we do the isObject check
|
|
@@ -866,13 +894,13 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
866
894
|
get: readonlyGet,
|
|
867
895
|
set(target, key) {
|
|
868
896
|
{
|
|
869
|
-
|
|
897
|
+
warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
870
898
|
}
|
|
871
899
|
return true;
|
|
872
900
|
},
|
|
873
901
|
deleteProperty(target, key) {
|
|
874
902
|
{
|
|
875
|
-
|
|
903
|
+
warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
876
904
|
}
|
|
877
905
|
return true;
|
|
878
906
|
}
|
|
@@ -896,10 +924,12 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
896
924
|
target = target["__v_raw" /* RAW */];
|
|
897
925
|
const rawTarget = toRaw(target);
|
|
898
926
|
const rawKey = toRaw(key);
|
|
899
|
-
if (
|
|
900
|
-
|
|
927
|
+
if (!isReadonly) {
|
|
928
|
+
if (key !== rawKey) {
|
|
929
|
+
track(rawTarget, "get" /* GET */, key);
|
|
930
|
+
}
|
|
931
|
+
track(rawTarget, "get" /* GET */, rawKey);
|
|
901
932
|
}
|
|
902
|
-
!isReadonly && track(rawTarget, "get" /* GET */, rawKey);
|
|
903
933
|
const { has } = getProto(rawTarget);
|
|
904
934
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
905
935
|
if (has.call(rawTarget, key)) {
|
|
@@ -918,10 +948,12 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
918
948
|
const target = this["__v_raw" /* RAW */];
|
|
919
949
|
const rawTarget = toRaw(target);
|
|
920
950
|
const rawKey = toRaw(key);
|
|
921
|
-
if (
|
|
922
|
-
|
|
951
|
+
if (!isReadonly) {
|
|
952
|
+
if (key !== rawKey) {
|
|
953
|
+
track(rawTarget, "has" /* HAS */, key);
|
|
954
|
+
}
|
|
955
|
+
track(rawTarget, "has" /* HAS */, rawKey);
|
|
923
956
|
}
|
|
924
|
-
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
|
|
925
957
|
return key === rawKey
|
|
926
958
|
? target.has(key)
|
|
927
959
|
: target.has(key) || target.has(rawKey);
|
|
@@ -1247,7 +1279,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1247
1279
|
if (existingProxy) {
|
|
1248
1280
|
return existingProxy;
|
|
1249
1281
|
}
|
|
1250
|
-
// only
|
|
1282
|
+
// only specific value types can be observed.
|
|
1251
1283
|
const targetType = getTargetType(target);
|
|
1252
1284
|
if (targetType === 0 /* INVALID */) {
|
|
1253
1285
|
return target;
|
|
@@ -1700,7 +1732,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1700
1732
|
const pendingPostFlushCbs = [];
|
|
1701
1733
|
let activePostFlushCbs = null;
|
|
1702
1734
|
let postFlushIndex = 0;
|
|
1703
|
-
const resolvedPromise = Promise.resolve();
|
|
1735
|
+
const resolvedPromise = /*#__PURE__*/ Promise.resolve();
|
|
1704
1736
|
let currentFlushPromise = null;
|
|
1705
1737
|
let currentPreFlushParentJob = null;
|
|
1706
1738
|
const RECURSION_LIMIT = 100;
|
|
@@ -1797,6 +1829,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1797
1829
|
}
|
|
1798
1830
|
}
|
|
1799
1831
|
function flushPostFlushCbs(seen) {
|
|
1832
|
+
// flush any pre cbs queued during the flush (e.g. pre watchers)
|
|
1833
|
+
flushPreFlushCbs();
|
|
1800
1834
|
if (pendingPostFlushCbs.length) {
|
|
1801
1835
|
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
1802
1836
|
pendingPostFlushCbs.length = 0;
|
|
@@ -2055,7 +2089,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2055
2089
|
// handle late devtools injection - only do this if we are in an actual
|
|
2056
2090
|
// browser environment to avoid the timer handle stalling test runner exit
|
|
2057
2091
|
// (#4815)
|
|
2058
|
-
// eslint-disable-next-line no-restricted-globals
|
|
2059
2092
|
typeof window !== 'undefined' &&
|
|
2060
2093
|
// some envs mock window but not fully
|
|
2061
2094
|
window.HTMLElement &&
|
|
@@ -2115,6 +2148,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2115
2148
|
}
|
|
2116
2149
|
|
|
2117
2150
|
function emit$1(instance, event, ...rawArgs) {
|
|
2151
|
+
if (instance.isUnmounted)
|
|
2152
|
+
return;
|
|
2118
2153
|
const props = instance.vnode.props || EMPTY_OBJ;
|
|
2119
2154
|
{
|
|
2120
2155
|
const { emitsOptions, propsOptions: [propsOptions] } = instance;
|
|
@@ -2147,7 +2182,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2147
2182
|
if (trim) {
|
|
2148
2183
|
args = rawArgs.map(a => a.trim());
|
|
2149
2184
|
}
|
|
2150
|
-
|
|
2185
|
+
if (number) {
|
|
2151
2186
|
args = rawArgs.map(toNumber);
|
|
2152
2187
|
}
|
|
2153
2188
|
}
|
|
@@ -2445,6 +2480,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2445
2480
|
warn$1(`Runtime directive used on component with non-element root node. ` +
|
|
2446
2481
|
`The directives will not function as intended.`);
|
|
2447
2482
|
}
|
|
2483
|
+
// clone before mutating since the root may be a hoisted vnode
|
|
2484
|
+
root = cloneVNode(root);
|
|
2448
2485
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
2449
2486
|
}
|
|
2450
2487
|
// inherit transition data
|
|
@@ -3147,7 +3184,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3147
3184
|
}
|
|
3148
3185
|
else if (isArray(source)) {
|
|
3149
3186
|
isMultiSource = true;
|
|
3150
|
-
forceTrigger = source.some(isReactive);
|
|
3187
|
+
forceTrigger = source.some(s => isReactive(s) || isShallow(s));
|
|
3151
3188
|
getter = () => source.map(s => {
|
|
3152
3189
|
if (isRef(s)) {
|
|
3153
3190
|
return s.value;
|
|
@@ -3239,16 +3276,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3239
3276
|
}
|
|
3240
3277
|
else {
|
|
3241
3278
|
// default: 'pre'
|
|
3242
|
-
scheduler = () =>
|
|
3243
|
-
if (!instance || instance.isMounted) {
|
|
3244
|
-
queuePreFlushCb(job);
|
|
3245
|
-
}
|
|
3246
|
-
else {
|
|
3247
|
-
// with 'pre' option, the first call must happen before
|
|
3248
|
-
// the component is mounted so it is called synchronously.
|
|
3249
|
-
job();
|
|
3250
|
-
}
|
|
3251
|
-
};
|
|
3279
|
+
scheduler = () => queuePreFlushCb(job);
|
|
3252
3280
|
}
|
|
3253
3281
|
const effect = new ReactiveEffect(getter, scheduler);
|
|
3254
3282
|
{
|
|
@@ -3391,10 +3419,22 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3391
3419
|
if (!children || !children.length) {
|
|
3392
3420
|
return;
|
|
3393
3421
|
}
|
|
3394
|
-
|
|
3422
|
+
let child = children[0];
|
|
3395
3423
|
if (children.length > 1) {
|
|
3396
|
-
|
|
3397
|
-
|
|
3424
|
+
let hasFound = false;
|
|
3425
|
+
// locate first non-comment child
|
|
3426
|
+
for (const c of children) {
|
|
3427
|
+
if (c.type !== Comment) {
|
|
3428
|
+
if (hasFound) {
|
|
3429
|
+
// warn more than one non-comment child
|
|
3430
|
+
warn$1('<transition> can only be used on a single element or component. ' +
|
|
3431
|
+
'Use <transition-group> for lists.');
|
|
3432
|
+
break;
|
|
3433
|
+
}
|
|
3434
|
+
child = c;
|
|
3435
|
+
hasFound = true;
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3398
3438
|
}
|
|
3399
3439
|
// there's no need to track reactivity for these props so use the raw
|
|
3400
3440
|
// props for a bit better perf
|
|
@@ -3407,8 +3447,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3407
3447
|
mode !== 'default') {
|
|
3408
3448
|
warn$1(`invalid <transition> mode: ${mode}`);
|
|
3409
3449
|
}
|
|
3410
|
-
// at this point children has a guaranteed length of 1.
|
|
3411
|
-
const child = children[0];
|
|
3412
3450
|
if (state.isLeaving) {
|
|
3413
3451
|
return emptyPlaceholder(child);
|
|
3414
3452
|
}
|
|
@@ -3491,6 +3529,17 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3491
3529
|
hook &&
|
|
3492
3530
|
callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
|
|
3493
3531
|
};
|
|
3532
|
+
const callAsyncHook = (hook, args) => {
|
|
3533
|
+
const done = args[1];
|
|
3534
|
+
callHook(hook, args);
|
|
3535
|
+
if (isArray(hook)) {
|
|
3536
|
+
if (hook.every(hook => hook.length <= 1))
|
|
3537
|
+
done();
|
|
3538
|
+
}
|
|
3539
|
+
else if (hook.length <= 1) {
|
|
3540
|
+
done();
|
|
3541
|
+
}
|
|
3542
|
+
};
|
|
3494
3543
|
const hooks = {
|
|
3495
3544
|
mode,
|
|
3496
3545
|
persisted,
|
|
@@ -3549,10 +3598,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3549
3598
|
el._enterCb = undefined;
|
|
3550
3599
|
});
|
|
3551
3600
|
if (hook) {
|
|
3552
|
-
hook
|
|
3553
|
-
if (hook.length <= 1) {
|
|
3554
|
-
done();
|
|
3555
|
-
}
|
|
3601
|
+
callAsyncHook(hook, [el, done]);
|
|
3556
3602
|
}
|
|
3557
3603
|
else {
|
|
3558
3604
|
done();
|
|
@@ -3586,10 +3632,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3586
3632
|
});
|
|
3587
3633
|
leavingVNodesCache[key] = vnode;
|
|
3588
3634
|
if (onLeave) {
|
|
3589
|
-
onLeave
|
|
3590
|
-
if (onLeave.length <= 1) {
|
|
3591
|
-
done();
|
|
3592
|
-
}
|
|
3635
|
+
callAsyncHook(onLeave, [el, done]);
|
|
3593
3636
|
}
|
|
3594
3637
|
else {
|
|
3595
3638
|
done();
|
|
@@ -3799,7 +3842,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3799
3842
|
}
|
|
3800
3843
|
});
|
|
3801
3844
|
}
|
|
3802
|
-
function createInnerComp(comp, { vnode: { ref, props, children } }) {
|
|
3845
|
+
function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
|
|
3803
3846
|
const vnode = createVNode(comp, props, children);
|
|
3804
3847
|
// ensure inner component inherits the async wrapper's ref owner
|
|
3805
3848
|
vnode.ref = ref;
|
|
@@ -3826,11 +3869,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3826
3869
|
// The whole point of this is to avoid importing KeepAlive directly in the
|
|
3827
3870
|
// renderer to facilitate tree-shaking.
|
|
3828
3871
|
const sharedContext = instance.ctx;
|
|
3829
|
-
// if the internal renderer is not registered, it indicates that this is server-side rendering,
|
|
3830
|
-
// for KeepAlive, we just need to render its children
|
|
3831
|
-
if (!sharedContext.renderer) {
|
|
3832
|
-
return slots.default;
|
|
3833
|
-
}
|
|
3834
3872
|
const cache = new Map();
|
|
3835
3873
|
const keys = new Set();
|
|
3836
3874
|
let current = null;
|
|
@@ -4008,7 +4046,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
4008
4046
|
// avoid vnode being unmounted
|
|
4009
4047
|
vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4010
4048
|
current = vnode;
|
|
4011
|
-
return rawVNode;
|
|
4049
|
+
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
4012
4050
|
};
|
|
4013
4051
|
}
|
|
4014
4052
|
};
|
|
@@ -4146,1111 +4184,1598 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
4146
4184
|
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
4147
4185
|
}
|
|
4148
4186
|
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4187
|
+
/**
|
|
4188
|
+
Runtime helper for applying directives to a vnode. Example usage:
|
|
4189
|
+
|
|
4190
|
+
const comp = resolveComponent('comp')
|
|
4191
|
+
const foo = resolveDirective('foo')
|
|
4192
|
+
const bar = resolveDirective('bar')
|
|
4193
|
+
|
|
4194
|
+
return withDirectives(h(comp), [
|
|
4195
|
+
[foo, this.x],
|
|
4196
|
+
[bar, this.y]
|
|
4197
|
+
])
|
|
4198
|
+
*/
|
|
4199
|
+
function validateDirectiveName(name) {
|
|
4200
|
+
if (isBuiltInDirective(name)) {
|
|
4201
|
+
warn$1('Do not use built-in directive ids as custom directive id: ' + name);
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
/**
|
|
4205
|
+
* Adds directives to a VNode.
|
|
4206
|
+
*/
|
|
4207
|
+
function withDirectives(vnode, directives) {
|
|
4208
|
+
const internalInstance = currentRenderingInstance;
|
|
4209
|
+
if (internalInstance === null) {
|
|
4210
|
+
warn$1(`withDirectives can only be used inside render functions.`);
|
|
4211
|
+
return vnode;
|
|
4212
|
+
}
|
|
4213
|
+
const instance = getExposeProxy(internalInstance) ||
|
|
4214
|
+
internalInstance.proxy;
|
|
4215
|
+
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
4216
|
+
for (let i = 0; i < directives.length; i++) {
|
|
4217
|
+
let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
|
|
4218
|
+
if (isFunction(dir)) {
|
|
4219
|
+
dir = {
|
|
4220
|
+
mounted: dir,
|
|
4221
|
+
updated: dir
|
|
4222
|
+
};
|
|
4154
4223
|
}
|
|
4155
|
-
|
|
4156
|
-
|
|
4224
|
+
if (dir.deep) {
|
|
4225
|
+
traverse(value);
|
|
4157
4226
|
}
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
shouldCacheAccess = false;
|
|
4167
|
-
// call beforeCreate first before accessing other options since
|
|
4168
|
-
// the hook may mutate resolved options (#2791)
|
|
4169
|
-
if (options.beforeCreate) {
|
|
4170
|
-
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
4227
|
+
bindings.push({
|
|
4228
|
+
dir,
|
|
4229
|
+
instance,
|
|
4230
|
+
value,
|
|
4231
|
+
oldValue: void 0,
|
|
4232
|
+
arg,
|
|
4233
|
+
modifiers
|
|
4234
|
+
});
|
|
4171
4235
|
}
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4236
|
+
return vnode;
|
|
4237
|
+
}
|
|
4238
|
+
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
4239
|
+
const bindings = vnode.dirs;
|
|
4240
|
+
const oldBindings = prevVNode && prevVNode.dirs;
|
|
4241
|
+
for (let i = 0; i < bindings.length; i++) {
|
|
4242
|
+
const binding = bindings[i];
|
|
4243
|
+
if (oldBindings) {
|
|
4244
|
+
binding.oldValue = oldBindings[i].value;
|
|
4245
|
+
}
|
|
4246
|
+
let hook = binding.dir[name];
|
|
4247
|
+
if (hook) {
|
|
4248
|
+
// disable tracking inside all lifecycle hooks
|
|
4249
|
+
// since they can potentially be called inside effects.
|
|
4250
|
+
pauseTracking();
|
|
4251
|
+
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
4252
|
+
vnode.el,
|
|
4253
|
+
binding,
|
|
4254
|
+
vnode,
|
|
4255
|
+
prevVNode
|
|
4256
|
+
]);
|
|
4257
|
+
resetTracking();
|
|
4188
4258
|
}
|
|
4189
4259
|
}
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4260
|
+
}
|
|
4261
|
+
|
|
4262
|
+
const COMPONENTS = 'components';
|
|
4263
|
+
const DIRECTIVES = 'directives';
|
|
4264
|
+
/**
|
|
4265
|
+
* @private
|
|
4266
|
+
*/
|
|
4267
|
+
function resolveComponent(name, maybeSelfReference) {
|
|
4268
|
+
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
4269
|
+
}
|
|
4270
|
+
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
4271
|
+
/**
|
|
4272
|
+
* @private
|
|
4273
|
+
*/
|
|
4274
|
+
function resolveDynamicComponent(component) {
|
|
4275
|
+
if (isString(component)) {
|
|
4276
|
+
return resolveAsset(COMPONENTS, component, false) || component;
|
|
4199
4277
|
}
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
if (isFunction(methodHandler)) {
|
|
4204
|
-
// In dev mode, we use the `createRenderContext` function to define
|
|
4205
|
-
// methods to the proxy target, and those are read-only but
|
|
4206
|
-
// reconfigurable, so it needs to be redefined here
|
|
4207
|
-
{
|
|
4208
|
-
Object.defineProperty(ctx, key, {
|
|
4209
|
-
value: methodHandler.bind(publicThis),
|
|
4210
|
-
configurable: true,
|
|
4211
|
-
enumerable: true,
|
|
4212
|
-
writable: true
|
|
4213
|
-
});
|
|
4214
|
-
}
|
|
4215
|
-
{
|
|
4216
|
-
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
4217
|
-
}
|
|
4218
|
-
}
|
|
4219
|
-
else {
|
|
4220
|
-
warn$1(`Method "${key}" has type "${typeof methodHandler}" in the component definition. ` +
|
|
4221
|
-
`Did you reference the function correctly?`);
|
|
4222
|
-
}
|
|
4223
|
-
}
|
|
4278
|
+
else {
|
|
4279
|
+
// invalid types will fallthrough to createVNode and raise warning
|
|
4280
|
+
return (component || NULL_DYNAMIC_COMPONENT);
|
|
4224
4281
|
}
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4282
|
+
}
|
|
4283
|
+
/**
|
|
4284
|
+
* @private
|
|
4285
|
+
*/
|
|
4286
|
+
function resolveDirective(name) {
|
|
4287
|
+
return resolveAsset(DIRECTIVES, name);
|
|
4288
|
+
}
|
|
4289
|
+
// implementation
|
|
4290
|
+
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
4291
|
+
const instance = currentRenderingInstance || currentInstance;
|
|
4292
|
+
if (instance) {
|
|
4293
|
+
const Component = instance.type;
|
|
4294
|
+
// explicit self name has highest priority
|
|
4295
|
+
if (type === COMPONENTS) {
|
|
4296
|
+
const selfName = getComponentName(Component);
|
|
4297
|
+
if (selfName &&
|
|
4298
|
+
(selfName === name ||
|
|
4299
|
+
selfName === camelize(name) ||
|
|
4300
|
+
selfName === capitalize(camelize(name)))) {
|
|
4301
|
+
return Component;
|
|
4302
|
+
}
|
|
4229
4303
|
}
|
|
4230
|
-
const
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4304
|
+
const res =
|
|
4305
|
+
// local registration
|
|
4306
|
+
// check instance[type] first which is resolved for options API
|
|
4307
|
+
resolve(instance[type] || Component[type], name) ||
|
|
4308
|
+
// global registration
|
|
4309
|
+
resolve(instance.appContext[type], name);
|
|
4310
|
+
if (!res && maybeSelfReference) {
|
|
4311
|
+
// fallback to implicit self-reference
|
|
4312
|
+
return Component;
|
|
4235
4313
|
}
|
|
4236
|
-
if (!
|
|
4237
|
-
|
|
4314
|
+
if (warnMissing && !res) {
|
|
4315
|
+
const extra = type === COMPONENTS
|
|
4316
|
+
? `\nIf this is a native custom element, make sure to exclude it from ` +
|
|
4317
|
+
`component resolution via compilerOptions.isCustomElement.`
|
|
4318
|
+
: ``;
|
|
4319
|
+
warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
|
4238
4320
|
}
|
|
4239
|
-
|
|
4240
|
-
instance.data = reactive(data);
|
|
4241
|
-
{
|
|
4242
|
-
for (const key in data) {
|
|
4243
|
-
checkDuplicateProperties("Data" /* DATA */, key);
|
|
4244
|
-
// expose data on ctx during dev
|
|
4245
|
-
if (key[0] !== '$' && key[0] !== '_') {
|
|
4246
|
-
Object.defineProperty(ctx, key, {
|
|
4247
|
-
configurable: true,
|
|
4248
|
-
enumerable: true,
|
|
4249
|
-
get: () => data[key],
|
|
4250
|
-
set: NOOP
|
|
4251
|
-
});
|
|
4252
|
-
}
|
|
4253
|
-
}
|
|
4254
|
-
}
|
|
4255
|
-
}
|
|
4256
|
-
}
|
|
4257
|
-
// state initialization complete at this point - start caching access
|
|
4258
|
-
shouldCacheAccess = true;
|
|
4259
|
-
if (computedOptions) {
|
|
4260
|
-
for (const key in computedOptions) {
|
|
4261
|
-
const opt = computedOptions[key];
|
|
4262
|
-
const get = isFunction(opt)
|
|
4263
|
-
? opt.bind(publicThis, publicThis)
|
|
4264
|
-
: isFunction(opt.get)
|
|
4265
|
-
? opt.get.bind(publicThis, publicThis)
|
|
4266
|
-
: NOOP;
|
|
4267
|
-
if (get === NOOP) {
|
|
4268
|
-
warn$1(`Computed property "${key}" has no getter.`);
|
|
4269
|
-
}
|
|
4270
|
-
const set = !isFunction(opt) && isFunction(opt.set)
|
|
4271
|
-
? opt.set.bind(publicThis)
|
|
4272
|
-
: () => {
|
|
4273
|
-
warn$1(`Write operation failed: computed property "${key}" is readonly.`);
|
|
4274
|
-
}
|
|
4275
|
-
;
|
|
4276
|
-
const c = computed$1({
|
|
4277
|
-
get,
|
|
4278
|
-
set
|
|
4279
|
-
});
|
|
4280
|
-
Object.defineProperty(ctx, key, {
|
|
4281
|
-
enumerable: true,
|
|
4282
|
-
configurable: true,
|
|
4283
|
-
get: () => c.value,
|
|
4284
|
-
set: v => (c.value = v)
|
|
4285
|
-
});
|
|
4286
|
-
{
|
|
4287
|
-
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
4288
|
-
}
|
|
4289
|
-
}
|
|
4290
|
-
}
|
|
4291
|
-
if (watchOptions) {
|
|
4292
|
-
for (const key in watchOptions) {
|
|
4293
|
-
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
4294
|
-
}
|
|
4295
|
-
}
|
|
4296
|
-
if (provideOptions) {
|
|
4297
|
-
const provides = isFunction(provideOptions)
|
|
4298
|
-
? provideOptions.call(publicThis)
|
|
4299
|
-
: provideOptions;
|
|
4300
|
-
Reflect.ownKeys(provides).forEach(key => {
|
|
4301
|
-
provide(key, provides[key]);
|
|
4302
|
-
});
|
|
4303
|
-
}
|
|
4304
|
-
if (created) {
|
|
4305
|
-
callHook(created, instance, "c" /* CREATED */);
|
|
4306
|
-
}
|
|
4307
|
-
function registerLifecycleHook(register, hook) {
|
|
4308
|
-
if (isArray(hook)) {
|
|
4309
|
-
hook.forEach(_hook => register(_hook.bind(publicThis)));
|
|
4310
|
-
}
|
|
4311
|
-
else if (hook) {
|
|
4312
|
-
register(hook.bind(publicThis));
|
|
4313
|
-
}
|
|
4314
|
-
}
|
|
4315
|
-
registerLifecycleHook(onBeforeMount, beforeMount);
|
|
4316
|
-
registerLifecycleHook(onMounted, mounted);
|
|
4317
|
-
registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
|
4318
|
-
registerLifecycleHook(onUpdated, updated);
|
|
4319
|
-
registerLifecycleHook(onActivated, activated);
|
|
4320
|
-
registerLifecycleHook(onDeactivated, deactivated);
|
|
4321
|
-
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
|
4322
|
-
registerLifecycleHook(onRenderTracked, renderTracked);
|
|
4323
|
-
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
|
4324
|
-
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
|
4325
|
-
registerLifecycleHook(onUnmounted, unmounted);
|
|
4326
|
-
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
4327
|
-
if (isArray(expose)) {
|
|
4328
|
-
if (expose.length) {
|
|
4329
|
-
const exposed = instance.exposed || (instance.exposed = {});
|
|
4330
|
-
expose.forEach(key => {
|
|
4331
|
-
Object.defineProperty(exposed, key, {
|
|
4332
|
-
get: () => publicThis[key],
|
|
4333
|
-
set: val => (publicThis[key] = val)
|
|
4334
|
-
});
|
|
4335
|
-
});
|
|
4336
|
-
}
|
|
4337
|
-
else if (!instance.exposed) {
|
|
4338
|
-
instance.exposed = {};
|
|
4339
|
-
}
|
|
4340
|
-
}
|
|
4341
|
-
// options that are handled when creating the instance but also need to be
|
|
4342
|
-
// applied from mixins
|
|
4343
|
-
if (render && instance.render === NOOP) {
|
|
4344
|
-
instance.render = render;
|
|
4321
|
+
return res;
|
|
4345
4322
|
}
|
|
4346
|
-
|
|
4347
|
-
|
|
4323
|
+
else {
|
|
4324
|
+
warn$1(`resolve${capitalize(type.slice(0, -1))} ` +
|
|
4325
|
+
`can only be used in render() or setup().`);
|
|
4348
4326
|
}
|
|
4349
|
-
// asset options.
|
|
4350
|
-
if (components)
|
|
4351
|
-
instance.components = components;
|
|
4352
|
-
if (directives)
|
|
4353
|
-
instance.directives = directives;
|
|
4354
4327
|
}
|
|
4355
|
-
function
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
}
|
|
4373
|
-
if (isRef(injected)) {
|
|
4374
|
-
// TODO remove the check in 3.3
|
|
4375
|
-
if (unwrapRef) {
|
|
4376
|
-
Object.defineProperty(ctx, key, {
|
|
4377
|
-
enumerable: true,
|
|
4378
|
-
configurable: true,
|
|
4379
|
-
get: () => injected.value,
|
|
4380
|
-
set: v => (injected.value = v)
|
|
4381
|
-
});
|
|
4382
|
-
}
|
|
4383
|
-
else {
|
|
4384
|
-
{
|
|
4385
|
-
warn$1(`injected property "${key}" is a ref and will be auto-unwrapped ` +
|
|
4386
|
-
`and no longer needs \`.value\` in the next minor release. ` +
|
|
4387
|
-
`To opt-in to the new behavior now, ` +
|
|
4388
|
-
`set \`app.config.unwrapInjectedRef = true\` (this config is ` +
|
|
4389
|
-
`temporary and will not be needed in the future.)`);
|
|
4390
|
-
}
|
|
4391
|
-
ctx[key] = injected;
|
|
4392
|
-
}
|
|
4393
|
-
}
|
|
4394
|
-
else {
|
|
4395
|
-
ctx[key] = injected;
|
|
4396
|
-
}
|
|
4397
|
-
{
|
|
4398
|
-
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
4328
|
+
function resolve(registry, name) {
|
|
4329
|
+
return (registry &&
|
|
4330
|
+
(registry[name] ||
|
|
4331
|
+
registry[camelize(name)] ||
|
|
4332
|
+
registry[capitalize(camelize(name))]));
|
|
4333
|
+
}
|
|
4334
|
+
|
|
4335
|
+
/**
|
|
4336
|
+
* Actual implementation
|
|
4337
|
+
*/
|
|
4338
|
+
function renderList(source, renderItem, cache, index) {
|
|
4339
|
+
let ret;
|
|
4340
|
+
const cached = (cache && cache[index]);
|
|
4341
|
+
if (isArray(source) || isString(source)) {
|
|
4342
|
+
ret = new Array(source.length);
|
|
4343
|
+
for (let i = 0, l = source.length; i < l; i++) {
|
|
4344
|
+
ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
|
|
4399
4345
|
}
|
|
4400
4346
|
}
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
? hook.map(h => h.bind(instance.proxy))
|
|
4405
|
-
: hook.bind(instance.proxy), instance, type);
|
|
4406
|
-
}
|
|
4407
|
-
function createWatcher(raw, ctx, publicThis, key) {
|
|
4408
|
-
const getter = key.includes('.')
|
|
4409
|
-
? createPathGetter(publicThis, key)
|
|
4410
|
-
: () => publicThis[key];
|
|
4411
|
-
if (isString(raw)) {
|
|
4412
|
-
const handler = ctx[raw];
|
|
4413
|
-
if (isFunction(handler)) {
|
|
4414
|
-
watch(getter, handler);
|
|
4347
|
+
else if (typeof source === 'number') {
|
|
4348
|
+
if (!Number.isInteger(source)) {
|
|
4349
|
+
warn$1(`The v-for range expect an integer value but got ${source}.`);
|
|
4415
4350
|
}
|
|
4416
|
-
|
|
4417
|
-
|
|
4351
|
+
ret = new Array(source);
|
|
4352
|
+
for (let i = 0; i < source; i++) {
|
|
4353
|
+
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
4418
4354
|
}
|
|
4419
4355
|
}
|
|
4420
|
-
else if (
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
else if (isObject(raw)) {
|
|
4424
|
-
if (isArray(raw)) {
|
|
4425
|
-
raw.forEach(r => createWatcher(r, ctx, publicThis, key));
|
|
4356
|
+
else if (isObject(source)) {
|
|
4357
|
+
if (source[Symbol.iterator]) {
|
|
4358
|
+
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
4426
4359
|
}
|
|
4427
4360
|
else {
|
|
4428
|
-
const
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
}
|
|
4434
|
-
else {
|
|
4435
|
-
warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
|
4361
|
+
const keys = Object.keys(source);
|
|
4362
|
+
ret = new Array(keys.length);
|
|
4363
|
+
for (let i = 0, l = keys.length; i < l; i++) {
|
|
4364
|
+
const key = keys[i];
|
|
4365
|
+
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
4436
4366
|
}
|
|
4437
4367
|
}
|
|
4438
4368
|
}
|
|
4439
4369
|
else {
|
|
4440
|
-
|
|
4370
|
+
ret = [];
|
|
4441
4371
|
}
|
|
4442
|
-
|
|
4372
|
+
if (cache) {
|
|
4373
|
+
cache[index] = ret;
|
|
4374
|
+
}
|
|
4375
|
+
return ret;
|
|
4376
|
+
}
|
|
4377
|
+
|
|
4443
4378
|
/**
|
|
4444
|
-
*
|
|
4445
|
-
*
|
|
4446
|
-
* instances.
|
|
4379
|
+
* Compiler runtime helper for creating dynamic slots object
|
|
4380
|
+
* @private
|
|
4447
4381
|
*/
|
|
4448
|
-
function
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
}
|
|
4457
|
-
else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
4458
|
-
{
|
|
4459
|
-
resolved = base;
|
|
4382
|
+
function createSlots(slots, dynamicSlots) {
|
|
4383
|
+
for (let i = 0; i < dynamicSlots.length; i++) {
|
|
4384
|
+
const slot = dynamicSlots[i];
|
|
4385
|
+
// array of dynamic slot generated by <template v-for="..." #[...]>
|
|
4386
|
+
if (isArray(slot)) {
|
|
4387
|
+
for (let j = 0; j < slot.length; j++) {
|
|
4388
|
+
slots[slot[j].name] = slot[j].fn;
|
|
4389
|
+
}
|
|
4460
4390
|
}
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
if (globalMixins.length) {
|
|
4465
|
-
globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
4391
|
+
else if (slot) {
|
|
4392
|
+
// conditional single slot generated by <template v-if="..." #foo>
|
|
4393
|
+
slots[slot.name] = slot.fn;
|
|
4466
4394
|
}
|
|
4467
|
-
mergeOptions(resolved, base, optionMergeStrategies);
|
|
4468
4395
|
}
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4396
|
+
return slots;
|
|
4397
|
+
}
|
|
4398
|
+
|
|
4399
|
+
/**
|
|
4400
|
+
* Compiler runtime helper for rendering `<slot/>`
|
|
4401
|
+
* @private
|
|
4402
|
+
*/
|
|
4403
|
+
function renderSlot(slots, name, props = {},
|
|
4404
|
+
// this is not a user-facing function, so the fallback is always generated by
|
|
4405
|
+
// the compiler and guaranteed to be a function returning an array
|
|
4406
|
+
fallback, noSlotted) {
|
|
4407
|
+
if (currentRenderingInstance.isCE ||
|
|
4408
|
+
(currentRenderingInstance.parent &&
|
|
4409
|
+
isAsyncWrapper(currentRenderingInstance.parent) &&
|
|
4410
|
+
currentRenderingInstance.parent.isCE)) {
|
|
4411
|
+
return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
|
|
4479
4412
|
}
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
const strat = internalOptionMergeStrats[key] || (strats && strats[key]);
|
|
4487
|
-
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
4488
|
-
}
|
|
4413
|
+
let slot = slots[name];
|
|
4414
|
+
if (slot && slot.length > 1) {
|
|
4415
|
+
warn$1(`SSR-optimized slot function detected in a non-SSR-optimized render ` +
|
|
4416
|
+
`function. You need to mark this component with $dynamic-slots in the ` +
|
|
4417
|
+
`parent template.`);
|
|
4418
|
+
slot = () => [];
|
|
4489
4419
|
}
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
// objects
|
|
4497
|
-
methods: mergeObjectOptions,
|
|
4498
|
-
computed: mergeObjectOptions,
|
|
4499
|
-
// lifecycle
|
|
4500
|
-
beforeCreate: mergeAsArray,
|
|
4501
|
-
created: mergeAsArray,
|
|
4502
|
-
beforeMount: mergeAsArray,
|
|
4503
|
-
mounted: mergeAsArray,
|
|
4504
|
-
beforeUpdate: mergeAsArray,
|
|
4505
|
-
updated: mergeAsArray,
|
|
4506
|
-
beforeDestroy: mergeAsArray,
|
|
4507
|
-
beforeUnmount: mergeAsArray,
|
|
4508
|
-
destroyed: mergeAsArray,
|
|
4509
|
-
unmounted: mergeAsArray,
|
|
4510
|
-
activated: mergeAsArray,
|
|
4511
|
-
deactivated: mergeAsArray,
|
|
4512
|
-
errorCaptured: mergeAsArray,
|
|
4513
|
-
serverPrefetch: mergeAsArray,
|
|
4514
|
-
// assets
|
|
4515
|
-
components: mergeObjectOptions,
|
|
4516
|
-
directives: mergeObjectOptions,
|
|
4517
|
-
// watch
|
|
4518
|
-
watch: mergeWatchOptions,
|
|
4519
|
-
// provide / inject
|
|
4520
|
-
provide: mergeDataFn,
|
|
4521
|
-
inject: mergeInject
|
|
4522
|
-
};
|
|
4523
|
-
function mergeDataFn(to, from) {
|
|
4524
|
-
if (!from) {
|
|
4525
|
-
return to;
|
|
4420
|
+
// a compiled slot disables block tracking by default to avoid manual
|
|
4421
|
+
// invocation interfering with template-based block tracking, but in
|
|
4422
|
+
// `renderSlot` we can be sure that it's template-based so we can force
|
|
4423
|
+
// enable it.
|
|
4424
|
+
if (slot && slot._c) {
|
|
4425
|
+
slot._d = false;
|
|
4526
4426
|
}
|
|
4527
|
-
|
|
4528
|
-
|
|
4427
|
+
openBlock();
|
|
4428
|
+
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
4429
|
+
const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
|
|
4430
|
+
? 64 /* STABLE_FRAGMENT */
|
|
4431
|
+
: -2 /* BAIL */);
|
|
4432
|
+
if (!noSlotted && rendered.scopeId) {
|
|
4433
|
+
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
4529
4434
|
}
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
};
|
|
4533
|
-
}
|
|
4534
|
-
function mergeInject(to, from) {
|
|
4535
|
-
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
4536
|
-
}
|
|
4537
|
-
function normalizeInject(raw) {
|
|
4538
|
-
if (isArray(raw)) {
|
|
4539
|
-
const res = {};
|
|
4540
|
-
for (let i = 0; i < raw.length; i++) {
|
|
4541
|
-
res[raw[i]] = raw[i];
|
|
4542
|
-
}
|
|
4543
|
-
return res;
|
|
4435
|
+
if (slot && slot._c) {
|
|
4436
|
+
slot._d = true;
|
|
4544
4437
|
}
|
|
4545
|
-
return
|
|
4546
|
-
}
|
|
4547
|
-
function mergeAsArray(to, from) {
|
|
4548
|
-
return to ? [...new Set([].concat(to, from))] : from;
|
|
4549
|
-
}
|
|
4550
|
-
function mergeObjectOptions(to, from) {
|
|
4551
|
-
return to ? extend(extend(Object.create(null), to), from) : from;
|
|
4438
|
+
return rendered;
|
|
4552
4439
|
}
|
|
4553
|
-
function
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4440
|
+
function ensureValidVNode(vnodes) {
|
|
4441
|
+
return vnodes.some(child => {
|
|
4442
|
+
if (!isVNode(child))
|
|
4443
|
+
return true;
|
|
4444
|
+
if (child.type === Comment)
|
|
4445
|
+
return false;
|
|
4446
|
+
if (child.type === Fragment &&
|
|
4447
|
+
!ensureValidVNode(child.children))
|
|
4448
|
+
return false;
|
|
4449
|
+
return true;
|
|
4450
|
+
})
|
|
4451
|
+
? vnodes
|
|
4452
|
+
: null;
|
|
4563
4453
|
}
|
|
4564
4454
|
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
if (!(key in props)) {
|
|
4575
|
-
props[key] = undefined;
|
|
4576
|
-
}
|
|
4577
|
-
}
|
|
4578
|
-
// validation
|
|
4579
|
-
{
|
|
4580
|
-
validateProps(rawProps || {}, props, instance);
|
|
4455
|
+
/**
|
|
4456
|
+
* For prefixing keys in v-on="obj" with "on"
|
|
4457
|
+
* @private
|
|
4458
|
+
*/
|
|
4459
|
+
function toHandlers(obj) {
|
|
4460
|
+
const ret = {};
|
|
4461
|
+
if (!isObject(obj)) {
|
|
4462
|
+
warn$1(`v-on with no argument expects an object value.`);
|
|
4463
|
+
return ret;
|
|
4581
4464
|
}
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
instance.props = isSSR ? props : shallowReactive(props);
|
|
4465
|
+
for (const key in obj) {
|
|
4466
|
+
ret[toHandlerKey(key)] = obj[key];
|
|
4585
4467
|
}
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4468
|
+
return ret;
|
|
4469
|
+
}
|
|
4470
|
+
|
|
4471
|
+
/**
|
|
4472
|
+
* #2437 In Vue 3, functional components do not have a public instance proxy but
|
|
4473
|
+
* they exist in the internal parent chain. For code that relies on traversing
|
|
4474
|
+
* public $parent chains, skip functional ones and go to the parent instead.
|
|
4475
|
+
*/
|
|
4476
|
+
const getPublicInstance = (i) => {
|
|
4477
|
+
if (!i)
|
|
4478
|
+
return null;
|
|
4479
|
+
if (isStatefulComponent(i))
|
|
4480
|
+
return getExposeProxy(i) || i.proxy;
|
|
4481
|
+
return getPublicInstance(i.parent);
|
|
4482
|
+
};
|
|
4483
|
+
const publicPropertiesMap =
|
|
4484
|
+
// Move PURE marker to new line to workaround compiler discarding it
|
|
4485
|
+
// due to type annotation
|
|
4486
|
+
/*#__PURE__*/ extend(Object.create(null), {
|
|
4487
|
+
$: i => i,
|
|
4488
|
+
$el: i => i.vnode.el,
|
|
4489
|
+
$data: i => i.data,
|
|
4490
|
+
$props: i => (shallowReadonly(i.props) ),
|
|
4491
|
+
$attrs: i => (shallowReadonly(i.attrs) ),
|
|
4492
|
+
$slots: i => (shallowReadonly(i.slots) ),
|
|
4493
|
+
$refs: i => (shallowReadonly(i.refs) ),
|
|
4494
|
+
$parent: i => getPublicInstance(i.parent),
|
|
4495
|
+
$root: i => getPublicInstance(i.root),
|
|
4496
|
+
$emit: i => i.emit,
|
|
4497
|
+
$options: i => (resolveMergedOptions(i) ),
|
|
4498
|
+
$forceUpdate: i => i.f || (i.f = () => queueJob(i.update)),
|
|
4499
|
+
$nextTick: i => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
4500
|
+
$watch: i => (instanceWatch.bind(i) )
|
|
4501
|
+
});
|
|
4502
|
+
const isReservedPrefix = (key) => key === '_' || key === '$';
|
|
4503
|
+
const PublicInstanceProxyHandlers = {
|
|
4504
|
+
get({ _: instance }, key) {
|
|
4505
|
+
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
|
4506
|
+
// for internal formatters to know that this is a Vue instance
|
|
4507
|
+
if (key === '__isVue') {
|
|
4508
|
+
return true;
|
|
4590
4509
|
}
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4510
|
+
// prioritize <script setup> bindings during dev.
|
|
4511
|
+
// this allows even properties that start with _ or $ to be used - so that
|
|
4512
|
+
// it aligns with the production behavior where the render fn is inlined and
|
|
4513
|
+
// indeed has access to all declared variables.
|
|
4514
|
+
if (setupState !== EMPTY_OBJ &&
|
|
4515
|
+
setupState.__isScriptSetup &&
|
|
4516
|
+
hasOwn(setupState, key)) {
|
|
4517
|
+
return setupState[key];
|
|
4594
4518
|
}
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
4616
|
-
let key = propsToUpdate[i];
|
|
4617
|
-
// skip if the prop key is a declared emit event listener
|
|
4618
|
-
if (isEmitListener(instance.emitsOptions, key)) {
|
|
4619
|
-
continue;
|
|
4620
|
-
}
|
|
4621
|
-
// PROPS flag guarantees rawProps to be non-null
|
|
4622
|
-
const value = rawProps[key];
|
|
4623
|
-
if (options) {
|
|
4624
|
-
// attr / props separation was done on init and will be consistent
|
|
4625
|
-
// in this code path, so just check if attrs have it.
|
|
4626
|
-
if (hasOwn(attrs, key)) {
|
|
4627
|
-
if (value !== attrs[key]) {
|
|
4628
|
-
attrs[key] = value;
|
|
4629
|
-
hasAttrsChanged = true;
|
|
4630
|
-
}
|
|
4631
|
-
}
|
|
4632
|
-
else {
|
|
4633
|
-
const camelizedKey = camelize(key);
|
|
4634
|
-
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
|
|
4635
|
-
}
|
|
4636
|
-
}
|
|
4637
|
-
else {
|
|
4638
|
-
if (value !== attrs[key]) {
|
|
4639
|
-
attrs[key] = value;
|
|
4640
|
-
hasAttrsChanged = true;
|
|
4641
|
-
}
|
|
4519
|
+
// data / props / ctx
|
|
4520
|
+
// This getter gets called for every property access on the render context
|
|
4521
|
+
// during render and is a major hotspot. The most expensive part of this
|
|
4522
|
+
// is the multiple hasOwn() calls. It's much faster to do a simple property
|
|
4523
|
+
// access on a plain object, so we use an accessCache object (with null
|
|
4524
|
+
// prototype) to memoize what access type a key corresponds to.
|
|
4525
|
+
let normalizedProps;
|
|
4526
|
+
if (key[0] !== '$') {
|
|
4527
|
+
const n = accessCache[key];
|
|
4528
|
+
if (n !== undefined) {
|
|
4529
|
+
switch (n) {
|
|
4530
|
+
case 1 /* SETUP */:
|
|
4531
|
+
return setupState[key];
|
|
4532
|
+
case 2 /* DATA */:
|
|
4533
|
+
return data[key];
|
|
4534
|
+
case 4 /* CONTEXT */:
|
|
4535
|
+
return ctx[key];
|
|
4536
|
+
case 3 /* PROPS */:
|
|
4537
|
+
return props[key];
|
|
4538
|
+
// default: just fallthrough
|
|
4642
4539
|
}
|
|
4643
4540
|
}
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
// full props update.
|
|
4648
|
-
if (setFullProps(instance, rawProps, props, attrs)) {
|
|
4649
|
-
hasAttrsChanged = true;
|
|
4650
|
-
}
|
|
4651
|
-
// in case of dynamic props, check if we need to delete keys from
|
|
4652
|
-
// the props object
|
|
4653
|
-
let kebabKey;
|
|
4654
|
-
for (const key in rawCurrentProps) {
|
|
4655
|
-
if (!rawProps ||
|
|
4656
|
-
// for camelCase
|
|
4657
|
-
(!hasOwn(rawProps, key) &&
|
|
4658
|
-
// it's possible the original props was passed in as kebab-case
|
|
4659
|
-
// and converted to camelCase (#955)
|
|
4660
|
-
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {
|
|
4661
|
-
if (options) {
|
|
4662
|
-
if (rawPrevProps &&
|
|
4663
|
-
// for camelCase
|
|
4664
|
-
(rawPrevProps[key] !== undefined ||
|
|
4665
|
-
// for kebab-case
|
|
4666
|
-
rawPrevProps[kebabKey] !== undefined)) {
|
|
4667
|
-
props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */);
|
|
4668
|
-
}
|
|
4669
|
-
}
|
|
4670
|
-
else {
|
|
4671
|
-
delete props[key];
|
|
4672
|
-
}
|
|
4541
|
+
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
4542
|
+
accessCache[key] = 1 /* SETUP */;
|
|
4543
|
+
return setupState[key];
|
|
4673
4544
|
}
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
if (attrs !== rawCurrentProps) {
|
|
4678
|
-
for (const key in attrs) {
|
|
4679
|
-
if (!rawProps ||
|
|
4680
|
-
(!hasOwn(rawProps, key) &&
|
|
4681
|
-
(!false ))) {
|
|
4682
|
-
delete attrs[key];
|
|
4683
|
-
hasAttrsChanged = true;
|
|
4684
|
-
}
|
|
4545
|
+
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
4546
|
+
accessCache[key] = 2 /* DATA */;
|
|
4547
|
+
return data[key];
|
|
4685
4548
|
}
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
validateProps(rawProps || {}, props, instance);
|
|
4694
|
-
}
|
|
4695
|
-
}
|
|
4696
|
-
function setFullProps(instance, rawProps, props, attrs) {
|
|
4697
|
-
const [options, needCastKeys] = instance.propsOptions;
|
|
4698
|
-
let hasAttrsChanged = false;
|
|
4699
|
-
let rawCastValues;
|
|
4700
|
-
if (rawProps) {
|
|
4701
|
-
for (let key in rawProps) {
|
|
4702
|
-
// key, ref are reserved and never passed down
|
|
4703
|
-
if (isReservedProp(key)) {
|
|
4704
|
-
continue;
|
|
4549
|
+
else if (
|
|
4550
|
+
// only cache other properties when instance has declared (thus stable)
|
|
4551
|
+
// props
|
|
4552
|
+
(normalizedProps = instance.propsOptions[0]) &&
|
|
4553
|
+
hasOwn(normalizedProps, key)) {
|
|
4554
|
+
accessCache[key] = 3 /* PROPS */;
|
|
4555
|
+
return props[key];
|
|
4705
4556
|
}
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
let camelKey;
|
|
4710
|
-
if (options && hasOwn(options, (camelKey = camelize(key)))) {
|
|
4711
|
-
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
|
4712
|
-
props[camelKey] = value;
|
|
4713
|
-
}
|
|
4714
|
-
else {
|
|
4715
|
-
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
|
4716
|
-
}
|
|
4557
|
+
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
4558
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
4559
|
+
return ctx[key];
|
|
4717
4560
|
}
|
|
4718
|
-
else if (
|
|
4719
|
-
|
|
4720
|
-
attrs[key] = value;
|
|
4721
|
-
hasAttrsChanged = true;
|
|
4722
|
-
}
|
|
4561
|
+
else if (shouldCacheAccess) {
|
|
4562
|
+
accessCache[key] = 0 /* OTHER */;
|
|
4723
4563
|
}
|
|
4724
4564
|
}
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
}
|
|
4733
|
-
}
|
|
4734
|
-
return hasAttrsChanged;
|
|
4735
|
-
}
|
|
4736
|
-
function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
4737
|
-
const opt = options[key];
|
|
4738
|
-
if (opt != null) {
|
|
4739
|
-
const hasDefault = hasOwn(opt, 'default');
|
|
4740
|
-
// default values
|
|
4741
|
-
if (hasDefault && value === undefined) {
|
|
4742
|
-
const defaultValue = opt.default;
|
|
4743
|
-
if (opt.type !== Function && isFunction(defaultValue)) {
|
|
4744
|
-
const { propsDefaults } = instance;
|
|
4745
|
-
if (key in propsDefaults) {
|
|
4746
|
-
value = propsDefaults[key];
|
|
4747
|
-
}
|
|
4748
|
-
else {
|
|
4749
|
-
setCurrentInstance(instance);
|
|
4750
|
-
value = propsDefaults[key] = defaultValue.call(null, props);
|
|
4751
|
-
unsetCurrentInstance();
|
|
4752
|
-
}
|
|
4565
|
+
const publicGetter = publicPropertiesMap[key];
|
|
4566
|
+
let cssModule, globalProperties;
|
|
4567
|
+
// public $xxx properties
|
|
4568
|
+
if (publicGetter) {
|
|
4569
|
+
if (key === '$attrs') {
|
|
4570
|
+
track(instance, "get" /* GET */, key);
|
|
4571
|
+
markAttrsAccessed();
|
|
4753
4572
|
}
|
|
4754
|
-
|
|
4755
|
-
|
|
4573
|
+
return publicGetter(instance);
|
|
4574
|
+
}
|
|
4575
|
+
else if (
|
|
4576
|
+
// css module (injected by vue-loader)
|
|
4577
|
+
(cssModule = type.__cssModules) &&
|
|
4578
|
+
(cssModule = cssModule[key])) {
|
|
4579
|
+
return cssModule;
|
|
4580
|
+
}
|
|
4581
|
+
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
4582
|
+
// user may set custom properties to `this` that start with `$`
|
|
4583
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
4584
|
+
return ctx[key];
|
|
4585
|
+
}
|
|
4586
|
+
else if (
|
|
4587
|
+
// global properties
|
|
4588
|
+
((globalProperties = appContext.config.globalProperties),
|
|
4589
|
+
hasOwn(globalProperties, key))) {
|
|
4590
|
+
{
|
|
4591
|
+
return globalProperties[key];
|
|
4756
4592
|
}
|
|
4757
4593
|
}
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4594
|
+
else if (currentRenderingInstance &&
|
|
4595
|
+
(!isString(key) ||
|
|
4596
|
+
// #1091 avoid internal isRef/isVNode checks on component instance leading
|
|
4597
|
+
// to infinite warning loop
|
|
4598
|
+
key.indexOf('__v') !== 0)) {
|
|
4599
|
+
if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
|
|
4600
|
+
warn$1(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved ` +
|
|
4601
|
+
`character ("$" or "_") and is not proxied on the render context.`);
|
|
4762
4602
|
}
|
|
4763
|
-
else if (
|
|
4764
|
-
(
|
|
4765
|
-
|
|
4603
|
+
else if (instance === currentRenderingInstance) {
|
|
4604
|
+
warn$1(`Property ${JSON.stringify(key)} was accessed during render ` +
|
|
4605
|
+
`but is not defined on instance.`);
|
|
4766
4606
|
}
|
|
4767
4607
|
}
|
|
4768
|
-
}
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
if (cached) {
|
|
4775
|
-
return cached;
|
|
4776
|
-
}
|
|
4777
|
-
const raw = comp.props;
|
|
4778
|
-
const normalized = {};
|
|
4779
|
-
const needCastKeys = [];
|
|
4780
|
-
// apply mixin/extends props
|
|
4781
|
-
let hasExtends = false;
|
|
4782
|
-
if (!isFunction(comp)) {
|
|
4783
|
-
const extendProps = (raw) => {
|
|
4784
|
-
hasExtends = true;
|
|
4785
|
-
const [props, keys] = normalizePropsOptions(raw, appContext, true);
|
|
4786
|
-
extend(normalized, props);
|
|
4787
|
-
if (keys)
|
|
4788
|
-
needCastKeys.push(...keys);
|
|
4789
|
-
};
|
|
4790
|
-
if (!asMixin && appContext.mixins.length) {
|
|
4791
|
-
appContext.mixins.forEach(extendProps);
|
|
4608
|
+
},
|
|
4609
|
+
set({ _: instance }, key, value) {
|
|
4610
|
+
const { data, setupState, ctx } = instance;
|
|
4611
|
+
if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
4612
|
+
setupState[key] = value;
|
|
4613
|
+
return true;
|
|
4792
4614
|
}
|
|
4793
|
-
if (
|
|
4794
|
-
|
|
4615
|
+
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
4616
|
+
data[key] = value;
|
|
4617
|
+
return true;
|
|
4795
4618
|
}
|
|
4796
|
-
if (
|
|
4797
|
-
|
|
4619
|
+
else if (hasOwn(instance.props, key)) {
|
|
4620
|
+
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
|
4621
|
+
return false;
|
|
4798
4622
|
}
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4623
|
+
if (key[0] === '$' && key.slice(1) in instance) {
|
|
4624
|
+
warn$1(`Attempting to mutate public property "${key}". ` +
|
|
4625
|
+
`Properties starting with $ are reserved and readonly.`, instance);
|
|
4626
|
+
return false;
|
|
4627
|
+
}
|
|
4628
|
+
else {
|
|
4629
|
+
if (key in instance.appContext.config.globalProperties) {
|
|
4630
|
+
Object.defineProperty(ctx, key, {
|
|
4631
|
+
enumerable: true,
|
|
4632
|
+
configurable: true,
|
|
4633
|
+
value
|
|
4634
|
+
});
|
|
4808
4635
|
}
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
normalized[normalizedKey] = EMPTY_OBJ;
|
|
4636
|
+
else {
|
|
4637
|
+
ctx[key] = value;
|
|
4812
4638
|
}
|
|
4813
4639
|
}
|
|
4814
|
-
}
|
|
4815
|
-
else if (raw) {
|
|
4816
|
-
if (!isObject(raw)) {
|
|
4817
|
-
warn$1(`invalid props options`, raw);
|
|
4818
|
-
}
|
|
4819
|
-
for (const key in raw) {
|
|
4820
|
-
const normalizedKey = camelize(key);
|
|
4821
|
-
if (validatePropName(normalizedKey)) {
|
|
4822
|
-
const opt = raw[key];
|
|
4823
|
-
const prop = (normalized[normalizedKey] =
|
|
4824
|
-
isArray(opt) || isFunction(opt) ? { type: opt } : opt);
|
|
4825
|
-
if (prop) {
|
|
4826
|
-
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
4827
|
-
const stringIndex = getTypeIndex(String, prop.type);
|
|
4828
|
-
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
4829
|
-
prop[1 /* shouldCastTrue */] =
|
|
4830
|
-
stringIndex < 0 || booleanIndex < stringIndex;
|
|
4831
|
-
// if the prop needs boolean casting or default value
|
|
4832
|
-
if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
|
4833
|
-
needCastKeys.push(normalizedKey);
|
|
4834
|
-
}
|
|
4835
|
-
}
|
|
4836
|
-
}
|
|
4837
|
-
}
|
|
4838
|
-
}
|
|
4839
|
-
const res = [normalized, needCastKeys];
|
|
4840
|
-
cache.set(comp, res);
|
|
4841
|
-
return res;
|
|
4842
|
-
}
|
|
4843
|
-
function validatePropName(key) {
|
|
4844
|
-
if (key[0] !== '$') {
|
|
4845
4640
|
return true;
|
|
4641
|
+
},
|
|
4642
|
+
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
4643
|
+
let normalizedProps;
|
|
4644
|
+
return (!!accessCache[key] ||
|
|
4645
|
+
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
4646
|
+
(setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
|
4647
|
+
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
4648
|
+
hasOwn(ctx, key) ||
|
|
4649
|
+
hasOwn(publicPropertiesMap, key) ||
|
|
4650
|
+
hasOwn(appContext.config.globalProperties, key));
|
|
4651
|
+
},
|
|
4652
|
+
defineProperty(target, key, descriptor) {
|
|
4653
|
+
if (descriptor.get != null) {
|
|
4654
|
+
// invalidate key cache of a getter based property #5417
|
|
4655
|
+
target._.accessCache[key] = 0;
|
|
4656
|
+
}
|
|
4657
|
+
else if (hasOwn(descriptor, 'value')) {
|
|
4658
|
+
this.set(target, key, descriptor.value, null);
|
|
4659
|
+
}
|
|
4660
|
+
return Reflect.defineProperty(target, key, descriptor);
|
|
4846
4661
|
}
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
function getType(ctor) {
|
|
4855
|
-
const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
|
|
4856
|
-
return match ? match[1] : ctor === null ? 'null' : '';
|
|
4857
|
-
}
|
|
4858
|
-
function isSameType(a, b) {
|
|
4859
|
-
return getType(a) === getType(b);
|
|
4662
|
+
};
|
|
4663
|
+
{
|
|
4664
|
+
PublicInstanceProxyHandlers.ownKeys = (target) => {
|
|
4665
|
+
warn$1(`Avoid app logic that relies on enumerating keys on a component instance. ` +
|
|
4666
|
+
`The keys will be empty in production mode to avoid performance overhead.`);
|
|
4667
|
+
return Reflect.ownKeys(target);
|
|
4668
|
+
};
|
|
4860
4669
|
}
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4670
|
+
const RuntimeCompiledPublicInstanceProxyHandlers = /*#__PURE__*/ extend({}, PublicInstanceProxyHandlers, {
|
|
4671
|
+
get(target, key) {
|
|
4672
|
+
// fast path for unscopables when using `with` block
|
|
4673
|
+
if (key === Symbol.unscopables) {
|
|
4674
|
+
return;
|
|
4675
|
+
}
|
|
4676
|
+
return PublicInstanceProxyHandlers.get(target, key, target);
|
|
4677
|
+
},
|
|
4678
|
+
has(_, key) {
|
|
4679
|
+
const has = key[0] !== '_' && !isGloballyWhitelisted(key);
|
|
4680
|
+
if (!has && PublicInstanceProxyHandlers.has(_, key)) {
|
|
4681
|
+
warn$1(`Property ${JSON.stringify(key)} should not start with _ which is a reserved prefix for Vue internals.`);
|
|
4682
|
+
}
|
|
4683
|
+
return has;
|
|
4867
4684
|
}
|
|
4868
|
-
|
|
4685
|
+
});
|
|
4686
|
+
// dev only
|
|
4687
|
+
// In dev mode, the proxy target exposes the same properties as seen on `this`
|
|
4688
|
+
// for easier console inspection. In prod mode it will be an empty object so
|
|
4689
|
+
// these properties definitions can be skipped.
|
|
4690
|
+
function createDevRenderContext(instance) {
|
|
4691
|
+
const target = {};
|
|
4692
|
+
// expose internal instance for proxy handlers
|
|
4693
|
+
Object.defineProperty(target, `_`, {
|
|
4694
|
+
configurable: true,
|
|
4695
|
+
enumerable: false,
|
|
4696
|
+
get: () => instance
|
|
4697
|
+
});
|
|
4698
|
+
// expose public properties
|
|
4699
|
+
Object.keys(publicPropertiesMap).forEach(key => {
|
|
4700
|
+
Object.defineProperty(target, key, {
|
|
4701
|
+
configurable: true,
|
|
4702
|
+
enumerable: false,
|
|
4703
|
+
get: () => publicPropertiesMap[key](instance),
|
|
4704
|
+
// intercepted by the proxy so no need for implementation,
|
|
4705
|
+
// but needed to prevent set errors
|
|
4706
|
+
set: NOOP
|
|
4707
|
+
});
|
|
4708
|
+
});
|
|
4709
|
+
return target;
|
|
4869
4710
|
}
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4711
|
+
// dev only
|
|
4712
|
+
function exposePropsOnRenderContext(instance) {
|
|
4713
|
+
const { ctx, propsOptions: [propsOptions] } = instance;
|
|
4714
|
+
if (propsOptions) {
|
|
4715
|
+
Object.keys(propsOptions).forEach(key => {
|
|
4716
|
+
Object.defineProperty(ctx, key, {
|
|
4717
|
+
enumerable: true,
|
|
4718
|
+
configurable: true,
|
|
4719
|
+
get: () => instance.props[key],
|
|
4720
|
+
set: NOOP
|
|
4721
|
+
});
|
|
4722
|
+
});
|
|
4881
4723
|
}
|
|
4882
4724
|
}
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
let isValid = false;
|
|
4900
|
-
const types = isArray(type) ? type : [type];
|
|
4901
|
-
const expectedTypes = [];
|
|
4902
|
-
// value is valid as long as one of the specified types match
|
|
4903
|
-
for (let i = 0; i < types.length && !isValid; i++) {
|
|
4904
|
-
const { valid, expectedType } = assertType(value, types[i]);
|
|
4905
|
-
expectedTypes.push(expectedType || '');
|
|
4906
|
-
isValid = valid;
|
|
4725
|
+
// dev only
|
|
4726
|
+
function exposeSetupStateOnRenderContext(instance) {
|
|
4727
|
+
const { ctx, setupState } = instance;
|
|
4728
|
+
Object.keys(toRaw(setupState)).forEach(key => {
|
|
4729
|
+
if (!setupState.__isScriptSetup) {
|
|
4730
|
+
if (isReservedPrefix(key[0])) {
|
|
4731
|
+
warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
|
|
4732
|
+
`which are reserved prefixes for Vue internals.`);
|
|
4733
|
+
return;
|
|
4734
|
+
}
|
|
4735
|
+
Object.defineProperty(ctx, key, {
|
|
4736
|
+
enumerable: true,
|
|
4737
|
+
configurable: true,
|
|
4738
|
+
get: () => setupState[key],
|
|
4739
|
+
set: NOOP
|
|
4740
|
+
});
|
|
4907
4741
|
}
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4742
|
+
});
|
|
4743
|
+
}
|
|
4744
|
+
|
|
4745
|
+
function createDuplicateChecker() {
|
|
4746
|
+
const cache = Object.create(null);
|
|
4747
|
+
return (type, key) => {
|
|
4748
|
+
if (cache[key]) {
|
|
4749
|
+
warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
|
4911
4750
|
}
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
if (validator && !validator(value)) {
|
|
4915
|
-
warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
|
4916
|
-
}
|
|
4917
|
-
}
|
|
4918
|
-
const isSimpleType = /*#__PURE__*/ makeMap('String,Number,Boolean,Function,Symbol,BigInt');
|
|
4919
|
-
/**
|
|
4920
|
-
* dev only
|
|
4921
|
-
*/
|
|
4922
|
-
function assertType(value, type) {
|
|
4923
|
-
let valid;
|
|
4924
|
-
const expectedType = getType(type);
|
|
4925
|
-
if (isSimpleType(expectedType)) {
|
|
4926
|
-
const t = typeof value;
|
|
4927
|
-
valid = t === expectedType.toLowerCase();
|
|
4928
|
-
// for primitive wrapper objects
|
|
4929
|
-
if (!valid && t === 'object') {
|
|
4930
|
-
valid = value instanceof type;
|
|
4751
|
+
else {
|
|
4752
|
+
cache[key] = type;
|
|
4931
4753
|
}
|
|
4932
|
-
}
|
|
4933
|
-
else if (expectedType === 'Object') {
|
|
4934
|
-
valid = isObject(value);
|
|
4935
|
-
}
|
|
4936
|
-
else if (expectedType === 'Array') {
|
|
4937
|
-
valid = isArray(value);
|
|
4938
|
-
}
|
|
4939
|
-
else if (expectedType === 'null') {
|
|
4940
|
-
valid = value === null;
|
|
4941
|
-
}
|
|
4942
|
-
else {
|
|
4943
|
-
valid = value instanceof type;
|
|
4944
|
-
}
|
|
4945
|
-
return {
|
|
4946
|
-
valid,
|
|
4947
|
-
expectedType
|
|
4948
4754
|
};
|
|
4949
4755
|
}
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
if (expectedTypes.length === 1 &&
|
|
4962
|
-
isExplicable(expectedType) &&
|
|
4963
|
-
!isBoolean(expectedType, receivedType)) {
|
|
4964
|
-
message += ` with value ${expectedValue}`;
|
|
4965
|
-
}
|
|
4966
|
-
message += `, got ${receivedType} `;
|
|
4967
|
-
// check if we need to specify received value
|
|
4968
|
-
if (isExplicable(receivedType)) {
|
|
4969
|
-
message += `with value ${receivedValue}.`;
|
|
4756
|
+
let shouldCacheAccess = true;
|
|
4757
|
+
function applyOptions(instance) {
|
|
4758
|
+
const options = resolveMergedOptions(instance);
|
|
4759
|
+
const publicThis = instance.proxy;
|
|
4760
|
+
const ctx = instance.ctx;
|
|
4761
|
+
// do not cache property access on public proxy during state initialization
|
|
4762
|
+
shouldCacheAccess = false;
|
|
4763
|
+
// call beforeCreate first before accessing other options since
|
|
4764
|
+
// the hook may mutate resolved options (#2791)
|
|
4765
|
+
if (options.beforeCreate) {
|
|
4766
|
+
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
4970
4767
|
}
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
}
|
|
4980
|
-
|
|
4981
|
-
|
|
4768
|
+
const {
|
|
4769
|
+
// state
|
|
4770
|
+
data: dataOptions, computed: computedOptions, methods, watch: watchOptions, provide: provideOptions, inject: injectOptions,
|
|
4771
|
+
// lifecycle
|
|
4772
|
+
created, beforeMount, mounted, beforeUpdate, updated, activated, deactivated, beforeDestroy, beforeUnmount, destroyed, unmounted, render, renderTracked, renderTriggered, errorCaptured, serverPrefetch,
|
|
4773
|
+
// public API
|
|
4774
|
+
expose, inheritAttrs,
|
|
4775
|
+
// assets
|
|
4776
|
+
components, directives, filters } = options;
|
|
4777
|
+
const checkDuplicateProperties = createDuplicateChecker() ;
|
|
4778
|
+
{
|
|
4779
|
+
const [propsOptions] = instance.propsOptions;
|
|
4780
|
+
if (propsOptions) {
|
|
4781
|
+
for (const key in propsOptions) {
|
|
4782
|
+
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4982
4785
|
}
|
|
4983
|
-
|
|
4984
|
-
|
|
4786
|
+
// options initialization order (to be consistent with Vue 2):
|
|
4787
|
+
// - props (already done outside of this function)
|
|
4788
|
+
// - inject
|
|
4789
|
+
// - methods
|
|
4790
|
+
// - data (deferred since it relies on `this` access)
|
|
4791
|
+
// - computed
|
|
4792
|
+
// - watch (deferred since it relies on `this` access)
|
|
4793
|
+
if (injectOptions) {
|
|
4794
|
+
resolveInjections(injectOptions, ctx, checkDuplicateProperties, instance.appContext.config.unwrapInjectedRef);
|
|
4985
4795
|
}
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
warn$1(`Slot "${key}" invoked outside of the render function: ` +
|
|
5009
|
-
`this will not track dependencies used in the slot. ` +
|
|
5010
|
-
`Invoke the slot function inside the render function instead.`);
|
|
5011
|
-
}
|
|
5012
|
-
return normalizeSlotValue(rawSlot(...args));
|
|
5013
|
-
}, ctx);
|
|
5014
|
-
normalized._c = false;
|
|
5015
|
-
return normalized;
|
|
5016
|
-
};
|
|
5017
|
-
const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
5018
|
-
const ctx = rawSlots._ctx;
|
|
5019
|
-
for (const key in rawSlots) {
|
|
5020
|
-
if (isInternalKey(key))
|
|
5021
|
-
continue;
|
|
5022
|
-
const value = rawSlots[key];
|
|
5023
|
-
if (isFunction(value)) {
|
|
5024
|
-
slots[key] = normalizeSlot(key, value, ctx);
|
|
5025
|
-
}
|
|
5026
|
-
else if (value != null) {
|
|
5027
|
-
{
|
|
5028
|
-
warn$1(`Non-function value encountered for slot "${key}". ` +
|
|
5029
|
-
`Prefer function slots for better performance.`);
|
|
4796
|
+
if (methods) {
|
|
4797
|
+
for (const key in methods) {
|
|
4798
|
+
const methodHandler = methods[key];
|
|
4799
|
+
if (isFunction(methodHandler)) {
|
|
4800
|
+
// In dev mode, we use the `createRenderContext` function to define
|
|
4801
|
+
// methods to the proxy target, and those are read-only but
|
|
4802
|
+
// reconfigurable, so it needs to be redefined here
|
|
4803
|
+
{
|
|
4804
|
+
Object.defineProperty(ctx, key, {
|
|
4805
|
+
value: methodHandler.bind(publicThis),
|
|
4806
|
+
configurable: true,
|
|
4807
|
+
enumerable: true,
|
|
4808
|
+
writable: true
|
|
4809
|
+
});
|
|
4810
|
+
}
|
|
4811
|
+
{
|
|
4812
|
+
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
4813
|
+
}
|
|
4814
|
+
}
|
|
4815
|
+
else {
|
|
4816
|
+
warn$1(`Method "${key}" has type "${typeof methodHandler}" in the component definition. ` +
|
|
4817
|
+
`Did you reference the function correctly?`);
|
|
5030
4818
|
}
|
|
5031
|
-
const normalized = normalizeSlotValue(value);
|
|
5032
|
-
slots[key] = () => normalized;
|
|
5033
4819
|
}
|
|
5034
4820
|
}
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
warn$1(`Non-function value encountered for default slot. ` +
|
|
5040
|
-
`Prefer function slots for better performance.`);
|
|
5041
|
-
}
|
|
5042
|
-
const normalized = normalizeSlotValue(children);
|
|
5043
|
-
instance.slots.default = () => normalized;
|
|
5044
|
-
};
|
|
5045
|
-
const initSlots = (instance, children) => {
|
|
5046
|
-
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
5047
|
-
const type = children._;
|
|
5048
|
-
if (type) {
|
|
5049
|
-
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
5050
|
-
// we should avoid the proxy object polluting the slots of the internal instance
|
|
5051
|
-
instance.slots = toRaw(children);
|
|
5052
|
-
// make compiler marker non-enumerable
|
|
5053
|
-
def(children, '_', type);
|
|
4821
|
+
if (dataOptions) {
|
|
4822
|
+
if (!isFunction(dataOptions)) {
|
|
4823
|
+
warn$1(`The data option must be a function. ` +
|
|
4824
|
+
`Plain object usage is no longer supported.`);
|
|
5054
4825
|
}
|
|
5055
|
-
|
|
5056
|
-
|
|
4826
|
+
const data = dataOptions.call(publicThis, publicThis);
|
|
4827
|
+
if (isPromise(data)) {
|
|
4828
|
+
warn$1(`data() returned a Promise - note data() cannot be async; If you ` +
|
|
4829
|
+
`intend to perform data fetching before component renders, use ` +
|
|
4830
|
+
`async setup() + <Suspense>.`);
|
|
5057
4831
|
}
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
instance.slots = {};
|
|
5061
|
-
if (children) {
|
|
5062
|
-
normalizeVNodeSlots(instance, children);
|
|
4832
|
+
if (!isObject(data)) {
|
|
4833
|
+
warn$1(`data() should return an object.`);
|
|
5063
4834
|
}
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
4835
|
+
else {
|
|
4836
|
+
instance.data = reactive(data);
|
|
4837
|
+
{
|
|
4838
|
+
for (const key in data) {
|
|
4839
|
+
checkDuplicateProperties("Data" /* DATA */, key);
|
|
4840
|
+
// expose data on ctx during dev
|
|
4841
|
+
if (!isReservedPrefix(key[0])) {
|
|
4842
|
+
Object.defineProperty(ctx, key, {
|
|
4843
|
+
configurable: true,
|
|
4844
|
+
enumerable: true,
|
|
4845
|
+
get: () => data[key],
|
|
4846
|
+
set: NOOP
|
|
4847
|
+
});
|
|
4848
|
+
}
|
|
4849
|
+
}
|
|
5079
4850
|
}
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
4851
|
+
}
|
|
4852
|
+
}
|
|
4853
|
+
// state initialization complete at this point - start caching access
|
|
4854
|
+
shouldCacheAccess = true;
|
|
4855
|
+
if (computedOptions) {
|
|
4856
|
+
for (const key in computedOptions) {
|
|
4857
|
+
const opt = computedOptions[key];
|
|
4858
|
+
const get = isFunction(opt)
|
|
4859
|
+
? opt.bind(publicThis, publicThis)
|
|
4860
|
+
: isFunction(opt.get)
|
|
4861
|
+
? opt.get.bind(publicThis, publicThis)
|
|
4862
|
+
: NOOP;
|
|
4863
|
+
if (get === NOOP) {
|
|
4864
|
+
warn$1(`Computed property "${key}" has no getter.`);
|
|
5084
4865
|
}
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
4866
|
+
const set = !isFunction(opt) && isFunction(opt.set)
|
|
4867
|
+
? opt.set.bind(publicThis)
|
|
4868
|
+
: () => {
|
|
4869
|
+
warn$1(`Write operation failed: computed property "${key}" is readonly.`);
|
|
4870
|
+
}
|
|
4871
|
+
;
|
|
4872
|
+
const c = computed$1({
|
|
4873
|
+
get,
|
|
4874
|
+
set
|
|
4875
|
+
});
|
|
4876
|
+
Object.defineProperty(ctx, key, {
|
|
4877
|
+
enumerable: true,
|
|
4878
|
+
configurable: true,
|
|
4879
|
+
get: () => c.value,
|
|
4880
|
+
set: v => (c.value = v)
|
|
4881
|
+
});
|
|
4882
|
+
{
|
|
4883
|
+
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
5096
4884
|
}
|
|
5097
4885
|
}
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
4886
|
+
}
|
|
4887
|
+
if (watchOptions) {
|
|
4888
|
+
for (const key in watchOptions) {
|
|
4889
|
+
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
5101
4890
|
}
|
|
5102
|
-
deletionComparisonTarget = children;
|
|
5103
4891
|
}
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
4892
|
+
if (provideOptions) {
|
|
4893
|
+
const provides = isFunction(provideOptions)
|
|
4894
|
+
? provideOptions.call(publicThis)
|
|
4895
|
+
: provideOptions;
|
|
4896
|
+
Reflect.ownKeys(provides).forEach(key => {
|
|
4897
|
+
provide(key, provides[key]);
|
|
4898
|
+
});
|
|
5108
4899
|
}
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
4900
|
+
if (created) {
|
|
4901
|
+
callHook(created, instance, "c" /* CREATED */);
|
|
4902
|
+
}
|
|
4903
|
+
function registerLifecycleHook(register, hook) {
|
|
4904
|
+
if (isArray(hook)) {
|
|
4905
|
+
hook.forEach(_hook => register(_hook.bind(publicThis)));
|
|
4906
|
+
}
|
|
4907
|
+
else if (hook) {
|
|
4908
|
+
register(hook.bind(publicThis));
|
|
5115
4909
|
}
|
|
5116
4910
|
}
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
4911
|
+
registerLifecycleHook(onBeforeMount, beforeMount);
|
|
4912
|
+
registerLifecycleHook(onMounted, mounted);
|
|
4913
|
+
registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
|
4914
|
+
registerLifecycleHook(onUpdated, updated);
|
|
4915
|
+
registerLifecycleHook(onActivated, activated);
|
|
4916
|
+
registerLifecycleHook(onDeactivated, deactivated);
|
|
4917
|
+
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
|
4918
|
+
registerLifecycleHook(onRenderTracked, renderTracked);
|
|
4919
|
+
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
|
4920
|
+
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
|
4921
|
+
registerLifecycleHook(onUnmounted, unmounted);
|
|
4922
|
+
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
4923
|
+
if (isArray(expose)) {
|
|
4924
|
+
if (expose.length) {
|
|
4925
|
+
const exposed = instance.exposed || (instance.exposed = {});
|
|
4926
|
+
expose.forEach(key => {
|
|
4927
|
+
Object.defineProperty(exposed, key, {
|
|
4928
|
+
get: () => publicThis[key],
|
|
4929
|
+
set: val => (publicThis[key] = val)
|
|
4930
|
+
});
|
|
4931
|
+
});
|
|
4932
|
+
}
|
|
4933
|
+
else if (!instance.exposed) {
|
|
4934
|
+
instance.exposed = {};
|
|
4935
|
+
}
|
|
4936
|
+
}
|
|
4937
|
+
// options that are handled when creating the instance but also need to be
|
|
4938
|
+
// applied from mixins
|
|
4939
|
+
if (render && instance.render === NOOP) {
|
|
4940
|
+
instance.render = render;
|
|
5134
4941
|
}
|
|
4942
|
+
if (inheritAttrs != null) {
|
|
4943
|
+
instance.inheritAttrs = inheritAttrs;
|
|
4944
|
+
}
|
|
4945
|
+
// asset options.
|
|
4946
|
+
if (components)
|
|
4947
|
+
instance.components = components;
|
|
4948
|
+
if (directives)
|
|
4949
|
+
instance.directives = directives;
|
|
5135
4950
|
}
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
function withDirectives(vnode, directives) {
|
|
5140
|
-
const internalInstance = currentRenderingInstance;
|
|
5141
|
-
if (internalInstance === null) {
|
|
5142
|
-
warn$1(`withDirectives can only be used inside render functions.`);
|
|
5143
|
-
return vnode;
|
|
4951
|
+
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
|
|
4952
|
+
if (isArray(injectOptions)) {
|
|
4953
|
+
injectOptions = normalizeInject(injectOptions);
|
|
5144
4954
|
}
|
|
5145
|
-
const
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
}
|
|
4955
|
+
for (const key in injectOptions) {
|
|
4956
|
+
const opt = injectOptions[key];
|
|
4957
|
+
let injected;
|
|
4958
|
+
if (isObject(opt)) {
|
|
4959
|
+
if ('default' in opt) {
|
|
4960
|
+
injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
|
|
4961
|
+
}
|
|
4962
|
+
else {
|
|
4963
|
+
injected = inject(opt.from || key);
|
|
4964
|
+
}
|
|
5155
4965
|
}
|
|
5156
|
-
|
|
5157
|
-
|
|
4966
|
+
else {
|
|
4967
|
+
injected = inject(opt);
|
|
4968
|
+
}
|
|
4969
|
+
if (isRef(injected)) {
|
|
4970
|
+
// TODO remove the check in 3.3
|
|
4971
|
+
if (unwrapRef) {
|
|
4972
|
+
Object.defineProperty(ctx, key, {
|
|
4973
|
+
enumerable: true,
|
|
4974
|
+
configurable: true,
|
|
4975
|
+
get: () => injected.value,
|
|
4976
|
+
set: v => (injected.value = v)
|
|
4977
|
+
});
|
|
4978
|
+
}
|
|
4979
|
+
else {
|
|
4980
|
+
{
|
|
4981
|
+
warn$1(`injected property "${key}" is a ref and will be auto-unwrapped ` +
|
|
4982
|
+
`and no longer needs \`.value\` in the next minor release. ` +
|
|
4983
|
+
`To opt-in to the new behavior now, ` +
|
|
4984
|
+
`set \`app.config.unwrapInjectedRef = true\` (this config is ` +
|
|
4985
|
+
`temporary and will not be needed in the future.)`);
|
|
4986
|
+
}
|
|
4987
|
+
ctx[key] = injected;
|
|
4988
|
+
}
|
|
4989
|
+
}
|
|
4990
|
+
else {
|
|
4991
|
+
ctx[key] = injected;
|
|
4992
|
+
}
|
|
4993
|
+
{
|
|
4994
|
+
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
5158
4995
|
}
|
|
5159
|
-
bindings.push({
|
|
5160
|
-
dir,
|
|
5161
|
-
instance,
|
|
5162
|
-
value,
|
|
5163
|
-
oldValue: void 0,
|
|
5164
|
-
arg,
|
|
5165
|
-
modifiers
|
|
5166
|
-
});
|
|
5167
4996
|
}
|
|
5168
|
-
return vnode;
|
|
5169
4997
|
}
|
|
5170
|
-
function
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
4998
|
+
function callHook(hook, instance, type) {
|
|
4999
|
+
callWithAsyncErrorHandling(isArray(hook)
|
|
5000
|
+
? hook.map(h => h.bind(instance.proxy))
|
|
5001
|
+
: hook.bind(instance.proxy), instance, type);
|
|
5002
|
+
}
|
|
5003
|
+
function createWatcher(raw, ctx, publicThis, key) {
|
|
5004
|
+
const getter = key.includes('.')
|
|
5005
|
+
? createPathGetter(publicThis, key)
|
|
5006
|
+
: () => publicThis[key];
|
|
5007
|
+
if (isString(raw)) {
|
|
5008
|
+
const handler = ctx[raw];
|
|
5009
|
+
if (isFunction(handler)) {
|
|
5010
|
+
watch(getter, handler);
|
|
5177
5011
|
}
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
// disable tracking inside all lifecycle hooks
|
|
5181
|
-
// since they can potentially be called inside effects.
|
|
5182
|
-
pauseTracking();
|
|
5183
|
-
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
5184
|
-
vnode.el,
|
|
5185
|
-
binding,
|
|
5186
|
-
vnode,
|
|
5187
|
-
prevVNode
|
|
5188
|
-
]);
|
|
5189
|
-
resetTracking();
|
|
5012
|
+
else {
|
|
5013
|
+
warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
5190
5014
|
}
|
|
5191
5015
|
}
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
}
|
|
5016
|
+
else if (isFunction(raw)) {
|
|
5017
|
+
watch(getter, raw.bind(publicThis));
|
|
5018
|
+
}
|
|
5019
|
+
else if (isObject(raw)) {
|
|
5020
|
+
if (isArray(raw)) {
|
|
5021
|
+
raw.forEach(r => createWatcher(r, ctx, publicThis, key));
|
|
5022
|
+
}
|
|
5023
|
+
else {
|
|
5024
|
+
const handler = isFunction(raw.handler)
|
|
5025
|
+
? raw.handler.bind(publicThis)
|
|
5026
|
+
: ctx[raw.handler];
|
|
5027
|
+
if (isFunction(handler)) {
|
|
5028
|
+
watch(getter, handler, raw);
|
|
5029
|
+
}
|
|
5030
|
+
else {
|
|
5031
|
+
warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
|
5032
|
+
}
|
|
5033
|
+
}
|
|
5034
|
+
}
|
|
5035
|
+
else {
|
|
5036
|
+
warn$1(`Invalid watch option: "${key}"`, raw);
|
|
5037
|
+
}
|
|
5214
5038
|
}
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5039
|
+
/**
|
|
5040
|
+
* Resolve merged options and cache it on the component.
|
|
5041
|
+
* This is done only once per-component since the merging does not involve
|
|
5042
|
+
* instances.
|
|
5043
|
+
*/
|
|
5044
|
+
function resolveMergedOptions(instance) {
|
|
5045
|
+
const base = instance.type;
|
|
5046
|
+
const { mixins, extends: extendsOptions } = base;
|
|
5047
|
+
const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;
|
|
5048
|
+
const cached = cache.get(base);
|
|
5049
|
+
let resolved;
|
|
5050
|
+
if (cached) {
|
|
5051
|
+
resolved = cached;
|
|
5052
|
+
}
|
|
5053
|
+
else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
5054
|
+
{
|
|
5055
|
+
resolved = base;
|
|
5220
5056
|
}
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5057
|
+
}
|
|
5058
|
+
else {
|
|
5059
|
+
resolved = {};
|
|
5060
|
+
if (globalMixins.length) {
|
|
5061
|
+
globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
5224
5062
|
}
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5063
|
+
mergeOptions(resolved, base, optionMergeStrategies);
|
|
5064
|
+
}
|
|
5065
|
+
cache.set(base, resolved);
|
|
5066
|
+
return resolved;
|
|
5067
|
+
}
|
|
5068
|
+
function mergeOptions(to, from, strats, asMixin = false) {
|
|
5069
|
+
const { mixins, extends: extendsOptions } = from;
|
|
5070
|
+
if (extendsOptions) {
|
|
5071
|
+
mergeOptions(to, extendsOptions, strats, true);
|
|
5072
|
+
}
|
|
5073
|
+
if (mixins) {
|
|
5074
|
+
mixins.forEach((m) => mergeOptions(to, m, strats, true));
|
|
5075
|
+
}
|
|
5076
|
+
for (const key in from) {
|
|
5077
|
+
if (asMixin && key === 'expose') {
|
|
5078
|
+
warn$1(`"expose" option is ignored when declared in mixins or extends. ` +
|
|
5079
|
+
`It should only be declared in the base component itself.`);
|
|
5080
|
+
}
|
|
5081
|
+
else {
|
|
5082
|
+
const strat = internalOptionMergeStrats[key] || (strats && strats[key]);
|
|
5083
|
+
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
5084
|
+
}
|
|
5085
|
+
}
|
|
5086
|
+
return to;
|
|
5087
|
+
}
|
|
5088
|
+
const internalOptionMergeStrats = {
|
|
5089
|
+
data: mergeDataFn,
|
|
5090
|
+
props: mergeObjectOptions,
|
|
5091
|
+
emits: mergeObjectOptions,
|
|
5092
|
+
// objects
|
|
5093
|
+
methods: mergeObjectOptions,
|
|
5094
|
+
computed: mergeObjectOptions,
|
|
5095
|
+
// lifecycle
|
|
5096
|
+
beforeCreate: mergeAsArray,
|
|
5097
|
+
created: mergeAsArray,
|
|
5098
|
+
beforeMount: mergeAsArray,
|
|
5099
|
+
mounted: mergeAsArray,
|
|
5100
|
+
beforeUpdate: mergeAsArray,
|
|
5101
|
+
updated: mergeAsArray,
|
|
5102
|
+
beforeDestroy: mergeAsArray,
|
|
5103
|
+
beforeUnmount: mergeAsArray,
|
|
5104
|
+
destroyed: mergeAsArray,
|
|
5105
|
+
unmounted: mergeAsArray,
|
|
5106
|
+
activated: mergeAsArray,
|
|
5107
|
+
deactivated: mergeAsArray,
|
|
5108
|
+
errorCaptured: mergeAsArray,
|
|
5109
|
+
serverPrefetch: mergeAsArray,
|
|
5110
|
+
// assets
|
|
5111
|
+
components: mergeObjectOptions,
|
|
5112
|
+
directives: mergeObjectOptions,
|
|
5113
|
+
// watch
|
|
5114
|
+
watch: mergeWatchOptions,
|
|
5115
|
+
// provide / inject
|
|
5116
|
+
provide: mergeDataFn,
|
|
5117
|
+
inject: mergeInject
|
|
5118
|
+
};
|
|
5119
|
+
function mergeDataFn(to, from) {
|
|
5120
|
+
if (!from) {
|
|
5121
|
+
return to;
|
|
5122
|
+
}
|
|
5123
|
+
if (!to) {
|
|
5124
|
+
return from;
|
|
5125
|
+
}
|
|
5126
|
+
return function mergedDataFn() {
|
|
5127
|
+
return (extend)(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
|
|
5128
|
+
};
|
|
5129
|
+
}
|
|
5130
|
+
function mergeInject(to, from) {
|
|
5131
|
+
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
5132
|
+
}
|
|
5133
|
+
function normalizeInject(raw) {
|
|
5134
|
+
if (isArray(raw)) {
|
|
5135
|
+
const res = {};
|
|
5136
|
+
for (let i = 0; i < raw.length; i++) {
|
|
5137
|
+
res[raw[i]] = raw[i];
|
|
5138
|
+
}
|
|
5139
|
+
return res;
|
|
5140
|
+
}
|
|
5141
|
+
return raw;
|
|
5142
|
+
}
|
|
5143
|
+
function mergeAsArray(to, from) {
|
|
5144
|
+
return to ? [...new Set([].concat(to, from))] : from;
|
|
5145
|
+
}
|
|
5146
|
+
function mergeObjectOptions(to, from) {
|
|
5147
|
+
return to ? extend(extend(Object.create(null), to), from) : from;
|
|
5148
|
+
}
|
|
5149
|
+
function mergeWatchOptions(to, from) {
|
|
5150
|
+
if (!to)
|
|
5151
|
+
return from;
|
|
5152
|
+
if (!from)
|
|
5153
|
+
return to;
|
|
5154
|
+
const merged = extend(Object.create(null), to);
|
|
5155
|
+
for (const key in from) {
|
|
5156
|
+
merged[key] = mergeAsArray(to[key], from[key]);
|
|
5157
|
+
}
|
|
5158
|
+
return merged;
|
|
5159
|
+
}
|
|
5160
|
+
|
|
5161
|
+
function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison
|
|
5162
|
+
isSSR = false) {
|
|
5163
|
+
const props = {};
|
|
5164
|
+
const attrs = {};
|
|
5165
|
+
def(attrs, InternalObjectKey, 1);
|
|
5166
|
+
instance.propsDefaults = Object.create(null);
|
|
5167
|
+
setFullProps(instance, rawProps, props, attrs);
|
|
5168
|
+
// ensure all declared prop keys are present
|
|
5169
|
+
for (const key in instance.propsOptions[0]) {
|
|
5170
|
+
if (!(key in props)) {
|
|
5171
|
+
props[key] = undefined;
|
|
5172
|
+
}
|
|
5173
|
+
}
|
|
5174
|
+
// validation
|
|
5175
|
+
{
|
|
5176
|
+
validateProps(rawProps || {}, props, instance);
|
|
5177
|
+
}
|
|
5178
|
+
if (isStateful) {
|
|
5179
|
+
// stateful
|
|
5180
|
+
instance.props = isSSR ? props : shallowReactive(props);
|
|
5181
|
+
}
|
|
5182
|
+
else {
|
|
5183
|
+
if (!instance.type.props) {
|
|
5184
|
+
// functional w/ optional props, props === attrs
|
|
5185
|
+
instance.props = attrs;
|
|
5186
|
+
}
|
|
5187
|
+
else {
|
|
5188
|
+
// functional w/ declared props
|
|
5189
|
+
instance.props = props;
|
|
5190
|
+
}
|
|
5191
|
+
}
|
|
5192
|
+
instance.attrs = attrs;
|
|
5193
|
+
}
|
|
5194
|
+
function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
5195
|
+
const { props, attrs, vnode: { patchFlag } } = instance;
|
|
5196
|
+
const rawCurrentProps = toRaw(props);
|
|
5197
|
+
const [options] = instance.propsOptions;
|
|
5198
|
+
let hasAttrsChanged = false;
|
|
5199
|
+
if (
|
|
5200
|
+
// always force full diff in dev
|
|
5201
|
+
// - #1942 if hmr is enabled with sfc component
|
|
5202
|
+
// - vite#872 non-sfc component used by sfc component
|
|
5203
|
+
!((instance.type.__hmrId ||
|
|
5204
|
+
(instance.parent && instance.parent.type.__hmrId))) &&
|
|
5205
|
+
(optimized || patchFlag > 0) &&
|
|
5206
|
+
!(patchFlag & 16 /* FULL_PROPS */)) {
|
|
5207
|
+
if (patchFlag & 8 /* PROPS */) {
|
|
5208
|
+
// Compiler-generated props & no keys change, just set the updated
|
|
5209
|
+
// the props.
|
|
5210
|
+
const propsToUpdate = instance.vnode.dynamicProps;
|
|
5211
|
+
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
5212
|
+
let key = propsToUpdate[i];
|
|
5213
|
+
// skip if the prop key is a declared emit event listener
|
|
5214
|
+
if (isEmitListener(instance.emitsOptions, key)) {
|
|
5215
|
+
continue;
|
|
5216
|
+
}
|
|
5217
|
+
// PROPS flag guarantees rawProps to be non-null
|
|
5218
|
+
const value = rawProps[key];
|
|
5219
|
+
if (options) {
|
|
5220
|
+
// attr / props separation was done on init and will be consistent
|
|
5221
|
+
// in this code path, so just check if attrs have it.
|
|
5222
|
+
if (hasOwn(attrs, key)) {
|
|
5223
|
+
if (value !== attrs[key]) {
|
|
5224
|
+
attrs[key] = value;
|
|
5225
|
+
hasAttrsChanged = true;
|
|
5226
|
+
}
|
|
5227
|
+
}
|
|
5228
|
+
else {
|
|
5229
|
+
const camelizedKey = camelize(key);
|
|
5230
|
+
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
|
|
5231
|
+
}
|
|
5232
|
+
}
|
|
5233
|
+
else {
|
|
5234
|
+
if (value !== attrs[key]) {
|
|
5235
|
+
attrs[key] = value;
|
|
5236
|
+
hasAttrsChanged = true;
|
|
5237
|
+
}
|
|
5238
|
+
}
|
|
5239
|
+
}
|
|
5240
|
+
}
|
|
5241
|
+
}
|
|
5242
|
+
else {
|
|
5243
|
+
// full props update.
|
|
5244
|
+
if (setFullProps(instance, rawProps, props, attrs)) {
|
|
5245
|
+
hasAttrsChanged = true;
|
|
5246
|
+
}
|
|
5247
|
+
// in case of dynamic props, check if we need to delete keys from
|
|
5248
|
+
// the props object
|
|
5249
|
+
let kebabKey;
|
|
5250
|
+
for (const key in rawCurrentProps) {
|
|
5251
|
+
if (!rawProps ||
|
|
5252
|
+
// for camelCase
|
|
5253
|
+
(!hasOwn(rawProps, key) &&
|
|
5254
|
+
// it's possible the original props was passed in as kebab-case
|
|
5255
|
+
// and converted to camelCase (#955)
|
|
5256
|
+
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {
|
|
5257
|
+
if (options) {
|
|
5258
|
+
if (rawPrevProps &&
|
|
5259
|
+
// for camelCase
|
|
5260
|
+
(rawPrevProps[key] !== undefined ||
|
|
5261
|
+
// for kebab-case
|
|
5262
|
+
rawPrevProps[kebabKey] !== undefined)) {
|
|
5263
|
+
props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */);
|
|
5264
|
+
}
|
|
5265
|
+
}
|
|
5266
|
+
else {
|
|
5267
|
+
delete props[key];
|
|
5268
|
+
}
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5271
|
+
// in the case of functional component w/o props declaration, props and
|
|
5272
|
+
// attrs point to the same object so it should already have been updated.
|
|
5273
|
+
if (attrs !== rawCurrentProps) {
|
|
5274
|
+
for (const key in attrs) {
|
|
5275
|
+
if (!rawProps ||
|
|
5276
|
+
(!hasOwn(rawProps, key) &&
|
|
5277
|
+
(!false ))) {
|
|
5278
|
+
delete attrs[key];
|
|
5279
|
+
hasAttrsChanged = true;
|
|
5280
|
+
}
|
|
5281
|
+
}
|
|
5282
|
+
}
|
|
5283
|
+
}
|
|
5284
|
+
// trigger updates for $attrs in case it's used in component slots
|
|
5285
|
+
if (hasAttrsChanged) {
|
|
5286
|
+
trigger(instance, "set" /* SET */, '$attrs');
|
|
5287
|
+
}
|
|
5288
|
+
{
|
|
5289
|
+
validateProps(rawProps || {}, props, instance);
|
|
5290
|
+
}
|
|
5291
|
+
}
|
|
5292
|
+
function setFullProps(instance, rawProps, props, attrs) {
|
|
5293
|
+
const [options, needCastKeys] = instance.propsOptions;
|
|
5294
|
+
let hasAttrsChanged = false;
|
|
5295
|
+
let rawCastValues;
|
|
5296
|
+
if (rawProps) {
|
|
5297
|
+
for (let key in rawProps) {
|
|
5298
|
+
// key, ref are reserved and never passed down
|
|
5299
|
+
if (isReservedProp(key)) {
|
|
5300
|
+
continue;
|
|
5301
|
+
}
|
|
5302
|
+
const value = rawProps[key];
|
|
5303
|
+
// prop option names are camelized during normalization, so to support
|
|
5304
|
+
// kebab -> camel conversion here we need to camelize the key.
|
|
5305
|
+
let camelKey;
|
|
5306
|
+
if (options && hasOwn(options, (camelKey = camelize(key)))) {
|
|
5307
|
+
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
|
5308
|
+
props[camelKey] = value;
|
|
5309
|
+
}
|
|
5310
|
+
else {
|
|
5311
|
+
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
|
5312
|
+
}
|
|
5313
|
+
}
|
|
5314
|
+
else if (!isEmitListener(instance.emitsOptions, key)) {
|
|
5315
|
+
if (!(key in attrs) || value !== attrs[key]) {
|
|
5316
|
+
attrs[key] = value;
|
|
5317
|
+
hasAttrsChanged = true;
|
|
5318
|
+
}
|
|
5319
|
+
}
|
|
5320
|
+
}
|
|
5321
|
+
}
|
|
5322
|
+
if (needCastKeys) {
|
|
5323
|
+
const rawCurrentProps = toRaw(props);
|
|
5324
|
+
const castValues = rawCastValues || EMPTY_OBJ;
|
|
5325
|
+
for (let i = 0; i < needCastKeys.length; i++) {
|
|
5326
|
+
const key = needCastKeys[i];
|
|
5327
|
+
props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn(castValues, key));
|
|
5328
|
+
}
|
|
5329
|
+
}
|
|
5330
|
+
return hasAttrsChanged;
|
|
5331
|
+
}
|
|
5332
|
+
function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
5333
|
+
const opt = options[key];
|
|
5334
|
+
if (opt != null) {
|
|
5335
|
+
const hasDefault = hasOwn(opt, 'default');
|
|
5336
|
+
// default values
|
|
5337
|
+
if (hasDefault && value === undefined) {
|
|
5338
|
+
const defaultValue = opt.default;
|
|
5339
|
+
if (opt.type !== Function && isFunction(defaultValue)) {
|
|
5340
|
+
const { propsDefaults } = instance;
|
|
5341
|
+
if (key in propsDefaults) {
|
|
5342
|
+
value = propsDefaults[key];
|
|
5343
|
+
}
|
|
5344
|
+
else {
|
|
5345
|
+
setCurrentInstance(instance);
|
|
5346
|
+
value = propsDefaults[key] = defaultValue.call(null, props);
|
|
5347
|
+
unsetCurrentInstance();
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
else {
|
|
5351
|
+
value = defaultValue;
|
|
5352
|
+
}
|
|
5353
|
+
}
|
|
5354
|
+
// boolean casting
|
|
5355
|
+
if (opt[0 /* shouldCast */]) {
|
|
5356
|
+
if (isAbsent && !hasDefault) {
|
|
5357
|
+
value = false;
|
|
5358
|
+
}
|
|
5359
|
+
else if (opt[1 /* shouldCastTrue */] &&
|
|
5360
|
+
(value === '' || value === hyphenate(key))) {
|
|
5361
|
+
value = true;
|
|
5362
|
+
}
|
|
5363
|
+
}
|
|
5364
|
+
}
|
|
5365
|
+
return value;
|
|
5366
|
+
}
|
|
5367
|
+
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
5368
|
+
const cache = appContext.propsCache;
|
|
5369
|
+
const cached = cache.get(comp);
|
|
5370
|
+
if (cached) {
|
|
5371
|
+
return cached;
|
|
5372
|
+
}
|
|
5373
|
+
const raw = comp.props;
|
|
5374
|
+
const normalized = {};
|
|
5375
|
+
const needCastKeys = [];
|
|
5376
|
+
// apply mixin/extends props
|
|
5377
|
+
let hasExtends = false;
|
|
5378
|
+
if (!isFunction(comp)) {
|
|
5379
|
+
const extendProps = (raw) => {
|
|
5380
|
+
hasExtends = true;
|
|
5381
|
+
const [props, keys] = normalizePropsOptions(raw, appContext, true);
|
|
5382
|
+
extend(normalized, props);
|
|
5383
|
+
if (keys)
|
|
5384
|
+
needCastKeys.push(...keys);
|
|
5385
|
+
};
|
|
5386
|
+
if (!asMixin && appContext.mixins.length) {
|
|
5387
|
+
appContext.mixins.forEach(extendProps);
|
|
5388
|
+
}
|
|
5389
|
+
if (comp.extends) {
|
|
5390
|
+
extendProps(comp.extends);
|
|
5391
|
+
}
|
|
5392
|
+
if (comp.mixins) {
|
|
5393
|
+
comp.mixins.forEach(extendProps);
|
|
5394
|
+
}
|
|
5395
|
+
}
|
|
5396
|
+
if (!raw && !hasExtends) {
|
|
5397
|
+
cache.set(comp, EMPTY_ARR);
|
|
5398
|
+
return EMPTY_ARR;
|
|
5399
|
+
}
|
|
5400
|
+
if (isArray(raw)) {
|
|
5401
|
+
for (let i = 0; i < raw.length; i++) {
|
|
5402
|
+
if (!isString(raw[i])) {
|
|
5403
|
+
warn$1(`props must be strings when using array syntax.`, raw[i]);
|
|
5404
|
+
}
|
|
5405
|
+
const normalizedKey = camelize(raw[i]);
|
|
5406
|
+
if (validatePropName(normalizedKey)) {
|
|
5407
|
+
normalized[normalizedKey] = EMPTY_OBJ;
|
|
5408
|
+
}
|
|
5409
|
+
}
|
|
5410
|
+
}
|
|
5411
|
+
else if (raw) {
|
|
5412
|
+
if (!isObject(raw)) {
|
|
5413
|
+
warn$1(`invalid props options`, raw);
|
|
5414
|
+
}
|
|
5415
|
+
for (const key in raw) {
|
|
5416
|
+
const normalizedKey = camelize(key);
|
|
5417
|
+
if (validatePropName(normalizedKey)) {
|
|
5418
|
+
const opt = raw[key];
|
|
5419
|
+
const prop = (normalized[normalizedKey] =
|
|
5420
|
+
isArray(opt) || isFunction(opt) ? { type: opt } : opt);
|
|
5421
|
+
if (prop) {
|
|
5422
|
+
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
5423
|
+
const stringIndex = getTypeIndex(String, prop.type);
|
|
5424
|
+
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
5425
|
+
prop[1 /* shouldCastTrue */] =
|
|
5426
|
+
stringIndex < 0 || booleanIndex < stringIndex;
|
|
5427
|
+
// if the prop needs boolean casting or default value
|
|
5428
|
+
if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
|
5429
|
+
needCastKeys.push(normalizedKey);
|
|
5430
|
+
}
|
|
5431
|
+
}
|
|
5432
|
+
}
|
|
5433
|
+
}
|
|
5434
|
+
}
|
|
5435
|
+
const res = [normalized, needCastKeys];
|
|
5436
|
+
cache.set(comp, res);
|
|
5437
|
+
return res;
|
|
5438
|
+
}
|
|
5439
|
+
function validatePropName(key) {
|
|
5440
|
+
if (key[0] !== '$') {
|
|
5441
|
+
return true;
|
|
5442
|
+
}
|
|
5443
|
+
else {
|
|
5444
|
+
warn$1(`Invalid prop name: "${key}" is a reserved property.`);
|
|
5445
|
+
}
|
|
5446
|
+
return false;
|
|
5447
|
+
}
|
|
5448
|
+
// use function string name to check type constructors
|
|
5449
|
+
// so that it works across vms / iframes.
|
|
5450
|
+
function getType(ctor) {
|
|
5451
|
+
const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
|
|
5452
|
+
return match ? match[1] : ctor === null ? 'null' : '';
|
|
5453
|
+
}
|
|
5454
|
+
function isSameType(a, b) {
|
|
5455
|
+
return getType(a) === getType(b);
|
|
5456
|
+
}
|
|
5457
|
+
function getTypeIndex(type, expectedTypes) {
|
|
5458
|
+
if (isArray(expectedTypes)) {
|
|
5459
|
+
return expectedTypes.findIndex(t => isSameType(t, type));
|
|
5460
|
+
}
|
|
5461
|
+
else if (isFunction(expectedTypes)) {
|
|
5462
|
+
return isSameType(expectedTypes, type) ? 0 : -1;
|
|
5463
|
+
}
|
|
5464
|
+
return -1;
|
|
5465
|
+
}
|
|
5466
|
+
/**
|
|
5467
|
+
* dev only
|
|
5468
|
+
*/
|
|
5469
|
+
function validateProps(rawProps, props, instance) {
|
|
5470
|
+
const resolvedValues = toRaw(props);
|
|
5471
|
+
const options = instance.propsOptions[0];
|
|
5472
|
+
for (const key in options) {
|
|
5473
|
+
let opt = options[key];
|
|
5474
|
+
if (opt == null)
|
|
5475
|
+
continue;
|
|
5476
|
+
validateProp(key, resolvedValues[key], opt, !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key)));
|
|
5477
|
+
}
|
|
5478
|
+
}
|
|
5479
|
+
/**
|
|
5480
|
+
* dev only
|
|
5481
|
+
*/
|
|
5482
|
+
function validateProp(name, value, prop, isAbsent) {
|
|
5483
|
+
const { type, required, validator } = prop;
|
|
5484
|
+
// required!
|
|
5485
|
+
if (required && isAbsent) {
|
|
5486
|
+
warn$1('Missing required prop: "' + name + '"');
|
|
5487
|
+
return;
|
|
5488
|
+
}
|
|
5489
|
+
// missing but optional
|
|
5490
|
+
if (value == null && !prop.required) {
|
|
5491
|
+
return;
|
|
5492
|
+
}
|
|
5493
|
+
// type check
|
|
5494
|
+
if (type != null && type !== true) {
|
|
5495
|
+
let isValid = false;
|
|
5496
|
+
const types = isArray(type) ? type : [type];
|
|
5497
|
+
const expectedTypes = [];
|
|
5498
|
+
// value is valid as long as one of the specified types match
|
|
5499
|
+
for (let i = 0; i < types.length && !isValid; i++) {
|
|
5500
|
+
const { valid, expectedType } = assertType(value, types[i]);
|
|
5501
|
+
expectedTypes.push(expectedType || '');
|
|
5502
|
+
isValid = valid;
|
|
5503
|
+
}
|
|
5504
|
+
if (!isValid) {
|
|
5505
|
+
warn$1(getInvalidTypeMessage(name, value, expectedTypes));
|
|
5506
|
+
return;
|
|
5507
|
+
}
|
|
5508
|
+
}
|
|
5509
|
+
// custom validator
|
|
5510
|
+
if (validator && !validator(value)) {
|
|
5511
|
+
warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
|
5512
|
+
}
|
|
5513
|
+
}
|
|
5514
|
+
const isSimpleType = /*#__PURE__*/ makeMap('String,Number,Boolean,Function,Symbol,BigInt');
|
|
5515
|
+
/**
|
|
5516
|
+
* dev only
|
|
5517
|
+
*/
|
|
5518
|
+
function assertType(value, type) {
|
|
5519
|
+
let valid;
|
|
5520
|
+
const expectedType = getType(type);
|
|
5521
|
+
if (isSimpleType(expectedType)) {
|
|
5522
|
+
const t = typeof value;
|
|
5523
|
+
valid = t === expectedType.toLowerCase();
|
|
5524
|
+
// for primitive wrapper objects
|
|
5525
|
+
if (!valid && t === 'object') {
|
|
5526
|
+
valid = value instanceof type;
|
|
5527
|
+
}
|
|
5528
|
+
}
|
|
5529
|
+
else if (expectedType === 'Object') {
|
|
5530
|
+
valid = isObject(value);
|
|
5531
|
+
}
|
|
5532
|
+
else if (expectedType === 'Array') {
|
|
5533
|
+
valid = isArray(value);
|
|
5534
|
+
}
|
|
5535
|
+
else if (expectedType === 'null') {
|
|
5536
|
+
valid = value === null;
|
|
5537
|
+
}
|
|
5538
|
+
else {
|
|
5539
|
+
valid = value instanceof type;
|
|
5540
|
+
}
|
|
5541
|
+
return {
|
|
5542
|
+
valid,
|
|
5543
|
+
expectedType
|
|
5544
|
+
};
|
|
5545
|
+
}
|
|
5546
|
+
/**
|
|
5547
|
+
* dev only
|
|
5548
|
+
*/
|
|
5549
|
+
function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
5550
|
+
let message = `Invalid prop: type check failed for prop "${name}".` +
|
|
5551
|
+
` Expected ${expectedTypes.map(capitalize).join(' | ')}`;
|
|
5552
|
+
const expectedType = expectedTypes[0];
|
|
5553
|
+
const receivedType = toRawType(value);
|
|
5554
|
+
const expectedValue = styleValue(value, expectedType);
|
|
5555
|
+
const receivedValue = styleValue(value, receivedType);
|
|
5556
|
+
// check if we need to specify expected value
|
|
5557
|
+
if (expectedTypes.length === 1 &&
|
|
5558
|
+
isExplicable(expectedType) &&
|
|
5559
|
+
!isBoolean(expectedType, receivedType)) {
|
|
5560
|
+
message += ` with value ${expectedValue}`;
|
|
5561
|
+
}
|
|
5562
|
+
message += `, got ${receivedType} `;
|
|
5563
|
+
// check if we need to specify received value
|
|
5564
|
+
if (isExplicable(receivedType)) {
|
|
5565
|
+
message += `with value ${receivedValue}.`;
|
|
5566
|
+
}
|
|
5567
|
+
return message;
|
|
5568
|
+
}
|
|
5569
|
+
/**
|
|
5570
|
+
* dev only
|
|
5571
|
+
*/
|
|
5572
|
+
function styleValue(value, type) {
|
|
5573
|
+
if (type === 'String') {
|
|
5574
|
+
return `"${value}"`;
|
|
5575
|
+
}
|
|
5576
|
+
else if (type === 'Number') {
|
|
5577
|
+
return `${Number(value)}`;
|
|
5578
|
+
}
|
|
5579
|
+
else {
|
|
5580
|
+
return `${value}`;
|
|
5581
|
+
}
|
|
5582
|
+
}
|
|
5583
|
+
/**
|
|
5584
|
+
* dev only
|
|
5585
|
+
*/
|
|
5586
|
+
function isExplicable(type) {
|
|
5587
|
+
const explicitTypes = ['string', 'number', 'boolean'];
|
|
5588
|
+
return explicitTypes.some(elem => type.toLowerCase() === elem);
|
|
5589
|
+
}
|
|
5590
|
+
/**
|
|
5591
|
+
* dev only
|
|
5592
|
+
*/
|
|
5593
|
+
function isBoolean(...args) {
|
|
5594
|
+
return args.some(elem => elem.toLowerCase() === 'boolean');
|
|
5595
|
+
}
|
|
5596
|
+
|
|
5597
|
+
const isInternalKey = (key) => key[0] === '_' || key === '$stable';
|
|
5598
|
+
const normalizeSlotValue = (value) => isArray(value)
|
|
5599
|
+
? value.map(normalizeVNode)
|
|
5600
|
+
: [normalizeVNode(value)];
|
|
5601
|
+
const normalizeSlot = (key, rawSlot, ctx) => {
|
|
5602
|
+
if (rawSlot._n) {
|
|
5603
|
+
// already normalized - #5353
|
|
5604
|
+
return rawSlot;
|
|
5605
|
+
}
|
|
5606
|
+
const normalized = withCtx((...args) => {
|
|
5607
|
+
if (currentInstance) {
|
|
5608
|
+
warn$1(`Slot "${key}" invoked outside of the render function: ` +
|
|
5609
|
+
`this will not track dependencies used in the slot. ` +
|
|
5610
|
+
`Invoke the slot function inside the render function instead.`);
|
|
5611
|
+
}
|
|
5612
|
+
return normalizeSlotValue(rawSlot(...args));
|
|
5613
|
+
}, ctx);
|
|
5614
|
+
normalized._c = false;
|
|
5615
|
+
return normalized;
|
|
5616
|
+
};
|
|
5617
|
+
const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
5618
|
+
const ctx = rawSlots._ctx;
|
|
5619
|
+
for (const key in rawSlots) {
|
|
5620
|
+
if (isInternalKey(key))
|
|
5621
|
+
continue;
|
|
5622
|
+
const value = rawSlots[key];
|
|
5623
|
+
if (isFunction(value)) {
|
|
5624
|
+
slots[key] = normalizeSlot(key, value, ctx);
|
|
5625
|
+
}
|
|
5626
|
+
else if (value != null) {
|
|
5627
|
+
{
|
|
5628
|
+
warn$1(`Non-function value encountered for slot "${key}". ` +
|
|
5629
|
+
`Prefer function slots for better performance.`);
|
|
5630
|
+
}
|
|
5631
|
+
const normalized = normalizeSlotValue(value);
|
|
5632
|
+
slots[key] = () => normalized;
|
|
5633
|
+
}
|
|
5634
|
+
}
|
|
5635
|
+
};
|
|
5636
|
+
const normalizeVNodeSlots = (instance, children) => {
|
|
5637
|
+
if (!isKeepAlive(instance.vnode) &&
|
|
5638
|
+
!(false )) {
|
|
5639
|
+
warn$1(`Non-function value encountered for default slot. ` +
|
|
5640
|
+
`Prefer function slots for better performance.`);
|
|
5641
|
+
}
|
|
5642
|
+
const normalized = normalizeSlotValue(children);
|
|
5643
|
+
instance.slots.default = () => normalized;
|
|
5644
|
+
};
|
|
5645
|
+
const initSlots = (instance, children) => {
|
|
5646
|
+
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
5647
|
+
const type = children._;
|
|
5648
|
+
if (type) {
|
|
5649
|
+
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
5650
|
+
// we should avoid the proxy object polluting the slots of the internal instance
|
|
5651
|
+
instance.slots = toRaw(children);
|
|
5652
|
+
// make compiler marker non-enumerable
|
|
5653
|
+
def(children, '_', type);
|
|
5654
|
+
}
|
|
5655
|
+
else {
|
|
5656
|
+
normalizeObjectSlots(children, (instance.slots = {}));
|
|
5657
|
+
}
|
|
5658
|
+
}
|
|
5659
|
+
else {
|
|
5660
|
+
instance.slots = {};
|
|
5661
|
+
if (children) {
|
|
5662
|
+
normalizeVNodeSlots(instance, children);
|
|
5663
|
+
}
|
|
5664
|
+
}
|
|
5665
|
+
def(instance.slots, InternalObjectKey, 1);
|
|
5666
|
+
};
|
|
5667
|
+
const updateSlots = (instance, children, optimized) => {
|
|
5668
|
+
const { vnode, slots } = instance;
|
|
5669
|
+
let needDeletionCheck = true;
|
|
5670
|
+
let deletionComparisonTarget = EMPTY_OBJ;
|
|
5671
|
+
if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
5672
|
+
const type = children._;
|
|
5673
|
+
if (type) {
|
|
5674
|
+
// compiled slots.
|
|
5675
|
+
if (isHmrUpdating) {
|
|
5676
|
+
// Parent was HMR updated so slot content may have changed.
|
|
5677
|
+
// force update slots and mark instance for hmr as well
|
|
5678
|
+
extend(slots, children);
|
|
5679
|
+
}
|
|
5680
|
+
else if (optimized && type === 1 /* STABLE */) {
|
|
5681
|
+
// compiled AND stable.
|
|
5682
|
+
// no need to update, and skip stale slots removal.
|
|
5683
|
+
needDeletionCheck = false;
|
|
5684
|
+
}
|
|
5685
|
+
else {
|
|
5686
|
+
// compiled but dynamic (v-if/v-for on slots) - update slots, but skip
|
|
5687
|
+
// normalization.
|
|
5688
|
+
extend(slots, children);
|
|
5689
|
+
// #2893
|
|
5690
|
+
// when rendering the optimized slots by manually written render function,
|
|
5691
|
+
// we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
|
|
5692
|
+
// i.e. let the `renderSlot` create the bailed Fragment
|
|
5693
|
+
if (!optimized && type === 1 /* STABLE */) {
|
|
5694
|
+
delete slots._;
|
|
5695
|
+
}
|
|
5696
|
+
}
|
|
5697
|
+
}
|
|
5698
|
+
else {
|
|
5699
|
+
needDeletionCheck = !children.$stable;
|
|
5700
|
+
normalizeObjectSlots(children, slots);
|
|
5701
|
+
}
|
|
5702
|
+
deletionComparisonTarget = children;
|
|
5703
|
+
}
|
|
5704
|
+
else if (children) {
|
|
5705
|
+
// non slot object children (direct value) passed to a component
|
|
5706
|
+
normalizeVNodeSlots(instance, children);
|
|
5707
|
+
deletionComparisonTarget = { default: 1 };
|
|
5708
|
+
}
|
|
5709
|
+
// delete stale slots
|
|
5710
|
+
if (needDeletionCheck) {
|
|
5711
|
+
for (const key in slots) {
|
|
5712
|
+
if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
|
|
5713
|
+
delete slots[key];
|
|
5714
|
+
}
|
|
5715
|
+
}
|
|
5716
|
+
}
|
|
5717
|
+
};
|
|
5718
|
+
|
|
5719
|
+
function createAppContext() {
|
|
5720
|
+
return {
|
|
5721
|
+
app: null,
|
|
5722
|
+
config: {
|
|
5723
|
+
isNativeTag: NO,
|
|
5724
|
+
performance: false,
|
|
5725
|
+
globalProperties: {},
|
|
5726
|
+
optionMergeStrategies: {},
|
|
5727
|
+
errorHandler: undefined,
|
|
5728
|
+
warnHandler: undefined,
|
|
5729
|
+
compilerOptions: {}
|
|
5730
|
+
},
|
|
5731
|
+
mixins: [],
|
|
5732
|
+
components: {},
|
|
5733
|
+
directives: {},
|
|
5734
|
+
provides: Object.create(null),
|
|
5735
|
+
optionsCache: new WeakMap(),
|
|
5736
|
+
propsCache: new WeakMap(),
|
|
5737
|
+
emitsCache: new WeakMap()
|
|
5738
|
+
};
|
|
5739
|
+
}
|
|
5740
|
+
let uid = 0;
|
|
5741
|
+
function createAppAPI(render, hydrate) {
|
|
5742
|
+
return function createApp(rootComponent, rootProps = null) {
|
|
5743
|
+
if (!isFunction(rootComponent)) {
|
|
5744
|
+
rootComponent = Object.assign({}, rootComponent);
|
|
5745
|
+
}
|
|
5746
|
+
if (rootProps != null && !isObject(rootProps)) {
|
|
5747
|
+
warn$1(`root props passed to app.mount() must be an object.`);
|
|
5748
|
+
rootProps = null;
|
|
5749
|
+
}
|
|
5750
|
+
const context = createAppContext();
|
|
5751
|
+
const installedPlugins = new Set();
|
|
5752
|
+
let isMounted = false;
|
|
5753
|
+
const app = (context.app = {
|
|
5754
|
+
_uid: uid++,
|
|
5755
|
+
_component: rootComponent,
|
|
5756
|
+
_props: rootProps,
|
|
5757
|
+
_container: null,
|
|
5758
|
+
_context: context,
|
|
5759
|
+
_instance: null,
|
|
5760
|
+
version,
|
|
5761
|
+
get config() {
|
|
5762
|
+
return context.config;
|
|
5763
|
+
},
|
|
5764
|
+
set config(v) {
|
|
5765
|
+
{
|
|
5766
|
+
warn$1(`app.config cannot be replaced. Modify individual options instead.`);
|
|
5767
|
+
}
|
|
5768
|
+
},
|
|
5769
|
+
use(plugin, ...options) {
|
|
5770
|
+
if (installedPlugins.has(plugin)) {
|
|
5771
|
+
warn$1(`Plugin has already been applied to target app.`);
|
|
5772
|
+
}
|
|
5773
|
+
else if (plugin && isFunction(plugin.install)) {
|
|
5774
|
+
installedPlugins.add(plugin);
|
|
5775
|
+
plugin.install(app, ...options);
|
|
5776
|
+
}
|
|
5777
|
+
else if (isFunction(plugin)) {
|
|
5778
|
+
installedPlugins.add(plugin);
|
|
5254
5779
|
plugin(app, ...options);
|
|
5255
5780
|
}
|
|
5256
5781
|
else {
|
|
@@ -5299,6 +5824,12 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
5299
5824
|
},
|
|
5300
5825
|
mount(rootContainer, isHydrate, isSVG) {
|
|
5301
5826
|
if (!isMounted) {
|
|
5827
|
+
// #5571
|
|
5828
|
+
if (rootContainer.__vue_app__) {
|
|
5829
|
+
warn$1(`There is already an app instance mounted on the host container.\n` +
|
|
5830
|
+
` If you want to mount another app on the same host container,` +
|
|
5831
|
+
` you need to unmount the previous app by calling \`app.unmount()\` first.`);
|
|
5832
|
+
}
|
|
5302
5833
|
const vnode = createVNode(rootComponent, rootProps);
|
|
5303
5834
|
// store app context on the root VNode.
|
|
5304
5835
|
// this will be set on the root instance on initial mount.
|
|
@@ -5349,8 +5880,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
5349
5880
|
warn$1(`App already provides property with key "${String(key)}". ` +
|
|
5350
5881
|
`It will be overwritten with the new value.`);
|
|
5351
5882
|
}
|
|
5352
|
-
// TypeScript doesn't allow symbols as index type
|
|
5353
|
-
// https://github.com/Microsoft/TypeScript/issues/24587
|
|
5354
5883
|
context.provides[key] = value;
|
|
5355
5884
|
return app;
|
|
5356
5885
|
}
|
|
@@ -5467,7 +5996,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
5467
5996
|
// Hydration also depends on some renderer internal logic which needs to be
|
|
5468
5997
|
// passed in via arguments.
|
|
5469
5998
|
function createHydrationFunctions(rendererInternals) {
|
|
5470
|
-
const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
|
|
5999
|
+
const { mt: mountComponent, p: patch, o: { patchProp, createText, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
|
|
5471
6000
|
const hydrate = (vnode, container) => {
|
|
5472
6001
|
if (!container.hasChildNodes()) {
|
|
5473
6002
|
warn$1(`Attempting to hydrate existing markup but container is empty. ` +
|
|
@@ -5487,14 +6016,26 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
5487
6016
|
const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
|
5488
6017
|
const isFragmentStart = isComment(node) && node.data === '[';
|
|
5489
6018
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
5490
|
-
const { type, ref, shapeFlag } = vnode;
|
|
6019
|
+
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
5491
6020
|
const domType = node.nodeType;
|
|
5492
6021
|
vnode.el = node;
|
|
6022
|
+
if (patchFlag === -2 /* BAIL */) {
|
|
6023
|
+
optimized = false;
|
|
6024
|
+
vnode.dynamicChildren = null;
|
|
6025
|
+
}
|
|
5493
6026
|
let nextNode = null;
|
|
5494
6027
|
switch (type) {
|
|
5495
6028
|
case Text:
|
|
5496
6029
|
if (domType !== 3 /* TEXT */) {
|
|
5497
|
-
|
|
6030
|
+
// #5728 empty text node inside a slot can cause hydration failure
|
|
6031
|
+
// because the server rendered HTML won't contain a text node
|
|
6032
|
+
if (vnode.children === '') {
|
|
6033
|
+
insert((vnode.el = createText('')), node.parentElement, node);
|
|
6034
|
+
nextNode = node;
|
|
6035
|
+
}
|
|
6036
|
+
else {
|
|
6037
|
+
nextNode = onMismatch();
|
|
6038
|
+
}
|
|
5498
6039
|
}
|
|
5499
6040
|
else {
|
|
5500
6041
|
if (node.data !== vnode.children) {
|
|
@@ -5568,6 +6109,12 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
5568
6109
|
nextNode = isFragmentStart
|
|
5569
6110
|
? locateClosingAsyncAnchor(node)
|
|
5570
6111
|
: nextSibling(node);
|
|
6112
|
+
// #4293 teleport as component root
|
|
6113
|
+
if (nextNode &&
|
|
6114
|
+
isComment(nextNode) &&
|
|
6115
|
+
nextNode.data === 'teleport end') {
|
|
6116
|
+
nextNode = nextSibling(nextNode);
|
|
6117
|
+
}
|
|
5571
6118
|
// #3787
|
|
5572
6119
|
// if component is async, it may get moved / unmounted before its
|
|
5573
6120
|
// inner component is loaded, so we need to give it a placeholder
|
|
@@ -6231,8 +6778,9 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
6231
6778
|
const fragmentStartAnchor = (n2.el = n1 ? n1.el : hostCreateText(''));
|
|
6232
6779
|
const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
|
|
6233
6780
|
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
|
6234
|
-
if (
|
|
6235
|
-
|
|
6781
|
+
if (// #5523 dev root fragment may inherit directives
|
|
6782
|
+
(isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
|
|
6783
|
+
// HMR updated / Dev root fragment (w/ comments), force full diff
|
|
6236
6784
|
patchFlag = 0;
|
|
6237
6785
|
optimized = false;
|
|
6238
6786
|
dynamicChildren = null;
|
|
@@ -6366,7 +6914,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
6366
6914
|
}
|
|
6367
6915
|
else {
|
|
6368
6916
|
// no update needed. just copy over properties
|
|
6369
|
-
n2.component = n1.component;
|
|
6370
6917
|
n2.el = n1.el;
|
|
6371
6918
|
instance.vnode = n2;
|
|
6372
6919
|
}
|
|
@@ -6449,7 +6996,10 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
6449
6996
|
// activated hook for keep-alive roots.
|
|
6450
6997
|
// #1742 activated hook must be accessed after first render
|
|
6451
6998
|
// since the hook may be injected by a child keep-alive
|
|
6452
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */
|
|
6999
|
+
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
7000
|
+
(parent &&
|
|
7001
|
+
isAsyncWrapper(parent.vnode) &&
|
|
7002
|
+
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
6453
7003
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
6454
7004
|
}
|
|
6455
7005
|
instance.isMounted = true;
|
|
@@ -6532,9 +7082,9 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
6532
7082
|
}
|
|
6533
7083
|
};
|
|
6534
7084
|
// create reactive effect for rendering
|
|
6535
|
-
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(
|
|
7085
|
+
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(update), instance.scope // track it in component's effect scope
|
|
6536
7086
|
));
|
|
6537
|
-
const update = (instance.update = effect.run
|
|
7087
|
+
const update = (instance.update = () => effect.run());
|
|
6538
7088
|
update.id = instance.uid;
|
|
6539
7089
|
// allowRecurse
|
|
6540
7090
|
// #1801, #2043 component render effects should allow recursive updates
|
|
@@ -6546,7 +7096,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
6546
7096
|
effect.onTrigger = instance.rtg
|
|
6547
7097
|
? e => invokeArrayFns(instance.rtg, e)
|
|
6548
7098
|
: void 0;
|
|
6549
|
-
// @ts-ignore (for scheduler)
|
|
6550
7099
|
update.ownerInstance = instance;
|
|
6551
7100
|
}
|
|
6552
7101
|
update();
|
|
@@ -6930,7 +7479,22 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
6930
7479
|
const remove = vnode => {
|
|
6931
7480
|
const { type, el, anchor, transition } = vnode;
|
|
6932
7481
|
if (type === Fragment) {
|
|
6933
|
-
|
|
7482
|
+
if (vnode.patchFlag > 0 &&
|
|
7483
|
+
vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
|
|
7484
|
+
transition &&
|
|
7485
|
+
!transition.persisted) {
|
|
7486
|
+
vnode.children.forEach(child => {
|
|
7487
|
+
if (child.type === Comment) {
|
|
7488
|
+
hostRemove(child.el);
|
|
7489
|
+
}
|
|
7490
|
+
else {
|
|
7491
|
+
remove(child);
|
|
7492
|
+
}
|
|
7493
|
+
});
|
|
7494
|
+
}
|
|
7495
|
+
else {
|
|
7496
|
+
removeFragment(el, anchor);
|
|
7497
|
+
}
|
|
6934
7498
|
return;
|
|
6935
7499
|
}
|
|
6936
7500
|
if (type === Static) {
|
|
@@ -7323,89 +7887,29 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
7323
7887
|
}
|
|
7324
7888
|
else {
|
|
7325
7889
|
vnode.anchor = nextSibling(node);
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
7344
|
-
}
|
|
7345
|
-
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
7346
|
-
/**
|
|
7347
|
-
* @private
|
|
7348
|
-
*/
|
|
7349
|
-
function resolveDynamicComponent(component) {
|
|
7350
|
-
if (isString(component)) {
|
|
7351
|
-
return resolveAsset(COMPONENTS, component, false) || component;
|
|
7352
|
-
}
|
|
7353
|
-
else {
|
|
7354
|
-
// invalid types will fallthrough to createVNode and raise warning
|
|
7355
|
-
return (component || NULL_DYNAMIC_COMPONENT);
|
|
7356
|
-
}
|
|
7357
|
-
}
|
|
7358
|
-
/**
|
|
7359
|
-
* @private
|
|
7360
|
-
*/
|
|
7361
|
-
function resolveDirective(name) {
|
|
7362
|
-
return resolveAsset(DIRECTIVES, name);
|
|
7363
|
-
}
|
|
7364
|
-
// implementation
|
|
7365
|
-
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
7366
|
-
const instance = currentRenderingInstance || currentInstance;
|
|
7367
|
-
if (instance) {
|
|
7368
|
-
const Component = instance.type;
|
|
7369
|
-
// explicit self name has highest priority
|
|
7370
|
-
if (type === COMPONENTS) {
|
|
7371
|
-
const selfName = getComponentName(Component);
|
|
7372
|
-
if (selfName &&
|
|
7373
|
-
(selfName === name ||
|
|
7374
|
-
selfName === camelize(name) ||
|
|
7375
|
-
selfName === capitalize(camelize(name)))) {
|
|
7376
|
-
return Component;
|
|
7377
|
-
}
|
|
7378
|
-
}
|
|
7379
|
-
const res =
|
|
7380
|
-
// local registration
|
|
7381
|
-
// check instance[type] first which is resolved for options API
|
|
7382
|
-
resolve(instance[type] || Component[type], name) ||
|
|
7383
|
-
// global registration
|
|
7384
|
-
resolve(instance.appContext[type], name);
|
|
7385
|
-
if (!res && maybeSelfReference) {
|
|
7386
|
-
// fallback to implicit self-reference
|
|
7387
|
-
return Component;
|
|
7388
|
-
}
|
|
7389
|
-
if (warnMissing && !res) {
|
|
7390
|
-
const extra = type === COMPONENTS
|
|
7391
|
-
? `\nIf this is a native custom element, make sure to exclude it from ` +
|
|
7392
|
-
`component resolution via compilerOptions.isCustomElement.`
|
|
7393
|
-
: ``;
|
|
7394
|
-
warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
|
7890
|
+
// lookahead until we find the target anchor
|
|
7891
|
+
// we cannot rely on return value of hydrateChildren() because there
|
|
7892
|
+
// could be nested teleports
|
|
7893
|
+
let targetAnchor = targetNode;
|
|
7894
|
+
while (targetAnchor) {
|
|
7895
|
+
targetAnchor = nextSibling(targetAnchor);
|
|
7896
|
+
if (targetAnchor &&
|
|
7897
|
+
targetAnchor.nodeType === 8 &&
|
|
7898
|
+
targetAnchor.data === 'teleport anchor') {
|
|
7899
|
+
vnode.targetAnchor = targetAnchor;
|
|
7900
|
+
target._lpa =
|
|
7901
|
+
vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
|
7902
|
+
break;
|
|
7903
|
+
}
|
|
7904
|
+
}
|
|
7905
|
+
hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
7906
|
+
}
|
|
7395
7907
|
}
|
|
7396
|
-
return res;
|
|
7397
|
-
}
|
|
7398
|
-
else {
|
|
7399
|
-
warn$1(`resolve${capitalize(type.slice(0, -1))} ` +
|
|
7400
|
-
`can only be used in render() or setup().`);
|
|
7401
7908
|
}
|
|
7909
|
+
return vnode.anchor && nextSibling(vnode.anchor);
|
|
7402
7910
|
}
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
(registry[name] ||
|
|
7406
|
-
registry[camelize(name)] ||
|
|
7407
|
-
registry[capitalize(camelize(name))]));
|
|
7408
|
-
}
|
|
7911
|
+
// Force-casted public typing for h and TSX props inference
|
|
7912
|
+
const Teleport = TeleportImpl;
|
|
7409
7913
|
|
|
7410
7914
|
const Fragment = Symbol('Fragment' );
|
|
7411
7915
|
const Text = Symbol('Text' );
|
|
@@ -7609,6 +8113,15 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
7609
8113
|
if (children) {
|
|
7610
8114
|
normalizeChildren(cloned, children);
|
|
7611
8115
|
}
|
|
8116
|
+
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
8117
|
+
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
8118
|
+
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
8119
|
+
}
|
|
8120
|
+
else {
|
|
8121
|
+
currentBlock.push(cloned);
|
|
8122
|
+
}
|
|
8123
|
+
}
|
|
8124
|
+
cloned.patchFlag |= -2 /* BAIL */;
|
|
7612
8125
|
return cloned;
|
|
7613
8126
|
}
|
|
7614
8127
|
// class component normalization.
|
|
@@ -7684,602 +8197,196 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
7684
8197
|
scopeId: vnode.scopeId,
|
|
7685
8198
|
slotScopeIds: vnode.slotScopeIds,
|
|
7686
8199
|
children: patchFlag === -1 /* HOISTED */ && isArray(children)
|
|
7687
|
-
? children.map(deepCloneVNode)
|
|
7688
|
-
: children,
|
|
7689
|
-
target: vnode.target,
|
|
7690
|
-
targetAnchor: vnode.targetAnchor,
|
|
7691
|
-
staticCount: vnode.staticCount,
|
|
7692
|
-
shapeFlag: vnode.shapeFlag,
|
|
7693
|
-
// if the vnode is cloned with extra props, we can no longer assume its
|
|
7694
|
-
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
7695
|
-
// note: preserve flag for fragments since they use the flag for children
|
|
7696
|
-
// fast paths only.
|
|
7697
|
-
patchFlag: extraProps && vnode.type !== Fragment
|
|
7698
|
-
? patchFlag === -1 // hoisted node
|
|
7699
|
-
? 16 /* FULL_PROPS */
|
|
7700
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
7701
|
-
: patchFlag,
|
|
7702
|
-
dynamicProps: vnode.dynamicProps,
|
|
7703
|
-
dynamicChildren: vnode.dynamicChildren,
|
|
7704
|
-
appContext: vnode.appContext,
|
|
7705
|
-
dirs: vnode.dirs,
|
|
7706
|
-
transition: vnode.transition,
|
|
7707
|
-
// These should technically only be non-null on mounted VNodes. However,
|
|
7708
|
-
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
7709
|
-
// them since them being non-null during a mount doesn't affect the logic as
|
|
7710
|
-
// they will simply be overwritten.
|
|
7711
|
-
component: vnode.component,
|
|
7712
|
-
suspense: vnode.suspense,
|
|
7713
|
-
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
7714
|
-
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
7715
|
-
el: vnode.el,
|
|
7716
|
-
anchor: vnode.anchor
|
|
7717
|
-
};
|
|
7718
|
-
return cloned;
|
|
7719
|
-
}
|
|
7720
|
-
/**
|
|
7721
|
-
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
7722
|
-
* https://github.com/vitejs/vite/issues/2022
|
|
7723
|
-
*/
|
|
7724
|
-
function deepCloneVNode(vnode) {
|
|
7725
|
-
const cloned = cloneVNode(vnode);
|
|
7726
|
-
if (isArray(vnode.children)) {
|
|
7727
|
-
cloned.children = vnode.children.map(deepCloneVNode);
|
|
7728
|
-
}
|
|
7729
|
-
return cloned;
|
|
7730
|
-
}
|
|
7731
|
-
/**
|
|
7732
|
-
* @private
|
|
7733
|
-
*/
|
|
7734
|
-
function createTextVNode(text = ' ', flag = 0) {
|
|
7735
|
-
return createVNode(Text, null, text, flag);
|
|
7736
|
-
}
|
|
7737
|
-
/**
|
|
7738
|
-
* @private
|
|
7739
|
-
*/
|
|
7740
|
-
function createStaticVNode(content, numberOfNodes) {
|
|
7741
|
-
// A static vnode can contain multiple stringified elements, and the number
|
|
7742
|
-
// of elements is necessary for hydration.
|
|
7743
|
-
const vnode = createVNode(Static, null, content);
|
|
7744
|
-
vnode.staticCount = numberOfNodes;
|
|
7745
|
-
return vnode;
|
|
7746
|
-
}
|
|
7747
|
-
/**
|
|
7748
|
-
* @private
|
|
7749
|
-
*/
|
|
7750
|
-
function createCommentVNode(text = '',
|
|
7751
|
-
// when used as the v-else branch, the comment node must be created as a
|
|
7752
|
-
// block to ensure correct updates.
|
|
7753
|
-
asBlock = false) {
|
|
7754
|
-
return asBlock
|
|
7755
|
-
? (openBlock(), createBlock(Comment, null, text))
|
|
7756
|
-
: createVNode(Comment, null, text);
|
|
7757
|
-
}
|
|
7758
|
-
function normalizeVNode(child) {
|
|
7759
|
-
if (child == null || typeof child === 'boolean') {
|
|
7760
|
-
// empty placeholder
|
|
7761
|
-
return createVNode(Comment);
|
|
7762
|
-
}
|
|
7763
|
-
else if (isArray(child)) {
|
|
7764
|
-
// fragment
|
|
7765
|
-
return createVNode(Fragment, null,
|
|
7766
|
-
// #3666, avoid reference pollution when reusing vnode
|
|
7767
|
-
child.slice());
|
|
7768
|
-
}
|
|
7769
|
-
else if (typeof child === 'object') {
|
|
7770
|
-
// already vnode, this should be the most common since compiled templates
|
|
7771
|
-
// always produce all-vnode children arrays
|
|
7772
|
-
return cloneIfMounted(child);
|
|
7773
|
-
}
|
|
7774
|
-
else {
|
|
7775
|
-
// strings and numbers
|
|
7776
|
-
return createVNode(Text, null, String(child));
|
|
7777
|
-
}
|
|
7778
|
-
}
|
|
7779
|
-
// optimized normalization for template-compiled render fns
|
|
7780
|
-
function cloneIfMounted(child) {
|
|
7781
|
-
return child.el === null || child.memo ? child : cloneVNode(child);
|
|
7782
|
-
}
|
|
7783
|
-
function normalizeChildren(vnode, children) {
|
|
7784
|
-
let type = 0;
|
|
7785
|
-
const { shapeFlag } = vnode;
|
|
7786
|
-
if (children == null) {
|
|
7787
|
-
children = null;
|
|
7788
|
-
}
|
|
7789
|
-
else if (isArray(children)) {
|
|
7790
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
7791
|
-
}
|
|
7792
|
-
else if (typeof children === 'object') {
|
|
7793
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
7794
|
-
// Normalize slot to plain children for plain element and Teleport
|
|
7795
|
-
const slot = children.default;
|
|
7796
|
-
if (slot) {
|
|
7797
|
-
// _c marker is added by withCtx() indicating this is a compiled slot
|
|
7798
|
-
slot._c && (slot._d = false);
|
|
7799
|
-
normalizeChildren(vnode, slot());
|
|
7800
|
-
slot._c && (slot._d = true);
|
|
7801
|
-
}
|
|
7802
|
-
return;
|
|
7803
|
-
}
|
|
7804
|
-
else {
|
|
7805
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
7806
|
-
const slotFlag = children._;
|
|
7807
|
-
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
7808
|
-
children._ctx = currentRenderingInstance;
|
|
7809
|
-
}
|
|
7810
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
7811
|
-
// a child component receives forwarded slots from the parent.
|
|
7812
|
-
// its slot type is determined by its parent's slot type.
|
|
7813
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
7814
|
-
children._ = 1 /* STABLE */;
|
|
7815
|
-
}
|
|
7816
|
-
else {
|
|
7817
|
-
children._ = 2 /* DYNAMIC */;
|
|
7818
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
7819
|
-
}
|
|
7820
|
-
}
|
|
7821
|
-
}
|
|
7822
|
-
}
|
|
7823
|
-
else if (isFunction(children)) {
|
|
7824
|
-
children = { default: children, _ctx: currentRenderingInstance };
|
|
7825
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
7826
|
-
}
|
|
7827
|
-
else {
|
|
7828
|
-
children = String(children);
|
|
7829
|
-
// force teleport children to array so it can be moved around
|
|
7830
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
7831
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
7832
|
-
children = [createTextVNode(children)];
|
|
7833
|
-
}
|
|
7834
|
-
else {
|
|
7835
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
7836
|
-
}
|
|
7837
|
-
}
|
|
7838
|
-
vnode.children = children;
|
|
7839
|
-
vnode.shapeFlag |= type;
|
|
7840
|
-
}
|
|
7841
|
-
function mergeProps(...args) {
|
|
7842
|
-
const ret = {};
|
|
7843
|
-
for (let i = 0; i < args.length; i++) {
|
|
7844
|
-
const toMerge = args[i];
|
|
7845
|
-
for (const key in toMerge) {
|
|
7846
|
-
if (key === 'class') {
|
|
7847
|
-
if (ret.class !== toMerge.class) {
|
|
7848
|
-
ret.class = normalizeClass([ret.class, toMerge.class]);
|
|
7849
|
-
}
|
|
7850
|
-
}
|
|
7851
|
-
else if (key === 'style') {
|
|
7852
|
-
ret.style = normalizeStyle([ret.style, toMerge.style]);
|
|
7853
|
-
}
|
|
7854
|
-
else if (isOn(key)) {
|
|
7855
|
-
const existing = ret[key];
|
|
7856
|
-
const incoming = toMerge[key];
|
|
7857
|
-
if (incoming &&
|
|
7858
|
-
existing !== incoming &&
|
|
7859
|
-
!(isArray(existing) && existing.includes(incoming))) {
|
|
7860
|
-
ret[key] = existing
|
|
7861
|
-
? [].concat(existing, incoming)
|
|
7862
|
-
: incoming;
|
|
7863
|
-
}
|
|
7864
|
-
}
|
|
7865
|
-
else if (key !== '') {
|
|
7866
|
-
ret[key] = toMerge[key];
|
|
7867
|
-
}
|
|
7868
|
-
}
|
|
7869
|
-
}
|
|
7870
|
-
return ret;
|
|
7871
|
-
}
|
|
7872
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
7873
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
7874
|
-
vnode,
|
|
7875
|
-
prevVNode
|
|
7876
|
-
]);
|
|
7877
|
-
}
|
|
7878
|
-
|
|
7879
|
-
/**
|
|
7880
|
-
* Actual implementation
|
|
7881
|
-
*/
|
|
7882
|
-
function renderList(source, renderItem, cache, index) {
|
|
7883
|
-
let ret;
|
|
7884
|
-
const cached = (cache && cache[index]);
|
|
7885
|
-
if (isArray(source) || isString(source)) {
|
|
7886
|
-
ret = new Array(source.length);
|
|
7887
|
-
for (let i = 0, l = source.length; i < l; i++) {
|
|
7888
|
-
ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
|
|
7889
|
-
}
|
|
7890
|
-
}
|
|
7891
|
-
else if (typeof source === 'number') {
|
|
7892
|
-
if (!Number.isInteger(source)) {
|
|
7893
|
-
warn$1(`The v-for range expect an integer value but got ${source}.`);
|
|
7894
|
-
return [];
|
|
7895
|
-
}
|
|
7896
|
-
ret = new Array(source);
|
|
7897
|
-
for (let i = 0; i < source; i++) {
|
|
7898
|
-
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
7899
|
-
}
|
|
7900
|
-
}
|
|
7901
|
-
else if (isObject(source)) {
|
|
7902
|
-
if (source[Symbol.iterator]) {
|
|
7903
|
-
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
7904
|
-
}
|
|
7905
|
-
else {
|
|
7906
|
-
const keys = Object.keys(source);
|
|
7907
|
-
ret = new Array(keys.length);
|
|
7908
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
7909
|
-
const key = keys[i];
|
|
7910
|
-
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
7911
|
-
}
|
|
7912
|
-
}
|
|
7913
|
-
}
|
|
7914
|
-
else {
|
|
7915
|
-
ret = [];
|
|
7916
|
-
}
|
|
7917
|
-
if (cache) {
|
|
7918
|
-
cache[index] = ret;
|
|
7919
|
-
}
|
|
7920
|
-
return ret;
|
|
7921
|
-
}
|
|
7922
|
-
|
|
8200
|
+
? children.map(deepCloneVNode)
|
|
8201
|
+
: children,
|
|
8202
|
+
target: vnode.target,
|
|
8203
|
+
targetAnchor: vnode.targetAnchor,
|
|
8204
|
+
staticCount: vnode.staticCount,
|
|
8205
|
+
shapeFlag: vnode.shapeFlag,
|
|
8206
|
+
// if the vnode is cloned with extra props, we can no longer assume its
|
|
8207
|
+
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
8208
|
+
// note: preserve flag for fragments since they use the flag for children
|
|
8209
|
+
// fast paths only.
|
|
8210
|
+
patchFlag: extraProps && vnode.type !== Fragment
|
|
8211
|
+
? patchFlag === -1 // hoisted node
|
|
8212
|
+
? 16 /* FULL_PROPS */
|
|
8213
|
+
: patchFlag | 16 /* FULL_PROPS */
|
|
8214
|
+
: patchFlag,
|
|
8215
|
+
dynamicProps: vnode.dynamicProps,
|
|
8216
|
+
dynamicChildren: vnode.dynamicChildren,
|
|
8217
|
+
appContext: vnode.appContext,
|
|
8218
|
+
dirs: vnode.dirs,
|
|
8219
|
+
transition: vnode.transition,
|
|
8220
|
+
// These should technically only be non-null on mounted VNodes. However,
|
|
8221
|
+
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
8222
|
+
// them since them being non-null during a mount doesn't affect the logic as
|
|
8223
|
+
// they will simply be overwritten.
|
|
8224
|
+
component: vnode.component,
|
|
8225
|
+
suspense: vnode.suspense,
|
|
8226
|
+
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
8227
|
+
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
8228
|
+
el: vnode.el,
|
|
8229
|
+
anchor: vnode.anchor
|
|
8230
|
+
};
|
|
8231
|
+
return cloned;
|
|
8232
|
+
}
|
|
7923
8233
|
/**
|
|
7924
|
-
*
|
|
7925
|
-
*
|
|
8234
|
+
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
8235
|
+
* https://github.com/vitejs/vite/issues/2022
|
|
7926
8236
|
*/
|
|
7927
|
-
function
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
if (isArray(slot)) {
|
|
7932
|
-
for (let j = 0; j < slot.length; j++) {
|
|
7933
|
-
slots[slot[j].name] = slot[j].fn;
|
|
7934
|
-
}
|
|
7935
|
-
}
|
|
7936
|
-
else if (slot) {
|
|
7937
|
-
// conditional single slot generated by <template v-if="..." #foo>
|
|
7938
|
-
slots[slot.name] = slot.fn;
|
|
7939
|
-
}
|
|
8237
|
+
function deepCloneVNode(vnode) {
|
|
8238
|
+
const cloned = cloneVNode(vnode);
|
|
8239
|
+
if (isArray(vnode.children)) {
|
|
8240
|
+
cloned.children = vnode.children.map(deepCloneVNode);
|
|
7940
8241
|
}
|
|
7941
|
-
return
|
|
7942
|
-
}
|
|
7943
|
-
|
|
8242
|
+
return cloned;
|
|
8243
|
+
}
|
|
7944
8244
|
/**
|
|
7945
|
-
* Compiler runtime helper for rendering `<slot/>`
|
|
7946
8245
|
* @private
|
|
7947
8246
|
*/
|
|
7948
|
-
function
|
|
7949
|
-
|
|
7950
|
-
// the compiler and guaranteed to be a function returning an array
|
|
7951
|
-
fallback, noSlotted) {
|
|
7952
|
-
if (currentRenderingInstance.isCE) {
|
|
7953
|
-
return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
|
|
7954
|
-
}
|
|
7955
|
-
let slot = slots[name];
|
|
7956
|
-
if (slot && slot.length > 1) {
|
|
7957
|
-
warn$1(`SSR-optimized slot function detected in a non-SSR-optimized render ` +
|
|
7958
|
-
`function. You need to mark this component with $dynamic-slots in the ` +
|
|
7959
|
-
`parent template.`);
|
|
7960
|
-
slot = () => [];
|
|
7961
|
-
}
|
|
7962
|
-
// a compiled slot disables block tracking by default to avoid manual
|
|
7963
|
-
// invocation interfering with template-based block tracking, but in
|
|
7964
|
-
// `renderSlot` we can be sure that it's template-based so we can force
|
|
7965
|
-
// enable it.
|
|
7966
|
-
if (slot && slot._c) {
|
|
7967
|
-
slot._d = false;
|
|
7968
|
-
}
|
|
7969
|
-
openBlock();
|
|
7970
|
-
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
7971
|
-
const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
|
|
7972
|
-
? 64 /* STABLE_FRAGMENT */
|
|
7973
|
-
: -2 /* BAIL */);
|
|
7974
|
-
if (!noSlotted && rendered.scopeId) {
|
|
7975
|
-
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
7976
|
-
}
|
|
7977
|
-
if (slot && slot._c) {
|
|
7978
|
-
slot._d = true;
|
|
7979
|
-
}
|
|
7980
|
-
return rendered;
|
|
8247
|
+
function createTextVNode(text = ' ', flag = 0) {
|
|
8248
|
+
return createVNode(Text, null, text, flag);
|
|
7981
8249
|
}
|
|
7982
|
-
function ensureValidVNode(vnodes) {
|
|
7983
|
-
return vnodes.some(child => {
|
|
7984
|
-
if (!isVNode(child))
|
|
7985
|
-
return true;
|
|
7986
|
-
if (child.type === Comment)
|
|
7987
|
-
return false;
|
|
7988
|
-
if (child.type === Fragment &&
|
|
7989
|
-
!ensureValidVNode(child.children))
|
|
7990
|
-
return false;
|
|
7991
|
-
return true;
|
|
7992
|
-
})
|
|
7993
|
-
? vnodes
|
|
7994
|
-
: null;
|
|
7995
|
-
}
|
|
7996
|
-
|
|
7997
8250
|
/**
|
|
7998
|
-
* For prefixing keys in v-on="obj" with "on"
|
|
7999
8251
|
* @private
|
|
8000
8252
|
*/
|
|
8001
|
-
function
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
return
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
// prototype) to memoize what access type a key corresponds to.
|
|
8063
|
-
let normalizedProps;
|
|
8064
|
-
if (key[0] !== '$') {
|
|
8065
|
-
const n = accessCache[key];
|
|
8066
|
-
if (n !== undefined) {
|
|
8067
|
-
switch (n) {
|
|
8068
|
-
case 1 /* SETUP */:
|
|
8069
|
-
return setupState[key];
|
|
8070
|
-
case 2 /* DATA */:
|
|
8071
|
-
return data[key];
|
|
8072
|
-
case 4 /* CONTEXT */:
|
|
8073
|
-
return ctx[key];
|
|
8074
|
-
case 3 /* PROPS */:
|
|
8075
|
-
return props[key];
|
|
8076
|
-
// default: just fallthrough
|
|
8077
|
-
}
|
|
8078
|
-
}
|
|
8079
|
-
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
8080
|
-
accessCache[key] = 1 /* SETUP */;
|
|
8081
|
-
return setupState[key];
|
|
8082
|
-
}
|
|
8083
|
-
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
8084
|
-
accessCache[key] = 2 /* DATA */;
|
|
8085
|
-
return data[key];
|
|
8086
|
-
}
|
|
8087
|
-
else if (
|
|
8088
|
-
// only cache other properties when instance has declared (thus stable)
|
|
8089
|
-
// props
|
|
8090
|
-
(normalizedProps = instance.propsOptions[0]) &&
|
|
8091
|
-
hasOwn(normalizedProps, key)) {
|
|
8092
|
-
accessCache[key] = 3 /* PROPS */;
|
|
8093
|
-
return props[key];
|
|
8094
|
-
}
|
|
8095
|
-
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
8096
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
8097
|
-
return ctx[key];
|
|
8098
|
-
}
|
|
8099
|
-
else if (shouldCacheAccess) {
|
|
8100
|
-
accessCache[key] = 0 /* OTHER */;
|
|
8101
|
-
}
|
|
8102
|
-
}
|
|
8103
|
-
const publicGetter = publicPropertiesMap[key];
|
|
8104
|
-
let cssModule, globalProperties;
|
|
8105
|
-
// public $xxx properties
|
|
8106
|
-
if (publicGetter) {
|
|
8107
|
-
if (key === '$attrs') {
|
|
8108
|
-
track(instance, "get" /* GET */, key);
|
|
8109
|
-
markAttrsAccessed();
|
|
8110
|
-
}
|
|
8111
|
-
return publicGetter(instance);
|
|
8112
|
-
}
|
|
8113
|
-
else if (
|
|
8114
|
-
// css module (injected by vue-loader)
|
|
8115
|
-
(cssModule = type.__cssModules) &&
|
|
8116
|
-
(cssModule = cssModule[key])) {
|
|
8117
|
-
return cssModule;
|
|
8118
|
-
}
|
|
8119
|
-
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
8120
|
-
// user may set custom properties to `this` that start with `$`
|
|
8121
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
8122
|
-
return ctx[key];
|
|
8123
|
-
}
|
|
8124
|
-
else if (
|
|
8125
|
-
// global properties
|
|
8126
|
-
((globalProperties = appContext.config.globalProperties),
|
|
8127
|
-
hasOwn(globalProperties, key))) {
|
|
8128
|
-
{
|
|
8129
|
-
return globalProperties[key];
|
|
8130
|
-
}
|
|
8131
|
-
}
|
|
8132
|
-
else if (currentRenderingInstance &&
|
|
8133
|
-
(!isString(key) ||
|
|
8134
|
-
// #1091 avoid internal isRef/isVNode checks on component instance leading
|
|
8135
|
-
// to infinite warning loop
|
|
8136
|
-
key.indexOf('__v') !== 0)) {
|
|
8137
|
-
if (data !== EMPTY_OBJ &&
|
|
8138
|
-
(key[0] === '$' || key[0] === '_') &&
|
|
8139
|
-
hasOwn(data, key)) {
|
|
8140
|
-
warn$1(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved ` +
|
|
8141
|
-
`character ("$" or "_") and is not proxied on the render context.`);
|
|
8142
|
-
}
|
|
8143
|
-
else if (instance === currentRenderingInstance) {
|
|
8144
|
-
warn$1(`Property ${JSON.stringify(key)} was accessed during render ` +
|
|
8145
|
-
`but is not defined on instance.`);
|
|
8253
|
+
function createStaticVNode(content, numberOfNodes) {
|
|
8254
|
+
// A static vnode can contain multiple stringified elements, and the number
|
|
8255
|
+
// of elements is necessary for hydration.
|
|
8256
|
+
const vnode = createVNode(Static, null, content);
|
|
8257
|
+
vnode.staticCount = numberOfNodes;
|
|
8258
|
+
return vnode;
|
|
8259
|
+
}
|
|
8260
|
+
/**
|
|
8261
|
+
* @private
|
|
8262
|
+
*/
|
|
8263
|
+
function createCommentVNode(text = '',
|
|
8264
|
+
// when used as the v-else branch, the comment node must be created as a
|
|
8265
|
+
// block to ensure correct updates.
|
|
8266
|
+
asBlock = false) {
|
|
8267
|
+
return asBlock
|
|
8268
|
+
? (openBlock(), createBlock(Comment, null, text))
|
|
8269
|
+
: createVNode(Comment, null, text);
|
|
8270
|
+
}
|
|
8271
|
+
function normalizeVNode(child) {
|
|
8272
|
+
if (child == null || typeof child === 'boolean') {
|
|
8273
|
+
// empty placeholder
|
|
8274
|
+
return createVNode(Comment);
|
|
8275
|
+
}
|
|
8276
|
+
else if (isArray(child)) {
|
|
8277
|
+
// fragment
|
|
8278
|
+
return createVNode(Fragment, null,
|
|
8279
|
+
// #3666, avoid reference pollution when reusing vnode
|
|
8280
|
+
child.slice());
|
|
8281
|
+
}
|
|
8282
|
+
else if (typeof child === 'object') {
|
|
8283
|
+
// already vnode, this should be the most common since compiled templates
|
|
8284
|
+
// always produce all-vnode children arrays
|
|
8285
|
+
return cloneIfMounted(child);
|
|
8286
|
+
}
|
|
8287
|
+
else {
|
|
8288
|
+
// strings and numbers
|
|
8289
|
+
return createVNode(Text, null, String(child));
|
|
8290
|
+
}
|
|
8291
|
+
}
|
|
8292
|
+
// optimized normalization for template-compiled render fns
|
|
8293
|
+
function cloneIfMounted(child) {
|
|
8294
|
+
return child.el === null || child.memo ? child : cloneVNode(child);
|
|
8295
|
+
}
|
|
8296
|
+
function normalizeChildren(vnode, children) {
|
|
8297
|
+
let type = 0;
|
|
8298
|
+
const { shapeFlag } = vnode;
|
|
8299
|
+
if (children == null) {
|
|
8300
|
+
children = null;
|
|
8301
|
+
}
|
|
8302
|
+
else if (isArray(children)) {
|
|
8303
|
+
type = 16 /* ARRAY_CHILDREN */;
|
|
8304
|
+
}
|
|
8305
|
+
else if (typeof children === 'object') {
|
|
8306
|
+
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
8307
|
+
// Normalize slot to plain children for plain element and Teleport
|
|
8308
|
+
const slot = children.default;
|
|
8309
|
+
if (slot) {
|
|
8310
|
+
// _c marker is added by withCtx() indicating this is a compiled slot
|
|
8311
|
+
slot._c && (slot._d = false);
|
|
8312
|
+
normalizeChildren(vnode, slot());
|
|
8313
|
+
slot._c && (slot._d = true);
|
|
8146
8314
|
}
|
|
8147
|
-
|
|
8148
|
-
},
|
|
8149
|
-
set({ _: instance }, key, value) {
|
|
8150
|
-
const { data, setupState, ctx } = instance;
|
|
8151
|
-
if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
8152
|
-
setupState[key] = value;
|
|
8153
|
-
return true;
|
|
8154
|
-
}
|
|
8155
|
-
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
8156
|
-
data[key] = value;
|
|
8157
|
-
return true;
|
|
8158
|
-
}
|
|
8159
|
-
else if (hasOwn(instance.props, key)) {
|
|
8160
|
-
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
|
8161
|
-
return false;
|
|
8162
|
-
}
|
|
8163
|
-
if (key[0] === '$' && key.slice(1) in instance) {
|
|
8164
|
-
warn$1(`Attempting to mutate public property "${key}". ` +
|
|
8165
|
-
`Properties starting with $ are reserved and readonly.`, instance);
|
|
8166
|
-
return false;
|
|
8315
|
+
return;
|
|
8167
8316
|
}
|
|
8168
8317
|
else {
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
value
|
|
8174
|
-
});
|
|
8318
|
+
type = 32 /* SLOTS_CHILDREN */;
|
|
8319
|
+
const slotFlag = children._;
|
|
8320
|
+
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
8321
|
+
children._ctx = currentRenderingInstance;
|
|
8175
8322
|
}
|
|
8176
|
-
else {
|
|
8177
|
-
|
|
8323
|
+
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
8324
|
+
// a child component receives forwarded slots from the parent.
|
|
8325
|
+
// its slot type is determined by its parent's slot type.
|
|
8326
|
+
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
8327
|
+
children._ = 1 /* STABLE */;
|
|
8328
|
+
}
|
|
8329
|
+
else {
|
|
8330
|
+
children._ = 2 /* DYNAMIC */;
|
|
8331
|
+
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
8332
|
+
}
|
|
8178
8333
|
}
|
|
8179
8334
|
}
|
|
8180
|
-
return true;
|
|
8181
|
-
},
|
|
8182
|
-
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
8183
|
-
let normalizedProps;
|
|
8184
|
-
return (!!accessCache[key] ||
|
|
8185
|
-
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
8186
|
-
(setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
|
8187
|
-
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
8188
|
-
hasOwn(ctx, key) ||
|
|
8189
|
-
hasOwn(publicPropertiesMap, key) ||
|
|
8190
|
-
hasOwn(appContext.config.globalProperties, key));
|
|
8191
|
-
},
|
|
8192
|
-
defineProperty(target, key, descriptor) {
|
|
8193
|
-
if (descriptor.get != null) {
|
|
8194
|
-
// invalidate key cache of a getter based property #5417
|
|
8195
|
-
target.$.accessCache[key] = 0;
|
|
8196
|
-
}
|
|
8197
|
-
else if (hasOwn(descriptor, 'value')) {
|
|
8198
|
-
this.set(target, key, descriptor.value, null);
|
|
8199
|
-
}
|
|
8200
|
-
return Reflect.defineProperty(target, key, descriptor);
|
|
8201
8335
|
}
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
// fast path for unscopables when using `with` block
|
|
8213
|
-
if (key === Symbol.unscopables) {
|
|
8214
|
-
return;
|
|
8336
|
+
else if (isFunction(children)) {
|
|
8337
|
+
children = { default: children, _ctx: currentRenderingInstance };
|
|
8338
|
+
type = 32 /* SLOTS_CHILDREN */;
|
|
8339
|
+
}
|
|
8340
|
+
else {
|
|
8341
|
+
children = String(children);
|
|
8342
|
+
// force teleport children to array so it can be moved around
|
|
8343
|
+
if (shapeFlag & 64 /* TELEPORT */) {
|
|
8344
|
+
type = 16 /* ARRAY_CHILDREN */;
|
|
8345
|
+
children = [createTextVNode(children)];
|
|
8215
8346
|
}
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
has(_, key) {
|
|
8219
|
-
const has = key[0] !== '_' && !isGloballyWhitelisted(key);
|
|
8220
|
-
if (!has && PublicInstanceProxyHandlers.has(_, key)) {
|
|
8221
|
-
warn$1(`Property ${JSON.stringify(key)} should not start with _ which is a reserved prefix for Vue internals.`);
|
|
8347
|
+
else {
|
|
8348
|
+
type = 8 /* TEXT_CHILDREN */;
|
|
8222
8349
|
}
|
|
8223
|
-
return has;
|
|
8224
|
-
}
|
|
8225
|
-
});
|
|
8226
|
-
// dev only
|
|
8227
|
-
// In dev mode, the proxy target exposes the same properties as seen on `this`
|
|
8228
|
-
// for easier console inspection. In prod mode it will be an empty object so
|
|
8229
|
-
// these properties definitions can be skipped.
|
|
8230
|
-
function createDevRenderContext(instance) {
|
|
8231
|
-
const target = {};
|
|
8232
|
-
// expose internal instance for proxy handlers
|
|
8233
|
-
Object.defineProperty(target, `_`, {
|
|
8234
|
-
configurable: true,
|
|
8235
|
-
enumerable: false,
|
|
8236
|
-
get: () => instance
|
|
8237
|
-
});
|
|
8238
|
-
// expose public properties
|
|
8239
|
-
Object.keys(publicPropertiesMap).forEach(key => {
|
|
8240
|
-
Object.defineProperty(target, key, {
|
|
8241
|
-
configurable: true,
|
|
8242
|
-
enumerable: false,
|
|
8243
|
-
get: () => publicPropertiesMap[key](instance),
|
|
8244
|
-
// intercepted by the proxy so no need for implementation,
|
|
8245
|
-
// but needed to prevent set errors
|
|
8246
|
-
set: NOOP
|
|
8247
|
-
});
|
|
8248
|
-
});
|
|
8249
|
-
return target;
|
|
8250
|
-
}
|
|
8251
|
-
// dev only
|
|
8252
|
-
function exposePropsOnRenderContext(instance) {
|
|
8253
|
-
const { ctx, propsOptions: [propsOptions] } = instance;
|
|
8254
|
-
if (propsOptions) {
|
|
8255
|
-
Object.keys(propsOptions).forEach(key => {
|
|
8256
|
-
Object.defineProperty(ctx, key, {
|
|
8257
|
-
enumerable: true,
|
|
8258
|
-
configurable: true,
|
|
8259
|
-
get: () => instance.props[key],
|
|
8260
|
-
set: NOOP
|
|
8261
|
-
});
|
|
8262
|
-
});
|
|
8263
8350
|
}
|
|
8351
|
+
vnode.children = children;
|
|
8352
|
+
vnode.shapeFlag |= type;
|
|
8264
8353
|
}
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
if (key
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8354
|
+
function mergeProps(...args) {
|
|
8355
|
+
const ret = {};
|
|
8356
|
+
for (let i = 0; i < args.length; i++) {
|
|
8357
|
+
const toMerge = args[i];
|
|
8358
|
+
for (const key in toMerge) {
|
|
8359
|
+
if (key === 'class') {
|
|
8360
|
+
if (ret.class !== toMerge.class) {
|
|
8361
|
+
ret.class = normalizeClass([ret.class, toMerge.class]);
|
|
8362
|
+
}
|
|
8363
|
+
}
|
|
8364
|
+
else if (key === 'style') {
|
|
8365
|
+
ret.style = normalizeStyle([ret.style, toMerge.style]);
|
|
8366
|
+
}
|
|
8367
|
+
else if (isOn(key)) {
|
|
8368
|
+
const existing = ret[key];
|
|
8369
|
+
const incoming = toMerge[key];
|
|
8370
|
+
if (incoming &&
|
|
8371
|
+
existing !== incoming &&
|
|
8372
|
+
!(isArray(existing) && existing.includes(incoming))) {
|
|
8373
|
+
ret[key] = existing
|
|
8374
|
+
? [].concat(existing, incoming)
|
|
8375
|
+
: incoming;
|
|
8376
|
+
}
|
|
8377
|
+
}
|
|
8378
|
+
else if (key !== '') {
|
|
8379
|
+
ret[key] = toMerge[key];
|
|
8274
8380
|
}
|
|
8275
|
-
Object.defineProperty(ctx, key, {
|
|
8276
|
-
enumerable: true,
|
|
8277
|
-
configurable: true,
|
|
8278
|
-
get: () => setupState[key],
|
|
8279
|
-
set: NOOP
|
|
8280
|
-
});
|
|
8281
8381
|
}
|
|
8282
|
-
}
|
|
8382
|
+
}
|
|
8383
|
+
return ret;
|
|
8384
|
+
}
|
|
8385
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
8386
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
8387
|
+
vnode,
|
|
8388
|
+
prevVNode
|
|
8389
|
+
]);
|
|
8283
8390
|
}
|
|
8284
8391
|
|
|
8285
8392
|
const emptyAppContext = createAppContext();
|
|
@@ -8308,7 +8415,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
8308
8415
|
provides: parent ? parent.provides : Object.create(appContext.provides),
|
|
8309
8416
|
accessCache: null,
|
|
8310
8417
|
renderCache: [],
|
|
8311
|
-
// local
|
|
8418
|
+
// local resolved assets
|
|
8312
8419
|
components: null,
|
|
8313
8420
|
directives: null,
|
|
8314
8421
|
// resolved props and emits options
|
|
@@ -8400,6 +8507,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
8400
8507
|
return setupResult;
|
|
8401
8508
|
}
|
|
8402
8509
|
function setupStatefulComponent(instance, isSSR) {
|
|
8510
|
+
var _a;
|
|
8403
8511
|
const Component = instance.type;
|
|
8404
8512
|
{
|
|
8405
8513
|
if (Component.name) {
|
|
@@ -8457,6 +8565,13 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
8457
8565
|
// async setup returned Promise.
|
|
8458
8566
|
// bail here and wait for re-entry.
|
|
8459
8567
|
instance.asyncDep = setupResult;
|
|
8568
|
+
if (!instance.suspense) {
|
|
8569
|
+
const name = (_a = Component.name) !== null && _a !== void 0 ? _a : 'Anonymous';
|
|
8570
|
+
warn$1(`Component <${name}>: setup function returned a promise, but no ` +
|
|
8571
|
+
`<Suspense> boundary was found in the parent component tree. ` +
|
|
8572
|
+
`A component with async setup() must be nested in a <Suspense> ` +
|
|
8573
|
+
`in order to be rendered.`);
|
|
8574
|
+
}
|
|
8460
8575
|
}
|
|
8461
8576
|
}
|
|
8462
8577
|
else {
|
|
@@ -9056,7 +9171,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9056
9171
|
return false;
|
|
9057
9172
|
}
|
|
9058
9173
|
for (let i = 0; i < prev.length; i++) {
|
|
9059
|
-
if (prev[i]
|
|
9174
|
+
if (hasChanged(prev[i], memo[i])) {
|
|
9060
9175
|
return false;
|
|
9061
9176
|
}
|
|
9062
9177
|
}
|
|
@@ -9068,7 +9183,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9068
9183
|
}
|
|
9069
9184
|
|
|
9070
9185
|
// Core API ------------------------------------------------------------------
|
|
9071
|
-
const version = "3.2.
|
|
9186
|
+
const version = "3.2.34";
|
|
9072
9187
|
/**
|
|
9073
9188
|
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
|
9074
9189
|
* @internal
|
|
@@ -9085,7 +9200,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9085
9200
|
|
|
9086
9201
|
const svgNS = 'http://www.w3.org/2000/svg';
|
|
9087
9202
|
const doc = (typeof document !== 'undefined' ? document : null);
|
|
9088
|
-
const templateContainer = doc && doc.createElement('template');
|
|
9203
|
+
const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
|
|
9089
9204
|
const nodeOps = {
|
|
9090
9205
|
insert: (child, parent, anchor) => {
|
|
9091
9206
|
parent.insertBefore(child, anchor || null);
|
|
@@ -9236,6 +9351,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9236
9351
|
val.forEach(v => setStyle(style, name, v));
|
|
9237
9352
|
}
|
|
9238
9353
|
else {
|
|
9354
|
+
if (val == null)
|
|
9355
|
+
val = '';
|
|
9239
9356
|
if (name.startsWith('--')) {
|
|
9240
9357
|
// custom property definition
|
|
9241
9358
|
style.setProperty(name, val);
|
|
@@ -9330,31 +9447,28 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9330
9447
|
}
|
|
9331
9448
|
return;
|
|
9332
9449
|
}
|
|
9450
|
+
let needRemove = false;
|
|
9333
9451
|
if (value === '' || value == null) {
|
|
9334
9452
|
const type = typeof el[key];
|
|
9335
9453
|
if (type === 'boolean') {
|
|
9336
9454
|
// e.g. <select multiple> compiles to { multiple: '' }
|
|
9337
|
-
|
|
9338
|
-
return;
|
|
9455
|
+
value = includeBooleanAttr(value);
|
|
9339
9456
|
}
|
|
9340
9457
|
else if (value == null && type === 'string') {
|
|
9341
9458
|
// e.g. <div :id="null">
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
return;
|
|
9459
|
+
value = '';
|
|
9460
|
+
needRemove = true;
|
|
9345
9461
|
}
|
|
9346
9462
|
else if (type === 'number') {
|
|
9347
9463
|
// e.g. <img :width="null">
|
|
9348
9464
|
// the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
}
|
|
9352
|
-
catch (_a) { }
|
|
9353
|
-
el.removeAttribute(key);
|
|
9354
|
-
return;
|
|
9465
|
+
value = 0;
|
|
9466
|
+
needRemove = true;
|
|
9355
9467
|
}
|
|
9356
9468
|
}
|
|
9357
|
-
// some properties perform value validation and throw
|
|
9469
|
+
// some properties perform value validation and throw,
|
|
9470
|
+
// some properties has getter, no setter, will error in 'use strict'
|
|
9471
|
+
// eg. <select :type="null"></select> <select :willValidate="null"></select>
|
|
9358
9472
|
try {
|
|
9359
9473
|
el[key] = value;
|
|
9360
9474
|
}
|
|
@@ -9364,31 +9478,35 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9364
9478
|
`value ${value} is invalid.`, e);
|
|
9365
9479
|
}
|
|
9366
9480
|
}
|
|
9481
|
+
needRemove && el.removeAttribute(key);
|
|
9367
9482
|
}
|
|
9368
9483
|
|
|
9369
9484
|
// Async edge case fix requires storing an event listener's attach timestamp.
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9485
|
+
const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
|
|
9486
|
+
let _getNow = Date.now;
|
|
9487
|
+
let skipTimestampCheck = false;
|
|
9488
|
+
if (typeof window !== 'undefined') {
|
|
9489
|
+
// Determine what event timestamp the browser is using. Annoyingly, the
|
|
9490
|
+
// timestamp can either be hi-res (relative to page load) or low-res
|
|
9491
|
+
// (relative to UNIX epoch), so in order to compare time we have to use the
|
|
9492
|
+
// same timestamp type when saving the flush timestamp.
|
|
9493
|
+
if (Date.now() > document.createEvent('Event').timeStamp) {
|
|
9494
|
+
// if the low-res timestamp which is bigger than the event timestamp
|
|
9495
|
+
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
|
9496
|
+
// and we need to use the hi-res version for event listeners as well.
|
|
9497
|
+
_getNow = () => performance.now();
|
|
9498
|
+
}
|
|
9499
|
+
// #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
|
|
9500
|
+
// and does not fire microtasks in between event propagation, so safe to exclude.
|
|
9501
|
+
const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
|
|
9502
|
+
skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
|
|
9503
|
+
}
|
|
9504
|
+
return [_getNow, skipTimestampCheck];
|
|
9505
|
+
})();
|
|
9388
9506
|
// To avoid the overhead of repeatedly calling performance.now(), we cache
|
|
9389
9507
|
// and use the same timestamp for all event listeners attached in the same tick.
|
|
9390
9508
|
let cachedNow = 0;
|
|
9391
|
-
const p = Promise.resolve();
|
|
9509
|
+
const p = /*#__PURE__*/ Promise.resolve();
|
|
9392
9510
|
const reset = () => {
|
|
9393
9511
|
cachedNow = 0;
|
|
9394
9512
|
};
|
|
@@ -9513,13 +9631,13 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9513
9631
|
}
|
|
9514
9632
|
return false;
|
|
9515
9633
|
}
|
|
9516
|
-
//
|
|
9517
|
-
//
|
|
9518
|
-
//
|
|
9519
|
-
//
|
|
9634
|
+
// these are enumerated attrs, however their corresponding DOM properties
|
|
9635
|
+
// are actually booleans - this leads to setting it with a string "false"
|
|
9636
|
+
// value leading it to be coerced to `true`, so we need to always treat
|
|
9637
|
+
// them as attributes.
|
|
9520
9638
|
// Note that `contentEditable` doesn't have this problem: its DOM
|
|
9521
9639
|
// property is also enumerated string values.
|
|
9522
|
-
if (key === 'spellcheck' || key === 'draggable') {
|
|
9640
|
+
if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
|
|
9523
9641
|
return false;
|
|
9524
9642
|
}
|
|
9525
9643
|
// #1787, #2840 form property on form elements is readonly and must be set as
|
|
@@ -9542,11 +9660,11 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9542
9660
|
return key in el;
|
|
9543
9661
|
}
|
|
9544
9662
|
|
|
9545
|
-
function defineCustomElement(options,
|
|
9663
|
+
function defineCustomElement(options, hydrate) {
|
|
9546
9664
|
const Comp = defineComponent(options);
|
|
9547
9665
|
class VueCustomElement extends VueElement {
|
|
9548
9666
|
constructor(initialProps) {
|
|
9549
|
-
super(Comp, initialProps,
|
|
9667
|
+
super(Comp, initialProps, hydrate);
|
|
9550
9668
|
}
|
|
9551
9669
|
}
|
|
9552
9670
|
VueCustomElement.def = Comp;
|
|
@@ -9894,7 +10012,10 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9894
10012
|
removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
|
9895
10013
|
done && done();
|
|
9896
10014
|
};
|
|
10015
|
+
let isLeaving = false;
|
|
9897
10016
|
const finishLeave = (el, done) => {
|
|
10017
|
+
isLeaving = false;
|
|
10018
|
+
removeTransitionClass(el, leaveFromClass);
|
|
9898
10019
|
removeTransitionClass(el, leaveToClass);
|
|
9899
10020
|
removeTransitionClass(el, leaveActiveClass);
|
|
9900
10021
|
done && done();
|
|
@@ -9927,12 +10048,17 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9927
10048
|
onEnter: makeEnterHook(false),
|
|
9928
10049
|
onAppear: makeEnterHook(true),
|
|
9929
10050
|
onLeave(el, done) {
|
|
10051
|
+
isLeaving = true;
|
|
9930
10052
|
const resolve = () => finishLeave(el, done);
|
|
9931
10053
|
addTransitionClass(el, leaveFromClass);
|
|
9932
10054
|
// force reflow so *-leave-from classes immediately take effect (#2593)
|
|
9933
10055
|
forceReflow();
|
|
9934
10056
|
addTransitionClass(el, leaveActiveClass);
|
|
9935
10057
|
nextFrame(() => {
|
|
10058
|
+
if (!isLeaving) {
|
|
10059
|
+
// cancelled
|
|
10060
|
+
return;
|
|
10061
|
+
}
|
|
9936
10062
|
removeTransitionClass(el, leaveFromClass);
|
|
9937
10063
|
addTransitionClass(el, leaveToClass);
|
|
9938
10064
|
if (!hasExplicitCallback(onLeave)) {
|
|
@@ -10224,7 +10350,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
10224
10350
|
}
|
|
10225
10351
|
|
|
10226
10352
|
const getModelAssigner = (vnode) => {
|
|
10227
|
-
const fn = vnode.props['onUpdate:modelValue']
|
|
10353
|
+
const fn = vnode.props['onUpdate:modelValue'] ||
|
|
10354
|
+
(false );
|
|
10228
10355
|
return isArray(fn) ? value => invokeArrayFns(fn, value) : fn;
|
|
10229
10356
|
};
|
|
10230
10357
|
function onCompositionStart(e) {
|
|
@@ -10234,14 +10361,9 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
10234
10361
|
const target = e.target;
|
|
10235
10362
|
if (target.composing) {
|
|
10236
10363
|
target.composing = false;
|
|
10237
|
-
|
|
10364
|
+
target.dispatchEvent(new Event('input'));
|
|
10238
10365
|
}
|
|
10239
10366
|
}
|
|
10240
|
-
function trigger$1(el, type) {
|
|
10241
|
-
const e = document.createEvent('HTMLEvents');
|
|
10242
|
-
e.initEvent(type, true, true);
|
|
10243
|
-
el.dispatchEvent(e);
|
|
10244
|
-
}
|
|
10245
10367
|
// We are exporting the v-model runtime directly as vnode hooks so that it can
|
|
10246
10368
|
// be tree-shaken in case v-model is never used.
|
|
10247
10369
|
const vModelText = {
|
|
@@ -10255,7 +10377,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
10255
10377
|
if (trim) {
|
|
10256
10378
|
domValue = domValue.trim();
|
|
10257
10379
|
}
|
|
10258
|
-
|
|
10380
|
+
if (castToNumber) {
|
|
10259
10381
|
domValue = toNumber(domValue);
|
|
10260
10382
|
}
|
|
10261
10383
|
el._assign(domValue);
|
|
@@ -10284,7 +10406,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
10284
10406
|
// avoid clearing unresolved text. #2302
|
|
10285
10407
|
if (el.composing)
|
|
10286
10408
|
return;
|
|
10287
|
-
if (document.activeElement === el) {
|
|
10409
|
+
if (document.activeElement === el && el.type !== 'range') {
|
|
10288
10410
|
if (lazy) {
|
|
10289
10411
|
return;
|
|
10290
10412
|
}
|
|
@@ -10454,27 +10576,25 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
10454
10576
|
callModelHook(el, binding, vnode, prevVNode, 'updated');
|
|
10455
10577
|
}
|
|
10456
10578
|
};
|
|
10457
|
-
function
|
|
10458
|
-
|
|
10459
|
-
switch (el.tagName) {
|
|
10579
|
+
function resolveDynamicModel(tagName, type) {
|
|
10580
|
+
switch (tagName) {
|
|
10460
10581
|
case 'SELECT':
|
|
10461
|
-
|
|
10462
|
-
break;
|
|
10582
|
+
return vModelSelect;
|
|
10463
10583
|
case 'TEXTAREA':
|
|
10464
|
-
|
|
10465
|
-
break;
|
|
10584
|
+
return vModelText;
|
|
10466
10585
|
default:
|
|
10467
|
-
switch (
|
|
10586
|
+
switch (type) {
|
|
10468
10587
|
case 'checkbox':
|
|
10469
|
-
|
|
10470
|
-
break;
|
|
10588
|
+
return vModelCheckbox;
|
|
10471
10589
|
case 'radio':
|
|
10472
|
-
|
|
10473
|
-
break;
|
|
10590
|
+
return vModelRadio;
|
|
10474
10591
|
default:
|
|
10475
|
-
|
|
10592
|
+
return vModelText;
|
|
10476
10593
|
}
|
|
10477
10594
|
}
|
|
10595
|
+
}
|
|
10596
|
+
function callModelHook(el, binding, vnode, prevVNode, hook) {
|
|
10597
|
+
const modelToUse = resolveDynamicModel(el.tagName, vnode.props && vnode.props.type);
|
|
10478
10598
|
const fn = modelToUse[hook];
|
|
10479
10599
|
fn && fn(el, binding, vnode, prevVNode);
|
|
10480
10600
|
}
|
|
@@ -10574,7 +10694,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
10574
10694
|
el.style.display = value ? el._vod : 'none';
|
|
10575
10695
|
}
|
|
10576
10696
|
|
|
10577
|
-
const rendererOptions = extend({ patchProp }, nodeOps);
|
|
10697
|
+
const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
|
|
10578
10698
|
// lazy create the renderer - this makes core renderer logic tree-shakable
|
|
10579
10699
|
// in case the user only imports reactivity utilities from Vue.
|
|
10580
10700
|
let renderer;
|