@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
  **/
@@ -199,10 +199,10 @@ function normalizeStyle(value) {
199
199
  }
200
200
  const listDelimiterRE = /;(?![^(]*\))/g;
201
201
  const propertyDelimiterRE = /:([^]+)/;
202
- const styleCommentRE = /\/\*[^]*?\*\//g;
202
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
203
203
  function parseStringStyle(cssText) {
204
204
  const ret = {};
205
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
205
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
206
206
  if (item) {
207
207
  const tmp = item.split(propertyDelimiterRE);
208
208
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -294,15 +294,72 @@ function getEscapedCssVarName(key, doubleEscape) {
294
294
  );
295
295
  }
296
296
 
297
- function looseCompareArrays(a, b) {
297
+ function looseCompareArrays(a, b, seen) {
298
298
  if (a.length !== b.length) return false;
299
299
  let equal = true;
300
300
  for (let i = 0; equal && i < a.length; i++) {
301
- equal = looseEqual(a[i], b[i]);
301
+ equal = looseEqual(a[i], b[i], seen);
302
302
  }
303
303
  return equal;
304
304
  }
305
- function looseEqual(a, b) {
305
+ function looseCompareCollections(a, b, seen) {
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], seen)) {
313
+ index = i;
314
+ break;
315
+ }
316
+ }
317
+ if (index < 0) return false;
318
+ matched[index] = 1;
319
+ }
320
+ return true;
321
+ }
322
+ function looseCompareObjects(a, b, seen) {
323
+ let aValidType = isMap(a);
324
+ let bValidType = isMap(b);
325
+ if (aValidType || bValidType) {
326
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
327
+ }
328
+ aValidType = isSet(a);
329
+ bValidType = isSet(b);
330
+ if (aValidType || bValidType) {
331
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
332
+ }
333
+ const aKeysCount = Object.keys(a).length;
334
+ const bKeysCount = Object.keys(b).length;
335
+ if (aKeysCount !== bKeysCount) {
336
+ return false;
337
+ }
338
+ for (const key in a) {
339
+ const aHasKey = a.hasOwnProperty(key);
340
+ const bHasKey = b.hasOwnProperty(key);
341
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
342
+ return false;
343
+ }
344
+ }
345
+ return String(a) === String(b);
346
+ }
347
+ function looseCompareNested(a, b, seen, compare) {
348
+ if (!seen) {
349
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
350
+ }
351
+ const [seenA, seenB] = seen;
352
+ if (seenA.has(a) || seenB.has(b)) {
353
+ return seenA.get(a) === b && seenB.get(b) === a;
354
+ }
355
+ seenA.set(a, b);
356
+ seenB.set(b, a);
357
+ const equal = compare(a, b, seen);
358
+ seenA.delete(a);
359
+ seenB.delete(b);
360
+ return equal;
361
+ }
362
+ function looseEqual(a, b, seen) {
306
363
  if (a === b) return true;
307
364
  let aValidType = isDate(a);
308
365
  let bValidType = isDate(b);
@@ -317,7 +374,7 @@ function looseEqual(a, b) {
317
374
  aValidType = isArray(a);
318
375
  bValidType = isArray(b);
319
376
  if (aValidType || bValidType) {
320
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
377
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
321
378
  }
322
379
  aValidType = isObject(a);
323
380
  bValidType = isObject(b);
@@ -325,18 +382,7 @@ function looseEqual(a, b) {
325
382
  if (!aValidType || !bValidType) {
326
383
  return false;
327
384
  }
328
- const aKeysCount = Object.keys(a).length;
329
- const bKeysCount = Object.keys(b).length;
330
- if (aKeysCount !== bKeysCount) {
331
- return false;
332
- }
333
- for (const key in a) {
334
- const aHasKey = a.hasOwnProperty(key);
335
- const bHasKey = b.hasOwnProperty(key);
336
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
337
- return false;
338
- }
339
- }
385
+ return looseCompareNested(a, b, seen, looseCompareObjects);
340
386
  }
341
387
  return String(a) === String(b);
342
388
  }
@@ -1141,7 +1187,9 @@ function reactiveReadArray(array) {
1141
1187
  const raw = toRaw(array);
1142
1188
  if (raw === array) return raw;
1143
1189
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1144
- return isShallow(array) ? raw : raw.map(toReactive);
1190
+ if (isShallow(array)) return raw;
1191
+ if (!isReadonly(array)) return raw.map(toReactive);
1192
+ return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
1145
1193
  }
