@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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -210,10 +210,10 @@ function normalizeStyle(value) {
210
210
  }
211
211
  const listDelimiterRE = /;(?![^(]*\))/g;
212
212
  const propertyDelimiterRE = /:([^]+)/;
213
- const styleCommentRE = /\/\*[^]*?\*\//g;
213
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
214
214
  function parseStringStyle(cssText) {
215
215
  const ret = {};
216
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
216
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
217
217
  if (item) {
218
218
  const tmp = item.split(propertyDelimiterRE);
219
219
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -347,15 +347,72 @@ function getEscapedCssVarName(key, doubleEscape) {
347
347
  );
348
348
  }
349
349
 
350
- function looseCompareArrays(a, b) {
350
+ function looseCompareArrays(a, b, seen) {
351
351
  if (a.length !== b.length) return false;
352
352
  let equal = true;
353
353
  for (let i = 0; equal && i < a.length; i++) {
354
- equal = looseEqual(a[i], b[i]);
354
+ equal = looseEqual(a[i], b[i], seen);
355
355
  }
356
356
  return equal;
357
357
  }
358
- function looseEqual(a, b) {
358
+ function looseCompareCollections(a, b, seen) {
359
+ if (a.size !== b.size) return false;
360
+ const candidates = Array.from(b);
361
+ const matched = new Uint8Array(candidates.length);
362
+ for (const item of a) {
363
+ let index = -1;
364
+ for (let i = 0; i < candidates.length; i++) {
365
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
366
+ index = i;
367
+ break;
368
+ }
369
+ }
370
+ if (index < 0) return false;
371
+ matched[index] = 1;
372
+ }
373
+ return true;
374
+ }
375
+ function looseCompareObjects(a, b, seen) {
376
+ let aValidType = isMap(a);
377
+ let bValidType = isMap(b);
378
+ if (aValidType || bValidType) {
379
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
380
+ }
381
+ aValidType = isSet(a);
382
+ bValidType = isSet(b);
383
+ if (aValidType || bValidType) {
384
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
385
+ }
386
+ const aKeysCount = Object.keys(a).length;
387
+ const bKeysCount = Object.keys(b).length;
388
+ if (aKeysCount !== bKeysCount) {
389
+ return false;
390
+ }
391
+ for (const key in a) {
392
+ const aHasKey = a.hasOwnProperty(key);
393
+ const bHasKey = b.hasOwnProperty(key);
394
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
395
+ return false;
396
+ }
397
+ }
398
+ return String(a) === String(b);
399
+ }
400
+ function looseCompareNested(a, b, seen, compare) {
401
+ if (!seen) {
402
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
403
+ }
404
+ const [seenA, seenB] = seen;
405
+ if (seenA.has(a) || seenB.has(b)) {
406
+ return seenA.get(a) === b && seenB.get(b) === a;
407
+ }
408
+ seenA.set(a, b);
409
+ seenB.set(b, a);
410
+ const equal = compare(a, b, seen);
411
+ seenA.delete(a);
412
+ seenB.delete(b);
413
+ return equal;
414
+ }
415
+ function looseEqual(a, b, seen) {
359
416
  if (a === b) return true;
360
417
  let aValidType = isDate(a);
361
418
  let bValidType = isDate(b);
@@ -370,7 +427,7 @@ function looseEqual(a, b) {
370
427
  aValidType = isArray(a);
371
428
  bValidType = isArray(b);
372
429
  if (aValidType || bValidType) {
373
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
430
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
374
431
  }
375
432
  aValidType = isObject(a);
376
433
  bValidType = isObject(b);
@@ -378,18 +435,7 @@ function looseEqual(a, b) {
378
435
  if (!aValidType || !bValidType) {
379
436
  return false;
380
437
  }
381
- const aKeysCount = Object.keys(a).length;
382
- const bKeysCount = Object.keys(b).length;
383
- if (aKeysCount !== bKeysCount) {
384
- return false;
385
- }
386
- for (const key in a) {
387
- const aHasKey = a.hasOwnProperty(key);
388
- const bHasKey = b.hasOwnProperty(key);
389
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
390
- return false;
391
- }
392
- }
438
+ return looseCompareNested(a, b, seen, looseCompareObjects);
393
439
  }
394
440
  return String(a) === String(b);
395
441
  }
@@ -1190,7 +1236,9 @@ function reactiveReadArray(array) {
1190
1236
  const raw = toRaw(array);
1191
1237
  if (raw === array) return raw;
1192
1238
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1193
- return isShallow(array) ? raw : raw.map(toReactive);
1239
+ if (isShallow(array)) return raw;
1240
+ if (!isReadonly(array)) return raw.map(toReactive);
1241
+ return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
1194
1242
  }
1195
1243
  function shallowReadArray(arr) {
1196
1244
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4931,13 +4979,15 @@ function createHydrationFunctions(rendererInternals) {
4931
4979
  getContainerType(container),
4932
4980
  optimized
4933
4981
  );
4934
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4982
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4935
4983
  let subTree;
4936
4984
  if (isFragmentStart) {
4937
- subTree = createVNode(Fragment);
4985
+ subTree = createVNode(Static);
4938
4986
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4939
4987
  } else {
4940
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4988
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4989
+ node.nodeType === 8 ? Comment : "div"
4990
+ );
4941
4991
  }
4942
4992
  subTree.el = node;
4943
4993
  vnode.component.subTree = subTree;
@@ -5840,7 +5890,10 @@ const KeepAliveImpl = {
5840
5890
  if (pendingCacheKey != null) {
5841
5891
  if (isSuspense(instance.subTree.type)) {
5842
5892
  queuePostRenderEffect(() => {
5843
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5893
+ const vnode = getInnerChild(instance.subTree);
5894
+ if (vnode.component) {
5895
+ cache.set(pendingCacheKey, vnode);
5896
+ }
5844
5897
  }, instance.subTree.suspense);
5845
5898
  } else {
5846
5899
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6761,12 +6814,41 @@ const getPublicInstance = (i) => {
6761
6814
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
6762
6815
  return getPublicInstance(i.parent);
6763
6816
  };
6817
+ const resolveDevRootEl = (vnode) => {
6818
+ let found = false;
6819
+ while (true) {
6820
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
6821
+ const root = filterSingleRoot(vnode.children);
6822
+ if (!root) {
6823
+ return;
6824
+ }
6825
+ vnode = root;
6826
+ found = true;
6827
+ continue;
6828
+ }
6829
+ const component = vnode.component;
6830
+ if (component && component.subTree) {
6831
+ vnode = component.subTree;
6832
+ continue;
6833
+ }
6834
+ const suspense = vnode.suspense;
6835
+ if (suspense && suspense.activeBranch) {
6836
+ vnode = suspense.activeBranch;
6837
+ continue;
6838
+ }
6839
+ return found ? vnode.el : void 0;
6840
+ }
6841
+ };
6842
+ const getDevRootFragmentEl = (i) => {
6843
+ const el = i.subTree && resolveDevRootEl(i.subTree);
6844
+ return el === void 0 ? i.vnode.el : el;
6845
+ };
6764
6846
  const publicPropertiesMap = (
6765
6847
  // Move PURE marker to new line to workaround compiler discarding it
6766
6848
  // due to type annotation
6767
6849
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
6768
6850
  $: (i) => i,
6769
- $el: (i) => i.vnode.el,
6851
+ $el: (i) => getDevRootFragmentEl(i) ,
6770
6852
  $data: (i) => i.data,
6771
6853
  $props: (i) => shallowReadonly(i.props) ,
6772
6854
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -7680,7 +7762,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7680
7762
  return vm;
7681
7763
  }
7682
7764
  }
7683
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
7765
+ Vue.version = `2.6.14-compat:${"3.5.43"}`;
7684
7766
  Vue.config = singletonApp.config;
7685
7767
  Vue.use = (plugin, ...options) => {
7686
7768
  if (plugin && isFunction(plugin.install)) {
@@ -8437,7 +8519,7 @@ function emit(instance, event, ...rawArgs) {
8437
8519
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8438
8520
  }
8439
8521
  if (modifiers.number) {
8440
- args = rawArgs.map(looseToNumber);
8522
+ args = args.map(looseToNumber);
8441
8523
  }
8442
8524
  }
8443
8525
  {
@@ -9536,6 +9618,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9536
9618
  optimized = false;
9537
9619
  n2.dynamicChildren = null;
9538
9620
  }
9621
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
9622
+ if (n2.dynamicChildren === EMPTY_ARR) {
9623
+ n2.dynamicChildren = [];
9624
+ }
9625
+ n2.dynamicChildren.hasOnce = true;
9626
+ }
9539
9627
  const { type, ref, shapeFlag } = n2;
9540
9628
  switch (type) {
9541
9629
  case Text:
@@ -10144,6 +10232,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10144
10232
  {
10145
10233
  pushWarningContext(n2);
10146
10234
  }
10235
+ n2.el = n1.el;
10147
10236
  updateComponentPreRender(instance, n2, optimized);
10148
10237
  {
10149
10238
  popWarningContext();
@@ -10759,7 +10848,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10759
10848
  cacheIndex,
10760
10849
  memo
10761
10850
  } = vnode;
10762
- if (patchFlag === -2) {
10851
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
10763
10852
  optimized = false;
10764
10853
  }
10765
10854
  if (ref != null) {
@@ -10767,7 +10856,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10767
10856
  setRef(ref, null, parentSuspense, vnode, true);
10768
10857
  resetTracking();
10769
10858
  }
10770
- if (cacheIndex != null) {
10859
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
10771
10860
  parentComponent.renderCache[cacheIndex] = void 0;
10772
10861
  }
10773
10862
  if (shapeFlag & 256) {
@@ -10848,6 +10937,9 @@ function baseCreateRenderer(options, createHydrationFns) {
10848
10937
  }
10849
10938
  if (type === Static) {
10850
10939
  removeStaticNode(vnode);
10940
+ if (transition && !transition.persisted && transition.afterLeave) {
10941
+ transition.afterLeave();
10942
+ }
10851
10943
  return;
10852
10944
  }
10853
10945
  const performRemove = () => {
@@ -10894,6 +10986,9 @@ function baseCreateRenderer(options, createHydrationFns) {
10894
10986
  if (job) {
10895
10987
  job.flags |= 8;
10896
10988
  unmount(subTree, instance, parentSuspense, doRemove);
10989
+ } else if (instance.vnode.el && subTree) {
10990
+ subTree.transition = instance.vnode.transition;
10991
+ unmount(subTree, instance, parentSuspense, doRemove);
10897
10992
  }
10898
10993
  if (um) {
10899
10994
  queuePostRenderEffect(um, parentSuspense);
@@ -11114,7 +11209,7 @@ const SuspenseImpl = {
11114
11209
  rendererInternals
11115
11210
  );
11116
11211
  } else {
11117
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
11212
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
11118
11213
  n2.suspense = n1.suspense;
11119
11214
  n2.suspense.vnode = n2;
11120
11215
  n2.el = n1.el;
@@ -11200,10 +11295,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11200
11295
  if (pendingBranch) {
11201
11296
  suspense.pendingBranch = newBranch;
11202
11297
  if (isSameVNodeType(pendingBranch, newBranch)) {
11298
+ suspense.deps++;
11203
11299
  patch(
11204
11300
  pendingBranch,
11205
11301
  newBranch,
11206
- suspense.hiddenContainer,
11302
+ // a hydrating pending branch is adopted SSR DOM, already in place
11303
+ isHydrating ? container : suspense.hiddenContainer,
11207
11304
  null,
11208
11305
  parentComponent,
11209
11306
  suspense,
@@ -11211,10 +11308,11 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11211
11308
  slotScopeIds,
11212
11309
  optimized
11213
11310
  );
11311
+ suspense.deps--;
11214
11312
  if (suspense.deps <= 0) {
11215
11313
  suspense.resolve();
11216
11314
  } else if (isInFallback) {
11217
- if (!isHydrating) {
11315
+ if (!isHydrating && !suspense.isFallbackMountPending) {
11218
11316
  patch(
11219
11317
  activeBranch,
11220
11318
  newFallback,
@@ -11255,7 +11353,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11255
11353
  );
11256
11354
  if (suspense.deps <= 0) {
11257
11355
  suspense.resolve();
11258
- } else {
11356
+ } else if (!suspense.isFallbackMountPending) {
11259
11357
  patch(
11260
11358
  activeBranch,
11261
11359
  newFallback,
@@ -11476,6 +11574,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11476
11574
  suspense.effects = [];
11477
11575
  if (isSuspensible) {
11478
11576
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
11577
+ parentSuspenseId = void 0;
11479
11578
  parentSuspense.deps--;
11480
11579
  if (parentSuspense.deps === 0 && !sync) {
11481
11580
  parentSuspense.resolve();
@@ -11496,9 +11595,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11496
11595
  if (!suspense.isInFallback) {
11497
11596
  return;
11498
11597
  }
11598
+ const latestFallback = suspense.vnode.ssFallback;
11499
11599
  patch(
11500
11600
  null,
11501
- fallbackVNode,
11601
+ latestFallback,
11502
11602
  container2,
11503
11603
  anchor2,
11504
11604
  parentComponent2,
@@ -11508,7 +11608,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11508
11608
  slotScopeIds,
11509
11609
  optimized
11510
11610
  );
11511
- setActiveBranch(suspense, fallbackVNode);
11611
+ setActiveBranch(suspense, latestFallback);
11512
11612
  };
11513
11613
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
11514
11614
  if (delayEnter) {
@@ -11548,6 +11648,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11548
11648
  return;
11549
11649
  }
11550
11650
  unsetCurrentInstance();
11651
+ if (hydratedEl && !instance.scope.active) {
11652
+ if (isInPendingSuspense && --suspense.deps === 0) {
11653
+ suspense.resolve();
11654
+ }
11655
+ return;
11656
+ }
11551
11657
  instance.asyncResolved = true;
11552
11658
  const { vnode: vnode2 } = instance;
11553
11659
  {
@@ -12033,7 +12139,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
12033
12139
  el: vnode.el,
12034
12140
  anchor: vnode.anchor,
12035
12141
  ctx: vnode.ctx,
12036
- ce: vnode.ce
12142
+ ce: vnode.ce,
12143
+ cacheIndex: vnode.cacheIndex
12037
12144
  };
12038
12145
  if (transition && cloneTransition) {
12039
12146
  setTransitionHooks(
@@ -12853,7 +12960,7 @@ function isMemoSame(cached, memo) {
12853
12960
  return true;
12854
12961
  }
12855
12962
 
12856
- const version = "3.5.41";
12963
+ const version = "3.5.43";
12857
12964
  const warn = warn$1 ;
12858
12965
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12859
12966
  const devtools = devtools$1 ;
@@ -13426,7 +13533,11 @@ function setStyle(style, name, val) {
13426
13533
  }
13427
13534
  }
13428
13535
  if (name.startsWith("--")) {
13429
- style.setProperty(name, val);
13536
+ if (importantRE.test(val)) {
13537
+ style.setProperty(name, val.replace(importantRE, ""), "important");
13538
+ } else {
13539
+ style.setProperty(name, val);
13540
+ }
13430
13541
  } else {
13431
13542
  const prefixed = autoPrefix(style, name);
13432
13543
  if (importantRE.test(val)) {
@@ -14613,13 +14724,21 @@ const vModelSelect = {
14613
14724
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14614
14725
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14615
14726
  );
14616
- el[assignKey](
14617
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14618
- );
14619
- el._assigning = true;
14620
- nextTick(() => {
14621
- el._assigning = false;
14622
- });
14727
+ const multiple = el.multiple;
14728
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
14729
+ const pending = el._pendingValue = [
14730
+ multiple,
14731
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
14732
+ ];
14733
+ try {
14734
+ el[assignKey](assignedValue);
14735
+ } finally {
14736
+ nextTick(() => {
14737
+ if (el._pendingValue === pending) {
14738
+ el._pendingValue = void 0;
14739
+ }
14740
+ });
14741
+ }
14623
14742
  });
14624
14743
  el[assignKey] = getModelAssigner(vnode);
14625
14744
  },
@@ -14633,11 +14752,25 @@ const vModelSelect = {
14633
14752
  el[assignKey] = getModelAssigner(vnode);
14634
14753
  },
14635
14754
  updated(el, { value }) {
14636
- if (!el._assigning) {
14755
+ const pending = el._pendingValue;
14756
+ el._pendingValue = void 0;
14757
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
14637
14758
  setSelected(el, value);
14638
14759
  }
14639
14760
  }
14640
14761
  };
14762
+ function isSameSelectValue(value, assignedValue, multiple) {
14763
+ if (!multiple) return looseEqual(value, assignedValue);
14764
+ if (isArray(value)) return looseEqual(value, assignedValue);
14765
+ if (isSet(value)) {
14766
+ if (value.size !== assignedValue.length) return false;
14767
+ for (const item of assignedValue) {
14768
+ if (!value.has(item)) return false;
14769
+ }
14770
+ return true;
14771
+ }
14772
+ return false;
14773
+ }
14641
14774
  function setSelected(el, value) {
14642
14775
  const isMultiple = el.multiple;
14643
14776
  const isArrayValue = isArray(value);