@vue/runtime-core 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/runtime-core.cjs.js +2661 -2640
- package/dist/runtime-core.cjs.prod.js +871 -854
- package/dist/runtime-core.d.ts +42 -28
- package/dist/runtime-core.esm-bundler.js +3874 -3853
- 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;
|
|
@@ -338,7 +340,6 @@ function flushJobs(seen) {
|
|
|
338
340
|
|
|
339
341
|
let buffer = [];
|
|
340
342
|
function setDevtoolsHook(hook, target) {
|
|
341
|
-
var _a, _b;
|
|
342
343
|
exports.devtools = hook;
|
|
343
344
|
if (exports.devtools) {
|
|
344
345
|
exports.devtools.enabled = true;
|
|
@@ -349,12 +350,11 @@ function setDevtoolsHook(hook, target) {
|
|
|
349
350
|
// handle late devtools injection - only do this if we are in an actual
|
|
350
351
|
// browser environment to avoid the timer handle stalling test runner exit
|
|
351
352
|
// (#4815)
|
|
352
|
-
// eslint-disable-next-line no-restricted-globals
|
|
353
353
|
typeof window !== 'undefined' &&
|
|
354
354
|
// some envs mock window but not fully
|
|
355
355
|
window.HTMLElement &&
|
|
356
356
|
// also exclude jsdom
|
|
357
|
-
!
|
|
357
|
+
!window.navigator?.userAgent?.includes('jsdom')) {
|
|
358
358
|
const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
|
|
359
359
|
target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
|
|
360
360
|
replay.push((newHook) => {
|
|
@@ -388,7 +388,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
388
388
|
if (trim) {
|
|
389
389
|
args = rawArgs.map(a => a.trim());
|
|
390
390
|
}
|
|
391
|
-
|
|
391
|
+
if (number) {
|
|
392
392
|
args = rawArgs.map(shared.toNumber);
|
|
393
393
|
}
|
|
394
394
|
}
|
|
@@ -616,6 +616,8 @@ function renderComponentRoot(instance) {
|
|
|
616
616
|
}
|
|
617
617
|
// inherit directives
|
|
618
618
|
if (vnode.dirs) {
|
|
619
|
+
// clone before mutating since the root may be a hoisted vnode
|
|
620
|
+
root = cloneVNode(root);
|
|
619
621
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
620
622
|
}
|
|
621
623
|
// inherit transition data
|
|
@@ -1220,7 +1222,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1220
1222
|
}
|
|
1221
1223
|
else if (shared.isArray(source)) {
|
|
1222
1224
|
isMultiSource = true;
|
|
1223
|
-
forceTrigger = source.some(reactivity.isReactive);
|
|
1225
|
+
forceTrigger = source.some(s => reactivity.isReactive(s) || reactivity.isShallow(s));
|
|
1224
1226
|
getter = () => source.map(s => {
|
|
1225
1227
|
if (reactivity.isRef(s)) {
|
|
1226
1228
|
return s.value;
|
|
@@ -1326,16 +1328,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1326
1328
|
}
|
|
1327
1329
|
else {
|
|
1328
1330
|
// 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
|
-
};
|
|
1331
|
+
scheduler = () => queuePreFlushCb(job);
|
|
1339
1332
|
}
|
|
1340
1333
|
const effect = new reactivity.ReactiveEffect(getter, scheduler);
|
|
1341
1334
|
// initial run
|
|
@@ -1570,6 +1563,17 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
1570
1563
|
hook &&
|
|
1571
1564
|
callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
|
|
1572
1565
|
};
|
|
1566
|
+
const callAsyncHook = (hook, args) => {
|
|
1567
|
+
const done = args[1];
|
|
1568
|
+
callHook(hook, args);
|
|
1569
|
+
if (shared.isArray(hook)) {
|
|
1570
|
+
if (hook.every(hook => hook.length <= 1))
|
|
1571
|
+
done();
|
|
1572
|
+
}
|
|
1573
|
+
else if (hook.length <= 1) {
|
|
1574
|
+
done();
|
|
1575
|
+
}
|
|
1576
|
+
};
|
|
1573
1577
|
const hooks = {
|
|
1574
1578
|
mode,
|
|
1575
1579
|
persisted,
|
|
@@ -1628,10 +1632,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
1628
1632
|
el._enterCb = undefined;
|
|
1629
1633
|
});
|
|
1630
1634
|
if (hook) {
|
|
1631
|
-
hook
|
|
1632
|
-
if (hook.length <= 1) {
|
|
1633
|
-
done();
|
|
1634
|
-
}
|
|
1635
|
+
callAsyncHook(hook, [el, done]);
|
|
1635
1636
|
}
|
|
1636
1637
|
else {
|
|
1637
1638
|
done();
|
|
@@ -1665,10 +1666,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
1665
1666
|
});
|
|
1666
1667
|
leavingVNodesCache[key] = vnode;
|
|
1667
1668
|
if (onLeave) {
|
|
1668
|
-
onLeave
|
|
1669
|
-
if (onLeave.length <= 1) {
|
|
1670
|
-
done();
|
|
1671
|
-
}
|
|
1669
|
+
callAsyncHook(onLeave, [el, done]);
|
|
1672
1670
|
}
|
|
1673
1671
|
else {
|
|
1674
1672
|
done();
|
|
@@ -1871,7 +1869,7 @@ function defineAsyncComponent(source) {
|
|
|
1871
1869
|
}
|
|
1872
1870
|
});
|
|
1873
1871
|
}
|
|
1874
|
-
function createInnerComp(comp, { vnode: { ref, props, children } }) {
|
|
1872
|
+
function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
|
|
1875
1873
|
const vnode = createVNode(comp, props, children);
|
|
1876
1874
|
// ensure inner component inherits the async wrapper's ref owner
|
|
1877
1875
|
vnode.ref = ref;
|
|
@@ -2066,7 +2064,7 @@ const KeepAliveImpl = {
|
|
|
2066
2064
|
// avoid vnode being unmounted
|
|
2067
2065
|
vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2068
2066
|
current = vnode;
|
|
2069
|
-
return rawVNode;
|
|
2067
|
+
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
2070
2068
|
};
|
|
2071
2069
|
}
|
|
2072
2070
|
};
|
|
@@ -2195,322 +2193,744 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
2195
2193
|
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
2196
2194
|
}
|
|
2197
2195
|
|
|
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);
|
|
2196
|
+
/**
|
|
2197
|
+
Runtime helper for applying directives to a vnode. Example usage:
|
|
2198
|
+
|
|
2199
|
+
const comp = resolveComponent('comp')
|
|
2200
|
+
const foo = resolveDirective('foo')
|
|
2201
|
+
const bar = resolveDirective('bar')
|
|
2202
|
+
|
|
2203
|
+
return withDirectives(h(comp), [
|
|
2204
|
+
[foo, this.x],
|
|
2205
|
+
[bar, this.y]
|
|
2206
|
+
])
|
|
2207
|
+
*/
|
|
2208
|
+
/**
|
|
2209
|
+
* Adds directives to a VNode.
|
|
2210
|
+
*/
|
|
2211
|
+
function withDirectives(vnode, directives) {
|
|
2212
|
+
const internalInstance = currentRenderingInstance;
|
|
2213
|
+
if (internalInstance === null) {
|
|
2214
|
+
return vnode;
|
|
2229
2215
|
}
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
}
|
|
2216
|
+
const instance = getExposeProxy(internalInstance) ||
|
|
2217
|
+
internalInstance.proxy;
|
|
2218
|
+
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
2219
|
+
for (let i = 0; i < directives.length; i++) {
|
|
2220
|
+
let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
|
|
2221
|
+
if (shared.isFunction(dir)) {
|
|
2222
|
+
dir = {
|
|
2223
|
+
mounted: dir,
|
|
2224
|
+
updated: dir
|
|
2225
|
+
};
|
|
2241
2226
|
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
const data = dataOptions.call(publicThis, publicThis);
|
|
2245
|
-
if (!shared.isObject(data)) ;
|
|
2246
|
-
else {
|
|
2247
|
-
instance.data = reactivity.reactive(data);
|
|
2227
|
+
if (dir.deep) {
|
|
2228
|
+
traverse(value);
|
|
2248
2229
|
}
|
|
2230
|
+
bindings.push({
|
|
2231
|
+
dir,
|
|
2232
|
+
instance,
|
|
2233
|
+
value,
|
|
2234
|
+
oldValue: void 0,
|
|
2235
|
+
arg,
|
|
2236
|
+
modifiers
|
|
2237
|
+
});
|
|
2249
2238
|
}
|
|
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
|
-
});
|
|
2239
|
+
return vnode;
|
|
2240
|
+
}
|
|
2241
|
+
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
2242
|
+
const bindings = vnode.dirs;
|
|
2243
|
+
const oldBindings = prevVNode && prevVNode.dirs;
|
|
2244
|
+
for (let i = 0; i < bindings.length; i++) {
|
|
2245
|
+
const binding = bindings[i];
|
|
2246
|
+
if (oldBindings) {
|
|
2247
|
+
binding.oldValue = oldBindings[i].value;
|
|
2273
2248
|
}
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2249
|
+
let hook = binding.dir[name];
|
|
2250
|
+
if (hook) {
|
|
2251
|
+
// disable tracking inside all lifecycle hooks
|
|
2252
|
+
// since they can potentially be called inside effects.
|
|
2253
|
+
reactivity.pauseTracking();
|
|
2254
|
+
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
2255
|
+
vnode.el,
|
|
2256
|
+
binding,
|
|
2257
|
+
vnode,
|
|
2258
|
+
prevVNode
|
|
2259
|
+
]);
|
|
2260
|
+
reactivity.resetTracking();
|
|
2278
2261
|
}
|
|
2279
2262
|
}
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
const COMPONENTS = 'components';
|
|
2266
|
+
const DIRECTIVES = 'directives';
|
|
2267
|
+
/**
|
|
2268
|
+
* @private
|
|
2269
|
+
*/
|
|
2270
|
+
function resolveComponent(name, maybeSelfReference) {
|
|
2271
|
+
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
2272
|
+
}
|
|
2273
|
+
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
2274
|
+
/**
|
|
2275
|
+
* @private
|
|
2276
|
+
*/
|
|
2277
|
+
function resolveDynamicComponent(component) {
|
|
2278
|
+
if (shared.isString(component)) {
|
|
2279
|
+
return resolveAsset(COMPONENTS, component, false) || component;
|
|
2287
2280
|
}
|
|
2288
|
-
|
|
2289
|
-
|
|
2281
|
+
else {
|
|
2282
|
+
// invalid types will fallthrough to createVNode and raise warning
|
|
2283
|
+
return (component || NULL_DYNAMIC_COMPONENT);
|
|
2290
2284
|
}
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2285
|
+
}
|
|
2286
|
+
/**
|
|
2287
|
+
* @private
|
|
2288
|
+
*/
|
|
2289
|
+
function resolveDirective(name) {
|
|
2290
|
+
return resolveAsset(DIRECTIVES, name);
|
|
2291
|
+
}
|
|
2292
|
+
// implementation
|
|
2293
|
+
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
2294
|
+
const instance = currentRenderingInstance || currentInstance;
|
|
2295
|
+
if (instance) {
|
|
2296
|
+
const Component = instance.type;
|
|
2297
|
+
// explicit self name has highest priority
|
|
2298
|
+
if (type === COMPONENTS) {
|
|
2299
|
+
const selfName = getComponentName(Component);
|
|
2300
|
+
if (selfName &&
|
|
2301
|
+
(selfName === name ||
|
|
2302
|
+
selfName === shared.camelize(name) ||
|
|
2303
|
+
selfName === shared.capitalize(shared.camelize(name)))) {
|
|
2304
|
+
return Component;
|
|
2305
|
+
}
|
|
2294
2306
|
}
|
|
2295
|
-
|
|
2296
|
-
|
|
2307
|
+
const res =
|
|
2308
|
+
// local registration
|
|
2309
|
+
// check instance[type] first which is resolved for options API
|
|
2310
|
+
resolve(instance[type] || Component[type], name) ||
|
|
2311
|
+
// global registration
|
|
2312
|
+
resolve(instance.appContext[type], name);
|
|
2313
|
+
if (!res && maybeSelfReference) {
|
|
2314
|
+
// fallback to implicit self-reference
|
|
2315
|
+
return Component;
|
|
2297
2316
|
}
|
|
2317
|
+
return res;
|
|
2298
2318
|
}
|
|
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 = {};
|
|
2319
|
+
}
|
|
2320
|
+
function resolve(registry, name) {
|
|
2321
|
+
return (registry &&
|
|
2322
|
+
(registry[name] ||
|
|
2323
|
+
registry[shared.camelize(name)] ||
|
|
2324
|
+
registry[shared.capitalize(shared.camelize(name))]));
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
/**
|
|
2328
|
+
* Actual implementation
|
|
2329
|
+
*/
|
|
2330
|
+
function renderList(source, renderItem, cache, index) {
|
|
2331
|
+
let ret;
|
|
2332
|
+
const cached = (cache && cache[index]);
|
|
2333
|
+
if (shared.isArray(source) || shared.isString(source)) {
|
|
2334
|
+
ret = new Array(source.length);
|
|
2335
|
+
for (let i = 0, l = source.length; i < l; i++) {
|
|
2336
|
+
ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
|
|
2323
2337
|
}
|
|
2324
2338
|
}
|
|
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);
|
|
2339
|
+
else if (typeof source === 'number') {
|
|
2340
|
+
ret = new Array(source);
|
|
2341
|
+
for (let i = 0; i < source; i++) {
|
|
2342
|
+
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
2343
|
+
}
|
|
2342
2344
|
}
|
|
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
|
-
}
|
|
2345
|
+
else if (shared.isObject(source)) {
|
|
2346
|
+
if (source[Symbol.iterator]) {
|
|
2347
|
+
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
2353
2348
|
}
|
|
2354
2349
|
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;
|
|
2350
|
+
const keys = Object.keys(source);
|
|
2351
|
+
ret = new Array(keys.length);
|
|
2352
|
+
for (let i = 0, l = keys.length; i < l; i++) {
|
|
2353
|
+
const key = keys[i];
|
|
2354
|
+
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
2369
2355
|
}
|
|
2370
2356
|
}
|
|
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
2357
|
}
|
|
2391
|
-
else
|
|
2392
|
-
|
|
2358
|
+
else {
|
|
2359
|
+
ret = [];
|
|
2393
2360
|
}
|
|
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
|
-
}
|
|
2361
|
+
if (cache) {
|
|
2362
|
+
cache[index] = ret;
|
|
2406
2363
|
}
|
|
2407
|
-
|
|
2408
|
-
}
|
|
2364
|
+
return ret;
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2409
2367
|
/**
|
|
2410
|
-
*
|
|
2411
|
-
*
|
|
2412
|
-
* instances.
|
|
2368
|
+
* Compiler runtime helper for creating dynamic slots object
|
|
2369
|
+
* @private
|
|
2413
2370
|
*/
|
|
2414
|
-
function
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
}
|
|
2423
|
-
else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
2424
|
-
{
|
|
2425
|
-
resolved = base;
|
|
2371
|
+
function createSlots(slots, dynamicSlots) {
|
|
2372
|
+
for (let i = 0; i < dynamicSlots.length; i++) {
|
|
2373
|
+
const slot = dynamicSlots[i];
|
|
2374
|
+
// array of dynamic slot generated by <template v-for="..." #[...]>
|
|
2375
|
+
if (shared.isArray(slot)) {
|
|
2376
|
+
for (let j = 0; j < slot.length; j++) {
|
|
2377
|
+
slots[slot[j].name] = slot[j].fn;
|
|
2378
|
+
}
|
|
2426
2379
|
}
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
if (globalMixins.length) {
|
|
2431
|
-
globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
2380
|
+
else if (slot) {
|
|
2381
|
+
// conditional single slot generated by <template v-if="..." #foo>
|
|
2382
|
+
slots[slot.name] = slot.fn;
|
|
2432
2383
|
}
|
|
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
2384
|
}
|
|
2443
|
-
|
|
2444
|
-
|
|
2385
|
+
return slots;
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
/**
|
|
2389
|
+
* Compiler runtime helper for rendering `<slot/>`
|
|
2390
|
+
* @private
|
|
2391
|
+
*/
|
|
2392
|
+
function renderSlot(slots, name, props = {},
|
|
2393
|
+
// this is not a user-facing function, so the fallback is always generated by
|
|
2394
|
+
// the compiler and guaranteed to be a function returning an array
|
|
2395
|
+
fallback, noSlotted) {
|
|
2396
|
+
if (currentRenderingInstance.isCE ||
|
|
2397
|
+
(currentRenderingInstance.parent &&
|
|
2398
|
+
isAsyncWrapper(currentRenderingInstance.parent) &&
|
|
2399
|
+
currentRenderingInstance.parent.isCE)) {
|
|
2400
|
+
return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
|
|
2445
2401
|
}
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2402
|
+
let slot = slots[name];
|
|
2403
|
+
// a compiled slot disables block tracking by default to avoid manual
|
|
2404
|
+
// invocation interfering with template-based block tracking, but in
|
|
2405
|
+
// `renderSlot` we can be sure that it's template-based so we can force
|
|
2406
|
+
// enable it.
|
|
2407
|
+
if (slot && slot._c) {
|
|
2408
|
+
slot._d = false;
|
|
2452
2409
|
}
|
|
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;
|
|
2410
|
+
openBlock();
|
|
2411
|
+
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
2412
|
+
const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
|
|
2413
|
+
? 64 /* STABLE_FRAGMENT */
|
|
2414
|
+
: -2 /* BAIL */);
|
|
2415
|
+
if (!noSlotted && rendered.scopeId) {
|
|
2416
|
+
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
2489
2417
|
}
|
|
2490
|
-
if (
|
|
2491
|
-
|
|
2418
|
+
if (slot && slot._c) {
|
|
2419
|
+
slot._d = true;
|
|
2492
2420
|
}
|
|
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));
|
|
2421
|
+
return rendered;
|
|
2499
2422
|
}
|
|
2500
|
-
function
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2423
|
+
function ensureValidVNode(vnodes) {
|
|
2424
|
+
return vnodes.some(child => {
|
|
2425
|
+
if (!isVNode(child))
|
|
2426
|
+
return true;
|
|
2427
|
+
if (child.type === Comment)
|
|
2428
|
+
return false;
|
|
2429
|
+
if (child.type === Fragment &&
|
|
2430
|
+
!ensureValidVNode(child.children))
|
|
2431
|
+
return false;
|
|
2432
|
+
return true;
|
|
2433
|
+
})
|
|
2434
|
+
? vnodes
|
|
2435
|
+
: null;
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
/**
|
|
2439
|
+
* For prefixing keys in v-on="obj" with "on"
|
|
2440
|
+
* @private
|
|
2441
|
+
*/
|
|
2442
|
+
function toHandlers(obj) {
|
|
2443
|
+
const ret = {};
|
|
2444
|
+
for (const key in obj) {
|
|
2445
|
+
ret[shared.toHandlerKey(key)] = obj[key];
|
|
2507
2446
|
}
|
|
2508
|
-
return
|
|
2509
|
-
}
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2447
|
+
return ret;
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
/**
|
|
2451
|
+
* #2437 In Vue 3, functional components do not have a public instance proxy but
|
|
2452
|
+
* they exist in the internal parent chain. For code that relies on traversing
|
|
2453
|
+
* public $parent chains, skip functional ones and go to the parent instead.
|
|
2454
|
+
*/
|
|
2455
|
+
const getPublicInstance = (i) => {
|
|
2456
|
+
if (!i)
|
|
2457
|
+
return null;
|
|
2458
|
+
if (isStatefulComponent(i))
|
|
2459
|
+
return getExposeProxy(i) || i.proxy;
|
|
2460
|
+
return getPublicInstance(i.parent);
|
|
2461
|
+
};
|
|
2462
|
+
const publicPropertiesMap =
|
|
2463
|
+
// Move PURE marker to new line to workaround compiler discarding it
|
|
2464
|
+
// due to type annotation
|
|
2465
|
+
/*#__PURE__*/ shared.extend(Object.create(null), {
|
|
2466
|
+
$: i => i,
|
|
2467
|
+
$el: i => i.vnode.el,
|
|
2468
|
+
$data: i => i.data,
|
|
2469
|
+
$props: i => (i.props),
|
|
2470
|
+
$attrs: i => (i.attrs),
|
|
2471
|
+
$slots: i => (i.slots),
|
|
2472
|
+
$refs: i => (i.refs),
|
|
2473
|
+
$parent: i => getPublicInstance(i.parent),
|
|
2474
|
+
$root: i => getPublicInstance(i.root),
|
|
2475
|
+
$emit: i => i.emit,
|
|
2476
|
+
$options: i => (resolveMergedOptions(i) ),
|
|
2477
|
+
$forceUpdate: i => i.f || (i.f = () => queueJob(i.update)),
|
|
2478
|
+
$nextTick: i => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
2479
|
+
$watch: i => (instanceWatch.bind(i) )
|
|
2480
|
+
});
|
|
2481
|
+
const PublicInstanceProxyHandlers = {
|
|
2482
|
+
get({ _: instance }, key) {
|
|
2483
|
+
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
|
2484
|
+
// data / props / ctx
|
|
2485
|
+
// This getter gets called for every property access on the render context
|
|
2486
|
+
// during render and is a major hotspot. The most expensive part of this
|
|
2487
|
+
// is the multiple hasOwn() calls. It's much faster to do a simple property
|
|
2488
|
+
// access on a plain object, so we use an accessCache object (with null
|
|
2489
|
+
// prototype) to memoize what access type a key corresponds to.
|
|
2490
|
+
let normalizedProps;
|
|
2491
|
+
if (key[0] !== '$') {
|
|
2492
|
+
const n = accessCache[key];
|
|
2493
|
+
if (n !== undefined) {
|
|
2494
|
+
switch (n) {
|
|
2495
|
+
case 1 /* SETUP */:
|
|
2496
|
+
return setupState[key];
|
|
2497
|
+
case 2 /* DATA */:
|
|
2498
|
+
return data[key];
|
|
2499
|
+
case 4 /* CONTEXT */:
|
|
2500
|
+
return ctx[key];
|
|
2501
|
+
case 3 /* PROPS */:
|
|
2502
|
+
return props[key];
|
|
2503
|
+
// default: just fallthrough
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
|
|
2507
|
+
accessCache[key] = 1 /* SETUP */;
|
|
2508
|
+
return setupState[key];
|
|
2509
|
+
}
|
|
2510
|
+
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
2511
|
+
accessCache[key] = 2 /* DATA */;
|
|
2512
|
+
return data[key];
|
|
2513
|
+
}
|
|
2514
|
+
else if (
|
|
2515
|
+
// only cache other properties when instance has declared (thus stable)
|
|
2516
|
+
// props
|
|
2517
|
+
(normalizedProps = instance.propsOptions[0]) &&
|
|
2518
|
+
shared.hasOwn(normalizedProps, key)) {
|
|
2519
|
+
accessCache[key] = 3 /* PROPS */;
|
|
2520
|
+
return props[key];
|
|
2521
|
+
}
|
|
2522
|
+
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
2523
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
2524
|
+
return ctx[key];
|
|
2525
|
+
}
|
|
2526
|
+
else if (shouldCacheAccess) {
|
|
2527
|
+
accessCache[key] = 0 /* OTHER */;
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
const publicGetter = publicPropertiesMap[key];
|
|
2531
|
+
let cssModule, globalProperties;
|
|
2532
|
+
// public $xxx properties
|
|
2533
|
+
if (publicGetter) {
|
|
2534
|
+
if (key === '$attrs') {
|
|
2535
|
+
reactivity.track(instance, "get" /* GET */, key);
|
|
2536
|
+
}
|
|
2537
|
+
return publicGetter(instance);
|
|
2538
|
+
}
|
|
2539
|
+
else if (
|
|
2540
|
+
// css module (injected by vue-loader)
|
|
2541
|
+
(cssModule = type.__cssModules) &&
|
|
2542
|
+
(cssModule = cssModule[key])) {
|
|
2543
|
+
return cssModule;
|
|
2544
|
+
}
|
|
2545
|
+
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
2546
|
+
// user may set custom properties to `this` that start with `$`
|
|
2547
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
2548
|
+
return ctx[key];
|
|
2549
|
+
}
|
|
2550
|
+
else if (
|
|
2551
|
+
// global properties
|
|
2552
|
+
((globalProperties = appContext.config.globalProperties),
|
|
2553
|
+
shared.hasOwn(globalProperties, key))) {
|
|
2554
|
+
{
|
|
2555
|
+
return globalProperties[key];
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
else ;
|
|
2559
|
+
},
|
|
2560
|
+
set({ _: instance }, key, value) {
|
|
2561
|
+
const { data, setupState, ctx } = instance;
|
|
2562
|
+
if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
|
|
2563
|
+
setupState[key] = value;
|
|
2564
|
+
return true;
|
|
2565
|
+
}
|
|
2566
|
+
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
2567
|
+
data[key] = value;
|
|
2568
|
+
return true;
|
|
2569
|
+
}
|
|
2570
|
+
else if (shared.hasOwn(instance.props, key)) {
|
|
2571
|
+
return false;
|
|
2572
|
+
}
|
|
2573
|
+
if (key[0] === '$' && key.slice(1) in instance) {
|
|
2574
|
+
return false;
|
|
2575
|
+
}
|
|
2576
|
+
else {
|
|
2577
|
+
{
|
|
2578
|
+
ctx[key] = value;
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
return true;
|
|
2582
|
+
},
|
|
2583
|
+
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
2584
|
+
let normalizedProps;
|
|
2585
|
+
return (!!accessCache[key] ||
|
|
2586
|
+
(data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
|
|
2587
|
+
(setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
|
|
2588
|
+
((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
|
|
2589
|
+
shared.hasOwn(ctx, key) ||
|
|
2590
|
+
shared.hasOwn(publicPropertiesMap, key) ||
|
|
2591
|
+
shared.hasOwn(appContext.config.globalProperties, key));
|
|
2592
|
+
},
|
|
2593
|
+
defineProperty(target, key, descriptor) {
|
|
2594
|
+
if (descriptor.get != null) {
|
|
2595
|
+
// invalidate key cache of a getter based property #5417
|
|
2596
|
+
target._.accessCache[key] = 0;
|
|
2597
|
+
}
|
|
2598
|
+
else if (shared.hasOwn(descriptor, 'value')) {
|
|
2599
|
+
this.set(target, key, descriptor.value, null);
|
|
2600
|
+
}
|
|
2601
|
+
return Reflect.defineProperty(target, key, descriptor);
|
|
2602
|
+
}
|
|
2603
|
+
};
|
|
2604
|
+
const RuntimeCompiledPublicInstanceProxyHandlers = /*#__PURE__*/ shared.extend({}, PublicInstanceProxyHandlers, {
|
|
2605
|
+
get(target, key) {
|
|
2606
|
+
// fast path for unscopables when using `with` block
|
|
2607
|
+
if (key === Symbol.unscopables) {
|
|
2608
|
+
return;
|
|
2609
|
+
}
|
|
2610
|
+
return PublicInstanceProxyHandlers.get(target, key, target);
|
|
2611
|
+
},
|
|
2612
|
+
has(_, key) {
|
|
2613
|
+
const has = key[0] !== '_' && !shared.isGloballyWhitelisted(key);
|
|
2614
|
+
return has;
|
|
2615
|
+
}
|
|
2616
|
+
});
|
|
2617
|
+
|
|
2618
|
+
let shouldCacheAccess = true;
|
|
2619
|
+
function applyOptions(instance) {
|
|
2620
|
+
const options = resolveMergedOptions(instance);
|
|
2621
|
+
const publicThis = instance.proxy;
|
|
2622
|
+
const ctx = instance.ctx;
|
|
2623
|
+
// do not cache property access on public proxy during state initialization
|
|
2624
|
+
shouldCacheAccess = false;
|
|
2625
|
+
// call beforeCreate first before accessing other options since
|
|
2626
|
+
// the hook may mutate resolved options (#2791)
|
|
2627
|
+
if (options.beforeCreate) {
|
|
2628
|
+
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
2629
|
+
}
|
|
2630
|
+
const {
|
|
2631
|
+
// state
|
|
2632
|
+
data: dataOptions, computed: computedOptions, methods, watch: watchOptions, provide: provideOptions, inject: injectOptions,
|
|
2633
|
+
// lifecycle
|
|
2634
|
+
created, beforeMount, mounted, beforeUpdate, updated, activated, deactivated, beforeDestroy, beforeUnmount, destroyed, unmounted, render, renderTracked, renderTriggered, errorCaptured, serverPrefetch,
|
|
2635
|
+
// public API
|
|
2636
|
+
expose, inheritAttrs,
|
|
2637
|
+
// assets
|
|
2638
|
+
components, directives, filters } = options;
|
|
2639
|
+
const checkDuplicateProperties = null;
|
|
2640
|
+
// options initialization order (to be consistent with Vue 2):
|
|
2641
|
+
// - props (already done outside of this function)
|
|
2642
|
+
// - inject
|
|
2643
|
+
// - methods
|
|
2644
|
+
// - data (deferred since it relies on `this` access)
|
|
2645
|
+
// - computed
|
|
2646
|
+
// - watch (deferred since it relies on `this` access)
|
|
2647
|
+
if (injectOptions) {
|
|
2648
|
+
resolveInjections(injectOptions, ctx, checkDuplicateProperties, instance.appContext.config.unwrapInjectedRef);
|
|
2649
|
+
}
|
|
2650
|
+
if (methods) {
|
|
2651
|
+
for (const key in methods) {
|
|
2652
|
+
const methodHandler = methods[key];
|
|
2653
|
+
if (shared.isFunction(methodHandler)) {
|
|
2654
|
+
// In dev mode, we use the `createRenderContext` function to define
|
|
2655
|
+
// methods to the proxy target, and those are read-only but
|
|
2656
|
+
// reconfigurable, so it needs to be redefined here
|
|
2657
|
+
{
|
|
2658
|
+
ctx[key] = methodHandler.bind(publicThis);
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
if (dataOptions) {
|
|
2664
|
+
const data = dataOptions.call(publicThis, publicThis);
|
|
2665
|
+
if (!shared.isObject(data)) ;
|
|
2666
|
+
else {
|
|
2667
|
+
instance.data = reactivity.reactive(data);
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
// state initialization complete at this point - start caching access
|
|
2671
|
+
shouldCacheAccess = true;
|
|
2672
|
+
if (computedOptions) {
|
|
2673
|
+
for (const key in computedOptions) {
|
|
2674
|
+
const opt = computedOptions[key];
|
|
2675
|
+
const get = shared.isFunction(opt)
|
|
2676
|
+
? opt.bind(publicThis, publicThis)
|
|
2677
|
+
: shared.isFunction(opt.get)
|
|
2678
|
+
? opt.get.bind(publicThis, publicThis)
|
|
2679
|
+
: shared.NOOP;
|
|
2680
|
+
const set = !shared.isFunction(opt) && shared.isFunction(opt.set)
|
|
2681
|
+
? opt.set.bind(publicThis)
|
|
2682
|
+
: shared.NOOP;
|
|
2683
|
+
const c = computed({
|
|
2684
|
+
get,
|
|
2685
|
+
set
|
|
2686
|
+
});
|
|
2687
|
+
Object.defineProperty(ctx, key, {
|
|
2688
|
+
enumerable: true,
|
|
2689
|
+
configurable: true,
|
|
2690
|
+
get: () => c.value,
|
|
2691
|
+
set: v => (c.value = v)
|
|
2692
|
+
});
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
if (watchOptions) {
|
|
2696
|
+
for (const key in watchOptions) {
|
|
2697
|
+
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
if (provideOptions) {
|
|
2701
|
+
const provides = shared.isFunction(provideOptions)
|
|
2702
|
+
? provideOptions.call(publicThis)
|
|
2703
|
+
: provideOptions;
|
|
2704
|
+
Reflect.ownKeys(provides).forEach(key => {
|
|
2705
|
+
provide(key, provides[key]);
|
|
2706
|
+
});
|
|
2707
|
+
}
|
|
2708
|
+
if (created) {
|
|
2709
|
+
callHook(created, instance, "c" /* CREATED */);
|
|
2710
|
+
}
|
|
2711
|
+
function registerLifecycleHook(register, hook) {
|
|
2712
|
+
if (shared.isArray(hook)) {
|
|
2713
|
+
hook.forEach(_hook => register(_hook.bind(publicThis)));
|
|
2714
|
+
}
|
|
2715
|
+
else if (hook) {
|
|
2716
|
+
register(hook.bind(publicThis));
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
registerLifecycleHook(onBeforeMount, beforeMount);
|
|
2720
|
+
registerLifecycleHook(onMounted, mounted);
|
|
2721
|
+
registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
|
2722
|
+
registerLifecycleHook(onUpdated, updated);
|
|
2723
|
+
registerLifecycleHook(onActivated, activated);
|
|
2724
|
+
registerLifecycleHook(onDeactivated, deactivated);
|
|
2725
|
+
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
|
2726
|
+
registerLifecycleHook(onRenderTracked, renderTracked);
|
|
2727
|
+
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
|
2728
|
+
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
|
2729
|
+
registerLifecycleHook(onUnmounted, unmounted);
|
|
2730
|
+
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
2731
|
+
if (shared.isArray(expose)) {
|
|
2732
|
+
if (expose.length) {
|
|
2733
|
+
const exposed = instance.exposed || (instance.exposed = {});
|
|
2734
|
+
expose.forEach(key => {
|
|
2735
|
+
Object.defineProperty(exposed, key, {
|
|
2736
|
+
get: () => publicThis[key],
|
|
2737
|
+
set: val => (publicThis[key] = val)
|
|
2738
|
+
});
|
|
2739
|
+
});
|
|
2740
|
+
}
|
|
2741
|
+
else if (!instance.exposed) {
|
|
2742
|
+
instance.exposed = {};
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
// options that are handled when creating the instance but also need to be
|
|
2746
|
+
// applied from mixins
|
|
2747
|
+
if (render && instance.render === shared.NOOP) {
|
|
2748
|
+
instance.render = render;
|
|
2749
|
+
}
|
|
2750
|
+
if (inheritAttrs != null) {
|
|
2751
|
+
instance.inheritAttrs = inheritAttrs;
|
|
2752
|
+
}
|
|
2753
|
+
// asset options.
|
|
2754
|
+
if (components)
|
|
2755
|
+
instance.components = components;
|
|
2756
|
+
if (directives)
|
|
2757
|
+
instance.directives = directives;
|
|
2758
|
+
}
|
|
2759
|
+
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP, unwrapRef = false) {
|
|
2760
|
+
if (shared.isArray(injectOptions)) {
|
|
2761
|
+
injectOptions = normalizeInject(injectOptions);
|
|
2762
|
+
}
|
|
2763
|
+
for (const key in injectOptions) {
|
|
2764
|
+
const opt = injectOptions[key];
|
|
2765
|
+
let injected;
|
|
2766
|
+
if (shared.isObject(opt)) {
|
|
2767
|
+
if ('default' in opt) {
|
|
2768
|
+
injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
|
|
2769
|
+
}
|
|
2770
|
+
else {
|
|
2771
|
+
injected = inject(opt.from || key);
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
else {
|
|
2775
|
+
injected = inject(opt);
|
|
2776
|
+
}
|
|
2777
|
+
if (reactivity.isRef(injected)) {
|
|
2778
|
+
// TODO remove the check in 3.3
|
|
2779
|
+
if (unwrapRef) {
|
|
2780
|
+
Object.defineProperty(ctx, key, {
|
|
2781
|
+
enumerable: true,
|
|
2782
|
+
configurable: true,
|
|
2783
|
+
get: () => injected.value,
|
|
2784
|
+
set: v => (injected.value = v)
|
|
2785
|
+
});
|
|
2786
|
+
}
|
|
2787
|
+
else {
|
|
2788
|
+
ctx[key] = injected;
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
else {
|
|
2792
|
+
ctx[key] = injected;
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2796
|
+
function callHook(hook, instance, type) {
|
|
2797
|
+
callWithAsyncErrorHandling(shared.isArray(hook)
|
|
2798
|
+
? hook.map(h => h.bind(instance.proxy))
|
|
2799
|
+
: hook.bind(instance.proxy), instance, type);
|
|
2800
|
+
}
|
|
2801
|
+
function createWatcher(raw, ctx, publicThis, key) {
|
|
2802
|
+
const getter = key.includes('.')
|
|
2803
|
+
? createPathGetter(publicThis, key)
|
|
2804
|
+
: () => publicThis[key];
|
|
2805
|
+
if (shared.isString(raw)) {
|
|
2806
|
+
const handler = ctx[raw];
|
|
2807
|
+
if (shared.isFunction(handler)) {
|
|
2808
|
+
watch(getter, handler);
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
else if (shared.isFunction(raw)) {
|
|
2812
|
+
watch(getter, raw.bind(publicThis));
|
|
2813
|
+
}
|
|
2814
|
+
else if (shared.isObject(raw)) {
|
|
2815
|
+
if (shared.isArray(raw)) {
|
|
2816
|
+
raw.forEach(r => createWatcher(r, ctx, publicThis, key));
|
|
2817
|
+
}
|
|
2818
|
+
else {
|
|
2819
|
+
const handler = shared.isFunction(raw.handler)
|
|
2820
|
+
? raw.handler.bind(publicThis)
|
|
2821
|
+
: ctx[raw.handler];
|
|
2822
|
+
if (shared.isFunction(handler)) {
|
|
2823
|
+
watch(getter, handler, raw);
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
else ;
|
|
2828
|
+
}
|
|
2829
|
+
/**
|
|
2830
|
+
* Resolve merged options and cache it on the component.
|
|
2831
|
+
* This is done only once per-component since the merging does not involve
|
|
2832
|
+
* instances.
|
|
2833
|
+
*/
|
|
2834
|
+
function resolveMergedOptions(instance) {
|
|
2835
|
+
const base = instance.type;
|
|
2836
|
+
const { mixins, extends: extendsOptions } = base;
|
|
2837
|
+
const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;
|
|
2838
|
+
const cached = cache.get(base);
|
|
2839
|
+
let resolved;
|
|
2840
|
+
if (cached) {
|
|
2841
|
+
resolved = cached;
|
|
2842
|
+
}
|
|
2843
|
+
else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
2844
|
+
{
|
|
2845
|
+
resolved = base;
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
else {
|
|
2849
|
+
resolved = {};
|
|
2850
|
+
if (globalMixins.length) {
|
|
2851
|
+
globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
2852
|
+
}
|
|
2853
|
+
mergeOptions(resolved, base, optionMergeStrategies);
|
|
2854
|
+
}
|
|
2855
|
+
cache.set(base, resolved);
|
|
2856
|
+
return resolved;
|
|
2857
|
+
}
|
|
2858
|
+
function mergeOptions(to, from, strats, asMixin = false) {
|
|
2859
|
+
const { mixins, extends: extendsOptions } = from;
|
|
2860
|
+
if (extendsOptions) {
|
|
2861
|
+
mergeOptions(to, extendsOptions, strats, true);
|
|
2862
|
+
}
|
|
2863
|
+
if (mixins) {
|
|
2864
|
+
mixins.forEach((m) => mergeOptions(to, m, strats, true));
|
|
2865
|
+
}
|
|
2866
|
+
for (const key in from) {
|
|
2867
|
+
if (asMixin && key === 'expose') ;
|
|
2868
|
+
else {
|
|
2869
|
+
const strat = internalOptionMergeStrats[key] || (strats && strats[key]);
|
|
2870
|
+
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
return to;
|
|
2874
|
+
}
|
|
2875
|
+
const internalOptionMergeStrats = {
|
|
2876
|
+
data: mergeDataFn,
|
|
2877
|
+
props: mergeObjectOptions,
|
|
2878
|
+
emits: mergeObjectOptions,
|
|
2879
|
+
// objects
|
|
2880
|
+
methods: mergeObjectOptions,
|
|
2881
|
+
computed: mergeObjectOptions,
|
|
2882
|
+
// lifecycle
|
|
2883
|
+
beforeCreate: mergeAsArray,
|
|
2884
|
+
created: mergeAsArray,
|
|
2885
|
+
beforeMount: mergeAsArray,
|
|
2886
|
+
mounted: mergeAsArray,
|
|
2887
|
+
beforeUpdate: mergeAsArray,
|
|
2888
|
+
updated: mergeAsArray,
|
|
2889
|
+
beforeDestroy: mergeAsArray,
|
|
2890
|
+
beforeUnmount: mergeAsArray,
|
|
2891
|
+
destroyed: mergeAsArray,
|
|
2892
|
+
unmounted: mergeAsArray,
|
|
2893
|
+
activated: mergeAsArray,
|
|
2894
|
+
deactivated: mergeAsArray,
|
|
2895
|
+
errorCaptured: mergeAsArray,
|
|
2896
|
+
serverPrefetch: mergeAsArray,
|
|
2897
|
+
// assets
|
|
2898
|
+
components: mergeObjectOptions,
|
|
2899
|
+
directives: mergeObjectOptions,
|
|
2900
|
+
// watch
|
|
2901
|
+
watch: mergeWatchOptions,
|
|
2902
|
+
// provide / inject
|
|
2903
|
+
provide: mergeDataFn,
|
|
2904
|
+
inject: mergeInject
|
|
2905
|
+
};
|
|
2906
|
+
function mergeDataFn(to, from) {
|
|
2907
|
+
if (!from) {
|
|
2908
|
+
return to;
|
|
2909
|
+
}
|
|
2910
|
+
if (!to) {
|
|
2911
|
+
return from;
|
|
2912
|
+
}
|
|
2913
|
+
return function mergedDataFn() {
|
|
2914
|
+
return (shared.extend)(shared.isFunction(to) ? to.call(this, this) : to, shared.isFunction(from) ? from.call(this, this) : from);
|
|
2915
|
+
};
|
|
2916
|
+
}
|
|
2917
|
+
function mergeInject(to, from) {
|
|
2918
|
+
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
2919
|
+
}
|
|
2920
|
+
function normalizeInject(raw) {
|
|
2921
|
+
if (shared.isArray(raw)) {
|
|
2922
|
+
const res = {};
|
|
2923
|
+
for (let i = 0; i < raw.length; i++) {
|
|
2924
|
+
res[raw[i]] = raw[i];
|
|
2925
|
+
}
|
|
2926
|
+
return res;
|
|
2927
|
+
}
|
|
2928
|
+
return raw;
|
|
2929
|
+
}
|
|
2930
|
+
function mergeAsArray(to, from) {
|
|
2931
|
+
return to ? [...new Set([].concat(to, from))] : from;
|
|
2932
|
+
}
|
|
2933
|
+
function mergeObjectOptions(to, from) {
|
|
2514
2934
|
return to ? shared.extend(shared.extend(Object.create(null), to), from) : from;
|
|
2515
2935
|
}
|
|
2516
2936
|
function mergeWatchOptions(to, from) {
|
|
@@ -2818,6 +3238,10 @@ const normalizeSlotValue = (value) => shared.isArray(value)
|
|
|
2818
3238
|
? value.map(normalizeVNode)
|
|
2819
3239
|
: [normalizeVNode(value)];
|
|
2820
3240
|
const normalizeSlot = (key, rawSlot, ctx) => {
|
|
3241
|
+
if (rawSlot._n) {
|
|
3242
|
+
// already normalized - #5353
|
|
3243
|
+
return rawSlot;
|
|
3244
|
+
}
|
|
2821
3245
|
const normalized = withCtx((...args) => {
|
|
2822
3246
|
return normalizeSlotValue(rawSlot(...args));
|
|
2823
3247
|
}, ctx);
|
|
@@ -2912,75 +3336,6 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
2912
3336
|
}
|
|
2913
3337
|
};
|
|
2914
3338
|
|
|
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
3339
|
function createAppContext() {
|
|
2985
3340
|
return {
|
|
2986
3341
|
app: null,
|
|
@@ -3006,7 +3361,7 @@ let uid = 0;
|
|
|
3006
3361
|
function createAppAPI(render, hydrate) {
|
|
3007
3362
|
return function createApp(rootComponent, rootProps = null) {
|
|
3008
3363
|
if (!shared.isFunction(rootComponent)) {
|
|
3009
|
-
rootComponent =
|
|
3364
|
+
rootComponent = { ...rootComponent };
|
|
3010
3365
|
}
|
|
3011
3366
|
if (rootProps != null && !shared.isObject(rootProps)) {
|
|
3012
3367
|
rootProps = null;
|
|
@@ -3087,8 +3442,6 @@ function createAppAPI(render, hydrate) {
|
|
|
3087
3442
|
}
|
|
3088
3443
|
},
|
|
3089
3444
|
provide(key, value) {
|
|
3090
|
-
// TypeScript doesn't allow symbols as index type
|
|
3091
|
-
// https://github.com/Microsoft/TypeScript/issues/24587
|
|
3092
3445
|
context.provides[key] = value;
|
|
3093
3446
|
return app;
|
|
3094
3447
|
}
|
|
@@ -3213,9 +3566,13 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3213
3566
|
const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
|
3214
3567
|
const isFragmentStart = isComment(node) && node.data === '[';
|
|
3215
3568
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
3216
|
-
const { type, ref, shapeFlag } = vnode;
|
|
3569
|
+
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
3217
3570
|
const domType = node.nodeType;
|
|
3218
3571
|
vnode.el = node;
|
|
3572
|
+
if (patchFlag === -2 /* BAIL */) {
|
|
3573
|
+
optimized = false;
|
|
3574
|
+
vnode.dynamicChildren = null;
|
|
3575
|
+
}
|
|
3219
3576
|
let nextNode = null;
|
|
3220
3577
|
switch (type) {
|
|
3221
3578
|
case Text:
|
|
@@ -3872,6 +4229,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3872
4229
|
else {
|
|
3873
4230
|
if (patchFlag > 0 &&
|
|
3874
4231
|
patchFlag & 64 /* STABLE_FRAGMENT */ &&
|
|
4232
|
+
// #5523 dev root fragment may inherit directives so always force update
|
|
4233
|
+
!(false /* DEV_ROOT_FRAGMENT */) &&
|
|
3875
4234
|
dynamicChildren &&
|
|
3876
4235
|
// #2715 the previous fragment could've been a BAILed one as a result
|
|
3877
4236
|
// of renderSlot() with no valid children
|
|
@@ -3956,7 +4315,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3956
4315
|
}
|
|
3957
4316
|
else {
|
|
3958
4317
|
// no update needed. just copy over properties
|
|
3959
|
-
n2.component = n1.component;
|
|
3960
4318
|
n2.el = n1.el;
|
|
3961
4319
|
instance.vnode = n2;
|
|
3962
4320
|
}
|
|
@@ -4015,7 +4373,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4015
4373
|
// activated hook for keep-alive roots.
|
|
4016
4374
|
// #1742 activated hook must be accessed after first render
|
|
4017
4375
|
// since the hook may be injected by a child keep-alive
|
|
4018
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */
|
|
4376
|
+
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
4377
|
+
(parent &&
|
|
4378
|
+
isAsyncWrapper(parent.vnode) &&
|
|
4379
|
+
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
4019
4380
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
4020
4381
|
}
|
|
4021
4382
|
instance.isMounted = true;
|
|
@@ -4073,9 +4434,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4073
4434
|
}
|
|
4074
4435
|
};
|
|
4075
4436
|
// create reactive effect for rendering
|
|
4076
|
-
const effect = (instance.effect = new reactivity.ReactiveEffect(componentUpdateFn, () => queueJob(
|
|
4437
|
+
const effect = (instance.effect = new reactivity.ReactiveEffect(componentUpdateFn, () => queueJob(update), instance.scope // track it in component's effect scope
|
|
4077
4438
|
));
|
|
4078
|
-
const update = (instance.update = effect.run
|
|
4439
|
+
const update = (instance.update = () => effect.run());
|
|
4079
4440
|
update.id = instance.uid;
|
|
4080
4441
|
// allowRecurse
|
|
4081
4442
|
// #1801, #2043 component render effects should allow recursive updates
|
|
@@ -4810,85 +5171,23 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
4810
5171
|
// if multiple teleports rendered to the same target element, we need to
|
|
4811
5172
|
// pick up from where the last teleport finished instead of the first node
|
|
4812
5173
|
const targetNode = target._lpa || target.firstChild;
|
|
4813
|
-
if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
4814
|
-
if (isTeleportDisabled(vnode.props)) {
|
|
4815
|
-
vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
4816
|
-
vnode.targetAnchor = targetNode;
|
|
4817
|
-
}
|
|
4818
|
-
else {
|
|
4819
|
-
vnode.anchor = nextSibling(node);
|
|
4820
|
-
vnode.targetAnchor = hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
4821
|
-
}
|
|
4822
|
-
target._lpa =
|
|
4823
|
-
vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
|
4824
|
-
}
|
|
4825
|
-
}
|
|
4826
|
-
return vnode.anchor && nextSibling(vnode.anchor);
|
|
4827
|
-
}
|
|
4828
|
-
// Force-casted public typing for h and TSX props inference
|
|
4829
|
-
const Teleport = TeleportImpl;
|
|
4830
|
-
|
|
4831
|
-
const COMPONENTS = 'components';
|
|
4832
|
-
const DIRECTIVES = 'directives';
|
|
4833
|
-
/**
|
|
4834
|
-
* @private
|
|
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;
|
|
4871
|
-
}
|
|
4872
|
-
}
|
|
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;
|
|
5174
|
+
if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5175
|
+
if (isTeleportDisabled(vnode.props)) {
|
|
5176
|
+
vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
5177
|
+
vnode.targetAnchor = targetNode;
|
|
5178
|
+
}
|
|
5179
|
+
else {
|
|
5180
|
+
vnode.anchor = nextSibling(node);
|
|
5181
|
+
vnode.targetAnchor = hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
5182
|
+
}
|
|
5183
|
+
target._lpa =
|
|
5184
|
+
vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
|
4882
5185
|
}
|
|
4883
|
-
return res;
|
|
4884
5186
|
}
|
|
5187
|
+
return vnode.anchor && nextSibling(vnode.anchor);
|
|
4885
5188
|
}
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
(registry[name] ||
|
|
4889
|
-
registry[shared.camelize(name)] ||
|
|
4890
|
-
registry[shared.capitalize(shared.camelize(name))]));
|
|
4891
|
-
}
|
|
5189
|
+
// Force-casted public typing for h and TSX props inference
|
|
5190
|
+
const Teleport = TeleportImpl;
|
|
4892
5191
|
|
|
4893
5192
|
const Fragment = Symbol(undefined);
|
|
4894
5193
|
const Text = Symbol(undefined);
|
|
@@ -5073,6 +5372,15 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5073
5372
|
if (children) {
|
|
5074
5373
|
normalizeChildren(cloned, children);
|
|
5075
5374
|
}
|
|
5375
|
+
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
5376
|
+
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
5377
|
+
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
5378
|
+
}
|
|
5379
|
+
else {
|
|
5380
|
+
currentBlock.push(cloned);
|
|
5381
|
+
}
|
|
5382
|
+
}
|
|
5383
|
+
cloned.patchFlag |= -2 /* BAIL */;
|
|
5076
5384
|
return cloned;
|
|
5077
5385
|
}
|
|
5078
5386
|
// class component normalization.
|
|
@@ -5208,408 +5516,117 @@ function normalizeVNode(child) {
|
|
|
5208
5516
|
// fragment
|
|
5209
5517
|
return createVNode(Fragment, null,
|
|
5210
5518
|
// #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];
|
|
5519
|
+
child.slice());
|
|
5442
5520
|
}
|
|
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 */;
|
|
5521
|
+
else if (typeof child === 'object') {
|
|
5522
|
+
// already vnode, this should be the most common since compiled templates
|
|
5523
|
+
// always produce all-vnode children arrays
|
|
5524
|
+
return cloneIfMounted(child);
|
|
5525
|
+
}
|
|
5526
|
+
else {
|
|
5527
|
+
// strings and numbers
|
|
5528
|
+
return createVNode(Text, null, String(child));
|
|
5529
|
+
}
|
|
5530
|
+
}
|
|
5531
|
+
// optimized normalization for template-compiled render fns
|
|
5532
|
+
function cloneIfMounted(child) {
|
|
5533
|
+
return child.el === null || child.memo ? child : cloneVNode(child);
|
|
5534
|
+
}
|
|
5535
|
+
function normalizeChildren(vnode, children) {
|
|
5536
|
+
let type = 0;
|
|
5537
|
+
const { shapeFlag } = vnode;
|
|
5538
|
+
if (children == null) {
|
|
5539
|
+
children = null;
|
|
5540
|
+
}
|
|
5541
|
+
else if (shared.isArray(children)) {
|
|
5542
|
+
type = 16 /* ARRAY_CHILDREN */;
|
|
5543
|
+
}
|
|
5544
|
+
else if (typeof children === 'object') {
|
|
5545
|
+
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
5546
|
+
// Normalize slot to plain children for plain element and Teleport
|
|
5547
|
+
const slot = children.default;
|
|
5548
|
+
if (slot) {
|
|
5549
|
+
// _c marker is added by withCtx() indicating this is a compiled slot
|
|
5550
|
+
slot._c && (slot._d = false);
|
|
5551
|
+
normalizeChildren(vnode, slot());
|
|
5552
|
+
slot._c && (slot._d = true);
|
|
5524
5553
|
}
|
|
5554
|
+
return;
|
|
5525
5555
|
}
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
reactivity.track(instance, "get" /* GET */, key);
|
|
5556
|
+
else {
|
|
5557
|
+
type = 32 /* SLOTS_CHILDREN */;
|
|
5558
|
+
const slotFlag = children._;
|
|
5559
|
+
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
5560
|
+
children._ctx = currentRenderingInstance;
|
|
5532
5561
|
}
|
|
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];
|
|
5562
|
+
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
5563
|
+
// a child component receives forwarded slots from the parent.
|
|
5564
|
+
// its slot type is determined by its parent's slot type.
|
|
5565
|
+
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
5566
|
+
children._ = 1 /* STABLE */;
|
|
5567
|
+
}
|
|
5568
|
+
else {
|
|
5569
|
+
children._ = 2 /* DYNAMIC */;
|
|
5570
|
+
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
5571
|
+
}
|
|
5552
5572
|
}
|
|
5553
5573
|
}
|
|
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;
|
|
5574
|
+
}
|
|
5575
|
+
else if (shared.isFunction(children)) {
|
|
5576
|
+
children = { default: children, _ctx: currentRenderingInstance };
|
|
5577
|
+
type = 32 /* SLOTS_CHILDREN */;
|
|
5578
|
+
}
|
|
5579
|
+
else {
|
|
5580
|
+
children = String(children);
|
|
5581
|
+
// force teleport children to array so it can be moved around
|
|
5582
|
+
if (shapeFlag & 64 /* TELEPORT */) {
|
|
5583
|
+
type = 16 /* ARRAY_CHILDREN */;
|
|
5584
|
+
children = [createTextVNode(children)];
|
|
5571
5585
|
}
|
|
5572
5586
|
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);
|
|
5587
|
+
type = 8 /* TEXT_CHILDREN */;
|
|
5596
5588
|
}
|
|
5597
|
-
return Reflect.defineProperty(target, key, descriptor);
|
|
5598
5589
|
}
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5590
|
+
vnode.children = children;
|
|
5591
|
+
vnode.shapeFlag |= type;
|
|
5592
|
+
}
|
|
5593
|
+
function mergeProps(...args) {
|
|
5594
|
+
const ret = {};
|
|
5595
|
+
for (let i = 0; i < args.length; i++) {
|
|
5596
|
+
const toMerge = args[i];
|
|
5597
|
+
for (const key in toMerge) {
|
|
5598
|
+
if (key === 'class') {
|
|
5599
|
+
if (ret.class !== toMerge.class) {
|
|
5600
|
+
ret.class = shared.normalizeClass([ret.class, toMerge.class]);
|
|
5601
|
+
}
|
|
5602
|
+
}
|
|
5603
|
+
else if (key === 'style') {
|
|
5604
|
+
ret.style = shared.normalizeStyle([ret.style, toMerge.style]);
|
|
5605
|
+
}
|
|
5606
|
+
else if (shared.isOn(key)) {
|
|
5607
|
+
const existing = ret[key];
|
|
5608
|
+
const incoming = toMerge[key];
|
|
5609
|
+
if (incoming &&
|
|
5610
|
+
existing !== incoming &&
|
|
5611
|
+
!(shared.isArray(existing) && existing.includes(incoming))) {
|
|
5612
|
+
ret[key] = existing
|
|
5613
|
+
? [].concat(existing, incoming)
|
|
5614
|
+
: incoming;
|
|
5615
|
+
}
|
|
5616
|
+
}
|
|
5617
|
+
else if (key !== '') {
|
|
5618
|
+
ret[key] = toMerge[key];
|
|
5619
|
+
}
|
|
5605
5620
|
}
|
|
5606
|
-
return PublicInstanceProxyHandlers.get(target, key, target);
|
|
5607
|
-
},
|
|
5608
|
-
has(_, key) {
|
|
5609
|
-
const has = key[0] !== '_' && !shared.isGloballyWhitelisted(key);
|
|
5610
|
-
return has;
|
|
5611
5621
|
}
|
|
5612
|
-
|
|
5622
|
+
return ret;
|
|
5623
|
+
}
|
|
5624
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
5625
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
5626
|
+
vnode,
|
|
5627
|
+
prevVNode
|
|
5628
|
+
]);
|
|
5629
|
+
}
|
|
5613
5630
|
|
|
5614
5631
|
const emptyAppContext = createAppContext();
|
|
5615
5632
|
let uid$1 = 0;
|
|
@@ -5637,7 +5654,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
5637
5654
|
provides: parent ? parent.provides : Object.create(appContext.provides),
|
|
5638
5655
|
accessCache: null,
|
|
5639
5656
|
renderCache: [],
|
|
5640
|
-
// local
|
|
5657
|
+
// local resolved assets
|
|
5641
5658
|
components: null,
|
|
5642
5659
|
directives: null,
|
|
5643
5660
|
// resolved props and emits options
|
|
@@ -6103,7 +6120,7 @@ function isMemoSame(cached, memo) {
|
|
|
6103
6120
|
return false;
|
|
6104
6121
|
}
|
|
6105
6122
|
for (let i = 0; i < prev.length; i++) {
|
|
6106
|
-
if (prev[i]
|
|
6123
|
+
if (shared.hasChanged(prev[i], memo[i])) {
|
|
6107
6124
|
return false;
|
|
6108
6125
|
}
|
|
6109
6126
|
}
|
|
@@ -6115,7 +6132,7 @@ function isMemoSame(cached, memo) {
|
|
|
6115
6132
|
}
|
|
6116
6133
|
|
|
6117
6134
|
// Core API ------------------------------------------------------------------
|
|
6118
|
-
const version = "3.2.
|
|
6135
|
+
const version = "3.2.34-beta.1";
|
|
6119
6136
|
const _ssrUtils = {
|
|
6120
6137
|
createComponentInstance,
|
|
6121
6138
|
setupComponent,
|