@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.
@@ -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
  **/
@@ -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;
@@ -3457,10 +3465,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
3457
3465
  setBlockTracking(-1);
3458
3466
  }
3459
3467
  const prevInstance = setCurrentRenderingInstance(ctx);
3468
+ const prevStackSize = blockStack.length;
3460
3469
  let res;
3461
3470
  try {
3462
3471
  res = fn(...args);
3463
3472
  } finally {
3473
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
3464
3474
  setCurrentRenderingInstance(prevInstance);
3465
3475
  if (renderFnWithContext._d) {
3466
3476
  setBlockTracking(1);
@@ -4461,7 +4471,11 @@ function getInnerChild$1(vnode) {
4461
4471
  function setTransitionHooks(vnode, hooks) {
4462
4472
  if (vnode.shapeFlag & 6 && vnode.component) {
4463
4473
  vnode.transition = hooks;
4464
- setTransitionHooks(vnode.component.subTree, hooks);
4474
+ const subTree = vnode.component.subTree;
4475
+ setTransitionHooks(
4476
+ isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
4477
+ hooks
4478
+ );
4465
4479
  } else if (vnode.shapeFlag & 128) {
4466
4480
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4467
4481
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -4621,12 +4635,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4621
4635
  }
4622
4636
  }
4623
4637
  if (isFunction(ref)) {
4624
- pauseTracking();
4625
- try {
4626
- callWithErrorHandling(ref, owner, 12, [value, refs]);
4627
- } finally {
4628
- resetTracking();
4629
- }
4638
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
4630
4639
  } else {
4631
4640
  const _isString = isString(ref);
4632
4641
  const _isRef = isRef(ref);
@@ -4997,6 +5006,7 @@ Server rendered element contains more child nodes than client vdom.`
4997
5006
  if (props) {
4998
5007
  {
4999
5008
  const isCustomElement = el.tagName.includes("-");
5009
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
5000
5010
  for (const key in props) {
5001
5011
  if (// #11189 skip if this node has directives that have created hooks
5002
5012
  // as it could have mutated the DOM in any possible way
@@ -5005,7 +5015,10 @@ Server rendered element contains more child nodes than client vdom.`
5005
5015
  }
5006
5016
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
5007
5017
  key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
5008
- patchProp(el, key, null, props[key], void 0, parentComponent);
5018
+ if (isUnchangedResourceProp(el, key, props[key])) {
5019
+ continue;
5020
+ }
5021
+ patchProp(el, key, null, props[key], namespace, parentComponent);
5009
5022
  }
5010
5023
  }
5011
5024
  }
