vue 3.2.24 → 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/dist/vue.esm-browser.js +176 -116
- package/dist/vue.esm-browser.prod.js +1 -1
- package/dist/vue.global.js +176 -116
- package/dist/vue.global.prod.js +1 -1
- package/dist/vue.runtime.esm-browser.js +128 -95
- package/dist/vue.runtime.esm-browser.prod.js +1 -1
- package/dist/vue.runtime.global.js +128 -95
- package/dist/vue.runtime.global.prod.js +1 -1
- package/package.json +9 -7
- package/ref-macros.d.ts +2 -98
package/dist/vue.global.js
CHANGED
|
@@ -110,7 +110,7 @@ var Vue = (function (exports) {
|
|
|
110
110
|
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
|
111
111
|
/**
|
|
112
112
|
* Boolean attributes should be included if the value is truthy or ''.
|
|
113
|
-
* e.g.
|
|
113
|
+
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
114
114
|
*/
|
|
115
115
|
function includeBooleanAttr(value) {
|
|
116
116
|
return !!value || value === '';
|
|
@@ -344,7 +344,7 @@ var Vue = (function (exports) {
|
|
|
344
344
|
'' + parseInt(key, 10) === key;
|
|
345
345
|
const isReservedProp = /*#__PURE__*/ makeMap(
|
|
346
346
|
// the leading comma is intentional so empty string "" is also included
|
|
347
|
-
',key,ref,' +
|
|
347
|
+
',key,ref,ref_for,ref_key,' +
|
|
348
348
|
'onVnodeBeforeMount,onVnodeMounted,' +
|
|
349
349
|
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
|
350
350
|
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
|
@@ -1439,21 +1439,25 @@ var Vue = (function (exports) {
|
|
|
1439
1439
|
return ret;
|
|
1440
1440
|
}
|
|
1441
1441
|
class ObjectRefImpl {
|
|
1442
|
-
constructor(_object, _key) {
|
|
1442
|
+
constructor(_object, _key, _defaultValue) {
|
|
1443
1443
|
this._object = _object;
|
|
1444
1444
|
this._key = _key;
|
|
1445
|
+
this._defaultValue = _defaultValue;
|
|
1445
1446
|
this.__v_isRef = true;
|
|
1446
1447
|
}
|
|
1447
1448
|
get value() {
|
|
1448
|
-
|
|
1449
|
+
const val = this._object[this._key];
|
|
1450
|
+
return val === undefined ? this._defaultValue : val;
|
|
1449
1451
|
}
|
|
1450
1452
|
set value(newVal) {
|
|
1451
1453
|
this._object[this._key] = newVal;
|
|
1452
1454
|
}
|
|
1453
1455
|
}
|
|
1454
|
-
function toRef(object, key) {
|
|
1456
|
+
function toRef(object, key, defaultValue) {
|
|
1455
1457
|
const val = object[key];
|
|
1456
|
-
return isRef(val)
|
|
1458
|
+
return isRef(val)
|
|
1459
|
+
? val
|
|
1460
|
+
: new ObjectRefImpl(object, key, defaultValue);
|
|
1457
1461
|
}
|
|
1458
1462
|
|
|
1459
1463
|
class ComputedRefImpl {
|
|
@@ -4712,6 +4716,102 @@ var Vue = (function (exports) {
|
|
|
4712
4716
|
};
|
|
4713
4717
|
}
|
|
4714
4718
|
|
|
4719
|
+
/**
|
|
4720
|
+
* Function for handling a template ref
|
|
4721
|
+
*/
|
|
4722
|
+
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
4723
|
+
if (isArray(rawRef)) {
|
|
4724
|
+
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
4725
|
+
return;
|
|
4726
|
+
}
|
|
4727
|
+
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
4728
|
+
// when mounting async components, nothing needs to be done,
|
|
4729
|
+
// because the template ref is forwarded to inner component
|
|
4730
|
+
return;
|
|
4731
|
+
}
|
|
4732
|
+
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
4733
|
+
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
4734
|
+
: vnode.el;
|
|
4735
|
+
const value = isUnmount ? null : refValue;
|
|
4736
|
+
const { i: owner, r: ref } = rawRef;
|
|
4737
|
+
if (!owner) {
|
|
4738
|
+
warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
4739
|
+
`A vnode with ref must be created inside the render function.`);
|
|
4740
|
+
return;
|
|
4741
|
+
}
|
|
4742
|
+
const oldRef = oldRawRef && oldRawRef.r;
|
|
4743
|
+
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
4744
|
+
const setupState = owner.setupState;
|
|
4745
|
+
// dynamic ref changed. unset old ref
|
|
4746
|
+
if (oldRef != null && oldRef !== ref) {
|
|
4747
|
+
if (isString(oldRef)) {
|
|
4748
|
+
refs[oldRef] = null;
|
|
4749
|
+
if (hasOwn(setupState, oldRef)) {
|
|
4750
|
+
setupState[oldRef] = null;
|
|
4751
|
+
}
|
|
4752
|
+
}
|
|
4753
|
+
else if (isRef(oldRef)) {
|
|
4754
|
+
oldRef.value = null;
|
|
4755
|
+
}
|
|
4756
|
+
}
|
|
4757
|
+
if (isFunction(ref)) {
|
|
4758
|
+
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
4759
|
+
}
|
|
4760
|
+
else {
|
|
4761
|
+
const _isString = isString(ref);
|
|
4762
|
+
const _isRef = isRef(ref);
|
|
4763
|
+
if (_isString || _isRef) {
|
|
4764
|
+
const doSet = () => {
|
|
4765
|
+
if (rawRef.f) {
|
|
4766
|
+
const existing = _isString ? refs[ref] : ref.value;
|
|
4767
|
+
if (isUnmount) {
|
|
4768
|
+
isArray(existing) && remove(existing, refValue);
|
|
4769
|
+
}
|
|
4770
|
+
else {
|
|
4771
|
+
if (!isArray(existing)) {
|
|
4772
|
+
if (_isString) {
|
|
4773
|
+
refs[ref] = [refValue];
|
|
4774
|
+
}
|
|
4775
|
+
else {
|
|
4776
|
+
ref.value = [refValue];
|
|
4777
|
+
if (rawRef.k)
|
|
4778
|
+
refs[rawRef.k] = ref.value;
|
|
4779
|
+
}
|
|
4780
|
+
}
|
|
4781
|
+
else if (!existing.includes(refValue)) {
|
|
4782
|
+
existing.push(refValue);
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4785
|
+
}
|
|
4786
|
+
else if (_isString) {
|
|
4787
|
+
refs[ref] = value;
|
|
4788
|
+
if (hasOwn(setupState, ref)) {
|
|
4789
|
+
setupState[ref] = value;
|
|
4790
|
+
}
|
|
4791
|
+
}
|
|
4792
|
+
else if (isRef(ref)) {
|
|
4793
|
+
ref.value = value;
|
|
4794
|
+
if (rawRef.k)
|
|
4795
|
+
refs[rawRef.k] = value;
|
|
4796
|
+
}
|
|
4797
|
+
else {
|
|
4798
|
+
warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
4799
|
+
}
|
|
4800
|
+
};
|
|
4801
|
+
if (value) {
|
|
4802
|
+
doSet.id = -1;
|
|
4803
|
+
queuePostRenderEffect(doSet, parentSuspense);
|
|
4804
|
+
}
|
|
4805
|
+
else {
|
|
4806
|
+
doSet();
|
|
4807
|
+
}
|
|
4808
|
+
}
|
|
4809
|
+
else {
|
|
4810
|
+
warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
4811
|
+
}
|
|
4812
|
+
}
|
|
4813
|
+
}
|
|
4814
|
+
|
|
4715
4815
|
let hasMismatch = false;
|
|
4716
4816
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
4717
4817
|
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
@@ -5344,12 +5444,15 @@ var Vue = (function (exports) {
|
|
|
5344
5444
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
5345
5445
|
const newProps = n2.props || EMPTY_OBJ;
|
|
5346
5446
|
let vnodeHook;
|
|
5447
|
+
// disable recurse in beforeUpdate hooks
|
|
5448
|
+
parentComponent && toggleRecurse(parentComponent, false);
|
|
5347
5449
|
if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
|
|
5348
5450
|
invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
5349
5451
|
}
|
|
5350
5452
|
if (dirs) {
|
|
5351
5453
|
invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
|
|
5352
5454
|
}
|
|
5455
|
+
parentComponent && toggleRecurse(parentComponent, true);
|
|
5353
5456
|
if (isHmrUpdating) {
|
|
5354
5457
|
// HMR updated, force full diff
|
|
5355
5458
|
patchFlag = 0;
|
|
@@ -5629,7 +5732,7 @@ var Vue = (function (exports) {
|
|
|
5629
5732
|
const { el, props } = initialVNode;
|
|
5630
5733
|
const { bm, m, parent } = instance;
|
|
5631
5734
|
const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
|
5632
|
-
|
|
5735
|
+
toggleRecurse(instance, false);
|
|
5633
5736
|
// beforeMount hook
|
|
5634
5737
|
if (bm) {
|
|
5635
5738
|
invokeArrayFns(bm);
|
|
@@ -5639,7 +5742,7 @@ var Vue = (function (exports) {
|
|
|
5639
5742
|
(vnodeHook = props && props.onVnodeBeforeMount)) {
|
|
5640
5743
|
invokeVNodeHook(vnodeHook, parent, initialVNode);
|
|
5641
5744
|
}
|
|
5642
|
-
|
|
5745
|
+
toggleRecurse(instance, true);
|
|
5643
5746
|
if (el && hydrateNode) {
|
|
5644
5747
|
// vnode has adopted host node - perform hydration instead of mount.
|
|
5645
5748
|
const hydrateSubTree = () => {
|
|
@@ -5721,7 +5824,7 @@ var Vue = (function (exports) {
|
|
|
5721
5824
|
pushWarningContext(next || instance.vnode);
|
|
5722
5825
|
}
|
|
5723
5826
|
// Disallow component effect recursion during pre-lifecycle hooks.
|
|
5724
|
-
|
|
5827
|
+
toggleRecurse(instance, false);
|
|
5725
5828
|
if (next) {
|
|
5726
5829
|
next.el = vnode.el;
|
|
5727
5830
|
updateComponentPreRender(instance, next, optimized);
|
|
@@ -5737,7 +5840,7 @@ var Vue = (function (exports) {
|
|
|
5737
5840
|
if ((vnodeHook = next.props && next.props.onVnodeBeforeUpdate)) {
|
|
5738
5841
|
invokeVNodeHook(vnodeHook, parent, next, vnode);
|
|
5739
5842
|
}
|
|
5740
|
-
|
|
5843
|
+
toggleRecurse(instance, true);
|
|
5741
5844
|
// render
|
|
5742
5845
|
{
|
|
5743
5846
|
startMeasure(instance, `render`);
|
|
@@ -5783,13 +5886,13 @@ var Vue = (function (exports) {
|
|
|
5783
5886
|
}
|
|
5784
5887
|
};
|
|
5785
5888
|
// create reactive effect for rendering
|
|
5786
|
-
const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
5787
|
-
);
|
|
5889
|
+
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
5890
|
+
));
|
|
5788
5891
|
const update = (instance.update = effect.run.bind(effect));
|
|
5789
5892
|
update.id = instance.uid;
|
|
5790
5893
|
// allowRecurse
|
|
5791
5894
|
// #1801, #2043 component render effects should allow recursive updates
|
|
5792
|
-
|
|
5895
|
+
toggleRecurse(instance, true);
|
|
5793
5896
|
{
|
|
5794
5897
|
effect.onTrack = instance.rtc
|
|
5795
5898
|
? e => invokeArrayFns(instance.rtc, e)
|
|
@@ -6313,85 +6416,8 @@ var Vue = (function (exports) {
|
|
|
6313
6416
|
createApp: createAppAPI(render, hydrate)
|
|
6314
6417
|
};
|
|
6315
6418
|
}
|
|
6316
|
-
function
|
|
6317
|
-
|
|
6318
|
-
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
6319
|
-
return;
|
|
6320
|
-
}
|
|
6321
|
-
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
6322
|
-
// when mounting async components, nothing needs to be done,
|
|
6323
|
-
// because the template ref is forwarded to inner component
|
|
6324
|
-
return;
|
|
6325
|
-
}
|
|
6326
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
6327
|
-
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
6328
|
-
: vnode.el;
|
|
6329
|
-
const value = isUnmount ? null : refValue;
|
|
6330
|
-
const { i: owner, r: ref } = rawRef;
|
|
6331
|
-
if (!owner) {
|
|
6332
|
-
warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
6333
|
-
`A vnode with ref must be created inside the render function.`);
|
|
6334
|
-
return;
|
|
6335
|
-
}
|
|
6336
|
-
const oldRef = oldRawRef && oldRawRef.r;
|
|
6337
|
-
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
6338
|
-
const setupState = owner.setupState;
|
|
6339
|
-
// dynamic ref changed. unset old ref
|
|
6340
|
-
if (oldRef != null && oldRef !== ref) {
|
|
6341
|
-
if (isString(oldRef)) {
|
|
6342
|
-
refs[oldRef] = null;
|
|
6343
|
-
if (hasOwn(setupState, oldRef)) {
|
|
6344
|
-
setupState[oldRef] = null;
|
|
6345
|
-
}
|
|
6346
|
-
}
|
|
6347
|
-
else if (isRef(oldRef)) {
|
|
6348
|
-
oldRef.value = null;
|
|
6349
|
-
}
|
|
6350
|
-
}
|
|
6351
|
-
if (isString(ref)) {
|
|
6352
|
-
const doSet = () => {
|
|
6353
|
-
{
|
|
6354
|
-
refs[ref] = value;
|
|
6355
|
-
}
|
|
6356
|
-
if (hasOwn(setupState, ref)) {
|
|
6357
|
-
setupState[ref] = value;
|
|
6358
|
-
}
|
|
6359
|
-
};
|
|
6360
|
-
// #1789: for non-null values, set them after render
|
|
6361
|
-
// null values means this is unmount and it should not overwrite another
|
|
6362
|
-
// ref with the same key
|
|
6363
|
-
if (value) {
|
|
6364
|
-
doSet.id = -1;
|
|
6365
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
6366
|
-
}
|
|
6367
|
-
else {
|
|
6368
|
-
doSet();
|
|
6369
|
-
}
|
|
6370
|
-
}
|
|
6371
|
-
else if (isRef(ref)) {
|
|
6372
|
-
const doSet = () => {
|
|
6373
|
-
ref.value = value;
|
|
6374
|
-
};
|
|
6375
|
-
if (value) {
|
|
6376
|
-
doSet.id = -1;
|
|
6377
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
6378
|
-
}
|
|
6379
|
-
else {
|
|
6380
|
-
doSet();
|
|
6381
|
-
}
|
|
6382
|
-
}
|
|
6383
|
-
else if (isFunction(ref)) {
|
|
6384
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
6385
|
-
}
|
|
6386
|
-
else {
|
|
6387
|
-
warn$1('Invalid template ref type:', value, `(${typeof value})`);
|
|
6388
|
-
}
|
|
6389
|
-
}
|
|
6390
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
6391
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
6392
|
-
vnode,
|
|
6393
|
-
prevVNode
|
|
6394
|
-
]);
|
|
6419
|
+
function toggleRecurse({ effect, update }, allowed) {
|
|
6420
|
+
effect.allowRecurse = update.allowRecurse = allowed;
|
|
6395
6421
|
}
|
|
6396
6422
|
/**
|
|
6397
6423
|
* #1156
|
|
@@ -6850,10 +6876,10 @@ var Vue = (function (exports) {
|
|
|
6850
6876
|
};
|
|
6851
6877
|
const InternalObjectKey = `__vInternal`;
|
|
6852
6878
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
6853
|
-
const normalizeRef = ({ ref }) => {
|
|
6879
|
+
const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
6854
6880
|
return (ref != null
|
|
6855
6881
|
? isString(ref) || isRef(ref) || isFunction(ref)
|
|
6856
|
-
? { i: currentRenderingInstance, r: ref }
|
|
6882
|
+
? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
|
|
6857
6883
|
: ref
|
|
6858
6884
|
: null);
|
|
6859
6885
|
};
|
|
@@ -7195,6 +7221,12 @@ var Vue = (function (exports) {
|
|
|
7195
7221
|
}
|
|
7196
7222
|
}
|
|
7197
7223
|
return ret;
|
|
7224
|
+
}
|
|
7225
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
7226
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
7227
|
+
vnode,
|
|
7228
|
+
prevVNode
|
|
7229
|
+
]);
|
|
7198
7230
|
}
|
|
7199
7231
|
|
|
7200
7232
|
/**
|
|
@@ -7606,6 +7638,7 @@ var Vue = (function (exports) {
|
|
|
7606
7638
|
root: null,
|
|
7607
7639
|
next: null,
|
|
7608
7640
|
subTree: null,
|
|
7641
|
+
effect: null,
|
|
7609
7642
|
update: null,
|
|
7610
7643
|
scope: new EffectScope(true /* detached */),
|
|
7611
7644
|
render: null,
|
|
@@ -9042,7 +9075,7 @@ var Vue = (function (exports) {
|
|
|
9042
9075
|
}
|
|
9043
9076
|
|
|
9044
9077
|
// Core API ------------------------------------------------------------------
|
|
9045
|
-
const version = "3.2.
|
|
9078
|
+
const version = "3.2.25";
|
|
9046
9079
|
/**
|
|
9047
9080
|
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
|
9048
9081
|
* @internal
|
|
@@ -11138,12 +11171,12 @@ var Vue = (function (exports) {
|
|
|
11138
11171
|
}
|
|
11139
11172
|
else if (p.name === 'bind' &&
|
|
11140
11173
|
(p.exp || allowEmpty) &&
|
|
11141
|
-
|
|
11174
|
+
isStaticArgOf(p.arg, name)) {
|
|
11142
11175
|
return p;
|
|
11143
11176
|
}
|
|
11144
11177
|
}
|
|
11145
11178
|
}
|
|
11146
|
-
function
|
|
11179
|
+
function isStaticArgOf(arg, name) {
|
|
11147
11180
|
return !!(arg && isStaticExp(arg) && arg.content === name);
|
|
11148
11181
|
}
|
|
11149
11182
|
function hasDynamicKeyVBind(node) {
|
|
@@ -11333,11 +11366,6 @@ var Vue = (function (exports) {
|
|
|
11333
11366
|
`data source.`,
|
|
11334
11367
|
link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
|
|
11335
11368
|
},
|
|
11336
|
-
["COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */]: {
|
|
11337
|
-
message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
|
|
11338
|
-
`Consider using function refs or refactor to avoid ref usage altogether.`,
|
|
11339
|
-
link: `https://v3.vuejs.org/guide/migration/array-refs.html`
|
|
11340
|
-
},
|
|
11341
11369
|
["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
|
|
11342
11370
|
message: `<template> with no special directives will render as a native template ` +
|
|
11343
11371
|
`element instead of its inner content in Vue 3.`
|
|
@@ -11810,7 +11838,7 @@ var Vue = (function (exports) {
|
|
|
11810
11838
|
else if (
|
|
11811
11839
|
// :is on plain element - only treat as component in compat mode
|
|
11812
11840
|
p.name === 'bind' &&
|
|
11813
|
-
|
|
11841
|
+
isStaticArgOf(p.arg, 'is') &&
|
|
11814
11842
|
false &&
|
|
11815
11843
|
checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
|
|
11816
11844
|
return true;
|
|
@@ -12257,6 +12285,11 @@ var Vue = (function (exports) {
|
|
|
12257
12285
|
if (codegenNode.type !== 13 /* VNODE_CALL */) {
|
|
12258
12286
|
return 0 /* NOT_CONSTANT */;
|
|
12259
12287
|
}
|
|
12288
|
+
if (codegenNode.isBlock &&
|
|
12289
|
+
node.tag !== 'svg' &&
|
|
12290
|
+
node.tag !== 'foreignObject') {
|
|
12291
|
+
return 0 /* NOT_CONSTANT */;
|
|
12292
|
+
}
|
|
12260
12293
|
const flag = getPatchFlag(codegenNode);
|
|
12261
12294
|
if (!flag) {
|
|
12262
12295
|
let returnType = 3 /* CAN_STRINGIFY */;
|
|
@@ -12393,7 +12426,7 @@ var Vue = (function (exports) {
|
|
|
12393
12426
|
else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
|
|
12394
12427
|
// some helper calls can be hoisted,
|
|
12395
12428
|
// such as the `normalizeProps` generated by the compiler for pre-normalize class,
|
|
12396
|
-
// in this case we need to respect the ConstantType of the helper's
|
|
12429
|
+
// in this case we need to respect the ConstantType of the helper's arguments
|
|
12397
12430
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
12398
12431
|
}
|
|
12399
12432
|
else {
|
|
@@ -14041,10 +14074,7 @@ var Vue = (function (exports) {
|
|
|
14041
14074
|
// updates inside get proper isSVG flag at runtime. (#639, #643)
|
|
14042
14075
|
// This is technically web-specific, but splitting the logic out of core
|
|
14043
14076
|
// leads to too much unnecessary complexity.
|
|
14044
|
-
(tag === 'svg' ||
|
|
14045
|
-
tag === 'foreignObject' ||
|
|
14046
|
-
// #938: elements with dynamic keys should be forced into blocks
|
|
14047
|
-
findProp(node, 'key', true)));
|
|
14077
|
+
(tag === 'svg' || tag === 'foreignObject'));
|
|
14048
14078
|
// props
|
|
14049
14079
|
if (props.length > 0) {
|
|
14050
14080
|
const propsBuildResult = buildProps(node, context);
|
|
@@ -14056,6 +14086,9 @@ var Vue = (function (exports) {
|
|
|
14056
14086
|
directives && directives.length
|
|
14057
14087
|
? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
|
|
14058
14088
|
: undefined;
|
|
14089
|
+
if (propsBuildResult.shouldUseBlock) {
|
|
14090
|
+
shouldUseBlock = true;
|
|
14091
|
+
}
|
|
14059
14092
|
}
|
|
14060
14093
|
// children
|
|
14061
14094
|
if (node.children.length > 0) {
|
|
@@ -14184,11 +14217,13 @@ var Vue = (function (exports) {
|
|
|
14184
14217
|
return toValidAssetId(tag, `component`);
|
|
14185
14218
|
}
|
|
14186
14219
|
function buildProps(node, context, props = node.props, ssr = false) {
|
|
14187
|
-
const { tag, loc: elementLoc } = node;
|
|
14220
|
+
const { tag, loc: elementLoc, children } = node;
|
|
14188
14221
|
const isComponent = node.tagType === 1 /* COMPONENT */;
|
|
14189
14222
|
let properties = [];
|
|
14190
14223
|
const mergeArgs = [];
|
|
14191
14224
|
const runtimeDirectives = [];
|
|
14225
|
+
const hasChildren = children.length > 0;
|
|
14226
|
+
let shouldUseBlock = false;
|
|
14192
14227
|
// patchFlag analysis
|
|
14193
14228
|
let patchFlag = 0;
|
|
14194
14229
|
let hasRef = false;
|
|
@@ -14251,9 +14286,12 @@ var Vue = (function (exports) {
|
|
|
14251
14286
|
const prop = props[i];
|
|
14252
14287
|
if (prop.type === 6 /* ATTRIBUTE */) {
|
|
14253
14288
|
const { loc, name, value } = prop;
|
|
14254
|
-
let
|
|
14289
|
+
let isStatic = true;
|
|
14255
14290
|
if (name === 'ref') {
|
|
14256
14291
|
hasRef = true;
|
|
14292
|
+
if (context.scopes.vFor > 0) {
|
|
14293
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
14294
|
+
}
|
|
14257
14295
|
}
|
|
14258
14296
|
// skip is on <component>, or is="vue:xxx"
|
|
14259
14297
|
if (name === 'is' &&
|
|
@@ -14262,7 +14300,7 @@ var Vue = (function (exports) {
|
|
|
14262
14300
|
(false ))) {
|
|
14263
14301
|
continue;
|
|
14264
14302
|
}
|
|
14265
|
-
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)),
|
|
14303
|
+
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
|
|
14266
14304
|
}
|
|
14267
14305
|
else {
|
|
14268
14306
|
// directives
|
|
@@ -14283,7 +14321,7 @@ var Vue = (function (exports) {
|
|
|
14283
14321
|
// skip v-is and :is on <component>
|
|
14284
14322
|
if (name === 'is' ||
|
|
14285
14323
|
(isVBind &&
|
|
14286
|
-
|
|
14324
|
+
isStaticArgOf(arg, 'is') &&
|
|
14287
14325
|
(isComponentTag(tag) ||
|
|
14288
14326
|
(false )))) {
|
|
14289
14327
|
continue;
|
|
@@ -14292,6 +14330,17 @@ var Vue = (function (exports) {
|
|
|
14292
14330
|
if (isVOn && ssr) {
|
|
14293
14331
|
continue;
|
|
14294
14332
|
}
|
|
14333
|
+
if (
|
|
14334
|
+
// #938: elements with dynamic keys should be forced into blocks
|
|
14335
|
+
(isVBind && isStaticArgOf(arg, 'key')) ||
|
|
14336
|
+
// inline before-update hooks need to force block so that it is invoked
|
|
14337
|
+
// before children
|
|
14338
|
+
(isVOn && hasChildren && isStaticArgOf(arg, 'vue:before-update'))) {
|
|
14339
|
+
shouldUseBlock = true;
|
|
14340
|
+
}
|
|
14341
|
+
if (isVBind && isStaticArgOf(arg, 'ref') && context.scopes.vFor > 0) {
|
|
14342
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
14343
|
+
}
|
|
14295
14344
|
// special case for v-bind and v-on with no argument
|
|
14296
14345
|
if (!arg && (isVBind || isVOn)) {
|
|
14297
14346
|
hasDynamicKeys = true;
|
|
@@ -14336,6 +14385,11 @@ var Vue = (function (exports) {
|
|
|
14336
14385
|
else {
|
|
14337
14386
|
// no built-in transform, this is a user custom directive.
|
|
14338
14387
|
runtimeDirectives.push(prop);
|
|
14388
|
+
// custom dirs may use beforeUpdate so they need to force blocks
|
|
14389
|
+
// to ensure before-update gets called before children update
|
|
14390
|
+
if (hasChildren) {
|
|
14391
|
+
shouldUseBlock = true;
|
|
14392
|
+
}
|
|
14339
14393
|
}
|
|
14340
14394
|
}
|
|
14341
14395
|
}
|
|
@@ -14374,7 +14428,8 @@ var Vue = (function (exports) {
|
|
|
14374
14428
|
patchFlag |= 32 /* HYDRATE_EVENTS */;
|
|
14375
14429
|
}
|
|
14376
14430
|
}
|
|
14377
|
-
if (
|
|
14431
|
+
if (!shouldUseBlock &&
|
|
14432
|
+
(patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
|
|
14378
14433
|
(hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
|
|
14379
14434
|
patchFlag |= 512 /* NEED_PATCH */;
|
|
14380
14435
|
}
|
|
@@ -14441,7 +14496,8 @@ var Vue = (function (exports) {
|
|
|
14441
14496
|
props: propsExpression,
|
|
14442
14497
|
directives: runtimeDirectives,
|
|
14443
14498
|
patchFlag,
|
|
14444
|
-
dynamicPropNames
|
|
14499
|
+
dynamicPropNames,
|
|
14500
|
+
shouldUseBlock
|
|
14445
14501
|
};
|
|
14446
14502
|
}
|
|
14447
14503
|
// Dedupe props in an object literal.
|
|
@@ -14577,7 +14633,7 @@ var Vue = (function (exports) {
|
|
|
14577
14633
|
}
|
|
14578
14634
|
}
|
|
14579
14635
|
else {
|
|
14580
|
-
if (p.name === 'bind' &&
|
|
14636
|
+
if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
|
|
14581
14637
|
if (p.exp)
|
|
14582
14638
|
slotName = p.exp;
|
|
14583
14639
|
}
|
|
@@ -14611,7 +14667,11 @@ var Vue = (function (exports) {
|
|
|
14611
14667
|
let eventName;
|
|
14612
14668
|
if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
|
|
14613
14669
|
if (arg.isStatic) {
|
|
14614
|
-
|
|
14670
|
+
let rawName = arg.content;
|
|
14671
|
+
// TODO deprecate @vnodeXXX usage
|
|
14672
|
+
if (rawName.startsWith('vue:')) {
|
|
14673
|
+
rawName = `vnode-${rawName.slice(4)}`;
|
|
14674
|
+
}
|
|
14615
14675
|
// for all event listeners, auto convert it to camelCase. See issue #2249
|
|
14616
14676
|
eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
|
|
14617
14677
|
}
|