@vue/compat 3.2.21 → 3.2.25
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/README.md +1 -0
- package/dist/vue.cjs.js +247 -242
- package/dist/vue.cjs.prod.js +234 -222
- package/dist/vue.esm-browser.js +222 -221
- package/dist/vue.esm-browser.prod.js +1 -1
- package/dist/vue.esm-bundler.js +224 -222
- package/dist/vue.global.js +222 -221
- package/dist/vue.global.prod.js +1 -1
- package/dist/vue.runtime.esm-browser.js +167 -167
- package/dist/vue.runtime.esm-browser.prod.js +1 -1
- package/dist/vue.runtime.esm-bundler.js +169 -168
- package/dist/vue.runtime.global.js +167 -167
- package/dist/vue.runtime.global.prod.js +1 -1
- package/package.json +2 -2
package/dist/vue.esm-bundler.js
CHANGED
|
@@ -107,7 +107,7 @@ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomo
|
|
|
107
107
|
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
|
108
108
|
/**
|
|
109
109
|
* Boolean attributes should be included if the value is truthy or ''.
|
|
110
|
-
* e.g.
|
|
110
|
+
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
111
111
|
*/
|
|
112
112
|
function includeBooleanAttr(value) {
|
|
113
113
|
return !!value || value === '';
|
|
@@ -342,7 +342,7 @@ const isIntegerKey = (key) => isString(key) &&
|
|
|
342
342
|
'' + parseInt(key, 10) === key;
|
|
343
343
|
const isReservedProp = /*#__PURE__*/ makeMap(
|
|
344
344
|
// the leading comma is intentional so empty string "" is also included
|
|
345
|
-
',key,ref,' +
|
|
345
|
+
',key,ref,ref_for,ref_key,' +
|
|
346
346
|
'onVnodeBeforeMount,onVnodeMounted,' +
|
|
347
347
|
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
|
348
348
|
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
|
@@ -531,7 +531,7 @@ const targetMap = new WeakMap();
|
|
|
531
531
|
let effectTrackDepth = 0;
|
|
532
532
|
let trackOpBit = 1;
|
|
533
533
|
/**
|
|
534
|
-
* The bitwise track markers support at most 30 levels
|
|
534
|
+
* The bitwise track markers support at most 30 levels of recursion.
|
|
535
535
|
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
|
|
536
536
|
* When recursion depth is greater, fall back to using a full cleanup.
|
|
537
537
|
*/
|
|
@@ -860,7 +860,7 @@ const shallowSet = /*#__PURE__*/ createSetter(true);
|
|
|
860
860
|
function createSetter(shallow = false) {
|
|
861
861
|
return function set(target, key, value, receiver) {
|
|
862
862
|
let oldValue = target[key];
|
|
863
|
-
if (!shallow) {
|
|
863
|
+
if (!shallow && !isReadonly(value)) {
|
|
864
864
|
value = toRaw(value);
|
|
865
865
|
oldValue = toRaw(oldValue);
|
|
866
866
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
@@ -1452,21 +1452,25 @@ function toRefs(object) {
|
|
|
1452
1452
|
return ret;
|
|
1453
1453
|
}
|
|
1454
1454
|
class ObjectRefImpl {
|
|
1455
|
-
constructor(_object, _key) {
|
|
1455
|
+
constructor(_object, _key, _defaultValue) {
|
|
1456
1456
|
this._object = _object;
|
|
1457
1457
|
this._key = _key;
|
|
1458
|
+
this._defaultValue = _defaultValue;
|
|
1458
1459
|
this.__v_isRef = true;
|
|
1459
1460
|
}
|
|
1460
1461
|
get value() {
|
|
1461
|
-
|
|
1462
|
+
const val = this._object[this._key];
|
|
1463
|
+
return val === undefined ? this._defaultValue : val;
|
|
1462
1464
|
}
|
|
1463
1465
|
set value(newVal) {
|
|
1464
1466
|
this._object[this._key] = newVal;
|
|
1465
1467
|
}
|
|
1466
1468
|
}
|
|
1467
|
-
function toRef(object, key) {
|
|
1469
|
+
function toRef(object, key, defaultValue) {
|
|
1468
1470
|
const val = object[key];
|
|
1469
|
-
return isRef(val)
|
|
1471
|
+
return isRef(val)
|
|
1472
|
+
? val
|
|
1473
|
+
: new ObjectRefImpl(object, key, defaultValue);
|
|
1470
1474
|
}
|
|
1471
1475
|
|
|
1472
1476
|
class ComputedRefImpl {
|
|
@@ -1674,6 +1678,7 @@ function emit(event, ...args) {
|
|
|
1674
1678
|
}
|
|
1675
1679
|
}
|
|
1676
1680
|
function setDevtoolsHook(hook, target) {
|
|
1681
|
+
var _a, _b;
|
|
1677
1682
|
devtools = hook;
|
|
1678
1683
|
if (devtools) {
|
|
1679
1684
|
devtools.enabled = true;
|
|
@@ -1686,7 +1691,10 @@ function setDevtoolsHook(hook, target) {
|
|
|
1686
1691
|
// (#4815)
|
|
1687
1692
|
// eslint-disable-next-line no-restricted-globals
|
|
1688
1693
|
typeof window !== 'undefined' &&
|
|
1689
|
-
|
|
1694
|
+
// some envs mock window but not fully
|
|
1695
|
+
window.HTMLElement &&
|
|
1696
|
+
// also exclude jsdom
|
|
1697
|
+
!((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
|
|
1690
1698
|
const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
|
|
1691
1699
|
target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
|
|
1692
1700
|
replay.push((newHook) => {
|
|
@@ -1909,11 +1917,6 @@ const deprecationData = {
|
|
|
1909
1917
|
`Use "${newHook}" instead.`,
|
|
1910
1918
|
link: `https://v3.vuejs.org/guide/migration/custom-directives.html`
|
|
1911
1919
|
},
|
|
1912
|
-
["V_FOR_REF" /* V_FOR_REF */]: {
|
|
1913
|
-
message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
|
|
1914
|
-
`Consider using function refs or refactor to avoid ref usage altogether.`,
|
|
1915
|
-
link: `https://v3.vuejs.org/guide/migration/array-refs.html`
|
|
1916
|
-
},
|
|
1917
1920
|
["V_ON_KEYCODE_MODIFIER" /* V_ON_KEYCODE_MODIFIER */]: {
|
|
1918
1921
|
message: `Using keyCode as v-on modifier is no longer supported. ` +
|
|
1919
1922
|
`Use kebab-case key name modifiers instead.`,
|
|
@@ -3324,7 +3327,9 @@ const BaseTransitionImpl = {
|
|
|
3324
3327
|
const rawProps = toRaw(props);
|
|
3325
3328
|
const { mode } = rawProps;
|
|
3326
3329
|
// check mode
|
|
3327
|
-
if ((process.env.NODE_ENV !== 'production') &&
|
|
3330
|
+
if ((process.env.NODE_ENV !== 'production') &&
|
|
3331
|
+
mode &&
|
|
3332
|
+
mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
|
|
3328
3333
|
warn$1(`invalid <transition> mode: ${mode}`);
|
|
3329
3334
|
}
|
|
3330
3335
|
// at this point children has a guaranteed length of 1.
|
|
@@ -3970,7 +3975,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
|
3970
3975
|
}
|
|
3971
3976
|
current = current.parent;
|
|
3972
3977
|
}
|
|
3973
|
-
hook();
|
|
3978
|
+
return hook();
|
|
3974
3979
|
});
|
|
3975
3980
|
injectHook(type, wrappedHook, target);
|
|
3976
3981
|
// In addition to registering it on the target instance, we walk up the parent
|
|
@@ -4755,7 +4760,7 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
4755
4760
|
continue;
|
|
4756
4761
|
}
|
|
4757
4762
|
}
|
|
4758
|
-
if (value !== attrs[key]) {
|
|
4763
|
+
if (!(key in attrs) || value !== attrs[key]) {
|
|
4759
4764
|
attrs[key] = value;
|
|
4760
4765
|
hasAttrsChanged = true;
|
|
4761
4766
|
}
|
|
@@ -5338,7 +5343,7 @@ function createCompatVue(createApp, createSingletonApp) {
|
|
|
5338
5343
|
return vm;
|
|
5339
5344
|
}
|
|
5340
5345
|
}
|
|
5341
|
-
Vue.version = "3.2.
|
|
5346
|
+
Vue.version = "3.2.25";
|
|
5342
5347
|
Vue.config = singletonApp.config;
|
|
5343
5348
|
Vue.use = (p, ...options) => {
|
|
5344
5349
|
if (p && isFunction(p.install)) {
|
|
@@ -5691,7 +5696,7 @@ const methodsToPatch = [
|
|
|
5691
5696
|
];
|
|
5692
5697
|
const patched = new WeakSet();
|
|
5693
5698
|
function defineReactive(obj, key, val) {
|
|
5694
|
-
// it's possible for the
|
|
5699
|
+
// it's possible for the original object to be mutated after being defined
|
|
5695
5700
|
// and expecting reactivity... we are covering it here because this seems to
|
|
5696
5701
|
// be a bit more common.
|
|
5697
5702
|
if (isObject(val) && !isReactive(val) && !patched.has(val)) {
|
|
@@ -5914,6 +5919,102 @@ function createAppAPI(render, hydrate) {
|
|
|
5914
5919
|
};
|
|
5915
5920
|
}
|
|
5916
5921
|
|
|
5922
|
+
/**
|
|
5923
|
+
* Function for handling a template ref
|
|
5924
|
+
*/
|
|
5925
|
+
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
5926
|
+
if (isArray(rawRef)) {
|
|
5927
|
+
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
5928
|
+
return;
|
|
5929
|
+
}
|
|
5930
|
+
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
5931
|
+
// when mounting async components, nothing needs to be done,
|
|
5932
|
+
// because the template ref is forwarded to inner component
|
|
5933
|
+
return;
|
|
5934
|
+
}
|
|
5935
|
+
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
5936
|
+
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
5937
|
+
: vnode.el;
|
|
5938
|
+
const value = isUnmount ? null : refValue;
|
|
5939
|
+
const { i: owner, r: ref } = rawRef;
|
|
5940
|
+
if ((process.env.NODE_ENV !== 'production') && !owner) {
|
|
5941
|
+
warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
5942
|
+
`A vnode with ref must be created inside the render function.`);
|
|
5943
|
+
return;
|
|
5944
|
+
}
|
|
5945
|
+
const oldRef = oldRawRef && oldRawRef.r;
|
|
5946
|
+
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
5947
|
+
const setupState = owner.setupState;
|
|
5948
|
+
// dynamic ref changed. unset old ref
|
|
5949
|
+
if (oldRef != null && oldRef !== ref) {
|
|
5950
|
+
if (isString(oldRef)) {
|
|
5951
|
+
refs[oldRef] = null;
|
|
5952
|
+
if (hasOwn(setupState, oldRef)) {
|
|
5953
|
+
setupState[oldRef] = null;
|
|
5954
|
+
}
|
|
5955
|
+
}
|
|
5956
|
+
else if (isRef(oldRef)) {
|
|
5957
|
+
oldRef.value = null;
|
|
5958
|
+
}
|
|
5959
|
+
}
|
|
5960
|
+
if (isFunction(ref)) {
|
|
5961
|
+
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
5962
|
+
}
|
|
5963
|
+
else {
|
|
5964
|
+
const _isString = isString(ref);
|
|
5965
|
+
const _isRef = isRef(ref);
|
|
5966
|
+
if (_isString || _isRef) {
|
|
5967
|
+
const doSet = () => {
|
|
5968
|
+
if (rawRef.f) {
|
|
5969
|
+
const existing = _isString ? refs[ref] : ref.value;
|
|
5970
|
+
if (isUnmount) {
|
|
5971
|
+
isArray(existing) && remove(existing, refValue);
|
|
5972
|
+
}
|
|
5973
|
+
else {
|
|
5974
|
+
if (!isArray(existing)) {
|
|
5975
|
+
if (_isString) {
|
|
5976
|
+
refs[ref] = [refValue];
|
|
5977
|
+
}
|
|
5978
|
+
else {
|
|
5979
|
+
ref.value = [refValue];
|
|
5980
|
+
if (rawRef.k)
|
|
5981
|
+
refs[rawRef.k] = ref.value;
|
|
5982
|
+
}
|
|
5983
|
+
}
|
|
5984
|
+
else if (!existing.includes(refValue)) {
|
|
5985
|
+
existing.push(refValue);
|
|
5986
|
+
}
|
|
5987
|
+
}
|
|
5988
|
+
}
|
|
5989
|
+
else if (_isString) {
|
|
5990
|
+
refs[ref] = value;
|
|
5991
|
+
if (hasOwn(setupState, ref)) {
|
|
5992
|
+
setupState[ref] = value;
|
|
5993
|
+
}
|
|
5994
|
+
}
|
|
5995
|
+
else if (isRef(ref)) {
|
|
5996
|
+
ref.value = value;
|
|
5997
|
+
if (rawRef.k)
|
|
5998
|
+
refs[rawRef.k] = value;
|
|
5999
|
+
}
|
|
6000
|
+
else if ((process.env.NODE_ENV !== 'production')) {
|
|
6001
|
+
warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
6002
|
+
}
|
|
6003
|
+
};
|
|
6004
|
+
if (value) {
|
|
6005
|
+
doSet.id = -1;
|
|
6006
|
+
queuePostRenderEffect(doSet, parentSuspense);
|
|
6007
|
+
}
|
|
6008
|
+
else {
|
|
6009
|
+
doSet();
|
|
6010
|
+
}
|
|
6011
|
+
}
|
|
6012
|
+
else if ((process.env.NODE_ENV !== 'production')) {
|
|
6013
|
+
warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
6014
|
+
}
|
|
6015
|
+
}
|
|
6016
|
+
}
|
|
6017
|
+
|
|
5917
6018
|
let hasMismatch = false;
|
|
5918
6019
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
5919
6020
|
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
@@ -6302,45 +6403,7 @@ function initFeatureFlags() {
|
|
|
6302
6403
|
`which expects these compile-time feature flags to be globally injected ` +
|
|
6303
6404
|
`via the bundler config in order to get better tree-shaking in the ` +
|
|
6304
6405
|
`production bundle.\n\n` +
|
|
6305
|
-
`For more details, see
|
|
6306
|
-
}
|
|
6307
|
-
}
|
|
6308
|
-
|
|
6309
|
-
function convertLegacyRefInFor(vnode) {
|
|
6310
|
-
// refInFor
|
|
6311
|
-
if (vnode.props && vnode.props.refInFor) {
|
|
6312
|
-
delete vnode.props.refInFor;
|
|
6313
|
-
if (vnode.ref) {
|
|
6314
|
-
if (isArray(vnode.ref)) {
|
|
6315
|
-
vnode.ref.forEach(r => (r.f = true));
|
|
6316
|
-
}
|
|
6317
|
-
else {
|
|
6318
|
-
vnode.ref.f = true;
|
|
6319
|
-
}
|
|
6320
|
-
}
|
|
6321
|
-
}
|
|
6322
|
-
}
|
|
6323
|
-
function registerLegacyRef(refs, key, value, owner, isInFor, isUnmount) {
|
|
6324
|
-
const existing = refs[key];
|
|
6325
|
-
if (isUnmount) {
|
|
6326
|
-
if (isArray(existing)) {
|
|
6327
|
-
remove(existing, value);
|
|
6328
|
-
}
|
|
6329
|
-
else {
|
|
6330
|
-
refs[key] = null;
|
|
6331
|
-
}
|
|
6332
|
-
}
|
|
6333
|
-
else if (isInFor) {
|
|
6334
|
-
(process.env.NODE_ENV !== 'production') && warnDeprecation("V_FOR_REF" /* V_FOR_REF */, owner);
|
|
6335
|
-
if (!isArray(existing)) {
|
|
6336
|
-
refs[key] = [value];
|
|
6337
|
-
}
|
|
6338
|
-
else if (!existing.includes(value)) {
|
|
6339
|
-
existing.push(value);
|
|
6340
|
-
}
|
|
6341
|
-
}
|
|
6342
|
-
else {
|
|
6343
|
-
refs[key] = value;
|
|
6406
|
+
`For more details, see https://link.vuejs.org/feature-flags.`);
|
|
6344
6407
|
}
|
|
6345
6408
|
}
|
|
6346
6409
|
|
|
@@ -6630,12 +6693,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6630
6693
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
6631
6694
|
const newProps = n2.props || EMPTY_OBJ;
|
|
6632
6695
|
let vnodeHook;
|
|
6696
|
+
// disable recurse in beforeUpdate hooks
|
|
6697
|
+
parentComponent && toggleRecurse(parentComponent, false);
|
|
6633
6698
|
if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
|
|
6634
6699
|
invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
6635
6700
|
}
|
|
6636
6701
|
if (dirs) {
|
|
6637
6702
|
invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
|
|
6638
6703
|
}
|
|
6704
|
+
parentComponent && toggleRecurse(parentComponent, true);
|
|
6639
6705
|
if ((process.env.NODE_ENV !== 'production') && isHmrUpdating) {
|
|
6640
6706
|
// HMR updated, force full diff
|
|
6641
6707
|
patchFlag = 0;
|
|
@@ -6919,7 +6985,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6919
6985
|
const { el, props } = initialVNode;
|
|
6920
6986
|
const { bm, m, parent } = instance;
|
|
6921
6987
|
const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
|
6922
|
-
|
|
6988
|
+
toggleRecurse(instance, false);
|
|
6923
6989
|
// beforeMount hook
|
|
6924
6990
|
if (bm) {
|
|
6925
6991
|
invokeArrayFns(bm);
|
|
@@ -6932,7 +6998,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6932
6998
|
if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
|
|
6933
6999
|
instance.emit('hook:beforeMount');
|
|
6934
7000
|
}
|
|
6935
|
-
|
|
7001
|
+
toggleRecurse(instance, true);
|
|
6936
7002
|
if (el && hydrateNode) {
|
|
6937
7003
|
// vnode has adopted host node - perform hydration instead of mount.
|
|
6938
7004
|
const hydrateSubTree = () => {
|
|
@@ -7020,7 +7086,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7020
7086
|
pushWarningContext(next || instance.vnode);
|
|
7021
7087
|
}
|
|
7022
7088
|
// Disallow component effect recursion during pre-lifecycle hooks.
|
|
7023
|
-
|
|
7089
|
+
toggleRecurse(instance, false);
|
|
7024
7090
|
if (next) {
|
|
7025
7091
|
next.el = vnode.el;
|
|
7026
7092
|
updateComponentPreRender(instance, next, optimized);
|
|
@@ -7039,7 +7105,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7039
7105
|
if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
|
|
7040
7106
|
instance.emit('hook:beforeUpdate');
|
|
7041
7107
|
}
|
|
7042
|
-
|
|
7108
|
+
toggleRecurse(instance, true);
|
|
7043
7109
|
// render
|
|
7044
7110
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
7045
7111
|
startMeasure(instance, `render`);
|
|
@@ -7088,13 +7154,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7088
7154
|
}
|
|
7089
7155
|
};
|
|
7090
7156
|
// create reactive effect for rendering
|
|
7091
|
-
const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
7092
|
-
);
|
|
7157
|
+
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
7158
|
+
));
|
|
7093
7159
|
const update = (instance.update = effect.run.bind(effect));
|
|
7094
7160
|
update.id = instance.uid;
|
|
7095
7161
|
// allowRecurse
|
|
7096
7162
|
// #1801, #2043 component render effects should allow recursive updates
|
|
7097
|
-
|
|
7163
|
+
toggleRecurse(instance, true);
|
|
7098
7164
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
7099
7165
|
effect.onTrack = instance.rtc
|
|
7100
7166
|
? e => invokeArrayFns(instance.rtc, e)
|
|
@@ -7624,88 +7690,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7624
7690
|
createApp: createAppAPI(render, hydrate)
|
|
7625
7691
|
};
|
|
7626
7692
|
}
|
|
7627
|
-
function
|
|
7628
|
-
|
|
7629
|
-
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
7630
|
-
return;
|
|
7631
|
-
}
|
|
7632
|
-
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
7633
|
-
// when mounting async components, nothing needs to be done,
|
|
7634
|
-
// because the template ref is forwarded to inner component
|
|
7635
|
-
return;
|
|
7636
|
-
}
|
|
7637
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
7638
|
-
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
7639
|
-
: vnode.el;
|
|
7640
|
-
const value = isUnmount ? null : refValue;
|
|
7641
|
-
const { i: owner, r: ref } = rawRef;
|
|
7642
|
-
if ((process.env.NODE_ENV !== 'production') && !owner) {
|
|
7643
|
-
warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
7644
|
-
`A vnode with ref must be created inside the render function.`);
|
|
7645
|
-
return;
|
|
7646
|
-
}
|
|
7647
|
-
const oldRef = oldRawRef && oldRawRef.r;
|
|
7648
|
-
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
7649
|
-
const setupState = owner.setupState;
|
|
7650
|
-
// dynamic ref changed. unset old ref
|
|
7651
|
-
if (oldRef != null && oldRef !== ref) {
|
|
7652
|
-
if (isString(oldRef)) {
|
|
7653
|
-
refs[oldRef] = null;
|
|
7654
|
-
if (hasOwn(setupState, oldRef)) {
|
|
7655
|
-
setupState[oldRef] = null;
|
|
7656
|
-
}
|
|
7657
|
-
}
|
|
7658
|
-
else if (isRef(oldRef)) {
|
|
7659
|
-
oldRef.value = null;
|
|
7660
|
-
}
|
|
7661
|
-
}
|
|
7662
|
-
if (isString(ref)) {
|
|
7663
|
-
const doSet = () => {
|
|
7664
|
-
if (isCompatEnabled("V_FOR_REF" /* V_FOR_REF */, owner)) {
|
|
7665
|
-
registerLegacyRef(refs, ref, refValue, owner, rawRef.f, isUnmount);
|
|
7666
|
-
}
|
|
7667
|
-
else {
|
|
7668
|
-
refs[ref] = value;
|
|
7669
|
-
}
|
|
7670
|
-
if (hasOwn(setupState, ref)) {
|
|
7671
|
-
setupState[ref] = value;
|
|
7672
|
-
}
|
|
7673
|
-
};
|
|
7674
|
-
// #1789: for non-null values, set them after render
|
|
7675
|
-
// null values means this is unmount and it should not overwrite another
|
|
7676
|
-
// ref with the same key
|
|
7677
|
-
if (value) {
|
|
7678
|
-
doSet.id = -1;
|
|
7679
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
7680
|
-
}
|
|
7681
|
-
else {
|
|
7682
|
-
doSet();
|
|
7683
|
-
}
|
|
7684
|
-
}
|
|
7685
|
-
else if (isRef(ref)) {
|
|
7686
|
-
const doSet = () => {
|
|
7687
|
-
ref.value = value;
|
|
7688
|
-
};
|
|
7689
|
-
if (value) {
|
|
7690
|
-
doSet.id = -1;
|
|
7691
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
7692
|
-
}
|
|
7693
|
-
else {
|
|
7694
|
-
doSet();
|
|
7695
|
-
}
|
|
7696
|
-
}
|
|
7697
|
-
else if (isFunction(ref)) {
|
|
7698
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
7699
|
-
}
|
|
7700
|
-
else if ((process.env.NODE_ENV !== 'production')) {
|
|
7701
|
-
warn$1('Invalid template ref type:', value, `(${typeof value})`);
|
|
7702
|
-
}
|
|
7703
|
-
}
|
|
7704
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
7705
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
7706
|
-
vnode,
|
|
7707
|
-
prevVNode
|
|
7708
|
-
]);
|
|
7693
|
+
function toggleRecurse({ effect, update }, allowed) {
|
|
7694
|
+
effect.allowRecurse = update.allowRecurse = allowed;
|
|
7709
7695
|
}
|
|
7710
7696
|
/**
|
|
7711
7697
|
* #1156
|
|
@@ -7715,8 +7701,8 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
|
7715
7701
|
*
|
|
7716
7702
|
* #2080
|
|
7717
7703
|
* Inside keyed `template` fragment static children, if a fragment is moved,
|
|
7718
|
-
* the children will always moved
|
|
7719
|
-
*
|
|
7704
|
+
* the children will always be moved. Therefore, in order to ensure correct move
|
|
7705
|
+
* position, el should be inherited from previous nodes.
|
|
7720
7706
|
*/
|
|
7721
7707
|
function traverseStaticChildren(n1, n2, shallow = false) {
|
|
7722
7708
|
const ch1 = n1.children;
|
|
@@ -8358,6 +8344,7 @@ function convertLegacyFunctionalComponent(comp) {
|
|
|
8358
8344
|
};
|
|
8359
8345
|
Func.props = comp.props;
|
|
8360
8346
|
Func.displayName = comp.name;
|
|
8347
|
+
Func.compatConfig = comp.compatConfig;
|
|
8361
8348
|
// v2 functional components do not inherit attrs
|
|
8362
8349
|
Func.inheritAttrs = false;
|
|
8363
8350
|
normalizedFunctionalComponentMap.set(comp, Func);
|
|
@@ -8504,10 +8491,10 @@ const createVNodeWithArgsTransform = (...args) => {
|
|
|
8504
8491
|
};
|
|
8505
8492
|
const InternalObjectKey = `__vInternal`;
|
|
8506
8493
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
8507
|
-
const normalizeRef = ({ ref }) => {
|
|
8494
|
+
const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
8508
8495
|
return (ref != null
|
|
8509
8496
|
? isString(ref) || isRef(ref) || isFunction(ref)
|
|
8510
|
-
? { i: currentRenderingInstance, r: ref }
|
|
8497
|
+
? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
|
|
8511
8498
|
: ref
|
|
8512
8499
|
: null);
|
|
8513
8500
|
};
|
|
@@ -8575,7 +8562,6 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
8575
8562
|
}
|
|
8576
8563
|
{
|
|
8577
8564
|
convertLegacyVModelProps(vnode);
|
|
8578
|
-
convertLegacyRefInFor(vnode);
|
|
8579
8565
|
defineLegacyVNodeProperties(vnode);
|
|
8580
8566
|
}
|
|
8581
8567
|
return vnode;
|
|
@@ -8848,7 +8834,8 @@ function mergeProps(...args) {
|
|
|
8848
8834
|
else if (isOn(key)) {
|
|
8849
8835
|
const existing = ret[key];
|
|
8850
8836
|
const incoming = toMerge[key];
|
|
8851
|
-
if (existing !== incoming
|
|
8837
|
+
if (existing !== incoming &&
|
|
8838
|
+
!(isArray(existing) && existing.includes(incoming))) {
|
|
8852
8839
|
ret[key] = existing
|
|
8853
8840
|
? [].concat(existing, incoming)
|
|
8854
8841
|
: incoming;
|
|
@@ -8860,6 +8847,12 @@ function mergeProps(...args) {
|
|
|
8860
8847
|
}
|
|
8861
8848
|
}
|
|
8862
8849
|
return ret;
|
|
8850
|
+
}
|
|
8851
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
8852
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
8853
|
+
vnode,
|
|
8854
|
+
prevVNode
|
|
8855
|
+
]);
|
|
8863
8856
|
}
|
|
8864
8857
|
|
|
8865
8858
|
function getCompatChildren(instance) {
|
|
@@ -9293,23 +9286,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
9293
9286
|
const n = accessCache[key];
|
|
9294
9287
|
if (n !== undefined) {
|
|
9295
9288
|
switch (n) {
|
|
9296
|
-
case
|
|
9289
|
+
case 1 /* SETUP */:
|
|
9297
9290
|
return setupState[key];
|
|
9298
|
-
case
|
|
9291
|
+
case 2 /* DATA */:
|
|
9299
9292
|
return data[key];
|
|
9300
|
-
case
|
|
9293
|
+
case 4 /* CONTEXT */:
|
|
9301
9294
|
return ctx[key];
|
|
9302
|
-
case
|
|
9295
|
+
case 3 /* PROPS */:
|
|
9303
9296
|
return props[key];
|
|
9304
9297
|
// default: just fallthrough
|
|
9305
9298
|
}
|
|
9306
9299
|
}
|
|
9307
9300
|
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
9308
|
-
accessCache[key] =
|
|
9301
|
+
accessCache[key] = 1 /* SETUP */;
|
|
9309
9302
|
return setupState[key];
|
|
9310
9303
|
}
|
|
9311
9304
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
9312
|
-
accessCache[key] =
|
|
9305
|
+
accessCache[key] = 2 /* DATA */;
|
|
9313
9306
|
return data[key];
|
|
9314
9307
|
}
|
|
9315
9308
|
else if (
|
|
@@ -9317,15 +9310,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
9317
9310
|
// props
|
|
9318
9311
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
9319
9312
|
hasOwn(normalizedProps, key)) {
|
|
9320
|
-
accessCache[key] =
|
|
9313
|
+
accessCache[key] = 3 /* PROPS */;
|
|
9321
9314
|
return props[key];
|
|
9322
9315
|
}
|
|
9323
9316
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
9324
|
-
accessCache[key] =
|
|
9317
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
9325
9318
|
return ctx[key];
|
|
9326
9319
|
}
|
|
9327
9320
|
else if (!__VUE_OPTIONS_API__ || shouldCacheAccess) {
|
|
9328
|
-
accessCache[key] =
|
|
9321
|
+
accessCache[key] = 0 /* OTHER */;
|
|
9329
9322
|
}
|
|
9330
9323
|
}
|
|
9331
9324
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -9346,7 +9339,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
9346
9339
|
}
|
|
9347
9340
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
9348
9341
|
// user may set custom properties to `this` that start with `$`
|
|
9349
|
-
accessCache[key] =
|
|
9342
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
9350
9343
|
return ctx[key];
|
|
9351
9344
|
}
|
|
9352
9345
|
else if (
|
|
@@ -9417,7 +9410,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
9417
9410
|
},
|
|
9418
9411
|
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
9419
9412
|
let normalizedProps;
|
|
9420
|
-
return (accessCache[key]
|
|
9413
|
+
return (!!accessCache[key] ||
|
|
9421
9414
|
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
9422
9415
|
(setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
|
9423
9416
|
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
@@ -9523,6 +9516,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
9523
9516
|
root: null,
|
|
9524
9517
|
next: null,
|
|
9525
9518
|
subTree: null,
|
|
9519
|
+
effect: null,
|
|
9526
9520
|
update: null,
|
|
9527
9521
|
scope: new EffectScope(true /* detached */),
|
|
9528
9522
|
render: null,
|
|
@@ -11042,7 +11036,7 @@ function isMemoSame(cached, memo) {
|
|
|
11042
11036
|
}
|
|
11043
11037
|
|
|
11044
11038
|
// Core API ------------------------------------------------------------------
|
|
11045
|
-
const version = "3.2.
|
|
11039
|
+
const version = "3.2.25";
|
|
11046
11040
|
const _ssrUtils = {
|
|
11047
11041
|
createComponentInstance,
|
|
11048
11042
|
setupComponent,
|
|
@@ -11317,12 +11311,19 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
11317
11311
|
el[key] = value == null ? '' : value;
|
|
11318
11312
|
return;
|
|
11319
11313
|
}
|
|
11320
|
-
if (key === 'value' &&
|
|
11314
|
+
if (key === 'value' &&
|
|
11315
|
+
el.tagName !== 'PROGRESS' &&
|
|
11316
|
+
// custom elements may use _value internally
|
|
11317
|
+
!el.tagName.includes('-')) {
|
|
11321
11318
|
// store value as _value as well since
|
|
11322
11319
|
// non-string values will be stringified.
|
|
11323
11320
|
el._value = value;
|
|
11324
11321
|
const newValue = value == null ? '' : value;
|
|
11325
|
-
if (el.value !== newValue
|
|
11322
|
+
if (el.value !== newValue ||
|
|
11323
|
+
// #4956: always set for OPTION elements because its value falls back to
|
|
11324
|
+
// textContent if no value attribute is present. And setting .value for
|
|
11325
|
+
// OPTION has no side effect
|
|
11326
|
+
el.tagName === 'OPTION') {
|
|
11326
11327
|
el.value = newValue;
|
|
11327
11328
|
}
|
|
11328
11329
|
if (value == null) {
|
|
@@ -11719,7 +11720,7 @@ class VueElement extends BaseClass {
|
|
|
11719
11720
|
// HMR
|
|
11720
11721
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
11721
11722
|
instance.ceReload = newStyles => {
|
|
11722
|
-
//
|
|
11723
|
+
// always reset styles
|
|
11723
11724
|
if (this._styles) {
|
|
11724
11725
|
this._styles.forEach(s => this.shadowRoot.removeChild(s));
|
|
11725
11726
|
this._styles.length = 0;
|
|
@@ -13499,12 +13500,12 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
|
13499
13500
|
}
|
|
13500
13501
|
else if (p.name === 'bind' &&
|
|
13501
13502
|
(p.exp || allowEmpty) &&
|
|
13502
|
-
|
|
13503
|
+
isStaticArgOf(p.arg, name)) {
|
|
13503
13504
|
return p;
|
|
13504
13505
|
}
|
|
13505
13506
|
}
|
|
13506
13507
|
}
|
|
13507
|
-
function
|
|
13508
|
+
function isStaticArgOf(arg, name) {
|
|
13508
13509
|
return !!(arg && isStaticExp(arg) && arg.content === name);
|
|
13509
13510
|
}
|
|
13510
13511
|
function hasDynamicKeyVBind(node) {
|
|
@@ -13547,7 +13548,6 @@ function getUnnormalizedProps(props, callPath = []) {
|
|
|
13547
13548
|
}
|
|
13548
13549
|
function injectProp(node, prop, context) {
|
|
13549
13550
|
let propsWithInjection;
|
|
13550
|
-
const originalProps = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
|
|
13551
13551
|
/**
|
|
13552
13552
|
* 1. mergeProps(...)
|
|
13553
13553
|
* 2. toHandlers(...)
|
|
@@ -13556,7 +13556,7 @@ function injectProp(node, prop, context) {
|
|
|
13556
13556
|
*
|
|
13557
13557
|
* we need to get the real props before normalization
|
|
13558
13558
|
*/
|
|
13559
|
-
let props =
|
|
13559
|
+
let props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
|
|
13560
13560
|
let callPath = [];
|
|
13561
13561
|
let parentCall;
|
|
13562
13562
|
if (props &&
|
|
@@ -13695,11 +13695,6 @@ const deprecationData$1 = {
|
|
|
13695
13695
|
`data source.`,
|
|
13696
13696
|
link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
|
|
13697
13697
|
},
|
|
13698
|
-
["COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */]: {
|
|
13699
|
-
message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
|
|
13700
|
-
`Consider using function refs or refactor to avoid ref usage altogether.`,
|
|
13701
|
-
link: `https://v3.vuejs.org/guide/migration/array-refs.html`
|
|
13702
|
-
},
|
|
13703
13698
|
["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
|
|
13704
13699
|
message: `<template> with no special directives will render as a native template ` +
|
|
13705
13700
|
`element instead of its inner content in Vue 3.`
|
|
@@ -14219,7 +14214,7 @@ function isComponent(tag, props, context) {
|
|
|
14219
14214
|
else if (
|
|
14220
14215
|
// :is on plain element - only treat as component in compat mode
|
|
14221
14216
|
p.name === 'bind' &&
|
|
14222
|
-
|
|
14217
|
+
isStaticArgOf(p.arg, 'is') &&
|
|
14223
14218
|
true &&
|
|
14224
14219
|
checkCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
|
|
14225
14220
|
return true;
|
|
@@ -14579,15 +14574,6 @@ function isSingleElementRoot(root, child) {
|
|
|
14579
14574
|
!isSlotOutlet(child));
|
|
14580
14575
|
}
|
|
14581
14576
|
function walk$1(node, context, doNotHoistNode = false) {
|
|
14582
|
-
// Some transforms, e.g. transformAssetUrls from @vue/compiler-sfc, replaces
|
|
14583
|
-
// static bindings with expressions. These expressions are guaranteed to be
|
|
14584
|
-
// constant so they are still eligible for hoisting, but they are only
|
|
14585
|
-
// available at runtime and therefore cannot be evaluated ahead of time.
|
|
14586
|
-
// This is only a concern for pre-stringification (via transformHoist by
|
|
14587
|
-
// @vue/compiler-dom), but doing it here allows us to perform only one full
|
|
14588
|
-
// walk of the AST and allow `stringifyStatic` to stop walking as soon as its
|
|
14589
|
-
// stringification threshold is met.
|
|
14590
|
-
let canStringify = true;
|
|
14591
14577
|
const { children } = node;
|
|
14592
14578
|
const originalCount = children.length;
|
|
14593
14579
|
let hoistedCount = 0;
|
|
@@ -14600,9 +14586,6 @@ function walk$1(node, context, doNotHoistNode = false) {
|
|
|
14600
14586
|
? 0 /* NOT_CONSTANT */
|
|
14601
14587
|
: getConstantType(child, context);
|
|
14602
14588
|
if (constantType > 0 /* NOT_CONSTANT */) {
|
|
14603
|
-
if (constantType < 3 /* CAN_STRINGIFY */) {
|
|
14604
|
-
canStringify = false;
|
|
14605
|
-
}
|
|
14606
14589
|
if (constantType >= 2 /* CAN_HOIST */) {
|
|
14607
14590
|
child.codegenNode.patchFlag =
|
|
14608
14591
|
-1 /* HOISTED */ + ((process.env.NODE_ENV !== 'production') ? ` /* HOISTED */` : ``);
|
|
@@ -14633,17 +14616,10 @@ function walk$1(node, context, doNotHoistNode = false) {
|
|
|
14633
14616
|
}
|
|
14634
14617
|
}
|
|
14635
14618
|
}
|
|
14636
|
-
else if (child.type === 12 /* TEXT_CALL */
|
|
14637
|
-
|
|
14638
|
-
|
|
14639
|
-
|
|
14640
|
-
canStringify = false;
|
|
14641
|
-
}
|
|
14642
|
-
if (contentType >= 2 /* CAN_HOIST */) {
|
|
14643
|
-
child.codegenNode = context.hoist(child.codegenNode);
|
|
14644
|
-
hoistedCount++;
|
|
14645
|
-
}
|
|
14646
|
-
}
|
|
14619
|
+
else if (child.type === 12 /* TEXT_CALL */ &&
|
|
14620
|
+
getConstantType(child.content, context) >= 2 /* CAN_HOIST */) {
|
|
14621
|
+
child.codegenNode = context.hoist(child.codegenNode);
|
|
14622
|
+
hoistedCount++;
|
|
14647
14623
|
}
|
|
14648
14624
|
// walk further
|
|
14649
14625
|
if (child.type === 1 /* ELEMENT */) {
|
|
@@ -14667,7 +14643,7 @@ function walk$1(node, context, doNotHoistNode = false) {
|
|
|
14667
14643
|
}
|
|
14668
14644
|
}
|
|
14669
14645
|
}
|
|
14670
|
-
if (
|
|
14646
|
+
if (hoistedCount && context.transformHoist) {
|
|
14671
14647
|
context.transformHoist(children, context, node);
|
|
14672
14648
|
}
|
|
14673
14649
|
// all children were hoisted - the entire children array is hoistable.
|
|
@@ -14696,6 +14672,11 @@ function getConstantType(node, context) {
|
|
|
14696
14672
|
if (codegenNode.type !== 13 /* VNODE_CALL */) {
|
|
14697
14673
|
return 0 /* NOT_CONSTANT */;
|
|
14698
14674
|
}
|
|
14675
|
+
if (codegenNode.isBlock &&
|
|
14676
|
+
node.tag !== 'svg' &&
|
|
14677
|
+
node.tag !== 'foreignObject') {
|
|
14678
|
+
return 0 /* NOT_CONSTANT */;
|
|
14679
|
+
}
|
|
14699
14680
|
const flag = getPatchFlag(codegenNode);
|
|
14700
14681
|
if (!flag) {
|
|
14701
14682
|
let returnType = 3 /* CAN_STRINGIFY */;
|
|
@@ -14833,7 +14814,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
14833
14814
|
else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
|
|
14834
14815
|
// some helper calls can be hoisted,
|
|
14835
14816
|
// such as the `normalizeProps` generated by the compiler for pre-normalize class,
|
|
14836
|
-
// in this case we need to respect the ConstantType of the helper's
|
|
14817
|
+
// in this case we need to respect the ConstantType of the helper's arguments
|
|
14837
14818
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
14838
14819
|
}
|
|
14839
14820
|
else {
|
|
@@ -16506,10 +16487,7 @@ const transformElement = (node, context) => {
|
|
|
16506
16487
|
// updates inside get proper isSVG flag at runtime. (#639, #643)
|
|
16507
16488
|
// This is technically web-specific, but splitting the logic out of core
|
|
16508
16489
|
// leads to too much unnecessary complexity.
|
|
16509
|
-
(tag === 'svg' ||
|
|
16510
|
-
tag === 'foreignObject' ||
|
|
16511
|
-
// #938: elements with dynamic keys should be forced into blocks
|
|
16512
|
-
findProp(node, 'key', true)));
|
|
16490
|
+
(tag === 'svg' || tag === 'foreignObject'));
|
|
16513
16491
|
// props
|
|
16514
16492
|
if (props.length > 0) {
|
|
16515
16493
|
const propsBuildResult = buildProps(node, context);
|
|
@@ -16521,6 +16499,9 @@ const transformElement = (node, context) => {
|
|
|
16521
16499
|
directives && directives.length
|
|
16522
16500
|
? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
|
|
16523
16501
|
: undefined;
|
|
16502
|
+
if (propsBuildResult.shouldUseBlock) {
|
|
16503
|
+
shouldUseBlock = true;
|
|
16504
|
+
}
|
|
16524
16505
|
}
|
|
16525
16506
|
// children
|
|
16526
16507
|
if (node.children.length > 0) {
|
|
@@ -16652,11 +16633,13 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
16652
16633
|
return toValidAssetId(tag, `component`);
|
|
16653
16634
|
}
|
|
16654
16635
|
function buildProps(node, context, props = node.props, ssr = false) {
|
|
16655
|
-
const { tag, loc: elementLoc } = node;
|
|
16636
|
+
const { tag, loc: elementLoc, children } = node;
|
|
16656
16637
|
const isComponent = node.tagType === 1 /* COMPONENT */;
|
|
16657
16638
|
let properties = [];
|
|
16658
16639
|
const mergeArgs = [];
|
|
16659
16640
|
const runtimeDirectives = [];
|
|
16641
|
+
const hasChildren = children.length > 0;
|
|
16642
|
+
let shouldUseBlock = false;
|
|
16660
16643
|
// patchFlag analysis
|
|
16661
16644
|
let patchFlag = 0;
|
|
16662
16645
|
let hasRef = false;
|
|
@@ -16719,9 +16702,12 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
16719
16702
|
const prop = props[i];
|
|
16720
16703
|
if (prop.type === 6 /* ATTRIBUTE */) {
|
|
16721
16704
|
const { loc, name, value } = prop;
|
|
16722
|
-
let
|
|
16705
|
+
let isStatic = true;
|
|
16723
16706
|
if (name === 'ref') {
|
|
16724
16707
|
hasRef = true;
|
|
16708
|
+
if (context.scopes.vFor > 0) {
|
|
16709
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
16710
|
+
}
|
|
16725
16711
|
}
|
|
16726
16712
|
// skip is on <component>, or is="vue:xxx"
|
|
16727
16713
|
if (name === 'is' &&
|
|
@@ -16730,7 +16716,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
16730
16716
|
(isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
|
|
16731
16717
|
continue;
|
|
16732
16718
|
}
|
|
16733
|
-
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)),
|
|
16719
|
+
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
|
|
16734
16720
|
}
|
|
16735
16721
|
else {
|
|
16736
16722
|
// directives
|
|
@@ -16751,7 +16737,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
16751
16737
|
// skip v-is and :is on <component>
|
|
16752
16738
|
if (name === 'is' ||
|
|
16753
16739
|
(isVBind &&
|
|
16754
|
-
|
|
16740
|
+
isStaticArgOf(arg, 'is') &&
|
|
16755
16741
|
(isComponentTag(tag) ||
|
|
16756
16742
|
(isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
|
|
16757
16743
|
continue;
|
|
@@ -16760,6 +16746,17 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
16760
16746
|
if (isVOn && ssr) {
|
|
16761
16747
|
continue;
|
|
16762
16748
|
}
|
|
16749
|
+
if (
|
|
16750
|
+
// #938: elements with dynamic keys should be forced into blocks
|
|
16751
|
+
(isVBind && isStaticArgOf(arg, 'key')) ||
|
|
16752
|
+
// inline before-update hooks need to force block so that it is invoked
|
|
16753
|
+
// before children
|
|
16754
|
+
(isVOn && hasChildren && isStaticArgOf(arg, 'vue:before-update'))) {
|
|
16755
|
+
shouldUseBlock = true;
|
|
16756
|
+
}
|
|
16757
|
+
if (isVBind && isStaticArgOf(arg, 'ref') && context.scopes.vFor > 0) {
|
|
16758
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
16759
|
+
}
|
|
16763
16760
|
// special case for v-bind and v-on with no argument
|
|
16764
16761
|
if (!arg && (isVBind || isVOn)) {
|
|
16765
16762
|
hasDynamicKeys = true;
|
|
@@ -16833,14 +16830,13 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
16833
16830
|
else {
|
|
16834
16831
|
// no built-in transform, this is a user custom directive.
|
|
16835
16832
|
runtimeDirectives.push(prop);
|
|
16833
|
+
// custom dirs may use beforeUpdate so they need to force blocks
|
|
16834
|
+
// to ensure before-update gets called before children update
|
|
16835
|
+
if (hasChildren) {
|
|
16836
|
+
shouldUseBlock = true;
|
|
16837
|
+
}
|
|
16836
16838
|
}
|
|
16837
16839
|
}
|
|
16838
|
-
if (prop.type === 6 /* ATTRIBUTE */ &&
|
|
16839
|
-
prop.name === 'ref' &&
|
|
16840
|
-
context.scopes.vFor > 0 &&
|
|
16841
|
-
checkCompatEnabled$1("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
|
|
16842
|
-
properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
|
|
16843
|
-
}
|
|
16844
16840
|
}
|
|
16845
16841
|
let propsExpression = undefined;
|
|
16846
16842
|
// has v-bind="object" or v-on="object", wrap with mergeProps
|
|
@@ -16877,7 +16873,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
16877
16873
|
patchFlag |= 32 /* HYDRATE_EVENTS */;
|
|
16878
16874
|
}
|
|
16879
16875
|
}
|
|
16880
|
-
if (
|
|
16876
|
+
if (!shouldUseBlock &&
|
|
16877
|
+
(patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
|
|
16881
16878
|
(hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
|
|
16882
16879
|
patchFlag |= 512 /* NEED_PATCH */;
|
|
16883
16880
|
}
|
|
@@ -16944,7 +16941,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
16944
16941
|
props: propsExpression,
|
|
16945
16942
|
directives: runtimeDirectives,
|
|
16946
16943
|
patchFlag,
|
|
16947
|
-
dynamicPropNames
|
|
16944
|
+
dynamicPropNames,
|
|
16945
|
+
shouldUseBlock
|
|
16948
16946
|
};
|
|
16949
16947
|
}
|
|
16950
16948
|
// Dedupe props in an object literal.
|
|
@@ -17032,7 +17030,7 @@ function stringifyDynamicPropNames(props) {
|
|
|
17032
17030
|
return propsNamesString + `]`;
|
|
17033
17031
|
}
|
|
17034
17032
|
function isComponentTag(tag) {
|
|
17035
|
-
return tag
|
|
17033
|
+
return tag === 'component' || tag === 'Component';
|
|
17036
17034
|
}
|
|
17037
17035
|
|
|
17038
17036
|
const transformSlotOutlet = (node, context) => {
|
|
@@ -17080,7 +17078,7 @@ function processSlotOutlet(node, context) {
|
|
|
17080
17078
|
}
|
|
17081
17079
|
}
|
|
17082
17080
|
else {
|
|
17083
|
-
if (p.name === 'bind' &&
|
|
17081
|
+
if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
|
|
17084
17082
|
if (p.exp)
|
|
17085
17083
|
slotName = p.exp;
|
|
17086
17084
|
}
|
|
@@ -17114,7 +17112,11 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
17114
17112
|
let eventName;
|
|
17115
17113
|
if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
|
|
17116
17114
|
if (arg.isStatic) {
|
|
17117
|
-
|
|
17115
|
+
let rawName = arg.content;
|
|
17116
|
+
// TODO deprecate @vnodeXXX usage
|
|
17117
|
+
if (rawName.startsWith('vue:')) {
|
|
17118
|
+
rawName = `vnode-${rawName.slice(4)}`;
|
|
17119
|
+
}
|
|
17118
17120
|
// for all event listeners, auto convert it to camelCase. See issue #2249
|
|
17119
17121
|
eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
|
|
17120
17122
|
}
|