vue 3.5.39 → 3.5.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.39
2
+ * vue v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.39
2
+ * vue v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.39
2
+ * vue v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -267,7 +267,7 @@ const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
267
267
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
268
268
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
269
269
  const isBooleanAttr = /* @__PURE__ */ makeMap(
270
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
270
+ specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
271
271
  );
272
272
  function includeBooleanAttr(value) {
273
273
  return !!value || value === "";
@@ -449,8 +449,9 @@ class EffectScope {
449
449
  this._isPaused = true;
450
450
  let i, l;
451
451
  if (this.scopes) {
452
- for (i = 0, l = this.scopes.length; i < l; i++) {
453
- this.scopes[i].pause();
452
+ const scopes = this.scopes.slice();
453
+ for (i = 0, l = scopes.length; i < l; i++) {
454
+ scopes[i].pause();
454
455
  }
455
456
  }
456
457
  for (i = 0, l = this.effects.length; i < l; i++) {
@@ -467,12 +468,14 @@ class EffectScope {
467
468
  this._isPaused = false;
468
469
  let i, l;
469
470
  if (this.scopes) {
470
- for (i = 0, l = this.scopes.length; i < l; i++) {
471
- this.scopes[i].resume();
471
+ const scopes = this.scopes.slice();
472
+ for (i = 0, l = scopes.length; i < l; i++) {
473
+ scopes[i].resume();
472
474
  }
473
475
  }
474
- for (i = 0, l = this.effects.length; i < l; i++) {
475
- this.effects[i].resume();
476
+ const effects = this.effects.slice();
477
+ for (i = 0, l = effects.length; i < l; i++) {
478
+ effects[i].resume();
476
479
  }
477
480
  }
478
481
  }
@@ -534,8 +537,9 @@ class EffectScope {
534
537
  }
535
538
  this.cleanups.length = 0;
536
539
  if (this.scopes) {
537
- for (i = 0, l = this.scopes.length; i < l; i++) {
538
- this.scopes[i].stop(true);
540
+ const scopes = this.scopes.slice();
541
+ for (i = 0, l = scopes.length; i < l; i++) {
542
+ scopes[i].stop(true);
539
543
  }
540
544
  this.scopes.length = 0;
541
545
  }
@@ -2666,7 +2670,9 @@ function queuePostFlushCb(cb) {
2666
2670
  cb.flags |= 1;
2667
2671
  }
2668
2672
  } else {
2669
- pendingPostFlushCbs.push(...cb);
2673
+ for (let i = 0; i < cb.length; i++) {
2674
+ pendingPostFlushCbs.push(cb[i]);
2675
+ }
2670
2676
  }
2671
2677
  queueFlush();
2672
2678
  }
@@ -2702,7 +2708,9 @@ function flushPostFlushCbs(seen) {
2702
2708
  );
2703
2709
  pendingPostFlushCbs.length = 0;
2704
2710
  if (activePostFlushCbs) {
2705
- activePostFlushCbs.push(...deduped);
2711
+ for (let i = 0; i < deduped.length; i++) {
2712
+ activePostFlushCbs.push(deduped[i]);
2713
+ }
2706
2714
  return;
2707
2715
  }
2708
2716
  activePostFlushCbs = deduped;
@@ -3032,10 +3040,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
3032
3040
  setBlockTracking(-1);
3033
3041
  }
3034
3042
  const prevInstance = setCurrentRenderingInstance(ctx);
3043
+ const prevStackSize = blockStack.length;
3035
3044
  let res;
3036
3045
  try {
3037
3046
  res = fn(...args);
3038
3047
  } finally {
3048
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
3039
3049
  setCurrentRenderingInstance(prevInstance);
3040
3050
  if (renderFnWithContext._d) {
3041
3051
  setBlockTracking(1);
@@ -3989,7 +3999,11 @@ function getInnerChild$1(vnode) {
3989
3999
  function setTransitionHooks(vnode, hooks) {
3990
4000
  if (vnode.shapeFlag & 6 && vnode.component) {
3991
4001
  vnode.transition = hooks;
3992
- setTransitionHooks(vnode.component.subTree, hooks);
4002
+ const subTree = vnode.component.subTree;
4003
+ setTransitionHooks(
4004
+ isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
4005
+ hooks
4006
+ );
3993
4007
  } else if (vnode.shapeFlag & 128) {
3994
4008
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3995
4009
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -4149,12 +4163,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4149
4163
  }
4150
4164
  }
4151
4165
  if (isFunction(ref)) {
4152
- pauseTracking();
4153
- try {
4154
- callWithErrorHandling(ref, owner, 12, [value, refs]);
4155
- } finally {
4156
- resetTracking();
4157
- }
4166
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
4158
4167
  } else {
4159
4168
  const _isString = isString(ref);
4160
4169
  const _isRef = isRef(ref);
@@ -4525,6 +4534,7 @@ Server rendered element contains more child nodes than client vdom.`
4525
4534
  if (props) {
4526
4535
  {
4527
4536
  const isCustomElement = el.tagName.includes("-");
4537
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4528
4538
  for (const key in props) {
4529
4539
  if (// #11189 skip if this node has directives that have created hooks
4530
4540
  // as it could have mutated the DOM in any possible way
@@ -4533,7 +4543,10 @@ Server rendered element contains more child nodes than client vdom.`
4533
4543
  }
4534
4544
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4535
4545
  key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4536
- patchProp(el, key, null, props[key], void 0, parentComponent);
4546
+ if (isUnchangedResourceProp(el, key, props[key])) {
4547
+ continue;
4548
+ }
4549
+ patchProp(el, key, null, props[key], namespace, parentComponent);
4537
4550
  }
4538
4551
  }
4539
4552
  }
@@ -4715,6 +4728,13 @@ Server rendered element contains fewer child nodes than client vdom.`
4715
4728
  };
4716
4729
  return [hydrate, hydrateNode];
4717
4730
  }
4731
+ const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
4732
+ function isUnchangedResourceProp(el, key, clientValue) {
4733
+ if (!resourceProps.has(key)) {
4734
+ return false;
4735
+ }
4736
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
4737
+ }
4718
4738
  function propHasMismatch(el, key, clientValue, vnode, instance) {
4719
4739
  let mismatchType;
4720
4740
  let mismatchKey;
@@ -4752,7 +4772,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4752
4772
  mismatchKey = "style";
4753
4773
  }
4754
4774
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
4755
- if (isBooleanAttr(key)) {
4775
+ if (key === "hidden") {
4776
+ actual = normalizeHiddenValue(el.getAttribute(key));
4777
+ expected = normalizeHiddenValue(clientValue);
4778
+ } else if (isBooleanAttr(key)) {
4756
4779
  actual = el.hasAttribute(key);
4757
4780
  expected = includeBooleanAttr(clientValue);
4758
4781
  } else if (clientValue == null) {
@@ -4788,6 +4811,15 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4788
4811
  }
4789
4812
  return false;
4790
4813
  }
4814
+ function normalizeHiddenValue(value) {
4815
+ if (!isRenderableAttrValue(value)) {
4816
+ return false;
4817
+ }
4818
+ if (isString(value)) {
4819
+ return value.toLowerCase() === "until-found" ? "until-found" : "";
4820
+ }
4821
+ return includeBooleanAttr(value) ? "" : false;
4822
+ }
4791
4823
  function toClassSet(str) {
4792
4824
  return new Set(str.trim().split(/\s+/));
4793
4825
  }
@@ -5036,6 +5068,7 @@ function defineAsyncComponent(source) {
5036
5068
  name: "AsyncComponentWrapper",
5037
5069
  __asyncLoader: load,
5038
5070
  __asyncHydrate(el, instance, hydrate) {
5071
+ const wasConnected = el.isConnected;
5039
5072
  let patched = false;
5040
5073
  (instance.bu || (instance.bu = [])).push(() => patched = true);
5041
5074
  const performHydrate = () => {
@@ -5047,6 +5080,7 @@ function defineAsyncComponent(source) {
5047
5080
  }
5048
5081
  return;
5049
5082
  }
5083
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
5050
5084
  hydrate();
5051
5085
  };
5052
5086
  const doHydrate = hydrateStrategy ? () => {
@@ -5605,14 +5639,16 @@ function createSlots(slots, dynamicSlots) {
5605
5639
  return slots;
5606
5640
  }
5607
5641
 
5608
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5642
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
5643
+ if (props == null) props = {};
5609
5644
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5610
- const hasProps = Object.keys(props).length > 0;
5611
- if (name !== "default") props.name = name;
5645
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
5646
+ const hasProps = Object.keys(slotProps).length > 0;
5647
+ if (name !== "default") slotProps.name = name;
5612
5648
  return openBlock(), createBlock(
5613
5649
  Fragment,
5614
5650
  null,
5615
- [createVNode("slot", props, fallback && fallback())],
5651
+ [createVNode("slot", slotProps, fallback && fallback())],
5616
5652
  hasProps ? -2 : 64
5617
5653
  );
5618
5654
  }
@@ -5626,26 +5662,34 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5626
5662
  if (slot && slot._c) {
5627
5663
  slot._d = false;
5628
5664
  }
5665
+ const prevStackSize = blockStack.length;
5629
5666
  openBlock();
5630
- const validSlotContent = slot && ensureValidVNode(slot(props));
5631
- const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
5632
- // key attached in the `createSlots` helper, respect that
5633
- validSlotContent && validSlotContent.key;
5634
- const rendered = createBlock(
5635
- Fragment,
5636
- {
5637
- key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
5638
- (!validSlotContent && fallback ? "_fb" : "")
5639
- },
5640
- validSlotContent || (fallback ? fallback() : []),
5641
- validSlotContent && slots._ === 1 ? 64 : -2
5642
- );
5667
+ let rendered;
5668
+ try {
5669
+ const validSlotContent = slot && ensureValidVNode(slot(props));
5670
+ const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
5671
+ // key attached in the `createSlots` helper, respect that
5672
+ validSlotContent && validSlotContent.key;
5673
+ rendered = createBlock(
5674
+ Fragment,
5675
+ {
5676
+ key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
5677
+ (!validSlotContent && fallback ? "_fb" : "")
5678
+ },
5679
+ validSlotContent || (fallback ? fallback() : []),
5680
+ validSlotContent && slots._ === 1 ? 64 : -2
5681
+ );
5682
+ } catch (err) {
5683
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
5684
+ throw err;
5685
+ } finally {
5686
+ if (slot && slot._c) {
5687
+ slot._d = true;
5688
+ }
5689
+ }
5643
5690
  if (!noSlotted && rendered.scopeId) {
5644
5691
  rendered.slotScopeIds = [rendered.scopeId + "-s"];
5645
5692
  }
5646
- if (slot && slot._c) {
5647
- slot._d = true;
5648
- }
5649
5693
  return rendered;
5650
5694
  }
5651
5695
  function ensureValidVNode(vnodes) {
@@ -7020,12 +7064,13 @@ function renderComponentRoot(instance) {
7020
7064
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
7021
7065
  }
7022
7066
  if (vnode.transition) {
7023
- if (!isElementRoot(root)) {
7067
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
7068
+ if (!isElementRoot(child)) {
7024
7069
  warn$1(
7025
7070
  `Component inside <Transition> renders non-element root node that cannot be animated.`
7026
7071
  );
7027
7072
  }
7028
- setTransitionHooks(root, vnode.transition);
7073
+ setTransitionHooks(child, vnode.transition);
7029
7074
  }
7030
7075
  if (setRoot) {
7031
7076
  setRoot(root);
@@ -9673,7 +9718,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9673
9718
  let hasUnresolvedAncestor = false;
9674
9719
  while (parent) {
9675
9720
  if (parent.pendingBranch) {
9676
- parent.effects.push(...effects);
9721
+ for (let i = 0; i < effects.length; i++) {
9722
+ parent.effects.push(effects[i]);
9723
+ }
9677
9724
  hasUnresolvedAncestor = true;
9678
9725
  break;
9679
9726
  }
@@ -10038,6 +10085,14 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
10038
10085
  if (vnode.key !== vnode.key) {
10039
10086
  warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
10040
10087
  }
10088
+ if (props && vnode.shapeFlag & 1) {
10089
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
10090
+ if (overwritingProp && hasContentChildren(vnode.children)) {
10091
+ warn$1(
10092
+ `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
10093
+ );
10094
+ }
10095
+ }
10041
10096
  if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
