vue 3.2.33 → 3.2.34-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue.esm-browser.js +1808 -1743
- package/dist/vue.esm-browser.prod.js +1 -1
- package/dist/vue.global.js +1808 -1743
- package/dist/vue.global.prod.js +1 -1
- package/dist/vue.runtime.esm-browser.js +3880 -3832
- package/dist/vue.runtime.esm-browser.prod.js +1 -1
- package/dist/vue.runtime.global.js +3880 -3832
- package/dist/vue.runtime.global.prod.js +1 -1
- package/macros.d.ts +12 -8
- package/package.json +6 -6
package/dist/vue.esm-browser.js
CHANGED
|
@@ -239,6 +239,11 @@ function looseEqual(a, b) {
|
|
|
239
239
|
if (aValidType || bValidType) {
|
|
240
240
|
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
|
241
241
|
}
|
|
242
|
+
aValidType = isSymbol(a);
|
|
243
|
+
bValidType = isSymbol(b);
|
|
244
|
+
if (aValidType || bValidType) {
|
|
245
|
+
return a === b;
|
|
246
|
+
}
|
|
242
247
|
aValidType = isArray(a);
|
|
243
248
|
bValidType = isArray(b);
|
|
244
249
|
if (aValidType || bValidType) {
|
|
@@ -334,7 +339,7 @@ const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
|
334
339
|
const isArray = Array.isArray;
|
|
335
340
|
const isMap = (val) => toTypeString(val) === '[object Map]';
|
|
336
341
|
const isSet = (val) => toTypeString(val) === '[object Set]';
|
|
337
|
-
const isDate = (val) => val
|
|
342
|
+
const isDate = (val) => toTypeString(val) === '[object Date]';
|
|
338
343
|
const isFunction = (val) => typeof val === 'function';
|
|
339
344
|
const isString = (val) => typeof val === 'string';
|
|
340
345
|
const isSymbol = (val) => typeof val === 'symbol';
|
|
@@ -781,17 +786,28 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
781
786
|
}
|
|
782
787
|
function triggerEffects(dep, debuggerEventExtraInfo) {
|
|
783
788
|
// spread into array for stabilization
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
789
|
+
const effects = isArray(dep) ? dep : [...dep];
|
|
790
|
+
for (const effect of effects) {
|
|
791
|
+
if (effect.computed) {
|
|
792
|
+
triggerEffect(effect, debuggerEventExtraInfo);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
for (const effect of effects) {
|
|
796
|
+
if (!effect.computed) {
|
|
797
|
+
triggerEffect(effect, debuggerEventExtraInfo);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
function triggerEffect(effect, debuggerEventExtraInfo) {
|
|
802
|
+
if (effect !== activeEffect || effect.allowRecurse) {
|
|
803
|
+
if (effect.onTrigger) {
|
|
804
|
+
effect.onTrigger(extend({ effect }, debuggerEventExtraInfo));
|
|
805
|
+
}
|
|
806
|
+
if (effect.scheduler) {
|
|
807
|
+
effect.scheduler();
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
effect.run();
|
|
795
811
|
}
|
|
796
812
|
}
|
|
797
813
|
}
|
|
@@ -800,6 +816,10 @@ const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
|
800
816
|
const builtInSymbols = new Set(
|
|
801
817
|
/*#__PURE__*/
|
|
802
818
|
Object.getOwnPropertyNames(Symbol)
|
|
819
|
+
// ios10.x Object.getOwnPropertyNames(Symbol) can enumerate 'arguments' and 'caller'
|
|
820
|
+
// but accessing them on Symbol leads to TypeError because Symbol is a strict mode
|
|
821
|
+
// function
|
|
822
|
+
.filter(key => key !== 'arguments' && key !== 'caller')
|
|
803
823
|
.map(key => Symbol[key])
|
|
804
824
|
.filter(isSymbol));
|
|
805
825
|
const get = /*#__PURE__*/ createGetter();
|
|
@@ -873,9 +893,8 @@ function createGetter(isReadonly = false, shallow = false) {
|
|
|
873
893
|
return res;
|
|
874
894
|
}
|
|
875
895
|
if (isRef(res)) {
|
|
876
|
-
// ref unwrapping -
|
|
877
|
-
|
|
878
|
-
return shouldUnwrap ? res.value : res;
|
|
896
|
+
// ref unwrapping - skip unwrap for Array + integer key.
|
|
897
|
+
return targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
879
898
|
}
|
|
880
899
|
if (isObject(res)) {
|
|
881
900
|
// Convert returned value into a proxy as well. we do the isObject check
|
|
@@ -981,10 +1000,12 @@ function get$1(target, key, isReadonly = false, isShallow = false) {
|
|
|
981
1000
|
target = target["__v_raw" /* RAW */];
|
|
982
1001
|
const rawTarget = toRaw(target);
|
|
983
1002
|
const rawKey = toRaw(key);
|
|
984
|
-
if (
|
|
985
|
-
|
|
1003
|
+
if (!isReadonly) {
|
|
1004
|
+
if (key !== rawKey) {
|
|
1005
|
+
track(rawTarget, "get" /* GET */, key);
|
|
1006
|
+
}
|
|
1007
|
+
track(rawTarget, "get" /* GET */, rawKey);
|
|
986
1008
|
}
|
|
987
|
-
!isReadonly && track(rawTarget, "get" /* GET */, rawKey);
|
|
988
1009
|
const { has } = getProto(rawTarget);
|
|
989
1010
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
990
1011
|
if (has.call(rawTarget, key)) {
|
|
@@ -1003,10 +1024,12 @@ function has$1(key, isReadonly = false) {
|
|
|
1003
1024
|
const target = this["__v_raw" /* RAW */];
|
|
1004
1025
|
const rawTarget = toRaw(target);
|
|
1005
1026
|
const rawKey = toRaw(key);
|
|
1006
|
-
if (
|
|
1007
|
-
|
|
1027
|
+
if (!isReadonly) {
|
|
1028
|
+
if (key !== rawKey) {
|
|
1029
|
+
track(rawTarget, "has" /* HAS */, key);
|
|
1030
|
+
}
|
|
1031
|
+
track(rawTarget, "has" /* HAS */, rawKey);
|
|
1008
1032
|
}
|
|
1009
|
-
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
|
|
1010
1033
|
return key === rawKey
|
|
1011
1034
|
? target.has(key)
|
|
1012
1035
|
: target.has(key) || target.has(rawKey);
|
|
@@ -1332,7 +1355,7 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1332
1355
|
if (existingProxy) {
|
|
1333
1356
|
return existingProxy;
|
|
1334
1357
|
}
|
|
1335
|
-
// only
|
|
1358
|
+
// only specific value types can be observed.
|
|
1336
1359
|
const targetType = getTargetType(target);
|
|
1337
1360
|
if (targetType === 0 /* INVALID */) {
|
|
1338
1361
|
return target;
|
|
@@ -1882,6 +1905,8 @@ function flushPreFlushCbs(seen, parentJob = null) {
|
|
|
1882
1905
|
}
|
|
1883
1906
|
}
|
|
1884
1907
|
function flushPostFlushCbs(seen) {
|
|
1908
|
+
// flush any pre cbs queued during the flush (e.g. pre watchers)
|
|
1909
|
+
flushPreFlushCbs();
|
|
1885
1910
|
if (pendingPostFlushCbs.length) {
|
|
1886
1911
|
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
1887
1912
|
pendingPostFlushCbs.length = 0;
|
|
@@ -2141,7 +2166,6 @@ function setDevtoolsHook(hook, target) {
|
|
|
2141
2166
|
// handle late devtools injection - only do this if we are in an actual
|
|
2142
2167
|
// browser environment to avoid the timer handle stalling test runner exit
|
|
2143
2168
|
// (#4815)
|
|
2144
|
-
// eslint-disable-next-line no-restricted-globals
|
|
2145
2169
|
typeof window !== 'undefined' &&
|
|
2146
2170
|
// some envs mock window but not fully
|
|
2147
2171
|
window.HTMLElement &&
|
|
@@ -2235,7 +2259,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
2235
2259
|
if (trim) {
|
|
2236
2260
|
args = rawArgs.map(a => a.trim());
|
|
2237
2261
|
}
|
|
2238
|
-
|
|
2262
|
+
if (number) {
|
|
2239
2263
|
args = rawArgs.map(toNumber);
|
|
2240
2264
|
}
|
|
2241
2265
|
}
|
|
@@ -2533,6 +2557,8 @@ function renderComponentRoot(instance) {
|
|
|
2533
2557
|
warn$1(`Runtime directive used on component with non-element root node. ` +
|
|
2534
2558
|
`The directives will not function as intended.`);
|
|
2535
2559
|
}
|
|
2560
|
+
// clone before mutating since the root may be a hoisted vnode
|
|
2561
|
+
root = cloneVNode(root);
|
|
2536
2562
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
2537
2563
|
}
|
|
2538
2564
|
// inherit transition data
|
|
@@ -3235,7 +3261,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3235
3261
|
}
|
|
3236
3262
|
else if (isArray(source)) {
|
|
3237
3263
|
isMultiSource = true;
|
|
3238
|
-
forceTrigger = source.some(isReactive);
|
|
3264
|
+
forceTrigger = source.some(s => isReactive(s) || isShallow(s));
|
|
3239
3265
|
getter = () => source.map(s => {
|
|
3240
3266
|
if (isRef(s)) {
|
|
3241
3267
|
return s.value;
|
|
@@ -3327,16 +3353,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3327
3353
|
}
|
|
3328
3354
|
else {
|
|
3329
3355
|
// default: 'pre'
|
|
3330
|
-
scheduler = () =>
|
|
3331
|
-
if (!instance || instance.isMounted) {
|
|
3332
|
-
queuePreFlushCb(job);
|
|
3333
|
-
}
|
|
3334
|
-
else {
|
|
3335
|
-
// with 'pre' option, the first call must happen before
|
|
3336
|
-
// the component is mounted so it is called synchronously.
|
|
3337
|
-
job();
|
|
3338
|
-
}
|
|
3339
|
-
};
|
|
3356
|
+
scheduler = () => queuePreFlushCb(job);
|
|
3340
3357
|
}
|
|
3341
3358
|
const effect = new ReactiveEffect(getter, scheduler);
|
|
3342
3359
|
{
|
|
@@ -3589,6 +3606,17 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
3589
3606
|
hook &&
|
|
3590
3607
|
callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
|
|
3591
3608
|
};
|
|
3609
|
+
const callAsyncHook = (hook, args) => {
|
|
3610
|
+
const done = args[1];
|
|
3611
|
+
callHook(hook, args);
|
|
3612
|
+
if (isArray(hook)) {
|
|
3613
|
+
if (hook.every(hook => hook.length <= 1))
|
|
3614
|
+
done();
|
|
3615
|
+
}
|
|
3616
|
+
else if (hook.length <= 1) {
|
|
3617
|
+
done();
|
|
3618
|
+
}
|
|
3619
|
+
};
|
|
3592
3620
|
const hooks = {
|
|
3593
3621
|
mode,
|
|
3594
3622
|
persisted,
|
|
@@ -3647,10 +3675,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
3647
3675
|
el._enterCb = undefined;
|
|
3648
3676
|
});
|
|
3649
3677
|
if (hook) {
|
|
3650
|
-
hook
|
|
3651
|
-
if (hook.length <= 1) {
|
|
3652
|
-
done();
|
|
3653
|
-
}
|
|
3678
|
+
callAsyncHook(hook, [el, done]);
|
|
3654
3679
|
}
|
|
3655
3680
|
else {
|
|
3656
3681
|
done();
|
|
@@ -3684,10 +3709,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
3684
3709
|
});
|
|
3685
3710
|
leavingVNodesCache[key] = vnode;
|
|
3686
3711
|
if (onLeave) {
|
|
3687
|
-
onLeave
|
|
3688
|
-
if (onLeave.length <= 1) {
|
|
3689
|
-
done();
|
|
3690
|
-
}
|
|
3712
|
+
callAsyncHook(onLeave, [el, done]);
|
|
3691
3713
|
}
|
|
3692
3714
|
else {
|
|
3693
3715
|
done();
|
|
@@ -3897,7 +3919,7 @@ function defineAsyncComponent(source) {
|
|
|
3897
3919
|
}
|
|
3898
3920
|
});
|
|
3899
3921
|
}
|
|
3900
|
-
function createInnerComp(comp, { vnode: { ref, props, children } }) {
|
|
3922
|
+
function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
|
|
3901
3923
|
const vnode = createVNode(comp, props, children);
|
|
3902
3924
|
// ensure inner component inherits the async wrapper's ref owner
|
|
3903
3925
|
vnode.ref = ref;
|
|
@@ -4106,7 +4128,7 @@ const KeepAliveImpl = {
|
|
|
4106
4128
|
// avoid vnode being unmounted
|
|
4107
4129
|
vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4108
4130
|
current = vnode;
|
|
4109
|
-
return rawVNode;
|
|
4131
|
+
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
4110
4132
|
};
|
|
4111
4133
|
}
|
|
4112
4134
|
};
|
|
@@ -4244,1109 +4266,1596 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
4244
4266
|
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
4245
4267
|
}
|
|
4246
4268
|
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4269
|
+
/**
|
|
4270
|
+
Runtime helper for applying directives to a vnode. Example usage:
|
|
4271
|
+
|
|
4272
|
+
const comp = resolveComponent('comp')
|
|
4273
|
+
const foo = resolveDirective('foo')
|
|
4274
|
+
const bar = resolveDirective('bar')
|
|
4275
|
+
|
|
4276
|
+
return withDirectives(h(comp), [
|
|
4277
|
+
[foo, this.x],
|
|
4278
|
+
[bar, this.y]
|
|
4279
|
+
])
|
|
4280
|
+
*/
|
|
4281
|
+
function validateDirectiveName(name) {
|
|
4282
|
+
if (isBuiltInDirective(name)) {
|
|
4283
|
+
warn$1('Do not use built-in directive ids as custom directive id: ' + name);
|
|
4284
|
+
}
|
|
4285
|
+
}
|
|
4286
|
+
/**
|
|
4287
|
+
* Adds directives to a VNode.
|
|
4288
|
+
*/
|
|
4289
|
+
function withDirectives(vnode, directives) {
|
|
4290
|
+
const internalInstance = currentRenderingInstance;
|
|
4291
|
+
if (internalInstance === null) {
|
|
4292
|
+
warn$1(`withDirectives can only be used inside render functions.`);
|
|
4293
|
+
return vnode;
|
|
4294
|
+
}
|
|
4295
|
+
const instance = getExposeProxy(internalInstance) ||
|
|
4296
|
+
internalInstance.proxy;
|
|
4297
|
+
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
4298
|
+
for (let i = 0; i < directives.length; i++) {
|
|
4299
|
+
let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
|
|
4300
|
+
if (isFunction(dir)) {
|
|
4301
|
+
dir = {
|
|
4302
|
+
mounted: dir,
|
|
4303
|
+
updated: dir
|
|
4304
|
+
};
|
|
4252
4305
|
}
|
|
4253
|
-
|
|
4254
|
-
|
|
4306
|
+
if (dir.deep) {
|
|
4307
|
+
traverse(value);
|
|
4255
4308
|
}
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
shouldCacheAccess = false;
|
|
4265
|
-
// call beforeCreate first before accessing other options since
|
|
4266
|
-
// the hook may mutate resolved options (#2791)
|
|
4267
|
-
if (options.beforeCreate) {
|
|
4268
|
-
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
4309
|
+
bindings.push({
|
|
4310
|
+
dir,
|
|
4311
|
+
instance,
|
|
4312
|
+
value,
|
|
4313
|
+
oldValue: void 0,
|
|
4314
|
+
arg,
|
|
4315
|
+
modifiers
|
|
4316
|
+
});
|
|
4269
4317
|
}
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4318
|
+
return vnode;
|
|
4319
|
+
}
|
|
4320
|
+
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
4321
|
+
const bindings = vnode.dirs;
|
|
4322
|
+
const oldBindings = prevVNode && prevVNode.dirs;
|
|
4323
|
+
for (let i = 0; i < bindings.length; i++) {
|
|
4324
|
+
const binding = bindings[i];
|
|
4325
|
+
if (oldBindings) {
|
|
4326
|
+
binding.oldValue = oldBindings[i].value;
|
|
4327
|
+
}
|
|
4328
|
+
let hook = binding.dir[name];
|
|
4329
|
+
if (hook) {
|
|
4330
|
+
// disable tracking inside all lifecycle hooks
|
|
4331
|
+
// since they can potentially be called inside effects.
|
|
4332
|
+
pauseTracking();
|
|
4333
|
+
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
4334
|
+
vnode.el,
|
|
4335
|
+
binding,
|
|
4336
|
+
vnode,
|
|
4337
|
+
prevVNode
|
|
4338
|
+
]);
|
|
4339
|
+
resetTracking();
|
|
4286
4340
|
}
|
|
4287
4341
|
}
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4342
|
+
}
|
|
4343
|
+
|
|
4344
|
+
const COMPONENTS = 'components';
|
|
4345
|
+
const DIRECTIVES = 'directives';
|
|
4346
|
+
/**
|
|
4347
|
+
* @private
|
|
4348
|
+
*/
|
|
4349
|
+
function resolveComponent(name, maybeSelfReference) {
|
|
4350
|
+
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
4351
|
+
}
|
|
4352
|
+
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
4353
|
+
/**
|
|
4354
|
+
* @private
|
|
4355
|
+
*/
|
|
4356
|
+
function resolveDynamicComponent(component) {
|
|
4357
|
+
if (isString(component)) {
|
|
4358
|
+
return resolveAsset(COMPONENTS, component, false) || component;
|
|
4297
4359
|
}
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
if (isFunction(methodHandler)) {
|
|
4302
|
-
// In dev mode, we use the `createRenderContext` function to define
|
|
4303
|
-
// methods to the proxy target, and those are read-only but
|
|
4304
|
-
// reconfigurable, so it needs to be redefined here
|
|
4305
|
-
{
|
|
4306
|
-
Object.defineProperty(ctx, key, {
|
|
4307
|
-
value: methodHandler.bind(publicThis),
|
|
4308
|
-
configurable: true,
|
|
4309
|
-
enumerable: true,
|
|
4310
|
-
writable: true
|
|
4311
|
-
});
|
|
4312
|
-
}
|
|
4313
|
-
{
|
|
4314
|
-
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
4315
|
-
}
|
|
4316
|
-
}
|
|
4317
|
-
else {
|
|
4318
|
-
warn$1(`Method "${key}" has type "${typeof methodHandler}" in the component definition. ` +
|
|
4319
|
-
`Did you reference the function correctly?`);
|
|
4320
|
-
}
|
|
4321
|
-
}
|
|
4360
|
+
else {
|
|
4361
|
+
// invalid types will fallthrough to createVNode and raise warning
|
|
4362
|
+
return (component || NULL_DYNAMIC_COMPONENT);
|
|
4322
4363
|
}
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4364
|
+
}
|
|
4365
|
+
/**
|
|
4366
|
+
* @private
|
|
4367
|
+
*/
|
|
4368
|
+
function resolveDirective(name) {
|
|
4369
|
+
return resolveAsset(DIRECTIVES, name);
|
|
4370
|
+
}
|
|
4371
|
+
// implementation
|
|
4372
|
+
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
4373
|
+
const instance = currentRenderingInstance || currentInstance;
|
|
4374
|
+
if (instance) {
|
|
4375
|
+
const Component = instance.type;
|
|
4376
|
+
// explicit self name has highest priority
|
|
4377
|
+
if (type === COMPONENTS) {
|
|
4378
|
+
const selfName = getComponentName(Component);
|
|
4379
|
+
if (selfName &&
|
|
4380
|
+
(selfName === name ||
|
|
4381
|
+
selfName === camelize(name) ||
|
|
4382
|
+
selfName === capitalize(camelize(name)))) {
|
|
4383
|
+
return Component;
|
|
4384
|
+
}
|
|
4333
4385
|
}
|
|
4334
|
-
|
|
4335
|
-
|
|
4386
|
+
const res =
|
|
4387
|
+
// local registration
|
|
4388
|
+
// check instance[type] first which is resolved for options API
|
|
4389
|
+
resolve(instance[type] || Component[type], name) ||
|
|
4390
|
+
// global registration
|
|
4391
|
+
resolve(instance.appContext[type], name);
|
|
4392
|
+
if (!res && maybeSelfReference) {
|
|
4393
|
+
// fallback to implicit self-reference
|
|
4394
|
+
return Component;
|
|
4336
4395
|
}
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
if (key[0] !== '$' && key[0] !== '_') {
|
|
4344
|
-
Object.defineProperty(ctx, key, {
|
|
4345
|
-
configurable: true,
|
|
4346
|
-
enumerable: true,
|
|
4347
|
-
get: () => data[key],
|
|
4348
|
-
set: NOOP
|
|
4349
|
-
});
|
|
4350
|
-
}
|
|
4351
|
-
}
|
|
4352
|
-
}
|
|
4396
|
+
if (warnMissing && !res) {
|
|
4397
|
+
const extra = type === COMPONENTS
|
|
4398
|
+
? `\nIf this is a native custom element, make sure to exclude it from ` +
|
|
4399
|
+
`component resolution via compilerOptions.isCustomElement.`
|
|
4400
|
+
: ``;
|
|
4401
|
+
warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
|
4353
4402
|
}
|
|
4403
|
+
return res;
|
|
4354
4404
|
}
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
for (const key in computedOptions) {
|
|
4359
|
-
const opt = computedOptions[key];
|
|
4360
|
-
const get = isFunction(opt)
|
|
4361
|
-
? opt.bind(publicThis, publicThis)
|
|
4362
|
-
: isFunction(opt.get)
|
|
4363
|
-
? opt.get.bind(publicThis, publicThis)
|
|
4364
|
-
: NOOP;
|
|
4365
|
-
if (get === NOOP) {
|
|
4366
|
-
warn$1(`Computed property "${key}" has no getter.`);
|
|
4367
|
-
}
|
|
4368
|
-
const set = !isFunction(opt) && isFunction(opt.set)
|
|
4369
|
-
? opt.set.bind(publicThis)
|
|
4370
|
-
: () => {
|
|
4371
|
-
warn$1(`Write operation failed: computed property "${key}" is readonly.`);
|
|
4372
|
-
}
|
|
4373
|
-
;
|
|
4374
|
-
const c = computed$1({
|
|
4375
|
-
get,
|
|
4376
|
-
set
|
|
4377
|
-
});
|
|
4378
|
-
Object.defineProperty(ctx, key, {
|
|
4379
|
-
enumerable: true,
|
|
4380
|
-
configurable: true,
|
|
4381
|
-
get: () => c.value,
|
|
4382
|
-
set: v => (c.value = v)
|
|
4383
|
-
});
|
|
4384
|
-
{
|
|
4385
|
-
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
4386
|
-
}
|
|
4387
|
-
}
|
|
4388
|
-
}
|
|
4389
|
-
if (watchOptions) {
|
|
4390
|
-
for (const key in watchOptions) {
|
|
4391
|
-
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
4392
|
-
}
|
|
4393
|
-
}
|
|
4394
|
-
if (provideOptions) {
|
|
4395
|
-
const provides = isFunction(provideOptions)
|
|
4396
|
-
? provideOptions.call(publicThis)
|
|
4397
|
-
: provideOptions;
|
|
4398
|
-
Reflect.ownKeys(provides).forEach(key => {
|
|
4399
|
-
provide(key, provides[key]);
|
|
4400
|
-
});
|
|
4401
|
-
}
|
|
4402
|
-
if (created) {
|
|
4403
|
-
callHook(created, instance, "c" /* CREATED */);
|
|
4405
|
+
else {
|
|
4406
|
+
warn$1(`resolve${capitalize(type.slice(0, -1))} ` +
|
|
4407
|
+
`can only be used in render() or setup().`);
|
|
4404
4408
|
}
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4409
|
+
}
|
|
4410
|
+
function resolve(registry, name) {
|
|
4411
|
+
return (registry &&
|
|
4412
|
+
(registry[name] ||
|
|
4413
|
+
registry[camelize(name)] ||
|
|
4414
|
+
registry[capitalize(camelize(name))]));
|
|
4415
|
+
}
|
|
4416
|
+
|
|
4417
|
+
/**
|
|
4418
|
+
* Actual implementation
|
|
4419
|
+
*/
|
|
4420
|
+
function renderList(source, renderItem, cache, index) {
|
|
4421
|
+
let ret;
|
|
4422
|
+
const cached = (cache && cache[index]);
|
|
4423
|
+
if (isArray(source) || isString(source)) {
|
|
4424
|
+
ret = new Array(source.length);
|
|
4425
|
+
for (let i = 0, l = source.length; i < l; i++) {
|
|
4426
|
+
ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
|
|
4411
4427
|
}
|
|
4412
4428
|
}
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
registerLifecycleHook(onUpdated, updated);
|
|
4417
|
-
registerLifecycleHook(onActivated, activated);
|
|
4418
|
-
registerLifecycleHook(onDeactivated, deactivated);
|
|
4419
|
-
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
|
4420
|
-
registerLifecycleHook(onRenderTracked, renderTracked);
|
|
4421
|
-
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
|
4422
|
-
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
|
4423
|
-
registerLifecycleHook(onUnmounted, unmounted);
|
|
4424
|
-
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
4425
|
-
if (isArray(expose)) {
|
|
4426
|
-
if (expose.length) {
|
|
4427
|
-
const exposed = instance.exposed || (instance.exposed = {});
|
|
4428
|
-
expose.forEach(key => {
|
|
4429
|
-
Object.defineProperty(exposed, key, {
|
|
4430
|
-
get: () => publicThis[key],
|
|
4431
|
-
set: val => (publicThis[key] = val)
|
|
4432
|
-
});
|
|
4433
|
-
});
|
|
4429
|
+
else if (typeof source === 'number') {
|
|
4430
|
+
if (!Number.isInteger(source)) {
|
|
4431
|
+
warn$1(`The v-for range expect an integer value but got ${source}.`);
|
|
4434
4432
|
}
|
|
4435
|
-
|
|
4436
|
-
|
|
4433
|
+
ret = new Array(source);
|
|
4434
|
+
for (let i = 0; i < source; i++) {
|
|
4435
|
+
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
4437
4436
|
}
|
|
4438
4437
|
}
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
instance.render = render;
|
|
4443
|
-
}
|
|
4444
|
-
if (inheritAttrs != null) {
|
|
4445
|
-
instance.inheritAttrs = inheritAttrs;
|
|
4446
|
-
}
|
|
4447
|
-
// asset options.
|
|
4448
|
-
if (components)
|
|
4449
|
-
instance.components = components;
|
|
4450
|
-
if (directives)
|
|
4451
|
-
instance.directives = directives;
|
|
4452
|
-
}
|
|
4453
|
-
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
|
|
4454
|
-
if (isArray(injectOptions)) {
|
|
4455
|
-
injectOptions = normalizeInject(injectOptions);
|
|
4456
|
-
}
|
|
4457
|
-
for (const key in injectOptions) {
|
|
4458
|
-
const opt = injectOptions[key];
|
|
4459
|
-
let injected;
|
|
4460
|
-
if (isObject(opt)) {
|
|
4461
|
-
if ('default' in opt) {
|
|
4462
|
-
injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
|
|
4463
|
-
}
|
|
4464
|
-
else {
|
|
4465
|
-
injected = inject(opt.from || key);
|
|
4466
|
-
}
|
|
4438
|
+
else if (isObject(source)) {
|
|
4439
|
+
if (source[Symbol.iterator]) {
|
|
4440
|
+
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
4467
4441
|
}
|
|
4468
4442
|
else {
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
Object.defineProperty(ctx, key, {
|
|
4475
|
-
enumerable: true,
|
|
4476
|
-
configurable: true,
|
|
4477
|
-
get: () => injected.value,
|
|
4478
|
-
set: v => (injected.value = v)
|
|
4479
|
-
});
|
|
4480
|
-
}
|
|
4481
|
-
else {
|
|
4482
|
-
{
|
|
4483
|
-
warn$1(`injected property "${key}" is a ref and will be auto-unwrapped ` +
|
|
4484
|
-
`and no longer needs \`.value\` in the next minor release. ` +
|
|
4485
|
-
`To opt-in to the new behavior now, ` +
|
|
4486
|
-
`set \`app.config.unwrapInjectedRef = true\` (this config is ` +
|
|
4487
|
-
`temporary and will not be needed in the future.)`);
|
|
4488
|
-
}
|
|
4489
|
-
ctx[key] = injected;
|
|
4443
|
+
const keys = Object.keys(source);
|
|
4444
|
+
ret = new Array(keys.length);
|
|
4445
|
+
for (let i = 0, l = keys.length; i < l; i++) {
|
|
4446
|
+
const key = keys[i];
|
|
4447
|
+
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
4490
4448
|
}
|
|
4491
4449
|
}
|
|
4492
|
-
else {
|
|
4493
|
-
ctx[key] = injected;
|
|
4494
|
-
}
|
|
4495
|
-
{
|
|
4496
|
-
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
4497
|
-
}
|
|
4498
4450
|
}
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
callWithAsyncErrorHandling(isArray(hook)
|
|
4502
|
-
? hook.map(h => h.bind(instance.proxy))
|
|
4503
|
-
: hook.bind(instance.proxy), instance, type);
|
|
4504
|
-
}
|
|
4505
|
-
function createWatcher(raw, ctx, publicThis, key) {
|
|
4506
|
-
const getter = key.includes('.')
|
|
4507
|
-
? createPathGetter(publicThis, key)
|
|
4508
|
-
: () => publicThis[key];
|
|
4509
|
-
if (isString(raw)) {
|
|
4510
|
-
const handler = ctx[raw];
|
|
4511
|
-
if (isFunction(handler)) {
|
|
4512
|
-
watch(getter, handler);
|
|
4513
|
-
}
|
|
4514
|
-
else {
|
|
4515
|
-
warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
4516
|
-
}
|
|
4451
|
+
else {
|
|
4452
|
+
ret = [];
|
|
4517
4453
|
}
|
|
4518
|
-
|
|
4519
|
-
|
|
4454
|
+
if (cache) {
|
|
4455
|
+
cache[index] = ret;
|
|
4520
4456
|
}
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4457
|
+
return ret;
|
|
4458
|
+
}
|
|
4459
|
+
|
|
4460
|
+
/**
|
|
4461
|
+
* Compiler runtime helper for creating dynamic slots object
|
|
4462
|
+
* @private
|
|
4463
|
+
*/
|
|
4464
|
+
function createSlots(slots, dynamicSlots) {
|
|
4465
|
+
for (let i = 0; i < dynamicSlots.length; i++) {
|
|
4466
|
+
const slot = dynamicSlots[i];
|
|
4467
|
+
// array of dynamic slot generated by <template v-for="..." #[...]>
|
|
4468
|
+
if (isArray(slot)) {
|
|
4469
|
+
for (let j = 0; j < slot.length; j++) {
|
|
4470
|
+
slots[slot[j].name] = slot[j].fn;
|
|
4534
4471
|
}
|
|
4535
4472
|
}
|
|
4473
|
+
else if (slot) {
|
|
4474
|
+
// conditional single slot generated by <template v-if="..." #foo>
|
|
4475
|
+
slots[slot.name] = slot.fn;
|
|
4476
|
+
}
|
|
4536
4477
|
}
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
}
|
|
4478
|
+
return slots;
|
|
4479
|
+
}
|
|
4480
|
+
|
|
4541
4481
|
/**
|
|
4542
|
-
*
|
|
4543
|
-
*
|
|
4544
|
-
* instances.
|
|
4482
|
+
* Compiler runtime helper for rendering `<slot/>`
|
|
4483
|
+
* @private
|
|
4545
4484
|
*/
|
|
4546
|
-
function
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4485
|
+
function renderSlot(slots, name, props = {},
|
|
4486
|
+
// this is not a user-facing function, so the fallback is always generated by
|
|
4487
|
+
// the compiler and guaranteed to be a function returning an array
|
|
4488
|
+
fallback, noSlotted) {
|
|
4489
|
+
if (currentRenderingInstance.isCE ||
|
|
4490
|
+
(currentRenderingInstance.parent &&
|
|
4491
|
+
isAsyncWrapper(currentRenderingInstance.parent) &&
|
|
4492
|
+
currentRenderingInstance.parent.isCE)) {
|
|
4493
|
+
return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
|
|
4554
4494
|
}
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4495
|
+
let slot = slots[name];
|
|
4496
|
+
if (slot && slot.length > 1) {
|
|
4497
|
+
warn$1(`SSR-optimized slot function detected in a non-SSR-optimized render ` +
|
|
4498
|
+
`function. You need to mark this component with $dynamic-slots in the ` +
|
|
4499
|
+
`parent template.`);
|
|
4500
|
+
slot = () => [];
|
|
4559
4501
|
}
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
}
|
|
4567
|
-
cache.set(base, resolved);
|
|
4568
|
-
return resolved;
|
|
4569
|
-
}
|
|
4570
|
-
function mergeOptions(to, from, strats, asMixin = false) {
|
|
4571
|
-
const { mixins, extends: extendsOptions } = from;
|
|
4572
|
-
if (extendsOptions) {
|
|
4573
|
-
mergeOptions(to, extendsOptions, strats, true);
|
|
4574
|
-
}
|
|
4575
|
-
if (mixins) {
|
|
4576
|
-
mixins.forEach((m) => mergeOptions(to, m, strats, true));
|
|
4577
|
-
}
|
|
4578
|
-
for (const key in from) {
|
|
4579
|
-
if (asMixin && key === 'expose') {
|
|
4580
|
-
warn$1(`"expose" option is ignored when declared in mixins or extends. ` +
|
|
4581
|
-
`It should only be declared in the base component itself.`);
|
|
4582
|
-
}
|
|
4583
|
-
else {
|
|
4584
|
-
const strat = internalOptionMergeStrats[key] || (strats && strats[key]);
|
|
4585
|
-
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
4586
|
-
}
|
|
4587
|
-
}
|
|
4588
|
-
return to;
|
|
4589
|
-
}
|
|
4590
|
-
const internalOptionMergeStrats = {
|
|
4591
|
-
data: mergeDataFn,
|
|
4592
|
-
props: mergeObjectOptions,
|
|
4593
|
-
emits: mergeObjectOptions,
|
|
4594
|
-
// objects
|
|
4595
|
-
methods: mergeObjectOptions,
|
|
4596
|
-
computed: mergeObjectOptions,
|
|
4597
|
-
// lifecycle
|
|
4598
|
-
beforeCreate: mergeAsArray,
|
|
4599
|
-
created: mergeAsArray,
|
|
4600
|
-
beforeMount: mergeAsArray,
|
|
4601
|
-
mounted: mergeAsArray,
|
|
4602
|
-
beforeUpdate: mergeAsArray,
|
|
4603
|
-
updated: mergeAsArray,
|
|
4604
|
-
beforeDestroy: mergeAsArray,
|
|
4605
|
-
beforeUnmount: mergeAsArray,
|
|
4606
|
-
destroyed: mergeAsArray,
|
|
4607
|
-
unmounted: mergeAsArray,
|
|
4608
|
-
activated: mergeAsArray,
|
|
4609
|
-
deactivated: mergeAsArray,
|
|
4610
|
-
errorCaptured: mergeAsArray,
|
|
4611
|
-
serverPrefetch: mergeAsArray,
|
|
4612
|
-
// assets
|
|
4613
|
-
components: mergeObjectOptions,
|
|
4614
|
-
directives: mergeObjectOptions,
|
|
4615
|
-
// watch
|
|
4616
|
-
watch: mergeWatchOptions,
|
|
4617
|
-
// provide / inject
|
|
4618
|
-
provide: mergeDataFn,
|
|
4619
|
-
inject: mergeInject
|
|
4620
|
-
};
|
|
4621
|
-
function mergeDataFn(to, from) {
|
|
4622
|
-
if (!from) {
|
|
4623
|
-
return to;
|
|
4502
|
+
// a compiled slot disables block tracking by default to avoid manual
|
|
4503
|
+
// invocation interfering with template-based block tracking, but in
|
|
4504
|
+
// `renderSlot` we can be sure that it's template-based so we can force
|
|
4505
|
+
// enable it.
|
|
4506
|
+
if (slot && slot._c) {
|
|
4507
|
+
slot._d = false;
|
|
4624
4508
|
}
|
|
4625
|
-
|
|
4626
|
-
|
|
4509
|
+
openBlock();
|
|
4510
|
+
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
4511
|
+
const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
|
|
4512
|
+
? 64 /* STABLE_FRAGMENT */
|
|
4513
|
+
: -2 /* BAIL */);
|
|
4514
|
+
if (!noSlotted && rendered.scopeId) {
|
|
4515
|
+
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
4627
4516
|
}
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
};
|
|
4631
|
-
}
|
|
4632
|
-
function mergeInject(to, from) {
|
|
4633
|
-
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
4634
|
-
}
|
|
4635
|
-
function normalizeInject(raw) {
|
|
4636
|
-
if (isArray(raw)) {
|
|
4637
|
-
const res = {};
|
|
4638
|
-
for (let i = 0; i < raw.length; i++) {
|
|
4639
|
-
res[raw[i]] = raw[i];
|
|
4640
|
-
}
|
|
4641
|
-
return res;
|
|
4517
|
+
if (slot && slot._c) {
|
|
4518
|
+
slot._d = true;
|
|
4642
4519
|
}
|
|
4643
|
-
return
|
|
4644
|
-
}
|
|
4645
|
-
function mergeAsArray(to, from) {
|
|
4646
|
-
return to ? [...new Set([].concat(to, from))] : from;
|
|
4647
|
-
}
|
|
4648
|
-
function mergeObjectOptions(to, from) {
|
|
4649
|
-
return to ? extend(extend(Object.create(null), to), from) : from;
|
|
4520
|
+
return rendered;
|
|
4650
4521
|
}
|
|
4651
|
-
function
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4522
|
+
function ensureValidVNode(vnodes) {
|
|
4523
|
+
return vnodes.some(child => {
|
|
4524
|
+
if (!isVNode(child))
|
|
4525
|
+
return true;
|
|
4526
|
+
if (child.type === Comment)
|
|
4527
|
+
return false;
|
|
4528
|
+
if (child.type === Fragment &&
|
|
4529
|
+
!ensureValidVNode(child.children))
|
|
4530
|
+
return false;
|
|
4531
|
+
return true;
|
|
4532
|
+
})
|
|
4533
|
+
? vnodes
|
|
4534
|
+
: null;
|
|
4661
4535
|
}
|
|
4662
4536
|
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
if (!(key in props)) {
|
|
4673
|
-
props[key] = undefined;
|
|
4674
|
-
}
|
|
4675
|
-
}
|
|
4676
|
-
// validation
|
|
4677
|
-
{
|
|
4678
|
-
validateProps(rawProps || {}, props, instance);
|
|
4537
|
+
/**
|
|
4538
|
+
* For prefixing keys in v-on="obj" with "on"
|
|
4539
|
+
* @private
|
|
4540
|
+
*/
|
|
4541
|
+
function toHandlers(obj) {
|
|
4542
|
+
const ret = {};
|
|
4543
|
+
if (!isObject(obj)) {
|
|
4544
|
+
warn$1(`v-on with no argument expects an object value.`);
|
|
4545
|
+
return ret;
|
|
4679
4546
|
}
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
instance.props = isSSR ? props : shallowReactive(props);
|
|
4547
|
+
for (const key in obj) {
|
|
4548
|
+
ret[toHandlerKey(key)] = obj[key];
|
|
4683
4549
|
}
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4550
|
+
return ret;
|
|
4551
|
+
}
|
|
4552
|
+
|
|
4553
|
+
/**
|
|
4554
|
+
* #2437 In Vue 3, functional components do not have a public instance proxy but
|
|
4555
|
+
* they exist in the internal parent chain. For code that relies on traversing
|
|
4556
|
+
* public $parent chains, skip functional ones and go to the parent instead.
|
|
4557
|
+
*/
|
|
4558
|
+
const getPublicInstance = (i) => {
|
|
4559
|
+
if (!i)
|
|
4560
|
+
return null;
|
|
4561
|
+
if (isStatefulComponent(i))
|
|
4562
|
+
return getExposeProxy(i) || i.proxy;
|
|
4563
|
+
return getPublicInstance(i.parent);
|
|
4564
|
+
};
|
|
4565
|
+
const publicPropertiesMap =
|
|
4566
|
+
// Move PURE marker to new line to workaround compiler discarding it
|
|
4567
|
+
// due to type annotation
|
|
4568
|
+
/*#__PURE__*/ extend(Object.create(null), {
|
|
4569
|
+
$: i => i,
|
|
4570
|
+
$el: i => i.vnode.el,
|
|
4571
|
+
$data: i => i.data,
|
|
4572
|
+
$props: i => (shallowReadonly(i.props) ),
|
|
4573
|
+
$attrs: i => (shallowReadonly(i.attrs) ),
|
|
4574
|
+
$slots: i => (shallowReadonly(i.slots) ),
|
|
4575
|
+
$refs: i => (shallowReadonly(i.refs) ),
|
|
4576
|
+
$parent: i => getPublicInstance(i.parent),
|
|
4577
|
+
$root: i => getPublicInstance(i.root),
|
|
4578
|
+
$emit: i => i.emit,
|
|
4579
|
+
$options: i => (resolveMergedOptions(i) ),
|
|
4580
|
+
$forceUpdate: i => i.f || (i.f = () => queueJob(i.update)),
|
|
4581
|
+
$nextTick: i => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
4582
|
+
$watch: i => (instanceWatch.bind(i) )
|
|
4583
|
+
});
|
|
4584
|
+
const isReservedPrefix = (key) => key === '_' || key === '$';
|
|
4585
|
+
const PublicInstanceProxyHandlers = {
|
|
4586
|
+
get({ _: instance }, key) {
|
|
4587
|
+
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
|
4588
|
+
// for internal formatters to know that this is a Vue instance
|
|
4589
|
+
if (key === '__isVue') {
|
|
4590
|
+
return true;
|
|
4688
4591
|
}
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4592
|
+
// prioritize <script setup> bindings during dev.
|
|
4593
|
+
// this allows even properties that start with _ or $ to be used - so that
|
|
4594
|
+
// it aligns with the production behavior where the render fn is inlined and
|
|
4595
|
+
// indeed has access to all declared variables.
|
|
4596
|
+
if (setupState !== EMPTY_OBJ &&
|
|
4597
|
+
setupState.__isScriptSetup &&
|
|
4598
|
+
hasOwn(setupState, key)) {
|
|
4599
|
+
return setupState[key];
|
|
4692
4600
|
}
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
4714
|
-
let key = propsToUpdate[i];
|
|
4715
|
-
// skip if the prop key is a declared emit event listener
|
|
4716
|
-
if (isEmitListener(instance.emitsOptions, key)) {
|
|
4717
|
-
continue;
|
|
4718
|
-
}
|
|
4719
|
-
// PROPS flag guarantees rawProps to be non-null
|
|
4720
|
-
const value = rawProps[key];
|
|
4721
|
-
if (options) {
|
|
4722
|
-
// attr / props separation was done on init and will be consistent
|
|
4723
|
-
// in this code path, so just check if attrs have it.
|
|
4724
|
-
if (hasOwn(attrs, key)) {
|
|
4725
|
-
if (value !== attrs[key]) {
|
|
4726
|
-
attrs[key] = value;
|
|
4727
|
-
hasAttrsChanged = true;
|
|
4728
|
-
}
|
|
4729
|
-
}
|
|
4730
|
-
else {
|
|
4731
|
-
const camelizedKey = camelize(key);
|
|
4732
|
-
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
|
|
4733
|
-
}
|
|
4734
|
-
}
|
|
4735
|
-
else {
|
|
4736
|
-
if (value !== attrs[key]) {
|
|
4737
|
-
attrs[key] = value;
|
|
4738
|
-
hasAttrsChanged = true;
|
|
4739
|
-
}
|
|
4601
|
+
// data / props / ctx
|
|
4602
|
+
// This getter gets called for every property access on the render context
|
|
4603
|
+
// during render and is a major hotspot. The most expensive part of this
|
|
4604
|
+
// is the multiple hasOwn() calls. It's much faster to do a simple property
|
|
4605
|
+
// access on a plain object, so we use an accessCache object (with null
|
|
4606
|
+
// prototype) to memoize what access type a key corresponds to.
|
|
4607
|
+
let normalizedProps;
|
|
4608
|
+
if (key[0] !== '$') {
|
|
4609
|
+
const n = accessCache[key];
|
|
4610
|
+
if (n !== undefined) {
|
|
4611
|
+
switch (n) {
|
|
4612
|
+
case 1 /* SETUP */:
|
|
4613
|
+
return setupState[key];
|
|
4614
|
+
case 2 /* DATA */:
|
|
4615
|
+
return data[key];
|
|
4616
|
+
case 4 /* CONTEXT */:
|
|
4617
|
+
return ctx[key];
|
|
4618
|
+
case 3 /* PROPS */:
|
|
4619
|
+
return props[key];
|
|
4620
|
+
// default: just fallthrough
|
|
4740
4621
|
}
|
|
4741
4622
|
}
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
// full props update.
|
|
4746
|
-
if (setFullProps(instance, rawProps, props, attrs)) {
|
|
4747
|
-
hasAttrsChanged = true;
|
|
4748
|
-
}
|
|
4749
|
-
// in case of dynamic props, check if we need to delete keys from
|
|
4750
|
-
// the props object
|
|
4751
|
-
let kebabKey;
|
|
4752
|
-
for (const key in rawCurrentProps) {
|
|
4753
|
-
if (!rawProps ||
|
|
4754
|
-
// for camelCase
|
|
4755
|
-
(!hasOwn(rawProps, key) &&
|
|
4756
|
-
// it's possible the original props was passed in as kebab-case
|
|
4757
|
-
// and converted to camelCase (#955)
|
|
4758
|
-
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {
|
|
4759
|
-
if (options) {
|
|
4760
|
-
if (rawPrevProps &&
|
|
4761
|
-
// for camelCase
|
|
4762
|
-
(rawPrevProps[key] !== undefined ||
|
|
4763
|
-
// for kebab-case
|
|
4764
|
-
rawPrevProps[kebabKey] !== undefined)) {
|
|
4765
|
-
props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */);
|
|
4766
|
-
}
|
|
4767
|
-
}
|
|
4768
|
-
else {
|
|
4769
|
-
delete props[key];
|
|
4770
|
-
}
|
|
4623
|
+
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
4624
|
+
accessCache[key] = 1 /* SETUP */;
|
|
4625
|
+
return setupState[key];
|
|
4771
4626
|
}
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
if (attrs !== rawCurrentProps) {
|
|
4776
|
-
for (const key in attrs) {
|
|
4777
|
-
if (!rawProps ||
|
|
4778
|
-
(!hasOwn(rawProps, key) &&
|
|
4779
|
-
(!false ))) {
|
|
4780
|
-
delete attrs[key];
|
|
4781
|
-
hasAttrsChanged = true;
|
|
4782
|
-
}
|
|
4627
|
+
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
4628
|
+
accessCache[key] = 2 /* DATA */;
|
|
4629
|
+
return data[key];
|
|
4783
4630
|
}
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
validateProps(rawProps || {}, props, instance);
|
|
4792
|
-
}
|
|
4793
|
-
}
|
|
4794
|
-
function setFullProps(instance, rawProps, props, attrs) {
|
|
4795
|
-
const [options, needCastKeys] = instance.propsOptions;
|
|
4796
|
-
let hasAttrsChanged = false;
|
|
4797
|
-
let rawCastValues;
|
|
4798
|
-
if (rawProps) {
|
|
4799
|
-
for (let key in rawProps) {
|
|
4800
|
-
// key, ref are reserved and never passed down
|
|
4801
|
-
if (isReservedProp(key)) {
|
|
4802
|
-
continue;
|
|
4631
|
+
else if (
|
|
4632
|
+
// only cache other properties when instance has declared (thus stable)
|
|
4633
|
+
// props
|
|
4634
|
+
(normalizedProps = instance.propsOptions[0]) &&
|
|
4635
|
+
hasOwn(normalizedProps, key)) {
|
|
4636
|
+
accessCache[key] = 3 /* PROPS */;
|
|
4637
|
+
return props[key];
|
|
4803
4638
|
}
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
let camelKey;
|
|
4808
|
-
if (options && hasOwn(options, (camelKey = camelize(key)))) {
|
|
4809
|
-
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
|
4810
|
-
props[camelKey] = value;
|
|
4811
|
-
}
|
|
4812
|
-
else {
|
|
4813
|
-
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
|
4814
|
-
}
|
|
4639
|
+
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
4640
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
4641
|
+
return ctx[key];
|
|
4815
4642
|
}
|
|
4816
|
-
else if (
|
|
4817
|
-
|
|
4818
|
-
attrs[key] = value;
|
|
4819
|
-
hasAttrsChanged = true;
|
|
4820
|
-
}
|
|
4643
|
+
else if (shouldCacheAccess) {
|
|
4644
|
+
accessCache[key] = 0 /* OTHER */;
|
|
4821
4645
|
}
|
|
4822
4646
|
}
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
}
|
|
4831
|
-
}
|
|
4832
|
-
return hasAttrsChanged;
|
|
4833
|
-
}
|
|
4834
|
-
function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
4835
|
-
const opt = options[key];
|
|
4836
|
-
if (opt != null) {
|
|
4837
|
-
const hasDefault = hasOwn(opt, 'default');
|
|
4838
|
-
// default values
|
|
4839
|
-
if (hasDefault && value === undefined) {
|
|
4840
|
-
const defaultValue = opt.default;
|
|
4841
|
-
if (opt.type !== Function && isFunction(defaultValue)) {
|
|
4842
|
-
const { propsDefaults } = instance;
|
|
4843
|
-
if (key in propsDefaults) {
|
|
4844
|
-
value = propsDefaults[key];
|
|
4845
|
-
}
|
|
4846
|
-
else {
|
|
4847
|
-
setCurrentInstance(instance);
|
|
4848
|
-
value = propsDefaults[key] = defaultValue.call(null, props);
|
|
4849
|
-
unsetCurrentInstance();
|
|
4850
|
-
}
|
|
4647
|
+
const publicGetter = publicPropertiesMap[key];
|
|
4648
|
+
let cssModule, globalProperties;
|
|
4649
|
+
// public $xxx properties
|
|
4650
|
+
if (publicGetter) {
|
|
4651
|
+
if (key === '$attrs') {
|
|
4652
|
+
track(instance, "get" /* GET */, key);
|
|
4653
|
+
markAttrsAccessed();
|
|
4851
4654
|
}
|
|
4852
|
-
|
|
4853
|
-
|
|
4655
|
+
return publicGetter(instance);
|
|
4656
|
+
}
|
|
4657
|
+
else if (
|
|
4658
|
+
// css module (injected by vue-loader)
|
|
4659
|
+
(cssModule = type.__cssModules) &&
|
|
4660
|
+
(cssModule = cssModule[key])) {
|
|
4661
|
+
return cssModule;
|
|
4662
|
+
}
|
|
4663
|
+
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
4664
|
+
// user may set custom properties to `this` that start with `$`
|
|
4665
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
4666
|
+
return ctx[key];
|
|
4667
|
+
}
|
|
4668
|
+
else if (
|
|
4669
|
+
// global properties
|
|
4670
|
+
((globalProperties = appContext.config.globalProperties),
|
|
4671
|
+
hasOwn(globalProperties, key))) {
|
|
4672
|
+
{
|
|
4673
|
+
return globalProperties[key];
|
|
4854
4674
|
}
|
|
4855
4675
|
}
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4676
|
+
else if (currentRenderingInstance &&
|
|
4677
|
+
(!isString(key) ||
|
|
4678
|
+
// #1091 avoid internal isRef/isVNode checks on component instance leading
|
|
4679
|
+
// to infinite warning loop
|
|
4680
|
+
key.indexOf('__v') !== 0)) {
|
|
4681
|
+
if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
|
|
4682
|
+
warn$1(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved ` +
|
|
4683
|
+
`character ("$" or "_") and is not proxied on the render context.`);
|
|
4860
4684
|
}
|
|
4861
|
-
else if (
|
|
4862
|
-
(
|
|
4863
|
-
|
|
4685
|
+
else if (instance === currentRenderingInstance) {
|
|
4686
|
+
warn$1(`Property ${JSON.stringify(key)} was accessed during render ` +
|
|
4687
|
+
`but is not defined on instance.`);
|
|
4864
4688
|
}
|
|
4865
4689
|
}
|
|
4866
|
-
}
|
|
4867
|
-
|
|
4868
|
-
}
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
if (cached) {
|
|
4873
|
-
return cached;
|
|
4874
|
-
}
|
|
4875
|
-
const raw = comp.props;
|
|
4876
|
-
const normalized = {};
|
|
4877
|
-
const needCastKeys = [];
|
|
4878
|
-
// apply mixin/extends props
|
|
4879
|
-
let hasExtends = false;
|
|
4880
|
-
if (!isFunction(comp)) {
|
|
4881
|
-
const extendProps = (raw) => {
|
|
4882
|
-
hasExtends = true;
|
|
4883
|
-
const [props, keys] = normalizePropsOptions(raw, appContext, true);
|
|
4884
|
-
extend(normalized, props);
|
|
4885
|
-
if (keys)
|
|
4886
|
-
needCastKeys.push(...keys);
|
|
4887
|
-
};
|
|
4888
|
-
if (!asMixin && appContext.mixins.length) {
|
|
4889
|
-
appContext.mixins.forEach(extendProps);
|
|
4690
|
+
},
|
|
4691
|
+
set({ _: instance }, key, value) {
|
|
4692
|
+
const { data, setupState, ctx } = instance;
|
|
4693
|
+
if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
4694
|
+
setupState[key] = value;
|
|
4695
|
+
return true;
|
|
4890
4696
|
}
|
|
4891
|
-
if (
|
|
4892
|
-
|
|
4697
|
+
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
4698
|
+
data[key] = value;
|
|
4699
|
+
return true;
|
|
4893
4700
|
}
|
|
4894
|
-
if (
|
|
4895
|
-
|
|
4701
|
+
else if (hasOwn(instance.props, key)) {
|
|
4702
|
+
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
|
4703
|
+
return false;
|
|
4896
4704
|
}
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4705
|
+
if (key[0] === '$' && key.slice(1) in instance) {
|
|
4706
|
+
warn$1(`Attempting to mutate public property "${key}". ` +
|
|
4707
|
+
`Properties starting with $ are reserved and readonly.`, instance);
|
|
4708
|
+
return false;
|
|
4709
|
+
}
|
|
4710
|
+
else {
|
|
4711
|
+
if (key in instance.appContext.config.globalProperties) {
|
|
4712
|
+
Object.defineProperty(ctx, key, {
|
|
4713
|
+
enumerable: true,
|
|
4714
|
+
configurable: true,
|
|
4715
|
+
value
|
|
4716
|
+
});
|
|
4906
4717
|
}
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
normalized[normalizedKey] = EMPTY_OBJ;
|
|
4718
|
+
else {
|
|
4719
|
+
ctx[key] = value;
|
|
4910
4720
|
}
|
|
4911
4721
|
}
|
|
4912
|
-
}
|
|
4913
|
-
else if (raw) {
|
|
4914
|
-
if (!isObject(raw)) {
|
|
4915
|
-
warn$1(`invalid props options`, raw);
|
|
4916
|
-
}
|
|
4917
|
-
for (const key in raw) {
|
|
4918
|
-
const normalizedKey = camelize(key);
|
|
4919
|
-
if (validatePropName(normalizedKey)) {
|
|
4920
|
-
const opt = raw[key];
|
|
4921
|
-
const prop = (normalized[normalizedKey] =
|
|
4922
|
-
isArray(opt) || isFunction(opt) ? { type: opt } : opt);
|
|
4923
|
-
if (prop) {
|
|
4924
|
-
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
4925
|
-
const stringIndex = getTypeIndex(String, prop.type);
|
|
4926
|
-
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
4927
|
-
prop[1 /* shouldCastTrue */] =
|
|
4928
|
-
stringIndex < 0 || booleanIndex < stringIndex;
|
|
4929
|
-
// if the prop needs boolean casting or default value
|
|
4930
|
-
if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
|
4931
|
-
needCastKeys.push(normalizedKey);
|
|
4932
|
-
}
|
|
4933
|
-
}
|
|
4934
|
-
}
|
|
4935
|
-
}
|
|
4936
|
-
}
|
|
4937
|
-
const res = [normalized, needCastKeys];
|
|
4938
|
-
cache.set(comp, res);
|
|
4939
|
-
return res;
|
|
4940
|
-
}
|
|
4941
|
-
function validatePropName(key) {
|
|
4942
|
-
if (key[0] !== '$') {
|
|
4943
4722
|
return true;
|
|
4723
|
+
},
|
|
4724
|
+
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
4725
|
+
let normalizedProps;
|
|
4726
|
+
return (!!accessCache[key] ||
|
|
4727
|
+
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
4728
|
+
(setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
|
4729
|
+
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
4730
|
+
hasOwn(ctx, key) ||
|
|
4731
|
+
hasOwn(publicPropertiesMap, key) ||
|
|
4732
|
+
hasOwn(appContext.config.globalProperties, key));
|
|
4733
|
+
},
|
|
4734
|
+
defineProperty(target, key, descriptor) {
|
|
4735
|
+
if (descriptor.get != null) {
|
|
4736
|
+
// invalidate key cache of a getter based property #5417
|
|
4737
|
+
target._.accessCache[key] = 0;
|
|
4738
|
+
}
|
|
4739
|
+
else if (hasOwn(descriptor, 'value')) {
|
|
4740
|
+
this.set(target, key, descriptor.value, null);
|
|
4741
|
+
}
|
|
4742
|
+
return Reflect.defineProperty(target, key, descriptor);
|
|
4944
4743
|
}
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
function getType(ctor) {
|
|
4953
|
-
const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
|
|
4954
|
-
return match ? match[1] : ctor === null ? 'null' : '';
|
|
4955
|
-
}
|
|
4956
|
-
function isSameType(a, b) {
|
|
4957
|
-
return getType(a) === getType(b);
|
|
4744
|
+
};
|
|
4745
|
+
{
|
|
4746
|
+
PublicInstanceProxyHandlers.ownKeys = (target) => {
|
|
4747
|
+
warn$1(`Avoid app logic that relies on enumerating keys on a component instance. ` +
|
|
4748
|
+
`The keys will be empty in production mode to avoid performance overhead.`);
|
|
4749
|
+
return Reflect.ownKeys(target);
|
|
4750
|
+
};
|
|
4958
4751
|
}
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4752
|
+
const RuntimeCompiledPublicInstanceProxyHandlers = /*#__PURE__*/ extend({}, PublicInstanceProxyHandlers, {
|
|
4753
|
+
get(target, key) {
|
|
4754
|
+
// fast path for unscopables when using `with` block
|
|
4755
|
+
if (key === Symbol.unscopables) {
|
|
4756
|
+
return;
|
|
4757
|
+
}
|
|
4758
|
+
return PublicInstanceProxyHandlers.get(target, key, target);
|
|
4759
|
+
},
|
|
4760
|
+
has(_, key) {
|
|
4761
|
+
const has = key[0] !== '_' && !isGloballyWhitelisted(key);
|
|
4762
|
+
if (!has && PublicInstanceProxyHandlers.has(_, key)) {
|
|
4763
|
+
warn$1(`Property ${JSON.stringify(key)} should not start with _ which is a reserved prefix for Vue internals.`);
|
|
4764
|
+
}
|
|
4765
|
+
return has;
|
|
4965
4766
|
}
|
|
4966
|
-
|
|
4767
|
+
});
|
|
4768
|
+
// dev only
|
|
4769
|
+
// In dev mode, the proxy target exposes the same properties as seen on `this`
|
|
4770
|
+
// for easier console inspection. In prod mode it will be an empty object so
|
|
4771
|
+
// these properties definitions can be skipped.
|
|
4772
|
+
function createDevRenderContext(instance) {
|
|
4773
|
+
const target = {};
|
|
4774
|
+
// expose internal instance for proxy handlers
|
|
4775
|
+
Object.defineProperty(target, `_`, {
|
|
4776
|
+
configurable: true,
|
|
4777
|
+
enumerable: false,
|
|
4778
|
+
get: () => instance
|
|
4779
|
+
});
|
|
4780
|
+
// expose public properties
|
|
4781
|
+
Object.keys(publicPropertiesMap).forEach(key => {
|
|
4782
|
+
Object.defineProperty(target, key, {
|
|
4783
|
+
configurable: true,
|
|
4784
|
+
enumerable: false,
|
|
4785
|
+
get: () => publicPropertiesMap[key](instance),
|
|
4786
|
+
// intercepted by the proxy so no need for implementation,
|
|
4787
|
+
// but needed to prevent set errors
|
|
4788
|
+
set: NOOP
|
|
4789
|
+
});
|
|
4790
|
+
});
|
|
4791
|
+
return target;
|
|
4967
4792
|
}
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4793
|
+
// dev only
|
|
4794
|
+
function exposePropsOnRenderContext(instance) {
|
|
4795
|
+
const { ctx, propsOptions: [propsOptions] } = instance;
|
|
4796
|
+
if (propsOptions) {
|
|
4797
|
+
Object.keys(propsOptions).forEach(key => {
|
|
4798
|
+
Object.defineProperty(ctx, key, {
|
|
4799
|
+
enumerable: true,
|
|
4800
|
+
configurable: true,
|
|
4801
|
+
get: () => instance.props[key],
|
|
4802
|
+
set: NOOP
|
|
4803
|
+
});
|
|
4804
|
+
});
|
|
4979
4805
|
}
|
|
4980
4806
|
}
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
let isValid = false;
|
|
4998
|
-
const types = isArray(type) ? type : [type];
|
|
4999
|
-
const expectedTypes = [];
|
|
5000
|
-
// value is valid as long as one of the specified types match
|
|
5001
|
-
for (let i = 0; i < types.length && !isValid; i++) {
|
|
5002
|
-
const { valid, expectedType } = assertType(value, types[i]);
|
|
5003
|
-
expectedTypes.push(expectedType || '');
|
|
5004
|
-
isValid = valid;
|
|
4807
|
+
// dev only
|
|
4808
|
+
function exposeSetupStateOnRenderContext(instance) {
|
|
4809
|
+
const { ctx, setupState } = instance;
|
|
4810
|
+
Object.keys(toRaw(setupState)).forEach(key => {
|
|
4811
|
+
if (!setupState.__isScriptSetup) {
|
|
4812
|
+
if (isReservedPrefix(key[0])) {
|
|
4813
|
+
warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
|
|
4814
|
+
`which are reserved prefixes for Vue internals.`);
|
|
4815
|
+
return;
|
|
4816
|
+
}
|
|
4817
|
+
Object.defineProperty(ctx, key, {
|
|
4818
|
+
enumerable: true,
|
|
4819
|
+
configurable: true,
|
|
4820
|
+
get: () => setupState[key],
|
|
4821
|
+
set: NOOP
|
|
4822
|
+
});
|
|
5005
4823
|
}
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
4824
|
+
});
|
|
4825
|
+
}
|
|
4826
|
+
|
|
4827
|
+
function createDuplicateChecker() {
|
|
4828
|
+
const cache = Object.create(null);
|
|
4829
|
+
return (type, key) => {
|
|
4830
|
+
if (cache[key]) {
|
|
4831
|
+
warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
|
5009
4832
|
}
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
if (validator && !validator(value)) {
|
|
5013
|
-
warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
|
5014
|
-
}
|
|
5015
|
-
}
|
|
5016
|
-
const isSimpleType = /*#__PURE__*/ makeMap('String,Number,Boolean,Function,Symbol,BigInt');
|
|
5017
|
-
/**
|
|
5018
|
-
* dev only
|
|
5019
|
-
*/
|
|
5020
|
-
function assertType(value, type) {
|
|
5021
|
-
let valid;
|
|
5022
|
-
const expectedType = getType(type);
|
|
5023
|
-
if (isSimpleType(expectedType)) {
|
|
5024
|
-
const t = typeof value;
|
|
5025
|
-
valid = t === expectedType.toLowerCase();
|
|
5026
|
-
// for primitive wrapper objects
|
|
5027
|
-
if (!valid && t === 'object') {
|
|
5028
|
-
valid = value instanceof type;
|
|
4833
|
+
else {
|
|
4834
|
+
cache[key] = type;
|
|
5029
4835
|
}
|
|
5030
|
-
}
|
|
5031
|
-
else if (expectedType === 'Object') {
|
|
5032
|
-
valid = isObject(value);
|
|
5033
|
-
}
|
|
5034
|
-
else if (expectedType === 'Array') {
|
|
5035
|
-
valid = isArray(value);
|
|
5036
|
-
}
|
|
5037
|
-
else if (expectedType === 'null') {
|
|
5038
|
-
valid = value === null;
|
|
5039
|
-
}
|
|
5040
|
-
else {
|
|
5041
|
-
valid = value instanceof type;
|
|
5042
|
-
}
|
|
5043
|
-
return {
|
|
5044
|
-
valid,
|
|
5045
|
-
expectedType
|
|
5046
4836
|
};
|
|
5047
4837
|
}
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
if (expectedTypes.length === 1 &&
|
|
5060
|
-
isExplicable(expectedType) &&
|
|
5061
|
-
!isBoolean(expectedType, receivedType)) {
|
|
5062
|
-
message += ` with value ${expectedValue}`;
|
|
5063
|
-
}
|
|
5064
|
-
message += `, got ${receivedType} `;
|
|
5065
|
-
// check if we need to specify received value
|
|
5066
|
-
if (isExplicable(receivedType)) {
|
|
5067
|
-
message += `with value ${receivedValue}.`;
|
|
4838
|
+
let shouldCacheAccess = true;
|
|
4839
|
+
function applyOptions(instance) {
|
|
4840
|
+
const options = resolveMergedOptions(instance);
|
|
4841
|
+
const publicThis = instance.proxy;
|
|
4842
|
+
const ctx = instance.ctx;
|
|
4843
|
+
// do not cache property access on public proxy during state initialization
|
|
4844
|
+
shouldCacheAccess = false;
|
|
4845
|
+
// call beforeCreate first before accessing other options since
|
|
4846
|
+
// the hook may mutate resolved options (#2791)
|
|
4847
|
+
if (options.beforeCreate) {
|
|
4848
|
+
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
5068
4849
|
}
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
}
|
|
5078
|
-
|
|
5079
|
-
|
|
4850
|
+
const {
|
|
4851
|
+
// state
|
|
4852
|
+
data: dataOptions, computed: computedOptions, methods, watch: watchOptions, provide: provideOptions, inject: injectOptions,
|
|
4853
|
+
// lifecycle
|
|
4854
|
+
created, beforeMount, mounted, beforeUpdate, updated, activated, deactivated, beforeDestroy, beforeUnmount, destroyed, unmounted, render, renderTracked, renderTriggered, errorCaptured, serverPrefetch,
|
|
4855
|
+
// public API
|
|
4856
|
+
expose, inheritAttrs,
|
|
4857
|
+
// assets
|
|
4858
|
+
components, directives, filters } = options;
|
|
4859
|
+
const checkDuplicateProperties = createDuplicateChecker() ;
|
|
4860
|
+
{
|
|
4861
|
+
const [propsOptions] = instance.propsOptions;
|
|
4862
|
+
if (propsOptions) {
|
|
4863
|
+
for (const key in propsOptions) {
|
|
4864
|
+
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
4865
|
+
}
|
|
4866
|
+
}
|
|
5080
4867
|
}
|
|
5081
|
-
|
|
5082
|
-
|
|
4868
|
+
// options initialization order (to be consistent with Vue 2):
|
|
4869
|
+
// - props (already done outside of this function)
|
|
4870
|
+
// - inject
|
|
4871
|
+
// - methods
|
|
4872
|
+
// - data (deferred since it relies on `this` access)
|
|
4873
|
+
// - computed
|
|
4874
|
+
// - watch (deferred since it relies on `this` access)
|
|
4875
|
+
if (injectOptions) {
|
|
4876
|
+
resolveInjections(injectOptions, ctx, checkDuplicateProperties, instance.appContext.config.unwrapInjectedRef);
|
|
5083
4877
|
}
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
function
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
}
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
warn$1(`Slot "${key}" invoked outside of the render function: ` +
|
|
5107
|
-
`this will not track dependencies used in the slot. ` +
|
|
5108
|
-
`Invoke the slot function inside the render function instead.`);
|
|
5109
|
-
}
|
|
5110
|
-
return normalizeSlotValue(rawSlot(...args));
|
|
5111
|
-
}, ctx);
|
|
5112
|
-
normalized._c = false;
|
|
5113
|
-
return normalized;
|
|
5114
|
-
};
|
|
5115
|
-
const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
5116
|
-
const ctx = rawSlots._ctx;
|
|
5117
|
-
for (const key in rawSlots) {
|
|
5118
|
-
if (isInternalKey(key))
|
|
5119
|
-
continue;
|
|
5120
|
-
const value = rawSlots[key];
|
|
5121
|
-
if (isFunction(value)) {
|
|
5122
|
-
slots[key] = normalizeSlot(key, value, ctx);
|
|
5123
|
-
}
|
|
5124
|
-
else if (value != null) {
|
|
5125
|
-
{
|
|
5126
|
-
warn$1(`Non-function value encountered for slot "${key}". ` +
|
|
5127
|
-
`Prefer function slots for better performance.`);
|
|
4878
|
+
if (methods) {
|
|
4879
|
+
for (const key in methods) {
|
|
4880
|
+
const methodHandler = methods[key];
|
|
4881
|
+
if (isFunction(methodHandler)) {
|
|
4882
|
+
// In dev mode, we use the `createRenderContext` function to define
|
|
4883
|
+
// methods to the proxy target, and those are read-only but
|
|
4884
|
+
// reconfigurable, so it needs to be redefined here
|
|
4885
|
+
{
|
|
4886
|
+
Object.defineProperty(ctx, key, {
|
|
4887
|
+
value: methodHandler.bind(publicThis),
|
|
4888
|
+
configurable: true,
|
|
4889
|
+
enumerable: true,
|
|
4890
|
+
writable: true
|
|
4891
|
+
});
|
|
4892
|
+
}
|
|
4893
|
+
{
|
|
4894
|
+
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
4895
|
+
}
|
|
4896
|
+
}
|
|
4897
|
+
else {
|
|
4898
|
+
warn$1(`Method "${key}" has type "${typeof methodHandler}" in the component definition. ` +
|
|
4899
|
+
`Did you reference the function correctly?`);
|
|
5128
4900
|
}
|
|
5129
|
-
const normalized = normalizeSlotValue(value);
|
|
5130
|
-
slots[key] = () => normalized;
|
|
5131
4901
|
}
|
|
5132
4902
|
}
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
warn$1(`Non-function value encountered for default slot. ` +
|
|
5138
|
-
`Prefer function slots for better performance.`);
|
|
5139
|
-
}
|
|
5140
|
-
const normalized = normalizeSlotValue(children);
|
|
5141
|
-
instance.slots.default = () => normalized;
|
|
5142
|
-
};
|
|
5143
|
-
const initSlots = (instance, children) => {
|
|
5144
|
-
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
5145
|
-
const type = children._;
|
|
5146
|
-
if (type) {
|
|
5147
|
-
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
5148
|
-
// we should avoid the proxy object polluting the slots of the internal instance
|
|
5149
|
-
instance.slots = toRaw(children);
|
|
5150
|
-
// make compiler marker non-enumerable
|
|
5151
|
-
def(children, '_', type);
|
|
4903
|
+
if (dataOptions) {
|
|
4904
|
+
if (!isFunction(dataOptions)) {
|
|
4905
|
+
warn$1(`The data option must be a function. ` +
|
|
4906
|
+
`Plain object usage is no longer supported.`);
|
|
5152
4907
|
}
|
|
5153
|
-
|
|
5154
|
-
|
|
4908
|
+
const data = dataOptions.call(publicThis, publicThis);
|
|
4909
|
+
if (isPromise(data)) {
|
|
4910
|
+
warn$1(`data() returned a Promise - note data() cannot be async; If you ` +
|
|
4911
|
+
`intend to perform data fetching before component renders, use ` +
|
|
4912
|
+
`async setup() + <Suspense>.`);
|
|
5155
4913
|
}
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
instance.slots = {};
|
|
5159
|
-
if (children) {
|
|
5160
|
-
normalizeVNodeSlots(instance, children);
|
|
4914
|
+
if (!isObject(data)) {
|
|
4915
|
+
warn$1(`data() should return an object.`);
|
|
5161
4916
|
}
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
const
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
4917
|
+
else {
|
|
4918
|
+
instance.data = reactive(data);
|
|
4919
|
+
{
|
|
4920
|
+
for (const key in data) {
|
|
4921
|
+
checkDuplicateProperties("Data" /* DATA */, key);
|
|
4922
|
+
// expose data on ctx during dev
|
|
4923
|
+
if (!isReservedPrefix(key[0])) {
|
|
4924
|
+
Object.defineProperty(ctx, key, {
|
|
4925
|
+
configurable: true,
|
|
4926
|
+
enumerable: true,
|
|
4927
|
+
get: () => data[key],
|
|
4928
|
+
set: NOOP
|
|
4929
|
+
});
|
|
4930
|
+
}
|
|
4931
|
+
}
|
|
5177
4932
|
}
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
4933
|
+
}
|
|
4934
|
+
}
|
|
4935
|
+
// state initialization complete at this point - start caching access
|
|
4936
|
+
shouldCacheAccess = true;
|
|
4937
|
+
if (computedOptions) {
|
|
4938
|
+
for (const key in computedOptions) {
|
|
4939
|
+
const opt = computedOptions[key];
|
|
4940
|
+
const get = isFunction(opt)
|
|
4941
|
+
? opt.bind(publicThis, publicThis)
|
|
4942
|
+
: isFunction(opt.get)
|
|
4943
|
+
? opt.get.bind(publicThis, publicThis)
|
|
4944
|
+
: NOOP;
|
|
4945
|
+
if (get === NOOP) {
|
|
4946
|
+
warn$1(`Computed property "${key}" has no getter.`);
|
|
5182
4947
|
}
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
4948
|
+
const set = !isFunction(opt) && isFunction(opt.set)
|
|
4949
|
+
? opt.set.bind(publicThis)
|
|
4950
|
+
: () => {
|
|
4951
|
+
warn$1(`Write operation failed: computed property "${key}" is readonly.`);
|
|
4952
|
+
}
|
|
4953
|
+
;
|
|
4954
|
+
const c = computed$1({
|
|
4955
|
+
get,
|
|
4956
|
+
set
|
|
4957
|
+
});
|
|
4958
|
+
Object.defineProperty(ctx, key, {
|
|
4959
|
+
enumerable: true,
|
|
4960
|
+
configurable: true,
|
|
4961
|
+
get: () => c.value,
|
|
4962
|
+
set: v => (c.value = v)
|
|
4963
|
+
});
|
|
4964
|
+
{
|
|
4965
|
+
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
5194
4966
|
}
|
|
5195
4967
|
}
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
4968
|
+
}
|
|
4969
|
+
if (watchOptions) {
|
|
4970
|
+
for (const key in watchOptions) {
|
|
4971
|
+
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
5199
4972
|
}
|
|
5200
|
-
deletionComparisonTarget = children;
|
|
5201
4973
|
}
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
4974
|
+
if (provideOptions) {
|
|
4975
|
+
const provides = isFunction(provideOptions)
|
|
4976
|
+
? provideOptions.call(publicThis)
|
|
4977
|
+
: provideOptions;
|
|
4978
|
+
Reflect.ownKeys(provides).forEach(key => {
|
|
4979
|
+
provide(key, provides[key]);
|
|
4980
|
+
});
|
|
5206
4981
|
}
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
4982
|
+
if (created) {
|
|
4983
|
+
callHook(created, instance, "c" /* CREATED */);
|
|
4984
|
+
}
|
|
4985
|
+
function registerLifecycleHook(register, hook) {
|
|
4986
|
+
if (isArray(hook)) {
|
|
4987
|
+
hook.forEach(_hook => register(_hook.bind(publicThis)));
|
|
4988
|
+
}
|
|
4989
|
+
else if (hook) {
|
|
4990
|
+
register(hook.bind(publicThis));
|
|
5213
4991
|
}
|
|
5214
4992
|
}
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
4993
|
+
registerLifecycleHook(onBeforeMount, beforeMount);
|
|
4994
|
+
registerLifecycleHook(onMounted, mounted);
|
|
4995
|
+
registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
|
4996
|
+
registerLifecycleHook(onUpdated, updated);
|
|
4997
|
+
registerLifecycleHook(onActivated, activated);
|
|
4998
|
+
registerLifecycleHook(onDeactivated, deactivated);
|
|
4999
|
+
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
|
5000
|
+
registerLifecycleHook(onRenderTracked, renderTracked);
|
|
5001
|
+
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
|
5002
|
+
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
|
5003
|
+
registerLifecycleHook(onUnmounted, unmounted);
|
|
5004
|
+
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
5005
|
+
if (isArray(expose)) {
|
|
5006
|
+
if (expose.length) {
|
|
5007
|
+
const exposed = instance.exposed || (instance.exposed = {});
|
|
5008
|
+
expose.forEach(key => {
|
|
5009
|
+
Object.defineProperty(exposed, key, {
|
|
5010
|
+
get: () => publicThis[key],
|
|
5011
|
+
set: val => (publicThis[key] = val)
|
|
5012
|
+
});
|
|
5013
|
+
});
|
|
5014
|
+
}
|
|
5015
|
+
else if (!instance.exposed) {
|
|
5016
|
+
instance.exposed = {};
|
|
5017
|
+
}
|
|
5018
|
+
}
|
|
5019
|
+
// options that are handled when creating the instance but also need to be
|
|
5020
|
+
// applied from mixins
|
|
5021
|
+
if (render && instance.render === NOOP) {
|
|
5022
|
+
instance.render = render;
|
|
5023
|
+
}
|
|
5024
|
+
if (inheritAttrs != null) {
|
|
5025
|
+
instance.inheritAttrs = inheritAttrs;
|
|
5232
5026
|
}
|
|
5027
|
+
// asset options.
|
|
5028
|
+
if (components)
|
|
5029
|
+
instance.components = components;
|
|
5030
|
+
if (directives)
|
|
5031
|
+
instance.directives = directives;
|
|
5233
5032
|
}
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
function withDirectives(vnode, directives) {
|
|
5238
|
-
const internalInstance = currentRenderingInstance;
|
|
5239
|
-
if (internalInstance === null) {
|
|
5240
|
-
warn$1(`withDirectives can only be used inside render functions.`);
|
|
5241
|
-
return vnode;
|
|
5033
|
+
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
|
|
5034
|
+
if (isArray(injectOptions)) {
|
|
5035
|
+
injectOptions = normalizeInject(injectOptions);
|
|
5242
5036
|
}
|
|
5243
|
-
const
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
}
|
|
5037
|
+
for (const key in injectOptions) {
|
|
5038
|
+
const opt = injectOptions[key];
|
|
5039
|
+
let injected;
|
|
5040
|
+
if (isObject(opt)) {
|
|
5041
|
+
if ('default' in opt) {
|
|
5042
|
+
injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
|
|
5043
|
+
}
|
|
5044
|
+
else {
|
|
5045
|
+
injected = inject(opt.from || key);
|
|
5046
|
+
}
|
|
5253
5047
|
}
|
|
5254
|
-
|
|
5255
|
-
|
|
5048
|
+
else {
|
|
5049
|
+
injected = inject(opt);
|
|
5050
|
+
}
|
|
5051
|
+
if (isRef(injected)) {
|
|
5052
|
+
// TODO remove the check in 3.3
|
|
5053
|
+
if (unwrapRef) {
|
|
5054
|
+
Object.defineProperty(ctx, key, {
|
|
5055
|
+
enumerable: true,
|
|
5056
|
+
configurable: true,
|
|
5057
|
+
get: () => injected.value,
|
|
5058
|
+
set: v => (injected.value = v)
|
|
5059
|
+
});
|
|
5060
|
+
}
|
|
5061
|
+
else {
|
|
5062
|
+
{
|
|
5063
|
+
warn$1(`injected property "${key}" is a ref and will be auto-unwrapped ` +
|
|
5064
|
+
`and no longer needs \`.value\` in the next minor release. ` +
|
|
5065
|
+
`To opt-in to the new behavior now, ` +
|
|
5066
|
+
`set \`app.config.unwrapInjectedRef = true\` (this config is ` +
|
|
5067
|
+
`temporary and will not be needed in the future.)`);
|
|
5068
|
+
}
|
|
5069
|
+
ctx[key] = injected;
|
|
5070
|
+
}
|
|
5071
|
+
}
|
|
5072
|
+
else {
|
|
5073
|
+
ctx[key] = injected;
|
|
5074
|
+
}
|
|
5075
|
+
{
|
|
5076
|
+
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
5256
5077
|
}
|
|
5257
|
-
bindings.push({
|
|
5258
|
-
dir,
|
|
5259
|
-
instance,
|
|
5260
|
-
value,
|
|
5261
|
-
oldValue: void 0,
|
|
5262
|
-
arg,
|
|
5263
|
-
modifiers
|
|
5264
|
-
});
|
|
5265
5078
|
}
|
|
5266
|
-
return vnode;
|
|
5267
5079
|
}
|
|
5268
|
-
function
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5080
|
+
function callHook(hook, instance, type) {
|
|
5081
|
+
callWithAsyncErrorHandling(isArray(hook)
|
|
5082
|
+
? hook.map(h => h.bind(instance.proxy))
|
|
5083
|
+
: hook.bind(instance.proxy), instance, type);
|
|
5084
|
+
}
|
|
5085
|
+
function createWatcher(raw, ctx, publicThis, key) {
|
|
5086
|
+
const getter = key.includes('.')
|
|
5087
|
+
? createPathGetter(publicThis, key)
|
|
5088
|
+
: () => publicThis[key];
|
|
5089
|
+
if (isString(raw)) {
|
|
5090
|
+
const handler = ctx[raw];
|
|
5091
|
+
if (isFunction(handler)) {
|
|
5092
|
+
watch(getter, handler);
|
|
5275
5093
|
}
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
// disable tracking inside all lifecycle hooks
|
|
5279
|
-
// since they can potentially be called inside effects.
|
|
5280
|
-
pauseTracking();
|
|
5281
|
-
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
5282
|
-
vnode.el,
|
|
5283
|
-
binding,
|
|
5284
|
-
vnode,
|
|
5285
|
-
prevVNode
|
|
5286
|
-
]);
|
|
5287
|
-
resetTracking();
|
|
5094
|
+
else {
|
|
5095
|
+
warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
5288
5096
|
}
|
|
5289
5097
|
}
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
}
|
|
5098
|
+
else if (isFunction(raw)) {
|
|
5099
|
+
watch(getter, raw.bind(publicThis));
|
|
5100
|
+
}
|
|
5101
|
+
else if (isObject(raw)) {
|
|
5102
|
+
if (isArray(raw)) {
|
|
5103
|
+
raw.forEach(r => createWatcher(r, ctx, publicThis, key));
|
|
5104
|
+
}
|
|
5105
|
+
else {
|
|
5106
|
+
const handler = isFunction(raw.handler)
|
|
5107
|
+
? raw.handler.bind(publicThis)
|
|
5108
|
+
: ctx[raw.handler];
|
|
5109
|
+
if (isFunction(handler)) {
|
|
5110
|
+
watch(getter, handler, raw);
|
|
5111
|
+
}
|
|
5112
|
+
else {
|
|
5113
|
+
warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
|
5114
|
+
}
|
|
5115
|
+
}
|
|
5116
|
+
}
|
|
5117
|
+
else {
|
|
5118
|
+
warn$1(`Invalid watch option: "${key}"`, raw);
|
|
5119
|
+
}
|
|
5312
5120
|
}
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5121
|
+
/**
|
|
5122
|
+
* Resolve merged options and cache it on the component.
|
|
5123
|
+
* This is done only once per-component since the merging does not involve
|
|
5124
|
+
* instances.
|
|
5125
|
+
*/
|
|
5126
|
+
function resolveMergedOptions(instance) {
|
|
5127
|
+
const base = instance.type;
|
|
5128
|
+
const { mixins, extends: extendsOptions } = base;
|
|
5129
|
+
const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;
|
|
5130
|
+
const cached = cache.get(base);
|
|
5131
|
+
let resolved;
|
|
5132
|
+
if (cached) {
|
|
5133
|
+
resolved = cached;
|
|
5134
|
+
}
|
|
5135
|
+
else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
5136
|
+
{
|
|
5137
|
+
resolved = base;
|
|
5318
5138
|
}
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5139
|
+
}
|
|
5140
|
+
else {
|
|
5141
|
+
resolved = {};
|
|
5142
|
+
if (globalMixins.length) {
|
|
5143
|
+
globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
5322
5144
|
}
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5145
|
+
mergeOptions(resolved, base, optionMergeStrategies);
|
|
5146
|
+
}
|
|
5147
|
+
cache.set(base, resolved);
|
|
5148
|
+
return resolved;
|
|
5149
|
+
}
|
|
5150
|
+
function mergeOptions(to, from, strats, asMixin = false) {
|
|
5151
|
+
const { mixins, extends: extendsOptions } = from;
|
|
5152
|
+
if (extendsOptions) {
|
|
5153
|
+
mergeOptions(to, extendsOptions, strats, true);
|
|
5154
|
+
}
|
|
5155
|
+
if (mixins) {
|
|
5156
|
+
mixins.forEach((m) => mergeOptions(to, m, strats, true));
|
|
5157
|
+
}
|
|
5158
|
+
for (const key in from) {
|
|
5159
|
+
if (asMixin && key === 'expose') {
|
|
5160
|
+
warn$1(`"expose" option is ignored when declared in mixins or extends. ` +
|
|
5161
|
+
`It should only be declared in the base component itself.`);
|
|
5162
|
+
}
|
|
5163
|
+
else {
|
|
5164
|
+
const strat = internalOptionMergeStrats[key] || (strats && strats[key]);
|
|
5165
|
+
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
5166
|
+
}
|
|
5167
|
+
}
|
|
5168
|
+
return to;
|
|
5169
|
+
}
|
|
5170
|
+
const internalOptionMergeStrats = {
|
|
5171
|
+
data: mergeDataFn,
|
|
5172
|
+
props: mergeObjectOptions,
|
|
5173
|
+
emits: mergeObjectOptions,
|
|
5174
|
+
// objects
|
|
5175
|
+
methods: mergeObjectOptions,
|
|
5176
|
+
computed: mergeObjectOptions,
|
|
5177
|
+
// lifecycle
|
|
5178
|
+
beforeCreate: mergeAsArray,
|
|
5179
|
+
created: mergeAsArray,
|
|
5180
|
+
beforeMount: mergeAsArray,
|
|
5181
|
+
mounted: mergeAsArray,
|
|
5182
|
+
beforeUpdate: mergeAsArray,
|
|
5183
|
+
updated: mergeAsArray,
|
|
5184
|
+
beforeDestroy: mergeAsArray,
|
|
5185
|
+
beforeUnmount: mergeAsArray,
|
|
5186
|
+
destroyed: mergeAsArray,
|
|
5187
|
+
unmounted: mergeAsArray,
|
|
5188
|
+
activated: mergeAsArray,
|
|
5189
|
+
deactivated: mergeAsArray,
|
|
5190
|
+
errorCaptured: mergeAsArray,
|
|
5191
|
+
serverPrefetch: mergeAsArray,
|
|
5192
|
+
// assets
|
|
5193
|
+
components: mergeObjectOptions,
|
|
5194
|
+
directives: mergeObjectOptions,
|
|
5195
|
+
// watch
|
|
5196
|
+
watch: mergeWatchOptions,
|
|
5197
|
+
// provide / inject
|
|
5198
|
+
provide: mergeDataFn,
|
|
5199
|
+
inject: mergeInject
|
|
5200
|
+
};
|
|
5201
|
+
function mergeDataFn(to, from) {
|
|
5202
|
+
if (!from) {
|
|
5203
|
+
return to;
|
|
5204
|
+
}
|
|
5205
|
+
if (!to) {
|
|
5206
|
+
return from;
|
|
5207
|
+
}
|
|
5208
|
+
return function mergedDataFn() {
|
|
5209
|
+
return (extend)(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
|
|
5210
|
+
};
|
|
5211
|
+
}
|
|
5212
|
+
function mergeInject(to, from) {
|
|
5213
|
+
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
5214
|
+
}
|
|
5215
|
+
function normalizeInject(raw) {
|
|
5216
|
+
if (isArray(raw)) {
|
|
5217
|
+
const res = {};
|
|
5218
|
+
for (let i = 0; i < raw.length; i++) {
|
|
5219
|
+
res[raw[i]] = raw[i];
|
|
5220
|
+
}
|
|
5221
|
+
return res;
|
|
5222
|
+
}
|
|
5223
|
+
return raw;
|
|
5224
|
+
}
|
|
5225
|
+
function mergeAsArray(to, from) {
|
|
5226
|
+
return to ? [...new Set([].concat(to, from))] : from;
|
|
5227
|
+
}
|
|
5228
|
+
function mergeObjectOptions(to, from) {
|
|
5229
|
+
return to ? extend(extend(Object.create(null), to), from) : from;
|
|
5230
|
+
}
|
|
5231
|
+
function mergeWatchOptions(to, from) {
|
|
5232
|
+
if (!to)
|
|
5233
|
+
return from;
|
|
5234
|
+
if (!from)
|
|
5235
|
+
return to;
|
|
5236
|
+
const merged = extend(Object.create(null), to);
|
|
5237
|
+
for (const key in from) {
|
|
5238
|
+
merged[key] = mergeAsArray(to[key], from[key]);
|
|
5239
|
+
}
|
|
5240
|
+
return merged;
|
|
5241
|
+
}
|
|
5242
|
+
|
|
5243
|
+
function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison
|
|
5244
|
+
isSSR = false) {
|
|
5245
|
+
const props = {};
|
|
5246
|
+
const attrs = {};
|
|
5247
|
+
def(attrs, InternalObjectKey, 1);
|
|
5248
|
+
instance.propsDefaults = Object.create(null);
|
|
5249
|
+
setFullProps(instance, rawProps, props, attrs);
|
|
5250
|
+
// ensure all declared prop keys are present
|
|
5251
|
+
for (const key in instance.propsOptions[0]) {
|
|
5252
|
+
if (!(key in props)) {
|
|
5253
|
+
props[key] = undefined;
|
|
5254
|
+
}
|
|
5255
|
+
}
|
|
5256
|
+
// validation
|
|
5257
|
+
{
|
|
5258
|
+
validateProps(rawProps || {}, props, instance);
|
|
5259
|
+
}
|
|
5260
|
+
if (isStateful) {
|
|
5261
|
+
// stateful
|
|
5262
|
+
instance.props = isSSR ? props : shallowReactive(props);
|
|
5263
|
+
}
|
|
5264
|
+
else {
|
|
5265
|
+
if (!instance.type.props) {
|
|
5266
|
+
// functional w/ optional props, props === attrs
|
|
5267
|
+
instance.props = attrs;
|
|
5268
|
+
}
|
|
5269
|
+
else {
|
|
5270
|
+
// functional w/ declared props
|
|
5271
|
+
instance.props = props;
|
|
5272
|
+
}
|
|
5273
|
+
}
|
|
5274
|
+
instance.attrs = attrs;
|
|
5275
|
+
}
|
|
5276
|
+
function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
5277
|
+
const { props, attrs, vnode: { patchFlag } } = instance;
|
|
5278
|
+
const rawCurrentProps = toRaw(props);
|
|
5279
|
+
const [options] = instance.propsOptions;
|
|
5280
|
+
let hasAttrsChanged = false;
|
|
5281
|
+
if (
|
|
5282
|
+
// always force full diff in dev
|
|
5283
|
+
// - #1942 if hmr is enabled with sfc component
|
|
5284
|
+
// - vite#872 non-sfc component used by sfc component
|
|
5285
|
+
!((instance.type.__hmrId ||
|
|
5286
|
+
(instance.parent && instance.parent.type.__hmrId))) &&
|
|
5287
|
+
(optimized || patchFlag > 0) &&
|
|
5288
|
+
!(patchFlag & 16 /* FULL_PROPS */)) {
|
|
5289
|
+
if (patchFlag & 8 /* PROPS */) {
|
|
5290
|
+
// Compiler-generated props & no keys change, just set the updated
|
|
5291
|
+
// the props.
|
|
5292
|
+
const propsToUpdate = instance.vnode.dynamicProps;
|
|
5293
|
+
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
5294
|
+
let key = propsToUpdate[i];
|
|
5295
|
+
// skip if the prop key is a declared emit event listener
|
|
5296
|
+
if (isEmitListener(instance.emitsOptions, key)) {
|
|
5297
|
+
continue;
|
|
5298
|
+
}
|
|
5299
|
+
// PROPS flag guarantees rawProps to be non-null
|
|
5300
|
+
const value = rawProps[key];
|
|
5301
|
+
if (options) {
|
|
5302
|
+
// attr / props separation was done on init and will be consistent
|
|
5303
|
+
// in this code path, so just check if attrs have it.
|
|
5304
|
+
if (hasOwn(attrs, key)) {
|
|
5305
|
+
if (value !== attrs[key]) {
|
|
5306
|
+
attrs[key] = value;
|
|
5307
|
+
hasAttrsChanged = true;
|
|
5308
|
+
}
|
|
5309
|
+
}
|
|
5310
|
+
else {
|
|
5311
|
+
const camelizedKey = camelize(key);
|
|
5312
|
+
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
|
|
5313
|
+
}
|
|
5314
|
+
}
|
|
5315
|
+
else {
|
|
5316
|
+
if (value !== attrs[key]) {
|
|
5317
|
+
attrs[key] = value;
|
|
5318
|
+
hasAttrsChanged = true;
|
|
5319
|
+
}
|
|
5320
|
+
}
|
|
5321
|
+
}
|
|
5322
|
+
}
|
|
5323
|
+
}
|
|
5324
|
+
else {
|
|
5325
|
+
// full props update.
|
|
5326
|
+
if (setFullProps(instance, rawProps, props, attrs)) {
|
|
5327
|
+
hasAttrsChanged = true;
|
|
5328
|
+
}
|
|
5329
|
+
// in case of dynamic props, check if we need to delete keys from
|
|
5330
|
+
// the props object
|
|
5331
|
+
let kebabKey;
|
|
5332
|
+
for (const key in rawCurrentProps) {
|
|
5333
|
+
if (!rawProps ||
|
|
5334
|
+
// for camelCase
|
|
5335
|
+
(!hasOwn(rawProps, key) &&
|
|
5336
|
+
// it's possible the original props was passed in as kebab-case
|
|
5337
|
+
// and converted to camelCase (#955)
|
|
5338
|
+
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {
|
|
5339
|
+
if (options) {
|
|
5340
|
+
if (rawPrevProps &&
|
|
5341
|
+
// for camelCase
|
|
5342
|
+
(rawPrevProps[key] !== undefined ||
|
|
5343
|
+
// for kebab-case
|
|
5344
|
+
rawPrevProps[kebabKey] !== undefined)) {
|
|
5345
|
+
props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */);
|
|
5346
|
+
}
|
|
5347
|
+
}
|
|
5348
|
+
else {
|
|
5349
|
+
delete props[key];
|
|
5350
|
+
}
|
|
5351
|
+
}
|
|
5352
|
+
}
|
|
5353
|
+
// in the case of functional component w/o props declaration, props and
|
|
5354
|
+
// attrs point to the same object so it should already have been updated.
|
|
5355
|
+
if (attrs !== rawCurrentProps) {
|
|
5356
|
+
for (const key in attrs) {
|
|
5357
|
+
if (!rawProps ||
|
|
5358
|
+
(!hasOwn(rawProps, key) &&
|
|
5359
|
+
(!false ))) {
|
|
5360
|
+
delete attrs[key];
|
|
5361
|
+
hasAttrsChanged = true;
|
|
5362
|
+
}
|
|
5363
|
+
}
|
|
5364
|
+
}
|
|
5365
|
+
}
|
|
5366
|
+
// trigger updates for $attrs in case it's used in component slots
|
|
5367
|
+
if (hasAttrsChanged) {
|
|
5368
|
+
trigger(instance, "set" /* SET */, '$attrs');
|
|
5369
|
+
}
|
|
5370
|
+
{
|
|
5371
|
+
validateProps(rawProps || {}, props, instance);
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
function setFullProps(instance, rawProps, props, attrs) {
|
|
5375
|
+
const [options, needCastKeys] = instance.propsOptions;
|
|
5376
|
+
let hasAttrsChanged = false;
|
|
5377
|
+
let rawCastValues;
|
|
5378
|
+
if (rawProps) {
|
|
5379
|
+
for (let key in rawProps) {
|
|
5380
|
+
// key, ref are reserved and never passed down
|
|
5381
|
+
if (isReservedProp(key)) {
|
|
5382
|
+
continue;
|
|
5383
|
+
}
|
|
5384
|
+
const value = rawProps[key];
|
|
5385
|
+
// prop option names are camelized during normalization, so to support
|
|
5386
|
+
// kebab -> camel conversion here we need to camelize the key.
|
|
5387
|
+
let camelKey;
|
|
5388
|
+
if (options && hasOwn(options, (camelKey = camelize(key)))) {
|
|
5389
|
+
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
|
5390
|
+
props[camelKey] = value;
|
|
5391
|
+
}
|
|
5392
|
+
else {
|
|
5393
|
+
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
|
5394
|
+
}
|
|
5395
|
+
}
|
|
5396
|
+
else if (!isEmitListener(instance.emitsOptions, key)) {
|
|
5397
|
+
if (!(key in attrs) || value !== attrs[key]) {
|
|
5398
|
+
attrs[key] = value;
|
|
5399
|
+
hasAttrsChanged = true;
|
|
5400
|
+
}
|
|
5401
|
+
}
|
|
5402
|
+
}
|
|
5403
|
+
}
|
|
5404
|
+
if (needCastKeys) {
|
|
5405
|
+
const rawCurrentProps = toRaw(props);
|
|
5406
|
+
const castValues = rawCastValues || EMPTY_OBJ;
|
|
5407
|
+
for (let i = 0; i < needCastKeys.length; i++) {
|
|
5408
|
+
const key = needCastKeys[i];
|
|
5409
|
+
props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn(castValues, key));
|
|
5410
|
+
}
|
|
5411
|
+
}
|
|
5412
|
+
return hasAttrsChanged;
|
|
5413
|
+
}
|
|
5414
|
+
function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
5415
|
+
const opt = options[key];
|
|
5416
|
+
if (opt != null) {
|
|
5417
|
+
const hasDefault = hasOwn(opt, 'default');
|
|
5418
|
+
// default values
|
|
5419
|
+
if (hasDefault && value === undefined) {
|
|
5420
|
+
const defaultValue = opt.default;
|
|
5421
|
+
if (opt.type !== Function && isFunction(defaultValue)) {
|
|
5422
|
+
const { propsDefaults } = instance;
|
|
5423
|
+
if (key in propsDefaults) {
|
|
5424
|
+
value = propsDefaults[key];
|
|
5425
|
+
}
|
|
5426
|
+
else {
|
|
5427
|
+
setCurrentInstance(instance);
|
|
5428
|
+
value = propsDefaults[key] = defaultValue.call(null, props);
|
|
5429
|
+
unsetCurrentInstance();
|
|
5430
|
+
}
|
|
5431
|
+
}
|
|
5432
|
+
else {
|
|
5433
|
+
value = defaultValue;
|
|
5434
|
+
}
|
|
5435
|
+
}
|
|
5436
|
+
// boolean casting
|
|
5437
|
+
if (opt[0 /* shouldCast */]) {
|
|
5438
|
+
if (isAbsent && !hasDefault) {
|
|
5439
|
+
value = false;
|
|
5440
|
+
}
|
|
5441
|
+
else if (opt[1 /* shouldCastTrue */] &&
|
|
5442
|
+
(value === '' || value === hyphenate(key))) {
|
|
5443
|
+
value = true;
|
|
5444
|
+
}
|
|
5445
|
+
}
|
|
5446
|
+
}
|
|
5447
|
+
return value;
|
|
5448
|
+
}
|
|
5449
|
+
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
5450
|
+
const cache = appContext.propsCache;
|
|
5451
|
+
const cached = cache.get(comp);
|
|
5452
|
+
if (cached) {
|
|
5453
|
+
return cached;
|
|
5454
|
+
}
|
|
5455
|
+
const raw = comp.props;
|
|
5456
|
+
const normalized = {};
|
|
5457
|
+
const needCastKeys = [];
|
|
5458
|
+
// apply mixin/extends props
|
|
5459
|
+
let hasExtends = false;
|
|
5460
|
+
if (!isFunction(comp)) {
|
|
5461
|
+
const extendProps = (raw) => {
|
|
5462
|
+
hasExtends = true;
|
|
5463
|
+
const [props, keys] = normalizePropsOptions(raw, appContext, true);
|
|
5464
|
+
extend(normalized, props);
|
|
5465
|
+
if (keys)
|
|
5466
|
+
needCastKeys.push(...keys);
|
|
5467
|
+
};
|
|
5468
|
+
if (!asMixin && appContext.mixins.length) {
|
|
5469
|
+
appContext.mixins.forEach(extendProps);
|
|
5470
|
+
}
|
|
5471
|
+
if (comp.extends) {
|
|
5472
|
+
extendProps(comp.extends);
|
|
5473
|
+
}
|
|
5474
|
+
if (comp.mixins) {
|
|
5475
|
+
comp.mixins.forEach(extendProps);
|
|
5476
|
+
}
|
|
5477
|
+
}
|
|
5478
|
+
if (!raw && !hasExtends) {
|
|
5479
|
+
cache.set(comp, EMPTY_ARR);
|
|
5480
|
+
return EMPTY_ARR;
|
|
5481
|
+
}
|
|
5482
|
+
if (isArray(raw)) {
|
|
5483
|
+
for (let i = 0; i < raw.length; i++) {
|
|
5484
|
+
if (!isString(raw[i])) {
|
|
5485
|
+
warn$1(`props must be strings when using array syntax.`, raw[i]);
|
|
5486
|
+
}
|
|
5487
|
+
const normalizedKey = camelize(raw[i]);
|
|
5488
|
+
if (validatePropName(normalizedKey)) {
|
|
5489
|
+
normalized[normalizedKey] = EMPTY_OBJ;
|
|
5490
|
+
}
|
|
5491
|
+
}
|
|
5492
|
+
}
|
|
5493
|
+
else if (raw) {
|
|
5494
|
+
if (!isObject(raw)) {
|
|
5495
|
+
warn$1(`invalid props options`, raw);
|
|
5496
|
+
}
|
|
5497
|
+
for (const key in raw) {
|
|
5498
|
+
const normalizedKey = camelize(key);
|
|
5499
|
+
if (validatePropName(normalizedKey)) {
|
|
5500
|
+
const opt = raw[key];
|
|
5501
|
+
const prop = (normalized[normalizedKey] =
|
|
5502
|
+
isArray(opt) || isFunction(opt) ? { type: opt } : opt);
|
|
5503
|
+
if (prop) {
|
|
5504
|
+
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
5505
|
+
const stringIndex = getTypeIndex(String, prop.type);
|
|
5506
|
+
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
5507
|
+
prop[1 /* shouldCastTrue */] =
|
|
5508
|
+
stringIndex < 0 || booleanIndex < stringIndex;
|
|
5509
|
+
// if the prop needs boolean casting or default value
|
|
5510
|
+
if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
|
5511
|
+
needCastKeys.push(normalizedKey);
|
|
5512
|
+
}
|
|
5513
|
+
}
|
|
5514
|
+
}
|
|
5515
|
+
}
|
|
5516
|
+
}
|
|
5517
|
+
const res = [normalized, needCastKeys];
|
|
5518
|
+
cache.set(comp, res);
|
|
5519
|
+
return res;
|
|
5520
|
+
}
|
|
5521
|
+
function validatePropName(key) {
|
|
5522
|
+
if (key[0] !== '$') {
|
|
5523
|
+
return true;
|
|
5524
|
+
}
|
|
5525
|
+
else {
|
|
5526
|
+
warn$1(`Invalid prop name: "${key}" is a reserved property.`);
|
|
5527
|
+
}
|
|
5528
|
+
return false;
|
|
5529
|
+
}
|
|
5530
|
+
// use function string name to check type constructors
|
|
5531
|
+
// so that it works across vms / iframes.
|
|
5532
|
+
function getType(ctor) {
|
|
5533
|
+
const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
|
|
5534
|
+
return match ? match[1] : ctor === null ? 'null' : '';
|
|
5535
|
+
}
|
|
5536
|
+
function isSameType(a, b) {
|
|
5537
|
+
return getType(a) === getType(b);
|
|
5538
|
+
}
|
|
5539
|
+
function getTypeIndex(type, expectedTypes) {
|
|
5540
|
+
if (isArray(expectedTypes)) {
|
|
5541
|
+
return expectedTypes.findIndex(t => isSameType(t, type));
|
|
5542
|
+
}
|
|
5543
|
+
else if (isFunction(expectedTypes)) {
|
|
5544
|
+
return isSameType(expectedTypes, type) ? 0 : -1;
|
|
5545
|
+
}
|
|
5546
|
+
return -1;
|
|
5547
|
+
}
|
|
5548
|
+
/**
|
|
5549
|
+
* dev only
|
|
5550
|
+
*/
|
|
5551
|
+
function validateProps(rawProps, props, instance) {
|
|
5552
|
+
const resolvedValues = toRaw(props);
|
|
5553
|
+
const options = instance.propsOptions[0];
|
|
5554
|
+
for (const key in options) {
|
|
5555
|
+
let opt = options[key];
|
|
5556
|
+
if (opt == null)
|
|
5557
|
+
continue;
|
|
5558
|
+
validateProp(key, resolvedValues[key], opt, !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key)));
|
|
5559
|
+
}
|
|
5560
|
+
}
|
|
5561
|
+
/**
|
|
5562
|
+
* dev only
|
|
5563
|
+
*/
|
|
5564
|
+
function validateProp(name, value, prop, isAbsent) {
|
|
5565
|
+
const { type, required, validator } = prop;
|
|
5566
|
+
// required!
|
|
5567
|
+
if (required && isAbsent) {
|
|
5568
|
+
warn$1('Missing required prop: "' + name + '"');
|
|
5569
|
+
return;
|
|
5570
|
+
}
|
|
5571
|
+
// missing but optional
|
|
5572
|
+
if (value == null && !prop.required) {
|
|
5573
|
+
return;
|
|
5574
|
+
}
|
|
5575
|
+
// type check
|
|
5576
|
+
if (type != null && type !== true) {
|
|
5577
|
+
let isValid = false;
|
|
5578
|
+
const types = isArray(type) ? type : [type];
|
|
5579
|
+
const expectedTypes = [];
|
|
5580
|
+
// value is valid as long as one of the specified types match
|
|
5581
|
+
for (let i = 0; i < types.length && !isValid; i++) {
|
|
5582
|
+
const { valid, expectedType } = assertType(value, types[i]);
|
|
5583
|
+
expectedTypes.push(expectedType || '');
|
|
5584
|
+
isValid = valid;
|
|
5585
|
+
}
|
|
5586
|
+
if (!isValid) {
|
|
5587
|
+
warn$1(getInvalidTypeMessage(name, value, expectedTypes));
|
|
5588
|
+
return;
|
|
5589
|
+
}
|
|
5590
|
+
}
|
|
5591
|
+
// custom validator
|
|
5592
|
+
if (validator && !validator(value)) {
|
|
5593
|
+
warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
|
5594
|
+
}
|
|
5595
|
+
}
|
|
5596
|
+
const isSimpleType = /*#__PURE__*/ makeMap('String,Number,Boolean,Function,Symbol,BigInt');
|
|
5597
|
+
/**
|
|
5598
|
+
* dev only
|
|
5599
|
+
*/
|
|
5600
|
+
function assertType(value, type) {
|
|
5601
|
+
let valid;
|
|
5602
|
+
const expectedType = getType(type);
|
|
5603
|
+
if (isSimpleType(expectedType)) {
|
|
5604
|
+
const t = typeof value;
|
|
5605
|
+
valid = t === expectedType.toLowerCase();
|
|
5606
|
+
// for primitive wrapper objects
|
|
5607
|
+
if (!valid && t === 'object') {
|
|
5608
|
+
valid = value instanceof type;
|
|
5609
|
+
}
|
|
5610
|
+
}
|
|
5611
|
+
else if (expectedType === 'Object') {
|
|
5612
|
+
valid = isObject(value);
|
|
5613
|
+
}
|
|
5614
|
+
else if (expectedType === 'Array') {
|
|
5615
|
+
valid = isArray(value);
|
|
5616
|
+
}
|
|
5617
|
+
else if (expectedType === 'null') {
|
|
5618
|
+
valid = value === null;
|
|
5619
|
+
}
|
|
5620
|
+
else {
|
|
5621
|
+
valid = value instanceof type;
|
|
5622
|
+
}
|
|
5623
|
+
return {
|
|
5624
|
+
valid,
|
|
5625
|
+
expectedType
|
|
5626
|
+
};
|
|
5627
|
+
}
|
|
5628
|
+
/**
|
|
5629
|
+
* dev only
|
|
5630
|
+
*/
|
|
5631
|
+
function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
5632
|
+
let message = `Invalid prop: type check failed for prop "${name}".` +
|
|
5633
|
+
` Expected ${expectedTypes.map(capitalize).join(' | ')}`;
|
|
5634
|
+
const expectedType = expectedTypes[0];
|
|
5635
|
+
const receivedType = toRawType(value);
|
|
5636
|
+
const expectedValue = styleValue(value, expectedType);
|
|
5637
|
+
const receivedValue = styleValue(value, receivedType);
|
|
5638
|
+
// check if we need to specify expected value
|
|
5639
|
+
if (expectedTypes.length === 1 &&
|
|
5640
|
+
isExplicable(expectedType) &&
|
|
5641
|
+
!isBoolean(expectedType, receivedType)) {
|
|
5642
|
+
message += ` with value ${expectedValue}`;
|
|
5643
|
+
}
|
|
5644
|
+
message += `, got ${receivedType} `;
|
|
5645
|
+
// check if we need to specify received value
|
|
5646
|
+
if (isExplicable(receivedType)) {
|
|
5647
|
+
message += `with value ${receivedValue}.`;
|
|
5648
|
+
}
|
|
5649
|
+
return message;
|
|
5650
|
+
}
|
|
5651
|
+
/**
|
|
5652
|
+
* dev only
|
|
5653
|
+
*/
|
|
5654
|
+
function styleValue(value, type) {
|
|
5655
|
+
if (type === 'String') {
|
|
5656
|
+
return `"${value}"`;
|
|
5657
|
+
}
|
|
5658
|
+
else if (type === 'Number') {
|
|
5659
|
+
return `${Number(value)}`;
|
|
5660
|
+
}
|
|
5661
|
+
else {
|
|
5662
|
+
return `${value}`;
|
|
5663
|
+
}
|
|
5664
|
+
}
|
|
5665
|
+
/**
|
|
5666
|
+
* dev only
|
|
5667
|
+
*/
|
|
5668
|
+
function isExplicable(type) {
|
|
5669
|
+
const explicitTypes = ['string', 'number', 'boolean'];
|
|
5670
|
+
return explicitTypes.some(elem => type.toLowerCase() === elem);
|
|
5671
|
+
}
|
|
5672
|
+
/**
|
|
5673
|
+
* dev only
|
|
5674
|
+
*/
|
|
5675
|
+
function isBoolean(...args) {
|
|
5676
|
+
return args.some(elem => elem.toLowerCase() === 'boolean');
|
|
5677
|
+
}
|
|
5678
|
+
|
|
5679
|
+
const isInternalKey = (key) => key[0] === '_' || key === '$stable';
|
|
5680
|
+
const normalizeSlotValue = (value) => isArray(value)
|
|
5681
|
+
? value.map(normalizeVNode)
|
|
5682
|
+
: [normalizeVNode(value)];
|
|
5683
|
+
const normalizeSlot = (key, rawSlot, ctx) => {
|
|
5684
|
+
if (rawSlot._n) {
|
|
5685
|
+
// already normalized - #5353
|
|
5686
|
+
return rawSlot;
|
|
5687
|
+
}
|
|
5688
|
+
const normalized = withCtx((...args) => {
|
|
5689
|
+
if (currentInstance) {
|
|
5690
|
+
warn$1(`Slot "${key}" invoked outside of the render function: ` +
|
|
5691
|
+
`this will not track dependencies used in the slot. ` +
|
|
5692
|
+
`Invoke the slot function inside the render function instead.`);
|
|
5693
|
+
}
|
|
5694
|
+
return normalizeSlotValue(rawSlot(...args));
|
|
5695
|
+
}, ctx);
|
|
5696
|
+
normalized._c = false;
|
|
5697
|
+
return normalized;
|
|
5698
|
+
};
|
|
5699
|
+
const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
5700
|
+
const ctx = rawSlots._ctx;
|
|
5701
|
+
for (const key in rawSlots) {
|
|
5702
|
+
if (isInternalKey(key))
|
|
5703
|
+
continue;
|
|
5704
|
+
const value = rawSlots[key];
|
|
5705
|
+
if (isFunction(value)) {
|
|
5706
|
+
slots[key] = normalizeSlot(key, value, ctx);
|
|
5707
|
+
}
|
|
5708
|
+
else if (value != null) {
|
|
5709
|
+
{
|
|
5710
|
+
warn$1(`Non-function value encountered for slot "${key}". ` +
|
|
5711
|
+
`Prefer function slots for better performance.`);
|
|
5712
|
+
}
|
|
5713
|
+
const normalized = normalizeSlotValue(value);
|
|
5714
|
+
slots[key] = () => normalized;
|
|
5715
|
+
}
|
|
5716
|
+
}
|
|
5717
|
+
};
|
|
5718
|
+
const normalizeVNodeSlots = (instance, children) => {
|
|
5719
|
+
if (!isKeepAlive(instance.vnode) &&
|
|
5720
|
+
!(false )) {
|
|
5721
|
+
warn$1(`Non-function value encountered for default slot. ` +
|
|
5722
|
+
`Prefer function slots for better performance.`);
|
|
5723
|
+
}
|
|
5724
|
+
const normalized = normalizeSlotValue(children);
|
|
5725
|
+
instance.slots.default = () => normalized;
|
|
5726
|
+
};
|
|
5727
|
+
const initSlots = (instance, children) => {
|
|
5728
|
+
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
5729
|
+
const type = children._;
|
|
5730
|
+
if (type) {
|
|
5731
|
+
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
5732
|
+
// we should avoid the proxy object polluting the slots of the internal instance
|
|
5733
|
+
instance.slots = toRaw(children);
|
|
5734
|
+
// make compiler marker non-enumerable
|
|
5735
|
+
def(children, '_', type);
|
|
5736
|
+
}
|
|
5737
|
+
else {
|
|
5738
|
+
normalizeObjectSlots(children, (instance.slots = {}));
|
|
5739
|
+
}
|
|
5740
|
+
}
|
|
5741
|
+
else {
|
|
5742
|
+
instance.slots = {};
|
|
5743
|
+
if (children) {
|
|
5744
|
+
normalizeVNodeSlots(instance, children);
|
|
5745
|
+
}
|
|
5746
|
+
}
|
|
5747
|
+
def(instance.slots, InternalObjectKey, 1);
|
|
5748
|
+
};
|
|
5749
|
+
const updateSlots = (instance, children, optimized) => {
|
|
5750
|
+
const { vnode, slots } = instance;
|
|
5751
|
+
let needDeletionCheck = true;
|
|
5752
|
+
let deletionComparisonTarget = EMPTY_OBJ;
|
|
5753
|
+
if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
5754
|
+
const type = children._;
|
|
5755
|
+
if (type) {
|
|
5756
|
+
// compiled slots.
|
|
5757
|
+
if (isHmrUpdating) {
|
|
5758
|
+
// Parent was HMR updated so slot content may have changed.
|
|
5759
|
+
// force update slots and mark instance for hmr as well
|
|
5760
|
+
extend(slots, children);
|
|
5761
|
+
}
|
|
5762
|
+
else if (optimized && type === 1 /* STABLE */) {
|
|
5763
|
+
// compiled AND stable.
|
|
5764
|
+
// no need to update, and skip stale slots removal.
|
|
5765
|
+
needDeletionCheck = false;
|
|
5766
|
+
}
|
|
5767
|
+
else {
|
|
5768
|
+
// compiled but dynamic (v-if/v-for on slots) - update slots, but skip
|
|
5769
|
+
// normalization.
|
|
5770
|
+
extend(slots, children);
|
|
5771
|
+
// #2893
|
|
5772
|
+
// when rendering the optimized slots by manually written render function,
|
|
5773
|
+
// we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
|
|
5774
|
+
// i.e. let the `renderSlot` create the bailed Fragment
|
|
5775
|
+
if (!optimized && type === 1 /* STABLE */) {
|
|
5776
|
+
delete slots._;
|
|
5777
|
+
}
|
|
5778
|
+
}
|
|
5779
|
+
}
|
|
5780
|
+
else {
|
|
5781
|
+
needDeletionCheck = !children.$stable;
|
|
5782
|
+
normalizeObjectSlots(children, slots);
|
|
5783
|
+
}
|
|
5784
|
+
deletionComparisonTarget = children;
|
|
5785
|
+
}
|
|
5786
|
+
else if (children) {
|
|
5787
|
+
// non slot object children (direct value) passed to a component
|
|
5788
|
+
normalizeVNodeSlots(instance, children);
|
|
5789
|
+
deletionComparisonTarget = { default: 1 };
|
|
5790
|
+
}
|
|
5791
|
+
// delete stale slots
|
|
5792
|
+
if (needDeletionCheck) {
|
|
5793
|
+
for (const key in slots) {
|
|
5794
|
+
if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
|
|
5795
|
+
delete slots[key];
|
|
5796
|
+
}
|
|
5797
|
+
}
|
|
5798
|
+
}
|
|
5799
|
+
};
|
|
5800
|
+
|
|
5801
|
+
function createAppContext() {
|
|
5802
|
+
return {
|
|
5803
|
+
app: null,
|
|
5804
|
+
config: {
|
|
5805
|
+
isNativeTag: NO,
|
|
5806
|
+
performance: false,
|
|
5807
|
+
globalProperties: {},
|
|
5808
|
+
optionMergeStrategies: {},
|
|
5809
|
+
errorHandler: undefined,
|
|
5810
|
+
warnHandler: undefined,
|
|
5811
|
+
compilerOptions: {}
|
|
5812
|
+
},
|
|
5813
|
+
mixins: [],
|
|
5814
|
+
components: {},
|
|
5815
|
+
directives: {},
|
|
5816
|
+
provides: Object.create(null),
|
|
5817
|
+
optionsCache: new WeakMap(),
|
|
5818
|
+
propsCache: new WeakMap(),
|
|
5819
|
+
emitsCache: new WeakMap()
|
|
5820
|
+
};
|
|
5821
|
+
}
|
|
5822
|
+
let uid = 0;
|
|
5823
|
+
function createAppAPI(render, hydrate) {
|
|
5824
|
+
return function createApp(rootComponent, rootProps = null) {
|
|
5825
|
+
if (!isFunction(rootComponent)) {
|
|
5826
|
+
rootComponent = Object.assign({}, rootComponent);
|
|
5827
|
+
}
|
|
5828
|
+
if (rootProps != null && !isObject(rootProps)) {
|
|
5829
|
+
warn$1(`root props passed to app.mount() must be an object.`);
|
|
5830
|
+
rootProps = null;
|
|
5831
|
+
}
|
|
5832
|
+
const context = createAppContext();
|
|
5833
|
+
const installedPlugins = new Set();
|
|
5834
|
+
let isMounted = false;
|
|
5835
|
+
const app = (context.app = {
|
|
5836
|
+
_uid: uid++,
|
|
5837
|
+
_component: rootComponent,
|
|
5838
|
+
_props: rootProps,
|
|
5839
|
+
_container: null,
|
|
5840
|
+
_context: context,
|
|
5841
|
+
_instance: null,
|
|
5842
|
+
version,
|
|
5843
|
+
get config() {
|
|
5844
|
+
return context.config;
|
|
5845
|
+
},
|
|
5846
|
+
set config(v) {
|
|
5847
|
+
{
|
|
5848
|
+
warn$1(`app.config cannot be replaced. Modify individual options instead.`);
|
|
5849
|
+
}
|
|
5850
|
+
},
|
|
5851
|
+
use(plugin, ...options) {
|
|
5852
|
+
if (installedPlugins.has(plugin)) {
|
|
5853
|
+
warn$1(`Plugin has already been applied to target app.`);
|
|
5854
|
+
}
|
|
5855
|
+
else if (plugin && isFunction(plugin.install)) {
|
|
5856
|
+
installedPlugins.add(plugin);
|
|
5857
|
+
plugin.install(app, ...options);
|
|
5858
|
+
}
|
|
5350
5859
|
else if (isFunction(plugin)) {
|
|
5351
5860
|
installedPlugins.add(plugin);
|
|
5352
5861
|
plugin(app, ...options);
|
|
@@ -5397,6 +5906,12 @@ function createAppAPI(render, hydrate) {
|
|
|
5397
5906
|
},
|
|
5398
5907
|
mount(rootContainer, isHydrate, isSVG) {
|
|
5399
5908
|
if (!isMounted) {
|
|
5909
|
+
// #5571
|
|
5910
|
+
if (rootContainer.__vue_app__) {
|
|
5911
|
+
warn$1(`There is already an app instance mounted on the host container.\n` +
|
|
5912
|
+
` If you want to mount another app on the same host container,` +
|
|
5913
|
+
` you need to unmount the previous app by calling \`app.unmount()\` first.`);
|
|
5914
|
+
}
|
|
5400
5915
|
const vnode = createVNode(rootComponent, rootProps);
|
|
5401
5916
|
// store app context on the root VNode.
|
|
5402
5917
|
// this will be set on the root instance on initial mount.
|
|
@@ -5447,8 +5962,6 @@ function createAppAPI(render, hydrate) {
|
|
|
5447
5962
|
warn$1(`App already provides property with key "${String(key)}". ` +
|
|
5448
5963
|
`It will be overwritten with the new value.`);
|
|
5449
5964
|
}
|
|
5450
|
-
// TypeScript doesn't allow symbols as index type
|
|
5451
|
-
// https://github.com/Microsoft/TypeScript/issues/24587
|
|
5452
5965
|
context.provides[key] = value;
|
|
5453
5966
|
return app;
|
|
5454
5967
|
}
|
|
@@ -5585,9 +6098,13 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
5585
6098
|
const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
|
5586
6099
|
const isFragmentStart = isComment(node) && node.data === '[';
|
|
5587
6100
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
5588
|
-
const { type, ref, shapeFlag } = vnode;
|
|
6101
|
+
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
5589
6102
|
const domType = node.nodeType;
|
|
5590
6103
|
vnode.el = node;
|
|
6104
|
+
if (patchFlag === -2 /* BAIL */) {
|
|
6105
|
+
optimized = false;
|
|
6106
|
+
vnode.dynamicChildren = null;
|
|
6107
|
+
}
|
|
5591
6108
|
let nextNode = null;
|
|
5592
6109
|
switch (type) {
|
|
5593
6110
|
case Text:
|
|
@@ -6352,6 +6869,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6352
6869
|
else {
|
|
6353
6870
|
if (patchFlag > 0 &&
|
|
6354
6871
|
patchFlag & 64 /* STABLE_FRAGMENT */ &&
|
|
6872
|
+
// #5523 dev root fragment may inherit directives so always force update
|
|
6873
|
+
!(patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) &&
|
|
6355
6874
|
dynamicChildren &&
|
|
6356
6875
|
// #2715 the previous fragment could've been a BAILed one as a result
|
|
6357
6876
|
// of renderSlot() with no valid children
|
|
@@ -6464,7 +6983,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6464
6983
|
}
|
|
6465
6984
|
else {
|
|
6466
6985
|
// no update needed. just copy over properties
|
|
6467
|
-
n2.component = n1.component;
|
|
6468
6986
|
n2.el = n1.el;
|
|
6469
6987
|
instance.vnode = n2;
|
|
6470
6988
|
}
|
|
@@ -6547,7 +7065,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6547
7065
|
// activated hook for keep-alive roots.
|
|
6548
7066
|
// #1742 activated hook must be accessed after first render
|
|
6549
7067
|
// since the hook may be injected by a child keep-alive
|
|
6550
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */
|
|
7068
|
+
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
7069
|
+
(parent &&
|
|
7070
|
+
isAsyncWrapper(parent.vnode) &&
|
|
7071
|
+
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
6551
7072
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
6552
7073
|
}
|
|
6553
7074
|
instance.isMounted = true;
|
|
@@ -6630,9 +7151,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6630
7151
|
}
|
|
6631
7152
|
};
|
|
6632
7153
|
// create reactive effect for rendering
|
|
6633
|
-
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(
|
|
7154
|
+
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(update), instance.scope // track it in component's effect scope
|
|
6634
7155
|
));
|
|
6635
|
-
const update = (instance.update = effect.run
|
|
7156
|
+
const update = (instance.update = () => effect.run());
|
|
6636
7157
|
update.id = instance.uid;
|
|
6637
7158
|
// allowRecurse
|
|
6638
7159
|
// #1801, #2043 component render effects should allow recursive updates
|
|
@@ -6644,7 +7165,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6644
7165
|
effect.onTrigger = instance.rtg
|
|
6645
7166
|
? e => invokeArrayFns(instance.rtg, e)
|
|
6646
7167
|
: void 0;
|
|
6647
|
-
// @ts-ignore (for scheduler)
|
|
6648
7168
|
update.ownerInstance = instance;
|
|
6649
7169
|
}
|
|
6650
7170
|
update();
|
|
@@ -7436,89 +7956,16 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
7436
7956
|
}
|
|
7437
7957
|
else {
|
|
7438
7958
|
vnode.anchor = nextSibling(node);
|
|
7439
|
-
vnode.targetAnchor = hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
7440
|
-
}
|
|
7441
|
-
target._lpa =
|
|
7442
|
-
vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
|
7443
|
-
}
|
|
7444
|
-
}
|
|
7445
|
-
return vnode.anchor && nextSibling(vnode.anchor);
|
|
7446
|
-
}
|
|
7447
|
-
// Force-casted public typing for h and TSX props inference
|
|
7448
|
-
const Teleport = TeleportImpl;
|
|
7449
|
-
|
|
7450
|
-
const COMPONENTS = 'components';
|
|
7451
|
-
const DIRECTIVES = 'directives';
|
|
7452
|
-
/**
|
|
7453
|
-
* @private
|
|
7454
|
-
*/
|
|
7455
|
-
function resolveComponent(name, maybeSelfReference) {
|
|
7456
|
-
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
7457
|
-
}
|
|
7458
|
-
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
7459
|
-
/**
|
|
7460
|
-
* @private
|
|
7461
|
-
*/
|
|
7462
|
-
function resolveDynamicComponent(component) {
|
|
7463
|
-
if (isString(component)) {
|
|
7464
|
-
return resolveAsset(COMPONENTS, component, false) || component;
|
|
7465
|
-
}
|
|
7466
|
-
else {
|
|
7467
|
-
// invalid types will fallthrough to createVNode and raise warning
|
|
7468
|
-
return (component || NULL_DYNAMIC_COMPONENT);
|
|
7469
|
-
}
|
|
7470
|
-
}
|
|
7471
|
-
/**
|
|
7472
|
-
* @private
|
|
7473
|
-
*/
|
|
7474
|
-
function resolveDirective(name) {
|
|
7475
|
-
return resolveAsset(DIRECTIVES, name);
|
|
7476
|
-
}
|
|
7477
|
-
// implementation
|
|
7478
|
-
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
7479
|
-
const instance = currentRenderingInstance || currentInstance;
|
|
7480
|
-
if (instance) {
|
|
7481
|
-
const Component = instance.type;
|
|
7482
|
-
// explicit self name has highest priority
|
|
7483
|
-
if (type === COMPONENTS) {
|
|
7484
|
-
const selfName = getComponentName(Component);
|
|
7485
|
-
if (selfName &&
|
|
7486
|
-
(selfName === name ||
|
|
7487
|
-
selfName === camelize(name) ||
|
|
7488
|
-
selfName === capitalize(camelize(name)))) {
|
|
7489
|
-
return Component;
|
|
7490
|
-
}
|
|
7491
|
-
}
|
|
7492
|
-
const res =
|
|
7493
|
-
// local registration
|
|
7494
|
-
// check instance[type] first which is resolved for options API
|
|
7495
|
-
resolve(instance[type] || Component[type], name) ||
|
|
7496
|
-
// global registration
|
|
7497
|
-
resolve(instance.appContext[type], name);
|
|
7498
|
-
if (!res && maybeSelfReference) {
|
|
7499
|
-
// fallback to implicit self-reference
|
|
7500
|
-
return Component;
|
|
7501
|
-
}
|
|
7502
|
-
if (warnMissing && !res) {
|
|
7503
|
-
const extra = type === COMPONENTS
|
|
7504
|
-
? `\nIf this is a native custom element, make sure to exclude it from ` +
|
|
7505
|
-
`component resolution via compilerOptions.isCustomElement.`
|
|
7506
|
-
: ``;
|
|
7507
|
-
warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
|
7959
|
+
vnode.targetAnchor = hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
7960
|
+
}
|
|
7961
|
+
target._lpa =
|
|
7962
|
+
vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
|
7508
7963
|
}
|
|
7509
|
-
return res;
|
|
7510
|
-
}
|
|
7511
|
-
else {
|
|
7512
|
-
warn$1(`resolve${capitalize(type.slice(0, -1))} ` +
|
|
7513
|
-
`can only be used in render() or setup().`);
|
|
7514
7964
|
}
|
|
7965
|
+
return vnode.anchor && nextSibling(vnode.anchor);
|
|
7515
7966
|
}
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
(registry[name] ||
|
|
7519
|
-
registry[camelize(name)] ||
|
|
7520
|
-
registry[capitalize(camelize(name))]));
|
|
7521
|
-
}
|
|
7967
|
+
// Force-casted public typing for h and TSX props inference
|
|
7968
|
+
const Teleport = TeleportImpl;
|
|
7522
7969
|
|
|
7523
7970
|
const Fragment = Symbol('Fragment' );
|
|
7524
7971
|
const Text = Symbol('Text' );
|
|
@@ -7722,6 +8169,15 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
7722
8169
|
if (children) {
|
|
7723
8170
|
normalizeChildren(cloned, children);
|
|
7724
8171
|
}
|
|
8172
|
+
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
8173
|
+
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
8174
|
+
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
8175
|
+
}
|
|
8176
|
+
else {
|
|
8177
|
+
currentBlock.push(cloned);
|
|
8178
|
+
}
|
|
8179
|
+
}
|
|
8180
|
+
cloned.patchFlag |= -2 /* BAIL */;
|
|
7725
8181
|
return cloned;
|
|
7726
8182
|
}
|
|
7727
8183
|
// class component normalization.
|
|
@@ -7798,607 +8254,195 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
7798
8254
|
slotScopeIds: vnode.slotScopeIds,
|
|
7799
8255
|
children: patchFlag === -1 /* HOISTED */ && isArray(children)
|
|
7800
8256
|
? children.map(deepCloneVNode)
|
|
7801
|
-
: children,
|
|
7802
|
-
target: vnode.target,
|
|
7803
|
-
targetAnchor: vnode.targetAnchor,
|
|
7804
|
-
staticCount: vnode.staticCount,
|
|
7805
|
-
shapeFlag: vnode.shapeFlag,
|
|
7806
|
-
// if the vnode is cloned with extra props, we can no longer assume its
|
|
7807
|
-
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
7808
|
-
// note: preserve flag for fragments since they use the flag for children
|
|
7809
|
-
// fast paths only.
|
|
7810
|
-
patchFlag: extraProps && vnode.type !== Fragment
|
|
7811
|
-
? patchFlag === -1 // hoisted node
|
|
7812
|
-
? 16 /* FULL_PROPS */
|
|
7813
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
7814
|
-
: patchFlag,
|
|
7815
|
-
dynamicProps: vnode.dynamicProps,
|
|
7816
|
-
dynamicChildren: vnode.dynamicChildren,
|
|
7817
|
-
appContext: vnode.appContext,
|
|
7818
|
-
dirs: vnode.dirs,
|
|
7819
|
-
transition: vnode.transition,
|
|
7820
|
-
// These should technically only be non-null on mounted VNodes. However,
|
|
7821
|
-
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
7822
|
-
// them since them being non-null during a mount doesn't affect the logic as
|
|
7823
|
-
// they will simply be overwritten.
|
|
7824
|
-
component: vnode.component,
|
|
7825
|
-
suspense: vnode.suspense,
|
|
7826
|
-
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
7827
|
-
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
7828
|
-
el: vnode.el,
|
|
7829
|
-
anchor: vnode.anchor
|
|
7830
|
-
};
|
|
7831
|
-
return cloned;
|
|
7832
|
-
}
|
|
7833
|
-
/**
|
|
7834
|
-
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
7835
|
-
* https://github.com/vitejs/vite/issues/2022
|
|
7836
|
-
*/
|
|
7837
|
-
function deepCloneVNode(vnode) {
|
|
7838
|
-
const cloned = cloneVNode(vnode);
|
|
7839
|
-
if (isArray(vnode.children)) {
|
|
7840
|
-
cloned.children = vnode.children.map(deepCloneVNode);
|
|
7841
|
-
}
|
|
7842
|
-
return cloned;
|
|
7843
|
-
}
|
|
7844
|
-
/**
|
|
7845
|
-
* @private
|
|
7846
|
-
*/
|
|
7847
|
-
function createTextVNode(text = ' ', flag = 0) {
|
|
7848
|
-
return createVNode(Text, null, text, flag);
|
|
7849
|
-
}
|
|
7850
|
-
/**
|
|
7851
|
-
* @private
|
|
7852
|
-
*/
|
|
7853
|
-
function createStaticVNode(content, numberOfNodes) {
|
|
7854
|
-
// A static vnode can contain multiple stringified elements, and the number
|
|
7855
|
-
// of elements is necessary for hydration.
|
|
7856
|
-
const vnode = createVNode(Static, null, content);
|
|
7857
|
-
vnode.staticCount = numberOfNodes;
|
|
7858
|
-
return vnode;
|
|
7859
|
-
}
|
|
7860
|
-
/**
|
|
7861
|
-
* @private
|
|
7862
|
-
*/
|
|
7863
|
-
function createCommentVNode(text = '',
|
|
7864
|
-
// when used as the v-else branch, the comment node must be created as a
|
|
7865
|
-
// block to ensure correct updates.
|
|
7866
|
-
asBlock = false) {
|
|
7867
|
-
return asBlock
|
|
7868
|
-
? (openBlock(), createBlock(Comment, null, text))
|
|
7869
|
-
: createVNode(Comment, null, text);
|
|
7870
|
-
}
|
|
7871
|
-
function normalizeVNode(child) {
|
|
7872
|
-
if (child == null || typeof child === 'boolean') {
|
|
7873
|
-
// empty placeholder
|
|
7874
|
-
return createVNode(Comment);
|
|
7875
|
-
}
|
|
7876
|
-
else if (isArray(child)) {
|
|
7877
|
-
// fragment
|
|
7878
|
-
return createVNode(Fragment, null,
|
|
7879
|
-
// #3666, avoid reference pollution when reusing vnode
|
|
7880
|
-
child.slice());
|
|
7881
|
-
}
|
|
7882
|
-
else if (typeof child === 'object') {
|
|
7883
|
-
// already vnode, this should be the most common since compiled templates
|
|
7884
|
-
// always produce all-vnode children arrays
|
|
7885
|
-
return cloneIfMounted(child);
|
|
7886
|
-
}
|
|
7887
|
-
else {
|
|
7888
|
-
// strings and numbers
|
|
7889
|
-
return createVNode(Text, null, String(child));
|
|
7890
|
-
}
|
|
7891
|
-
}
|
|
7892
|
-
// optimized normalization for template-compiled render fns
|
|
7893
|
-
function cloneIfMounted(child) {
|
|
7894
|
-
return child.el === null || child.memo ? child : cloneVNode(child);
|
|
7895
|
-
}
|
|
7896
|
-
function normalizeChildren(vnode, children) {
|
|
7897
|
-
let type = 0;
|
|
7898
|
-
const { shapeFlag } = vnode;
|
|
7899
|
-
if (children == null) {
|
|
7900
|
-
children = null;
|
|
7901
|
-
}
|
|
7902
|
-
else if (isArray(children)) {
|
|
7903
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
7904
|
-
}
|
|
7905
|
-
else if (typeof children === 'object') {
|
|
7906
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
7907
|
-
// Normalize slot to plain children for plain element and Teleport
|
|
7908
|
-
const slot = children.default;
|
|
7909
|
-
if (slot) {
|
|
7910
|
-
// _c marker is added by withCtx() indicating this is a compiled slot
|
|
7911
|
-
slot._c && (slot._d = false);
|
|
7912
|
-
normalizeChildren(vnode, slot());
|
|
7913
|
-
slot._c && (slot._d = true);
|
|
7914
|
-
}
|
|
7915
|
-
return;
|
|
7916
|
-
}
|
|
7917
|
-
else {
|
|
7918
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
7919
|
-
const slotFlag = children._;
|
|
7920
|
-
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
7921
|
-
children._ctx = currentRenderingInstance;
|
|
7922
|
-
}
|
|
7923
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
7924
|
-
// a child component receives forwarded slots from the parent.
|
|
7925
|
-
// its slot type is determined by its parent's slot type.
|
|
7926
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
7927
|
-
children._ = 1 /* STABLE */;
|
|
7928
|
-
}
|
|
7929
|
-
else {
|
|
7930
|
-
children._ = 2 /* DYNAMIC */;
|
|
7931
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
7932
|
-
}
|
|
7933
|
-
}
|
|
7934
|
-
}
|
|
7935
|
-
}
|
|
7936
|
-
else if (isFunction(children)) {
|
|
7937
|
-
children = { default: children, _ctx: currentRenderingInstance };
|
|
7938
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
7939
|
-
}
|
|
7940
|
-
else {
|
|
7941
|
-
children = String(children);
|
|
7942
|
-
// force teleport children to array so it can be moved around
|
|
7943
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
7944
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
7945
|
-
children = [createTextVNode(children)];
|
|
7946
|
-
}
|
|
7947
|
-
else {
|
|
7948
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
7949
|
-
}
|
|
7950
|
-
}
|
|
7951
|
-
vnode.children = children;
|
|
7952
|
-
vnode.shapeFlag |= type;
|
|
7953
|
-
}
|
|
7954
|
-
function mergeProps(...args) {
|
|
7955
|
-
const ret = {};
|
|
7956
|
-
for (let i = 0; i < args.length; i++) {
|
|
7957
|
-
const toMerge = args[i];
|
|
7958
|
-
for (const key in toMerge) {
|
|
7959
|
-
if (key === 'class') {
|
|
7960
|
-
if (ret.class !== toMerge.class) {
|
|
7961
|
-
ret.class = normalizeClass([ret.class, toMerge.class]);
|
|
7962
|
-
}
|
|
7963
|
-
}
|
|
7964
|
-
else if (key === 'style') {
|
|
7965
|
-
ret.style = normalizeStyle([ret.style, toMerge.style]);
|
|
7966
|
-
}
|
|
7967
|
-
else if (isOn(key)) {
|
|
7968
|
-
const existing = ret[key];
|
|
7969
|
-
const incoming = toMerge[key];
|
|
7970
|
-
if (incoming &&
|
|
7971
|
-
existing !== incoming &&
|
|
7972
|
-
!(isArray(existing) && existing.includes(incoming))) {
|
|
7973
|
-
ret[key] = existing
|
|
7974
|
-
? [].concat(existing, incoming)
|
|
7975
|
-
: incoming;
|
|
7976
|
-
}
|
|
7977
|
-
}
|
|
7978
|
-
else if (key !== '') {
|
|
7979
|
-
ret[key] = toMerge[key];
|
|
7980
|
-
}
|
|
7981
|
-
}
|
|
7982
|
-
}
|
|
7983
|
-
return ret;
|
|
7984
|
-
}
|
|
7985
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
7986
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
7987
|
-
vnode,
|
|
7988
|
-
prevVNode
|
|
7989
|
-
]);
|
|
7990
|
-
}
|
|
7991
|
-
|
|
7992
|
-
/**
|
|
7993
|
-
* Actual implementation
|
|
7994
|
-
*/
|
|
7995
|
-
function renderList(source, renderItem, cache, index) {
|
|
7996
|
-
let ret;
|
|
7997
|
-
const cached = (cache && cache[index]);
|
|
7998
|
-
if (isArray(source) || isString(source)) {
|
|
7999
|
-
ret = new Array(source.length);
|
|
8000
|
-
for (let i = 0, l = source.length; i < l; i++) {
|
|
8001
|
-
ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
|
|
8002
|
-
}
|
|
8003
|
-
}
|
|
8004
|
-
else if (typeof source === 'number') {
|
|
8005
|
-
if (!Number.isInteger(source)) {
|
|
8006
|
-
warn$1(`The v-for range expect an integer value but got ${source}.`);
|
|
8007
|
-
return [];
|
|
8008
|
-
}
|
|
8009
|
-
ret = new Array(source);
|
|
8010
|
-
for (let i = 0; i < source; i++) {
|
|
8011
|
-
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
8012
|
-
}
|
|
8013
|
-
}
|
|
8014
|
-
else if (isObject(source)) {
|
|
8015
|
-
if (source[Symbol.iterator]) {
|
|
8016
|
-
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
8017
|
-
}
|
|
8018
|
-
else {
|
|
8019
|
-
const keys = Object.keys(source);
|
|
8020
|
-
ret = new Array(keys.length);
|
|
8021
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
8022
|
-
const key = keys[i];
|
|
8023
|
-
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
8024
|
-
}
|
|
8025
|
-
}
|
|
8026
|
-
}
|
|
8027
|
-
else {
|
|
8028
|
-
ret = [];
|
|
8029
|
-
}
|
|
8030
|
-
if (cache) {
|
|
8031
|
-
cache[index] = ret;
|
|
8032
|
-
}
|
|
8033
|
-
return ret;
|
|
8034
|
-
}
|
|
8035
|
-
|
|
8257
|
+
: children,
|
|
8258
|
+
target: vnode.target,
|
|
8259
|
+
targetAnchor: vnode.targetAnchor,
|
|
8260
|
+
staticCount: vnode.staticCount,
|
|
8261
|
+
shapeFlag: vnode.shapeFlag,
|
|
8262
|
+
// if the vnode is cloned with extra props, we can no longer assume its
|
|
8263
|
+
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
8264
|
+
// note: preserve flag for fragments since they use the flag for children
|
|
8265
|
+
// fast paths only.
|
|
8266
|
+
patchFlag: extraProps && vnode.type !== Fragment
|
|
8267
|
+
? patchFlag === -1 // hoisted node
|
|
8268
|
+
? 16 /* FULL_PROPS */
|
|
8269
|
+
: patchFlag | 16 /* FULL_PROPS */
|
|
8270
|
+
: patchFlag,
|
|
8271
|
+
dynamicProps: vnode.dynamicProps,
|
|
8272
|
+
dynamicChildren: vnode.dynamicChildren,
|
|
8273
|
+
appContext: vnode.appContext,
|
|
8274
|
+
dirs: vnode.dirs,
|
|
8275
|
+
transition: vnode.transition,
|
|
8276
|
+
// These should technically only be non-null on mounted VNodes. However,
|
|
8277
|
+
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
8278
|
+
// them since them being non-null during a mount doesn't affect the logic as
|
|
8279
|
+
// they will simply be overwritten.
|
|
8280
|
+
component: vnode.component,
|
|
8281
|
+
suspense: vnode.suspense,
|
|
8282
|
+
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
8283
|
+
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
8284
|
+
el: vnode.el,
|
|
8285
|
+
anchor: vnode.anchor
|
|
8286
|
+
};
|
|
8287
|
+
return cloned;
|
|
8288
|
+
}
|
|
8036
8289
|
/**
|
|
8037
|
-
*
|
|
8038
|
-
*
|
|
8290
|
+
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
8291
|
+
* https://github.com/vitejs/vite/issues/2022
|
|
8039
8292
|
*/
|
|
8040
|
-
function
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
if (isArray(slot)) {
|
|
8045
|
-
for (let j = 0; j < slot.length; j++) {
|
|
8046
|
-
slots[slot[j].name] = slot[j].fn;
|
|
8047
|
-
}
|
|
8048
|
-
}
|
|
8049
|
-
else if (slot) {
|
|
8050
|
-
// conditional single slot generated by <template v-if="..." #foo>
|
|
8051
|
-
slots[slot.name] = slot.fn;
|
|
8052
|
-
}
|
|
8293
|
+
function deepCloneVNode(vnode) {
|
|
8294
|
+
const cloned = cloneVNode(vnode);
|
|
8295
|
+
if (isArray(vnode.children)) {
|
|
8296
|
+
cloned.children = vnode.children.map(deepCloneVNode);
|
|
8053
8297
|
}
|
|
8054
|
-
return
|
|
8055
|
-
}
|
|
8056
|
-
|
|
8298
|
+
return cloned;
|
|
8299
|
+
}
|
|
8057
8300
|
/**
|
|
8058
|
-
* Compiler runtime helper for rendering `<slot/>`
|
|
8059
8301
|
* @private
|
|
8060
8302
|
*/
|
|
8061
|
-
function
|
|
8062
|
-
|
|
8063
|
-
// the compiler and guaranteed to be a function returning an array
|
|
8064
|
-
fallback, noSlotted) {
|
|
8065
|
-
if (currentRenderingInstance.isCE ||
|
|
8066
|
-
(currentRenderingInstance.parent &&
|
|
8067
|
-
isAsyncWrapper(currentRenderingInstance.parent) &&
|
|
8068
|
-
currentRenderingInstance.parent.isCE)) {
|
|
8069
|
-
return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
|
|
8070
|
-
}
|
|
8071
|
-
let slot = slots[name];
|
|
8072
|
-
if (slot && slot.length > 1) {
|
|
8073
|
-
warn$1(`SSR-optimized slot function detected in a non-SSR-optimized render ` +
|
|
8074
|
-
`function. You need to mark this component with $dynamic-slots in the ` +
|
|
8075
|
-
`parent template.`);
|
|
8076
|
-
slot = () => [];
|
|
8077
|
-
}
|
|
8078
|
-
// a compiled slot disables block tracking by default to avoid manual
|
|
8079
|
-
// invocation interfering with template-based block tracking, but in
|
|
8080
|
-
// `renderSlot` we can be sure that it's template-based so we can force
|
|
8081
|
-
// enable it.
|
|
8082
|
-
if (slot && slot._c) {
|
|
8083
|
-
slot._d = false;
|
|
8084
|
-
}
|
|
8085
|
-
openBlock();
|
|
8086
|
-
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
8087
|
-
const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
|
|
8088
|
-
? 64 /* STABLE_FRAGMENT */
|
|
8089
|
-
: -2 /* BAIL */);
|
|
8090
|
-
if (!noSlotted && rendered.scopeId) {
|
|
8091
|
-
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
8092
|
-
}
|
|
8093
|
-
if (slot && slot._c) {
|
|
8094
|
-
slot._d = true;
|
|
8095
|
-
}
|
|
8096
|
-
return rendered;
|
|
8303
|
+
function createTextVNode(text = ' ', flag = 0) {
|
|
8304
|
+
return createVNode(Text, null, text, flag);
|
|
8097
8305
|
}
|
|
8098
|
-
function ensureValidVNode(vnodes) {
|
|
8099
|
-
return vnodes.some(child => {
|
|
8100
|
-
if (!isVNode(child))
|
|
8101
|
-
return true;
|
|
8102
|
-
if (child.type === Comment)
|
|
8103
|
-
return false;
|
|
8104
|
-
if (child.type === Fragment &&
|
|
8105
|
-
!ensureValidVNode(child.children))
|
|
8106
|
-
return false;
|
|
8107
|
-
return true;
|
|
8108
|
-
})
|
|
8109
|
-
? vnodes
|
|
8110
|
-
: null;
|
|
8111
|
-
}
|
|
8112
|
-
|
|
8113
8306
|
/**
|
|
8114
|
-
* For prefixing keys in v-on="obj" with "on"
|
|
8115
8307
|
* @private
|
|
8116
8308
|
*/
|
|
8117
|
-
function
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
return
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
//
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
}
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
// during render and is a major hotspot. The most expensive part of this
|
|
8179
|
-
// is the multiple hasOwn() calls. It's much faster to do a simple property
|
|
8180
|
-
// access on a plain object, so we use an accessCache object (with null
|
|
8181
|
-
// prototype) to memoize what access type a key corresponds to.
|
|
8182
|
-
let normalizedProps;
|
|
8183
|
-
if (key[0] !== '$') {
|
|
8184
|
-
const n = accessCache[key];
|
|
8185
|
-
if (n !== undefined) {
|
|
8186
|
-
switch (n) {
|
|
8187
|
-
case 1 /* SETUP */:
|
|
8188
|
-
return setupState[key];
|
|
8189
|
-
case 2 /* DATA */:
|
|
8190
|
-
return data[key];
|
|
8191
|
-
case 4 /* CONTEXT */:
|
|
8192
|
-
return ctx[key];
|
|
8193
|
-
case 3 /* PROPS */:
|
|
8194
|
-
return props[key];
|
|
8195
|
-
// default: just fallthrough
|
|
8196
|
-
}
|
|
8197
|
-
}
|
|
8198
|
-
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
8199
|
-
accessCache[key] = 1 /* SETUP */;
|
|
8200
|
-
return setupState[key];
|
|
8201
|
-
}
|
|
8202
|
-
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
8203
|
-
accessCache[key] = 2 /* DATA */;
|
|
8204
|
-
return data[key];
|
|
8205
|
-
}
|
|
8206
|
-
else if (
|
|
8207
|
-
// only cache other properties when instance has declared (thus stable)
|
|
8208
|
-
// props
|
|
8209
|
-
(normalizedProps = instance.propsOptions[0]) &&
|
|
8210
|
-
hasOwn(normalizedProps, key)) {
|
|
8211
|
-
accessCache[key] = 3 /* PROPS */;
|
|
8212
|
-
return props[key];
|
|
8213
|
-
}
|
|
8214
|
-
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
8215
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
8216
|
-
return ctx[key];
|
|
8217
|
-
}
|
|
8218
|
-
else if (shouldCacheAccess) {
|
|
8219
|
-
accessCache[key] = 0 /* OTHER */;
|
|
8220
|
-
}
|
|
8221
|
-
}
|
|
8222
|
-
const publicGetter = publicPropertiesMap[key];
|
|
8223
|
-
let cssModule, globalProperties;
|
|
8224
|
-
// public $xxx properties
|
|
8225
|
-
if (publicGetter) {
|
|
8226
|
-
if (key === '$attrs') {
|
|
8227
|
-
track(instance, "get" /* GET */, key);
|
|
8228
|
-
markAttrsAccessed();
|
|
8229
|
-
}
|
|
8230
|
-
return publicGetter(instance);
|
|
8231
|
-
}
|
|
8232
|
-
else if (
|
|
8233
|
-
// css module (injected by vue-loader)
|
|
8234
|
-
(cssModule = type.__cssModules) &&
|
|
8235
|
-
(cssModule = cssModule[key])) {
|
|
8236
|
-
return cssModule;
|
|
8237
|
-
}
|
|
8238
|
-
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
8239
|
-
// user may set custom properties to `this` that start with `$`
|
|
8240
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
8241
|
-
return ctx[key];
|
|
8242
|
-
}
|
|
8243
|
-
else if (
|
|
8244
|
-
// global properties
|
|
8245
|
-
((globalProperties = appContext.config.globalProperties),
|
|
8246
|
-
hasOwn(globalProperties, key))) {
|
|
8247
|
-
{
|
|
8248
|
-
return globalProperties[key];
|
|
8249
|
-
}
|
|
8250
|
-
}
|
|
8251
|
-
else if (currentRenderingInstance &&
|
|
8252
|
-
(!isString(key) ||
|
|
8253
|
-
// #1091 avoid internal isRef/isVNode checks on component instance leading
|
|
8254
|
-
// to infinite warning loop
|
|
8255
|
-
key.indexOf('__v') !== 0)) {
|
|
8256
|
-
if (data !== EMPTY_OBJ &&
|
|
8257
|
-
(key[0] === '$' || key[0] === '_') &&
|
|
8258
|
-
hasOwn(data, key)) {
|
|
8259
|
-
warn$1(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved ` +
|
|
8260
|
-
`character ("$" or "_") and is not proxied on the render context.`);
|
|
8261
|
-
}
|
|
8262
|
-
else if (instance === currentRenderingInstance) {
|
|
8263
|
-
warn$1(`Property ${JSON.stringify(key)} was accessed during render ` +
|
|
8264
|
-
`but is not defined on instance.`);
|
|
8309
|
+
function createStaticVNode(content, numberOfNodes) {
|
|
8310
|
+
// A static vnode can contain multiple stringified elements, and the number
|
|
8311
|
+
// of elements is necessary for hydration.
|
|
8312
|
+
const vnode = createVNode(Static, null, content);
|
|
8313
|
+
vnode.staticCount = numberOfNodes;
|
|
8314
|
+
return vnode;
|
|
8315
|
+
}
|
|
8316
|
+
/**
|
|
8317
|
+
* @private
|
|
8318
|
+
*/
|
|
8319
|
+
function createCommentVNode(text = '',
|
|
8320
|
+
// when used as the v-else branch, the comment node must be created as a
|
|
8321
|
+
// block to ensure correct updates.
|
|
8322
|
+
asBlock = false) {
|
|
8323
|
+
return asBlock
|
|
8324
|
+
? (openBlock(), createBlock(Comment, null, text))
|
|
8325
|
+
: createVNode(Comment, null, text);
|
|
8326
|
+
}
|
|
8327
|
+
function normalizeVNode(child) {
|
|
8328
|
+
if (child == null || typeof child === 'boolean') {
|
|
8329
|
+
// empty placeholder
|
|
8330
|
+
return createVNode(Comment);
|
|
8331
|
+
}
|
|
8332
|
+
else if (isArray(child)) {
|
|
8333
|
+
// fragment
|
|
8334
|
+
return createVNode(Fragment, null,
|
|
8335
|
+
// #3666, avoid reference pollution when reusing vnode
|
|
8336
|
+
child.slice());
|
|
8337
|
+
}
|
|
8338
|
+
else if (typeof child === 'object') {
|
|
8339
|
+
// already vnode, this should be the most common since compiled templates
|
|
8340
|
+
// always produce all-vnode children arrays
|
|
8341
|
+
return cloneIfMounted(child);
|
|
8342
|
+
}
|
|
8343
|
+
else {
|
|
8344
|
+
// strings and numbers
|
|
8345
|
+
return createVNode(Text, null, String(child));
|
|
8346
|
+
}
|
|
8347
|
+
}
|
|
8348
|
+
// optimized normalization for template-compiled render fns
|
|
8349
|
+
function cloneIfMounted(child) {
|
|
8350
|
+
return child.el === null || child.memo ? child : cloneVNode(child);
|
|
8351
|
+
}
|
|
8352
|
+
function normalizeChildren(vnode, children) {
|
|
8353
|
+
let type = 0;
|
|
8354
|
+
const { shapeFlag } = vnode;
|
|
8355
|
+
if (children == null) {
|
|
8356
|
+
children = null;
|
|
8357
|
+
}
|
|
8358
|
+
else if (isArray(children)) {
|
|
8359
|
+
type = 16 /* ARRAY_CHILDREN */;
|
|
8360
|
+
}
|
|
8361
|
+
else if (typeof children === 'object') {
|
|
8362
|
+
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
8363
|
+
// Normalize slot to plain children for plain element and Teleport
|
|
8364
|
+
const slot = children.default;
|
|
8365
|
+
if (slot) {
|
|
8366
|
+
// _c marker is added by withCtx() indicating this is a compiled slot
|
|
8367
|
+
slot._c && (slot._d = false);
|
|
8368
|
+
normalizeChildren(vnode, slot());
|
|
8369
|
+
slot._c && (slot._d = true);
|
|
8265
8370
|
}
|
|
8266
|
-
|
|
8267
|
-
},
|
|
8268
|
-
set({ _: instance }, key, value) {
|
|
8269
|
-
const { data, setupState, ctx } = instance;
|
|
8270
|
-
if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
8271
|
-
setupState[key] = value;
|
|
8272
|
-
return true;
|
|
8273
|
-
}
|
|
8274
|
-
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
8275
|
-
data[key] = value;
|
|
8276
|
-
return true;
|
|
8277
|
-
}
|
|
8278
|
-
else if (hasOwn(instance.props, key)) {
|
|
8279
|
-
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
|
8280
|
-
return false;
|
|
8281
|
-
}
|
|
8282
|
-
if (key[0] === '$' && key.slice(1) in instance) {
|
|
8283
|
-
warn$1(`Attempting to mutate public property "${key}". ` +
|
|
8284
|
-
`Properties starting with $ are reserved and readonly.`, instance);
|
|
8285
|
-
return false;
|
|
8371
|
+
return;
|
|
8286
8372
|
}
|
|
8287
8373
|
else {
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
value
|
|
8293
|
-
});
|
|
8374
|
+
type = 32 /* SLOTS_CHILDREN */;
|
|
8375
|
+
const slotFlag = children._;
|
|
8376
|
+
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
8377
|
+
children._ctx = currentRenderingInstance;
|
|
8294
8378
|
}
|
|
8295
|
-
else {
|
|
8296
|
-
|
|
8379
|
+
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
8380
|
+
// a child component receives forwarded slots from the parent.
|
|
8381
|
+
// its slot type is determined by its parent's slot type.
|
|
8382
|
+
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
8383
|
+
children._ = 1 /* STABLE */;
|
|
8384
|
+
}
|
|
8385
|
+
else {
|
|
8386
|
+
children._ = 2 /* DYNAMIC */;
|
|
8387
|
+
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
8388
|
+
}
|
|
8297
8389
|
}
|
|
8298
8390
|
}
|
|
8299
|
-
return true;
|
|
8300
|
-
},
|
|
8301
|
-
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
8302
|
-
let normalizedProps;
|
|
8303
|
-
return (!!accessCache[key] ||
|
|
8304
|
-
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
8305
|
-
(setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
|
8306
|
-
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
8307
|
-
hasOwn(ctx, key) ||
|
|
8308
|
-
hasOwn(publicPropertiesMap, key) ||
|
|
8309
|
-
hasOwn(appContext.config.globalProperties, key));
|
|
8310
|
-
},
|
|
8311
|
-
defineProperty(target, key, descriptor) {
|
|
8312
|
-
if (descriptor.get != null) {
|
|
8313
|
-
// invalidate key cache of a getter based property #5417
|
|
8314
|
-
target._.accessCache[key] = 0;
|
|
8315
|
-
}
|
|
8316
|
-
else if (hasOwn(descriptor, 'value')) {
|
|
8317
|
-
this.set(target, key, descriptor.value, null);
|
|
8318
|
-
}
|
|
8319
|
-
return Reflect.defineProperty(target, key, descriptor);
|
|
8320
8391
|
}
|
|
8321
|
-
|
|
8322
|
-
{
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
// fast path for unscopables when using `with` block
|
|
8332
|
-
if (key === Symbol.unscopables) {
|
|
8333
|
-
return;
|
|
8392
|
+
else if (isFunction(children)) {
|
|
8393
|
+
children = { default: children, _ctx: currentRenderingInstance };
|
|
8394
|
+
type = 32 /* SLOTS_CHILDREN */;
|
|
8395
|
+
}
|
|
8396
|
+
else {
|
|
8397
|
+
children = String(children);
|
|
8398
|
+
// force teleport children to array so it can be moved around
|
|
8399
|
+
if (shapeFlag & 64 /* TELEPORT */) {
|
|
8400
|
+
type = 16 /* ARRAY_CHILDREN */;
|
|
8401
|
+
children = [createTextVNode(children)];
|
|
8334
8402
|
}
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
has(_, key) {
|
|
8338
|
-
const has = key[0] !== '_' && !isGloballyWhitelisted(key);
|
|
8339
|
-
if (!has && PublicInstanceProxyHandlers.has(_, key)) {
|
|
8340
|
-
warn$1(`Property ${JSON.stringify(key)} should not start with _ which is a reserved prefix for Vue internals.`);
|
|
8403
|
+
else {
|
|
8404
|
+
type = 8 /* TEXT_CHILDREN */;
|
|
8341
8405
|
}
|
|
8342
|
-
return has;
|
|
8343
|
-
}
|
|
8344
|
-
});
|
|
8345
|
-
// dev only
|
|
8346
|
-
// In dev mode, the proxy target exposes the same properties as seen on `this`
|
|
8347
|
-
// for easier console inspection. In prod mode it will be an empty object so
|
|
8348
|
-
// these properties definitions can be skipped.
|
|
8349
|
-
function createDevRenderContext(instance) {
|
|
8350
|
-
const target = {};
|
|
8351
|
-
// expose internal instance for proxy handlers
|
|
8352
|
-
Object.defineProperty(target, `_`, {
|
|
8353
|
-
configurable: true,
|
|
8354
|
-
enumerable: false,
|
|
8355
|
-
get: () => instance
|
|
8356
|
-
});
|
|
8357
|
-
// expose public properties
|
|
8358
|
-
Object.keys(publicPropertiesMap).forEach(key => {
|
|
8359
|
-
Object.defineProperty(target, key, {
|
|
8360
|
-
configurable: true,
|
|
8361
|
-
enumerable: false,
|
|
8362
|
-
get: () => publicPropertiesMap[key](instance),
|
|
8363
|
-
// intercepted by the proxy so no need for implementation,
|
|
8364
|
-
// but needed to prevent set errors
|
|
8365
|
-
set: NOOP
|
|
8366
|
-
});
|
|
8367
|
-
});
|
|
8368
|
-
return target;
|
|
8369
|
-
}
|
|
8370
|
-
// dev only
|
|
8371
|
-
function exposePropsOnRenderContext(instance) {
|
|
8372
|
-
const { ctx, propsOptions: [propsOptions] } = instance;
|
|
8373
|
-
if (propsOptions) {
|
|
8374
|
-
Object.keys(propsOptions).forEach(key => {
|
|
8375
|
-
Object.defineProperty(ctx, key, {
|
|
8376
|
-
enumerable: true,
|
|
8377
|
-
configurable: true,
|
|
8378
|
-
get: () => instance.props[key],
|
|
8379
|
-
set: NOOP
|
|
8380
|
-
});
|
|
8381
|
-
});
|
|
8382
8406
|
}
|
|
8407
|
+
vnode.children = children;
|
|
8408
|
+
vnode.shapeFlag |= type;
|
|
8383
8409
|
}
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
if (key
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8410
|
+
function mergeProps(...args) {
|
|
8411
|
+
const ret = {};
|
|
8412
|
+
for (let i = 0; i < args.length; i++) {
|
|
8413
|
+
const toMerge = args[i];
|
|
8414
|
+
for (const key in toMerge) {
|
|
8415
|
+
if (key === 'class') {
|
|
8416
|
+
if (ret.class !== toMerge.class) {
|
|
8417
|
+
ret.class = normalizeClass([ret.class, toMerge.class]);
|
|
8418
|
+
}
|
|
8419
|
+
}
|
|
8420
|
+
else if (key === 'style') {
|
|
8421
|
+
ret.style = normalizeStyle([ret.style, toMerge.style]);
|
|
8422
|
+
}
|
|
8423
|
+
else if (isOn(key)) {
|
|
8424
|
+
const existing = ret[key];
|
|
8425
|
+
const incoming = toMerge[key];
|
|
8426
|
+
if (incoming &&
|
|
8427
|
+
existing !== incoming &&
|
|
8428
|
+
!(isArray(existing) && existing.includes(incoming))) {
|
|
8429
|
+
ret[key] = existing
|
|
8430
|
+
? [].concat(existing, incoming)
|
|
8431
|
+
: incoming;
|
|
8432
|
+
}
|
|
8433
|
+
}
|
|
8434
|
+
else if (key !== '') {
|
|
8435
|
+
ret[key] = toMerge[key];
|
|
8393
8436
|
}
|
|
8394
|
-
Object.defineProperty(ctx, key, {
|
|
8395
|
-
enumerable: true,
|
|
8396
|
-
configurable: true,
|
|
8397
|
-
get: () => setupState[key],
|
|
8398
|
-
set: NOOP
|
|
8399
|
-
});
|
|
8400
8437
|
}
|
|
8401
|
-
}
|
|
8438
|
+
}
|
|
8439
|
+
return ret;
|
|
8440
|
+
}
|
|
8441
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
8442
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
8443
|
+
vnode,
|
|
8444
|
+
prevVNode
|
|
8445
|
+
]);
|
|
8402
8446
|
}
|
|
8403
8447
|
|
|
8404
8448
|
const emptyAppContext = createAppContext();
|
|
@@ -8427,7 +8471,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
8427
8471
|
provides: parent ? parent.provides : Object.create(appContext.provides),
|
|
8428
8472
|
accessCache: null,
|
|
8429
8473
|
renderCache: [],
|
|
8430
|
-
// local
|
|
8474
|
+
// local resolved assets
|
|
8431
8475
|
components: null,
|
|
8432
8476
|
directives: null,
|
|
8433
8477
|
// resolved props and emits options
|
|
@@ -9188,7 +9232,7 @@ function isMemoSame(cached, memo) {
|
|
|
9188
9232
|
return false;
|
|
9189
9233
|
}
|
|
9190
9234
|
for (let i = 0; i < prev.length; i++) {
|
|
9191
|
-
if (prev[i]
|
|
9235
|
+
if (hasChanged(prev[i], memo[i])) {
|
|
9192
9236
|
return false;
|
|
9193
9237
|
}
|
|
9194
9238
|
}
|
|
@@ -9200,7 +9244,7 @@ function isMemoSame(cached, memo) {
|
|
|
9200
9244
|
}
|
|
9201
9245
|
|
|
9202
9246
|
// Core API ------------------------------------------------------------------
|
|
9203
|
-
const version = "3.2.
|
|
9247
|
+
const version = "3.2.34-beta.1";
|
|
9204
9248
|
/**
|
|
9205
9249
|
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
|
9206
9250
|
* @internal
|
|
@@ -9677,11 +9721,11 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
9677
9721
|
return key in el;
|
|
9678
9722
|
}
|
|
9679
9723
|
|
|
9680
|
-
function defineCustomElement(options,
|
|
9724
|
+
function defineCustomElement(options, hydrate) {
|
|
9681
9725
|
const Comp = defineComponent(options);
|
|
9682
9726
|
class VueCustomElement extends VueElement {
|
|
9683
9727
|
constructor(initialProps) {
|
|
9684
|
-
super(Comp, initialProps,
|
|
9728
|
+
super(Comp, initialProps, hydrate);
|
|
9685
9729
|
}
|
|
9686
9730
|
}
|
|
9687
9731
|
VueCustomElement.def = Comp;
|
|
@@ -10041,7 +10085,10 @@ function resolveTransitionProps(rawProps) {
|
|
|
10041
10085
|
removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
|
10042
10086
|
done && done();
|
|
10043
10087
|
};
|
|
10088
|
+
let isLeaving = false;
|
|
10044
10089
|
const finishLeave = (el, done) => {
|
|
10090
|
+
isLeaving = false;
|
|
10091
|
+
removeTransitionClass(el, leaveFromClass);
|
|
10045
10092
|
removeTransitionClass(el, leaveToClass);
|
|
10046
10093
|
removeTransitionClass(el, leaveActiveClass);
|
|
10047
10094
|
done && done();
|
|
@@ -10074,12 +10121,17 @@ function resolveTransitionProps(rawProps) {
|
|
|
10074
10121
|
onEnter: makeEnterHook(false),
|
|
10075
10122
|
onAppear: makeEnterHook(true),
|
|
10076
10123
|
onLeave(el, done) {
|
|
10124
|
+
isLeaving = true;
|
|
10077
10125
|
const resolve = () => finishLeave(el, done);
|
|
10078
10126
|
addTransitionClass(el, leaveFromClass);
|
|
10079
10127
|
// force reflow so *-leave-from classes immediately take effect (#2593)
|
|
10080
10128
|
forceReflow();
|
|
10081
10129
|
addTransitionClass(el, leaveActiveClass);
|
|
10082
10130
|
nextFrame(() => {
|
|
10131
|
+
if (!isLeaving) {
|
|
10132
|
+
// cancelled
|
|
10133
|
+
return;
|
|
10134
|
+
}
|
|
10083
10135
|
removeTransitionClass(el, leaveFromClass);
|
|
10084
10136
|
addTransitionClass(el, leaveToClass);
|
|
10085
10137
|
if (!hasExplicitCallback(onLeave)) {
|
|
@@ -10371,7 +10423,8 @@ function hasCSSTransform(el, root, moveClass) {
|
|
|
10371
10423
|
}
|
|
10372
10424
|
|
|
10373
10425
|
const getModelAssigner = (vnode) => {
|
|
10374
|
-
const fn = vnode.props['onUpdate:modelValue']
|
|
10426
|
+
const fn = vnode.props['onUpdate:modelValue'] ||
|
|
10427
|
+
(false );
|
|
10375
10428
|
return isArray(fn) ? value => invokeArrayFns(fn, value) : fn;
|
|
10376
10429
|
};
|
|
10377
10430
|
function onCompositionStart(e) {
|
|
@@ -10381,14 +10434,9 @@ function onCompositionEnd(e) {
|
|
|
10381
10434
|
const target = e.target;
|
|
10382
10435
|
if (target.composing) {
|
|
10383
10436
|
target.composing = false;
|
|
10384
|
-
|
|
10437
|
+
target.dispatchEvent(new Event('input'));
|
|
10385
10438
|
}
|
|
10386
10439
|
}
|
|
10387
|
-
function trigger$1(el, type) {
|
|
10388
|
-
const e = document.createEvent('HTMLEvents');
|
|
10389
|
-
e.initEvent(type, true, true);
|
|
10390
|
-
el.dispatchEvent(e);
|
|
10391
|
-
}
|
|
10392
10440
|
// We are exporting the v-model runtime directly as vnode hooks so that it can
|
|
10393
10441
|
// be tree-shaken in case v-model is never used.
|
|
10394
10442
|
const vModelText = {
|
|
@@ -10402,7 +10450,7 @@ const vModelText = {
|
|
|
10402
10450
|
if (trim) {
|
|
10403
10451
|
domValue = domValue.trim();
|
|
10404
10452
|
}
|
|
10405
|
-
|
|
10453
|
+
if (castToNumber) {
|
|
10406
10454
|
domValue = toNumber(domValue);
|
|
10407
10455
|
}
|
|
10408
10456
|
el._assign(domValue);
|
|
@@ -10431,7 +10479,7 @@ const vModelText = {
|
|
|
10431
10479
|
// avoid clearing unresolved text. #2302
|
|
10432
10480
|
if (el.composing)
|
|
10433
10481
|
return;
|
|
10434
|
-
if (document.activeElement === el) {
|
|
10482
|
+
if (document.activeElement === el && el.type !== 'range') {
|
|
10435
10483
|
if (lazy) {
|
|
10436
10484
|
return;
|
|
10437
10485
|
}
|
|
@@ -13035,6 +13083,7 @@ function createStructuralDirectiveTransform(name, fn) {
|
|
|
13035
13083
|
}
|
|
13036
13084
|
|
|
13037
13085
|
const PURE_ANNOTATION = `/*#__PURE__*/`;
|
|
13086
|
+
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
13038
13087
|
function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssrRuntimeModuleName = 'vue/server-renderer', ssr = false, isTS = false, inSSR = false }) {
|
|
13039
13088
|
const context = {
|
|
13040
13089
|
mode,
|
|
@@ -13111,9 +13160,7 @@ function generate(ast, options = {}) {
|
|
|
13111
13160
|
// function mode const declarations should be inside with block
|
|
13112
13161
|
// also they should be renamed to avoid collision with user properties
|
|
13113
13162
|
if (hasHelpers) {
|
|
13114
|
-
push(`const { ${ast.helpers
|
|
13115
|
-
.map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
|
|
13116
|
-
.join(', ')} } = _Vue`);
|
|
13163
|
+
push(`const { ${ast.helpers.map(aliasHelper).join(', ')} } = _Vue`);
|
|
13117
13164
|
push(`\n`);
|
|
13118
13165
|
newline();
|
|
13119
13166
|
}
|
|
@@ -13168,7 +13215,6 @@ function generate(ast, options = {}) {
|
|
|
13168
13215
|
function genFunctionPreamble(ast, context) {
|
|
13169
13216
|
const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName, ssrRuntimeModuleName } = context;
|
|
13170
13217
|
const VueBinding = runtimeGlobalName;
|
|
13171
|
-
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
13172
13218
|
// Generate const declaration for helpers
|
|
13173
13219
|
// In prefix mode, we place the const declaration at top so it's done
|
|
13174
13220
|
// only once; But if we not prefixing, we place the declaration inside the
|
|
@@ -13781,14 +13827,14 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
13781
13827
|
}
|
|
13782
13828
|
}
|
|
13783
13829
|
function createIfBranch(node, dir) {
|
|
13830
|
+
const isTemplateIf = node.tagType === 3 /* TEMPLATE */;
|
|
13784
13831
|
return {
|
|
13785
13832
|
type: 10 /* IF_BRANCH */,
|
|
13786
13833
|
loc: node.loc,
|
|
13787
13834
|
condition: dir.name === 'else' ? undefined : dir.exp,
|
|
13788
|
-
children:
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
userKey: findProp(node, `key`)
|
|
13835
|
+
children: isTemplateIf && !findDir(node, 'for') ? node.children : [node],
|
|
13836
|
+
userKey: findProp(node, `key`),
|
|
13837
|
+
isTemplateIf
|
|
13792
13838
|
};
|
|
13793
13839
|
}
|
|
13794
13840
|
function createCodegenNodeForBranch(branch, keyIndex, context) {
|
|
@@ -13823,7 +13869,8 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
13823
13869
|
let patchFlagText = PatchFlagNames[64 /* STABLE_FRAGMENT */];
|
|
13824
13870
|
// check if the fragment actually contains a single valid child with
|
|
13825
13871
|
// the rest being comments
|
|
13826
|
-
if (
|
|
13872
|
+
if (!branch.isTemplateIf &&
|
|
13873
|
+
children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
|
|
13827
13874
|
patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
|
|
13828
13875
|
patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
|
|
13829
13876
|
}
|
|
@@ -14761,10 +14808,11 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
14761
14808
|
classProp.value = createCallExpression(context.helper(NORMALIZE_CLASS), [classProp.value]);
|
|
14762
14809
|
}
|
|
14763
14810
|
if (styleProp &&
|
|
14764
|
-
!isStaticExp(styleProp.value) &&
|
|
14765
14811
|
// the static style is compiled into an object,
|
|
14766
14812
|
// so use `hasStyleBinding` to ensure that it is a dynamic style binding
|
|
14767
14813
|
(hasStyleBinding ||
|
|
14814
|
+
(styleProp.value.type === 4 /* SIMPLE_EXPRESSION */ &&
|
|
14815
|
+
styleProp.value.content.trim()[0] === `[`) ||
|
|
14768
14816
|
// v-bind:style and style both exist,
|
|
14769
14817
|
// v-bind:style with static literal object
|
|
14770
14818
|
styleProp.value.type === 17 /* JS_ARRAY_EXPRESSION */)) {
|
|
@@ -15114,11 +15162,7 @@ const transformText = (node, context) => {
|
|
|
15114
15162
|
const next = children[j];
|
|
15115
15163
|
if (isText(next)) {
|
|
15116
15164
|
if (!currentContainer) {
|
|
15117
|
-
currentContainer = children[i] =
|
|
15118
|
-
type: 8 /* COMPOUND_EXPRESSION */,
|
|
15119
|
-
loc: child.loc,
|
|
15120
|
-
children: [child]
|
|
15121
|
-
};
|
|
15165
|
+
currentContainer = children[i] = createCompoundExpression([child], child.loc);
|
|
15122
15166
|
}
|
|
15123
15167
|
// merge adjacent text node into current
|
|
15124
15168
|
currentContainer.children.push(` + `, next);
|
|
@@ -15525,7 +15569,9 @@ const transformVText = (dir, node, context) => {
|
|
|
15525
15569
|
return {
|
|
15526
15570
|
props: [
|
|
15527
15571
|
createObjectProperty(createSimpleExpression(`textContent`, true), exp
|
|
15528
|
-
?
|
|
15572
|
+
? getConstantType(exp, context) > 0
|
|
15573
|
+
? exp
|
|
15574
|
+
: createCallExpression(context.helperString(TO_DISPLAY_STRING), [exp], loc)
|
|
15529
15575
|
: createSimpleExpression('', true))
|
|
15530
15576
|
]
|
|
15531
15577
|
};
|
|
@@ -15733,19 +15779,38 @@ const transformShow = (dir, node, context) => {
|
|
|
15733
15779
|
};
|
|
15734
15780
|
};
|
|
15735
15781
|
|
|
15736
|
-
const
|
|
15782
|
+
const transformTransition = (node, context) => {
|
|
15737
15783
|
if (node.type === 1 /* ELEMENT */ &&
|
|
15738
15784
|
node.tagType === 1 /* COMPONENT */) {
|
|
15739
15785
|
const component = context.isBuiltInComponent(node.tag);
|
|
15740
15786
|
if (component === TRANSITION$1) {
|
|
15741
15787
|
return () => {
|
|
15742
|
-
if (node.children.length
|
|
15788
|
+
if (!node.children.length) {
|
|
15789
|
+
return;
|
|
15790
|
+
}
|
|
15791
|
+
// warn multiple transition children
|
|
15792
|
+
if (hasMultipleChildren(node)) {
|
|
15743
15793
|
context.onError(createDOMCompilerError(59 /* X_TRANSITION_INVALID_CHILDREN */, {
|
|
15744
15794
|
start: node.children[0].loc.start,
|
|
15745
15795
|
end: node.children[node.children.length - 1].loc.end,
|
|
15746
15796
|
source: ''
|
|
15747
15797
|
}));
|
|
15748
15798
|
}
|
|
15799
|
+
// check if it's s single child w/ v-show
|
|
15800
|
+
// if yes, inject "persisted: true" to the transition props
|
|
15801
|
+
const child = node.children[0];
|
|
15802
|
+
if (child.type === 1 /* ELEMENT */) {
|
|
15803
|
+
for (const p of child.props) {
|
|
15804
|
+
if (p.type === 7 /* DIRECTIVE */ && p.name === 'show') {
|
|
15805
|
+
node.props.push({
|
|
15806
|
+
type: 6 /* ATTRIBUTE */,
|
|
15807
|
+
name: 'persisted',
|
|
15808
|
+
value: undefined,
|
|
15809
|
+
loc: node.loc
|
|
15810
|
+
});
|
|
15811
|
+
}
|
|
15812
|
+
}
|
|
15813
|
+
}
|
|
15749
15814
|
};
|
|
15750
15815
|
}
|
|
15751
15816
|
}
|
|
@@ -15771,7 +15836,7 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
15771
15836
|
|
|
15772
15837
|
const DOMNodeTransforms = [
|
|
15773
15838
|
transformStyle,
|
|
15774
|
-
...([
|
|
15839
|
+
...([transformTransition] )
|
|
15775
15840
|
];
|
|
15776
15841
|
const DOMDirectiveTransforms = {
|
|
15777
15842
|
cloak: noopDirectiveTransform,
|