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
  **/
@@ -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,15 +221,72 @@ 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 looseEqual(a, b) {
232
+ function looseCompareCollections(a, b, seen) {
233
+ if (a.size !== b.size) return false;
234
+ const candidates = Array.from(b);
235
+ const matched = new Uint8Array(candidates.length);
236
+ for (const item of a) {
237
+ let index = -1;
238
+ for (let i = 0; i < candidates.length; i++) {
239
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
240
+ index = i;
241
+ break;
242
+ }
243
+ }
244
+ if (index < 0) return false;
245
+ matched[index] = 1;
246
+ }
247
+ return true;
248
+ }
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) {
233
290
  if (a === b) return true;
234
291
  let aValidType = isDate(a);
235
292
  let bValidType = isDate(b);
@@ -244,7 +301,7 @@ function looseEqual(a, b) {
244
301
  aValidType = isArray(a);
245
302
  bValidType = isArray(b);
246
303
  if (aValidType || bValidType) {
247
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
304
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
248
305
  }
249
306
  aValidType = isObject(a);
250
307
  bValidType = isObject(b);
@@ -252,18 +309,7 @@ function looseEqual(a, b) {
252
309
  if (!aValidType || !bValidType) {
253
310
  return false;
254
311
  }
255
- const aKeysCount = Object.keys(a).length;
256
- const bKeysCount = Object.keys(b).length;
257
- if (aKeysCount !== bKeysCount) {
258
- return false;
259
- }
260
- for (const key in a) {
261
- const aHasKey = a.hasOwnProperty(key);
262
- const bHasKey = b.hasOwnProperty(key);
263
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
264
- return false;
265
- }
266
- }
312
+ return looseCompareNested(a, b, seen, looseCompareObjects);
267
313
  }
268
314
  return String(a) === String(b);
269
315
  }
@@ -1064,7 +1110,9 @@ function reactiveReadArray(array) {
1064
1110
  const raw = toRaw(array);
1065
1111
  if (raw === array) return raw;
1066
1112
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1067
- 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);
1068
1116
  }
1069
1117
  function shallowReadArray(arr) {
1070
1118
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4333,13 +4381,15 @@ function createHydrationFunctions(rendererInternals) {
4333
4381
  getContainerType(container),
4334
4382
  optimized
4335
4383
  );
4336
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4384
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4337
4385
  let subTree;
4338
4386
  if (isFragmentStart) {
4339
- subTree = createVNode(Fragment);
4387
+ subTree = createVNode(Static);
4340
4388
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4341
4389
  } else {
4342
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4390
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4391
+ node.nodeType === 8 ? Comment : "div"
4392
+ );
4343
4393
  }
4344
4394
  subTree.el = node;
4345
4395
  vnode.component.subTree = subTree;
