@vue/compat 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.
@@ -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. <select multiple> compiles to { multiple: '' }
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');
@@ -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
- return this._object[this._key];
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) ? val : new ObjectRefImpl(object, key);
1449
+ return isRef(val)
1450
+ ? val
1451
+ : new ObjectRefImpl(object, key, defaultValue);
1448
1452
  }
1449
1453
 
1450
1454
  class ComputedRefImpl {
@@ -4269,7 +4273,7 @@ function createCompatVue(createApp, createSingletonApp) {
4269
4273
  return vm;
4270
4274
  }
4271
4275
  }
4272
- Vue.version = "3.2.24";
4276
+ Vue.version = "3.2.25";
4273
4277
  Vue.config = singletonApp.config;
4274
4278
  Vue.use = (p, ...options) => {
4275
4279
  if (p && isFunction(p.install)) {
@@ -4580,7 +4584,7 @@ const methodsToPatch = [
4580
4584
  ];
4581
4585
  const patched = new WeakSet();
4582
4586
  function defineReactive(obj, key, val) {
4583
- // it's possible for the orignial object to be mutated after being defined
4587
+ // it's possible for the original object to be mutated after being defined
4584
4588
  // and expecting reactivity... we are covering it here because this seems to
4585
4589
  // be a bit more common.
4586
4590
  if (isObject(val) && !isReactive(val) && !patched.has(val)) {
@@ -4748,6 +4752,92 @@ function createAppAPI(render, hydrate) {
4748
4752
  };
4749
4753
  }
4750
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
+
4751
4841
  let hasMismatch = false;
4752
4842
  const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
4753
4843
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
@@ -5043,43 +5133,6 @@ function createHydrationFunctions(rendererInternals) {
5043
5133
  return [hydrate, hydrateNode];
5044
5134
  }
5045
5135
 
5046
- function convertLegacyRefInFor(vnode) {
5047
- // refInFor
5048
- if (vnode.props && vnode.props.refInFor) {
5049
- delete vnode.props.refInFor;
5050
- if (vnode.ref) {
5051
- if (isArray(vnode.ref)) {
5052
- vnode.ref.forEach(r => (r.f = true));
5053
- }
5054
- else {
5055
- vnode.ref.f = true;
5056
- }
5057
- }
5058
- }
5059
- }
5060
- function registerLegacyRef(refs, key, value, owner, isInFor, isUnmount) {
5061
- const existing = refs[key];
5062
- if (isUnmount) {
5063
- if (isArray(existing)) {
5064
- remove(existing, value);
5065
- }
5066
- else {
5067
- refs[key] = null;
5068
- }
5069
- }
5070
- else if (isInFor) {
5071
- if (!isArray(existing)) {
5072
- refs[key] = [value];
5073
- }
5074
- else if (!existing.includes(value)) {
5075
- existing.push(value);
5076
- }
5077
- }
5078
- else {
5079
- refs[key] = value;
5080
- }
5081
- }
5082
-
5083
5136
  const queuePostRenderEffect = queueEffectWithSuspense
5084
5137
  ;
5085
5138
  /**
@@ -5321,12 +5374,15 @@ function baseCreateRenderer(options, createHydrationFns) {
5321
5374
  const oldProps = n1.props || EMPTY_OBJ;
5322
5375
  const newProps = n2.props || EMPTY_OBJ;
5323
5376
  let vnodeHook;
5377
+ // disable recurse in beforeUpdate hooks
5378
+ parentComponent && toggleRecurse(parentComponent, false);
5324
5379
  if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
5325
5380
  invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
5326
5381
  }
5327
5382
  if (dirs) {
5328
5383
  invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
5329
5384
  }
5385
+ parentComponent && toggleRecurse(parentComponent, true);
5330
5386
  const areChildrenSVG = isSVG && n2.type !== 'foreignObject';
5331
5387
  if (dynamicChildren) {
5332
5388
  patchBlockChildren(n1.dynamicChildren, dynamicChildren, el, parentComponent, parentSuspense, areChildrenSVG, slotScopeIds);
@@ -5567,7 +5623,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5567
5623
  const { el, props } = initialVNode;
5568
5624
  const { bm, m, parent } = instance;
5569
5625
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
5570
- effect.allowRecurse = false;
5626
+ toggleRecurse(instance, false);
5571
5627
  // beforeMount hook
5572
5628
  if (bm) {
5573
5629
  invokeArrayFns(bm);
@@ -5580,7 +5636,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5580
5636
  if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
5581
5637
  instance.emit('hook:beforeMount');
5582
5638
  }
5583
- effect.allowRecurse = true;
5639
+ toggleRecurse(instance, true);
5584
5640
  if (el && hydrateNode) {
5585
5641
  // vnode has adopted host node - perform hydration instead of mount.
5586
5642
  const hydrateSubTree = () => {
@@ -5638,7 +5694,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5638
5694
  let originNext = next;
5639
5695
  let vnodeHook;
5640
5696
  // Disallow component effect recursion during pre-lifecycle hooks.
5641
- effect.allowRecurse = false;
5697
+ toggleRecurse(instance, false);
5642
5698
  if (next) {
5643
5699
  next.el = vnode.el;
5644
5700
  updateComponentPreRender(instance, next, optimized);
@@ -5657,7 +5713,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5657
5713
  if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
5658
5714
  instance.emit('hook:beforeUpdate');
5659
5715
  }
5660
- effect.allowRecurse = true;
5716
+ toggleRecurse(instance, true);
5661
5717
  const nextTree = renderComponentRoot(instance);
5662
5718
  const prevTree = instance.subTree;
5663
5719
  instance.subTree = nextTree;
@@ -5687,13 +5743,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5687
5743
  }
5688
5744
  };
5689
5745
  // create reactive effect for rendering
5690
- const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
5691
- );
5746
+ const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
5747
+ ));
5692
5748
  const update = (instance.update = effect.run.bind(effect));
5693
5749
  update.id = instance.uid;
5694
5750
  // allowRecurse
5695
5751
  // #1801, #2043 component render effects should allow recursive updates
5696
- effect.allowRecurse = update.allowRecurse = true;
5752
+ toggleRecurse(instance, true);
5697
5753
  update();
5698
5754
  };
5699
5755
  const updateComponentPreRender = (instance, nextVNode, optimized) => {
@@ -6204,81 +6260,8 @@ function baseCreateRenderer(options, createHydrationFns) {
6204
6260
  createApp: createAppAPI(render, hydrate)
6205
6261
  };
6206
6262
  }
6207
- function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6208
- if (isArray(rawRef)) {
6209
- rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
6210
- return;
6211
- }
6212
- if (isAsyncWrapper(vnode) && !isUnmount) {
6213
- // when mounting async components, nothing needs to be done,
6214
- // because the template ref is forwarded to inner component
6215
- return;
6216
- }
6217
- const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
6218
- ? getExposeProxy(vnode.component) || vnode.component.proxy
6219
- : vnode.el;
6220
- const value = isUnmount ? null : refValue;
6221
- const { i: owner, r: ref } = rawRef;
6222
- const oldRef = oldRawRef && oldRawRef.r;
6223
- const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
6224
- const setupState = owner.setupState;
6225
- // dynamic ref changed. unset old ref
6226
- if (oldRef != null && oldRef !== ref) {
6227
- if (isString(oldRef)) {
6228
- refs[oldRef] = null;
6229
- if (hasOwn(setupState, oldRef)) {
6230
- setupState[oldRef] = null;
6231
- }
6232
- }
6233
- else if (isRef(oldRef)) {
6234
- oldRef.value = null;
6235
- }
6236
- }
6237
- if (isString(ref)) {
6238
- const doSet = () => {
6239
- if (isCompatEnabled("V_FOR_REF" /* V_FOR_REF */, owner)) {
6240
- registerLegacyRef(refs, ref, refValue, owner, rawRef.f, isUnmount);
6241
- }
6242
- else {
6243
- refs[ref] = value;
6244
- }
6245
- if (hasOwn(setupState, ref)) {
6246
- setupState[ref] = value;
6247
- }
6248
- };
6249
- // #1789: for non-null values, set them after render
6250
- // null values means this is unmount and it should not overwrite another
6251
- // ref with the same key
6252
- if (value) {
6253
- doSet.id = -1;
6254
- queuePostRenderEffect(doSet, parentSuspense);
6255
- }
6256
- else {
6257
- doSet();
6258
- }
6259
- }
6260
- else if (isRef(ref)) {
6261
- const doSet = () => {
6262
- ref.value = value;
6263
- };
6264
- if (value) {
6265
- doSet.id = -1;
6266
- queuePostRenderEffect(doSet, parentSuspense);
6267
- }
6268
- else {
6269
- doSet();
6270
- }
6271
- }
6272
- else if (isFunction(ref)) {
6273
- callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
6274
- }
6275
- else ;
6276
- }
6277
- function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
6278
- callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
6279
- vnode,
6280
- prevVNode
6281
- ]);
6263
+ function toggleRecurse({ effect, update }, allowed) {
6264
+ effect.allowRecurse = update.allowRecurse = allowed;
6282
6265
  }
