@vue/compat 3.3.7 → 3.3.9

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.
@@ -936,7 +936,7 @@ function createReadonlyMethod(type) {
936
936
  toRaw(this)
937
937
  );
938
938
  }
939
- return type === "delete" ? false : this;
939
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
940
940
  };
941
941
  }
942
942
  function createInstrumentations() {
@@ -2664,9 +2664,19 @@ function renderComponentRoot(instance) {
2664
2664
  try {
2665
2665
  if (vnode.shapeFlag & 4) {
2666
2666
  const proxyToUse = withProxy || proxy;
2667
+ const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2668
+ get(target, key, receiver) {
2669
+ warn(
2670
+ `Property '${String(
2671
+ key
2672
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
2673
+ );
2674
+ return Reflect.get(target, key, receiver);
2675
+ }
2676
+ }) : proxyToUse;
2667
2677
  result = normalizeVNode(
2668
2678
  render.call(
2669
- proxyToUse,
2679
+ thisProxy,
2670
2680
  proxyToUse,
2671
2681
  renderCache,
2672
2682
  props,
@@ -2917,6 +2927,65 @@ function updateHOCHostEl({ vnode, parent }, el) {
2917
2927
  }
2918
2928
  }
2919
2929
 
2930
+ const COMPONENTS = "components";
2931
+ const DIRECTIVES = "directives";
2932
+ const FILTERS = "filters";
2933
+ function resolveComponent(name, maybeSelfReference) {
2934
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2935
+ }
2936
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2937
+ function resolveDynamicComponent(component) {
2938
+ if (isString(component)) {
2939
+ return resolveAsset(COMPONENTS, component, false) || component;
2940
+ } else {
2941
+ return component || NULL_DYNAMIC_COMPONENT;
2942
+ }
2943
+ }
2944
+ function resolveDirective(name) {
2945
+ return resolveAsset(DIRECTIVES, name);
2946
+ }
2947
+ function resolveFilter$1(name) {
2948
+ return resolveAsset(FILTERS, name);
2949
+ }
2950
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2951
+ const instance = currentRenderingInstance || currentInstance;
2952
+ if (instance) {
2953
+ const Component = instance.type;
2954
+ if (type === COMPONENTS) {
2955
+ const selfName = getComponentName(
2956
+ Component,
2957
+ false
2958
+ /* do not include inferred name to avoid breaking existing code */
2959
+ );
2960
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2961
+ return Component;
2962
+ }
2963
+ }
2964
+ const res = (
2965
+ // local registration
2966
+ // check instance[type] first which is resolved for options API
2967
+ resolve(instance[type] || Component[type], name) || // global registration
2968
+ resolve(instance.appContext[type], name)
2969
+ );
2970
+ if (!res && maybeSelfReference) {
2971
+ return Component;
2972
+ }
2973
+ if (warnMissing && !res) {
2974
+ const extra = type === COMPONENTS ? `
2975
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
2976
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
2977
+ }
2978
+ return res;
2979
+ } else {
2980
+ warn(
2981
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
2982
+ );
2983
+ }
2984
+ }
2985
+ function resolve(registry, name) {
2986
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2987
+ }
2988
+
2920
2989
  const isSuspense = (type) => type.__isSuspense;
2921
2990
  const SuspenseImpl = {
2922
2991
  name: "Suspense",
@@ -3451,7 +3520,7 @@ function normalizeSuspenseSlot(s) {
3451
3520
  }
3452
3521
  if (isArray(s)) {
3453
3522
  const singleChild = filterSingleRoot(s);
3454
- if (!singleChild) {
3523
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3455
3524
  warn(`<Suspense> slots expect a single root node.`);
3456
3525
  }
3457
3526
  s = singleChild;
@@ -3637,6 +3706,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3637
3706
  let onCleanup = (fn) => {
3638
3707
  cleanup = effect.onStop = () => {
3639
3708
  callWithErrorHandling(fn, instance, 4);
3709
+ cleanup = effect.onStop = void 0;
3640
3710
  };
3641
3711
  };
3642
3712
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -4113,7 +4183,11 @@ function emptyPlaceholder(vnode) {
4113
4183
  }
4114
4184
  }
4115
4185
  function getKeepAliveChild(vnode) {
4116
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
4186
+ return isKeepAlive(vnode) ? (
4187
+ // #7121 ensure get the child component subtree in case
4188
+ // it's been replaced during HMR
4189
+ vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
4190
+ ) : vnode;
4117
4191
  }
4118
4192
  function setTransitionHooks(vnode, hooks) {
4119
4193
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -4628,65 +4702,6 @@ function getCompatListeners(instance) {
4628
4702
  return listeners;
4629
4703
  }
4630
4704
 
4631
- const COMPONENTS = "components";
4632
- const DIRECTIVES = "directives";
4633
- const FILTERS = "filters";
4634
- function resolveComponent(name, maybeSelfReference) {
4635
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4636
- }
4637
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4638
- function resolveDynamicComponent(component) {
4639
- if (isString(component)) {
4640
- return resolveAsset(COMPONENTS, component, false) || component;
4641
- } else {
4642
- return component || NULL_DYNAMIC_COMPONENT;
4643
- }
4644
- }
4645
- function resolveDirective(name) {
4646
- return resolveAsset(DIRECTIVES, name);
4647
- }
4648
- function resolveFilter$1(name) {
4649
- return resolveAsset(FILTERS, name);
4650
- }
4651
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4652
- const instance = currentRenderingInstance || currentInstance;
4653
- if (instance) {
4654
- const Component = instance.type;
4655
- if (type === COMPONENTS) {
4656
- const selfName = getComponentName(
4657
- Component,
4658
- false
4659
- /* do not include inferred name to avoid breaking existing code */
4660
- );
4661
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4662
- return Component;
4663
- }
4664
- }
4665
- const res = (
4666
- // local registration
4667
- // check instance[type] first which is resolved for options API
4668
- resolve(instance[type] || Component[type], name) || // global registration
4669
- resolve(instance.appContext[type], name)
4670
- );
4671
- if (!res && maybeSelfReference) {
4672
- return Component;
4673
- }
4674
- if (warnMissing && !res) {
4675
- const extra = type === COMPONENTS ? `
4676
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4677
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4678
- }
4679
- return res;
4680
- } else {
4681
- warn(
4682
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4683
- );
4684
- }
4685
- }
4686
- function resolve(registry, name) {
4687
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4688
- }
4689
-
4690
4705
  function convertLegacyRenderFn(instance) {
4691
4706
  const Component2 = instance.type;
4692
4707
  const render = Component2.render;
@@ -6189,7 +6204,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6189
6204
  return vm;
6190
6205
  }
6191
6206
  }
6192
- Vue.version = `2.6.14-compat:${"3.3.7"}`;
6207
+ Vue.version = `2.6.14-compat:${"3.3.9"}`;
6193
6208
  Vue.config = singletonApp.config;
6194
6209
  Vue.use = (p, ...options) => {
6195
6210
  if (p && isFunction(p.install)) {
@@ -7217,6 +7232,9 @@ function assertType(value, type) {
7217
7232
  };
7218
7233
  }
7219
7234
  function getInvalidTypeMessage(name, value, expectedTypes) {
7235
+ if (expectedTypes.length === 0) {
7236
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
7237
+ }
7220
7238
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7221
7239
  const expectedType = expectedTypes[0];
7222
7240
  const receivedType = toRawType(value);
@@ -7488,6 +7506,20 @@ function createHydrationFunctions(rendererInternals) {
7488
7506
  const { type, ref, shapeFlag, patchFlag } = vnode;
7489
7507
  let domType = node.nodeType;
7490
7508
  vnode.el = node;
7509
+ {
7510
+ if (!("__vnode" in node)) {
7511
+ Object.defineProperty(node, "__vnode", {
7512
+ value: vnode,
7513
+ enumerable: false
7514
+ });
7515
+ }
7516
+ if (!("__vueParentComponent" in node)) {
7517
+ Object.defineProperty(node, "__vueParentComponent", {
7518
+ value: parentComponent,
7519
+ enumerable: false
7520
+ });
7521
+ }
7522
+ }
7491
7523
  if (patchFlag === -2) {
7492
7524
  optimized = false;
7493
7525
  vnode.dynamicChildren = null;
@@ -7518,15 +7550,15 @@ function createHydrationFunctions(rendererInternals) {
7518
7550
  }
7519
7551
  break;
7520
7552
  case Comment:
7521
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7522
- if (node.tagName.toLowerCase() === "template") {
7523
- const content = vnode.el.content.firstChild;
7524
- replaceNode(content, node, parentComponent);
7525
- vnode.el = node = content;
7526
- nextNode = nextSibling(node);
7527
- } else {
7528
- nextNode = onMismatch();
7529
- }
7553
+ if (isTemplateNode(node)) {
7554
+ nextNode = nextSibling(node);
7555
+ replaceNode(
7556
+ vnode.el = node.content.firstChild,
7557
+ node,
7558
+ parentComponent
7559
+ );
7560
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7561
+ nextNode = onMismatch();
7530
7562
  } else {
7531
7563
  nextNode = nextSibling(node);
7532
7564
  }
@@ -7649,15 +7681,16 @@ function createHydrationFunctions(rendererInternals) {
7649
7681
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7650
7682
  optimized = optimized || !!vnode.dynamicChildren;
7651
7683
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7652
- const forcePatchValue = type === "input" && dirs || type === "option";
7684
+ const forcePatch = type === "input" || type === "option";
7653
7685
  {
7654
7686
  if (dirs) {
7655
7687
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7656
7688
  }
7657
7689
  if (props) {
7658
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
7690
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7659
7691
  for (const key in props) {
7660
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
7692
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
7693
+ key[0] === ".") {
7661
7694
  patchProp(
7662
7695
  el,
7663
7696
  key,
@@ -7870,8 +7903,7 @@ function createHydrationFunctions(rendererInternals) {
7870
7903
  let parent = parentComponent;
7871
7904
  while (parent) {
7872
7905
  if (parent.vnode.el === oldNode) {
7873
- parent.vnode.el = newNode;
7874
- parent.subTree.el = newNode;
7906
+ parent.vnode.el = parent.subTree.el = newNode;
7875
7907
  }
7876
7908
  parent = parent.parent;
7877
7909
  }
@@ -9449,6 +9481,7 @@ const resolveTarget = (props, select) => {
9449
9481
  }
9450
9482
  };
9451
9483
  const TeleportImpl = {
9484
+ name: "Teleport",
9452
9485
  __isTeleport: true,
9453
9486
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
9454
9487
  const {
@@ -9928,7 +9961,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
9928
9961
  if (shapeFlag & 4 && isProxy(type)) {
9929
9962
  type = toRaw(type);
9930
9963
  warn(
9931
- `Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
9964
+ `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
9932
9965
  `
9933
9966
  Component that was made reactive: `,
9934
9967
  type
@@ -10764,7 +10797,7 @@ function isMemoSame(cached, memo) {
10764
10797
  return true;
10765
10798
  }
10766
10799
 
10767
- const version = "3.3.7";
10800
+ const version = "3.3.9";
10768
10801
  const ssrUtils = null;
10769
10802
  const resolveFilter = resolveFilter$1 ;
10770
10803
  const _compatUtils = {
@@ -12005,21 +12038,20 @@ const vModelText = {
12005
12038
  el[assignKey] = getModelAssigner(vnode);
12006
12039
  if (el.composing)
12007
12040
  return;
12041
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
12042
+ const newValue = value == null ? "" : value;
12043
+ if (elValue === newValue) {
12044
+ return;
12045
+ }
12008
12046
  if (document.activeElement === el && el.type !== "range") {
12009
12047
  if (lazy) {
12010
12048
  return;
12011
12049
  }
12012
- if (trim && el.value.trim() === value) {
12050
+ if (trim && el.value.trim() === newValue) {
12013
12051
  return;
12014
12052
  }
12015
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
12016
- return;
12017
- }
12018
- }
12019
- const newValue = value == null ? "" : value;
12020
- if (el.value !== newValue) {
12021
- el.value = newValue;
12022
12053
  }
12054
+ el.value = newValue;
12023
12055
  }
12024
12056
  };
12025
12057
  const vModelCheckbox = {