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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -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
  **/
@@ -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
  **/
@@ -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,22 +294,22 @@ 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 looseCompareCollections(a, b) {
305
+ function looseCompareCollections(a, b, seen) {
306
306
  if (a.size !== b.size) return false;
307
307
  const candidates = Array.from(b);
308
308
  const matched = new Uint8Array(candidates.length);
309
309
  for (const item of a) {
310
310
  let index = -1;
311
311
  for (let i = 0; i < candidates.length; i++) {
312
- if (!matched[i] && looseEqual(item, candidates[i])) {
312
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
313
313
  index = i;
314
314
  break;
315
315
  }
@@ -319,7 +319,47 @@ function looseCompareCollections(a, b) {
319
319
  }
320
320
  return true;
321
321
  }
322
- function looseEqual(a, b) {
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) {
323
363
  if (a === b) return true;
324
364
  let aValidType = isDate(a);
325
365
  let bValidType = isDate(b);
@@ -334,7 +374,7 @@ function looseEqual(a, b) {
334
374
  aValidType = isArray(a);
335
375
  bValidType = isArray(b);
336
376
  if (aValidType || bValidType) {
337
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
377
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
338
378
  }
339
379
  aValidType = isObject(a);
340
380
  bValidType = isObject(b);
@@ -342,28 +382,7 @@ function looseEqual(a, b) {
342
382
  if (!aValidType || !bValidType) {
343
383
  return false;
344
384
  }
345
- aValidType = isMap(a);
346
- bValidType = isMap(b);
347
- if (aValidType || bValidType) {
348
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
349
- }
350
- aValidType = isSet(a);
351
- bValidType = isSet(b);
352
- if (aValidType || bValidType) {
353
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
354
- }
355
- const aKeysCount = Object.keys(a).length;
356
- const bKeysCount = Object.keys(b).length;
357
- if (aKeysCount !== bKeysCount) {
358
- return false;
359
- }
360
- for (const key in a) {
361
- const aHasKey = a.hasOwnProperty(key);
362
- const bHasKey = b.hasOwnProperty(key);
363
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
364
- return false;
365
- }
366
- }
385
+ return looseCompareNested(a, b, seen, looseCompareObjects);
367
386
  }
368
387
  return String(a) === String(b);
369
388
  }
@@ -1164,7 +1183,9 @@ function reactiveReadArray(array) {
1164
1183
  const raw = toRaw(array);
1165
1184
  if (raw === array) return raw;
1166
1185
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1167
- 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);
1168
1189
  }
1169
1190
  function shallowReadArray(arr) {
1170
1191
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4433,13 +4454,15 @@ function createHydrationFunctions(rendererInternals) {
4433
4454
  getContainerType(container),
4434
4455
  optimized
4435
4456
  );
4436
- if (isAsyncWrapper(vnode) && !vnode.component.subTree) {
4457
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4437
4458
  let subTree;
4438
4459
  if (isFragmentStart) {
4439
4460
  subTree = createVNode(Static);
4440
4461
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4441
4462
  } else {
4442
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4463
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4464
+ node.nodeType === 8 ? Comment : "div"
4465
+ );
4443
4466
  }
4444
4467
  subTree.el = node;
4445
4468
  vnode.component.subTree = subTree;
@@ -7885,6 +7908,12 @@ function baseCreateRenderer(options, createHydrationFns) {
7885
7908
  optimized = false;
7886
7909
  n2.dynamicChildren = null;
7887
7910
  }
7911
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
7912
+ if (n2.dynamicChildren === EMPTY_ARR) {
7913
+ n2.dynamicChildren = [];
7914
+ }
7915
+ n2.dynamicChildren.hasOnce = true;
7916
+ }
7888
7917
  const { type, ref, shapeFlag } = n2;
7889
7918
  switch (type) {
7890
7919
  case Text:
@@ -8492,6 +8521,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8492
8521
  {
8493
8522
  pushWarningContext(n2);
8494
8523
  }
8524
+ n2.el = n1.el;
8495
8525
  updateComponentPreRender(instance, n2, optimized);
8496
8526
  {
8497
8527
  popWarningContext();
@@ -9083,7 +9113,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9083
9113
  cacheIndex,
9084
9114
  memo
9085
9115
  } = vnode;
9086
- if (patchFlag === -2) {
9116
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
9087
9117
  optimized = false;
9088
9118
  }
9089
9119
  if (ref != null) {
@@ -9091,7 +9121,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9091
9121
  setRef(ref, null, parentSuspense, vnode, true);
9092
9122
  resetTracking();
9093
9123
  }
9094
- if (cacheIndex != null) {
9124
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
9095
9125
  parentComponent.renderCache[cacheIndex] = void 0;
9096
9126
  }
9097
9127
  if (shapeFlag & 256) {
@@ -9172,6 +9202,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9172
9202
  }
9173
9203
  if (type === Static) {
9174
9204
  removeStaticNode(vnode);
9205
+ if (transition && !transition.persisted && transition.afterLeave) {
9206
+ transition.afterLeave();
9207
+ }
9175
9208
  return;
9176
9209
  }
9177
9210
  const performRemove = () => {
@@ -9215,6 +9248,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9215
9248
  if (job) {
9216
9249
  job.flags |= 8;
9217
9250
  unmount(subTree, instance, parentSuspense, doRemove);
9251
+ } else if (instance.vnode.el && subTree) {
9252
+ subTree.transition = instance.vnode.transition;
9253
+ unmount(subTree, instance, parentSuspense, doRemove);
9218
9254
  }
9219
9255
  if (um) {
9220
9256
  queuePostRenderEffect(um, parentSuspense);
@@ -9429,7 +9465,7 @@ const SuspenseImpl = {
9429
9465
  rendererInternals
9430
9466
  );
9431
9467
  } else {
9432
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
9468
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
9433
9469
  n2.suspense = n1.suspense;
9434
9470
  n2.suspense.vnode = n2;
9435
9471
  n2.el = n1.el;
@@ -9515,10 +9551,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9515
9551
  if (pendingBranch) {
9516
9552
  suspense.pendingBranch = newBranch;
9517
9553
  if (isSameVNodeType(pendingBranch, newBranch)) {
9554
+ suspense.deps++;
9518
9555
  patch(
9519
9556
  pendingBranch,
9520
9557
  newBranch,
9521
- suspense.hiddenContainer,
9558
+ // a hydrating pending branch is adopted SSR DOM, already in place
9559
+ isHydrating ? container : suspense.hiddenContainer,
9522
9560
  null,
9523
9561
  parentComponent,
9524
9562
  suspense,
@@ -9526,6 +9564,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9526
9564
  slotScopeIds,
9527
9565
  optimized
9528
9566
  );
9567
+ suspense.deps--;
9529
9568
  if (suspense.deps <= 0) {
9530
9569
  suspense.resolve();
9531
9570
  } else if (isInFallback) {
@@ -9791,6 +9830,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9791
9830
  suspense.effects = [];
9792
9831
  if (isSuspensible) {
9793
9832
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
9833
+ parentSuspenseId = void 0;
9794
9834
  parentSuspense.deps--;
9795
9835
  if (parentSuspense.deps === 0 && !sync) {
9796
9836
  parentSuspense.resolve();
@@ -9864,6 +9904,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9864
9904
  return;
9865
9905
  }
9866
9906
  unsetCurrentInstance();
9907
+ if (hydratedEl && !instance.scope.active) {
9908
+ if (isInPendingSuspense && --suspense.deps === 0) {
9909
+ suspense.resolve();
9910
+ }
9911
+ return;
9912
+ }
9867
9913
  instance.asyncResolved = true;
9868
9914
  const { vnode: vnode2 } = instance;
9869
9915
  {
@@ -10285,7 +10331,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
10285
10331
  el: vnode.el,
10286
10332
  anchor: vnode.anchor,
10287
10333
  ctx: vnode.ctx,
10288
- ce: vnode.ce
10334
+ ce: vnode.ce,
10335
+ cacheIndex: vnode.cacheIndex
10289
10336
  };
10290
10337
  if (transition && cloneTransition) {
10291
10338
  setTransitionHooks(
@@ -11090,7 +11137,7 @@ function isMemoSame(cached, memo) {
11090
11137
  return true;
11091
11138
  }
11092
11139
 
11093
- const version = "3.5.42";
11140
+ const version = "3.5.43";
11094
11141
  const warn = warn$1 ;
11095
11142
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11096
11143
  const devtools = devtools$1 ;