@vue/runtime-core 3.1.0-beta.5 → 3.1.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 +360 -319
- package/dist/runtime-core.cjs.prod.js +325 -280
- package/dist/runtime-core.d.ts +40 -10
- package/dist/runtime-core.esm-bundler.js +364 -322
- package/package.json +3 -3
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -375,7 +375,7 @@ function flushJobs(seen) {
|
|
|
375
375
|
try {
|
|
376
376
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
377
377
|
const job = queue[flushIndex];
|
|
378
|
-
if (job) {
|
|
378
|
+
if (job && job.active !== false) {
|
|
379
379
|
if (true && checkRecursiveUpdates(seen, job)) {
|
|
380
380
|
continue;
|
|
381
381
|
}
|
|
@@ -557,7 +557,7 @@ function devtoolsInitApp(app, version) {
|
|
|
557
557
|
exports.devtools.emit("app:init" /* APP_INIT */, app, version, {
|
|
558
558
|
Fragment,
|
|
559
559
|
Text,
|
|
560
|
-
Comment,
|
|
560
|
+
Comment: Comment$1,
|
|
561
561
|
Static
|
|
562
562
|
});
|
|
563
563
|
}
|
|
@@ -887,7 +887,7 @@ function warnDeprecation(key, instance, ...args) {
|
|
|
887
887
|
warnCount[dupKey] = 0;
|
|
888
888
|
const { message, link } = deprecationData[key];
|
|
889
889
|
warn(`(deprecation ${key}) ${typeof message === 'function' ? message(...args) : message}${link ? `\n Details: ${link}` : ``}`);
|
|
890
|
-
if (!isCompatEnabled(key, instance)) {
|
|
890
|
+
if (!isCompatEnabled(key, instance, true)) {
|
|
891
891
|
console.error(`^ The above deprecation's compat behavior is disabled and will likely ` +
|
|
892
892
|
`lead to runtime errors.`);
|
|
893
893
|
}
|
|
@@ -994,8 +994,10 @@ function emit(instance, event, ...rawArgs) {
|
|
|
994
994
|
}
|
|
995
995
|
}
|
|
996
996
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
997
|
-
|
|
998
|
-
|
|
997
|
+
const cache = appContext.emitsCache;
|
|
998
|
+
const cached = cache.get(comp);
|
|
999
|
+
if (cached !== undefined) {
|
|
1000
|
+
return cached;
|
|
999
1001
|
}
|
|
1000
1002
|
const raw = comp.emits;
|
|
1001
1003
|
let normalized = {};
|
|
@@ -1020,7 +1022,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
1020
1022
|
}
|
|
1021
1023
|
}
|
|
1022
1024
|
if (!raw && !hasExtends) {
|
|
1023
|
-
|
|
1025
|
+
cache.set(comp, null);
|
|
1026
|
+
return null;
|
|
1024
1027
|
}
|
|
1025
1028
|
if (shared.isArray(raw)) {
|
|
1026
1029
|
raw.forEach(key => (normalized[key] = null));
|
|
@@ -1028,7 +1031,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
1028
1031
|
else {
|
|
1029
1032
|
shared.extend(normalized, raw);
|
|
1030
1033
|
}
|
|
1031
|
-
|
|
1034
|
+
cache.set(comp, normalized);
|
|
1035
|
+
return normalized;
|
|
1032
1036
|
}
|
|
1033
1037
|
// Check if an incoming prop key is a declared emit event listener.
|
|
1034
1038
|
// e.g. With `emits: { click: null }`, props named `onClick` and `onclick` are
|
|
@@ -1138,7 +1142,7 @@ function markAttrsAccessed() {
|
|
|
1138
1142
|
accessedAttrs = true;
|
|
1139
1143
|
}
|
|
1140
1144
|
function renderComponentRoot(instance) {
|
|
1141
|
-
const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx } = instance;
|
|
1145
|
+
const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
|
|
1142
1146
|
let result;
|
|
1143
1147
|
const prev = setCurrentRenderingInstance(instance);
|
|
1144
1148
|
{
|
|
@@ -1187,7 +1191,7 @@ function renderComponentRoot(instance) {
|
|
|
1187
1191
|
;
|
|
1188
1192
|
[root, setRoot] = getChildRoot(result);
|
|
1189
1193
|
}
|
|
1190
|
-
if (fallthroughAttrs &&
|
|
1194
|
+
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
1191
1195
|
const keys = Object.keys(fallthroughAttrs);
|
|
1192
1196
|
const { shapeFlag } = root;
|
|
1193
1197
|
if (keys.length) {
|
|
@@ -1202,7 +1206,7 @@ function renderComponentRoot(instance) {
|
|
|
1202
1206
|
}
|
|
1203
1207
|
root = cloneVNode(root, fallthroughAttrs);
|
|
1204
1208
|
}
|
|
1205
|
-
else if (true && !accessedAttrs && root.type !== Comment) {
|
|
1209
|
+
else if (true && !accessedAttrs && root.type !== Comment$1) {
|
|
1206
1210
|
const allAttrs = Object.keys(attrs);
|
|
1207
1211
|
const eventAttrs = [];
|
|
1208
1212
|
const extraAttrs = [];
|
|
@@ -1268,7 +1272,7 @@ function renderComponentRoot(instance) {
|
|
|
1268
1272
|
catch (err) {
|
|
1269
1273
|
blockStack.length = 0;
|
|
1270
1274
|
handleError(err, instance, 1 /* RENDER_FUNCTION */);
|
|
1271
|
-
result = createVNode(Comment);
|
|
1275
|
+
result = createVNode(Comment$1);
|
|
1272
1276
|
}
|
|
1273
1277
|
setCurrentRenderingInstance(prev);
|
|
1274
1278
|
return result;
|
|
@@ -1307,7 +1311,7 @@ function filterSingleRoot(children) {
|
|
|
1307
1311
|
const child = children[i];
|
|
1308
1312
|
if (isVNode(child)) {
|
|
1309
1313
|
// ignore user comment
|
|
1310
|
-
if (child.type !== Comment || child.children === 'v-if') {
|
|
1314
|
+
if (child.type !== Comment$1 || child.children === 'v-if') {
|
|
1311
1315
|
if (singleRoot) {
|
|
1312
1316
|
// has more than 1 non-comment child, return now
|
|
1313
1317
|
return;
|
|
@@ -1344,7 +1348,7 @@ const filterModelListeners = (attrs, props) => {
|
|
|
1344
1348
|
const isElementRoot = (vnode) => {
|
|
1345
1349
|
return (vnode.shapeFlag & 6 /* COMPONENT */ ||
|
|
1346
1350
|
vnode.shapeFlag & 1 /* ELEMENT */ ||
|
|
1347
|
-
vnode.type === Comment // potential v-if branch switch
|
|
1351
|
+
vnode.type === Comment$1 // potential v-if branch switch
|
|
1348
1352
|
);
|
|
1349
1353
|
};
|
|
1350
1354
|
function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
|
@@ -1450,7 +1454,8 @@ const SuspenseImpl = {
|
|
|
1450
1454
|
}
|
|
1451
1455
|
},
|
|
1452
1456
|
hydrate: hydrateSuspense,
|
|
1453
|
-
create: createSuspenseBoundary
|
|
1457
|
+
create: createSuspenseBoundary,
|
|
1458
|
+
normalize: normalizeSuspenseChildren
|
|
1454
1459
|
};
|
|
1455
1460
|
// Force-casted public typing for h and TSX props inference
|
|
1456
1461
|
const Suspense = (SuspenseImpl
|
|
@@ -1795,24 +1800,29 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl
|
|
|
1795
1800
|
}
|
|
1796
1801
|
function normalizeSuspenseChildren(vnode) {
|
|
1797
1802
|
const { shapeFlag, children } = vnode;
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
}
|
|
1804
|
-
else {
|
|
1805
|
-
content = normalizeSuspenseSlot(children);
|
|
1806
|
-
fallback = normalizeVNode(null);
|
|
1807
|
-
}
|
|
1808
|
-
return {
|
|
1809
|
-
content,
|
|
1810
|
-
fallback
|
|
1811
|
-
};
|
|
1803
|
+
const isSlotChildren = shapeFlag & 32 /* SLOTS_CHILDREN */;
|
|
1804
|
+
vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children);
|
|
1805
|
+
vnode.ssFallback = isSlotChildren
|
|
1806
|
+
? normalizeSuspenseSlot(children.fallback)
|
|
1807
|
+
: createVNode(Comment);
|
|
1812
1808
|
}
|
|
1813
1809
|
function normalizeSuspenseSlot(s) {
|
|
1810
|
+
let block;
|
|
1814
1811
|
if (shared.isFunction(s)) {
|
|
1812
|
+
const isCompiledSlot = s._c;
|
|
1813
|
+
if (isCompiledSlot) {
|
|
1814
|
+
// disableTracking: false
|
|
1815
|
+
// allow block tracking for compiled slots
|
|
1816
|
+
// (see ./componentRenderContext.ts)
|
|
1817
|
+
s._d = false;
|
|
1818
|
+
openBlock();
|
|
1819
|
+
}
|
|
1815
1820
|
s = s();
|
|
1821
|
+
if (isCompiledSlot) {
|
|
1822
|
+
s._d = true;
|
|
1823
|
+
block = currentBlock;
|
|
1824
|
+
closeBlock();
|
|
1825
|
+
}
|
|
1816
1826
|
}
|
|
1817
1827
|
if (shared.isArray(s)) {
|
|
1818
1828
|
const singleChild = filterSingleRoot(s);
|
|
@@ -1821,7 +1831,11 @@ function normalizeSuspenseSlot(s) {
|
|
|
1821
1831
|
}
|
|
1822
1832
|
s = singleChild;
|
|
1823
1833
|
}
|
|
1824
|
-
|
|
1834
|
+
s = normalizeVNode(s);
|
|
1835
|
+
if (block) {
|
|
1836
|
+
s.dynamicChildren = block.filter(c => c !== s);
|
|
1837
|
+
}
|
|
1838
|
+
return s;
|
|
1825
1839
|
}
|
|
1826
1840
|
function queueEffectWithSuspense(fn, suspense) {
|
|
1827
1841
|
if (suspense && suspense.pendingBranch) {
|
|
@@ -2043,7 +2057,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
2043
2057
|
job.allowRecurse = !!cb;
|
|
2044
2058
|
let scheduler;
|
|
2045
2059
|
if (flush === 'sync') {
|
|
2046
|
-
scheduler = job;
|
|
2060
|
+
scheduler = job; // the scheduler function gets called directly
|
|
2047
2061
|
}
|
|
2048
2062
|
else if (flush === 'post') {
|
|
2049
2063
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
@@ -2119,7 +2133,9 @@ function createPathGetter(ctx, path) {
|
|
|
2119
2133
|
};
|
|
2120
2134
|
}
|
|
2121
2135
|
function traverse(value, seen = new Set()) {
|
|
2122
|
-
if (!shared.isObject(value) ||
|
|
2136
|
+
if (!shared.isObject(value) ||
|
|
2137
|
+
seen.has(value) ||
|
|
2138
|
+
value["__v_skip" /* SKIP */]) {
|
|
2123
2139
|
return value;
|
|
2124
2140
|
}
|
|
2125
2141
|
seen.add(value);
|
|
@@ -2233,7 +2249,7 @@ const BaseTransitionImpl = {
|
|
|
2233
2249
|
}
|
|
2234
2250
|
// handle mode
|
|
2235
2251
|
if (oldInnerChild &&
|
|
2236
|
-
oldInnerChild.type !== Comment &&
|
|
2252
|
+
oldInnerChild.type !== Comment$1 &&
|
|
2237
2253
|
(!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
|
|
2238
2254
|
const leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
|
|
2239
2255
|
// update old tree's hooks in case of dynamic transition
|
|
@@ -2248,7 +2264,7 @@ const BaseTransitionImpl = {
|
|
|
2248
2264
|
};
|
|
2249
2265
|
return emptyPlaceholder(child);
|
|
2250
2266
|
}
|
|
2251
|
-
else if (mode === 'in-out' && innerChild.type !== Comment) {
|
|
2267
|
+
else if (mode === 'in-out' && innerChild.type !== Comment$1) {
|
|
2252
2268
|
leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
|
2253
2269
|
const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
|
|
2254
2270
|
leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
|
|
@@ -2440,7 +2456,7 @@ function getTransitionRawChildren(children, keepComment = false) {
|
|
|
2440
2456
|
ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
|
|
2441
2457
|
}
|
|
2442
2458
|
// comment placeholders should be skipped, e.g. v-if
|
|
2443
|
-
else if (keepComment || child.type !== Comment) {
|
|
2459
|
+
else if (keepComment || child.type !== Comment$1) {
|
|
2444
2460
|
ret.push(child);
|
|
2445
2461
|
}
|
|
2446
2462
|
}
|
|
@@ -2938,75 +2954,6 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
2938
2954
|
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
2939
2955
|
}
|
|
2940
2956
|
|
|
2941
|
-
const COMPONENTS = 'components';
|
|
2942
|
-
const DIRECTIVES = 'directives';
|
|
2943
|
-
/**
|
|
2944
|
-
* @private
|
|
2945
|
-
*/
|
|
2946
|
-
function resolveComponent(name, maybeSelfReference) {
|
|
2947
|
-
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
2948
|
-
}
|
|
2949
|
-
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
2950
|
-
/**
|
|
2951
|
-
* @private
|
|
2952
|
-
*/
|
|
2953
|
-
function resolveDynamicComponent(component) {
|
|
2954
|
-
if (shared.isString(component)) {
|
|
2955
|
-
return resolveAsset(COMPONENTS, component, false) || component;
|
|
2956
|
-
}
|
|
2957
|
-
else {
|
|
2958
|
-
// invalid types will fallthrough to createVNode and raise warning
|
|
2959
|
-
return (component || NULL_DYNAMIC_COMPONENT);
|
|
2960
|
-
}
|
|
2961
|
-
}
|
|
2962
|
-
/**
|
|
2963
|
-
* @private
|
|
2964
|
-
*/
|
|
2965
|
-
function resolveDirective(name) {
|
|
2966
|
-
return resolveAsset(DIRECTIVES, name);
|
|
2967
|
-
}
|
|
2968
|
-
// implementation
|
|
2969
|
-
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
2970
|
-
const instance = currentRenderingInstance || currentInstance;
|
|
2971
|
-
if (instance) {
|
|
2972
|
-
const Component = instance.type;
|
|
2973
|
-
// explicit self name has highest priority
|
|
2974
|
-
if (type === COMPONENTS) {
|
|
2975
|
-
const selfName = getComponentName(Component);
|
|
2976
|
-
if (selfName &&
|
|
2977
|
-
(selfName === name ||
|
|
2978
|
-
selfName === shared.camelize(name) ||
|
|
2979
|
-
selfName === shared.capitalize(shared.camelize(name)))) {
|
|
2980
|
-
return Component;
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2983
|
-
const res =
|
|
2984
|
-
// local registration
|
|
2985
|
-
// check instance[type] first for components with mixin or extends.
|
|
2986
|
-
resolve(instance[type] || Component[type], name) ||
|
|
2987
|
-
// global registration
|
|
2988
|
-
resolve(instance.appContext[type], name);
|
|
2989
|
-
if (!res && maybeSelfReference) {
|
|
2990
|
-
// fallback to implicit self-reference
|
|
2991
|
-
return Component;
|
|
2992
|
-
}
|
|
2993
|
-
if (warnMissing && !res) {
|
|
2994
|
-
warn(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
|
|
2995
|
-
}
|
|
2996
|
-
return res;
|
|
2997
|
-
}
|
|
2998
|
-
else {
|
|
2999
|
-
warn(`resolve${shared.capitalize(type.slice(0, -1))} ` +
|
|
3000
|
-
`can only be used in render() or setup().`);
|
|
3001
|
-
}
|
|
3002
|
-
}
|
|
3003
|
-
function resolve(registry, name) {
|
|
3004
|
-
return (registry &&
|
|
3005
|
-
(registry[name] ||
|
|
3006
|
-
registry[shared.camelize(name)] ||
|
|
3007
|
-
registry[shared.capitalize(shared.camelize(name))]));
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
2957
|
function createDuplicateChecker() {
|
|
3011
2958
|
const cache = Object.create(null);
|
|
3012
2959
|
return (type, key) => {
|
|
@@ -3019,38 +2966,26 @@ function createDuplicateChecker() {
|
|
|
3019
2966
|
};
|
|
3020
2967
|
}
|
|
3021
2968
|
let shouldCacheAccess = true;
|
|
3022
|
-
function applyOptions(instance
|
|
2969
|
+
function applyOptions(instance) {
|
|
2970
|
+
const options = resolveMergedOptions(instance);
|
|
2971
|
+
const publicThis = instance.proxy;
|
|
2972
|
+
const ctx = instance.ctx;
|
|
2973
|
+
// do not cache property access on public proxy during state initialization
|
|
2974
|
+
shouldCacheAccess = false;
|
|
2975
|
+
// call beforeCreate first before accessing other options since
|
|
2976
|
+
// the hook may mutate resolved options (#2791)
|
|
2977
|
+
if (options.beforeCreate) {
|
|
2978
|
+
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
2979
|
+
}
|
|
3023
2980
|
const {
|
|
3024
|
-
// composition
|
|
3025
|
-
mixins, extends: extendsOptions,
|
|
3026
2981
|
// state
|
|
3027
2982
|
data: dataOptions, computed: computedOptions, methods, watch: watchOptions, provide: provideOptions, inject: injectOptions,
|
|
3028
2983
|
// lifecycle
|
|
3029
|
-
beforeMount, mounted, beforeUpdate, updated, activated, deactivated, beforeDestroy, beforeUnmount, destroyed, unmounted, render, renderTracked, renderTriggered, errorCaptured, serverPrefetch,
|
|
2984
|
+
created, beforeMount, mounted, beforeUpdate, updated, activated, deactivated, beforeDestroy, beforeUnmount, destroyed, unmounted, render, renderTracked, renderTriggered, errorCaptured, serverPrefetch,
|
|
3030
2985
|
// public API
|
|
3031
|
-
expose
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
const globalMixins = instance.appContext.mixins;
|
|
3035
|
-
if (asMixin && render && instance.render === shared.NOOP) {
|
|
3036
|
-
instance.render = render;
|
|
3037
|
-
}
|
|
3038
|
-
// applyOptions is called non-as-mixin once per instance
|
|
3039
|
-
if (!asMixin) {
|
|
3040
|
-
shouldCacheAccess = false;
|
|
3041
|
-
callSyncHook('beforeCreate', "bc" /* BEFORE_CREATE */, options, instance, globalMixins);
|
|
3042
|
-
shouldCacheAccess = true;
|
|
3043
|
-
// global mixins are applied first
|
|
3044
|
-
applyMixins(instance, globalMixins, deferredData, deferredWatch, deferredProvide);
|
|
3045
|
-
}
|
|
3046
|
-
// extending a base component...
|
|
3047
|
-
if (extendsOptions) {
|
|
3048
|
-
applyOptions(instance, extendsOptions, deferredData, deferredWatch, deferredProvide, true);
|
|
3049
|
-
}
|
|
3050
|
-
// local mixins
|
|
3051
|
-
if (mixins) {
|
|
3052
|
-
applyMixins(instance, mixins, deferredData, deferredWatch, deferredProvide);
|
|
3053
|
-
}
|
|
2986
|
+
expose, inheritAttrs,
|
|
2987
|
+
// assets
|
|
2988
|
+
components, directives, filters } = options;
|
|
3054
2989
|
const checkDuplicateProperties = createDuplicateChecker() ;
|
|
3055
2990
|
{
|
|
3056
2991
|
const [propsOptions] = instance.propsOptions;
|
|
@@ -3094,33 +3029,40 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
|
|
|
3094
3029
|
}
|
|
3095
3030
|
}
|
|
3096
3031
|
}
|
|
3097
|
-
if (
|
|
3098
|
-
if (
|
|
3099
|
-
|
|
3032
|
+
if (dataOptions) {
|
|
3033
|
+
if (!shared.isFunction(dataOptions)) {
|
|
3034
|
+
warn(`The data option must be a function. ` +
|
|
3035
|
+
`Plain object usage is no longer supported.`);
|
|
3100
3036
|
}
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3037
|
+
const data = dataOptions.call(publicThis, publicThis);
|
|
3038
|
+
if (shared.isPromise(data)) {
|
|
3039
|
+
warn(`data() returned a Promise - note data() cannot be async; If you ` +
|
|
3040
|
+
`intend to perform data fetching before component renders, use ` +
|
|
3041
|
+
`async setup() + <Suspense>.`);
|
|
3104
3042
|
}
|
|
3105
|
-
{
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3043
|
+
if (!shared.isObject(data)) {
|
|
3044
|
+
warn(`data() should return an object.`);
|
|
3045
|
+
}
|
|
3046
|
+
else {
|
|
3047
|
+
instance.data = reactivity.reactive(data);
|
|
3048
|
+
{
|
|
3049
|
+
for (const key in data) {
|
|
3050
|
+
checkDuplicateProperties("Data" /* DATA */, key);
|
|
3051
|
+
// expose data on ctx during dev
|
|
3052
|
+
if (key[0] !== '$' && key[0] !== '_') {
|
|
3053
|
+
Object.defineProperty(ctx, key, {
|
|
3054
|
+
configurable: true,
|
|
3055
|
+
enumerable: true,
|
|
3056
|
+
get: () => data[key],
|
|
3057
|
+
set: shared.NOOP
|
|
3058
|
+
});
|
|
3059
|
+
}
|
|
3117
3060
|
}
|
|
3118
3061
|
}
|
|
3119
3062
|
}
|
|
3120
3063
|
}
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
}
|
|
3064
|
+
// state initialization complete at this point - start caching access
|
|
3065
|
+
shouldCacheAccess = true;
|
|
3124
3066
|
if (computedOptions) {
|
|
3125
3067
|
for (const key in computedOptions) {
|
|
3126
3068
|
const opt = computedOptions[key];
|
|
@@ -3154,42 +3096,26 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
|
|
|
3154
3096
|
}
|
|
3155
3097
|
}
|
|
3156
3098
|
if (watchOptions) {
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
deferredWatch.forEach(watchOptions => {
|
|
3161
|
-
for (const key in watchOptions) {
|
|
3162
|
-
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
3163
|
-
}
|
|
3164
|
-
});
|
|
3099
|
+
for (const key in watchOptions) {
|
|
3100
|
+
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
3101
|
+
}
|
|
3165
3102
|
}
|
|
3166
3103
|
if (provideOptions) {
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
? provideOptions.call(publicThis)
|
|
3173
|
-
: provideOptions;
|
|
3174
|
-
Reflect.ownKeys(provides).forEach(key => {
|
|
3175
|
-
provide(key, provides[key]);
|
|
3176
|
-
});
|
|
3104
|
+
const provides = shared.isFunction(provideOptions)
|
|
3105
|
+
? provideOptions.call(publicThis)
|
|
3106
|
+
: provideOptions;
|
|
3107
|
+
Reflect.ownKeys(provides).forEach(key => {
|
|
3108
|
+
provide(key, provides[key]);
|
|
3177
3109
|
});
|
|
3178
3110
|
}
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
// resolved asset registry attached to instance.
|
|
3182
|
-
if (asMixin) {
|
|
3183
|
-
resolveInstanceAssets(instance, options, COMPONENTS);
|
|
3184
|
-
resolveInstanceAssets(instance, options, DIRECTIVES);
|
|
3185
|
-
}
|
|
3186
|
-
// lifecycle options
|
|
3187
|
-
if (!asMixin) {
|
|
3188
|
-
callSyncHook('created', "c" /* CREATED */, options, instance, globalMixins);
|
|
3111
|
+
if (created) {
|
|
3112
|
+
callHook(created, instance, "c" /* CREATED */);
|
|
3189
3113
|
}
|
|
3190
3114
|
function registerLifecycleHook(register, hook) {
|
|
3191
|
-
|
|
3192
|
-
|
|
3115
|
+
if (shared.isArray(hook)) {
|
|
3116
|
+
hook.forEach(_hook => register(_hook.bind(publicThis)));
|
|
3117
|
+
}
|
|
3118
|
+
else if (hook) {
|
|
3193
3119
|
register(hook.bind(publicThis));
|
|
3194
3120
|
}
|
|
3195
3121
|
}
|
|
@@ -3206,105 +3132,57 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
|
|
|
3206
3132
|
registerLifecycleHook(onUnmounted, unmounted);
|
|
3207
3133
|
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
3208
3134
|
if (shared.isArray(expose)) {
|
|
3209
|
-
if (
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
});
|
|
3215
|
-
}
|
|
3216
|
-
else if (!instance.exposed) {
|
|
3217
|
-
instance.exposed = shared.EMPTY_OBJ;
|
|
3218
|
-
}
|
|
3135
|
+
if (expose.length) {
|
|
3136
|
+
const exposed = instance.exposed || (instance.exposed = reactivity.proxyRefs({}));
|
|
3137
|
+
expose.forEach(key => {
|
|
3138
|
+
exposed[key] = reactivity.toRef(publicThis, key);
|
|
3139
|
+
});
|
|
3219
3140
|
}
|
|
3220
|
-
else {
|
|
3221
|
-
|
|
3141
|
+
else if (!instance.exposed) {
|
|
3142
|
+
instance.exposed = shared.EMPTY_OBJ;
|
|
3222
3143
|
}
|
|
3223
3144
|
}
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
if (
|
|
3227
|
-
|
|
3228
|
-
(instance[type] = shared.extend({}, instance.type[type])), mixin[type]);
|
|
3145
|
+
// options that are handled when creating the instance but also need to be
|
|
3146
|
+
// applied from mixins
|
|
3147
|
+
if (render && instance.render === shared.NOOP) {
|
|
3148
|
+
instance.render = render;
|
|
3229
3149
|
}
|
|
3150
|
+
if (inheritAttrs != null) {
|
|
3151
|
+
instance.inheritAttrs = inheritAttrs;
|
|
3152
|
+
}
|
|
3153
|
+
// asset options.
|
|
3154
|
+
if (components)
|
|
3155
|
+
instance.components = components;
|
|
3156
|
+
if (directives)
|
|
3157
|
+
instance.directives = directives;
|
|
3230
3158
|
}
|
|
3231
3159
|
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
|
|
3232
3160
|
if (shared.isArray(injectOptions)) {
|
|
3233
|
-
|
|
3234
|
-
const key = injectOptions[i];
|
|
3235
|
-
ctx[key] = inject(key);
|
|
3236
|
-
{
|
|
3237
|
-
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
3238
|
-
}
|
|
3239
|
-
}
|
|
3161
|
+
injectOptions = normalizeInject(injectOptions);
|
|
3240
3162
|
}
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
if (
|
|
3163
|
+
for (const key in injectOptions) {
|
|
3164
|
+
const opt = injectOptions[key];
|
|
3165
|
+
if (shared.isObject(opt)) {
|
|
3166
|
+
if ('default' in opt) {
|
|
3245
3167
|
ctx[key] = inject(opt.from || key, opt.default, true /* treat default function as factory */);
|
|
3246
3168
|
}
|
|
3247
3169
|
else {
|
|
3248
|
-
ctx[key] = inject(opt);
|
|
3249
|
-
}
|
|
3250
|
-
{
|
|
3251
|
-
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
3170
|
+
ctx[key] = inject(opt.from || key);
|
|
3252
3171
|
}
|
|
3253
3172
|
}
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
function callSyncHook(name, type, options, instance, globalMixins) {
|
|
3257
|
-
for (let i = 0; i < globalMixins.length; i++) {
|
|
3258
|
-
callHookWithMixinAndExtends(name, type, globalMixins[i], instance);
|
|
3259
|
-
}
|
|
3260
|
-
callHookWithMixinAndExtends(name, type, options, instance);
|
|
3261
|
-
}
|
|
3262
|
-
function callHookWithMixinAndExtends(name, type, options, instance) {
|
|
3263
|
-
const { extends: base, mixins } = options;
|
|
3264
|
-
const selfHook = options[name];
|
|
3265
|
-
if (base) {
|
|
3266
|
-
callHookWithMixinAndExtends(name, type, base, instance);
|
|
3267
|
-
}
|
|
3268
|
-
if (mixins) {
|
|
3269
|
-
for (let i = 0; i < mixins.length; i++) {
|
|
3270
|
-
callHookWithMixinAndExtends(name, type, mixins[i], instance);
|
|
3173
|
+
else {
|
|
3174
|
+
ctx[key] = inject(opt);
|
|
3271
3175
|
}
|
|
3272
|
-
}
|
|
3273
|
-
if (selfHook) {
|
|
3274
|
-
callWithAsyncErrorHandling(selfHook.bind(instance.proxy), instance, type);
|
|
3275
|
-
}
|
|
3276
|
-
}
|
|
3277
|
-
function applyMixins(instance, mixins, deferredData, deferredWatch, deferredProvide) {
|
|
3278
|
-
for (let i = 0; i < mixins.length; i++) {
|
|
3279
|
-
applyOptions(instance, mixins[i], deferredData, deferredWatch, deferredProvide, true);
|
|
3280
|
-
}
|
|
3281
|
-
}
|
|
3282
|
-
function resolveData(instance, dataFn, publicThis) {
|
|
3283
|
-
if (!shared.isFunction(dataFn)) {
|
|
3284
|
-
warn(`The data option must be a function. ` +
|
|
3285
|
-
`Plain object usage is no longer supported.`);
|
|
3286
|
-
}
|
|
3287
|
-
shouldCacheAccess = false;
|
|
3288
|
-
const data = dataFn.call(publicThis, publicThis);
|
|
3289
|
-
shouldCacheAccess = true;
|
|
3290
|
-
if (shared.isPromise(data)) {
|
|
3291
|
-
warn(`data() returned a Promise - note data() cannot be async; If you ` +
|
|
3292
|
-
`intend to perform data fetching before component renders, use ` +
|
|
3293
|
-
`async setup() + <Suspense>.`);
|
|
3294
|
-
}
|
|
3295
|
-
if (!shared.isObject(data)) {
|
|
3296
|
-
warn(`data() should return an object.`);
|
|
3297
|
-
}
|
|
3298
|
-
else if (instance.data === shared.EMPTY_OBJ) {
|
|
3299
|
-
instance.data = reactivity.reactive(data);
|
|
3300
|
-
}
|
|
3301
|
-
else {
|
|
3302
|
-
// existing data: this is a mixin or extends.
|
|
3303
3176
|
{
|
|
3304
|
-
|
|
3177
|
+
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
3305
3178
|
}
|
|
3306
3179
|
}
|
|
3307
3180
|
}
|
|
3181
|
+
function callHook(hook, instance, type) {
|
|
3182
|
+
callWithAsyncErrorHandling(shared.isArray(hook)
|
|
3183
|
+
? hook.map(h => h.bind(instance.proxy))
|
|
3184
|
+
: hook.bind(instance.proxy), instance, type);
|
|
3185
|
+
}
|
|
3308
3186
|
function createWatcher(raw, ctx, publicThis, key) {
|
|
3309
3187
|
const getter = key.includes('.')
|
|
3310
3188
|
? createPathGetter(publicThis, key)
|
|
@@ -3341,33 +3219,115 @@ function createWatcher(raw, ctx, publicThis, key) {
|
|
|
3341
3219
|
warn(`Invalid watch option: "${key}"`, raw);
|
|
3342
3220
|
}
|
|
3343
3221
|
}
|
|
3222
|
+
/**
|
|
3223
|
+
* Resolve merged options and cache it on the component.
|
|
3224
|
+
* This is done only once per-component since the merging does not involve
|
|
3225
|
+
* instances.
|
|
3226
|
+
*/
|
|
3344
3227
|
function resolveMergedOptions(instance) {
|
|
3345
|
-
const
|
|
3346
|
-
const {
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
if (
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
globalMixins.
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
}
|
|
3357
|
-
|
|
3228
|
+
const base = instance.type;
|
|
3229
|
+
const { mixins, extends: extendsOptions } = base;
|
|
3230
|
+
const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;
|
|
3231
|
+
const cached = cache.get(base);
|
|
3232
|
+
let resolved;
|
|
3233
|
+
if (cached) {
|
|
3234
|
+
resolved = cached;
|
|
3235
|
+
}
|
|
3236
|
+
else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
3237
|
+
{
|
|
3238
|
+
resolved = base;
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
else {
|
|
3242
|
+
resolved = {};
|
|
3243
|
+
if (globalMixins.length) {
|
|
3244
|
+
globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
3245
|
+
}
|
|
3246
|
+
mergeOptions(resolved, base, optionMergeStrategies);
|
|
3247
|
+
}
|
|
3248
|
+
cache.set(base, resolved);
|
|
3249
|
+
return resolved;
|
|
3250
|
+
}
|
|
3251
|
+
function mergeOptions(to, from, strats, asMixin = false) {
|
|
3358
3252
|
const { mixins, extends: extendsOptions } = from;
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3253
|
+
if (extendsOptions) {
|
|
3254
|
+
mergeOptions(to, extendsOptions, strats, true);
|
|
3255
|
+
}
|
|
3256
|
+
if (mixins) {
|
|
3257
|
+
mixins.forEach((m) => mergeOptions(to, m, strats, true));
|
|
3258
|
+
}
|
|
3362
3259
|
for (const key in from) {
|
|
3363
|
-
if (
|
|
3364
|
-
|
|
3260
|
+
if (asMixin && key === 'expose') {
|
|
3261
|
+
warn(`"expose" option is ignored when declared in mixins or extends. ` +
|
|
3262
|
+
`It should only be declared in the base component itself.`);
|
|
3365
3263
|
}
|
|
3366
3264
|
else {
|
|
3367
|
-
|
|
3265
|
+
const strat = internalOptionMergeStrats[key] || (strats && strats[key]);
|
|
3266
|
+
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
3368
3267
|
}
|
|
3369
3268
|
}
|
|
3370
3269
|
return to;
|
|
3270
|
+
}
|
|
3271
|
+
const internalOptionMergeStrats = {
|
|
3272
|
+
data: mergeDataFn,
|
|
3273
|
+
props: mergeObjectOptions,
|
|
3274
|
+
emits: mergeObjectOptions,
|
|
3275
|
+
// objects
|
|
3276
|
+
methods: mergeObjectOptions,
|
|
3277
|
+
computed: mergeObjectOptions,
|
|
3278
|
+
// lifecycle
|
|
3279
|
+
beforeCreate: mergeHook,
|
|
3280
|
+
created: mergeHook,
|
|
3281
|
+
beforeMount: mergeHook,
|
|
3282
|
+
mounted: mergeHook,
|
|
3283
|
+
beforeUpdate: mergeHook,
|
|
3284
|
+
updated: mergeHook,
|
|
3285
|
+
beforeDestroy: mergeHook,
|
|
3286
|
+
destroyed: mergeHook,
|
|
3287
|
+
activated: mergeHook,
|
|
3288
|
+
deactivated: mergeHook,
|
|
3289
|
+
errorCaptured: mergeHook,
|
|
3290
|
+
serverPrefetch: mergeHook,
|
|
3291
|
+
// assets
|
|
3292
|
+
components: mergeObjectOptions,
|
|
3293
|
+
directives: mergeObjectOptions,
|
|
3294
|
+
// watch has special merge behavior in v2, but isn't actually needed in v3.
|
|
3295
|
+
// since we are only exposing these for compat and nobody should be relying
|
|
3296
|
+
// on the watch-specific behavior, just expose the object merge strat.
|
|
3297
|
+
watch: mergeObjectOptions,
|
|
3298
|
+
// provide / inject
|
|
3299
|
+
provide: mergeDataFn,
|
|
3300
|
+
inject: mergeInject
|
|
3301
|
+
};
|
|
3302
|
+
function mergeDataFn(to, from) {
|
|
3303
|
+
if (!from) {
|
|
3304
|
+
return to;
|
|
3305
|
+
}
|
|
3306
|
+
if (!to) {
|
|
3307
|
+
return from;
|
|
3308
|
+
}
|
|
3309
|
+
return function mergedDataFn() {
|
|
3310
|
+
return (shared.extend)(shared.isFunction(to) ? to.call(this, this) : to, shared.isFunction(from) ? from.call(this, this) : from);
|
|
3311
|
+
};
|
|
3312
|
+
}
|
|
3313
|
+
function mergeInject(to, from) {
|
|
3314
|
+
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
3315
|
+
}
|
|
3316
|
+
function normalizeInject(raw) {
|
|
3317
|
+
if (shared.isArray(raw)) {
|
|
3318
|
+
const res = {};
|
|
3319
|
+
for (let i = 0; i < raw.length; i++) {
|
|
3320
|
+
res[raw[i]] = raw[i];
|
|
3321
|
+
}
|
|
3322
|
+
return res;
|
|
3323
|
+
}
|
|
3324
|
+
return raw;
|
|
3325
|
+
}
|
|
3326
|
+
function mergeHook(to, from) {
|
|
3327
|
+
return to ? [...new Set([].concat(to, from))] : from;
|
|
3328
|
+
}
|
|
3329
|
+
function mergeObjectOptions(to, from) {
|
|
3330
|
+
return to ? shared.extend(shared.extend(Object.create(null), to), from) : from;
|
|
3371
3331
|
}
|
|
3372
3332
|
|
|
3373
3333
|
function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison
|
|
@@ -3571,8 +3531,10 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
3571
3531
|
return value;
|
|
3572
3532
|
}
|
|
3573
3533
|
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
3574
|
-
|
|
3575
|
-
|
|
3534
|
+
const cache = appContext.propsCache;
|
|
3535
|
+
const cached = cache.get(comp);
|
|
3536
|
+
if (cached) {
|
|
3537
|
+
return cached;
|
|
3576
3538
|
}
|
|
3577
3539
|
const raw = comp.props;
|
|
3578
3540
|
const normalized = {};
|
|
@@ -3598,7 +3560,8 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3598
3560
|
}
|
|
3599
3561
|
}
|
|
3600
3562
|
if (!raw && !hasExtends) {
|
|
3601
|
-
|
|
3563
|
+
cache.set(comp, shared.EMPTY_ARR);
|
|
3564
|
+
return shared.EMPTY_ARR;
|
|
3602
3565
|
}
|
|
3603
3566
|
if (shared.isArray(raw)) {
|
|
3604
3567
|
for (let i = 0; i < raw.length; i++) {
|
|
@@ -3635,7 +3598,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3635
3598
|
}
|
|
3636
3599
|
}
|
|
3637
3600
|
}
|
|
3638
|
-
|
|
3601
|
+
const res = [normalized, needCastKeys];
|
|
3602
|
+
cache.set(comp, res);
|
|
3603
|
+
return res;
|
|
3639
3604
|
}
|
|
3640
3605
|
function validatePropName(key) {
|
|
3641
3606
|
if (key[0] !== '$') {
|
|
@@ -3968,12 +3933,16 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
3968
3933
|
}
|
|
3969
3934
|
let hook = binding.dir[name];
|
|
3970
3935
|
if (hook) {
|
|
3936
|
+
// disable tracking inside all lifecycle hooks
|
|
3937
|
+
// since they can potentially be called inside effects.
|
|
3938
|
+
reactivity.pauseTracking();
|
|
3971
3939
|
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
3972
3940
|
vnode.el,
|
|
3973
3941
|
binding,
|
|
3974
3942
|
vnode,
|
|
3975
3943
|
prevVNode
|
|
3976
3944
|
]);
|
|
3945
|
+
reactivity.resetTracking();
|
|
3977
3946
|
}
|
|
3978
3947
|
}
|
|
3979
3948
|
}
|
|
@@ -3993,7 +3962,10 @@ function createAppContext() {
|
|
|
3993
3962
|
mixins: [],
|
|
3994
3963
|
components: {},
|
|
3995
3964
|
directives: {},
|
|
3996
|
-
provides: Object.create(null)
|
|
3965
|
+
provides: Object.create(null),
|
|
3966
|
+
optionsCache: new WeakMap(),
|
|
3967
|
+
propsCache: new WeakMap(),
|
|
3968
|
+
emitsCache: new WeakMap()
|
|
3997
3969
|
};
|
|
3998
3970
|
}
|
|
3999
3971
|
let uid = 0;
|
|
@@ -4043,11 +4015,6 @@ function createAppAPI(render, hydrate) {
|
|
|
4043
4015
|
{
|
|
4044
4016
|
if (!context.mixins.includes(mixin)) {
|
|
4045
4017
|
context.mixins.push(mixin);
|
|
4046
|
-
// global mixin with props/emits de-optimizes props/emits
|
|
4047
|
-
// normalization caching.
|
|
4048
|
-
if (mixin.props || mixin.emits) {
|
|
4049
|
-
context.deopt = true;
|
|
4050
|
-
}
|
|
4051
4018
|
}
|
|
4052
4019
|
else {
|
|
4053
4020
|
warn('Mixin has already been applied to target app' +
|
|
@@ -4190,7 +4157,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4190
4157
|
nextNode = nextSibling(node);
|
|
4191
4158
|
}
|
|
4192
4159
|
break;
|
|
4193
|
-
case Comment:
|
|
4160
|
+
case Comment$1:
|
|
4194
4161
|
if (domType !== 8 /* COMMENT */ || isFragmentStart) {
|
|
4195
4162
|
nextNode = onMismatch();
|
|
4196
4163
|
}
|
|
@@ -4632,7 +4599,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4632
4599
|
case Text:
|
|
4633
4600
|
processText(n1, n2, container, anchor);
|
|
4634
4601
|
break;
|
|
4635
|
-
case Comment:
|
|
4602
|
+
case Comment$1:
|
|
4636
4603
|
processCommentNode(n1, n2, container, anchor);
|
|
4637
4604
|
break;
|
|
4638
4605
|
case Static:
|
|
@@ -4927,15 +4894,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4927
4894
|
const newVNode = newChildren[i];
|
|
4928
4895
|
// Determine the container (parent element) for the patch.
|
|
4929
4896
|
const container =
|
|
4930
|
-
//
|
|
4931
|
-
//
|
|
4932
|
-
oldVNode.
|
|
4933
|
-
// - In the case of
|
|
4934
|
-
//
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4897
|
+
// oldVNode may be an errored async setup() component inside Suspense
|
|
4898
|
+
// which will not have a mounted element
|
|
4899
|
+
oldVNode.el &&
|
|
4900
|
+
// - In the case of a Fragment, we need to provide the actual parent
|
|
4901
|
+
// of the Fragment itself so it can move its children.
|
|
4902
|
+
(oldVNode.type === Fragment ||
|
|
4903
|
+
// - In the case of different nodes, there is going to be a replacement
|
|
4904
|
+
// which also requires the correct parent container
|
|
4905
|
+
!isSameVNodeType(oldVNode, newVNode) ||
|
|
4906
|
+
// - In the case of a component, it could contain anything.
|
|
4907
|
+
oldVNode.shapeFlag & 6 /* COMPONENT */ ||
|
|
4908
|
+
oldVNode.shapeFlag & 64 /* TELEPORT */)
|
|
4939
4909
|
? hostParentNode(oldVNode.el)
|
|
4940
4910
|
: // In other cases, the parent container is not actually used so we
|
|
4941
4911
|
// just pass the block element here to avoid a DOM parentNode call.
|
|
@@ -4969,7 +4939,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4969
4939
|
const fragmentStartAnchor = (n2.el = n1 ? n1.el : hostCreateText(''));
|
|
4970
4940
|
const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
|
|
4971
4941
|
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
|
4972
|
-
if (
|
|
4942
|
+
if (dynamicChildren) {
|
|
4973
4943
|
optimized = true;
|
|
4974
4944
|
}
|
|
4975
4945
|
// check if this is a slot fragment with :slotted scope ids
|
|
@@ -5068,7 +5038,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5068
5038
|
// Give it a placeholder if this is not hydration
|
|
5069
5039
|
// TODO handle self-defined fallback
|
|
5070
5040
|
if (!initialVNode.el) {
|
|
5071
|
-
const placeholder = (instance.subTree = createVNode(Comment));
|
|
5041
|
+
const placeholder = (instance.subTree = createVNode(Comment$1));
|
|
5072
5042
|
processCommentNode(null, placeholder, container, anchor);
|
|
5073
5043
|
}
|
|
5074
5044
|
return;
|
|
@@ -5815,7 +5785,7 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
5815
5785
|
}
|
|
5816
5786
|
// also inherit for comment nodes, but not placeholders (e.g. v-if which
|
|
5817
5787
|
// would have received .el during block patch)
|
|
5818
|
-
if (c2.type === Comment && !c2.el) {
|
|
5788
|
+
if (c2.type === Comment$1 && !c2.el) {
|
|
5819
5789
|
c2.el = c1.el;
|
|
5820
5790
|
}
|
|
5821
5791
|
}
|
|
@@ -6054,9 +6024,78 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
6054
6024
|
// Force-casted public typing for h and TSX props inference
|
|
6055
6025
|
const Teleport = TeleportImpl;
|
|
6056
6026
|
|
|
6027
|
+
const COMPONENTS = 'components';
|
|
6028
|
+
const DIRECTIVES = 'directives';
|
|
6029
|
+
/**
|
|
6030
|
+
* @private
|
|
6031
|
+
*/
|
|
6032
|
+
function resolveComponent(name, maybeSelfReference) {
|
|
6033
|
+
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
6034
|
+
}
|
|
6035
|
+
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
6036
|
+
/**
|
|
6037
|
+
* @private
|
|
6038
|
+
*/
|
|
6039
|
+
function resolveDynamicComponent(component) {
|
|
6040
|
+
if (shared.isString(component)) {
|
|
6041
|
+
return resolveAsset(COMPONENTS, component, false) || component;
|
|
6042
|
+
}
|
|
6043
|
+
else {
|
|
6044
|
+
// invalid types will fallthrough to createVNode and raise warning
|
|
6045
|
+
return (component || NULL_DYNAMIC_COMPONENT);
|
|
6046
|
+
}
|
|
6047
|
+
}
|
|
6048
|
+
/**
|
|
6049
|
+
* @private
|
|
6050
|
+
*/
|
|
6051
|
+
function resolveDirective(name) {
|
|
6052
|
+
return resolveAsset(DIRECTIVES, name);
|
|
6053
|
+
}
|
|
6054
|
+
// implementation
|
|
6055
|
+
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
6056
|
+
const instance = currentRenderingInstance || currentInstance;
|
|
6057
|
+
if (instance) {
|
|
6058
|
+
const Component = instance.type;
|
|
6059
|
+
// explicit self name has highest priority
|
|
6060
|
+
if (type === COMPONENTS) {
|
|
6061
|
+
const selfName = getComponentName(Component);
|
|
6062
|
+
if (selfName &&
|
|
6063
|
+
(selfName === name ||
|
|
6064
|
+
selfName === shared.camelize(name) ||
|
|
6065
|
+
selfName === shared.capitalize(shared.camelize(name)))) {
|
|
6066
|
+
return Component;
|
|
6067
|
+
}
|
|
6068
|
+
}
|
|
6069
|
+
const res =
|
|
6070
|
+
// local registration
|
|
6071
|
+
// check instance[type] first which is resolved for options API
|
|
6072
|
+
resolve(instance[type] || Component[type], name) ||
|
|
6073
|
+
// global registration
|
|
6074
|
+
resolve(instance.appContext[type], name);
|
|
6075
|
+
if (!res && maybeSelfReference) {
|
|
6076
|
+
// fallback to implicit self-reference
|
|
6077
|
+
return Component;
|
|
6078
|
+
}
|
|
6079
|
+
if (warnMissing && !res) {
|
|
6080
|
+
warn(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
|
|
6081
|
+
}
|
|
6082
|
+
return res;
|
|
6083
|
+
}
|
|
6084
|
+
else {
|
|
6085
|
+
warn(`resolve${shared.capitalize(type.slice(0, -1))} ` +
|
|
6086
|
+
`can only be used in render() or setup().`);
|
|
6087
|
+
}
|
|
6088
|
+
}
|
|
6089
|
+
function resolve(registry, name) {
|
|
6090
|
+
return (registry &&
|
|
6091
|
+
(registry[name] ||
|
|
6092
|
+
registry[shared.camelize(name)] ||
|
|
6093
|
+
registry[shared.capitalize(shared.camelize(name))]));
|
|
6094
|
+
}
|
|
6095
|
+
|
|
6057
6096
|
const Fragment = Symbol('Fragment' );
|
|
6058
6097
|
const Text = Symbol('Text' );
|
|
6059
|
-
const Comment = Symbol('Comment' );
|
|
6098
|
+
const Comment$1 = Symbol('Comment' );
|
|
6060
6099
|
const Static = Symbol('Static' );
|
|
6061
6100
|
// Since v-if and v-for are the two possible ways node structure can dynamically
|
|
6062
6101
|
// change, once we consider v-if branches and each v-for fragment a block, we
|
|
@@ -6175,7 +6214,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6175
6214
|
if (!type) {
|
|
6176
6215
|
warn(`Invalid vnode type when creating vnode: ${type}.`);
|
|
6177
6216
|
}
|
|
6178
|
-
type = Comment;
|
|
6217
|
+
type = Comment$1;
|
|
6179
6218
|
}
|
|
6180
6219
|
if (isVNode(type)) {
|
|
6181
6220
|
// createVNode receiving an existing vnode. This happens in cases like
|
|
@@ -6263,9 +6302,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6263
6302
|
normalizeChildren(vnode, children);
|
|
6264
6303
|
// normalize suspense children
|
|
6265
6304
|
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6266
|
-
|
|
6267
|
-
vnode.ssContent = content;
|
|
6268
|
-
vnode.ssFallback = fallback;
|
|
6305
|
+
type.normalize(vnode);
|
|
6269
6306
|
}
|
|
6270
6307
|
if (isBlockTreeEnabled > 0 &&
|
|
6271
6308
|
// avoid a block node from tracking itself
|
|
@@ -6376,22 +6413,24 @@ function createCommentVNode(text = '',
|
|
|
6376
6413
|
// block to ensure correct updates.
|
|
6377
6414
|
asBlock = false) {
|
|
6378
6415
|
return asBlock
|
|
6379
|
-
? (openBlock(), createBlock(Comment, null, text))
|
|
6380
|
-
: createVNode(Comment, null, text);
|
|
6416
|
+
? (openBlock(), createBlock(Comment$1, null, text))
|
|
6417
|
+
: createVNode(Comment$1, null, text);
|
|
6381
6418
|
}
|
|
6382
6419
|
function normalizeVNode(child) {
|
|
6383
6420
|
if (child == null || typeof child === 'boolean') {
|
|
6384
6421
|
// empty placeholder
|
|
6385
|
-
return createVNode(Comment);
|
|
6422
|
+
return createVNode(Comment$1);
|
|
6386
6423
|
}
|
|
6387
6424
|
else if (shared.isArray(child)) {
|
|
6388
6425
|
// fragment
|
|
6389
|
-
return createVNode(Fragment, null,
|
|
6426
|
+
return createVNode(Fragment, null,
|
|
6427
|
+
// #3666, avoid reference pollution when reusing vnode
|
|
6428
|
+
child.slice());
|
|
6390
6429
|
}
|
|
6391
6430
|
else if (typeof child === 'object') {
|
|
6392
6431
|
// already vnode, this should be the most common since compiled templates
|
|
6393
6432
|
// always produce all-vnode children arrays
|
|
6394
|
-
return
|
|
6433
|
+
return cloneIfMounted(child);
|
|
6395
6434
|
}
|
|
6396
6435
|
else {
|
|
6397
6436
|
// strings and numbers
|
|
@@ -6590,7 +6629,7 @@ function ensureValidVNode(vnodes) {
|
|
|
6590
6629
|
return vnodes.some(child => {
|
|
6591
6630
|
if (!isVNode(child))
|
|
6592
6631
|
return true;
|
|
6593
|
-
if (child.type === Comment)
|
|
6632
|
+
if (child.type === Comment$1)
|
|
6594
6633
|
return false;
|
|
6595
6634
|
if (child.type === Fragment &&
|
|
6596
6635
|
!ensureValidVNode(child.children))
|
|
@@ -6904,6 +6943,8 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
6904
6943
|
emitted: null,
|
|
6905
6944
|
// props default value
|
|
6906
6945
|
propsDefaults: shared.EMPTY_OBJ,
|
|
6946
|
+
// inheritAttrs
|
|
6947
|
+
inheritAttrs: type.inheritAttrs,
|
|
6907
6948
|
// state
|
|
6908
6949
|
ctx: shared.EMPTY_OBJ,
|
|
6909
6950
|
data: shared.EMPTY_OBJ,
|
|
@@ -7127,7 +7168,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
7127
7168
|
{
|
|
7128
7169
|
currentInstance = instance;
|
|
7129
7170
|
reactivity.pauseTracking();
|
|
7130
|
-
applyOptions(instance
|
|
7171
|
+
applyOptions(instance);
|
|
7131
7172
|
reactivity.resetTracking();
|
|
7132
7173
|
currentInstance = null;
|
|
7133
7174
|
}
|
|
@@ -7489,7 +7530,7 @@ function initCustomFormatter() {
|
|
|
7489
7530
|
}
|
|
7490
7531
|
|
|
7491
7532
|
// Core API ------------------------------------------------------------------
|
|
7492
|
-
const version = "3.1.
|
|
7533
|
+
const version = "3.1.1";
|
|
7493
7534
|
const _ssrUtils = {
|
|
7494
7535
|
createComponentInstance,
|
|
7495
7536
|
setupComponent,
|
|
@@ -7535,7 +7576,7 @@ exports.capitalize = shared.capitalize;
|
|
|
7535
7576
|
exports.toDisplayString = shared.toDisplayString;
|
|
7536
7577
|
exports.toHandlerKey = shared.toHandlerKey;
|
|
7537
7578
|
exports.BaseTransition = BaseTransition;
|
|
7538
|
-
exports.Comment = Comment;
|
|
7579
|
+
exports.Comment = Comment$1;
|
|
7539
7580
|
exports.Fragment = Fragment;
|
|
7540
7581
|
exports.KeepAlive = KeepAlive;
|
|
7541
7582
|
exports.Static = Static;
|