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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -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
  **/
@@ -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
  **/
@@ -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) {
@@ -4406,10 +4433,10 @@ function createHydrationFunctions(rendererInternals) {
4406
4433
  getContainerType(container),
4407
4434
  optimized
4408
4435
  );
4409
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4436
+ if (isAsyncWrapper(vnode) && !vnode.component.subTree) {
4410
4437
  let subTree;
4411
4438
  if (isFragmentStart) {
4412
- subTree = createVNode(Fragment);
4439
+ subTree = createVNode(Static);
4413
4440
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4414
4441
  } else {
4415
4442
  subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
@@ -5318,7 +5345,10 @@ const KeepAliveImpl = {
5318
5345
  if (pendingCacheKey != null) {
5319
5346
  if (isSuspense(instance.subTree.type)) {
5320
5347
  queuePostRenderEffect(() => {
5321
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5348
+ const vnode = getInnerChild(instance.subTree);
5349
+ if (vnode.component) {
5350
+ cache.set(pendingCacheKey, vnode);
5351
+ }
5322
5352
  }, instance.subTree.suspense);
5323
5353
  } else {
5324
5354
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -5719,12 +5749,41 @@ const getPublicInstance = (i) => {
5719
5749
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
5720
5750
  return getPublicInstance(i.parent);
5721
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
+ };
5722
5781
  const publicPropertiesMap = (
5723
5782
  // Move PURE marker to new line to workaround compiler discarding it
5724
5783
  // due to type annotation
5725
5784
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
5726
5785
  $: (i) => i,
5727
- $el: (i) => i.vnode.el,
5786
+ $el: (i) => getDevRootFragmentEl(i) ,
5728
5787
  $data: (i) => i.data,
5729
5788
  $props: (i) => shallowReadonly(i.props) ,
5730
5789
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -6827,7 +6886,7 @@ function emit(instance, event, ...rawArgs) {
6827
6886
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
6828
6887
  }
6829
6888
  if (modifiers.number) {
6830
- args = rawArgs.map(looseToNumber);
6889
+ args = args.map(looseToNumber);
6831
6890
  }
6832
6891
  }
6833
6892
  {
@@ -9470,7 +9529,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9470
9529
  if (suspense.deps <= 0) {
9471
9530
  suspense.resolve();
9472
9531
  } else if (isInFallback) {
9473
- if (!isHydrating) {
9532
+ if (!isHydrating && !suspense.isFallbackMountPending) {
9474
9533
  patch(
9475
9534
  activeBranch,
9476
9535
  newFallback,
@@ -9511,7 +9570,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9511
9570
  );
9512
9571
  if (suspense.deps <= 0) {
9513
9572
  suspense.resolve();
9514
- } else {
9573
+ } else if (!suspense.isFallbackMountPending) {
9515
9574
  patch(
9516
9575
  activeBranch,
9517
9576
  newFallback,
@@ -9752,9 +9811,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9752
9811
  if (!suspense.isInFallback) {
9753
9812
  return;
9754
9813
  }
9814
+ const latestFallback = suspense.vnode.ssFallback;
9755
9815
  patch(
9756
9816
  null,
9757
- fallbackVNode,
9817
+ latestFallback,
9758
9818
  container2,
9759
9819
  anchor2,
9760
9820
  parentComponent2,
@@ -9764,7 +9824,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9764
9824
  slotScopeIds,
9765
9825
  optimized
9766
9826
  );
9767
- setActiveBranch(suspense, fallbackVNode);
9827
+ setActiveBranch(suspense, latestFallback);
9768
9828
  };
9769
9829
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
9770
9830
  if (delayEnter) {
@@ -11030,7 +11090,7 @@ function isMemoSame(cached, memo) {
11030
11090
  return true;
11031
11091
  }
11032
11092
 
11033
- const version = "3.5.41";
11093
+ const version = "3.5.42";
11034
11094
  const warn = warn$1 ;
11035
11095
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11036
11096
  const devtools = devtools$1 ;
@@ -11627,7 +11687,11 @@ function setStyle(style, name, val) {
11627
11687
  }
11628
11688
  }
11629
11689
  if (name.startsWith("--")) {
11630
- 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
+ }
11631
11695
  } else {
11632
11696
  const prefixed = autoPrefix(style, name);
11633
11697
  if (importantRE.test(val)) {
@@ -12761,13 +12825,21 @@ const vModelSelect = {
12761
12825
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12762
12826
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12763
12827
  );
12764
- el[assignKey](
12765
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12766
- );
12767
- el._assigning = true;
12768
- nextTick(() => {
12769
- el._assigning = false;
12770
- });
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
+ }
12771
12843
  });
12772
12844
  el[assignKey] = getModelAssigner(vnode);
12773
12845
  },
@@ -12781,11 +12853,25 @@ const vModelSelect = {
12781
12853
  el[assignKey] = getModelAssigner(vnode);
12782
12854
  },
12783
12855
  updated(el, { value }) {
12784
- 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])) {
12785
12859
  setSelected(el, value);
12786
12860
  }
12787
12861
  }
12788
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
+ }
12789
12875
  function setSelected(el, value) {
12790
12876
  const isMultiple = el.multiple;
12791
12877
  const isArrayValue = isArray(value);