@vue/compat 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/compat v3.5.39
2
+ * @vue/compat v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -278,7 +278,7 @@ const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
278
278
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
279
279
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
280
280
  const isBooleanAttr = /* @__PURE__ */ makeMap(
281
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
281
+ specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
282
282
  );
283
283
  function includeBooleanAttr(value) {
284
284
  return !!value || value === "";
@@ -502,8 +502,9 @@ class EffectScope {
502
502
  this._isPaused = true;
503
503
  let i, l;
504
504
  if (this.scopes) {
505
- for (i = 0, l = this.scopes.length; i < l; i++) {
506
- this.scopes[i].pause();
505
+ const scopes = this.scopes.slice();
506
+ for (i = 0, l = scopes.length; i < l; i++) {
507
+ scopes[i].pause();
507
508
  }
508
509
  }
509
510
  for (i = 0, l = this.effects.length; i < l; i++) {
@@ -520,12 +521,14 @@ class EffectScope {
520
521
  this._isPaused = false;
521
522
  let i, l;
522
523
  if (this.scopes) {
523
- for (i = 0, l = this.scopes.length; i < l; i++) {
524
- this.scopes[i].resume();
524
+ const scopes = this.scopes.slice();
525
+ for (i = 0, l = scopes.length; i < l; i++) {
526
+ scopes[i].resume();
525
527
  }
526
528
  }
527
- for (i = 0, l = this.effects.length; i < l; i++) {
528
- this.effects[i].resume();
529
+ const effects = this.effects.slice();
530
+ for (i = 0, l = effects.length; i < l; i++) {
531
+ effects[i].resume();
529
532
  }
530
533
  }
531
534
  }
@@ -587,8 +590,9 @@ class EffectScope {
587
590
  }
588
591
  this.cleanups.length = 0;
589
592
  if (this.scopes) {
590
- for (i = 0, l = this.scopes.length; i < l; i++) {
591
- this.scopes[i].stop(true);
593
+ const scopes = this.scopes.slice();
594
+ for (i = 0, l = scopes.length; i < l; i++) {
595
+ scopes[i].stop(true);
592
596
  }
593
597
  this.scopes.length = 0;
594
598
  }
@@ -2719,7 +2723,9 @@ function queuePostFlushCb(cb) {
2719
2723
  cb.flags |= 1;
2720
2724
  }
2721
2725
  } else {
2722
- pendingPostFlushCbs.push(...cb);
2726
+ for (let i = 0; i < cb.length; i++) {
2727
+ pendingPostFlushCbs.push(cb[i]);
2728
+ }
2723
2729
  }
2724
2730
  queueFlush();
2725
2731
  }
@@ -2755,7 +2761,9 @@ function flushPostFlushCbs(seen) {
2755
2761
  );
2756
2762
  pendingPostFlushCbs.length = 0;
2757
2763
  if (activePostFlushCbs) {
2758
- activePostFlushCbs.push(...deduped);
2764
+ for (let i = 0; i < deduped.length; i++) {
2765
+ activePostFlushCbs.push(deduped[i]);
2766
+ }
2759
2767
  return;
2760
2768
  }
2761
2769
  activePostFlushCbs = deduped;
@@ -3510,10 +3518,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
3510
3518
  setBlockTracking(-1);
3511
3519
  }
3512
3520
  const prevInstance = setCurrentRenderingInstance(ctx);
3521
+ const prevStackSize = blockStack.length;
3513
3522
  let res;
3514
3523
  try {
3515
3524
  res = fn(...args);
3516
3525
  } finally {
3526
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
3517
3527
  setCurrentRenderingInstance(prevInstance);
3518
3528
  if (renderFnWithContext._d) {
3519
3529
  setBlockTracking(1);
@@ -4514,7 +4524,11 @@ function getInnerChild$1(vnode) {
4514
4524
  function setTransitionHooks(vnode, hooks) {
4515
4525
  if (vnode.shapeFlag & 6 && vnode.component) {
4516
4526
  vnode.transition = hooks;
4517
- setTransitionHooks(vnode.component.subTree, hooks);
4527
+ const subTree = vnode.component.subTree;
4528
+ setTransitionHooks(
4529
+ isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
4530
+ hooks
4531
+ );
4518
4532
  } else if (vnode.shapeFlag & 128) {
4519
4533
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4520
4534
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -4674,12 +4688,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4674
4688
  }
4675
4689
  }
4676
4690
  if (isFunction(ref)) {
4677
- pauseTracking();
4678
- try {
4679
- callWithErrorHandling(ref, owner, 12, [value, refs]);
4680
- } finally {
4681
- resetTracking();
4682
- }
4691
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
4683
4692
  } else {
4684
4693
  const _isString = isString(ref);
4685
4694
  const _isRef = isRef(ref);
@@ -5050,6 +5059,7 @@ Server rendered element contains more child nodes than client vdom.`
5050
5059
  if (props) {
5051
5060
  {
5052
5061
  const isCustomElement = el.tagName.includes("-");
5062
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
5053
5063
  for (const key in props) {
5054
5064
  if (// #11189 skip if this node has directives that have created hooks
5055
5065
  // as it could have mutated the DOM in any possible way
@@ -5058,7 +5068,10 @@ Server rendered element contains more child nodes than client vdom.`
5058
5068
  }
5059
5069
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
5060
5070
  key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
5061
- patchProp(el, key, null, props[key], void 0, parentComponent);
5071
+ if (isUnchangedResourceProp(el, key, props[key])) {
5072
+ continue;
5073
+ }
5074
+ patchProp(el, key, null, props[key], namespace, parentComponent);
5062
5075
  }
5063
5076
  }
5064
5077
  }
@@ -5240,6 +5253,13 @@ Server rendered element contains fewer child nodes than client vdom.`
5240
5253
  };
5241
5254
  return [hydrate, hydrateNode];
5242
5255
  }
5256
+ const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
5257
+ function isUnchangedResourceProp(el, key, clientValue) {
5258
+ if (!resourceProps.has(key)) {
5259
+ return false;
5260
+ }
5261
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
5262
+ }
5243
5263
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5244
5264
  let mismatchType;
5245
5265
  let mismatchKey;
@@ -5277,7 +5297,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5277
5297
  mismatchKey = "style";
5278
5298
  }
5279
5299
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
5280
- if (isBooleanAttr(key)) {
5300
+ if (key === "hidden") {
5301
+ actual = normalizeHiddenValue(el.getAttribute(key));
5302
+ expected = normalizeHiddenValue(clientValue);
5303
+ } else if (isBooleanAttr(key)) {
5281
5304
  actual = el.hasAttribute(key);
5282
5305
  expected = includeBooleanAttr(clientValue);
5283
5306
  } else if (clientValue == null) {
@@ -5313,6 +5336,15 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5313
5336
  }
5314
5337
  return false;
5315
5338
  }
5339
+ function normalizeHiddenValue(value) {
5340
+ if (!isRenderableAttrValue(value)) {
5341
+ return false;
5342
+ }
5343
+ if (isString(value)) {
5344
+ return value.toLowerCase() === "until-found" ? "until-found" : "";
5345
+ }
5346
+ return includeBooleanAttr(value) ? "" : false;
5347
+ }
5316
5348
  function toClassSet(str) {
5317
5349
  return new Set(str.trim().split(/\s+/));
5318
5350
  }
@@ -5561,6 +5593,7 @@ function defineAsyncComponent(source) {
5561
5593
  name: "AsyncComponentWrapper",
5562
5594
  __asyncLoader: load,
5563
5595
  __asyncHydrate(el, instance, hydrate) {
5596
+ const wasConnected = el.isConnected;
5564
5597
  let patched = false;
5565
5598
  (instance.bu || (instance.bu = [])).push(() => patched = true);
5566
5599
  const performHydrate = () => {
@@ -5572,6 +5605,7 @@ function defineAsyncComponent(source) {
5572
5605
  }
5573
5606
  return;
5574
5607
  }
5608
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
5575
5609
  hydrate();
5576
5610
  };
5577
5611
  const doHydrate = hydrateStrategy ? () => {
@@ -6418,14 +6452,16 @@ function createSlots(slots, dynamicSlots) {
6418
6452
  return slots;
6419
6453
  }
6420
6454
 
6421
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6455
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
6456
+ if (props == null) props = {};
6422
6457
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6423
- const hasProps = Object.keys(props).length > 0;
6424
- if (name !== "default") props.name = name;
6458
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
6459
+ const hasProps = Object.keys(slotProps).length > 0;
6460
+ if (name !== "default") slotProps.name = name;
6425
6461
  return openBlock(), createBlock(
6426
6462
  Fragment,
6427
6463
  null,
6428
- [createVNode("slot", props, fallback && fallback())],
6464
+ [createVNode("slot", slotProps, fallback && fallback())],
6429
6465
  hasProps ? -2 : 64
6430
6466
  );
6431
6467
  }
@@ -6439,26 +6475,34 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6439
6475
  if (slot && slot._c) {
6440
6476
  slot._d = false;
6441
6477
  }
6478
+ const prevStackSize = blockStack.length;
6442
6479
  openBlock();
6443
- const validSlotContent = slot && ensureValidVNode(slot(props));
6444
- const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
6445
- // key attached in the `createSlots` helper, respect that
6446
- validSlotContent && validSlotContent.key;
6447
- const rendered = createBlock(
6448
- Fragment,
6449
- {
6450
- key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
6451
- (!validSlotContent && fallback ? "_fb" : "")
6452
- },
6453
- validSlotContent || (fallback ? fallback() : []),
6454
- validSlotContent && slots._ === 1 ? 64 : -2
6455
- );
6480
+ let rendered;
6481
+ try {
6482
+ const validSlotContent = slot && ensureValidVNode(slot(props));
6483
+ const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
6484
+ // key attached in the `createSlots` helper, respect that
6485
+ validSlotContent && validSlotContent.key;
6486
+ rendered = createBlock(
6487
+ Fragment,
6488
+ {
6489
+ key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
6490
+ (!validSlotContent && fallback ? "_fb" : "")
6491
+ },
6492
+ validSlotContent || (fallback ? fallback() : []),
6493
+ validSlotContent && slots._ === 1 ? 64 : -2
6494
+ );
6495
+ } catch (err) {
6496
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
6497
+ throw err;
6498
+ } finally {
6499
+ if (slot && slot._c) {
6500
+ slot._d = true;
6501
+ }
6502
+ }
6456
6503
  if (!noSlotted && rendered.scopeId) {
6457
6504
  rendered.slotScopeIds = [rendered.scopeId + "-s"];
6458
6505
  }
6459
- if (slot && slot._c) {
6460
- slot._d = true;
6461
- }
6462
6506
  return rendered;
6463
6507
  }
6464
6508
  function ensureValidVNode(vnodes) {
@@ -7636,7 +7680,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7636
7680
  return vm;
7637
7681
  }
7638
7682
  }
7639
- Vue.version = `2.6.14-compat:${"3.5.39"}`;
7683
+ Vue.version = `2.6.14-compat:${"3.5.41"}`;
7640
7684
  Vue.config = singletonApp.config;
7641
7685
  Vue.use = (plugin, ...options) => {
7642
7686
  if (plugin && isFunction(plugin.install)) {
@@ -8658,12 +8702,13 @@ function renderComponentRoot(instance) {
8658
8702
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
8659
8703
  }
8660
8704
  if (vnode.transition) {
8661
- if (!isElementRoot(root)) {
8705
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
8706
+ if (!isElementRoot(child)) {
8662
8707
  warn$1(
8663
8708
  `Component inside <Transition> renders non-element root node that cannot be animated.`
8664
8709
  );
8665
8710
  }
8666
- setTransitionHooks(root, vnode.transition);
8711
+ setTransitionHooks(child, vnode.transition);
8667
8712
  }
8668
8713
  if (setRoot) {
8669
8714
  setRoot(root);
@@ -11417,7 +11462,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11417
11462
  let hasUnresolvedAncestor = false;
11418
11463
  while (parent) {
11419
11464
  if (parent.pendingBranch) {
11420
- parent.effects.push(...effects);
11465
+ for (let i = 0; i < effects.length; i++) {
11466
+ parent.effects.push(effects[i]);
11467
+ }
11421
11468
  hasUnresolvedAncestor = true;
11422
11469
  break;
11423
11470
  }
@@ -11839,6 +11886,14 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
11839
11886
  if (vnode.key !== vnode.key) {
11840
11887
  warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
11841
11888
  }
11889
+ if (props && vnode.shapeFlag & 1) {
11890
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
11891
+ if (overwritingProp && hasContentChildren(vnode.children)) {
11892
+ warn$1(
11893
+ `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
11894
+ );
11895
+ }
11896
+ }
11842
11897
  if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