@@ -5245,7 +5295,10 @@ const KeepAliveImpl = {
5245
5295
  if (pendingCacheKey != null) {
5246
5296
  if (isSuspense(instance.subTree.type)) {
5247
5297
  queuePostRenderEffect(() => {
5248
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5298
+ const vnode = getInnerChild(instance.subTree);
5299
+ if (vnode.component) {
5300
+ cache.set(pendingCacheKey, vnode);
5301
+ }
5249
5302
  }, instance.subTree.suspense);
5250
5303
  } else {
5251
5304
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -5646,12 +5699,41 @@ const getPublicInstance = (i) => {
5646
5699
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
5647
5700
  return getPublicInstance(i.parent);
5648
5701
  };
5702
+ const resolveDevRootEl = (vnode) => {
5703
+ let found = false;
5704
+ while (true) {
5705
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
5706
+ const root = filterSingleRoot(vnode.children);
5707
+ if (!root) {
5708
+ return;
5709
+ }
5710
+ vnode = root;
5711
+ found = true;
5712
+ continue;
5713
+ }
5714
+ const component = vnode.component;
5715
+ if (component && component.subTree) {
5716
+ vnode = component.subTree;
5717
+ continue;
5718
+ }
5719
+ const suspense = vnode.suspense;
5720
+ if (suspense && suspense.activeBranch) {
5721
+ vnode = suspense.activeBranch;
5722
+ continue;
5723
+ }
5724
+ return found ? vnode.el : void 0;
5725
+ }
5726
+ };
5727
+ const getDevRootFragmentEl = (i) => {
5728
+ const el = i.subTree && resolveDevRootEl(i.subTree);
5729
+ return el === void 0 ? i.vnode.el : el;
5730
+ };
5649
5731
  const publicPropertiesMap = (
5650
5732
  // Move PURE marker to new line to workaround compiler discarding it
5651
5733
  // due to type annotation
5652
5734
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
5653
5735
  $: (i) => i,
5654
- $el: (i) => i.vnode.el,
5736
+ $el: (i) => getDevRootFragmentEl(i) ,
5655
5737
  $data: (i) => i.data,
5656
5738
  $props: (i) => shallowReadonly(i.props) ,
5657
5739
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -6754,7 +6836,7 @@ function emit(instance, event, ...rawArgs) {
6754
6836
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
6755
6837
  }
6756
6838
  if (modifiers.number) {
6757
- args = rawArgs.map(looseToNumber);
6839
+ args = args.map(looseToNumber);
6758
6840
  }
6759
6841
  }
6760
6842
  {
@@ -7753,6 +7835,12 @@ function baseCreateRenderer(options, createHydrationFns) {
7753
7835
  optimized = false;
7754
7836
  n2.dynamicChildren = null;
7755
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
+ }
7756
7844
  const { type, ref, shapeFlag } = n2;
7757
7845
  switch (type) {
7758
7846
  case Text:
@@ -8360,6 +8448,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8360
8448
  {
8361
8449
  pushWarningContext(n2);
8362
8450
  }
8451
+ n2.el = n1.el;
8363
8452
  updateComponentPreRender(instance, n2, optimized);
8364
8453
  {
8365
8454
  popWarningContext();
@@ -8951,7 +9040,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8951
9040
  cacheIndex,
8952
9041
  memo
8953
9042
  } = vnode;
8954
- if (patchFlag === -2) {
9043
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
8955
9044
  optimized = false;
8956
9045
  }
8957
9046
  if (ref != null) {
@@ -8959,7 +9048,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8959
9048
  setRef(ref, null, parentSuspense, vnode, true);
8960
9049
  resetTracking();
8961
9050
  }
8962
- if (cacheIndex != null) {
9051
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
8963
9052
  parentComponent.renderCache[cacheIndex] = void 0;
8964
9053
  }
8965
9054
  if (shapeFlag & 256) {
@@ -9040,6 +9129,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9040
9129
  }
9041
9130
  if (type === Static) {
9042
9131
  removeStaticNode(vnode);
9132
+ if (transition && !transition.persisted && transition.afterLeave) {
9133
+ transition.afterLeave();
9134
+ }
9043
9135
  return;
9044
9136
  }
9045
9137
  const performRemove = () => {
@@ -9083,6 +9175,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9083
9175
  if (job) {
9084
9176
  job.flags |= 8;
9085
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);
9086
9181
  }
9087
9182
  if (um) {
9088
9183
  queuePostRenderEffect(um, parentSuspense);
@@ -9297,7 +9392,7 @@ const SuspenseImpl = {
9297
9392
  rendererInternals
9298
9393
  );
9299
9394
  } else {
9300
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
9395
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
9301
9396
  n2.suspense = n1.suspense;
9302
9397
  n2.suspense.vnode = n2;
9303
9398
  n2.el = n1.el;
@@ -9383,10 +9478,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9383
9478
  if (pendingBranch) {
9384
9479
  suspense.pendingBranch = newBranch;
9385
9480
  if (isSameVNodeType(pendingBranch, newBranch)) {
9481
+ suspense.deps++;
9386
9482
  patch(
9387
9483
  pendingBranch,
9388
9484
  newBranch,
9389
- suspense.hiddenContainer,
9485
+ // a hydrating pending branch is adopted SSR DOM, already in place
9486
+ isHydrating ? container : suspense.hiddenContainer,
9390
9487
  null,
9391
9488
  parentComponent,
9392
9489
  suspense,
@@ -9394,10 +9491,11 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9394
9491
  slotScopeIds,
9395
9492
  optimized
9396
9493
  );
9494
+ suspense.deps--;
9397
9495
  if (suspense.deps <= 0) {
9398
9496
  suspense.resolve();
9399
9497
  } else if (isInFallback) {
9400
- if (!isHydrating) {
9498
+ if (!isHydrating && !suspense.isFallbackMountPending) {
9401
9499
  patch(
9402
9500
  activeBranch,
9403
9501
  newFallback,
@@ -9438,7 +9536,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9438
9536
  );
9439
9537
  if (suspense.deps <= 0) {
9440
9538
  suspense.resolve();
9441
- } else {
9539
+ } else if (!suspense.isFallbackMountPending) {
9442
9540
  patch(
9443
9541
  activeBranch,
9444
9542
  newFallback,
@@ -9659,6 +9757,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9659
9757
  suspense.effects = [];
9660
9758
  if (isSuspensible) {
9661
9759
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
9760
+ parentSuspenseId = void 0;
9662
9761
  parentSuspense.deps--;
9663
9762
  if (parentSuspense.deps === 0 && !sync) {
9664
9763
  parentSuspense.resolve();
@@ -9679,9 +9778,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9679
9778
  if (!suspense.isInFallback) {
9680
9779
  return;
9681
9780
  }
9781
+ const latestFallback = suspense.vnode.ssFallback;
9682
9782
  patch(
9683
9783
  null,
9684
- fallbackVNode,
9784
+ latestFallback,
9685
9785
  container2,
9686
9786
  anchor2,
9687
9787
  parentComponent2,
@@ -9691,7 +9791,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9691
9791
  slotScopeIds,
9692
9792
  optimized
9693
9793
  );
9694
- setActiveBranch(suspense, fallbackVNode);
9794
+ setActiveBranch(suspense, latestFallback);
9695
9795
  };
9696
9796
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
9697
9797
  if (delayEnter) {
@@ -9731,6 +9831,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9731
9831
  return;
9732
9832
  }
9733
9833
  unsetCurrentInstance();
9834
+ if (hydratedEl && !instance.scope.active) {
9835
+ if (isInPendingSuspense && --suspense.deps === 0) {
9836
+ suspense.resolve();
9837
+ }
9838
+ return;
9839
+ }
9734
9840
  instance.asyncResolved = true;
9735
9841
  const { vnode: vnode2 } = instance;
9736
9842
  {
@@ -10152,7 +10258,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
10152
10258
  el: vnode.el,
10153
10259
  anchor: vnode.anchor,
10154
10260
  ctx: vnode.ctx,
10155
- ce: vnode.ce
10261
+ ce: vnode.ce,
10262
+ cacheIndex: vnode.cacheIndex
10156
10263
  };
10157
10264
  if (transition && cloneTransition) {
10158
10265
  setTransitionHooks(
@@ -10957,7 +11064,7 @@ function isMemoSame(cached, memo) {
10957
11064
  return true;
10958
11065
  }
10959
11066
 
10960
- const version = "3.5.41";
11067
+ const version = "3.5.43";
10961
11068
  const warn = warn$1 ;
10962
11069
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10963
11070
  const devtools = devtools$1 ;
@@ -11554,7 +11661,11 @@ function setStyle(style, name, val) {
11554
11661
  }
11555
11662
  }
11556
11663
  if (name.startsWith("--")) {
11557
- style.setProperty(name, val);
11664
+ if (importantRE.test(val)) {
11665
+ style.setProperty(name, val.replace(importantRE, ""), "important");
11666
+ } else {
11667
+ style.setProperty(name, val);
11668
+ }
11558
11669
  } else {
11559
11670
  const prefixed = autoPrefix(style, name);
11560
11671
  if (importantRE.test(val)) {
@@ -12688,13 +12799,21 @@ const vModelSelect = {
12688
12799
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12689
12800
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12690
12801
  );
12691
- el[assignKey](
12692
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12693
- );
12694
- el._assigning = true;
12695
- nextTick(() => {
12696
- el._assigning = false;
12697
- });
12802
+ const multiple = el.multiple;
12803
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
12804
+ const pending = el._pendingValue = [
12805
+ multiple,
12806
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
12807
+ ];
12808
+ try {
12809
+ el[assignKey](assignedValue);
12810
+ } finally {
12811
+ nextTick(() => {
12812
+ if (el._pendingValue === pending) {
12813
+ el._pendingValue = void 0;
12814
+ }
12815
+ });
12816
+ }
12698
12817
  });
12699
12818
  el[assignKey] = getModelAssigner(vnode);
12700
12819
  },
@@ -12708,11 +12827,25 @@ const vModelSelect = {
12708
12827
  el[assignKey] = getModelAssigner(vnode);
12709
12828
  },
12710
12829
  updated(el, { value }) {
12711
- if (!el._assigning) {
12830
+ const pending = el._pendingValue;
12831
+ el._pendingValue = void 0;
12832
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
12712
12833
  setSelected(el, value);
12713
12834
  }
12714
12835
  }
12715
12836
  };
12837
+ function isSameSelectValue(value, assignedValue, multiple) {
12838
+ if (!multiple) return looseEqual(value, assignedValue);
12839
+ if (isArray(value)) return looseEqual(value, assignedValue);
12840
+ if (isSet(value)) {
12841
+ if (value.size !== assignedValue.length) return false;
12842
+ for (const item of assignedValue) {
12843
+ if (!value.has(item)) return false;
12844
+ }
12845
+ return true;
12846
+ }
12847
+ return false;
12848
+ }
12716
12849
  function setSelected(el, value) {
12717
12850
  const isMultiple = el.multiple;
12718
12851
  const isArrayValue = isArray(value);