@vue/compat 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/compat v3.5.41
2
+ * @vue/compat 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) {
@@ -4805,10 +4832,10 @@ function createHydrationFunctions(rendererInternals) {
4805
4832
  getContainerType(container),
4806
4833
  optimized
4807
4834
  );
4808
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4835
+ if (isAsyncWrapper(vnode) && !vnode.component.subTree) {
4809
4836
  let subTree;
4810
4837
  if (isFragmentStart) {
4811
- subTree = createVNode(Fragment);
4838
+ subTree = createVNode(Static);
4812
4839
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4813
4840
  } else {
4814
4841
  subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
@@ -5717,7 +5744,10 @@ const KeepAliveImpl = {
5717
5744
  if (pendingCacheKey != null) {
5718
5745
  if (isSuspense(instance.subTree.type)) {
5719
5746
  queuePostRenderEffect(() => {
5720
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5747
+ const vnode = getInnerChild(instance.subTree);
5748
+ if (vnode.component) {
5749
+ cache.set(pendingCacheKey, vnode);
5750
+ }
5721
5751
  }, instance.subTree.suspense);
5722
5752
  } else {
5723
5753
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6638,12 +6668,41 @@ const getPublicInstance = (i) => {
6638
6668
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
6639
6669
  return getPublicInstance(i.parent);
6640
6670
  };
6671
+ const resolveDevRootEl = (vnode) => {
6672
+ let found = false;
6673
+ while (true) {
6674
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
6675
+ const root = filterSingleRoot(vnode.children);
6676
+ if (!root) {
6677
+ return;
6678
+ }
6679
+ vnode = root;
6680
+ found = true;
6681
+ continue;
6682
+ }
6683
+ const component = vnode.component;
6684
+ if (component && component.subTree) {
6685
+ vnode = component.subTree;
6686
+ continue;
6687
+ }
6688
+ const suspense = vnode.suspense;
6689
+ if (suspense && suspense.activeBranch) {
6690
+ vnode = suspense.activeBranch;
6691
+ continue;
6692
+ }
6693
+ return found ? vnode.el : void 0;
6694
+ }
6695
+ };
6696
+ const getDevRootFragmentEl = (i) => {
6697
+ const el = i.subTree && resolveDevRootEl(i.subTree);
6698
+ return el === void 0 ? i.vnode.el : el;
6699
+ };
6641
6700
  const publicPropertiesMap = (
6642
6701
  // Move PURE marker to new line to workaround compiler discarding it
6643
6702
  // due to type annotation
6644
6703
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
6645
6704
  $: (i) => i,
6646
- $el: (i) => i.vnode.el,
6705
+ $el: (i) => getDevRootFragmentEl(i) ,
6647
6706
  $data: (i) => i.data,
6648
6707
  $props: (i) => shallowReadonly(i.props) ,
6649
6708
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -7557,7 +7616,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7557
7616
  return vm;
7558
7617
  }
7559
7618
  }
7560
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
7619
+ Vue.version = `2.6.14-compat:${"3.5.42"}`;
7561
7620
  Vue.config = singletonApp.config;
7562
7621
  Vue.use = (plugin, ...options) => {
7563
7622
  if (plugin && isFunction(plugin.install)) {
@@ -8314,7 +8373,7 @@ function emit(instance, event, ...rawArgs) {
8314
8373
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8315
8374
  }
8316
8375
  if (modifiers.number) {
8317
- args = rawArgs.map(looseToNumber);
8376
+ args = args.map(looseToNumber);
8318
8377
  }
8319
8378
  }
8320
8379
  {
@@ -11091,7 +11150,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11091
11150
  if (suspense.deps <= 0) {
11092
11151
  suspense.resolve();
11093
11152
  } else if (isInFallback) {
11094
- if (!isHydrating) {
11153
+ if (!isHydrating && !suspense.isFallbackMountPending) {
11095
11154
  patch(
11096
11155
  activeBranch,
11097
11156
  newFallback,
@@ -11132,7 +11191,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11132
11191
  );
11133
11192
  if (suspense.deps <= 0) {
11134
11193
  suspense.resolve();
11135
- } else {
11194
+ } else if (!suspense.isFallbackMountPending) {
11136
11195
  patch(
11137
11196
  activeBranch,
11138
11197
  newFallback,
@@ -11373,9 +11432,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11373
11432
  if (!suspense.isInFallback) {
11374
11433
  return;
11375
11434
  }
11435
+ const latestFallback = suspense.vnode.ssFallback;
11376
11436
  patch(
11377
11437
  null,
11378
- fallbackVNode,
11438
+ latestFallback,
11379
11439
  container2,
11380
11440
  anchor2,
11381
11441
  parentComponent2,
@@ -11385,7 +11445,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11385
11445
  slotScopeIds,
11386
11446
  optimized
11387
11447
  );
11388
- setActiveBranch(suspense, fallbackVNode);
11448
+ setActiveBranch(suspense, latestFallback);
11389
11449
  };
11390
11450
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
11391
11451
  if (delayEnter) {
@@ -12730,7 +12790,7 @@ function isMemoSame(cached, memo) {
12730
12790
  return true;
12731
12791
  }
12732
12792
 
12733
- const version = "3.5.41";
12793
+ const version = "3.5.42";
12734
12794
  const warn = warn$1 ;
12735
12795
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12736
12796
  const devtools = devtools$1 ;
@@ -13371,7 +13431,11 @@ function setStyle(style, name, val) {
13371
13431
  }
13372
13432
  }
13373
13433
  if (name.startsWith("--")) {
13374
- style.setProperty(name, val);
13434
+ if (importantRE.test(val)) {
13435
+ style.setProperty(name, val.replace(importantRE, ""), "important");
13436
+ } else {
13437
+ style.setProperty(name, val);
13438
+ }
13375
13439
  } else {
13376
13440
  const prefixed = autoPrefix(style, name);
13377
13441
  if (importantRE.test(val)) {
@@ -14558,13 +14622,21 @@ const vModelSelect = {
14558
14622
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14559
14623
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14560
14624
  );
14561
- el[assignKey](
14562
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14563
- );
14564
- el._assigning = true;
14565
- nextTick(() => {
14566
- el._assigning = false;
14567
- });
14625
+ const multiple = el.multiple;
14626
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
14627
+ const pending = el._pendingValue = [
14628
+ multiple,
14629
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
14630
+ ];
14631
+ try {
14632
+ el[assignKey](assignedValue);
14633
+ } finally {
14634
+ nextTick(() => {
14635
+ if (el._pendingValue === pending) {
14636
+ el._pendingValue = void 0;
14637
+ }
14638
+ });
14639
+ }
14568
14640
  });
14569
14641
  el[assignKey] = getModelAssigner(vnode);
14570
14642
  },
@@ -14578,11 +14650,25 @@ const vModelSelect = {
14578
14650
  el[assignKey] = getModelAssigner(vnode);
14579
14651
  },
14580
14652
  updated(el, { value }) {
14581
- if (!el._assigning) {
14653
+ const pending = el._pendingValue;
14654
+ el._pendingValue = void 0;
14655
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
14582
14656
  setSelected(el, value);
14583
14657
  }
14584
14658
  }
14585
14659
  };
14660
+ function isSameSelectValue(value, assignedValue, multiple) {
14661
+ if (!multiple) return looseEqual(value, assignedValue);
14662
+ if (isArray(value)) return looseEqual(value, assignedValue);
14663
+ if (isSet(value)) {
14664
+ if (value.size !== assignedValue.length) return false;
14665
+ for (const item of assignedValue) {
14666
+ if (!value.has(item)) return false;
14667
+ }
14668
+ return true;
14669
+ }
14670
+ return false;
14671
+ }
14586
14672
  function setSelected(el, value) {
14587
14673
  const isMultiple = el.multiple;
14588
14674
  const isArrayValue = isArray(value);