1146
1194
  function shallowReadArray(arr) {
1147
1195
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4897,13 +4945,15 @@ function createHydrationFunctions(rendererInternals) {
4897
4945
  getContainerType(container),
4898
4946
  optimized
4899
4947
  );
4900
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4948
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4901
4949
  let subTree;
4902
4950
  if (isFragmentStart) {
4903
- subTree = createVNode(Fragment);
4951
+ subTree = createVNode(Static);
4904
4952
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4905
4953
  } else {
4906
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4954
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4955
+ node.nodeType === 8 ? Comment : "div"
4956
+ );
4907
4957
  }
4908
4958
  subTree.el = node;
4909
4959
  vnode.component.subTree = subTree;
@@ -5821,7 +5871,10 @@ const KeepAliveImpl = {
5821
5871
  if (pendingCacheKey != null) {
5822
5872
  if (isSuspense(instance.subTree.type)) {
5823
5873
  queuePostRenderEffect(() => {
5824
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5874
+ const vnode = getInnerChild(instance.subTree);
5875
+ if (vnode.component) {
5876
+ cache.set(pendingCacheKey, vnode);
5877
+ }
5825
5878
  }, instance.subTree.suspense);
5826
5879
  } else {
5827
5880
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6742,12 +6795,41 @@ const getPublicInstance = (i) => {
6742
6795
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
6743
6796
  return getPublicInstance(i.parent);
6744
6797
  };
6798
+ const resolveDevRootEl = (vnode) => {
6799
+ let found = false;
6800
+ while (true) {
6801
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
6802
+ const root = filterSingleRoot(vnode.children);
6803
+ if (!root) {
6804
+ return;
6805
+ }
6806
+ vnode = root;
6807
+ found = true;
6808
+ continue;
6809
+ }
6810
+ const component = vnode.component;
6811
+ if (component && component.subTree) {
6812
+ vnode = component.subTree;
6813
+ continue;
6814
+ }
6815
+ const suspense = vnode.suspense;
6816
+ if (suspense && suspense.activeBranch) {
6817
+ vnode = suspense.activeBranch;
6818
+ continue;
6819
+ }
6820
+ return found ? vnode.el : void 0;
6821
+ }
6822
+ };
6823
+ const getDevRootFragmentEl = (i) => {
6824
+ const el = i.subTree && resolveDevRootEl(i.subTree);
6825
+ return el === void 0 ? i.vnode.el : el;
6826
+ };
6745
6827
  const publicPropertiesMap = (
6746
6828
  // Move PURE marker to new line to workaround compiler discarding it
6747
6829
  // due to type annotation
6748
6830
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
6749
6831
  $: (i) => i,
6750
- $el: (i) => i.vnode.el,
6832
+ $el: (i) => !!(process.env.NODE_ENV !== "production") ? getDevRootFragmentEl(i) : i.vnode.el,
6751
6833
  $data: (i) => i.data,
6752
6834
  $props: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.props) : i.props,
6753
6835
  $attrs: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.attrs) : i.attrs,
@@ -7663,7 +7745,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7663
7745
  return vm;
7664
7746
  }
7665
7747
  }
7666
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
7748
+ Vue.version = `2.6.14-compat:${"3.5.43"}`;
7667
7749
  Vue.config = singletonApp.config;
7668
7750
  Vue.use = (plugin, ...options) => {
7669
7751
  if (plugin && isFunction(plugin.install)) {
@@ -8422,7 +8504,7 @@ function emit(instance, event, ...rawArgs) {
8422
8504
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8423
8505
  }
8424
8506
  if (modifiers.number) {
8425
- args = rawArgs.map(looseToNumber);
8507
+ args = args.map(looseToNumber);
8426
8508
  }
8427
8509
  }
8428
8510
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
@@ -9548,6 +9630,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9548
9630
  optimized = false;
9549
9631
  n2.dynamicChildren = null;
9550
9632
  }
9633
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
9634
+ if (n2.dynamicChildren === EMPTY_ARR) {
9635
+ n2.dynamicChildren = [];
9636
+ }
9637
+ n2.dynamicChildren.hasOnce = true;
9638
+ }
9551
9639
  const { type, ref, shapeFlag } = n2;