@@ -5187,6 +5200,13 @@ Server rendered element contains fewer child nodes than client vdom.`
5187
5200
  };
5188
5201
  return [hydrate, hydrateNode];
5189
5202
  }
5203
+ const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
5204
+ function isUnchangedResourceProp(el, key, clientValue) {
5205
+ if (!resourceProps.has(key)) {
5206
+ return false;
5207
+ }
5208
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
5209
+ }
5190
5210
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5191
5211
  let mismatchType;
5192
5212
  let mismatchKey;
@@ -5224,7 +5244,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5224
5244
  mismatchKey = "style";
5225
5245
  }
5226
5246
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
5227
- if (isBooleanAttr(key)) {
5247
+ if (key === "hidden") {
5248
+ actual = normalizeHiddenValue(el.getAttribute(key));
5249
+ expected = normalizeHiddenValue(clientValue);
5250
+ } else if (isBooleanAttr(key)) {
5228
5251
  actual = el.hasAttribute(key);
5229
5252
  expected = includeBooleanAttr(clientValue);
5230
5253
  } else if (clientValue == null) {
@@ -5260,6 +5283,15 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5260
5283
  }
5261
5284
  return false;
5262
5285
  }
5286
+ function normalizeHiddenValue(value) {
5287
+ if (!isRenderableAttrValue(value)) {
5288
+ return false;
5289
+ }
5290
+ if (isString(value)) {
5291
+ return value.toLowerCase() === "until-found" ? "until-found" : "";
5292
+ }
5293
+ return includeBooleanAttr(value) ? "" : false;
5294
+ }
5263
5295
  function toClassSet(str) {
5264
5296
  return new Set(str.trim().split(/\s+/));
5265
5297
  }
@@ -5508,6 +5540,7 @@ function defineAsyncComponent(source) {
5508
5540
  name: "AsyncComponentWrapper",
5509
5541
  __asyncLoader: load,
5510
5542
  __asyncHydrate(el, instance, hydrate) {
5543
+ const wasConnected = el.isConnected;
5511
5544
  let patched = false;
5512
5545
  (instance.bu || (instance.bu = [])).push(() => patched = true);
5513
5546
  const performHydrate = () => {
@@ -5519,6 +5552,7 @@ function defineAsyncComponent(source) {
5519
5552
  }
5520
5553
  return;
5521
5554
  }
5555
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
5522
5556
  hydrate();
5523
5557
  };
5524
5558
  const doHydrate = hydrateStrategy ? () => {
@@ -6368,14 +6402,16 @@ function createSlots(slots, dynamicSlots) {
6368
6402
  return slots;
6369
6403
  }
6370
6404
 
6371
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6405
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
6406
+ if (props == null) props = {};
6372
6407
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6373
- const hasProps = Object.keys(props).length > 0;
6374
- if (name !== "default") props.name = name;
6408
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
6409
+ const hasProps = Object.keys(slotProps).length > 0;
6410
+ if (name !== "default") slotProps.name = name;
6375
6411
  return openBlock(), createBlock(
6376
6412
  Fragment,
6377
6413
  null,
6378
- [createVNode("slot", props, fallback && fallback())],
6414
+ [createVNode("slot", slotProps, fallback && fallback())],
6379
6415
  hasProps ? -2 : 64
6380
6416
  );
6381
6417
  }
@@ -6389,26 +6425,34 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6389
6425
  if (slot && slot._c) {
6390
6426
  slot._d = false;
6391
6427
  }
6428
+ const prevStackSize = blockStack.length;
6392
6429
  openBlock();
6393
- const validSlotContent = slot && ensureValidVNode(slot(props));
6394
- const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
6395
- // key attached in the `createSlots` helper, respect that
6396
- validSlotContent && validSlotContent.key;
6397
- const rendered = createBlock(
6398
- Fragment,
6399
- {
6400
- key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
6401
- (!validSlotContent && fallback ? "_fb" : "")
6402
- },
6403
- validSlotContent || (fallback ? fallback() : []),
6404
- validSlotContent && slots._ === 1 ? 64 : -2
6405
- );
6430
+ let rendered;
6431
+ try {
6432
+ const validSlotContent = slot && ensureValidVNode(slot(props));
6433
+ const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
6434
+ // key attached in the `createSlots` helper, respect that
6435
+ validSlotContent && validSlotContent.key;
6436
+ rendered = createBlock(
6437
+ Fragment,
6438
+ {
6439
+ key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
6440
+ (!validSlotContent && fallback ? "_fb" : "")
6441
+ },
6442
+ validSlotContent || (fallback ? fallback() : []),
6443
+ validSlotContent && slots._ === 1 ? 64 : -2
6444
+ );
6445
+ } catch (err) {
6446
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
6447
+ throw err;
6448
+ } finally {
6449
+ if (slot && slot._c) {
6450
+ slot._d = true;
6451
+ }
6452
+ }
6406
6453
  if (!noSlotted && rendered.scopeId) {
6407
6454
  rendered.slotScopeIds = [rendered.scopeId + "-s"];
6408
6455
  }
6409
- if (slot && slot._c) {
6410
- slot._d = true;
6411
- }
6412
6456
  return rendered;
6413
6457
  }
6414
6458
  function ensureValidVNode(vnodes) {
@@ -7586,7 +7630,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7586
7630
  return vm;
7587
7631
  }
7588
7632
  }
7589
- Vue.version = `2.6.14-compat:${"3.5.39"}`;
7633
+ Vue.version = `2.6.14-compat:${"3.5.41"}`;
7590
7634
  Vue.config = singletonApp.config;
7591
7635
  Vue.use = (plugin, ...options) => {
7592
7636
  if (plugin && isFunction(plugin.install)) {
@@ -8608,12 +8652,13 @@ function renderComponentRoot(instance) {
8608
8652
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
8609
8653
  }
8610
8654
  if (vnode.transition) {
8611
- if (!isElementRoot(root)) {
8655
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
8656
+ if (!isElementRoot(child)) {
8612
8657
  warn$1(
8613
8658
  `Component inside <Transition> renders non-element root node that cannot be animated.`
8614
8659
  );
8615
8660
  }
8616
- setTransitionHooks(root, vnode.transition);
8661
+ setTransitionHooks(child, vnode.transition);
8617
8662
  }
8618
8663
  if (setRoot) {
8619
8664
  setRoot(root);
@@ -11367,7 +11412,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11367
11412
  let hasUnresolvedAncestor = false;
11368
11413
  while (parent) {
11369
11414
  if (parent.pendingBranch) {
11370
- parent.effects.push(...effects);
11415
+ for (let i = 0; i < effects.length; i++) {
11416
+ parent.effects.push(effects[i]);
11417
+ }
11371
11418
  hasUnresolvedAncestor = true;
11372
11419
  break;
11373
11420
  }
@@ -11789,6 +11836,14 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
11789
11836
  if (vnode.key !== vnode.key) {
11790
11837
  warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
11791
11838
  }
11839
+ if (props && vnode.shapeFlag & 1) {
11840
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
11841
+ if (overwritingProp && hasContentChildren(vnode.children)) {
11842
+ warn$1(
11843
+ `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
11844
+ );
11845
+ }
11846
+ }
11792
11847
  if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
