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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -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
  **/
@@ -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,15 +294,72 @@ 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 looseEqual(a, b) {
305
+ function looseCompareCollections(a, b, seen) {
306
+ if (a.size !== b.size) return false;
307
+ const candidates = Array.from(b);
308
+ const matched = new Uint8Array(candidates.length);
309
+ for (const item of a) {
310
+ let index = -1;
311
+ for (let i = 0; i < candidates.length; i++) {
312
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
313
+ index = i;
314
+ break;
315
+ }
316
+ }
317
+ if (index < 0) return false;
318
+ matched[index] = 1;
319
+ }
320
+ return true;
321
+ }
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) {
306
363
  if (a === b) return true;
307
364
  let aValidType = isDate(a);
308
365
  let bValidType = isDate(b);
@@ -317,7 +374,7 @@ function looseEqual(a, b) {
317
374
  aValidType = isArray(a);
318
375
  bValidType = isArray(b);
319
376
  if (aValidType || bValidType) {
320
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
377
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
321
378
  }
322
379
  aValidType = isObject(a);
323
380
  bValidType = isObject(b);
@@ -325,18 +382,7 @@ function looseEqual(a, b) {
325
382
  if (!aValidType || !bValidType) {
326
383
  return false;
327
384
  }
328
- const aKeysCount = Object.keys(a).length;
329
- const bKeysCount = Object.keys(b).length;
330
- if (aKeysCount !== bKeysCount) {
331
- return false;
332
- }
333
- for (const key in a) {
334
- const aHasKey = a.hasOwnProperty(key);
335
- const bHasKey = b.hasOwnProperty(key);
336
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
337
- return false;
338
- }
339
- }
385
+ return looseCompareNested(a, b, seen, looseCompareObjects);
340
386
  }
341
387
  return String(a) === String(b);
342
388
  }
@@ -1137,7 +1183,9 @@ function reactiveReadArray(array) {
1137
1183
  const raw = toRaw(array);
1138
1184
  if (raw === array) return raw;
1139
1185
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1140
- 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);
1141
1189
  }
1142
1190
  function shallowReadArray(arr) {
1143
1191
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4406,13 +4454,15 @@ function createHydrationFunctions(rendererInternals) {
4406
4454
  getContainerType(container),
4407
4455
  optimized
4408
4456
  );
4409
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4457
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4410
4458
  let subTree;
4411
4459
  if (isFragmentStart) {
4412
- subTree = createVNode(Fragment);
4460
+ subTree = createVNode(Static);
4413
4461
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4414
4462
  } else {
4415
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4463
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4464
+ node.nodeType === 8 ? Comment : "div"
4465
+ );
4416
4466
  }
4417
4467
  subTree.el = node;
4418
4468
  vnode.component.subTree = subTree;
