@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
  }
@@ -1064,7 +1110,9 @@ function reactiveReadArray(array) {
1064
1110
  const raw = toRaw(array);
1065
1111
  if (raw === array) return raw;
1066
1112
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1067
- return isShallow(array) ? raw : raw.map(toReactive);
1113
+ if (isShallow(array)) return raw;
1114
+ if (!isReadonly(array)) return raw.map(toReactive);
1115
+ return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
1068
1116
  }
1069
1117
  function shallowReadArray(arr) {
1070
1118
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4805,13 +4853,15 @@ function createHydrationFunctions(rendererInternals) {
4805
4853
  getContainerType(container),
4806
4854
  optimized
4807
4855
  );
4808
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4856
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4809
4857
  let subTree;
4810
4858
  if (isFragmentStart) {
4811
- subTree = createVNode(Fragment);
4859
+ subTree = createVNode(Static);
4812
4860
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4813
4861
  } else {
4814
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4862
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4863
+ node.nodeType === 8 ? Comment : "div"
4864
+ );
4815
4865
  }
4816
4866
  subTree.el = node;
4817
4867
  vnode.component.subTree = subTree;
@@ -5717,7 +5767,10 @@ const KeepAliveImpl = {
5717
5767
  if (pendingCacheKey != null) {
5718
5768
  if (isSuspense(instance.subTree.type)) {
5719
5769
  queuePostRenderEffect(() => {
5720
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5770
+ const vnode = getInnerChild(instance.subTree);
5771
+ if (vnode.component) {
5772
+ cache.set(pendingCacheKey, vnode);
5773
+ }
5721
5774
  }, instance.subTree.suspense);
5722
5775
  } else {
5723
5776
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6638,12 +6691,41 @@ const getPublicInstance = (i) => {
6638
6691
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
6639
6692
  return getPublicInstance(i.parent);
6640
6693
  };
6694
+ const resolveDevRootEl = (vnode) => {
6695
+ let found = false;
6696
+ while (true) {
6697
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
6698
+ const root = filterSingleRoot(vnode.children);
6699
+ if (!root) {
6700
+ return;
6701
+ }
6702
+ vnode = root;
6703
+ found = true;
6704
+ continue;
6705
+ }
6706
+ const component = vnode.component;
6707
+ if (component && component.subTree) {
6708
+ vnode = component.subTree;
6709
+ continue;
6710
+ }
6711
+ const suspense = vnode.suspense;
6712
+ if (suspense && suspense.activeBranch) {
6713
+ vnode = suspense.activeBranch;
6714
+ continue;
6715
+ }
6716
+ return found ? vnode.el : void 0;
6717
+ }
6718
+ };
6719
+ const getDevRootFragmentEl = (i) => {
6720
+ const el = i.subTree && resolveDevRootEl(i.subTree);
6721
+ return el === void 0 ? i.vnode.el : el;
6722
+ };
6641
6723
  const publicPropertiesMap = (
6642
6724
  // Move PURE marker to new line to workaround compiler discarding it
6643
6725
  // due to type annotation
6644
6726
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
6645
6727
  $: (i) => i,
6646
- $el: (i) => i.vnode.el,
6728
+ $el: (i) => getDevRootFragmentEl(i) ,
6647
6729
  $data: (i) => i.data,
6648
6730
  $props: (i) => shallowReadonly(i.props) ,
6649
6731
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -7557,7 +7639,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7557
7639
  return vm;
7558
7640
  }
7559
7641
  }
7560
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
7642
+ Vue.version = `2.6.14-compat:${"3.5.43"}`;
7561
7643
  Vue.config = singletonApp.config;
7562
7644
  Vue.use = (plugin, ...options) => {
7563
7645
  if (plugin && isFunction(plugin.install)) {
@@ -8314,7 +8396,7 @@ function emit(instance, event, ...rawArgs) {
8314
8396
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8315
8397
  }
8316
8398
  if (modifiers.number) {
8317
- args = rawArgs.map(looseToNumber);
8399
+ args = args.map(looseToNumber);
8318
8400
  }
8319
8401
  }
8320
8402
  {
@@ -9413,6 +9495,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9413
9495
  optimized = false;
9414
9496
  n2.dynamicChildren = null;
9415
9497
  }
9498
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
9499
+ if (n2.dynamicChildren === EMPTY_ARR) {
9500
+ n2.dynamicChildren = [];
9501
+ }
9502
+ n2.dynamicChildren.hasOnce = true;
9503
+ }
9416
9504
  const { type, ref, shapeFlag } = n2;
9417
9505
  switch (type) {
9418
9506
  case Text:
@@ -10021,6 +10109,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10021
10109
  {
10022
10110
  pushWarningContext(n2);
10023
10111
  }
10112
+ n2.el = n1.el;
10024
10113
  updateComponentPreRender(instance, n2, optimized);
10025
10114
  {
10026
10115
  popWarningContext();
@@ -10636,7 +10725,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10636
10725
  cacheIndex,
10637
10726
  memo
10638
10727
  } = vnode;
10639
- if (patchFlag === -2) {
10728
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
10640
10729
  optimized = false;
10641
10730
  }
10642
10731
  if (ref != null) {
@@ -10644,7 +10733,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10644
10733
  setRef(ref, null, parentSuspense, vnode, true);
10645
10734
  resetTracking();
10646
10735
  }
10647
- if (cacheIndex != null) {
10736
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
10648
10737
  parentComponent.renderCache[cacheIndex] = void 0;
10649
10738
  }
10650
10739
  if (shapeFlag & 256) {
@@ -10725,6 +10814,9 @@ function baseCreateRenderer(options, createHydrationFns) {
10725
10814
  }
10726
10815
  if (type === Static) {
10727
10816
  removeStaticNode(vnode);
10817
+ if (transition && !transition.persisted && transition.afterLeave) {
10818
+ transition.afterLeave();
10819
+ }
10728
10820
  return;
10729
10821
  }
10730
10822
  const performRemove = () => {
@@ -10771,6 +10863,9 @@ function baseCreateRenderer(options, createHydrationFns) {
10771
10863
  if (job) {
10772
10864
  job.flags |= 8;
10773
10865
  unmount(subTree, instance, parentSuspense, doRemove);
10866
+ } else if (instance.vnode.el && subTree) {
10867
+ subTree.transition = instance.vnode.transition;
10868
+ unmount(subTree, instance, parentSuspense, doRemove);
10774
10869
  }
10775
10870
  if (um) {
10776
10871
  queuePostRenderEffect(um, parentSuspense);
@@ -10991,7 +11086,7 @@ const SuspenseImpl = {
10991
11086
  rendererInternals
10992
11087
  );
10993
11088
  } else {
10994
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
11089
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
10995
11090
  n2.suspense = n1.suspense;
10996
11091
  n2.suspense.vnode = n2;
10997
11092
  n2.el = n1.el;
@@ -11077,10 +11172,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11077
11172
  if (pendingBranch) {
11078
11173
  suspense.pendingBranch = newBranch;
11079
11174
  if (isSameVNodeType(pendingBranch, newBranch)) {
11175
+ suspense.deps++;
11080
11176
  patch(
11081
11177
  pendingBranch,
11082
11178
  newBranch,
11083
- suspense.hiddenContainer,
11179
+ // a hydrating pending branch is adopted SSR DOM, already in place
11180
+ isHydrating ? container : suspense.hiddenContainer,
11084
11181
  null,
11085
11182
  parentComponent,
11086
11183
  suspense,
@@ -11088,10 +11185,11 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11088
11185
  slotScopeIds,
11089
11186
  optimized
11090
11187
  );
11188
+ suspense.deps--;
11091
11189
  if (suspense.deps <= 0) {
11092
11190
  suspense.resolve();
11093
11191
  } else if (isInFallback) {
11094
- if (!isHydrating) {
11192
+ if (!isHydrating && !suspense.isFallbackMountPending) {
11095
11193
  patch(
11096
11194
  activeBranch,
11097
11195
  newFallback,
@@ -11132,7 +11230,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11132
11230
  );
11133
11231
  if (suspense.deps <= 0) {
11134
11232
  suspense.resolve();
11135
- } else {
11233
+ } else if (!suspense.isFallbackMountPending) {
11136
11234
  patch(
11137
11235
  activeBranch,
11138
11236
  newFallback,
@@ -11353,6 +11451,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11353
11451
  suspense.effects = [];
11354
11452
  if (isSuspensible) {
11355
11453
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
11454
+ parentSuspenseId = void 0;
11356
11455
  parentSuspense.deps--;
11357
11456
  if (parentSuspense.deps === 0 && !sync) {
11358
11457
  parentSuspense.resolve();
@@ -11373,9 +11472,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11373
11472
  if (!suspense.isInFallback) {
11374
11473
  return;
11375
11474
  }
11475
+ const latestFallback = suspense.vnode.ssFallback;
11376
11476
  patch(
11377
11477
  null,
11378
- fallbackVNode,
11478
+ latestFallback,
11379
11479
  container2,
11380
11480
  anchor2,
11381
11481
  parentComponent2,
@@ -11385,7 +11485,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11385
11485
  slotScopeIds,
11386
11486
  optimized
11387
11487
  );
11388
- setActiveBranch(suspense, fallbackVNode);
11488
+ setActiveBranch(suspense, latestFallback);
11389
11489
  };
11390
11490
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
11391
11491
  if (delayEnter) {
@@ -11425,6 +11525,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11425
11525
  return;
11426
11526
  }
11427
11527
  unsetCurrentInstance();
11528
+ if (hydratedEl && !instance.scope.active) {
11529
+ if (isInPendingSuspense && --suspense.deps === 0) {
11530
+ suspense.resolve();
11531
+ }
11532
+ return;
11533
+ }
11428
11534
  instance.asyncResolved = true;
11429
11535
  const { vnode: vnode2 } = instance;
11430
11536
  {
@@ -11910,7 +12016,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
11910
12016
  el: vnode.el,
11911
12017
  anchor: vnode.anchor,
11912
12018
  ctx: vnode.ctx,
11913
- ce: vnode.ce
12019
+ ce: vnode.ce,
12020
+ cacheIndex: vnode.cacheIndex
11914
12021
  };
11915
12022
  if (transition && cloneTransition) {
11916
12023
  setTransitionHooks(
@@ -12730,7 +12837,7 @@ function isMemoSame(cached, memo) {
12730
12837
  return true;
12731
12838
  }
12732
12839
 
12733
- const version = "3.5.41";
12840
+ const version = "3.5.43";
12734
12841
  const warn = warn$1 ;
12735
12842
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12736
12843
  const devtools = devtools$1 ;
@@ -13371,7 +13478,11 @@ function setStyle(style, name, val) {
13371
13478
  }
13372
13479
  }
13373
13480
  if (name.startsWith("--")) {
13374
- style.setProperty(name, val);
13481
+ if (importantRE.test(val)) {
13482
+ style.setProperty(name, val.replace(importantRE, ""), "important");
13483
+ } else {
13484
+ style.setProperty(name, val);
13485
+ }
13375
13486
  } else {
13376
13487
  const prefixed = autoPrefix(style, name);
13377
13488
  if (importantRE.test(val)) {
@@ -14558,13 +14669,21 @@ const vModelSelect = {
14558
14669
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14559
14670
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14560
14671
  );
14561
- el[assignKey](
14562
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14563
- );
14564
- el._assigning = true;
14565
- nextTick(() => {
14566
- el._assigning = false;
14567
- });
14672
+ const multiple = el.multiple;
14673
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
14674
+ const pending = el._pendingValue = [
14675
+ multiple,
14676
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
14677
+ ];
14678
+ try {
14679
+ el[assignKey](assignedValue);
14680
+ } finally {
14681
+ nextTick(() => {
14682
+ if (el._pendingValue === pending) {
14683
+ el._pendingValue = void 0;
14684
+ }
14685
+ });
14686
+ }
14568
14687
  });
14569
14688
  el[assignKey] = getModelAssigner(vnode);
14570
14689
  },
@@ -14578,11 +14697,25 @@ const vModelSelect = {
14578
14697
  el[assignKey] = getModelAssigner(vnode);
14579
14698
  },
14580
14699
  updated(el, { value }) {
14581
- if (!el._assigning) {
14700
+ const pending = el._pendingValue;
14701
+ el._pendingValue = void 0;
14702
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
14582
14703
  setSelected(el, value);
14583
14704
  }
14584
14705
  }
14585
14706
  };
14707
+ function isSameSelectValue(value, assignedValue, multiple) {
14708
+ if (!multiple) return looseEqual(value, assignedValue);
14709
+ if (isArray(value)) return looseEqual(value, assignedValue);
14710
+ if (isSet(value)) {
14711
+ if (value.size !== assignedValue.length) return false;
14712
+ for (const item of assignedValue) {
14713
+ if (!value.has(item)) return false;
14714
+ }
14715
+ return true;
14716
+ }
14717
+ return false;
14718
+ }
14586
14719
  function setSelected(el, value) {
14587
14720
  const isMultiple = el.multiple;
14588
14721
  const isArrayValue = isArray(value);