@vue/runtime-dom 3.2.33 → 3.2.35
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 +37 -24
- package/dist/runtime-dom.cjs.prod.js +37 -24
- package/dist/runtime-dom.d.ts +5 -6
- package/dist/runtime-dom.esm-browser.js +1814 -1747
- package/dist/runtime-dom.esm-browser.prod.js +1 -1
- package/dist/runtime-dom.esm-bundler.js +37 -24
- package/dist/runtime-dom.global.js +1814 -1747
- 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';
|
|
@@ -705,17 +710,28 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
705
710
|
}
|
|
706
711
|
function triggerEffects(dep, debuggerEventExtraInfo) {
|
|
707
712
|
// spread into array for stabilization
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
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();
|
|
719
735
|
}
|
|
720
736
|
}
|
|
721
737
|
}
|
|
@@ -724,6 +740,10 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
724
740
|
const builtInSymbols = new Set(
|
|
725
741
|
/*#__PURE__*/
|
|
726
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')
|
|
727
747
|
.map(key => Symbol[key])
|
|
728
748
|
.filter(isSymbol));
|
|
729
749
|
const get = /*#__PURE__*/ createGetter();
|
|
@@ -797,9 +817,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
797
817
|
return res;
|
|
798
818
|
}
|
|
799
819
|
if (isRef(res)) {
|
|
800
|
-
// ref unwrapping -
|
|
801
|
-
|
|
802
|
-
return shouldUnwrap ? res.value : res;
|
|
820
|
+
// ref unwrapping - skip unwrap for Array + integer key.
|
|
821
|
+
return targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
803
822
|
}
|
|
804
823
|
if (isObject(res)) {
|
|
805
824
|
// Convert returned value into a proxy as well. we do the isObject check
|
|
@@ -905,10 +924,12 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
905
924
|
target = target["__v_raw" /* RAW */];
|
|
906
925
|
const rawTarget = toRaw(target);
|
|
907
926
|
const rawKey = toRaw(key);
|
|
908
|
-
if (
|
|
909
|
-
|
|
927
|
+
if (!isReadonly) {
|
|
928
|
+
if (key !== rawKey) {
|
|
929
|
+
track(rawTarget, "get" /* GET */, key);
|
|
930
|
+
}
|
|
931
|
+
track(rawTarget, "get" /* GET */, rawKey);
|
|
910
932
|
}
|
|
911
|
-
!isReadonly && track(rawTarget, "get" /* GET */, rawKey);
|
|
912
933
|
const { has } = getProto(rawTarget);
|
|
913
934
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
914
935
|
if (has.call(rawTarget, key)) {
|
|
@@ -927,10 +948,12 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
927
948
|
const target = this["__v_raw" /* RAW */];
|
|
928
949
|
const rawTarget = toRaw(target);
|
|
929
950
|
const rawKey = toRaw(key);
|
|
930
|
-
if (
|
|
931
|
-
|
|
951
|
+
if (!isReadonly) {
|
|
952
|
+
if (key !== rawKey) {
|
|
953
|
+
track(rawTarget, "has" /* HAS */, key);
|
|
954
|
+
}
|
|
955
|
+
track(rawTarget, "has" /* HAS */, rawKey);
|
|
932
956
|
}
|
|
933
|
-
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
|
|
934
957
|
return key === rawKey
|
|
935
958
|
? target.has(key)
|
|
936
959
|
: target.has(key) || target.has(rawKey);
|
|
@@ -1256,7 +1279,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1256
1279
|
if (existingProxy) {
|
|
1257
1280
|
return existingProxy;
|
|
1258
1281
|
}
|
|
1259
|
-
// only
|
|
1282
|
+
// only specific value types can be observed.
|
|
1260
1283
|
const targetType = getTargetType(target);
|
|
1261
1284
|
if (targetType === 0 /* INVALID */) {
|
|
1262
1285
|
return target;
|
|
@@ -1806,6 +1829,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1806
1829
|
}
|
|
1807
1830
|
}
|
|
1808
1831
|
function flushPostFlushCbs(seen) {
|
|
1832
|
+
// flush any pre cbs queued during the flush (e.g. pre watchers)
|
|
1833
|
+
flushPreFlushCbs();
|
|
1809
1834
|
if (pendingPostFlushCbs.length) {
|
|
1810
1835
|
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
1811
1836
|
pendingPostFlushCbs.length = 0;
|
|
@@ -2064,7 +2089,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2064
2089
|
// handle late devtools injection - only do this if we are in an actual
|
|
2065
2090
|
// browser environment to avoid the timer handle stalling test runner exit
|
|
2066
2091
|
// (#4815)
|
|
2067
|
-
// eslint-disable-next-line no-restricted-globals
|
|
2068
2092
|
typeof window !== 'undefined' &&
|
|
2069
2093
|
// some envs mock window but not fully
|
|
2070
2094
|
window.HTMLElement &&
|
|
@@ -2158,7 +2182,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2158
2182
|
if (trim) {
|
|
2159
2183
|
args = rawArgs.map(a => a.trim());
|
|
2160
2184
|
}
|
|
2161
|
-
|
|
2185
|
+
if (number) {
|
|
2162
2186
|
args = rawArgs.map(toNumber);
|
|
2163
2187
|
}
|
|
2164
2188
|
}
|
|
@@ -2456,6 +2480,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2456
2480
|
warn$1(`Runtime directive used on component with non-element root node. ` +
|
|
2457
2481
|
`The directives will not function as intended.`);
|
|
2458
2482
|
}
|
|
2483
|
+
// clone before mutating since the root may be a hoisted vnode
|
|
2484
|
+
root = cloneVNode(root);
|
|
2459
2485
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
2460
2486
|
}
|
|
2461
2487
|
// inherit transition data
|
|
@@ -3158,7 +3184,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3158
3184
|
}
|
|
3159
3185
|
else if (isArray(source)) {
|
|
3160
3186
|
isMultiSource = true;
|
|
3161
|
-
forceTrigger = source.some(isReactive);
|
|
3187
|
+
forceTrigger = source.some(s => isReactive(s) || isShallow(s));
|
|
3162
3188
|
getter = () => source.map(s => {
|
|
3163
3189
|
if (isRef(s)) {
|
|
3164
3190
|
return s.value;
|
|
@@ -3250,16 +3276,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3250
3276
|
}
|
|
3251
3277
|
else {
|
|
3252
3278
|
// default: 'pre'
|
|
3253
|
-
scheduler = () =>
|
|
3254
|
-
if (!instance || instance.isMounted) {
|
|
3255
|
-
queuePreFlushCb(job);
|
|
3256
|
-
}
|
|
3257
|
-
else {
|
|
3258
|
-
// with 'pre' option, the first call must happen before
|
|
3259
|
-
// the component is mounted so it is called synchronously.
|
|
3260
|
-
job();
|
|
3261
|
-
}
|
|
3262
|
-
};
|
|
3279
|
+
scheduler = () => queuePreFlushCb(job);
|
|
3263
3280
|
}
|
|
3264
3281
|
const effect = new ReactiveEffect(getter, scheduler);
|
|
3265
3282
|
{
|
|
@@ -3512,6 +3529,17 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3512
3529
|
hook &&
|
|
3513
3530
|
callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
|
|
3514
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
|
+
};
|
|
3515
3543
|
const hooks = {
|
|
3516
3544
|
mode,
|
|
3517
3545
|
persisted,
|
|
@@ -3570,10 +3598,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3570
3598
|
el._enterCb = undefined;
|
|
3571
3599
|
});
|
|
3572
3600
|
if (hook) {
|
|
3573
|
-
hook
|
|
3574
|
-
if (hook.length <= 1) {
|
|
3575
|
-
done();
|
|
3576
|
-
}
|
|
3601
|
+
callAsyncHook(hook, [el, done]);
|
|
3577
3602
|
}
|
|
3578
3603
|
else {
|
|
3579
3604
|
done();
|
|
@@ -3607,10 +3632,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3607
3632
|
});
|
|
3608
3633
|
leavingVNodesCache[key] = vnode;
|
|
3609
3634
|
if (onLeave) {
|
|
3610
|
-
onLeave
|
|
3611
|
-
if (onLeave.length <= 1) {
|
|
3612
|
-
done();
|
|
3613
|
-
}
|
|
3635
|
+
callAsyncHook(onLeave, [el, done]);
|
|
3614
3636
|
}
|
|
3615
3637
|
else {
|
|
3616
3638
|
done();
|
|
@@ -3820,7 +3842,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3820
3842
|
}
|
|
3821
3843
|
});
|
|
3822
3844
|
}
|
|
3823
|
-
function createInnerComp(comp, { vnode: { ref, props, children } }) {
|
|
3845
|
+
function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
|
|
3824
3846
|
const vnode = createVNode(comp, props, children);
|
|
3825
3847
|
// ensure inner component inherits the async wrapper's ref owner
|
|
3826
3848
|
vnode.ref = ref;
|
|
@@ -3847,11 +3869,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3847
3869
|
// The whole point of this is to avoid importing KeepAlive directly in the
|
|
3848
3870
|
// renderer to facilitate tree-shaking.
|
|
3849
3871
|
const sharedContext = instance.ctx;
|
|
3850
|
-
// if the internal renderer is not registered, it indicates that this is server-side rendering,
|
|
3851
|
-
// for KeepAlive, we just need to render its children
|
|
3852
|
-
if (!sharedContext.renderer) {
|
|
3853
|
-
return slots.default;
|
|
3854
|
-
}
|
|
3855
3872
|
const cache = new Map();
|
|
3856
3873
|
const keys = new Set();
|
|
3857
3874
|
let current = null;
|
|
@@ -4029,7 +4046,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
4029
4046
|
// avoid vnode being unmounted
|
|
4030
4047
|
vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4031
4048
|
current = vnode;
|
|
4032
|
-
return rawVNode;
|
|
4049
|
+
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
4033
4050
|
};
|
|
4034
4051
|
}
|
|
4035
4052
|
};
|
|
@@ -4167,1110 +4184,1597 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
4167
4184
|
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
4168
4185
|
}
|
|
4169
4186
|
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
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
|
+
};
|
|
4175
4223
|
}
|
|
4176
|
-
|
|
4177
|
-
|
|
4224
|
+
if (dir.deep) {
|
|
4225
|
+
traverse(value);
|
|
4178
4226
|
}
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
shouldCacheAccess = false;
|
|
4188
|
-
// call beforeCreate first before accessing other options since
|
|
4189
|
-
// the hook may mutate resolved options (#2791)
|
|
4190
|
-
if (options.beforeCreate) {
|
|
4191
|
-
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
|
+
});
|
|
4192
4235
|
}
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
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();
|
|
4209
4258
|
}
|
|
4210
4259
|
}
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
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;
|
|
4220
4277
|
}
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
if (isFunction(methodHandler)) {
|
|
4225
|
-
// In dev mode, we use the `createRenderContext` function to define
|
|
4226
|
-
// methods to the proxy target, and those are read-only but
|
|
4227
|
-
// reconfigurable, so it needs to be redefined here
|
|
4228
|
-
{
|
|
4229
|
-
Object.defineProperty(ctx, key, {
|
|
4230
|
-
value: methodHandler.bind(publicThis),
|
|
4231
|
-
configurable: true,
|
|
4232
|
-
enumerable: true,
|
|
4233
|
-
writable: true
|
|
4234
|
-
});
|
|
4235
|
-
}
|
|
4236
|
-
{
|
|
4237
|
-
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
4238
|
-
}
|
|
4239
|
-
}
|
|
4240
|
-
else {
|
|
4241
|
-
warn$1(`Method "${key}" has type "${typeof methodHandler}" in the component definition. ` +
|
|
4242
|
-
`Did you reference the function correctly?`);
|
|
4243
|
-
}
|
|
4244
|
-
}
|
|
4278
|
+
else {
|
|
4279
|
+
// invalid types will fallthrough to createVNode and raise warning
|
|
4280
|
+
return (component || NULL_DYNAMIC_COMPONENT);
|
|
4245
4281
|
}
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
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
|
+
}
|
|
4256
4303
|
}
|
|
4257
|
-
|
|
4258
|
-
|
|
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;
|
|
4259
4313
|
}
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
if (key[0] !== '$' && key[0] !== '_') {
|
|
4267
|
-
Object.defineProperty(ctx, key, {
|
|
4268
|
-
configurable: true,
|
|
4269
|
-
enumerable: true,
|
|
4270
|
-
get: () => data[key],
|
|
4271
|
-
set: NOOP
|
|
4272
|
-
});
|
|
4273
|
-
}
|
|
4274
|
-
}
|
|
4275
|
-
}
|
|
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}`);
|
|
4276
4320
|
}
|
|
4321
|
+
return res;
|
|
4277
4322
|
}
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
for (const key in computedOptions) {
|
|
4282
|
-
const opt = computedOptions[key];
|
|
4283
|
-
const get = isFunction(opt)
|
|
4284
|
-
? opt.bind(publicThis, publicThis)
|
|
4285
|
-
: isFunction(opt.get)
|
|
4286
|
-
? opt.get.bind(publicThis, publicThis)
|
|
4287
|
-
: NOOP;
|
|
4288
|
-
if (get === NOOP) {
|
|
4289
|
-
warn$1(`Computed property "${key}" has no getter.`);
|
|
4290
|
-
}
|
|
4291
|
-
const set = !isFunction(opt) && isFunction(opt.set)
|
|
4292
|
-
? opt.set.bind(publicThis)
|
|
4293
|
-
: () => {
|
|
4294
|
-
warn$1(`Write operation failed: computed property "${key}" is readonly.`);
|
|
4295
|
-
}
|
|
4296
|
-
;
|
|
4297
|
-
const c = computed$1({
|
|
4298
|
-
get,
|
|
4299
|
-
set
|
|
4300
|
-
});
|
|
4301
|
-
Object.defineProperty(ctx, key, {
|
|
4302
|
-
enumerable: true,
|
|
4303
|
-
configurable: true,
|
|
4304
|
-
get: () => c.value,
|
|
4305
|
-
set: v => (c.value = v)
|
|
4306
|
-
});
|
|
4307
|
-
{
|
|
4308
|
-
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
4309
|
-
}
|
|
4310
|
-
}
|
|
4311
|
-
}
|
|
4312
|
-
if (watchOptions) {
|
|
4313
|
-
for (const key in watchOptions) {
|
|
4314
|
-
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
4315
|
-
}
|
|
4316
|
-
}
|
|
4317
|
-
if (provideOptions) {
|
|
4318
|
-
const provides = isFunction(provideOptions)
|
|
4319
|
-
? provideOptions.call(publicThis)
|
|
4320
|
-
: provideOptions;
|
|
4321
|
-
Reflect.ownKeys(provides).forEach(key => {
|
|
4322
|
-
provide(key, provides[key]);
|
|
4323
|
-
});
|
|
4324
|
-
}
|
|
4325
|
-
if (created) {
|
|
4326
|
-
callHook(created, instance, "c" /* CREATED */);
|
|
4323
|
+
else {
|
|
4324
|
+
warn$1(`resolve${capitalize(type.slice(0, -1))} ` +
|
|
4325
|
+
`can only be used in render() or setup().`);
|
|
4327
4326
|
}
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4327
|
+
}
|
|
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]);
|
|
4334
4345
|
}
|
|
4335
4346
|
}
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
registerLifecycleHook(onUpdated, updated);
|
|
4340
|
-
registerLifecycleHook(onActivated, activated);
|
|
4341
|
-
registerLifecycleHook(onDeactivated, deactivated);
|
|
4342
|
-
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
|
4343
|
-
registerLifecycleHook(onRenderTracked, renderTracked);
|
|
4344
|
-
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
|
4345
|
-
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
|
4346
|
-
registerLifecycleHook(onUnmounted, unmounted);
|
|
4347
|
-
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
4348
|
-
if (isArray(expose)) {
|
|
4349
|
-
if (expose.length) {
|
|
4350
|
-
const exposed = instance.exposed || (instance.exposed = {});
|
|
4351
|
-
expose.forEach(key => {
|
|
4352
|
-
Object.defineProperty(exposed, key, {
|
|
4353
|
-
get: () => publicThis[key],
|
|
4354
|
-
set: val => (publicThis[key] = val)
|
|
4355
|
-
});
|
|
4356
|
-
});
|
|
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}.`);
|
|
4357
4350
|
}
|
|
4358
|
-
|
|
4359
|
-
|
|
4351
|
+
ret = new Array(source);
|
|
4352
|
+
for (let i = 0; i < source; i++) {
|
|
4353
|
+
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
4360
4354
|
}
|
|
4361
4355
|
}
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
instance.render = render;
|
|
4366
|
-
}
|
|
4367
|
-
if (inheritAttrs != null) {
|
|
4368
|
-
instance.inheritAttrs = inheritAttrs;
|
|
4369
|
-
}
|
|
4370
|
-
// asset options.
|
|
4371
|
-
if (components)
|
|
4372
|
-
instance.components = components;
|
|
4373
|
-
if (directives)
|
|
4374
|
-
instance.directives = directives;
|
|
4375
|
-
}
|
|
4376
|
-
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
|
|
4377
|
-
if (isArray(injectOptions)) {
|
|
4378
|
-
injectOptions = normalizeInject(injectOptions);
|
|
4379
|
-
}
|
|
4380
|
-
for (const key in injectOptions) {
|
|
4381
|
-
const opt = injectOptions[key];
|
|
4382
|
-
let injected;
|
|
4383
|
-
if (isObject(opt)) {
|
|
4384
|
-
if ('default' in opt) {
|
|
4385
|
-
injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
|
|
4386
|
-
}
|
|
4387
|
-
else {
|
|
4388
|
-
injected = inject(opt.from || key);
|
|
4389
|
-
}
|
|
4356
|
+
else if (isObject(source)) {
|
|
4357
|
+
if (source[Symbol.iterator]) {
|
|
4358
|
+
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
4390
4359
|
}
|
|
4391
4360
|
else {
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
Object.defineProperty(ctx, key, {
|
|
4398
|
-
enumerable: true,
|
|
4399
|
-
configurable: true,
|
|
4400
|
-
get: () => injected.value,
|
|
4401
|
-
set: v => (injected.value = v)
|
|
4402
|
-
});
|
|
4403
|
-
}
|
|
4404
|
-
else {
|
|
4405
|
-
{
|
|
4406
|
-
warn$1(`injected property "${key}" is a ref and will be auto-unwrapped ` +
|
|
4407
|
-
`and no longer needs \`.value\` in the next minor release. ` +
|
|
4408
|
-
`To opt-in to the new behavior now, ` +
|
|
4409
|
-
`set \`app.config.unwrapInjectedRef = true\` (this config is ` +
|
|
4410
|
-
`temporary and will not be needed in the future.)`);
|
|
4411
|
-
}
|
|
4412
|
-
ctx[key] = injected;
|
|
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]);
|
|
4413
4366
|
}
|
|
4414
4367
|
}
|
|
4415
|
-
else {
|
|
4416
|
-
ctx[key] = injected;
|
|
4417
|
-
}
|
|
4418
|
-
{
|
|
4419
|
-
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
4420
|
-
}
|
|
4421
4368
|
}
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
callWithAsyncErrorHandling(isArray(hook)
|
|
4425
|
-
? hook.map(h => h.bind(instance.proxy))
|
|
4426
|
-
: hook.bind(instance.proxy), instance, type);
|
|
4427
|
-
}
|
|
4428
|
-
function createWatcher(raw, ctx, publicThis, key) {
|
|
4429
|
-
const getter = key.includes('.')
|
|
4430
|
-
? createPathGetter(publicThis, key)
|
|
4431
|
-
: () => publicThis[key];
|
|
4432
|
-
if (isString(raw)) {
|
|
4433
|
-
const handler = ctx[raw];
|
|
4434
|
-
if (isFunction(handler)) {
|
|
4435
|
-
watch(getter, handler);
|
|
4436
|
-
}
|
|
4437
|
-
else {
|
|
4438
|
-
warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
4439
|
-
}
|
|
4369
|
+
else {
|
|
4370
|
+
ret = [];
|
|
4440
4371
|
}
|
|
4441
|
-
|
|
4442
|
-
|
|
4372
|
+
if (cache) {
|
|
4373
|
+
cache[index] = ret;
|
|
4443
4374
|
}
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4375
|
+
return ret;
|
|
4376
|
+
}
|
|
4377
|
+
|
|
4378
|
+
/**
|
|
4379
|
+
* Compiler runtime helper for creating dynamic slots object
|
|
4380
|
+
* @private
|
|
4381
|
+
*/
|
|
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;
|
|
4457
4389
|
}
|
|
4458
4390
|
}
|
|
4391
|
+
else if (slot) {
|
|
4392
|
+
// conditional single slot generated by <template v-if="..." #foo>
|
|
4393
|
+
slots[slot.name] = slot.fn;
|
|
4394
|
+
}
|
|
4459
4395
|
}
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
}
|
|
4396
|
+
return slots;
|
|
4397
|
+
}
|
|
4398
|
+
|
|
4464
4399
|
/**
|
|
4465
|
-
*
|
|
4466
|
-
*
|
|
4467
|
-
* instances.
|
|
4400
|
+
* Compiler runtime helper for rendering `<slot/>`
|
|
4401
|
+
* @private
|
|
4468
4402
|
*/
|
|
4469
|
-
function
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
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());
|
|
4477
4412
|
}
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
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 = () => [];
|
|
4482
4419
|
}
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
}
|
|
4490
|
-
cache.set(base, resolved);
|
|
4491
|
-
return resolved;
|
|
4492
|
-
}
|
|
4493
|
-
function mergeOptions(to, from, strats, asMixin = false) {
|
|
4494
|
-
const { mixins, extends: extendsOptions } = from;
|
|
4495
|
-
if (extendsOptions) {
|
|
4496
|
-
mergeOptions(to, extendsOptions, strats, true);
|
|
4497
|
-
}
|
|
4498
|
-
if (mixins) {
|
|
4499
|
-
mixins.forEach((m) => mergeOptions(to, m, strats, true));
|
|
4500
|
-
}
|
|
4501
|
-
for (const key in from) {
|
|
4502
|
-
if (asMixin && key === 'expose') {
|
|
4503
|
-
warn$1(`"expose" option is ignored when declared in mixins or extends. ` +
|
|
4504
|
-
`It should only be declared in the base component itself.`);
|
|
4505
|
-
}
|
|
4506
|
-
else {
|
|
4507
|
-
const strat = internalOptionMergeStrats[key] || (strats && strats[key]);
|
|
4508
|
-
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
4509
|
-
}
|
|
4510
|
-
}
|
|
4511
|
-
return to;
|
|
4512
|
-
}
|
|
4513
|
-
const internalOptionMergeStrats = {
|
|
4514
|
-
data: mergeDataFn,
|
|
4515
|
-
props: mergeObjectOptions,
|
|
4516
|
-
emits: mergeObjectOptions,
|
|
4517
|
-
// objects
|
|
4518
|
-
methods: mergeObjectOptions,
|
|
4519
|
-
computed: mergeObjectOptions,
|
|
4520
|
-
// lifecycle
|
|
4521
|
-
beforeCreate: mergeAsArray,
|
|
4522
|
-
created: mergeAsArray,
|
|
4523
|
-
beforeMount: mergeAsArray,
|
|
4524
|
-
mounted: mergeAsArray,
|
|
4525
|
-
beforeUpdate: mergeAsArray,
|
|
4526
|
-
updated: mergeAsArray,
|
|
4527
|
-
beforeDestroy: mergeAsArray,
|
|
4528
|
-
beforeUnmount: mergeAsArray,
|
|
4529
|
-
destroyed: mergeAsArray,
|
|
4530
|
-
unmounted: mergeAsArray,
|
|
4531
|
-
activated: mergeAsArray,
|
|
4532
|
-
deactivated: mergeAsArray,
|
|
4533
|
-
errorCaptured: mergeAsArray,
|
|
4534
|
-
serverPrefetch: mergeAsArray,
|
|
4535
|
-
// assets
|
|
4536
|
-
components: mergeObjectOptions,
|
|
4537
|
-
directives: mergeObjectOptions,
|
|
4538
|
-
// watch
|
|
4539
|
-
watch: mergeWatchOptions,
|
|
4540
|
-
// provide / inject
|
|
4541
|
-
provide: mergeDataFn,
|
|
4542
|
-
inject: mergeInject
|
|
4543
|
-
};
|
|
4544
|
-
function mergeDataFn(to, from) {
|
|
4545
|
-
if (!from) {
|
|
4546
|
-
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;
|
|
4547
4426
|
}
|
|
4548
|
-
|
|
4549
|
-
|
|
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'];
|
|
4550
4434
|
}
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
};
|
|
4554
|
-
}
|
|
4555
|
-
function mergeInject(to, from) {
|
|
4556
|
-
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
4557
|
-
}
|
|
4558
|
-
function normalizeInject(raw) {
|
|
4559
|
-
if (isArray(raw)) {
|
|
4560
|
-
const res = {};
|
|
4561
|
-
for (let i = 0; i < raw.length; i++) {
|
|
4562
|
-
res[raw[i]] = raw[i];
|
|
4563
|
-
}
|
|
4564
|
-
return res;
|
|
4435
|
+
if (slot && slot._c) {
|
|
4436
|
+
slot._d = true;
|
|
4565
4437
|
}
|
|
4566
|
-
return
|
|
4567
|
-
}
|
|
4568
|
-
function mergeAsArray(to, from) {
|
|
4569
|
-
return to ? [...new Set([].concat(to, from))] : from;
|
|
4570
|
-
}
|
|
4571
|
-
function mergeObjectOptions(to, from) {
|
|
4572
|
-
return to ? extend(extend(Object.create(null), to), from) : from;
|
|
4438
|
+
return rendered;
|
|
4573
4439
|
}
|
|
4574
|
-
function
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
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;
|
|
4584
4453
|
}
|
|
4585
4454
|
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
if (!(key in props)) {
|
|
4596
|
-
props[key] = undefined;
|
|
4597
|
-
}
|
|
4598
|
-
}
|
|
4599
|
-
// validation
|
|
4600
|
-
{
|
|
4601
|
-
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;
|
|
4602
4464
|
}
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
instance.props = isSSR ? props : shallowReactive(props);
|
|
4465
|
+
for (const key in obj) {
|
|
4466
|
+
ret[toHandlerKey(key)] = obj[key];
|
|
4606
4467
|
}
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
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;
|
|
4611
4509
|
}
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
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];
|
|
4615
4518
|
}
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
4637
|
-
let key = propsToUpdate[i];
|
|
4638
|
-
// skip if the prop key is a declared emit event listener
|
|
4639
|
-
if (isEmitListener(instance.emitsOptions, key)) {
|
|
4640
|
-
continue;
|
|
4641
|
-
}
|
|
4642
|
-
// PROPS flag guarantees rawProps to be non-null
|
|
4643
|
-
const value = rawProps[key];
|
|
4644
|
-
if (options) {
|
|
4645
|
-
// attr / props separation was done on init and will be consistent
|
|
4646
|
-
// in this code path, so just check if attrs have it.
|
|
4647
|
-
if (hasOwn(attrs, key)) {
|
|
4648
|
-
if (value !== attrs[key]) {
|
|
4649
|
-
attrs[key] = value;
|
|
4650
|
-
hasAttrsChanged = true;
|
|
4651
|
-
}
|
|
4652
|
-
}
|
|
4653
|
-
else {
|
|
4654
|
-
const camelizedKey = camelize(key);
|
|
4655
|
-
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
|
|
4656
|
-
}
|
|
4657
|
-
}
|
|
4658
|
-
else {
|
|
4659
|
-
if (value !== attrs[key]) {
|
|
4660
|
-
attrs[key] = value;
|
|
4661
|
-
hasAttrsChanged = true;
|
|
4662
|
-
}
|
|
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
|
|
4663
4539
|
}
|
|
4664
4540
|
}
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
// full props update.
|
|
4669
|
-
if (setFullProps(instance, rawProps, props, attrs)) {
|
|
4670
|
-
hasAttrsChanged = true;
|
|
4671
|
-
}
|
|
4672
|
-
// in case of dynamic props, check if we need to delete keys from
|
|
4673
|
-
// the props object
|
|
4674
|
-
let kebabKey;
|
|
4675
|
-
for (const key in rawCurrentProps) {
|
|
4676
|
-
if (!rawProps ||
|
|
4677
|
-
// for camelCase
|
|
4678
|
-
(!hasOwn(rawProps, key) &&
|
|
4679
|
-
// it's possible the original props was passed in as kebab-case
|
|
4680
|
-
// and converted to camelCase (#955)
|
|
4681
|
-
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {
|
|
4682
|
-
if (options) {
|
|
4683
|
-
if (rawPrevProps &&
|
|
4684
|
-
// for camelCase
|
|
4685
|
-
(rawPrevProps[key] !== undefined ||
|
|
4686
|
-
// for kebab-case
|
|
4687
|
-
rawPrevProps[kebabKey] !== undefined)) {
|
|
4688
|
-
props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */);
|
|
4689
|
-
}
|
|
4690
|
-
}
|
|
4691
|
-
else {
|
|
4692
|
-
delete props[key];
|
|
4693
|
-
}
|
|
4541
|
+
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
4542
|
+
accessCache[key] = 1 /* SETUP */;
|
|
4543
|
+
return setupState[key];
|
|
4694
4544
|
}
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
if (attrs !== rawCurrentProps) {
|
|
4699
|
-
for (const key in attrs) {
|
|
4700
|
-
if (!rawProps ||
|
|
4701
|
-
(!hasOwn(rawProps, key) &&
|
|
4702
|
-
(!false ))) {
|
|
4703
|
-
delete attrs[key];
|
|
4704
|
-
hasAttrsChanged = true;
|
|
4705
|
-
}
|
|
4545
|
+
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
4546
|
+
accessCache[key] = 2 /* DATA */;
|
|
4547
|
+
return data[key];
|
|
4706
4548
|
}
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
validateProps(rawProps || {}, props, instance);
|
|
4715
|
-
}
|
|
4716
|
-
}
|
|
4717
|
-
function setFullProps(instance, rawProps, props, attrs) {
|
|
4718
|
-
const [options, needCastKeys] = instance.propsOptions;
|
|
4719
|
-
let hasAttrsChanged = false;
|
|
4720
|
-
let rawCastValues;
|
|
4721
|
-
if (rawProps) {
|
|
4722
|
-
for (let key in rawProps) {
|
|
4723
|
-
// key, ref are reserved and never passed down
|
|
4724
|
-
if (isReservedProp(key)) {
|
|
4725
|
-
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];
|
|
4726
4556
|
}
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
let camelKey;
|
|
4731
|
-
if (options && hasOwn(options, (camelKey = camelize(key)))) {
|
|
4732
|
-
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
|
4733
|
-
props[camelKey] = value;
|
|
4734
|
-
}
|
|
4735
|
-
else {
|
|
4736
|
-
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
|
4737
|
-
}
|
|
4557
|
+
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
4558
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
4559
|
+
return ctx[key];
|
|
4738
4560
|
}
|
|
4739
|
-
else if (
|
|
4740
|
-
|
|
4741
|
-
attrs[key] = value;
|
|
4742
|
-
hasAttrsChanged = true;
|
|
4743
|
-
}
|
|
4561
|
+
else if (shouldCacheAccess) {
|
|
4562
|
+
accessCache[key] = 0 /* OTHER */;
|
|
4744
4563
|
}
|
|
4745
4564
|
}
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
}
|
|
4754
|
-
}
|
|
4755
|
-
return hasAttrsChanged;
|
|
4756
|
-
}
|
|
4757
|
-
function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
4758
|
-
const opt = options[key];
|
|
4759
|
-
if (opt != null) {
|
|
4760
|
-
const hasDefault = hasOwn(opt, 'default');
|
|
4761
|
-
// default values
|
|
4762
|
-
if (hasDefault && value === undefined) {
|
|
4763
|
-
const defaultValue = opt.default;
|
|
4764
|
-
if (opt.type !== Function && isFunction(defaultValue)) {
|
|
4765
|
-
const { propsDefaults } = instance;
|
|
4766
|
-
if (key in propsDefaults) {
|
|
4767
|
-
value = propsDefaults[key];
|
|
4768
|
-
}
|
|
4769
|
-
else {
|
|
4770
|
-
setCurrentInstance(instance);
|
|
4771
|
-
value = propsDefaults[key] = defaultValue.call(null, props);
|
|
4772
|
-
unsetCurrentInstance();
|
|
4773
|
-
}
|
|
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();
|
|
4774
4572
|
}
|
|
4775
|
-
|
|
4776
|
-
|
|
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];
|
|
4777
4592
|
}
|
|
4778
4593
|
}
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
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.`);
|
|
4783
4602
|
}
|
|
4784
|
-
else if (
|
|
4785
|
-
(
|
|
4786
|
-
|
|
4603
|
+
else if (instance === currentRenderingInstance) {
|
|
4604
|
+
warn$1(`Property ${JSON.stringify(key)} was accessed during render ` +
|
|
4605
|
+
`but is not defined on instance.`);
|
|
4787
4606
|
}
|
|
4788
4607
|
}
|
|
4789
|
-
}
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
if (cached) {
|
|
4796
|
-
return cached;
|
|
4797
|
-
}
|
|
4798
|
-
const raw = comp.props;
|
|
4799
|
-
const normalized = {};
|
|
4800
|
-
const needCastKeys = [];
|
|
4801
|
-
// apply mixin/extends props
|
|
4802
|
-
let hasExtends = false;
|
|
4803
|
-
if (!isFunction(comp)) {
|
|
4804
|
-
const extendProps = (raw) => {
|
|
4805
|
-
hasExtends = true;
|
|
4806
|
-
const [props, keys] = normalizePropsOptions(raw, appContext, true);
|
|
4807
|
-
extend(normalized, props);
|
|
4808
|
-
if (keys)
|
|
4809
|
-
needCastKeys.push(...keys);
|
|
4810
|
-
};
|
|
4811
|
-
if (!asMixin && appContext.mixins.length) {
|
|
4812
|
-
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;
|
|
4813
4614
|
}
|
|
4814
|
-
if (
|
|
4815
|
-
|
|
4615
|
+
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
4616
|
+
data[key] = value;
|
|
4617
|
+
return true;
|
|
4816
4618
|
}
|
|
4817
|
-
if (
|
|
4818
|
-
|
|
4619
|
+
else if (hasOwn(instance.props, key)) {
|
|
4620
|
+
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
|
4621
|
+
return false;
|
|
4819
4622
|
}
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
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
|
+
});
|
|
4829
4635
|
}
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
normalized[normalizedKey] = EMPTY_OBJ;
|
|
4636
|
+
else {
|
|
4637
|
+
ctx[key] = value;
|
|
4833
4638
|
}
|
|
4834
4639
|
}
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
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;
|
|
4839
4656
|
}
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
if (validatePropName(normalizedKey)) {
|
|
4843
|
-
const opt = raw[key];
|
|
4844
|
-
const prop = (normalized[normalizedKey] =
|
|
4845
|
-
isArray(opt) || isFunction(opt) ? { type: opt } : opt);
|
|
4846
|
-
if (prop) {
|
|
4847
|
-
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
4848
|
-
const stringIndex = getTypeIndex(String, prop.type);
|
|
4849
|
-
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
4850
|
-
prop[1 /* shouldCastTrue */] =
|
|
4851
|
-
stringIndex < 0 || booleanIndex < stringIndex;
|
|
4852
|
-
// if the prop needs boolean casting or default value
|
|
4853
|
-
if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
|
4854
|
-
needCastKeys.push(normalizedKey);
|
|
4855
|
-
}
|
|
4856
|
-
}
|
|
4857
|
-
}
|
|
4657
|
+
else if (hasOwn(descriptor, 'value')) {
|
|
4658
|
+
this.set(target, key, descriptor.value, null);
|
|
4858
4659
|
}
|
|
4660
|
+
return Reflect.defineProperty(target, key, descriptor);
|
|
4859
4661
|
}
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
}
|
|
4868
|
-
else {
|
|
4869
|
-
warn$1(`Invalid prop name: "${key}" is a reserved property.`);
|
|
4870
|
-
}
|
|
4871
|
-
return false;
|
|
4872
|
-
}
|
|
4873
|
-
// use function string name to check type constructors
|
|
4874
|
-
// so that it works across vms / iframes.
|
|
4875
|
-
function getType(ctor) {
|
|
4876
|
-
const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
|
|
4877
|
-
return match ? match[1] : ctor === null ? 'null' : '';
|
|
4878
|
-
}
|
|
4879
|
-
function isSameType(a, b) {
|
|
4880
|
-
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
|
+
};
|
|
4881
4669
|
}
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
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;
|
|
4888
4684
|
}
|
|
4889
|
-
|
|
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;
|
|
4890
4710
|
}
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
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
|
+
});
|
|
4902
4723
|
}
|
|
4903
4724
|
}
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
let isValid = false;
|
|
4921
|
-
const types = isArray(type) ? type : [type];
|
|
4922
|
-
const expectedTypes = [];
|
|
4923
|
-
// value is valid as long as one of the specified types match
|
|
4924
|
-
for (let i = 0; i < types.length && !isValid; i++) {
|
|
4925
|
-
const { valid, expectedType } = assertType(value, types[i]);
|
|
4926
|
-
expectedTypes.push(expectedType || '');
|
|
4927
|
-
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
|
+
});
|
|
4928
4741
|
}
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
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]}.`);
|
|
4932
4750
|
}
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
if (validator && !validator(value)) {
|
|
4936
|
-
warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
|
4937
|
-
}
|
|
4938
|
-
}
|
|
4939
|
-
const isSimpleType = /*#__PURE__*/ makeMap('String,Number,Boolean,Function,Symbol,BigInt');
|
|
4940
|
-
/**
|
|
4941
|
-
* dev only
|
|
4942
|
-
*/
|
|
4943
|
-
function assertType(value, type) {
|
|
4944
|
-
let valid;
|
|
4945
|
-
const expectedType = getType(type);
|
|
4946
|
-
if (isSimpleType(expectedType)) {
|
|
4947
|
-
const t = typeof value;
|
|
4948
|
-
valid = t === expectedType.toLowerCase();
|
|
4949
|
-
// for primitive wrapper objects
|
|
4950
|
-
if (!valid && t === 'object') {
|
|
4951
|
-
valid = value instanceof type;
|
|
4751
|
+
else {
|
|
4752
|
+
cache[key] = type;
|
|
4952
4753
|
}
|
|
4953
|
-
}
|
|
4954
|
-
else if (expectedType === 'Object') {
|
|
4955
|
-
valid = isObject(value);
|
|
4956
|
-
}
|
|
4957
|
-
else if (expectedType === 'Array') {
|
|
4958
|
-
valid = isArray(value);
|
|
4959
|
-
}
|
|
4960
|
-
else if (expectedType === 'null') {
|
|
4961
|
-
valid = value === null;
|
|
4962
|
-
}
|
|
4963
|
-
else {
|
|
4964
|
-
valid = value instanceof type;
|
|
4965
|
-
}
|
|
4966
|
-
return {
|
|
4967
|
-
valid,
|
|
4968
|
-
expectedType
|
|
4969
4754
|
};
|
|
4970
4755
|
}
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
if (expectedTypes.length === 1 &&
|
|
4983
|
-
isExplicable(expectedType) &&
|
|
4984
|
-
!isBoolean(expectedType, receivedType)) {
|
|
4985
|
-
message += ` with value ${expectedValue}`;
|
|
4986
|
-
}
|
|
4987
|
-
message += `, got ${receivedType} `;
|
|
4988
|
-
// check if we need to specify received value
|
|
4989
|
-
if (isExplicable(receivedType)) {
|
|
4990
|
-
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 */);
|
|
4991
4767
|
}
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
}
|
|
5001
|
-
|
|
5002
|
-
|
|
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
|
+
}
|
|
5003
4785
|
}
|
|
5004
|
-
|
|
5005
|
-
|
|
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);
|
|
5006
4795
|
}
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
warn$1(`Slot "${key}" invoked outside of the render function: ` +
|
|
5030
|
-
`this will not track dependencies used in the slot. ` +
|
|
5031
|
-
`Invoke the slot function inside the render function instead.`);
|
|
5032
|
-
}
|
|
5033
|
-
return normalizeSlotValue(rawSlot(...args));
|
|
5034
|
-
}, ctx);
|
|
5035
|
-
normalized._c = false;
|
|
5036
|
-
return normalized;
|
|
5037
|
-
};
|
|
5038
|
-
const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
5039
|
-
const ctx = rawSlots._ctx;
|
|
5040
|
-
for (const key in rawSlots) {
|
|
5041
|
-
if (isInternalKey(key))
|
|
5042
|
-
continue;
|
|
5043
|
-
const value = rawSlots[key];
|
|
5044
|
-
if (isFunction(value)) {
|
|
5045
|
-
slots[key] = normalizeSlot(key, value, ctx);
|
|
5046
|
-
}
|
|
5047
|
-
else if (value != null) {
|
|
5048
|
-
{
|
|
5049
|
-
warn$1(`Non-function value encountered for slot "${key}". ` +
|
|
5050
|
-
`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?`);
|
|
5051
4818
|
}
|
|
5052
|
-
const normalized = normalizeSlotValue(value);
|
|
5053
|
-
slots[key] = () => normalized;
|
|
5054
4819
|
}
|
|
5055
4820
|
}
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
warn$1(`Non-function value encountered for default slot. ` +
|
|
5061
|
-
`Prefer function slots for better performance.`);
|
|
5062
|
-
}
|
|
5063
|
-
const normalized = normalizeSlotValue(children);
|
|
5064
|
-
instance.slots.default = () => normalized;
|
|
5065
|
-
};
|
|
5066
|
-
const initSlots = (instance, children) => {
|
|
5067
|
-
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
5068
|
-
const type = children._;
|
|
5069
|
-
if (type) {
|
|
5070
|
-
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
5071
|
-
// we should avoid the proxy object polluting the slots of the internal instance
|
|
5072
|
-
instance.slots = toRaw(children);
|
|
5073
|
-
// make compiler marker non-enumerable
|
|
5074
|
-
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.`);
|
|
5075
4825
|
}
|
|
5076
|
-
|
|
5077
|
-
|
|
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>.`);
|
|
5078
4831
|
}
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
instance.slots = {};
|
|
5082
|
-
if (children) {
|
|
5083
|
-
normalizeVNodeSlots(instance, children);
|
|
4832
|
+
if (!isObject(data)) {
|
|
4833
|
+
warn$1(`data() should return an object.`);
|
|
5084
4834
|
}
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
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
|
+
}
|
|
5100
4850
|
}
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
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.`);
|
|
5105
4865
|
}
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
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);
|
|
5117
4884
|
}
|
|
5118
4885
|
}
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
4886
|
+
}
|
|
4887
|
+
if (watchOptions) {
|
|
4888
|
+
for (const key in watchOptions) {
|
|
4889
|
+
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
5122
4890
|
}
|
|
5123
|
-
deletionComparisonTarget = children;
|
|
5124
4891
|
}
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
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
|
+
});
|
|
5129
4899
|
}
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
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));
|
|
5136
4909
|
}
|
|
5137
4910
|
}
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
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;
|
|
4941
|
+
}
|
|
4942
|
+
if (inheritAttrs != null) {
|
|
4943
|
+
instance.inheritAttrs = inheritAttrs;
|
|
5155
4944
|
}
|
|
4945
|
+
// asset options.
|
|
4946
|
+
if (components)
|
|
4947
|
+
instance.components = components;
|
|
4948
|
+
if (directives)
|
|
4949
|
+
instance.directives = directives;
|
|
5156
4950
|
}
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
function withDirectives(vnode, directives) {
|
|
5161
|
-
const internalInstance = currentRenderingInstance;
|
|
5162
|
-
if (internalInstance === null) {
|
|
5163
|
-
warn$1(`withDirectives can only be used inside render functions.`);
|
|
5164
|
-
return vnode;
|
|
4951
|
+
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
|
|
4952
|
+
if (isArray(injectOptions)) {
|
|
4953
|
+
injectOptions = normalizeInject(injectOptions);
|
|
5165
4954
|
}
|
|
5166
|
-
const
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
}
|
|
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
|
+
}
|
|
5176
4965
|
}
|
|
5177
|
-
|
|
5178
|
-
|
|
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);
|
|
5179
4995
|
}
|
|
5180
|
-
bindings.push({
|
|
5181
|
-
dir,
|
|
5182
|
-
instance,
|
|
5183
|
-
value,
|
|
5184
|
-
oldValue: void 0,
|
|
5185
|
-
arg,
|
|
5186
|
-
modifiers
|
|
5187
|
-
});
|
|
5188
4996
|
}
|
|
5189
|
-
return vnode;
|
|
5190
4997
|
}
|
|
5191
|
-
function
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
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);
|
|
5198
5011
|
}
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
// disable tracking inside all lifecycle hooks
|
|
5202
|
-
// since they can potentially be called inside effects.
|
|
5203
|
-
pauseTracking();
|
|
5204
|
-
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
5205
|
-
vnode.el,
|
|
5206
|
-
binding,
|
|
5207
|
-
vnode,
|
|
5208
|
-
prevVNode
|
|
5209
|
-
]);
|
|
5210
|
-
resetTracking();
|
|
5012
|
+
else {
|
|
5013
|
+
warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
5211
5014
|
}
|
|
5212
5015
|
}
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
}
|
|
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
|
+
}
|
|
5235
5038
|
}
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
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;
|
|
5241
5056
|
}
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5057
|
+
}
|
|
5058
|
+
else {
|
|
5059
|
+
resolved = {};
|
|
5060
|
+
if (globalMixins.length) {
|
|
5061
|
+
globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
5245
5062
|
}
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
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)) {
|
|
5274
5778
|
installedPlugins.add(plugin);
|
|
5275
5779
|
plugin(app, ...options);
|
|
5276
5780
|
}
|
|
@@ -5320,6 +5824,12 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
5320
5824
|
},
|
|
5321
5825
|
mount(rootContainer, isHydrate, isSVG) {
|
|
5322
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
|
+
}
|
|
5323
5833
|
const vnode = createVNode(rootComponent, rootProps);
|
|
5324
5834
|
// store app context on the root VNode.
|
|
5325
5835
|
// this will be set on the root instance on initial mount.
|
|
@@ -5370,8 +5880,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
5370
5880
|
warn$1(`App already provides property with key "${String(key)}". ` +
|
|
5371
5881
|
`It will be overwritten with the new value.`);
|
|
5372
5882
|
}
|
|
5373
|
-
// TypeScript doesn't allow symbols as index type
|
|
5374
|
-
// https://github.com/Microsoft/TypeScript/issues/24587
|
|
5375
5883
|
context.provides[key] = value;
|
|
5376
5884
|
return app;
|
|
5377
5885
|
}
|
|
@@ -5488,7 +5996,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
5488
5996
|
// Hydration also depends on some renderer internal logic which needs to be
|
|
5489
5997
|
// passed in via arguments.
|
|
5490
5998
|
function createHydrationFunctions(rendererInternals) {
|
|
5491
|
-
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;
|
|
5492
6000
|
const hydrate = (vnode, container) => {
|
|
5493
6001
|
if (!container.hasChildNodes()) {
|
|
5494
6002
|
warn$1(`Attempting to hydrate existing markup but container is empty. ` +
|
|
@@ -5508,14 +6016,26 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
5508
6016
|
const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
|
5509
6017
|
const isFragmentStart = isComment(node) && node.data === '[';
|
|
5510
6018
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
5511
|
-
const { type, ref, shapeFlag } = vnode;
|
|
6019
|
+
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
5512
6020
|
const domType = node.nodeType;
|
|
5513
6021
|
vnode.el = node;
|
|
6022
|
+
if (patchFlag === -2 /* BAIL */) {
|
|
6023
|
+
optimized = false;
|
|
6024
|
+
vnode.dynamicChildren = null;
|
|
6025
|
+
}
|
|
5514
6026
|
let nextNode = null;
|
|
5515
6027
|
switch (type) {
|
|
5516
6028
|
case Text:
|
|
5517
6029
|
if (domType !== 3 /* TEXT */) {
|
|
5518
|
-
|
|
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('')), parentNode(node), node);
|
|
6034
|
+
nextNode = node;
|
|
6035
|
+
}
|
|
6036
|
+
else {
|
|
6037
|
+
nextNode = onMismatch();
|
|
6038
|
+
}
|
|
5519
6039
|
}
|
|
5520
6040
|
else {
|
|
5521
6041
|
if (node.data !== vnode.children) {
|
|
@@ -5589,6 +6109,12 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
5589
6109
|
nextNode = isFragmentStart
|
|
5590
6110
|
? locateClosingAsyncAnchor(node)
|
|
5591
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
|
+
}
|
|
5592
6118
|
// #3787
|
|
5593
6119
|
// if component is async, it may get moved / unmounted before its
|
|
5594
6120
|
// inner component is loaded, so we need to give it a placeholder
|
|
@@ -6252,8 +6778,9 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
6252
6778
|
const fragmentStartAnchor = (n2.el = n1 ? n1.el : hostCreateText(''));
|
|
6253
6779
|
const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
|
|
6254
6780
|
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
|
6255
|
-
if (
|
|
6256
|
-
|
|
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
|
|
6257
6784
|
patchFlag = 0;
|
|
6258
6785
|
optimized = false;
|
|
6259
6786
|
dynamicChildren = null;
|
|
@@ -6387,7 +6914,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
6387
6914
|
}
|
|
6388
6915
|
else {
|
|
6389
6916
|
// no update needed. just copy over properties
|
|
6390
|
-
n2.component = n1.component;
|
|
6391
6917
|
n2.el = n1.el;
|
|
6392
6918
|
instance.vnode = n2;
|
|
6393
6919
|
}
|
|
@@ -6470,7 +6996,10 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
6470
6996
|
// activated hook for keep-alive roots.
|
|
6471
6997
|
// #1742 activated hook must be accessed after first render
|
|
6472
6998
|
// since the hook may be injected by a child keep-alive
|
|
6473
|
-
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 */)) {
|
|
6474
7003
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
6475
7004
|
}
|
|
6476
7005
|
instance.isMounted = true;
|
|
@@ -6553,9 +7082,9 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
6553
7082
|
}
|
|
6554
7083
|
};
|
|
6555
7084
|
// create reactive effect for rendering
|
|
6556
|
-
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
|
|
6557
7086
|
));
|
|
6558
|
-
const update = (instance.update = effect.run
|
|
7087
|
+
const update = (instance.update = () => effect.run());
|
|
6559
7088
|
update.id = instance.uid;
|
|
6560
7089
|
// allowRecurse
|
|
6561
7090
|
// #1801, #2043 component render effects should allow recursive updates
|
|
@@ -6567,7 +7096,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
6567
7096
|
effect.onTrigger = instance.rtg
|
|
6568
7097
|
? e => invokeArrayFns(instance.rtg, e)
|
|
6569
7098
|
: void 0;
|
|
6570
|
-
// @ts-ignore (for scheduler)
|
|
6571
7099
|
update.ownerInstance = instance;
|
|
6572
7100
|
}
|
|
6573
7101
|
update();
|
|
@@ -7358,90 +7886,30 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
7358
7886
|
vnode.targetAnchor = targetNode;
|
|
7359
7887
|
}
|
|
7360
7888
|
else {
|
|
7361
|
-
vnode.anchor = nextSibling(node);
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
7380
|
-
}
|
|
7381
|
-
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
7382
|
-
/**
|
|
7383
|
-
* @private
|
|
7384
|
-
*/
|
|
7385
|
-
function resolveDynamicComponent(component) {
|
|
7386
|
-
if (isString(component)) {
|
|
7387
|
-
return resolveAsset(COMPONENTS, component, false) || component;
|
|
7388
|
-
}
|
|
7389
|
-
else {
|
|
7390
|
-
// invalid types will fallthrough to createVNode and raise warning
|
|
7391
|
-
return (component || NULL_DYNAMIC_COMPONENT);
|
|
7392
|
-
}
|
|
7393
|
-
}
|
|
7394
|
-
/**
|
|
7395
|
-
* @private
|
|
7396
|
-
*/
|
|
7397
|
-
function resolveDirective(name) {
|
|
7398
|
-
return resolveAsset(DIRECTIVES, name);
|
|
7399
|
-
}
|
|
7400
|
-
// implementation
|
|
7401
|
-
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
7402
|
-
const instance = currentRenderingInstance || currentInstance;
|
|
7403
|
-
if (instance) {
|
|
7404
|
-
const Component = instance.type;
|
|
7405
|
-
// explicit self name has highest priority
|
|
7406
|
-
if (type === COMPONENTS) {
|
|
7407
|
-
const selfName = getComponentName(Component);
|
|
7408
|
-
if (selfName &&
|
|
7409
|
-
(selfName === name ||
|
|
7410
|
-
selfName === camelize(name) ||
|
|
7411
|
-
selfName === capitalize(camelize(name)))) {
|
|
7412
|
-
return Component;
|
|
7413
|
-
}
|
|
7414
|
-
}
|
|
7415
|
-
const res =
|
|
7416
|
-
// local registration
|
|
7417
|
-
// check instance[type] first which is resolved for options API
|
|
7418
|
-
resolve(instance[type] || Component[type], name) ||
|
|
7419
|
-
// global registration
|
|
7420
|
-
resolve(instance.appContext[type], name);
|
|
7421
|
-
if (!res && maybeSelfReference) {
|
|
7422
|
-
// fallback to implicit self-reference
|
|
7423
|
-
return Component;
|
|
7424
|
-
}
|
|
7425
|
-
if (warnMissing && !res) {
|
|
7426
|
-
const extra = type === COMPONENTS
|
|
7427
|
-
? `\nIf this is a native custom element, make sure to exclude it from ` +
|
|
7428
|
-
`component resolution via compilerOptions.isCustomElement.`
|
|
7429
|
-
: ``;
|
|
7430
|
-
warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
|
7889
|
+
vnode.anchor = nextSibling(node);
|
|
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
|
+
}
|
|
7431
7907
|
}
|
|
7432
|
-
return res;
|
|
7433
|
-
}
|
|
7434
|
-
else {
|
|
7435
|
-
warn$1(`resolve${capitalize(type.slice(0, -1))} ` +
|
|
7436
|
-
`can only be used in render() or setup().`);
|
|
7437
7908
|
}
|
|
7909
|
+
return vnode.anchor && nextSibling(vnode.anchor);
|
|
7438
7910
|
}
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
(registry[name] ||
|
|
7442
|
-
registry[camelize(name)] ||
|
|
7443
|
-
registry[capitalize(camelize(name))]));
|
|
7444
|
-
}
|
|
7911
|
+
// Force-casted public typing for h and TSX props inference
|
|
7912
|
+
const Teleport = TeleportImpl;
|
|
7445
7913
|
|
|
7446
7914
|
const Fragment = Symbol('Fragment' );
|
|
7447
7915
|
const Text = Symbol('Text' );
|
|
@@ -7645,6 +8113,15 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
7645
8113
|
if (children) {
|
|
7646
8114
|
normalizeChildren(cloned, children);
|
|
7647
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 */;
|
|
7648
8125
|
return cloned;
|
|
7649
8126
|
}
|
|
7650
8127
|
// class component normalization.
|
|
@@ -7722,606 +8199,194 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
7722
8199
|
children: patchFlag === -1 /* HOISTED */ && isArray(children)
|
|
7723
8200
|
? children.map(deepCloneVNode)
|
|
7724
8201
|
: children,
|
|
7725
|
-
target: vnode.target,
|
|
7726
|
-
targetAnchor: vnode.targetAnchor,
|
|
7727
|
-
staticCount: vnode.staticCount,
|
|
7728
|
-
shapeFlag: vnode.shapeFlag,
|
|
7729
|
-
// if the vnode is cloned with extra props, we can no longer assume its
|
|
7730
|
-
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
7731
|
-
// note: preserve flag for fragments since they use the flag for children
|
|
7732
|
-
// fast paths only.
|
|
7733
|
-
patchFlag: extraProps && vnode.type !== Fragment
|
|
7734
|
-
? patchFlag === -1 // hoisted node
|
|
7735
|
-
? 16 /* FULL_PROPS */
|
|
7736
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
7737
|
-
: patchFlag,
|
|
7738
|
-
dynamicProps: vnode.dynamicProps,
|
|
7739
|
-
dynamicChildren: vnode.dynamicChildren,
|
|
7740
|
-
appContext: vnode.appContext,
|
|
7741
|
-
dirs: vnode.dirs,
|
|
7742
|
-
transition: vnode.transition,
|
|
7743
|
-
// These should technically only be non-null on mounted VNodes. However,
|
|
7744
|
-
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
7745
|
-
// them since them being non-null during a mount doesn't affect the logic as
|
|
7746
|
-
// they will simply be overwritten.
|
|
7747
|
-
component: vnode.component,
|
|
7748
|
-
suspense: vnode.suspense,
|
|
7749
|
-
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
7750
|
-
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
7751
|
-
el: vnode.el,
|
|
7752
|
-
anchor: vnode.anchor
|
|
7753
|
-
};
|
|
7754
|
-
return cloned;
|
|
7755
|
-
}
|
|
7756
|
-
/**
|
|
7757
|
-
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
7758
|
-
* https://github.com/vitejs/vite/issues/2022
|
|
7759
|
-
*/
|
|
7760
|
-
function deepCloneVNode(vnode) {
|
|
7761
|
-
const cloned = cloneVNode(vnode);
|
|
7762
|
-
if (isArray(vnode.children)) {
|
|
7763
|
-
cloned.children = vnode.children.map(deepCloneVNode);
|
|
7764
|
-
}
|
|
7765
|
-
return cloned;
|
|
7766
|
-
}
|
|
7767
|
-
/**
|
|
7768
|
-
* @private
|
|
7769
|
-
*/
|
|
7770
|
-
function createTextVNode(text = ' ', flag = 0) {
|
|
7771
|
-
return createVNode(Text, null, text, flag);
|
|
7772
|
-
}
|
|
7773
|
-
/**
|
|
7774
|
-
* @private
|
|
7775
|
-
*/
|
|
7776
|
-
function createStaticVNode(content, numberOfNodes) {
|
|
7777
|
-
// A static vnode can contain multiple stringified elements, and the number
|
|
7778
|
-
// of elements is necessary for hydration.
|
|
7779
|
-
const vnode = createVNode(Static, null, content);
|
|
7780
|
-
vnode.staticCount = numberOfNodes;
|
|
7781
|
-
return vnode;
|
|
7782
|
-
}
|
|
7783
|
-
/**
|
|
7784
|
-
* @private
|
|
7785
|
-
*/
|
|
7786
|
-
function createCommentVNode(text = '',
|
|
7787
|
-
// when used as the v-else branch, the comment node must be created as a
|
|
7788
|
-
// block to ensure correct updates.
|
|
7789
|
-
asBlock = false) {
|
|
7790
|
-
return asBlock
|
|
7791
|
-
? (openBlock(), createBlock(Comment, null, text))
|
|
7792
|
-
: createVNode(Comment, null, text);
|
|
7793
|
-
}
|
|
7794
|
-
function normalizeVNode(child) {
|
|
7795
|
-
if (child == null || typeof child === 'boolean') {
|
|
7796
|
-
// empty placeholder
|
|
7797
|
-
return createVNode(Comment);
|
|
7798
|
-
}
|
|
7799
|
-
else if (isArray(child)) {
|
|
7800
|
-
// fragment
|
|
7801
|
-
return createVNode(Fragment, null,
|
|
7802
|
-
// #3666, avoid reference pollution when reusing vnode
|
|
7803
|
-
child.slice());
|
|
7804
|
-
}
|
|
7805
|
-
else if (typeof child === 'object') {
|
|
7806
|
-
// already vnode, this should be the most common since compiled templates
|
|
7807
|
-
// always produce all-vnode children arrays
|
|
7808
|
-
return cloneIfMounted(child);
|
|
7809
|
-
}
|
|
7810
|
-
else {
|
|
7811
|
-
// strings and numbers
|
|
7812
|
-
return createVNode(Text, null, String(child));
|
|
7813
|
-
}
|
|
7814
|
-
}
|
|
7815
|
-
// optimized normalization for template-compiled render fns
|
|
7816
|
-
function cloneIfMounted(child) {
|
|
7817
|
-
return child.el === null || child.memo ? child : cloneVNode(child);
|
|
7818
|
-
}
|
|
7819
|
-
function normalizeChildren(vnode, children) {
|
|
7820
|
-
let type = 0;
|
|
7821
|
-
const { shapeFlag } = vnode;
|
|
7822
|
-
if (children == null) {
|
|
7823
|
-
children = null;
|
|
7824
|
-
}
|
|
7825
|
-
else if (isArray(children)) {
|
|
7826
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
7827
|
-
}
|
|
7828
|
-
else if (typeof children === 'object') {
|
|
7829
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
7830
|
-
// Normalize slot to plain children for plain element and Teleport
|
|
7831
|
-
const slot = children.default;
|
|
7832
|
-
if (slot) {
|
|
7833
|
-
// _c marker is added by withCtx() indicating this is a compiled slot
|
|
7834
|
-
slot._c && (slot._d = false);
|
|
7835
|
-
normalizeChildren(vnode, slot());
|
|
7836
|
-
slot._c && (slot._d = true);
|
|
7837
|
-
}
|
|
7838
|
-
return;
|
|
7839
|
-
}
|
|
7840
|
-
else {
|
|
7841
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
7842
|
-
const slotFlag = children._;
|
|
7843
|
-
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
7844
|
-
children._ctx = currentRenderingInstance;
|
|
7845
|
-
}
|
|
7846
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
7847
|
-
// a child component receives forwarded slots from the parent.
|
|
7848
|
-
// its slot type is determined by its parent's slot type.
|
|
7849
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
7850
|
-
children._ = 1 /* STABLE */;
|
|
7851
|
-
}
|
|
7852
|
-
else {
|
|
7853
|
-
children._ = 2 /* DYNAMIC */;
|
|
7854
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
7855
|
-
}
|
|
7856
|
-
}
|
|
7857
|
-
}
|
|
7858
|
-
}
|
|
7859
|
-
else if (isFunction(children)) {
|
|
7860
|
-
children = { default: children, _ctx: currentRenderingInstance };
|
|
7861
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
7862
|
-
}
|
|
7863
|
-
else {
|
|
7864
|
-
children = String(children);
|
|
7865
|
-
// force teleport children to array so it can be moved around
|
|
7866
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
7867
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
7868
|
-
children = [createTextVNode(children)];
|
|
7869
|
-
}
|
|
7870
|
-
else {
|
|
7871
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
7872
|
-
}
|
|
7873
|
-
}
|
|
7874
|
-
vnode.children = children;
|
|
7875
|
-
vnode.shapeFlag |= type;
|
|
7876
|
-
}
|
|
7877
|
-
function mergeProps(...args) {
|
|
7878
|
-
const ret = {};
|
|
7879
|
-
for (let i = 0; i < args.length; i++) {
|
|
7880
|
-
const toMerge = args[i];
|
|
7881
|
-
for (const key in toMerge) {
|
|
7882
|
-
if (key === 'class') {
|
|
7883
|
-
if (ret.class !== toMerge.class) {
|
|
7884
|
-
ret.class = normalizeClass([ret.class, toMerge.class]);
|
|
7885
|
-
}
|
|
7886
|
-
}
|
|
7887
|
-
else if (key === 'style') {
|
|
7888
|
-
ret.style = normalizeStyle([ret.style, toMerge.style]);
|
|
7889
|
-
}
|
|
7890
|
-
else if (isOn(key)) {
|
|
7891
|
-
const existing = ret[key];
|
|
7892
|
-
const incoming = toMerge[key];
|
|
7893
|
-
if (incoming &&
|
|
7894
|
-
existing !== incoming &&
|
|
7895
|
-
!(isArray(existing) && existing.includes(incoming))) {
|
|
7896
|
-
ret[key] = existing
|
|
7897
|
-
? [].concat(existing, incoming)
|
|
7898
|
-
: incoming;
|
|
7899
|
-
}
|
|
7900
|
-
}
|
|
7901
|
-
else if (key !== '') {
|
|
7902
|
-
ret[key] = toMerge[key];
|
|
7903
|
-
}
|
|
7904
|
-
}
|
|
7905
|
-
}
|
|
7906
|
-
return ret;
|
|
7907
|
-
}
|
|
7908
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
7909
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
7910
|
-
vnode,
|
|
7911
|
-
prevVNode
|
|
7912
|
-
]);
|
|
7913
|
-
}
|
|
7914
|
-
|
|
7915
|
-
/**
|
|
7916
|
-
* Actual implementation
|
|
7917
|
-
*/
|
|
7918
|
-
function renderList(source, renderItem, cache, index) {
|
|
7919
|
-
let ret;
|
|
7920
|
-
const cached = (cache && cache[index]);
|
|
7921
|
-
if (isArray(source) || isString(source)) {
|
|
7922
|
-
ret = new Array(source.length);
|
|
7923
|
-
for (let i = 0, l = source.length; i < l; i++) {
|
|
7924
|
-
ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
|
|
7925
|
-
}
|
|
7926
|
-
}
|
|
7927
|
-
else if (typeof source === 'number') {
|
|
7928
|
-
if (!Number.isInteger(source)) {
|
|
7929
|
-
warn$1(`The v-for range expect an integer value but got ${source}.`);
|
|
7930
|
-
return [];
|
|
7931
|
-
}
|
|
7932
|
-
ret = new Array(source);
|
|
7933
|
-
for (let i = 0; i < source; i++) {
|
|
7934
|
-
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
7935
|
-
}
|
|
7936
|
-
}
|
|
7937
|
-
else if (isObject(source)) {
|
|
7938
|
-
if (source[Symbol.iterator]) {
|
|
7939
|
-
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
7940
|
-
}
|
|
7941
|
-
else {
|
|
7942
|
-
const keys = Object.keys(source);
|
|
7943
|
-
ret = new Array(keys.length);
|
|
7944
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
7945
|
-
const key = keys[i];
|
|
7946
|
-
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
7947
|
-
}
|
|
7948
|
-
}
|
|
7949
|
-
}
|
|
7950
|
-
else {
|
|
7951
|
-
ret = [];
|
|
7952
|
-
}
|
|
7953
|
-
if (cache) {
|
|
7954
|
-
cache[index] = ret;
|
|
7955
|
-
}
|
|
7956
|
-
return ret;
|
|
7957
|
-
}
|
|
7958
|
-
|
|
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
|
+
}
|
|
7959
8233
|
/**
|
|
7960
|
-
*
|
|
7961
|
-
*
|
|
8234
|
+
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
8235
|
+
* https://github.com/vitejs/vite/issues/2022
|
|
7962
8236
|
*/
|
|
7963
|
-
function
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
if (isArray(slot)) {
|
|
7968
|
-
for (let j = 0; j < slot.length; j++) {
|
|
7969
|
-
slots[slot[j].name] = slot[j].fn;
|
|
7970
|
-
}
|
|
7971
|
-
}
|
|
7972
|
-
else if (slot) {
|
|
7973
|
-
// conditional single slot generated by <template v-if="..." #foo>
|
|
7974
|
-
slots[slot.name] = slot.fn;
|
|
7975
|
-
}
|
|
8237
|
+
function deepCloneVNode(vnode) {
|
|
8238
|
+
const cloned = cloneVNode(vnode);
|
|
8239
|
+
if (isArray(vnode.children)) {
|
|
8240
|
+
cloned.children = vnode.children.map(deepCloneVNode);
|
|
7976
8241
|
}
|
|
7977
|
-
return
|
|
7978
|
-
}
|
|
7979
|
-
|
|
8242
|
+
return cloned;
|
|
8243
|
+
}
|
|
7980
8244
|
/**
|
|
7981
|
-
* Compiler runtime helper for rendering `<slot/>`
|
|
7982
8245
|
* @private
|
|
7983
8246
|
*/
|
|
7984
|
-
function
|
|
7985
|
-
|
|
7986
|
-
// the compiler and guaranteed to be a function returning an array
|
|
7987
|
-
fallback, noSlotted) {
|
|
7988
|
-
if (currentRenderingInstance.isCE ||
|
|
7989
|
-
(currentRenderingInstance.parent &&
|
|
7990
|
-
isAsyncWrapper(currentRenderingInstance.parent) &&
|
|
7991
|
-
currentRenderingInstance.parent.isCE)) {
|
|
7992
|
-
return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
|
|
7993
|
-
}
|
|
7994
|
-
let slot = slots[name];
|
|
7995
|
-
if (slot && slot.length > 1) {
|
|
7996
|
-
warn$1(`SSR-optimized slot function detected in a non-SSR-optimized render ` +
|
|
7997
|
-
`function. You need to mark this component with $dynamic-slots in the ` +
|
|
7998
|
-
`parent template.`);
|
|
7999
|
-
slot = () => [];
|
|
8000
|
-
}
|
|
8001
|
-
// a compiled slot disables block tracking by default to avoid manual
|
|
8002
|
-
// invocation interfering with template-based block tracking, but in
|
|
8003
|
-
// `renderSlot` we can be sure that it's template-based so we can force
|
|
8004
|
-
// enable it.
|
|
8005
|
-
if (slot && slot._c) {
|
|
8006
|
-
slot._d = false;
|
|
8007
|
-
}
|
|
8008
|
-
openBlock();
|
|
8009
|
-
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
8010
|
-
const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
|
|
8011
|
-
? 64 /* STABLE_FRAGMENT */
|
|
8012
|
-
: -2 /* BAIL */);
|
|
8013
|
-
if (!noSlotted && rendered.scopeId) {
|
|
8014
|
-
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
8015
|
-
}
|
|
8016
|
-
if (slot && slot._c) {
|
|
8017
|
-
slot._d = true;
|
|
8018
|
-
}
|
|
8019
|
-
return rendered;
|
|
8247
|
+
function createTextVNode(text = ' ', flag = 0) {
|
|
8248
|
+
return createVNode(Text, null, text, flag);
|
|
8020
8249
|
}
|
|
8021
|
-
function ensureValidVNode(vnodes) {
|
|
8022
|
-
return vnodes.some(child => {
|
|
8023
|
-
if (!isVNode(child))
|
|
8024
|
-
return true;
|
|
8025
|
-
if (child.type === Comment)
|
|
8026
|
-
return false;
|
|
8027
|
-
if (child.type === Fragment &&
|
|
8028
|
-
!ensureValidVNode(child.children))
|
|
8029
|
-
return false;
|
|
8030
|
-
return true;
|
|
8031
|
-
})
|
|
8032
|
-
? vnodes
|
|
8033
|
-
: null;
|
|
8034
|
-
}
|
|
8035
|
-
|
|
8036
8250
|
/**
|
|
8037
|
-
* For prefixing keys in v-on="obj" with "on"
|
|
8038
8251
|
* @private
|
|
8039
|
-
*/
|
|
8040
|
-
function
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
return
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
}
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
// during render and is a major hotspot. The most expensive part of this
|
|
8102
|
-
// is the multiple hasOwn() calls. It's much faster to do a simple property
|
|
8103
|
-
// access on a plain object, so we use an accessCache object (with null
|
|
8104
|
-
// prototype) to memoize what access type a key corresponds to.
|
|
8105
|
-
let normalizedProps;
|
|
8106
|
-
if (key[0] !== '$') {
|
|
8107
|
-
const n = accessCache[key];
|
|
8108
|
-
if (n !== undefined) {
|
|
8109
|
-
switch (n) {
|
|
8110
|
-
case 1 /* SETUP */:
|
|
8111
|
-
return setupState[key];
|
|
8112
|
-
case 2 /* DATA */:
|
|
8113
|
-
return data[key];
|
|
8114
|
-
case 4 /* CONTEXT */:
|
|
8115
|
-
return ctx[key];
|
|
8116
|
-
case 3 /* PROPS */:
|
|
8117
|
-
return props[key];
|
|
8118
|
-
// default: just fallthrough
|
|
8119
|
-
}
|
|
8120
|
-
}
|
|
8121
|
-
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
8122
|
-
accessCache[key] = 1 /* SETUP */;
|
|
8123
|
-
return setupState[key];
|
|
8124
|
-
}
|
|
8125
|
-
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
8126
|
-
accessCache[key] = 2 /* DATA */;
|
|
8127
|
-
return data[key];
|
|
8128
|
-
}
|
|
8129
|
-
else if (
|
|
8130
|
-
// only cache other properties when instance has declared (thus stable)
|
|
8131
|
-
// props
|
|
8132
|
-
(normalizedProps = instance.propsOptions[0]) &&
|
|
8133
|
-
hasOwn(normalizedProps, key)) {
|
|
8134
|
-
accessCache[key] = 3 /* PROPS */;
|
|
8135
|
-
return props[key];
|
|
8136
|
-
}
|
|
8137
|
-
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
8138
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
8139
|
-
return ctx[key];
|
|
8140
|
-
}
|
|
8141
|
-
else if (shouldCacheAccess) {
|
|
8142
|
-
accessCache[key] = 0 /* OTHER */;
|
|
8143
|
-
}
|
|
8144
|
-
}
|
|
8145
|
-
const publicGetter = publicPropertiesMap[key];
|
|
8146
|
-
let cssModule, globalProperties;
|
|
8147
|
-
// public $xxx properties
|
|
8148
|
-
if (publicGetter) {
|
|
8149
|
-
if (key === '$attrs') {
|
|
8150
|
-
track(instance, "get" /* GET */, key);
|
|
8151
|
-
markAttrsAccessed();
|
|
8152
|
-
}
|
|
8153
|
-
return publicGetter(instance);
|
|
8154
|
-
}
|
|
8155
|
-
else if (
|
|
8156
|
-
// css module (injected by vue-loader)
|
|
8157
|
-
(cssModule = type.__cssModules) &&
|
|
8158
|
-
(cssModule = cssModule[key])) {
|
|
8159
|
-
return cssModule;
|
|
8160
|
-
}
|
|
8161
|
-
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
8162
|
-
// user may set custom properties to `this` that start with `$`
|
|
8163
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
8164
|
-
return ctx[key];
|
|
8165
|
-
}
|
|
8166
|
-
else if (
|
|
8167
|
-
// global properties
|
|
8168
|
-
((globalProperties = appContext.config.globalProperties),
|
|
8169
|
-
hasOwn(globalProperties, key))) {
|
|
8170
|
-
{
|
|
8171
|
-
return globalProperties[key];
|
|
8172
|
-
}
|
|
8173
|
-
}
|
|
8174
|
-
else if (currentRenderingInstance &&
|
|
8175
|
-
(!isString(key) ||
|
|
8176
|
-
// #1091 avoid internal isRef/isVNode checks on component instance leading
|
|
8177
|
-
// to infinite warning loop
|
|
8178
|
-
key.indexOf('__v') !== 0)) {
|
|
8179
|
-
if (data !== EMPTY_OBJ &&
|
|
8180
|
-
(key[0] === '$' || key[0] === '_') &&
|
|
8181
|
-
hasOwn(data, key)) {
|
|
8182
|
-
warn$1(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved ` +
|
|
8183
|
-
`character ("$" or "_") and is not proxied on the render context.`);
|
|
8184
|
-
}
|
|
8185
|
-
else if (instance === currentRenderingInstance) {
|
|
8186
|
-
warn$1(`Property ${JSON.stringify(key)} was accessed during render ` +
|
|
8187
|
-
`but is not defined on instance.`);
|
|
8252
|
+
*/
|
|
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);
|
|
8188
8314
|
}
|
|
8189
|
-
|
|
8190
|
-
},
|
|
8191
|
-
set({ _: instance }, key, value) {
|
|
8192
|
-
const { data, setupState, ctx } = instance;
|
|
8193
|
-
if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
8194
|
-
setupState[key] = value;
|
|
8195
|
-
return true;
|
|
8196
|
-
}
|
|
8197
|
-
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
8198
|
-
data[key] = value;
|
|
8199
|
-
return true;
|
|
8200
|
-
}
|
|
8201
|
-
else if (hasOwn(instance.props, key)) {
|
|
8202
|
-
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
|
8203
|
-
return false;
|
|
8204
|
-
}
|
|
8205
|
-
if (key[0] === '$' && key.slice(1) in instance) {
|
|
8206
|
-
warn$1(`Attempting to mutate public property "${key}". ` +
|
|
8207
|
-
`Properties starting with $ are reserved and readonly.`, instance);
|
|
8208
|
-
return false;
|
|
8315
|
+
return;
|
|
8209
8316
|
}
|
|
8210
8317
|
else {
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
value
|
|
8216
|
-
});
|
|
8318
|
+
type = 32 /* SLOTS_CHILDREN */;
|
|
8319
|
+
const slotFlag = children._;
|
|
8320
|
+
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
8321
|
+
children._ctx = currentRenderingInstance;
|
|
8217
8322
|
}
|
|
8218
|
-
else {
|
|
8219
|
-
|
|
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
|
+
}
|
|
8220
8333
|
}
|
|
8221
8334
|
}
|
|
8222
|
-
return true;
|
|
8223
|
-
},
|
|
8224
|
-
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
8225
|
-
let normalizedProps;
|
|
8226
|
-
return (!!accessCache[key] ||
|
|
8227
|
-
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
8228
|
-
(setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
|
8229
|
-
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
8230
|
-
hasOwn(ctx, key) ||
|
|
8231
|
-
hasOwn(publicPropertiesMap, key) ||
|
|
8232
|
-
hasOwn(appContext.config.globalProperties, key));
|
|
8233
|
-
},
|
|
8234
|
-
defineProperty(target, key, descriptor) {
|
|
8235
|
-
if (descriptor.get != null) {
|
|
8236
|
-
// invalidate key cache of a getter based property #5417
|
|
8237
|
-
target._.accessCache[key] = 0;
|
|
8238
|
-
}
|
|
8239
|
-
else if (hasOwn(descriptor, 'value')) {
|
|
8240
|
-
this.set(target, key, descriptor.value, null);
|
|
8241
|
-
}
|
|
8242
|
-
return Reflect.defineProperty(target, key, descriptor);
|
|
8243
8335
|
}
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
// fast path for unscopables when using `with` block
|
|
8255
|
-
if (key === Symbol.unscopables) {
|
|
8256
|
-
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)];
|
|
8257
8346
|
}
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
has(_, key) {
|
|
8261
|
-
const has = key[0] !== '_' && !isGloballyWhitelisted(key);
|
|
8262
|
-
if (!has && PublicInstanceProxyHandlers.has(_, key)) {
|
|
8263
|
-
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 */;
|
|
8264
8349
|
}
|
|
8265
|
-
return has;
|
|
8266
|
-
}
|
|
8267
|
-
});
|
|
8268
|
-
// dev only
|
|
8269
|
-
// In dev mode, the proxy target exposes the same properties as seen on `this`
|
|
8270
|
-
// for easier console inspection. In prod mode it will be an empty object so
|
|
8271
|
-
// these properties definitions can be skipped.
|
|
8272
|
-
function createDevRenderContext(instance) {
|
|
8273
|
-
const target = {};
|
|
8274
|
-
// expose internal instance for proxy handlers
|
|
8275
|
-
Object.defineProperty(target, `_`, {
|
|
8276
|
-
configurable: true,
|
|
8277
|
-
enumerable: false,
|
|
8278
|
-
get: () => instance
|
|
8279
|
-
});
|
|
8280
|
-
// expose public properties
|
|
8281
|
-
Object.keys(publicPropertiesMap).forEach(key => {
|
|
8282
|
-
Object.defineProperty(target, key, {
|
|
8283
|
-
configurable: true,
|
|
8284
|
-
enumerable: false,
|
|
8285
|
-
get: () => publicPropertiesMap[key](instance),
|
|
8286
|
-
// intercepted by the proxy so no need for implementation,
|
|
8287
|
-
// but needed to prevent set errors
|
|
8288
|
-
set: NOOP
|
|
8289
|
-
});
|
|
8290
|
-
});
|
|
8291
|
-
return target;
|
|
8292
|
-
}
|
|
8293
|
-
// dev only
|
|
8294
|
-
function exposePropsOnRenderContext(instance) {
|
|
8295
|
-
const { ctx, propsOptions: [propsOptions] } = instance;
|
|
8296
|
-
if (propsOptions) {
|
|
8297
|
-
Object.keys(propsOptions).forEach(key => {
|
|
8298
|
-
Object.defineProperty(ctx, key, {
|
|
8299
|
-
enumerable: true,
|
|
8300
|
-
configurable: true,
|
|
8301
|
-
get: () => instance.props[key],
|
|
8302
|
-
set: NOOP
|
|
8303
|
-
});
|
|
8304
|
-
});
|
|
8305
8350
|
}
|
|
8351
|
+
vnode.children = children;
|
|
8352
|
+
vnode.shapeFlag |= type;
|
|
8306
8353
|
}
|
|
8307
|
-
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
if (key
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
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];
|
|
8316
8380
|
}
|
|
8317
|
-
Object.defineProperty(ctx, key, {
|
|
8318
|
-
enumerable: true,
|
|
8319
|
-
configurable: true,
|
|
8320
|
-
get: () => setupState[key],
|
|
8321
|
-
set: NOOP
|
|
8322
|
-
});
|
|
8323
8381
|
}
|
|
8324
|
-
}
|
|
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
|
+
]);
|
|
8325
8390
|
}
|
|
8326
8391
|
|
|
8327
8392
|
const emptyAppContext = createAppContext();
|
|
@@ -8350,7 +8415,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
8350
8415
|
provides: parent ? parent.provides : Object.create(appContext.provides),
|
|
8351
8416
|
accessCache: null,
|
|
8352
8417
|
renderCache: [],
|
|
8353
|
-
// local
|
|
8418
|
+
// local resolved assets
|
|
8354
8419
|
components: null,
|
|
8355
8420
|
directives: null,
|
|
8356
8421
|
// resolved props and emits options
|
|
@@ -9106,7 +9171,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9106
9171
|
return false;
|
|
9107
9172
|
}
|
|
9108
9173
|
for (let i = 0; i < prev.length; i++) {
|
|
9109
|
-
if (prev[i]
|
|
9174
|
+
if (hasChanged(prev[i], memo[i])) {
|
|
9110
9175
|
return false;
|
|
9111
9176
|
}
|
|
9112
9177
|
}
|
|
@@ -9118,7 +9183,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9118
9183
|
}
|
|
9119
9184
|
|
|
9120
9185
|
// Core API ------------------------------------------------------------------
|
|
9121
|
-
const version = "3.2.
|
|
9186
|
+
const version = "3.2.35";
|
|
9122
9187
|
/**
|
|
9123
9188
|
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
|
9124
9189
|
* @internal
|
|
@@ -9595,11 +9660,11 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9595
9660
|
return key in el;
|
|
9596
9661
|
}
|
|
9597
9662
|
|
|
9598
|
-
function defineCustomElement(options,
|
|
9663
|
+
function defineCustomElement(options, hydrate) {
|
|
9599
9664
|
const Comp = defineComponent(options);
|
|
9600
9665
|
class VueCustomElement extends VueElement {
|
|
9601
9666
|
constructor(initialProps) {
|
|
9602
|
-
super(Comp, initialProps,
|
|
9667
|
+
super(Comp, initialProps, hydrate);
|
|
9603
9668
|
}
|
|
9604
9669
|
}
|
|
9605
9670
|
VueCustomElement.def = Comp;
|
|
@@ -9947,7 +10012,10 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9947
10012
|
removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
|
9948
10013
|
done && done();
|
|
9949
10014
|
};
|
|
10015
|
+
let isLeaving = false;
|
|
9950
10016
|
const finishLeave = (el, done) => {
|
|
10017
|
+
isLeaving = false;
|
|
10018
|
+
removeTransitionClass(el, leaveFromClass);
|
|
9951
10019
|
removeTransitionClass(el, leaveToClass);
|
|
9952
10020
|
removeTransitionClass(el, leaveActiveClass);
|
|
9953
10021
|
done && done();
|
|
@@ -9980,12 +10048,17 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
9980
10048
|
onEnter: makeEnterHook(false),
|
|
9981
10049
|
onAppear: makeEnterHook(true),
|
|
9982
10050
|
onLeave(el, done) {
|
|
10051
|
+
isLeaving = true;
|
|
9983
10052
|
const resolve = () => finishLeave(el, done);
|
|
9984
10053
|
addTransitionClass(el, leaveFromClass);
|
|
9985
10054
|
// force reflow so *-leave-from classes immediately take effect (#2593)
|
|
9986
10055
|
forceReflow();
|
|
9987
10056
|
addTransitionClass(el, leaveActiveClass);
|
|
9988
10057
|
nextFrame(() => {
|
|
10058
|
+
if (!isLeaving) {
|
|
10059
|
+
// cancelled
|
|
10060
|
+
return;
|
|
10061
|
+
}
|
|
9989
10062
|
removeTransitionClass(el, leaveFromClass);
|
|
9990
10063
|
addTransitionClass(el, leaveToClass);
|
|
9991
10064
|
if (!hasExplicitCallback(onLeave)) {
|
|
@@ -10277,7 +10350,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
10277
10350
|
}
|
|
10278
10351
|
|
|
10279
10352
|
const getModelAssigner = (vnode) => {
|
|
10280
|
-
const fn = vnode.props['onUpdate:modelValue']
|
|
10353
|
+
const fn = vnode.props['onUpdate:modelValue'] ||
|
|
10354
|
+
(false );
|
|
10281
10355
|
return isArray(fn) ? value => invokeArrayFns(fn, value) : fn;
|
|
10282
10356
|
};
|
|
10283
10357
|
function onCompositionStart(e) {
|
|
@@ -10287,14 +10361,9 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
10287
10361
|
const target = e.target;
|
|
10288
10362
|
if (target.composing) {
|
|
10289
10363
|
target.composing = false;
|
|
10290
|
-
|
|
10364
|
+
target.dispatchEvent(new Event('input'));
|
|
10291
10365
|
}
|
|
10292
10366
|
}
|
|
10293
|
-
function trigger$1(el, type) {
|
|
10294
|
-
const e = document.createEvent('HTMLEvents');
|
|
10295
|
-
e.initEvent(type, true, true);
|
|
10296
|
-
el.dispatchEvent(e);
|
|
10297
|
-
}
|
|
10298
10367
|
// We are exporting the v-model runtime directly as vnode hooks so that it can
|
|
10299
10368
|
// be tree-shaken in case v-model is never used.
|
|
10300
10369
|
const vModelText = {
|
|
@@ -10308,7 +10377,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
10308
10377
|
if (trim) {
|
|
10309
10378
|
domValue = domValue.trim();
|
|
10310
10379
|
}
|
|
10311
|
-
|
|
10380
|
+
if (castToNumber) {
|
|
10312
10381
|
domValue = toNumber(domValue);
|
|
10313
10382
|
}
|
|
10314
10383
|
el._assign(domValue);
|
|
@@ -10337,7 +10406,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
10337
10406
|
// avoid clearing unresolved text. #2302
|
|
10338
10407
|
if (el.composing)
|
|
10339
10408
|
return;
|
|
10340
|
-
if (document.activeElement === el) {
|
|
10409
|
+
if (document.activeElement === el && el.type !== 'range') {
|
|
10341
10410
|
if (lazy) {
|
|
10342
10411
|
return;
|
|
10343
10412
|
}
|
|
@@ -10507,27 +10576,25 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
10507
10576
|
callModelHook(el, binding, vnode, prevVNode, 'updated');
|
|
10508
10577
|
}
|
|
10509
10578
|
};
|
|
10510
|
-
function
|
|
10511
|
-
|
|
10512
|
-
switch (el.tagName) {
|
|
10579
|
+
function resolveDynamicModel(tagName, type) {
|
|
10580
|
+
switch (tagName) {
|
|
10513
10581
|
case 'SELECT':
|
|
10514
|
-
|
|
10515
|
-
break;
|
|
10582
|
+
return vModelSelect;
|
|
10516
10583
|
case 'TEXTAREA':
|
|
10517
|
-
|
|
10518
|
-
break;
|
|
10584
|
+
return vModelText;
|
|
10519
10585
|
default:
|
|
10520
|
-
switch (
|
|
10586
|
+
switch (type) {
|
|
10521
10587
|
case 'checkbox':
|
|
10522
|
-
|
|
10523
|
-
break;
|
|
10588
|
+
return vModelCheckbox;
|
|
10524
10589
|
case 'radio':
|
|
10525
|
-
|
|
10526
|
-
break;
|
|
10590
|
+
return vModelRadio;
|
|
10527
10591
|
default:
|
|
10528
|
-
|
|
10592
|
+
return vModelText;
|
|
10529
10593
|
}
|
|
10530
10594
|
}
|
|
10595
|
+
}
|
|
10596
|
+
function callModelHook(el, binding, vnode, prevVNode, hook) {
|
|
10597
|
+
const modelToUse = resolveDynamicModel(el.tagName, vnode.props && vnode.props.type);
|
|
10531
10598
|
const fn = modelToUse[hook];
|
|
10532
10599
|
fn && fn(el, binding, vnode, prevVNode);
|
|
10533
10600
|
}
|