vue 3.5.42 → 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 v3.5.42
2
+ * vue 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,22 +221,22 @@ 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 looseCompareCollections(a, b) {
232
+ function looseCompareCollections(a, b, seen) {
233
233
  if (a.size !== b.size) return false;
234
234
  const candidates = Array.from(b);
235
235
  const matched = new Uint8Array(candidates.length);
236
236
  for (const item of a) {
237
237
  let index = -1;
238
238
  for (let i = 0; i < candidates.length; i++) {
239
- if (!matched[i] && looseEqual(item, candidates[i])) {
239
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
240
240
  index = i;
241
241
  break;
242
242
  }
@@ -246,7 +246,47 @@ function looseCompareCollections(a, b) {
246
246
  }
247
247
  return true;
248
248
  }
249
- function looseEqual(a, b) {
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) {
250
290
  if (a === b) return true;
251
291
  let aValidType = isDate(a);
252
292
  let bValidType = isDate(b);
@@ -261,7 +301,7 @@ function looseEqual(a, b) {
261
301
  aValidType = isArray(a);
262
302
  bValidType = isArray(b);
263
303
  if (aValidType || bValidType) {
264
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
304
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
265
305
  }
266
306
  aValidType = isObject(a);
267
307
  bValidType = isObject(b);
@@ -269,28 +309,7 @@ function looseEqual(a, b) {
269
309
  if (!aValidType || !bValidType) {
270
310
  return false;
271
311
  }
272
- aValidType = isMap(a);
273
- bValidType = isMap(b);
274
- if (aValidType || bValidType) {
275
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
276
- }
277
- aValidType = isSet(a);
278
- bValidType = isSet(b);
279
- if (aValidType || bValidType) {
280
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
281
- }
282
- const aKeysCount = Object.keys(a).length;
283
- const bKeysCount = Object.keys(b).length;
284
- if (aKeysCount !== bKeysCount) {
285
- return false;
286
- }
287
- for (const key in a) {
288
- const aHasKey = a.hasOwnProperty(key);
289
- const bHasKey = b.hasOwnProperty(key);
290
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
291
- return false;
292
- }
293
- }
312
+ return looseCompareNested(a, b, seen, looseCompareObjects);
294
313
  }
295
314
  return String(a) === String(b);
296
315
  }
@@ -1091,7 +1110,9 @@ function reactiveReadArray(array) {
1091
1110
  const raw = toRaw(array);
1092
1111
  if (raw === array) return raw;
1093
1112
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1094
- 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);
1095
1116
  }
1096
1117
  function shallowReadArray(arr) {
1097
1118
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4360,13 +4381,15 @@ function createHydrationFunctions(rendererInternals) {
4360
4381
  getContainerType(container),
4361
4382
  optimized
4362
4383
  );
4363
- if (isAsyncWrapper(vnode) && !vnode.component.subTree) {
4384
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4364
4385
  let subTree;
4365
4386
  if (isFragmentStart) {
4366
4387
  subTree = createVNode(Static);
4367
4388
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4368
4389
  } else {
4369
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4390
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4391
+ node.nodeType === 8 ? Comment : "div"
4392
+ );
4370
4393
  }
4371
4394
  subTree.el = node;
4372
4395
  vnode.component.subTree = subTree;
@@ -7812,6 +7835,12 @@ function baseCreateRenderer(options, createHydrationFns) {
7812
7835
  optimized = false;
7813
7836
  n2.dynamicChildren = null;
7814
7837
  }
7838
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
7839
+ if (n2.dynamicChildren === EMPTY_ARR) {
7840
+ n2.dynamicChildren = [];
7841
+ }
7842
+ n2.dynamicChildren.hasOnce = true;
7843
+ }
7815
7844
  const { type, ref, shapeFlag } = n2;
7816
7845
  switch (type) {
7817
7846
  case Text:
@@ -8419,6 +8448,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8419
8448
  {
8420
8449
  pushWarningContext(n2);
8421
8450
  }
8451
+ n2.el = n1.el;
8422
8452
  updateComponentPreRender(instance, n2, optimized);
8423
8453
  {
8424
8454
  popWarningContext();
@@ -9010,7 +9040,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9010
9040
  cacheIndex,
9011
9041
  memo
9012
9042
  } = vnode;
9013
- if (patchFlag === -2) {
9043
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
9014
9044
  optimized = false;
9015
9045
  }
9016
9046
  if (ref != null) {
@@ -9018,7 +9048,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9018
9048
  setRef(ref, null, parentSuspense, vnode, true);
9019
9049
  resetTracking();
9020
9050
  }
9021
- if (cacheIndex != null) {
9051
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
9022
9052
  parentComponent.renderCache[cacheIndex] = void 0;
9023
9053
  }
9024
9054
  if (shapeFlag & 256) {
@@ -9099,6 +9129,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9099
9129
  }
9100
9130
  if (type === Static) {
9101
9131
  removeStaticNode(vnode);
9132
+ if (transition && !transition.persisted && transition.afterLeave) {
9133
+ transition.afterLeave();
9134
+ }
9102
9135
  return;
9103
9136
  }
9104
9137
  const performRemove = () => {
@@ -9142,6 +9175,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9142
9175
  if (job) {
9143
9176
  job.flags |= 8;
9144
9177
  unmount(subTree, instance, parentSuspense, doRemove);
9178
+ } else if (instance.vnode.el && subTree) {
9179
+ subTree.transition = instance.vnode.transition;
9180
+ unmount(subTree, instance, parentSuspense, doRemove);
9145
9181
  }
9146
9182
  if (um) {
9147
9183
  queuePostRenderEffect(um, parentSuspense);
@@ -9356,7 +9392,7 @@ const SuspenseImpl = {
9356
9392
  rendererInternals
9357
9393
  );
9358
9394
  } else {
9359
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
9395
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
9360
9396
  n2.suspense = n1.suspense;
9361
9397
  n2.suspense.vnode = n2;
9362
9398
  n2.el = n1.el;
@@ -9442,10 +9478,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9442
9478
  if (pendingBranch) {
9443
9479
  suspense.pendingBranch = newBranch;
9444
9480
  if (isSameVNodeType(pendingBranch, newBranch)) {
9481
+ suspense.deps++;
9445
9482
  patch(
9446
9483
  pendingBranch,
9447
9484
  newBranch,
9448
- suspense.hiddenContainer,
9485
+ // a hydrating pending branch is adopted SSR DOM, already in place
9486
+ isHydrating ? container : suspense.hiddenContainer,
9449
9487
  null,
9450
9488
  parentComponent,
9451
9489
  suspense,
@@ -9453,6 +9491,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9453
9491
  slotScopeIds,
9454
9492
  optimized
9455
9493
  );
9494
+ suspense.deps--;
9456
9495
  if (suspense.deps <= 0) {
9457
9496
  suspense.resolve();
9458
9497
  } else if (isInFallback) {
@@ -9718,6 +9757,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9718
9757
  suspense.effects = [];
9719
9758
  if (isSuspensible) {
9720
9759
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
9760
+ parentSuspenseId = void 0;
9721
9761
  parentSuspense.deps--;
9722
9762
  if (parentSuspense.deps === 0 && !sync) {
9723
9763
  parentSuspense.resolve();
@@ -9791,6 +9831,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9791
9831
  return;
9792
9832
  }
9793
9833
  unsetCurrentInstance();
9834
+ if (hydratedEl && !instance.scope.active) {
9835
+ if (isInPendingSuspense && --suspense.deps === 0) {
9836
+ suspense.resolve();
9837
+ }
9838
+ return;
9839
+ }
9794
9840
  instance.asyncResolved = true;
9795
9841
  const { vnode: vnode2 } = instance;
9796
9842
  {
@@ -10212,7 +10258,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
10212
10258
  el: vnode.el,
10213
10259
  anchor: vnode.anchor,
10214
10260
  ctx: vnode.ctx,
10215
- ce: vnode.ce
10261
+ ce: vnode.ce,
10262
+ cacheIndex: vnode.cacheIndex
10216
10263
  };
10217
10264
  if (transition && cloneTransition) {
10218
10265
  setTransitionHooks(
@@ -11017,7 +11064,7 @@ function isMemoSame(cached, memo) {
11017
11064
  return true;
11018
11065
  }
11019
11066
 
11020
- const version = "3.5.42";
11067
+ const version = "3.5.43";
11021
11068
  const warn = warn$1 ;
11022
11069
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11023
11070
  const devtools = devtools$1 ;