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.
@@ -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
  **/
@@ -1371,7 +1371,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1371
1371
  value,
1372
1372
  isRef(target) ? target : receiver
1373
1373
  );
1374
- if (target === toRaw(receiver)) {
1374
+ if (target === toRaw(receiver) && result) {
1375
1375
  if (!hadKey) {
1376
1376
  trigger(target, "add", key, value);
1377
1377
  } else if (hasChanged(value, oldValue)) {
@@ -3381,11 +3381,9 @@ const TeleportImpl = {
3381
3381
  }
3382
3382
  } else {
3383
3383
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3384
- const nextTarget = n2.target = resolveTarget(
3385
- n2.props,
3386
- querySelector
3387
- );
3384
+ const nextTarget = resolveTarget(n2.props, querySelector);
3388
3385
  if (nextTarget) {
3386
+ n2.target = nextTarget;
3389
3387
  moveTeleport(
3390
3388
  n2,
3391
3389
  nextTarget,
@@ -3423,7 +3421,8 @@ const TeleportImpl = {
3423
3421
  target,
3424
3422
  props
3425
3423
  } = vnode;
3426
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3424
+ const disabled = isTeleportDisabled(props);
3425
+ const shouldRemove = doRemove || !disabled;
3427
3426
  const pendingMount = pendingMounts.get(vnode);
3428
3427
  if (pendingMount) {
3429
3428
  pendingMount.flags |= 8;
@@ -3434,7 +3433,7 @@ const TeleportImpl = {
3434
3433
  hostRemove(targetAnchor);
3435
3434
  }
3436
3435
  doRemove && hostRemove(anchor);
3437
- if (!pendingMount && shapeFlag & 16) {
3436
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) {
3438
3437
  for (let i = 0; i < children.length; i++) {
3439
3438
  const child = children[i];
3440
3439
  unmount(
@@ -4077,7 +4076,12 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4077
4076
  }
4078
4077
  }
4079
4078
  if (isFunction(ref)) {
4080
- callWithErrorHandling(ref, owner, 12, [value, refs]);
4079
+ pauseTracking();
4080
+ try {
4081
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
4082
+ } finally {
4083
+ resetTracking();
4084
+ }
4081
4085
  } else {
4082
4086
  const _isString = isString(ref);
4083
4087
  const _isRef = isRef(ref);
@@ -4369,7 +4373,15 @@ function createHydrationFunctions(rendererInternals) {
4369
4373
  };
4370
4374
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4371
4375
  optimized = optimized || !!vnode.dynamicChildren;
4372
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4376
+ const {
4377
+ type,
4378
+ dynamicProps,
4379
+ props,
4380
+ patchFlag,
4381
+ shapeFlag,
4382
+ dirs,
4383
+ transition
4384
+ } = vnode;
4373
4385
  const forcePatch = type === "input" || type === "option";
4374
4386
  {
4375
4387
  if (dirs) {
@@ -4447,7 +4459,7 @@ Server rendered element contains more child nodes than client vdom.`
4447
4459
  logMismatchError();
4448
4460
  }
4449
4461
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4450
- key[0] === "." || isCustomElement && !isReservedProp(key)) {
4462
+ key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4451
4463
  patchProp(el, key, null, props[key], void 0, parentComponent);
4452
4464
  }
4453
4465
  }
@@ -4552,7 +4564,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4552
4564
  }
4553
4565
  };
4554
4566
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
4555
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
4567
+ if (!isNodeMismatchAllowed(node, vnode)) {
4556
4568
  warn$1(
4557
4569
  `Hydration node mismatch:
4558
4570
  - rendered on server:`,
@@ -4767,7 +4779,12 @@ function isMismatchAllowed(el, allowedType) {
4767
4779
  el = el.parentElement;
4768
4780
  }
4769
4781
  }
4770
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
4782
+ return isMismatchAllowedByAttr(
4783
+ el && el.getAttribute(allowMismatchAttr),
4784
+ allowedType
4785
+ );
4786
+ }
4787
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
4771
4788
  if (allowedAttr == null) {
4772
4789
  return false;
4773
4790
  } else if (allowedAttr === "") {
@@ -4780,6 +4797,19 @@ function isMismatchAllowed(el, allowedType) {
4780
4797
  return list.includes(MismatchTypeString[allowedType]);
4781
4798
  }
4782
4799
  }
4800
+ function isNodeMismatchAllowed(node, vnode) {
4801
+ return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
4802
+ }
4803
+ function isMismatchAllowedByNode(node) {
4804
+ return node.nodeType === 1 && isMismatchAllowedByAttr(
4805
+ node.getAttribute(allowMismatchAttr),
4806
+ 1 /* CHILDREN */
4807
+ );
4808
+ }
4809
+ function isMismatchAllowedByVNode({ props }) {
4810
+ const allowedAttr = props && props[allowMismatchAttr];
4811
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
4812
+ }
4783
4813
 
4784
4814
  const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
4785
4815
  const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
@@ -6777,7 +6807,8 @@ function isEmitListener(options, key) {
6777
6807
  if (!options || !isOn(key)) {
6778
6808
  return false;
6779
6809
  }
6780
- key = key.slice(2).replace(/Once$/, "");
6810
+ key = key.slice(2);
6811
+ key = key === "Once" ? key : key.replace(/Once$/, "");
6781
6812
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
6782
6813
  }
6783
6814
 
@@ -8001,7 +8032,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8001
8032
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
8002
8033
  }
8003
8034
  parentComponent && toggleRecurse(parentComponent, true);
8004
- if (isHmrUpdating) {
8035
+ if (
8036
+ // HMR updated, force full diff
8037
+ isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
8038
+ // Force full diff when block metadata is unstable.
8039
+ dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
8040
+ ) {
8005
8041
  patchFlag = 0;
8006
8042
  optimized = false;
8007
8043
  dynamicChildren = null;
@@ -10134,6 +10170,10 @@ function normalizeChildren(vnode, children) {
10134
10170
  }
10135
10171
  }
10136
10172
  } else if (isFunction(children)) {
10173
+ if (shapeFlag & (1 | 64)) {
10174
+ normalizeChildren(vnode, { default: children });
10175
+ return;
10176
+ }
10137
10177
  children = { default: children, _ctx: currentRenderingInstance };
10138
10178
  type = 32;
10139
10179
  } else {
@@ -10852,7 +10892,7 @@ function isMemoSame(cached, memo) {
10852
10892
  return true;
10853
10893
  }
10854
10894
 
10855
- const version = "3.5.37";
10895
+ const version = "3.5.39";
10856
10896
  const warn = warn$1 ;
10857
10897
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10858
10898
  const devtools = devtools$1 ;
@@ -11585,16 +11625,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
11585
11625
  }
11586
11626
  }
11587
11627
  }
11588
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
11628
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
11629
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
11589
11630
  function parseName(name) {
11590
11631
  let options;
11591
- if (optionsModifierRE.test(name)) {
11592
- options = {};
11593
- let m;
11594
- while (m = name.match(optionsModifierRE)) {
11595
- name = name.slice(0, name.length - m[0].length);
11596
- options[m[0].toLowerCase()] = true;
11597
- }
11632
+ let m;
11633
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
11634
+ if (!options) options = {};
11635
+ name = name.slice(0, name.length - m[1].length);
11636
+ options[m[1].toLowerCase()] = true;
11598
11637
  }
11599
11638
  const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
11600
11639
  return [event, options];