@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
  **/
@@ -1448,7 +1448,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1448
1448
  value,
1449
1449
  isRef(target) ? target : receiver
1450
1450
  );
1451
- if (target === toRaw(receiver)) {
1451
+ if (target === toRaw(receiver) && result) {
1452
1452
  if (!hadKey) {
1453
1453
  trigger(target, "add", key, value);
1454
1454
  } else if (hasChanged(value, oldValue)) {
@@ -3941,11 +3941,9 @@ const TeleportImpl = {
3941
3941
  }
3942
3942
  } else {
3943
3943
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3944
- const nextTarget = n2.target = resolveTarget(
3945
- n2.props,
3946
- querySelector
3947
- );
3944
+ const nextTarget = resolveTarget(n2.props, querySelector);
3948
3945
  if (nextTarget) {
3946
+ n2.target = nextTarget;
3949
3947
  moveTeleport(
3950
3948
  n2,
3951
3949
  nextTarget,
@@ -3983,7 +3981,8 @@ const TeleportImpl = {
3983
3981
  target,
3984
3982
  props
3985
3983
  } = vnode;
3986
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3984
+ const disabled = isTeleportDisabled(props);
3985
+ const shouldRemove = doRemove || !disabled;
3987
3986
  const pendingMount = pendingMounts.get(vnode);
3988
3987
  if (pendingMount) {
3989
3988
  pendingMount.flags |= 8;
@@ -3994,7 +3993,7 @@ const TeleportImpl = {
3994
3993
  hostRemove(targetAnchor);
3995
3994
  }
3996
3995
  doRemove && hostRemove(anchor);
3997
- if (!pendingMount && shapeFlag & 16) {
3996
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) {
3998
3997
  for (let i = 0; i < children.length; i++) {
3999
3998
  const child = children[i];
4000
3999
  unmount(
@@ -4641,7 +4640,12 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4641
4640
  }
4642
4641
  }
4643
4642
  if (isFunction(ref)) {
4644
- callWithErrorHandling(ref, owner, 12, [value, refs]);
4643
+ pauseTracking();
4644
+ try {
4645
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
4646
+ } finally {
4647
+ resetTracking();
4648
+ }
4645
4649
  } else {
4646
4650
  const _isString = isString(ref);
4647
4651
  const _isRef = isRef(ref);
@@ -4933,9 +4937,18 @@ function createHydrationFunctions(rendererInternals) {
4933
4937
  };
4934
4938
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4935
4939
  optimized = optimized || !!vnode.dynamicChildren;
4936
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4940
+ const {
4941
+ type,
4942
+ dynamicProps,
4943
+ props,
4944
+ patchFlag,
4945
+ shapeFlag,
4946
+ dirs,
4947
+ transition
4948
+ } = vnode;
4937
4949
  const forcePatch = type === "input" || type === "option";
4938
- if (!!(process.env.NODE_ENV !== "production") || forcePatch || patchFlag !== -1) {
4950
+ const hasDynamicProps = !!dynamicProps;
4951
+ if (!!(process.env.NODE_ENV !== "production") || forcePatch || hasDynamicProps || patchFlag !== -1) {
4939
4952
  if (dirs) {
4940
4953
  invokeDirectiveHook(vnode, null, parentComponent, "created");
4941
4954
  }
@@ -5002,7 +5015,7 @@ Server rendered element contains more child nodes than client vdom.`
5002
5015
  }
5003
5016
  }
5004
5017
  if (props) {
5005
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || !optimized || patchFlag & (16 | 32)) {
5018
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || hasDynamicProps || !optimized || patchFlag & (16 | 32)) {
5006
5019
  const isCustomElement = el.tagName.includes("-");
5007
5020
  for (const key in props) {
5008
5021
  if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && // #11189 skip if this node has directives that have created hooks
@@ -5011,7 +5024,7 @@ Server rendered element contains more child nodes than client vdom.`
5011
5024
  logMismatchError();
5012
5025
  }
5013
5026
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
5014
- key[0] === "." || isCustomElement && !isReservedProp(key)) {
5027
+ key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
5015
5028
  patchProp(el, key, null, props[key], void 0, parentComponent);
5016
5029
  }
5017
5030
  }
@@ -5127,7 +5140,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5127
5140
  }
5128
5141
  };
5129
5142
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
5130
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
5143
+ if (!isNodeMismatchAllowed(node, vnode)) {
5131
5144
  (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
5132
5145
  `Hydration node mismatch:
5133
5146
  - rendered on server:`,
@@ -5342,7 +5355,12 @@ function isMismatchAllowed(el, allowedType) {
5342
5355
  el = el.parentElement;
5343
5356
  }
5344
5357
  }
5345
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
5358
+ return isMismatchAllowedByAttr(
5359
+ el && el.getAttribute(allowMismatchAttr),
5360
+ allowedType
5361
+ );
5362
+ }
5363
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
5346
5364
  if (allowedAttr == null) {
5347
5365
  return false;
5348
5366
  } else if (allowedAttr === "") {
@@ -5355,6 +5373,19 @@ function isMismatchAllowed(el, allowedType) {
5355
5373
  return list.includes(MismatchTypeString[allowedType]);
5356
5374
  }
5357
5375
  }
5376
+ function isNodeMismatchAllowed(node, vnode) {
5377
+ return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
5378
+ }
5379
+ function isMismatchAllowedByNode(node) {
5380
+ return node.nodeType === 1 && isMismatchAllowedByAttr(
5381
+ node.getAttribute(allowMismatchAttr),
5382
+ 1 /* CHILDREN */
5383
+ );
5384
+ }
5385
+ function isMismatchAllowedByVNode({ props }) {
5386
+ const allowedAttr = props && props[allowMismatchAttr];
5387
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
5388
+ }
5358
5389
 
5359
5390
  const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
5360
5391
  const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
@@ -7588,7 +7619,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7588
7619
  return vm;
7589
7620
  }
7590
7621
  }
7591
- Vue.version = `2.6.14-compat:${"3.5.37"}`;
7622
+ Vue.version = `2.6.14-compat:${"3.5.39"}`;
7592
7623
  Vue.config = singletonApp.config;
7593
7624
  Vue.use = (plugin, ...options) => {
7594
7625
  if (plugin && isFunction(plugin.install)) {
@@ -8451,7 +8482,8 @@ function isEmitListener(options, key) {
8451
8482
  if (key.startsWith(compatModelEventPrefix)) {
8452
8483
  return true;
8453
8484
  }
8454
- key = key.slice(2).replace(/Once$/, "");
8485
+ key = key.slice(2);
8486
+ key = key === "Once" ? key : key.replace(/Once$/, "");
8455
8487
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
8456
8488
  }
8457
8489
 
@@ -9795,7 +9827,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9795
9827
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
9796
9828
  }
9797
9829
  parentComponent && toggleRecurse(parentComponent, true);
9798
- if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
9830
+ if (
9831
+ // HMR updated, force full diff
9832
+ !!(process.env.NODE_ENV !== "production") && isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
9833
+ // Force full diff when block metadata is unstable.
9834
+ dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
9835
+ ) {
9799
9836
  patchFlag = 0;
9800
9837
  optimized = false;
9801
9838
  dynamicChildren = null;
@@ -12040,6 +12077,10 @@ function normalizeChildren(vnode, children) {
12040
12077
  }
12041
12078
  }
12042
12079
  } else if (isFunction(children)) {
12080
+ if (shapeFlag & (1 | 64)) {
12081
+ normalizeChildren(vnode, { default: children });
12082
+ return;
12083
+ }
12043
12084
  children = { default: children, _ctx: currentRenderingInstance };
12044
12085
  type = 32;
12045
12086
  } else {
@@ -12784,7 +12825,7 @@ function isMemoSame(cached, memo) {
12784
12825
  return true;
12785
12826
  }
12786
12827
 
12787
- const version = "3.5.37";
12828
+ const version = "3.5.39";
12788
12829
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12789
12830
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12790
12831
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13605,16 +13646,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
13605
13646
  }
13606
13647
  }
13607
13648
  }
13608
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
13649
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
13650
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
13609
13651
  function parseName(name) {
13610
13652
  let options;
13611
- if (optionsModifierRE.test(name)) {
13612
- options = {};
13613
- let m;
13614
- while (m = name.match(optionsModifierRE)) {
13615
- name = name.slice(0, name.length - m[0].length);
13616
- options[m[0].toLowerCase()] = true;
13617
- }
13653
+ let m;
13654
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
13655
+ if (!options) options = {};
13656
+ name = name.slice(0, name.length - m[1].length);
13657
+ options[m[1].toLowerCase()] = true;
13618
13658
  }
13619
13659
  const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
13620
13660
  return [event, options];
@@ -20229,7 +20269,7 @@ function rewriteFilter(node, context) {
20229
20269
  if (child.type === 4) {
20230
20270
  parseFilter(child, context);
20231
20271
  } else if (child.type === 8) {
20232
- rewriteFilter(node, context);
20272
+ rewriteFilter(child, context);
20233
20273
  } else if (child.type === 5) {
20234
20274
  rewriteFilter(child.content, context);
20235
20275
  }
@@ -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
  **/
@@ -1447,7 +1447,7 @@ var Vue = (function () {
1447
1447
  value,
1448
1448
  isRef(target) ? target : receiver
1449
1449
  );
1450
- if (target === toRaw(receiver)) {
1450
+ if (target === toRaw(receiver) && result) {
1451
1451
  if (!hadKey) {
1452
1452
  trigger(target, "add", key, value);
1453
1453
  } else if (hasChanged(value, oldValue)) {
@@ -3898,11 +3898,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3898
3898
  }
3899
3899
  } else {
3900
3900
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3901
- const nextTarget = n2.target = resolveTarget(
3902
- n2.props,
3903
- querySelector
3904
- );
3901
+ const nextTarget = resolveTarget(n2.props, querySelector);
3905
3902
  if (nextTarget) {
3903
+ n2.target = nextTarget;
3906
3904
  moveTeleport(
3907
3905
  n2,
3908
3906
  nextTarget,
@@ -3940,7 +3938,8 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3940
3938
  target,
3941
3939
  props
3942
3940
  } = vnode;
3943
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3941
+ const disabled = isTeleportDisabled(props);
3942
+ const shouldRemove = doRemove || !disabled;
3944
3943
  const pendingMount = pendingMounts.get(vnode);
3945
3944
  if (pendingMount) {
3946
3945
  pendingMount.flags |= 8;
@@ -3951,7 +3950,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3951
3950
  hostRemove(targetAnchor);
3952
3951
  }
3953
3952
  doRemove && hostRemove(anchor);
3954
- if (!pendingMount && shapeFlag & 16) {
3953
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) {
3955
3954
  for (let i = 0; i < children.length; i++) {
3956
3955
  const child = children[i];
3957
3956
  unmount(
@@ -4597,7 +4596,12 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4597
4596
  }
4598
4597
  }
4599
4598
  if (isFunction(ref)) {
4600
- callWithErrorHandling(ref, owner, 12, [value, refs]);
4599
+ pauseTracking();
4600
+ try {
4601
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
4602
+ } finally {
4603
+ resetTracking();
4604
+ }
4601
4605
  } else {
4602
4606
  const _isString = isString(ref);
4603
4607
  const _isRef = isRef(ref);
@@ -4889,7 +4893,15 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4889
4893
  };
4890
4894
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4891
4895
  optimized = optimized || !!vnode.dynamicChildren;
4892
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4896
+ const {
4897
+ type,
4898
+ dynamicProps,
4899
+ props,
4900
+ patchFlag,
4901
+ shapeFlag,
4902
+ dirs,
4903
+ transition
4904
+ } = vnode;
4893
4905
  const forcePatch = type === "input" || type === "option";
4894
4906
  {
4895
4907
  if (dirs) {
@@ -4967,7 +4979,7 @@ Server rendered element contains more child nodes than client vdom.`
4967
4979
  logMismatchError();
4968
4980
  }
4969
4981
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4970
- key[0] === "." || isCustomElement && !isReservedProp(key)) {
4982
+ key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4971
4983
  patchProp(el, key, null, props[key], void 0, parentComponent);
4972
4984
  }
4973
4985
  }
@@ -5072,7 +5084,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5072
5084
  }
5073
5085
  };
5074
5086
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
5075
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
5087
+ if (!isNodeMismatchAllowed(node, vnode)) {
5076
5088
  warn$1(
5077
5089
  `Hydration node mismatch:
5078
5090
  - rendered on server:`,
@@ -5287,7 +5299,12 @@ Server rendered element contains fewer child nodes than client vdom.`
5287
5299
  el = el.parentElement;
5288
5300
  }
5289
5301
  }
5290
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
5302
+ return isMismatchAllowedByAttr(
5303
+ el && el.getAttribute(allowMismatchAttr),
5304
+ allowedType
5305
+ );
5306
+ }
5307
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
5291
5308
  if (allowedAttr == null) {
5292
5309
  return false;
5293
5310
  } else if (allowedAttr === "") {
@@ -5300,6 +5317,19 @@ Server rendered element contains fewer child nodes than client vdom.`
5300
5317
  return list.includes(MismatchTypeString[allowedType]);
5301
5318
  }
5302
5319
  }
5320
+ function isNodeMismatchAllowed(node, vnode) {
5321
+ return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
5322
+ }
5323
+ function isMismatchAllowedByNode(node) {
5324
+ return node.nodeType === 1 && isMismatchAllowedByAttr(
5325
+ node.getAttribute(allowMismatchAttr),
5326
+ 1 /* CHILDREN */
5327
+ );
5328
+ }
5329
+ function isMismatchAllowedByVNode({ props }) {
5330
+ const allowedAttr = props && props[allowMismatchAttr];
5331
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
5332
+ }
5303
5333
 
5304
5334
  const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
5305
5335
  const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
@@ -7522,7 +7552,7 @@ If this is a native custom element, make sure to exclude it from component resol
7522
7552
  return vm;
7523
7553
  }
7524
7554
  }
7525
- Vue.version = `2.6.14-compat:${"3.5.37"}`;
7555
+ Vue.version = `2.6.14-compat:${"3.5.39"}`;
7526
7556
  Vue.config = singletonApp.config;
7527
7557
  Vue.use = (plugin, ...options) => {
7528
7558
  if (plugin && isFunction(plugin.install)) {
@@ -8383,7 +8413,8 @@ If you want to remount the same app, move your app creation logic into a factory
8383
8413
  if (key.startsWith(compatModelEventPrefix)) {
8384
8414
  return true;
8385
8415
  }
8386
- key = key.slice(2).replace(/Once$/, "");
8416
+ key = key.slice(2);
8417
+ key = key === "Once" ? key : key.replace(/Once$/, "");
8387
8418
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
8388
8419
  }
8389
8420
 
@@ -9700,7 +9731,12 @@ If you want to remount the same app, move your app creation logic into a factory
9700
9731
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
9701
9732
  }
9702
9733
  parentComponent && toggleRecurse(parentComponent, true);
9703
- if (isHmrUpdating) {
9734
+ if (
9735
+ // HMR updated, force full diff
9736
+ isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
9737
+ // Force full diff when block metadata is unstable.
9738
+ dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
9739
+ ) {
9704
9740
  patchFlag = 0;
9705
9741
  optimized = false;
9706
9742
  dynamicChildren = null;
@@ -11934,6 +11970,10 @@ Component that was made reactive: `,
11934
11970
  }
11935
11971
  }
11936
11972
  } else if (isFunction(children)) {
11973
+ if (shapeFlag & (1 | 64)) {
11974
+ normalizeChildren(vnode, { default: children });
11975
+ return;
11976
+ }
11937
11977
  children = { default: children, _ctx: currentRenderingInstance };
11938
11978
  type = 32;
11939
11979
  } else {
@@ -12650,7 +12690,7 @@ Component that was made reactive: `,
12650
12690
  return true;
12651
12691
  }
12652
12692
 
12653
- const version = "3.5.37";
12693
+ const version = "3.5.39";
12654
12694
  const warn = warn$1 ;
12655
12695
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12656
12696
  const devtools = devtools$1 ;
@@ -13452,16 +13492,15 @@ Component that was made reactive: `,
13452
13492
  }
13453
13493
  }
13454
13494
  }
13455
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
13495
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
13496
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
13456
13497
  function parseName(name) {
13457
13498
  let options;
13458
- if (optionsModifierRE.test(name)) {
13459
- options = {};
13460
- let m;
13461
- while (m = name.match(optionsModifierRE)) {
13462
- name = name.slice(0, name.length - m[0].length);
13463
- options[m[0].toLowerCase()] = true;
13464
- }
13499
+ let m;
13500
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
13501
+ if (!options) options = {};
13502
+ name = name.slice(0, name.length - m[1].length);
13503
+ options[m[1].toLowerCase()] = true;
13465
13504
  }
13466
13505
  const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
13467
13506
  return [event, options];
@@ -20026,7 +20065,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
20026
20065
  if (child.type === 4) {
20027
20066
  parseFilter(child, context);
20028
20067
  } else if (child.type === 8) {
20029
- rewriteFilter(node, context);
20068
+ rewriteFilter(child, context);
20030
20069
  } else if (child.type === 5) {
20031
20070
  rewriteFilter(child.content, context);
20032
20071
  }