提交 fbf930ca 编写于 作者: fxy060608's avatar fxy060608

build(deps): bump vue from 3.1.0-beta.3 to 3.1.0-beta.4

上级 2efa2ca2
...@@ -1460,6 +1460,15 @@ function createDevtoolsComponentHook(hook) { ...@@ -1460,6 +1460,15 @@ function createDevtoolsComponentHook(hook) {
exports.devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component); exports.devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
}; };
} }
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
function createDevtoolsPerformanceHook(hook) {
return (component, type, time) => {
if (!exports.devtools)
return;
exports.devtools.emit(hook, component.appContext.app, component.uid, component, type, time);
};
}
function devtoolsComponentEmit(component, event, params) { function devtoolsComponentEmit(component, event, params) {
if (!exports.devtools) if (!exports.devtools)
return; return;
...@@ -2029,12 +2038,16 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // false on ...@@ -2029,12 +2038,16 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // false on
if (!isRenderingCompiledSlot) { if (!isRenderingCompiledSlot) {
closeBlock(); closeBlock();
} }
{
devtoolsComponentUpdated(ctx);
}
return res; return res;
}; };
// mark this as a compiled slot function. // mark this as a compiled slot function.
// this is used in vnode.ts -> normalizeChildren() to set the slot // this is used in vnode.ts -> normalizeChildren() to set the slot
// rendering flag. // rendering flag.
renderFnWithContext._c = true; // also used to cache the normalized results to avoid repeated normalization
renderFnWithContext._c = renderFnWithContext;
return renderFnWithContext; return renderFnWithContext;
} }
...@@ -3880,7 +3893,8 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [], ...@@ -3880,7 +3893,8 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
instance.render = render; instance.render = render;
} }
// fixed by xxxxxx // fixed by xxxxxx
const customApplyOptions = instance.appContext.config.globalProperties.$applyOptions; const customApplyOptions = instance.appContext.config.globalProperties
.$applyOptions;
if (customApplyOptions) { if (customApplyOptions) {
customApplyOptions(options, instance, publicThis); customApplyOptions(options, instance, publicThis);
} }
...@@ -4284,7 +4298,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { ...@@ -4284,7 +4298,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
} }
else { else {
const camelizedKey = shared.camelize(key); const camelizedKey = shared.camelize(key);
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance); props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
} }
} }
else { else {
...@@ -4317,7 +4331,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { ...@@ -4317,7 +4331,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
(rawPrevProps[key] !== undefined || (rawPrevProps[key] !== undefined ||
// for kebab-case // for kebab-case
rawPrevProps[kebabKey] !== undefined)) { rawPrevProps[kebabKey] !== undefined)) {
props[key] = resolvePropValue(options, rawProps || shared.EMPTY_OBJ, key, undefined, instance); props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */);
} }
} }
else { else {
...@@ -4347,6 +4361,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { ...@@ -4347,6 +4361,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
function setFullProps(instance, rawProps, props, attrs) { function setFullProps(instance, rawProps, props, attrs) {
const [options, needCastKeys] = instance.propsOptions; const [options, needCastKeys] = instance.propsOptions;
let hasAttrsChanged = false; let hasAttrsChanged = false;
let rawCastValues;
if (rawProps) { if (rawProps) {
for (let key in rawProps) { for (let key in rawProps) {
// key, ref are reserved and never passed down // key, ref are reserved and never passed down
...@@ -4358,7 +4373,12 @@ function setFullProps(instance, rawProps, props, attrs) { ...@@ -4358,7 +4373,12 @@ function setFullProps(instance, rawProps, props, attrs) {
// kebab -> camel conversion here we need to camelize the key. // kebab -> camel conversion here we need to camelize the key.
let camelKey; let camelKey;
if (options && shared.hasOwn(options, (camelKey = shared.camelize(key)))) { if (options && shared.hasOwn(options, (camelKey = shared.camelize(key)))) {
props[camelKey] = value; if (!needCastKeys || !needCastKeys.includes(camelKey)) {
props[camelKey] = value;
}
else {
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
}
} }
else if (!isEmitListener(instance.emitsOptions, key)) { else if (!isEmitListener(instance.emitsOptions, key)) {
if (value !== attrs[key]) { if (value !== attrs[key]) {
...@@ -4370,14 +4390,15 @@ function setFullProps(instance, rawProps, props, attrs) { ...@@ -4370,14 +4390,15 @@ function setFullProps(instance, rawProps, props, attrs) {
} }
if (needCastKeys) { if (needCastKeys) {
const rawCurrentProps = toRaw(props); const rawCurrentProps = toRaw(props);
const castValues = rawCastValues || shared.EMPTY_OBJ;
for (let i = 0; i < needCastKeys.length; i++) { for (let i = 0; i < needCastKeys.length; i++) {
const key = needCastKeys[i]; const key = needCastKeys[i];
props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance); props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !shared.hasOwn(castValues, key));
} }
} }
return hasAttrsChanged; return hasAttrsChanged;
} }
function resolvePropValue(options, props, key, value, instance) { function resolvePropValue(options, props, key, value, instance, isAbsent) {
const opt = options[key]; const opt = options[key];
if (opt != null) { if (opt != null) {
const hasDefault = shared.hasOwn(opt, 'default'); const hasDefault = shared.hasOwn(opt, 'default');
...@@ -4401,7 +4422,7 @@ function resolvePropValue(options, props, key, value, instance) { ...@@ -4401,7 +4422,7 @@ function resolvePropValue(options, props, key, value, instance) {
} }
// boolean casting // boolean casting
if (opt[0 /* shouldCast */]) { if (opt[0 /* shouldCast */]) {
if (!shared.hasOwn(props, key) && !hasDefault) { if (isAbsent && !hasDefault) {
value = false; value = false;
} }
else if (opt[1 /* shouldCastTrue */] && else if (opt[1 /* shouldCastTrue */] &&
...@@ -4638,14 +4659,15 @@ const isInternalKey = (key) => key[0] === '_' || key === '$stable'; ...@@ -4638,14 +4659,15 @@ const isInternalKey = (key) => key[0] === '_' || key === '$stable';
const normalizeSlotValue = (value) => shared.isArray(value) const normalizeSlotValue = (value) => shared.isArray(value)
? value.map(normalizeVNode) ? value.map(normalizeVNode)
: [normalizeVNode(value)]; : [normalizeVNode(value)];
const normalizeSlot = (key, rawSlot, ctx) => withCtx((props) => { const normalizeSlot = (key, rawSlot, ctx) => rawSlot._c ||
if (currentInstance) { withCtx((props) => {
warn(`Slot "${key}" invoked outside of the render function: ` + if (currentInstance) {
`this will not track dependencies used in the slot. ` + warn(`Slot "${key}" invoked outside of the render function: ` +
`Invoke the slot function inside the render function instead.`); `this will not track dependencies used in the slot. ` +
} `Invoke the slot function inside the render function instead.`);
return normalizeSlotValue(rawSlot(props)); }
}, ctx); return normalizeSlotValue(rawSlot(props));
}, ctx);
const normalizeObjectSlots = (rawSlots, slots, instance) => { const normalizeObjectSlots = (rawSlots, slots, instance) => {
const ctx = rawSlots._ctx; const ctx = rawSlots._ctx;
for (const key in rawSlots) { for (const key in rawSlots) {
...@@ -4678,7 +4700,9 @@ const initSlots = (instance, children) => { ...@@ -4678,7 +4700,9 @@ const initSlots = (instance, children) => {
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) { if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
const type = children._; const type = children._;
if (type) { if (type) {
instance.slots = children; // users can get the shallow readonly version of the slots object through `this.$slots`,
// we should avoid the proxy object polluting the slots of the internal instance
instance.slots = toRaw(children);
// make compiler marker non-enumerable // make compiler marker non-enumerable
shared.def(children, '_', type); shared.def(children, '_', type);
} }
...@@ -5282,6 +5306,9 @@ function startMeasure(instance, type) { ...@@ -5282,6 +5306,9 @@ function startMeasure(instance, type) {
if (instance.appContext.config.performance && isSupported()) { if (instance.appContext.config.performance && isSupported()) {
perf.mark(`vue-${type}-${instance.uid}`); perf.mark(`vue-${type}-${instance.uid}`);
} }
{
devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
}
} }
function endMeasure(instance, type) { function endMeasure(instance, type) {
if (instance.appContext.config.performance && isSupported()) { if (instance.appContext.config.performance && isSupported()) {
...@@ -5292,6 +5319,9 @@ function endMeasure(instance, type) { ...@@ -5292,6 +5319,9 @@ function endMeasure(instance, type) {
perf.clearMarks(startTag); perf.clearMarks(startTag);
perf.clearMarks(endTag); perf.clearMarks(endTag);
} }
{
devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
}
} }
function isSupported() { function isSupported() {
if (supported !== undefined) { if (supported !== undefined) {
...@@ -8388,7 +8418,7 @@ function initCustomFormatter() { ...@@ -8388,7 +8418,7 @@ function initCustomFormatter() {
} }
// Core API ------------------------------------------------------------------ // Core API ------------------------------------------------------------------
const version = "3.1.0-beta.3"; const version = "3.1.0-beta.4";
const _ssrUtils = { const _ssrUtils = {
createComponentInstance, createComponentInstance,
setupComponent, setupComponent,
......
...@@ -1759,6 +1759,15 @@ function createDevtoolsComponentHook(hook) { ...@@ -1759,6 +1759,15 @@ function createDevtoolsComponentHook(hook) {
devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component); devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
}; };
} }
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
function createDevtoolsPerformanceHook(hook) {
return (component, type, time) => {
if (!devtools)
return;
devtools.emit(hook, component.appContext.app, component.uid, component, type, time);
};
}
function devtoolsComponentEmit(component, event, params) { function devtoolsComponentEmit(component, event, params) {
if (!devtools) if (!devtools)
return; return;
...@@ -2250,8 +2259,10 @@ function convertLegacyVModelProps(vnode) { ...@@ -2250,8 +2259,10 @@ function convertLegacyVModelProps(vnode) {
// modelValue -> value // modelValue -> value
// onUpdate:modelValue -> onModelCompat:input // onUpdate:modelValue -> onModelCompat:input
const { prop = 'value', event = 'input' } = type.model || {}; const { prop = 'value', event = 'input' } = type.model || {};
props[prop] = props.modelValue; if (prop !== 'modelValue') {
delete props.modelValue; props[prop] = props.modelValue;
delete props.modelValue;
}
// important: update dynamic props // important: update dynamic props
if (dynamicProps) { if (dynamicProps) {
dynamicProps[dynamicProps.indexOf('modelValue')] = prop; dynamicProps[dynamicProps.indexOf('modelValue')] = prop;
...@@ -2517,12 +2528,16 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // true onl ...@@ -2517,12 +2528,16 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // true onl
if (!isRenderingCompiledSlot) { if (!isRenderingCompiledSlot) {
closeBlock(); closeBlock();
} }
{
devtoolsComponentUpdated(ctx);
}
return res; return res;
}; };
// mark this as a compiled slot function. // mark this as a compiled slot function.
// this is used in vnode.ts -> normalizeChildren() to set the slot // this is used in vnode.ts -> normalizeChildren() to set the slot
// rendering flag. // rendering flag.
renderFnWithContext._c = true; // also used to cache the normalized results to avoid repeated normalization
renderFnWithContext._c = renderFnWithContext;
if (isNonScopedSlot) { if (isNonScopedSlot) {
renderFnWithContext._nonScoped = true; renderFnWithContext._nonScoped = true;
} }
...@@ -4437,7 +4452,8 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [], ...@@ -4437,7 +4452,8 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
instance.render = render; instance.render = render;
} }
// fixed by xxxxxx // fixed by xxxxxx
const customApplyOptions = instance.appContext.config.globalProperties.$applyOptions; const customApplyOptions = instance.appContext.config.globalProperties
.$applyOptions;
if (customApplyOptions) { if (customApplyOptions) {
customApplyOptions(options, instance, publicThis); customApplyOptions(options, instance, publicThis);
} }
...@@ -4912,7 +4928,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { ...@@ -4912,7 +4928,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
} }
else { else {
const camelizedKey = camelize(key); const camelizedKey = camelize(key);
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance); props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
} }
} }
else { else {
...@@ -4953,7 +4969,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { ...@@ -4953,7 +4969,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
(rawPrevProps[key] !== undefined || (rawPrevProps[key] !== undefined ||
// for kebab-case // for kebab-case
rawPrevProps[kebabKey] !== undefined)) { rawPrevProps[kebabKey] !== undefined)) {
props[key] = resolvePropValue(options, rawProps || EMPTY_OBJ, key, undefined, instance); props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */);
} }
} }
else { else {
...@@ -4983,6 +4999,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { ...@@ -4983,6 +4999,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
function setFullProps(instance, rawProps, props, attrs) { function setFullProps(instance, rawProps, props, attrs) {
const [options, needCastKeys] = instance.propsOptions; const [options, needCastKeys] = instance.propsOptions;
let hasAttrsChanged = false; let hasAttrsChanged = false;
let rawCastValues;
if (rawProps) { if (rawProps) {
for (let key in rawProps) { for (let key in rawProps) {
// key, ref are reserved and never passed down // key, ref are reserved and never passed down
...@@ -5002,7 +5019,12 @@ function setFullProps(instance, rawProps, props, attrs) { ...@@ -5002,7 +5019,12 @@ function setFullProps(instance, rawProps, props, attrs) {
// kebab -> camel conversion here we need to camelize the key. // kebab -> camel conversion here we need to camelize the key.
let camelKey; let camelKey;
if (options && hasOwn(options, (camelKey = camelize(key)))) { if (options && hasOwn(options, (camelKey = camelize(key)))) {
props[camelKey] = value; if (!needCastKeys || !needCastKeys.includes(camelKey)) {
props[camelKey] = value;
}
else {
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
}
} }
else if (!isEmitListener(instance.emitsOptions, key)) { else if (!isEmitListener(instance.emitsOptions, key)) {
// Any non-declared (either as a prop or an emitted event) props are put // Any non-declared (either as a prop or an emitted event) props are put
...@@ -5025,14 +5047,15 @@ function setFullProps(instance, rawProps, props, attrs) { ...@@ -5025,14 +5047,15 @@ function setFullProps(instance, rawProps, props, attrs) {
} }
if (needCastKeys) { if (needCastKeys) {
const rawCurrentProps = toRaw(props); const rawCurrentProps = toRaw(props);
const castValues = rawCastValues || EMPTY_OBJ;
for (let i = 0; i < needCastKeys.length; i++) { for (let i = 0; i < needCastKeys.length; i++) {
const key = needCastKeys[i]; const key = needCastKeys[i];
props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance); props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn(castValues, key));
} }
} }
return hasAttrsChanged; return hasAttrsChanged;
} }
function resolvePropValue(options, props, key, value, instance) { function resolvePropValue(options, props, key, value, instance, isAbsent) {
const opt = options[key]; const opt = options[key];
if (opt != null) { if (opt != null) {
const hasDefault = hasOwn(opt, 'default'); const hasDefault = hasOwn(opt, 'default');
...@@ -5058,7 +5081,7 @@ function resolvePropValue(options, props, key, value, instance) { ...@@ -5058,7 +5081,7 @@ function resolvePropValue(options, props, key, value, instance) {
} }
// boolean casting // boolean casting
if (opt[0 /* shouldCast */]) { if (opt[0 /* shouldCast */]) {
if (!hasOwn(props, key) && !hasDefault) { if (isAbsent && !hasDefault) {
value = false; value = false;
} }
else if (opt[1 /* shouldCastTrue */] && else if (opt[1 /* shouldCastTrue */] &&
...@@ -5298,14 +5321,15 @@ const isInternalKey = (key) => key[0] === '_' || key === '$stable'; ...@@ -5298,14 +5321,15 @@ const isInternalKey = (key) => key[0] === '_' || key === '$stable';
const normalizeSlotValue = (value) => isArray(value) const normalizeSlotValue = (value) => isArray(value)
? value.map(normalizeVNode) ? value.map(normalizeVNode)
: [normalizeVNode(value)]; : [normalizeVNode(value)];
const normalizeSlot = (key, rawSlot, ctx) => withCtx((props) => { const normalizeSlot = (key, rawSlot, ctx) => rawSlot._c ||
if (currentInstance) { withCtx((props) => {
warn(`Slot "${key}" invoked outside of the render function: ` + if (currentInstance) {
`this will not track dependencies used in the slot. ` + warn(`Slot "${key}" invoked outside of the render function: ` +
`Invoke the slot function inside the render function instead.`); `this will not track dependencies used in the slot. ` +
} `Invoke the slot function inside the render function instead.`);
return normalizeSlotValue(rawSlot(props)); }
}, ctx); return normalizeSlotValue(rawSlot(props));
}, ctx);
const normalizeObjectSlots = (rawSlots, slots, instance) => { const normalizeObjectSlots = (rawSlots, slots, instance) => {
const ctx = rawSlots._ctx; const ctx = rawSlots._ctx;
for (const key in rawSlots) { for (const key in rawSlots) {
...@@ -5338,7 +5362,9 @@ const initSlots = (instance, children) => { ...@@ -5338,7 +5362,9 @@ const initSlots = (instance, children) => {
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) { if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
const type = children._; const type = children._;
if (type) { if (type) {
instance.slots = children; // users can get the shallow readonly version of the slots object through `this.$slots`,
// we should avoid the proxy object polluting the slots of the internal instance
instance.slots = toRaw(children);
// make compiler marker non-enumerable // make compiler marker non-enumerable
def(children, '_', type); def(children, '_', type);
} }
...@@ -5612,7 +5638,7 @@ function createCompatVue(createApp, createSingletonApp) { ...@@ -5612,7 +5638,7 @@ function createCompatVue(createApp, createSingletonApp) {
return vm; return vm;
} }
} }
Vue.version = "3.1.0-beta.3"; Vue.version = "3.1.0-beta.4";
Vue.config = singletonApp.config; Vue.config = singletonApp.config;
Vue.use = (p, ...options) => { Vue.use = (p, ...options) => {
if (p && isFunction(p.install)) { if (p && isFunction(p.install)) {
...@@ -6487,6 +6513,9 @@ function startMeasure(instance, type) { ...@@ -6487,6 +6513,9 @@ function startMeasure(instance, type) {
if (instance.appContext.config.performance && isSupported()) { if (instance.appContext.config.performance && isSupported()) {
perf.mark(`vue-${type}-${instance.uid}`); perf.mark(`vue-${type}-${instance.uid}`);
} }
{
devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
}
} }
function endMeasure(instance, type) { function endMeasure(instance, type) {
if (instance.appContext.config.performance && isSupported()) { if (instance.appContext.config.performance && isSupported()) {
...@@ -6497,6 +6526,9 @@ function endMeasure(instance, type) { ...@@ -6497,6 +6526,9 @@ function endMeasure(instance, type) {
perf.clearMarks(startTag); perf.clearMarks(startTag);
perf.clearMarks(endTag); perf.clearMarks(endTag);
} }
{
devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
}
} }
function isSupported() { function isSupported() {
if (supported !== undefined) { if (supported !== undefined) {
...@@ -10262,7 +10294,7 @@ function initCustomFormatter() { ...@@ -10262,7 +10294,7 @@ function initCustomFormatter() {
} }
// Core API ------------------------------------------------------------------ // Core API ------------------------------------------------------------------
const version = "3.1.0-beta.3"; const version = "3.1.0-beta.4";
const _ssrUtils = { const _ssrUtils = {
createComponentInstance, createComponentInstance,
setupComponent, setupComponent,
......
...@@ -1766,6 +1766,15 @@ function createDevtoolsComponentHook(hook) { ...@@ -1766,6 +1766,15 @@ function createDevtoolsComponentHook(hook) {
devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component); devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
}; };
} }
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
function createDevtoolsPerformanceHook(hook) {
return (component, type, time) => {
if (!devtools)
return;
devtools.emit(hook, component.appContext.app, component.uid, component, type, time);
};
}
function devtoolsComponentEmit(component, event, params) { function devtoolsComponentEmit(component, event, params) {
if (!devtools) if (!devtools)
return; return;
...@@ -2260,8 +2269,10 @@ function convertLegacyVModelProps(vnode) { ...@@ -2260,8 +2269,10 @@ function convertLegacyVModelProps(vnode) {
// modelValue -> value // modelValue -> value
// onUpdate:modelValue -> onModelCompat:input // onUpdate:modelValue -> onModelCompat:input
const { prop = 'value', event = 'input' } = type.model || {}; const { prop = 'value', event = 'input' } = type.model || {};
props[prop] = props.modelValue; if (prop !== 'modelValue') {
delete props.modelValue; props[prop] = props.modelValue;
delete props.modelValue;
}
// important: update dynamic props // important: update dynamic props
if (dynamicProps) { if (dynamicProps) {
dynamicProps[dynamicProps.indexOf('modelValue')] = prop; dynamicProps[dynamicProps.indexOf('modelValue')] = prop;
...@@ -2527,12 +2538,16 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // true onl ...@@ -2527,12 +2538,16 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // true onl
if (!isRenderingCompiledSlot) { if (!isRenderingCompiledSlot) {
closeBlock(); closeBlock();
} }
if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
devtoolsComponentUpdated(ctx);
}
return res; return res;
}; };
// mark this as a compiled slot function. // mark this as a compiled slot function.
// this is used in vnode.ts -> normalizeChildren() to set the slot // this is used in vnode.ts -> normalizeChildren() to set the slot
// rendering flag. // rendering flag.
renderFnWithContext._c = true; // also used to cache the normalized results to avoid repeated normalization
renderFnWithContext._c = renderFnWithContext;
if (isNonScopedSlot) { if (isNonScopedSlot) {
renderFnWithContext._nonScoped = true; renderFnWithContext._nonScoped = true;
} }
...@@ -4431,7 +4446,8 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [], ...@@ -4431,7 +4446,8 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
instance.render = render; instance.render = render;
} }
// fixed by xxxxxx // fixed by xxxxxx
const customApplyOptions = instance.appContext.config.globalProperties.$applyOptions; const customApplyOptions = instance.appContext.config.globalProperties
.$applyOptions;
if (customApplyOptions) { if (customApplyOptions) {
customApplyOptions(options, instance, publicThis); customApplyOptions(options, instance, publicThis);
} }
...@@ -4912,7 +4928,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { ...@@ -4912,7 +4928,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
} }
else { else {
const camelizedKey = camelize(key); const camelizedKey = camelize(key);
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance); props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
} }
} }
else { else {
...@@ -4953,7 +4969,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { ...@@ -4953,7 +4969,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
(rawPrevProps[key] !== undefined || (rawPrevProps[key] !== undefined ||
// for kebab-case // for kebab-case
rawPrevProps[kebabKey] !== undefined)) { rawPrevProps[kebabKey] !== undefined)) {
props[key] = resolvePropValue(options, rawProps || EMPTY_OBJ, key, undefined, instance); props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */);
} }
} }
else { else {
...@@ -4983,6 +4999,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { ...@@ -4983,6 +4999,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
function setFullProps(instance, rawProps, props, attrs) { function setFullProps(instance, rawProps, props, attrs) {
const [options, needCastKeys] = instance.propsOptions; const [options, needCastKeys] = instance.propsOptions;
let hasAttrsChanged = false; let hasAttrsChanged = false;
let rawCastValues;
if (rawProps) { if (rawProps) {
for (let key in rawProps) { for (let key in rawProps) {
// key, ref are reserved and never passed down // key, ref are reserved and never passed down
...@@ -5002,7 +5019,12 @@ function setFullProps(instance, rawProps, props, attrs) { ...@@ -5002,7 +5019,12 @@ function setFullProps(instance, rawProps, props, attrs) {
// kebab -> camel conversion here we need to camelize the key. // kebab -> camel conversion here we need to camelize the key.
let camelKey; let camelKey;
if (options && hasOwn(options, (camelKey = camelize(key)))) { if (options && hasOwn(options, (camelKey = camelize(key)))) {
props[camelKey] = value; if (!needCastKeys || !needCastKeys.includes(camelKey)) {
props[camelKey] = value;
}
else {
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
}
} }
else if (!isEmitListener(instance.emitsOptions, key)) { else if (!isEmitListener(instance.emitsOptions, key)) {
// Any non-declared (either as a prop or an emitted event) props are put // Any non-declared (either as a prop or an emitted event) props are put
...@@ -5025,14 +5047,15 @@ function setFullProps(instance, rawProps, props, attrs) { ...@@ -5025,14 +5047,15 @@ function setFullProps(instance, rawProps, props, attrs) {
} }
if (needCastKeys) { if (needCastKeys) {
const rawCurrentProps = toRaw(props); const rawCurrentProps = toRaw(props);
const castValues = rawCastValues || EMPTY_OBJ;
for (let i = 0; i < needCastKeys.length; i++) { for (let i = 0; i < needCastKeys.length; i++) {
const key = needCastKeys[i]; const key = needCastKeys[i];
props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance); props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn(castValues, key));
} }
} }
return hasAttrsChanged; return hasAttrsChanged;
} }
function resolvePropValue(options, props, key, value, instance) { function resolvePropValue(options, props, key, value, instance, isAbsent) {
const opt = options[key]; const opt = options[key];
if (opt != null) { if (opt != null) {
const hasDefault = hasOwn(opt, 'default'); const hasDefault = hasOwn(opt, 'default');
...@@ -5058,7 +5081,7 @@ function resolvePropValue(options, props, key, value, instance) { ...@@ -5058,7 +5081,7 @@ function resolvePropValue(options, props, key, value, instance) {
} }
// boolean casting // boolean casting
if (opt[0 /* shouldCast */]) { if (opt[0 /* shouldCast */]) {
if (!hasOwn(props, key) && !hasDefault) { if (isAbsent && !hasDefault) {
value = false; value = false;
} }
else if (opt[1 /* shouldCastTrue */] && else if (opt[1 /* shouldCastTrue */] &&
...@@ -5298,14 +5321,15 @@ const isInternalKey = (key) => key[0] === '_' || key === '$stable'; ...@@ -5298,14 +5321,15 @@ const isInternalKey = (key) => key[0] === '_' || key === '$stable';
const normalizeSlotValue = (value) => isArray(value) const normalizeSlotValue = (value) => isArray(value)
? value.map(normalizeVNode) ? value.map(normalizeVNode)
: [normalizeVNode(value)]; : [normalizeVNode(value)];
const normalizeSlot = (key, rawSlot, ctx) => withCtx((props) => { const normalizeSlot = (key, rawSlot, ctx) => rawSlot._c ||
if ((process.env.NODE_ENV !== 'production') && currentInstance) { withCtx((props) => {
warn(`Slot "${key}" invoked outside of the render function: ` + if ((process.env.NODE_ENV !== 'production') && currentInstance) {
`this will not track dependencies used in the slot. ` + warn(`Slot "${key}" invoked outside of the render function: ` +
`Invoke the slot function inside the render function instead.`); `this will not track dependencies used in the slot. ` +
} `Invoke the slot function inside the render function instead.`);
return normalizeSlotValue(rawSlot(props)); }
}, ctx); return normalizeSlotValue(rawSlot(props));
}, ctx);
const normalizeObjectSlots = (rawSlots, slots, instance) => { const normalizeObjectSlots = (rawSlots, slots, instance) => {
const ctx = rawSlots._ctx; const ctx = rawSlots._ctx;
for (const key in rawSlots) { for (const key in rawSlots) {
...@@ -5340,7 +5364,9 @@ const initSlots = (instance, children) => { ...@@ -5340,7 +5364,9 @@ const initSlots = (instance, children) => {
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) { if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
const type = children._; const type = children._;
if (type) { if (type) {
instance.slots = children; // users can get the shallow readonly version of the slots object through `this.$slots`,
// we should avoid the proxy object polluting the slots of the internal instance
instance.slots = toRaw(children);
// make compiler marker non-enumerable // make compiler marker non-enumerable
def(children, '_', type); def(children, '_', type);
} }
...@@ -5614,7 +5640,7 @@ function createCompatVue(createApp, createSingletonApp) { ...@@ -5614,7 +5640,7 @@ function createCompatVue(createApp, createSingletonApp) {
return vm; return vm;
} }
} }
Vue.version = "3.1.0-beta.3"; Vue.version = "3.1.0-beta.4";
Vue.config = singletonApp.config; Vue.config = singletonApp.config;
Vue.use = (p, ...options) => { Vue.use = (p, ...options) => {
if (p && isFunction(p.install)) { if (p && isFunction(p.install)) {
...@@ -6497,6 +6523,9 @@ function startMeasure(instance, type) { ...@@ -6497,6 +6523,9 @@ function startMeasure(instance, type) {
if (instance.appContext.config.performance && isSupported()) { if (instance.appContext.config.performance && isSupported()) {
perf.mark(`vue-${type}-${instance.uid}`); perf.mark(`vue-${type}-${instance.uid}`);
} }
if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
}
} }
function endMeasure(instance, type) { function endMeasure(instance, type) {
if (instance.appContext.config.performance && isSupported()) { if (instance.appContext.config.performance && isSupported()) {
...@@ -6507,6 +6536,9 @@ function endMeasure(instance, type) { ...@@ -6507,6 +6536,9 @@ function endMeasure(instance, type) {
perf.clearMarks(startTag); perf.clearMarks(startTag);
perf.clearMarks(endTag); perf.clearMarks(endTag);
} }
if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
}
} }
function isSupported() { function isSupported() {
if (supported !== undefined) { if (supported !== undefined) {
...@@ -10323,7 +10355,7 @@ function initCustomFormatter() { ...@@ -10323,7 +10355,7 @@ function initCustomFormatter() {
} }
// Core API ------------------------------------------------------------------ // Core API ------------------------------------------------------------------
const version = "3.1.0-beta.3"; const version = "3.1.0-beta.4";
/** /**
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds. * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
* @internal * @internal
......
...@@ -1466,6 +1466,15 @@ function createDevtoolsComponentHook(hook) { ...@@ -1466,6 +1466,15 @@ function createDevtoolsComponentHook(hook) {
devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component); devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
}; };
} }
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
function createDevtoolsPerformanceHook(hook) {
return (component, type, time) => {
if (!devtools)
return;
devtools.emit(hook, component.appContext.app, component.uid, component, type, time);
};
}
function devtoolsComponentEmit(component, event, params) { function devtoolsComponentEmit(component, event, params) {
if (!devtools) if (!devtools)
return; return;
...@@ -2038,12 +2047,16 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // false on ...@@ -2038,12 +2047,16 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // false on
if (!isRenderingCompiledSlot) { if (!isRenderingCompiledSlot) {
closeBlock(); closeBlock();
} }
if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
devtoolsComponentUpdated(ctx);
}
return res; return res;
}; };
// mark this as a compiled slot function. // mark this as a compiled slot function.
// this is used in vnode.ts -> normalizeChildren() to set the slot // this is used in vnode.ts -> normalizeChildren() to set the slot
// rendering flag. // rendering flag.
renderFnWithContext._c = true; // also used to cache the normalized results to avoid repeated normalization
renderFnWithContext._c = renderFnWithContext;
return renderFnWithContext; return renderFnWithContext;
} }
...@@ -3872,7 +3885,8 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [], ...@@ -3872,7 +3885,8 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
instance.render = render; instance.render = render;
} }
// fixed by xxxxxx // fixed by xxxxxx
const customApplyOptions = instance.appContext.config.globalProperties.$applyOptions; const customApplyOptions = instance.appContext.config.globalProperties
.$applyOptions;
if (customApplyOptions) { if (customApplyOptions) {
customApplyOptions(options, instance, publicThis); customApplyOptions(options, instance, publicThis);
} }
...@@ -4281,7 +4295,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { ...@@ -4281,7 +4295,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
} }
else { else {
const camelizedKey = camelize(key); const camelizedKey = camelize(key);
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance); props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
} }
} }
else { else {
...@@ -4314,7 +4328,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { ...@@ -4314,7 +4328,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
(rawPrevProps[key] !== undefined || (rawPrevProps[key] !== undefined ||
// for kebab-case // for kebab-case
rawPrevProps[kebabKey] !== undefined)) { rawPrevProps[kebabKey] !== undefined)) {
props[key] = resolvePropValue(options, rawProps || EMPTY_OBJ, key, undefined, instance); props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */);
} }
} }
else { else {
...@@ -4344,6 +4358,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { ...@@ -4344,6 +4358,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
function setFullProps(instance, rawProps, props, attrs) { function setFullProps(instance, rawProps, props, attrs) {
const [options, needCastKeys] = instance.propsOptions; const [options, needCastKeys] = instance.propsOptions;
let hasAttrsChanged = false; let hasAttrsChanged = false;
let rawCastValues;
if (rawProps) { if (rawProps) {
for (let key in rawProps) { for (let key in rawProps) {
// key, ref are reserved and never passed down // key, ref are reserved and never passed down
...@@ -4355,7 +4370,12 @@ function setFullProps(instance, rawProps, props, attrs) { ...@@ -4355,7 +4370,12 @@ function setFullProps(instance, rawProps, props, attrs) {
// kebab -> camel conversion here we need to camelize the key. // kebab -> camel conversion here we need to camelize the key.
let camelKey; let camelKey;
if (options && hasOwn(options, (camelKey = camelize(key)))) { if (options && hasOwn(options, (camelKey = camelize(key)))) {
props[camelKey] = value; if (!needCastKeys || !needCastKeys.includes(camelKey)) {
props[camelKey] = value;
}
else {
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
}
} }
else if (!isEmitListener(instance.emitsOptions, key)) { else if (!isEmitListener(instance.emitsOptions, key)) {
if (value !== attrs[key]) { if (value !== attrs[key]) {
...@@ -4367,14 +4387,15 @@ function setFullProps(instance, rawProps, props, attrs) { ...@@ -4367,14 +4387,15 @@ function setFullProps(instance, rawProps, props, attrs) {
} }
if (needCastKeys) { if (needCastKeys) {
const rawCurrentProps = toRaw(props); const rawCurrentProps = toRaw(props);
const castValues = rawCastValues || EMPTY_OBJ;
for (let i = 0; i < needCastKeys.length; i++) { for (let i = 0; i < needCastKeys.length; i++) {
const key = needCastKeys[i]; const key = needCastKeys[i];
props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance); props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn(castValues, key));
} }
} }
return hasAttrsChanged; return hasAttrsChanged;
} }
function resolvePropValue(options, props, key, value, instance) { function resolvePropValue(options, props, key, value, instance, isAbsent) {
const opt = options[key]; const opt = options[key];
if (opt != null) { if (opt != null) {
const hasDefault = hasOwn(opt, 'default'); const hasDefault = hasOwn(opt, 'default');
...@@ -4398,7 +4419,7 @@ function resolvePropValue(options, props, key, value, instance) { ...@@ -4398,7 +4419,7 @@ function resolvePropValue(options, props, key, value, instance) {
} }
// boolean casting // boolean casting
if (opt[0 /* shouldCast */]) { if (opt[0 /* shouldCast */]) {
if (!hasOwn(props, key) && !hasDefault) { if (isAbsent && !hasDefault) {
value = false; value = false;
} }
else if (opt[1 /* shouldCastTrue */] && else if (opt[1 /* shouldCastTrue */] &&
...@@ -4635,14 +4656,15 @@ const isInternalKey = (key) => key[0] === '_' || key === '$stable'; ...@@ -4635,14 +4656,15 @@ const isInternalKey = (key) => key[0] === '_' || key === '$stable';
const normalizeSlotValue = (value) => isArray(value) const normalizeSlotValue = (value) => isArray(value)
? value.map(normalizeVNode) ? value.map(normalizeVNode)
: [normalizeVNode(value)]; : [normalizeVNode(value)];
const normalizeSlot = (key, rawSlot, ctx) => withCtx((props) => { const normalizeSlot = (key, rawSlot, ctx) => rawSlot._c ||
if ((process.env.NODE_ENV !== 'production') && currentInstance) { withCtx((props) => {
warn(`Slot "${key}" invoked outside of the render function: ` + if ((process.env.NODE_ENV !== 'production') && currentInstance) {
`this will not track dependencies used in the slot. ` + warn(`Slot "${key}" invoked outside of the render function: ` +
`Invoke the slot function inside the render function instead.`); `this will not track dependencies used in the slot. ` +
} `Invoke the slot function inside the render function instead.`);
return normalizeSlotValue(rawSlot(props)); }
}, ctx); return normalizeSlotValue(rawSlot(props));
}, ctx);
const normalizeObjectSlots = (rawSlots, slots, instance) => { const normalizeObjectSlots = (rawSlots, slots, instance) => {
const ctx = rawSlots._ctx; const ctx = rawSlots._ctx;
for (const key in rawSlots) { for (const key in rawSlots) {
...@@ -4677,7 +4699,9 @@ const initSlots = (instance, children) => { ...@@ -4677,7 +4699,9 @@ const initSlots = (instance, children) => {
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) { if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
const type = children._; const type = children._;
if (type) { if (type) {
instance.slots = children; // users can get the shallow readonly version of the slots object through `this.$slots`,
// we should avoid the proxy object polluting the slots of the internal instance
instance.slots = toRaw(children);
// make compiler marker non-enumerable // make compiler marker non-enumerable
def(children, '_', type); def(children, '_', type);
} }
...@@ -5287,6 +5311,9 @@ function startMeasure(instance, type) { ...@@ -5287,6 +5311,9 @@ function startMeasure(instance, type) {
if (instance.appContext.config.performance && isSupported()) { if (instance.appContext.config.performance && isSupported()) {
perf.mark(`vue-${type}-${instance.uid}`); perf.mark(`vue-${type}-${instance.uid}`);
} }
if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
}
} }
function endMeasure(instance, type) { function endMeasure(instance, type) {
if (instance.appContext.config.performance && isSupported()) { if (instance.appContext.config.performance && isSupported()) {
...@@ -5297,6 +5324,9 @@ function endMeasure(instance, type) { ...@@ -5297,6 +5324,9 @@ function endMeasure(instance, type) {
perf.clearMarks(startTag); perf.clearMarks(startTag);
perf.clearMarks(endTag); perf.clearMarks(endTag);
} }
if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
}
} }
function isSupported() { function isSupported() {
if (supported !== undefined) { if (supported !== undefined) {
...@@ -8444,7 +8474,7 @@ function initCustomFormatter() { ...@@ -8444,7 +8474,7 @@ function initCustomFormatter() {
} }
// Core API ------------------------------------------------------------------ // Core API ------------------------------------------------------------------
const version = "3.1.0-beta.3"; const version = "3.1.0-beta.4";
/** /**
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds. * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
* @internal * @internal
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册