@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.prod.js
CHANGED
|
@@ -40,7 +40,7 @@ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomo
|
|
|
40
40
|
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
|
41
41
|
/**
|
|
42
42
|
* Boolean attributes should be included if the value is truthy or ''.
|
|
43
|
-
* e.g.
|
|
43
|
+
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
44
44
|
*/
|
|
45
45
|
function includeBooleanAttr(value) {
|
|
46
46
|
return !!value || value === '';
|
|
@@ -404,7 +404,7 @@ const isIntegerKey = (key) => isString(key) &&
|
|
|
404
404
|
'' + parseInt(key, 10) === key;
|
|
405
405
|
const isReservedProp = /*#__PURE__*/ makeMap(
|
|
406
406
|
// the leading comma is intentional so empty string "" is also included
|
|
407
|
-
',key,ref,' +
|
|
407
|
+
',key,ref,ref_for,ref_key,' +
|
|
408
408
|
'onVnodeBeforeMount,onVnodeMounted,' +
|
|
409
409
|
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
|
410
410
|
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
|
@@ -582,7 +582,7 @@ const targetMap = new WeakMap();
|
|
|
582
582
|
let effectTrackDepth = 0;
|
|
583
583
|
let trackOpBit = 1;
|
|
584
584
|
/**
|
|
585
|
-
* The bitwise track markers support at most 30 levels
|
|
585
|
+
* The bitwise track markers support at most 30 levels of recursion.
|
|
586
586
|
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
|
|
587
587
|
* When recursion depth is greater, fall back to using a full cleanup.
|
|
588
588
|
*/
|
|
@@ -891,7 +891,7 @@ const shallowSet = /*#__PURE__*/ createSetter(true);
|
|
|
891
891
|
function createSetter(shallow = false) {
|
|
892
892
|
return function set(target, key, value, receiver) {
|
|
893
893
|
let oldValue = target[key];
|
|
894
|
-
if (!shallow) {
|
|
894
|
+
if (!shallow && !isReadonly(value)) {
|
|
895
895
|
value = toRaw(value);
|
|
896
896
|
oldValue = toRaw(oldValue);
|
|
897
897
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
@@ -1430,21 +1430,25 @@ function toRefs(object) {
|
|
|
1430
1430
|
return ret;
|
|
1431
1431
|
}
|
|
1432
1432
|
class ObjectRefImpl {
|
|
1433
|
-
constructor(_object, _key) {
|
|
1433
|
+
constructor(_object, _key, _defaultValue) {
|
|
1434
1434
|
this._object = _object;
|
|
1435
1435
|
this._key = _key;
|
|
1436
|
+
this._defaultValue = _defaultValue;
|
|
1436
1437
|
this.__v_isRef = true;
|
|
1437
1438
|
}
|
|
1438
1439
|
get value() {
|
|
1439
|
-
|
|
1440
|
+
const val = this._object[this._key];
|
|
1441
|
+
return val === undefined ? this._defaultValue : val;
|
|
1440
1442
|
}
|
|
1441
1443
|
set value(newVal) {
|
|
1442
1444
|
this._object[this._key] = newVal;
|
|
1443
1445
|
}
|
|
1444
1446
|
}
|
|
1445
|
-
function toRef(object, key) {
|
|
1447
|
+
function toRef(object, key, defaultValue) {
|
|
1446
1448
|
const val = object[key];
|
|
1447
|
-
return isRef(val)
|
|
1449
|
+
return isRef(val)
|
|
1450
|
+
? val
|
|
1451
|
+
: new ObjectRefImpl(object, key, defaultValue);
|
|
1448
1452
|
}
|
|
1449
1453
|
|
|
1450
1454
|
class ComputedRefImpl {
|
|
@@ -1494,6 +1498,7 @@ function computed(getterOrOptions, debugOptions) {
|
|
|
1494
1498
|
let devtools;
|
|
1495
1499
|
let buffer = [];
|
|
1496
1500
|
function setDevtoolsHook(hook, target) {
|
|
1501
|
+
var _a, _b;
|
|
1497
1502
|
devtools = hook;
|
|
1498
1503
|
if (devtools) {
|
|
1499
1504
|
devtools.enabled = true;
|
|
@@ -1506,7 +1511,10 @@ function setDevtoolsHook(hook, target) {
|
|
|
1506
1511
|
// (#4815)
|
|
1507
1512
|
// eslint-disable-next-line no-restricted-globals
|
|
1508
1513
|
typeof window !== 'undefined' &&
|
|
1509
|
-
|
|
1514
|
+
// some envs mock window but not fully
|
|
1515
|
+
window.HTMLElement &&
|
|
1516
|
+
// also exclude jsdom
|
|
1517
|
+
!((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
|
|
1510
1518
|
const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
|
|
1511
1519
|
target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
|
|
1512
1520
|
replay.push((newHook) => {
|
|
@@ -3203,7 +3211,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
|
3203
3211
|
}
|
|
3204
3212
|
current = current.parent;
|
|
3205
3213
|
}
|
|
3206
|
-
hook();
|
|
3214
|
+
return hook();
|
|
3207
3215
|
});
|
|
3208
3216
|
injectHook(type, wrappedHook, target);
|
|
3209
3217
|
// In addition to registering it on the target instance, we walk up the parent
|
|
@@ -3875,7 +3883,7 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
3875
3883
|
continue;
|
|
3876
3884
|
}
|
|
3877
3885
|
}
|
|
3878
|
-
if (value !== attrs[key]) {
|
|
3886
|
+
if (!(key in attrs) || value !== attrs[key]) {
|
|
3879
3887
|
attrs[key] = value;
|
|
3880
3888
|
hasAttrsChanged = true;
|
|
3881
3889
|
}
|
|
@@ -4265,7 +4273,7 @@ function createCompatVue(createApp, createSingletonApp) {
|
|
|
4265
4273
|
return vm;
|
|
4266
4274
|
}
|
|
4267
4275
|
}
|
|
4268
|
-
Vue.version = "3.2.
|
|
4276
|
+
Vue.version = "3.2.25";
|
|
4269
4277
|
Vue.config = singletonApp.config;
|
|
4270
4278
|
Vue.use = (p, ...options) => {
|
|
4271
4279
|
if (p && isFunction(p.install)) {
|
|
@@ -4576,7 +4584,7 @@ const methodsToPatch = [
|
|
|
4576
4584
|
];
|
|
4577
4585
|
const patched = new WeakSet();
|
|
4578
4586
|
function defineReactive(obj, key, val) {
|
|
4579
|
-
// it's possible for the
|
|
4587
|
+
// it's possible for the original object to be mutated after being defined
|
|
4580
4588
|
// and expecting reactivity... we are covering it here because this seems to
|
|
4581
4589
|
// be a bit more common.
|
|
4582
4590
|
if (isObject(val) && !isReactive(val) && !patched.has(val)) {
|
|
@@ -4744,6 +4752,92 @@ function createAppAPI(render, hydrate) {
|
|
|
4744
4752
|
};
|
|
4745
4753
|
}
|
|
4746
4754
|
|
|
4755
|
+
/**
|
|
4756
|
+
* Function for handling a template ref
|
|
4757
|
+
*/
|
|
4758
|
+
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
4759
|
+
if (isArray(rawRef)) {
|
|
4760
|
+
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
4761
|
+
return;
|
|
4762
|
+
}
|
|
4763
|
+
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
4764
|
+
// when mounting async components, nothing needs to be done,
|
|
4765
|
+
// because the template ref is forwarded to inner component
|
|
4766
|
+
return;
|
|
4767
|
+
}
|
|
4768
|
+
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
4769
|
+
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
4770
|
+
: vnode.el;
|
|
4771
|
+
const value = isUnmount ? null : refValue;
|
|
4772
|
+
const { i: owner, r: ref } = rawRef;
|
|
4773
|
+
const oldRef = oldRawRef && oldRawRef.r;
|
|
4774
|
+
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
4775
|
+
const setupState = owner.setupState;
|
|
4776
|
+
// dynamic ref changed. unset old ref
|
|
4777
|
+
if (oldRef != null && oldRef !== ref) {
|
|
4778
|
+
if (isString(oldRef)) {
|
|
4779
|
+
refs[oldRef] = null;
|
|
4780
|
+
if (hasOwn(setupState, oldRef)) {
|
|
4781
|
+
setupState[oldRef] = null;
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
else if (isRef(oldRef)) {
|
|
4785
|
+
oldRef.value = null;
|
|
4786
|
+
}
|
|
4787
|
+
}
|
|
4788
|
+
if (isFunction(ref)) {
|
|
4789
|
+
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
4790
|
+
}
|
|
4791
|
+
else {
|
|
4792
|
+
const _isString = isString(ref);
|
|
4793
|
+
const _isRef = isRef(ref);
|
|
4794
|
+
if (_isString || _isRef) {
|
|
4795
|
+
const doSet = () => {
|
|
4796
|
+
if (rawRef.f) {
|
|
4797
|
+
const existing = _isString ? refs[ref] : ref.value;
|
|
4798
|
+
if (isUnmount) {
|
|
4799
|
+
isArray(existing) && remove(existing, refValue);
|
|
4800
|
+
}
|
|
4801
|
+
else {
|
|
4802
|
+
if (!isArray(existing)) {
|
|
4803
|
+
if (_isString) {
|
|
4804
|
+
refs[ref] = [refValue];
|
|
4805
|
+
}
|
|
4806
|
+
else {
|
|
4807
|
+
ref.value = [refValue];
|
|
4808
|
+
if (rawRef.k)
|
|
4809
|
+
refs[rawRef.k] = ref.value;
|
|
4810
|
+
}
|
|
4811
|
+
}
|
|
4812
|
+
else if (!existing.includes(refValue)) {
|
|
4813
|
+
existing.push(refValue);
|
|
4814
|
+
}
|
|
4815
|
+
}
|
|
4816
|
+
}
|
|
4817
|
+
else if (_isString) {
|
|
4818
|
+
refs[ref] = value;
|
|
4819
|
+
if (hasOwn(setupState, ref)) {
|
|
4820
|
+
setupState[ref] = value;
|
|
4821
|
+
}
|
|
4822
|
+
}
|
|
4823
|
+
else if (isRef(ref)) {
|
|
4824
|
+
ref.value = value;
|
|
4825
|
+
if (rawRef.k)
|
|
4826
|
+
refs[rawRef.k] = value;
|
|
4827
|
+
}
|
|
4828
|
+
else ;
|
|
4829
|
+
};
|
|
4830
|
+
if (value) {
|
|
4831
|
+
doSet.id = -1;
|
|
4832
|
+
queuePostRenderEffect(doSet, parentSuspense);
|
|
4833
|
+
}
|
|
4834
|
+
else {
|
|
4835
|
+
doSet();
|
|
4836
|
+
}
|
|
4837
|
+
}
|
|
4838
|
+
}
|
|
4839
|
+
}
|
|
4840
|
+
|
|
4747
4841
|
let hasMismatch = false;
|
|
4748
4842
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
4749
4843
|
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
@@ -5039,43 +5133,6 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
5039
5133
|
return [hydrate, hydrateNode];
|
|
5040
5134
|
}
|
|
5041
5135
|
|
|
5042
|
-
function convertLegacyRefInFor(vnode) {
|
|
5043
|
-
// refInFor
|
|
5044
|
-
if (vnode.props && vnode.props.refInFor) {
|
|
5045
|
-
delete vnode.props.refInFor;
|
|
5046
|
-
if (vnode.ref) {
|
|
5047
|
-
if (isArray(vnode.ref)) {
|
|
5048
|
-
vnode.ref.forEach(r => (r.f = true));
|
|
5049
|
-
}
|
|
5050
|
-
else {
|
|
5051
|
-
vnode.ref.f = true;
|
|
5052
|
-
}
|
|
5053
|
-
}
|
|
5054
|
-
}
|
|
5055
|
-
}
|
|
5056
|
-
function registerLegacyRef(refs, key, value, owner, isInFor, isUnmount) {
|
|
5057
|
-
const existing = refs[key];
|
|
5058
|
-
if (isUnmount) {
|
|
5059
|
-
if (isArray(existing)) {
|
|
5060
|
-
remove(existing, value);
|
|
5061
|
-
}
|
|
5062
|
-
else {
|
|
5063
|
-
refs[key] = null;
|
|
5064
|
-
}
|
|
5065
|
-
}
|
|
5066
|
-
else if (isInFor) {
|
|
5067
|
-
if (!isArray(existing)) {
|
|
5068
|
-
refs[key] = [value];
|
|
5069
|
-
}
|
|
5070
|
-
else if (!existing.includes(value)) {
|
|
5071
|
-
existing.push(value);
|
|
5072
|
-
}
|
|
5073
|
-
}
|
|
5074
|
-
else {
|
|
5075
|
-
refs[key] = value;
|
|
5076
|
-
}
|
|
5077
|
-
}
|
|
5078
|
-
|
|
5079
5136
|
const queuePostRenderEffect = queueEffectWithSuspense
|
|
5080
5137
|
;
|
|
5081
5138
|
/**
|
|
@@ -5317,12 +5374,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5317
5374
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
5318
5375
|
const newProps = n2.props || EMPTY_OBJ;
|
|
5319
5376
|
let vnodeHook;
|
|
5377
|
+
// disable recurse in beforeUpdate hooks
|
|
5378
|
+
parentComponent && toggleRecurse(parentComponent, false);
|
|
5320
5379
|
if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
|
|
5321
5380
|
invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
5322
5381
|
}
|
|
5323
5382
|
if (dirs) {
|
|
5324
5383
|
invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
|
|
5325
5384
|
}
|
|
5385
|
+
parentComponent && toggleRecurse(parentComponent, true);
|
|
5326
5386
|
const areChildrenSVG = isSVG && n2.type !== 'foreignObject';
|
|
5327
5387
|
if (dynamicChildren) {
|
|
5328
5388
|
patchBlockChildren(n1.dynamicChildren, dynamicChildren, el, parentComponent, parentSuspense, areChildrenSVG, slotScopeIds);
|
|
@@ -5563,7 +5623,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5563
5623
|
const { el, props } = initialVNode;
|
|
5564
5624
|
const { bm, m, parent } = instance;
|
|
5565
5625
|
const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
|
5566
|
-
|
|
5626
|
+
toggleRecurse(instance, false);
|
|
5567
5627
|
// beforeMount hook
|
|
5568
5628
|
if (bm) {
|
|
5569
5629
|
invokeArrayFns(bm);
|
|
@@ -5576,7 +5636,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5576
5636
|
if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
|
|
5577
5637
|
instance.emit('hook:beforeMount');
|
|
5578
5638
|
}
|
|
5579
|
-
|
|
5639
|
+
toggleRecurse(instance, true);
|
|
5580
5640
|
if (el && hydrateNode) {
|
|
5581
5641
|
// vnode has adopted host node - perform hydration instead of mount.
|
|
5582
5642
|
const hydrateSubTree = () => {
|
|
@@ -5634,7 +5694,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5634
5694
|
let originNext = next;
|
|
5635
5695
|
let vnodeHook;
|
|
5636
5696
|
// Disallow component effect recursion during pre-lifecycle hooks.
|
|
5637
|
-
|
|
5697
|
+
toggleRecurse(instance, false);
|
|
5638
5698
|
if (next) {
|
|
5639
5699
|
next.el = vnode.el;
|
|
5640
5700
|
updateComponentPreRender(instance, next, optimized);
|
|
@@ -5653,7 +5713,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5653
5713
|
if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
|
|
5654
5714
|
instance.emit('hook:beforeUpdate');
|
|
5655
5715
|
}
|
|
5656
|
-
|
|
5716
|
+
toggleRecurse(instance, true);
|
|
5657
5717
|
const nextTree = renderComponentRoot(instance);
|
|
5658
5718
|
const prevTree = instance.subTree;
|
|
5659
5719
|
instance.subTree = nextTree;
|
|
@@ -5683,13 +5743,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5683
5743
|
}
|
|
5684
5744
|
};
|
|
5685
5745
|
// create reactive effect for rendering
|
|
5686
|
-
const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
5687
|
-
);
|
|
5746
|
+
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
5747
|
+
));
|
|
5688
5748
|
const update = (instance.update = effect.run.bind(effect));
|
|
5689
5749
|
update.id = instance.uid;
|
|
5690
5750
|
// allowRecurse
|
|
5691
5751
|
// #1801, #2043 component render effects should allow recursive updates
|
|
5692
|
-
|
|
5752
|
+
toggleRecurse(instance, true);
|
|
5693
5753
|
update();
|
|
5694
5754
|
};
|
|
5695
5755
|
const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
|
@@ -6200,81 +6260,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6200
6260
|
createApp: createAppAPI(render, hydrate)
|
|
6201
6261
|
};
|
|
6202
6262
|
}
|
|
6203
|
-
function
|
|
6204
|
-
|
|
6205
|
-
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
6206
|
-
return;
|
|
6207
|
-
}
|
|
6208
|
-
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
6209
|
-
// when mounting async components, nothing needs to be done,
|
|
6210
|
-
// because the template ref is forwarded to inner component
|
|
6211
|
-
return;
|
|
6212
|
-
}
|
|
6213
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
6214
|
-
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
6215
|
-
: vnode.el;
|
|
6216
|
-
const value = isUnmount ? null : refValue;
|
|
6217
|
-
const { i: owner, r: ref } = rawRef;
|
|
6218
|
-
const oldRef = oldRawRef && oldRawRef.r;
|
|
6219
|
-
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
6220
|
-
const setupState = owner.setupState;
|
|
6221
|
-
// dynamic ref changed. unset old ref
|
|
6222
|
-
if (oldRef != null && oldRef !== ref) {
|
|
6223
|
-
if (isString(oldRef)) {
|
|
6224
|
-
refs[oldRef] = null;
|
|
6225
|
-
if (hasOwn(setupState, oldRef)) {
|
|
6226
|
-
setupState[oldRef] = null;
|
|
6227
|
-
}
|
|
6228
|
-
}
|
|
6229
|
-
else if (isRef(oldRef)) {
|
|
6230
|
-
oldRef.value = null;
|
|
6231
|
-
}
|
|
6232
|
-
}
|
|
6233
|
-
if (isString(ref)) {
|
|
6234
|
-
const doSet = () => {
|
|
6235
|
-
if (isCompatEnabled("V_FOR_REF" /* V_FOR_REF */, owner)) {
|
|
6236
|
-
registerLegacyRef(refs, ref, refValue, owner, rawRef.f, isUnmount);
|
|
6237
|
-
}
|
|
6238
|
-
else {
|
|
6239
|
-
refs[ref] = value;
|
|
6240
|
-
}
|
|
6241
|
-
if (hasOwn(setupState, ref)) {
|
|
6242
|
-
setupState[ref] = value;
|
|
6243
|
-
}
|
|
6244
|
-
};
|
|
6245
|
-
// #1789: for non-null values, set them after render
|
|
6246
|
-
// null values means this is unmount and it should not overwrite another
|
|
6247
|
-
// ref with the same key
|
|
6248
|
-
if (value) {
|
|
6249
|
-
doSet.id = -1;
|
|
6250
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
6251
|
-
}
|
|
6252
|
-
else {
|
|
6253
|
-
doSet();
|
|
6254
|
-
}
|
|
6255
|
-
}
|
|
6256
|
-
else if (isRef(ref)) {
|
|
6257
|
-
const doSet = () => {
|
|
6258
|
-
ref.value = value;
|
|
6259
|
-
};
|
|
6260
|
-
if (value) {
|
|
6261
|
-
doSet.id = -1;
|
|
6262
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
6263
|
-
}
|
|
6264
|
-
else {
|
|
6265
|
-
doSet();
|
|
6266
|
-
}
|
|
6267
|
-
}
|
|
6268
|
-
else if (isFunction(ref)) {
|
|
6269
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
6270
|
-
}
|
|
6271
|
-
else ;
|
|
6272
|
-
}
|
|
6273
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
6274
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
6275
|
-
vnode,
|
|
6276
|
-
prevVNode
|
|
6277
|
-
]);
|
|
6263
|
+
function toggleRecurse({ effect, update }, allowed) {
|
|
6264
|
+
effect.allowRecurse = update.allowRecurse = allowed;
|
|
6278
6265
|
}
|
|
6279
6266
|
/**
|
|
6280
6267
|
* #1156
|
|
@@ -6284,8 +6271,8 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
|
6284
6271
|
*
|
|
6285
6272
|
* #2080
|
|
6286
6273
|
* Inside keyed `template` fragment static children, if a fragment is moved,
|
|
6287
|
-
* the children will always moved
|
|
6288
|
-
*
|
|
6274
|
+
* the children will always be moved. Therefore, in order to ensure correct move
|
|
6275
|
+
* position, el should be inherited from previous nodes.
|
|
6289
6276
|
*/
|
|
6290
6277
|
function traverseStaticChildren(n1, n2, shallow = false) {
|
|
6291
6278
|
const ch1 = n1.children;
|
|
@@ -6882,6 +6869,7 @@ function convertLegacyFunctionalComponent(comp) {
|
|
|
6882
6869
|
};
|
|
6883
6870
|
Func.props = comp.props;
|
|
6884
6871
|
Func.displayName = comp.name;
|
|
6872
|
+
Func.compatConfig = comp.compatConfig;
|
|
6885
6873
|
// v2 functional components do not inherit attrs
|
|
6886
6874
|
Func.inheritAttrs = false;
|
|
6887
6875
|
normalizedFunctionalComponentMap.set(comp, Func);
|
|
@@ -7015,10 +7003,10 @@ function transformVNodeArgs(transformer) {
|
|
|
7015
7003
|
}
|
|
7016
7004
|
const InternalObjectKey = `__vInternal`;
|
|
7017
7005
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
7018
|
-
const normalizeRef = ({ ref }) => {
|
|
7006
|
+
const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
7019
7007
|
return (ref != null
|
|
7020
7008
|
? isString(ref) || isRef(ref) || isFunction(ref)
|
|
7021
|
-
? { i: currentRenderingInstance, r: ref }
|
|
7009
|
+
? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
|
|
7022
7010
|
: ref
|
|
7023
7011
|
: null);
|
|
7024
7012
|
};
|
|
@@ -7082,7 +7070,6 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
7082
7070
|
}
|
|
7083
7071
|
{
|
|
7084
7072
|
convertLegacyVModelProps(vnode);
|
|
7085
|
-
convertLegacyRefInFor(vnode);
|
|
7086
7073
|
defineLegacyVNodeProperties(vnode);
|
|
7087
7074
|
}
|
|
7088
7075
|
return vnode;
|
|
@@ -7332,7 +7319,8 @@ function mergeProps(...args) {
|
|
|
7332
7319
|
else if (isOn(key)) {
|
|
7333
7320
|
const existing = ret[key];
|
|
7334
7321
|
const incoming = toMerge[key];
|
|
7335
|
-
if (existing !== incoming
|
|
7322
|
+
if (existing !== incoming &&
|
|
7323
|
+
!(isArray(existing) && existing.includes(incoming))) {
|
|
7336
7324
|
ret[key] = existing
|
|
7337
7325
|
? [].concat(existing, incoming)
|
|
7338
7326
|
: incoming;
|
|
@@ -7344,6 +7332,12 @@ function mergeProps(...args) {
|
|
|
7344
7332
|
}
|
|
7345
7333
|
}
|
|
7346
7334
|
return ret;
|
|
7335
|
+
}
|
|
7336
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
7337
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
7338
|
+
vnode,
|
|
7339
|
+
prevVNode
|
|
7340
|
+
]);
|
|
7347
7341
|
}
|
|
7348
7342
|
|
|
7349
7343
|
function getCompatChildren(instance) {
|
|
@@ -7749,23 +7743,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
7749
7743
|
const n = accessCache[key];
|
|
7750
7744
|
if (n !== undefined) {
|
|
7751
7745
|
switch (n) {
|
|
7752
|
-
case
|
|
7746
|
+
case 1 /* SETUP */:
|
|
7753
7747
|
return setupState[key];
|
|
7754
|
-
case
|
|
7748
|
+
case 2 /* DATA */:
|
|
7755
7749
|
return data[key];
|
|
7756
|
-
case
|
|
7750
|
+
case 4 /* CONTEXT */:
|
|
7757
7751
|
return ctx[key];
|
|
7758
|
-
case
|
|
7752
|
+
case 3 /* PROPS */:
|
|
7759
7753
|
return props[key];
|
|
7760
7754
|
// default: just fallthrough
|
|
7761
7755
|
}
|
|
7762
7756
|
}
|
|
7763
7757
|
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
7764
|
-
accessCache[key] =
|
|
7758
|
+
accessCache[key] = 1 /* SETUP */;
|
|
7765
7759
|
return setupState[key];
|
|
7766
7760
|
}
|
|
7767
7761
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
7768
|
-
accessCache[key] =
|
|
7762
|
+
accessCache[key] = 2 /* DATA */;
|
|
7769
7763
|
return data[key];
|
|
7770
7764
|
}
|
|
7771
7765
|
else if (
|
|
@@ -7773,15 +7767,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
7773
7767
|
// props
|
|
7774
7768
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
7775
7769
|
hasOwn(normalizedProps, key)) {
|
|
7776
|
-
accessCache[key] =
|
|
7770
|
+
accessCache[key] = 3 /* PROPS */;
|
|
7777
7771
|
return props[key];
|
|
7778
7772
|
}
|
|
7779
7773
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
7780
|
-
accessCache[key] =
|
|
7774
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
7781
7775
|
return ctx[key];
|
|
7782
7776
|
}
|
|
7783
7777
|
else if (shouldCacheAccess) {
|
|
7784
|
-
accessCache[key] =
|
|
7778
|
+
accessCache[key] = 0 /* OTHER */;
|
|
7785
7779
|
}
|
|
7786
7780
|
}
|
|
7787
7781
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -7801,7 +7795,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
7801
7795
|
}
|
|
7802
7796
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
7803
7797
|
// user may set custom properties to `this` that start with `$`
|
|
7804
|
-
accessCache[key] =
|
|
7798
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
7805
7799
|
return ctx[key];
|
|
7806
7800
|
}
|
|
7807
7801
|
else if (
|
|
@@ -7844,7 +7838,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
7844
7838
|
},
|
|
7845
7839
|
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
7846
7840
|
let normalizedProps;
|
|
7847
|
-
return (accessCache[key]
|
|
7841
|
+
return (!!accessCache[key] ||
|
|
7848
7842
|
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
7849
7843
|
(setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
|
7850
7844
|
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
@@ -7882,6 +7876,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
7882
7876
|
root: null,
|
|
7883
7877
|
next: null,
|
|
7884
7878
|
subTree: null,
|
|
7879
|
+
effect: null,
|
|
7885
7880
|
update: null,
|
|
7886
7881
|
scope: new EffectScope(true /* detached */),
|
|
7887
7882
|
render: null,
|
|
@@ -8959,7 +8954,7 @@ function isMemoSame(cached, memo) {
|
|
|
8959
8954
|
}
|
|
8960
8955
|
|
|
8961
8956
|
// Core API ------------------------------------------------------------------
|
|
8962
|
-
const version = "3.2.
|
|
8957
|
+
const version = "3.2.25";
|
|
8963
8958
|
const _ssrUtils = {
|
|
8964
8959
|
createComponentInstance,
|
|
8965
8960
|
setupComponent,
|
|
@@ -9234,12 +9229,19 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
9234
9229
|
el[key] = value == null ? '' : value;
|
|
9235
9230
|
return;
|
|
9236
9231
|
}
|
|
9237
|
-
if (key === 'value' &&
|
|
9232
|
+
if (key === 'value' &&
|
|
9233
|
+
el.tagName !== 'PROGRESS' &&
|
|
9234
|
+
// custom elements may use _value internally
|
|
9235
|
+
!el.tagName.includes('-')) {
|
|
9238
9236
|
// store value as _value as well since
|
|
9239
9237
|
// non-string values will be stringified.
|
|
9240
9238
|
el._value = value;
|
|
9241
9239
|
const newValue = value == null ? '' : value;
|
|
9242
|
-
if (el.value !== newValue
|
|
9240
|
+
if (el.value !== newValue ||
|
|
9241
|
+
// #4956: always set for OPTION elements because its value falls back to
|
|
9242
|
+
// textContent if no value attribute is present. And setting .value for
|
|
9243
|
+
// OPTION has no side effect
|
|
9244
|
+
el.tagName === 'OPTION') {
|
|
9243
9245
|
el.value = newValue;
|
|
9244
9246
|
}
|
|
9245
9247
|
if (value == null) {
|
|
@@ -11160,12 +11162,12 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
|
11160
11162
|
}
|
|
11161
11163
|
else if (p.name === 'bind' &&
|
|
11162
11164
|
(p.exp || allowEmpty) &&
|
|
11163
|
-
|
|
11165
|
+
isStaticArgOf(p.arg, name)) {
|
|
11164
11166
|
return p;
|
|
11165
11167
|
}
|
|
11166
11168
|
}
|
|
11167
11169
|
}
|
|
11168
|
-
function
|
|
11170
|
+
function isStaticArgOf(arg, name) {
|
|
11169
11171
|
return !!(arg && isStaticExp(arg) && arg.content === name);
|
|
11170
11172
|
}
|
|
11171
11173
|
function hasDynamicKeyVBind(node) {
|
|
@@ -11208,7 +11210,6 @@ function getUnnormalizedProps(props, callPath = []) {
|
|
|
11208
11210
|
}
|
|
11209
11211
|
function injectProp(node, prop, context) {
|
|
11210
11212
|
let propsWithInjection;
|
|
11211
|
-
const originalProps = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
|
|
11212
11213
|
/**
|
|
11213
11214
|
* 1. mergeProps(...)
|
|
11214
11215
|
* 2. toHandlers(...)
|
|
@@ -11217,7 +11218,7 @@ function injectProp(node, prop, context) {
|
|
|
11217
11218
|
*
|
|
11218
11219
|
* we need to get the real props before normalization
|
|
11219
11220
|
*/
|
|
11220
|
-
let props =
|
|
11221
|
+
let props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
|
|
11221
11222
|
let callPath = [];
|
|
11222
11223
|
let parentCall;
|
|
11223
11224
|
if (props &&
|
|
@@ -11827,7 +11828,7 @@ function isComponent(tag, props, context) {
|
|
|
11827
11828
|
else if (
|
|
11828
11829
|
// :is on plain element - only treat as component in compat mode
|
|
11829
11830
|
p.name === 'bind' &&
|
|
11830
|
-
|
|
11831
|
+
isStaticArgOf(p.arg, 'is') &&
|
|
11831
11832
|
true &&
|
|
11832
11833
|
checkCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
|
|
11833
11834
|
return true;
|
|
@@ -12184,15 +12185,6 @@ function isSingleElementRoot(root, child) {
|
|
|
12184
12185
|
!isSlotOutlet(child));
|
|
12185
12186
|
}
|
|
12186
12187
|
function walk$1(node, context, doNotHoistNode = false) {
|
|
12187
|
-
// Some transforms, e.g. transformAssetUrls from @vue/compiler-sfc, replaces
|
|
12188
|
-
// static bindings with expressions. These expressions are guaranteed to be
|
|
12189
|
-
// constant so they are still eligible for hoisting, but they are only
|
|
12190
|
-
// available at runtime and therefore cannot be evaluated ahead of time.
|
|
12191
|
-
// This is only a concern for pre-stringification (via transformHoist by
|
|
12192
|
-
// @vue/compiler-dom), but doing it here allows us to perform only one full
|
|
12193
|
-
// walk of the AST and allow `stringifyStatic` to stop walking as soon as its
|
|
12194
|
-
// stringification threshold is met.
|
|
12195
|
-
let canStringify = true;
|
|
12196
12188
|
const { children } = node;
|
|
12197
12189
|
const originalCount = children.length;
|
|
12198
12190
|
let hoistedCount = 0;
|
|
@@ -12205,9 +12197,6 @@ function walk$1(node, context, doNotHoistNode = false) {
|
|
|
12205
12197
|
? 0 /* NOT_CONSTANT */
|
|
12206
12198
|
: getConstantType(child, context);
|
|
12207
12199
|
if (constantType > 0 /* NOT_CONSTANT */) {
|
|
12208
|
-
if (constantType < 3 /* CAN_STRINGIFY */) {
|
|
12209
|
-
canStringify = false;
|
|
12210
|
-
}
|
|
12211
12200
|
if (constantType >= 2 /* CAN_HOIST */) {
|
|
12212
12201
|
child.codegenNode.patchFlag =
|
|
12213
12202
|
-1 /* HOISTED */ + (``);
|
|
@@ -12238,17 +12227,10 @@ function walk$1(node, context, doNotHoistNode = false) {
|
|
|
12238
12227
|
}
|
|
12239
12228
|
}
|
|
12240
12229
|
}
|
|
12241
|
-
else if (child.type === 12 /* TEXT_CALL */
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
canStringify = false;
|
|
12246
|
-
}
|
|
12247
|
-
if (contentType >= 2 /* CAN_HOIST */) {
|
|
12248
|
-
child.codegenNode = context.hoist(child.codegenNode);
|
|
12249
|
-
hoistedCount++;
|
|
12250
|
-
}
|
|
12251
|
-
}
|
|
12230
|
+
else if (child.type === 12 /* TEXT_CALL */ &&
|
|
12231
|
+
getConstantType(child.content, context) >= 2 /* CAN_HOIST */) {
|
|
12232
|
+
child.codegenNode = context.hoist(child.codegenNode);
|
|
12233
|
+
hoistedCount++;
|
|
12252
12234
|
}
|
|
12253
12235
|
// walk further
|
|
12254
12236
|
if (child.type === 1 /* ELEMENT */) {
|
|
@@ -12272,7 +12254,7 @@ function walk$1(node, context, doNotHoistNode = false) {
|
|
|
12272
12254
|
}
|
|
12273
12255
|
}
|
|
12274
12256
|
}
|
|
12275
|
-
if (
|
|
12257
|
+
if (hoistedCount && context.transformHoist) {
|
|
12276
12258
|
context.transformHoist(children, context, node);
|
|
12277
12259
|
}
|
|
12278
12260
|
// all children were hoisted - the entire children array is hoistable.
|
|
@@ -12301,6 +12283,11 @@ function getConstantType(node, context) {
|
|
|
12301
12283
|
if (codegenNode.type !== 13 /* VNODE_CALL */) {
|
|
12302
12284
|
return 0 /* NOT_CONSTANT */;
|
|
12303
12285
|
}
|
|
12286
|
+
if (codegenNode.isBlock &&
|
|
12287
|
+
node.tag !== 'svg' &&
|
|
12288
|
+
node.tag !== 'foreignObject') {
|
|
12289
|
+
return 0 /* NOT_CONSTANT */;
|
|
12290
|
+
}
|
|
12304
12291
|
const flag = getPatchFlag(codegenNode);
|
|
12305
12292
|
if (!flag) {
|
|
12306
12293
|
let returnType = 3 /* CAN_STRINGIFY */;
|
|
@@ -12437,7 +12424,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
12437
12424
|
else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
|
|
12438
12425
|
// some helper calls can be hoisted,
|
|
12439
12426
|
// such as the `normalizeProps` generated by the compiler for pre-normalize class,
|
|
12440
|
-
// in this case we need to respect the ConstantType of the helper's
|
|
12427
|
+
// in this case we need to respect the ConstantType of the helper's arguments
|
|
12441
12428
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
12442
12429
|
}
|
|
12443
12430
|
else {
|
|
@@ -14834,10 +14821,7 @@ const transformElement = (node, context) => {
|
|
|
14834
14821
|
// updates inside get proper isSVG flag at runtime. (#639, #643)
|
|
14835
14822
|
// This is technically web-specific, but splitting the logic out of core
|
|
14836
14823
|
// leads to too much unnecessary complexity.
|
|
14837
|
-
(tag === 'svg' ||
|
|
14838
|
-
tag === 'foreignObject' ||
|
|
14839
|
-
// #938: elements with dynamic keys should be forced into blocks
|
|
14840
|
-
findProp(node, 'key', true)));
|
|
14824
|
+
(tag === 'svg' || tag === 'foreignObject'));
|
|
14841
14825
|
// props
|
|
14842
14826
|
if (props.length > 0) {
|
|
14843
14827
|
const propsBuildResult = buildProps(node, context);
|
|
@@ -14849,6 +14833,9 @@ const transformElement = (node, context) => {
|
|
|
14849
14833
|
directives && directives.length
|
|
14850
14834
|
? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
|
|
14851
14835
|
: undefined;
|
|
14836
|
+
if (propsBuildResult.shouldUseBlock) {
|
|
14837
|
+
shouldUseBlock = true;
|
|
14838
|
+
}
|
|
14852
14839
|
}
|
|
14853
14840
|
// children
|
|
14854
14841
|
if (node.children.length > 0) {
|
|
@@ -15019,11 +15006,13 @@ function resolveSetupReference(name, context) {
|
|
|
15019
15006
|
}
|
|
15020
15007
|
}
|
|
15021
15008
|
function buildProps(node, context, props = node.props, ssr = false) {
|
|
15022
|
-
const { tag, loc: elementLoc } = node;
|
|
15009
|
+
const { tag, loc: elementLoc, children } = node;
|
|
15023
15010
|
const isComponent = node.tagType === 1 /* COMPONENT */;
|
|
15024
15011
|
let properties = [];
|
|
15025
15012
|
const mergeArgs = [];
|
|
15026
15013
|
const runtimeDirectives = [];
|
|
15014
|
+
const hasChildren = children.length > 0;
|
|
15015
|
+
let shouldUseBlock = false;
|
|
15027
15016
|
// patchFlag analysis
|
|
15028
15017
|
let patchFlag = 0;
|
|
15029
15018
|
let hasRef = false;
|
|
@@ -15086,15 +15075,20 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
15086
15075
|
const prop = props[i];
|
|
15087
15076
|
if (prop.type === 6 /* ATTRIBUTE */) {
|
|
15088
15077
|
const { loc, name, value } = prop;
|
|
15089
|
-
let
|
|
15078
|
+
let isStatic = true;
|
|
15090
15079
|
if (name === 'ref') {
|
|
15091
15080
|
hasRef = true;
|
|
15081
|
+
if (context.scopes.vFor > 0) {
|
|
15082
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
15083
|
+
}
|
|
15092
15084
|
// in inline mode there is no setupState object, so we can't use string
|
|
15093
15085
|
// keys to set the ref. Instead, we need to transform it to pass the
|
|
15094
15086
|
// actual ref instead.
|
|
15095
|
-
if (
|
|
15096
|
-
|
|
15097
|
-
|
|
15087
|
+
if (value &&
|
|
15088
|
+
context.inline &&
|
|
15089
|
+
context.bindingMetadata[value.content]) {
|
|
15090
|
+
isStatic = false;
|
|
15091
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_key', true), createSimpleExpression(value.content, true, value.loc)));
|
|
15098
15092
|
}
|
|
15099
15093
|
}
|
|
15100
15094
|
// skip is on <component>, or is="vue:xxx"
|
|
@@ -15104,7 +15098,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
15104
15098
|
(isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
|
|
15105
15099
|
continue;
|
|
15106
15100
|
}
|
|
15107
|
-
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)),
|
|
15101
|
+
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
|
|
15108
15102
|
}
|
|
15109
15103
|
else {
|
|
15110
15104
|
// directives
|
|
@@ -15125,7 +15119,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
15125
15119
|
// skip v-is and :is on <component>
|
|
15126
15120
|
if (name === 'is' ||
|
|
15127
15121
|
(isVBind &&
|
|
15128
|
-
|
|
15122
|
+
isStaticArgOf(arg, 'is') &&
|
|
15129
15123
|
(isComponentTag(tag) ||
|
|
15130
15124
|
(isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
|
|
15131
15125
|
continue;
|
|
@@ -15134,6 +15128,17 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
15134
15128
|
if (isVOn && ssr) {
|
|
15135
15129
|
continue;
|
|
15136
15130
|
}
|
|
15131
|
+
if (
|
|
15132
|
+
// #938: elements with dynamic keys should be forced into blocks
|
|
15133
|
+
(isVBind && isStaticArgOf(arg, 'key')) ||
|
|
15134
|
+
// inline before-update hooks need to force block so that it is invoked
|
|
15135
|
+
// before children
|
|
15136
|
+
(isVOn && hasChildren && isStaticArgOf(arg, 'vue:before-update'))) {
|
|
15137
|
+
shouldUseBlock = true;
|
|
15138
|
+
}
|
|
15139
|
+
if (isVBind && isStaticArgOf(arg, 'ref') && context.scopes.vFor > 0) {
|
|
15140
|
+
properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
|
|
15141
|
+
}
|
|
15137
15142
|
// special case for v-bind and v-on with no argument
|
|
15138
15143
|
if (!arg && (isVBind || isVOn)) {
|
|
15139
15144
|
hasDynamicKeys = true;
|
|
@@ -15184,14 +15189,13 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
15184
15189
|
else {
|
|
15185
15190
|
// no built-in transform, this is a user custom directive.
|
|
15186
15191
|
runtimeDirectives.push(prop);
|
|
15192
|
+
// custom dirs may use beforeUpdate so they need to force blocks
|
|
15193
|
+
// to ensure before-update gets called before children update
|
|
15194
|
+
if (hasChildren) {
|
|
15195
|
+
shouldUseBlock = true;
|
|
15196
|
+
}
|
|
15187
15197
|
}
|
|
15188
15198
|
}
|
|
15189
|
-
if (prop.type === 6 /* ATTRIBUTE */ &&
|
|
15190
|
-
prop.name === 'ref' &&
|
|
15191
|
-
context.scopes.vFor > 0 &&
|
|
15192
|
-
checkCompatEnabled$1("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
|
|
15193
|
-
properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
|
|
15194
|
-
}
|
|
15195
15199
|
}
|
|
15196
15200
|
let propsExpression = undefined;
|
|
15197
15201
|
// has v-bind="object" or v-on="object", wrap with mergeProps
|
|
@@ -15228,7 +15232,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
15228
15232
|
patchFlag |= 32 /* HYDRATE_EVENTS */;
|
|
15229
15233
|
}
|
|
15230
15234
|
}
|
|
15231
|
-
if (
|
|
15235
|
+
if (!shouldUseBlock &&
|
|
15236
|
+
(patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
|
|
15232
15237
|
(hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
|
|
15233
15238
|
patchFlag |= 512 /* NEED_PATCH */;
|
|
15234
15239
|
}
|
|
@@ -15295,7 +15300,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
15295
15300
|
props: propsExpression,
|
|
15296
15301
|
directives: runtimeDirectives,
|
|
15297
15302
|
patchFlag,
|
|
15298
|
-
dynamicPropNames
|
|
15303
|
+
dynamicPropNames,
|
|
15304
|
+
shouldUseBlock
|
|
15299
15305
|
};
|
|
15300
15306
|
}
|
|
15301
15307
|
// Dedupe props in an object literal.
|
|
@@ -15389,22 +15395,7 @@ function stringifyDynamicPropNames(props) {
|
|
|
15389
15395
|
return propsNamesString + `]`;
|
|
15390
15396
|
}
|
|
15391
15397
|
function isComponentTag(tag) {
|
|
15392
|
-
return tag
|
|
15393
|
-
}
|
|
15394
|
-
function processInlineRef(context, raw) {
|
|
15395
|
-
const body = [createSimpleExpression(`_refs['${raw}'] = _value`)];
|
|
15396
|
-
const { bindingMetadata, helperString } = context;
|
|
15397
|
-
const type = bindingMetadata[raw];
|
|
15398
|
-
if (type === "setup-ref" /* SETUP_REF */) {
|
|
15399
|
-
body.push(createSimpleExpression(`${raw}.value = _value`));
|
|
15400
|
-
}
|
|
15401
|
-
else if (type === "setup-maybe-ref" /* SETUP_MAYBE_REF */) {
|
|
15402
|
-
body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) && (${raw}.value = _value)`));
|
|
15403
|
-
}
|
|
15404
|
-
else if (type === "setup-let" /* SETUP_LET */) {
|
|
15405
|
-
body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) ? ${raw}.value = _value : ${raw} = _value`));
|
|
15406
|
-
}
|
|
15407
|
-
return body;
|
|
15398
|
+
return tag === 'component' || tag === 'Component';
|
|
15408
15399
|
}
|
|
15409
15400
|
|
|
15410
15401
|
const transformSlotOutlet = (node, context) => {
|
|
@@ -15452,7 +15443,7 @@ function processSlotOutlet(node, context) {
|
|
|
15452
15443
|
}
|
|
15453
15444
|
}
|
|
15454
15445
|
else {
|
|
15455
|
-
if (p.name === 'bind' &&
|
|
15446
|
+
if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
|
|
15456
15447
|
if (p.exp)
|
|
15457
15448
|
slotName = p.exp;
|
|
15458
15449
|
}
|
|
@@ -15486,7 +15477,11 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
15486
15477
|
let eventName;
|
|
15487
15478
|
if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
|
|
15488
15479
|
if (arg.isStatic) {
|
|
15489
|
-
|
|
15480
|
+
let rawName = arg.content;
|
|
15481
|
+
// TODO deprecate @vnodeXXX usage
|
|
15482
|
+
if (rawName.startsWith('vue:')) {
|
|
15483
|
+
rawName = `vnode-${rawName.slice(4)}`;
|
|
15484
|
+
}
|
|
15490
15485
|
// for all event listeners, auto convert it to camelCase. See issue #2249
|
|
15491
15486
|
eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
|
|
15492
15487
|
}
|
|
@@ -18818,6 +18813,11 @@ const transformShow = (dir, node, context) => {
|
|
|
18818
18813
|
/**
|
|
18819
18814
|
* This module is Node-only.
|
|
18820
18815
|
*/
|
|
18816
|
+
/**
|
|
18817
|
+
* Regex for replacing placeholders for embedded constant variables
|
|
18818
|
+
* (e.g. import URL string constants generated by compiler-sfc)
|
|
18819
|
+
*/
|
|
18820
|
+
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
|
|
18821
18821
|
/**
|
|
18822
18822
|
* Turn eligible hoisted static trees into stringified static nodes, e.g.
|
|
18823
18823
|
*
|
|
@@ -18854,7 +18854,7 @@ const stringifyStatic = (children, context, parent) => {
|
|
|
18854
18854
|
ec >= 5 /* ELEMENT_WITH_BINDING_COUNT */) {
|
|
18855
18855
|
// combine all currently eligible nodes into a single static vnode call
|
|
18856
18856
|
const staticCall = createCallExpression(context.helper(CREATE_STATIC), [
|
|
18857
|
-
JSON.stringify(currentChunk.map(node => stringifyNode(node, context)).join('')),
|
|
18857
|
+
JSON.stringify(currentChunk.map(node => stringifyNode(node, context)).join('')).replace(expReplaceRE, `" + $1 + "`),
|
|
18858
18858
|
// the 2nd argument indicates the number of DOM nodes this static vnode
|
|
18859
18859
|
// will insert / hydrate
|
|
18860
18860
|
String(currentChunk.length)
|
|
@@ -18922,7 +18922,7 @@ const replaceHoist = (node, replacement, context) => {
|
|
|
18922
18922
|
const isNonStringifiable = /*#__PURE__*/ makeMap(`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`);
|
|
18923
18923
|
/**
|
|
18924
18924
|
* for a hoisted node, analyze it and return:
|
|
18925
|
-
* - false: bailed (contains runtime constant)
|
|
18925
|
+
* - false: bailed (contains non-stringifiable props or runtime constant)
|
|
18926
18926
|
* - [nc, ec] where
|
|
18927
18927
|
* - nc is the number of nodes inside
|
|
18928
18928
|
* - ec is the number of element with bindings inside
|
|
@@ -18960,6 +18960,11 @@ function analyzeNode(node) {
|
|
|
18960
18960
|
(p.arg.isStatic && !isStringifiableAttr(p.arg.content, node.ns)))) {
|
|
18961
18961
|
return bail();
|
|
18962
18962
|
}
|
|
18963
|
+
if (p.exp &&
|
|
18964
|
+
(p.exp.type === 8 /* COMPOUND_EXPRESSION */ ||
|
|
18965
|
+
p.exp.constType < 3 /* CAN_STRINGIFY */)) {
|
|
18966
|
+
return bail();
|
|
18967
|
+
}
|
|
18963
18968
|
}
|
|
18964
18969
|
}
|
|
18965
18970
|
for (let i = 0; i < node.children.length; i++) {
|
|
@@ -19015,8 +19020,15 @@ function stringifyElement(node, context) {
|
|
|
19015
19020
|
}
|
|
19016
19021
|
}
|
|
19017
19022
|
else if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind') {
|
|
19023
|
+
const exp = p.exp;
|
|
19024
|
+
if (exp.content[0] === '_') {
|
|
19025
|
+
// internally generated string constant references
|
|
19026
|
+
// e.g. imported URL strings via compiler-sfc transformAssetUrl plugin
|
|
19027
|
+
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
|
|
19028
|
+
continue;
|
|
19029
|
+
}
|
|
19018
19030
|
// constant v-bind, e.g. :foo="1"
|
|
19019
|
-
let evaluated = evaluateConstant(
|
|
19031
|
+
let evaluated = evaluateConstant(exp);
|
|
19020
19032
|
if (evaluated != null) {
|
|
19021
19033
|
const arg = p.arg && p.arg.content;
|
|
19022
19034
|
if (arg === 'class') {
|