@vue/runtime-core 3.2.33 → 3.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime-core.cjs.js +3297 -3245
- package/dist/runtime-core.cjs.prod.js +891 -845
- package/dist/runtime-core.d.ts +31 -17
- package/dist/runtime-core.esm-bundler.js +3901 -3850
- package/package.json +3 -3
|
@@ -274,6 +274,8 @@ function flushPreFlushCbs(seen, parentJob = null) {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
function flushPostFlushCbs(seen) {
|
|
277
|
+
// flush any pre cbs queued during the flush (e.g. pre watchers)
|
|
278
|
+
flushPreFlushCbs();
|
|
277
279
|
if (pendingPostFlushCbs.length) {
|
|
278
280
|
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
279
281
|
pendingPostFlushCbs.length = 0;
|
|
@@ -349,7 +351,6 @@ function setDevtoolsHook(hook, target) {
|
|
|
349
351
|
// handle late devtools injection - only do this if we are in an actual
|
|
350
352
|
// browser environment to avoid the timer handle stalling test runner exit
|
|
351
353
|
// (#4815)
|
|
352
|
-
// eslint-disable-next-line no-restricted-globals
|
|
353
354
|
typeof window !== 'undefined' &&
|
|
354
355
|
// some envs mock window but not fully
|
|
355
356
|
window.HTMLElement &&
|
|
@@ -388,7 +389,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
388
389
|
if (trim) {
|
|
389
390
|
args = rawArgs.map(a => a.trim());
|
|
390
391
|
}
|
|
391
|
-
|
|
392
|
+
if (number) {
|
|
392
393
|
args = rawArgs.map(shared.toNumber);
|
|
393
394
|
}
|
|
394
395
|
}
|
|
@@ -616,6 +617,8 @@ function renderComponentRoot(instance) {
|
|
|
616
617
|
}
|
|
617
618
|
// inherit directives
|
|
618
619
|
if (vnode.dirs) {
|
|
620
|
+
// clone before mutating since the root may be a hoisted vnode
|
|
621
|
+
root = cloneVNode(root);
|
|
619
622
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
620
623
|
}
|
|
621
624
|
// inherit transition data
|
|
@@ -1220,7 +1223,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1220
1223
|
}
|
|
1221
1224
|
else if (shared.isArray(source)) {
|
|
1222
1225
|
isMultiSource = true;
|
|
1223
|
-
forceTrigger = source.some(reactivity.isReactive);
|
|
1226
|
+
forceTrigger = source.some(s => reactivity.isReactive(s) || reactivity.isShallow(s));
|
|
1224
1227
|
getter = () => source.map(s => {
|
|
1225
1228
|
if (reactivity.isRef(s)) {
|
|
1226
1229
|
return s.value;
|
|
@@ -1326,16 +1329,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1326
1329
|
}
|
|
1327
1330
|
else {
|
|
1328
1331
|
// default: 'pre'
|
|
1329
|
-
scheduler = () =>
|
|
1330
|
-
if (!instance || instance.isMounted) {
|
|
1331
|
-
queuePreFlushCb(job);
|
|
1332
|
-
}
|
|
1333
|
-
else {
|
|
1334
|
-
// with 'pre' option, the first call must happen before
|
|
1335
|
-
// the component is mounted so it is called synchronously.
|
|
1336
|
-
job();
|
|
1337
|
-
}
|
|
1338
|
-
};
|
|
1332
|
+
scheduler = () => queuePreFlushCb(job);
|
|
1339
1333
|
}
|
|
1340
1334
|
const effect = new reactivity.ReactiveEffect(getter, scheduler);
|
|
1341
1335
|
// initial run
|
|
@@ -1570,6 +1564,17 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
1570
1564
|
hook &&
|
|
1571
1565
|
callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
|
|
1572
1566
|
};
|
|
1567
|
+
const callAsyncHook = (hook, args) => {
|
|
1568
|
+
const done = args[1];
|
|
1569
|
+
callHook(hook, args);
|
|
1570
|
+
if (shared.isArray(hook)) {
|
|
1571
|
+
if (hook.every(hook => hook.length <= 1))
|
|
1572
|
+
done();
|
|
1573
|
+
}
|
|
1574
|
+
else if (hook.length <= 1) {
|
|
1575
|
+
done();
|
|
1576
|
+
}
|
|
1577
|
+
};
|
|
1573
1578
|
const hooks = {
|
|
1574
1579
|
mode,
|
|
1575
1580
|
persisted,
|
|
@@ -1628,10 +1633,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
1628
1633
|
el._enterCb = undefined;
|
|
1629
1634
|
});
|
|
1630
1635
|
if (hook) {
|
|
1631
|
-
hook
|
|
1632
|
-
if (hook.length <= 1) {
|
|
1633
|
-
done();
|
|
1634
|
-
}
|
|
1636
|
+
callAsyncHook(hook, [el, done]);
|
|
1635
1637
|
}
|
|
1636
1638
|
else {
|
|
1637
1639
|
done();
|
|
@@ -1665,10 +1667,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
1665
1667
|
});
|
|
1666
1668
|
leavingVNodesCache[key] = vnode;
|
|
1667
1669
|
if (onLeave) {
|
|
1668
|
-
onLeave
|
|
1669
|
-
if (onLeave.length <= 1) {
|
|
1670
|
-
done();
|
|
1671
|
-
}
|
|
1670
|
+
callAsyncHook(onLeave, [el, done]);
|
|
1672
1671
|
}
|
|
1673
1672
|
else {
|
|
1674
1673
|
done();
|
|
@@ -1871,7 +1870,7 @@ function defineAsyncComponent(source) {
|
|
|
1871
1870
|
}
|
|
1872
1871
|
});
|
|
1873
1872
|
}
|
|
1874
|
-
function createInnerComp(comp, { vnode: { ref, props, children } }) {
|
|
1873
|
+
function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
|
|
1875
1874
|
const vnode = createVNode(comp, props, children);
|
|
1876
1875
|
// ensure inner component inherits the async wrapper's ref owner
|
|
1877
1876
|
vnode.ref = ref;
|
|
@@ -1901,7 +1900,10 @@ const KeepAliveImpl = {
|
|
|
1901
1900
|
// if the internal renderer is not registered, it indicates that this is server-side rendering,
|
|
1902
1901
|
// for KeepAlive, we just need to render its children
|
|
1903
1902
|
if (!sharedContext.renderer) {
|
|
1904
|
-
return
|
|
1903
|
+
return () => {
|
|
1904
|
+
const children = slots.default && slots.default();
|
|
1905
|
+
return children && children.length === 1 ? children[0] : children;
|
|
1906
|
+
};
|
|
1905
1907
|
}
|
|
1906
1908
|
const cache = new Map();
|
|
1907
1909
|
const keys = new Set();
|
|
@@ -2066,7 +2068,7 @@ const KeepAliveImpl = {
|
|
|
2066
2068
|
// avoid vnode being unmounted
|
|
2067
2069
|
vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2068
2070
|
current = vnode;
|
|
2069
|
-
return rawVNode;
|
|
2071
|
+
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
2070
2072
|
};
|
|
2071
2073
|
}
|
|
2072
2074
|
};
|
|
@@ -2195,320 +2197,742 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
2195
2197
|
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
2196
2198
|
}
|
|
2197
2199
|
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
// assets
|
|
2218
|
-
components, directives, filters } = options;
|
|
2219
|
-
const checkDuplicateProperties = null;
|
|
2220
|
-
// options initialization order (to be consistent with Vue 2):
|
|
2221
|
-
// - props (already done outside of this function)
|
|
2222
|
-
// - inject
|
|
2223
|
-
// - methods
|
|
2224
|
-
// - data (deferred since it relies on `this` access)
|
|
2225
|
-
// - computed
|
|
2226
|
-
// - watch (deferred since it relies on `this` access)
|
|
2227
|
-
if (injectOptions) {
|
|
2228
|
-
resolveInjections(injectOptions, ctx, checkDuplicateProperties, instance.appContext.config.unwrapInjectedRef);
|
|
2200
|
+
/**
|
|
2201
|
+
Runtime helper for applying directives to a vnode. Example usage:
|
|
2202
|
+
|
|
2203
|
+
const comp = resolveComponent('comp')
|
|
2204
|
+
const foo = resolveDirective('foo')
|
|
2205
|
+
const bar = resolveDirective('bar')
|
|
2206
|
+
|
|
2207
|
+
return withDirectives(h(comp), [
|
|
2208
|
+
[foo, this.x],
|
|
2209
|
+
[bar, this.y]
|
|
2210
|
+
])
|
|
2211
|
+
*/
|
|
2212
|
+
/**
|
|
2213
|
+
* Adds directives to a VNode.
|
|
2214
|
+
*/
|
|
2215
|
+
function withDirectives(vnode, directives) {
|
|
2216
|
+
const internalInstance = currentRenderingInstance;
|
|
2217
|
+
if (internalInstance === null) {
|
|
2218
|
+
return vnode;
|
|
2229
2219
|
}
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
}
|
|
2220
|
+
const instance = getExposeProxy(internalInstance) ||
|
|
2221
|
+
internalInstance.proxy;
|
|
2222
|
+
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
2223
|
+
for (let i = 0; i < directives.length; i++) {
|
|
2224
|
+
let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
|
|
2225
|
+
if (shared.isFunction(dir)) {
|
|
2226
|
+
dir = {
|
|
2227
|
+
mounted: dir,
|
|
2228
|
+
updated: dir
|
|
2229
|
+
};
|
|
2241
2230
|
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
const data = dataOptions.call(publicThis, publicThis);
|
|
2245
|
-
if (!shared.isObject(data)) ;
|
|
2246
|
-
else {
|
|
2247
|
-
instance.data = reactivity.reactive(data);
|
|
2231
|
+
if (dir.deep) {
|
|
2232
|
+
traverse(value);
|
|
2248
2233
|
}
|
|
2234
|
+
bindings.push({
|
|
2235
|
+
dir,
|
|
2236
|
+
instance,
|
|
2237
|
+
value,
|
|
2238
|
+
oldValue: void 0,
|
|
2239
|
+
arg,
|
|
2240
|
+
modifiers
|
|
2241
|
+
});
|
|
2249
2242
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
: shared.NOOP;
|
|
2260
|
-
const set = !shared.isFunction(opt) && shared.isFunction(opt.set)
|
|
2261
|
-
? opt.set.bind(publicThis)
|
|
2262
|
-
: shared.NOOP;
|
|
2263
|
-
const c = computed({
|
|
2264
|
-
get,
|
|
2265
|
-
set
|
|
2266
|
-
});
|
|
2267
|
-
Object.defineProperty(ctx, key, {
|
|
2268
|
-
enumerable: true,
|
|
2269
|
-
configurable: true,
|
|
2270
|
-
get: () => c.value,
|
|
2271
|
-
set: v => (c.value = v)
|
|
2272
|
-
});
|
|
2243
|
+
return vnode;
|
|
2244
|
+
}
|
|
2245
|
+
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
2246
|
+
const bindings = vnode.dirs;
|
|
2247
|
+
const oldBindings = prevVNode && prevVNode.dirs;
|
|
2248
|
+
for (let i = 0; i < bindings.length; i++) {
|
|
2249
|
+
const binding = bindings[i];
|
|
2250
|
+
if (oldBindings) {
|
|
2251
|
+
binding.oldValue = oldBindings[i].value;
|
|
2273
2252
|
}
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2253
|
+
let hook = binding.dir[name];
|
|
2254
|
+
if (hook) {
|
|
2255
|
+
// disable tracking inside all lifecycle hooks
|
|
2256
|
+
// since they can potentially be called inside effects.
|
|
2257
|
+
reactivity.pauseTracking();
|
|
2258
|
+
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
2259
|
+
vnode.el,
|
|
2260
|
+
binding,
|
|
2261
|
+
vnode,
|
|
2262
|
+
prevVNode
|
|
2263
|
+
]);
|
|
2264
|
+
reactivity.resetTracking();
|
|
2278
2265
|
}
|
|
2279
2266
|
}
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
const COMPONENTS = 'components';
|
|
2270
|
+
const DIRECTIVES = 'directives';
|
|
2271
|
+
/**
|
|
2272
|
+
* @private
|
|
2273
|
+
*/
|
|
2274
|
+
function resolveComponent(name, maybeSelfReference) {
|
|
2275
|
+
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
2276
|
+
}
|
|
2277
|
+
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
2278
|
+
/**
|
|
2279
|
+
* @private
|
|
2280
|
+
*/
|
|
2281
|
+
function resolveDynamicComponent(component) {
|
|
2282
|
+
if (shared.isString(component)) {
|
|
2283
|
+
return resolveAsset(COMPONENTS, component, false) || component;
|
|
2287
2284
|
}
|
|
2288
|
-
|
|
2289
|
-
|
|
2285
|
+
else {
|
|
2286
|
+
// invalid types will fallthrough to createVNode and raise warning
|
|
2287
|
+
return (component || NULL_DYNAMIC_COMPONENT);
|
|
2290
2288
|
}
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2289
|
+
}
|
|
2290
|
+
/**
|
|
2291
|
+
* @private
|
|
2292
|
+
*/
|
|
2293
|
+
function resolveDirective(name) {
|
|
2294
|
+
return resolveAsset(DIRECTIVES, name);
|
|
2295
|
+
}
|
|
2296
|
+
// implementation
|
|
2297
|
+
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
2298
|
+
const instance = currentRenderingInstance || currentInstance;
|
|
2299
|
+
if (instance) {
|
|
2300
|
+
const Component = instance.type;
|
|
2301
|
+
// explicit self name has highest priority
|
|
2302
|
+
if (type === COMPONENTS) {
|
|
2303
|
+
const selfName = getComponentName(Component);
|
|
2304
|
+
if (selfName &&
|
|
2305
|
+
(selfName === name ||
|
|
2306
|
+
selfName === shared.camelize(name) ||
|
|
2307
|
+
selfName === shared.capitalize(shared.camelize(name)))) {
|
|
2308
|
+
return Component;
|
|
2309
|
+
}
|
|
2294
2310
|
}
|
|
2295
|
-
|
|
2296
|
-
|
|
2311
|
+
const res =
|
|
2312
|
+
// local registration
|
|
2313
|
+
// check instance[type] first which is resolved for options API
|
|
2314
|
+
resolve(instance[type] || Component[type], name) ||
|
|
2315
|
+
// global registration
|
|
2316
|
+
resolve(instance.appContext[type], name);
|
|
2317
|
+
if (!res && maybeSelfReference) {
|
|
2318
|
+
// fallback to implicit self-reference
|
|
2319
|
+
return Component;
|
|
2297
2320
|
}
|
|
2321
|
+
return res;
|
|
2298
2322
|
}
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
set: val => (publicThis[key] = val)
|
|
2318
|
-
});
|
|
2319
|
-
});
|
|
2320
|
-
}
|
|
2321
|
-
else if (!instance.exposed) {
|
|
2322
|
-
instance.exposed = {};
|
|
2323
|
+
}
|
|
2324
|
+
function resolve(registry, name) {
|
|
2325
|
+
return (registry &&
|
|
2326
|
+
(registry[name] ||
|
|
2327
|
+
registry[shared.camelize(name)] ||
|
|
2328
|
+
registry[shared.capitalize(shared.camelize(name))]));
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
/**
|
|
2332
|
+
* Actual implementation
|
|
2333
|
+
*/
|
|
2334
|
+
function renderList(source, renderItem, cache, index) {
|
|
2335
|
+
let ret;
|
|
2336
|
+
const cached = (cache && cache[index]);
|
|
2337
|
+
if (shared.isArray(source) || shared.isString(source)) {
|
|
2338
|
+
ret = new Array(source.length);
|
|
2339
|
+
for (let i = 0, l = source.length; i < l; i++) {
|
|
2340
|
+
ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
|
|
2323
2341
|
}
|
|
2324
2342
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
if (inheritAttrs != null) {
|
|
2331
|
-
instance.inheritAttrs = inheritAttrs;
|
|
2332
|
-
}
|
|
2333
|
-
// asset options.
|
|
2334
|
-
if (components)
|
|
2335
|
-
instance.components = components;
|
|
2336
|
-
if (directives)
|
|
2337
|
-
instance.directives = directives;
|
|
2338
|
-
}
|
|
2339
|
-
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP, unwrapRef = false) {
|
|
2340
|
-
if (shared.isArray(injectOptions)) {
|
|
2341
|
-
injectOptions = normalizeInject(injectOptions);
|
|
2343
|
+
else if (typeof source === 'number') {
|
|
2344
|
+
ret = new Array(source);
|
|
2345
|
+
for (let i = 0; i < source; i++) {
|
|
2346
|
+
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
2347
|
+
}
|
|
2342
2348
|
}
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
if (shared.isObject(opt)) {
|
|
2347
|
-
if ('default' in opt) {
|
|
2348
|
-
injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
|
|
2349
|
-
}
|
|
2350
|
-
else {
|
|
2351
|
-
injected = inject(opt.from || key);
|
|
2352
|
-
}
|
|
2349
|
+
else if (shared.isObject(source)) {
|
|
2350
|
+
if (source[Symbol.iterator]) {
|
|
2351
|
+
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
2353
2352
|
}
|
|
2354
2353
|
else {
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
Object.defineProperty(ctx, key, {
|
|
2361
|
-
enumerable: true,
|
|
2362
|
-
configurable: true,
|
|
2363
|
-
get: () => injected.value,
|
|
2364
|
-
set: v => (injected.value = v)
|
|
2365
|
-
});
|
|
2366
|
-
}
|
|
2367
|
-
else {
|
|
2368
|
-
ctx[key] = injected;
|
|
2354
|
+
const keys = Object.keys(source);
|
|
2355
|
+
ret = new Array(keys.length);
|
|
2356
|
+
for (let i = 0, l = keys.length; i < l; i++) {
|
|
2357
|
+
const key = keys[i];
|
|
2358
|
+
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
2369
2359
|
}
|
|
2370
2360
|
}
|
|
2371
|
-
else {
|
|
2372
|
-
ctx[key] = injected;
|
|
2373
|
-
}
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
function callHook(hook, instance, type) {
|
|
2377
|
-
callWithAsyncErrorHandling(shared.isArray(hook)
|
|
2378
|
-
? hook.map(h => h.bind(instance.proxy))
|
|
2379
|
-
: hook.bind(instance.proxy), instance, type);
|
|
2380
|
-
}
|
|
2381
|
-
function createWatcher(raw, ctx, publicThis, key) {
|
|
2382
|
-
const getter = key.includes('.')
|
|
2383
|
-
? createPathGetter(publicThis, key)
|
|
2384
|
-
: () => publicThis[key];
|
|
2385
|
-
if (shared.isString(raw)) {
|
|
2386
|
-
const handler = ctx[raw];
|
|
2387
|
-
if (shared.isFunction(handler)) {
|
|
2388
|
-
watch(getter, handler);
|
|
2389
|
-
}
|
|
2390
2361
|
}
|
|
2391
|
-
else
|
|
2392
|
-
|
|
2362
|
+
else {
|
|
2363
|
+
ret = [];
|
|
2393
2364
|
}
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
raw.forEach(r => createWatcher(r, ctx, publicThis, key));
|
|
2397
|
-
}
|
|
2398
|
-
else {
|
|
2399
|
-
const handler = shared.isFunction(raw.handler)
|
|
2400
|
-
? raw.handler.bind(publicThis)
|
|
2401
|
-
: ctx[raw.handler];
|
|
2402
|
-
if (shared.isFunction(handler)) {
|
|
2403
|
-
watch(getter, handler, raw);
|
|
2404
|
-
}
|
|
2405
|
-
}
|
|
2365
|
+
if (cache) {
|
|
2366
|
+
cache[index] = ret;
|
|
2406
2367
|
}
|
|
2407
|
-
|
|
2408
|
-
}
|
|
2368
|
+
return ret;
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2409
2371
|
/**
|
|
2410
|
-
*
|
|
2411
|
-
*
|
|
2412
|
-
* instances.
|
|
2372
|
+
* Compiler runtime helper for creating dynamic slots object
|
|
2373
|
+
* @private
|
|
2413
2374
|
*/
|
|
2414
|
-
function
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
}
|
|
2423
|
-
else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
2424
|
-
{
|
|
2425
|
-
resolved = base;
|
|
2375
|
+
function createSlots(slots, dynamicSlots) {
|
|
2376
|
+
for (let i = 0; i < dynamicSlots.length; i++) {
|
|
2377
|
+
const slot = dynamicSlots[i];
|
|
2378
|
+
// array of dynamic slot generated by <template v-for="..." #[...]>
|
|
2379
|
+
if (shared.isArray(slot)) {
|
|
2380
|
+
for (let j = 0; j < slot.length; j++) {
|
|
2381
|
+
slots[slot[j].name] = slot[j].fn;
|
|
2382
|
+
}
|
|
2426
2383
|
}
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
if (globalMixins.length) {
|
|
2431
|
-
globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
2384
|
+
else if (slot) {
|
|
2385
|
+
// conditional single slot generated by <template v-if="..." #foo>
|
|
2386
|
+
slots[slot.name] = slot.fn;
|
|
2432
2387
|
}
|
|
2433
|
-
mergeOptions(resolved, base, optionMergeStrategies);
|
|
2434
|
-
}
|
|
2435
|
-
cache.set(base, resolved);
|
|
2436
|
-
return resolved;
|
|
2437
|
-
}
|
|
2438
|
-
function mergeOptions(to, from, strats, asMixin = false) {
|
|
2439
|
-
const { mixins, extends: extendsOptions } = from;
|
|
2440
|
-
if (extendsOptions) {
|
|
2441
|
-
mergeOptions(to, extendsOptions, strats, true);
|
|
2442
2388
|
}
|
|
2443
|
-
|
|
2444
|
-
|
|
2389
|
+
return slots;
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
/**
|
|
2393
|
+
* Compiler runtime helper for rendering `<slot/>`
|
|
2394
|
+
* @private
|
|
2395
|
+
*/
|
|
2396
|
+
function renderSlot(slots, name, props = {},
|
|
2397
|
+
// this is not a user-facing function, so the fallback is always generated by
|
|
2398
|
+
// the compiler and guaranteed to be a function returning an array
|
|
2399
|
+
fallback, noSlotted) {
|
|
2400
|
+
if (currentRenderingInstance.isCE ||
|
|
2401
|
+
(currentRenderingInstance.parent &&
|
|
2402
|
+
isAsyncWrapper(currentRenderingInstance.parent) &&
|
|
2403
|
+
currentRenderingInstance.parent.isCE)) {
|
|
2404
|
+
return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
|
|
2445
2405
|
}
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2406
|
+
let slot = slots[name];
|
|
2407
|
+
// a compiled slot disables block tracking by default to avoid manual
|
|
2408
|
+
// invocation interfering with template-based block tracking, but in
|
|
2409
|
+
// `renderSlot` we can be sure that it's template-based so we can force
|
|
2410
|
+
// enable it.
|
|
2411
|
+
if (slot && slot._c) {
|
|
2412
|
+
slot._d = false;
|
|
2452
2413
|
}
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
const
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
methods: mergeObjectOptions,
|
|
2461
|
-
computed: mergeObjectOptions,
|
|
2462
|
-
// lifecycle
|
|
2463
|
-
beforeCreate: mergeAsArray,
|
|
2464
|
-
created: mergeAsArray,
|
|
2465
|
-
beforeMount: mergeAsArray,
|
|
2466
|
-
mounted: mergeAsArray,
|
|
2467
|
-
beforeUpdate: mergeAsArray,
|
|
2468
|
-
updated: mergeAsArray,
|
|
2469
|
-
beforeDestroy: mergeAsArray,
|
|
2470
|
-
beforeUnmount: mergeAsArray,
|
|
2471
|
-
destroyed: mergeAsArray,
|
|
2472
|
-
unmounted: mergeAsArray,
|
|
2473
|
-
activated: mergeAsArray,
|
|
2474
|
-
deactivated: mergeAsArray,
|
|
2475
|
-
errorCaptured: mergeAsArray,
|
|
2476
|
-
serverPrefetch: mergeAsArray,
|
|
2477
|
-
// assets
|
|
2478
|
-
components: mergeObjectOptions,
|
|
2479
|
-
directives: mergeObjectOptions,
|
|
2480
|
-
// watch
|
|
2481
|
-
watch: mergeWatchOptions,
|
|
2482
|
-
// provide / inject
|
|
2483
|
-
provide: mergeDataFn,
|
|
2484
|
-
inject: mergeInject
|
|
2485
|
-
};
|
|
2486
|
-
function mergeDataFn(to, from) {
|
|
2487
|
-
if (!from) {
|
|
2488
|
-
return to;
|
|
2414
|
+
openBlock();
|
|
2415
|
+
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
2416
|
+
const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
|
|
2417
|
+
? 64 /* STABLE_FRAGMENT */
|
|
2418
|
+
: -2 /* BAIL */);
|
|
2419
|
+
if (!noSlotted && rendered.scopeId) {
|
|
2420
|
+
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
2489
2421
|
}
|
|
2490
|
-
if (
|
|
2491
|
-
|
|
2422
|
+
if (slot && slot._c) {
|
|
2423
|
+
slot._d = true;
|
|
2492
2424
|
}
|
|
2493
|
-
return
|
|
2494
|
-
return (shared.extend)(shared.isFunction(to) ? to.call(this, this) : to, shared.isFunction(from) ? from.call(this, this) : from);
|
|
2495
|
-
};
|
|
2496
|
-
}
|
|
2497
|
-
function mergeInject(to, from) {
|
|
2498
|
-
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
2425
|
+
return rendered;
|
|
2499
2426
|
}
|
|
2500
|
-
function
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2427
|
+
function ensureValidVNode(vnodes) {
|
|
2428
|
+
return vnodes.some(child => {
|
|
2429
|
+
if (!isVNode(child))
|
|
2430
|
+
return true;
|
|
2431
|
+
if (child.type === Comment)
|
|
2432
|
+
return false;
|
|
2433
|
+
if (child.type === Fragment &&
|
|
2434
|
+
!ensureValidVNode(child.children))
|
|
2435
|
+
return false;
|
|
2436
|
+
return true;
|
|
2437
|
+
})
|
|
2438
|
+
? vnodes
|
|
2439
|
+
: null;
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
/**
|
|
2443
|
+
* For prefixing keys in v-on="obj" with "on"
|
|
2444
|
+
* @private
|
|
2445
|
+
*/
|
|
2446
|
+
function toHandlers(obj) {
|
|
2447
|
+
const ret = {};
|
|
2448
|
+
for (const key in obj) {
|
|
2449
|
+
ret[shared.toHandlerKey(key)] = obj[key];
|
|
2507
2450
|
}
|
|
2508
|
-
return
|
|
2509
|
-
}
|
|
2510
|
-
|
|
2511
|
-
|
|
2451
|
+
return ret;
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
/**
|
|
2455
|
+
* #2437 In Vue 3, functional components do not have a public instance proxy but
|
|
2456
|
+
* they exist in the internal parent chain. For code that relies on traversing
|
|
2457
|
+
* public $parent chains, skip functional ones and go to the parent instead.
|
|
2458
|
+
*/
|
|
2459
|
+
const getPublicInstance = (i) => {
|
|
2460
|
+
if (!i)
|
|
2461
|
+
return null;
|
|
2462
|
+
if (isStatefulComponent(i))
|
|
2463
|
+
return getExposeProxy(i) || i.proxy;
|
|
2464
|
+
return getPublicInstance(i.parent);
|
|
2465
|
+
};
|
|
2466
|
+
const publicPropertiesMap =
|
|
2467
|
+
// Move PURE marker to new line to workaround compiler discarding it
|
|
2468
|
+
// due to type annotation
|
|
2469
|
+
/*#__PURE__*/ shared.extend(Object.create(null), {
|
|
2470
|
+
$: i => i,
|
|
2471
|
+
$el: i => i.vnode.el,
|
|
2472
|
+
$data: i => i.data,
|
|
2473
|
+
$props: i => (i.props),
|
|
2474
|
+
$attrs: i => (i.attrs),
|
|
2475
|
+
$slots: i => (i.slots),
|
|
2476
|
+
$refs: i => (i.refs),
|
|
2477
|
+
$parent: i => getPublicInstance(i.parent),
|
|
2478
|
+
$root: i => getPublicInstance(i.root),
|
|
2479
|
+
$emit: i => i.emit,
|
|
2480
|
+
$options: i => (resolveMergedOptions(i) ),
|
|
2481
|
+
$forceUpdate: i => i.f || (i.f = () => queueJob(i.update)),
|
|
2482
|
+
$nextTick: i => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
2483
|
+
$watch: i => (instanceWatch.bind(i) )
|
|
2484
|
+
});
|
|
2485
|
+
const PublicInstanceProxyHandlers = {
|
|
2486
|
+
get({ _: instance }, key) {
|
|
2487
|
+
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
|
2488
|
+
// data / props / ctx
|
|
2489
|
+
// This getter gets called for every property access on the render context
|
|
2490
|
+
// during render and is a major hotspot. The most expensive part of this
|
|
2491
|
+
// is the multiple hasOwn() calls. It's much faster to do a simple property
|
|
2492
|
+
// access on a plain object, so we use an accessCache object (with null
|
|
2493
|
+
// prototype) to memoize what access type a key corresponds to.
|
|
2494
|
+
let normalizedProps;
|
|
2495
|
+
if (key[0] !== '$') {
|
|
2496
|
+
const n = accessCache[key];
|
|
2497
|
+
if (n !== undefined) {
|
|
2498
|
+
switch (n) {
|
|
2499
|
+
case 1 /* SETUP */:
|
|
2500
|
+
return setupState[key];
|
|
2501
|
+
case 2 /* DATA */:
|
|
2502
|
+
return data[key];
|
|
2503
|
+
case 4 /* CONTEXT */:
|
|
2504
|
+
return ctx[key];
|
|
2505
|
+
case 3 /* PROPS */:
|
|
2506
|
+
return props[key];
|
|
2507
|
+
// default: just fallthrough
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
|
|
2511
|
+
accessCache[key] = 1 /* SETUP */;
|
|
2512
|
+
return setupState[key];
|
|
2513
|
+
}
|
|
2514
|
+
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
2515
|
+
accessCache[key] = 2 /* DATA */;
|
|
2516
|
+
return data[key];
|
|
2517
|
+
}
|
|
2518
|
+
else if (
|
|
2519
|
+
// only cache other properties when instance has declared (thus stable)
|
|
2520
|
+
// props
|
|
2521
|
+
(normalizedProps = instance.propsOptions[0]) &&
|
|
2522
|
+
shared.hasOwn(normalizedProps, key)) {
|
|
2523
|
+
accessCache[key] = 3 /* PROPS */;
|
|
2524
|
+
return props[key];
|
|
2525
|
+
}
|
|
2526
|
+
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
2527
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
2528
|
+
return ctx[key];
|
|
2529
|
+
}
|
|
2530
|
+
else if (shouldCacheAccess) {
|
|
2531
|
+
accessCache[key] = 0 /* OTHER */;
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
const publicGetter = publicPropertiesMap[key];
|
|
2535
|
+
let cssModule, globalProperties;
|
|
2536
|
+
// public $xxx properties
|
|
2537
|
+
if (publicGetter) {
|
|
2538
|
+
if (key === '$attrs') {
|
|
2539
|
+
reactivity.track(instance, "get" /* GET */, key);
|
|
2540
|
+
}
|
|
2541
|
+
return publicGetter(instance);
|
|
2542
|
+
}
|
|
2543
|
+
else if (
|
|
2544
|
+
// css module (injected by vue-loader)
|
|
2545
|
+
(cssModule = type.__cssModules) &&
|
|
2546
|
+
(cssModule = cssModule[key])) {
|
|
2547
|
+
return cssModule;
|
|
2548
|
+
}
|
|
2549
|
+
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
2550
|
+
// user may set custom properties to `this` that start with `$`
|
|
2551
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
2552
|
+
return ctx[key];
|
|
2553
|
+
}
|
|
2554
|
+
else if (
|
|
2555
|
+
// global properties
|
|
2556
|
+
((globalProperties = appContext.config.globalProperties),
|
|
2557
|
+
shared.hasOwn(globalProperties, key))) {
|
|
2558
|
+
{
|
|
2559
|
+
return globalProperties[key];
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2562
|
+
else ;
|
|
2563
|
+
},
|
|
2564
|
+
set({ _: instance }, key, value) {
|
|
2565
|
+
const { data, setupState, ctx } = instance;
|
|
2566
|
+
if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
|
|
2567
|
+
setupState[key] = value;
|
|
2568
|
+
return true;
|
|
2569
|
+
}
|
|
2570
|
+
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
2571
|
+
data[key] = value;
|
|
2572
|
+
return true;
|
|
2573
|
+
}
|
|
2574
|
+
else if (shared.hasOwn(instance.props, key)) {
|
|
2575
|
+
return false;
|
|
2576
|
+
}
|
|
2577
|
+
if (key[0] === '$' && key.slice(1) in instance) {
|
|
2578
|
+
return false;
|
|
2579
|
+
}
|
|
2580
|
+
else {
|
|
2581
|
+
{
|
|
2582
|
+
ctx[key] = value;
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
return true;
|
|
2586
|
+
},
|
|
2587
|
+
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
2588
|
+
let normalizedProps;
|
|
2589
|
+
return (!!accessCache[key] ||
|
|
2590
|
+
(data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
|
|
2591
|
+
(setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
|
|
2592
|
+
((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
|
|
2593
|
+
shared.hasOwn(ctx, key) ||
|
|
2594
|
+
shared.hasOwn(publicPropertiesMap, key) ||
|
|
2595
|
+
shared.hasOwn(appContext.config.globalProperties, key));
|
|
2596
|
+
},
|
|
2597
|
+
defineProperty(target, key, descriptor) {
|
|
2598
|
+
if (descriptor.get != null) {
|
|
2599
|
+
// invalidate key cache of a getter based property #5417
|
|
2600
|
+
target._.accessCache[key] = 0;
|
|
2601
|
+
}
|
|
2602
|
+
else if (shared.hasOwn(descriptor, 'value')) {
|
|
2603
|
+
this.set(target, key, descriptor.value, null);
|
|
2604
|
+
}
|
|
2605
|
+
return Reflect.defineProperty(target, key, descriptor);
|
|
2606
|
+
}
|
|
2607
|
+
};
|
|
2608
|
+
const RuntimeCompiledPublicInstanceProxyHandlers = /*#__PURE__*/ shared.extend({}, PublicInstanceProxyHandlers, {
|
|
2609
|
+
get(target, key) {
|
|
2610
|
+
// fast path for unscopables when using `with` block
|
|
2611
|
+
if (key === Symbol.unscopables) {
|
|
2612
|
+
return;
|
|
2613
|
+
}
|
|
2614
|
+
return PublicInstanceProxyHandlers.get(target, key, target);
|
|
2615
|
+
},
|
|
2616
|
+
has(_, key) {
|
|
2617
|
+
const has = key[0] !== '_' && !shared.isGloballyWhitelisted(key);
|
|
2618
|
+
return has;
|
|
2619
|
+
}
|
|
2620
|
+
});
|
|
2621
|
+
|
|
2622
|
+
let shouldCacheAccess = true;
|
|
2623
|
+
function applyOptions(instance) {
|
|
2624
|
+
const options = resolveMergedOptions(instance);
|
|
2625
|
+
const publicThis = instance.proxy;
|
|
2626
|
+
const ctx = instance.ctx;
|
|
2627
|
+
// do not cache property access on public proxy during state initialization
|
|
2628
|
+
shouldCacheAccess = false;
|
|
2629
|
+
// call beforeCreate first before accessing other options since
|
|
2630
|
+
// the hook may mutate resolved options (#2791)
|
|
2631
|
+
if (options.beforeCreate) {
|
|
2632
|
+
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
2633
|
+
}
|
|
2634
|
+
const {
|
|
2635
|
+
// state
|
|
2636
|
+
data: dataOptions, computed: computedOptions, methods, watch: watchOptions, provide: provideOptions, inject: injectOptions,
|
|
2637
|
+
// lifecycle
|
|
2638
|
+
created, beforeMount, mounted, beforeUpdate, updated, activated, deactivated, beforeDestroy, beforeUnmount, destroyed, unmounted, render, renderTracked, renderTriggered, errorCaptured, serverPrefetch,
|
|
2639
|
+
// public API
|
|
2640
|
+
expose, inheritAttrs,
|
|
2641
|
+
// assets
|
|
2642
|
+
components, directives, filters } = options;
|
|
2643
|
+
const checkDuplicateProperties = null;
|
|
2644
|
+
// options initialization order (to be consistent with Vue 2):
|
|
2645
|
+
// - props (already done outside of this function)
|
|
2646
|
+
// - inject
|
|
2647
|
+
// - methods
|
|
2648
|
+
// - data (deferred since it relies on `this` access)
|
|
2649
|
+
// - computed
|
|
2650
|
+
// - watch (deferred since it relies on `this` access)
|
|
2651
|
+
if (injectOptions) {
|
|
2652
|
+
resolveInjections(injectOptions, ctx, checkDuplicateProperties, instance.appContext.config.unwrapInjectedRef);
|
|
2653
|
+
}
|
|
2654
|
+
if (methods) {
|
|
2655
|
+
for (const key in methods) {
|
|
2656
|
+
const methodHandler = methods[key];
|
|
2657
|
+
if (shared.isFunction(methodHandler)) {
|
|
2658
|
+
// In dev mode, we use the `createRenderContext` function to define
|
|
2659
|
+
// methods to the proxy target, and those are read-only but
|
|
2660
|
+
// reconfigurable, so it needs to be redefined here
|
|
2661
|
+
{
|
|
2662
|
+
ctx[key] = methodHandler.bind(publicThis);
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
if (dataOptions) {
|
|
2668
|
+
const data = dataOptions.call(publicThis, publicThis);
|
|
2669
|
+
if (!shared.isObject(data)) ;
|
|
2670
|
+
else {
|
|
2671
|
+
instance.data = reactivity.reactive(data);
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
// state initialization complete at this point - start caching access
|
|
2675
|
+
shouldCacheAccess = true;
|
|
2676
|
+
if (computedOptions) {
|
|
2677
|
+
for (const key in computedOptions) {
|
|
2678
|
+
const opt = computedOptions[key];
|
|
2679
|
+
const get = shared.isFunction(opt)
|
|
2680
|
+
? opt.bind(publicThis, publicThis)
|
|
2681
|
+
: shared.isFunction(opt.get)
|
|
2682
|
+
? opt.get.bind(publicThis, publicThis)
|
|
2683
|
+
: shared.NOOP;
|
|
2684
|
+
const set = !shared.isFunction(opt) && shared.isFunction(opt.set)
|
|
2685
|
+
? opt.set.bind(publicThis)
|
|
2686
|
+
: shared.NOOP;
|
|
2687
|
+
const c = computed({
|
|
2688
|
+
get,
|
|
2689
|
+
set
|
|
2690
|
+
});
|
|
2691
|
+
Object.defineProperty(ctx, key, {
|
|
2692
|
+
enumerable: true,
|
|
2693
|
+
configurable: true,
|
|
2694
|
+
get: () => c.value,
|
|
2695
|
+
set: v => (c.value = v)
|
|
2696
|
+
});
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
if (watchOptions) {
|
|
2700
|
+
for (const key in watchOptions) {
|
|
2701
|
+
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
if (provideOptions) {
|
|
2705
|
+
const provides = shared.isFunction(provideOptions)
|
|
2706
|
+
? provideOptions.call(publicThis)
|
|
2707
|
+
: provideOptions;
|
|
2708
|
+
Reflect.ownKeys(provides).forEach(key => {
|
|
2709
|
+
provide(key, provides[key]);
|
|
2710
|
+
});
|
|
2711
|
+
}
|
|
2712
|
+
if (created) {
|
|
2713
|
+
callHook(created, instance, "c" /* CREATED */);
|
|
2714
|
+
}
|
|
2715
|
+
function registerLifecycleHook(register, hook) {
|
|
2716
|
+
if (shared.isArray(hook)) {
|
|
2717
|
+
hook.forEach(_hook => register(_hook.bind(publicThis)));
|
|
2718
|
+
}
|
|
2719
|
+
else if (hook) {
|
|
2720
|
+
register(hook.bind(publicThis));
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
registerLifecycleHook(onBeforeMount, beforeMount);
|
|
2724
|
+
registerLifecycleHook(onMounted, mounted);
|
|
2725
|
+
registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
|
2726
|
+
registerLifecycleHook(onUpdated, updated);
|
|
2727
|
+
registerLifecycleHook(onActivated, activated);
|
|
2728
|
+
registerLifecycleHook(onDeactivated, deactivated);
|
|
2729
|
+
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
|
2730
|
+
registerLifecycleHook(onRenderTracked, renderTracked);
|
|
2731
|
+
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
|
2732
|
+
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
|
2733
|
+
registerLifecycleHook(onUnmounted, unmounted);
|
|
2734
|
+
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
2735
|
+
if (shared.isArray(expose)) {
|
|
2736
|
+
if (expose.length) {
|
|
2737
|
+
const exposed = instance.exposed || (instance.exposed = {});
|
|
2738
|
+
expose.forEach(key => {
|
|
2739
|
+
Object.defineProperty(exposed, key, {
|
|
2740
|
+
get: () => publicThis[key],
|
|
2741
|
+
set: val => (publicThis[key] = val)
|
|
2742
|
+
});
|
|
2743
|
+
});
|
|
2744
|
+
}
|
|
2745
|
+
else if (!instance.exposed) {
|
|
2746
|
+
instance.exposed = {};
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
// options that are handled when creating the instance but also need to be
|
|
2750
|
+
// applied from mixins
|
|
2751
|
+
if (render && instance.render === shared.NOOP) {
|
|
2752
|
+
instance.render = render;
|
|
2753
|
+
}
|
|
2754
|
+
if (inheritAttrs != null) {
|
|
2755
|
+
instance.inheritAttrs = inheritAttrs;
|
|
2756
|
+
}
|
|
2757
|
+
// asset options.
|
|
2758
|
+
if (components)
|
|
2759
|
+
instance.components = components;
|
|
2760
|
+
if (directives)
|
|
2761
|
+
instance.directives = directives;
|
|
2762
|
+
}
|
|
2763
|
+
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP, unwrapRef = false) {
|
|
2764
|
+
if (shared.isArray(injectOptions)) {
|
|
2765
|
+
injectOptions = normalizeInject(injectOptions);
|
|
2766
|
+
}
|
|
2767
|
+
for (const key in injectOptions) {
|
|
2768
|
+
const opt = injectOptions[key];
|
|
2769
|
+
let injected;
|
|
2770
|
+
if (shared.isObject(opt)) {
|
|
2771
|
+
if ('default' in opt) {
|
|
2772
|
+
injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
|
|
2773
|
+
}
|
|
2774
|
+
else {
|
|
2775
|
+
injected = inject(opt.from || key);
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
else {
|
|
2779
|
+
injected = inject(opt);
|
|
2780
|
+
}
|
|
2781
|
+
if (reactivity.isRef(injected)) {
|
|
2782
|
+
// TODO remove the check in 3.3
|
|
2783
|
+
if (unwrapRef) {
|
|
2784
|
+
Object.defineProperty(ctx, key, {
|
|
2785
|
+
enumerable: true,
|
|
2786
|
+
configurable: true,
|
|
2787
|
+
get: () => injected.value,
|
|
2788
|
+
set: v => (injected.value = v)
|
|
2789
|
+
});
|
|
2790
|
+
}
|
|
2791
|
+
else {
|
|
2792
|
+
ctx[key] = injected;
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
else {
|
|
2796
|
+
ctx[key] = injected;
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
function callHook(hook, instance, type) {
|
|
2801
|
+
callWithAsyncErrorHandling(shared.isArray(hook)
|
|
2802
|
+
? hook.map(h => h.bind(instance.proxy))
|
|
2803
|
+
: hook.bind(instance.proxy), instance, type);
|
|
2804
|
+
}
|
|
2805
|
+
function createWatcher(raw, ctx, publicThis, key) {
|
|
2806
|
+
const getter = key.includes('.')
|
|
2807
|
+
? createPathGetter(publicThis, key)
|
|
2808
|
+
: () => publicThis[key];
|
|
2809
|
+
if (shared.isString(raw)) {
|
|
2810
|
+
const handler = ctx[raw];
|
|
2811
|
+
if (shared.isFunction(handler)) {
|
|
2812
|
+
watch(getter, handler);
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
else if (shared.isFunction(raw)) {
|
|
2816
|
+
watch(getter, raw.bind(publicThis));
|
|
2817
|
+
}
|
|
2818
|
+
else if (shared.isObject(raw)) {
|
|
2819
|
+
if (shared.isArray(raw)) {
|
|
2820
|
+
raw.forEach(r => createWatcher(r, ctx, publicThis, key));
|
|
2821
|
+
}
|
|
2822
|
+
else {
|
|
2823
|
+
const handler = shared.isFunction(raw.handler)
|
|
2824
|
+
? raw.handler.bind(publicThis)
|
|
2825
|
+
: ctx[raw.handler];
|
|
2826
|
+
if (shared.isFunction(handler)) {
|
|
2827
|
+
watch(getter, handler, raw);
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
else ;
|
|
2832
|
+
}
|
|
2833
|
+
/**
|
|
2834
|
+
* Resolve merged options and cache it on the component.
|
|
2835
|
+
* This is done only once per-component since the merging does not involve
|
|
2836
|
+
* instances.
|
|
2837
|
+
*/
|
|
2838
|
+
function resolveMergedOptions(instance) {
|
|
2839
|
+
const base = instance.type;
|
|
2840
|
+
const { mixins, extends: extendsOptions } = base;
|
|
2841
|
+
const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;
|
|
2842
|
+
const cached = cache.get(base);
|
|
2843
|
+
let resolved;
|
|
2844
|
+
if (cached) {
|
|
2845
|
+
resolved = cached;
|
|
2846
|
+
}
|
|
2847
|
+
else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
2848
|
+
{
|
|
2849
|
+
resolved = base;
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
else {
|
|
2853
|
+
resolved = {};
|
|
2854
|
+
if (globalMixins.length) {
|
|
2855
|
+
globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
2856
|
+
}
|
|
2857
|
+
mergeOptions(resolved, base, optionMergeStrategies);
|
|
2858
|
+
}
|
|
2859
|
+
cache.set(base, resolved);
|
|
2860
|
+
return resolved;
|
|
2861
|
+
}
|
|
2862
|
+
function mergeOptions(to, from, strats, asMixin = false) {
|
|
2863
|
+
const { mixins, extends: extendsOptions } = from;
|
|
2864
|
+
if (extendsOptions) {
|
|
2865
|
+
mergeOptions(to, extendsOptions, strats, true);
|
|
2866
|
+
}
|
|
2867
|
+
if (mixins) {
|
|
2868
|
+
mixins.forEach((m) => mergeOptions(to, m, strats, true));
|
|
2869
|
+
}
|
|
2870
|
+
for (const key in from) {
|
|
2871
|
+
if (asMixin && key === 'expose') ;
|
|
2872
|
+
else {
|
|
2873
|
+
const strat = internalOptionMergeStrats[key] || (strats && strats[key]);
|
|
2874
|
+
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
2875
|
+
}
|
|
2876
|
+
}
|
|
2877
|
+
return to;
|
|
2878
|
+
}
|
|
2879
|
+
const internalOptionMergeStrats = {
|
|
2880
|
+
data: mergeDataFn,
|
|
2881
|
+
props: mergeObjectOptions,
|
|
2882
|
+
emits: mergeObjectOptions,
|
|
2883
|
+
// objects
|
|
2884
|
+
methods: mergeObjectOptions,
|
|
2885
|
+
computed: mergeObjectOptions,
|
|
2886
|
+
// lifecycle
|
|
2887
|
+
beforeCreate: mergeAsArray,
|
|
2888
|
+
created: mergeAsArray,
|
|
2889
|
+
beforeMount: mergeAsArray,
|
|
2890
|
+
mounted: mergeAsArray,
|
|
2891
|
+
beforeUpdate: mergeAsArray,
|
|
2892
|
+
updated: mergeAsArray,
|
|
2893
|
+
beforeDestroy: mergeAsArray,
|
|
2894
|
+
beforeUnmount: mergeAsArray,
|
|
2895
|
+
destroyed: mergeAsArray,
|
|
2896
|
+
unmounted: mergeAsArray,
|
|
2897
|
+
activated: mergeAsArray,
|
|
2898
|
+
deactivated: mergeAsArray,
|
|
2899
|
+
errorCaptured: mergeAsArray,
|
|
2900
|
+
serverPrefetch: mergeAsArray,
|
|
2901
|
+
// assets
|
|
2902
|
+
components: mergeObjectOptions,
|
|
2903
|
+
directives: mergeObjectOptions,
|
|
2904
|
+
// watch
|
|
2905
|
+
watch: mergeWatchOptions,
|
|
2906
|
+
// provide / inject
|
|
2907
|
+
provide: mergeDataFn,
|
|
2908
|
+
inject: mergeInject
|
|
2909
|
+
};
|
|
2910
|
+
function mergeDataFn(to, from) {
|
|
2911
|
+
if (!from) {
|
|
2912
|
+
return to;
|
|
2913
|
+
}
|
|
2914
|
+
if (!to) {
|
|
2915
|
+
return from;
|
|
2916
|
+
}
|
|
2917
|
+
return function mergedDataFn() {
|
|
2918
|
+
return (shared.extend)(shared.isFunction(to) ? to.call(this, this) : to, shared.isFunction(from) ? from.call(this, this) : from);
|
|
2919
|
+
};
|
|
2920
|
+
}
|
|
2921
|
+
function mergeInject(to, from) {
|
|
2922
|
+
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
2923
|
+
}
|
|
2924
|
+
function normalizeInject(raw) {
|
|
2925
|
+
if (shared.isArray(raw)) {
|
|
2926
|
+
const res = {};
|
|
2927
|
+
for (let i = 0; i < raw.length; i++) {
|
|
2928
|
+
res[raw[i]] = raw[i];
|
|
2929
|
+
}
|
|
2930
|
+
return res;
|
|
2931
|
+
}
|
|
2932
|
+
return raw;
|
|
2933
|
+
}
|
|
2934
|
+
function mergeAsArray(to, from) {
|
|
2935
|
+
return to ? [...new Set([].concat(to, from))] : from;
|
|
2512
2936
|
}
|
|
2513
2937
|
function mergeObjectOptions(to, from) {
|
|
2514
2938
|
return to ? shared.extend(shared.extend(Object.create(null), to), from) : from;
|
|
@@ -2818,6 +3242,10 @@ const normalizeSlotValue = (value) => shared.isArray(value)
|
|
|
2818
3242
|
? value.map(normalizeVNode)
|
|
2819
3243
|
: [normalizeVNode(value)];
|
|
2820
3244
|
const normalizeSlot = (key, rawSlot, ctx) => {
|
|
3245
|
+
if (rawSlot._n) {
|
|
3246
|
+
// already normalized - #5353
|
|
3247
|
+
return rawSlot;
|
|
3248
|
+
}
|
|
2821
3249
|
const normalized = withCtx((...args) => {
|
|
2822
3250
|
return normalizeSlotValue(rawSlot(...args));
|
|
2823
3251
|
}, ctx);
|
|
@@ -2912,75 +3340,6 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
2912
3340
|
}
|
|
2913
3341
|
};
|
|
2914
3342
|
|
|
2915
|
-
/**
|
|
2916
|
-
Runtime helper for applying directives to a vnode. Example usage:
|
|
2917
|
-
|
|
2918
|
-
const comp = resolveComponent('comp')
|
|
2919
|
-
const foo = resolveDirective('foo')
|
|
2920
|
-
const bar = resolveDirective('bar')
|
|
2921
|
-
|
|
2922
|
-
return withDirectives(h(comp), [
|
|
2923
|
-
[foo, this.x],
|
|
2924
|
-
[bar, this.y]
|
|
2925
|
-
])
|
|
2926
|
-
*/
|
|
2927
|
-
/**
|
|
2928
|
-
* Adds directives to a VNode.
|
|
2929
|
-
*/
|
|
2930
|
-
function withDirectives(vnode, directives) {
|
|
2931
|
-
const internalInstance = currentRenderingInstance;
|
|
2932
|
-
if (internalInstance === null) {
|
|
2933
|
-
return vnode;
|
|
2934
|
-
}
|
|
2935
|
-
const instance = getExposeProxy(internalInstance) ||
|
|
2936
|
-
internalInstance.proxy;
|
|
2937
|
-
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
2938
|
-
for (let i = 0; i < directives.length; i++) {
|
|
2939
|
-
let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
|
|
2940
|
-
if (shared.isFunction(dir)) {
|
|
2941
|
-
dir = {
|
|
2942
|
-
mounted: dir,
|
|
2943
|
-
updated: dir
|
|
2944
|
-
};
|
|
2945
|
-
}
|
|
2946
|
-
if (dir.deep) {
|
|
2947
|
-
traverse(value);
|
|
2948
|
-
}
|
|
2949
|
-
bindings.push({
|
|
2950
|
-
dir,
|
|
2951
|
-
instance,
|
|
2952
|
-
value,
|
|
2953
|
-
oldValue: void 0,
|
|
2954
|
-
arg,
|
|
2955
|
-
modifiers
|
|
2956
|
-
});
|
|
2957
|
-
}
|
|
2958
|
-
return vnode;
|
|
2959
|
-
}
|
|
2960
|
-
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
2961
|
-
const bindings = vnode.dirs;
|
|
2962
|
-
const oldBindings = prevVNode && prevVNode.dirs;
|
|
2963
|
-
for (let i = 0; i < bindings.length; i++) {
|
|
2964
|
-
const binding = bindings[i];
|
|
2965
|
-
if (oldBindings) {
|
|
2966
|
-
binding.oldValue = oldBindings[i].value;
|
|
2967
|
-
}
|
|
2968
|
-
let hook = binding.dir[name];
|
|
2969
|
-
if (hook) {
|
|
2970
|
-
// disable tracking inside all lifecycle hooks
|
|
2971
|
-
// since they can potentially be called inside effects.
|
|
2972
|
-
reactivity.pauseTracking();
|
|
2973
|
-
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
2974
|
-
vnode.el,
|
|
2975
|
-
binding,
|
|
2976
|
-
vnode,
|
|
2977
|
-
prevVNode
|
|
2978
|
-
]);
|
|
2979
|
-
reactivity.resetTracking();
|
|
2980
|
-
}
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2983
|
-
|
|
2984
3343
|
function createAppContext() {
|
|
2985
3344
|
return {
|
|
2986
3345
|
app: null,
|
|
@@ -3006,7 +3365,7 @@ let uid = 0;
|
|
|
3006
3365
|
function createAppAPI(render, hydrate) {
|
|
3007
3366
|
return function createApp(rootComponent, rootProps = null) {
|
|
3008
3367
|
if (!shared.isFunction(rootComponent)) {
|
|
3009
|
-
rootComponent =
|
|
3368
|
+
rootComponent = { ...rootComponent };
|
|
3010
3369
|
}
|
|
3011
3370
|
if (rootProps != null && !shared.isObject(rootProps)) {
|
|
3012
3371
|
rootProps = null;
|
|
@@ -3087,8 +3446,6 @@ function createAppAPI(render, hydrate) {
|
|
|
3087
3446
|
}
|
|
3088
3447
|
},
|
|
3089
3448
|
provide(key, value) {
|
|
3090
|
-
// TypeScript doesn't allow symbols as index type
|
|
3091
|
-
// https://github.com/Microsoft/TypeScript/issues/24587
|
|
3092
3449
|
context.provides[key] = value;
|
|
3093
3450
|
return app;
|
|
3094
3451
|
}
|
|
@@ -3195,7 +3552,7 @@ const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
|
3195
3552
|
// Hydration also depends on some renderer internal logic which needs to be
|
|
3196
3553
|
// passed in via arguments.
|
|
3197
3554
|
function createHydrationFunctions(rendererInternals) {
|
|
3198
|
-
const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
|
|
3555
|
+
const { mt: mountComponent, p: patch, o: { patchProp, createText, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
|
|
3199
3556
|
const hydrate = (vnode, container) => {
|
|
3200
3557
|
if (!container.hasChildNodes()) {
|
|
3201
3558
|
patch(null, vnode, container);
|
|
@@ -3213,14 +3570,26 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3213
3570
|
const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
|
3214
3571
|
const isFragmentStart = isComment(node) && node.data === '[';
|
|
3215
3572
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
3216
|
-
const { type, ref, shapeFlag } = vnode;
|
|
3573
|
+
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
3217
3574
|
const domType = node.nodeType;
|
|
3218
3575
|
vnode.el = node;
|
|
3576
|
+
if (patchFlag === -2 /* BAIL */) {
|
|
3577
|
+
optimized = false;
|
|
3578
|
+
vnode.dynamicChildren = null;
|
|
3579
|
+
}
|
|
3219
3580
|
let nextNode = null;
|
|
3220
3581
|
switch (type) {
|
|
3221
3582
|
case Text:
|
|
3222
3583
|
if (domType !== 3 /* TEXT */) {
|
|
3223
|
-
|
|
3584
|
+
// #5728 empty text node inside a slot can cause hydration failure
|
|
3585
|
+
// because the server rendered HTML won't contain a text node
|
|
3586
|
+
if (vnode.children === '') {
|
|
3587
|
+
insert((vnode.el = createText('')), parentNode(node), node);
|
|
3588
|
+
nextNode = node;
|
|
3589
|
+
}
|
|
3590
|
+
else {
|
|
3591
|
+
nextNode = onMismatch();
|
|
3592
|
+
}
|
|
3224
3593
|
}
|
|
3225
3594
|
else {
|
|
3226
3595
|
if (node.data !== vnode.children) {
|
|
@@ -3291,6 +3660,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3291
3660
|
nextNode = isFragmentStart
|
|
3292
3661
|
? locateClosingAsyncAnchor(node)
|
|
3293
3662
|
: nextSibling(node);
|
|
3663
|
+
// #4293 teleport as component root
|
|
3664
|
+
if (nextNode &&
|
|
3665
|
+
isComment(nextNode) &&
|
|
3666
|
+
nextNode.data === 'teleport end') {
|
|
3667
|
+
nextNode = nextSibling(nextNode);
|
|
3668
|
+
}
|
|
3294
3669
|
// #3787
|
|
3295
3670
|
// if component is async, it may get moved / unmounted before its
|
|
3296
3671
|
// inner component is loaded, so we need to give it a placeholder
|
|
@@ -3956,7 +4331,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3956
4331
|
}
|
|
3957
4332
|
else {
|
|
3958
4333
|
// no update needed. just copy over properties
|
|
3959
|
-
n2.component = n1.component;
|
|
3960
4334
|
n2.el = n1.el;
|
|
3961
4335
|
instance.vnode = n2;
|
|
3962
4336
|
}
|
|
@@ -4015,7 +4389,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4015
4389
|
// activated hook for keep-alive roots.
|
|
4016
4390
|
// #1742 activated hook must be accessed after first render
|
|
4017
4391
|
// since the hook may be injected by a child keep-alive
|
|
4018
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */
|
|
4392
|
+
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
4393
|
+
(parent &&
|
|
4394
|
+
isAsyncWrapper(parent.vnode) &&
|
|
4395
|
+
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
4019
4396
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
4020
4397
|
}
|
|
4021
4398
|
instance.isMounted = true;
|
|
@@ -4073,9 +4450,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4073
4450
|
}
|
|
4074
4451
|
};
|
|
4075
4452
|
// create reactive effect for rendering
|
|
4076
|
-
const effect = (instance.effect = new reactivity.ReactiveEffect(componentUpdateFn, () => queueJob(
|
|
4453
|
+
const effect = (instance.effect = new reactivity.ReactiveEffect(componentUpdateFn, () => queueJob(update), instance.scope // track it in component's effect scope
|
|
4077
4454
|
));
|
|
4078
|
-
const update = (instance.update = effect.run
|
|
4455
|
+
const update = (instance.update = () => effect.run());
|
|
4079
4456
|
update.id = instance.uid;
|
|
4080
4457
|
// allowRecurse
|
|
4081
4458
|
// #1801, #2043 component render effects should allow recursive updates
|
|
@@ -4817,78 +5194,29 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
4817
5194
|
}
|
|
4818
5195
|
else {
|
|
4819
5196
|
vnode.anchor = nextSibling(node);
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
function resolveComponent(name, maybeSelfReference) {
|
|
4837
|
-
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
4838
|
-
}
|
|
4839
|
-
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
4840
|
-
/**
|
|
4841
|
-
* @private
|
|
4842
|
-
*/
|
|
4843
|
-
function resolveDynamicComponent(component) {
|
|
4844
|
-
if (shared.isString(component)) {
|
|
4845
|
-
return resolveAsset(COMPONENTS, component, false) || component;
|
|
4846
|
-
}
|
|
4847
|
-
else {
|
|
4848
|
-
// invalid types will fallthrough to createVNode and raise warning
|
|
4849
|
-
return (component || NULL_DYNAMIC_COMPONENT);
|
|
4850
|
-
}
|
|
4851
|
-
}
|
|
4852
|
-
/**
|
|
4853
|
-
* @private
|
|
4854
|
-
*/
|
|
4855
|
-
function resolveDirective(name) {
|
|
4856
|
-
return resolveAsset(DIRECTIVES, name);
|
|
4857
|
-
}
|
|
4858
|
-
// implementation
|
|
4859
|
-
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
4860
|
-
const instance = currentRenderingInstance || currentInstance;
|
|
4861
|
-
if (instance) {
|
|
4862
|
-
const Component = instance.type;
|
|
4863
|
-
// explicit self name has highest priority
|
|
4864
|
-
if (type === COMPONENTS) {
|
|
4865
|
-
const selfName = getComponentName(Component);
|
|
4866
|
-
if (selfName &&
|
|
4867
|
-
(selfName === name ||
|
|
4868
|
-
selfName === shared.camelize(name) ||
|
|
4869
|
-
selfName === shared.capitalize(shared.camelize(name)))) {
|
|
4870
|
-
return Component;
|
|
5197
|
+
// lookahead until we find the target anchor
|
|
5198
|
+
// we cannot rely on return value of hydrateChildren() because there
|
|
5199
|
+
// could be nested teleports
|
|
5200
|
+
let targetAnchor = targetNode;
|
|
5201
|
+
while (targetAnchor) {
|
|
5202
|
+
targetAnchor = nextSibling(targetAnchor);
|
|
5203
|
+
if (targetAnchor &&
|
|
5204
|
+
targetAnchor.nodeType === 8 &&
|
|
5205
|
+
targetAnchor.data === 'teleport anchor') {
|
|
5206
|
+
vnode.targetAnchor = targetAnchor;
|
|
5207
|
+
target._lpa =
|
|
5208
|
+
vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
|
5209
|
+
break;
|
|
5210
|
+
}
|
|
5211
|
+
}
|
|
5212
|
+
hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
4871
5213
|
}
|
|
4872
5214
|
}
|
|
4873
|
-
const res =
|
|
4874
|
-
// local registration
|
|
4875
|
-
// check instance[type] first which is resolved for options API
|
|
4876
|
-
resolve(instance[type] || Component[type], name) ||
|
|
4877
|
-
// global registration
|
|
4878
|
-
resolve(instance.appContext[type], name);
|
|
4879
|
-
if (!res && maybeSelfReference) {
|
|
4880
|
-
// fallback to implicit self-reference
|
|
4881
|
-
return Component;
|
|
4882
|
-
}
|
|
4883
|
-
return res;
|
|
4884
5215
|
}
|
|
5216
|
+
return vnode.anchor && nextSibling(vnode.anchor);
|
|
4885
5217
|
}
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
(registry[name] ||
|
|
4889
|
-
registry[shared.camelize(name)] ||
|
|
4890
|
-
registry[shared.capitalize(shared.camelize(name))]));
|
|
4891
|
-
}
|
|
5218
|
+
// Force-casted public typing for h and TSX props inference
|
|
5219
|
+
const Teleport = TeleportImpl;
|
|
4892
5220
|
|
|
4893
5221
|
const Fragment = Symbol(undefined);
|
|
4894
5222
|
const Text = Symbol(undefined);
|
|
@@ -5073,6 +5401,15 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5073
5401
|
if (children) {
|
|
5074
5402
|
normalizeChildren(cloned, children);
|
|
5075
5403
|
}
|
|
5404
|
+
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
5405
|
+
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
5406
|
+
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
5407
|
+
}
|
|
5408
|
+
else {
|
|
5409
|
+
currentBlock.push(cloned);
|
|
5410
|
+
}
|
|
5411
|
+
}
|
|
5412
|
+
cloned.patchFlag |= -2 /* BAIL */;
|
|
5076
5413
|
return cloned;
|
|
5077
5414
|
}
|
|
5078
5415
|
// class component normalization.
|
|
@@ -5208,408 +5545,117 @@ function normalizeVNode(child) {
|
|
|
5208
5545
|
// fragment
|
|
5209
5546
|
return createVNode(Fragment, null,
|
|
5210
5547
|
// #3666, avoid reference pollution when reusing vnode
|
|
5211
|
-
child.slice());
|
|
5212
|
-
}
|
|
5213
|
-
else if (typeof child === 'object') {
|
|
5214
|
-
// already vnode, this should be the most common since compiled templates
|
|
5215
|
-
// always produce all-vnode children arrays
|
|
5216
|
-
return cloneIfMounted(child);
|
|
5217
|
-
}
|
|
5218
|
-
else {
|
|
5219
|
-
// strings and numbers
|
|
5220
|
-
return createVNode(Text, null, String(child));
|
|
5221
|
-
}
|
|
5222
|
-
}
|
|
5223
|
-
// optimized normalization for template-compiled render fns
|
|
5224
|
-
function cloneIfMounted(child) {
|
|
5225
|
-
return child.el === null || child.memo ? child : cloneVNode(child);
|
|
5226
|
-
}
|
|
5227
|
-
function normalizeChildren(vnode, children) {
|
|
5228
|
-
let type = 0;
|
|
5229
|
-
const { shapeFlag } = vnode;
|
|
5230
|
-
if (children == null) {
|
|
5231
|
-
children = null;
|
|
5232
|
-
}
|
|
5233
|
-
else if (shared.isArray(children)) {
|
|
5234
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
5235
|
-
}
|
|
5236
|
-
else if (typeof children === 'object') {
|
|
5237
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
5238
|
-
// Normalize slot to plain children for plain element and Teleport
|
|
5239
|
-
const slot = children.default;
|
|
5240
|
-
if (slot) {
|
|
5241
|
-
// _c marker is added by withCtx() indicating this is a compiled slot
|
|
5242
|
-
slot._c && (slot._d = false);
|
|
5243
|
-
normalizeChildren(vnode, slot());
|
|
5244
|
-
slot._c && (slot._d = true);
|
|
5245
|
-
}
|
|
5246
|
-
return;
|
|
5247
|
-
}
|
|
5248
|
-
else {
|
|
5249
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
5250
|
-
const slotFlag = children._;
|
|
5251
|
-
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
5252
|
-
children._ctx = currentRenderingInstance;
|
|
5253
|
-
}
|
|
5254
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
5255
|
-
// a child component receives forwarded slots from the parent.
|
|
5256
|
-
// its slot type is determined by its parent's slot type.
|
|
5257
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
5258
|
-
children._ = 1 /* STABLE */;
|
|
5259
|
-
}
|
|
5260
|
-
else {
|
|
5261
|
-
children._ = 2 /* DYNAMIC */;
|
|
5262
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
5263
|
-
}
|
|
5264
|
-
}
|
|
5265
|
-
}
|
|
5266
|
-
}
|
|
5267
|
-
else if (shared.isFunction(children)) {
|
|
5268
|
-
children = { default: children, _ctx: currentRenderingInstance };
|
|
5269
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
5270
|
-
}
|
|
5271
|
-
else {
|
|
5272
|
-
children = String(children);
|
|
5273
|
-
// force teleport children to array so it can be moved around
|
|
5274
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
5275
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
5276
|
-
children = [createTextVNode(children)];
|
|
5277
|
-
}
|
|
5278
|
-
else {
|
|
5279
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
5280
|
-
}
|
|
5281
|
-
}
|
|
5282
|
-
vnode.children = children;
|
|
5283
|
-
vnode.shapeFlag |= type;
|
|
5284
|
-
}
|
|
5285
|
-
function mergeProps(...args) {
|
|
5286
|
-
const ret = {};
|
|
5287
|
-
for (let i = 0; i < args.length; i++) {
|
|
5288
|
-
const toMerge = args[i];
|
|
5289
|
-
for (const key in toMerge) {
|
|
5290
|
-
if (key === 'class') {
|
|
5291
|
-
if (ret.class !== toMerge.class) {
|
|
5292
|
-
ret.class = shared.normalizeClass([ret.class, toMerge.class]);
|
|
5293
|
-
}
|
|
5294
|
-
}
|
|
5295
|
-
else if (key === 'style') {
|
|
5296
|
-
ret.style = shared.normalizeStyle([ret.style, toMerge.style]);
|
|
5297
|
-
}
|
|
5298
|
-
else if (shared.isOn(key)) {
|
|
5299
|
-
const existing = ret[key];
|
|
5300
|
-
const incoming = toMerge[key];
|
|
5301
|
-
if (incoming &&
|
|
5302
|
-
existing !== incoming &&
|
|
5303
|
-
!(shared.isArray(existing) && existing.includes(incoming))) {
|
|
5304
|
-
ret[key] = existing
|
|
5305
|
-
? [].concat(existing, incoming)
|
|
5306
|
-
: incoming;
|
|
5307
|
-
}
|
|
5308
|
-
}
|
|
5309
|
-
else if (key !== '') {
|
|
5310
|
-
ret[key] = toMerge[key];
|
|
5311
|
-
}
|
|
5312
|
-
}
|
|
5313
|
-
}
|
|
5314
|
-
return ret;
|
|
5315
|
-
}
|
|
5316
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
5317
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
5318
|
-
vnode,
|
|
5319
|
-
prevVNode
|
|
5320
|
-
]);
|
|
5321
|
-
}
|
|
5322
|
-
|
|
5323
|
-
/**
|
|
5324
|
-
* Actual implementation
|
|
5325
|
-
*/
|
|
5326
|
-
function renderList(source, renderItem, cache, index) {
|
|
5327
|
-
let ret;
|
|
5328
|
-
const cached = (cache && cache[index]);
|
|
5329
|
-
if (shared.isArray(source) || shared.isString(source)) {
|
|
5330
|
-
ret = new Array(source.length);
|
|
5331
|
-
for (let i = 0, l = source.length; i < l; i++) {
|
|
5332
|
-
ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
|
|
5333
|
-
}
|
|
5334
|
-
}
|
|
5335
|
-
else if (typeof source === 'number') {
|
|
5336
|
-
ret = new Array(source);
|
|
5337
|
-
for (let i = 0; i < source; i++) {
|
|
5338
|
-
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
5339
|
-
}
|
|
5340
|
-
}
|
|
5341
|
-
else if (shared.isObject(source)) {
|
|
5342
|
-
if (source[Symbol.iterator]) {
|
|
5343
|
-
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
5344
|
-
}
|
|
5345
|
-
else {
|
|
5346
|
-
const keys = Object.keys(source);
|
|
5347
|
-
ret = new Array(keys.length);
|
|
5348
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
5349
|
-
const key = keys[i];
|
|
5350
|
-
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
5351
|
-
}
|
|
5352
|
-
}
|
|
5353
|
-
}
|
|
5354
|
-
else {
|
|
5355
|
-
ret = [];
|
|
5356
|
-
}
|
|
5357
|
-
if (cache) {
|
|
5358
|
-
cache[index] = ret;
|
|
5359
|
-
}
|
|
5360
|
-
return ret;
|
|
5361
|
-
}
|
|
5362
|
-
|
|
5363
|
-
/**
|
|
5364
|
-
* Compiler runtime helper for creating dynamic slots object
|
|
5365
|
-
* @private
|
|
5366
|
-
*/
|
|
5367
|
-
function createSlots(slots, dynamicSlots) {
|
|
5368
|
-
for (let i = 0; i < dynamicSlots.length; i++) {
|
|
5369
|
-
const slot = dynamicSlots[i];
|
|
5370
|
-
// array of dynamic slot generated by <template v-for="..." #[...]>
|
|
5371
|
-
if (shared.isArray(slot)) {
|
|
5372
|
-
for (let j = 0; j < slot.length; j++) {
|
|
5373
|
-
slots[slot[j].name] = slot[j].fn;
|
|
5374
|
-
}
|
|
5375
|
-
}
|
|
5376
|
-
else if (slot) {
|
|
5377
|
-
// conditional single slot generated by <template v-if="..." #foo>
|
|
5378
|
-
slots[slot.name] = slot.fn;
|
|
5379
|
-
}
|
|
5380
|
-
}
|
|
5381
|
-
return slots;
|
|
5382
|
-
}
|
|
5383
|
-
|
|
5384
|
-
/**
|
|
5385
|
-
* Compiler runtime helper for rendering `<slot/>`
|
|
5386
|
-
* @private
|
|
5387
|
-
*/
|
|
5388
|
-
function renderSlot(slots, name, props = {},
|
|
5389
|
-
// this is not a user-facing function, so the fallback is always generated by
|
|
5390
|
-
// the compiler and guaranteed to be a function returning an array
|
|
5391
|
-
fallback, noSlotted) {
|
|
5392
|
-
if (currentRenderingInstance.isCE ||
|
|
5393
|
-
(currentRenderingInstance.parent &&
|
|
5394
|
-
isAsyncWrapper(currentRenderingInstance.parent) &&
|
|
5395
|
-
currentRenderingInstance.parent.isCE)) {
|
|
5396
|
-
return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
|
|
5397
|
-
}
|
|
5398
|
-
let slot = slots[name];
|
|
5399
|
-
// a compiled slot disables block tracking by default to avoid manual
|
|
5400
|
-
// invocation interfering with template-based block tracking, but in
|
|
5401
|
-
// `renderSlot` we can be sure that it's template-based so we can force
|
|
5402
|
-
// enable it.
|
|
5403
|
-
if (slot && slot._c) {
|
|
5404
|
-
slot._d = false;
|
|
5405
|
-
}
|
|
5406
|
-
openBlock();
|
|
5407
|
-
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
5408
|
-
const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
|
|
5409
|
-
? 64 /* STABLE_FRAGMENT */
|
|
5410
|
-
: -2 /* BAIL */);
|
|
5411
|
-
if (!noSlotted && rendered.scopeId) {
|
|
5412
|
-
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
5413
|
-
}
|
|
5414
|
-
if (slot && slot._c) {
|
|
5415
|
-
slot._d = true;
|
|
5416
|
-
}
|
|
5417
|
-
return rendered;
|
|
5418
|
-
}
|
|
5419
|
-
function ensureValidVNode(vnodes) {
|
|
5420
|
-
return vnodes.some(child => {
|
|
5421
|
-
if (!isVNode(child))
|
|
5422
|
-
return true;
|
|
5423
|
-
if (child.type === Comment)
|
|
5424
|
-
return false;
|
|
5425
|
-
if (child.type === Fragment &&
|
|
5426
|
-
!ensureValidVNode(child.children))
|
|
5427
|
-
return false;
|
|
5428
|
-
return true;
|
|
5429
|
-
})
|
|
5430
|
-
? vnodes
|
|
5431
|
-
: null;
|
|
5432
|
-
}
|
|
5433
|
-
|
|
5434
|
-
/**
|
|
5435
|
-
* For prefixing keys in v-on="obj" with "on"
|
|
5436
|
-
* @private
|
|
5437
|
-
*/
|
|
5438
|
-
function toHandlers(obj) {
|
|
5439
|
-
const ret = {};
|
|
5440
|
-
for (const key in obj) {
|
|
5441
|
-
ret[shared.toHandlerKey(key)] = obj[key];
|
|
5548
|
+
child.slice());
|
|
5442
5549
|
}
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
$watch: i => (instanceWatch.bind(i) )
|
|
5476
|
-
});
|
|
5477
|
-
const PublicInstanceProxyHandlers = {
|
|
5478
|
-
get({ _: instance }, key) {
|
|
5479
|
-
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
|
5480
|
-
// data / props / ctx
|
|
5481
|
-
// This getter gets called for every property access on the render context
|
|
5482
|
-
// during render and is a major hotspot. The most expensive part of this
|
|
5483
|
-
// is the multiple hasOwn() calls. It's much faster to do a simple property
|
|
5484
|
-
// access on a plain object, so we use an accessCache object (with null
|
|
5485
|
-
// prototype) to memoize what access type a key corresponds to.
|
|
5486
|
-
let normalizedProps;
|
|
5487
|
-
if (key[0] !== '$') {
|
|
5488
|
-
const n = accessCache[key];
|
|
5489
|
-
if (n !== undefined) {
|
|
5490
|
-
switch (n) {
|
|
5491
|
-
case 1 /* SETUP */:
|
|
5492
|
-
return setupState[key];
|
|
5493
|
-
case 2 /* DATA */:
|
|
5494
|
-
return data[key];
|
|
5495
|
-
case 4 /* CONTEXT */:
|
|
5496
|
-
return ctx[key];
|
|
5497
|
-
case 3 /* PROPS */:
|
|
5498
|
-
return props[key];
|
|
5499
|
-
// default: just fallthrough
|
|
5500
|
-
}
|
|
5501
|
-
}
|
|
5502
|
-
else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
|
|
5503
|
-
accessCache[key] = 1 /* SETUP */;
|
|
5504
|
-
return setupState[key];
|
|
5505
|
-
}
|
|
5506
|
-
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
5507
|
-
accessCache[key] = 2 /* DATA */;
|
|
5508
|
-
return data[key];
|
|
5509
|
-
}
|
|
5510
|
-
else if (
|
|
5511
|
-
// only cache other properties when instance has declared (thus stable)
|
|
5512
|
-
// props
|
|
5513
|
-
(normalizedProps = instance.propsOptions[0]) &&
|
|
5514
|
-
shared.hasOwn(normalizedProps, key)) {
|
|
5515
|
-
accessCache[key] = 3 /* PROPS */;
|
|
5516
|
-
return props[key];
|
|
5517
|
-
}
|
|
5518
|
-
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
5519
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
5520
|
-
return ctx[key];
|
|
5521
|
-
}
|
|
5522
|
-
else if (shouldCacheAccess) {
|
|
5523
|
-
accessCache[key] = 0 /* OTHER */;
|
|
5550
|
+
else if (typeof child === 'object') {
|
|
5551
|
+
// already vnode, this should be the most common since compiled templates
|
|
5552
|
+
// always produce all-vnode children arrays
|
|
5553
|
+
return cloneIfMounted(child);
|
|
5554
|
+
}
|
|
5555
|
+
else {
|
|
5556
|
+
// strings and numbers
|
|
5557
|
+
return createVNode(Text, null, String(child));
|
|
5558
|
+
}
|
|
5559
|
+
}
|
|
5560
|
+
// optimized normalization for template-compiled render fns
|
|
5561
|
+
function cloneIfMounted(child) {
|
|
5562
|
+
return child.el === null || child.memo ? child : cloneVNode(child);
|
|
5563
|
+
}
|
|
5564
|
+
function normalizeChildren(vnode, children) {
|
|
5565
|
+
let type = 0;
|
|
5566
|
+
const { shapeFlag } = vnode;
|
|
5567
|
+
if (children == null) {
|
|
5568
|
+
children = null;
|
|
5569
|
+
}
|
|
5570
|
+
else if (shared.isArray(children)) {
|
|
5571
|
+
type = 16 /* ARRAY_CHILDREN */;
|
|
5572
|
+
}
|
|
5573
|
+
else if (typeof children === 'object') {
|
|
5574
|
+
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
5575
|
+
// Normalize slot to plain children for plain element and Teleport
|
|
5576
|
+
const slot = children.default;
|
|
5577
|
+
if (slot) {
|
|
5578
|
+
// _c marker is added by withCtx() indicating this is a compiled slot
|
|
5579
|
+
slot._c && (slot._d = false);
|
|
5580
|
+
normalizeChildren(vnode, slot());
|
|
5581
|
+
slot._c && (slot._d = true);
|
|
5524
5582
|
}
|
|
5583
|
+
return;
|
|
5525
5584
|
}
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
reactivity.track(instance, "get" /* GET */, key);
|
|
5585
|
+
else {
|
|
5586
|
+
type = 32 /* SLOTS_CHILDREN */;
|
|
5587
|
+
const slotFlag = children._;
|
|
5588
|
+
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
5589
|
+
children._ctx = currentRenderingInstance;
|
|
5532
5590
|
}
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
5544
|
-
return ctx[key];
|
|
5545
|
-
}
|
|
5546
|
-
else if (
|
|
5547
|
-
// global properties
|
|
5548
|
-
((globalProperties = appContext.config.globalProperties),
|
|
5549
|
-
shared.hasOwn(globalProperties, key))) {
|
|
5550
|
-
{
|
|
5551
|
-
return globalProperties[key];
|
|
5591
|
+
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
5592
|
+
// a child component receives forwarded slots from the parent.
|
|
5593
|
+
// its slot type is determined by its parent's slot type.
|
|
5594
|
+
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
5595
|
+
children._ = 1 /* STABLE */;
|
|
5596
|
+
}
|
|
5597
|
+
else {
|
|
5598
|
+
children._ = 2 /* DYNAMIC */;
|
|
5599
|
+
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
5600
|
+
}
|
|
5552
5601
|
}
|
|
5553
5602
|
}
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
}
|
|
5566
|
-
else if (shared.hasOwn(instance.props, key)) {
|
|
5567
|
-
return false;
|
|
5568
|
-
}
|
|
5569
|
-
if (key[0] === '$' && key.slice(1) in instance) {
|
|
5570
|
-
return false;
|
|
5603
|
+
}
|
|
5604
|
+
else if (shared.isFunction(children)) {
|
|
5605
|
+
children = { default: children, _ctx: currentRenderingInstance };
|
|
5606
|
+
type = 32 /* SLOTS_CHILDREN */;
|
|
5607
|
+
}
|
|
5608
|
+
else {
|
|
5609
|
+
children = String(children);
|
|
5610
|
+
// force teleport children to array so it can be moved around
|
|
5611
|
+
if (shapeFlag & 64 /* TELEPORT */) {
|
|
5612
|
+
type = 16 /* ARRAY_CHILDREN */;
|
|
5613
|
+
children = [createTextVNode(children)];
|
|
5571
5614
|
}
|
|
5572
5615
|
else {
|
|
5573
|
-
|
|
5574
|
-
ctx[key] = value;
|
|
5575
|
-
}
|
|
5576
|
-
}
|
|
5577
|
-
return true;
|
|
5578
|
-
},
|
|
5579
|
-
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
5580
|
-
let normalizedProps;
|
|
5581
|
-
return (!!accessCache[key] ||
|
|
5582
|
-
(data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
|
|
5583
|
-
(setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
|
|
5584
|
-
((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
|
|
5585
|
-
shared.hasOwn(ctx, key) ||
|
|
5586
|
-
shared.hasOwn(publicPropertiesMap, key) ||
|
|
5587
|
-
shared.hasOwn(appContext.config.globalProperties, key));
|
|
5588
|
-
},
|
|
5589
|
-
defineProperty(target, key, descriptor) {
|
|
5590
|
-
if (descriptor.get != null) {
|
|
5591
|
-
// invalidate key cache of a getter based property #5417
|
|
5592
|
-
target._.accessCache[key] = 0;
|
|
5593
|
-
}
|
|
5594
|
-
else if (shared.hasOwn(descriptor, 'value')) {
|
|
5595
|
-
this.set(target, key, descriptor.value, null);
|
|
5616
|
+
type = 8 /* TEXT_CHILDREN */;
|
|
5596
5617
|
}
|
|
5597
|
-
return Reflect.defineProperty(target, key, descriptor);
|
|
5598
5618
|
}
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5619
|
+
vnode.children = children;
|
|
5620
|
+
vnode.shapeFlag |= type;
|
|
5621
|
+
}
|
|
5622
|
+
function mergeProps(...args) {
|
|
5623
|
+
const ret = {};
|
|
5624
|
+
for (let i = 0; i < args.length; i++) {
|
|
5625
|
+
const toMerge = args[i];
|
|
5626
|
+
for (const key in toMerge) {
|
|
5627
|
+
if (key === 'class') {
|
|
5628
|
+
if (ret.class !== toMerge.class) {
|
|
5629
|
+
ret.class = shared.normalizeClass([ret.class, toMerge.class]);
|
|
5630
|
+
}
|
|
5631
|
+
}
|
|
5632
|
+
else if (key === 'style') {
|
|
5633
|
+
ret.style = shared.normalizeStyle([ret.style, toMerge.style]);
|
|
5634
|
+
}
|
|
5635
|
+
else if (shared.isOn(key)) {
|
|
5636
|
+
const existing = ret[key];
|
|
5637
|
+
const incoming = toMerge[key];
|
|
5638
|
+
if (incoming &&
|
|
5639
|
+
existing !== incoming &&
|
|
5640
|
+
!(shared.isArray(existing) && existing.includes(incoming))) {
|
|
5641
|
+
ret[key] = existing
|
|
5642
|
+
? [].concat(existing, incoming)
|
|
5643
|
+
: incoming;
|
|
5644
|
+
}
|
|
5645
|
+
}
|
|
5646
|
+
else if (key !== '') {
|
|
5647
|
+
ret[key] = toMerge[key];
|
|
5648
|
+
}
|
|
5605
5649
|
}
|
|
5606
|
-
return PublicInstanceProxyHandlers.get(target, key, target);
|
|
5607
|
-
},
|
|
5608
|
-
has(_, key) {
|
|
5609
|
-
const has = key[0] !== '_' && !shared.isGloballyWhitelisted(key);
|
|
5610
|
-
return has;
|
|
5611
5650
|
}
|
|
5612
|
-
|
|
5651
|
+
return ret;
|
|
5652
|
+
}
|
|
5653
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
5654
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
5655
|
+
vnode,
|
|
5656
|
+
prevVNode
|
|
5657
|
+
]);
|
|
5658
|
+
}
|
|
5613
5659
|
|
|
5614
5660
|
const emptyAppContext = createAppContext();
|
|
5615
5661
|
let uid$1 = 0;
|
|
@@ -5637,7 +5683,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
5637
5683
|
provides: parent ? parent.provides : Object.create(appContext.provides),
|
|
5638
5684
|
accessCache: null,
|
|
5639
5685
|
renderCache: [],
|
|
5640
|
-
// local
|
|
5686
|
+
// local resolved assets
|
|
5641
5687
|
components: null,
|
|
5642
5688
|
directives: null,
|
|
5643
5689
|
// resolved props and emits options
|
|
@@ -6103,7 +6149,7 @@ function isMemoSame(cached, memo) {
|
|
|
6103
6149
|
return false;
|
|
6104
6150
|
}
|
|
6105
6151
|
for (let i = 0; i < prev.length; i++) {
|
|
6106
|
-
if (prev[i]
|
|
6152
|
+
if (shared.hasChanged(prev[i], memo[i])) {
|
|
6107
6153
|
return false;
|
|
6108
6154
|
}
|
|
6109
6155
|
}
|
|
@@ -6115,7 +6161,7 @@ function isMemoSame(cached, memo) {
|
|
|
6115
6161
|
}
|
|
6116
6162
|
|
|
6117
6163
|
// Core API ------------------------------------------------------------------
|
|
6118
|
-
const version = "3.2.
|
|
6164
|
+
const version = "3.2.35";
|
|
6119
6165
|
const _ssrUtils = {
|
|
6120
6166
|
createComponentInstance,
|
|
6121
6167
|
setupComponent,
|