vue 3.5.41 → 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.41
2
+ * vue v3.5.42
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -229,6 +229,23 @@ function looseCompareArrays(a, b) {
229
229
  }
230
230
  return equal;
231
231
  }
232
+ function looseCompareCollections(a, b) {
233
+ if (a.size !== b.size) return false;
234
+ const candidates = Array.from(b);
235
+ const matched = new Uint8Array(candidates.length);
236
+ for (const item of a) {
237
+ let index = -1;
238
+ for (let i = 0; i < candidates.length; i++) {
239
+ if (!matched[i] && looseEqual(item, candidates[i])) {
240
+ index = i;
241
+ break;
242
+ }
243
+ }
244
+ if (index < 0) return false;
245
+ matched[index] = 1;
246
+ }
247
+ return true;
248
+ }
232
249
  function looseEqual(a, b) {
233
250
  if (a === b) return true;
234
251
  let aValidType = isDate(a);
@@ -252,6 +269,16 @@ function looseEqual(a, b) {
252
269
  if (!aValidType || !bValidType) {
253
270
  return false;
254
271
  }
272
+ aValidType = isMap(a);
273
+ bValidType = isMap(b);
274
+ if (aValidType || bValidType) {
275
+ return aValidType && bValidType ? looseCompareCollections(a, b) : false;
276
+ }
277
+ aValidType = isSet(a);
278
+ bValidType = isSet(b);
279
+ if (aValidType || bValidType) {
280
+ return aValidType && bValidType ? looseCompareCollections(a, b) : false;
281
+ }
255
282
  const aKeysCount = Object.keys(a).length;
256
283
  const bKeysCount = Object.keys(b).length;
257
284
  if (aKeysCount !== bKeysCount) {
@@ -4333,10 +4360,10 @@ function createHydrationFunctions(rendererInternals) {
4333
4360
  getContainerType(container),
4334
4361
  optimized
4335
4362
  );
4336
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4363
+ if (isAsyncWrapper(vnode) && !vnode.component.subTree) {
4337
4364
  let subTree;
4338
4365
  if (isFragmentStart) {
4339
- subTree = createVNode(Fragment);
4366
+ subTree = createVNode(Static);
4340
4367
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4341
4368
  } else {
4342
4369
  subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
@@ -5245,7 +5272,10 @@ const KeepAliveImpl = {
5245
5272
  if (pendingCacheKey != null) {
5246
5273
  if (isSuspense(instance.subTree.type)) {
5247
5274
  queuePostRenderEffect(() => {
5248
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5275
+ const vnode = getInnerChild(instance.subTree);
5276
+ if (vnode.component) {
5277
+ cache.set(pendingCacheKey, vnode);
5278
+ }
5249
5279
  }, instance.subTree.suspense);
5250
5280
  } else {
5251
5281
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -5646,12 +5676,41 @@ const getPublicInstance = (i) => {
5646
5676
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
5647
5677
  return getPublicInstance(i.parent);
5648
5678
  };
5679
+ const resolveDevRootEl = (vnode) => {
5680
+ let found = false;
5681
+ while (true) {
5682
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
5683
+ const root = filterSingleRoot(vnode.children);
5684
+ if (!root) {
5685
+ return;
5686
+ }
5687
+ vnode = root;
5688
+ found = true;
5689
+ continue;
5690
+ }
5691
+ const component = vnode.component;
5692
+ if (component && component.subTree) {
5693
+ vnode = component.subTree;
5694
+ continue;
5695
+ }
5696
+ const suspense = vnode.suspense;
5697
+ if (suspense && suspense.activeBranch) {
5698
+ vnode = suspense.activeBranch;
5699
+ continue;
5700
+ }
5701
+ return found ? vnode.el : void 0;
5702
+ }
5703
+ };
5704
+ const getDevRootFragmentEl = (i) => {
5705
+ const el = i.subTree && resolveDevRootEl(i.subTree);
5706
+ return el === void 0 ? i.vnode.el : el;
5707
+ };
5649
5708
  const publicPropertiesMap = (
5650
5709
  // Move PURE marker to new line to workaround compiler discarding it
5651
5710
  // due to type annotation
5652
5711
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
5653
5712
  $: (i) => i,
5654
- $el: (i) => i.vnode.el,
5713
+ $el: (i) => getDevRootFragmentEl(i) ,
5655
5714
  $data: (i) => i.data,
5656
5715
  $props: (i) => shallowReadonly(i.props) ,
5657
5716
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -6754,7 +6813,7 @@ function emit(instance, event, ...rawArgs) {
6754
6813
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
6755
6814
  }
6756
6815
  if (modifiers.number) {
6757
- args = rawArgs.map(looseToNumber);
6816
+ args = args.map(looseToNumber);
6758
6817
  }
6759
6818
  }
6760
6819
  {
@@ -9397,7 +9456,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9397
9456
  if (suspense.deps <= 0) {
9398
9457
  suspense.resolve();
9399
9458
  } else if (isInFallback) {
9400
- if (!isHydrating) {
9459
+ if (!isHydrating && !suspense.isFallbackMountPending) {
9401
9460
  patch(
9402
9461
  activeBranch,
9403
9462
  newFallback,
@@ -9438,7 +9497,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9438
9497
  );
9439
9498
  if (suspense.deps <= 0) {
9440
9499
  suspense.resolve();
9441
- } else {
9500
+ } else if (!suspense.isFallbackMountPending) {
9442
9501
  patch(
9443
9502
  activeBranch,
9444
9503
  newFallback,
@@ -9679,9 +9738,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9679
9738
  if (!suspense.isInFallback) {
9680
9739
  return;
9681
9740
  }
9741
+ const latestFallback = suspense.vnode.ssFallback;
9682
9742
  patch(
9683
9743
  null,
9684
- fallbackVNode,
9744
+ latestFallback,
9685
9745
  container2,
9686
9746
  anchor2,
9687
9747
  parentComponent2,
@@ -9691,7 +9751,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9691
9751
  slotScopeIds,
9692
9752
  optimized
9693
9753
  );
9694
- setActiveBranch(suspense, fallbackVNode);
9754
+ setActiveBranch(suspense, latestFallback);
9695
9755
  };
9696
9756
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
9697
9757
  if (delayEnter) {
@@ -10957,7 +11017,7 @@ function isMemoSame(cached, memo) {
10957
11017
  return true;
10958
11018
  }
10959
11019
 
10960
- const version = "3.5.41";
11020
+ const version = "3.5.42";
10961
11021
  const warn = warn$1 ;
10962
11022
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10963
11023
  const devtools = devtools$1 ;
@@ -11554,7 +11614,11 @@ function setStyle(style, name, val) {
11554
11614
  }
11555
11615
  }
11556
11616
  if (name.startsWith("--")) {
11557
- style.setProperty(name, val);
11617
+ if (importantRE.test(val)) {
11618
+ style.setProperty(name, val.replace(importantRE, ""), "important");
11619
+ } else {
11620
+ style.setProperty(name, val);
11621
+ }
11558
11622
  } else {
11559
11623
  const prefixed = autoPrefix(style, name);
11560
11624
  if (importantRE.test(val)) {
@@ -12688,13 +12752,21 @@ const vModelSelect = {
12688
12752
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12689
12753
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12690
12754
  );
12691
- el[assignKey](
12692
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12693
- );
12694
- el._assigning = true;
12695
- nextTick(() => {
12696
- el._assigning = false;
12697
- });
12755
+ const multiple = el.multiple;
12756
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
12757
+ const pending = el._pendingValue = [
12758
+ multiple,
12759
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
12760
+ ];
12761
+ try {
12762
+ el[assignKey](assignedValue);
12763
+ } finally {
12764
+ nextTick(() => {
12765
+ if (el._pendingValue === pending) {
12766
+ el._pendingValue = void 0;
12767
+ }
12768
+ });
12769
+ }
12698
12770
  });
12699
12771
  el[assignKey] = getModelAssigner(vnode);
12700
12772
  },
@@ -12708,11 +12780,25 @@ const vModelSelect = {
12708
12780
  el[assignKey] = getModelAssigner(vnode);
12709
12781
  },
12710
12782
  updated(el, { value }) {
12711
- if (!el._assigning) {
12783
+ const pending = el._pendingValue;
12784
+ el._pendingValue = void 0;
12785
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
12712
12786
  setSelected(el, value);
12713
12787
  }
12714
12788
  }
12715
12789
  };
12790
+ function isSameSelectValue(value, assignedValue, multiple) {
12791
+ if (!multiple) return looseEqual(value, assignedValue);
12792
+ if (isArray(value)) return looseEqual(value, assignedValue);
12793
+ if (isSet(value)) {
12794
+ if (value.size !== assignedValue.length) return false;
12795
+ for (const item of assignedValue) {
12796
+ if (!value.has(item)) return false;
12797
+ }
12798
+ return true;
12799
+ }
12800
+ return false;
12801
+ }
12716
12802
  function setSelected(el, value) {
12717
12803
  const isMultiple = el.multiple;
12718
12804
  const isArrayValue = isArray(value);