11793
11848
  !isBlockNode && // has current parent block
11794
11849
  currentBlock && // presence of a patch flag indicates this node needs patching on updates.
@@ -11806,6 +11861,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
11806
11861
  }
11807
11862
  return vnode;
11808
11863
  }
11864
+ function hasContentChildren(children) {
11865
+ if (isString(children)) return children !== "";
11866
+ if (isArray(children)) return children.length > 0;
11867
+ return false;
11868
+ }
11809
11869
  const createVNode = createVNodeWithArgsTransform ;
11810
11870
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
11811
11871
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -12260,7 +12320,12 @@ function setupStatefulComponent(instance, isSSR) {
12260
12320
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
12261
12321
  if (isSSR) {
12262
12322
  return setupResult.then((resolvedResult) => {
12263
- handleSetupResult(instance, resolvedResult, isSSR);
12323
+ setInSSRSetupState(true);
12324
+ try {
12325
+ handleSetupResult(instance, resolvedResult, isSSR);
12326
+ } finally {
12327
+ setInSSRSetupState(false);
12328
+ }
12264
12329
  }).catch((e) => {
12265
12330
  handleError(e, instance, 0);
12266
12331
  });
@@ -12738,7 +12803,7 @@ function isMemoSame(cached, memo) {
12738
12803
  return true;
12739
12804
  }
12740
12805
 
12741
- const version = "3.5.39";
12806
+ const version = "3.5.41";
12742
12807
  const warn = warn$1 ;
12743
12808
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12744
12809
  const devtools = devtools$1 ;
@@ -13796,7 +13861,9 @@ class VueElement extends BaseClass {
13796
13861
  if (parent && parent._pendingResolve) {
13797
13862
  this._pendingResolve = parent._pendingResolve.then(() => {
13798
13863
  this._pendingResolve = void 0;
13799
- this._resolveDef();
13864
+ if (this.isConnected) {
13865
+ return this._resolveDef();
13866
+ }
13800
13867
  });
13801
13868
  } else {
13802
13869
  this._resolveDef();
@@ -13846,7 +13913,7 @@ class VueElement extends BaseClass {
13846
13913
  */
13847
13914
  _resolveDef() {
13848
13915
  if (this._pendingResolve) {
13849
- return;
13916
+ return this._pendingResolve;
13850
13917
  }
13851
13918
  for (let i = 0; i < this.attributes.length; i++) {
13852
13919
  this._setAttr(this.attributes[i].name);
@@ -13886,6 +13953,7 @@ class VueElement extends BaseClass {
13886
13953
  def.configureApp = this._def.configureApp;
13887
13954
  resolve(this._def = def, true);
13888
13955
  });
13956
+ return this._pendingResolve;
13889
13957
  } else {
13890
13958
  resolve(this._def);
13891
13959
  }
@@ -13923,6 +13991,11 @@ class VueElement extends BaseClass {
13923
13991
  }
13924
13992
  }
13925
13993
  for (const key of declaredPropKeys.map(camelize)) {
13994
+ if (key in Object.getPrototypeOf(this)) {
13995
+ warn(
13996
+ `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
13997
+ );
13998
+ }
13926
13999
  Object.defineProperty(this, key, {
13927
14000
  get() {
13928
14001
  return this._getProp(key);
@@ -14416,6 +14489,7 @@ function onCompositionEnd(e) {
14416
14489
  }
14417
14490
  }
14418
14491
  const assignKey = /* @__PURE__ */ Symbol("_assign");
14492
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
14419
14493
  function castValue(value, trim, number) {
14420
14494
  if (trim) value = value.trim();
14421
14495
  if (number) value = looseToNumber(value);
@@ -14423,6 +14497,13 @@ function castValue(value, trim, number) {
14423
14497
  }
14424
14498
  const vModelText = {
14425
14499
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
14500
+ if (el.parentNode) {
14501
+ if (el.type === "text") {
14502
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
14503
+ } else if (el.type === "textarea") {
14504
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
14505
+ }
14506
+ }
14426
14507
  el[assignKey] = getModelAssigner(vnode);
14427
14508
  const castToNumber = number || vnode.props && vnode.props.type === "number";
14428
14509
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -14441,8 +14522,15 @@ const vModelText = {
14441
14522
  }
14442
14523
  },
14443
14524
  // set value on mounted so it's after min/max for type="range"
14444
- mounted(el, { value }) {
14445
- el.value = value == null ? "" : value;
14525
+ mounted(el, { value, modifiers: { trim, number } }) {
14526
+ const newValue = value == null ? "" : value;
14527
+ const initialValue = el[initialValueKey];
14528
+ delete el[initialValueKey];
14529
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
14530
+ el[assignKey](castValue(el.value, trim, number));
14531
+ } else {
14532
+ el.value = newValue;
14533
+ }
14446
14534
  },
14447
14535
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
14448
14536
  el[assignKey] = getModelAssigner(vnode);
@@ -14538,13 +14626,13 @@ const vModelSelect = {
14538
14626
  // <select multiple> value need to be deep traversed
14539
14627
  deep: true,
14540
14628
  created(el, { value, modifiers: { number } }, vnode) {
14541
- const isSetModel = isSet(value);
14629
+ el._modelValue = value;
14542
14630
  addEventListener(el, "change", () => {
14543
14631
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14544
14632
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14545
14633
  );
14546
14634
  el[assignKey](
14547
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
14635
+ el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14548
14636
  );
14549
14637
  el._assigning = true;
14550
14638
  nextTick(() => {
@@ -14558,7 +14646,8 @@ const vModelSelect = {
14558
14646
  mounted(el, { value }) {
14559
14647
  setSelected(el, value);
14560
14648
  },
14561
- beforeUpdate(el, _binding, vnode) {
14649
+ beforeUpdate(el, { value }, vnode) {
14650
+ el._modelValue = value;
14562
14651
  el[assignKey] = getModelAssigner(vnode);
14563
14652
  },
14564
14653
  updated(el, { value }) {
@@ -16497,6 +16586,9 @@ function getUnnormalizedProps(props, callPath = []) {
16497
16586
  return [props, callPath];
16498
16587
  }
16499
16588
  function injectProp(node, prop, context) {
16589
+ if (node.type !== 13 && injectSlotKey(node, prop)) {
16590
+ return;
16591
+ }
16500
16592
  let propsWithInjection;
16501
16593
  let props = node.type === 13 ? node.props : node.arguments[2];
16502
16594
  let callPath = [];
@@ -16554,6 +16646,24 @@ function injectProp(node, prop, context) {
16554
16646
  }
16555
16647
  }
16556
16648
  }
16649
+ function injectSlotKey(node, prop) {
16650
+ var _a, _b, _c;
16651
+ if (prop.key.type !== 4 || prop.key.content !== "key") {
16652
+ return false;
16653
+ }
16654
+ const props = node.arguments[2];
16655
+ if (props && !isString(props)) {
16656
+ const [unnormalizedProps] = getUnnormalizedProps(props);
16657
+ if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) {
16658
+ return true;
16659
+ }
16660
+ }
16661
+ (_a = node.arguments)[2] || (_a[2] = "{}");
16662
+ (_b = node.arguments)[3] || (_b[3] = "undefined");
16663
+ (_c = node.arguments)[4] || (_c[4] = "undefined");
16664
+ node.arguments[5] = prop.value;
16665
+ return true;
16666
+ }
16557
16667
  function hasProp(prop, props) {
16558
16668
  let result = false;
16559
16669
  if (prop.key.type === 4) {
@@ -18820,6 +18930,7 @@ const transformFor = createStructuralDirectiveTransform(
18820
18930
  node.loc
18821
18931
  );
18822
18932
  return () => {
18933
+ var _a;
18823
18934
  let childBlock;
18824
18935
  const { children } = forNode;
18825
18936
  if (isTemplate) {
@@ -18863,7 +18974,8 @@ const transformFor = createStructuralDirectiveTransform(
18863
18974
  if (isTemplate && keyProperty) {
18864
18975
  injectProp(childBlock, keyProperty, context);
18865
18976
  }
18866
- if (childBlock.isBlock !== !isStableFragment) {
18977
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
18978
+ if (childBlock.isBlock !== shouldUseBlock) {
18867
18979
  if (childBlock.isBlock) {
18868
18980
  removeHelper(OPEN_BLOCK);
18869
18981
  removeHelper(
@@ -18875,12 +18987,15 @@ const transformFor = createStructuralDirectiveTransform(
18875
18987
  );
18876
18988
  }
18877
18989
  }
18878
- childBlock.isBlock = !isStableFragment;
18990
+ childBlock.isBlock = shouldUseBlock;
18879
18991
  if (childBlock.isBlock) {
18880
18992
  helper(OPEN_BLOCK);
18881
18993
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
18882
18994
  } else {
18883
18995
  helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
18996
+ if (childBlock.needsPatch) {
18997
+ childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
18998
+ }
18884
18999
  }
18885
19000
  }
18886
19001
  if (memo) {
@@ -19259,6 +19374,8 @@ const transformElement = (node, context) => {
19259
19374
  let vnodeDynamicProps;
19260
19375
  let dynamicPropNames;
19261
19376
  let vnodeDirectives;
19377
+ let needsPatch = false;
19378
+ let isBlockRequired = false;
19262
19379
  let shouldUseBlock = (
19263
19380
  // dynamic component may resolve to plain elements
19264
19381
  isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
@@ -19278,6 +19395,8 @@ const transformElement = (node, context) => {
19278
19395
  vnodeProps = propsBuildResult.props;
19279
19396
  patchFlag = propsBuildResult.patchFlag;
19280
19397
  dynamicPropNames = propsBuildResult.dynamicPropNames;
19398
+ needsPatch = propsBuildResult.needsPatch;
19399
+ isBlockRequired = propsBuildResult.isBlockRequired;
19281
19400
  const directives = propsBuildResult.directives;
19282
19401
  vnodeDirectives = directives && directives.length ? createArrayExpression(
19283
19402
  directives.map((dir) => buildDirectiveArgs(dir, context))
@@ -19328,7 +19447,7 @@ const transformElement = (node, context) => {
19328
19447
  if (dynamicPropNames && dynamicPropNames.length) {
19329
19448
  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
19330
19449
  }
19331
- node.codegenNode = createVNodeCall(
19450
+ const vnodeCall = node.codegenNode = createVNodeCall(
19332
19451
  context,
19333
19452
  vnodeTag,
19334
19453
  vnodeProps,
@@ -19341,6 +19460,13 @@ const transformElement = (node, context) => {
19341
19460
  isComponent,
19342
19461
  node.loc
19343
19462
  );
19463
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
19464
+ if (needsPatch) {
19465
+ vnodeCall.needsPatch = true;
19466
+ }
19467
+ if (isBlockRequired) {
19468
+ vnodeCall.isBlockRequired = true;
19469
+ }
19344
19470
  };
19345
19471
  };
19346
19472
  function resolveComponentType(node, context, ssr = false) {
@@ -19392,6 +19518,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19392
19518
  const runtimeDirectives = [];
19393
19519
  const hasChildren = children.length > 0;
19394
19520
  let shouldUseBlock = false;
19521
+ let isBlockRequired = false;
19395
19522
  let patchFlag = 0;
19396
19523
  let hasRef = false;
19397
19524
  let hasClassBinding = false;
@@ -19433,19 +19560,20 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19433
19560
  if (isEventHandler && isReservedProp(name)) {
19434
19561
  hasVnodeHook = true;
19435
19562
  }
19563
+ if (name === "ref") {
19564
+ hasRef = true;
19565
+ }
19436
19566
  if (isEventHandler && value.type === 14) {
19437
19567
  value = value.arguments[0];
19438
19568
  }
19439
19569
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
19440
19570
  return;
19441
19571
  }
19442
- if (name === "ref") {
19443
- hasRef = true;
19444
- } else if (name === "class") {
19572
+ if (name === "class") {
19445
19573
  hasClassBinding = true;
19446
19574
  } else if (name === "style") {
19447
19575
  hasStyleBinding = true;
19448
- } else if (name !== "key" && !dynamicPropNames.includes(name)) {
19576
+ } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
19449
19577
  dynamicPropNames.push(name);
19450
19578
  }
19451
19579
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
@@ -19504,13 +19632,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19504
19632
  if (isVOn && ssr) {
19505
19633
  continue;
19506
19634
  }
19507
- if (
19508
- // #938: elements with dynamic keys should be forced into blocks
19509
- isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
19510
- // before children
19511
- isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
19512
- ) {
19635
+ if (isVBind && isStaticArgOf(arg, "key")) {
19636
+ shouldUseBlock = true;
19637
+ }
19638
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
19513
19639
  shouldUseBlock = true;
19640
+ isBlockRequired = true;
19514
19641
  }
19515
19642
  if (isVBind && isStaticArgOf(arg, "ref")) {
19516
19643
  pushRefVForMarker();
@@ -19593,6 +19720,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19593
19720
  runtimeDirectives.push(prop);
19594
19721
  if (hasChildren) {
19595
19722
  shouldUseBlock = true;
19723
+ isBlockRequired = true;
19596
19724
  }
19597
19725
  }
19598
19726
  }
@@ -19631,7 +19759,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19631
19759
  patchFlag |= 32;
19632
19760
  }
19633
19761
  }
19634
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
19762
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
19763
+ if (!shouldUseBlock && needsPatch) {
19635
19764
  patchFlag |= 512;
19636
19765
  }
19637
19766
  if (!context.inSSR && propsExpression) {
@@ -19697,7 +19826,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19697
19826
  directives: runtimeDirectives,
19698
19827
  patchFlag,
19699
19828
  dynamicPropNames,
19700
- shouldUseBlock
19829
+ shouldUseBlock,
19830
+ needsPatch,
19831
+ isBlockRequired
19701
19832
  };
19702
19833
  }
19703
19834
  function dedupeProperties(properties) {