@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.cjs.js
CHANGED
|
@@ -113,7 +113,7 @@ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomo
|
|
|
113
113
|
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
|
114
114
|
/**
|
|
115
115
|
* Boolean attributes should be included if the value is truthy or ''.
|
|
116
|
-
* e.g.
|
|
116
|
+
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
117
117
|
*/
|
|
118
118
|
function includeBooleanAttr(value) {
|
|
119
119
|
return !!value || value === '';
|
|
@@ -478,7 +478,7 @@ const isIntegerKey = (key) => isString(key) &&
|
|
|
478
478
|
'' + parseInt(key, 10) === key;
|
|
479
479
|
const isReservedProp = /*#__PURE__*/ makeMap(
|
|
480
480
|
// the leading comma is intentional so empty string "" is also included
|
|
481
|
-
',key,ref,' +
|
|
481
|
+
',key,ref,ref_for,ref_key,' +
|
|
482
482
|
'onVnodeBeforeMount,onVnodeMounted,' +
|
|
483
483
|
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
|
484
484
|
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
|
@@ -667,7 +667,7 @@ const targetMap = new WeakMap();
|
|
|
667
667
|
let effectTrackDepth = 0;
|
|
668
668
|
let trackOpBit = 1;
|
|
669
669
|
/**
|
|
670
|
-
* The bitwise track markers support at most 30 levels
|
|
670
|
+
* The bitwise track markers support at most 30 levels of recursion.
|
|
671
671
|
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
|
|
672
672
|
* When recursion depth is greater, fall back to using a full cleanup.
|
|
673
673
|
*/
|
|
@@ -988,7 +988,7 @@ const shallowSet = /*#__PURE__*/ createSetter(true);
|
|
|
988
988
|
function createSetter(shallow = false) {
|
|
989
989
|
return function set(target, key, value, receiver) {
|
|
990
990
|
let oldValue = target[key];
|
|
991
|
-
if (!shallow) {
|
|
991
|
+
if (!shallow && !isReadonly(value)) {
|
|
992
992
|
value = toRaw(value);
|
|
993
993
|
oldValue = toRaw(oldValue);
|
|
994
994
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
@@ -1573,21 +1573,25 @@ function toRefs(object) {
|
|
|
1573
1573
|
return ret;
|
|
1574
1574
|
}
|
|
1575
1575
|
class ObjectRefImpl {
|
|
1576
|
-
constructor(_object, _key) {
|
|
1576
|
+
constructor(_object, _key, _defaultValue) {
|
|
1577
1577
|
this._object = _object;
|
|
1578
1578
|
this._key = _key;
|
|
1579
|
+
this._defaultValue = _defaultValue;
|
|
1579
1580
|
this.__v_isRef = true;
|
|
1580
1581
|
}
|
|
1581
1582
|
get value() {
|
|
1582
|
-
|
|
1583
|
+
const val = this._object[this._key];
|
|
1584
|
+
return val === undefined ? this._defaultValue : val;
|
|
1583
1585
|
}
|
|
1584
1586
|
set value(newVal) {
|
|
1585
1587
|
this._object[this._key] = newVal;
|
|
1586
1588
|
}
|
|
1587
1589
|
}
|
|
1588
|
-
function toRef(object, key) {
|
|
1590
|
+
function toRef(object, key, defaultValue) {
|
|
1589
1591
|
const val = object[key];
|
|
1590
|
-
return isRef(val)
|
|
1592
|
+
return isRef(val)
|
|
1593
|
+
? val
|
|
1594
|
+
: new ObjectRefImpl(object, key, defaultValue);
|
|
1591
1595
|
}
|
|
1592
1596
|
|
|
1593
1597
|
class ComputedRefImpl {
|
|
@@ -1794,6 +1798,7 @@ function emit(event, ...args) {
|
|
|
1794
1798
|
}
|
|
1795
1799
|
}
|
|
1796
1800
|
function setDevtoolsHook(hook, target) {
|
|
1801
|
+
var _a, _b;
|
|
1797
1802
|
devtools = hook;
|
|
1798
1803
|
if (devtools) {
|
|
1799
1804
|
devtools.enabled = true;
|
|
@@ -1806,7 +1811,10 @@ function setDevtoolsHook(hook, target) {
|
|
|
1806
1811
|
// (#4815)
|
|
1807
1812
|
// eslint-disable-next-line no-restricted-globals
|
|
1808
1813
|
typeof window !== 'undefined' &&
|
|
1809
|
-
|
|
1814
|
+
// some envs mock window but not fully
|
|
1815
|
+
window.HTMLElement &&
|
|
1816
|
+
// also exclude jsdom
|
|
1817
|
+
!((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
|
|
1810
1818
|
const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
|
|
1811
1819
|
target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
|
|
1812
1820
|
replay.push((newHook) => {
|
|
@@ -2029,11 +2037,6 @@ const deprecationData = {
|
|
|
2029
2037
|
`Use "${newHook}" instead.`,
|
|
2030
2038
|
link: `https://v3.vuejs.org/guide/migration/custom-directives.html`
|
|
2031
2039
|
},
|
|
2032
|
-
["V_FOR_REF" /* V_FOR_REF */]: {
|
|
2033
|
-
message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
|
|
2034
|
-
`Consider using function refs or refactor to avoid ref usage altogether.`,
|
|
2035
|
-
link: `https://v3.vuejs.org/guide/migration/array-refs.html`
|
|
2036
|
-
},
|
|
2037
2040
|
["V_ON_KEYCODE_MODIFIER" /* V_ON_KEYCODE_MODIFIER */]: {
|
|
2038
2041
|
message: `Using keyCode as v-on modifier is no longer supported. ` +
|
|
2039
2042
|
`Use kebab-case key name modifiers instead.`,
|
|
@@ -3440,7 +3443,8 @@ const BaseTransitionImpl = {
|
|
|
3440
3443
|
const rawProps = toRaw(props);
|
|
3441
3444
|
const { mode } = rawProps;
|
|
3442
3445
|
// check mode
|
|
3443
|
-
if (mode &&
|
|
3446
|
+
if (mode &&
|
|
3447
|
+
mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
|
|
3444
3448
|
warn$1(`invalid <transition> mode: ${mode}`);
|
|
3445
3449
|
}
|
|
3446
3450
|
// at this point children has a guaranteed length of 1.
|
|
@@ -4086,7 +4090,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
|
4086
4090
|
}
|
|
4087
4091
|
current = current.parent;
|
|
4088
4092
|
}
|
|
4089
|
-
hook();
|
|
4093
|
+
return hook();
|
|
4090
4094
|
});
|
|
4091
4095
|
injectHook(type, wrappedHook, target);
|
|
4092
4096
|
// In addition to registering it on the target instance, we walk up the parent
|
|
@@ -4864,7 +4868,7 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
4864
4868
|
continue;
|
|
4865
4869
|
}
|
|
4866
4870
|
}
|
|
4867
|
-
if (value !== attrs[key]) {
|
|
4871
|
+
if (!(key in attrs) || value !== attrs[key]) {
|
|
4868
4872
|
attrs[key] = value;
|
|
4869
4873
|
hasAttrsChanged = true;
|
|
4870
4874
|
}
|
|
@@ -5445,7 +5449,7 @@ function createCompatVue(createApp, createSingletonApp) {
|
|
|
5445
5449
|
return vm;
|
|
5446
5450
|
}
|
|
5447
5451
|
}
|
|
5448
|
-
Vue.version = "3.2.
|
|
5452
|
+
Vue.version = "3.2.25";
|
|
5449
5453
|
Vue.config = singletonApp.config;
|
|
5450
5454
|
Vue.use = (p, ...options) => {
|
|
5451
5455
|
if (p && isFunction(p.install)) {
|
|
@@ -5796,7 +5800,7 @@ const methodsToPatch = [
|
|
|
5796
5800
|
];
|
|
5797
5801
|
const patched = new WeakSet();
|
|
5798
5802
|
function defineReactive(obj, key, val) {
|
|
5799
|
-
// it's possible for the
|
|
5803
|
+
// it's possible for the original object to be mutated after being defined
|
|
5800
5804
|
// and expecting reactivity... we are covering it here because this seems to
|
|
5801
5805
|
// be a bit more common.
|
|
5802
5806
|
if (isObject(val) && !isReactive(val) && !patched.has(val)) {
|
|
@@ -6016,6 +6020,102 @@ function createAppAPI(render, hydrate) {
|
|
|
6016
6020
|
};
|
|
6017
6021
|
}
|
|
6018
6022
|
|
|
6023
|
+
/**
|
|
6024
|
+
* Function for handling a template ref
|
|
6025
|
+
*/
|
|
6026
|
+
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
6027
|
+
if (isArray(rawRef)) {
|
|
6028
|
+
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
6029
|
+
return;
|
|
6030
|
+
}
|
|
6031
|
+
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
6032
|
+
// when mounting async components, nothing needs to be done,
|
|
6033
|
+
// because the template ref is forwarded to inner component
|
|
6034
|
+
return;
|
|
6035
|
+
}
|
|
6036
|
+
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
6037
|
+
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
6038
|
+
: vnode.el;
|
|
6039
|
+
const value = isUnmount ? null : refValue;
|
|
6040
|
+
const { i: owner, r: ref } = rawRef;
|
|
6041
|
+
if (!owner) {
|
|
6042
|
+
warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
6043
|
+
`A vnode with ref must be created inside the render function.`);
|
|
6044
|
+
return;
|
|
6045
|
+
}
|
|
6046
|
+
const oldRef = oldRawRef && oldRawRef.r;
|
|
6047
|
+
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
6048
|
+
const setupState = owner.setupState;
|
|
6049
|
+
// dynamic ref changed. unset old ref
|
|
6050
|
+
if (oldRef != null && oldRef !== ref) {
|
|
6051
|
+
if (isString(oldRef)) {
|
|
6052
|
+
refs[oldRef] = null;
|
|
6053
|
+
if (hasOwn(setupState, oldRef)) {
|
|
6054
|
+
setupState[oldRef] = null;
|
|
6055
|
+
}
|
|
6056
|
+
}
|
|
6057
|
+
else if (isRef(oldRef)) {
|
|
6058
|
+
oldRef.value = null;
|
|
6059
|
+
}
|
|
6060
|
+
}
|
|
6061
|
+
if (isFunction(ref)) {
|
|
6062
|
+
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
6063
|
+
}
|
|
6064
|
+
else {
|
|
6065
|
+
const _isString = isString(ref);
|
|
6066
|
+
const _isRef = isRef(ref);
|
|
6067
|
+
if (_isString || _isRef) {
|
|
6068
|
+
const doSet = () => {
|
|
6069
|
+
if (rawRef.f) {
|
|
6070
|
+
const existing = _isString ? refs[ref] : ref.value;
|
|
6071
|
+
if (isUnmount) {
|
|
6072
|
+
isArray(existing) && remove(existing, refValue);
|
|
6073
|
+
}
|
|
6074
|
+
else {
|
|
6075
|
+
if (!isArray(existing)) {
|
|
6076
|
+
if (_isString) {
|
|
6077
|
+
refs[ref] = [refValue];
|
|
6078
|
+
}
|
|
6079
|
+
else {
|
|
6080
|
+
ref.value = [refValue];
|
|
6081
|
+
if (rawRef.k)
|
|
6082
|
+
refs[rawRef.k] = ref.value;
|
|
6083
|
+
}
|
|
6084
|
+
}
|
|
6085
|
+
else if (!existing.includes(refValue)) {
|
|
6086
|
+
existing.push(refValue);
|
|
6087
|
+
}
|
|
6088
|
+
}
|
|
6089
|
+
}
|
|
6090
|
+
else if (_isString) {
|
|
6091
|
+
refs[ref] = value;
|
|
6092
|
+
if (hasOwn(setupState, ref)) {
|
|
6093
|
+
setupState[ref] = value;
|
|
6094
|
+
}
|
|
6095
|
+
}
|
|
6096
|
+
else if (isRef(ref)) {
|
|
6097
|
+
ref.value = value;
|
|
6098
|
+
if (rawRef.k)
|
|
6099
|
+
refs[rawRef.k] = value;
|
|
6100
|
+
}
|
|
6101
|
+
else {
|
|
6102
|
+
warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
6103
|
+
}
|
|
6104
|
+
};
|
|
6105
|
+
if (value) {
|
|
6106
|
+
doSet.id = -1;
|
|
6107
|
+
queuePostRenderEffect(doSet, parentSuspense);
|
|
6108
|
+
}
|
|
6109
|
+
else {
|
|
6110
|
+
doSet();
|
|
6111
|
+
}
|
|
6112
|
+
}
|
|
6113
|
+
else {
|
|
6114
|
+
warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
6115
|
+
}
|
|
6116
|
+
}
|
|
6117
|
+
}
|
|
6118
|
+
|
|
6019
6119
|
let hasMismatch = false;
|
|
6020
6120
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
6021
6121
|
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
@@ -6377,44 +6477,6 @@ function isSupported() {
|
|
|
6377
6477
|
return supported;
|
|
6378
6478
|
}
|
|
6379
6479
|
|
|
6380
|
-
function convertLegacyRefInFor(vnode) {
|
|
6381
|
-
// refInFor
|
|
6382
|
-
if (vnode.props && vnode.props.refInFor) {
|
|
6383
|
-
delete vnode.props.refInFor;
|
|
6384
|
-
if (vnode.ref) {
|
|
6385
|
-
if (isArray(vnode.ref)) {
|
|
6386
|
-
vnode.ref.forEach(r => (r.f = true));
|
|
6387
|
-
}
|
|
6388
|
-
else {
|
|
6389
|
-
vnode.ref.f = true;
|
|
6390
|
-
}
|
|
6391
|
-
}
|
|
6392
|
-
}
|
|
6393
|
-
}
|
|
6394
|
-
function registerLegacyRef(refs, key, value, owner, isInFor, isUnmount) {
|
|
6395
|
-
const existing = refs[key];
|
|
6396
|
-
if (isUnmount) {
|
|
6397
|
-
if (isArray(existing)) {
|
|
6398
|
-
remove(existing, value);
|
|
6399
|
-
}
|
|
6400
|
-
else {
|
|
6401
|
-
refs[key] = null;
|
|
6402
|
-
}
|
|
6403
|
-
}
|
|
6404
|
-
else if (isInFor) {
|
|
6405
|
-
warnDeprecation("V_FOR_REF" /* V_FOR_REF */, owner);
|
|
6406
|
-
if (!isArray(existing)) {
|
|
6407
|
-
refs[key] = [value];
|
|
6408
|
-
}
|
|
6409
|
-
else if (!existing.includes(value)) {
|
|
6410
|
-
existing.push(value);
|
|
6411
|
-
}
|
|
6412
|
-
}
|
|
6413
|
-
else {
|
|
6414
|
-
refs[key] = value;
|
|
6415
|
-
}
|
|
6416
|
-
}
|
|
6417
|
-
|
|
6418
6480
|
const queuePostRenderEffect = queueEffectWithSuspense
|
|
6419
6481
|
;
|
|
6420
6482
|
/**
|
|
@@ -6686,12 +6748,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6686
6748
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
6687
6749
|
const newProps = n2.props || EMPTY_OBJ;
|
|
6688
6750
|
let vnodeHook;
|
|
6751
|
+
// disable recurse in beforeUpdate hooks
|
|
6752
|
+
parentComponent && toggleRecurse(parentComponent, false);
|
|
6689
6753
|
if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
|
|
6690
6754
|
invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
6691
6755
|
}
|
|
6692
6756
|
if (dirs) {
|
|
6693
6757
|
invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
|
|
6694
6758
|
}
|
|
6759
|
+
parentComponent && toggleRecurse(parentComponent, true);
|
|
6695
6760
|
if (isHmrUpdating) {
|
|
6696
6761
|
// HMR updated, force full diff
|
|
6697
6762
|
patchFlag = 0;
|
|
@@ -6975,7 +7040,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6975
7040
|
const { el, props } = initialVNode;
|
|
6976
7041
|
const { bm, m, parent } = instance;
|
|
6977
7042
|
const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
|
6978
|
-
|
|
7043
|
+
toggleRecurse(instance, false);
|
|
6979
7044
|
// beforeMount hook
|
|
6980
7045
|
if (bm) {
|
|
6981
7046
|
invokeArrayFns(bm);
|
|
@@ -6988,7 +7053,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6988
7053
|
if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
|
|
6989
7054
|
instance.emit('hook:beforeMount');
|
|
6990
7055
|
}
|
|
6991
|
-
|
|
7056
|
+
toggleRecurse(instance, true);
|
|
6992
7057
|
if (el && hydrateNode) {
|
|
6993
7058
|
// vnode has adopted host node - perform hydration instead of mount.
|
|
6994
7059
|
const hydrateSubTree = () => {
|
|
@@ -7076,7 +7141,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7076
7141
|
pushWarningContext(next || instance.vnode);
|
|
7077
7142
|
}
|
|
7078
7143
|
// Disallow component effect recursion during pre-lifecycle hooks.
|
|
7079
|
-
|
|
7144
|
+
toggleRecurse(instance, false);
|
|
7080
7145
|
if (next) {
|
|
7081
7146
|
next.el = vnode.el;
|
|
7082
7147
|
updateComponentPreRender(instance, next, optimized);
|
|
@@ -7095,7 +7160,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7095
7160
|
if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
|
|
7096
7161
|
instance.emit('hook:beforeUpdate');
|
|
7097
7162
|
}
|
|
7098
|
-
|
|
7163
|
+
toggleRecurse(instance, true);
|
|
7099
7164
|
// render
|
|
7100
7165
|
{
|
|
7101
7166
|
startMeasure(instance, `render`);
|
|
@@ -7144,13 +7209,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7144
7209
|
}
|
|
7145
7210
|
};
|
|
7146
7211
|
// create reactive effect for rendering
|
|
7147
|
-
const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
7148
|
-
);
|
|
7212
|
+
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
7213
|
+
));
|
|
7149
7214
|
const update = (instance.update = effect.run.bind(effect));
|
|
7150
7215
|
update.id = instance.uid;
|
|
7151
7216
|
// allowRecurse
|
|
7152
7217
|
// #1801, #2043 component render effects should allow recursive updates
|
|
7153
|
-
|
|
7218
|
+
toggleRecurse(instance, true);
|
|
7154
7219
|
{
|
|
7155
7220
|
effect.onTrack = instance.rtc
|
|
7156
7221
|
? e => invokeArrayFns(instance.rtc, e)
|
|
@@ -7680,88 +7745,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7680
7745
|
createApp: createAppAPI(render, hydrate)
|
|
7681
7746
|
};
|
|
7682
7747
|
}
|
|
7683
|
-
function
|
|
7684
|
-
|
|
7685
|
-
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
7686
|
-
return;
|
|
7687
|
-
}
|
|
7688
|
-
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
7689
|
-
// when mounting async components, nothing needs to be done,
|
|
7690
|
-
// because the template ref is forwarded to inner component
|
|
7691
|
-
return;
|
|
7692
|
-
}
|
|
7693
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
7694
|
-
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
7695
|
-
: vnode.el;
|
|
7696
|
-
const value = isUnmount ? null : refValue;
|
|
7697
|
-
const { i: owner, r: ref } = rawRef;
|
|
7698
|
-
if (!owner) {
|
|
7699
|
-
warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
7700
|
-
`A vnode with ref must be created inside the render function.`);
|
|
7701
|
-
return;
|
|
7702
|
-
}
|
|
7703
|
-
const oldRef = oldRawRef && oldRawRef.r;
|
|
7704
|
-
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
7705
|
-
const setupState = owner.setupState;
|
|
7706
|
-
// dynamic ref changed. unset old ref
|
|
7707
|
-
if (oldRef != null && oldRef !== ref) {
|
|
7708
|
-
if (isString(oldRef)) {
|
|
7709
|
-
refs[oldRef] = null;
|
|
7710
|
-
if (hasOwn(setupState, oldRef)) {
|
|
7711
|
-
setupState[oldRef] = null;
|
|
7712
|
-
}
|
|
7713
|
-
}
|
|
7714
|
-
else if (isRef(oldRef)) {
|
|
7715
|
-
oldRef.value = null;
|
|
7716
|
-
}
|
|
7717
|
-
}
|
|
7718
|
-
if (isString(ref)) {
|
|
7719
|
-
const doSet = () => {
|
|
7720
|
-
if (isCompatEnabled("V_FOR_REF" /* V_FOR_REF */, owner)) {
|
|
7721
|
-
registerLegacyRef(refs, ref, refValue, owner, rawRef.f, isUnmount);
|
|
7722
|
-
}
|
|
7723
|
-
else {
|
|
7724
|
-
refs[ref] = value;
|
|
7725
|
-
}
|
|
7726
|
-
if (hasOwn(setupState, ref)) {
|
|
7727
|
-
setupState[ref] = value;
|
|
7728
|
-
}
|
|
7729
|
-
};
|
|
7730
|
-
// #1789: for non-null values, set them after render
|
|
7731
|
-
// null values means this is unmount and it should not overwrite another
|
|
7732
|
-
// ref with the same key
|
|
7733
|
-
if (value) {
|
|
7734
|
-
doSet.id = -1;
|
|
7735
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
7736
|
-
}
|
|
7737
|
-
else {
|
|
7738
|
-
doSet();
|
|
7739
|
-
}
|
|
7740
|
-
}
|
|
7741
|
-
else if (isRef(ref)) {
|
|
7742
|
-
const doSet = () => {
|
|
7743
|
-
ref.value = value;
|
|
7744
|
-
};
|
|
7745
|
-
if (value) {
|
|
7746
|
-
doSet.id = -1;
|
|
7747
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
7748
|
-
}
|
|
7749
|
-
else {
|
|
7750
|
-
doSet();
|
|
7751
|
-
}
|
|
7752
|
-
}
|
|
7753
|
-
else if (isFunction(ref)) {
|
|
7754
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
7755
|
-
}
|
|
7756
|
-
else {
|
|
7757
|
-
warn$1('Invalid template ref type:', value, `(${typeof value})`);
|
|
7758
|
-
}
|
|
7759
|
-
}
|
|
7760
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
7761
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
7762
|
-
vnode,
|
|
7763
|
-
prevVNode
|
|
7764
|
-
]);
|
|
7748
|
+
function toggleRecurse({ effect, update }, allowed) {
|
|
7749
|
+
effect.allowRecurse = update.allowRecurse = allowed;
|
|
7765
7750
|
}
|
|
7766
7751
|
/**
|
|
7767
7752
|
* #1156
|
|
@@ -7771,8 +7756,8 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
|
7771
7756
|
*
|
|
7772
7757
|
* #2080
|
|
7773
7758
|
* Inside keyed `template` fragment static children, if a fragment is moved,
|
|
7774
|
-
* the children will always moved
|
|
7775
|
-
*
|
|
7759
|
+
* the children will always be moved. Therefore, in order to ensure correct move
|
|
7760
|
+
* position, el should be inherited from previous nodes.
|
|
7776
7761
|
*/
|
|
7777
7762
|
function traverseStaticChildren(n1, n2, shallow = false) {
|
|
7778
7763
|
const ch1 = n1.children;
|
|
@@ -8410,6 +8395,7 @@ function convertLegacyFunctionalComponent(comp) {
|
|
|
8410
8395
|
};
|
|
8411
8396
|
Func.props = comp.props;
|
|
8412
8397
|
Func.displayName = comp.name;
|
|
8398
|
+
Func.compatConfig = comp.compatConfig;
|
|
8413
8399
|
// v2 functional components do not inherit attrs
|
|
8414
8400
|
Func.inheritAttrs = false;
|
|
8415
8401
|
normalizedFunctionalComponentMap.set(comp, Func);
|
|
@@ -8555,10 +8541,10 @@ const createVNodeWithArgsTransform = (...args) => {
|
|
|
8555
8541
|
};
|
|
8556
8542
|
const InternalObjectKey = `__vInternal`;
|
|
8557
8543
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
8558
|
-
const normalizeRef = ({ ref }) => {
|
|
8544
|
+
const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
8559
8545
|
return (ref != null
|
|
8560
8546
|
? isString(ref) || isRef(ref) || isFunction(ref)
|
|
8561
|
-
? { i: currentRenderingInstance, r: ref }
|
|
8547
|
+
? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
|
|
8562
8548
|
: ref
|
|
8563
8549
|
: null);
|
|
8564
8550
|
};
|
|
@@ -8626,7 +8612,6 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
8626
8612
|
}
|
|
8627
8613
|
{
|
|
8628
8614
|
convertLegacyVModelProps(vnode);
|
|
8629
|
-
convertLegacyRefInFor(vnode);
|
|
8630
8615
|
defineLegacyVNodeProperties(vnode);
|
|
8631
8616
|
}
|
|
8632
8617
|
return vnode;
|
|
@@ -8899,7 +8884,8 @@ function mergeProps(...args) {
|
|
|
8899
8884
|
else if (isOn(key)) {
|
|
8900
8885
|
const existing = ret[key];
|
|
8901
8886
|
const incoming = toMerge[key];
|
|
8902
|
-
if (existing !== incoming
|
|
8887
|
+
if (existing !== incoming &&
|
|
8888
|
+
!(isArray(existing) && existing.includes(incoming))) {
|
|
8903
8889
|
ret[key] = existing
|
|
8904
8890
|
? [].concat(existing, incoming)
|
|
8905
8891
|
: incoming;
|
|
@@ -8911,6 +8897,12 @@ function mergeProps(...args) {
|
|
|
8911
8897
|
}
|
|
8912
8898
|
}
|
|
8913
8899
|
return ret;
|
|
8900
|
+
}
|
|
8901
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
8902
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
8903
|
+
vnode,
|
|
8904
|
+
prevVNode
|
|
8905
|
+
]);
|
|
8914
8906
|
}
|
|
8915
8907
|
|
|
8916
8908
|
function getCompatChildren(instance) {
|
|
@@ -9343,23 +9335,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
9343
9335
|
const n = accessCache[key];
|
|
9344
9336
|
if (n !== undefined) {
|
|
9345
9337
|
switch (n) {
|
|
9346
|
-
case
|
|
9338
|
+
case 1 /* SETUP */:
|
|
9347
9339
|
return setupState[key];
|
|
9348
|
-
case
|
|
9340
|
+
case 2 /* DATA */:
|
|
9349
9341
|
return data[key];
|
|
9350
|
-
case
|
|
9342
|
+
case 4 /* CONTEXT */:
|
|
9351
9343
|
return ctx[key];
|
|
9352
|
-
case
|
|
9344
|
+
case 3 /* PROPS */:
|
|
9353
9345
|
return props[key];
|
|
9354
9346
|
// default: just fallthrough
|
|
9355
9347
|
}
|
|
9356
9348
|
}
|
|
9357
9349
|
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
9358
|
-
accessCache[key] =
|
|
9350
|
+
accessCache[key] = 1 /* SETUP */;
|
|
9359
9351
|
return setupState[key];
|
|
9360
9352
|
}
|
|
9361
9353
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
9362
|
-
accessCache[key] =
|
|
9354
|
+
accessCache[key] = 2 /* DATA */;
|
|
9363
9355
|
return data[key];
|
|
9364
9356
|
}
|
|
9365
9357
|
else if (
|
|
@@ -9367,15 +9359,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
9367
9359
|
// props
|
|
9368
9360
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
9369
9361
|
hasOwn(normalizedProps, key)) {
|
|
9370
|
-
accessCache[key] =
|
|
9362
|
+
accessCache[key] = 3 /* PROPS */;
|
|
9371
9363
|
return props[key];
|
|
9372
9364
|
}
|
|
9373
9365
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
9374
|
-
accessCache[key] =
|
|
9366
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
9375
9367
|
return ctx[key];
|
|
9376
9368
|
}
|
|
9377
9369
|
else if (shouldCacheAccess) {
|
|
9378
|
-
accessCache[key] =
|
|
9370
|
+
accessCache[key] = 0 /* OTHER */;
|
|
9379
9371
|
}
|
|
9380
9372
|
}
|
|
9381
9373
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -9396,7 +9388,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
9396
9388
|
}
|
|
9397
9389
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
9398
9390
|
// user may set custom properties to `this` that start with `$`
|
|
9399
|
-
accessCache[key] =
|
|
9391
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
9400
9392
|
return ctx[key];
|
|
9401
9393
|
}
|
|
9402
9394
|
else if (
|
|
@@ -9464,7 +9456,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
9464
9456
|
},
|
|
9465
9457
|
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
9466
9458
|
let normalizedProps;
|
|
9467
|
-
return (accessCache[key]
|
|
9459
|
+
return (!!accessCache[key] ||
|
|
9468
9460
|
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
9469
9461
|
(setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
|
9470
9462
|
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
@@ -9570,6 +9562,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
9570
9562
|
root: null,
|
|
9571
9563
|
next: null,
|
|
9572
9564
|
subTree: null,
|
|
9565
|
+
effect: null,
|
|
9573
9566
|
update: null,
|
|
9574
9567
|
scope: new EffectScope(true /* detached */),
|
|
9575
9568
|
render: null,
|
|
@@ -11060,7 +11053,7 @@ function isMemoSame(cached, memo) {
|
|
|
11060
11053
|
}
|
|
11061
11054
|
|
|
11062
11055
|
// Core API ------------------------------------------------------------------
|
|
11063
|
-
const version = "3.2.
|
|
11056
|
+
const version = "3.2.25";
|
|
11064
11057
|
const _ssrUtils = {
|
|
11065
11058
|
createComponentInstance,
|
|
11066
11059
|
setupComponent,
|
|
@@ -11335,12 +11328,19 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
11335
11328
|
el[key] = value == null ? '' : value;
|
|
11336
11329
|
return;
|
|
11337
11330
|
}
|
|
11338
|
-
if (key === 'value' &&
|
|
11331
|
+
if (key === 'value' &&
|
|
11332
|
+
el.tagName !== 'PROGRESS' &&
|
|
11333
|
+
// custom elements may use _value internally
|
|
11334
|
+
!el.tagName.includes('-')) {
|
|
11339
11335
|
// store value as _value as well since
|
|
11340
11336
|
// non-string values will be stringified.
|
|
11341
11337
|
el._value = value;
|
|
11342
11338
|
const newValue = value == null ? '' : value;
|
|
11343
|
-
if (el.value !== newValue
|
|
11339
|
+
if (el.value !== newValue ||
|
|
11340
|
+
// #4956: always set for OPTION elements because its value falls back to
|
|
11341
|
+
// textContent if no value attribute is present. And setting .value for
|
|
11342
|
+
// OPTION has no side effect
|
|
11343
|
+
el.tagName === 'OPTION') {
|
|
11344
11344
|
el.value = newValue;
|
|
11345
11345
|
}
|
|
11346
11346
|
if (value == null) {
|
|
@@ -11736,7 +11736,7 @@ class VueElement extends BaseClass {
|
|
|
11736
11736
|
// HMR
|
|
11737
11737
|
{
|
|
11738
11738
|
instance.ceReload = newStyles => {
|
|
11739
|
-
//
|
|
11739
|
+
// always reset styles
|
|
11740
11740
|
if (this._styles) {
|
|
11741
11741
|
this._styles.forEach(s => this.shadowRoot.removeChild(s));
|
|
11742
11742
|
this._styles.length = 0;
|
|
@@ -13387,12 +13387,12 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
|
13387
13387
|
}
|
|
13388
13388
|
else if (p.name === 'bind' &&
|
|
13389
13389
|
(p.exp || allowEmpty) &&
|
|
13390
|
-
|
|
13390
|
+
isStaticArgOf(p.arg, name)) {
|
|
13391
13391
|
return p;
|
|
13392
13392
|
}
|
|
13393
13393
|
}
|
|
13394
13394
|
}
|
|
13395
|
-
function
|
|
13395
|
+
function isStaticArgOf(arg, name) {
|
|
13396
13396
|
return !!(arg && isStaticExp(arg) && arg.content === name);
|
|
13397
13397
|
}
|
|
13398
13398
|
function hasDynamicKeyVBind(node) {
|
|
@@ -13435,7 +13435,6 @@ function getUnnormalizedProps(props, callPath = []) {
|
|
|
13435
13435
|
}
|
|
13436
13436
|
function injectProp(node, prop, context) {
|
|
13437
13437
|
let propsWithInjection;
|
|
13438
|
-
const originalProps = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
|
|
13439
13438
|
/**
|
|
13440
13439
|
* 1. mergeProps(...)
|
|
13441
13440
|
* 2. toHandlers(...)
|
|
@@ -13444,7 +13443,7 @@ function injectProp(node, prop, context) {
|
|
|
13444
13443
|
*
|
|
13445
13444
|
* we need to get the real props before normalization
|
|
13446
13445
|
*/
|
|
13447
|
-
let props =
|
|
13446
|
+
let props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
|
|
13448
13447
|
let callPath = [];
|
|
13449
13448
|
let parentCall;
|
|
13450
13449
|
if (props &&
|
|
@@ -13626,11 +13625,6 @@ const deprecationData$1 = {
|
|
|
13626
13625
|
`data source.`,
|
|
13627
13626
|
link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
|
|
13628
13627
|
},
|
|
13629
|
-
["COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */]: {
|
|
13630
|
-
message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
|
|
13631
|
-
`Consider using function refs or refactor to avoid ref usage altogether.`,
|
|
13632
|
-
link: `https://v3.vuejs.org/guide/migration/array-refs.html`
|
|
13633
|
-
},
|
|
13634
13628
|
["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
|
|
13635
13629
|
message: `<template> with no special directives will render as a native template ` +
|
|
13636
13630
|
`element instead of its inner content in Vue 3.`
|
|
@@ -14148,7 +14142,7 @@ function isComponent(tag, props, context) {
|
|
|
14148
14142
|
else if (
|
|
14149
14143
|
// :is on plain element - only treat as component in compat mode
|
|
14150
14144
|
p.name === 'bind' &&
|
|
14151
|
-
|
|
14145
|
+
isStaticArgOf(p.arg, 'is') &&
|
|
14152
14146
|
true &&
|
|
14153
14147
|
checkCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
|
|
14154
14148
|
return true;
|
|
@@ -14508,15 +14502,6 @@ function isSingleElementRoot(root, child) {
|
|
|
14508
14502
|
!isSlotOutlet(child));
|
|
14509
14503
|
}
|
|
14510
14504
|
function walk$1(node, context, doNotHoistNode = false) {
|
|
14511
|
-
// Some transforms, e.g. transformAssetUrls from @vue/compiler-sfc, replaces
|
|
14512
|
-
// static bindings with expressions. These expressions are guaranteed to be
|
|
14513
|
-
// constant so they are still eligible for hoisting, but they are only
|
|
14514
|
-
// available at runtime and therefore cannot be evaluated ahead of time.
|
|
14515
|
-
// This is only a concern for pre-stringification (via transformHoist by
|
|
14516
|
-
// @vue/compiler-dom), but doing it here allows us to perform only one full
|
|
14517
|
-
// walk of the AST and allow `stringifyStatic` to stop walking as soon as its
|
|
14518
|
-
// stringification threshold is met.
|
|
14519
|
-
let canStringify = true;
|
|
14520
14505
|
const { children } = node;
|
|
14521
14506
|
const originalCount = children.length;
|
|
14522
14507
|
let hoistedCount = 0;
|
|
@@ -14529,9 +14514,6 @@ function walk$1(node, context, doNotHoistNode = false) {
|
|
|
14529
14514
|
? 0 /* NOT_CONSTANT */
|
|
14530
14515
|
: getConstantType(child, context);
|
|
14531
14516
|
if (constantType > 0 /* NOT_CONSTANT */) {
|
|
14532
|
-
if (constantType < 3 /* CAN_STRINGIFY */) {
|
|
14533
|
-
canStringify = false;
|
|
14534
|
-
}
|
|
14535
14517
|
if (constantType >= 2 /* CAN_HOIST */) {
|
|
14536
14518
|
child.codegenNode.patchFlag =
|
|
14537
14519
|
-1 /* HOISTED */ + (` /* HOISTED */` );
|
|
@@ -14562,17 +14544,10 @@ function walk$1(node, context, doNotHoistNode = false) {
|
|
|
14562
14544
|
}
|
|
14563
14545
|
}
|
|
14564
14546
|
}
|
|
14565
|
-
else if (child.type === 12 /* TEXT_CALL */
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
canStringify = false;
|
|
14570
|
-
}
|
|
14571
|
-
if (contentType >= 2 /* CAN_HOIST */) {
|
|
14572
|
-
child.codegenNode = context.hoist(child.codegenNode);
|
|
14573
|
-
hoistedCount++;
|
|
14574
|
-
}
|
|
14575
|
-
}
|
|
14547
|
+
else if (child.type === 12 /* TEXT_CALL */ &&
|
|
14548
|
+
getConstantType(child.content, context) >= 2 /* CAN_HOIST */) {
|
|
14549
|
+
child.codegenNode = context.hoist(child.codegenNode);
|
|
14550
|
+
hoistedCount++;
|
|
14576
14551
|
}
|
|
14577
14552
|
// walk further
|
|
14578
14553
|
if (child.type === 1 /* ELEMENT */) {
|
|
@@ -14596,7 +14571,7 @@ function walk$1(node, context, doNotHoistNode = false) {
|
|
|
14596
14571
|
}
|
|
14597
14572
|
}
|
|
14598
14573
|
}
|
|
14599
|
-
if (
|
|
14574
|
+
if (hoistedCount && context.transformHoist) {
|
|
14600
14575
|
context.transformHoist(children, context, node);
|
|
14601
14576
|
}
|
|
14602
14577
|
// all children were hoisted - the entire children array is hoistable.
|
|
@@ -14625,6 +14600,11 @@ function getConstantType(node, context) {
|
|
|
14625
14600
|
if (codegenNode.type !== 13 /* VNODE_CALL */) {
|
|
14626
14601
|
return 0 /* NOT_CONSTANT */;
|
|
14627
14602
|
}
|
|
14603
|
+
if (codegenNode.isBlock &&
|
|
14604
|
+
node.tag !== 'svg' &&
|
|
14605
|
+
node.tag !== 'foreignObject') {
|
|
14606
|
+
return 0 /* NOT_CONSTANT */;
|
|
14607
|
+
}
|
|
14628
14608
|
const flag = getPatchFlag(codegenNode);
|
|
14629
14609
|
if (!flag) {
|
|
14630
14610
|
let returnType = 3 /* CAN_STRINGIFY */;
|
|
@@ -14761,7 +14741,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
14761
14741
|
else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
|
|
14762
14742
|
// some helper calls can be hoisted,
|
|
14763
14743
|
// such as the `normalizeProps` generated by the compiler for pre-normalize class,
|
|
14764
|
-
// in this case we need to respect the ConstantType of the helper's
|
|
14744
|
+
// in this case we need to respect the ConstantType of the helper's arguments
|
|
14765
14745
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
14766
14746
|
}
|
|
14767
14747
|
else {
|
|
@@ -17215,10 +17195,7 @@ const transformElement = (node, context) => {
|
|
|
17215
17195
|
// updates inside get proper isSVG flag at runtime. (#639, #643)
|
|
17216
17196
|
// This is technically web-specific, but splitting the logic out of core
|
|
17217
17197
|
// leads to too much unnecessary complexity.
|
|
17218
|
-
(tag === 'svg' ||
|
|
17219
|
-
tag === 'foreignObject' ||
|
|
17220
|
-
// #938: elements with dynamic keys should be forced into blocks
|
|
17221
|
-
findProp(node, 'key', true)));
|
|
17198
|
+
(tag === 'svg' || tag === 'foreignObject'));
|
|
17222
17199
|
// props
|
|
17223
17200
|
if (props.length > 0) {
|
|
17224
17201
|
const propsBuildResult = buildProps(node, context);
|
|
@@ -17230,6 +17207,9 @@ const transformElement = (node, context) => {
|
|
|
17230
17207
|
directives && directives.length
|
|
17231
17208
|
? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
|
|
17232
17209
|
: undefined;
|
|
17210
|
+
if (propsBuildResult.shouldUseBlock) {
|
|
17211
|
+
shouldUseBlock = true;
|
|
17212
|
+
}
|
|
17233
17213
|
}
|
|
17234
17214
|
// children
|
|
17235
17215
|
if (node.children.length > 0) {
|
|
@@ -17419,11 +17399,13 @@ function resolveSetupReference(name, context) {
|
|
|
17419
17399
|
}
|
|
17420
17400
|
}
|
|
17421
17401
|
function buildProps(node, context, props = node.props, ssr = false) {
|
|
17422
|
-
const { tag, loc: elementLoc } = node;
|
|
17402
|
+
const { tag, loc: elementLoc, children } = node;
|
|
17423
17403
|
const isComponent = node.tagType === 1 /* COMPONENT */;
|
|
17424
17404
|
let properties = [];
|
|
17425
17405
|
const mergeArgs = [];
|
|
17426
17406
|
const runtimeDirectives = [];
|
|
17407
|
+
const hasChildren = children.length > 0;
|
|
17408
|
+
let shouldUseBlock = false;
|
|
17427
17409
|
// patchFlag analysis
|
|
17428
17410
|
let patchFlag = 0;
|
|
17429
17411
|
let hasRef = false;
|
|
@@ -17486,15 +17468,20 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
17486
17468
|
const prop = props[i];
|
|
17487
17469
|
if (prop.type === 6 /* ATTRIBUTE */) {
|
|
17488
17470
|
const { loc, name, value } = prop;
|
|
17489
|
-
let
|
|
17471
|
+
let isStatic = true;
|
|
17490
17472
|
if (name === 'ref') {
|
|
17491
17473
|
hasRef = true;
|
|
17474
|
+
if (context.scopes.vFor > 0) {
|
|
17475
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
17476
|
+
}
|
|
17492
17477
|
// in inline mode there is no setupState object, so we can't use string
|
|
17493
17478
|
// keys to set the ref. Instead, we need to transform it to pass the
|
|
17494
17479
|
// actual ref instead.
|
|
17495
|
-
if (
|
|
17496
|
-
|
|
17497
|
-
|
|
17480
|
+
if (value &&
|
|
17481
|
+
context.inline &&
|
|
17482
|
+
context.bindingMetadata[value.content]) {
|
|
17483
|
+
isStatic = false;
|
|
17484
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_key', true), createSimpleExpression(value.content, true, value.loc)));
|
|
17498
17485
|
}
|
|
17499
17486
|
}
|
|
17500
17487
|
// skip is on <component>, or is="vue:xxx"
|
|
@@ -17504,7 +17491,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
17504
17491
|
(isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
|
|
17505
17492
|
continue;
|
|
17506
17493
|
}
|
|
17507
|
-
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)),
|
|
17494
|
+
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
|
|
17508
17495
|
}
|
|
17509
17496
|
else {
|
|
17510
17497
|
// directives
|
|
@@ -17525,7 +17512,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
17525
17512
|
// skip v-is and :is on <component>
|
|
17526
17513
|
if (name === 'is' ||
|
|
17527
17514
|
(isVBind &&
|
|
17528
|
-
|
|
17515
|
+
isStaticArgOf(arg, 'is') &&
|
|
17529
17516
|
(isComponentTag(tag) ||
|
|
17530
17517
|
(isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
|
|
17531
17518
|
continue;
|
|
@@ -17534,6 +17521,17 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
17534
17521
|
if (isVOn && ssr) {
|
|
17535
17522
|
continue;
|
|
17536
17523
|
}
|
|
17524
|
+
if (
|
|
17525
|
+
// #938: elements with dynamic keys should be forced into blocks
|
|
17526
|
+
(isVBind && isStaticArgOf(arg, 'key')) ||
|
|
17527
|
+
// inline before-update hooks need to force block so that it is invoked
|
|
17528
|
+
// before children
|
|
17529
|
+
(isVOn && hasChildren && isStaticArgOf(arg, 'vue:before-update'))) {
|
|
17530
|
+
shouldUseBlock = true;
|
|
17531
|
+
}
|
|
17532
|
+
if (isVBind && isStaticArgOf(arg, 'ref') && context.scopes.vFor > 0) {
|
|
17533
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
17534
|
+
}
|
|
17537
17535
|
// special case for v-bind and v-on with no argument
|
|
17538
17536
|
if (!arg && (isVBind || isVOn)) {
|
|
17539
17537
|
hasDynamicKeys = true;
|
|
@@ -17607,14 +17605,13 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
17607
17605
|
else {
|
|
17608
17606
|
// no built-in transform, this is a user custom directive.
|
|
17609
17607
|
runtimeDirectives.push(prop);
|
|
17608
|
+
// custom dirs may use beforeUpdate so they need to force blocks
|
|
17609
|
+
// to ensure before-update gets called before children update
|
|
17610
|
+
if (hasChildren) {
|
|
17611
|
+
shouldUseBlock = true;
|
|
17612
|
+
}
|
|
17610
17613
|
}
|
|
17611
17614
|
}
|
|
17612
|
-
if (prop.type === 6 /* ATTRIBUTE */ &&
|
|
17613
|
-
prop.name === 'ref' &&
|
|
17614
|
-
context.scopes.vFor > 0 &&
|
|
17615
|
-
checkCompatEnabled$1("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
|
|
17616
|
-
properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
|
|
17617
|
-
}
|
|
17618
17615
|
}
|
|
17619
17616
|
let propsExpression = undefined;
|
|
17620
17617
|
// has v-bind="object" or v-on="object", wrap with mergeProps
|
|
@@ -17651,7 +17648,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
17651
17648
|
patchFlag |= 32 /* HYDRATE_EVENTS */;
|
|
17652
17649
|
}
|
|
17653
17650
|
}
|
|
17654
|
-
if (
|
|
17651
|
+
if (!shouldUseBlock &&
|
|
17652
|
+
(patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
|
|
17655
17653
|
(hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
|
|
17656
17654
|
patchFlag |= 512 /* NEED_PATCH */;
|
|
17657
17655
|
}
|
|
@@ -17718,7 +17716,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
17718
17716
|
props: propsExpression,
|
|
17719
17717
|
directives: runtimeDirectives,
|
|
17720
17718
|
patchFlag,
|
|
17721
|
-
dynamicPropNames
|
|
17719
|
+
dynamicPropNames,
|
|
17720
|
+
shouldUseBlock
|
|
17722
17721
|
};
|
|
17723
17722
|
}
|
|
17724
17723
|
// Dedupe props in an object literal.
|
|
@@ -17812,22 +17811,7 @@ function stringifyDynamicPropNames(props) {
|
|
|
17812
17811
|
return propsNamesString + `]`;
|
|
17813
17812
|
}
|
|
17814
17813
|
function isComponentTag(tag) {
|
|
17815
|
-
return tag
|
|
17816
|
-
}
|
|
17817
|
-
function processInlineRef(context, raw) {
|
|
17818
|
-
const body = [createSimpleExpression(`_refs['${raw}'] = _value`)];
|
|
17819
|
-
const { bindingMetadata, helperString } = context;
|
|
17820
|
-
const type = bindingMetadata[raw];
|
|
17821
|
-
if (type === "setup-ref" /* SETUP_REF */) {
|
|
17822
|
-
body.push(createSimpleExpression(`${raw}.value = _value`));
|
|
17823
|
-
}
|
|
17824
|
-
else if (type === "setup-maybe-ref" /* SETUP_MAYBE_REF */) {
|
|
17825
|
-
body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) && (${raw}.value = _value)`));
|
|
17826
|
-
}
|
|
17827
|
-
else if (type === "setup-let" /* SETUP_LET */) {
|
|
17828
|
-
body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) ? ${raw}.value = _value : ${raw} = _value`));
|
|
17829
|
-
}
|
|
17830
|
-
return body;
|
|
17814
|
+
return tag === 'component' || tag === 'Component';
|
|
17831
17815
|
}
|
|
17832
17816
|
|
|
17833
17817
|
const transformSlotOutlet = (node, context) => {
|
|
@@ -17875,7 +17859,7 @@ function processSlotOutlet(node, context) {
|
|
|
17875
17859
|
}
|
|
17876
17860
|
}
|
|
17877
17861
|
else {
|
|
17878
|
-
if (p.name === 'bind' &&
|
|
17862
|
+
if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
|
|
17879
17863
|
if (p.exp)
|
|
17880
17864
|
slotName = p.exp;
|
|
17881
17865
|
}
|
|
@@ -17909,7 +17893,11 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
17909
17893
|
let eventName;
|
|
17910
17894
|
if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
|
|
17911
17895
|
if (arg.isStatic) {
|
|
17912
|
-
|
|
17896
|
+
let rawName = arg.content;
|
|
17897
|
+
// TODO deprecate @vnodeXXX usage
|
|
17898
|
+
if (rawName.startsWith('vue:')) {
|
|
17899
|
+
rawName = `vnode-${rawName.slice(4)}`;
|
|
17900
|
+
}
|
|
17913
17901
|
// for all event listeners, auto convert it to camelCase. See issue #2249
|
|
17914
17902
|
eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
|
|
17915
17903
|
}
|
|
@@ -21285,6 +21273,11 @@ function hasMultipleChildren(node) {
|
|
|
21285
21273
|
/**
|
|
21286
21274
|
* This module is Node-only.
|
|
21287
21275
|
*/
|
|
21276
|
+
/**
|
|
21277
|
+
* Regex for replacing placeholders for embedded constant variables
|
|
21278
|
+
* (e.g. import URL string constants generated by compiler-sfc)
|
|
21279
|
+
*/
|
|
21280
|
+
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
|
|
21288
21281
|
/**
|
|
21289
21282
|
* Turn eligible hoisted static trees into stringified static nodes, e.g.
|
|
21290
21283
|
*
|
|
@@ -21321,7 +21314,7 @@ const stringifyStatic = (children, context, parent) => {
|
|
|
21321
21314
|
ec >= 5 /* ELEMENT_WITH_BINDING_COUNT */) {
|
|
21322
21315
|
// combine all currently eligible nodes into a single static vnode call
|
|
21323
21316
|
const staticCall = createCallExpression(context.helper(CREATE_STATIC), [
|
|
21324
|
-
JSON.stringify(currentChunk.map(node => stringifyNode(node, context)).join('')),
|
|
21317
|
+
JSON.stringify(currentChunk.map(node => stringifyNode(node, context)).join('')).replace(expReplaceRE, `" + $1 + "`),
|
|
21325
21318
|
// the 2nd argument indicates the number of DOM nodes this static vnode
|
|
21326
21319
|
// will insert / hydrate
|
|
21327
21320
|
String(currentChunk.length)
|
|
@@ -21389,7 +21382,7 @@ const replaceHoist = (node, replacement, context) => {
|
|
|
21389
21382
|
const isNonStringifiable = /*#__PURE__*/ makeMap(`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`);
|
|
21390
21383
|
/**
|
|
21391
21384
|
* for a hoisted node, analyze it and return:
|
|
21392
|
-
* - false: bailed (contains runtime constant)
|
|
21385
|
+
* - false: bailed (contains non-stringifiable props or runtime constant)
|
|
21393
21386
|
* - [nc, ec] where
|
|
21394
21387
|
* - nc is the number of nodes inside
|
|
21395
21388
|
* - ec is the number of element with bindings inside
|
|
@@ -21427,6 +21420,11 @@ function analyzeNode(node) {
|
|
|
21427
21420
|
(p.arg.isStatic && !isStringifiableAttr(p.arg.content, node.ns)))) {
|
|
21428
21421
|
return bail();
|
|
21429
21422
|
}
|
|
21423
|
+
if (p.exp &&
|
|
21424
|
+
(p.exp.type === 8 /* COMPOUND_EXPRESSION */ ||
|
|
21425
|
+
p.exp.constType < 3 /* CAN_STRINGIFY */)) {
|
|
21426
|
+
return bail();
|
|
21427
|
+
}
|
|
21430
21428
|
}
|
|
21431
21429
|
}
|
|
21432
21430
|
for (let i = 0; i < node.children.length; i++) {
|
|
@@ -21482,8 +21480,15 @@ function stringifyElement(node, context) {
|
|
|
21482
21480
|
}
|
|
21483
21481
|
}
|
|
21484
21482
|
else if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind') {
|
|
21483
|
+
const exp = p.exp;
|
|
21484
|
+
if (exp.content[0] === '_') {
|
|
21485
|
+
// internally generated string constant references
|
|
21486
|
+
// e.g. imported URL strings via compiler-sfc transformAssetUrl plugin
|
|
21487
|
+
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
|
|
21488
|
+
continue;
|
|
21489
|
+
}
|
|
21485
21490
|
// constant v-bind, e.g. :foo="1"
|
|
21486
|
-
let evaluated = evaluateConstant(
|
|
21491
|
+
let evaluated = evaluateConstant(exp);
|
|
21487
21492
|
if (evaluated != null) {
|
|
21488
21493
|
const arg = p.arg && p.arg.content;
|
|
21489
21494
|
if (arg === 'class') {
|