@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
  **/
@@ -131,10 +131,10 @@ var Vue = (function () {
131
131
  }
132
132
  const listDelimiterRE = /;(?![^(]*\))/g;
133
133
  const propertyDelimiterRE = /:([^]+)/;
134
- const styleCommentRE = /\/\*[^]*?\*\//g;
134
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
135
135
  function parseStringStyle(cssText) {
136
136
  const ret = {};
137
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
137
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
138
138
  if (item) {
139
139
  const tmp = item.split(propertyDelimiterRE);
140
140
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -224,15 +224,72 @@ var Vue = (function () {
224
224
  );
225
225
  }
226
226
 
227
- function looseCompareArrays(a, b) {
227
+ function looseCompareArrays(a, b, seen) {
228
228
  if (a.length !== b.length) return false;
229
229
  let equal = true;
230
230
  for (let i = 0; equal && i < a.length; i++) {
231
- equal = looseEqual(a[i], b[i]);
231
+ equal = looseEqual(a[i], b[i], seen);
232
232
  }
233
233
  return equal;
234
234
  }
235
- function looseEqual(a, b) {
235
+ function looseCompareCollections(a, b, seen) {
236
+ if (a.size !== b.size) return false;
237
+ const candidates = Array.from(b);
238
+ const matched = new Uint8Array(candidates.length);
239
+ for (const item of a) {
240
+ let index = -1;
241
+ for (let i = 0; i < candidates.length; i++) {
242
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
243
+ index = i;
244
+ break;
245
+ }
246
+ }
247
+ if (index < 0) return false;
248
+ matched[index] = 1;
249
+ }
250
+ return true;
251
+ }
252
+ function looseCompareObjects(a, b, seen) {
253
+ let aValidType = isMap(a);
254
+ let bValidType = isMap(b);
255
+ if (aValidType || bValidType) {
256
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
257
+ }
258
+ aValidType = isSet(a);
259
+ bValidType = isSet(b);
260
+ if (aValidType || bValidType) {
261
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
262
+ }
263
+ const aKeysCount = Object.keys(a).length;
264
+ const bKeysCount = Object.keys(b).length;
265
+ if (aKeysCount !== bKeysCount) {
266
+ return false;
267
+ }
268
+ for (const key in a) {
269
+ const aHasKey = a.hasOwnProperty(key);
270
+ const bHasKey = b.hasOwnProperty(key);
271
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
272
+ return false;
273
+ }
274
+ }
275
+ return String(a) === String(b);
276
+ }
277
+ function looseCompareNested(a, b, seen, compare) {
278
+ if (!seen) {
279
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
280
+ }
281
+ const [seenA, seenB] = seen;
282
+ if (seenA.has(a) || seenB.has(b)) {
283
+ return seenA.get(a) === b && seenB.get(b) === a;
284
+ }
285
+ seenA.set(a, b);
286
+ seenB.set(b, a);
287
+ const equal = compare(a, b, seen);
288
+ seenA.delete(a);
289
+ seenB.delete(b);
290
+ return equal;
291
+ }
292
+ function looseEqual(a, b, seen) {
236
293
  if (a === b) return true;
237
294
  let aValidType = isDate(a);
238
295
  let bValidType = isDate(b);
@@ -247,7 +304,7 @@ var Vue = (function () {
247
304
  aValidType = isArray(a);
248
305
  bValidType = isArray(b);
249
306
  if (aValidType || bValidType) {
250
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
307
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
251
308
  }
252
309
  aValidType = isObject(a);
253
310
  bValidType = isObject(b);
@@ -255,18 +312,7 @@ var Vue = (function () {
255
312
  if (!aValidType || !bValidType) {
256
313
  return false;
257
314
  }
258
- const aKeysCount = Object.keys(a).length;
259
- const bKeysCount = Object.keys(b).length;
260
- if (aKeysCount !== bKeysCount) {
261
- return false;
262
- }
263
- for (const key in a) {
264
- const aHasKey = a.hasOwnProperty(key);
265
- const bHasKey = b.hasOwnProperty(key);
266
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
267
- return false;
268
- }
269
- }
315
+ return looseCompareNested(a, b, seen, looseCompareObjects);
270
316
  }
271
317
  return String(a) === String(b);
272
318
  }
@@ -1067,7 +1113,9 @@ var Vue = (function () {
1067
1113
  const raw = toRaw(array);
1068
1114
  if (raw === array) return raw;
1069
1115
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1070
- return isShallow(array) ? raw : raw.map(toReactive);
1116
+ if (isShallow(array)) return raw;
1117
+ if (!isReadonly(array)) return raw.map(toReactive);
1118
+ return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
1071
1119
  }
1072
1120
  function shallowReadArray(arr) {
1073
1121
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4780,13 +4828,15 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4780
4828
  getContainerType(container),
4781
4829
  optimized
4782
4830
  );
4783
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4831
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4784
4832
  let subTree;
4785
4833
  if (isFragmentStart) {
4786
- subTree = createVNode(Fragment);
4834
+ subTree = createVNode(Static);
4787
4835
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4788
4836
  } else {
4789
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4837
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4838
+ node.nodeType === 8 ? Comment : "div"
4839
+ );
4790
4840
  }
4791
4841
  subTree.el = node;
4792
4842
  vnode.component.subTree = subTree;
@@ -5686,7 +5736,10 @@ Server rendered element contains fewer child nodes than client vdom.`
5686
5736
  if (pendingCacheKey != null) {
5687
5737
  if (isSuspense(instance.subTree.type)) {
5688
5738
  queuePostRenderEffect(() => {
5689
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5739
+ const vnode = getInnerChild(instance.subTree);
5740
+ if (vnode.component) {
5741
+ cache.set(pendingCacheKey, vnode);
5742
+ }
5690
5743
  }, instance.subTree.suspense);
5691
5744
  } else {
5692
5745
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6607,12 +6660,41 @@ If this is a native custom element, make sure to exclude it from component resol
6607
6660
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
6608
6661
  return getPublicInstance(i.parent);
6609
6662
  };
6663
+ const resolveDevRootEl = (vnode) => {
6664
+ let found = false;
6665
+ while (true) {
6666
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
6667
+ const root = filterSingleRoot(vnode.children);
6668
+ if (!root) {
6669
+ return;
6670
+ }
6671
+ vnode = root;
6672
+ found = true;
6673
+ continue;
6674
+ }
6675
+ const component = vnode.component;
6676
+ if (component && component.subTree) {
6677
+ vnode = component.subTree;
6678
+ continue;
6679
+ }
6680
+ const suspense = vnode.suspense;
6681
+ if (suspense && suspense.activeBranch) {
6682
+ vnode = suspense.activeBranch;
6683
+ continue;
6684
+ }
6685
+ return found ? vnode.el : void 0;
6686
+ }
6687
+ };
6688
+ const getDevRootFragmentEl = (i) => {
6689
+ const el = i.subTree && resolveDevRootEl(i.subTree);
6690
+ return el === void 0 ? i.vnode.el : el;
6691
+ };
6610
6692
  const publicPropertiesMap = (
6611
6693
  // Move PURE marker to new line to workaround compiler discarding it
6612
6694
  // due to type annotation
6613
6695
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
6614
6696
  $: (i) => i,
6615
- $el: (i) => i.vnode.el,
6697
+ $el: (i) => getDevRootFragmentEl(i) ,
6616
6698
  $data: (i) => i.data,
6617
6699
  $props: (i) => shallowReadonly(i.props) ,
6618
6700
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -7523,7 +7605,7 @@ If this is a native custom element, make sure to exclude it from component resol
7523
7605
  return vm;
7524
7606
  }
7525
7607
  }
7526
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
7608
+ Vue.version = `2.6.14-compat:${"3.5.43"}`;
7527
7609
  Vue.config = singletonApp.config;
7528
7610
  Vue.use = (plugin, ...options) => {
7529
7611
  if (plugin && isFunction(plugin.install)) {
@@ -8280,7 +8362,7 @@ If you want to remount the same app, move your app creation logic into a factory
8280
8362
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8281
8363
  }
8282
8364
  if (modifiers.number) {
8283
- args = rawArgs.map(looseToNumber);
8365
+ args = args.map(looseToNumber);
8284
8366
  }
8285
8367
  }
8286
8368
  {
@@ -9379,6 +9461,12 @@ If you want to remount the same app, move your app creation logic into a factory
9379
9461
  optimized = false;
9380
9462
  n2.dynamicChildren = null;
9381
9463
  }
9464
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
9465
+ if (n2.dynamicChildren === EMPTY_ARR) {
9466
+ n2.dynamicChildren = [];
9467
+ }
9468
+ n2.dynamicChildren.hasOnce = true;
9469
+ }
9382
9470
  const { type, ref, shapeFlag } = n2;
9383
9471
  switch (type) {
9384
9472
  case Text:
@@ -9987,6 +10075,7 @@ If you want to remount the same app, move your app creation logic into a factory
9987
10075
  {
9988
10076
  pushWarningContext(n2);
9989
10077
  }
10078
+ n2.el = n1.el;
9990
10079
  updateComponentPreRender(instance, n2, optimized);
9991
10080
  {
9992
10081
  popWarningContext();
@@ -10602,7 +10691,7 @@ If you want to remount the same app, move your app creation logic into a factory
10602
10691
  cacheIndex,
10603
10692
  memo
10604
10693
  } = vnode;
10605
- if (patchFlag === -2) {
10694
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
10606
10695
  optimized = false;
10607
10696
  }
10608
10697
  if (ref != null) {
@@ -10610,7 +10699,7 @@ If you want to remount the same app, move your app creation logic into a factory
10610
10699
  setRef(ref, null, parentSuspense, vnode, true);
10611
10700
  resetTracking();
10612
10701
  }
10613
- if (cacheIndex != null) {
10702
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
10614
10703
  parentComponent.renderCache[cacheIndex] = void 0;
10615
10704
  }
10616
10705
  if (shapeFlag & 256) {
@@ -10691,6 +10780,9 @@ If you want to remount the same app, move your app creation logic into a factory
10691
10780
  }
10692
10781
  if (type === Static) {
10693
10782
  removeStaticNode(vnode);
10783
+ if (transition && !transition.persisted && transition.afterLeave) {
10784
+ transition.afterLeave();
10785
+ }
10694
10786
  return;
10695
10787
  }
10696
10788
  const performRemove = () => {
@@ -10737,6 +10829,9 @@ If you want to remount the same app, move your app creation logic into a factory
10737
10829
  if (job) {
10738
10830
  job.flags |= 8;
10739
10831
  unmount(subTree, instance, parentSuspense, doRemove);
10832
+ } else if (instance.vnode.el && subTree) {
10833
+ subTree.transition = instance.vnode.transition;
10834
+ unmount(subTree, instance, parentSuspense, doRemove);
10740
10835
  }
10741
10836
  if (um) {
10742
10837
  queuePostRenderEffect(um, parentSuspense);
@@ -10957,7 +11052,7 @@ If you want to remount the same app, move your app creation logic into a factory
10957
11052
  rendererInternals
10958
11053
  );
10959
11054
  } else {
10960
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
11055
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
10961
11056
  n2.suspense = n1.suspense;
10962
11057
  n2.suspense.vnode = n2;
10963
11058
  n2.el = n1.el;
@@ -11043,10 +11138,12 @@ If you want to remount the same app, move your app creation logic into a factory
11043
11138
  if (pendingBranch) {
11044
11139
  suspense.pendingBranch = newBranch;
11045
11140
  if (isSameVNodeType(pendingBranch, newBranch)) {
11141
+ suspense.deps++;
11046
11142
  patch(
11047
11143
  pendingBranch,
11048
11144
  newBranch,
11049
- suspense.hiddenContainer,
11145
+ // a hydrating pending branch is adopted SSR DOM, already in place
11146
+ isHydrating ? container : suspense.hiddenContainer,
11050
11147
  null,
11051
11148
  parentComponent,
11052
11149
  suspense,
@@ -11054,10 +11151,11 @@ If you want to remount the same app, move your app creation logic into a factory
11054
11151
  slotScopeIds,
11055
11152
  optimized
11056
11153
  );
11154
+ suspense.deps--;
11057
11155
  if (suspense.deps <= 0) {
11058
11156
  suspense.resolve();
11059
11157
  } else if (isInFallback) {
11060
- if (!isHydrating) {
11158
+ if (!isHydrating && !suspense.isFallbackMountPending) {
11061
11159
  patch(
11062
11160
  activeBranch,
11063
11161
  newFallback,
@@ -11098,7 +11196,7 @@ If you want to remount the same app, move your app creation logic into a factory
11098
11196
  );
11099
11197
  if (suspense.deps <= 0) {
11100
11198
  suspense.resolve();
11101
- } else {
11199
+ } else if (!suspense.isFallbackMountPending) {
11102
11200
  patch(
11103
11201
  activeBranch,
11104
11202
  newFallback,
@@ -11319,6 +11417,7 @@ If you want to remount the same app, move your app creation logic into a factory
11319
11417
  suspense.effects = [];
11320
11418
  if (isSuspensible) {
11321
11419
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
11420
+ parentSuspenseId = void 0;
11322
11421
  parentSuspense.deps--;
11323
11422
  if (parentSuspense.deps === 0 && !sync) {
11324
11423
  parentSuspense.resolve();
@@ -11339,9 +11438,10 @@ If you want to remount the same app, move your app creation logic into a factory
11339
11438
  if (!suspense.isInFallback) {
11340
11439
  return;
11341
11440
  }
11441
+ const latestFallback = suspense.vnode.ssFallback;
11342
11442
  patch(
11343
11443
  null,
11344
- fallbackVNode,
11444
+ latestFallback,
11345
11445
  container2,
11346
11446
  anchor2,
11347
11447
  parentComponent2,
@@ -11351,7 +11451,7 @@ If you want to remount the same app, move your app creation logic into a factory
11351
11451
  slotScopeIds,
11352
11452
  optimized
11353
11453
  );
11354
- setActiveBranch(suspense, fallbackVNode);
11454
+ setActiveBranch(suspense, latestFallback);
11355
11455
  };
11356
11456
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
11357
11457
  if (delayEnter) {
@@ -11391,6 +11491,12 @@ If you want to remount the same app, move your app creation logic into a factory
11391
11491
  return;
11392
11492
  }
11393
11493
  unsetCurrentInstance();
11494
+ if (hydratedEl && !instance.scope.active) {
11495
+ if (isInPendingSuspense && --suspense.deps === 0) {
11496
+ suspense.resolve();
11497
+ }
11498
+ return;
11499
+ }
11394
11500
  instance.asyncResolved = true;
11395
11501
  const { vnode: vnode2 } = instance;
11396
11502
  {
@@ -11876,7 +11982,8 @@ Component that was made reactive: `,
11876
11982
  el: vnode.el,
11877
11983
  anchor: vnode.anchor,
11878
11984
  ctx: vnode.ctx,
11879
- ce: vnode.ce
11985
+ ce: vnode.ce,
11986
+ cacheIndex: vnode.cacheIndex
11880
11987
  };
11881
11988
  if (transition && cloneTransition) {
11882
11989
  setTransitionHooks(
@@ -12682,7 +12789,7 @@ Component that was made reactive: `,
12682
12789
  return true;
12683
12790
  }
12684
12791
 
12685
- const version = "3.5.41";
12792
+ const version = "3.5.43";
12686
12793
  const warn = warn$1 ;
12687
12794
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12688
12795
  const devtools = devtools$1 ;
@@ -13304,7 +13411,11 @@ Component that was made reactive: `,
13304
13411
  }
13305
13412
  }
13306
13413
  if (name.startsWith("--")) {
13307
- style.setProperty(name, val);
13414
+ if (importantRE.test(val)) {
13415
+ style.setProperty(name, val.replace(importantRE, ""), "important");
13416
+ } else {
13417
+ style.setProperty(name, val);
13418
+ }
13308
13419
  } else {
13309
13420
  const prefixed = autoPrefix(style, name);
13310
13421
  if (importantRE.test(val)) {
@@ -14479,13 +14590,21 @@ Expected function or array of functions, received type ${typeof value}.`
14479
14590
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14480
14591
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14481
14592
  );
14482
- el[assignKey](
14483
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14484
- );
14485
- el._assigning = true;
14486
- nextTick(() => {
14487
- el._assigning = false;
14488
- });
14593
+ const multiple = el.multiple;
14594
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
14595
+ const pending = el._pendingValue = [
14596
+ multiple,
14597
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
14598
+ ];
14599
+ try {
14600
+ el[assignKey](assignedValue);
14601
+ } finally {
14602
+ nextTick(() => {
14603
+ if (el._pendingValue === pending) {
14604
+ el._pendingValue = void 0;
14605
+ }
14606
+ });
14607
+ }
14489
14608
  });
14490
14609
  el[assignKey] = getModelAssigner(vnode);
14491
14610
  },
@@ -14499,11 +14618,25 @@ Expected function or array of functions, received type ${typeof value}.`
14499
14618
  el[assignKey] = getModelAssigner(vnode);
14500
14619
  },
14501
14620
  updated(el, { value }) {
14502
- if (!el._assigning) {
14621
+ const pending = el._pendingValue;
14622
+ el._pendingValue = void 0;
14623
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
14503
14624
  setSelected(el, value);
14504
14625
  }
14505
14626
  }
14506
14627
  };
14628
+ function isSameSelectValue(value, assignedValue, multiple) {
14629
+ if (!multiple) return looseEqual(value, assignedValue);
14630
+ if (isArray(value)) return looseEqual(value, assignedValue);
14631
+ if (isSet(value)) {
14632
+ if (value.size !== assignedValue.length) return false;
14633
+ for (const item of assignedValue) {
14634
+ if (!value.has(item)) return false;
14635
+ }
14636
+ return true;
14637
+ }
14638
+ return false;
14639
+ }
14507
14640
  function setSelected(el, value) {
14508
14641
  const isMultiple = el.multiple;
14509
14642
  const isArrayValue = isArray(value);