vue 3.5.40 → 3.5.42

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.40
2
+ * vue v3.5.42
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.40
2
+ * vue v3.5.42
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.40
2
+ * vue v3.5.42
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 === "";
@@ -302,6 +302,23 @@ function looseCompareArrays(a, b) {
302
302
  }
303
303
  return equal;
304
304
  }
305
+ function looseCompareCollections(a, b) {
306
+ if (a.size !== b.size) return false;
307
+ const candidates = Array.from(b);
308
+ const matched = new Uint8Array(candidates.length);
309
+ for (const item of a) {
310
+ let index = -1;
311
+ for (let i = 0; i < candidates.length; i++) {
312
+ if (!matched[i] && looseEqual(item, candidates[i])) {
313
+ index = i;
314
+ break;
315
+ }
316
+ }
317
+ if (index < 0) return false;
318
+ matched[index] = 1;
319
+ }
320
+ return true;
321
+ }
305
322
  function looseEqual(a, b) {
306
323
  if (a === b) return true;
307
324
  let aValidType = isDate(a);
@@ -325,6 +342,16 @@ function looseEqual(a, b) {
325
342
  if (!aValidType || !bValidType) {
326
343
  return false;
327
344
  }
345
+ aValidType = isMap(a);
346
+ bValidType = isMap(b);
347
+ if (aValidType || bValidType) {
348
+ return aValidType && bValidType ? looseCompareCollections(a, b) : false;
349
+ }
350
+ aValidType = isSet(a);
351
+ bValidType = isSet(b);
352
+ if (aValidType || bValidType) {
353
+ return aValidType && bValidType ? looseCompareCollections(a, b) : false;
354
+ }
328
355
  const aKeysCount = Object.keys(a).length;
329
356
  const bKeysCount = Object.keys(b).length;
330
357
  if (aKeysCount !== bKeysCount) {
@@ -2670,7 +2697,9 @@ function queuePostFlushCb(cb) {
2670
2697
  cb.flags |= 1;
2671
2698
  }
2672
2699
  } else {
2673
- pendingPostFlushCbs.push(...cb);
2700
+ for (let i = 0; i < cb.length; i++) {
2701
+ pendingPostFlushCbs.push(cb[i]);
2702
+ }
2674
2703
  }
2675
2704
  queueFlush();
2676
2705
  }
@@ -2706,7 +2735,9 @@ function flushPostFlushCbs(seen) {
2706
2735
  );
2707
2736
  pendingPostFlushCbs.length = 0;
2708
2737
  if (activePostFlushCbs) {
2709
- activePostFlushCbs.push(...deduped);
2738
+ for (let i = 0; i < deduped.length; i++) {
2739
+ activePostFlushCbs.push(deduped[i]);
2740
+ }
2710
2741
  return;
2711
2742
  }
2712
2743
  activePostFlushCbs = deduped;
@@ -3995,7 +4026,11 @@ function getInnerChild$1(vnode) {
3995
4026
  function setTransitionHooks(vnode, hooks) {
3996
4027
  if (vnode.shapeFlag & 6 && vnode.component) {
3997
4028
  vnode.transition = hooks;
3998
- setTransitionHooks(vnode.component.subTree, hooks);
4029
+ const subTree = vnode.component.subTree;
4030
+ setTransitionHooks(
4031
+ isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
4032
+ hooks
4033
+ );
3999
4034
  } else if (vnode.shapeFlag & 128) {
4000
4035
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4001
4036
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -4398,10 +4433,10 @@ function createHydrationFunctions(rendererInternals) {
4398
4433
  getContainerType(container),
4399
4434
  optimized
4400
4435
  );
4401
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4436
+ if (isAsyncWrapper(vnode) && !vnode.component.subTree) {
4402
4437
  let subTree;
4403
4438
  if (isFragmentStart) {
4404
- subTree = createVNode(Fragment);
4439
+ subTree = createVNode(Static);
4405
4440
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4406
4441
  } else {
4407
4442
  subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
@@ -4535,6 +4570,9 @@ Server rendered element contains more child nodes than client vdom.`
4535
4570
  }
4536
4571
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4537
4572
  key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4573
+ if (isUnchangedResourceProp(el, key, props[key])) {
4574
+ continue;
4575
+ }
4538
4576
  patchProp(el, key, null, props[key], namespace, parentComponent);
4539
4577
  }
4540
4578
  }
@@ -4717,6 +4755,13 @@ Server rendered element contains fewer child nodes than client vdom.`
4717
4755
  };
4718
4756
  return [hydrate, hydrateNode];
4719
4757
  }
4758
+ const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
4759
+ function isUnchangedResourceProp(el, key, clientValue) {
4760
+ if (!resourceProps.has(key)) {
4761
+ return false;
4762
+ }
4763
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
4764
+ }
4720
4765
  function propHasMismatch(el, key, clientValue, vnode, instance) {
4721
4766
  let mismatchType;
4722
4767
  let mismatchKey;
@@ -4754,7 +4799,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4754
4799
  mismatchKey = "style";
4755
4800
  }
4756
4801
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
4757
- if (isBooleanAttr(key)) {
4802
+ if (key === "hidden") {
4803
+ actual = normalizeHiddenValue(el.getAttribute(key));
4804
+ expected = normalizeHiddenValue(clientValue);
4805
+ } else if (isBooleanAttr(key)) {
4758
4806
  actual = el.hasAttribute(key);
4759
4807
  expected = includeBooleanAttr(clientValue);
4760
4808
  } else if (clientValue == null) {
@@ -4790,6 +4838,15 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4790
4838
  }
4791
4839
  return false;
4792
4840
  }
4841
+ function normalizeHiddenValue(value) {
4842
+ if (!isRenderableAttrValue(value)) {
4843
+ return false;
4844
+ }
4845
+ if (isString(value)) {
4846
+ return value.toLowerCase() === "until-found" ? "until-found" : "";
4847
+ }
4848
+ return includeBooleanAttr(value) ? "" : false;
4849
+ }
4793
4850
  function toClassSet(str) {
4794
4851
  return new Set(str.trim().split(/\s+/));
4795
4852
  }
@@ -5288,7 +5345,10 @@ const KeepAliveImpl = {
5288
5345
  if (pendingCacheKey != null) {
5289
5346
  if (isSuspense(instance.subTree.type)) {
5290
5347
  queuePostRenderEffect(() => {
5291
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5348
+ const vnode = getInnerChild(instance.subTree);
5349
+ if (vnode.component) {
5350
+ cache.set(pendingCacheKey, vnode);
5351
+ }
5292
5352
  }, instance.subTree.suspense);
5293
5353
  } else {
5294
5354
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -5609,7 +5669,8 @@ function createSlots(slots, dynamicSlots) {
5609
5669
  return slots;
5610
5670
  }
5611
5671
 
5612
- function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
5672
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
5673
+ if (props == null) props = {};
5613
5674
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5614
5675
  const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
5615
5676
  const hasProps = Object.keys(slotProps).length > 0;
@@ -5688,12 +5749,41 @@ const getPublicInstance = (i) => {
5688
5749
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
5689
5750
  return getPublicInstance(i.parent);
5690
5751
  };
5752
+ const resolveDevRootEl = (vnode) => {
5753
+ let found = false;
5754
+ while (true) {
5755
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
5756
+ const root = filterSingleRoot(vnode.children);
5757
+ if (!root) {
5758
+ return;
5759
+ }
5760
+ vnode = root;
5761
+ found = true;
5762
+ continue;
5763
+ }
5764
+ const component = vnode.component;
5765
+ if (component && component.subTree) {
5766
+ vnode = component.subTree;
5767
+ continue;
5768
+ }
5769
+ const suspense = vnode.suspense;
5770
+ if (suspense && suspense.activeBranch) {
5771
+ vnode = suspense.activeBranch;
5772
+ continue;
5773
+ }
5774
+ return found ? vnode.el : void 0;
5775
+ }
5776
+ };
5777
+ const getDevRootFragmentEl = (i) => {
5778
+ const el = i.subTree && resolveDevRootEl(i.subTree);
5779
+ return el === void 0 ? i.vnode.el : el;
5780
+ };
5691
5781
  const publicPropertiesMap = (
5692
5782
  // Move PURE marker to new line to workaround compiler discarding it
5693
5783
  // due to type annotation
5694
5784
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
5695
5785
  $: (i) => i,
5696
- $el: (i) => i.vnode.el,
5786
+ $el: (i) => getDevRootFragmentEl(i) ,
5697
5787
  $data: (i) => i.data,
5698
5788
  $props: (i) => shallowReadonly(i.props) ,
5699
5789
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -6796,7 +6886,7 @@ function emit(instance, event, ...rawArgs) {
6796
6886
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
6797
6887
  }
6798
6888
  if (modifiers.number) {
6799
- args = rawArgs.map(looseToNumber);
6889
+ args = args.map(looseToNumber);
6800
6890
  }
6801
6891
  }
6802
6892
  {
@@ -7033,12 +7123,13 @@ function renderComponentRoot(instance) {
7033
7123
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
7034
7124
  }
7035
7125
  if (vnode.transition) {
7036
- if (!isElementRoot(root)) {
7126
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
7127
+ if (!isElementRoot(child)) {
7037
7128
  warn$1(
7038
7129
  `Component inside <Transition> renders non-element root node that cannot be animated.`
7039
7130
  );
7040
7131
  }
7041
- setTransitionHooks(root, vnode.transition);
7132
+ setTransitionHooks(child, vnode.transition);
7042
7133
  }
7043
7134
  if (setRoot) {
7044
7135
  setRoot(root);
@@ -9438,7 +9529,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9438
9529
  if (suspense.deps <= 0) {
9439
9530
  suspense.resolve();
9440
9531
  } else if (isInFallback) {
9441
- if (!isHydrating) {
9532
+ if (!isHydrating && !suspense.isFallbackMountPending) {
9442
9533
  patch(
9443
9534
  activeBranch,
9444
9535
  newFallback,
@@ -9479,7 +9570,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9479
9570
  );
9480
9571
  if (suspense.deps <= 0) {
9481
9572
  suspense.resolve();
9482
- } else {
9573
+ } else if (!suspense.isFallbackMountPending) {
9483
9574
  patch(
9484
9575
  activeBranch,
9485
9576
  newFallback,
@@ -9686,7 +9777,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9686
9777
  let hasUnresolvedAncestor = false;
9687
9778
  while (parent) {
9688
9779
  if (parent.pendingBranch) {
9689
- parent.effects.push(...effects);
9780
+ for (let i = 0; i < effects.length; i++) {
9781
+ parent.effects.push(effects[i]);
9782
+ }
9690
9783
  hasUnresolvedAncestor = true;
9691
9784
  break;
9692
9785
  }
@@ -9718,9 +9811,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9718
9811
  if (!suspense.isInFallback) {
9719
9812
  return;
9720
9813
  }
9814
+ const latestFallback = suspense.vnode.ssFallback;
9721
9815
  patch(
9722
9816
  null,
9723
- fallbackVNode,
9817
+ latestFallback,
9724
9818
  container2,
9725
9819
  anchor2,
9726
9820
  parentComponent2,
@@ -9730,7 +9824,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9730
9824
  slotScopeIds,
9731
9825
  optimized
9732
9826
  );
9733
- setActiveBranch(suspense, fallbackVNode);
9827
+ setActiveBranch(suspense, latestFallback);
9734
9828
  };
9735
9829
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
9736
9830
  if (delayEnter) {
@@ -10051,6 +10145,14 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
10051
10145
  if (vnode.key !== vnode.key) {
10052
10146
  warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
10053
10147
  }
10148
+ if (props && vnode.shapeFlag & 1) {
10149
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
10150
+ if (overwritingProp && hasContentChildren(vnode.children)) {
10151
+ warn$1(
10152
+ `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
10153
+ );
10154
+ }
10155
+ }
10054
10156
  if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
10055
10157
  !isBlockNode && // has current parent block
10056
10158
  currentBlock && // presence of a patch flag indicates this node needs patching on updates.
@@ -10064,6 +10166,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
10064
10166
  }
10065
10167
  return vnode;
10066
10168
  }
10169
+ function hasContentChildren(children) {
10170
+ if (isString(children)) return children !== "";
10171
+ if (isArray(children)) return children.length > 0;
10172
+ return false;
10173
+ }
10067
10174
  const createVNode = createVNodeWithArgsTransform ;
10068
10175
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
10069
10176
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -10512,7 +10619,12 @@ function setupStatefulComponent(instance, isSSR) {
10512
10619
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10513
10620
  if (isSSR) {
10514
10621
  return setupResult.then((resolvedResult) => {
10515
- handleSetupResult(instance, resolvedResult, isSSR);
10622
+ setInSSRSetupState(true);
10623
+ try {
10624
+ handleSetupResult(instance, resolvedResult, isSSR);
10625
+ } finally {
10626
+ setInSSRSetupState(false);
10627
+ }
10516
10628
  }).catch((e) => {
10517
10629
  handleError(e, instance, 0);
10518
10630
  });
@@ -10978,7 +11090,7 @@ function isMemoSame(cached, memo) {
10978
11090
  return true;
10979
11091
  }
10980
11092
 
10981
- const version = "3.5.40";
11093
+ const version = "3.5.42";
10982
11094
  const warn = warn$1 ;
10983
11095
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10984
11096
  const devtools = devtools$1 ;
@@ -11575,7 +11687,11 @@ function setStyle(style, name, val) {
11575
11687
  }
11576
11688
  }
11577
11689
  if (name.startsWith("--")) {
11578
- style.setProperty(name, val);
11690
+ if (importantRE.test(val)) {
11691
+ style.setProperty(name, val.replace(importantRE, ""), "important");
11692
+ } else {
11693
+ style.setProperty(name, val);
11694
+ }
11579
11695
  } else {
11580
11696
  const prefixed = autoPrefix(style, name);
11581
11697
  if (importantRE.test(val)) {
@@ -11948,7 +12064,9 @@ class VueElement extends BaseClass {
11948
12064
  if (parent && parent._pendingResolve) {
11949
12065
  this._pendingResolve = parent._pendingResolve.then(() => {
11950
12066
  this._pendingResolve = void 0;
11951
- this._resolveDef();
12067
+ if (this.isConnected) {
12068
+ return this._resolveDef();
12069
+ }
11952
12070
  });
11953
12071
  } else {
11954
12072
  this._resolveDef();
@@ -11998,7 +12116,7 @@ class VueElement extends BaseClass {
11998
12116
  */
11999
12117
  _resolveDef() {
12000
12118
  if (this._pendingResolve) {
12001
- return;
12119
+ return this._pendingResolve;
12002
12120
  }
12003
12121
  for (let i = 0; i < this.attributes.length; i++) {
12004
12122
  this._setAttr(this.attributes[i].name);
@@ -12038,6 +12156,7 @@ class VueElement extends BaseClass {
12038
12156
  def.configureApp = this._def.configureApp;
12039
12157
  resolve(this._def = def, true);
12040
12158
  });
12159
+ return this._pendingResolve;
12041
12160
  } else {
12042
12161
  resolve(this._def);
12043
12162
  }
@@ -12075,6 +12194,11 @@ class VueElement extends BaseClass {
12075
12194
  }
12076
12195
  }
12077
12196
  for (const key of declaredPropKeys.map(camelize)) {
12197
+ if (key in Object.getPrototypeOf(this)) {
12198
+ warn(
12199
+ `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
12200
+ );
12201
+ }
12078
12202
  Object.defineProperty(this, key, {
12079
12203
  get() {
12080
12204
  return this._getProp(key);
@@ -12559,6 +12683,7 @@ function onCompositionEnd(e) {
12559
12683
  }
12560
12684
  }
12561
12685
  const assignKey = /* @__PURE__ */ Symbol("_assign");
12686
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
12562
12687
  function castValue(value, trim, number) {
12563
12688
  if (trim) value = value.trim();
12564
12689
  if (number) value = looseToNumber(value);
@@ -12566,6 +12691,13 @@ function castValue(value, trim, number) {
12566
12691
  }
12567
12692
  const vModelText = {
12568
12693
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
12694
+ if (el.parentNode) {
12695
+ if (el.type === "text") {
12696
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
12697
+ } else if (el.type === "textarea") {
12698
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
12699
+ }
12700
+ }
12569
12701
  el[assignKey] = getModelAssigner(vnode);
12570
12702
  const castToNumber = number || vnode.props && vnode.props.type === "number";
12571
12703
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -12584,8 +12716,15 @@ const vModelText = {
12584
12716
  }
12585
12717
  },
12586
12718
  // set value on mounted so it's after min/max for type="range"
12587
- mounted(el, { value }) {
12588
- el.value = value == null ? "" : value;
12719
+ mounted(el, { value, modifiers: { trim, number } }) {
12720
+ const newValue = value == null ? "" : value;
12721
+ const initialValue = el[initialValueKey];
12722
+ delete el[initialValueKey];
12723
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
12724
+ el[assignKey](castValue(el.value, trim, number));
12725
+ } else {
12726
+ el.value = newValue;
12727
+ }
12589
12728
  },
12590
12729
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
12591
12730
  el[assignKey] = getModelAssigner(vnode);
@@ -12686,13 +12825,21 @@ const vModelSelect = {
12686
12825
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12687
12826
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12688
12827
  );
12689
- el[assignKey](
12690
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12691
- );
12692
- el._assigning = true;
12693
- nextTick(() => {
12694
- el._assigning = false;
12695
- });
12828
+ const multiple = el.multiple;
12829
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
12830
+ const pending = el._pendingValue = [
12831
+ multiple,
12832
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
12833
+ ];
12834
+ try {
12835
+ el[assignKey](assignedValue);
12836
+ } finally {
12837
+ nextTick(() => {
12838
+ if (el._pendingValue === pending) {
12839
+ el._pendingValue = void 0;
12840
+ }
12841
+ });
12842
+ }
12696
12843
  });
12697
12844
  el[assignKey] = getModelAssigner(vnode);
12698
12845
  },
@@ -12706,11 +12853,25 @@ const vModelSelect = {
12706
12853
  el[assignKey] = getModelAssigner(vnode);
12707
12854
  },
12708
12855
  updated(el, { value }) {
12709
- if (!el._assigning) {
12856
+ const pending = el._pendingValue;
12857
+ el._pendingValue = void 0;
12858
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
12710
12859
  setSelected(el, value);
12711
12860
  }
12712
12861
  }
12713
12862
  };
12863
+ function isSameSelectValue(value, assignedValue, multiple) {
12864
+ if (!multiple) return looseEqual(value, assignedValue);
12865
+ if (isArray(value)) return looseEqual(value, assignedValue);
12866
+ if (isSet(value)) {
12867
+ if (value.size !== assignedValue.length) return false;
12868
+ for (const item of assignedValue) {
12869
+ if (!value.has(item)) return false;
12870
+ }
12871
+ return true;
12872
+ }
12873
+ return false;
12874
+ }
12714
12875
  function setSelected(el, value) {
12715
12876
  const isMultiple = el.multiple;
12716
12877
  const isArrayValue = isArray(value);
@@ -16753,6 +16914,7 @@ const transformFor = createStructuralDirectiveTransform(
16753
16914
  node.loc
16754
16915
  );
16755
16916
  return () => {
16917
+ var _a;
16756
16918
  let childBlock;
16757
16919
  const { children } = forNode;
16758
16920
  if (isTemplate) {
@@ -16796,7 +16958,8 @@ const transformFor = createStructuralDirectiveTransform(
16796
16958
  if (isTemplate && keyProperty) {
16797
16959
  injectProp(childBlock, keyProperty, context);
16798
16960
  }
16799
- if (childBlock.isBlock !== !isStableFragment) {
16961
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
16962
+ if (childBlock.isBlock !== shouldUseBlock) {
16800
16963
  if (childBlock.isBlock) {
16801
16964
  removeHelper(OPEN_BLOCK);
16802
16965
  removeHelper(
@@ -16808,12 +16971,15 @@ const transformFor = createStructuralDirectiveTransform(
16808
16971
  );
16809
16972
  }
16810
16973
  }
16811
- childBlock.isBlock = !isStableFragment;
16974
+ childBlock.isBlock = shouldUseBlock;
16812
16975
  if (childBlock.isBlock) {
16813
16976
  helper(OPEN_BLOCK);
16814
16977
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
16815
16978
  } else {
16816
16979
  helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
16980
+ if (childBlock.needsPatch) {
16981
+ childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
16982
+ }
16817
16983
  }
16818
16984
  }
16819
16985
  if (memo) {
@@ -17189,6 +17355,8 @@ const transformElement = (node, context) => {
17189
17355
  let vnodeDynamicProps;
17190
17356
  let dynamicPropNames;
17191
17357
  let vnodeDirectives;
17358
+ let needsPatch = false;
17359
+ let isBlockRequired = false;
17192
17360
  let shouldUseBlock = (
17193
17361
  // dynamic component may resolve to plain elements
17194
17362
  isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
@@ -17208,6 +17376,8 @@ const transformElement = (node, context) => {
17208
17376
  vnodeProps = propsBuildResult.props;
17209
17377
  patchFlag = propsBuildResult.patchFlag;
17210
17378
  dynamicPropNames = propsBuildResult.dynamicPropNames;
17379
+ needsPatch = propsBuildResult.needsPatch;
17380
+ isBlockRequired = propsBuildResult.isBlockRequired;
17211
17381
  const directives = propsBuildResult.directives;
17212
17382
  vnodeDirectives = directives && directives.length ? createArrayExpression(
17213
17383
  directives.map((dir) => buildDirectiveArgs(dir, context))
@@ -17258,7 +17428,7 @@ const transformElement = (node, context) => {
17258
17428
  if (dynamicPropNames && dynamicPropNames.length) {
17259
17429
  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
17260
17430
  }
17261
- node.codegenNode = createVNodeCall(
17431
+ const vnodeCall = node.codegenNode = createVNodeCall(
17262
17432
  context,
17263
17433
  vnodeTag,
17264
17434
  vnodeProps,
@@ -17271,6 +17441,13 @@ const transformElement = (node, context) => {
17271
17441
  isComponent,
17272
17442
  node.loc
17273
17443
  );
17444
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
17445
+ if (needsPatch) {
17446
+ vnodeCall.needsPatch = true;
17447
+ }
17448
+ if (isBlockRequired) {
17449
+ vnodeCall.isBlockRequired = true;
17450
+ }
17274
17451
  };
17275
17452
  };
17276
17453
  function resolveComponentType(node, context, ssr = false) {
@@ -17319,6 +17496,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17319
17496
  const runtimeDirectives = [];
17320
17497
  const hasChildren = children.length > 0;
17321
17498
  let shouldUseBlock = false;
17499
+ let isBlockRequired = false;
17322
17500
  let patchFlag = 0;
17323
17501
  let hasRef = false;
17324
17502
  let hasClassBinding = false;
@@ -17360,19 +17538,20 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17360
17538
  if (isEventHandler && isReservedProp(name)) {
17361
17539
  hasVnodeHook = true;
17362
17540
  }
17541
+ if (name === "ref") {
17542
+ hasRef = true;
17543
+ }
17363
17544
  if (isEventHandler && value.type === 14) {
17364
17545
  value = value.arguments[0];
17365
17546
  }
17366
17547
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
17367
17548
  return;
17368
17549
  }
17369
- if (name === "ref") {
17370
- hasRef = true;
17371
- } else if (name === "class") {
17550
+ if (name === "class") {
17372
17551
  hasClassBinding = true;
17373
17552
  } else if (name === "style") {
17374
17553
  hasStyleBinding = true;
17375
- } else if (name !== "key" && !dynamicPropNames.includes(name)) {
17554
+ } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
17376
17555
  dynamicPropNames.push(name);
17377
17556
  }
17378
17557
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
@@ -17425,13 +17604,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17425
17604
  if (isVOn && ssr) {
17426
17605
  continue;
17427
17606
  }
17428
- if (
17429
- // #938: elements with dynamic keys should be forced into blocks
17430
- isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
17431
- // before children
17432
- isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
17433
- ) {
17607
+ if (isVBind && isStaticArgOf(arg, "key")) {
17608
+ shouldUseBlock = true;
17609
+ }
17610
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
17434
17611
  shouldUseBlock = true;
17612
+ isBlockRequired = true;
17435
17613
  }
17436
17614
  if (isVBind && isStaticArgOf(arg, "ref")) {
17437
17615
  pushRefVForMarker();
@@ -17483,6 +17661,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17483
17661
  runtimeDirectives.push(prop);
17484
17662
  if (hasChildren) {
17485
17663
  shouldUseBlock = true;
17664
+ isBlockRequired = true;
17486
17665
  }
17487
17666
  }
17488
17667
  }
@@ -17521,7 +17700,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17521
17700
  patchFlag |= 32;
17522
17701
  }
17523
17702
  }
17524
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
17703
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
17704
+ if (!shouldUseBlock && needsPatch) {
17525
17705
  patchFlag |= 512;
17526
17706
  }
17527
17707
  if (!context.inSSR && propsExpression) {
@@ -17587,7 +17767,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17587
17767
  directives: runtimeDirectives,
17588
17768
  patchFlag,
17589
17769
  dynamicPropNames,
17590
- shouldUseBlock
17770
+ shouldUseBlock,
17771
+ needsPatch,
17772
+ isBlockRequired
17591
17773
  };
17592
17774
  }
17593
17775
  function dedupeProperties(properties) {