@@ -5318,7 +5368,10 @@ const KeepAliveImpl = {
5318
5368
  if (pendingCacheKey != null) {
5319
5369
  if (isSuspense(instance.subTree.type)) {
5320
5370
  queuePostRenderEffect(() => {
5321
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5371
+ const vnode = getInnerChild(instance.subTree);
5372
+ if (vnode.component) {
5373
+ cache.set(pendingCacheKey, vnode);
5374
+ }
5322
5375
  }, instance.subTree.suspense);
5323
5376
  } else {
5324
5377
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -5719,12 +5772,41 @@ const getPublicInstance = (i) => {
5719
5772
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
5720
5773
  return getPublicInstance(i.parent);
5721
5774
  };
5775
+ const resolveDevRootEl = (vnode) => {
5776
+ let found = false;
5777
+ while (true) {
5778
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
5779
+ const root = filterSingleRoot(vnode.children);
5780
+ if (!root) {
5781
+ return;
5782
+ }
5783
+ vnode = root;
5784
+ found = true;
5785
+ continue;
5786
+ }
5787
+ const component = vnode.component;
5788
+ if (component && component.subTree) {
5789
+ vnode = component.subTree;
5790
+ continue;
5791
+ }
5792
+ const suspense = vnode.suspense;
5793
+ if (suspense && suspense.activeBranch) {
5794
+ vnode = suspense.activeBranch;
5795
+ continue;
5796
+ }
5797
+ return found ? vnode.el : void 0;
5798
+ }
5799
+ };
5800
+ const getDevRootFragmentEl = (i) => {
5801
+ const el = i.subTree && resolveDevRootEl(i.subTree);
5802
+ return el === void 0 ? i.vnode.el : el;
5803
+ };
5722
5804
  const publicPropertiesMap = (
5723
5805
  // Move PURE marker to new line to workaround compiler discarding it
5724
5806
  // due to type annotation
5725
5807
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
5726
5808
  $: (i) => i,
5727
- $el: (i) => i.vnode.el,
5809
+ $el: (i) => getDevRootFragmentEl(i) ,
5728
5810
  $data: (i) => i.data,
5729
5811
  $props: (i) => shallowReadonly(i.props) ,
5730
5812
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -6827,7 +6909,7 @@ function emit(instance, event, ...rawArgs) {
6827
6909
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
6828
6910
  }
6829
6911
  if (modifiers.number) {
6830
- args = rawArgs.map(looseToNumber);
6912
+ args = args.map(looseToNumber);
6831
6913
  }
6832
6914
  }
6833
6915
  {
@@ -7826,6 +7908,12 @@ function baseCreateRenderer(options, createHydrationFns) {
7826
7908
  optimized = false;
7827
7909
  n2.dynamicChildren = null;
7828
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
+ }
7829
7917
  const { type, ref, shapeFlag } = n2;
7830
7918
  switch (type) {
7831
7919
  case Text:
@@ -8433,6 +8521,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8433
8521
  {
8434
8522
  pushWarningContext(n2);
8435
8523
  }
8524
+ n2.el = n1.el;
8436
8525
  updateComponentPreRender(instance, n2, optimized);
8437
8526
  {
8438
8527
  popWarningContext();
@@ -9024,7 +9113,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9024
9113
  cacheIndex,
9025
9114
  memo
9026
9115
  } = vnode;
9027
- if (patchFlag === -2) {
9116
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
9028
9117
  optimized = false;
9029
9118
  }
9030
9119
  if (ref != null) {
@@ -9032,7 +9121,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9032
9121
  setRef(ref, null, parentSuspense, vnode, true);
9033
9122
  resetTracking();
9034
9123
  }
9035
- if (cacheIndex != null) {
9124
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
9036
9125
  parentComponent.renderCache[cacheIndex] = void 0;
9037
9126
  }
9038
9127
  if (shapeFlag & 256) {
@@ -9113,6 +9202,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9113
9202
  }
9114
9203
  if (type === Static) {
9115
9204
  removeStaticNode(vnode);
9205
+ if (transition && !transition.persisted && transition.afterLeave) {
9206
+ transition.afterLeave();
9207
+ }
9116
9208
  return;
9117
9209
  }
9118
9210
  const performRemove = () => {
@@ -9156,6 +9248,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9156
9248
  if (job) {
9157
9249
  job.flags |= 8;
9158
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);
9159
9254
  }
9160
9255
  if (um) {
9161
9256
  queuePostRenderEffect(um, parentSuspense);
@@ -9370,7 +9465,7 @@ const SuspenseImpl = {
9370
9465
  rendererInternals
9371
9466
  );
9372
9467
  } else {
9373
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
9468
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
9374
9469
  n2.suspense = n1.suspense;
9375
9470
  n2.suspense.vnode = n2;
9376
9471
  n2.el = n1.el;
@@ -9456,10 +9551,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9456
9551
  if (pendingBranch) {
9457
9552
  suspense.pendingBranch = newBranch;
9458
9553
  if (isSameVNodeType(pendingBranch, newBranch)) {
9554
+ suspense.deps++;
9459
9555
  patch(
9460
9556
  pendingBranch,
9461
9557
  newBranch,
9462
- suspense.hiddenContainer,
9558
+ // a hydrating pending branch is adopted SSR DOM, already in place
9559
+ isHydrating ? container : suspense.hiddenContainer,
9463
9560
  null,
9464
9561
  parentComponent,
9465
9562
  suspense,
@@ -9467,10 +9564,11 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9467
9564
  slotScopeIds,
9468
9565
  optimized
9469
9566
  );
9567
+ suspense.deps--;
9470
9568
  if (suspense.deps <= 0) {
9471
9569
  suspense.resolve();
9472
9570
  } else if (isInFallback) {
9473
- if (!isHydrating) {
9571
+ if (!isHydrating && !suspense.isFallbackMountPending) {
9474
9572
  patch(
9475
9573
  activeBranch,
9476
9574
  newFallback,
@@ -9511,7 +9609,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9511
9609
  );
9512
9610
  if (suspense.deps <= 0) {
9513
9611
  suspense.resolve();
9514
- } else {
9612
+ } else if (!suspense.isFallbackMountPending) {
9515
9613
  patch(
9516
9614
  activeBranch,
9517
9615
  newFallback,
@@ -9732,6 +9830,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9732
9830
  suspense.effects = [];
9733
9831
  if (isSuspensible) {
9734
9832
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
9833
+ parentSuspenseId = void 0;
9735
9834
  parentSuspense.deps--;
9736
9835
  if (parentSuspense.deps === 0 && !sync) {
9737
9836
  parentSuspense.resolve();
@@ -9752,9 +9851,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9752
9851
  if (!suspense.isInFallback) {
9753
9852
  return;
9754
9853
  }
9854
+ const latestFallback = suspense.vnode.ssFallback;
9755
9855
  patch(
9756
9856
  null,
9757
- fallbackVNode,
9857
+ latestFallback,
9758
9858
  container2,
9759
9859
  anchor2,
9760
9860
  parentComponent2,
@@ -9764,7 +9864,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9764
9864
  slotScopeIds,
9765
9865
  optimized
9766
9866
  );
9767
- setActiveBranch(suspense, fallbackVNode);
9867
+ setActiveBranch(suspense, latestFallback);
9768
9868
  };
9769
9869
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
9770
9870
  if (delayEnter) {
@@ -9804,6 +9904,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9804
9904
  return;
9805
9905
  }
9806
9906
  unsetCurrentInstance();
9907
+ if (hydratedEl && !instance.scope.active) {
9908
+ if (isInPendingSuspense && --suspense.deps === 0) {
9909
+ suspense.resolve();
9910
+ }
9911
+ return;
9912
+ }
9807
9913
  instance.asyncResolved = true;
9808
9914
  const { vnode: vnode2 } = instance;
9809
9915
  {
@@ -10225,7 +10331,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
10225
10331
  el: vnode.el,
10226
10332
  anchor: vnode.anchor,
10227
10333
  ctx: vnode.ctx,
10228
- ce: vnode.ce
10334
+ ce: vnode.ce,
10335
+ cacheIndex: vnode.cacheIndex
10229
10336
  };
10230
10337
  if (transition && cloneTransition) {
10231
10338
  setTransitionHooks(
@@ -11030,7 +11137,7 @@ function isMemoSame(cached, memo) {
11030
11137
  return true;
11031
11138
  }
11032
11139
 
11033
- const version = "3.5.41";
11140
+ const version = "3.5.43";
11034
11141
  const warn = warn$1 ;
11035
11142
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11036
11143
  const devtools = devtools$1 ;
@@ -11627,7 +11734,11 @@ function setStyle(style, name, val) {
11627
11734
  }
11628
11735
  }
11629
11736
  if (name.startsWith("--")) {
11630
- style.setProperty(name, val);
11737
+ if (importantRE.test(val)) {
11738
+ style.setProperty(name, val.replace(importantRE, ""), "important");
11739
+ } else {
11740
+ style.setProperty(name, val);
11741
+ }
11631
11742
  } else {
11632
11743
  const prefixed = autoPrefix(style, name);
11633
11744
  if (importantRE.test(val)) {
@@ -12761,13 +12872,21 @@ const vModelSelect = {
12761
12872
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12762
12873
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12763
12874
  );
12764
- el[assignKey](
12765
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12766
- );
12767
- el._assigning = true;
12768
- nextTick(() => {
12769
- el._assigning = false;
12770
- });
12875
+ const multiple = el.multiple;
12876
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
12877
+ const pending = el._pendingValue = [
12878
+ multiple,
12879
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
12880
+ ];
12881
+ try {
12882
+ el[assignKey](assignedValue);
12883
+ } finally {
12884
+ nextTick(() => {
12885
+ if (el._pendingValue === pending) {
12886
+ el._pendingValue = void 0;
12887
+ }
12888
+ });
12889
+ }
12771
12890
  });
12772
12891
  el[assignKey] = getModelAssigner(vnode);
12773
12892
  },
@@ -12781,11 +12900,25 @@ const vModelSelect = {
12781
12900
  el[assignKey] = getModelAssigner(vnode);
12782
12901
  },
12783
12902
  updated(el, { value }) {
12784
- if (!el._assigning) {
12903
+ const pending = el._pendingValue;
12904
+ el._pendingValue = void 0;
12905
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
12785
12906
  setSelected(el, value);
12786
12907
  }
12787
12908
  }
12788
12909
  };
12910
+ function isSameSelectValue(value, assignedValue, multiple) {
12911
+ if (!multiple) return looseEqual(value, assignedValue);
12912
+ if (isArray(value)) return looseEqual(value, assignedValue);
12913
+ if (isSet(value)) {
12914
+ if (value.size !== assignedValue.length) return false;
12915
+ for (const item of assignedValue) {
12916
+ if (!value.has(item)) return false;
12917
+ }
12918
+ return true;
12919
+ }
12920
+ return false;
12921
+ }
12789
12922
  function setSelected(el, value) {
12790
12923
  const isMultiple = el.multiple;
12791
12924
  const isArrayValue = isArray(value);