@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) {
@@ -4824,10 +4851,10 @@ function createHydrationFunctions(rendererInternals) {
4824
4851
  getContainerType(container),
4825
4852
  optimized
4826
4853
  );
4827
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4854
+ if (isAsyncWrapper(vnode) && !vnode.component.subTree) {
4828
4855
  let subTree;
4829
4856
  if (isFragmentStart) {
4830
- subTree = createVNode(Fragment);
4857
+ subTree = createVNode(Static);
4831
4858
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4832
4859
  } else {
4833
4860
  subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
@@ -5748,7 +5775,10 @@ const KeepAliveImpl = {
5748
5775
  if (pendingCacheKey != null) {
5749
5776
  if (isSuspense(instance.subTree.type)) {
5750
5777
  queuePostRenderEffect(() => {
5751
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5778
+ const vnode = getInnerChild(instance.subTree);
5779
+ if (vnode.component) {
5780
+ cache.set(pendingCacheKey, vnode);
5781
+ }
5752
5782
  }, instance.subTree.suspense);
5753
5783
  } else {
5754
5784
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6669,12 +6699,41 @@ const getPublicInstance = (i) => {
6669
6699
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
6670
6700
  return getPublicInstance(i.parent);
6671
6701
  };
6702
+ const resolveDevRootEl = (vnode) => {
6703
+ let found = false;
6704
+ while (true) {
6705
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
6706
+ const root = filterSingleRoot(vnode.children);
6707
+ if (!root) {
6708
+ return;
6709
+ }
6710
+ vnode = root;
6711
+ found = true;
6712
+ continue;
6713
+ }
6714
+ const component = vnode.component;
6715
+ if (component && component.subTree) {
6716
+ vnode = component.subTree;
6717
+ continue;
6718
+ }
6719
+ const suspense = vnode.suspense;
6720
+ if (suspense && suspense.activeBranch) {
6721
+ vnode = suspense.activeBranch;
6722
+ continue;
6723
+ }
6724
+ return found ? vnode.el : void 0;
6725
+ }
6726
+ };
6727
+ const getDevRootFragmentEl = (i) => {
6728
+ const el = i.subTree && resolveDevRootEl(i.subTree);
6729
+ return el === void 0 ? i.vnode.el : el;
6730
+ };
6672
6731
  const publicPropertiesMap = (
6673
6732
  // Move PURE marker to new line to workaround compiler discarding it
6674
6733
  // due to type annotation
6675
6734
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
6676
6735
  $: (i) => i,
6677
- $el: (i) => i.vnode.el,
6736
+ $el: (i) => !!(process.env.NODE_ENV !== "production") ? getDevRootFragmentEl(i) : i.vnode.el,
6678
6737
  $data: (i) => i.data,
6679
6738
  $props: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.props) : i.props,
6680
6739
  $attrs: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.attrs) : i.attrs,
@@ -7590,7 +7649,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7590
7649
  return vm;
7591
7650
  }
7592
7651
  }
7593
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
7652
+ Vue.version = `2.6.14-compat:${"3.5.42"}`;
7594
7653
  Vue.config = singletonApp.config;
7595
7654
  Vue.use = (plugin, ...options) => {
7596
7655
  if (plugin && isFunction(plugin.install)) {
@@ -8349,7 +8408,7 @@ function emit(instance, event, ...rawArgs) {
8349
8408
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8350
8409
  }
8351
8410
  if (modifiers.number) {
8352
- args = rawArgs.map(looseToNumber);
8411
+ args = args.map(looseToNumber);
8353
8412
  }
8354
8413
  }
8355
8414
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
@@ -11164,7 +11223,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11164
11223
  if (suspense.deps <= 0) {
11165
11224
  suspense.resolve();
11166
11225
  } else if (isInFallback) {
11167
- if (!isHydrating) {
11226
+ if (!isHydrating && !suspense.isFallbackMountPending) {
11168
11227
  patch(
11169
11228
  activeBranch,
11170
11229
  newFallback,
@@ -11205,7 +11264,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11205
11264
  );
11206
11265
  if (suspense.deps <= 0) {
11207
11266
  suspense.resolve();
11208
- } else {
11267
+ } else if (!suspense.isFallbackMountPending) {
11209
11268
  patch(
11210
11269
  activeBranch,
11211
11270
  newFallback,
@@ -11446,9 +11505,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11446
11505
  if (!suspense.isInFallback) {
11447
11506
  return;
11448
11507
  }
11508
+ const latestFallback = suspense.vnode.ssFallback;
11449
11509
  patch(
11450
11510
  null,
11451
- fallbackVNode,
11511
+ latestFallback,
11452
11512
  container2,
11453
11513
  anchor2,
11454
11514
  parentComponent2,
@@ -11458,7 +11518,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11458
11518
  slotScopeIds,
11459
11519
  optimized
11460
11520
  );
11461
- setActiveBranch(suspense, fallbackVNode);
11521
+ setActiveBranch(suspense, latestFallback);
11462
11522
  };
11463
11523
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
11464
11524
  if (delayEnter) {
@@ -12817,7 +12877,7 @@ function isMemoSame(cached, memo) {
12817
12877
  return true;
12818
12878
  }
12819
12879
 
12820
- const version = "3.5.41";
12880
+ const version = "3.5.42";
12821
12881
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12822
12882
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12823
12883
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13458,7 +13518,11 @@ function setStyle(style, name, val) {
13458
13518
  }
13459
13519
  }
13460
13520
  if (name.startsWith("--")) {
13461
- style.setProperty(name, val);
13521
+ if (importantRE.test(val)) {
13522
+ style.setProperty(name, val.replace(importantRE, ""), "important");
13523
+ } else {
13524
+ style.setProperty(name, val);
13525
+ }
13462
13526
  } else {
13463
13527
  const prefixed = autoPrefix(style, name);
13464
13528
  if (importantRE.test(val)) {
@@ -14645,13 +14709,21 @@ const vModelSelect = {
14645
14709
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14646
14710
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14647
14711
  );
14648
- el[assignKey](
14649
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14650
- );
14651
- el._assigning = true;
14652
- nextTick(() => {
14653
- el._assigning = false;
14654
- });
14712
+ const multiple = el.multiple;
14713
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
14714
+ const pending = el._pendingValue = [
14715
+ multiple,
14716
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
14717
+ ];
14718
+ try {
14719
+ el[assignKey](assignedValue);
14720
+ } finally {
14721
+ nextTick(() => {
14722
+ if (el._pendingValue === pending) {
14723
+ el._pendingValue = void 0;
14724
+ }
14725
+ });
14726
+ }
14655
14727
  });
14656
14728
  el[assignKey] = getModelAssigner(vnode);
14657
14729
  },
@@ -14665,11 +14737,25 @@ const vModelSelect = {
14665
14737
  el[assignKey] = getModelAssigner(vnode);
14666
14738
  },
14667
14739
  updated(el, { value }) {
14668
- if (!el._assigning) {
14740
+ const pending = el._pendingValue;
14741
+ el._pendingValue = void 0;
14742
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
14669
14743
  setSelected(el, value);
14670
14744
  }
14671
14745
  }
14672
14746
  };
14747
+ function isSameSelectValue(value, assignedValue, multiple) {
14748
+ if (!multiple) return looseEqual(value, assignedValue);
14749
+ if (isArray(value)) return looseEqual(value, assignedValue);
14750
+ if (isSet(value)) {
14751
+ if (value.size !== assignedValue.length) return false;
14752
+ for (const item of assignedValue) {
14753
+ if (!value.has(item)) return false;
14754
+ }
14755
+ return true;
14756
+ }
14757
+ return false;
14758
+ }
14673
14759
  function setSelected(el, value) {
14674
14760
  const isMultiple = el.multiple;
14675
14761
  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
  **/
@@ -232,6 +232,23 @@ var Vue = (function () {
232
232
  }
233
233
  return equal;
234
234
  }
235
+ function looseCompareCollections(a, b) {
236
+ if (a.size !== b.size) return false;
237
+ const candidates = Array.from(b);
238
+ const matched = new Uint8Array(candidates.length);
239
+ for (const item of a) {
240
+ let index = -1;
241
+ for (let i = 0; i < candidates.length; i++) {
242
+ if (!matched[i] && looseEqual(item, candidates[i])) {
243
+ index = i;
244
+ break;
245
+ }
246
+ }
247
+ if (index < 0) return false;
248
+ matched[index] = 1;
249
+ }
250
+ return true;
251
+ }
235
252
  function looseEqual(a, b) {
236
253
  if (a === b) return true;
237
254
  let aValidType = isDate(a);
@@ -255,6 +272,16 @@ var Vue = (function () {
255
272
  if (!aValidType || !bValidType) {
256
273
  return false;
257
274
  }
275
+ aValidType = isMap(a);
276
+ bValidType = isMap(b);
277
+ if (aValidType || bValidType) {
278
+ return aValidType && bValidType ? looseCompareCollections(a, b) : false;
279
+ }
280
+ aValidType = isSet(a);
281
+ bValidType = isSet(b);
282
+ if (aValidType || bValidType) {
283
+ return aValidType && bValidType ? looseCompareCollections(a, b) : false;
284
+ }
258
285
  const aKeysCount = Object.keys(a).length;
259
286
  const bKeysCount = Object.keys(b).length;
260
287
  if (aKeysCount !== bKeysCount) {
@@ -4780,10 +4807,10 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4780
4807
  getContainerType(container),
4781
4808
  optimized
4782
4809
  );
4783
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4810
+ if (isAsyncWrapper(vnode) && !vnode.component.subTree) {
4784
4811
  let subTree;
4785
4812
  if (isFragmentStart) {
4786
- subTree = createVNode(Fragment);
4813
+ subTree = createVNode(Static);
4787
4814
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4788
4815
  } else {
4789
4816
  subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
@@ -5686,7 +5713,10 @@ Server rendered element contains fewer child nodes than client vdom.`
5686
5713
  if (pendingCacheKey != null) {
5687
5714
  if (isSuspense(instance.subTree.type)) {
5688
5715
  queuePostRenderEffect(() => {
5689
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5716
+ const vnode = getInnerChild(instance.subTree);
5717
+ if (vnode.component) {
5718
+ cache.set(pendingCacheKey, vnode);
5719
+ }
5690
5720
  }, instance.subTree.suspense);
5691
5721
  } else {
5692
5722
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6607,12 +6637,41 @@ If this is a native custom element, make sure to exclude it from component resol
6607
6637
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
6608
6638
  return getPublicInstance(i.parent);
6609
6639
  };
6640
+ const resolveDevRootEl = (vnode) => {
6641
+ let found = false;
6642
+ while (true) {
6643
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
6644
+ const root = filterSingleRoot(vnode.children);
6645
+ if (!root) {
6646
+ return;
6647
+ }
6648
+ vnode = root;
6649
+ found = true;
6650
+ continue;
6651
+ }
6652
+ const component = vnode.component;
6653
+ if (component && component.subTree) {
6654
+ vnode = component.subTree;
6655
+ continue;
6656
+ }
6657
+ const suspense = vnode.suspense;
6658
+ if (suspense && suspense.activeBranch) {
6659
+ vnode = suspense.activeBranch;
6660
+ continue;
6661
+ }
6662
+ return found ? vnode.el : void 0;
6663
+ }
6664
+ };
6665
+ const getDevRootFragmentEl = (i) => {
6666
+ const el = i.subTree && resolveDevRootEl(i.subTree);
6667
+ return el === void 0 ? i.vnode.el : el;
6668
+ };
6610
6669
  const publicPropertiesMap = (
6611
6670
  // Move PURE marker to new line to workaround compiler discarding it
6612
6671
  // due to type annotation
6613
6672
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
6614
6673
  $: (i) => i,
6615
- $el: (i) => i.vnode.el,
6674
+ $el: (i) => getDevRootFragmentEl(i) ,
6616
6675
  $data: (i) => i.data,
6617
6676
  $props: (i) => shallowReadonly(i.props) ,
6618
6677
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -7523,7 +7582,7 @@ If this is a native custom element, make sure to exclude it from component resol
7523
7582
  return vm;
7524
7583
  }
7525
7584
  }
7526
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
7585
+ Vue.version = `2.6.14-compat:${"3.5.42"}`;
7527
7586
  Vue.config = singletonApp.config;
7528
7587
  Vue.use = (plugin, ...options) => {
7529
7588
  if (plugin && isFunction(plugin.install)) {
@@ -8280,7 +8339,7 @@ If you want to remount the same app, move your app creation logic into a factory
8280
8339
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8281
8340
  }
8282
8341
  if (modifiers.number) {
8283
- args = rawArgs.map(looseToNumber);
8342
+ args = args.map(looseToNumber);
8284
8343
  }
8285
8344
  }
8286
8345
  {
@@ -11057,7 +11116,7 @@ If you want to remount the same app, move your app creation logic into a factory
11057
11116
  if (suspense.deps <= 0) {
11058
11117
  suspense.resolve();
11059
11118
  } else if (isInFallback) {
11060
- if (!isHydrating) {
11119
+ if (!isHydrating && !suspense.isFallbackMountPending) {
11061
11120
  patch(
11062
11121
  activeBranch,
11063
11122
  newFallback,
@@ -11098,7 +11157,7 @@ If you want to remount the same app, move your app creation logic into a factory
11098
11157
  );
11099
11158
  if (suspense.deps <= 0) {
11100
11159
  suspense.resolve();
11101
- } else {
11160
+ } else if (!suspense.isFallbackMountPending) {
11102
11161
  patch(
11103
11162
  activeBranch,
11104
11163
  newFallback,
@@ -11339,9 +11398,10 @@ If you want to remount the same app, move your app creation logic into a factory
11339
11398
  if (!suspense.isInFallback) {
11340
11399
  return;
11341
11400
  }
11401
+ const latestFallback = suspense.vnode.ssFallback;
11342
11402
  patch(
11343
11403
  null,
11344
- fallbackVNode,
11404
+ latestFallback,
11345
11405
  container2,
11346
11406
  anchor2,
11347
11407
  parentComponent2,
@@ -11351,7 +11411,7 @@ If you want to remount the same app, move your app creation logic into a factory
11351
11411
  slotScopeIds,
11352
11412
  optimized
11353
11413
  );
11354
- setActiveBranch(suspense, fallbackVNode);
11414
+ setActiveBranch(suspense, latestFallback);
11355
11415
  };
11356
11416
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
11357
11417
  if (delayEnter) {
@@ -12682,7 +12742,7 @@ Component that was made reactive: `,
12682
12742
  return true;
12683
12743
  }
12684
12744
 
12685
- const version = "3.5.41";
12745
+ const version = "3.5.42";
12686
12746
  const warn = warn$1 ;
12687
12747
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12688
12748
  const devtools = devtools$1 ;
@@ -13304,7 +13364,11 @@ Component that was made reactive: `,
13304
13364
  }
13305
13365
  }
13306
13366
  if (name.startsWith("--")) {
13307
- style.setProperty(name, val);
13367
+ if (importantRE.test(val)) {
13368
+ style.setProperty(name, val.replace(importantRE, ""), "important");
13369
+ } else {
13370
+ style.setProperty(name, val);
13371
+ }
13308
13372
  } else {
13309
13373
  const prefixed = autoPrefix(style, name);
13310
13374
  if (importantRE.test(val)) {
@@ -14479,13 +14543,21 @@ Expected function or array of functions, received type ${typeof value}.`
14479
14543
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14480
14544
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14481
14545
  );
14482
- el[assignKey](
14483
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14484
- );
14485
- el._assigning = true;
14486
- nextTick(() => {
14487
- el._assigning = false;
14488
- });
14546
+ const multiple = el.multiple;
14547
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
14548
+ const pending = el._pendingValue = [
14549
+ multiple,
14550
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
14551
+ ];
14552
+ try {
14553
+ el[assignKey](assignedValue);
14554
+ } finally {
14555
+ nextTick(() => {
14556
+ if (el._pendingValue === pending) {
14557
+ el._pendingValue = void 0;
14558
+ }
14559
+ });
14560
+ }
14489
14561
  });
14490
14562
  el[assignKey] = getModelAssigner(vnode);
14491
14563
  },
@@ -14499,11 +14571,25 @@ Expected function or array of functions, received type ${typeof value}.`
14499
14571
  el[assignKey] = getModelAssigner(vnode);
14500
14572
  },
14501
14573
  updated(el, { value }) {
14502
- if (!el._assigning) {
14574
+ const pending = el._pendingValue;
14575
+ el._pendingValue = void 0;
14576
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
14503
14577
  setSelected(el, value);
14504
14578
  }
14505
14579
  }
14506
14580
  };
14581
+ function isSameSelectValue(value, assignedValue, multiple) {
14582
+ if (!multiple) return looseEqual(value, assignedValue);
14583
+ if (isArray(value)) return looseEqual(value, assignedValue);
14584
+ if (isSet(value)) {
14585
+ if (value.size !== assignedValue.length) return false;
14586
+ for (const item of assignedValue) {
14587
+ if (!value.has(item)) return false;
14588
+ }
14589
+ return true;
14590
+ }
14591
+ return false;
14592
+ }
14507
14593
  function setSelected(el, value) {
14508
14594
  const isMultiple = el.multiple;
14509
14595
  const isArrayValue = isArray(value);