@vue/runtime-core 3.2.31 → 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 +3272 -3194
- package/dist/runtime-core.cjs.prod.js +847 -796
- package/dist/runtime-core.d.ts +43 -29
- package/dist/runtime-core.esm-bundler.js +2739 -2658
- package/package.json +3 -3
|
@@ -184,7 +184,7 @@ let preFlushIndex = 0;
|
|
|
184
184
|
const pendingPostFlushCbs = [];
|
|
185
185
|
let activePostFlushCbs = null;
|
|
186
186
|
let postFlushIndex = 0;
|
|
187
|
-
const resolvedPromise = Promise.resolve();
|
|
187
|
+
const resolvedPromise = /*#__PURE__*/ Promise.resolve();
|
|
188
188
|
let currentFlushPromise = null;
|
|
189
189
|
let currentPreFlushParentJob = null;
|
|
190
190
|
function nextTick(fn) {
|
|
@@ -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) => {
|
|
@@ -375,6 +375,8 @@ function setDevtoolsHook(hook, target) {
|
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
function emit(instance, event, ...rawArgs) {
|
|
378
|
+
if (instance.isUnmounted)
|
|
379
|
+
return;
|
|
378
380
|
const props = instance.vnode.props || shared.EMPTY_OBJ;
|
|
379
381
|
let args = rawArgs;
|
|
380
382
|
const isModelListener = event.startsWith('update:');
|
|
@@ -386,7 +388,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
386
388
|
if (trim) {
|
|
387
389
|
args = rawArgs.map(a => a.trim());
|
|
388
390
|
}
|
|
389
|
-
|
|
391
|
+
if (number) {
|
|
390
392
|
args = rawArgs.map(shared.toNumber);
|
|
391
393
|
}
|
|
392
394
|
}
|
|
@@ -614,6 +616,8 @@ function renderComponentRoot(instance) {
|
|
|
614
616
|
}
|
|
615
617
|
// inherit directives
|
|
616
618
|
if (vnode.dirs) {
|
|
619
|
+
// clone before mutating since the root may be a hoisted vnode
|
|
620
|
+
root = cloneVNode(root);
|
|
617
621
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
618
622
|
}
|
|
619
623
|
// inherit transition data
|
|
@@ -1218,7 +1222,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1218
1222
|
}
|
|
1219
1223
|
else if (shared.isArray(source)) {
|
|
1220
1224
|
isMultiSource = true;
|
|
1221
|
-
forceTrigger = source.some(reactivity.isReactive);
|
|
1225
|
+
forceTrigger = source.some(s => reactivity.isReactive(s) || reactivity.isShallow(s));
|
|
1222
1226
|
getter = () => source.map(s => {
|
|
1223
1227
|
if (reactivity.isRef(s)) {
|
|
1224
1228
|
return s.value;
|
|
@@ -1324,16 +1328,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1324
1328
|
}
|
|
1325
1329
|
else {
|
|
1326
1330
|
// default: 'pre'
|
|
1327
|
-
scheduler = () =>
|
|
1328
|
-
if (!instance || instance.isMounted) {
|
|
1329
|
-
queuePreFlushCb(job);
|
|
1330
|
-
}
|
|
1331
|
-
else {
|
|
1332
|
-
// with 'pre' option, the first call must happen before
|
|
1333
|
-
// the component is mounted so it is called synchronously.
|
|
1334
|
-
job();
|
|
1335
|
-
}
|
|
1336
|
-
};
|
|
1331
|
+
scheduler = () => queuePreFlushCb(job);
|
|
1337
1332
|
}
|
|
1338
1333
|
const effect = new reactivity.ReactiveEffect(getter, scheduler);
|
|
1339
1334
|
// initial run
|
|
@@ -1472,12 +1467,20 @@ const BaseTransitionImpl = {
|
|
|
1472
1467
|
if (!children || !children.length) {
|
|
1473
1468
|
return;
|
|
1474
1469
|
}
|
|
1470
|
+
let child = children[0];
|
|
1471
|
+
if (children.length > 1) {
|
|
1472
|
+
// locate first non-comment child
|
|
1473
|
+
for (const c of children) {
|
|
1474
|
+
if (c.type !== Comment) {
|
|
1475
|
+
child = c;
|
|
1476
|
+
break;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1475
1480
|
// there's no need to track reactivity for these props so use the raw
|
|
1476
1481
|
// props for a bit better perf
|
|
1477
1482
|
const rawProps = reactivity.toRaw(props);
|
|
1478
1483
|
const { mode } = rawProps;
|
|
1479
|
-
// at this point children has a guaranteed length of 1.
|
|
1480
|
-
const child = children[0];
|
|
1481
1484
|
if (state.isLeaving) {
|
|
1482
1485
|
return emptyPlaceholder(child);
|
|
1483
1486
|
}
|
|
@@ -1560,6 +1563,17 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
1560
1563
|
hook &&
|
|
1561
1564
|
callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
|
|
1562
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
|
+
};
|
|
1563
1577
|
const hooks = {
|
|
1564
1578
|
mode,
|
|
1565
1579
|
persisted,
|
|
@@ -1618,10 +1632,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
1618
1632
|
el._enterCb = undefined;
|
|
1619
1633
|
});
|
|
1620
1634
|
if (hook) {
|
|
1621
|
-
hook
|
|
1622
|
-
if (hook.length <= 1) {
|
|
1623
|
-
done();
|
|
1624
|
-
}
|
|
1635
|
+
callAsyncHook(hook, [el, done]);
|
|
1625
1636
|
}
|
|
1626
1637
|
else {
|
|
1627
1638
|
done();
|
|
@@ -1655,10 +1666,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
1655
1666
|
});
|
|
1656
1667
|
leavingVNodesCache[key] = vnode;
|
|
1657
1668
|
if (onLeave) {
|
|
1658
|
-
onLeave
|
|
1659
|
-
if (onLeave.length <= 1) {
|
|
1660
|
-
done();
|
|
1661
|
-
}
|
|
1669
|
+
callAsyncHook(onLeave, [el, done]);
|
|
1662
1670
|
}
|
|
1663
1671
|
else {
|
|
1664
1672
|
done();
|
|
@@ -1700,20 +1708,24 @@ function setTransitionHooks(vnode, hooks) {
|
|
|
1700
1708
|
vnode.transition = hooks;
|
|
1701
1709
|
}
|
|
1702
1710
|
}
|
|
1703
|
-
function getTransitionRawChildren(children, keepComment = false) {
|
|
1711
|
+
function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
1704
1712
|
let ret = [];
|
|
1705
1713
|
let keyedFragmentCount = 0;
|
|
1706
1714
|
for (let i = 0; i < children.length; i++) {
|
|
1707
|
-
|
|
1715
|
+
let child = children[i];
|
|
1716
|
+
// #5360 inherit parent key in case of <template v-for>
|
|
1717
|
+
const key = parentKey == null
|
|
1718
|
+
? child.key
|
|
1719
|
+
: String(parentKey) + String(child.key != null ? child.key : i);
|
|
1708
1720
|
// handle fragment children case, e.g. v-for
|
|
1709
1721
|
if (child.type === Fragment) {
|
|
1710
1722
|
if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
|
|
1711
1723
|
keyedFragmentCount++;
|
|
1712
|
-
ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
|
|
1724
|
+
ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
|
|
1713
1725
|
}
|
|
1714
1726
|
// comment placeholders should be skipped, e.g. v-if
|
|
1715
1727
|
else if (keepComment || child.type !== Comment) {
|
|
1716
|
-
ret.push(child);
|
|
1728
|
+
ret.push(key != null ? cloneVNode(child, { key }) : child);
|
|
1717
1729
|
}
|
|
1718
1730
|
}
|
|
1719
1731
|
// #1126 if a transition children list contains multiple sub fragments, these
|
|
@@ -1857,7 +1869,7 @@ function defineAsyncComponent(source) {
|
|
|
1857
1869
|
}
|
|
1858
1870
|
});
|
|
1859
1871
|
}
|
|
1860
|
-
function createInnerComp(comp, { vnode: { ref, props, children } }) {
|
|
1872
|
+
function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
|
|
1861
1873
|
const vnode = createVNode(comp, props, children);
|
|
1862
1874
|
// ensure inner component inherits the async wrapper's ref owner
|
|
1863
1875
|
vnode.ref = ref;
|
|
@@ -2052,7 +2064,7 @@ const KeepAliveImpl = {
|
|
|
2052
2064
|
// avoid vnode being unmounted
|
|
2053
2065
|
vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2054
2066
|
current = vnode;
|
|
2055
|
-
return rawVNode;
|
|
2067
|
+
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
2056
2068
|
};
|
|
2057
2069
|
}
|
|
2058
2070
|
};
|
|
@@ -2181,337 +2193,759 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
2181
2193
|
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
2182
2194
|
}
|
|
2183
2195
|
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
// assets
|
|
2204
|
-
components, directives, filters } = options;
|
|
2205
|
-
const checkDuplicateProperties = null;
|
|
2206
|
-
// options initialization order (to be consistent with Vue 2):
|
|
2207
|
-
// - props (already done outside of this function)
|
|
2208
|
-
// - inject
|
|
2209
|
-
// - methods
|
|
2210
|
-
// - data (deferred since it relies on `this` access)
|
|
2211
|
-
// - computed
|
|
2212
|
-
// - watch (deferred since it relies on `this` access)
|
|
2213
|
-
if (injectOptions) {
|
|
2214
|
-
resolveInjections(injectOptions, ctx, checkDuplicateProperties, instance.appContext.config.unwrapInjectedRef);
|
|
2215
|
-
}
|
|
2216
|
-
if (methods) {
|
|
2217
|
-
for (const key in methods) {
|
|
2218
|
-
const methodHandler = methods[key];
|
|
2219
|
-
if (shared.isFunction(methodHandler)) {
|
|
2220
|
-
// In dev mode, we use the `createRenderContext` function to define
|
|
2221
|
-
// methods to the proxy target, and those are read-only but
|
|
2222
|
-
// reconfigurable, so it needs to be redefined here
|
|
2223
|
-
{
|
|
2224
|
-
ctx[key] = methodHandler.bind(publicThis);
|
|
2225
|
-
}
|
|
2226
|
-
}
|
|
2227
|
-
}
|
|
2228
|
-
}
|
|
2229
|
-
if (dataOptions) {
|
|
2230
|
-
const data = dataOptions.call(publicThis, publicThis);
|
|
2231
|
-
if (!shared.isObject(data)) ;
|
|
2232
|
-
else {
|
|
2233
|
-
instance.data = reactivity.reactive(data);
|
|
2234
|
-
}
|
|
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;
|
|
2235
2215
|
}
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
:
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
const set = !shared.isFunction(opt) && shared.isFunction(opt.set)
|
|
2247
|
-
? opt.set.bind(publicThis)
|
|
2248
|
-
: shared.NOOP;
|
|
2249
|
-
const c = computed({
|
|
2250
|
-
get,
|
|
2251
|
-
set
|
|
2252
|
-
});
|
|
2253
|
-
Object.defineProperty(ctx, key, {
|
|
2254
|
-
enumerable: true,
|
|
2255
|
-
configurable: true,
|
|
2256
|
-
get: () => c.value,
|
|
2257
|
-
set: v => (c.value = v)
|
|
2258
|
-
});
|
|
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
|
+
};
|
|
2259
2226
|
}
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
for (const key in watchOptions) {
|
|
2263
|
-
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
2227
|
+
if (dir.deep) {
|
|
2228
|
+
traverse(value);
|
|
2264
2229
|
}
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
:
|
|
2270
|
-
|
|
2271
|
-
|
|
2230
|
+
bindings.push({
|
|
2231
|
+
dir,
|
|
2232
|
+
instance,
|
|
2233
|
+
value,
|
|
2234
|
+
oldValue: void 0,
|
|
2235
|
+
arg,
|
|
2236
|
+
modifiers
|
|
2272
2237
|
});
|
|
2273
2238
|
}
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
}
|
|
2284
|
-
}
|
|
2285
|
-
registerLifecycleHook(onBeforeMount, beforeMount);
|
|
2286
|
-
registerLifecycleHook(onMounted, mounted);
|
|
2287
|
-
registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
|
2288
|
-
registerLifecycleHook(onUpdated, updated);
|
|
2289
|
-
registerLifecycleHook(onActivated, activated);
|
|
2290
|
-
registerLifecycleHook(onDeactivated, deactivated);
|
|
2291
|
-
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
|
2292
|
-
registerLifecycleHook(onRenderTracked, renderTracked);
|
|
2293
|
-
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
|
2294
|
-
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
|
2295
|
-
registerLifecycleHook(onUnmounted, unmounted);
|
|
2296
|
-
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
2297
|
-
if (shared.isArray(expose)) {
|
|
2298
|
-
if (expose.length) {
|
|
2299
|
-
const exposed = instance.exposed || (instance.exposed = {});
|
|
2300
|
-
expose.forEach(key => {
|
|
2301
|
-
Object.defineProperty(exposed, key, {
|
|
2302
|
-
get: () => publicThis[key],
|
|
2303
|
-
set: val => (publicThis[key] = val)
|
|
2304
|
-
});
|
|
2305
|
-
});
|
|
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;
|
|
2306
2248
|
}
|
|
2307
|
-
|
|
2308
|
-
|
|
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();
|
|
2309
2261
|
}
|
|
2310
2262
|
}
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
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;
|
|
2315
2280
|
}
|
|
2316
|
-
|
|
2317
|
-
|
|
2281
|
+
else {
|
|
2282
|
+
// invalid types will fallthrough to createVNode and raise warning
|
|
2283
|
+
return (component || NULL_DYNAMIC_COMPONENT);
|
|
2318
2284
|
}
|
|
2319
|
-
// asset options.
|
|
2320
|
-
if (components)
|
|
2321
|
-
instance.components = components;
|
|
2322
|
-
if (directives)
|
|
2323
|
-
instance.directives = directives;
|
|
2324
2285
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
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;
|
|
2338
2305
|
}
|
|
2339
2306
|
}
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
//
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
get: () => injected.value,
|
|
2350
|
-
set: v => (injected.value = v)
|
|
2351
|
-
});
|
|
2352
|
-
}
|
|
2353
|
-
else {
|
|
2354
|
-
ctx[key] = injected;
|
|
2355
|
-
}
|
|
2356
|
-
}
|
|
2357
|
-
else {
|
|
2358
|
-
ctx[key] = injected;
|
|
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;
|
|
2359
2316
|
}
|
|
2317
|
+
return res;
|
|
2360
2318
|
}
|
|
2361
2319
|
}
|
|
2362
|
-
function
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
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]);
|
|
2375
2337
|
}
|
|
2376
2338
|
}
|
|
2377
|
-
else if (
|
|
2378
|
-
|
|
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
|
+
}
|
|
2379
2344
|
}
|
|
2380
|
-
else if (shared.isObject(
|
|
2381
|
-
if (
|
|
2382
|
-
|
|
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]));
|
|
2383
2348
|
}
|
|
2384
2349
|
else {
|
|
2385
|
-
const
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
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]);
|
|
2390
2355
|
}
|
|
2391
2356
|
}
|
|
2392
2357
|
}
|
|
2393
|
-
else
|
|
2394
|
-
|
|
2358
|
+
else {
|
|
2359
|
+
ret = [];
|
|
2360
|
+
}
|
|
2361
|
+
if (cache) {
|
|
2362
|
+
cache[index] = ret;
|
|
2363
|
+
}
|
|
2364
|
+
return ret;
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2395
2367
|
/**
|
|
2396
|
-
*
|
|
2397
|
-
*
|
|
2398
|
-
* instances.
|
|
2368
|
+
* Compiler runtime helper for creating dynamic slots object
|
|
2369
|
+
* @private
|
|
2399
2370
|
*/
|
|
2400
|
-
function
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
}
|
|
2409
|
-
else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
2410
|
-
{
|
|
2411
|
-
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
|
+
}
|
|
2412
2379
|
}
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
if (globalMixins.length) {
|
|
2417
|
-
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;
|
|
2418
2383
|
}
|
|
2419
|
-
mergeOptions(resolved, base, optionMergeStrategies);
|
|
2420
|
-
}
|
|
2421
|
-
cache.set(base, resolved);
|
|
2422
|
-
return resolved;
|
|
2423
|
-
}
|
|
2424
|
-
function mergeOptions(to, from, strats, asMixin = false) {
|
|
2425
|
-
const { mixins, extends: extendsOptions } = from;
|
|
2426
|
-
if (extendsOptions) {
|
|
2427
|
-
mergeOptions(to, extendsOptions, strats, true);
|
|
2428
|
-
}
|
|
2429
|
-
if (mixins) {
|
|
2430
|
-
mixins.forEach((m) => mergeOptions(to, m, strats, true));
|
|
2431
2384
|
}
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
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());
|
|
2438
2401
|
}
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
methods: mergeObjectOptions,
|
|
2447
|
-
computed: mergeObjectOptions,
|
|
2448
|
-
// lifecycle
|
|
2449
|
-
beforeCreate: mergeAsArray,
|
|
2450
|
-
created: mergeAsArray,
|
|
2451
|
-
beforeMount: mergeAsArray,
|
|
2452
|
-
mounted: mergeAsArray,
|
|
2453
|
-
beforeUpdate: mergeAsArray,
|
|
2454
|
-
updated: mergeAsArray,
|
|
2455
|
-
beforeDestroy: mergeAsArray,
|
|
2456
|
-
beforeUnmount: mergeAsArray,
|
|
2457
|
-
destroyed: mergeAsArray,
|
|
2458
|
-
unmounted: mergeAsArray,
|
|
2459
|
-
activated: mergeAsArray,
|
|
2460
|
-
deactivated: mergeAsArray,
|
|
2461
|
-
errorCaptured: mergeAsArray,
|
|
2462
|
-
serverPrefetch: mergeAsArray,
|
|
2463
|
-
// assets
|
|
2464
|
-
components: mergeObjectOptions,
|
|
2465
|
-
directives: mergeObjectOptions,
|
|
2466
|
-
// watch
|
|
2467
|
-
watch: mergeWatchOptions,
|
|
2468
|
-
// provide / inject
|
|
2469
|
-
provide: mergeDataFn,
|
|
2470
|
-
inject: mergeInject
|
|
2471
|
-
};
|
|
2472
|
-
function mergeDataFn(to, from) {
|
|
2473
|
-
if (!from) {
|
|
2474
|
-
return to;
|
|
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;
|
|
2475
2409
|
}
|
|
2476
|
-
|
|
2477
|
-
|
|
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'];
|
|
2478
2417
|
}
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
};
|
|
2482
|
-
}
|
|
2483
|
-
function mergeInject(to, from) {
|
|
2484
|
-
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
2485
|
-
}
|
|
2486
|
-
function normalizeInject(raw) {
|
|
2487
|
-
if (shared.isArray(raw)) {
|
|
2488
|
-
const res = {};
|
|
2489
|
-
for (let i = 0; i < raw.length; i++) {
|
|
2490
|
-
res[raw[i]] = raw[i];
|
|
2491
|
-
}
|
|
2492
|
-
return res;
|
|
2418
|
+
if (slot && slot._c) {
|
|
2419
|
+
slot._d = true;
|
|
2493
2420
|
}
|
|
2494
|
-
return
|
|
2495
|
-
}
|
|
2496
|
-
function mergeAsArray(to, from) {
|
|
2497
|
-
return to ? [...new Set([].concat(to, from))] : from;
|
|
2498
|
-
}
|
|
2499
|
-
function mergeObjectOptions(to, from) {
|
|
2500
|
-
return to ? shared.extend(shared.extend(Object.create(null), to), from) : from;
|
|
2421
|
+
return rendered;
|
|
2501
2422
|
}
|
|
2502
|
-
function
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
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;
|
|
2512
2436
|
}
|
|
2513
2437
|
|
|
2514
|
-
|
|
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];
|
|
2446
|
+
}
|
|
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) {
|
|
2934
|
+
return to ? shared.extend(shared.extend(Object.create(null), to), from) : from;
|
|
2935
|
+
}
|
|
2936
|
+
function mergeWatchOptions(to, from) {
|
|
2937
|
+
if (!to)
|
|
2938
|
+
return from;
|
|
2939
|
+
if (!from)
|
|
2940
|
+
return to;
|
|
2941
|
+
const merged = shared.extend(Object.create(null), to);
|
|
2942
|
+
for (const key in from) {
|
|
2943
|
+
merged[key] = mergeAsArray(to[key], from[key]);
|
|
2944
|
+
}
|
|
2945
|
+
return merged;
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison
|
|
2515
2949
|
isSSR = false) {
|
|
2516
2950
|
const props = {};
|
|
2517
2951
|
const attrs = {};
|
|
@@ -2557,6 +2991,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
2557
2991
|
const propsToUpdate = instance.vnode.dynamicProps;
|
|
2558
2992
|
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
2559
2993
|
let key = propsToUpdate[i];
|
|
2994
|
+
// skip if the prop key is a declared emit event listener
|
|
2995
|
+
if (isEmitListener(instance.emitsOptions, key)) {
|
|
2996
|
+
continue;
|
|
2997
|
+
}
|
|
2560
2998
|
// PROPS flag guarantees rawProps to be non-null
|
|
2561
2999
|
const value = rawProps[key];
|
|
2562
3000
|
if (options) {
|
|
@@ -2800,6 +3238,10 @@ const normalizeSlotValue = (value) => shared.isArray(value)
|
|
|
2800
3238
|
? value.map(normalizeVNode)
|
|
2801
3239
|
: [normalizeVNode(value)];
|
|
2802
3240
|
const normalizeSlot = (key, rawSlot, ctx) => {
|
|
3241
|
+
if (rawSlot._n) {
|
|
3242
|
+
// already normalized - #5353
|
|
3243
|
+
return rawSlot;
|
|
3244
|
+
}
|
|
2803
3245
|
const normalized = withCtx((...args) => {
|
|
2804
3246
|
return normalizeSlotValue(rawSlot(...args));
|
|
2805
3247
|
}, ctx);
|
|
@@ -2894,74 +3336,6 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
2894
3336
|
}
|
|
2895
3337
|
};
|
|
2896
3338
|
|
|
2897
|
-
/**
|
|
2898
|
-
Runtime helper for applying directives to a vnode. Example usage:
|
|
2899
|
-
|
|
2900
|
-
const comp = resolveComponent('comp')
|
|
2901
|
-
const foo = resolveDirective('foo')
|
|
2902
|
-
const bar = resolveDirective('bar')
|
|
2903
|
-
|
|
2904
|
-
return withDirectives(h(comp), [
|
|
2905
|
-
[foo, this.x],
|
|
2906
|
-
[bar, this.y]
|
|
2907
|
-
])
|
|
2908
|
-
*/
|
|
2909
|
-
/**
|
|
2910
|
-
* Adds directives to a VNode.
|
|
2911
|
-
*/
|
|
2912
|
-
function withDirectives(vnode, directives) {
|
|
2913
|
-
const internalInstance = currentRenderingInstance;
|
|
2914
|
-
if (internalInstance === null) {
|
|
2915
|
-
return vnode;
|
|
2916
|
-
}
|
|
2917
|
-
const instance = internalInstance.proxy;
|
|
2918
|
-
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
2919
|
-
for (let i = 0; i < directives.length; i++) {
|
|
2920
|
-
let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
|
|
2921
|
-
if (shared.isFunction(dir)) {
|
|
2922
|
-
dir = {
|
|
2923
|
-
mounted: dir,
|
|
2924
|
-
updated: dir
|
|
2925
|
-
};
|
|
2926
|
-
}
|
|
2927
|
-
if (dir.deep) {
|
|
2928
|
-
traverse(value);
|
|
2929
|
-
}
|
|
2930
|
-
bindings.push({
|
|
2931
|
-
dir,
|
|
2932
|
-
instance,
|
|
2933
|
-
value,
|
|
2934
|
-
oldValue: void 0,
|
|
2935
|
-
arg,
|
|
2936
|
-
modifiers
|
|
2937
|
-
});
|
|
2938
|
-
}
|
|
2939
|
-
return vnode;
|
|
2940
|
-
}
|
|
2941
|
-
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
2942
|
-
const bindings = vnode.dirs;
|
|
2943
|
-
const oldBindings = prevVNode && prevVNode.dirs;
|
|
2944
|
-
for (let i = 0; i < bindings.length; i++) {
|
|
2945
|
-
const binding = bindings[i];
|
|
2946
|
-
if (oldBindings) {
|
|
2947
|
-
binding.oldValue = oldBindings[i].value;
|
|
2948
|
-
}
|
|
2949
|
-
let hook = binding.dir[name];
|
|
2950
|
-
if (hook) {
|
|
2951
|
-
// disable tracking inside all lifecycle hooks
|
|
2952
|
-
// since they can potentially be called inside effects.
|
|
2953
|
-
reactivity.pauseTracking();
|
|
2954
|
-
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
2955
|
-
vnode.el,
|
|
2956
|
-
binding,
|
|
2957
|
-
vnode,
|
|
2958
|
-
prevVNode
|
|
2959
|
-
]);
|
|
2960
|
-
reactivity.resetTracking();
|
|
2961
|
-
}
|
|
2962
|
-
}
|
|
2963
|
-
}
|
|
2964
|
-
|
|
2965
3339
|
function createAppContext() {
|
|
2966
3340
|
return {
|
|
2967
3341
|
app: null,
|
|
@@ -2986,6 +3360,9 @@ function createAppContext() {
|
|
|
2986
3360
|
let uid = 0;
|
|
2987
3361
|
function createAppAPI(render, hydrate) {
|
|
2988
3362
|
return function createApp(rootComponent, rootProps = null) {
|
|
3363
|
+
if (!shared.isFunction(rootComponent)) {
|
|
3364
|
+
rootComponent = { ...rootComponent };
|
|
3365
|
+
}
|
|
2989
3366
|
if (rootProps != null && !shared.isObject(rootProps)) {
|
|
2990
3367
|
rootProps = null;
|
|
2991
3368
|
}
|
|
@@ -3065,8 +3442,6 @@ function createAppAPI(render, hydrate) {
|
|
|
3065
3442
|
}
|
|
3066
3443
|
},
|
|
3067
3444
|
provide(key, value) {
|
|
3068
|
-
// TypeScript doesn't allow symbols as index type
|
|
3069
|
-
// https://github.com/Microsoft/TypeScript/issues/24587
|
|
3070
3445
|
context.provides[key] = value;
|
|
3071
3446
|
return app;
|
|
3072
3447
|
}
|
|
@@ -3125,6 +3500,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
3125
3500
|
if (!shared.isArray(existing)) {
|
|
3126
3501
|
if (_isString) {
|
|
3127
3502
|
refs[ref] = [refValue];
|
|
3503
|
+
if (shared.hasOwn(setupState, ref)) {
|
|
3504
|
+
setupState[ref] = refs[ref];
|
|
3505
|
+
}
|
|
3128
3506
|
}
|
|
3129
3507
|
else {
|
|
3130
3508
|
ref.value = [refValue];
|
|
@@ -3188,9 +3566,13 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3188
3566
|
const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
|
3189
3567
|
const isFragmentStart = isComment(node) && node.data === '[';
|
|
3190
3568
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
3191
|
-
const { type, ref, shapeFlag } = vnode;
|
|
3569
|
+
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
3192
3570
|
const domType = node.nodeType;
|
|
3193
3571
|
vnode.el = node;
|
|
3572
|
+
if (patchFlag === -2 /* BAIL */) {
|
|
3573
|
+
optimized = false;
|
|
3574
|
+
vnode.dynamicChildren = null;
|
|
3575
|
+
}
|
|
3194
3576
|
let nextNode = null;
|
|
3195
3577
|
switch (type) {
|
|
3196
3578
|
case Text:
|
|
@@ -3847,6 +4229,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3847
4229
|
else {
|
|
3848
4230
|
if (patchFlag > 0 &&
|
|
3849
4231
|
patchFlag & 64 /* STABLE_FRAGMENT */ &&
|
|
4232
|
+
// #5523 dev root fragment may inherit directives so always force update
|
|
4233
|
+
!(false /* DEV_ROOT_FRAGMENT */) &&
|
|
3850
4234
|
dynamicChildren &&
|
|
3851
4235
|
// #2715 the previous fragment could've been a BAILed one as a result
|
|
3852
4236
|
// of renderSlot() with no valid children
|
|
@@ -3931,7 +4315,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3931
4315
|
}
|
|
3932
4316
|
else {
|
|
3933
4317
|
// no update needed. just copy over properties
|
|
3934
|
-
n2.component = n1.component;
|
|
3935
4318
|
n2.el = n1.el;
|
|
3936
4319
|
instance.vnode = n2;
|
|
3937
4320
|
}
|
|
@@ -3990,7 +4373,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3990
4373
|
// activated hook for keep-alive roots.
|
|
3991
4374
|
// #1742 activated hook must be accessed after first render
|
|
3992
4375
|
// since the hook may be injected by a child keep-alive
|
|
3993
|
-
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 */)) {
|
|
3994
4380
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
3995
4381
|
}
|
|
3996
4382
|
instance.isMounted = true;
|
|
@@ -4048,9 +4434,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4048
4434
|
}
|
|
4049
4435
|
};
|
|
4050
4436
|
// create reactive effect for rendering
|
|
4051
|
-
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
|
|
4052
4438
|
));
|
|
4053
|
-
const update = (instance.update = effect.run
|
|
4439
|
+
const update = (instance.update = () => effect.run());
|
|
4054
4440
|
update.id = instance.uid;
|
|
4055
4441
|
// allowRecurse
|
|
4056
4442
|
// #1801, #2043 component render effects should allow recursive updates
|
|
@@ -4433,7 +4819,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4433
4819
|
const remove = vnode => {
|
|
4434
4820
|
const { type, el, anchor, transition } = vnode;
|
|
4435
4821
|
if (type === Fragment) {
|
|
4436
|
-
|
|
4822
|
+
{
|
|
4823
|
+
removeFragment(el, anchor);
|
|
4824
|
+
}
|
|
4437
4825
|
return;
|
|
4438
4826
|
}
|
|
4439
4827
|
if (type === Static) {
|
|
@@ -4801,68 +5189,6 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
4801
5189
|
// Force-casted public typing for h and TSX props inference
|
|
4802
5190
|
const Teleport = TeleportImpl;
|
|
4803
5191
|
|
|
4804
|
-
const COMPONENTS = 'components';
|
|
4805
|
-
const DIRECTIVES = 'directives';
|
|
4806
|
-
/**
|
|
4807
|
-
* @private
|
|
4808
|
-
*/
|
|
4809
|
-
function resolveComponent(name, maybeSelfReference) {
|
|
4810
|
-
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
4811
|
-
}
|
|
4812
|
-
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
4813
|
-
/**
|
|
4814
|
-
* @private
|
|
4815
|
-
*/
|
|
4816
|
-
function resolveDynamicComponent(component) {
|
|
4817
|
-
if (shared.isString(component)) {
|
|
4818
|
-
return resolveAsset(COMPONENTS, component, false) || component;
|
|
4819
|
-
}
|
|
4820
|
-
else {
|
|
4821
|
-
// invalid types will fallthrough to createVNode and raise warning
|
|
4822
|
-
return (component || NULL_DYNAMIC_COMPONENT);
|
|
4823
|
-
}
|
|
4824
|
-
}
|
|
4825
|
-
/**
|
|
4826
|
-
* @private
|
|
4827
|
-
*/
|
|
4828
|
-
function resolveDirective(name) {
|
|
4829
|
-
return resolveAsset(DIRECTIVES, name);
|
|
4830
|
-
}
|
|
4831
|
-
// implementation
|
|
4832
|
-
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
4833
|
-
const instance = currentRenderingInstance || currentInstance;
|
|
4834
|
-
if (instance) {
|
|
4835
|
-
const Component = instance.type;
|
|
4836
|
-
// explicit self name has highest priority
|
|
4837
|
-
if (type === COMPONENTS) {
|
|
4838
|
-
const selfName = getComponentName(Component);
|
|
4839
|
-
if (selfName &&
|
|
4840
|
-
(selfName === name ||
|
|
4841
|
-
selfName === shared.camelize(name) ||
|
|
4842
|
-
selfName === shared.capitalize(shared.camelize(name)))) {
|
|
4843
|
-
return Component;
|
|
4844
|
-
}
|
|
4845
|
-
}
|
|
4846
|
-
const res =
|
|
4847
|
-
// local registration
|
|
4848
|
-
// check instance[type] first which is resolved for options API
|
|
4849
|
-
resolve(instance[type] || Component[type], name) ||
|
|
4850
|
-
// global registration
|
|
4851
|
-
resolve(instance.appContext[type], name);
|
|
4852
|
-
if (!res && maybeSelfReference) {
|
|
4853
|
-
// fallback to implicit self-reference
|
|
4854
|
-
return Component;
|
|
4855
|
-
}
|
|
4856
|
-
return res;
|
|
4857
|
-
}
|
|
4858
|
-
}
|
|
4859
|
-
function resolve(registry, name) {
|
|
4860
|
-
return (registry &&
|
|
4861
|
-
(registry[name] ||
|
|
4862
|
-
registry[shared.camelize(name)] ||
|
|
4863
|
-
registry[shared.capitalize(shared.camelize(name))]));
|
|
4864
|
-
}
|
|
4865
|
-
|
|
4866
5192
|
const Fragment = Symbol(undefined);
|
|
4867
5193
|
const Text = Symbol(undefined);
|
|
4868
5194
|
const Comment = Symbol(undefined);
|
|
@@ -5046,6 +5372,15 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5046
5372
|
if (children) {
|
|
5047
5373
|
normalizeChildren(cloned, children);
|
|
5048
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 */;
|
|
5049
5384
|
return cloned;
|
|
5050
5385
|
}
|
|
5051
5386
|
// class component normalization.
|
|
@@ -5237,345 +5572,61 @@ function normalizeChildren(vnode, children) {
|
|
|
5237
5572
|
}
|
|
5238
5573
|
}
|
|
5239
5574
|
}
|
|
5240
|
-
else if (shared.isFunction(children)) {
|
|
5241
|
-
children = { default: children, _ctx: currentRenderingInstance };
|
|
5242
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
5243
|
-
}
|
|
5244
|
-
else {
|
|
5245
|
-
children = String(children);
|
|
5246
|
-
// force teleport children to array so it can be moved around
|
|
5247
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
5248
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
5249
|
-
children = [createTextVNode(children)];
|
|
5250
|
-
}
|
|
5251
|
-
else {
|
|
5252
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
5253
|
-
}
|
|
5254
|
-
}
|
|
5255
|
-
vnode.children = children;
|
|
5256
|
-
vnode.shapeFlag |= type;
|
|
5257
|
-
}
|
|
5258
|
-
function mergeProps(...args) {
|
|
5259
|
-
const ret = {};
|
|
5260
|
-
for (let i = 0; i < args.length; i++) {
|
|
5261
|
-
const toMerge = args[i];
|
|
5262
|
-
for (const key in toMerge) {
|
|
5263
|
-
if (key === 'class') {
|
|
5264
|
-
if (ret.class !== toMerge.class) {
|
|
5265
|
-
ret.class = shared.normalizeClass([ret.class, toMerge.class]);
|
|
5266
|
-
}
|
|
5267
|
-
}
|
|
5268
|
-
else if (key === 'style') {
|
|
5269
|
-
ret.style = shared.normalizeStyle([ret.style, toMerge.style]);
|
|
5270
|
-
}
|
|
5271
|
-
else if (shared.isOn(key)) {
|
|
5272
|
-
const existing = ret[key];
|
|
5273
|
-
const incoming = toMerge[key];
|
|
5274
|
-
if (incoming &&
|
|
5275
|
-
existing !== incoming &&
|
|
5276
|
-
!(shared.isArray(existing) && existing.includes(incoming))) {
|
|
5277
|
-
ret[key] = existing
|
|
5278
|
-
? [].concat(existing, incoming)
|
|
5279
|
-
: incoming;
|
|
5280
|
-
}
|
|
5281
|
-
}
|
|
5282
|
-
else if (key !== '') {
|
|
5283
|
-
ret[key] = toMerge[key];
|
|
5284
|
-
}
|
|
5285
|
-
}
|
|
5286
|
-
}
|
|
5287
|
-
return ret;
|
|
5288
|
-
}
|
|
5289
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
5290
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
5291
|
-
vnode,
|
|
5292
|
-
prevVNode
|
|
5293
|
-
]);
|
|
5294
|
-
}
|
|
5295
|
-
|
|
5296
|
-
/**
|
|
5297
|
-
* Actual implementation
|
|
5298
|
-
*/
|
|
5299
|
-
function renderList(source, renderItem, cache, index) {
|
|
5300
|
-
let ret;
|
|
5301
|
-
const cached = (cache && cache[index]);
|
|
5302
|
-
if (shared.isArray(source) || shared.isString(source)) {
|
|
5303
|
-
ret = new Array(source.length);
|
|
5304
|
-
for (let i = 0, l = source.length; i < l; i++) {
|
|
5305
|
-
ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
|
|
5306
|
-
}
|
|
5307
|
-
}
|
|
5308
|
-
else if (typeof source === 'number') {
|
|
5309
|
-
ret = new Array(source);
|
|
5310
|
-
for (let i = 0; i < source; i++) {
|
|
5311
|
-
ret[i] = renderItem(i + 1, i, undefined, cached && cached[i]);
|
|
5312
|
-
}
|
|
5313
|
-
}
|
|
5314
|
-
else if (shared.isObject(source)) {
|
|
5315
|
-
if (source[Symbol.iterator]) {
|
|
5316
|
-
ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
|
|
5317
|
-
}
|
|
5318
|
-
else {
|
|
5319
|
-
const keys = Object.keys(source);
|
|
5320
|
-
ret = new Array(keys.length);
|
|
5321
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
5322
|
-
const key = keys[i];
|
|
5323
|
-
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
5324
|
-
}
|
|
5325
|
-
}
|
|
5326
|
-
}
|
|
5327
|
-
else {
|
|
5328
|
-
ret = [];
|
|
5329
|
-
}
|
|
5330
|
-
if (cache) {
|
|
5331
|
-
cache[index] = ret;
|
|
5332
|
-
}
|
|
5333
|
-
return ret;
|
|
5334
|
-
}
|
|
5335
|
-
|
|
5336
|
-
/**
|
|
5337
|
-
* Compiler runtime helper for creating dynamic slots object
|
|
5338
|
-
* @private
|
|
5339
|
-
*/
|
|
5340
|
-
function createSlots(slots, dynamicSlots) {
|
|
5341
|
-
for (let i = 0; i < dynamicSlots.length; i++) {
|
|
5342
|
-
const slot = dynamicSlots[i];
|
|
5343
|
-
// array of dynamic slot generated by <template v-for="..." #[...]>
|
|
5344
|
-
if (shared.isArray(slot)) {
|
|
5345
|
-
for (let j = 0; j < slot.length; j++) {
|
|
5346
|
-
slots[slot[j].name] = slot[j].fn;
|
|
5347
|
-
}
|
|
5348
|
-
}
|
|
5349
|
-
else if (slot) {
|
|
5350
|
-
// conditional single slot generated by <template v-if="..." #foo>
|
|
5351
|
-
slots[slot.name] = slot.fn;
|
|
5352
|
-
}
|
|
5353
|
-
}
|
|
5354
|
-
return slots;
|
|
5355
|
-
}
|
|
5356
|
-
|
|
5357
|
-
/**
|
|
5358
|
-
* Compiler runtime helper for rendering `<slot/>`
|
|
5359
|
-
* @private
|
|
5360
|
-
*/
|
|
5361
|
-
function renderSlot(slots, name, props = {},
|
|
5362
|
-
// this is not a user-facing function, so the fallback is always generated by
|
|
5363
|
-
// the compiler and guaranteed to be a function returning an array
|
|
5364
|
-
fallback, noSlotted) {
|
|
5365
|
-
if (currentRenderingInstance.isCE) {
|
|
5366
|
-
return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
|
|
5367
|
-
}
|
|
5368
|
-
let slot = slots[name];
|
|
5369
|
-
// a compiled slot disables block tracking by default to avoid manual
|
|
5370
|
-
// invocation interfering with template-based block tracking, but in
|
|
5371
|
-
// `renderSlot` we can be sure that it's template-based so we can force
|
|
5372
|
-
// enable it.
|
|
5373
|
-
if (slot && slot._c) {
|
|
5374
|
-
slot._d = false;
|
|
5375
|
-
}
|
|
5376
|
-
openBlock();
|
|
5377
|
-
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
5378
|
-
const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
|
|
5379
|
-
? 64 /* STABLE_FRAGMENT */
|
|
5380
|
-
: -2 /* BAIL */);
|
|
5381
|
-
if (!noSlotted && rendered.scopeId) {
|
|
5382
|
-
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
5575
|
+
else if (shared.isFunction(children)) {
|
|
5576
|
+
children = { default: children, _ctx: currentRenderingInstance };
|
|
5577
|
+
type = 32 /* SLOTS_CHILDREN */;
|
|
5383
5578
|
}
|
|
5384
|
-
|
|
5385
|
-
|
|
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)];
|
|
5585
|
+
}
|
|
5586
|
+
else {
|
|
5587
|
+
type = 8 /* TEXT_CHILDREN */;
|
|
5588
|
+
}
|
|
5386
5589
|
}
|
|
5387
|
-
|
|
5590
|
+
vnode.children = children;
|
|
5591
|
+
vnode.shapeFlag |= type;
|
|
5388
5592
|
}
|
|
5389
|
-
function
|
|
5390
|
-
return vnodes.some(child => {
|
|
5391
|
-
if (!isVNode(child))
|
|
5392
|
-
return true;
|
|
5393
|
-
if (child.type === Comment)
|
|
5394
|
-
return false;
|
|
5395
|
-
if (child.type === Fragment &&
|
|
5396
|
-
!ensureValidVNode(child.children))
|
|
5397
|
-
return false;
|
|
5398
|
-
return true;
|
|
5399
|
-
})
|
|
5400
|
-
? vnodes
|
|
5401
|
-
: null;
|
|
5402
|
-
}
|
|
5403
|
-
|
|
5404
|
-
/**
|
|
5405
|
-
* For prefixing keys in v-on="obj" with "on"
|
|
5406
|
-
* @private
|
|
5407
|
-
*/
|
|
5408
|
-
function toHandlers(obj) {
|
|
5593
|
+
function mergeProps(...args) {
|
|
5409
5594
|
const ret = {};
|
|
5410
|
-
for (
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
/**
|
|
5417
|
-
* #2437 In Vue 3, functional components do not have a public instance proxy but
|
|
5418
|
-
* they exist in the internal parent chain. For code that relies on traversing
|
|
5419
|
-
* public $parent chains, skip functional ones and go to the parent instead.
|
|
5420
|
-
*/
|
|
5421
|
-
const getPublicInstance = (i) => {
|
|
5422
|
-
if (!i)
|
|
5423
|
-
return null;
|
|
5424
|
-
if (isStatefulComponent(i))
|
|
5425
|
-
return getExposeProxy(i) || i.proxy;
|
|
5426
|
-
return getPublicInstance(i.parent);
|
|
5427
|
-
};
|
|
5428
|
-
const publicPropertiesMap = shared.extend(Object.create(null), {
|
|
5429
|
-
$: i => i,
|
|
5430
|
-
$el: i => i.vnode.el,
|
|
5431
|
-
$data: i => i.data,
|
|
5432
|
-
$props: i => (i.props),
|
|
5433
|
-
$attrs: i => (i.attrs),
|
|
5434
|
-
$slots: i => (i.slots),
|
|
5435
|
-
$refs: i => (i.refs),
|
|
5436
|
-
$parent: i => getPublicInstance(i.parent),
|
|
5437
|
-
$root: i => getPublicInstance(i.root),
|
|
5438
|
-
$emit: i => i.emit,
|
|
5439
|
-
$options: i => (resolveMergedOptions(i) ),
|
|
5440
|
-
$forceUpdate: i => () => queueJob(i.update),
|
|
5441
|
-
$nextTick: i => nextTick.bind(i.proxy),
|
|
5442
|
-
$watch: i => (instanceWatch.bind(i) )
|
|
5443
|
-
});
|
|
5444
|
-
const PublicInstanceProxyHandlers = {
|
|
5445
|
-
get({ _: instance }, key) {
|
|
5446
|
-
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
|
5447
|
-
// data / props / ctx
|
|
5448
|
-
// This getter gets called for every property access on the render context
|
|
5449
|
-
// during render and is a major hotspot. The most expensive part of this
|
|
5450
|
-
// is the multiple hasOwn() calls. It's much faster to do a simple property
|
|
5451
|
-
// access on a plain object, so we use an accessCache object (with null
|
|
5452
|
-
// prototype) to memoize what access type a key corresponds to.
|
|
5453
|
-
let normalizedProps;
|
|
5454
|
-
if (key[0] !== '$') {
|
|
5455
|
-
const n = accessCache[key];
|
|
5456
|
-
if (n !== undefined) {
|
|
5457
|
-
switch (n) {
|
|
5458
|
-
case 1 /* SETUP */:
|
|
5459
|
-
return setupState[key];
|
|
5460
|
-
case 2 /* DATA */:
|
|
5461
|
-
return data[key];
|
|
5462
|
-
case 4 /* CONTEXT */:
|
|
5463
|
-
return ctx[key];
|
|
5464
|
-
case 3 /* PROPS */:
|
|
5465
|
-
return props[key];
|
|
5466
|
-
// default: just fallthrough
|
|
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]);
|
|
5467
5601
|
}
|
|
5468
5602
|
}
|
|
5469
|
-
else if (
|
|
5470
|
-
|
|
5471
|
-
return setupState[key];
|
|
5472
|
-
}
|
|
5473
|
-
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
5474
|
-
accessCache[key] = 2 /* DATA */;
|
|
5475
|
-
return data[key];
|
|
5476
|
-
}
|
|
5477
|
-
else if (
|
|
5478
|
-
// only cache other properties when instance has declared (thus stable)
|
|
5479
|
-
// props
|
|
5480
|
-
(normalizedProps = instance.propsOptions[0]) &&
|
|
5481
|
-
shared.hasOwn(normalizedProps, key)) {
|
|
5482
|
-
accessCache[key] = 3 /* PROPS */;
|
|
5483
|
-
return props[key];
|
|
5484
|
-
}
|
|
5485
|
-
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
5486
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
5487
|
-
return ctx[key];
|
|
5488
|
-
}
|
|
5489
|
-
else if (shouldCacheAccess) {
|
|
5490
|
-
accessCache[key] = 0 /* OTHER */;
|
|
5491
|
-
}
|
|
5492
|
-
}
|
|
5493
|
-
const publicGetter = publicPropertiesMap[key];
|
|
5494
|
-
let cssModule, globalProperties;
|
|
5495
|
-
// public $xxx properties
|
|
5496
|
-
if (publicGetter) {
|
|
5497
|
-
if (key === '$attrs') {
|
|
5498
|
-
reactivity.track(instance, "get" /* GET */, key);
|
|
5603
|
+
else if (key === 'style') {
|
|
5604
|
+
ret.style = shared.normalizeStyle([ret.style, toMerge.style]);
|
|
5499
5605
|
}
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
5511
|
-
return ctx[key];
|
|
5512
|
-
}
|
|
5513
|
-
else if (
|
|
5514
|
-
// global properties
|
|
5515
|
-
((globalProperties = appContext.config.globalProperties),
|
|
5516
|
-
shared.hasOwn(globalProperties, key))) {
|
|
5517
|
-
{
|
|
5518
|
-
return globalProperties[key];
|
|
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
|
+
}
|
|
5519
5616
|
}
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
},
|
|
5523
|
-
set({ _: instance }, key, value) {
|
|
5524
|
-
const { data, setupState, ctx } = instance;
|
|
5525
|
-
if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
|
|
5526
|
-
setupState[key] = value;
|
|
5527
|
-
return true;
|
|
5528
|
-
}
|
|
5529
|
-
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
5530
|
-
data[key] = value;
|
|
5531
|
-
return true;
|
|
5532
|
-
}
|
|
5533
|
-
else if (shared.hasOwn(instance.props, key)) {
|
|
5534
|
-
return false;
|
|
5535
|
-
}
|
|
5536
|
-
if (key[0] === '$' && key.slice(1) in instance) {
|
|
5537
|
-
return false;
|
|
5538
|
-
}
|
|
5539
|
-
else {
|
|
5540
|
-
{
|
|
5541
|
-
ctx[key] = value;
|
|
5617
|
+
else if (key !== '') {
|
|
5618
|
+
ret[key] = toMerge[key];
|
|
5542
5619
|
}
|
|
5543
5620
|
}
|
|
5544
|
-
return true;
|
|
5545
|
-
},
|
|
5546
|
-
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
5547
|
-
let normalizedProps;
|
|
5548
|
-
return (!!accessCache[key] ||
|
|
5549
|
-
(data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
|
|
5550
|
-
(setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
|
|
5551
|
-
((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
|
|
5552
|
-
shared.hasOwn(ctx, key) ||
|
|
5553
|
-
shared.hasOwn(publicPropertiesMap, key) ||
|
|
5554
|
-
shared.hasOwn(appContext.config.globalProperties, key));
|
|
5555
|
-
},
|
|
5556
|
-
defineProperty(target, key, descriptor) {
|
|
5557
|
-
if (descriptor.get != null) {
|
|
5558
|
-
this.set(target, key, descriptor.get(), null);
|
|
5559
|
-
}
|
|
5560
|
-
else if (descriptor.value != null) {
|
|
5561
|
-
this.set(target, key, descriptor.value, null);
|
|
5562
|
-
}
|
|
5563
|
-
return Reflect.defineProperty(target, key, descriptor);
|
|
5564
|
-
}
|
|
5565
|
-
};
|
|
5566
|
-
const RuntimeCompiledPublicInstanceProxyHandlers = /*#__PURE__*/ shared.extend({}, PublicInstanceProxyHandlers, {
|
|
5567
|
-
get(target, key) {
|
|
5568
|
-
// fast path for unscopables when using `with` block
|
|
5569
|
-
if (key === Symbol.unscopables) {
|
|
5570
|
-
return;
|
|
5571
|
-
}
|
|
5572
|
-
return PublicInstanceProxyHandlers.get(target, key, target);
|
|
5573
|
-
},
|
|
5574
|
-
has(_, key) {
|
|
5575
|
-
const has = key[0] !== '_' && !shared.isGloballyWhitelisted(key);
|
|
5576
|
-
return has;
|
|
5577
5621
|
}
|
|
5578
|
-
|
|
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
|
+
}
|
|
5579
5630
|
|
|
5580
5631
|
const emptyAppContext = createAppContext();
|
|
5581
5632
|
let uid$1 = 0;
|
|
@@ -5603,7 +5654,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
5603
5654
|
provides: parent ? parent.provides : Object.create(appContext.provides),
|
|
5604
5655
|
accessCache: null,
|
|
5605
5656
|
renderCache: [],
|
|
5606
|
-
// local
|
|
5657
|
+
// local resolved assets
|
|
5607
5658
|
components: null,
|
|
5608
5659
|
directives: null,
|
|
5609
5660
|
// resolved props and emits options
|
|
@@ -6069,7 +6120,7 @@ function isMemoSame(cached, memo) {
|
|
|
6069
6120
|
return false;
|
|
6070
6121
|
}
|
|
6071
6122
|
for (let i = 0; i < prev.length; i++) {
|
|
6072
|
-
if (prev[i]
|
|
6123
|
+
if (shared.hasChanged(prev[i], memo[i])) {
|
|
6073
6124
|
return false;
|
|
6074
6125
|
}
|
|
6075
6126
|
}
|
|
@@ -6081,7 +6132,7 @@ function isMemoSame(cached, memo) {
|
|
|
6081
6132
|
}
|
|
6082
6133
|
|
|
6083
6134
|
// Core API ------------------------------------------------------------------
|
|
6084
|
-
const version = "3.2.
|
|
6135
|
+
const version = "3.2.34-beta.1";
|
|
6085
6136
|
const _ssrUtils = {
|
|
6086
6137
|
createComponentInstance,
|
|
6087
6138
|
setupComponent,
|