vue 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 v3.5.41
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.41
2
+ * vue v3.5.43
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -202,10 +202,10 @@ var Vue = (function (exports) {
202
202
  }
203
203
  const listDelimiterRE = /;(?![^(]*\))/g;
204
204
  const propertyDelimiterRE = /:([^]+)/;
205
- const styleCommentRE = /\/\*[^]*?\*\//g;
205
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
206
206
  function parseStringStyle(cssText) {
207
207
  const ret = {};
208
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
208
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
209
209
  if (item) {
210
210
  const tmp = item.split(propertyDelimiterRE);
211
211
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -297,15 +297,72 @@ var Vue = (function (exports) {
297
297
  );
298
298
  }
299
299
 
300
- function looseCompareArrays(a, b) {
300
+ function looseCompareArrays(a, b, seen) {
301
301
  if (a.length !== b.length) return false;
302
302
  let equal = true;
303
303
  for (let i = 0; equal && i < a.length; i++) {
304
- equal = looseEqual(a[i], b[i]);
304
+ equal = looseEqual(a[i], b[i], seen);
305
305
  }
306
306
  return equal;
307
307
  }
308
- function looseEqual(a, b) {
308
+ function looseCompareCollections(a, b, seen) {
309
+ if (a.size !== b.size) return false;
310
+ const candidates = Array.from(b);
311
+ const matched = new Uint8Array(candidates.length);
312
+ for (const item of a) {
313
+ let index = -1;
314
+ for (let i = 0; i < candidates.length; i++) {
315
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
316
+ index = i;
317
+ break;
318
+ }
319
+ }
320
+ if (index < 0) return false;
321
+ matched[index] = 1;
322
+ }
323
+ return true;
324
+ }
325
+ function looseCompareObjects(a, b, seen) {
326
+ let aValidType = isMap(a);
327
+ let bValidType = isMap(b);
328
+ if (aValidType || bValidType) {
329
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
330
+ }
331
+ aValidType = isSet(a);
332
+ bValidType = isSet(b);
333
+ if (aValidType || bValidType) {
334
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
335
+ }
336
+ const aKeysCount = Object.keys(a).length;
337
+ const bKeysCount = Object.keys(b).length;
338
+ if (aKeysCount !== bKeysCount) {
339
+ return false;
340
+ }
341
+ for (const key in a) {
342
+ const aHasKey = a.hasOwnProperty(key);
343
+ const bHasKey = b.hasOwnProperty(key);
344
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
345
+ return false;
346
+ }
347
+ }
348
+ return String(a) === String(b);
349
+ }
350
+ function looseCompareNested(a, b, seen, compare) {
351
+ if (!seen) {
352
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
353
+ }
354
+ const [seenA, seenB] = seen;
355
+ if (seenA.has(a) || seenB.has(b)) {
356
+ return seenA.get(a) === b && seenB.get(b) === a;
357
+ }
358
+ seenA.set(a, b);
359
+ seenB.set(b, a);
360
+ const equal = compare(a, b, seen);
361
+ seenA.delete(a);
362
+ seenB.delete(b);
363
+ return equal;
364
+ }
365
+ function looseEqual(a, b, seen) {
309
366
  if (a === b) return true;
310
367
  let aValidType = isDate(a);
311
368
  let bValidType = isDate(b);
@@ -320,7 +377,7 @@ var Vue = (function (exports) {
320
377
  aValidType = isArray(a);
321
378
  bValidType = isArray(b);
322
379
  if (aValidType || bValidType) {
323
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
380
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
324
381
  }
325
382
  aValidType = isObject(a);
326
383
  bValidType = isObject(b);
@@ -328,18 +385,7 @@ var Vue = (function (exports) {
328
385
  if (!aValidType || !bValidType) {
329
386
  return false;
330
387
  }
331
- const aKeysCount = Object.keys(a).length;
332
- const bKeysCount = Object.keys(b).length;
333
- if (aKeysCount !== bKeysCount) {
334
- return false;
335
- }
336
- for (const key in a) {
337
- const aHasKey = a.hasOwnProperty(key);
338
- const bHasKey = b.hasOwnProperty(key);
339
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
340
- return false;
341
- }
342
- }
388
+ return looseCompareNested(a, b, seen, looseCompareObjects);
343
389
  }
344
390
  return String(a) === String(b);
345
391
  }
@@ -1140,7 +1186,9 @@ var Vue = (function (exports) {
1140
1186
  const raw = toRaw(array);
1141
1187
  if (raw === array) return raw;
1142
1188
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1143
- return isShallow(array) ? raw : raw.map(toReactive);
1189
+ if (isShallow(array)) return raw;
1190
+ if (!isReadonly(array)) return raw.map(toReactive);
1191
+ return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
1144
1192
  }
1145
1193
  function shallowReadArray(arr) {
1146
1194
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4381,13 +4429,15 @@ var Vue = (function (exports) {
4381
4429
  getContainerType(container),
4382
4430
  optimized
4383
4431
  );
4384
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4432
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4385
4433
  let subTree;
4386
4434
  if (isFragmentStart) {
4387
- subTree = createVNode(Fragment);
4435
+ subTree = createVNode(Static);
4388
4436
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4389
4437
  } else {
4390
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4438
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4439
+ node.nodeType === 8 ? Comment : "div"
4440
+ );
4391
4441
  }
4392
4442
  subTree.el = node;
4393
4443
  vnode.component.subTree = subTree;
@@ -5287,7 +5337,10 @@ Server rendered element contains fewer child nodes than client vdom.`
5287
5337
  if (pendingCacheKey != null) {
5288
5338
  if (isSuspense(instance.subTree.type)) {
5289
5339
  queuePostRenderEffect(() => {
5290
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5340
+ const vnode = getInnerChild(instance.subTree);
5341
+ if (vnode.component) {
5342
+ cache.set(pendingCacheKey, vnode);
5343
+ }
5291
5344
  }, instance.subTree.suspense);
5292
5345
  } else {
5293
5346
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -5688,12 +5741,41 @@ If this is a native custom element, make sure to exclude it from component resol
5688
5741
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
5689
5742
  return getPublicInstance(i.parent);
5690
5743
  };
5744
+ const resolveDevRootEl = (vnode) => {
5745
+ let found = false;
5746
+ while (true) {
5747
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
5748
+ const root = filterSingleRoot(vnode.children);
5749
+ if (!root) {
5750
+ return;
5751
+ }
5752
+ vnode = root;
5753
+ found = true;
5754
+ continue;
5755
+ }
5756
+ const component = vnode.component;
5757
+ if (component && component.subTree) {
5758
+ vnode = component.subTree;
5759
+ continue;
5760
+ }
5761
+ const suspense = vnode.suspense;
5762
+ if (suspense && suspense.activeBranch) {
5763
+ vnode = suspense.activeBranch;
5764
+ continue;
5765
+ }
5766
+ return found ? vnode.el : void 0;
5767
+ }
5768
+ };
5769
+ const getDevRootFragmentEl = (i) => {
5770
+ const el = i.subTree && resolveDevRootEl(i.subTree);
5771
+ return el === void 0 ? i.vnode.el : el;
5772
+ };
5691
5773
  const publicPropertiesMap = (
5692
5774
  // Move PURE marker to new line to workaround compiler discarding it
5693
5775
  // due to type annotation
5694
5776
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
5695
5777
  $: (i) => i,
5696
- $el: (i) => i.vnode.el,
5778
+ $el: (i) => getDevRootFragmentEl(i) ,
5697
5779
  $data: (i) => i.data,
5698
5780
  $props: (i) => shallowReadonly(i.props) ,
5699
5781
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -6793,7 +6875,7 @@ If you want to remount the same app, move your app creation logic into a factory
6793
6875
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
6794
6876
  }
6795
6877
  if (modifiers.number) {
6796
- args = rawArgs.map(looseToNumber);
6878
+ args = args.map(looseToNumber);
6797
6879
  }
6798
6880
  }
6799
6881
  {
@@ -7792,6 +7874,12 @@ If you want to remount the same app, move your app creation logic into a factory
7792
7874
  optimized = false;
7793
7875
  n2.dynamicChildren = null;
7794
7876
  }
7877
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
7878
+ if (n2.dynamicChildren === EMPTY_ARR) {
7879
+ n2.dynamicChildren = [];
7880
+ }
7881
+ n2.dynamicChildren.hasOnce = true;
7882
+ }
7795
7883
  const { type, ref, shapeFlag } = n2;
7796
7884
  switch (type) {
7797
7885
  case Text:
@@ -8399,6 +8487,7 @@ If you want to remount the same app, move your app creation logic into a factory
8399
8487
  {
8400
8488
  pushWarningContext(n2);
8401
8489
  }
8490
+ n2.el = n1.el;
8402
8491
  updateComponentPreRender(instance, n2, optimized);
8403
8492
  {
8404
8493
  popWarningContext();
@@ -8990,7 +9079,7 @@ If you want to remount the same app, move your app creation logic into a factory
8990
9079
  cacheIndex,
8991
9080
  memo
8992
9081
  } = vnode;
8993
- if (patchFlag === -2) {
9082
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
8994
9083
  optimized = false;
8995
9084
  }
8996
9085
  if (ref != null) {
@@ -8998,7 +9087,7 @@ If you want to remount the same app, move your app creation logic into a factory
8998
9087
  setRef(ref, null, parentSuspense, vnode, true);
8999
9088
  resetTracking();
9000
9089
  }
9001
- if (cacheIndex != null) {
9090
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
9002
9091
  parentComponent.renderCache[cacheIndex] = void 0;
9003
9092
  }
9004
9093
  if (shapeFlag & 256) {
@@ -9079,6 +9168,9 @@ If you want to remount the same app, move your app creation logic into a factory
9079
9168
  }
9080
9169
  if (type === Static) {
9081
9170
  removeStaticNode(vnode);
9171
+ if (transition && !transition.persisted && transition.afterLeave) {
9172
+ transition.afterLeave();
9173
+ }
9082
9174
  return;
9083
9175
  }
9084
9176
  const performRemove = () => {
@@ -9122,6 +9214,9 @@ If you want to remount the same app, move your app creation logic into a factory
9122
9214
  if (job) {
9123
9215
  job.flags |= 8;
9124
9216
  unmount(subTree, instance, parentSuspense, doRemove);
9217
+ } else if (instance.vnode.el && subTree) {
9218
+ subTree.transition = instance.vnode.transition;
9219
+ unmount(subTree, instance, parentSuspense, doRemove);
9125
9220
  }
9126
9221
  if (um) {
9127
9222
  queuePostRenderEffect(um, parentSuspense);
@@ -9336,7 +9431,7 @@ If you want to remount the same app, move your app creation logic into a factory
9336
9431
  rendererInternals
9337
9432
  );
9338
9433
  } else {
9339
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
9434
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
9340
9435
  n2.suspense = n1.suspense;
9341
9436
  n2.suspense.vnode = n2;
9342
9437
  n2.el = n1.el;
@@ -9422,10 +9517,12 @@ If you want to remount the same app, move your app creation logic into a factory
9422
9517
  if (pendingBranch) {
9423
9518
  suspense.pendingBranch = newBranch;
9424
9519
  if (isSameVNodeType(pendingBranch, newBranch)) {
9520
+ suspense.deps++;
9425
9521
  patch(
9426
9522
  pendingBranch,
9427
9523
  newBranch,
9428
- suspense.hiddenContainer,
9524
+ // a hydrating pending branch is adopted SSR DOM, already in place
9525
+ isHydrating ? container : suspense.hiddenContainer,
9429
9526
  null,
9430
9527
  parentComponent,
9431
9528
  suspense,
@@ -9433,10 +9530,11 @@ If you want to remount the same app, move your app creation logic into a factory
9433
9530
  slotScopeIds,
9434
9531
  optimized
9435
9532
  );
9533
+ suspense.deps--;
9436
9534
  if (suspense.deps <= 0) {
9437
9535
  suspense.resolve();
9438
9536
  } else if (isInFallback) {
9439
- if (!isHydrating) {
9537
+ if (!isHydrating && !suspense.isFallbackMountPending) {
9440
9538
  patch(
9441
9539
  activeBranch,
9442
9540
  newFallback,
@@ -9477,7 +9575,7 @@ If you want to remount the same app, move your app creation logic into a factory
9477
9575
  );
9478
9576
  if (suspense.deps <= 0) {
9479
9577
  suspense.resolve();
9480
- } else {
9578
+ } else if (!suspense.isFallbackMountPending) {
9481
9579
  patch(
9482
9580
  activeBranch,
9483
9581
  newFallback,
@@ -9698,6 +9796,7 @@ If you want to remount the same app, move your app creation logic into a factory
9698
9796
  suspense.effects = [];
9699
9797
  if (isSuspensible) {
9700
9798
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
9799
+ parentSuspenseId = void 0;
9701
9800
  parentSuspense.deps--;
9702
9801
  if (parentSuspense.deps === 0 && !sync) {
9703
9802
  parentSuspense.resolve();
@@ -9718,9 +9817,10 @@ If you want to remount the same app, move your app creation logic into a factory
9718
9817
  if (!suspense.isInFallback) {
9719
9818
  return;
9720
9819
  }
9820
+ const latestFallback = suspense.vnode.ssFallback;
9721
9821
  patch(
9722
9822
  null,
9723
- fallbackVNode,
9823
+ latestFallback,
9724
9824
  container2,
9725
9825
  anchor2,
9726
9826
  parentComponent2,
@@ -9730,7 +9830,7 @@ If you want to remount the same app, move your app creation logic into a factory
9730
9830
  slotScopeIds,
9731
9831
  optimized
9732
9832
  );
9733
- setActiveBranch(suspense, fallbackVNode);
9833
+ setActiveBranch(suspense, latestFallback);
9734
9834
  };
9735
9835
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
9736
9836
  if (delayEnter) {
@@ -9770,6 +9870,12 @@ If you want to remount the same app, move your app creation logic into a factory
9770
9870
  return;
9771
9871
  }
9772
9872
  unsetCurrentInstance();
9873
+ if (hydratedEl && !instance.scope.active) {
9874
+ if (isInPendingSuspense && --suspense.deps === 0) {
9875
+ suspense.resolve();
9876
+ }
9877
+ return;
9878
+ }
9773
9879
  instance.asyncResolved = true;
9774
9880
  const { vnode: vnode2 } = instance;
9775
9881
  {
@@ -10191,7 +10297,8 @@ Component that was made reactive: `,
10191
10297
  el: vnode.el,
10192
10298
  anchor: vnode.anchor,
10193
10299
  ctx: vnode.ctx,
10194
- ce: vnode.ce
10300
+ ce: vnode.ce,
10301
+ cacheIndex: vnode.cacheIndex
10195
10302
  };
10196
10303
  if (transition && cloneTransition) {
10197
10304
  setTransitionHooks(
@@ -10982,7 +11089,7 @@ Component that was made reactive: `,
10982
11089
  return true;
10983
11090
  }
10984
11091
 
10985
- const version = "3.5.41";
11092
+ const version = "3.5.43";
10986
11093
  const warn = warn$1 ;
10987
11094
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10988
11095
  const devtools = devtools$1 ;
@@ -11560,7 +11667,11 @@ Component that was made reactive: `,
11560
11667
  }
11561
11668
  }
11562
11669
  if (name.startsWith("--")) {
11563
- style.setProperty(name, val);
11670
+ if (importantRE.test(val)) {
11671
+ style.setProperty(name, val.replace(importantRE, ""), "important");
11672
+ } else {
11673
+ style.setProperty(name, val);
11674
+ }
11564
11675
  } else {
11565
11676
  const prefixed = autoPrefix(style, name);
11566
11677
  if (importantRE.test(val)) {
@@ -12682,13 +12793,21 @@ Expected function or array of functions, received type ${typeof value}.`
12682
12793
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12683
12794
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12684
12795
  );
12685
- el[assignKey](
12686
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12687
- );
12688
- el._assigning = true;
12689
- nextTick(() => {
12690
- el._assigning = false;
12691
- });
12796
+ const multiple = el.multiple;
12797
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
12798
+ const pending = el._pendingValue = [
12799
+ multiple,
12800
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
12801
+ ];
12802
+ try {
12803
+ el[assignKey](assignedValue);
12804
+ } finally {
12805
+ nextTick(() => {
12806
+ if (el._pendingValue === pending) {
12807
+ el._pendingValue = void 0;
12808
+ }
12809
+ });
12810
+ }
12692
12811
  });
12693
12812
  el[assignKey] = getModelAssigner(vnode);
12694
12813
  },
@@ -12702,11 +12821,25 @@ Expected function or array of functions, received type ${typeof value}.`
12702
12821
  el[assignKey] = getModelAssigner(vnode);
12703
12822
  },
12704
12823
  updated(el, { value }) {
12705
- if (!el._assigning) {
12824
+ const pending = el._pendingValue;
12825
+ el._pendingValue = void 0;
12826
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
12706
12827
  setSelected(el, value);
12707
12828
  }
12708
12829
  }
12709
12830
  };
12831
+ function isSameSelectValue(value, assignedValue, multiple) {
12832
+ if (!multiple) return looseEqual(value, assignedValue);
12833
+ if (isArray(value)) return looseEqual(value, assignedValue);
12834
+ if (isSet(value)) {
12835
+ if (value.size !== assignedValue.length) return false;
12836
+ for (const item of assignedValue) {
12837
+ if (!value.has(item)) return false;
12838
+ }
12839
+ return true;
12840
+ }
12841
+ return false;
12842
+ }
12710
12843
  function setSelected(el, value) {
12711
12844
  const isMultiple = el.multiple;
12712
12845
  const isArrayValue = isArray(value);