@vue/compat 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/compat v3.5.37
2
+ * @vue/compat 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)) {
@@ -3850,11 +3850,9 @@ const TeleportImpl = {
3850
3850
  }
3851
3851
  } else {
3852
3852
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3853
- const nextTarget = n2.target = resolveTarget(
3854
- n2.props,
3855
- querySelector
3856
- );
3853
+ const nextTarget = resolveTarget(n2.props, querySelector);
3857
3854
  if (nextTarget) {
3855
+ n2.target = nextTarget;
3858
3856
  moveTeleport(
3859
3857
  n2,
3860
3858
  nextTarget,
@@ -3892,7 +3890,8 @@ const TeleportImpl = {
3892
3890
  target,
3893
3891
  props
3894
3892
  } = vnode;
3895
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3893
+ const disabled = isTeleportDisabled(props);
3894
+ const shouldRemove = doRemove || !disabled;
3896
3895
  const pendingMount = pendingMounts.get(vnode);
3897
3896
  if (pendingMount) {
3898
3897
  pendingMount.flags |= 8;
@@ -3903,7 +3902,7 @@ const TeleportImpl = {
3903
3902
  hostRemove(targetAnchor);
3904
3903
  }
3905
3904
  doRemove && hostRemove(anchor);
3906
- if (!pendingMount && shapeFlag & 16) {
3905
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) {
3907
3906
  for (let i = 0; i < children.length; i++) {
3908
3907
  const child = children[i];
3909
3908
  unmount(
@@ -4549,7 +4548,12 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4549
4548
  }
4550
4549
  }
4551
4550
  if (isFunction(ref)) {
4552
- callWithErrorHandling(ref, owner, 12, [value, refs]);
4551
+ pauseTracking();
4552
+ try {
4553
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
4554
+ } finally {
4555
+ resetTracking();
4556
+ }
4553
4557
  } else {
4554
4558
  const _isString = isString(ref);
4555
4559
  const _isRef = isRef(ref);
@@ -4841,7 +4845,15 @@ function createHydrationFunctions(rendererInternals) {
4841
4845
  };
4842
4846
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4843
4847
  optimized = optimized || !!vnode.dynamicChildren;
4844
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4848
+ const {
4849
+ type,
4850
+ dynamicProps,
4851
+ props,
4852
+ patchFlag,
4853
+ shapeFlag,
4854
+ dirs,
4855
+ transition
4856
+ } = vnode;
4845
4857
  const forcePatch = type === "input" || type === "option";
4846
4858
  {
4847
4859
  if (dirs) {
@@ -4919,7 +4931,7 @@ Server rendered element contains more child nodes than client vdom.`
4919
4931
  logMismatchError();
4920
4932
  }
4921
4933
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4922
- key[0] === "." || isCustomElement && !isReservedProp(key)) {
4934
+ key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4923
4935
  patchProp(el, key, null, props[key], void 0, parentComponent);
4924
4936
  }
4925
4937
  }
@@ -5024,7 +5036,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5024
5036
  }
5025
5037
  };
5026
5038
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
5027
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
5039
+ if (!isNodeMismatchAllowed(node, vnode)) {
5028
5040
  warn$1(
5029
5041
  `Hydration node mismatch:
5030
5042
  - rendered on server:`,
@@ -5239,7 +5251,12 @@ function isMismatchAllowed(el, allowedType) {
5239
5251
  el = el.parentElement;
5240
5252
  }
5241
5253
  }
5242
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
5254
+ return isMismatchAllowedByAttr(
5255
+ el && el.getAttribute(allowMismatchAttr),
5256
+ allowedType
5257
+ );
5258
+ }
5259
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
5243
5260
  if (allowedAttr == null) {
5244
5261
  return false;
5245
5262
  } else if (allowedAttr === "") {
@@ -5252,6 +5269,19 @@ function isMismatchAllowed(el, allowedType) {
5252
5269
  return list.includes(MismatchTypeString[allowedType]);
5253
5270
  }
5254
5271
  }
5272
+ function isNodeMismatchAllowed(node, vnode) {
5273
+ return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
5274
+ }
5275
+ function isMismatchAllowedByNode(node) {
5276
+ return node.nodeType === 1 && isMismatchAllowedByAttr(
5277
+ node.getAttribute(allowMismatchAttr),
5278
+ 1 /* CHILDREN */
5279
+ );
5280
+ }
5281
+ function isMismatchAllowedByVNode({ props }) {
5282
+ const allowedAttr = props && props[allowMismatchAttr];
5283
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
5284
+ }
5255
5285
 
5256
5286
  const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
5257
5287
  const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
@@ -7483,7 +7513,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7483
7513
  return vm;
7484
7514
  }
7485
7515
  }
7486
- Vue.version = `2.6.14-compat:${"3.5.37"}`;
7516
+ Vue.version = `2.6.14-compat:${"3.5.39"}`;
7487
7517
  Vue.config = singletonApp.config;
7488
7518
  Vue.use = (plugin, ...options) => {
7489
7519
  if (plugin && isFunction(plugin.install)) {
@@ -8344,7 +8374,8 @@ function isEmitListener(options, key) {
8344
8374
  if (key.startsWith(compatModelEventPrefix)) {
8345
8375
  return true;
8346
8376
  }
8347
- key = key.slice(2).replace(/Once$/, "");
8377
+ key = key.slice(2);
8378
+ key = key === "Once" ? key : key.replace(/Once$/, "");
8348
8379
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
8349
8380
  }
8350
8381
 
@@ -9661,7 +9692,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9661
9692
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
9662
9693
  }
9663
9694
  parentComponent && toggleRecurse(parentComponent, true);
9664
- if (isHmrUpdating) {
9695
+ if (
9696
+ // HMR updated, force full diff
9697
+ isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
9698
+ // Force full diff when block metadata is unstable.
9699
+ dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
9700
+ ) {
9665
9701
  patchFlag = 0;
9666
9702
  optimized = false;
9667
9703
  dynamicChildren = null;
@@ -11895,6 +11931,10 @@ function normalizeChildren(vnode, children) {
11895
11931
  }
11896
11932
  }
11897
11933
  } else if (isFunction(children)) {
11934
+ if (shapeFlag & (1 | 64)) {
11935
+ normalizeChildren(vnode, { default: children });
11936
+ return;
11937
+ }
11898
11938
  children = { default: children, _ctx: currentRenderingInstance };
11899
11939
  type = 32;
11900
11940
  } else {
@@ -12625,7 +12665,7 @@ function isMemoSame(cached, memo) {
12625
12665
  return true;
12626
12666
  }
12627
12667
 
12628
- const version = "3.5.37";
12668
+ const version = "3.5.39";
12629
12669
  const warn = warn$1 ;
12630
12670
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12631
12671
  const devtools = devtools$1 ;
@@ -13446,16 +13486,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
13446
13486
  }
13447
13487
  }
13448
13488
  }
13449
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
13489
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
13490
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
13450
13491
  function parseName(name) {
13451
13492
  let options;
13452
- if (optionsModifierRE.test(name)) {
13453
- options = {};
13454
- let m;
13455
- while (m = name.match(optionsModifierRE)) {
13456
- name = name.slice(0, name.length - m[0].length);
13457
- options[m[0].toLowerCase()] = true;
13458
- }
13493
+ let m;
13494
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
13495
+ if (!options) options = {};
13496
+ name = name.slice(0, name.length - m[1].length);
13497
+ options[m[1].toLowerCase()] = true;
13459
13498
  }
13460
13499
  const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
13461
13500
  return [event, options];