@vue/runtime-core 3.4.0-alpha.4 → 3.4.0-beta.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.
@@ -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
  /**
@@ -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,17 +318,17 @@ 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;
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;
328
332
  declare enum MoveType {
329
333
  ENTER = 0,
330
334
  LEAVE = 1,
@@ -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> = {
@@ -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
  /**
@@ -814,12 +818,12 @@ export interface AppContext {
814
818
  directives: Record<string, Directive>;
815
819
  provides: Record<string | symbol, any>;
816
820
  }
817
- type PluginInstallFunction<Options> = Options extends unknown[] ? (app: App, ...options: Options) => any : (app: App, options: Options) => any;
818
- export type Plugin<Options = any[]> = (PluginInstallFunction<Options> & {
819
- install?: PluginInstallFunction<Options>;
820
- }) | {
821
+ type PluginInstallFunction<Options = any[]> = Options extends unknown[] ? (app: App, ...options: Options) => any : (app: App, options: Options) => any;
822
+ export type ObjectPlugin<Options = any[]> = {
821
823
  install: PluginInstallFunction<Options>;
822
824
  };
825
+ export type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> & Partial<ObjectPlugin<Options>>;
826
+ export type Plugin<Options = any[]> = FunctionPlugin<Options> | ObjectPlugin<Options>;
823
827
  export type CreateAppFunction<HostElement> = (rootComponent: Component, rootProps?: Data | null) => App<HostElement>;
824
828
 
825
829
  type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>;
@@ -830,7 +834,7 @@ export interface TeleportProps {
830
834
  declare const TeleportImpl: {
831
835
  name: string;
832
836
  __isTeleport: boolean;
833
- 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;
834
838
  remove(vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, optimized: boolean, { um: unmount, o: { remove: hostRemove } }: RendererInternals, doRemove: boolean): void;
835
839
  move: typeof moveTeleport;
836
840
  hydrate: typeof hydrateTeleport;
@@ -1007,6 +1011,21 @@ export declare function createCommentVNode(text?: string, asBlock?: boolean): VN
1007
1011
  export declare function mergeProps(...args: (Data & VNodeProps)[]): Data;
1008
1012
 
1009
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;
1010
1029
  /**
1011
1030
  * For extending allowed non-declared props on components in TSX
1012
1031
  */
@@ -1033,10 +1052,10 @@ interface ComponentInternalOptions {
1033
1052
  */
1034
1053
  __name?: string;
1035
1054
  }