9552
9640
  switch (type) {
9553
9641
  case Text:
@@ -10167,6 +10255,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10167
10255
  if (!!(process.env.NODE_ENV !== "production")) {
10168
10256
  pushWarningContext(n2);
10169
10257
  }
10258
+ n2.el = n1.el;
10170
10259
  updateComponentPreRender(instance, n2, optimized);
10171
10260
  if (!!(process.env.NODE_ENV !== "production")) {
10172
10261
  popWarningContext();
@@ -10782,7 +10871,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10782
10871
  cacheIndex,
10783
10872
  memo
10784
10873
  } = vnode;
10785
- if (patchFlag === -2) {
10874
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
10786
10875
  optimized = false;
10787
10876
  }
10788
10877
  if (ref != null) {
@@ -10790,7 +10879,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10790
10879
  setRef(ref, null, parentSuspense, vnode, true);
10791
10880
  resetTracking();
10792
10881
  }
10793
- if (cacheIndex != null) {
10882
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
10794
10883
  parentComponent.renderCache[cacheIndex] = void 0;
10795
10884
  }
10796
10885
  if (shapeFlag & 256) {
@@ -10871,6 +10960,9 @@ function baseCreateRenderer(options, createHydrationFns) {
10871
10960
  }
10872
10961
  if (type === Static) {
10873
10962
  removeStaticNode(vnode);
10963
+ if (transition && !transition.persisted && transition.afterLeave) {
10964
+ transition.afterLeave();
10965
+ }
10874
10966
  return;
10875
10967
  }
10876
10968
  const performRemove = () => {
@@ -10917,6 +11009,9 @@ function baseCreateRenderer(options, createHydrationFns) {
10917
11009
  if (job) {
10918
11010
  job.flags |= 8;
10919
11011
  unmount(subTree, instance, parentSuspense, doRemove);
11012
+ } else if (instance.vnode.el && subTree) {
11013
+ subTree.transition = instance.vnode.transition;
11014
+ unmount(subTree, instance, parentSuspense, doRemove);
10920
11015
  }
10921
11016
  if (um) {
10922
11017
  queuePostRenderEffect(um, parentSuspense);
@@ -11137,7 +11232,7 @@ const SuspenseImpl = {
11137
11232
  rendererInternals
11138
11233
  );
11139
11234
  } else {
11140
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
11235
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
11141
11236
  n2.suspense = n1.suspense;
11142
11237
  n2.suspense.vnode = n2;
11143
11238
  n2.el = n1.el;
@@ -11223,10 +11318,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11223
11318
  if (pendingBranch) {
11224
11319
  suspense.pendingBranch = newBranch;
11225
11320
  if (isSameVNodeType(pendingBranch, newBranch)) {
11321
+ suspense.deps++;
11226
11322
  patch(
11227
11323
  pendingBranch,
11228
11324
  newBranch,
11229
- suspense.hiddenContainer,
11325
+ // a hydrating pending branch is adopted SSR DOM, already in place
11326
+ isHydrating ? container : suspense.hiddenContainer,
11230
11327
  null,
11231
11328
  parentComponent,
11232
11329
  suspense,
@@ -11234,10 +11331,11 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11234
11331
  slotScopeIds,
11235
11332
  optimized
11236
11333
  );
11334
+ suspense.deps--;
11237
11335
  if (suspense.deps <= 0) {
11238
11336
  suspense.resolve();
11239
11337
  } else if (isInFallback) {
11240
- if (!isHydrating) {
11338
+ if (!isHydrating && !suspense.isFallbackMountPending) {
11241
11339
  patch(
11242
11340
  activeBranch,
11243
11341
  newFallback,
@@ -11278,7 +11376,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11278
11376
  );
11279
11377
  if (suspense.deps <= 0) {
11280
11378
  suspense.resolve();
11281
- } else {
11379
+ } else if (!suspense.isFallbackMountPending) {
11282
11380
  patch(
11283
11381
  activeBranch,
11284
11382
  newFallback,
@@ -11499,6 +11597,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11499
11597
  suspense.effects = [];
11500
11598
  if (isSuspensible) {
11501
11599
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
11600
+ parentSuspenseId = void 0;
11502
11601
  parentSuspense.deps--;
11503
11602
  if (parentSuspense.deps === 0 && !sync) {
11504
11603
  parentSuspense.resolve();
@@ -11519,9 +11618,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11519
11618
  if (!suspense.isInFallback) {
11520
11619
  return;
11521
11620
  }
11621
+ const latestFallback = suspense.vnode.ssFallback;
11522
11622
  patch(
11523
11623
  null,
11524
- fallbackVNode,
11624
+ latestFallback,
11525
11625
  container2,
11526
11626
  anchor2,
11527
11627
  parentComponent2,
@@ -11531,7 +11631,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11531
11631
  slotScopeIds,
11532
11632
  optimized
11533
11633
  );
11534
- setActiveBranch(suspense, fallbackVNode);
11634
+ setActiveBranch(suspense, latestFallback);
11535
11635
  };
11536
11636
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
11537
11637
  if (delayEnter) {
@@ -11571,6 +11671,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11571
11671
  return;
11572
11672
  }
11573
11673
  unsetCurrentInstance();
11674
+ if (hydratedEl && !instance.scope.active) {
11675
+ if (isInPendingSuspense && --suspense.deps === 0) {
11676
+ suspense.resolve();
11677
+ }
11678
+ return;
11679
+ }
11574
11680
  instance.asyncResolved = true;
11575
11681
  const { vnode: vnode2 } = instance;
11576
11682
  if (!!(process.env.NODE_ENV !== "production")) {
@@ -12056,7 +12162,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
12056
12162
  el: vnode.el,
12057
12163
  anchor: vnode.anchor,
12058
12164
  ctx: vnode.ctx,
12059
- ce: vnode.ce
12165
+ ce: vnode.ce,
12166
+ cacheIndex: vnode.cacheIndex
12060
12167
  };
12061
12168
  if (transition && cloneTransition) {
12062
12169
  setTransitionHooks(
@@ -12890,7 +12997,7 @@ function isMemoSame(cached, memo) {
12890
12997
  return true;
12891
12998
  }
12892
12999
 
12893
- const version = "3.5.41";
13000
+ const version = "3.5.43";
12894
13001
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12895
13002
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12896
13003
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13531,7 +13638,11 @@ function setStyle(style, name, val) {
13531
13638
  }
13532
13639
  }
13533
13640
  if (name.startsWith("--")) {
13534
- style.setProperty(name, val);
13641
+ if (importantRE.test(val)) {
13642
+ style.setProperty(name, val.replace(importantRE, ""), "important");
13643
+ } else {
13644
+ style.setProperty(name, val);
13645
+ }
13535
13646
  } else {
13536
13647
  const prefixed = autoPrefix(style, name);
13537
13648
  if (importantRE.test(val)) {
@@ -14718,13 +14829,21 @@ const vModelSelect = {
14718
14829
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14719
14830
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14720
14831
  );
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
- });
14832
+ const multiple = el.multiple;
14833
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
14834
+ const pending = el._pendingValue = [
14835
+ multiple,
14836
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
14837
+ ];
14838
+ try {
14839
+ el[assignKey](assignedValue);
14840
+ } finally {
14841
+ nextTick(() => {
14842
+ if (el._pendingValue === pending) {
14843
+ el._pendingValue = void 0;
14844
+ }
14845
+ });
14846
+ }
14728
14847
  });
14729
14848
  el[assignKey] = getModelAssigner(vnode);
14730
14849
  },
@@ -14738,11 +14857,25 @@ const vModelSelect = {
14738
14857
  el[assignKey] = getModelAssigner(vnode);
14739
14858
  },
14740
14859
  updated(el, { value }) {
14741
- if (!el._assigning) {
14860
+ const pending = el._pendingValue;
14861
+ el._pendingValue = void 0;
14862
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
14742
14863
  setSelected(el, value);
14743
14864
  }
14744
14865
  }
14745
14866
  };
14867
+ function isSameSelectValue(value, assignedValue, multiple) {
14868
+ if (!multiple) return looseEqual(value, assignedValue);
14869
+ if (isArray(value)) return looseEqual(value, assignedValue);
14870
+ if (isSet(value)) {
14871
+ if (value.size !== assignedValue.length) return false;
14872
+ for (const item of assignedValue) {
14873
+ if (!value.has(item)) return false;
14874
+ }
14875
+ return true;
14876
+ }
14877
+ return false;
14878
+ }
14746
14879
  function setSelected(el, value) {
14747
14880
  const isMultiple = el.multiple;
14748
14881
  const isArrayValue = isArray(value);