@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
  **/
@@ -145,10 +145,10 @@ function normalizeStyle(value) {
145
145
  }
146
146
  const listDelimiterRE = /;(?![^(]*\))/g;
147
147
  const propertyDelimiterRE = /:([^]+)/;
148
- const styleCommentRE = /\/\*[^]*?\*\//g;
148
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
149
149
  function parseStringStyle(cssText) {
150
150
  const ret = {};
151
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
151
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
152
152
  if (item) {
153
153
  const tmp = item.split(propertyDelimiterRE);
154
154
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -268,15 +268,72 @@ function escapeHtml(string) {
268
268
  return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
269
269
  }
270
270
 
271
- function looseCompareArrays(a, b) {
271
+ function looseCompareArrays(a, b, seen) {
272
272
  if (a.length !== b.length) return false;
273
273
  let equal = true;
274
274
  for (let i = 0; equal && i < a.length; i++) {
275
- equal = looseEqual(a[i], b[i]);
275
+ equal = looseEqual(a[i], b[i], seen);
276
276
  }
277
277
  return equal;
278
278
  }
279
- function looseEqual(a, b) {
279
+ function looseCompareCollections(a, b, seen) {
280
+ if (a.size !== b.size) return false;
281
+ const candidates = Array.from(b);
282
+ const matched = new Uint8Array(candidates.length);
283
+ for (const item of a) {
284
+ let index = -1;
285
+ for (let i = 0; i < candidates.length; i++) {
286
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
287
+ index = i;
288
+ break;
289
+ }
290
+ }
291
+ if (index < 0) return false;
292
+ matched[index] = 1;
293
+ }
294
+ return true;
295
+ }
296
+ function looseCompareObjects(a, b, seen) {
297
+ let aValidType = isMap(a);
298
+ let bValidType = isMap(b);
299
+ if (aValidType || bValidType) {
300
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
301
+ }
302
+ aValidType = isSet(a);
303
+ bValidType = isSet(b);
304
+ if (aValidType || bValidType) {
305
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
306
+ }
307
+ const aKeysCount = Object.keys(a).length;
308
+ const bKeysCount = Object.keys(b).length;
309
+ if (aKeysCount !== bKeysCount) {
310
+ return false;
311
+ }
312
+ for (const key in a) {
313
+ const aHasKey = a.hasOwnProperty(key);
314
+ const bHasKey = b.hasOwnProperty(key);
315
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
316
+ return false;
317
+ }
318
+ }
319
+ return String(a) === String(b);
320
+ }
321
+ function looseCompareNested(a, b, seen, compare) {
322
+ if (!seen) {
323
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
324
+ }
325
+ const [seenA, seenB] = seen;
326
+ if (seenA.has(a) || seenB.has(b)) {
327
+ return seenA.get(a) === b && seenB.get(b) === a;
328
+ }
329
+ seenA.set(a, b);
330
+ seenB.set(b, a);
331
+ const equal = compare(a, b, seen);
332
+ seenA.delete(a);
333
+ seenB.delete(b);
334
+ return equal;
335
+ }
336
+ function looseEqual(a, b, seen) {
280
337
  if (a === b) return true;
281
338
  let aValidType = isDate(a);
282
339
  let bValidType = isDate(b);
@@ -291,7 +348,7 @@ function looseEqual(a, b) {
291
348
  aValidType = isArray(a);
292
349
  bValidType = isArray(b);
293
350
  if (aValidType || bValidType) {
294
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
351
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
295
352
  }
296
353
  aValidType = isObject(a);
297
354
  bValidType = isObject(b);
@@ -299,18 +356,7 @@ function looseEqual(a, b) {
299
356
  if (!aValidType || !bValidType) {
300
357
  return false;
301
358
  }
302
- const aKeysCount = Object.keys(a).length;
303
- const bKeysCount = Object.keys(b).length;
304
- if (aKeysCount !== bKeysCount) {
305
- return false;
306
- }
307
- for (const key in a) {
308
- const aHasKey = a.hasOwnProperty(key);
309
- const bHasKey = b.hasOwnProperty(key);
310
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
311
- return false;
312
- }
313
- }
359
+ return looseCompareNested(a, b, seen, looseCompareObjects);
314
360
  }
315
361
  return String(a) === String(b);
316
362
  }
@@ -1035,7 +1081,9 @@ function reactiveReadArray(array) {
1035
1081
  const raw = toRaw(array);
1036
1082
  if (raw === array) return raw;
1037
1083
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1038
- return isShallow(array) ? raw : raw.map(toReactive);
1084
+ if (isShallow(array)) return raw;
1085
+ if (!isReadonly(array)) return raw.map(toReactive);
1086
+ return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
1039
1087
  }
1040
1088
  function shallowReadArray(arr) {
1041
1089
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -3900,13 +3948,15 @@ function createHydrationFunctions(rendererInternals) {
3900
3948
  getContainerType(container),
3901
3949
  optimized
3902
3950
  );
3903
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
3951
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
3904
3952
  let subTree;
3905
3953
  if (isFragmentStart) {
3906
- subTree = createVNode(Fragment);
3954
+ subTree = createVNode(Static);
3907
3955
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
3908
3956
  } else {
3909
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
3957
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
3958
+ node.nodeType === 8 ? Comment : "div"
3959
+ );
3910
3960
  }
3911
3961
  subTree.el = node;
3912
3962
  vnode.component.subTree = subTree;
@@ -4629,7 +4679,10 @@ const KeepAliveImpl = {
4629
4679
  if (pendingCacheKey != null) {
4630
4680
  if (isSuspense(instance.subTree.type)) {
4631
4681
  queuePostRenderEffect(() => {
4632
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4682
+ const vnode = getInnerChild(instance.subTree);
4683
+ if (vnode.component) {
4684
+ cache.set(pendingCacheKey, vnode);
4685
+ }
4633
4686
  }, instance.subTree.suspense);
4634
4687
  } else {
4635
4688
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -6188,7 +6241,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6188
6241
  return vm;
6189
6242
  }
6190
6243
  }
6191
- Vue.version = `2.6.14-compat:${"3.5.41"}`;
6244
+ Vue.version = `2.6.14-compat:${"3.5.43"}`;
6192
6245
  Vue.config = singletonApp.config;
6193
6246
  Vue.use = (plugin, ...options) => {
6194
6247
  if (plugin && isFunction(plugin.install)) {
@@ -6785,7 +6838,7 @@ function emit(instance, event, ...rawArgs) {
6785
6838
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
6786
6839
  }
6787
6840
  if (modifiers.number) {
6788
- args = rawArgs.map(looseToNumber);
6841
+ args = args.map(looseToNumber);
6789
6842
  }
6790
6843
  }
6791
6844
  let handlerName;
@@ -7583,6 +7636,12 @@ function baseCreateRenderer(options, createHydrationFns) {
7583
7636
  optimized = false;
7584
7637
  n2.dynamicChildren = null;
7585
7638
  }
7639
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
7640
+ if (n2.dynamicChildren === EMPTY_ARR) {
7641
+ n2.dynamicChildren = [];
7642
+ }
7643
+ n2.dynamicChildren.hasOnce = true;
7644
+ }
7586
7645
  const { type, ref, shapeFlag } = n2;
7587
7646
  switch (type) {
7588
7647
  case Text:
@@ -8136,6 +8195,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8136
8195
  const instance = n2.component = n1.component;
8137
8196
  if (shouldUpdateComponent(n1, n2, optimized)) {
8138
8197
  if (instance.asyncDep && !instance.asyncResolved) {
8198
+ n2.el = n1.el;
8139
8199
  updateComponentPreRender(instance, n2, optimized);
8140
8200
  return;
8141
8201
  } else {
@@ -8689,7 +8749,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8689
8749
  cacheIndex,
8690
8750
  memo
8691
8751
  } = vnode;
8692
- if (patchFlag === -2) {
8752
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
8693
8753
  optimized = false;
8694
8754
  }
8695
8755
  if (ref != null) {
@@ -8697,7 +8757,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8697
8757
  setRef(ref, null, parentSuspense, vnode, true);
8698
8758
  resetTracking();
8699
8759
  }
8700
- if (cacheIndex != null) {
8760
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
8701
8761
  parentComponent.renderCache[cacheIndex] = void 0;
8702
8762
  }
8703
8763
  if (shapeFlag & 256) {
@@ -8770,6 +8830,9 @@ function baseCreateRenderer(options, createHydrationFns) {
8770
8830
  }
8771
8831
  if (type === Static) {
8772
8832
  removeStaticNode(vnode);
8833
+ if (transition && !transition.persisted && transition.afterLeave) {
8834
+ transition.afterLeave();
8835
+ }
8773
8836
  return;
8774
8837
  }
8775
8838
  const performRemove = () => {
@@ -8813,6 +8876,9 @@ function baseCreateRenderer(options, createHydrationFns) {
8813
8876
  if (job) {
8814
8877
  job.flags |= 8;
8815
8878
  unmount(subTree, instance, parentSuspense, doRemove);
8879
+ } else if (instance.vnode.el && subTree) {
8880
+ subTree.transition = instance.vnode.transition;
8881
+ unmount(subTree, instance, parentSuspense, doRemove);
8816
8882
  }
8817
8883
  if (um) {
8818
8884
  queuePostRenderEffect(um, parentSuspense);
@@ -9027,7 +9093,7 @@ const SuspenseImpl = {
9027
9093
  rendererInternals
9028
9094
  );
9029
9095
  } else {
9030
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
9096
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
9031
9097
  n2.suspense = n1.suspense;
9032
9098
  n2.suspense.vnode = n2;
9033
9099
  n2.el = n1.el;
@@ -9113,10 +9179,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9113
9179
  if (pendingBranch) {
9114
9180
  suspense.pendingBranch = newBranch;
9115
9181
  if (isSameVNodeType(pendingBranch, newBranch)) {
9182
+ suspense.deps++;
9116
9183
  patch(
9117
9184
  pendingBranch,
9118
9185
  newBranch,
9119
- suspense.hiddenContainer,
9186
+ // a hydrating pending branch is adopted SSR DOM, already in place
9187
+ isHydrating ? container : suspense.hiddenContainer,
9120
9188
  null,
9121
9189
  parentComponent,
9122
9190
  suspense,
@@ -9124,10 +9192,11 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9124
9192
  slotScopeIds,
9125
9193
  optimized
9126
9194
  );
9195
+ suspense.deps--;
9127
9196
  if (suspense.deps <= 0) {
9128
9197
  suspense.resolve();
9129
9198
  } else if (isInFallback) {
9130
- if (!isHydrating) {
9199
+ if (!isHydrating && !suspense.isFallbackMountPending) {
9131
9200
  patch(
9132
9201
  activeBranch,
9133
9202
  newFallback,
@@ -9168,7 +9237,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9168
9237
  );
9169
9238
  if (suspense.deps <= 0) {
9170
9239
  suspense.resolve();
9171
- } else {
9240
+ } else if (!suspense.isFallbackMountPending) {
9172
9241
  patch(
9173
9242
  activeBranch,
9174
9243
  newFallback,
@@ -9367,6 +9436,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9367
9436
  suspense.effects = [];
9368
9437
  if (isSuspensible) {
9369
9438
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
9439
+ parentSuspenseId = void 0;
9370
9440
  parentSuspense.deps--;
9371
9441
  if (parentSuspense.deps === 0 && !sync) {
9372
9442
  parentSuspense.resolve();
@@ -9387,9 +9457,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9387
9457
  if (!suspense.isInFallback) {
9388
9458
  return;
9389
9459
  }
9460
+ const latestFallback = suspense.vnode.ssFallback;
9390
9461
  patch(
9391
9462
  null,
9392
- fallbackVNode,
9463
+ latestFallback,
9393
9464
  container2,
9394
9465
  anchor2,
9395
9466
  parentComponent2,
@@ -9399,7 +9470,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9399
9470
  slotScopeIds,
9400
9471
  optimized
9401
9472
  );
9402
- setActiveBranch(suspense, fallbackVNode);
9473
+ setActiveBranch(suspense, latestFallback);
9403
9474
  };
9404
9475
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
9405
9476
  if (delayEnter) {
@@ -9439,6 +9510,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9439
9510
  return;
9440
9511
  }
9441
9512
  unsetCurrentInstance();
9513
+ if (hydratedEl && !instance.scope.active) {
9514
+ if (isInPendingSuspense && --suspense.deps === 0) {
9515
+ suspense.resolve();
9516
+ }
9517
+ return;
9518
+ }
9442
9519
  instance.asyncResolved = true;
9443
9520
  const { vnode: vnode2 } = instance;
9444
9521
  handleSetupResult(instance, asyncSetupResult, false);
@@ -9872,7 +9949,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
9872
9949
  el: vnode.el,
9873
9950
  anchor: vnode.anchor,
9874
9951
  ctx: vnode.ctx,
9875
- ce: vnode.ce
9952
+ ce: vnode.ce,
9953
+ cacheIndex: vnode.cacheIndex
9876
9954
  };
9877
9955
  if (transition && cloneTransition) {
9878
9956
  setTransitionHooks(
@@ -10364,7 +10442,7 @@ function isMemoSame(cached, memo) {
10364
10442
  return true;
10365
10443
  }
10366
10444
 
10367
- const version = "3.5.41";
10445
+ const version = "3.5.43";
10368
10446
  const warn$1 = NOOP;
10369
10447
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10370
10448
  const devtools = void 0;
@@ -10925,7 +11003,11 @@ function setStyle(style, name, val) {
10925
11003
  } else {
10926
11004
  if (val == null) val = "";
10927
11005
  if (name.startsWith("--")) {
10928
- style.setProperty(name, val);
11006
+ if (importantRE.test(val)) {
11007
+ style.setProperty(name, val.replace(importantRE, ""), "important");
11008
+ } else {
11009
+ style.setProperty(name, val);
11010
+ }
10929
11011
  } else {
10930
11012
  const prefixed = autoPrefix(style, name);
10931
11013
  if (importantRE.test(val)) {
@@ -12020,13 +12102,21 @@ const vModelSelect = {
12020
12102
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12021
12103
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12022
12104
  );
12023
- el[assignKey](
12024
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12025
- );
12026
- el._assigning = true;
12027
- nextTick(() => {
12028
- el._assigning = false;
12029
- });
12105
+ const multiple = el.multiple;
12106
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
12107
+ const pending = el._pendingValue = [
12108
+ multiple,
12109
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
12110
+ ];
12111
+ try {
12112
+ el[assignKey](assignedValue);
12113
+ } finally {
12114
+ nextTick(() => {
12115
+ if (el._pendingValue === pending) {
12116
+ el._pendingValue = void 0;
12117
+ }
12118
+ });
12119
+ }
12030
12120
  });
12031
12121
  el[assignKey] = getModelAssigner(vnode);
12032
12122
  },
@@ -12040,11 +12130,25 @@ const vModelSelect = {
12040
12130
  el[assignKey] = getModelAssigner(vnode);
12041
12131
  },
12042
12132
  updated(el, { value }) {
12043
- if (!el._assigning) {
12133
+ const pending = el._pendingValue;
12134
+ el._pendingValue = void 0;
12135
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
12044
12136
  setSelected(el, value);
12045
12137
  }
12046
12138
  }
12047
12139
  };
12140
+ function isSameSelectValue(value, assignedValue, multiple) {
12141
+ if (!multiple) return looseEqual(value, assignedValue);
12142
+ if (isArray(value)) return looseEqual(value, assignedValue);
12143
+ if (isSet(value)) {
12144
+ if (value.size !== assignedValue.length) return false;
12145
+ for (const item of assignedValue) {
12146
+ if (!value.has(item)) return false;
12147
+ }
12148
+ return true;
12149
+ }
12150
+ return false;
12151
+ }
12048
12152
  function setSelected(el, value) {
12049
12153
  const isMultiple = el.multiple;
12050
12154
  const isArrayValue = isArray(value);