6283
6266
  /**
6284
6267
  * #1156
@@ -7020,10 +7003,10 @@ function transformVNodeArgs(transformer) {
7020
7003
  }
7021
7004
  const InternalObjectKey = `__vInternal`;
7022
7005
  const normalizeKey = ({ key }) => key != null ? key : null;
7023
- const normalizeRef = ({ ref }) => {
7006
+ const normalizeRef = ({ ref, ref_key, ref_for }) => {
7024
7007
  return (ref != null
7025
7008
  ? isString(ref) || isRef(ref) || isFunction(ref)
7026
- ? { i: currentRenderingInstance, r: ref }
7009
+ ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
7027
7010
  : ref
7028
7011
  : null);
7029
7012
  };
@@ -7087,7 +7070,6 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
7087
7070
  }
7088
7071
  {
7089
7072
  convertLegacyVModelProps(vnode);
7090
- convertLegacyRefInFor(vnode);
7091
7073
  defineLegacyVNodeProperties(vnode);
7092
7074
  }
7093
7075
  return vnode;
@@ -7350,6 +7332,12 @@ function mergeProps(...args) {
7350
7332
  }
7351
7333
  }
7352
7334
  return ret;
7335
+ }
7336
+ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
7337
+ callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
7338
+ vnode,
7339
+ prevVNode
7340
+ ]);
7353
7341
  }
7354
7342
 
7355
7343
  function getCompatChildren(instance) {
@@ -7888,6 +7876,7 @@ function createComponentInstance(vnode, parent, suspense) {
7888
7876
  root: null,
7889
7877
  next: null,
7890
7878
  subTree: null,
7879
+ effect: null,
7891
7880
  update: null,
7892
7881
  scope: new EffectScope(true /* detached */),
