@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.
@@ -110,7 +110,7 @@ var Vue = (function () {
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. <select multiple> compiles to { multiple: '' }
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 () {
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 () {
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
- return this._object[this._key];
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) ? val : new ObjectRefImpl(object, key);
1458
+ return isRef(val)
1459
+ ? val
1460
+ : new ObjectRefImpl(object, key, defaultValue);
1457
1461
  }
1458
1462
 
1459
1463
  class ComputedRefImpl {
@@ -1899,11 +1903,6 @@ var Vue = (function () {
1899
1903
  `Use "${newHook}" instead.`,
1900
1904
  link: `https://v3.vuejs.org/guide/migration/custom-directives.html`
1901
1905
  },
1902
- ["V_FOR_REF" /* V_FOR_REF */]: {
1903
- message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
1904
- `Consider using function refs or refactor to avoid ref usage altogether.`,
1905
- link: `https://v3.vuejs.org/guide/migration/array-refs.html`
1906
- },
1907
1906
  ["V_ON_KEYCODE_MODIFIER" /* V_ON_KEYCODE_MODIFIER */]: {
1908
1907
  message: `Using keyCode as v-on modifier is no longer supported. ` +
1909
1908
  `Use kebab-case key name modifiers instead.`,
@@ -5316,7 +5315,7 @@ var Vue = (function () {
5316
5315
  return vm;
5317
5316
  }
5318
5317
  }
5319
- Vue.version = "3.2.24";
5318
+ Vue.version = "3.2.25";
5320
5319
  Vue.config = singletonApp.config;
5321
5320
  Vue.use = (p, ...options) => {
5322
5321
  if (p && isFunction(p.install)) {
@@ -5667,7 +5666,7 @@ var Vue = (function () {
5667
5666
  ];
5668
5667
  const patched = new WeakSet();
5669
5668
  function defineReactive(obj, key, val) {
5670
- // it's possible for the orignial object to be mutated after being defined
5669
+ // it's possible for the original object to be mutated after being defined
5671
5670
  // and expecting reactivity... we are covering it here because this seems to
5672
5671
  // be a bit more common.
5673
5672
  if (isObject(val) && !isReactive(val) && !patched.has(val)) {
@@ -5887,6 +5886,102 @@ var Vue = (function () {
5887
5886
  };
5888
5887
  }
5889
5888
 
5889
+ /**
5890
+ * Function for handling a template ref
5891
+ */
5892
+ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
5893
+ if (isArray(rawRef)) {
5894
+ rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
5895
+ return;
5896
+ }
5897
+ if (isAsyncWrapper(vnode) && !isUnmount) {
5898
+ // when mounting async components, nothing needs to be done,
5899
+ // because the template ref is forwarded to inner component
5900
+ return;
5901
+ }
5902
+ const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
5903
+ ? getExposeProxy(vnode.component) || vnode.component.proxy
5904
+ : vnode.el;
5905
+ const value = isUnmount ? null : refValue;
5906
+ const { i: owner, r: ref } = rawRef;
5907
+ if (!owner) {
5908
+ warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
5909
+ `A vnode with ref must be created inside the render function.`);
5910
+ return;
5911
+ }
5912
+ const oldRef = oldRawRef && oldRawRef.r;
5913
+ const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
5914
+ const setupState = owner.setupState;
5915
+ // dynamic ref changed. unset old ref
5916
+ if (oldRef != null && oldRef !== ref) {
5917
+ if (isString(oldRef)) {
5918
+ refs[oldRef] = null;
5919
+ if (hasOwn(setupState, oldRef)) {
5920
+ setupState[oldRef] = null;
5921
+ }
5922
+ }
5923
+ else if (isRef(oldRef)) {
5924
+ oldRef.value = null;
5925
+ }
5926
+ }
5927
+ if (isFunction(ref)) {
5928
+ callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
5929
+ }
5930
+ else {
5931
+ const _isString = isString(ref);
5932
+ const _isRef = isRef(ref);
5933
+ if (_isString || _isRef) {
5934
+ const doSet = () => {
5935
+ if (rawRef.f) {
5936
+ const existing = _isString ? refs[ref] : ref.value;
5937
+ if (isUnmount) {
5938
+ isArray(existing) && remove(existing, refValue);
5939
+ }
5940
+ else {
5941
+ if (!isArray(existing)) {
5942
+ if (_isString) {
5943
+ refs[ref] = [refValue];
5944
+ }
5945
+ else {
5946
+ ref.value = [refValue];
5947
+ if (rawRef.k)
5948
+ refs[rawRef.k] = ref.value;
5949
+ }
5950
+ }
5951
+ else if (!existing.includes(refValue)) {
5952
+ existing.push(refValue);
5953
+ }
5954
+ }
5955
+ }
5956
+ else if (_isString) {
5957
+ refs[ref] = value;
5958
+ if (hasOwn(setupState, ref)) {
5959
+ setupState[ref] = value;
5960
+ }
5961
+ }
5962
+ else if (isRef(ref)) {
5963
+ ref.value = value;
5964
+ if (rawRef.k)
5965
+ refs[rawRef.k] = value;
5966
+ }
5967
+ else {
5968
+ warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
5969
+ }
5970
+ };
5971
+ if (value) {
5972
+ doSet.id = -1;
5973
+ queuePostRenderEffect(doSet, parentSuspense);
5974
+ }
5975
+ else {
5976
+ doSet();
5977
+ }
5978
+ }
5979
+ else {
5980
+ warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
5981
+ }
5982
+ }
5983
+ }
5984
+
5890
5985
  let hasMismatch = false;
5891
5986
  const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
5892
5987
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
@@ -6248,44 +6343,6 @@ var Vue = (function () {
6248
6343
  return supported;
6249
6344
  }
6250
6345
 
6251
- function convertLegacyRefInFor(vnode) {
6252
- // refInFor
6253
- if (vnode.props && vnode.props.refInFor) {
6254
- delete vnode.props.refInFor;
6255
- if (vnode.ref) {
6256
- if (isArray(vnode.ref)) {
6257
- vnode.ref.forEach(r => (r.f = true));
6258
- }
6259
- else {
6260
- vnode.ref.f = true;
6261
- }
6262
- }
6263
- }
6264
- }
6265
- function registerLegacyRef(refs, key, value, owner, isInFor, isUnmount) {
6266
- const existing = refs[key];
6267
- if (isUnmount) {
6268
- if (isArray(existing)) {
6269
- remove(existing, value);
6270
- }
6271
- else {
6272
- refs[key] = null;
6273
- }
6274
- }
6275
- else if (isInFor) {
6276
- warnDeprecation("V_FOR_REF" /* V_FOR_REF */, owner);
6277
- if (!isArray(existing)) {
6278
- refs[key] = [value];
6279
- }
6280
- else if (!existing.includes(value)) {
6281
- existing.push(value);
6282
- }
6283
- }
6284
- else {
6285
- refs[key] = value;
6286
- }
6287
- }
6288
-
6289
6346
  const queuePostRenderEffect = queueEffectWithSuspense
6290
6347
  ;
6291
6348
  /**
@@ -6557,12 +6614,15 @@ var Vue = (function () {
6557
6614
  const oldProps = n1.props || EMPTY_OBJ;
6558
6615
  const newProps = n2.props || EMPTY_OBJ;
6559
6616
  let vnodeHook;
6617
+ // disable recurse in beforeUpdate hooks
6618
+ parentComponent && toggleRecurse(parentComponent, false);
6560
6619
  if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
6561
6620
  invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
6562
6621
  }
6563
6622
  if (dirs) {
6564
6623
  invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
6565
6624
  }
6625
+ parentComponent && toggleRecurse(parentComponent, true);
6566
6626
  if (isHmrUpdating) {
6567
6627
  // HMR updated, force full diff
6568
6628
  patchFlag = 0;
@@ -6846,7 +6906,7 @@ var Vue = (function () {
6846
6906
  const { el, props } = initialVNode;
6847
6907
  const { bm, m, parent } = instance;
6848
6908
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
6849
- effect.allowRecurse = false;
6909
+ toggleRecurse(instance, false);
6850
6910
  // beforeMount hook
6851
6911
  if (bm) {
6852
6912
  invokeArrayFns(bm);
@@ -6859,7 +6919,7 @@ var Vue = (function () {
6859
6919
  if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
6860
6920
  instance.emit('hook:beforeMount');
6861
6921
  }
6862
- effect.allowRecurse = true;
6922
+ toggleRecurse(instance, true);
6863
6923
  if (el && hydrateNode) {
6864
6924
  // vnode has adopted host node - perform hydration instead of mount.
6865
6925
  const hydrateSubTree = () => {
@@ -6947,7 +7007,7 @@ var Vue = (function () {
6947
7007
  pushWarningContext(next || instance.vnode);
6948
7008
  }
6949
7009
  // Disallow component effect recursion during pre-lifecycle hooks.
6950
- effect.allowRecurse = false;
7010
+ toggleRecurse(instance, false);
6951
7011
  if (next) {
6952
7012
  next.el = vnode.el;
6953
7013
  updateComponentPreRender(instance, next, optimized);
@@ -6966,7 +7026,7 @@ var Vue = (function () {
6966
7026
  if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
6967
7027
  instance.emit('hook:beforeUpdate');
6968
7028
  }
6969
- effect.allowRecurse = true;
7029
+ toggleRecurse(instance, true);
6970
7030
  // render
6971
7031
  {
6972
7032
  startMeasure(instance, `render`);
@@ -7015,13 +7075,13 @@ var Vue = (function () {
7015
7075
  }
7016
7076
  };
7017
7077
  // create reactive effect for rendering
7018
- const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
7019
- );
7078
+ const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
7079
+ ));
7020
7080
  const update = (instance.update = effect.run.bind(effect));
7021
7081
  update.id = instance.uid;
7022
7082
  // allowRecurse
7023
7083
  // #1801, #2043 component render effects should allow recursive updates
7024
- effect.allowRecurse = update.allowRecurse = true;
7084
+ toggleRecurse(instance, true);
7025
7085
  {
7026
7086
  effect.onTrack = instance.rtc
7027
7087
  ? e => invokeArrayFns(instance.rtc, e)
@@ -7551,88 +7611,8 @@ var Vue = (function () {
7551
7611
  createApp: createAppAPI(render, hydrate)
7552
7612
  };
7553
7613
  }
7554
- function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7555
- if (isArray(rawRef)) {
7556
- rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
7557
- return;
7558
- }
7559
- if (isAsyncWrapper(vnode) && !isUnmount) {
7560
- // when mounting async components, nothing needs to be done,
7561
- // because the template ref is forwarded to inner component
7562
- return;
7563
- }
7564
- const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
7565
- ? getExposeProxy(vnode.component) || vnode.component.proxy
7566
- : vnode.el;
7567
- const value = isUnmount ? null : refValue;
7568
- const { i: owner, r: ref } = rawRef;
7569
- if (!owner) {
7570
- warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
7571
- `A vnode with ref must be created inside the render function.`);
7572
- return;
7573
- }
7574
- const oldRef = oldRawRef && oldRawRef.r;
7575
- const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
7576
- const setupState = owner.setupState;
7577
- // dynamic ref changed. unset old ref
7578
- if (oldRef != null && oldRef !== ref) {
7579
- if (isString(oldRef)) {
7580
- refs[oldRef] = null;
7581
- if (hasOwn(setupState, oldRef)) {
7582
- setupState[oldRef] = null;
7583
- }
7584
- }
7585
- else if (isRef(oldRef)) {
7586
- oldRef.value = null;
7587
- }
7588
- }
7589
- if (isString(ref)) {
7590
- const doSet = () => {
7591
- if (isCompatEnabled("V_FOR_REF" /* V_FOR_REF */, owner)) {
7592
- registerLegacyRef(refs, ref, refValue, owner, rawRef.f, isUnmount);
7593
- }
7594
- else {
7595
- refs[ref] = value;
7596
- }
7597
- if (hasOwn(setupState, ref)) {
7598
- setupState[ref] = value;
7599
- }
7600
- };
7601
- // #1789: for non-null values, set them after render
7602
- // null values means this is unmount and it should not overwrite another
7603
- // ref with the same key
7604
- if (value) {
7605
- doSet.id = -1;
7606
- queuePostRenderEffect(doSet, parentSuspense);
7607
- }
7608
- else {
7609
- doSet();
7610
- }
7611
- }
7612
- else if (isRef(ref)) {
7613
- const doSet = () => {
7614
- ref.value = value;
7615
- };
7616
- if (value) {
7617
- doSet.id = -1;
7618
- queuePostRenderEffect(doSet, parentSuspense);
7619
- }
7620
- else {
7621
- doSet();
7622
- }
7623
- }
7624
- else if (isFunction(ref)) {
7625
- callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
7626
- }
7627
- else {
7628
- warn$1('Invalid template ref type:', value, `(${typeof value})`);
7629
- }
7630
- }
7631
- function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
7632
- callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
7633
- vnode,
7634
- prevVNode
7635
- ]);
7614
+ function toggleRecurse({ effect, update }, allowed) {
7615
+ effect.allowRecurse = update.allowRecurse = allowed;
7636
7616
  }
7637
7617
  /**
7638
7618
  * #1156
@@ -8427,10 +8407,10 @@ var Vue = (function () {
8427
8407
  };
8428
8408
  const InternalObjectKey = `__vInternal`;
8429
8409
  const normalizeKey = ({ key }) => key != null ? key : null;
8430
- const normalizeRef = ({ ref }) => {
8410
+ const normalizeRef = ({ ref, ref_key, ref_for }) => {
8431
8411
  return (ref != null
8432
8412
  ? isString(ref) || isRef(ref) || isFunction(ref)
8433
- ? { i: currentRenderingInstance, r: ref }
8413
+ ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
8434
8414
  : ref
8435
8415
  : null);
8436
8416
  };
@@ -8498,7 +8478,6 @@ var Vue = (function () {
8498
8478
  }
8499
8479
  {
8500
8480
  convertLegacyVModelProps(vnode);
8501
- convertLegacyRefInFor(vnode);
8502
8481
  defineLegacyVNodeProperties(vnode);
8503
8482
  }
8504
8483
  return vnode;
@@ -8784,6 +8763,12 @@ var Vue = (function () {
8784
8763
  }
8785
8764
  }
8786
8765
  return ret;
8766
+ }
8767
+ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
8768
+ callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
8769
+ vnode,
8770
+ prevVNode
8771
+ ]);
8787
8772
  }
8788
8773
 
8789
8774
  function getCompatChildren(instance) {
@@ -9443,6 +9428,7 @@ var Vue = (function () {
9443
9428
  root: null,
9444
9429
  next: null,
9445
9430
  subTree: null,
9431
+ effect: null,
9446
9432
  update: null,
9447
9433
  scope: new EffectScope(true /* detached */),
9448
9434
  render: null,
@@ -10907,7 +10893,7 @@ var Vue = (function () {
10907
10893
  }
10908
10894
 
10909
10895
  // Core API ------------------------------------------------------------------
10910
- const version = "3.2.24";
10896
+ const version = "3.2.25";
10911
10897
  /**
10912
10898
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10913
10899
  * @internal
@@ -13306,12 +13292,12 @@ var Vue = (function () {
13306
13292
  }
13307
13293
  else if (p.name === 'bind' &&
13308
13294
  (p.exp || allowEmpty) &&
13309
- isBindKey(p.arg, name)) {
13295
+ isStaticArgOf(p.arg, name)) {
13310
13296
  return p;
13311
13297
  }
13312
13298
  }
13313
13299
  }
13314
- function isBindKey(arg, name) {
13300
+ function isStaticArgOf(arg, name) {
13315
13301
  return !!(arg && isStaticExp(arg) && arg.content === name);
13316
13302
  }
13317
13303
  function hasDynamicKeyVBind(node) {
@@ -13501,11 +13487,6 @@ var Vue = (function () {
13501
13487
  `data source.`,
13502
13488
  link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
13503
13489
  },
13504
- ["COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */]: {
13505
- message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
13506
- `Consider using function refs or refactor to avoid ref usage altogether.`,
13507
- link: `https://v3.vuejs.org/guide/migration/array-refs.html`
13508
- },
13509
13490
  ["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
13510
13491
  message: `<template> with no special directives will render as a native template ` +
13511
13492
  `element instead of its inner content in Vue 3.`
@@ -14023,7 +14004,7 @@ var Vue = (function () {
14023
14004
  else if (
14024
14005
  // :is on plain element - only treat as component in compat mode
14025
14006
  p.name === 'bind' &&
14026
- isBindKey(p.arg, 'is') &&
14007
+ isStaticArgOf(p.arg, 'is') &&
14027
14008
  true &&
14028
14009
  checkCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
14029
14010
  return true;
@@ -14481,6 +14462,11 @@ var Vue = (function () {
14481
14462
  if (codegenNode.type !== 13 /* VNODE_CALL */) {
14482
14463
  return 0 /* NOT_CONSTANT */;
14483
14464
  }
14465
+ if (codegenNode.isBlock &&
14466
+ node.tag !== 'svg' &&
14467
+ node.tag !== 'foreignObject') {
14468
+ return 0 /* NOT_CONSTANT */;
14469
+ }
14484
14470
  const flag = getPatchFlag(codegenNode);
14485
14471
  if (!flag) {
14486
14472
  let returnType = 3 /* CAN_STRINGIFY */;
@@ -14617,7 +14603,7 @@ var Vue = (function () {
14617
14603
  else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
14618
14604
  // some helper calls can be hoisted,
14619
14605
  // such as the `normalizeProps` generated by the compiler for pre-normalize class,
14620
- // in this case we need to respect the ConstantType of the helper's argments
14606
+ // in this case we need to respect the ConstantType of the helper's arguments
14621
14607
  valueType = getConstantTypeOfHelperCall(value, context);
14622
14608
  }
14623
14609
  else {
@@ -16284,10 +16270,7 @@ var Vue = (function () {
16284
16270
  // updates inside get proper isSVG flag at runtime. (#639, #643)
16285
16271
  // This is technically web-specific, but splitting the logic out of core
16286
16272
  // leads to too much unnecessary complexity.
16287
- (tag === 'svg' ||
16288
- tag === 'foreignObject' ||
16289
- // #938: elements with dynamic keys should be forced into blocks
16290
- findProp(node, 'key', true)));
16273
+ (tag === 'svg' || tag === 'foreignObject'));
16291
16274
  // props
16292
16275
  if (props.length > 0) {
16293
16276
  const propsBuildResult = buildProps(node, context);
@@ -16299,6 +16282,9 @@ var Vue = (function () {
16299
16282
  directives && directives.length
16300
16283
  ? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
16301
16284
  : undefined;
16285
+ if (propsBuildResult.shouldUseBlock) {
16286
+ shouldUseBlock = true;
16287
+ }
16302
16288
  }
16303
16289
  // children
16304
16290
  if (node.children.length > 0) {
@@ -16427,11 +16413,13 @@ var Vue = (function () {
16427
16413
  return toValidAssetId(tag, `component`);
16428
16414
  }
16429
16415
  function buildProps(node, context, props = node.props, ssr = false) {
16430
- const { tag, loc: elementLoc } = node;
16416
+ const { tag, loc: elementLoc, children } = node;
16431
16417
  const isComponent = node.tagType === 1 /* COMPONENT */;
16432
16418
  let properties = [];
16433
16419
  const mergeArgs = [];
16434
16420
  const runtimeDirectives = [];
16421
+ const hasChildren = children.length > 0;
16422
+ let shouldUseBlock = false;
16435
16423
  // patchFlag analysis
16436
16424
  let patchFlag = 0;
16437
16425
  let hasRef = false;
@@ -16494,9 +16482,12 @@ var Vue = (function () {
16494
16482
  const prop = props[i];
16495
16483
  if (prop.type === 6 /* ATTRIBUTE */) {
16496
16484
  const { loc, name, value } = prop;
16497
- let valueNode = createSimpleExpression(value ? value.content : '', true, value ? value.loc : loc);
16485
+ let isStatic = true;
16498
16486
  if (name === 'ref') {
16499
16487
  hasRef = true;
16488
+ if (context.scopes.vFor > 0) {
16489
+ properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
16490
+ }
16500
16491
  }
16501
16492
  // skip is on <component>, or is="vue:xxx"
16502
16493
  if (name === 'is' &&
@@ -16505,7 +16496,7 @@ var Vue = (function () {
16505
16496
  (isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
16506
16497
  continue;
16507
16498
  }
16508
- properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), valueNode));
16499
+ properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
16509
16500
  }
16510
16501
  else {
16511
16502
  // directives
@@ -16526,7 +16517,7 @@ var Vue = (function () {
16526
16517
  // skip v-is and :is on <component>
16527
16518
  if (name === 'is' ||
16528
16519
  (isVBind &&
16529
- isBindKey(arg, 'is') &&
16520
+ isStaticArgOf(arg, 'is') &&
16530
16521
  (isComponentTag(tag) ||
16531
16522
  (isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
16532
16523
  continue;
@@ -16535,6 +16526,17 @@ var Vue = (function () {
16535
16526
  if (isVOn && ssr) {
16536
16527
  continue;
16537
16528
  }
16529
+ if (
16530
+ // #938: elements with dynamic keys should be forced into blocks
16531
+ (isVBind && isStaticArgOf(arg, 'key')) ||
16532
+ // inline before-update hooks need to force block so that it is invoked
16533
+ // before children
16534
+ (isVOn && hasChildren && isStaticArgOf(arg, 'vue:before-update'))) {
16535
+ shouldUseBlock = true;
16536
+ }
16537
+ if (isVBind && isStaticArgOf(arg, 'ref') && context.scopes.vFor > 0) {
16538
+ properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
16539
+ }
16538
16540
  // special case for v-bind and v-on with no argument
16539
16541
  if (!arg && (isVBind || isVOn)) {
16540
16542
  hasDynamicKeys = true;
@@ -16608,14 +16610,13 @@ var Vue = (function () {
16608
16610
  else {
16609
16611
  // no built-in transform, this is a user custom directive.
16610
16612
  runtimeDirectives.push(prop);
16613
+ // custom dirs may use beforeUpdate so they need to force blocks
16614
+ // to ensure before-update gets called before children update
16615
+ if (hasChildren) {
16616
+ shouldUseBlock = true;
16617
+ }
16611
16618
  }
16612
16619
  }
16613
- if (prop.type === 6 /* ATTRIBUTE */ &&
16614
- prop.name === 'ref' &&
16615
- context.scopes.vFor > 0 &&
16616
- checkCompatEnabled$1("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
16617
- properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
16618
- }
16619
16620
  }
16620
16621
  let propsExpression = undefined;
16621
16622
  // has v-bind="object" or v-on="object", wrap with mergeProps
@@ -16652,7 +16653,8 @@ var Vue = (function () {
16652
16653
  patchFlag |= 32 /* HYDRATE_EVENTS */;
16653
16654
  }
16654
16655
  }
16655
- if ((patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
16656
+ if (!shouldUseBlock &&
16657
+ (patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
16656
16658
  (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
16657
16659
  patchFlag |= 512 /* NEED_PATCH */;
16658
16660
  }
@@ -16719,7 +16721,8 @@ var Vue = (function () {
16719
16721
  props: propsExpression,
16720
16722
  directives: runtimeDirectives,
16721
16723
  patchFlag,
16722
- dynamicPropNames
16724
+ dynamicPropNames,
16725
+ shouldUseBlock
16723
16726
  };
16724
16727
  }
16725
16728
  // Dedupe props in an object literal.
@@ -16855,7 +16858,7 @@ var Vue = (function () {
16855
16858
  }
16856
16859
  }
16857
16860
  else {
16858
- if (p.name === 'bind' && isBindKey(p.arg, 'name')) {
16861
+ if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
16859
16862
  if (p.exp)
16860
16863
  slotName = p.exp;
16861
16864
  }
@@ -16889,7 +16892,11 @@ var Vue = (function () {
16889
16892
  let eventName;
16890
16893
  if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
16891
16894
  if (arg.isStatic) {
16892
- const rawName = arg.content;
16895
+ let rawName = arg.content;
16896
+ // TODO deprecate @vnodeXXX usage
16897
+ if (rawName.startsWith('vue:')) {
16898
+ rawName = `vnode-${rawName.slice(4)}`;
16899
+ }
16893
16900
  // for all event listeners, auto convert it to camelCase. See issue #2249
16894
16901
  eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
16895
16902
  }