@vue/runtime-core 3.4.0-alpha.1 → 3.4.0-alpha.2

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.
@@ -815,9 +815,19 @@ function renderComponentRoot(instance) {
815
815
  try {
816
816
  if (vnode.shapeFlag & 4) {
817
817
  const proxyToUse = withProxy || proxy;
818
+ const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
819
+ get(target, key, receiver) {
820
+ warn(
821
+ `Property '${String(
822
+ key
823
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
824
+ );
825
+ return Reflect.get(target, key, receiver);
826
+ }
827
+ }) : proxyToUse;
818
828
  result = normalizeVNode(
819
829
  render.call(
820
- proxyToUse,
830
+ thisProxy,
821
831
  proxyToUse,
822
832
  renderCache,
823
833
  props,
@@ -1052,6 +1062,61 @@ function updateHOCHostEl({ vnode, parent }, el) {
1052
1062
  }
1053
1063
  }
1054
1064
 
1065
+ const COMPONENTS = "components";
1066
+ const DIRECTIVES = "directives";
1067
+ function resolveComponent(name, maybeSelfReference) {
1068
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
1069
+ }
1070
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
1071
+ function resolveDynamicComponent(component) {
1072
+ if (shared.isString(component)) {
1073
+ return resolveAsset(COMPONENTS, component, false) || component;
1074
+ } else {
1075
+ return component || NULL_DYNAMIC_COMPONENT;
1076
+ }
1077
+ }
1078
+ function resolveDirective(name) {
1079
+ return resolveAsset(DIRECTIVES, name);
1080
+ }
1081
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
1082
+ const instance = currentRenderingInstance || currentInstance;
1083
+ if (instance) {
1084
+ const Component = instance.type;
1085
+ if (type === COMPONENTS) {
1086
+ const selfName = getComponentName(
1087
+ Component,
1088
+ false
1089
+ /* do not include inferred name to avoid breaking existing code */
1090
+ );
1091
+ if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
1092
+ return Component;
1093
+ }
1094
+ }
1095
+ const res = (
1096
+ // local registration
1097
+ // check instance[type] first which is resolved for options API
1098
+ resolve(instance[type] || Component[type], name) || // global registration
1099
+ resolve(instance.appContext[type], name)
1100
+ );
1101
+ if (!res && maybeSelfReference) {
1102
+ return Component;
1103
+ }
1104
+ if (warnMissing && !res) {
1105
+ const extra = type === COMPONENTS ? `
1106
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
1107
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
1108
+ }
1109
+ return res;
1110
+ } else {
1111
+ warn(
1112
+ `resolve${shared.capitalize(type.slice(0, -1))} can only be used in render() or setup().`
1113
+ );
1114
+ }
1115
+ }
1116
+ function resolve(registry, name) {
1117
+ return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
1118
+ }
1119
+
1055
1120
  const isSuspense = (type) => type.__isSuspense;
1056
1121
  const SuspenseImpl = {
1057
1122
  name: "Suspense",
@@ -1586,7 +1651,7 @@ function normalizeSuspenseSlot(s) {
1586
1651
  }
1587
1652
  if (shared.isArray(s)) {
1588
1653
  const singleChild = filterSingleRoot(s);
1589
- if (!singleChild) {
1654
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
1590
1655
  warn(`<Suspense> slots expect a single root node.`);
1591
1656
  }
1592
1657
  s = singleChild;
@@ -1736,6 +1801,7 @@ function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger
1736
1801
  let onCleanup = (fn) => {
1737
1802
  cleanup = effect.onStop = () => {
1738
1803
  callWithErrorHandling(fn, instance, 4);
1804
+ cleanup = effect.onStop = void 0;
1739
1805
  };
1740
1806
  };
1741
1807
  let ssrCleanup;
@@ -2228,7 +2294,11 @@ function emptyPlaceholder(vnode) {
2228
2294
  }
2229
2295
  }
2230
2296
  function getKeepAliveChild(vnode) {
2231
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
2297
+ return isKeepAlive(vnode) ? (
2298
+ // #7121 ensure get the child component subtree in case
2299
+ // it's been replaced during HMR
2300
+ vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
2301
+ ) : vnode;
2232
2302
  }
2233
2303
  function setTransitionHooks(vnode, hooks) {
2234
2304
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -2712,61 +2782,6 @@ function onErrorCaptured(hook, target = currentInstance) {
2712
2782
  injectHook("ec", hook, target);
2713
2783
  }
2714
2784
 
2715
- const COMPONENTS = "components";
2716
- const DIRECTIVES = "directives";
2717
- function resolveComponent(name, maybeSelfReference) {
2718
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2719
- }
2720
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2721
- function resolveDynamicComponent(component) {
2722
- if (shared.isString(component)) {
2723
- return resolveAsset(COMPONENTS, component, false) || component;
2724
- } else {
2725
- return component || NULL_DYNAMIC_COMPONENT;
2726
- }
2727
- }
2728
- function resolveDirective(name) {
2729
- return resolveAsset(DIRECTIVES, name);
2730
- }
2731
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2732
- const instance = currentRenderingInstance || currentInstance;
2733
- if (instance) {
2734
- const Component = instance.type;
2735
- if (type === COMPONENTS) {
2736
- const selfName = getComponentName(
2737
- Component,
2738
- false
2739
- /* do not include inferred name to avoid breaking existing code */
2740
- );
2741
- if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
2742
- return Component;
2743
- }
2744
- }
2745
- const res = (
2746
- // local registration
2747
- // check instance[type] first which is resolved for options API
2748
- resolve(instance[type] || Component[type], name) || // global registration
2749
- resolve(instance.appContext[type], name)
2750
- );
2751
- if (!res && maybeSelfReference) {
2752
- return Component;
2753
- }
2754
- if (warnMissing && !res) {
2755
- const extra = type === COMPONENTS ? `
2756
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
2757
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
2758
- }
2759
- return res;
2760
- } else {
2761
- warn(
2762
- `resolve${shared.capitalize(type.slice(0, -1))} can only be used in render() or setup().`
2763
- );
2764
- }
2765
- }
2766
- function resolve(registry, name) {
2767
- return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
2768
- }
2769
-
2770
2785
  function renderList(source, renderItem, cache, index) {
2771
2786
  let ret;
2772
2787
  const cached = cache && cache[index];
@@ -4286,6 +4301,9 @@ function assertType(value, type) {
4286
4301
  };
4287
4302
  }
4288
4303
  function getInvalidTypeMessage(name, value, expectedTypes) {
4304
+ if (expectedTypes.length === 0) {
4305
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
4306
+ }
4289
4307
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(shared.capitalize).join(" | ")}`;
4290
4308
  const expectedType = expectedTypes[0];
4291
4309
  const receivedType = shared.toRawType(value);
@@ -4555,6 +4573,20 @@ function createHydrationFunctions(rendererInternals) {
4555
4573
  const { type, ref, shapeFlag, patchFlag } = vnode;
4556
4574
  let domType = node.nodeType;
4557
4575
  vnode.el = node;
4576
+ {
4577
+ if (!("__vnode" in node)) {
4578
+ Object.defineProperty(node, "__vnode", {
4579
+ value: vnode,
4580
+ enumerable: false
4581
+ });
4582
+ }
4583
+ if (!("__vueParentComponent" in node)) {
4584
+ Object.defineProperty(node, "__vueParentComponent", {
4585
+ value: parentComponent,
4586
+ enumerable: false
4587
+ });
4588
+ }
4589
+ }
4558
4590
  if (patchFlag === -2) {
4559
4591
  optimized = false;
4560
4592
  vnode.dynamicChildren = null;
@@ -4585,15 +4617,15 @@ function createHydrationFunctions(rendererInternals) {
4585
4617
  }
4586
4618
  break;
4587
4619
  case Comment:
4588
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
4589
- if (node.tagName.toLowerCase() === "template") {
4590
- const content = vnode.el.content.firstChild;
4591
- replaceNode(content, node, parentComponent);
4592
- vnode.el = node = content;
4593
- nextNode = nextSibling(node);
4594
- } else {
4595
- nextNode = onMismatch();
4596
- }
4620
+ if (isTemplateNode(node)) {
4621
+ nextNode = nextSibling(node);
4622
+ replaceNode(
4623
+ vnode.el = node.content.firstChild,
4624
+ node,
4625
+ parentComponent
4626
+ );
4627
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
4628
+ nextNode = onMismatch();
4597
4629
  } else {
4598
4630
  nextNode = nextSibling(node);
4599
4631
  }
@@ -4716,15 +4748,16 @@ function createHydrationFunctions(rendererInternals) {
4716
4748
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4717
4749
  optimized = optimized || !!vnode.dynamicChildren;
4718
4750
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4719
- const forcePatchValue = type === "input" && dirs || type === "option";
4751
+ const forcePatch = type === "input" || type === "option";
4720
4752
  {
4721
4753
  if (dirs) {
4722
4754
  invokeDirectiveHook(vnode, null, parentComponent, "created");
4723
4755
  }
4724
4756
  if (props) {
4725
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
4757
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
4726
4758
  for (const key in props) {
4727
- if (forcePatchValue && key.endsWith("value") || shared.isOn(key) && !shared.isReservedProp(key)) {
4759
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4760
+ key[0] === ".") {
4728
4761
  patchProp(
4729
4762
  el,
4730
4763
  key,
@@ -4937,8 +4970,7 @@ function createHydrationFunctions(rendererInternals) {
4937
4970
  let parent = parentComponent;
4938
4971
  while (parent) {
4939
4972
  if (parent.vnode.el === oldNode) {
4940
- parent.vnode.el = newNode;
4941
- parent.subTree.el = newNode;
4973
+ parent.vnode.el = parent.subTree.el = newNode;
4942
4974
  }
4943
4975
  parent = parent.parent;
4944
4976
  }
@@ -6488,6 +6520,7 @@ const resolveTarget = (props, select) => {
6488
6520
  }
6489
6521
  };
6490
6522
  const TeleportImpl = {
6523
+ name: "Teleport",
6491
6524
  __isTeleport: true,
6492
6525
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
6493
6526
  const {
@@ -6909,7 +6942,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
6909
6942
  if (shapeFlag & 4 && reactivity.isProxy(type)) {
6910
6943
  type = reactivity.toRaw(type);
6911
6944
  warn(
6912
- `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\`.`,
6945
+ `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\`.`,
6913
6946
  `
6914
6947
  Component that was made reactive: `,
6915
6948
  type
@@ -7746,7 +7779,7 @@ function isMemoSame(cached, memo) {
7746
7779
  return true;
7747
7780
  }
7748
7781
 
7749
- const version = "3.4.0-alpha.1";
7782
+ const version = "3.4.0-alpha.2";
7750
7783
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
7751
7784
  const _ssrUtils = {
7752
7785
  createComponentInstance,
@@ -400,9 +400,19 @@ function renderComponentRoot(instance) {
400
400
  try {
401
401
  if (vnode.shapeFlag & 4) {
402
402
  const proxyToUse = withProxy || proxy;
403
+ const thisProxy = false ? new Proxy(proxyToUse, {
404
+ get(target, key, receiver) {
405
+ warn(
406
+ `Property '${String(
407
+ key
408
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
409
+ );
410
+ return Reflect.get(target, key, receiver);
411
+ }
412
+ }) : proxyToUse;
403
413
  result = normalizeVNode(
404
414
  render.call(
405
- proxyToUse,
415
+ thisProxy,
406
416
  proxyToUse,
407
417
  renderCache,
408
418
  props,
@@ -568,6 +578,52 @@ function updateHOCHostEl({ vnode, parent }, el) {
568
578
  }
569
579
  }
570
580
 
581
+ const COMPONENTS = "components";
582
+ const DIRECTIVES = "directives";
583
+ function resolveComponent(name, maybeSelfReference) {
584
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
585
+ }
586
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
587
+ function resolveDynamicComponent(component) {
588
+ if (shared.isString(component)) {
589
+ return resolveAsset(COMPONENTS, component, false) || component;
590
+ } else {
591
+ return component || NULL_DYNAMIC_COMPONENT;
592
+ }
593
+ }
594
+ function resolveDirective(name) {
595
+ return resolveAsset(DIRECTIVES, name);
596
+ }
597
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
598
+ const instance = currentRenderingInstance || currentInstance;
599
+ if (instance) {
600
+ const Component = instance.type;
601
+ if (type === COMPONENTS) {
602
+ const selfName = getComponentName(
603
+ Component,
604
+ false
605
+ /* do not include inferred name to avoid breaking existing code */
606
+ );
607
+ if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
608
+ return Component;
609
+ }
610
+ }
611
+ const res = (
612
+ // local registration
613
+ // check instance[type] first which is resolved for options API
614
+ resolve(instance[type] || Component[type], name) || // global registration
615
+ resolve(instance.appContext[type], name)
616
+ );
617
+ if (!res && maybeSelfReference) {
618
+ return Component;
619
+ }
620
+ return res;
621
+ }
622
+ }
623
+ function resolve(registry, name) {
624
+ return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
625
+ }
626
+
571
627
  const isSuspense = (type) => type.__isSuspense;
572
628
  const SuspenseImpl = {
573
629
  name: "Suspense",
@@ -1189,6 +1245,7 @@ function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger
1189
1245
  let onCleanup = (fn) => {
1190
1246
  cleanup = effect.onStop = () => {
1191
1247
  callWithErrorHandling(fn, instance, 4);
1248
+ cleanup = effect.onStop = void 0;
1192
1249
  };
1193
1250
  };
1194
1251
  let ssrCleanup;
@@ -1661,7 +1718,11 @@ function emptyPlaceholder(vnode) {
1661
1718
  }
1662
1719
  }
1663
1720
  function getKeepAliveChild(vnode) {
1664
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
1721
+ return isKeepAlive(vnode) ? (
1722
+ // #7121 ensure get the child component subtree in case
1723
+ // it's been replaced during HMR
1724
+ vnode.children ? vnode.children[0] : void 0
1725
+ ) : vnode;
1665
1726
  }
1666
1727
  function setTransitionHooks(vnode, hooks) {
1667
1728
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -2120,52 +2181,6 @@ function onErrorCaptured(hook, target = currentInstance) {
2120
2181
  injectHook("ec", hook, target);
2121
2182
  }
2122
2183
 
2123
- const COMPONENTS = "components";
2124
- const DIRECTIVES = "directives";
2125
- function resolveComponent(name, maybeSelfReference) {
2126
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2127
- }
2128
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2129
- function resolveDynamicComponent(component) {
2130
- if (shared.isString(component)) {
2131
- return resolveAsset(COMPONENTS, component, false) || component;
2132
- } else {
2133
- return component || NULL_DYNAMIC_COMPONENT;
2134
- }
2135
- }
2136
- function resolveDirective(name) {
2137
- return resolveAsset(DIRECTIVES, name);
2138
- }
2139
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2140
- const instance = currentRenderingInstance || currentInstance;
2141
- if (instance) {
2142
- const Component = instance.type;
2143
- if (type === COMPONENTS) {
2144
- const selfName = getComponentName(
2145
- Component,
2146
- false
2147
- /* do not include inferred name to avoid breaking existing code */
2148
- );
2149
- if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
2150
- return Component;
2151
- }
2152
- }
2153
- const res = (
2154
- // local registration
2155
- // check instance[type] first which is resolved for options API
2156
- resolve(instance[type] || Component[type], name) || // global registration
2157
- resolve(instance.appContext[type], name)
2158
- );
2159
- if (!res && maybeSelfReference) {
2160
- return Component;
2161
- }
2162
- return res;
2163
- }
2164
- }
2165
- function resolve(registry, name) {
2166
- return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
2167
- }
2168
-
2169
2184
  function renderList(source, renderItem, cache, index) {
2170
2185
  let ret;
2171
2186
  const cached = cache && cache[index];
@@ -3510,15 +3525,15 @@ function createHydrationFunctions(rendererInternals) {
3510
3525
  }
3511
3526
  break;
3512
3527
  case Comment:
3513
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
3514
- if (node.tagName.toLowerCase() === "template") {
3515
- const content = vnode.el.content.firstChild;
3516
- replaceNode(content, node, parentComponent);
3517
- vnode.el = node = content;
3518
- nextNode = nextSibling(node);
3519
- } else {
3520
- nextNode = onMismatch();
3521
- }
3528
+ if (isTemplateNode(node)) {
3529
+ nextNode = nextSibling(node);
3530
+ replaceNode(
3531
+ vnode.el = node.content.firstChild,
3532
+ node,
3533
+ parentComponent
3534
+ );
3535
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
3536
+ nextNode = onMismatch();
3522
3537
  } else {
3523
3538
  nextNode = nextSibling(node);
3524
3539
  }
@@ -3639,15 +3654,16 @@ function createHydrationFunctions(rendererInternals) {
3639
3654
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
3640
3655
  optimized = optimized || !!vnode.dynamicChildren;
3641
3656
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
3642
- const forcePatchValue = type === "input" && dirs || type === "option";
3643
- if (forcePatchValue || patchFlag !== -1) {
3657
+ const forcePatch = type === "input" || type === "option";
3658
+ if (forcePatch || patchFlag !== -1) {
3644
3659
  if (dirs) {
3645
3660
  invokeDirectiveHook(vnode, null, parentComponent, "created");
3646
3661
  }
3647
3662
  if (props) {
3648
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
3663
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
3649
3664
  for (const key in props) {
3650
- if (forcePatchValue && key.endsWith("value") || shared.isOn(key) && !shared.isReservedProp(key)) {
3665
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
3666
+ key[0] === ".") {
3651
3667
  patchProp(
3652
3668
  el,
3653
3669
  key,
@@ -3832,8 +3848,7 @@ function createHydrationFunctions(rendererInternals) {
3832
3848
  let parent = parentComponent;
3833
3849
  while (parent) {
3834
3850
  if (parent.vnode.el === oldNode) {
3835
- parent.vnode.el = newNode;
3836
- parent.subTree.el = newNode;
3851
+ parent.vnode.el = parent.subTree.el = newNode;
3837
3852
  }
3838
3853
  parent = parent.parent;
3839
3854
  }
@@ -5192,6 +5207,7 @@ const resolveTarget = (props, select) => {
5192
5207
  }
5193
5208
  };
5194
5209
  const TeleportImpl = {
5210
+ name: "Teleport",
5195
5211
  __isTeleport: true,
5196
5212
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
5197
5213
  const {
@@ -6088,7 +6104,7 @@ function isMemoSame(cached, memo) {
6088
6104
  return true;
6089
6105
  }
6090
6106
 
6091
- const version = "3.4.0-alpha.1";
6107
+ const version = "3.4.0-alpha.2";
6092
6108
  const ErrorTypeStrings = null;
6093
6109
  const _ssrUtils = {
6094
6110
  createComponentInstance,
@@ -126,7 +126,7 @@ C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOpt
126
126
  $forceUpdate: () => void;
127
127
  $nextTick: typeof nextTick;
128
128
  $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R]) => any : (...args: any) => any, options?: WatchOptions): WatchStopHandle;
129
- } & P & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>;
129
+ } & IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B>>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>;
130
130
 
131
131
  declare const enum LifecycleHooks {
132
132
  BEFORE_CREATE = "bc",
@@ -737,6 +737,25 @@ export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T
737
737
  */
738
738
  export declare function hasInjectionContext(): boolean;
739
739
 
740
+ type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
741
+ type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
742
+ export type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = {}> = ComponentPublicInstanceConstructor<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, PP & Props, Defaults, true, {}, S>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S> & PP;
743
+ export declare function defineComponent<Props extends Record<string, any>, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}>(setup: (props: Props, ctx: SetupContext<E, S>) => RenderFunction | Promise<RenderFunction>, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs'> & {
744
+ props?: (keyof Props)[];
745
+ emits?: E | EE[];
746
+ slots?: S;
747
+ }): (props: Props & EmitsToProps<E>) => any;
748
+ export declare function defineComponent<Props extends Record<string, any>, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}>(setup: (props: Props, ctx: SetupContext<E, S>) => RenderFunction | Promise<RenderFunction>, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs'> & {
749
+ props?: ComponentObjectPropsOptions<Props>;
750
+ emits?: E | EE[];
751
+ slots?: S;
752
+ }): (props: Props & EmitsToProps<E>) => any;
753
+ export declare function defineComponent<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<Props, E>, ExtractDefaultPropTypes<Props>, S>;
754
+ export declare function defineComponent<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string, Props = Readonly<{
755
+ [key in PropNames]?: any;
756
+ }>>(options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<Props, E>, ExtractDefaultPropTypes<Props>, S>;
757
+ export declare function defineComponent<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<PropsOptions, E>, ExtractDefaultPropTypes<PropsOptions>, S>;
758
+
740
759
  export interface App<HostElement = any> {
741
760
  version: string;
742
761
  config: AppConfig;
@@ -744,7 +763,7 @@ export interface App<HostElement = any> {
744
763
  use<Options>(plugin: Plugin<Options>, options: Options): this;
745
764
  mixin(mixin: ComponentOptions): this;
746
765
  component(name: string): Component | undefined;
747
- component(name: string, component: Component): this;
766
+ component(name: string, component: Component | DefineComponent): this;
748
767
  directive(name: string): Directive | undefined;
749
768
  directive(name: string, directive: Directive): this;
750
769
  mount(rootContainer: HostElement | string, isHydrate?: boolean, isSVG?: boolean): ComponentPublicInstance;
@@ -814,6 +833,7 @@ export interface TeleportProps {
814
833
  disabled?: boolean;
815
834
  }
816
835
  declare const TeleportImpl: {
836
+ name: string;
817
837
  __isTeleport: boolean;
818
838
  process(n1: TeleportVNode | null, n2: TeleportVNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, isSVG: boolean, slotScopeIds: string[] | null, optimized: boolean, internals: RendererInternals): void;
819
839
  remove(vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, optimized: boolean, { um: unmount, o: { remove: hostRemove } }: RendererInternals, doRemove: boolean): void;
@@ -1124,25 +1144,6 @@ export declare function watch<T extends Readonly<MultiWatchSources>, Immediate e
1124
1144
  export declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
1125
1145
  export declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
1126
1146
 
1127
- type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
1128
- type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
1129
- export type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = {}> = ComponentPublicInstanceConstructor<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, PP & Props, Defaults, true, {}, S> & Props> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S> & PP;
1130
- export declare function defineComponent<Props extends Record<string, any>, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}>(setup: (props: Props, ctx: SetupContext<E, S>) => RenderFunction | Promise<RenderFunction>, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs'> & {
1131
- props?: (keyof Props)[];
1132
- emits?: E | EE[];
1133
- slots?: S;
1134
- }): (props: Props & EmitsToProps<E>) => any;
1135
- export declare function defineComponent<Props extends Record<string, any>, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}>(setup: (props: Props, ctx: SetupContext<E, S>) => RenderFunction | Promise<RenderFunction>, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs'> & {
1136
- props?: ComponentObjectPropsOptions<Props>;
1137
- emits?: E | EE[];
1138
- slots?: S;
1139
- }): (props: Props & EmitsToProps<E>) => any;
1140
- export declare function defineComponent<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<Props, E>, ExtractDefaultPropTypes<Props>, S>;
1141
- export declare function defineComponent<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string, Props = Readonly<{
1142
- [key in PropNames]?: any;
1143
- }>>(options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<Props, E>, ExtractDefaultPropTypes<Props>, S>;
1144
- export declare function defineComponent<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<PropsOptions, E>, ExtractDefaultPropTypes<PropsOptions>, S>;
1145
-
1146
1147
  type AsyncComponentResolveResult<T = Component> = T | {
1147
1148
  default: T;
1148
1149
  };
@@ -1197,7 +1198,7 @@ export declare function defineProps<PropNames extends string = string>(props: Pr
1197
1198
  [key in PropNames]?: any;
1198
1199
  }>>;
1199
1200
  export declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
1200
- export declare function defineProps<TypeProps>(): DefineProps<TypeProps, BooleanKey<TypeProps>>;
1201
+ export declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
1201
1202
  type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
1202
1203
  readonly [K in BKeys]-?: boolean;
1203
1204
  };
@@ -1320,8 +1321,8 @@ type InferDefaults<T> = {
1320
1321
  };
1321
1322
  type NativeType = null | number | string | boolean | symbol | Function;
1322
1323
  type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
1323
- type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Omit<T, keyof Defaults> & {
1324
- [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? T[K] : NotUndefined<T[K]> : never;
1324
+ type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Readonly<Omit<T, keyof Defaults>> & {
1325
+ readonly [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? T[K] : NotUndefined<T[K]> : never;
1325
1326
  } & {
1326
1327
  readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
1327
1328
  };
@@ -1,6 +1,6 @@
1
1
  import { pauseTracking, resetTracking, isRef, toRaw, getCurrentScope, isShallow as isShallow$1, isReactive, ReactiveEffect, ref, shallowReadonly, track, reactive, shallowReactive, trigger, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, isReadonly } from '@vue/reactivity';
2
2
  export { EffectScope, ReactiveEffect, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
3
- import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, toNumber, hasChanged, remove, isSet, isMap, isPlainObject, isBuiltInDirective, invokeArrayFns, isRegExp, capitalize, isGloballyAllowed, NO, def, isReservedProp, EMPTY_ARR, toRawType, makeMap, normalizeClass, normalizeStyle } from '@vue/shared';
3
+ import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, capitalize, toNumber, hasChanged, remove, isSet, isMap, isPlainObject, isBuiltInDirective, invokeArrayFns, isRegExp, isGloballyAllowed, NO, def, isReservedProp, EMPTY_ARR, toRawType, makeMap, normalizeClass, normalizeStyle } from '@vue/shared';
4
4
  export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
5
5
 
6
6
  const stack = [];
@@ -819,9 +819,19 @@ function renderComponentRoot(instance) {
819
819
  try {
820
820
  if (vnode.shapeFlag & 4) {
821
821
  const proxyToUse = withProxy || proxy;
822
+ const thisProxy = !!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup ? new Proxy(proxyToUse, {
823
+ get(target, key, receiver) {
824
+ warn(
825
+ `Property '${String(
826
+ key
827
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
828
+ );
829
+ return Reflect.get(target, key, receiver);
830
+ }
831
+ }) : proxyToUse;
822
832
  result = normalizeVNode(
823
833
  render.call(
824
- proxyToUse,
834
+ thisProxy,
825
835
  proxyToUse,
826
836
  renderCache,
827
837
  props,
@@ -1056,6 +1066,61 @@ function updateHOCHostEl({ vnode, parent }, el) {
1056
1066
  }
1057
1067
  }
1058
1068
 
1069
+ const COMPONENTS = "components";
1070
+ const DIRECTIVES = "directives";
1071
+ function resolveComponent(name, maybeSelfReference) {
1072
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
1073
+ }
1074
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
1075
+ function resolveDynamicComponent(component) {
1076
+ if (isString(component)) {
1077
+ return resolveAsset(COMPONENTS, component, false) || component;
1078
+ } else {
1079
+ return component || NULL_DYNAMIC_COMPONENT;
1080
+ }
1081
+ }
1082
+ function resolveDirective(name) {
1083
+ return resolveAsset(DIRECTIVES, name);
1084
+ }
1085
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
1086
+ const instance = currentRenderingInstance || currentInstance;
1087
+ if (instance) {
1088
+ const Component = instance.type;
1089
+ if (type === COMPONENTS) {
1090
+ const selfName = getComponentName(
1091
+ Component,
1092
+ false
1093
+ /* do not include inferred name to avoid breaking existing code */
1094
+ );
1095
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
1096
+ return Component;
1097
+ }
1098
+ }
1099
+ const res = (
1100
+ // local registration
1101
+ // check instance[type] first which is resolved for options API
1102
+ resolve(instance[type] || Component[type], name) || // global registration
1103
+ resolve(instance.appContext[type], name)
1104
+ );
1105
+ if (!res && maybeSelfReference) {
1106
+ return Component;
1107
+ }
1108
+ if (!!(process.env.NODE_ENV !== "production") && warnMissing && !res) {
1109
+ const extra = type === COMPONENTS ? `
1110
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
1111
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
1112
+ }
1113
+ return res;
1114
+ } else if (!!(process.env.NODE_ENV !== "production")) {
1115
+ warn(
1116
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
1117
+ );
1118
+ }
1119
+ }
1120
+ function resolve(registry, name) {
1121
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
1122
+ }
1123
+
1059
1124
  const isSuspense = (type) => type.__isSuspense;
1060
1125
  const SuspenseImpl = {
1061
1126
  name: "Suspense",
@@ -1590,7 +1655,7 @@ function normalizeSuspenseSlot(s) {
1590
1655
  }
1591
1656
  if (isArray(s)) {
1592
1657
  const singleChild = filterSingleRoot(s);
1593
- if (!!(process.env.NODE_ENV !== "production") && !singleChild) {
1658
+ if (!!(process.env.NODE_ENV !== "production") && !singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
1594
1659
  warn(`<Suspense> slots expect a single root node.`);
1595
1660
  }
1596
1661
  s = singleChild;
@@ -1740,6 +1805,7 @@ function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger
1740
1805
  let onCleanup = (fn) => {
1741
1806
  cleanup = effect.onStop = () => {
1742
1807
  callWithErrorHandling(fn, instance, 4);
1808
+ cleanup = effect.onStop = void 0;
1743
1809
  };
1744
1810
  };
1745
1811
  let ssrCleanup;
@@ -2234,7 +2300,11 @@ function emptyPlaceholder(vnode) {
2234
2300
  }
2235
2301
  }
2236
2302
  function getKeepAliveChild(vnode) {
2237
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
2303
+ return isKeepAlive(vnode) ? (
2304
+ // #7121 ensure get the child component subtree in case
2305
+ // it's been replaced during HMR
2306
+ !!(process.env.NODE_ENV !== "production") && vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
2307
+ ) : vnode;
2238
2308
  }
2239
2309
  function setTransitionHooks(vnode, hooks) {
2240
2310
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -2718,61 +2788,6 @@ function onErrorCaptured(hook, target = currentInstance) {
2718
2788
  injectHook("ec", hook, target);
2719
2789
  }
2720
2790
 
2721
- const COMPONENTS = "components";
2722
- const DIRECTIVES = "directives";
2723
- function resolveComponent(name, maybeSelfReference) {
2724
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2725
- }
2726
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2727
- function resolveDynamicComponent(component) {
2728
- if (isString(component)) {
2729
- return resolveAsset(COMPONENTS, component, false) || component;
2730
- } else {
2731
- return component || NULL_DYNAMIC_COMPONENT;
2732
- }
2733
- }
2734
- function resolveDirective(name) {
2735
- return resolveAsset(DIRECTIVES, name);
2736
- }
2737
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2738
- const instance = currentRenderingInstance || currentInstance;
2739
- if (instance) {
2740
- const Component = instance.type;
2741
- if (type === COMPONENTS) {
2742
- const selfName = getComponentName(
2743
- Component,
2744
- false
2745
- /* do not include inferred name to avoid breaking existing code */
2746
- );
2747
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2748
- return Component;
2749
- }
2750
- }
2751
- const res = (
2752
- // local registration
2753
- // check instance[type] first which is resolved for options API
2754
- resolve(instance[type] || Component[type], name) || // global registration
2755
- resolve(instance.appContext[type], name)
2756
- );
2757
- if (!res && maybeSelfReference) {
2758
- return Component;
2759
- }
2760
- if (!!(process.env.NODE_ENV !== "production") && warnMissing && !res) {
2761
- const extra = type === COMPONENTS ? `
2762
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
2763
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
2764
- }
2765
- return res;
2766
- } else if (!!(process.env.NODE_ENV !== "production")) {
2767
- warn(
2768
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
2769
- );
2770
- }
2771
- }
2772
- function resolve(registry, name) {
2773
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2774
- }
2775
-
2776
2791
  function renderList(source, renderItem, cache, index) {
2777
2792
  let ret;
2778
2793
  const cached = cache && cache[index];
@@ -4296,6 +4311,9 @@ function assertType(value, type) {
4296
4311
  };
4297
4312
  }
4298
4313
  function getInvalidTypeMessage(name, value, expectedTypes) {
4314
+ if (expectedTypes.length === 0) {
4315
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
4316
+ }
4299
4317
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
4300
4318
  const expectedType = expectedTypes[0];
4301
4319
  const receivedType = toRawType(value);
@@ -4565,6 +4583,20 @@ function createHydrationFunctions(rendererInternals) {
4565
4583
  const { type, ref, shapeFlag, patchFlag } = vnode;
4566
4584
  let domType = node.nodeType;
4567
4585
  vnode.el = node;
4586
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
4587
+ if (!("__vnode" in node)) {
4588
+ Object.defineProperty(node, "__vnode", {
4589
+ value: vnode,
4590
+ enumerable: false
4591
+ });
4592
+ }
4593
+ if (!("__vueParentComponent" in node)) {
4594
+ Object.defineProperty(node, "__vueParentComponent", {
4595
+ value: parentComponent,
4596
+ enumerable: false
4597
+ });
4598
+ }
4599
+ }
4568
4600
  if (patchFlag === -2) {
4569
4601
  optimized = false;
4570
4602
  vnode.dynamicChildren = null;
@@ -4595,15 +4627,15 @@ function createHydrationFunctions(rendererInternals) {
4595
4627
  }
4596
4628
  break;
4597
4629
  case Comment:
4598
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
4599
- if (node.tagName.toLowerCase() === "template") {
4600
- const content = vnode.el.content.firstChild;
4601
- replaceNode(content, node, parentComponent);
4602
- vnode.el = node = content;
4603
- nextNode = nextSibling(node);
4604
- } else {
4605
- nextNode = onMismatch();
4606
- }
4630
+ if (isTemplateNode(node)) {
4631
+ nextNode = nextSibling(node);
4632
+ replaceNode(
4633
+ vnode.el = node.content.firstChild,
4634
+ node,
4635
+ parentComponent
4636
+ );
4637
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
4638
+ nextNode = onMismatch();
4607
4639
  } else {
4608
4640
  nextNode = nextSibling(node);
4609
4641
  }
@@ -4726,15 +4758,16 @@ function createHydrationFunctions(rendererInternals) {
4726
4758
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4727
4759
  optimized = optimized || !!vnode.dynamicChildren;
4728
4760
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4729
- const forcePatchValue = type === "input" && dirs || type === "option";
4730
- if (!!(process.env.NODE_ENV !== "production") || forcePatchValue || patchFlag !== -1) {
4761
+ const forcePatch = type === "input" || type === "option";
4762
+ if (!!(process.env.NODE_ENV !== "production") || forcePatch || patchFlag !== -1) {
4731
4763
  if (dirs) {
4732
4764
  invokeDirectiveHook(vnode, null, parentComponent, "created");
4733
4765
  }
4734
4766
  if (props) {
4735
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
4767
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
4736
4768
  for (const key in props) {
4737
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
4769
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4770
+ key[0] === ".") {
4738
4771
  patchProp(
4739
4772
  el,
4740
4773
  key,
@@ -4947,8 +4980,7 @@ function createHydrationFunctions(rendererInternals) {
4947
4980
  let parent = parentComponent;
4948
4981
  while (parent) {
4949
4982
  if (parent.vnode.el === oldNode) {
4950
- parent.vnode.el = newNode;
4951
- parent.subTree.el = newNode;
4983
+ parent.vnode.el = parent.subTree.el = newNode;
4952
4984
  }
4953
4985
  parent = parent.parent;
4954
4986
  }
@@ -6532,6 +6564,7 @@ const resolveTarget = (props, select) => {
6532
6564
  }
6533
6565
  };
6534
6566
  const TeleportImpl = {
6567
+ name: "Teleport",
6535
6568
  __isTeleport: true,
6536
6569
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
6537
6570
  const {
@@ -6953,7 +6986,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
6953
6986
  if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
6954
6987
  type = toRaw(type);
6955
6988
  warn(
6956
- `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\`.`,
6989
+ `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\`.`,
6957
6990
  `
6958
6991
  Component that was made reactive: `,
6959
6992
  type
@@ -7806,7 +7839,7 @@ function isMemoSame(cached, memo) {
7806
7839
  return true;
7807
7840
  }
7808
7841
 
7809
- const version = "3.4.0-alpha.1";
7842
+ const version = "3.4.0-alpha.2";
7810
7843
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
7811
7844
  const _ssrUtils = {
7812
7845
  createComponentInstance,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.4.0-alpha.1",
3
+ "version": "3.4.0-alpha.2",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.4.0-alpha.1",
36
- "@vue/reactivity": "3.4.0-alpha.1"
35
+ "@vue/shared": "3.4.0-alpha.2",
36
+ "@vue/reactivity": "3.4.0-alpha.2"
37
37
  }
38
38
  }