7893
7882
  render: null,
@@ -8965,7 +8954,7 @@ function isMemoSame(cached, memo) {
8965
8954
  }
8966
8955
 
8967
8956
  // Core API ------------------------------------------------------------------
8968
- const version = "3.2.24";
8957
+ const version = "3.2.25";
8969
8958
  const _ssrUtils = {
8970
8959
  createComponentInstance,
8971
8960
  setupComponent,
@@ -11173,12 +11162,12 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
11173
11162
  }
11174
11163
  else if (p.name === 'bind' &&
11175
11164
  (p.exp || allowEmpty) &&
11176
- isBindKey(p.arg, name)) {
11165
+ isStaticArgOf(p.arg, name)) {
11177
11166
  return p;
11178
11167
  }
11179
11168
  }
11180
11169
  }
11181
- function isBindKey(arg, name) {
11170
+ function isStaticArgOf(arg, name) {
11182
11171
  return !!(arg && isStaticExp(arg) && arg.content === name);
11183
11172
  }
11184
11173
  function hasDynamicKeyVBind(node) {
@@ -11839,7 +11828,7 @@ function isComponent(tag, props, context) {
11839
11828
  else if (
11840
11829
  // :is on plain element - only treat as component in compat mode
11841
11830
  p.name === 'bind' &&
11842
- isBindKey(p.arg, 'is') &&
11831
+ isStaticArgOf(p.arg, 'is') &&
11843
11832
  true &&
11844
11833
  checkCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
11845
11834
  return true;
@@ -12294,6 +12283,11 @@ function getConstantType(node, context) {
12294
12283
  if (codegenNode.type !== 13 /* VNODE_CALL */) {
12295
12284
  return 0 /* NOT_CONSTANT */;
12296
12285
  }
12286
+ if (codegenNode.isBlock &&
12287
+ node.tag !== 'svg' &&
12288
+ node.tag !== 'foreignObject') {
12289
+ return 0 /* NOT_CONSTANT */;
12290
+ }
12297
12291
  const flag = getPatchFlag(codegenNode);
12298
12292
  if (!flag) {
12299
12293
  let returnType = 3 /* CAN_STRINGIFY */;
@@ -12430,7 +12424,7 @@ function getGeneratedPropsConstantType(node, context) {
12430
12424
  else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
12431
12425
  // some helper calls can be hoisted,
12432
12426
  // such as the `normalizeProps` generated by the compiler for pre-normalize class,
12433
- // in this case we need to respect the ConstantType of the helper's argments
12427
+ // in this case we need to respect the ConstantType of the helper's arguments
12434
12428
  valueType = getConstantTypeOfHelperCall(value, context);
12435
12429
  }
12436
12430
  else {
@@ -14827,10 +14821,7 @@ const transformElement = (node, context) => {
14827
14821
  // updates inside get proper isSVG flag at runtime. (#639, #643)
14828
14822
  // This is technically web-specific, but splitting the logic out of core
14829
14823
  // leads to too much unnecessary complexity.
14830
- (tag === 'svg' ||
14831
- tag === 'foreignObject' ||
14832
- // #938: elements with dynamic keys should be forced into blocks
14833
- findProp(node, 'key', true)));
14824
+ (tag === 'svg' || tag === 'foreignObject'));
14834
14825
  // props
14835
14826
  if (props.length > 0) {
14836
14827
  const propsBuildResult = buildProps(node, context);
@@ -14842,6 +14833,9 @@ const transformElement = (node, context) => {
14842
14833
  directives && directives.length
14843
14834
  ? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
14844
14835
  : undefined;
14836
+ if (propsBuildResult.shouldUseBlock) {
14837
+ shouldUseBlock = true;
14838
+ }
14845
14839
  }
14846
14840
  // children
14847
14841
  if (node.children.length > 0) {
@@ -15012,11 +15006,13 @@ function resolveSetupReference(name, context) {
15012
15006
  }
15013
15007
  }
15014
15008
  function buildProps(node, context, props = node.props, ssr = false) {
15015
- const { tag, loc: elementLoc } = node;
15009
+ const { tag, loc: elementLoc, children } = node;
15016
15010
  const isComponent = node.tagType === 1 /* COMPONENT */;
15017
15011
  let properties = [];
15018
15012
  const mergeArgs = [];
15019
15013
  const runtimeDirectives = [];
15014
+ const hasChildren = children.length > 0;
15015
+ let shouldUseBlock = false;
15020
15016
  // patchFlag analysis
15021
15017
  let patchFlag = 0;
15022
15018
  let hasRef = false;
@@ -15079,15 +15075,20 @@ function buildProps(node, context, props = node.props, ssr = false) {
15079
15075
  const prop = props[i];
15080
15076
  if (prop.type === 6 /* ATTRIBUTE */) {
15081
15077
  const { loc, name, value } = prop;
15082
- let valueNode = createSimpleExpression(value ? value.content : '', true, value ? value.loc : loc);
15078
+ let isStatic = true;
15083
15079
  if (name === 'ref') {
15084
15080
  hasRef = true;
15081
+ if (context.scopes.vFor > 0) {
15082
+ properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
15083
+ }
15085
15084
  // in inline mode there is no setupState object, so we can't use string
15086
15085
  // keys to set the ref. Instead, we need to transform it to pass the
15087
15086
  // actual ref instead.
15088
- if (context.inline && (value === null || value === void 0 ? void 0 : value.content)) {
15089
- valueNode = createFunctionExpression(['_value', '_refs']);
15090
- valueNode.body = createBlockStatement(processInlineRef(context, value.content));
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)));
15091
15092
  }
15092
15093
  }
15093
15094
  // skip is on <component>, or is="vue:xxx"
@@ -15097,7 +15098,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
15097
15098
  (isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
15098
15099
  continue;
15099
15100
  }
15100
- properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), valueNode));
15101
+ properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
15101
15102
  }
15102
15103
  else {
15103
15104
  // directives
@@ -15118,7 +15119,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
15118
15119
  // skip v-is and :is on <component>
15119
15120
  if (name === 'is' ||
15120
15121
  (isVBind &&
15121
- isBindKey(arg, 'is') &&
15122
+ isStaticArgOf(arg, 'is') &&
15122
15123
  (isComponentTag(tag) ||
15123
15124
  (isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
15124
15125
  continue;
@@ -15127,6 +15128,17 @@ function buildProps(node, context, props = node.props, ssr = false) {
15127
15128
  if (isVOn && ssr) {
15128
15129
  continue;
15129
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
+ }
15130
15142
  // special case for v-bind and v-on with no argument
15131
15143
  if (!arg && (isVBind || isVOn)) {
15132
15144
  hasDynamicKeys = true;
@@ -15177,14 +15189,13 @@ function buildProps(node, context, props = node.props, ssr = false) {
15177
15189
  else {
15178
15190
  // no built-in transform, this is a user custom directive.
15179
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
+ }
15180
15197
  }
15181
15198
  }
15182
- if (prop.type === 6 /* ATTRIBUTE */ &&
15183
- prop.name === 'ref' &&
15184
- context.scopes.vFor > 0 &&
15185
- checkCompatEnabled$1("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
15186
- properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
15187
- }
15188
15199
  }
15189
15200
  let propsExpression = undefined;
15190
15201
  // has v-bind="object" or v-on="object", wrap with mergeProps
@@ -15221,7 +15232,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
15221
15232
  patchFlag |= 32 /* HYDRATE_EVENTS */;
15222
15233
  }
15223
15234
  }
15224
- if ((patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
15235
+ if (!shouldUseBlock &&
15236
+ (patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
15225
15237
  (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
15226
15238
  patchFlag |= 512 /* NEED_PATCH */;
15227
15239
  }
@@ -15288,7 +15300,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
15288
15300
  props: propsExpression,
15289
15301
  directives: runtimeDirectives,
15290
15302
  patchFlag,
15291
- dynamicPropNames
15303
+ dynamicPropNames,
15304
+ shouldUseBlock
15292
15305
  };
15293
15306
  }
15294
15307
  // Dedupe props in an object literal.
@@ -15383,21 +15396,6 @@ function stringifyDynamicPropNames(props) {
15383
15396
  }
15384
15397
  function isComponentTag(tag) {
15385
15398
  return tag === 'component' || tag === 'Component';
15386
- }
15387
- function processInlineRef(context, raw) {
15388
- const body = [createSimpleExpression(`_refs['${raw}'] = _value`)];
15389
- const { bindingMetadata, helperString } = context;
15390
- const type = bindingMetadata[raw];
15391
- if (type === "setup-ref" /* SETUP_REF */) {
15392
- body.push(createSimpleExpression(`${raw}.value = _value`));
15393
- }
15394
- else if (type === "setup-maybe-ref" /* SETUP_MAYBE_REF */) {
15395
- body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) && (${raw}.value = _value)`));
15396
- }
15397
- else if (type === "setup-let" /* SETUP_LET */) {
15398
- body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) ? ${raw}.value = _value : ${raw} = _value`));
15399
- }
15400
- return body;
15401
15399
  }
15402
15400
 
15403
15401
  const transformSlotOutlet = (node, context) => {
@@ -15445,7 +15443,7 @@ function processSlotOutlet(node, context) {
15445
15443
  }
15446
15444
  }
15447
15445
  else {
15448
- if (p.name === 'bind' && isBindKey(p.arg, 'name')) {
15446
+ if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
15449
15447
  if (p.exp)
15450
15448
  slotName = p.exp;
15451
15449
  }
@@ -15479,7 +15477,11 @@ const transformOn = (dir, node, context, augmentor) => {
15479
15477
  let eventName;
15480
15478
  if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
15481
15479
  if (arg.isStatic) {
15482
- const rawName = arg.content;
15480
+ let rawName = arg.content;
15481
+ // TODO deprecate @vnodeXXX usage
15482
+ if (rawName.startsWith('vue:')) {
15483
+ rawName = `vnode-${rawName.slice(4)}`;
15484
+ }
15483
15485
  // for all event listeners, auto convert it to camelCase. See issue #2249
15484
15486
  eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
15485
15487
  }