@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
  **/
@@ -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) {
@@ -4897,10 +4924,10 @@ function createHydrationFunctions(rendererInternals) {
4897
4924
  getContainerType(container),
4898
4925
  optimized
4899
4926
  );
4900
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4927
+ if (isAsyncWrapper(vnode) && !vnode.component.subTree) {
4901
4928
  let subTree;
4902
4929
  if (isFragmentStart) {
4903
- subTree = createVNode(Fragment);
4930
+ subTree = createVNode(Static);
4904
4931
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4905
4932
  } else {
4906
4933
  subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
@@ -5821,7 +5848,10 @@ const KeepAliveImpl = {
5821
5848
  if (pendingCacheKey != null) {
5822
5849
  if (isSuspense(instance.subTree.type)) {
5823
5850
  queuePostRenderEffect(() => {
5824
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5851
+ const vnode = getInnerChild(instance.subTree);
5852
+ if (vnode.component) {
5853
+ cache.set(pendingCacheKey, vnode);
5854
+ }
5825
5855
  }, instance.subTree.suspense);
5826
5856
  } else {
5827
5857
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6742,12 +6772,41 @@ const getPublicInstance = (i) => {
6742
6772
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
6743
6773
  return getPublicInstance(i.parent);
6744
6774
  };
6775
+ const resolveDevRootEl = (vnode) => {
6776
+ let found = false;
6777
+ while (true) {
6778
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
6779
+ const root = filterSingleRoot(vnode.children);
6780
+ if (!root) {
6781
+ return;
6782
+ }
6783
+ vnode = root;
6784
+ found = true;
6785
+ continue;
6786
+ }
6787
+ const component = vnode.component;
6788
+ if (component && component.subTree) {
6789
+ vnode = component.subTree;
6790
+ continue;
6791
+ }
6792
+ const suspense = vnode.suspense;
6793
+ if (suspense && suspense.activeBranch) {
6794
+ vnode = suspense.activeBranch;
6795
+ continue;
6796
+ }
6797
+ return found ? vnode.el : void 0;
6798
+ }
6799
+ };
6800
+ const getDevRootFragmentEl = (i) => {
6801
+ const el = i.subTree && resolveDevRootEl(i.subTree);
6802
+ return el === void 0 ? i.vnode.el : el;
6803
+ };
6745
6804
  const publicPropertiesMap = (
6746
6805
  // Move PURE marker to new line to workaround compiler discarding it
6747
6806
  // due to type annotation
6748
6807
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
6749
6808
  $: (i) => i,
6750
- $el: (i) => i.vnode.el,
6809
+ $el: (i) => !!(process.env.NODE_ENV !== "production") ? getDevRootFragmentEl(i) : i.vnode.el,
6751
6810
  $data: (i) => i.data,
6752
6811
  $props: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.props) : i.props,
6753
6812
  $attrs: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.attrs) : i.attrs,
@@ -7663,7 +7722,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7663
7722
  return vm;
7664
7723
  }
7665
7724
  }
7666
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
7725
+ Vue.version = `2.6.14-compat:${"3.5.42"}`;
7667
7726
  Vue.config = singletonApp.config;
7668
7727
  Vue.use = (plugin, ...options) => {
7669
7728
  if (plugin && isFunction(plugin.install)) {
@@ -8422,7 +8481,7 @@ function emit(instance, event, ...rawArgs) {
8422
8481
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8423
8482
  }
8424
8483
  if (modifiers.number) {
8425
- args = rawArgs.map(looseToNumber);
8484
+ args = args.map(looseToNumber);
8426
8485
  }
8427
8486
  }
8428
8487
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
@@ -11237,7 +11296,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11237
11296
  if (suspense.deps <= 0) {
11238
11297
  suspense.resolve();
11239
11298
  } else if (isInFallback) {
11240
- if (!isHydrating) {
11299
+ if (!isHydrating && !suspense.isFallbackMountPending) {
11241
11300
  patch(
11242
11301
  activeBranch,
11243
11302
  newFallback,
@@ -11278,7 +11337,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11278
11337
  );
11279
11338
  if (suspense.deps <= 0) {
11280
11339
  suspense.resolve();
11281
- } else {
11340
+ } else if (!suspense.isFallbackMountPending) {
11282
11341
  patch(
11283
11342
  activeBranch,
11284
11343
  newFallback,
@@ -11519,9 +11578,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11519
11578
  if (!suspense.isInFallback) {
11520
11579
  return;
11521
11580
  }
11581
+ const latestFallback = suspense.vnode.ssFallback;
11522
11582
  patch(
11523
11583
  null,
11524
- fallbackVNode,
11584
+ latestFallback,
11525
11585
  container2,
11526
11586
  anchor2,
11527
11587
  parentComponent2,
@@ -11531,7 +11591,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11531
11591
  slotScopeIds,
11532
11592
  optimized
11533
11593
  );
11534
- setActiveBranch(suspense, fallbackVNode);
11594
+ setActiveBranch(suspense, latestFallback);
11535
11595
  };
11536
11596
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
11537
11597
  if (delayEnter) {
@@ -12890,7 +12950,7 @@ function isMemoSame(cached, memo) {
12890
12950
  return true;
12891
12951
  }
12892
12952
 
12893
- const version = "3.5.41";
12953
+ const version = "3.5.42";
12894
12954
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12895
12955
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12896
12956
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13531,7 +13591,11 @@ function setStyle(style, name, val) {
13531
13591
  }
13532
13592
  }
13533
13593
  if (name.startsWith("--")) {
13534
- style.setProperty(name, val);
13594
+ if (importantRE.test(val)) {
13595
+ style.setProperty(name, val.replace(importantRE, ""), "important");
13596
+ } else {
13597
+ style.setProperty(name, val);
13598
+ }
13535
13599
  } else {
13536
13600
  const prefixed = autoPrefix(style, name);
13537
13601
  if (importantRE.test(val)) {
@@ -14718,13 +14782,21 @@ const vModelSelect = {
14718
14782
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14719
14783
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14720
14784
  );
14721
- el[assignKey](
14722
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14723
- );
14724
- el._assigning = true;
14725
- nextTick(() => {
14726
- el._assigning = false;
14727
- });
14785
+ const multiple = el.multiple;
14786
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
14787
+ const pending = el._pendingValue = [
14788
+ multiple,
14789
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
14790
+ ];
14791
+ try {
14792
+ el[assignKey](assignedValue);
14793
+ } finally {
14794
+ nextTick(() => {
14795
+ if (el._pendingValue === pending) {
14796
+ el._pendingValue = void 0;
14797
+ }
14798
+ });
14799
+ }
14728
14800
  });
14729
14801
  el[assignKey] = getModelAssigner(vnode);
14730
14802
  },
@@ -14738,11 +14810,25 @@ const vModelSelect = {
14738
14810
  el[assignKey] = getModelAssigner(vnode);
14739
14811
  },
14740
14812
  updated(el, { value }) {
14741
- if (!el._assigning) {
14813
+ const pending = el._pendingValue;
14814
+ el._pendingValue = void 0;
14815
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
14742
14816
  setSelected(el, value);
14743
14817
  }
14744
14818
  }
14745
14819
  };
14820
+ function isSameSelectValue(value, assignedValue, multiple) {
14821
+ if (!multiple) return looseEqual(value, assignedValue);
14822
+ if (isArray(value)) return looseEqual(value, assignedValue);
14823
+ if (isSet(value)) {
14824
+ if (value.size !== assignedValue.length) return false;
14825
+ for (const item of assignedValue) {
14826
+ if (!value.has(item)) return false;
14827
+ }
14828
+ return true;
14829
+ }
14830
+ return false;
14831
+ }
14746
14832
  function setSelected(el, value) {
14747
14833
  const isMultiple = el.multiple;
14748
14834
  const isArrayValue = isArray(value);
@@ -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
  **/
@@ -305,6 +305,23 @@ var Vue = (function () {
305
305
  }
306
306
  return equal;
307
307
  }
308
+ function looseCompareCollections(a, b) {
309
+ if (a.size !== b.size) return false;
310
+ const candidates = Array.from(b);
311
+ const matched = new Uint8Array(candidates.length);
312
+ for (const item of a) {
313
+ let index = -1;
314
+ for (let i = 0; i < candidates.length; i++) {
315
+ if (!matched[i] && looseEqual(item, candidates[i])) {
316
+ index = i;
317
+ break;
318
+ }
319
+ }
320
+ if (index < 0) return false;
321
+ matched[index] = 1;
322
+ }
323
+ return true;
324
+ }
308
325
  function looseEqual(a, b) {
309
326
  if (a === b) return true;
310
327
  let aValidType = isDate(a);
@@ -328,6 +345,16 @@ var Vue = (function () {
328
345
  if (!aValidType || !bValidType) {
329
346
  return false;
330
347
  }
348
+ aValidType = isMap(a);
349
+ bValidType = isMap(b);
350
+ if (aValidType || bValidType) {
351
+ return aValidType && bValidType ? looseCompareCollections(a, b) : false;
352
+ }
353
+ aValidType = isSet(a);
354
+ bValidType = isSet(b);
355
+ if (aValidType || bValidType) {
356
+ return aValidType && bValidType ? looseCompareCollections(a, b) : false;
357
+ }
331
358
  const aKeysCount = Object.keys(a).length;
332
359
  const bKeysCount = Object.keys(b).length;
333
360
  if (aKeysCount !== bKeysCount) {
@@ -4853,10 +4880,10 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4853
4880
  getContainerType(container),
4854
4881
  optimized
4855
4882
  );
4856
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4883
+ if (isAsyncWrapper(vnode) && !vnode.component.subTree) {
4857
4884
  let subTree;
4858
4885
  if (isFragmentStart) {
4859
- subTree = createVNode(Fragment);
4886
+ subTree = createVNode(Static);
4860
4887
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4861
4888
  } else {
4862
4889
  subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
@@ -5759,7 +5786,10 @@ Server rendered element contains fewer child nodes than client vdom.`
5759
5786
  if (pendingCacheKey != null) {
5760
5787
  if (isSuspense(instance.subTree.type)) {
5761
5788
  queuePostRenderEffect(() => {
5762
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5789
+ const vnode = getInnerChild(instance.subTree);
5790
+ if (vnode.component) {
5791
+ cache.set(pendingCacheKey, vnode);
5792
+ }
5763
5793
  }, instance.subTree.suspense);
5764
5794
  } else {
5765
5795
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6680,12 +6710,41 @@ If this is a native custom element, make sure to exclude it from component resol
6680
6710
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
6681
6711
  return getPublicInstance(i.parent);
6682
6712
  };
6713
+ const resolveDevRootEl = (vnode) => {
6714
+ let found = false;
6715
+ while (true) {
6716
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
6717
+ const root = filterSingleRoot(vnode.children);
6718
+ if (!root) {
6719
+ return;
6720
+ }
6721
+ vnode = root;
6722
+ found = true;
6723
+ continue;
6724
+ }
6725
+ const component = vnode.component;
6726
+ if (component && component.subTree) {
6727
+ vnode = component.subTree;
6728
+ continue;
6729
+ }
6730
+ const suspense = vnode.suspense;
6731
+ if (suspense && suspense.activeBranch) {
6732
+ vnode = suspense.activeBranch;
6733
+ continue;
6734
+ }
6735
+ return found ? vnode.el : void 0;
6736
+ }
6737
+ };
6738
+ const getDevRootFragmentEl = (i) => {
6739
+ const el = i.subTree && resolveDevRootEl(i.subTree);
6740
+ return el === void 0 ? i.vnode.el : el;
6741
+ };
6683
6742
  const publicPropertiesMap = (
6684
6743
  // Move PURE marker to new line to workaround compiler discarding it
6685
6744
  // due to type annotation
6686
6745
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
6687
6746
  $: (i) => i,
6688
- $el: (i) => i.vnode.el,
6747
+ $el: (i) => getDevRootFragmentEl(i) ,
6689
6748
  $data: (i) => i.data,
6690
6749
  $props: (i) => shallowReadonly(i.props) ,
6691
6750
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -7596,7 +7655,7 @@ If this is a native custom element, make sure to exclude it from component resol
7596
7655
  return vm;
7597
7656
  }
7598
7657
  }
7599
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
7658
+ Vue.version = `2.6.14-compat:${"3.5.42"}`;
7600
7659
  Vue.config = singletonApp.config;
7601
7660
  Vue.use = (plugin, ...options) => {
7602
7661
  if (plugin && isFunction(plugin.install)) {
@@ -8353,7 +8412,7 @@ If you want to remount the same app, move your app creation logic into a factory
8353
8412
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8354
8413
  }
8355
8414
  if (modifiers.number) {
8356
- args = rawArgs.map(looseToNumber);
8415
+ args = args.map(looseToNumber);
8357
8416
  }
8358
8417
  }
8359
8418
  {
@@ -11130,7 +11189,7 @@ If you want to remount the same app, move your app creation logic into a factory
11130
11189
  if (suspense.deps <= 0) {
11131
11190
  suspense.resolve();
11132
11191
  } else if (isInFallback) {
11133
- if (!isHydrating) {
11192
+ if (!isHydrating && !suspense.isFallbackMountPending) {
11134
11193
  patch(
11135
11194
  activeBranch,
11136
11195
  newFallback,
@@ -11171,7 +11230,7 @@ If you want to remount the same app, move your app creation logic into a factory
11171
11230
  );
11172
11231
  if (suspense.deps <= 0) {
11173
11232
  suspense.resolve();
11174
- } else {
11233
+ } else if (!suspense.isFallbackMountPending) {
11175
11234
  patch(
11176
11235
  activeBranch,
11177
11236
  newFallback,
@@ -11412,9 +11471,10 @@ If you want to remount the same app, move your app creation logic into a factory
11412
11471
  if (!suspense.isInFallback) {
11413
11472
  return;
11414
11473
  }
11474
+ const latestFallback = suspense.vnode.ssFallback;
11415
11475
  patch(
11416
11476
  null,
11417
- fallbackVNode,
11477
+ latestFallback,
11418
11478
  container2,
11419
11479
  anchor2,
11420
11480
  parentComponent2,
@@ -11424,7 +11484,7 @@ If you want to remount the same app, move your app creation logic into a factory
11424
11484
  slotScopeIds,
11425
11485
  optimized
11426
11486
  );
11427
- setActiveBranch(suspense, fallbackVNode);
11487
+ setActiveBranch(suspense, latestFallback);
11428
11488
  };
11429
11489
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
11430
11490
  if (delayEnter) {
@@ -12755,7 +12815,7 @@ Component that was made reactive: `,
12755
12815
  return true;
12756
12816
  }
12757
12817
 
12758
- const version = "3.5.41";
12818
+ const version = "3.5.42";
12759
12819
  const warn = warn$1 ;
12760
12820
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12761
12821
  const devtools = devtools$1 ;
@@ -13377,7 +13437,11 @@ Component that was made reactive: `,
13377
13437
  }
13378
13438
  }
13379
13439
  if (name.startsWith("--")) {
13380
- style.setProperty(name, val);
13440
+ if (importantRE.test(val)) {
13441
+ style.setProperty(name, val.replace(importantRE, ""), "important");
13442
+ } else {
13443
+ style.setProperty(name, val);
13444
+ }
13381
13445
  } else {
13382
13446
  const prefixed = autoPrefix(style, name);
13383
13447
  if (importantRE.test(val)) {
@@ -14552,13 +14616,21 @@ Expected function or array of functions, received type ${typeof value}.`
14552
14616
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14553
14617
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14554
14618
  );
14555
- el[assignKey](
14556
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14557
- );
14558
- el._assigning = true;
14559
- nextTick(() => {
14560
- el._assigning = false;
14561
- });
14619
+ const multiple = el.multiple;
14620
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
14621
+ const pending = el._pendingValue = [
14622
+ multiple,
14623
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
14624
+ ];
14625
+ try {
14626
+ el[assignKey](assignedValue);
14627
+ } finally {
14628
+ nextTick(() => {
14629
+ if (el._pendingValue === pending) {
14630
+ el._pendingValue = void 0;
14631
+ }
14632
+ });
14633
+ }
14562
14634
  });
14563
14635
  el[assignKey] = getModelAssigner(vnode);
14564
14636
  },
@@ -14572,11 +14644,25 @@ Expected function or array of functions, received type ${typeof value}.`
14572
14644
  el[assignKey] = getModelAssigner(vnode);
14573
14645
  },
14574
14646
  updated(el, { value }) {
14575
- if (!el._assigning) {
14647
+ const pending = el._pendingValue;
14648
+ el._pendingValue = void 0;
14649
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
14576
14650
  setSelected(el, value);
14577
14651
  }
14578
14652
  }
14579
14653
  };
14654
+ function isSameSelectValue(value, assignedValue, multiple) {
14655
+ if (!multiple) return looseEqual(value, assignedValue);
14656
+ if (isArray(value)) return looseEqual(value, assignedValue);
14657
+ if (isSet(value)) {
14658
+ if (value.size !== assignedValue.length) return false;
14659
+ for (const item of assignedValue) {
14660
+ if (!value.has(item)) return false;
14661
+ }
14662
+ return true;
14663
+ }
14664
+ return false;
14665
+ }
14580
14666
  function setSelected(el, value) {
14581
14667
  const isMultiple = el.multiple;
14582
14668
  const isArrayValue = isArray(value);