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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -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
  **/
@@ -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
  **/
@@ -449,8 +449,9 @@ class EffectScope {
449
449
  this._isPaused = true;
450
450
  let i, l;
451
451
  if (this.scopes) {
452
- for (i = 0, l = this.scopes.length; i < l; i++) {
453
- this.scopes[i].pause();
452
+ const scopes = this.scopes.slice();
453
+ for (i = 0, l = scopes.length; i < l; i++) {
454
+ scopes[i].pause();
454
455
  }
455
456
  }
456
457
  for (i = 0, l = this.effects.length; i < l; i++) {
@@ -467,12 +468,14 @@ class EffectScope {
467
468
  this._isPaused = false;
468
469
  let i, l;
469
470
  if (this.scopes) {
470
- for (i = 0, l = this.scopes.length; i < l; i++) {
471
- this.scopes[i].resume();
471
+ const scopes = this.scopes.slice();
472
+ for (i = 0, l = scopes.length; i < l; i++) {
473
+ scopes[i].resume();
472
474
  }
473
475
  }
474
- for (i = 0, l = this.effects.length; i < l; i++) {
475
- this.effects[i].resume();
476
+ const effects = this.effects.slice();
477
+ for (i = 0, l = effects.length; i < l; i++) {
478
+ effects[i].resume();
476
479
  }
477
480
  }
478
481
  }
@@ -534,8 +537,9 @@ class EffectScope {
534
537
  }
535
538
  this.cleanups.length = 0;
536
539
  if (this.scopes) {
537
- for (i = 0, l = this.scopes.length; i < l; i++) {
538
- this.scopes[i].stop(true);
540
+ const scopes = this.scopes.slice();
541
+ for (i = 0, l = scopes.length; i < l; i++) {
542
+ scopes[i].stop(true);
539
543
  }
540
544
  this.scopes.length = 0;
541
545
  }
@@ -1444,7 +1448,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1444
1448
  value,
1445
1449
  isRef(target) ? target : receiver
1446
1450
  );
1447
- if (target === toRaw(receiver)) {
1451
+ if (target === toRaw(receiver) && result) {
1448
1452
  if (!hadKey) {
1449
1453
  trigger(target, "add", key, value);
1450
1454
  } else if (hasChanged(value, oldValue)) {
@@ -3032,10 +3036,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
3032
3036
  setBlockTracking(-1);
3033
3037
  }
3034
3038
  const prevInstance = setCurrentRenderingInstance(ctx);
3039
+ const prevStackSize = blockStack.length;
3035
3040
  let res;
3036
3041
  try {
3037
3042
  res = fn(...args);
3038
3043
  } finally {
3044
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
3039
3045
  setCurrentRenderingInstance(prevInstance);
3040
3046
  if (renderFnWithContext._d) {
3041
3047
  setBlockTracking(1);
@@ -3454,11 +3460,9 @@ const TeleportImpl = {
3454
3460
  }
3455
3461
  } else {
3456
3462
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3457
- const nextTarget = n2.target = resolveTarget(
3458
- n2.props,
3459
- querySelector
3460
- );
3463
+ const nextTarget = resolveTarget(n2.props, querySelector);
3461
3464
  if (nextTarget) {
3465
+ n2.target = nextTarget;
3462
3466
  moveTeleport(
3463
3467
  n2,
3464
3468
  nextTarget,
@@ -3496,7 +3500,8 @@ const TeleportImpl = {
3496
3500
  target,
3497
3501
  props
3498
3502
  } = vnode;
3499
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3503
+ const disabled = isTeleportDisabled(props);
3504
+ const shouldRemove = doRemove || !disabled;
3500
3505
  const pendingMount = pendingMounts.get(vnode);
3501
3506
  if (pendingMount) {
3502
3507
  pendingMount.flags |= 8;
@@ -3507,7 +3512,7 @@ const TeleportImpl = {
3507
3512
  hostRemove(targetAnchor);
3508
3513
  }
3509
3514
  doRemove && hostRemove(anchor);
3510
- if (!pendingMount && shapeFlag & 16) {
3515
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) {
3511
3516
  for (let i = 0; i < children.length; i++) {
3512
3517
  const child = children[i];
3513
3518
  unmount(
@@ -4442,7 +4447,15 @@ function createHydrationFunctions(rendererInternals) {
4442
4447
  };
4443
4448
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4444
4449
  optimized = optimized || !!vnode.dynamicChildren;
4445
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4450
+ const {
4451
+ type,
4452
+ dynamicProps,
4453
+ props,
4454
+ patchFlag,
4455
+ shapeFlag,
4456
+ dirs,
4457
+ transition
4458
+ } = vnode;
4446
4459
  const forcePatch = type === "input" || type === "option";
4447
4460
  {
4448
4461
  if (dirs) {
@@ -4513,6 +4526,7 @@ Server rendered element contains more child nodes than client vdom.`
4513
4526
  if (props) {
4514
4527
  {
4515
4528
  const isCustomElement = el.tagName.includes("-");
4529
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4516
4530
  for (const key in props) {
4517
4531
  if (// #11189 skip if this node has directives that have created hooks
4518
4532
  // as it could have mutated the DOM in any possible way
@@ -4520,8 +4534,8 @@ Server rendered element contains more child nodes than client vdom.`
4520
4534
  logMismatchError();
4521
4535
  }
4522
4536
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4523
- key[0] === "." || isCustomElement && !isReservedProp(key)) {
4524
- patchProp(el, key, null, props[key], void 0, parentComponent);
4537
+ key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4538
+ patchProp(el, key, null, props[key], namespace, parentComponent);
4525
4539
  }
4526
4540
  }
4527
4541
  }
@@ -4625,7 +4639,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4625
4639
  }
4626
4640
  };
4627
4641
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
4628
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
4642
+ if (!isNodeMismatchAllowed(node, vnode)) {
4629
4643
  warn$1(
4630
4644
  `Hydration node mismatch:
4631
4645
  - rendered on server:`,
@@ -4840,7 +4854,12 @@ function isMismatchAllowed(el, allowedType) {
4840
4854
  el = el.parentElement;
4841
4855
  }
4842
4856
  }
4843
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
4857
+ return isMismatchAllowedByAttr(
4858
+ el && el.getAttribute(allowMismatchAttr),
4859
+ allowedType
4860
+ );
4861
+ }
4862
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
4844
4863
  if (allowedAttr == null) {
4845
4864
  return false;
4846
4865
  } else if (allowedAttr === "") {
@@ -4853,6 +4872,19 @@ function isMismatchAllowed(el, allowedType) {
4853
4872
  return list.includes(MismatchTypeString[allowedType]);
4854
4873
  }
4855
4874
  }
4875
+ function isNodeMismatchAllowed(node, vnode) {
4876
+ return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
4877
+ }
4878
+ function isMismatchAllowedByNode(node) {
4879
+ return node.nodeType === 1 && isMismatchAllowedByAttr(
4880
+ node.getAttribute(allowMismatchAttr),
4881
+ 1 /* CHILDREN */
4882
+ );
4883
+ }
4884
+ function isMismatchAllowedByVNode({ props }) {
4885
+ const allowedAttr = props && props[allowMismatchAttr];
4886
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
4887
+ }
4856
4888
 
4857
4889
  const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
4858
4890
  const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
@@ -5006,6 +5038,7 @@ function defineAsyncComponent(source) {
5006
5038
  name: "AsyncComponentWrapper",
5007
5039
  __asyncLoader: load,
5008
5040
  __asyncHydrate(el, instance, hydrate) {
5041
+ const wasConnected = el.isConnected;
5009
5042
  let patched = false;
5010
5043
  (instance.bu || (instance.bu = [])).push(() => patched = true);
5011
5044
  const performHydrate = () => {
@@ -5017,6 +5050,7 @@ function defineAsyncComponent(source) {
5017
5050
  }
5018
5051
  return;
5019
5052
  }
5053
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
5020
5054
  hydrate();
5021
5055
  };
5022
5056
  const doHydrate = hydrateStrategy ? () => {
@@ -5575,14 +5609,15 @@ function createSlots(slots, dynamicSlots) {
5575
5609
  return slots;
5576
5610
  }
5577
5611
 
5578
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5612
+ function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
5579
5613
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5580
- const hasProps = Object.keys(props).length > 0;
5581
- if (name !== "default") props.name = name;
5614
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
5615
+ const hasProps = Object.keys(slotProps).length > 0;
5616
+ if (name !== "default") slotProps.name = name;
5582
5617
  return openBlock(), createBlock(
5583
5618
  Fragment,
5584
5619
  null,
5585
- [createVNode("slot", props, fallback && fallback())],
5620
+ [createVNode("slot", slotProps, fallback && fallback())],
5586
5621
  hasProps ? -2 : 64
5587
5622
  );
5588
5623
  }
@@ -5596,26 +5631,34 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5596
5631
  if (slot && slot._c) {
5597
5632
  slot._d = false;
5598
5633
  }
5634
+ const prevStackSize = blockStack.length;
5599
5635
  openBlock();
5600
- const validSlotContent = slot && ensureValidVNode(slot(props));
5601
- const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
5602
- // key attached in the `createSlots` helper, respect that
5603
- validSlotContent && validSlotContent.key;
5604
- const rendered = createBlock(
5605
- Fragment,
5606
- {
5607
- key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
5608
- (!validSlotContent && fallback ? "_fb" : "")
5609
- },
5610
- validSlotContent || (fallback ? fallback() : []),
5611
- validSlotContent && slots._ === 1 ? 64 : -2
5612
- );
5636
+ let rendered;
5637
+ try {
5638
+ const validSlotContent = slot && ensureValidVNode(slot(props));
5639
+ const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
5640
+ // key attached in the `createSlots` helper, respect that
5641
+ validSlotContent && validSlotContent.key;
5642
+ rendered = createBlock(
5643
+ Fragment,
5644
+ {
5645
+ key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
5646
+ (!validSlotContent && fallback ? "_fb" : "")
5647
+ },
5648
+ validSlotContent || (fallback ? fallback() : []),
5649
+ validSlotContent && slots._ === 1 ? 64 : -2
5650
+ );
5651
+ } catch (err) {
5652
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
5653
+ throw err;
5654
+ } finally {
5655
+ if (slot && slot._c) {
5656
+ slot._d = true;
5657
+ }
5658
+ }
5613
5659
  if (!noSlotted && rendered.scopeId) {
5614
5660
  rendered.slotScopeIds = [rendered.scopeId + "-s"];
5615
5661
  }
5616
- if (slot && slot._c) {
5617
- slot._d = true;
5618
- }
5619
5662
  return rendered;
5620
5663
  }
5621
5664
  function ensureValidVNode(vnodes) {
@@ -6850,7 +6893,8 @@ function isEmitListener(options, key) {
6850
6893
  if (!options || !isOn(key)) {
6851
6894
  return false;
6852
6895
  }
6853
- key = key.slice(2).replace(/Once$/, "");
6896
+ key = key.slice(2);
6897
+ key = key === "Once" ? key : key.replace(/Once$/, "");
6854
6898
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
6855
6899
  }
6856
6900
 
@@ -8074,7 +8118,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8074
8118
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
8075
8119
  }
8076
8120
  parentComponent && toggleRecurse(parentComponent, true);
8077
- if (isHmrUpdating) {
8121
+ if (
8122
+ // HMR updated, force full diff
8123
+ isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
8124
+ // Force full diff when block metadata is unstable.
8125
+ dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
8126
+ ) {
8078
8127
  patchFlag = 0;
8079
8128
  optimized = false;
8080
8129
  dynamicChildren = null;
@@ -10207,6 +10256,10 @@ function normalizeChildren(vnode, children) {
10207
10256
  }
10208
10257
  }
10209
10258
  } else if (isFunction(children)) {
10259
+ if (shapeFlag & (1 | 64)) {
10260
+ normalizeChildren(vnode, { default: children });
10261
+ return;
10262
+ }
10210
10263
  children = { default: children, _ctx: currentRenderingInstance };
10211
10264
  type = 32;
10212
10265
  } else {
@@ -10925,7 +10978,7 @@ function isMemoSame(cached, memo) {
10925
10978
  return true;
10926
10979
  }
10927
10980
 
10928
- const version = "3.5.38";
10981
+ const version = "3.5.40";
10929
10982
  const warn = warn$1 ;
10930
10983
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10931
10984
  const devtools = devtools$1 ;
@@ -11658,16 +11711,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
11658
11711
  }
11659
11712
  }
11660
11713
  }
11661
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
11714
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
11715
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
11662
11716
  function parseName(name) {
11663
11717
  let options;
11664
- if (optionsModifierRE.test(name)) {
11665
- options = {};
11666
- let m;
11667
- while (m = name.match(optionsModifierRE)) {
11668
- name = name.slice(0, name.length - m[0].length);
11669
- options[m[0].toLowerCase()] = true;
11670
- }
11718
+ let m;
11719
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
11720
+ if (!options) options = {};
11721
+ name = name.slice(0, name.length - m[1].length);
11722
+ options[m[1].toLowerCase()] = true;
11671
11723
  }
11672
11724
  const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
11673
11725
  return [event, options];
@@ -12629,13 +12681,13 @@ const vModelSelect = {
12629
12681
  // <select multiple> value need to be deep traversed
12630
12682
  deep: true,
12631
12683
  created(el, { value, modifiers: { number } }, vnode) {
12632
- const isSetModel = isSet(value);
12684
+ el._modelValue = value;
12633
12685
  addEventListener(el, "change", () => {
12634
12686
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12635
12687
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12636
12688
  );
12637
12689
  el[assignKey](
12638
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12690
+ el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
12639
12691
  );
12640
12692
  el._assigning = true;
12641
12693
  nextTick(() => {
@@ -12649,7 +12701,8 @@ const vModelSelect = {
12649
12701
  mounted(el, { value }) {
12650
12702
  setSelected(el, value);
12651
12703
  },
12652
- beforeUpdate(el, _binding, vnode) {
12704
+ beforeUpdate(el, { value }, vnode) {
12705
+ el._modelValue = value;
12653
12706
  el[assignKey] = getModelAssigner(vnode);
12654
12707
  },
12655
12708
  updated(el, { value }) {
@@ -14453,6 +14506,9 @@ function getUnnormalizedProps(props, callPath = []) {
14453
14506
  return [props, callPath];
14454
14507
  }
14455
14508
  function injectProp(node, prop, context) {
14509
+ if (node.type !== 13 && injectSlotKey(node, prop)) {
14510
+ return;
14511
+ }
14456
14512
  let propsWithInjection;
14457
14513
  let props = node.type === 13 ? node.props : node.arguments[2];
14458
14514
  let callPath = [];
@@ -14510,6 +14566,24 @@ function injectProp(node, prop, context) {
14510
14566
  }
14511
14567
  }
14512
14568
  }
14569
+ function injectSlotKey(node, prop) {
14570
+ var _a, _b, _c;
14571
+ if (prop.key.type !== 4 || prop.key.content !== "key") {
14572
+ return false;
14573
+ }
14574
+ const props = node.arguments[2];
14575
+ if (props && !isString(props)) {
14576
+ const [unnormalizedProps] = getUnnormalizedProps(props);
14577
+ if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) {
14578
+ return true;
14579
+ }
14580
+ }
14581
+ (_a = node.arguments)[2] || (_a[2] = "{}");
14582
+ (_b = node.arguments)[3] || (_b[3] = "undefined");
14583
+ (_c = node.arguments)[4] || (_c[4] = "undefined");
14584
+ node.arguments[5] = prop.value;
14585
+ return true;
14586
+ }
14513
14587
  function hasProp(prop, props) {
14514
14588
  let result = false;
14515
14589
  if (prop.key.type === 4) {