vue 3.5.38 → 3.5.40

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.38
2
+ * vue v3.5.40
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -379,8 +379,9 @@ var Vue = (function (exports) {
379
379
  this._isPaused = true;
380
380
  let i, l;
381
381
  if (this.scopes) {
382
- for (i = 0, l = this.scopes.length; i < l; i++) {
383
- this.scopes[i].pause();
382
+ const scopes = this.scopes.slice();
383
+ for (i = 0, l = scopes.length; i < l; i++) {
384
+ scopes[i].pause();
384
385
  }
385
386
  }
386
387
  for (i = 0, l = this.effects.length; i < l; i++) {
@@ -397,12 +398,14 @@ var Vue = (function (exports) {
397
398
  this._isPaused = false;
398
399
  let i, l;
399
400
  if (this.scopes) {
400
- for (i = 0, l = this.scopes.length; i < l; i++) {
401
- this.scopes[i].resume();
401
+ const scopes = this.scopes.slice();
402
+ for (i = 0, l = scopes.length; i < l; i++) {
403
+ scopes[i].resume();
402
404
  }
403
405
  }
404
- for (i = 0, l = this.effects.length; i < l; i++) {
405
- this.effects[i].resume();
406
+ const effects = this.effects.slice();
407
+ for (i = 0, l = effects.length; i < l; i++) {
408
+ effects[i].resume();
406
409
  }
407
410
  }
408
411
  }
@@ -464,8 +467,9 @@ var Vue = (function (exports) {
464
467
  }
465
468
  this.cleanups.length = 0;
466
469
  if (this.scopes) {
467
- for (i = 0, l = this.scopes.length; i < l; i++) {
468
- this.scopes[i].stop(true);
470
+ const scopes = this.scopes.slice();
471
+ for (i = 0, l = scopes.length; i < l; i++) {
472
+ scopes[i].stop(true);
469
473
  }
470
474
  this.scopes.length = 0;
471
475
  }
@@ -1374,7 +1378,7 @@ var Vue = (function (exports) {
1374
1378
  value,
1375
1379
  isRef(target) ? target : receiver
1376
1380
  );
1377
- if (target === toRaw(receiver)) {
1381
+ if (target === toRaw(receiver) && result) {
1378
1382
  if (!hadKey) {
1379
1383
  trigger(target, "add", key, value);
1380
1384
  } else if (hasChanged(value, oldValue)) {
@@ -2962,10 +2966,12 @@ var Vue = (function (exports) {
2962
2966
  setBlockTracking(-1);
2963
2967
  }
2964
2968
  const prevInstance = setCurrentRenderingInstance(ctx);
2969
+ const prevStackSize = blockStack.length;
2965
2970
  let res;
2966
2971
  try {
2967
2972
  res = fn(...args);
2968
2973
  } finally {
2974
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
2969
2975
  setCurrentRenderingInstance(prevInstance);
2970
2976
  if (renderFnWithContext._d) {
2971
2977
  setBlockTracking(1);
@@ -3356,11 +3362,9 @@ var Vue = (function (exports) {
3356
3362
  }
3357
3363
  } else {
3358
3364
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3359
- const nextTarget = n2.target = resolveTarget(
3360
- n2.props,
3361
- querySelector
3362
- );
3365
+ const nextTarget = resolveTarget(n2.props, querySelector);
3363
3366
  if (nextTarget) {
3367
+ n2.target = nextTarget;
3364
3368
  moveTeleport(
3365
3369
  n2,
3366
3370
  nextTarget,
@@ -3398,7 +3402,8 @@ var Vue = (function (exports) {
3398
3402
  target,
3399
3403
  props
3400
3404
  } = vnode;
3401
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3405
+ const disabled = isTeleportDisabled(props);
3406
+ const shouldRemove = doRemove || !disabled;
3402
3407
  const pendingMount = pendingMounts.get(vnode);
3403
3408
  if (pendingMount) {
3404
3409
  pendingMount.flags |= 8;
@@ -3409,7 +3414,7 @@ var Vue = (function (exports) {
3409
3414
  hostRemove(targetAnchor);
3410
3415
  }
3411
3416
  doRemove && hostRemove(anchor);
3412
- if (!pendingMount && shapeFlag & 16) {
3417
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) {
3413
3418
  for (let i = 0; i < children.length; i++) {
3414
3419
  const child = children[i];
3415
3420
  unmount(
@@ -4344,7 +4349,15 @@ var Vue = (function (exports) {
4344
4349
  };
4345
4350
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4346
4351
  optimized = optimized || !!vnode.dynamicChildren;
4347
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4352
+ const {
4353
+ type,
4354
+ dynamicProps,
4355
+ props,
4356
+ patchFlag,
4357
+ shapeFlag,
4358
+ dirs,
4359
+ transition
4360
+ } = vnode;
4348
4361
  const forcePatch = type === "input" || type === "option";
4349
4362
  {
4350
4363
  if (dirs) {
@@ -4415,6 +4428,7 @@ Server rendered element contains more child nodes than client vdom.`
4415
4428
  if (props) {
4416
4429
  {
4417
4430
  const isCustomElement = el.tagName.includes("-");
4431
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4418
4432
  for (const key in props) {
4419
4433
  if (// #11189 skip if this node has directives that have created hooks
4420
4434
  // as it could have mutated the DOM in any possible way
@@ -4422,8 +4436,8 @@ Server rendered element contains more child nodes than client vdom.`
4422
4436
  logMismatchError();
4423
4437
  }
4424
4438
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4425
- key[0] === "." || isCustomElement && !isReservedProp(key)) {
4426
- patchProp(el, key, null, props[key], void 0, parentComponent);
4439
+ key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4440
+ patchProp(el, key, null, props[key], namespace, parentComponent);
4427
4441
  }
4428
4442
  }
4429
4443
  }
@@ -4527,7 +4541,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4527
4541
  }
4528
4542
  };
4529
4543
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
4530
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
4544
+ if (!isNodeMismatchAllowed(node, vnode)) {
4531
4545
  warn$1(
4532
4546
  `Hydration node mismatch:
4533
4547
  - rendered on server:`,
@@ -4742,7 +4756,12 @@ Server rendered element contains fewer child nodes than client vdom.`
4742
4756
  el = el.parentElement;
4743
4757
  }
4744
4758
  }
4745
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
4759
+ return isMismatchAllowedByAttr(
4760
+ el && el.getAttribute(allowMismatchAttr),
4761
+ allowedType
4762
+ );
4763
+ }
4764
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
4746
4765
  if (allowedAttr == null) {
4747
4766
  return false;
4748
4767
  } else if (allowedAttr === "") {
@@ -4755,6 +4774,19 @@ Server rendered element contains fewer child nodes than client vdom.`
4755
4774
  return list.includes(MismatchTypeString[allowedType]);
4756
4775
  }
4757
4776
  }
4777
+ function isNodeMismatchAllowed(node, vnode) {
4778
+ return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
4779
+ }
4780
+ function isMismatchAllowedByNode(node) {
4781
+ return node.nodeType === 1 && isMismatchAllowedByAttr(
4782
+ node.getAttribute(allowMismatchAttr),
4783
+ 1 /* CHILDREN */
4784
+ );
4785
+ }
4786
+ function isMismatchAllowedByVNode({ props }) {
4787
+ const allowedAttr = props && props[allowMismatchAttr];
4788
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
4789
+ }
4758
4790
 
4759
4791
  const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
4760
4792
  const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
@@ -4908,6 +4940,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4908
4940
  name: "AsyncComponentWrapper",
4909
4941
  __asyncLoader: load,
4910
4942
  __asyncHydrate(el, instance, hydrate) {
4943
+ const wasConnected = el.isConnected;
4911
4944
  let patched = false;
4912
4945
  (instance.bu || (instance.bu = [])).push(() => patched = true);
4913
4946
  const performHydrate = () => {
@@ -4919,6 +4952,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4919
4952
  }
4920
4953
  return;
4921
4954
  }
4955
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
4922
4956
  hydrate();
4923
4957
  };
4924
4958
  const doHydrate = hydrateStrategy ? () => {
@@ -5471,14 +5505,15 @@ If this is a native custom element, make sure to exclude it from component resol
5471
5505
  return slots;
5472
5506
  }
5473
5507
 
5474
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5508
+ function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
5475
5509
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5476
- const hasProps = Object.keys(props).length > 0;
5477
- if (name !== "default") props.name = name;
5510
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
5511
+ const hasProps = Object.keys(slotProps).length > 0;
5512
+ if (name !== "default") slotProps.name = name;
5478
5513
  return openBlock(), createBlock(
5479
5514
  Fragment,
5480
5515
  null,
5481
- [createVNode("slot", props, fallback && fallback())],
5516
+ [createVNode("slot", slotProps, fallback && fallback())],
5482
5517
  hasProps ? -2 : 64
5483
5518
  );
5484
5519
  }
@@ -5492,26 +5527,34 @@ If this is a native custom element, make sure to exclude it from component resol
5492
5527
  if (slot && slot._c) {
5493
5528
  slot._d = false;
5494
5529
  }
5530
+ const prevStackSize = blockStack.length;
5495
5531
  openBlock();
5496
- const validSlotContent = slot && ensureValidVNode(slot(props));
5497
- const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
5498
- // key attached in the `createSlots` helper, respect that
5499
- validSlotContent && validSlotContent.key;
5500
- const rendered = createBlock(
5501
- Fragment,
5502
- {
5503
- key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
5504
- (!validSlotContent && fallback ? "_fb" : "")
5505
- },
5506
- validSlotContent || (fallback ? fallback() : []),
5507
- validSlotContent && slots._ === 1 ? 64 : -2
5508
- );
5532
+ let rendered;
5533
+ try {
5534
+ const validSlotContent = slot && ensureValidVNode(slot(props));
5535
+ const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
5536
+ // key attached in the `createSlots` helper, respect that
5537
+ validSlotContent && validSlotContent.key;
5538
+ rendered = createBlock(
5539
+ Fragment,
5540
+ {
5541
+ key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
5542
+ (!validSlotContent && fallback ? "_fb" : "")
5543
+ },
5544
+ validSlotContent || (fallback ? fallback() : []),
5545
+ validSlotContent && slots._ === 1 ? 64 : -2
5546
+ );
5547
+ } catch (err) {
5548
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
5549
+ throw err;
5550
+ } finally {
5551
+ if (slot && slot._c) {
5552
+ slot._d = true;
5553
+ }
5554
+ }
5509
5555
  if (!noSlotted && rendered.scopeId) {
5510
5556
  rendered.slotScopeIds = [rendered.scopeId + "-s"];
5511
5557
  }
5512
- if (slot && slot._c) {
5513
- slot._d = true;
5514
- }
5515
5558
  return rendered;
5516
5559
  }
5517
5560
  function ensureValidVNode(vnodes) {
@@ -6743,7 +6786,8 @@ If you want to remount the same app, move your app creation logic into a factory
6743
6786
  if (!options || !isOn(key)) {
6744
6787
  return false;
6745
6788
  }
6746
- key = key.slice(2).replace(/Once$/, "");
6789
+ key = key.slice(2);
6790
+ key = key === "Once" ? key : key.replace(/Once$/, "");
6747
6791
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
6748
6792
  }
6749
6793
 
@@ -7967,7 +8011,12 @@ If you want to remount the same app, move your app creation logic into a factory
7967
8011
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
7968
8012
  }
7969
8013
  parentComponent && toggleRecurse(parentComponent, true);
7970
- if (isHmrUpdating) {
8014
+ if (
8015
+ // HMR updated, force full diff
8016
+ isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
8017
+ // Force full diff when block metadata is unstable.
8018
+ dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
8019
+ ) {
7971
8020
  patchFlag = 0;
7972
8021
  optimized = false;
7973
8022
  dynamicChildren = null;
@@ -10100,6 +10149,10 @@ Component that was made reactive: `,
10100
10149
  }
10101
10150
  }
10102
10151
  } else if (isFunction(children)) {
10152
+ if (shapeFlag & (1 | 64)) {
10153
+ normalizeChildren(vnode, { default: children });
10154
+ return;
10155
+ }
10103
10156
  children = { default: children, _ctx: currentRenderingInstance };
10104
10157
  type = 32;
10105
10158
  } else {
@@ -10804,7 +10857,7 @@ Component that was made reactive: `,
10804
10857
  return true;
10805
10858
  }
10806
10859
 
10807
- const version = "3.5.38";
10860
+ const version = "3.5.40";
10808
10861
  const warn = warn$1 ;
10809
10862
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10810
10863
  const devtools = devtools$1 ;
@@ -11518,16 +11571,15 @@ Component that was made reactive: `,
11518
11571
  }
11519
11572
  }
11520
11573
  }
11521
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
11574
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
11575
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
11522
11576
  function parseName(name) {
11523
11577
  let options;
11524
- if (optionsModifierRE.test(name)) {
11525
- options = {};
11526
- let m;
11527
- while (m = name.match(optionsModifierRE)) {
11528
- name = name.slice(0, name.length - m[0].length);
11529
- options[m[0].toLowerCase()] = true;
11530
- }
11578
+ let m;
11579
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
11580
+ if (!options) options = {};
11581
+ name = name.slice(0, name.length - m[1].length);
11582
+ options[m[1].toLowerCase()] = true;
11531
11583
  }
11532
11584
  const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
11533
11585
  return [event, options];
@@ -12477,13 +12529,13 @@ Expected function or array of functions, received type ${typeof value}.`
12477
12529
  // <select multiple> value need to be deep traversed
12478
12530
  deep: true,
12479
12531
  created(el, { value, modifiers: { number } }, vnode) {
12480
- const isSetModel = isSet(value);
12532
+ el._modelValue = value;
12481
12533
  addEventListener(el, "change", () => {
12482
12534
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12483
12535
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12484
12536
  );
12485
12537
  el[assignKey](
12486
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12538
+ el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12487
12539
  );
12488
12540
  el._assigning = true;
12489
12541
  nextTick(() => {
@@ -12497,7 +12549,8 @@ Expected function or array of functions, received type ${typeof value}.`
12497
12549
  mounted(el, { value }) {
12498
12550
  setSelected(el, value);
12499
12551
  },
12500
- beforeUpdate(el, _binding, vnode) {
12552
+ beforeUpdate(el, { value }, vnode) {
12553
+ el._modelValue = value;
12501
12554
  el[assignKey] = getModelAssigner(vnode);
12502
12555
  },
12503
12556
  updated(el, { value }) {