10042
10097
  !isBlockNode && // has current parent block
10043
10098
  currentBlock && // presence of a patch flag indicates this node needs patching on updates.
@@ -10051,6 +10106,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
10051
10106
  }
10052
10107
  return vnode;
10053
10108
  }
10109
+ function hasContentChildren(children) {
10110
+ if (isString(children)) return children !== "";
10111
+ if (isArray(children)) return children.length > 0;
10112
+ return false;
10113
+ }
10054
10114
  const createVNode = createVNodeWithArgsTransform ;
10055
10115
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
10056
10116
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -10499,7 +10559,12 @@ function setupStatefulComponent(instance, isSSR) {
10499
10559
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10500
10560
  if (isSSR) {
10501
10561
  return setupResult.then((resolvedResult) => {
10502
- handleSetupResult(instance, resolvedResult, isSSR);
10562
+ setInSSRSetupState(true);
10563
+ try {
10564
+ handleSetupResult(instance, resolvedResult, isSSR);
10565
+ } finally {
10566
+ setInSSRSetupState(false);
10567
+ }
10503
10568
  }).catch((e) => {
10504
10569
  handleError(e, instance, 0);
10505
10570
  });
@@ -10965,7 +11030,7 @@ function isMemoSame(cached, memo) {
10965
11030
  return true;
10966
11031
  }
10967
11032
 
10968
- const version = "3.5.39";
11033
+ const version = "3.5.41";
10969
11034
  const warn = warn$1 ;
10970
11035
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10971
11036
  const devtools = devtools$1 ;
@@ -11935,7 +12000,9 @@ class VueElement extends BaseClass {
11935
12000
  if (parent && parent._pendingResolve) {
11936
12001
  this._pendingResolve = parent._pendingResolve.then(() => {
11937
12002
  this._pendingResolve = void 0;
11938
- this._resolveDef();
12003
+ if (this.isConnected) {
12004
+ return this._resolveDef();
12005
+ }
11939
12006
  });
11940
12007
  } else {
11941
12008
  this._resolveDef();
@@ -11985,7 +12052,7 @@ class VueElement extends BaseClass {
11985
12052
  */
11986
12053
  _resolveDef() {
11987
12054
  if (this._pendingResolve) {
11988
- return;
12055
+ return this._pendingResolve;
11989
12056
  }
11990
12057
  for (let i = 0; i < this.attributes.length; i++) {
11991
12058
  this._setAttr(this.attributes[i].name);
@@ -12025,6 +12092,7 @@ class VueElement extends BaseClass {
12025
12092
  def.configureApp = this._def.configureApp;
12026
12093
  resolve(this._def = def, true);
12027
12094
  });
12095
+ return this._pendingResolve;
12028
12096
  } else {
12029
12097
  resolve(this._def);
12030
12098
  }
@@ -12062,6 +12130,11 @@ class VueElement extends BaseClass {
12062
12130
  }
12063
12131
  }
12064
12132
  for (const key of declaredPropKeys.map(camelize)) {
12133
+ if (key in Object.getPrototypeOf(this)) {
12134
+ warn(
12135
+ `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
12136
+ );
12137
+ }
12065
12138
  Object.defineProperty(this, key, {
12066
12139
  get() {
12067
12140
  return this._getProp(key);
@@ -12546,6 +12619,7 @@ function onCompositionEnd(e) {
12546
12619
  }
12547
12620
  }
12548
12621
  const assignKey = /* @__PURE__ */ Symbol("_assign");
12622
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
12549
12623
  function castValue(value, trim, number) {
12550
12624
  if (trim) value = value.trim();
12551
12625
  if (number) value = looseToNumber(value);
@@ -12553,6 +12627,13 @@ function castValue(value, trim, number) {
12553
12627
  }
12554
12628
  const vModelText = {
12555
12629
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
12630
+ if (el.parentNode) {
12631
+ if (el.type === "text") {
12632
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
12633
+ } else if (el.type === "textarea") {
12634
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
12635
+ }
12636
+ }
12556
12637
  el[assignKey] = getModelAssigner(vnode);
12557
12638
  const castToNumber = number || vnode.props && vnode.props.type === "number";
12558
12639
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -12571,8 +12652,15 @@ const vModelText = {
12571
12652
  }
12572
12653
  },
12573
12654
  // set value on mounted so it's after min/max for type="range"
12574
- mounted(el, { value }) {
12575
- el.value = value == null ? "" : value;
12655
+ mounted(el, { value, modifiers: { trim, number } }) {
12656
+ const newValue = value == null ? "" : value;
12657
+ const initialValue = el[initialValueKey];
12658
+ delete el[initialValueKey];
12659
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
12660
+ el[assignKey](castValue(el.value, trim, number));
12661
+ } else {
12662
+ el.value = newValue;
12663
+ }
12576
12664
  },
12577
12665
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
12578
12666
  el[assignKey] = getModelAssigner(vnode);
@@ -12668,13 +12756,13 @@ const vModelSelect = {
12668
12756
  // <select multiple> value need to be deep traversed
12669
12757
  deep: true,
12670
12758
  created(el, { value, modifiers: { number } }, vnode) {
12671
- const isSetModel = isSet(value);
12759
+ el._modelValue = value;
12672
12760
  addEventListener(el, "change", () => {
12673
12761
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12674
12762
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12675
12763
  );
12676
12764
  el[assignKey](
12677
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12765
+ el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12678
12766
  );
12679
12767
  el._assigning = true;
12680
12768
  nextTick(() => {
@@ -12688,7 +12776,8 @@ const vModelSelect = {
12688
12776
  mounted(el, { value }) {
12689
12777
  setSelected(el, value);
12690
12778
  },
12691
- beforeUpdate(el, _binding, vnode) {
12779
+ beforeUpdate(el, { value }, vnode) {
12780
+ el._modelValue = value;
12692
12781
  el[assignKey] = getModelAssigner(vnode);
12693
12782
  },
12694
12783
  updated(el, { value }) {
@@ -14492,6 +14581,9 @@ function getUnnormalizedProps(props, callPath = []) {
14492
14581
  return [props, callPath];
14493
14582
  }
14494
14583
  function injectProp(node, prop, context) {
14584
+ if (node.type !== 13 && injectSlotKey(node, prop)) {
14585
+ return;
14586
+ }
14495
14587
  let propsWithInjection;
14496
14588
  let props = node.type === 13 ? node.props : node.arguments[2];
14497
14589
  let callPath = [];
@@ -14549,6 +14641,24 @@ function injectProp(node, prop, context) {
14549
14641
  }
14550
14642
  }
14551
14643
  }
14644
+ function injectSlotKey(node, prop) {
14645
+ var _a, _b, _c;
14646
+ if (prop.key.type !== 4 || prop.key.content !== "key") {
14647
+ return false;
14648
+ }
14649
+ const props = node.arguments[2];
14650
+ if (props && !isString(props)) {
14651
+ const [unnormalizedProps] = getUnnormalizedProps(props);
14652
+ if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) {
14653
+ return true;
14654
+ }
14655
+ }
14656
+ (_a = node.arguments)[2] || (_a[2] = "{}");
14657
+ (_b = node.arguments)[3] || (_b[3] = "undefined");
14658
+ (_c = node.arguments)[4] || (_c[4] = "undefined");
14659
+ node.arguments[5] = prop.value;
14660
+ return true;
14661
+ }
14552
14662
  function hasProp(prop, props) {
14553
14663
  let result = false;
14554
14664
  if (prop.key.type === 4) {
@@ -16718,6 +16828,7 @@ const transformFor = createStructuralDirectiveTransform(
16718
16828
  node.loc
16719
16829
  );
16720
16830
  return () => {
16831
+ var _a;
16721
16832
  let childBlock;
16722
16833
  const { children } = forNode;
16723
16834
  if (isTemplate) {
@@ -16761,7 +16872,8 @@ const transformFor = createStructuralDirectiveTransform(
16761
16872
  if (isTemplate && keyProperty) {
16762
16873
  injectProp(childBlock, keyProperty, context);
16763
16874
  }
16764
- if (childBlock.isBlock !== !isStableFragment) {
16875
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
16876
+ if (childBlock.isBlock !== shouldUseBlock) {
16765
16877
  if (childBlock.isBlock) {
16766
16878
  removeHelper(OPEN_BLOCK);
16767
16879
  removeHelper(
@@ -16773,12 +16885,15 @@ const transformFor = createStructuralDirectiveTransform(
16773
16885
  );
16774
16886
  }
16775
16887
  }
16776
- childBlock.isBlock = !isStableFragment;
16888
+ childBlock.isBlock = shouldUseBlock;
16777
16889
  if (childBlock.isBlock) {
16778
16890
  helper(OPEN_BLOCK);
16779
16891
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
16780
16892
  } else {
16781
16893
  helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
16894
+ if (childBlock.needsPatch) {
16895
+ childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
16896
+ }
16782
16897
  }
16783
16898
  }
16784
16899
  if (memo) {
@@ -17154,6 +17269,8 @@ const transformElement = (node, context) => {
17154
17269
  let vnodeDynamicProps;
17155
17270
  let dynamicPropNames;
17156
17271
  let vnodeDirectives;
17272
+ let needsPatch = false;
17273
+ let isBlockRequired = false;
17157
17274
  let shouldUseBlock = (
17158
17275
  // dynamic component may resolve to plain elements
17159
17276
  isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
@@ -17173,6 +17290,8 @@ const transformElement = (node, context) => {
17173
17290
  vnodeProps = propsBuildResult.props;
17174
17291
  patchFlag = propsBuildResult.patchFlag;
17175
17292
  dynamicPropNames = propsBuildResult.dynamicPropNames;
17293
+ needsPatch = propsBuildResult.needsPatch;
17294
+ isBlockRequired = propsBuildResult.isBlockRequired;
17176
17295
  const directives = propsBuildResult.directives;
17177
17296
  vnodeDirectives = directives && directives.length ? createArrayExpression(
17178
17297
  directives.map((dir) => buildDirectiveArgs(dir, context))
@@ -17223,7 +17342,7 @@ const transformElement = (node, context) => {
17223
17342
  if (dynamicPropNames && dynamicPropNames.length) {
17224
17343
  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
17225
17344
  }
17226
- node.codegenNode = createVNodeCall(
17345
+ const vnodeCall = node.codegenNode = createVNodeCall(
17227
17346
  context,
17228
17347
  vnodeTag,
17229
17348
  vnodeProps,
@@ -17236,6 +17355,13 @@ const transformElement = (node, context) => {
17236
17355
  isComponent,
17237
17356
  node.loc
17238
17357
  );
17358
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
17359
+ if (needsPatch) {
17360
+ vnodeCall.needsPatch = true;
17361
+ }
17362
+ if (isBlockRequired) {
17363
+ vnodeCall.isBlockRequired = true;
17364
+ }
17239
17365
  };
17240
17366
  };
17241
17367
  function resolveComponentType(node, context, ssr = false) {
@@ -17284,6 +17410,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17284
17410
  const runtimeDirectives = [];
17285
17411
  const hasChildren = children.length > 0;
17286
17412
  let shouldUseBlock = false;
17413
+ let isBlockRequired = false;
17287
17414
  let patchFlag = 0;
17288
17415
  let hasRef = false;
17289
17416
  let hasClassBinding = false;
@@ -17325,19 +17452,20 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17325
17452
  if (isEventHandler && isReservedProp(name)) {
17326
17453
  hasVnodeHook = true;
17327
17454
  }
17455
+ if (name === "ref") {
17456
+ hasRef = true;
17457
+ }
17328
17458
  if (isEventHandler && value.type === 14) {
17329
17459
  value = value.arguments[0];
17330
17460
  }
17331
17461
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
17332
17462
  return;
17333
17463
  }
17334
- if (name === "ref") {
17335
- hasRef = true;
17336
- } else if (name === "class") {
17464
+ if (name === "class") {
17337
17465
  hasClassBinding = true;
17338
17466
  } else if (name === "style") {
17339
17467
  hasStyleBinding = true;
17340
- } else if (name !== "key" && !dynamicPropNames.includes(name)) {
17468
+ } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
17341
17469
  dynamicPropNames.push(name);
17342
17470
  }
17343
17471
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
@@ -17390,13 +17518,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17390
17518
  if (isVOn && ssr) {
17391
17519
  continue;
17392
17520
  }
17393
- if (
17394
- // #938: elements with dynamic keys should be forced into blocks
17395
- isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
17396
- // before children
17397
- isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
17398
- ) {
17521
+ if (isVBind && isStaticArgOf(arg, "key")) {
17522
+ shouldUseBlock = true;
17523
+ }
17524
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
17399
17525
  shouldUseBlock = true;
17526
+ isBlockRequired = true;
17400
17527
  }
17401
17528
  if (isVBind && isStaticArgOf(arg, "ref")) {
17402
17529
  pushRefVForMarker();
@@ -17448,6 +17575,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17448
17575
  runtimeDirectives.push(prop);
17449
17576
  if (hasChildren) {
17450
17577
  shouldUseBlock = true;
17578
+ isBlockRequired = true;
17451
17579
  }
17452
17580
  }
17453
17581
  }
@@ -17486,7 +17614,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17486
17614
  patchFlag |= 32;
17487
17615
  }
17488
17616
  }
17489
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
17617
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
17618
+ if (!shouldUseBlock && needsPatch) {
17490
17619
  patchFlag |= 512;
17491
17620
  }
17492
17621
  if (!context.inSSR && propsExpression) {
@@ -17552,7 +17681,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17552
17681
  directives: runtimeDirectives,
17553
17682
  patchFlag,
17554
17683
  dynamicPropNames,
17555
- shouldUseBlock
17684
+ shouldUseBlock,
17685
+ needsPatch,
17686
+ isBlockRequired
17556
17687
  };
17557
17688
  }
17558
17689
  function dedupeProperties(properties) {