11843
11898
  !isBlockNode && // has current parent block
11844
11899
  currentBlock && // presence of a patch flag indicates this node needs patching on updates.
@@ -11856,6 +11911,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
11856
11911
  }
11857
11912
  return vnode;
11858
11913
  }
11914
+ function hasContentChildren(children) {
11915
+ if (isString(children)) return children !== "";
11916
+ if (isArray(children)) return children.length > 0;
11917
+ return false;
11918
+ }
11859
11919
  const createVNode = createVNodeWithArgsTransform ;
11860
11920
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
11861
11921
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -12310,7 +12370,12 @@ function setupStatefulComponent(instance, isSSR) {
12310
12370
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
12311
12371
  if (isSSR) {
12312
12372
  return setupResult.then((resolvedResult) => {
12313
- handleSetupResult(instance, resolvedResult, isSSR);
12373
+ setInSSRSetupState(true);
12374
+ try {
12375
+ handleSetupResult(instance, resolvedResult, isSSR);
12376
+ } finally {
12377
+ setInSSRSetupState(false);
12378
+ }
12314
12379
  }).catch((e) => {
12315
12380
  handleError(e, instance, 0);
12316
12381
  });
@@ -12788,7 +12853,7 @@ function isMemoSame(cached, memo) {
12788
12853
  return true;
12789
12854
  }
12790
12855
 
12791
- const version = "3.5.39";
12856
+ const version = "3.5.41";
12792
12857
  const warn = warn$1 ;
12793
12858
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12794
12859
  const devtools = devtools$1 ;
@@ -13778,7 +13843,9 @@ class VueElement extends BaseClass {
13778
13843
  if (parent && parent._pendingResolve) {
13779
13844
  this._pendingResolve = parent._pendingResolve.then(() => {
13780
13845
  this._pendingResolve = void 0;
13781
- this._resolveDef();
13846
+ if (this.isConnected) {
13847
+ return this._resolveDef();
13848
+ }
13782
13849
  });
13783
13850
  } else {
13784
13851
  this._resolveDef();
@@ -13828,7 +13895,7 @@ class VueElement extends BaseClass {
13828
13895
  */
13829
13896
  _resolveDef() {
13830
13897
  if (this._pendingResolve) {
13831
- return;
13898
+ return this._pendingResolve;
13832
13899
  }
13833
13900
  for (let i = 0; i < this.attributes.length; i++) {
13834
13901
  this._setAttr(this.attributes[i].name);
@@ -13868,6 +13935,7 @@ class VueElement extends BaseClass {
13868
13935
  def.configureApp = this._def.configureApp;
13869
13936
  resolve(this._def = def, true);
13870
13937
  });
13938
+ return this._pendingResolve;
13871
13939
  } else {
13872
13940
  resolve(this._def);
13873
13941
  }
@@ -13905,6 +13973,11 @@ class VueElement extends BaseClass {
13905
13973
  }
13906
13974
  }
13907
13975
  for (const key of declaredPropKeys.map(camelize)) {
13976
+ if (key in Object.getPrototypeOf(this)) {
13977
+ warn(
13978
+ `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
13979
+ );
13980
+ }
13908
13981
  Object.defineProperty(this, key, {
13909
13982
  get() {
13910
13983
  return this._getProp(key);
@@ -14398,6 +14471,7 @@ function onCompositionEnd(e) {
14398
14471
  }
14399
14472
  }
14400
14473
  const assignKey = /* @__PURE__ */ Symbol("_assign");
14474
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
14401
14475
  function castValue(value, trim, number) {
14402
14476
  if (trim) value = value.trim();
14403
14477
  if (number) value = looseToNumber(value);
@@ -14405,6 +14479,13 @@ function castValue(value, trim, number) {
14405
14479
  }
14406
14480
  const vModelText = {
14407
14481
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
14482
+ if (el.parentNode) {
14483
+ if (el.type === "text") {
14484
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
14485
+ } else if (el.type === "textarea") {
14486
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
14487
+ }
14488
+ }
14408
14489
  el[assignKey] = getModelAssigner(vnode);
14409
14490
  const castToNumber = number || vnode.props && vnode.props.type === "number";
14410
14491
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -14423,8 +14504,15 @@ const vModelText = {
14423
14504
  }
14424
14505
  },
14425
14506
  // set value on mounted so it's after min/max for type="range"
14426
- mounted(el, { value }) {
14427
- el.value = value == null ? "" : value;
14507
+ mounted(el, { value, modifiers: { trim, number } }) {
14508
+ const newValue = value == null ? "" : value;
14509
+ const initialValue = el[initialValueKey];
14510
+ delete el[initialValueKey];
14511
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
14512
+ el[assignKey](castValue(el.value, trim, number));
14513
+ } else {
14514
+ el.value = newValue;
14515
+ }
14428
14516
  },
14429
14517
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
14430
14518
  el[assignKey] = getModelAssigner(vnode);
@@ -14520,13 +14608,13 @@ const vModelSelect = {
14520
14608
  // <select multiple> value need to be deep traversed
14521
14609
  deep: true,
14522
14610
  created(el, { value, modifiers: { number } }, vnode) {
14523
- const isSetModel = isSet(value);
14611
+ el._modelValue = value;
14524
14612
  addEventListener(el, "change", () => {
14525
14613
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14526
14614
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14527
14615
  );
14528
14616
  el[assignKey](
14529
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
14617
+ el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14530
14618
  );
14531
14619
  el._assigning = true;
14532
14620
  nextTick(() => {
@@ -14540,7 +14628,8 @@ const vModelSelect = {
14540
14628
  mounted(el, { value }) {
14541
14629
  setSelected(el, value);
14542
14630
  },
14543
- beforeUpdate(el, _binding, vnode) {
14631
+ beforeUpdate(el, { value }, vnode) {
14632
+ el._modelValue = value;
14544
14633
  el[assignKey] = getModelAssigner(vnode);
14545
14634
  },
14546
14635
  updated(el, { value }) {
@@ -16908,6 +16997,9 @@ function getUnnormalizedProps(props, callPath = []) {
16908
16997
  return [props, callPath];
16909
16998
  }
16910
16999
  function injectProp(node, prop, context) {
17000
+ if (node.type !== 13 && injectSlotKey(node, prop)) {
17001
+ return;
17002
+ }
16911
17003
  let propsWithInjection;
16912
17004
  let props = node.type === 13 ? node.props : node.arguments[2];
16913
17005
  let callPath = [];
@@ -16965,6 +17057,24 @@ function injectProp(node, prop, context) {
16965
17057
  }
16966
17058
  }
16967
17059
  }
17060
+ function injectSlotKey(node, prop) {
17061
+ var _a, _b, _c;
17062
+ if (prop.key.type !== 4 || prop.key.content !== "key") {
17063
+ return false;
17064
+ }
17065
+ const props = node.arguments[2];
17066
+ if (props && !isString(props)) {
17067
+ const [unnormalizedProps] = getUnnormalizedProps(props);
17068
+ if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) {
17069
+ return true;
17070
+ }
17071
+ }
17072
+ (_a = node.arguments)[2] || (_a[2] = "{}");
17073
+ (_b = node.arguments)[3] || (_b[3] = "undefined");
17074
+ (_c = node.arguments)[4] || (_c[4] = "undefined");
17075
+ node.arguments[5] = prop.value;
17076
+ return true;
17077
+ }
16968
17078
  function hasProp(prop, props) {
16969
17079
  let result = false;
16970
17080
  if (prop.key.type === 4) {
@@ -19691,6 +19801,7 @@ const transformFor = createStructuralDirectiveTransform(
19691
19801
  node.loc
19692
19802
  );
19693
19803
  return () => {
19804
+ var _a;
19694
19805
  let childBlock;
19695
19806
  const { children } = forNode;
19696
19807
  if (isTemplate) {
@@ -19734,7 +19845,8 @@ const transformFor = createStructuralDirectiveTransform(
19734
19845
  if (isTemplate && keyProperty) {
19735
19846
  injectProp(childBlock, keyProperty, context);
19736
19847
  }
19737
- if (childBlock.isBlock !== !isStableFragment) {
19848
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
19849
+ if (childBlock.isBlock !== shouldUseBlock) {
19738
19850
  if (childBlock.isBlock) {
19739
19851
  removeHelper(OPEN_BLOCK);
19740
19852
  removeHelper(
@@ -19746,12 +19858,15 @@ const transformFor = createStructuralDirectiveTransform(
19746
19858
  );
19747
19859
  }
19748
19860
  }
19749
- childBlock.isBlock = !isStableFragment;
19861
+ childBlock.isBlock = shouldUseBlock;
19750
19862
  if (childBlock.isBlock) {
19751
19863
  helper(OPEN_BLOCK);
19752
19864
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
19753
19865
  } else {
19754
19866
  helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
19867
+ if (childBlock.needsPatch) {
19868
+ childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
19869
+ }
19755
19870
  }
19756
19871
  }
19757
19872
  if (memo) {
@@ -20173,6 +20288,8 @@ const transformElement = (node, context) => {
20173
20288
  let vnodeDynamicProps;
20174
20289
  let dynamicPropNames;
20175
20290
  let vnodeDirectives;
20291
+ let needsPatch = false;
20292
+ let isBlockRequired = false;
20176
20293
  let shouldUseBlock = (
20177
20294
  // dynamic component may resolve to plain elements
20178
20295
  isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
@@ -20192,6 +20309,8 @@ const transformElement = (node, context) => {
20192
20309
  vnodeProps = propsBuildResult.props;
20193
20310
  patchFlag = propsBuildResult.patchFlag;
20194
20311
  dynamicPropNames = propsBuildResult.dynamicPropNames;
20312
+ needsPatch = propsBuildResult.needsPatch;
20313
+ isBlockRequired = propsBuildResult.isBlockRequired;
20195
20314
  const directives = propsBuildResult.directives;
20196
20315
  vnodeDirectives = directives && directives.length ? createArrayExpression(
20197
20316
  directives.map((dir) => buildDirectiveArgs(dir, context))
@@ -20242,7 +20361,7 @@ const transformElement = (node, context) => {
20242
20361
  if (dynamicPropNames && dynamicPropNames.length) {
20243
20362
  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
20244
20363
  }
20245
- node.codegenNode = createVNodeCall(
20364
+ const vnodeCall = node.codegenNode = createVNodeCall(
20246
20365
  context,
20247
20366
  vnodeTag,
20248
20367
  vnodeProps,
@@ -20255,6 +20374,13 @@ const transformElement = (node, context) => {
20255
20374
  isComponent,
20256
20375
  node.loc
20257
20376
  );
20377
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
20378
+ if (needsPatch) {
20379
+ vnodeCall.needsPatch = true;
20380
+ }
20381
+ if (isBlockRequired) {
20382
+ vnodeCall.isBlockRequired = true;
20383
+ }
20258
20384
  };
20259
20385
  };
20260
20386
  function resolveComponentType(node, context, ssr = false) {
@@ -20364,6 +20490,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
20364
20490
  const runtimeDirectives = [];
20365
20491
  const hasChildren = children.length > 0;
20366
20492
  let shouldUseBlock = false;
20493
+ let isBlockRequired = false;
20367
20494
  let patchFlag = 0;
20368
20495
  let hasRef = false;
20369
20496
  let hasClassBinding = false;
@@ -20405,19 +20532,20 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
20405
20532
  if (isEventHandler && isReservedProp(name)) {
20406
20533
  hasVnodeHook = true;
20407
20534
  }
20535
+ if (name === "ref") {
20536
+ hasRef = true;
20537
+ }
20408
20538
  if (isEventHandler && value.type === 14) {
20409
20539
  value = value.arguments[0];
20410
20540
  }
20411
20541
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
20412
20542
  return;
20413
20543
  }
20414
- if (name === "ref") {
20415
- hasRef = true;
20416
- } else if (name === "class") {
20544
+ if (name === "class") {
20417
20545
  hasClassBinding = true;
20418
20546
  } else if (name === "style") {
20419
20547
  hasStyleBinding = true;
20420
- } else if (name !== "key" && !dynamicPropNames.includes(name)) {
20548
+ } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
20421
20549
  dynamicPropNames.push(name);
20422
20550
  }
20423
20551
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
@@ -20488,14 +20616,13 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
20488
20616
  if (isVOn && ssr) {
20489
20617
  continue;
20490
20618
  }
20491
- if (
20492
- // #938: elements with dynamic keys should be forced into blocks
20493
- isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
20494
- // before children
20495
- isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
20496
- ) {
20619
+ if (isVBind && isStaticArgOf(arg, "key")) {
20497
20620
  shouldUseBlock = true;
20498
20621
  }
20622
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
20623
+ shouldUseBlock = true;
20624
+ isBlockRequired = true;
20625
+ }
20499
20626
  if (isVBind && isStaticArgOf(arg, "ref")) {
20500
20627
  pushRefVForMarker();
20501
20628
  }
@@ -20577,6 +20704,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
20577
20704
  runtimeDirectives.push(prop);
20578
20705
  if (hasChildren) {
20579
20706
  shouldUseBlock = true;
20707
+ isBlockRequired = true;
20580
20708
  }
20581
20709
  }
20582
20710
  }
@@ -20615,7 +20743,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
20615
20743
  patchFlag |= 32;
20616
20744
  }
20617
20745
  }
20618
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
20746
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
20747
+ if (!shouldUseBlock && needsPatch) {
20619
20748
  patchFlag |= 512;
20620
20749
  }
20621
20750
  if (!context.inSSR && propsExpression) {
@@ -20681,7 +20810,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
20681
20810
  directives: runtimeDirectives,
20682
20811
  patchFlag,
20683
20812
  dynamicPropNames,
20684
- shouldUseBlock
20813
+ shouldUseBlock,
20814
+ needsPatch,
20815
+ isBlockRequired
20685
20816
  };
20686
20817
  }
20687
20818
  function dedupeProperties(properties) {
@@ -22060,12 +22191,15 @@ function stringifyElement(node, context) {
22060
22191
  res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
22061
22192
  continue;
22062
22193
  }
22063
- if (isBooleanAttr(p.arg.content) && exp.content === "false") {
22194
+ if ((isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") {
22064
22195
  continue;
22065
22196
  }
22066
22197
  let evaluated = evaluateConstant(exp);
22067
22198
  if (evaluated != null) {
22068
22199
  const arg = p.arg && p.arg.content;
22200
+ if (arg === "hidden" && typeof evaluated === "number" && !includeBooleanAttr(evaluated)) {
22201
+ continue;
22202
+ }
22069
22203
  if (arg === "class") {
22070
22204
  evaluated = normalizeClass(evaluated);
22071
22205
  } else if (arg === "style") {