@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
  **/
@@ -1375,7 +1375,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1375
1375
  value,
1376
1376
  isRef(target) ? target : receiver
1377
1377
  );
1378
- if (target === toRaw(receiver)) {
1378
+ if (target === toRaw(receiver) && result) {
1379
1379
  if (!hadKey) {
1380
1380
  trigger(target, "add", key, value);
1381
1381
  } else if (hasChanged(value, oldValue)) {
@@ -3868,11 +3868,9 @@ const TeleportImpl = {
3868
3868
  }
3869
3869
  } else {
3870
3870
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3871
- const nextTarget = n2.target = resolveTarget(
3872
- n2.props,
3873
- querySelector
3874
- );
3871
+ const nextTarget = resolveTarget(n2.props, querySelector);
3875
3872
  if (nextTarget) {
3873
+ n2.target = nextTarget;
3876
3874
  moveTeleport(
3877
3875
  n2,
3878
3876
  nextTarget,
@@ -3910,7 +3908,8 @@ const TeleportImpl = {
3910
3908
  target,
3911
3909
  props
3912
3910
  } = vnode;
3913
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3911
+ const disabled = isTeleportDisabled(props);
3912
+ const shouldRemove = doRemove || !disabled;
3914
3913
  const pendingMount = pendingMounts.get(vnode);
3915
3914
  if (pendingMount) {
3916
3915
  pendingMount.flags |= 8;
@@ -3921,7 +3920,7 @@ const TeleportImpl = {
3921
3920
  hostRemove(targetAnchor);
3922
3921
  }
3923
3922
  doRemove && hostRemove(anchor);
3924
- if (!pendingMount && shapeFlag & 16) {
3923
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) {
3925
3924
  for (let i = 0; i < children.length; i++) {
3926
3925
  const child = children[i];
3927
3926
  unmount(
@@ -4568,7 +4567,12 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4568
4567
  }
4569
4568
  }
4570
4569
  if (isFunction(ref)) {
4571
- callWithErrorHandling(ref, owner, 12, [value, refs]);
4570
+ pauseTracking();
4571
+ try {
4572
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
4573
+ } finally {
4574
+ resetTracking();
4575
+ }
4572
4576
  } else {
4573
4577
  const _isString = isString(ref);
4574
4578
  const _isRef = isRef(ref);
@@ -4860,9 +4864,18 @@ function createHydrationFunctions(rendererInternals) {
4860
4864
  };
4861
4865
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4862
4866
  optimized = optimized || !!vnode.dynamicChildren;
4863
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4867
+ const {
4868
+ type,
4869
+ dynamicProps,
4870
+ props,
4871
+ patchFlag,
4872
+ shapeFlag,
4873
+ dirs,
4874
+ transition
4875
+ } = vnode;
4864
4876
  const forcePatch = type === "input" || type === "option";
4865
- if (!!(process.env.NODE_ENV !== "production") || forcePatch || patchFlag !== -1) {
4877
+ const hasDynamicProps = !!dynamicProps;
4878
+ if (!!(process.env.NODE_ENV !== "production") || forcePatch || hasDynamicProps || patchFlag !== -1) {
4866
4879
  if (dirs) {
4867
4880
  invokeDirectiveHook(vnode, null, parentComponent, "created");
4868
4881
  }
@@ -4929,7 +4942,7 @@ Server rendered element contains more child nodes than client vdom.`
4929
4942
  }
4930
4943
  }
4931
4944
  if (props) {
4932
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || !optimized || patchFlag & (16 | 32)) {
4945
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || hasDynamicProps || !optimized || patchFlag & (16 | 32)) {
4933
4946
  const isCustomElement = el.tagName.includes("-");
4934
4947
  for (const key in props) {
4935
4948
  if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && // #11189 skip if this node has directives that have created hooks
@@ -4938,7 +4951,7 @@ Server rendered element contains more child nodes than client vdom.`
4938
4951
  logMismatchError();
4939
4952
  }
4940
4953
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4941
- key[0] === "." || isCustomElement && !isReservedProp(key)) {
4954
+ key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4942
4955
  patchProp(el, key, null, props[key], void 0, parentComponent);
4943
4956
  }
4944
4957
  }
@@ -5054,7 +5067,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5054
5067
  }
5055
5068
  };
5056
5069
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
5057
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
5070
+ if (!isNodeMismatchAllowed(node, vnode)) {
5058
5071
  (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
5059
5072
  `Hydration node mismatch:
5060
5073
  - rendered on server:`,
@@ -5269,7 +5282,12 @@ function isMismatchAllowed(el, allowedType) {
5269
5282
  el = el.parentElement;
5270
5283
  }
5271
5284
  }
5272
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
5285
+ return isMismatchAllowedByAttr(
5286
+ el && el.getAttribute(allowMismatchAttr),
5287
+ allowedType
5288
+ );
5289
+ }
5290
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
5273
5291
  if (allowedAttr == null) {
5274
5292
  return false;
5275
5293
  } else if (allowedAttr === "") {
@@ -5282,6 +5300,19 @@ function isMismatchAllowed(el, allowedType) {
5282
5300
  return list.includes(MismatchTypeString[allowedType]);
5283
5301
  }
5284
5302
  }
5303
+ function isNodeMismatchAllowed(node, vnode) {
5304
+ return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
5305
+ }
5306
+ function isMismatchAllowedByNode(node) {
5307
+ return node.nodeType === 1 && isMismatchAllowedByAttr(
5308
+ node.getAttribute(allowMismatchAttr),
5309
+ 1 /* CHILDREN */
5310
+ );
5311
+ }
5312
+ function isMismatchAllowedByVNode({ props }) {
5313
+ const allowedAttr = props && props[allowMismatchAttr];
5314
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
5315
+ }
5285
5316
 
5286
5317
  const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
5287
5318
  const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
@@ -7515,7 +7546,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7515
7546
  return vm;
7516
7547
  }
7517
7548
  }
7518
- Vue.version = `2.6.14-compat:${"3.5.37"}`;
7549
+ Vue.version = `2.6.14-compat:${"3.5.39"}`;
7519
7550
  Vue.config = singletonApp.config;
7520
7551
  Vue.use = (plugin, ...options) => {
7521
7552
  if (plugin && isFunction(plugin.install)) {
@@ -8378,7 +8409,8 @@ function isEmitListener(options, key) {
8378
8409
  if (key.startsWith(compatModelEventPrefix)) {
8379
8410
  return true;
8380
8411
  }
8381
- key = key.slice(2).replace(/Once$/, "");
8412
+ key = key.slice(2);
8413
+ key = key === "Once" ? key : key.replace(/Once$/, "");
8382
8414
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
8383
8415
  }
8384
8416
 
@@ -9722,7 +9754,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9722
9754
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
9723
9755
  }
9724
9756
  parentComponent && toggleRecurse(parentComponent, true);
9725
- if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
9757
+ if (
9758
+ // HMR updated, force full diff
9759
+ !!(process.env.NODE_ENV !== "production") && isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
9760
+ // Force full diff when block metadata is unstable.
9761
+ dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
9762
+ ) {
9726
9763
  patchFlag = 0;
9727
9764
  optimized = false;
9728
9765
  dynamicChildren = null;
@@ -11967,6 +12004,10 @@ function normalizeChildren(vnode, children) {
11967
12004
  }
11968
12005
  }
11969
12006
  } else if (isFunction(children)) {
12007
+ if (shapeFlag & (1 | 64)) {
12008
+ normalizeChildren(vnode, { default: children });
12009
+ return;
12010
+ }
11970
12011
  children = { default: children, _ctx: currentRenderingInstance };
11971
12012
  type = 32;
11972
12013
  } else {
@@ -12711,7 +12752,7 @@ function isMemoSame(cached, memo) {
12711
12752
  return true;
12712
12753
  }
12713
12754
 
12714
- const version = "3.5.37";
12755
+ const version = "3.5.39";
12715
12756
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12716
12757
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12717
12758
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13532,16 +13573,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
13532
13573
  }
13533
13574
  }
13534
13575
  }
13535
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
13576
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
13577
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
13536
13578
  function parseName(name) {
13537
13579
  let options;
13538
- if (optionsModifierRE.test(name)) {
13539
- options = {};
13540
- let m;
13541
- while (m = name.match(optionsModifierRE)) {
13542
- name = name.slice(0, name.length - m[0].length);
13543
- options[m[0].toLowerCase()] = true;
13544
- }
13580
+ let m;
13581
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
13582
+ if (!options) options = {};
13583
+ name = name.slice(0, name.length - m[1].length);
13584
+ options[m[1].toLowerCase()] = true;
13545
13585
  }
13546
13586
  const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
13547
13587
  return [event, options];
@@ -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
  **/
@@ -1374,7 +1374,7 @@ var Vue = (function () {
1374
1374
  value,
1375
1375
  isRef(target) ? target : receiver
1376
1376
  );
1377
- if (target === toRaw(receiver)) {
1377
+ if (target === toRaw(receiver) && result) {
1378
1378
  if (!hadKey) {
1379
1379
  trigger(target, "add", key, value);
1380
1380
  } else if (hasChanged(value, oldValue)) {
@@ -3825,11 +3825,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3825
3825
  }
3826
3826
  } else {
3827
3827
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3828
- const nextTarget = n2.target = resolveTarget(
3829
- n2.props,
3830
- querySelector
3831
- );
3828
+ const nextTarget = resolveTarget(n2.props, querySelector);
3832
3829
  if (nextTarget) {
3830
+ n2.target = nextTarget;
3833
3831
  moveTeleport(
3834
3832
  n2,
3835
3833
  nextTarget,
@@ -3867,7 +3865,8 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3867
3865
  target,
3868
3866
  props
3869
3867
  } = vnode;
3870
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3868
+ const disabled = isTeleportDisabled(props);
3869
+ const shouldRemove = doRemove || !disabled;
3871
3870
  const pendingMount = pendingMounts.get(vnode);
3872
3871
  if (pendingMount) {
3873
3872
  pendingMount.flags |= 8;
@@ -3878,7 +3877,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3878
3877
  hostRemove(targetAnchor);
3879
3878
  }
3880
3879
  doRemove && hostRemove(anchor);
3881
- if (!pendingMount && shapeFlag & 16) {
3880
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) {
3882
3881
  for (let i = 0; i < children.length; i++) {
3883
3882
  const child = children[i];
3884
3883
  unmount(
@@ -4524,7 +4523,12 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4524
4523
  }
4525
4524
  }
4526
4525
  if (isFunction(ref)) {
4527
- callWithErrorHandling(ref, owner, 12, [value, refs]);
4526
+ pauseTracking();
4527
+ try {
4528
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
4529
+ } finally {
4530
+ resetTracking();
4531
+ }
4528
4532
  } else {
4529
4533
  const _isString = isString(ref);
4530
4534
  const _isRef = isRef(ref);
@@ -4816,7 +4820,15 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4816
4820
  };
4817
4821
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4818
4822
  optimized = optimized || !!vnode.dynamicChildren;
4819
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4823
+ const {
4824
+ type,
4825
+ dynamicProps,
4826
+ props,
4827
+ patchFlag,
4828
+ shapeFlag,
4829
+ dirs,
4830
+ transition
4831
+ } = vnode;
4820
4832
  const forcePatch = type === "input" || type === "option";
4821
4833
  {
4822
4834
  if (dirs) {
@@ -4894,7 +4906,7 @@ Server rendered element contains more child nodes than client vdom.`
4894
4906
  logMismatchError();
4895
4907
  }
4896
4908
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4897
- key[0] === "." || isCustomElement && !isReservedProp(key)) {
4909
+ key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4898
4910
  patchProp(el, key, null, props[key], void 0, parentComponent);
4899
4911
  }
4900
4912
  }
@@ -4999,7 +5011,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4999
5011
  }
5000
5012
  };
5001
5013
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
5002
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
5014
+ if (!isNodeMismatchAllowed(node, vnode)) {
5003
5015
  warn$1(
5004
5016
  `Hydration node mismatch:
5005
5017
  - rendered on server:`,
@@ -5214,7 +5226,12 @@ Server rendered element contains fewer child nodes than client vdom.`
5214
5226
  el = el.parentElement;
5215
5227
  }
5216
5228
  }
5217
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
5229
+ return isMismatchAllowedByAttr(
5230
+ el && el.getAttribute(allowMismatchAttr),
5231
+ allowedType
5232
+ );
5233
+ }
5234
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
5218
5235
  if (allowedAttr == null) {
5219
5236
  return false;
5220
5237
  } else if (allowedAttr === "") {
@@ -5227,6 +5244,19 @@ Server rendered element contains fewer child nodes than client vdom.`
5227
5244
  return list.includes(MismatchTypeString[allowedType]);
5228
5245
  }
5229
5246
  }
5247
+ function isNodeMismatchAllowed(node, vnode) {
5248
+ return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
5249
+ }
5250
+ function isMismatchAllowedByNode(node) {
5251
+ return node.nodeType === 1 && isMismatchAllowedByAttr(
5252
+ node.getAttribute(allowMismatchAttr),
5253
+ 1 /* CHILDREN */
5254
+ );
5255
+ }
5256
+ function isMismatchAllowedByVNode({ props }) {
5257
+ const allowedAttr = props && props[allowMismatchAttr];
5258
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
5259
+ }
5230
5260
 
5231
5261
  const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
5232
5262
  const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
@@ -7449,7 +7479,7 @@ If this is a native custom element, make sure to exclude it from component resol
7449
7479
  return vm;
7450
7480
  }
7451
7481
  }
7452
- Vue.version = `2.6.14-compat:${"3.5.37"}`;
7482
+ Vue.version = `2.6.14-compat:${"3.5.39"}`;
7453
7483
  Vue.config = singletonApp.config;
7454
7484
  Vue.use = (plugin, ...options) => {
7455
7485
  if (plugin && isFunction(plugin.install)) {
@@ -8310,7 +8340,8 @@ If you want to remount the same app, move your app creation logic into a factory
8310
8340
  if (key.startsWith(compatModelEventPrefix)) {
8311
8341
  return true;
8312
8342
  }
8313
- key = key.slice(2).replace(/Once$/, "");
8343
+ key = key.slice(2);
8344
+ key = key === "Once" ? key : key.replace(/Once$/, "");
8314
8345
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
8315
8346
  }
8316
8347
 
@@ -9627,7 +9658,12 @@ If you want to remount the same app, move your app creation logic into a factory
9627
9658
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
9628
9659
  }
9629
9660
  parentComponent && toggleRecurse(parentComponent, true);
9630
- if (isHmrUpdating) {
9661
+ if (
9662
+ // HMR updated, force full diff
9663
+ isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
9664
+ // Force full diff when block metadata is unstable.
9665
+ dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
9666
+ ) {
9631
9667
  patchFlag = 0;
9632
9668
  optimized = false;
9633
9669
  dynamicChildren = null;
@@ -11861,6 +11897,10 @@ Component that was made reactive: `,
11861
11897
  }
11862
11898
  }
11863
11899
  } else if (isFunction(children)) {
11900
+ if (shapeFlag & (1 | 64)) {
11901
+ normalizeChildren(vnode, { default: children });
11902
+ return;
11903
+ }
11864
11904
  children = { default: children, _ctx: currentRenderingInstance };
11865
11905
  type = 32;
11866
11906
  } else {
@@ -12577,7 +12617,7 @@ Component that was made reactive: `,
12577
12617
  return true;
12578
12618
  }
12579
12619
 
12580
- const version = "3.5.37";
12620
+ const version = "3.5.39";
12581
12621
  const warn = warn$1 ;
12582
12622
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12583
12623
  const devtools = devtools$1 ;
@@ -13379,16 +13419,15 @@ Component that was made reactive: `,
13379
13419
  }
13380
13420
  }
13381
13421
  }
13382
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
13422
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
13423
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
13383
13424
  function parseName(name) {
13384
13425
  let options;
13385
- if (optionsModifierRE.test(name)) {
13386
- options = {};
13387
- let m;
13388
- while (m = name.match(optionsModifierRE)) {
13389
- name = name.slice(0, name.length - m[0].length);
13390
- options[m[0].toLowerCase()] = true;
13391
- }
13426
+ let m;
13427
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
13428
+ if (!options) options = {};
13429
+ name = name.slice(0, name.length - m[1].length);
13430
+ options[m[1].toLowerCase()] = true;
13392
13431
  }
13393
13432
  const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
13394
13433
  return [event, options];