@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
  }
@@ -1137,7 +1183,9 @@ function reactiveReadArray(array) {
1137
1183
  const raw = toRaw(array);
1138
1184
  if (raw === array) return raw;
1139
1185
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1140
- return isShallow(array) ? raw : raw.map(toReactive);
1186
+ if (isShallow(array)) return raw;
1187
+ if (!isReadonly(array)) return raw.map(toReactive);
1188
+ return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
1141
1189
  }
1142
1190
  function shallowReadArray(arr) {
1143
1191
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4878,13 +4926,15 @@ function createHydrationFunctions(rendererInternals) {
4878
4926
  getContainerType(container),
4879
4927
  optimized
4880
4928
  );
4881
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4929
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4882
4930
  let subTree;
4883
4931
  if (isFragmentStart) {
4884
- subTree = createVNode(Fragment);
4932
+ subTree = createVNode(Static);
4885
4933
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4886
4934
  } else {
4887
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4935
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4936
+ node.nodeType === 8 ? Comment : "div"
4937
+ );
4888
4938
  }
4889
4939
  subTree.el = node;
4890
4940
  vnode.component.subTree = subTree;
@@ -5790,7 +5840,10 @@ const KeepAliveImpl = {
5790
5840
  if (pendingCacheKey != null) {
5791
5841
  if (isSuspense(instance.subTree.type)) {
5792
5842
  queuePostRenderEffect(() => {
5793
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5843
+ const vnode = getInnerChild(instance.subTree);
5844
+ if (vnode.component) {
5845
+ cache.set(pendingCacheKey, vnode);
5846
+ }
5794
5847
  }, instance.subTree.suspense);
5795
5848
  } else {
5796
5849
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6711,12 +6764,41 @@ const getPublicInstance = (i) => {
6711
6764
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
6712
6765
  return getPublicInstance(i.parent);
6713
6766
  };
6767
+ const resolveDevRootEl = (vnode) => {
6768
+ let found = false;
6769
+ while (true) {
6770
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
6771
+ const root = filterSingleRoot(vnode.children);
6772
+ if (!root) {
6773
+ return;
6774
+ }
6775
+ vnode = root;
6776
+ found = true;
6777
+ continue;
6778
+ }
6779
+ const component = vnode.component;
6780
+ if (component && component.subTree) {
6781
+ vnode = component.subTree;
6782
+ continue;
6783
+ }
6784
+ const suspense = vnode.suspense;
6785
+ if (suspense && suspense.activeBranch) {
6786
+ vnode = suspense.activeBranch;
6787
+ continue;
6788
+ }
6789
+ return found ? vnode.el : void 0;
6790
+ }
6791
+ };
6792
+ const getDevRootFragmentEl = (i) => {
6793
+ const el = i.subTree && resolveDevRootEl(i.subTree);
6794
+ return el === void 0 ? i.vnode.el : el;
6795
+ };
6714
6796
  const publicPropertiesMap = (
6715
6797
  // Move PURE marker to new line to workaround compiler discarding it
6716
6798
  // due to type annotation
6717
6799
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
6718
6800
  $: (i) => i,
6719
- $el: (i) => i.vnode.el,
6801
+ $el: (i) => getDevRootFragmentEl(i) ,
6720
6802
  $data: (i) => i.data,
6721
6803
  $props: (i) => shallowReadonly(i.props) ,
6722
6804
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -7630,7 +7712,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7630
7712
  return vm;
7631
7713
  }
7632
7714
  }
7633
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
7715
+ Vue.version = `2.6.14-compat:${"3.5.43"}`;
7634
7716
  Vue.config = singletonApp.config;
7635
7717
  Vue.use = (plugin, ...options) => {
7636
7718
  if (plugin && isFunction(plugin.install)) {
@@ -8387,7 +8469,7 @@ function emit(instance, event, ...rawArgs) {
8387
8469
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8388
8470
  }
8389
8471
  if (modifiers.number) {
8390
- args = rawArgs.map(looseToNumber);
8472
+ args = args.map(looseToNumber);
8391
8473
  }
8392
8474
  }
8393
8475
  {
@@ -9486,6 +9568,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9486
9568
  optimized = false;
9487
9569
  n2.dynamicChildren = null;
9488
9570
  }
9571
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
9572
+ if (n2.dynamicChildren === EMPTY_ARR) {
9573
+ n2.dynamicChildren = [];
9574
+ }
9575
+ n2.dynamicChildren.hasOnce = true;
9576
+ }
9489
9577
  const { type, ref, shapeFlag } = n2;
9490
9578
  switch (type) {
9491
9579
  case Text:
@@ -10094,6 +10182,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10094
10182
  {
10095
10183
  pushWarningContext(n2);
10096
10184
  }
10185
+ n2.el = n1.el;
10097
10186
  updateComponentPreRender(instance, n2, optimized);
10098
10187
  {
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
  {
@@ -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(
@@ -12803,7 +12910,7 @@ function isMemoSame(cached, memo) {
12803
12910
  return true;
12804
12911
  }
12805
12912
 
12806
- const version = "3.5.41";
12913
+ const version = "3.5.43";
12807
12914
  const warn = warn$1 ;
12808
12915
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12809
12916
  const devtools = devtools$1 ;
@@ -13444,7 +13551,11 @@ function setStyle(style, name, val) {
13444
13551
  }
13445
13552
  }
13446
13553
  if (name.startsWith("--")) {
13447
- style.setProperty(name, val);
13554
+ if (importantRE.test(val)) {
13555
+ style.setProperty(name, val.replace(importantRE, ""), "important");
13556
+ } else {
13557
+ style.setProperty(name, val);
13558
+ }
13448
13559
  } else {
13449
13560
  const prefixed = autoPrefix(style, name);
13450
13561
  if (importantRE.test(val)) {
@@ -14631,13 +14742,21 @@ const vModelSelect = {
14631
14742
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14632
14743
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14633
14744
  );
14634
- el[assignKey](
14635
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14636
- );
14637
- el._assigning = true;
14638
- nextTick(() => {
14639
- el._assigning = false;
14640
- });
14745
+ const multiple = el.multiple;
14746
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
14747
+ const pending = el._pendingValue = [
14748
+ multiple,
14749
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
14750
+ ];
14751
+ try {
14752
+ el[assignKey](assignedValue);
14753
+ } finally {
14754
+ nextTick(() => {
14755
+ if (el._pendingValue === pending) {
14756
+ el._pendingValue = void 0;
14757
+ }
14758
+ });
14759
+ }
14641
14760
  });
14642
14761
  el[assignKey] = getModelAssigner(vnode);
14643
14762
  },
@@ -14651,11 +14770,25 @@ const vModelSelect = {
14651
14770
  el[assignKey] = getModelAssigner(vnode);
14652
14771
  },
14653
14772
  updated(el, { value }) {
14654
- if (!el._assigning) {
14773
+ const pending = el._pendingValue;
14774
+ el._pendingValue = void 0;
14775
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
14655
14776
  setSelected(el, value);
14656
14777
  }
14657
14778
  }
14658
14779
  };
14780
+ function isSameSelectValue(value, assignedValue, multiple) {
14781
+ if (!multiple) return looseEqual(value, assignedValue);
14782
+ if (isArray(value)) return looseEqual(value, assignedValue);
14783
+ if (isSet(value)) {
14784
+ if (value.size !== assignedValue.length) return false;
14785
+ for (const item of assignedValue) {
14786
+ if (!value.has(item)) return false;
14787
+ }
14788
+ return true;
14789
+ }
14790
+ return false;
14791
+ }
14659
14792
  function setSelected(el, value) {
14660
14793
  const isMultiple = el.multiple;
14661
14794
  const isArrayValue = isArray(value);