@vue/compat 3.5.41 → 3.5.43

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.43
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -202,10 +202,10 @@ var Vue = (function () {
202
202
  }
203
203
  const listDelimiterRE = /;(?![^(]*\))/g;
204
204
  const propertyDelimiterRE = /:([^]+)/;
205
- const styleCommentRE = /\/\*[^]*?\*\//g;
205
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
206
206
  function parseStringStyle(cssText) {
207
207
  const ret = {};
208
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
208
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
209
209
  if (item) {
210
210
  const tmp = item.split(propertyDelimiterRE);
211
211
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -297,15 +297,72 @@ var Vue = (function () {
297
297
  );
298
298
  }
299
299
 
300
- function looseCompareArrays(a, b) {
300
+ function looseCompareArrays(a, b, seen) {
301
301
  if (a.length !== b.length) return false;
302
302
  let equal = true;
303
303
  for (let i = 0; equal && i < a.length; i++) {
304
- equal = looseEqual(a[i], b[i]);
304
+ equal = looseEqual(a[i], b[i], seen);
305
305
  }
306
306
  return equal;
307
307
  }
308
- function looseEqual(a, b) {
308
+ function looseCompareCollections(a, b, seen) {
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], seen)) {
316
+ index = i;
317
+ break;
318
+ }
319
+ }
320
+ if (index < 0) return false;
321
+ matched[index] = 1;
322
+ }
323
+ return true;
324
+ }
325
+ function looseCompareObjects(a, b, seen) {
326
+ let aValidType = isMap(a);
327
+ let bValidType = isMap(b);
328
+ if (aValidType || bValidType) {
329
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
330
+ }
331
+ aValidType = isSet(a);
332
+ bValidType = isSet(b);
333
+ if (aValidType || bValidType) {
334
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
335
+ }
336
+ const aKeysCount = Object.keys(a).length;
337
+ const bKeysCount = Object.keys(b).length;
338
+ if (aKeysCount !== bKeysCount) {
339
+ return false;
340
+ }
341
+ for (const key in a) {
342
+ const aHasKey = a.hasOwnProperty(key);
343
+ const bHasKey = b.hasOwnProperty(key);
344
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
345
+ return false;
346
+ }
347
+ }
348
+ return String(a) === String(b);
349
+ }
350
+ function looseCompareNested(a, b, seen, compare) {
351
+ if (!seen) {
352
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
353
+ }
354
+ const [seenA, seenB] = seen;
355
+ if (seenA.has(a) || seenB.has(b)) {
356
+ return seenA.get(a) === b && seenB.get(b) === a;
357
+ }
358
+ seenA.set(a, b);
359
+ seenB.set(b, a);
360
+ const equal = compare(a, b, seen);
361
+ seenA.delete(a);
362
+ seenB.delete(b);
363
+ return equal;
364
+ }
365
+ function looseEqual(a, b, seen) {
309
366
  if (a === b) return true;
310
367
  let aValidType = isDate(a);
311
368
  let bValidType = isDate(b);
@@ -320,7 +377,7 @@ var Vue = (function () {
320
377
  aValidType = isArray(a);
321
378
  bValidType = isArray(b);
322
379
  if (aValidType || bValidType) {
323
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
380
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
324
381
  }
325
382
  aValidType = isObject(a);
326
383
  bValidType = isObject(b);
@@ -328,18 +385,7 @@ var Vue = (function () {
328
385
  if (!aValidType || !bValidType) {
329
386
  return false;
330
387
  }
331
- const aKeysCount = Object.keys(a).length;
332
- const bKeysCount = Object.keys(b).length;
333
- if (aKeysCount !== bKeysCount) {
334
- return false;
335
- }
336
- for (const key in a) {
337
- const aHasKey = a.hasOwnProperty(key);
338
- const bHasKey = b.hasOwnProperty(key);
339
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
340
- return false;
341
- }
342
- }
388
+ return looseCompareNested(a, b, seen, looseCompareObjects);
343
389
  }
344
390
  return String(a) === String(b);
345
391
  }
@@ -1140,7 +1186,9 @@ var Vue = (function () {
1140
1186
  const raw = toRaw(array);
1141
1187
  if (raw === array) return raw;
1142
1188
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1143
- return isShallow(array) ? raw : raw.map(toReactive);
1189
+ if (isShallow(array)) return raw;
1190
+ if (!isReadonly(array)) return raw.map(toReactive);
1191
+ return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
1144
1192
  }
1145
1193
  function shallowReadArray(arr) {
1146
1194
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4853,13 +4901,15 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4853
4901
  getContainerType(container),
4854
4902
  optimized
4855
4903
  );
4856
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4904
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4857
4905
  let subTree;
4858
4906
  if (isFragmentStart) {
4859
- subTree = createVNode(Fragment);
4907
+ subTree = createVNode(Static);
4860
4908
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4861
4909
  } else {
4862
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4910
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4911
+ node.nodeType === 8 ? Comment : "div"
4912
+ );
4863
4913
  }
4864
4914
  subTree.el = node;
4865
4915
  vnode.component.subTree = subTree;
@@ -5759,7 +5809,10 @@ Server rendered element contains fewer child nodes than client vdom.`
5759
5809
  if (pendingCacheKey != null) {
5760
5810
  if (isSuspense(instance.subTree.type)) {
5761
5811
  queuePostRenderEffect(() => {
5762
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5812
+ const vnode = getInnerChild(instance.subTree);
5813
+ if (vnode.component) {
5814
+ cache.set(pendingCacheKey, vnode);
5815
+ }
5763
5816
  }, instance.subTree.suspense);
5764
5817
  } else {
5765
5818
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6680,12 +6733,41 @@ If this is a native custom element, make sure to exclude it from component resol
6680
6733
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
6681
6734
  return getPublicInstance(i.parent);
6682
6735
  };
6736
+ const resolveDevRootEl = (vnode) => {
6737
+ let found = false;
6738
+ while (true) {
6739
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
6740
+ const root = filterSingleRoot(vnode.children);
6741
+ if (!root) {
6742
+ return;
6743
+ }
6744
+ vnode = root;
6745
+ found = true;
6746
+ continue;
6747
+ }
6748
+ const component = vnode.component;
6749
+ if (component && component.subTree) {
6750
+ vnode = component.subTree;
6751
+ continue;
6752
+ }
6753
+ const suspense = vnode.suspense;
6754
+ if (suspense && suspense.activeBranch) {
6755
+ vnode = suspense.activeBranch;
6756
+ continue;
6757
+ }
6758
+ return found ? vnode.el : void 0;
6759
+ }
6760
+ };
6761
+ const getDevRootFragmentEl = (i) => {
6762
+ const el = i.subTree && resolveDevRootEl(i.subTree);
6763
+ return el === void 0 ? i.vnode.el : el;
6764
+ };
6683
6765
  const publicPropertiesMap = (
6684
6766
  // Move PURE marker to new line to workaround compiler discarding it
6685
6767
  // due to type annotation
6686
6768
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
6687
6769
  $: (i) => i,
6688
- $el: (i) => i.vnode.el,
6770
+ $el: (i) => getDevRootFragmentEl(i) ,
6689
6771
  $data: (i) => i.data,
6690
6772
  $props: (i) => shallowReadonly(i.props) ,
6691
6773
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -7596,7 +7678,7 @@ If this is a native custom element, make sure to exclude it from component resol
7596
7678
  return vm;
7597
7679
  }
7598
7680
  }
7599
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
7681
+ Vue.version = `2.6.14-compat:${"3.5.43"}`;
7600
7682
  Vue.config = singletonApp.config;
7601
7683
  Vue.use = (plugin, ...options) => {
7602
7684
  if (plugin && isFunction(plugin.install)) {
@@ -8353,7 +8435,7 @@ If you want to remount the same app, move your app creation logic into a factory
8353
8435
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8354
8436
  }
8355
8437
  if (modifiers.number) {
8356
- args = rawArgs.map(looseToNumber);
8438
+ args = args.map(looseToNumber);
8357
8439
  }
8358
8440
  }
8359
8441
  {
@@ -9452,6 +9534,12 @@ If you want to remount the same app, move your app creation logic into a factory
9452
9534
  optimized = false;
9453
9535
  n2.dynamicChildren = null;
9454
9536
  }
9537
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
9538
+ if (n2.dynamicChildren === EMPTY_ARR) {
9539
+ n2.dynamicChildren = [];
9540
+ }
9541
+ n2.dynamicChildren.hasOnce = true;
9542
+ }
9455
9543
  const { type, ref, shapeFlag } = n2;
9456
9544
  switch (type) {
9457
9545
  case Text:
@@ -10060,6 +10148,7 @@ If you want to remount the same app, move your app creation logic into a factory
10060
10148
  {
10061
10149
  pushWarningContext(n2);
10062
10150
  }
10151
+ n2.el = n1.el;
10063
10152
  updateComponentPreRender(instance, n2, optimized);
10064
10153
  {
10065
10154
  popWarningContext();
@@ -10675,7 +10764,7 @@ If you want to remount the same app, move your app creation logic into a factory
10675
10764
  cacheIndex,
10676
10765
  memo
10677
10766
  } = vnode;
10678
- if (patchFlag === -2) {
10767
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
10679
10768
  optimized = false;
10680
10769
  }
10681
10770
  if (ref != null) {
@@ -10683,7 +10772,7 @@ If you want to remount the same app, move your app creation logic into a factory
10683
10772
  setRef(ref, null, parentSuspense, vnode, true);
10684
10773
  resetTracking();
10685
10774
  }
10686
- if (cacheIndex != null) {
10775
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
10687
10776
  parentComponent.renderCache[cacheIndex] = void 0;
10688
10777
  }
10689
10778
  if (shapeFlag & 256) {
@@ -10764,6 +10853,9 @@ If you want to remount the same app, move your app creation logic into a factory
10764
10853
  }
10765
10854
  if (type === Static) {
10766
10855
  removeStaticNode(vnode);
10856
+ if (transition && !transition.persisted && transition.afterLeave) {
10857
+ transition.afterLeave();
10858
+ }
10767
10859
  return;
10768
10860
  }
10769
10861
  const performRemove = () => {
@@ -10810,6 +10902,9 @@ If you want to remount the same app, move your app creation logic into a factory
10810
10902
  if (job) {
10811
10903
  job.flags |= 8;
10812
10904
  unmount(subTree, instance, parentSuspense, doRemove);
10905
+ } else if (instance.vnode.el && subTree) {
10906
+ subTree.transition = instance.vnode.transition;
10907
+ unmount(subTree, instance, parentSuspense, doRemove);
10813
10908
  }
10814
10909
  if (um) {
10815
10910
  queuePostRenderEffect(um, parentSuspense);
@@ -11030,7 +11125,7 @@ If you want to remount the same app, move your app creation logic into a factory
11030
11125
  rendererInternals
11031
11126
  );
11032
11127
  } else {
11033
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
11128
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
11034
11129
  n2.suspense = n1.suspense;
11035
11130
  n2.suspense.vnode = n2;
11036
11131
  n2.el = n1.el;
@@ -11116,10 +11211,12 @@ If you want to remount the same app, move your app creation logic into a factory
11116
11211
  if (pendingBranch) {
11117
11212
  suspense.pendingBranch = newBranch;
11118
11213
  if (isSameVNodeType(pendingBranch, newBranch)) {
11214
+ suspense.deps++;
11119
11215
  patch(
11120
11216
  pendingBranch,
11121
11217
  newBranch,
11122
- suspense.hiddenContainer,
11218
+ // a hydrating pending branch is adopted SSR DOM, already in place
11219
+ isHydrating ? container : suspense.hiddenContainer,
11123
11220
  null,
11124
11221
  parentComponent,
11125
11222
  suspense,
@@ -11127,10 +11224,11 @@ If you want to remount the same app, move your app creation logic into a factory
11127
11224
  slotScopeIds,
11128
11225
  optimized
11129
11226
  );
11227
+ suspense.deps--;
11130
11228
  if (suspense.deps <= 0) {
11131
11229
  suspense.resolve();
11132
11230
  } else if (isInFallback) {
11133
- if (!isHydrating) {
11231
+ if (!isHydrating && !suspense.isFallbackMountPending) {
11134
11232
  patch(
11135
11233
  activeBranch,
11136
11234
  newFallback,
@@ -11171,7 +11269,7 @@ If you want to remount the same app, move your app creation logic into a factory
11171
11269
  );
11172
11270
  if (suspense.deps <= 0) {
11173
11271
  suspense.resolve();
11174
- } else {
11272
+ } else if (!suspense.isFallbackMountPending) {
11175
11273
  patch(
11176
11274
  activeBranch,
11177
11275
  newFallback,
@@ -11392,6 +11490,7 @@ If you want to remount the same app, move your app creation logic into a factory
11392
11490
  suspense.effects = [];
11393
11491
  if (isSuspensible) {
11394
11492
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
11493
+ parentSuspenseId = void 0;
11395
11494
  parentSuspense.deps--;
11396
11495
  if (parentSuspense.deps === 0 && !sync) {
11397
11496
  parentSuspense.resolve();
@@ -11412,9 +11511,10 @@ If you want to remount the same app, move your app creation logic into a factory
11412
11511
  if (!suspense.isInFallback) {
11413
11512
  return;
11414
11513
  }
11514
+ const latestFallback = suspense.vnode.ssFallback;
11415
11515
  patch(
11416
11516
  null,
11417
- fallbackVNode,
11517
+ latestFallback,
11418
11518
  container2,
11419
11519
  anchor2,
11420
11520
  parentComponent2,
@@ -11424,7 +11524,7 @@ If you want to remount the same app, move your app creation logic into a factory
11424
11524
  slotScopeIds,
11425
11525
  optimized
11426
11526
  );
11427
- setActiveBranch(suspense, fallbackVNode);
11527
+ setActiveBranch(suspense, latestFallback);
11428
11528
  };
11429
11529
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
11430
11530
  if (delayEnter) {
@@ -11464,6 +11564,12 @@ If you want to remount the same app, move your app creation logic into a factory
11464
11564
  return;
11465
11565
  }
11466
11566
  unsetCurrentInstance();
11567
+ if (hydratedEl && !instance.scope.active) {
11568
+ if (isInPendingSuspense && --suspense.deps === 0) {
11569
+ suspense.resolve();
11570
+ }
11571
+ return;
11572
+ }
11467
11573
  instance.asyncResolved = true;
11468
11574
  const { vnode: vnode2 } = instance;
11469
11575
  {
@@ -11949,7 +12055,8 @@ Component that was made reactive: `,
11949
12055
  el: vnode.el,
11950
12056
  anchor: vnode.anchor,
11951
12057
  ctx: vnode.ctx,
11952
- ce: vnode.ce
12058
+ ce: vnode.ce,
12059
+ cacheIndex: vnode.cacheIndex
11953
12060
  };
11954
12061
  if (transition && cloneTransition) {
11955
12062
  setTransitionHooks(
@@ -12755,7 +12862,7 @@ Component that was made reactive: `,
12755
12862
  return true;
12756
12863
  }
12757
12864
 
12758
- const version = "3.5.41";
12865
+ const version = "3.5.43";
12759
12866
  const warn = warn$1 ;
12760
12867
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12761
12868
  const devtools = devtools$1 ;
@@ -13377,7 +13484,11 @@ Component that was made reactive: `,
13377
13484
  }
13378
13485
  }
13379
13486
  if (name.startsWith("--")) {
13380
- style.setProperty(name, val);
13487
+ if (importantRE.test(val)) {
13488
+ style.setProperty(name, val.replace(importantRE, ""), "important");
13489
+ } else {
13490
+ style.setProperty(name, val);
13491
+ }
13381
13492
  } else {
13382
13493
  const prefixed = autoPrefix(style, name);
13383
13494
  if (importantRE.test(val)) {
@@ -14552,13 +14663,21 @@ Expected function or array of functions, received type ${typeof value}.`
14552
14663
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14553
14664
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14554
14665
  );
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
- });
14666
+ const multiple = el.multiple;
14667
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
14668
+ const pending = el._pendingValue = [
14669
+ multiple,
14670
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
14671
+ ];
14672
+ try {
14673
+ el[assignKey](assignedValue);
14674
+ } finally {
14675
+ nextTick(() => {
14676
+ if (el._pendingValue === pending) {
14677
+ el._pendingValue = void 0;
14678
+ }
14679
+ });
14680
+ }
14562
14681
  });
14563
14682
  el[assignKey] = getModelAssigner(vnode);
14564
14683
  },
@@ -14572,11 +14691,25 @@ Expected function or array of functions, received type ${typeof value}.`
14572
14691
  el[assignKey] = getModelAssigner(vnode);
14573
14692
  },
14574
14693
  updated(el, { value }) {
14575
- if (!el._assigning) {
14694
+ const pending = el._pendingValue;
14695
+ el._pendingValue = void 0;
14696
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
14576
14697
  setSelected(el, value);
14577
14698
  }
14578
14699
  }
14579
14700
  };
14701
+ function isSameSelectValue(value, assignedValue, multiple) {
14702
+ if (!multiple) return looseEqual(value, assignedValue);
14703
+ if (isArray(value)) return looseEqual(value, assignedValue);
14704
+ if (isSet(value)) {
14705
+ if (value.size !== assignedValue.length) return false;
14706
+ for (const item of assignedValue) {
14707
+ if (!value.has(item)) return false;
14708
+ }
14709
+ return true;
14710
+ }
14711
+ return false;
14712
+ }
14580
14713
  function setSelected(el, value) {
14581
14714
  const isMultiple = el.multiple;
14582
14715
  const isArrayValue = isArray(value);