vue 3.5.37 → 3.5.39

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.37
2
+ * vue v3.5.39
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.37
2
+ * vue v3.5.39
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.37
2
+ * vue v3.5.39
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1444,7 +1444,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1444
1444
  value,
1445
1445
  isRef(target) ? target : receiver
1446
1446
  );
1447
- if (target === toRaw(receiver)) {
1447
+ if (target === toRaw(receiver) && result) {
1448
1448
  if (!hadKey) {
1449
1449
  trigger(target, "add", key, value);
1450
1450
  } else if (hasChanged(value, oldValue)) {
@@ -3454,11 +3454,9 @@ const TeleportImpl = {
3454
3454
  }
3455
3455
  } else {
3456
3456
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3457
- const nextTarget = n2.target = resolveTarget(
3458
- n2.props,
3459
- querySelector
3460
- );
3457
+ const nextTarget = resolveTarget(n2.props, querySelector);
3461
3458
  if (nextTarget) {
3459
+ n2.target = nextTarget;
3462
3460
  moveTeleport(
3463
3461
  n2,
3464
3462
  nextTarget,
@@ -3496,7 +3494,8 @@ const TeleportImpl = {
3496
3494
  target,
3497
3495
  props
3498
3496
  } = vnode;
3499
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3497
+ const disabled = isTeleportDisabled(props);
3498
+ const shouldRemove = doRemove || !disabled;
3500
3499
  const pendingMount = pendingMounts.get(vnode);
3501
3500
  if (pendingMount) {
3502
3501
  pendingMount.flags |= 8;
@@ -3507,7 +3506,7 @@ const TeleportImpl = {
3507
3506
  hostRemove(targetAnchor);
3508
3507
  }
3509
3508
  doRemove && hostRemove(anchor);
3510
- if (!pendingMount && shapeFlag & 16) {
3509
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) {
3511
3510
  for (let i = 0; i < children.length; i++) {
3512
3511
  const child = children[i];
3513
3512
  unmount(
@@ -4150,7 +4149,12 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4150
4149
  }
4151
4150
  }
4152
4151
  if (isFunction(ref)) {
4153
- callWithErrorHandling(ref, owner, 12, [value, refs]);
4152
+ pauseTracking();
4153
+ try {
4154
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
4155
+ } finally {
4156
+ resetTracking();
4157
+ }
4154
4158
  } else {
4155
4159
  const _isString = isString(ref);
4156
4160
  const _isRef = isRef(ref);
@@ -4442,7 +4446,15 @@ function createHydrationFunctions(rendererInternals) {
4442
4446
  };
4443
4447
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4444
4448
  optimized = optimized || !!vnode.dynamicChildren;
4445
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4449
+ const {
4450
+ type,
4451
+ dynamicProps,
4452
+ props,
4453
+ patchFlag,
4454
+ shapeFlag,
4455
+ dirs,
4456
+ transition
4457
+ } = vnode;
4446
4458
  const forcePatch = type === "input" || type === "option";
4447
4459
  {
4448
4460
  if (dirs) {
@@ -4520,7 +4532,7 @@ Server rendered element contains more child nodes than client vdom.`
4520
4532
  logMismatchError();
4521
4533
  }
4522
4534
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4523
- key[0] === "." || isCustomElement && !isReservedProp(key)) {
4535
+ key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4524
4536
  patchProp(el, key, null, props[key], void 0, parentComponent);
4525
4537
  }
4526
4538
  }
@@ -4625,7 +4637,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4625
4637
  }
4626
4638
  };
4627
4639
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
4628
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
4640
+ if (!isNodeMismatchAllowed(node, vnode)) {
4629
4641
  warn$1(
4630
4642
  `Hydration node mismatch:
4631
4643
  - rendered on server:`,
@@ -4840,7 +4852,12 @@ function isMismatchAllowed(el, allowedType) {
4840
4852
  el = el.parentElement;
4841
4853
  }
4842
4854
  }
4843
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
4855
+ return isMismatchAllowedByAttr(
4856
+ el && el.getAttribute(allowMismatchAttr),
4857
+ allowedType
4858
+ );
4859
+ }
4860
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
4844
4861
  if (allowedAttr == null) {
4845
4862
  return false;
4846
4863
  } else if (allowedAttr === "") {
@@ -4853,6 +4870,19 @@ function isMismatchAllowed(el, allowedType) {
4853
4870
  return list.includes(MismatchTypeString[allowedType]);
4854
4871
  }
4855
4872
  }
4873
+ function isNodeMismatchAllowed(node, vnode) {
4874
+ return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
4875
+ }
4876
+ function isMismatchAllowedByNode(node) {
4877
+ return node.nodeType === 1 && isMismatchAllowedByAttr(
4878
+ node.getAttribute(allowMismatchAttr),
4879
+ 1 /* CHILDREN */
4880
+ );
4881
+ }
4882
+ function isMismatchAllowedByVNode({ props }) {
4883
+ const allowedAttr = props && props[allowMismatchAttr];
4884
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
4885
+ }
4856
4886
 
4857
4887
  const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
4858
4888
  const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
@@ -6850,7 +6880,8 @@ function isEmitListener(options, key) {
6850
6880
  if (!options || !isOn(key)) {
6851
6881
  return false;
6852
6882
  }
6853
- key = key.slice(2).replace(/Once$/, "");
6883
+ key = key.slice(2);
6884
+ key = key === "Once" ? key : key.replace(/Once$/, "");
6854
6885
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
6855
6886
  }
6856
6887
 
@@ -8074,7 +8105,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8074
8105
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
8075
8106
  }
8076
8107
  parentComponent && toggleRecurse(parentComponent, true);
8077
- if (isHmrUpdating) {
8108
+ if (
8109
+ // HMR updated, force full diff
8110
+ isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
8111
+ // Force full diff when block metadata is unstable.
8112
+ dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
8113
+ ) {
8078
8114
  patchFlag = 0;
8079
8115
  optimized = false;
8080
8116
  dynamicChildren = null;
@@ -10207,6 +10243,10 @@ function normalizeChildren(vnode, children) {
10207
10243
  }
10208
10244
  }
10209
10245
  } else if (isFunction(children)) {
10246
+ if (shapeFlag & (1 | 64)) {
10247
+ normalizeChildren(vnode, { default: children });
10248
+ return;
10249
+ }
10210
10250
  children = { default: children, _ctx: currentRenderingInstance };
10211
10251
  type = 32;
10212
10252
  } else {
@@ -10925,7 +10965,7 @@ function isMemoSame(cached, memo) {
10925
10965
  return true;
10926
10966
  }
10927
10967
 
10928
- const version = "3.5.37";
10968
+ const version = "3.5.39";
10929
10969
  const warn = warn$1 ;
10930
10970
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10931
10971
  const devtools = devtools$1 ;
@@ -11658,16 +11698,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
11658
11698
  }
11659
11699
  }
11660
11700
  }
11661
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
11701
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
11702
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
11662
11703
  function parseName(name) {
11663
11704
  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
- }
11705
+ let m;
11706
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
11707
+ if (!options) options = {};
11708
+ name = name.slice(0, name.length - m[1].length);
11709
+ options[m[1].toLowerCase()] = true;
11671
11710
  }
11672
11711
  const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
11673
11712
  return [event, options];