@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
  **/
@@ -128,10 +128,10 @@ function normalizeStyle(value) {
128
128
  }
129
129
  const listDelimiterRE = /;(?![^(]*\))/g;
130
130
  const propertyDelimiterRE = /:([^]+)/;
131
- const styleCommentRE = /\/\*[^]*?\*\//g;
131
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
132
132
  function parseStringStyle(cssText) {
133
133
  const ret = {};
134
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
134
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
135
135
  if (item) {
136
136
  const tmp = item.split(propertyDelimiterRE);
137
137
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -221,15 +221,72 @@ function getEscapedCssVarName(key, doubleEscape) {
221
221
  );
222
222
  }
223
223
 
224
- function looseCompareArrays(a, b) {
224
+ function looseCompareArrays(a, b, seen) {
225
225
  if (a.length !== b.length) return false;
226
226
  let equal = true;
227
227
  for (let i = 0; equal && i < a.length; i++) {
228
- equal = looseEqual(a[i], b[i]);
228
+ equal = looseEqual(a[i], b[i], seen);
229
229
  }
230
230
  return equal;
231
231
  }
232
- function looseEqual(a, b) {
232
+ function looseCompareCollections(a, b, seen) {
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], seen)) {
240
+ index = i;
241
+ break;
242
+ }
243
+ }
244
+ if (index < 0) return false;
245
+ matched[index] = 1;
246
+ }
247
+ return true;
248
+ }
249
+ function looseCompareObjects(a, b, seen) {
250
+ let aValidType = isMap(a);
251
+ let bValidType = isMap(b);
252
+ if (aValidType || bValidType) {
253
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
254
+ }
255
+ aValidType = isSet(a);
256
+ bValidType = isSet(b);
257
+ if (aValidType || bValidType) {
258
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
259
+ }
260
+ const aKeysCount = Object.keys(a).length;
261
+ const bKeysCount = Object.keys(b).length;
262
+ if (aKeysCount !== bKeysCount) {
263
+ return false;
264
+ }
265
+ for (const key in a) {
266
+ const aHasKey = a.hasOwnProperty(key);
267
+ const bHasKey = b.hasOwnProperty(key);
268
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
269
+ return false;
270
+ }
271
+ }
272
+ return String(a) === String(b);
273
+ }
274
+ function looseCompareNested(a, b, seen, compare) {
275
+ if (!seen) {
276
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
277
+ }
278
+ const [seenA, seenB] = seen;
279
+ if (seenA.has(a) || seenB.has(b)) {
280
+ return seenA.get(a) === b && seenB.get(b) === a;
281
+ }
282
+ seenA.set(a, b);
283
+ seenB.set(b, a);
284
+ const equal = compare(a, b, seen);
285
+ seenA.delete(a);
286
+ seenB.delete(b);
287
+ return equal;
288
+ }
289
+ function looseEqual(a, b, seen) {
233
290
  if (a === b) return true;
234
291
  let aValidType = isDate(a);
235
292
  let bValidType = isDate(b);
@@ -244,7 +301,7 @@ function looseEqual(a, b) {
244
301
  aValidType = isArray(a);
245
302
  bValidType = isArray(b);
246
303
  if (aValidType || bValidType) {
247
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
304
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
248
305
  }
249
306
  aValidType = isObject(a);
250
307
  bValidType = isObject(b);
@@ -252,18 +309,7 @@ function looseEqual(a, b) {
252
309
  if (!aValidType || !bValidType) {
253
310
  return false;
254
311
  }
255
- const aKeysCount = Object.keys(a).length;
256
- const bKeysCount = Object.keys(b).length;
257
- if (aKeysCount !== bKeysCount) {
258
- return false;
259
- }
260
- for (const key in a) {
261
- const aHasKey = a.hasOwnProperty(key);
262
- const bHasKey = b.hasOwnProperty(key);
263
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
264
- return false;
265
- }
266
- }
312
+ return looseCompareNested(a, b, seen, looseCompareObjects);
267
313
  }
268
314
  return String(a) === String(b);
269
315
  }
@@ -1068,7 +1114,9 @@ function reactiveReadArray(array) {
1068
1114
  const raw = toRaw(array);
1069
1115
  if (raw === array) return raw;
1070
1116
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1071
- return isShallow(array) ? raw : raw.map(toReactive);
1117
+ if (isShallow(array)) return raw;
1118
+ if (!isReadonly(array)) return raw.map(toReactive);
1119
+ return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
1072
1120
  }
