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
  **/
@@ -131,10 +131,10 @@ var Vue = (function (exports) {
131
131
  }
132
132
  const listDelimiterRE = /;(?![^(]*\))/g;
133
133
  const propertyDelimiterRE = /:([^]+)/;
134
- const styleCommentRE = /\/\*[^]*?\*\//g;
134
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
135
135
  function parseStringStyle(cssText) {
136
136
  const ret = {};
137
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
137
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
138
138
  if (item) {
139
139
  const tmp = item.split(propertyDelimiterRE);
140
140
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -224,15 +224,72 @@ var Vue = (function (exports) {
224
224
  );
225
225
  }
226
226
 
227
- function looseCompareArrays(a, b) {
227
+ function looseCompareArrays(a, b, seen) {
228
228
  if (a.length !== b.length) return false;
229
229
  let equal = true;
230
230
  for (let i = 0; equal && i < a.length; i++) {
231
- equal = looseEqual(a[i], b[i]);
231
+ equal = looseEqual(a[i], b[i], seen);
232
232
  }
233
233
  return equal;
234
234
  }
235
- function looseEqual(a, b) {
235
+ function looseCompareCollections(a, b, seen) {
236
+ if (a.size !== b.size) return false;
237
+ const candidates = Array.from(b);
238
+ const matched = new Uint8Array(candidates.length);
239
+ for (const item of a) {
240
+ let index = -1;
241
+ for (let i = 0; i < candidates.length; i++) {
242
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
243
+ index = i;
244
+ break;
245
+ }
246
+ }
247
+ if (index < 0) return false;
248
+ matched[index] = 1;
249
+ }
250
+ return true;
251
+ }
252
+ function looseCompareObjects(a, b, seen) {
253
+ let aValidType = isMap(a);
254
+ let bValidType = isMap(b);
255
+ if (aValidType || bValidType) {
256
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
257
+ }
258
+ aValidType = isSet(a);
259
+ bValidType = isSet(b);
260
+ if (aValidType || bValidType) {
261
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
262
+ }
263
+ const aKeysCount = Object.keys(a).length;
264
+ const bKeysCount = Object.keys(b).length;
265
+ if (aKeysCount !== bKeysCount) {
266
+ return false;
267
+ }
268
+ for (const key in a) {
269
+ const aHasKey = a.hasOwnProperty(key);
270
+ const bHasKey = b.hasOwnProperty(key);
271
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
272
+ return false;
273
+ }
274
+ }
275
+ return String(a) === String(b);
276
+ }
277
+ function looseCompareNested(a, b, seen, compare) {
278
+ if (!seen) {
279
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
280
+ }
281
+ const [seenA, seenB] = seen;
282
+ if (seenA.has(a) || seenB.has(b)) {
283
+ return seenA.get(a) === b && seenB.get(b) === a;
284
+ }
285
+ seenA.set(a, b);
286
+ seenB.set(b, a);
287
+ const equal = compare(a, b, seen);
288
+ seenA.delete(a);
289
+ seenB.delete(b);
290
+ return equal;
291
+ }
292
+ function looseEqual(a, b, seen) {
236
293
  if (a === b) return true;
237
294
  let aValidType = isDate(a);
238
295
  let bValidType = isDate(b);
@@ -247,7 +304,7 @@ var Vue = (function (exports) {
247
304
  aValidType = isArray(a);
248
305
  bValidType = isArray(b);
249
306
  if (aValidType || bValidType) {
250
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
307
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
251
308
  }
252
309
  aValidType = isObject(a);
253
310
  bValidType = isObject(b);
@@ -255,18 +312,7 @@ var Vue = (function (exports) {
255
312
  if (!aValidType || !bValidType) {
256
313
  return false;
257
314
  }
258
- const aKeysCount = Object.keys(a).length;
259
- const bKeysCount = Object.keys(b).length;
260
- if (aKeysCount !== bKeysCount) {
261
- return false;
262
- }
263
- for (const key in a) {
264
- const aHasKey = a.hasOwnProperty(key);
265
- const bHasKey = b.hasOwnProperty(key);
266
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
267
- return false;
268
- }
269
- }
315
+ return looseCompareNested(a, b, seen, looseCompareObjects);
270
316
  }
271
317
  return String(a) === String(b);
272
318
  }
@@ -1067,7 +1113,9 @@ var Vue = (function (exports) {
1067
1113
  const raw = toRaw(array);
1068
1114
  if (raw === array) return raw;
1069
1115
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1070
- return isShallow(array) ? raw : raw.map(toReactive);
1116
+ if (isShallow(array)) return raw;
1117
+ if (!isReadonly(array)) return raw.map(toReactive);
1118
+ return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
1071
1119
  }
1072
1120
  function shallowReadArray(arr) {
1073
1121
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4308,13 +4356,15 @@ var Vue = (function (exports) {
4308
4356
  getContainerType(container),
4309
4357
  optimized
4310
4358
  );
4311
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4359
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4312
4360
  let subTree;
4313
4361
  if (isFragmentStart) {
4314
- subTree = createVNode(Fragment);
4362
+ subTree = createVNode(Static);
4315
4363
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4316
4364
  } else {
4317
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4365
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4366
+ node.nodeType === 8 ? Comment : "div"
4367
+ );
4318
4368
  }
4319
4369
  subTree.el = node;
4320
4370
  vnode.component.subTree = subTree;
@@ -5214,7 +5264,10 @@ Server rendered element contains fewer child nodes than client vdom.`
5214
5264
  if (pendingCacheKey != null) {
5215
5265
  if (isSuspense(instance.subTree.type)) {
5216
5266
  queuePostRenderEffect(() => {
5217
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5267
+ const vnode = getInnerChild(instance.subTree);
5268
+ if (vnode.component) {
5269
+ cache.set(pendingCacheKey, vnode);
5270
+ }
5218
5271
  }, instance.subTree.suspense);
5219
5272
  } else {
5220
5273
  cache.set(pendingCacheKey, getInnerChild(instance.subTree));
@@ -5615,12 +5668,41 @@ If this is a native custom element, make sure to exclude it from component resol
5615
5668
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
5616
5669
  return getPublicInstance(i.parent);
5617
5670
  };
5671
+ const resolveDevRootEl = (vnode) => {
5672
+ let found = false;
5673
+ while (true) {
5674
+ if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
5675
+ const root = filterSingleRoot(vnode.children);
5676
+ if (!root) {
5677
+ return;
5678
+ }
5679
+ vnode = root;
5680
+ found = true;
5681
+ continue;
5682
+ }
5683
+ const component = vnode.component;
5684
+ if (component && component.subTree) {
5685
+ vnode = component.subTree;
5686
+ continue;
5687
+ }
5688
+ const suspense = vnode.suspense;
5689
+ if (suspense && suspense.activeBranch) {
5690
+ vnode = suspense.activeBranch;
5691
+ continue;
5692
+ }
5693
+ return found ? vnode.el : void 0;
5694
+ }
5695
+ };
5696
+ const getDevRootFragmentEl = (i) => {
5697
+ const el = i.subTree && resolveDevRootEl(i.subTree);
5698
+ return el === void 0 ? i.vnode.el : el;
5699
+ };
5618
5700
  const publicPropertiesMap = (
5619
5701
  // Move PURE marker to new line to workaround compiler discarding it
5620
5702
  // due to type annotation
5621
5703
  /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
5622
5704
  $: (i) => i,
5623
- $el: (i) => i.vnode.el,
5705
+ $el: (i) => getDevRootFragmentEl(i) ,
5624
5706
  $data: (i) => i.data,
5625
5707
  $props: (i) => shallowReadonly(i.props) ,
5626
5708
  $attrs: (i) => shallowReadonly(i.attrs) ,
@@ -6720,7 +6802,7 @@ If you want to remount the same app, move your app creation logic into a factory
6720
6802
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
6721
6803
  }
6722
6804
  if (modifiers.number) {
6723
- args = rawArgs.map(looseToNumber);
6805
+ args = args.map(looseToNumber);
6724
6806
  }
6725
6807
  }
6726
6808
  {
@@ -7719,6 +7801,12 @@ If you want to remount the same app, move your app creation logic into a factory
7719
7801
  optimized = false;
7720
7802
  n2.dynamicChildren = null;
7721
7803
  }
7804
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
7805
+ if (n2.dynamicChildren === EMPTY_ARR) {
7806
+ n2.dynamicChildren = [];
7807
+ }
7808
+ n2.dynamicChildren.hasOnce = true;
7809
+ }
7722
7810
  const { type, ref, shapeFlag } = n2;
7723
7811
  switch (type) {
7724
7812
  case Text:
@@ -8326,6 +8414,7 @@ If you want to remount the same app, move your app creation logic into a factory
8326
8414
  {
8327
8415
  pushWarningContext(n2);
8328
8416
  }
8417
+ n2.el = n1.el;
8329
8418
  updateComponentPreRender(instance, n2, optimized);
8330
8419
  {
8331
8420
  popWarningContext();
@@ -8917,7 +9006,7 @@ If you want to remount the same app, move your app creation logic into a factory
8917
9006
  cacheIndex,
8918
9007
  memo
8919
9008
  } = vnode;
8920
- if (patchFlag === -2) {
9009
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
8921
9010
  optimized = false;
8922
9011
  }
8923
9012
  if (ref != null) {
@@ -8925,7 +9014,7 @@ If you want to remount the same app, move your app creation logic into a factory
8925
9014
  setRef(ref, null, parentSuspense, vnode, true);
8926
9015
  resetTracking();
8927
9016
  }
8928
- if (cacheIndex != null) {
9017
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
8929
9018
  parentComponent.renderCache[cacheIndex] = void 0;
8930
9019
  }
8931
9020
  if (shapeFlag & 256) {
@@ -9006,6 +9095,9 @@ If you want to remount the same app, move your app creation logic into a factory
9006
9095
  }
9007
9096
  if (type === Static) {
9008
9097
  removeStaticNode(vnode);
9098
+ if (transition && !transition.persisted && transition.afterLeave) {
9099
+ transition.afterLeave();
9100
+ }
9009
9101
  return;
9010
9102
  }
9011
9103
  const performRemove = () => {
@@ -9049,6 +9141,9 @@ If you want to remount the same app, move your app creation logic into a factory
9049
9141
  if (job) {
9050
9142
  job.flags |= 8;
9051
9143
  unmount(subTree, instance, parentSuspense, doRemove);
9144
+ } else if (instance.vnode.el && subTree) {
9145
+ subTree.transition = instance.vnode.transition;
9146
+ unmount(subTree, instance, parentSuspense, doRemove);
9052
9147
  }
9053
9148
  if (um) {
9054
9149
  queuePostRenderEffect(um, parentSuspense);
@@ -9263,7 +9358,7 @@ If you want to remount the same app, move your app creation logic into a factory
9263
9358
  rendererInternals
9264
9359
  );
9265
9360
  } else {
9266
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
9361
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
9267
9362
  n2.suspense = n1.suspense;
9268
9363
  n2.suspense.vnode = n2;
9269
9364
  n2.el = n1.el;
@@ -9349,10 +9444,12 @@ If you want to remount the same app, move your app creation logic into a factory
9349
9444
  if (pendingBranch) {
9350
9445
  suspense.pendingBranch = newBranch;
9351
9446
  if (isSameVNodeType(pendingBranch, newBranch)) {
9447
+ suspense.deps++;
9352
9448
  patch(
9353
9449
  pendingBranch,
9354
9450
  newBranch,
9355
- suspense.hiddenContainer,
9451
+ // a hydrating pending branch is adopted SSR DOM, already in place
9452
+ isHydrating ? container : suspense.hiddenContainer,
9356
9453
  null,
9357
9454
  parentComponent,
9358
9455
  suspense,
@@ -9360,10 +9457,11 @@ If you want to remount the same app, move your app creation logic into a factory
9360
9457
  slotScopeIds,
9361
9458
  optimized
9362
9459
  );
9460
+ suspense.deps--;
9363
9461
  if (suspense.deps <= 0) {
9364
9462
  suspense.resolve();
9365
9463
  } else if (isInFallback) {
9366
- if (!isHydrating) {
9464
+ if (!isHydrating && !suspense.isFallbackMountPending) {
9367
9465
  patch(
9368
9466
  activeBranch,
9369
9467
  newFallback,
@@ -9404,7 +9502,7 @@ If you want to remount the same app, move your app creation logic into a factory
9404
9502
  );
9405
9503
  if (suspense.deps <= 0) {
9406
9504
  suspense.resolve();
9407
- } else {
9505
+ } else if (!suspense.isFallbackMountPending) {
9408
9506
  patch(
9409
9507
  activeBranch,
9410
9508
  newFallback,
@@ -9625,6 +9723,7 @@ If you want to remount the same app, move your app creation logic into a factory
9625
9723
  suspense.effects = [];
9626
9724
  if (isSuspensible) {
9627
9725
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
9726
+ parentSuspenseId = void 0;
9628
9727
  parentSuspense.deps--;
9629
9728
  if (parentSuspense.deps === 0 && !sync) {
9630
9729
  parentSuspense.resolve();
@@ -9645,9 +9744,10 @@ If you want to remount the same app, move your app creation logic into a factory
9645
9744
  if (!suspense.isInFallback) {
9646
9745
  return;
9647
9746
  }
9747
+ const latestFallback = suspense.vnode.ssFallback;
9648
9748
  patch(
9649
9749
  null,
9650
- fallbackVNode,
9750
+ latestFallback,
9651
9751
  container2,
9652
9752
  anchor2,
9653
9753
  parentComponent2,
@@ -9657,7 +9757,7 @@ If you want to remount the same app, move your app creation logic into a factory
9657
9757
  slotScopeIds,
9658
9758
  optimized
9659
9759
  );
9660
- setActiveBranch(suspense, fallbackVNode);
9760
+ setActiveBranch(suspense, latestFallback);
9661
9761
  };
9662
9762
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
9663
9763
  if (delayEnter) {
@@ -9697,6 +9797,12 @@ If you want to remount the same app, move your app creation logic into a factory
9697
9797
  return;
9698
9798
  }
9699
9799
  unsetCurrentInstance();
9800
+ if (hydratedEl && !instance.scope.active) {
9801
+ if (isInPendingSuspense && --suspense.deps === 0) {
9802
+ suspense.resolve();
9803
+ }
9804
+ return;
9805
+ }
9700
9806
  instance.asyncResolved = true;
9701
9807
  const { vnode: vnode2 } = instance;
9702
9808
  {
@@ -10118,7 +10224,8 @@ Component that was made reactive: `,
10118
10224
  el: vnode.el,
10119
10225
  anchor: vnode.anchor,
10120
10226
  ctx: vnode.ctx,
10121
- ce: vnode.ce
10227
+ ce: vnode.ce,
10228
+ cacheIndex: vnode.cacheIndex
10122
10229
  };
10123
10230
  if (transition && cloneTransition) {
10124
10231
  setTransitionHooks(
@@ -10909,7 +11016,7 @@ Component that was made reactive: `,
10909
11016
  return true;
10910
11017
  }
10911
11018
 
10912
- const version = "3.5.41";
11019
+ const version = "3.5.43";
10913
11020
  const warn = warn$1 ;
10914
11021
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10915
11022
  const devtools = devtools$1 ;
@@ -11487,7 +11594,11 @@ Component that was made reactive: `,
11487
11594
  }
11488
11595
  }
11489
11596
  if (name.startsWith("--")) {
11490
- style.setProperty(name, val);
11597
+ if (importantRE.test(val)) {
11598
+ style.setProperty(name, val.replace(importantRE, ""), "important");
11599
+ } else {
11600
+ style.setProperty(name, val);
11601
+ }
11491
11602
  } else {
11492
11603
  const prefixed = autoPrefix(style, name);
11493
11604
  if (importantRE.test(val)) {
@@ -12609,13 +12720,21 @@ Expected function or array of functions, received type ${typeof value}.`
12609
12720
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12610
12721
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12611
12722
  );
12612
- el[assignKey](
12613
- el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12614
- );
12615
- el._assigning = true;
12616
- nextTick(() => {
12617
- el._assigning = false;
12618
- });
12723
+ const multiple = el.multiple;
12724
+ const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
12725
+ const pending = el._pendingValue = [
12726
+ multiple,
12727
+ multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
12728
+ ];
12729
+ try {
12730
+ el[assignKey](assignedValue);
12731
+ } finally {
12732
+ nextTick(() => {
12733
+ if (el._pendingValue === pending) {
12734
+ el._pendingValue = void 0;
12735
+ }
12736
+ });
12737
+ }
12619
12738
  });
12620
12739
  el[assignKey] = getModelAssigner(vnode);
12621
12740
  },
@@ -12629,11 +12748,25 @@ Expected function or array of functions, received type ${typeof value}.`
12629
12748
  el[assignKey] = getModelAssigner(vnode);
12630
12749
  },
12631
12750
  updated(el, { value }) {
12632
- if (!el._assigning) {
12751
+ const pending = el._pendingValue;
12752
+ el._pendingValue = void 0;
12753
+ if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
12633
12754
  setSelected(el, value);
12634
12755
  }
12635
12756
  }
12636
12757
  };
12758
+ function isSameSelectValue(value, assignedValue, multiple) {
12759
+ if (!multiple) return looseEqual(value, assignedValue);
12760
+ if (isArray(value)) return looseEqual(value, assignedValue);
12761
+ if (isSet(value)) {
12762
+ if (value.size !== assignedValue.length) return false;
12763
+ for (const item of assignedValue) {
12764
+ if (!value.has(item)) return false;
12765
+ }
12766
+ return true;
12767
+ }
12768
+ return false;
12769
+ }
12637
12770
  function setSelected(el, value) {
12638
12771
  const isMultiple = el.multiple;
12639
12772
  const isArrayValue = isArray(value);