1036
- export interface FunctionalComponent<P = {}, E extends EmitsOptions = {}, S extends Record<string, any> = any> extends ComponentInternalOptions {
1037
- (props: P & EmitsToProps<E>, 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;
1038
1057
  props?: ComponentPropsOptions<P>;
1039
- emits?: E | (keyof E)[];
1058
+ emits?: EE | (keyof EE)[];
1040
1059
  slots?: IfAny<S, Slots, SlotsType<S>>;
1041
1060
  inheritAttrs?: boolean;
1042
1061
  displayName?: string;
@@ -1052,12 +1071,12 @@ interface ClassComponent {
1052
1071
  * values, e.g. checking if its a function or not. This is mostly for internal
1053
1072
  * implementation code.
1054
1073
  */
1055
- 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>;
1056
1075
  /**
1057
1076
  * A type used in public APIs where a component type is expected.
1058
1077
  * The constructor type is an artificial type returned by defineComponent().
1059
1078
  */
1060
- 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>;
1061
1080
 
1062
1081
  export type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends any ? {
1063
1082
  attrs: Data;
@@ -1182,9 +1201,9 @@ export declare function defineAsyncComponent<T extends Component = {
1182
1201
  * foo?: string
1183
1202
  * bar: number
1184
1203
  * }>()
1204
+ * ```
1185
1205
  *
1186
1206
  * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
1187
- * ```
1188
1207
  *
1189
1208
  * This is only usable inside `<script setup>`, is compiled away in the
1190
1209
  * output and should **not** be actually called at runtime.
@@ -1194,7 +1213,7 @@ export declare function defineProps<PropNames extends string = string>(props: Pr
1194
1213
  }>>;
1195
1214
  export declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
1196
1215
  export declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
1197
- type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
1216
+ export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
1198
1217
  readonly [K in BKeys]-?: boolean;
1199
1218
  };
1200
1219
  type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
@@ -1210,8 +1229,9 @@ type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends
1210
1229
  * Example type-based declaration:
1211
1230
  * ```ts
1212
1231
  * const emit = defineEmits<{
1213
- * (event: 'change'): void
1214
- * (event: 'update', id: number): void
1232
+ * // <eventName>: <expected arguments>
1233
+ * change: []
1234
+ * update: [value: string] // named tuple syntax
1215
1235
  * }>()
1216
1236
  *
1217
1237
  * emit('change')
@@ -1259,7 +1279,7 @@ export declare function defineOptions<RawBindings = {}, D = {}, C extends Comput
1259
1279
  }): void;
1260
1280
  export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
1261
1281
  /**
1262
- * (**Experimental**) Vue `<script setup>` compiler macro for declaring a
1282
+ * Vue `<script setup>` compiler macro for declaring a
1263
1283
  * two-way binding prop that can be consumed via `v-model` from the parent
1264
1284
  * component. This will declare a prop with the same name and a corresponding
1265
1285
  * `update:propName` event.
@@ -1268,9 +1288,11 @@ export declare function defineSlots<S extends Record<string, any> = Record<strin
1268
1288
  * Otherwise the prop name will default to "modelValue". In both cases, you
1269
1289
  * can also pass an additional object which will be used as the prop's options.
1270
1290
  *
1271
- * The options object can also specify an additional option, `local`. When set
1272
- * to `true`, the ref can be locally mutated even if the parent did not pass
1273
- * 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.
1274
1296
  *
1275
1297
  * @example
1276
1298
  * ```ts
@@ -1287,29 +1309,22 @@ export declare function defineSlots<S extends Record<string, any> = Record<strin
1287
1309
  *
1288
1310
  * // with specified name and default value
1289
1311
  * const count = defineModel<number>('count', { default: 0 })
1290
- *
1291
- * // local mutable model, can be mutated locally
1292
- * // even if the parent did not pass the matching `v-model`.
1293
- * const count = defineModel<number>('count', { local: true, default: 0 })
1294
1312
  * ```
1295
1313
  */
1296
1314
  export declare function defineModel<T>(options: {
1297
1315
  required: true;
1298
- } & PropOptions<T> & DefineModelOptions): Ref<T>;
1316
+ } & PropOptions<T>): Ref<T>;
1299
1317
  export declare function defineModel<T>(options: {
1300
1318
  default: any;
1301
- } & PropOptions<T> & DefineModelOptions): Ref<T>;
1302
- 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>;
1303
1321
  export declare function defineModel<T>(name: string, options: {
1304
1322
  required: true;
1305
- } & PropOptions<T> & DefineModelOptions): Ref<T>;
1323
+ } & PropOptions<T>): Ref<T>;
1306
1324
  export declare function defineModel<T>(name: string, options: {
1307
1325
  default: any;
1308
- } & PropOptions<T> & DefineModelOptions): Ref<T>;
1309
- export declare function defineModel<T>(name: string, options?: PropOptions<T> & DefineModelOptions): Ref<T | undefined>;
1310
- interface DefineModelOptions {
1311
- local?: boolean;
1312
- }
1326
+ } & PropOptions<T>): Ref<T>;
1327
+ export declare function defineModel<T>(name: string, options?: PropOptions<T>): Ref<T | undefined>;
1313
1328
  type NotUndefined<T> = T extends undefined ? never : T;
1314
1329
  type InferDefaults<T> = {
1315
1330
  [K in keyof T]?: InferDefault<T, T[K]>;
@@ -1344,9 +1359,7 @@ type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof
1344
1359
  export declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
1345
1360
  export declare function useSlots(): SetupContext['slots'];
1346
1361
  export declare function useAttrs(): SetupContext['attrs'];
1347
- export declare function useModel<T extends Record<string, any>, K extends keyof T>(props: T, name: K, options?: {
1348
- local?: boolean;
1349
- }): Ref<T[K]>;
1362
+ export declare function useModel<T extends Record<string, any>, K extends keyof T>(props: T, name: K): Ref<T[K]>;
1350
1363
 
1351
1364
  type RawProps = VNodeProps & {
1352
1365
  __v_isVNode?: never;
@@ -1361,6 +1374,11 @@ interface Constructor<P = any> {
1361
1374
  $props: P;
1362
1375
  };
1363
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;
1364
1382
  export declare function h(type: string, children?: RawChildren): VNode;
1365
1383
  export declare function h(type: string, props?: RawProps | null, children?: RawChildren | RawSlots): VNode;
1366
1384
  export declare function h(type: typeof Text | typeof Comment, children?: string | number | boolean): VNode;
@@ -1573,8 +1591,8 @@ export type CompatVue = Pick<App, 'version' | 'component' | 'directive'> & {
1573
1591
  mixin(mixin: ComponentOptions): CompatVue;
1574
1592
  component(name: string): Component | undefined;
1575
1593
  component(name: string, component: Component): CompatVue;
1576
- directive(name: string): Directive | undefined;
1577
- 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;
1578
1596
  compile(template: string): RenderFunction;
1579
1597
  /**
1580
1598
  * @deprecated Vue 3 no longer supports extending constructors.