1073
1121
  function shallowReadArray(arr) {
1074
1122
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4824,13 +4872,15 @@ function createHydrationFunctions(rendererInternals) {
4824
4872
  getContainerType(container),
4825
4873
  optimized
4826
4874
  );
4827
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4875
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4828
4876
  let subTree;
4829
4877
  if (isFragmentStart) {
4830
- subTree = createVNode(Fragment);
4878
+ subTree = createVNode(Static);
4831
4879
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4832
4880
  } else {
4833
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4881
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4882
+ node.nodeType === 8 ? Comment : "div"
4883
+ );
4834
4884
  }
4835
4885
  subTree.el = node;
4836
4886
  vnode.component.subTree = subTree;
@@ -5748,7 +5798,10 @@ const KeepAliveImpl = {
5748
5798
  if (pendingCacheKey != null) {
5749
5799
  if (isSuspense(instance.subTree.type)) {
5750
5800
  queuePostRenderEffect(() => {
5751
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5801
+ const vnode = getInnerChild(instance.subTree);
5802
+ if (vnode.component) {
5803
+ cache.set(pendingCacheKey, vnode);
5804
+ }
5752
5805
  }, instance.subTree.suspense);
5753
5806
  } else {
5754
5807
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6669,12 +6722,41 @@ const getPublicInstance = (i) => {
6669
6722
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
6670
6723
  return getPublicInstance(i.parent);
6671
6724
  };
6725
+ const resolveDevRootEl = (vnode) => {
6726
+ let found = false;
6727
+ while (true) {
6728
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
6729
+ const root = filterSingleRoot(vnode.children);
6730
+ if (!root) {
6731
+ return;
6732
+ }
6733
+ vnode = root;
6734
+ found = true;
6735
+ continue;
6736
+ }
6737
+ const component = vnode.component;
6738
+ if (component && component.subTree) {
6739
+ vnode = component.subTree;
6740
+ continue;
6741
+ }
6742
+ const suspense = vnode.suspense;
6743
+ if (suspense && suspense.activeBranch) {
6744
+ vnode = suspense.activeBranch;
6745
+ continue;
6746
+ }
6747
+ return found ? vnode.el : void 0;
6748
+ }
6749
+ };
6750
+ const getDevRootFragmentEl = (i) => {
6751
+ const el = i.subTree && resolveDevRootEl(i.subTree);
6752
+ return el === void 0 ? i.vnode.el : el;
6753
+ };
6672
6754
  const publicPropertiesMap = (
6673
6755
  // Move PURE marker to new line to workaround compiler discarding it
6674
6756
  // due to type annotation
6675
6757
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
6676
6758
  $: (i) => i,
6677
- $el: (i) => i.vnode.el,
6759
+ $el: (i) => !!(process.env.NODE_ENV !== "production") ? getDevRootFragmentEl(i) : i.vnode.el,
6678
6760
  $data: (i) => i.data,
6679
6761
  $props: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.props) : i.props,
6680
6762
  $attrs: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.attrs) : i.attrs,
@@ -7590,7 +7672,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7590
7672
  return vm;
7591
7673
  }
7592
7674
  }
7593
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
7675
+ Vue.version = `2.6.14-compat:${"3.5.43"}`;
7594
7676
  Vue.config = singletonApp.config;
7595
7677
  Vue.use = (plugin, ...options) => {
7596
7678
  if (plugin && isFunction(plugin.install)) {
@@ -8349,7 +8431,7 @@ function emit(instance, event, ...rawArgs) {
8349
8431
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8350
8432
  }
8351
8433
  if (modifiers.number) {
8352
- args = rawArgs.map(looseToNumber);
8434
+ args = args.map(looseToNumber);
8353
8435
  }
8354
8436
  }
8355
8437
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
@@ -9475,6 +9557,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9475
9557
  optimized = false;
9476
9558
  n2.dynamicChildren = null;
9477
9559
  }
9560
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
9561
+ if (n2.dynamicChildren === EMPTY_ARR) {
9562
+ n2.dynamicChildren = [];
9563
+ }
9564
+ n2.dynamicChildren.hasOnce = true;
9565
+ }
9478
9566
  const { type, ref, shapeFlag } = n2;
