@vue/runtime-core 3.4.0-alpha.3 → 3.4.0-beta.1

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.
@@ -14,7 +14,7 @@ declare const SlotSymbol: unique symbol;
14
14
  export type SlotsType<T extends Record<string, any> = Record<string, any>> = {
15
15
  [SlotSymbol]?: T;
16
16
  };
17
- type StrictUnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<T>;
17
+ type StrictUnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<T> & T;
18
18
  type UnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<Prettify<{
19
19
  [K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? T[K] : Slot<T[K]>;
20
20
  }>>;
@@ -58,12 +58,15 @@ export declare function queuePostFlushCb(cb: SchedulerJobs): void;
58
58
  export type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
59
59
  export type EmitsOptions = ObjectEmitsOptions | string[];
60
60
  type EmitsToProps<T extends EmitsOptions> = T extends string[] ? {
61
- [K in string & `on${Capitalize<T[number]>}`]?: (...args: any[]) => any;
61
+ [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any;
62
62
  } : T extends ObjectEmitsOptions ? {
63
- [K in string & `on${Capitalize<string & keyof T>}`]?: K extends `on${infer C}` ? T[Uncapitalize<C>] extends null ? (...args: any[]) => any : (...args: T[Uncapitalize<C>] extends (...args: infer P) => any ? P : never) => any : never;
63
+ [K in `on${Capitalize<string & keyof T>}`]?: K extends `on${infer C}` ? (...args: T[Uncapitalize<C>] extends (...args: infer P) => any ? P : T[Uncapitalize<C>] extends null ? any[] : never) => any : never;
64
64
  } : {};
65
+ type ShortEmitsToObject<E> = E extends Record<string, any[]> ? {
66
+ [K in keyof E]: (...args: E[K]) => any;
67
+ } : E;
65
68
  type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options> = Options extends Array<infer V> ? (event: V, ...args: any[]) => void : {} extends Options ? (event: string, ...args: any[]) => void : UnionToIntersection<{
66
- [key in Event]: Options[key] extends (...args: infer Args) => any ? (event: key, ...args: Args) => void : (event: key, ...args: any[]) => void;
69
+ [key in Event]: Options[key] extends (...args: infer Args) => any ? (event: key, ...args: Args) => void : Options[key] extends any[] ? (event: key, ...args: Options[key]) => void : (event: key, ...args: any[]) => void;
67
70
  }[Event]>;
68
71
 
69
72
  /**
@@ -128,7 +131,7 @@ C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOpt
128
131
  $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
132
  } & IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B>>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>;
130
133
 
131
- declare const enum LifecycleHooks {
134
+ declare enum LifecycleHooks {
132
135
  BEFORE_CREATE = "bc",
133
136
  CREATED = "c",
134
137
  BEFORE_MOUNT = "bm",
@@ -160,7 +163,7 @@ export interface SuspenseProps {
160
163
  declare const SuspenseImpl: {
161
164
  name: string;
162
165
  __isSuspense: boolean;
163
- process(n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, isSVG: boolean, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals): void;
166
+ process(n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals): void;
164
167
  hydrate: typeof hydrateSuspense;
165
168
  create: typeof createSuspenseBoundary;
166
169
  normalize: typeof normalizeSuspenseChildren;
@@ -179,7 +182,7 @@ export interface SuspenseBoundary {
179
182
  vnode: VNode<RendererNode, RendererElement, SuspenseProps>;
180
183
  parent: SuspenseBoundary | null;
181
184
  parentComponent: ComponentInternalInstance | null;
182
- isSVG: boolean;
185
+ namespace: ElementNamespace;
183
186
  container: RendererElement;
184
187
  hiddenContainer: RendererElement;
185
188
  anchor: RendererNode | null;
@@ -199,8 +202,8 @@ export interface SuspenseBoundary {
199
202
  registerDep(instance: ComponentInternalInstance, setupRenderEffect: SetupRenderEffectFn): void;
200
203
  unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void;
201
204
  }
202
- declare function createSuspenseBoundary(vnode: VNode, parentSuspense: SuspenseBoundary | null, parentComponent: ComponentInternalInstance | null, container: RendererElement, hiddenContainer: RendererElement, anchor: RendererNode | null, isSVG: boolean, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, isHydrating?: boolean): SuspenseBoundary;
203
- declare function hydrateSuspense(node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, isSVG: boolean, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, hydrateNode: (node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
205
+ declare function createSuspenseBoundary(vnode: VNode, parentSuspense: SuspenseBoundary | null, parentComponent: ComponentInternalInstance | null, container: RendererElement, hiddenContainer: RendererElement, anchor: RendererNode | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, isHydrating?: boolean): SuspenseBoundary;
206
+ declare function hydrateSuspense(node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, hydrateNode: (node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
204
207
  declare function normalizeSuspenseChildren(vnode: VNode): void;
205
208
 
206
209
  export type RootHydrateFunction = (vnode: VNode<Node, Element>, container: (Element | ShadowRoot) & {
@@ -277,12 +280,13 @@ export interface Renderer<HostElement = RendererElement> {
277
280
  export interface HydrationRenderer extends Renderer<Element | ShadowRoot> {
278
281
  hydrate: RootHydrateFunction;
279
282
  }
280
- export type RootRenderFunction<HostElement = RendererElement> = (vnode: VNode | null, container: HostElement, isSVG?: boolean) => void;
283
+ export type ElementNamespace = 'svg' | 'mathml' | undefined;
284
+ export type RootRenderFunction<HostElement = RendererElement> = (vnode: VNode | null, container: HostElement, namespace?: ElementNamespace) => void;
281
285
  export interface RendererOptions<HostNode = RendererNode, HostElement = RendererElement> {
282
- patchProp(el: HostElement, key: string, prevValue: any, nextValue: any, isSVG?: boolean, prevChildren?: VNode<HostNode, HostElement>[], parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, unmountChildren?: UnmountChildrenFn): void;
286
+ patchProp(el: HostElement, key: string, prevValue: any, nextValue: any, namespace?: ElementNamespace, prevChildren?: VNode<HostNode, HostElement>[], parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, unmountChildren?: UnmountChildrenFn): void;
283
287
  insert(el: HostNode, parent: HostElement, anchor?: HostNode | null): void;
284
288
  remove(el: HostNode): void;
285
- createElement(type: string, isSVG?: boolean, isCustomizedBuiltIn?: string, vnodeProps?: (VNodeProps & {
289
+ createElement(type: string, namespace?: ElementNamespace, isCustomizedBuiltIn?: string, vnodeProps?: (VNodeProps & {
286
290
  [key: string]: any;
287
291
  }) | null): HostElement;
288
292
  createText(text: string): HostNode;
@@ -294,7 +298,7 @@ export interface RendererOptions<HostNode = RendererNode, HostElement = Renderer
294
298
  querySelector?(selector: string): HostElement | null;
295
299
  setScopeId?(el: HostElement, id: string): void;
296
300
  cloneNode?(node: HostNode): HostNode;
297
- insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, isSVG: boolean, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode];
301
+ insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, namespace: ElementNamespace, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode];
298
302
  }
299
303
  export interface RendererNode {
300
304
  [key: string]: any;
@@ -314,18 +318,18 @@ interface RendererInternals<HostNode = RendererNode, HostElement = RendererEleme
314
318
  o: RendererOptions<HostNode, HostElement>;
315
319
  }
316
320
  type PatchFn = (n1: VNode | null, // null means this is a mount
317
- n2: VNode, container: RendererElement, anchor?: RendererNode | null, parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, isSVG?: boolean, slotScopeIds?: string[] | null, optimized?: boolean) => void;
318
- type MountChildrenFn = (children: VNodeArrayChildren, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, isSVG: boolean, slotScopeIds: string[] | null, optimized: boolean, start?: number) => void;
319
- type PatchChildrenFn = (n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, isSVG: boolean, slotScopeIds: string[] | null, optimized: boolean) => void;
320
- type PatchBlockChildrenFn = (oldChildren: VNode[], newChildren: VNode[], fallbackContainer: RendererElement, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, isSVG: boolean, slotScopeIds: string[] | null) => void;
321
+ n2: VNode, container: RendererElement, anchor?: RendererNode | null, parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, namespace?: ElementNamespace, slotScopeIds?: string[] | null, optimized?: boolean) => void;
322
+ type MountChildrenFn = (children: VNodeArrayChildren, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, start?: number) => void;
323
+ type PatchChildrenFn = (n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean) => void;
324
+ type PatchBlockChildrenFn = (oldChildren: VNode[], newChildren: VNode[], fallbackContainer: RendererElement, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null) => void;
321
325
  type MoveFn = (vnode: VNode, container: RendererElement, anchor: RendererNode | null, type: MoveType, parentSuspense?: SuspenseBoundary | null) => void;
322
326
  type NextFn = (vnode: VNode) => RendererNode | null;
323
327
  type UnmountFn = (vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean) => void;
324
328
  type RemoveFn = (vnode: VNode) => void;
325
329
  type UnmountChildrenFn = (children: VNode[], parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean, start?: number) => void;
326
- type MountComponentFn = (initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, isSVG: boolean, optimized: boolean) => void;
327
- type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, isSVG: boolean, optimized: boolean) => void;
328
- declare const enum MoveType {
330
+ type MountComponentFn = (initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
331
+ type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
332
+ declare enum MoveType {
329
333
  ENTER = 0,
330
334
  LEAVE = 1,
331
335
  REORDER = 2
@@ -389,7 +393,7 @@ interface PropOptions<T = any, D = T> {
389
393
  type?: PropType<T> | true | null;
390
394
  required?: boolean;
391
395
  default?: D | DefaultFactory<D> | null | undefined | object;
392
- validator?(value: unknown): boolean;
396
+ validator?(value: unknown, props: Data): boolean;
393
397
  }
394
398
  export type PropType<T> = PropConstructor<T> | PropConstructor<T>[];
395
399
  type PropConstructor<T = any> = {
@@ -514,7 +518,7 @@ export type DirectiveArguments = Array<[Directive | undefined] | [Directive | un
514
518
  */
515
519
  export declare function withDirectives<T extends VNode>(vnode: T, directives: DirectiveArguments): T;
516
520
 
517
- export declare const enum DeprecationTypes {
521
+ declare enum DeprecationTypes$1 {
518
522
  GLOBAL_MOUNT = "GLOBAL_MOUNT",
519
523
  GLOBAL_MOUNT_CONTAINER = "GLOBAL_MOUNT_CONTAINER",
520
524
  GLOBAL_EXTEND = "GLOBAL_EXTEND",
@@ -558,7 +562,7 @@ export declare const enum DeprecationTypes {
558
562
  FILTERS = "FILTERS",
559
563
  PRIVATE_APIS = "PRIVATE_APIS"
560
564
  }
561
- type CompatConfig = Partial<Record<DeprecationTypes, boolean | 'suppress-warning'>> & {
565
+ type CompatConfig = Partial<Record<DeprecationTypes$1, boolean | 'suppress-warning'>> & {
562
566
  MODE?: 2 | 3 | ((comp: Component | null) => 2 | 3);
563
567
  };
564
568
  declare function configureCompat(config: CompatConfig): void;
@@ -737,7 +741,7 @@ export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T
737
741
  */
738
742
  export declare function hasInjectionContext(): boolean;
739
743
 
740
- type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
744
+ export type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
741
745
  type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
742
746
  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
747
  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'> & {
@@ -764,9 +768,9 @@ export interface App<HostElement = any> {
764
768
  mixin(mixin: ComponentOptions): this;
765
769
  component(name: string): Component | undefined;
766
770
  component(name: string, component: Component | DefineComponent): this;
767
- directive(name: string): Directive | undefined;
768
- directive(name: string, directive: Directive): this;
769
- mount(rootContainer: HostElement | string, isHydrate?: boolean, isSVG?: boolean): ComponentPublicInstance;
771
+ directive<T = any, V = any>(name: string): Directive<T, V> | undefined;
772
+ directive<T = any, V = any>(name: string, directive: Directive<T, V>): this;
773
+ mount(rootContainer: HostElement | string, isHydrate?: boolean, namespace?: boolean | ElementNamespace): ComponentPublicInstance;
770
774
  unmount(): void;
771
775
  provide<T>(key: InjectionKey<T> | string, value: T): this;
772
776
  /**
@@ -805,11 +809,6 @@ export interface AppConfig {
805
809
  * @deprecated use config.compilerOptions.isCustomElement
806
810
  */
807
811
  isCustomElement?: (tag: string) => boolean;
808
- /**
809
- * Temporary config for opt-in to unwrap injected refs.
810
- * @deprecated this no longer has effect. 3.3 always unwraps injected refs.
811
- */
812
- unwrapInjectedRef?: boolean;
813
812
  }
814
813
  export interface AppContext {
815
814
  app: App;
@@ -819,12 +818,12 @@ export interface AppContext {
819
818
  directives: Record<string, Directive>;
820
819
  provides: Record<string | symbol, any>;
821
820
  }
822
- type PluginInstallFunction<Options> = Options extends unknown[] ? (app: App, ...options: Options) => any : (app: App, options: Options) => any;
823
- export type Plugin<Options = any[]> = (PluginInstallFunction<Options> & {
824
- install?: PluginInstallFunction<Options>;
825
- }) | {
821
+ type PluginInstallFunction<Options = any[]> = Options extends unknown[] ? (app: App, ...options: Options) => any : (app: App, options: Options) => any;
822
+ export type ObjectPlugin<Options = any[]> = {
826
823
  install: PluginInstallFunction<Options>;
827
824
  };
825
+ export type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> & Partial<ObjectPlugin<Options>>;
826
+ export type Plugin<Options = any[]> = FunctionPlugin<Options> | ObjectPlugin<Options>;
828
827
  export type CreateAppFunction<HostElement> = (rootComponent: Component, rootProps?: Data | null) => App<HostElement>;
829
828
 
830
829
  type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>;
@@ -835,12 +834,12 @@ export interface TeleportProps {
835
834
  declare const TeleportImpl: {
836
835
  name: string;
837
836
  __isTeleport: boolean;
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;
837
+ process(n1: TeleportVNode | null, n2: TeleportVNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, internals: RendererInternals): void;
839
838
  remove(vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, optimized: boolean, { um: unmount, o: { remove: hostRemove } }: RendererInternals, doRemove: boolean): void;
840
839
  move: typeof moveTeleport;
841
840
  hydrate: typeof hydrateTeleport;
842
841
  };
843
- declare const enum TeleportMoveTypes {
842
+ declare enum TeleportMoveTypes {
844
843
  TARGET_CHANGE = 0,
845
844
  TOGGLE = 1,
846
845
  REORDER = 2
@@ -1012,6 +1011,21 @@ export declare function createCommentVNode(text?: string, asBlock?: boolean): VN
1012
1011
  export declare function mergeProps(...args: (Data & VNodeProps)[]): Data;
1013
1012
 
1014
1013
  type Data = Record<string, unknown>;
1014
+ /**
1015
+ * Public utility type for extracting the instance type of a component.
1016
+ * Works with all valid component definition types. This is intended to replace
1017
+ * the usage of `InstanceType<typeof Comp>` which only works for
1018
+ * constructor-based component definition types.
1019
+ *
1020
+ * Exmaple:
1021
+ * ```ts
1022
+ * const MyComp = { ... }
1023
+ * declare const instance: ComponentInstance<typeof MyComp>
1024
+ * ```
1025
+ */
1026
+ export type ComponentInstance<T> = T extends {
1027
+ new (): ComponentPublicInstance;
1028
+ } ? InstanceType<T> : T extends FunctionalComponent<infer Props, infer Emits> ? ComponentPublicInstance<Props, {}, {}, {}, {}, ShortEmitsToObject<Emits>> : T extends Component<infer Props, infer RawBindings, infer D, infer C, infer M> ? ComponentPublicInstance<unknown extends Props ? {} : Props, unknown extends RawBindings ? {} : RawBindings, unknown extends D ? {} : D, C, M> : never;
1015
1029
  /**
1016
1030
  * For extending allowed non-declared props on components in TSX
1017
1031
  */
@@ -1038,10 +1052,10 @@ interface ComponentInternalOptions {
1038
1052
  */
1039
1053
  __name?: string;
1040
1054
  }
1041
- export interface FunctionalComponent<P = {}, E extends EmitsOptions = {}, S extends Record<string, any> = any> extends ComponentInternalOptions {
1042
- (props: P, ctx: Omit<SetupContext<E, IfAny<S, {}, SlotsType<S>>>, 'expose'>): any;
1055
+ export interface FunctionalComponent<P = {}, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any, EE extends EmitsOptions = ShortEmitsToObject<E>> extends ComponentInternalOptions {
1056
+ (props: P & EmitsToProps<EE>, ctx: Omit<SetupContext<EE, IfAny<S, {}, SlotsType<S>>>, 'expose'>): any;
1043
1057
  props?: ComponentPropsOptions<P>;
1044
- emits?: E | (keyof E)[];
1058
+ emits?: EE | (keyof EE)[];
1045
1059
  slots?: IfAny<S, Slots, SlotsType<S>>;
1046
1060
  inheritAttrs?: boolean;
1047
1061
  displayName?: string;
@@ -1057,12 +1071,12 @@ interface ClassComponent {
1057
1071
  * values, e.g. checking if its a function or not. This is mostly for internal
1058
1072
  * implementation code.
1059
1073
  */
1060
- export type ConcreteComponent<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions> = ComponentOptions<Props, RawBindings, D, C, M> | FunctionalComponent<Props, any>;
1074
+ export type ConcreteComponent<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any> = ComponentOptions<Props, RawBindings, D, C, M> | FunctionalComponent<Props, E, S>;
1061
1075
  /**
1062
1076
  * A type used in public APIs where a component type is expected.
1063
1077
  * The constructor type is an artificial type returned by defineComponent().
1064
1078
  */
1065
- export type Component<Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions> = ConcreteComponent<Props, RawBindings, D, C, M> | ComponentPublicInstanceConstructor<Props>;
1079
+ export type Component<Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any> = ConcreteComponent<Props, RawBindings, D, C, M, E, S> | ComponentPublicInstanceConstructor<Props>;
1066
1080
 
1067
1081
  export type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends any ? {
1068
1082
  attrs: Data;
@@ -1187,9 +1201,9 @@ export declare function defineAsyncComponent<T extends Component = {
1187
1201
  * foo?: string
1188
1202
  * bar: number
1189
1203
  * }>()
1204
+ * ```
1190
1205
  *
1191
1206
  * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
1192
- * ```
1193
1207
  *
1194
1208
  * This is only usable inside `<script setup>`, is compiled away in the
1195
1209
  * output and should **not** be actually called at runtime.
@@ -1199,7 +1213,7 @@ export declare function defineProps<PropNames extends string = string>(props: Pr
1199
1213
  }>>;
1200
1214
  export declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
1201
1215
  export declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
1202
- type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
1216
+ export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
1203
1217
  readonly [K in BKeys]-?: boolean;
1204
1218
  };
1205
1219
  type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
@@ -1215,8 +1229,9 @@ type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends
1215
1229
  * Example type-based declaration:
1216
1230
  * ```ts
1217
1231
  * const emit = defineEmits<{
1218
- * (event: 'change'): void
1219
- * (event: 'update', id: number): void
1232
+ * // <eventName>: <expected arguments>
1233
+ * change: []
1234
+ * update: [value: string] // named tuple syntax
1220
1235
  * }>()
1221
1236
  *
1222
1237
  * emit('change')
@@ -1264,7 +1279,7 @@ export declare function defineOptions<RawBindings = {}, D = {}, C extends Comput
1264
1279
  }): void;
1265
1280
  export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
1266
1281
  /**
1267
- * (**Experimental**) Vue `<script setup>` compiler macro for declaring a
1282
+ * Vue `<script setup>` compiler macro for declaring a
1268
1283
  * two-way binding prop that can be consumed via `v-model` from the parent
1269
1284
  * component. This will declare a prop with the same name and a corresponding
1270
1285
  * `update:propName` event.
@@ -1273,9 +1288,11 @@ export declare function defineSlots<S extends Record<string, any> = Record<strin
1273
1288
  * Otherwise the prop name will default to "modelValue". In both cases, you
1274
1289
  * can also pass an additional object which will be used as the prop's options.
1275
1290
  *
1276
- * The options object can also specify an additional option, `local`. When set
1277
- * to `true`, the ref can be locally mutated even if the parent did not pass
1278
- * the matching `v-model`.
1291
+ * The the returned ref behaves differently depending on whether the parent
1292
+ * provided the corresponding v-model props or not:
1293
+ * - If yes, the returned ref's value will always be in sync with the parent
1294
+ * prop.
1295
+ * - If not, the returned ref will behave like a normal local ref.
1279
1296
  *
1280
1297
  * @example
1281
1298
  * ```ts
@@ -1292,29 +1309,22 @@ export declare function defineSlots<S extends Record<string, any> = Record<strin
1292
1309
  *
1293
1310
  * // with specified name and default value
1294
1311
  * const count = defineModel<number>('count', { default: 0 })
1295
- *
1296
- * // local mutable model, can be mutated locally
1297
- * // even if the parent did not pass the matching `v-model`.
1298
- * const count = defineModel<number>('count', { local: true, default: 0 })
1299
1312
  * ```
1300
1313
  */
1301
1314
  export declare function defineModel<T>(options: {
1302
1315
  required: true;
1303
- } & PropOptions<T> & DefineModelOptions): Ref<T>;
1316
+ } & PropOptions<T>): Ref<T>;
1304
1317
  export declare function defineModel<T>(options: {
1305
1318
  default: any;
1306
- } & PropOptions<T> & DefineModelOptions): Ref<T>;
1307
- export declare function defineModel<T>(options?: PropOptions<T> & DefineModelOptions): Ref<T | undefined>;
1319
+ } & PropOptions<T>): Ref<T>;
1320
+ export declare function defineModel<T>(options?: PropOptions<T>): Ref<T | undefined>;
1308
1321
  export declare function defineModel<T>(name: string, options: {
1309
1322
  required: true;
1310
- } & PropOptions<T> & DefineModelOptions): Ref<T>;
1323
+ } & PropOptions<T>): Ref<T>;
1311
1324
  export declare function defineModel<T>(name: string, options: {
1312
1325
  default: any;
1313
- } & PropOptions<T> & DefineModelOptions): Ref<T>;
1314
- export declare function defineModel<T>(name: string, options?: PropOptions<T> & DefineModelOptions): Ref<T | undefined>;
1315
- interface DefineModelOptions {
1316
- local?: boolean;
1317
- }
1326
+ } & PropOptions<T>): Ref<T>;
1327
+ export declare function defineModel<T>(name: string, options?: PropOptions<T>): Ref<T | undefined>;
1318
1328
  type NotUndefined<T> = T extends undefined ? never : T;
1319
1329
  type InferDefaults<T> = {
1320
1330
  [K in keyof T]?: InferDefault<T, T[K]>;
@@ -1349,9 +1359,7 @@ type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof
1349
1359
  export declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
1350
1360
  export declare function useSlots(): SetupContext['slots'];
1351
1361
  export declare function useAttrs(): SetupContext['attrs'];
1352
- export declare function useModel<T extends Record<string, any>, K extends keyof T>(props: T, name: K, options?: {
1353
- local?: boolean;
1354
- }): Ref<T[K]>;
1362
+ export declare function useModel<T extends Record<string, any>, K extends keyof T>(props: T, name: K): Ref<T[K]>;
1355
1363
 
1356
1364
  type RawProps = VNodeProps & {
1357
1365
  __v_isVNode?: never;
@@ -1366,6 +1374,11 @@ interface Constructor<P = any> {
1366
1374
  $props: P;
1367
1375
  };
1368
1376
  }
1377
+ type HTMLElementEventHandler = {
1378
+ [K in keyof HTMLElementEventMap as `on${Capitalize<K>}`]?: (ev: HTMLElementEventMap[K]) => any;
1379
+ };
1380
+ export declare function h<K extends keyof HTMLElementTagNameMap>(type: K, children?: RawChildren): VNode;
1381
+ export declare function h<K extends keyof HTMLElementTagNameMap>(type: K, props?: (RawProps & HTMLElementEventHandler) | null, children?: RawChildren | RawSlots): VNode;
1369
1382
  export declare function h(type: string, children?: RawChildren): VNode;
1370
1383
  export declare function h(type: string, props?: RawProps | null, children?: RawChildren | RawSlots): VNode;
1371
1384
  export declare function h(type: typeof Text | typeof Comment, children?: string | number | boolean): VNode;
@@ -1393,7 +1406,7 @@ export declare const useSSRContext: <T = Record<string, any>>() => T | undefined
1393
1406
 
1394
1407
  export declare function warn(msg: string, ...args: any[]): void;
1395
1408
 
1396
- export declare const enum ErrorCodes {
1409
+ export declare enum ErrorCodes {
1397
1410
  SETUP_FUNCTION = 0,
1398
1411
  RENDER_FUNCTION = 1,
1399
1412
  WATCH_GETTER = 2,
@@ -1578,8 +1591,8 @@ export type CompatVue = Pick<App, 'version' | 'component' | 'directive'> & {
1578
1591
  mixin(mixin: ComponentOptions): CompatVue;
1579
1592
  component(name: string): Component | undefined;
1580
1593
  component(name: string, component: Component): CompatVue;
1581
- directive(name: string): Directive | undefined;
1582
- directive(name: string, directive: Directive): CompatVue;
1594
+ directive<T = any, V = any>(name: string): Directive<T, V> | undefined;
1595
+ directive<T = any, V = any>(name: string, directive: Directive<T, V>): CompatVue;
1583
1596
  compile(template: string): RenderFunction;
1584
1597
  /**
1585
1598
  * @deprecated Vue 3 no longer supports extending constructors.
@@ -1613,6 +1626,8 @@ declare module '@vue/reactivity' {
1613
1626
  }
1614
1627
  }
1615
1628
 
1629
+ export declare const DeprecationTypes: typeof DeprecationTypes$1;
1630
+
1616
1631
  export { createBaseVNode as createElementVNode, };
1617
1632
  // Note: this file is auto concatenated to the end of the bundled d.ts during
1618
1633
  // build.