9479
9567
  switch (type) {
9480
9568
  case Text:
@@ -10094,6 +10182,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10094
10182
  if (!!(process.env.NODE_ENV !== "production")) {
10095
10183
  pushWarningContext(n2);
10096
10184
  }
10185
+ n2.el = n1.el;
10097
10186
  updateComponentPreRender(instance, n2, optimized);
10098
10187
  if (!!(process.env.NODE_ENV !== "production")) {
10099
10188
  popWarningContext();
@@ -10709,7 +10798,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10709
10798
  cacheIndex,
10710
10799
  memo
10711
10800
  } = vnode;
10712
- if (patchFlag === -2) {
10801
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
10713
10802
  optimized = false;
10714
10803
  }
10715
10804
  if (ref != null) {
@@ -10717,7 +10806,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10717
10806
  setRef(ref, null, parentSuspense, vnode, true);
10718
10807
  resetTracking();
10719
10808
  }
10720
- if (cacheIndex != null) {
10809
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
10721
10810
  parentComponent.renderCache[cacheIndex] = void 0;
10722
10811
  }
10723
10812
  if (shapeFlag & 256) {
@@ -10798,6 +10887,9 @@ function baseCreateRenderer(options, createHydrationFns) {
10798
10887
  }
10799
10888
  if (type === Static) {
10800
10889
  removeStaticNode(vnode);
10890
+ if (transition && !transition.persisted && transition.afterLeave) {
10891
+ transition.afterLeave();
10892
+ }
10801
10893
  return;
10802
10894
  }
10803
10895
  const performRemove = () => {
@@ -10844,6 +10936,9 @@ function baseCreateRenderer(options, createHydrationFns) {
10844
10936
  if (job) {
10845
10937
  job.flags |= 8;
10846
10938
  unmount(subTree, instance, parentSuspense, doRemove);
10939
+ } else if (instance.vnode.el && subTree) {
10940
+ subTree.transition = instance.vnode.transition;
10941
+ unmount(subTree, instance, parentSuspense, doRemove);
10847
10942
  }
10848
10943
  if (um) {
10849
10944
  queuePostRenderEffect(um, parentSuspense);
@@ -11064,7 +11159,7 @@ const SuspenseImpl = {
11064
11159
  rendererInternals
11065
11160
  );
11066
11161
  } else {
11067
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
11162
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
11068
11163
  n2.suspense = n1.suspense;
11069
11164
  n2.suspense.vnode = n2;
11070
11165
  n2.el = n1.el;
@@ -11150,10 +11245,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11150
11245
  if (pendingBranch) {
11151
11246
  suspense.pendingBranch = newBranch;
11152
11247
  if (isSameVNodeType(pendingBranch, newBranch)) {
11248
+ suspense.deps++;
11153
11249
  patch(
11154
11250
  pendingBranch,
11155
11251
  newBranch,
11156
- suspense.hiddenContainer,
11252
+ // a hydrating pending branch is adopted SSR DOM, already in place
11253
+ isHydrating ? container : suspense.hiddenContainer,
11157
11254
  null,
11158
11255
  parentComponent,
11159
11256
  suspense,
@@ -11161,10 +11258,11 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11161
11258
  slotScopeIds,
11162
11259
  optimized
11163
11260
  );
11261
+ suspense.deps--;
11164
11262
  if (suspense.deps <= 0) {
11165
11263
  suspense.resolve();
11166
11264
  } else if (isInFallback) {
11167
- if (!isHydrating) {
11265
+ if (!isHydrating && !suspense.isFallbackMountPending) {
11168
11266
  patch(
11169
11267
  activeBranch,
11170
11268
  newFallback,
@@ -11205,7 +11303,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11205
11303
  );
11206
11304
  if (suspense.deps <= 0) {
11207
11305
  suspense.resolve();
11208
- } else {
11306
+ } else if (!suspense.isFallbackMountPending) {
11209
11307
  patch(
11210
11308
  activeBranch,
11211
11309
  newFallback,
@@ -11426,6 +11524,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11426
11524
  suspense.effects = [];
11427
11525
  if (isSuspensible) {
11428
11526
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
11527
+ parentSuspenseId = void 0;
11429
11528
  parentSuspense.deps--;
11430
11529
  if (parentSuspense.deps === 0 && !sync) {
11431
11530
  parentSuspense.resolve();
@@ -11446,9 +11545,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11446
11545
  if (!suspense.isInFallback) {
11447
11546
  return;
11448
11547
  }
11548
+ const latestFallback = suspense.vnode.ssFallback;
11449
11549
  patch(
11450
11550
  null,
11451
- fallbackVNode,
11551
+ latestFallback,
11452
11552
  container2,
11453
11553
  anchor2,
11454
11554
  parentComponent2,
@@ -11458,7 +11558,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11458
11558
  slotScopeIds,
11459
11559
  optimized
11460
11560
  );
11461
- setActiveBranch(suspense, fallbackVNode);
11561
+ setActiveBranch(suspense, latestFallback);
11462
11562
  };
11463
11563
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
11464
11564
  if (delayEnter) {
@@ -11498,6 +11598,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11498
11598
  return;
11499
11599
  }
11500
11600
  unsetCurrentInstance();
11601
+ if (hydratedEl && !instance.scope.active) {
11602
+ if (isInPendingSuspense && --suspense.deps === 0) {
11603
+ suspense.resolve();
11604
+ }
11605
+ return;
11606
+ }
11501
11607
  instance.asyncResolved = true;
11502
11608
  const { vnode: vnode2 } = instance;
11503
11609
  if (!!(process.env.NODE_ENV !== "production")) {
@@ -11983,7 +12089,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
11983
12089
  el: vnode.el,
11984
12090
  anchor: vnode.anchor,
11985
12091
  ctx: vnode.ctx,
11986
- ce: vnode.ce
12092
+ ce: vnode.ce,
12093
+ cacheIndex: vnode.cacheIndex
11987
12094
  };
11988
12095
  if (transition && cloneTransition) {
11989
12096
  setTransitionHooks(
@@ -12817,7 +12924,7 @@ function isMemoSame(cached, memo) {
12817
12924
  return true;
12818
12925
  }
12819
12926
 
12820
- const version = "3.5.41";
12927
+ const version = "3.5.43";
12821
12928
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12822
12929
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12823
12930
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13458,7 +13565,11 @@ function setStyle(style, name, val) {
13458
13565
  }
13459
13566
  }
13460
13567
  if (name.startsWith("--")) {
13461
- style.setProperty(name, val);
13568
+ if (importantRE.test(val)) {
13569
+ style.setProperty(name, val.replace(importantRE, ""), "important");
13570
+ } else {
13571
+ style.setProperty(name, val);
13572
+ }
13462
13573
  } else {
13463
13574
  const prefixed = autoPrefix(style, name);
13464
13575
  if (importantRE.test(val)) {
@@ -14645,13 +14756,21 @@ const vModelSelect = {
14645
14756
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14646
14757
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14647
14758
  );
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
- });
14759
+ const multiple = el.multiple;
14760
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
14761
+ const pending = el._pendingValue = [
14762
+ multiple,
14763
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
14764
+ ];
14765
+ try {
14766
+ el[assignKey](assignedValue);
14767
+ } finally {
14768
+ nextTick(() => {
14769
+ if (el._pendingValue === pending) {
14770
+ el._pendingValue = void 0;
14771
+ }
14772
+ });
14773
+ }
14655
14774
  });
14656
14775
  el[assignKey] = getModelAssigner(vnode);
14657
14776
  },
@@ -14665,11 +14784,25 @@ const vModelSelect = {
14665
14784
  el[assignKey] = getModelAssigner(vnode);
14666
14785
  },
14667
14786
  updated(el, { value }) {
14668
- if (!el._assigning) {
14787
+ const pending = el._pendingValue;
14788
+ el._pendingValue = void 0;
14789
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
14669
14790
  setSelected(el, value);
14670
14791
  }
14671
14792
  }
14672
14793
  };
14794
+ function isSameSelectValue(value, assignedValue, multiple) {
14795
+ if (!multiple) return looseEqual(value, assignedValue);
14796
+ if (isArray(value)) return looseEqual(value, assignedValue);
14797
+ if (isSet(value)) {
14798
+ if (value.size !== assignedValue.length) return false;
14799
+ for (const item of assignedValue) {
14800
+ if (!value.has(item)) return false;
14801
+ }
14802
+ return true;
14803
+ }
14804
+ return false;
14805
+ }
14673
14806
  function setSelected(el, value) {
14674
14807
  const isMultiple = el.multiple;
14675
14808
  const isArrayValue = isArray(value);