@vue/runtime-core 3.4.26 → 3.5.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.
@@ -1,6 +1,6 @@
1
- import { computed as computed$1, ShallowUnwrapRef, UnwrapNestedRefs, DebuggerEvent, ComputedGetter, WritableComputedOptions, Ref, ReactiveEffect, ComputedRef, DebuggerOptions, reactive } from '@vue/reactivity';
1
+ import { computed as computed$1, Ref, ShallowUnwrapRef, UnwrapNestedRefs, DebuggerEvent, ComputedGetter, WritableComputedOptions, ReactiveEffect, ComputedRef, DebuggerOptions, reactive } from '@vue/reactivity';
2
2
  export { ComputedGetter, ComputedRef, ComputedSetter, CustomRefFactory, DebuggerEvent, DebuggerEventExtraInfo, DebuggerOptions, DeepReadonly, EffectScheduler, EffectScope, MaybeRef, MaybeRefOrGetter, Raw, ReactiveEffect, ReactiveEffectOptions, ReactiveEffectRunner, ReactiveFlags, Ref, ShallowReactive, ShallowRef, ShallowUnwrapRef, ToRef, ToRefs, TrackOpTypes, TriggerOpTypes, UnwrapNestedRefs, UnwrapRef, WritableComputedOptions, WritableComputedRef, 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 { IfAny, Prettify, Awaited, UnionToIntersection, LooseRequired } from '@vue/shared';
3
+ import { IfAny, Prettify, Awaited, LooseRequired, UnionToIntersection, OverloadParameters } from '@vue/shared';
4
4
  export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
5
5
 
6
6
  export declare const computed: typeof computed$1;
@@ -23,11 +23,9 @@ type RawSlots = {
23
23
  $stable?: boolean;
24
24
  };
25
25
 
26
- interface SchedulerJob extends Function {
27
- id?: number;
28
- pre?: boolean;
29
- active?: boolean;
30
- computed?: boolean;
26
+ declare enum SchedulerJobFlags {
27
+ QUEUED = 1,
28
+ PRE = 2,
31
29
  /**
32
30
  * Indicates whether the effect is allowed to recursively trigger itself
33
31
  * when managed by the scheduler.
@@ -43,7 +41,16 @@ interface SchedulerJob extends Function {
43
41
  * responsibility to perform recursive state mutation that eventually
44
42
  * stabilizes (#1727).
45
43
  */
46
- allowRecurse?: boolean;
44
+ ALLOW_RECURSE = 4,
45
+ DISPOSED = 8
46
+ }
47
+ interface SchedulerJob extends Function {
48
+ id?: number;
49
+ /**
50
+ * flags can technically be undefined, but it can still be used in bitwise
51
+ * operations just like 0.
52
+ */
53
+ flags?: SchedulerJobFlags;
47
54
  /**
48
55
  * Attached by renderer.ts when setting up a component's render effect
49
56
  * Used to obtain component information when reporting max recursive updates.
@@ -55,13 +62,320 @@ type SchedulerJobs = SchedulerJob | SchedulerJob[];
55
62
  export declare function nextTick<T = void, R = void>(this: T, fn?: (this: T) => R): Promise<Awaited<R>>;
56
63
  export declare function queuePostFlushCb(cb: SchedulerJobs): void;
57
64
 
65
+ export type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
66
+ export type ComponentObjectPropsOptions<P = Data> = {
67
+ [K in keyof P]: Prop<P[K]> | null;
68
+ };
69
+ export type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
70
+ type DefaultFactory<T> = (props: Data) => T | null | undefined;
71
+ interface PropOptions<T = any, D = T> {
72
+ type?: PropType<T> | true | null;
73
+ required?: boolean;
74
+ default?: D | DefaultFactory<D> | null | undefined | object;
75
+ validator?(value: unknown, props: Data): boolean;
76
+ }
77
+ export type PropType<T> = PropConstructor<T> | (PropConstructor<T> | null)[];
78
+ type PropConstructor<T = any> = {
79
+ new (...args: any[]): T & {};
80
+ } | {
81
+ (): T;
82
+ } | PropMethod<T>;
83
+ type PropMethod<T, TConstructor = any> = [T] extends [
84
+ ((...args: any) => any) | undefined
85
+ ] ? {
86
+ new (): TConstructor;
87
+ (): T;
88
+ readonly prototype: TConstructor;
89
+ } : never;
90
+ type RequiredKeys<T> = {
91
+ [K in keyof T]: T[K] extends {
92
+ required: true;
93
+ } | {
94
+ default: any;
95
+ } | BooleanConstructor | {
96
+ type: BooleanConstructor;
97
+ } ? T[K] extends {
98
+ default: undefined | (() => undefined);
99
+ } ? never : K : never;
100
+ }[keyof T];
101
+ type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
102
+ type DefaultKeys<T> = {
103
+ [K in keyof T]: T[K] extends {
104
+ default: any;
105
+ } | BooleanConstructor | {
106
+ type: BooleanConstructor;
107
+ } ? T[K] extends {
108
+ type: BooleanConstructor;
109
+ required: true;
110
+ } ? never : K : never;
111
+ }[keyof T];
112
+ type InferPropType<T, NullAsAny = true> = [T] extends [null] ? NullAsAny extends true ? any : null : [T] extends [{
113
+ type: null | true;
114
+ }] ? any : [T] extends [ObjectConstructor | {
115
+ type: ObjectConstructor;
116
+ }] ? Record<string, any> : [T] extends [BooleanConstructor | {
117
+ type: BooleanConstructor;
118
+ }] ? boolean : [T] extends [DateConstructor | {
119
+ type: DateConstructor;
120
+ }] ? Date : [T] extends [(infer U)[] | {
121
+ type: (infer U)[];
122
+ }] ? U extends DateConstructor ? Date | InferPropType<U, false> : InferPropType<U, false> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T;
123
+ /**
124
+ * Extract prop types from a runtime props options object.
125
+ * The extracted types are **internal** - i.e. the resolved props received by
126
+ * the component.
127
+ * - Boolean props are always present
128
+ * - Props with default values are always present
129
+ *
130
+ * To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
131
+ */
132
+ export type ExtractPropTypes<O> = {
133
+ [K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>;
134
+ } & {
135
+ [K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
136
+ };
137
+ type PublicRequiredKeys<T> = {
138
+ [K in keyof T]: T[K] extends {
139
+ required: true;
140
+ } ? K : never;
141
+ }[keyof T];
142
+ type PublicOptionalKeys<T> = Exclude<keyof T, PublicRequiredKeys<T>>;
143
+ /**
144
+ * Extract prop types from a runtime props options object.
145
+ * The extracted types are **public** - i.e. the expected props that can be
146
+ * passed to component.
147
+ */
148
+ export type ExtractPublicPropTypes<O> = {
149
+ [K in keyof Pick<O, PublicRequiredKeys<O>>]: InferPropType<O[K]>;
150
+ } & {
151
+ [K in keyof Pick<O, PublicOptionalKeys<O>>]?: InferPropType<O[K]>;
152
+ };
153
+ export type ExtractDefaultPropTypes<O> = O extends object ? {
154
+ [K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
155
+ } : {};
156
+
157
+ /**
158
+ * Vue `<script setup>` compiler macro for declaring component props. The
159
+ * expected argument is the same as the component `props` option.
160
+ *
161
+ * Example runtime declaration:
162
+ * ```js
163
+ * // using Array syntax
164
+ * const props = defineProps(['foo', 'bar'])
165
+ * // using Object syntax
166
+ * const props = defineProps({
167
+ * foo: String,
168
+ * bar: {
169
+ * type: Number,
170
+ * required: true
171
+ * }
172
+ * })
173
+ * ```
174
+ *
175
+ * Equivalent type-based declaration:
176
+ * ```ts
177
+ * // will be compiled into equivalent runtime declarations
178
+ * const props = defineProps<{
179
+ * foo?: string
180
+ * bar: number
181
+ * }>()
182
+ * ```
183
+ *
184
+ * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
185
+ *
186
+ * This is only usable inside `<script setup>`, is compiled away in the
187
+ * output and should **not** be actually called at runtime.
188
+ */
189
+ export declare function defineProps<PropNames extends string = string>(props: PropNames[]): Prettify<Readonly<{
190
+ [key in PropNames]?: any;
191
+ }>>;
192
+ export declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
193
+ export declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
194
+ export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
195
+ readonly [K in BKeys]-?: boolean;
196
+ };
197
+ type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
198
+ /**
199
+ * Vue `<script setup>` compiler macro for declaring a component's emitted
200
+ * events. The expected argument is the same as the component `emits` option.
201
+ *
202
+ * Example runtime declaration:
203
+ * ```js
204
+ * const emit = defineEmits(['change', 'update'])
205
+ * ```
206
+ *
207
+ * Example type-based declaration:
208
+ * ```ts
209
+ * const emit = defineEmits<{
210
+ * // <eventName>: <expected arguments>
211
+ * change: []
212
+ * update: [value: string] // named tuple syntax
213
+ * }>()
214
+ *
215
+ * emit('change')
216
+ * emit('update', 1)
217
+ * ```
218
+ *
219
+ * This is only usable inside `<script setup>`, is compiled away in the
220
+ * output and should **not** be actually called at runtime.
221
+ *
222
+ * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
223
+ */
224
+ export declare function defineEmits<EE extends string = string>(emitOptions: EE[]): EmitFn<EE[]>;
225
+ export declare function defineEmits<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E>;
226
+ export declare function defineEmits<T extends ComponentTypeEmits>(): T extends (...args: any[]) => any ? T : ShortEmits<T>;
227
+ export type ComponentTypeEmits = ((...args: any[]) => any) | Record<string, any[]>;
228
+ type RecordToUnion<T extends Record<string, any>> = T[keyof T];
229
+ type ShortEmits<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
230
+ [K in keyof T]: (evt: K, ...args: T[K]) => void;
231
+ }>>;
232
+ /**
233
+ * Vue `<script setup>` compiler macro for declaring a component's exposed
234
+ * instance properties when it is accessed by a parent component via template
235
+ * refs.
236
+ *
237
+ * `<script setup>` components are closed by default - i.e. variables inside
238
+ * the `<script setup>` scope is not exposed to parent unless explicitly exposed
239
+ * via `defineExpose`.
240
+ *
241
+ * This is only usable inside `<script setup>`, is compiled away in the
242
+ * output and should **not** be actually called at runtime.
243
+ *
244
+ * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
245
+ */
246
+ export declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
247
+ /**
248
+ * Vue `<script setup>` compiler macro for declaring a component's additional
249
+ * options. This should be used only for options that cannot be expressed via
250
+ * Composition API - e.g. `inheritAttrs`.
251
+ *
252
+ * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
253
+ */
254
+ export declare function defineOptions<RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin>(options?: ComponentOptionsBase<{}, RawBindings, D, C, M, Mixin, Extends, {}> & {
255
+ /**
256
+ * props should be defined via defineProps().
257
+ */
258
+ props?: never;
259
+ /**
260
+ * emits should be defined via defineEmits().
261
+ */
262
+ emits?: never;
263
+ /**
264
+ * expose should be defined via defineExpose().
265
+ */
266
+ expose?: never;
267
+ /**
268
+ * slots should be defined via defineSlots().
269
+ */
270
+ slots?: never;
271
+ }): void;
272
+ export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
273
+ export type ModelRef<T, M extends string | number | symbol = string> = Ref<T> & [
274
+ ModelRef<T, M>,
275
+ Record<M, true | undefined>
276
+ ];
277
+ type DefineModelOptions<T = any> = {
278
+ get?: (v: T) => any;
279
+ set?: (v: T) => any;
280
+ };
281
+ /**
282
+ * Vue `<script setup>` compiler macro for declaring a
283
+ * two-way binding prop that can be consumed via `v-model` from the parent
284
+ * component. This will declare a prop with the same name and a corresponding
285
+ * `update:propName` event.
286
+ *
287
+ * If the first argument is a string, it will be used as the prop name;
288
+ * Otherwise the prop name will default to "modelValue". In both cases, you
289
+ * can also pass an additional object which will be used as the prop's options.
290
+ *
291
+ * The returned ref behaves differently depending on whether the parent
292
+ * provided the corresponding v-model props or not:
293
+ * - If yes, the returned ref's value will always be in sync with the parent
294
+ * prop.
295
+ * - If not, the returned ref will behave like a normal local ref.
296
+ *
297
+ * @example
298
+ * ```ts
299
+ * // default model (consumed via `v-model`)
300
+ * const modelValue = defineModel<string>()
301
+ * modelValue.value = "hello"
302
+ *
303
+ * // default model with options
304
+ * const modelValue = defineModel<string>({ required: true })
305
+ *
306
+ * // with specified name (consumed via `v-model:count`)
307
+ * const count = defineModel<number>('count')
308
+ * count.value++
309
+ *
310
+ * // with specified name and default value
311
+ * const count = defineModel<number>('count', { default: 0 })
312
+ * ```
313
+ */
314
+ export declare function defineModel<T, M extends string | number | symbol = string>(options: {
315
+ required: true;
316
+ } & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
317
+ export declare function defineModel<T, M extends string | number | symbol = string>(options: {
318
+ default: any;
319
+ } & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
320
+ export declare function defineModel<T, M extends string | number | symbol = string>(options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
321
+ export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
322
+ required: true;
323
+ } & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
324
+ export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
325
+ default: any;
326
+ } & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
327
+ export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
328
+ type NotUndefined<T> = T extends undefined ? never : T;
329
+ type MappedOmit<T, K extends keyof any> = {
330
+ [P in keyof T as P extends K ? never : P]: T[P];
331
+ };
332
+ type InferDefaults<T> = {
333
+ [K in keyof T]?: InferDefault<T, T[K]>;
334
+ };
335
+ type NativeType = null | number | string | boolean | symbol | Function;
336
+ type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
337
+ type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Readonly<MappedOmit<T, keyof Defaults>> & {
338
+ readonly [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? T[K] : NotUndefined<T[K]> : never;
339
+ } & {
340
+ readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
341
+ };
342
+ /**
343
+ * Vue `<script setup>` compiler macro for providing props default values when
344
+ * using type-based `defineProps` declaration.
345
+ *
346
+ * Example usage:
347
+ * ```ts
348
+ * withDefaults(defineProps<{
349
+ * size?: number
350
+ * labels?: string[]
351
+ * }>(), {
352
+ * size: 3,
353
+ * labels: () => ['default label']
354
+ * })
355
+ * ```
356
+ *
357
+ * This is only usable inside `<script setup>`, is compiled away in the output
358
+ * and should **not** be actually called at runtime.
359
+ *
360
+ * @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
361
+ */
362
+ export declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
363
+ export declare function useSlots(): SetupContext['slots'];
364
+ export declare function useAttrs(): SetupContext['attrs'];
365
+
58
366
  export type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
59
367
  export type EmitsOptions = ObjectEmitsOptions | string[];
60
- type EmitsToProps<T extends EmitsOptions> = T extends string[] ? {
368
+ export type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> = T extends string[] ? {
61
369
  [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any;
62
370
  } : T extends ObjectEmitsOptions ? {
63
371
  [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
372
  } : {};
373
+ type TypeEmitsToOptions<T extends ComponentTypeEmits> = T extends Record<string, any[]> ? {
374
+ [K in keyof T]: T[K] extends [...args: infer Args] ? (...args: Args) => any : () => any;
375
+ } : T extends (...args: any[]) => any ? ParametersToFns<OverloadParameters<T>> : {};
376
+ type ParametersToFns<T extends any[]> = {
377
+ [K in T[0]]: K extends `${infer C}` ? (...args: T extends [C, ...infer Args] ? Args : never) => any : never;
378
+ };
65
379
  type ShortEmitsToObject<E> = E extends Record<string, any[]> ? {
66
380
  [K in keyof E]: (...args: E[K]) => any;
67
381
  } : E;
@@ -69,6 +383,49 @@ type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Op
69
383
  [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;
70
384
  }[Event]>;
71
385
 
386
+ /**
387
+ Runtime helper for applying directives to a vnode. Example usage:
388
+
389
+ const comp = resolveComponent('comp')
390
+ const foo = resolveDirective('foo')
391
+ const bar = resolveDirective('bar')
392
+
393
+ return withDirectives(h(comp), [
394
+ [foo, this.x],
395
+ [bar, this.y]
396
+ ])
397
+ */
398
+
399
+ export interface DirectiveBinding<Value = any, Modifiers extends string = string, Arg extends string = string> {
400
+ instance: ComponentPublicInstance | null;
401
+ value: Value;
402
+ oldValue: Value | null;
403
+ arg?: Arg;
404
+ modifiers: DirectiveModifiers<Modifiers>;
405
+ dir: ObjectDirective<any, Value>;
406
+ }
407
+ export type DirectiveHook<HostElement = any, Prev = VNode<any, HostElement> | null, Value = any, Modifiers extends string = string, Arg extends string = string> = (el: HostElement, binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode<any, HostElement>, prevVNode: Prev) => void;
408
+ type SSRDirectiveHook<Value = any, Modifiers extends string = string, Arg extends string = string> = (binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode) => Data | undefined;
409
+ export interface ObjectDirective<HostElement = any, Value = any, Modifiers extends string = string, Arg extends string = string> {
410
+ created?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
411
+ beforeMount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
412
+ mounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
413
+ beforeUpdate?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
414
+ updated?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
415
+ beforeUnmount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
416
+ unmounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
417
+ getSSRProps?: SSRDirectiveHook<Value, Modifiers, Arg>;
418
+ deep?: boolean;
419
+ }
420
+ export type FunctionDirective<HostElement = any, V = any, Modifiers extends string = string, Arg extends string = string> = DirectiveHook<HostElement, any, V, Modifiers, Arg>;
421
+ export type Directive<HostElement = any, Value = any, Modifiers extends string = string, Arg extends string = string> = ObjectDirective<HostElement, Value, Modifiers, Arg> | FunctionDirective<HostElement, Value, Modifiers, Arg>;
422
+ type DirectiveModifiers<K extends string = string> = Record<K, boolean>;
423
+ export type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, string] | [Directive | undefined, any, string, DirectiveModifiers]>;
424
+ /**
425
+ * Adds directives to a VNode.
426
+ */
427
+ export declare function withDirectives<T extends VNode>(vnode: T, directives: DirectiveArguments): T;
428
+
72
429
  /**
73
430
  * Custom properties added to component instances in any way and can be accessed through `this`
74
431
  *
@@ -97,7 +454,7 @@ type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Op
97
454
  export interface ComponentCustomProperties {
98
455
  }
99
456
  type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin ? ComponentOptionsMixin extends T ? true : false : false;
100
- type MixinToOptionTypes<T> = T extends ComponentOptionsBase<infer P, infer B, infer D, infer C, infer M, infer Mixin, infer Extends, any, any, infer Defaults, any, any, any> ? OptionTypesType<P & {}, B & {}, D & {}, C & {}, M & {}, Defaults & {}> & IntersectionMixin<Mixin> & IntersectionMixin<Extends> : never;
457
+ type MixinToOptionTypes<T> = T extends ComponentOptionsBase<infer P, infer B, infer D, infer C, infer M, infer Mixin, infer Extends, any, any, infer Defaults, any, any, any, any, any, any, any> ? OptionTypesType<P & {}, B & {}, D & {}, C & {}, M & {}, Defaults & {}> & IntersectionMixin<Mixin> & IntersectionMixin<Extends> : never;
101
458
  type ExtractMixin<T> = {
102
459
  Mixin: MixinToOptionTypes<T>;
103
460
  }[T extends ComponentOptionsMixin ? 'Mixin' : never];
@@ -110,11 +467,24 @@ type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props,
110
467
  __isSuspense?: never;
111
468
  new (...args: any[]): T;
112
469
  };
470
+ /**
471
+ * @deprecated This is no longer used internally, but exported and relied on by
472
+ * existing library types generated by vue-tsc.
473
+ */
113
474
  export type CreateComponentPublicInstance<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, 'P'> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, 'B'> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, 'D'> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, 'C'> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, 'M'> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, 'Defaults'> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults, {}, string, S>, I, S>;
475
+ /**
476
+ * This is the same as `CreateComponentPublicInstance` but adds local components,
477
+ * global directives, exposed, and provide inference.
478
+ * It changes the arguments order so that we don't need to repeat mixin
479
+ * inference everywhere internally, but it has to be a new type to avoid
480
+ * breaking types that relies on previous arguments order (#10842)
481
+ */
482
+ export type CreateComponentPublicInstanceWithMixins<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, 'P'> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, 'B'> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, 'D'> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, 'C'> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, 'M'> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, 'Defaults'> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults, {}, string, S, LC, Directives, Exposed, Provide>, I, S, Exposed>;
483
+ type ExposedKeys<T, Exposed extends string & keyof T> = '' extends Exposed ? T : Pick<T, Exposed>;
114
484
  export type ComponentPublicInstance<P = {}, // props type extracted from props option
115
485
  B = {}, // raw bindings returned from setup()
116
486
  D = {}, // return from data()
117
- C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}, S extends SlotsType = {}> = {
487
+ C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, Exposed extends string = ''> = {
118
488
  $: ComponentInternalInstance;
119
489
  $data: D;
120
490
  $props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
@@ -129,7 +499,7 @@ C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOpt
129
499
  $forceUpdate: () => void;
130
500
  $nextTick: typeof nextTick;
131
501
  $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;
132
- } & IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B>>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>;
502
+ } & ExposedKeys<IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B>>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>, Exposed>;
133
503
 
134
504
  declare enum LifecycleHooks {
135
505
  BEFORE_CREATE = "bc",
@@ -365,157 +735,22 @@ export declare const KeepAlive: {
365
735
  };
366
736
  };
367
737
  __isKeepAlive: true;
368
- };
369
- export declare function onActivated(hook: Function, target?: ComponentInternalInstance | null): void;
370
- export declare function onDeactivated(hook: Function, target?: ComponentInternalInstance | null): void;
371
-
372
- export declare const onBeforeMount: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
373
- export declare const onMounted: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
374
- export declare const onBeforeUpdate: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
375
- export declare const onUpdated: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
376
- export declare const onBeforeUnmount: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
377
- export declare const onUnmounted: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
378
- export declare const onServerPrefetch: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
379
- type DebuggerHook = (e: DebuggerEvent) => void;
380
- export declare const onRenderTriggered: (hook: DebuggerHook, target?: ComponentInternalInstance | null) => false | Function | undefined;
381
- export declare const onRenderTracked: (hook: DebuggerHook, target?: ComponentInternalInstance | null) => false | Function | undefined;
382
- type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
383
- export declare function onErrorCaptured<TError = Error>(hook: ErrorCapturedHook<TError>, target?: ComponentInternalInstance | null): void;
384
-
385
- export type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
386
- export type ComponentObjectPropsOptions<P = Data> = {
387
- [K in keyof P]: Prop<P[K]> | null;
388
- };
389
- export type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
390
- type DefaultFactory<T> = (props: Data) => T | null | undefined;
391
- interface PropOptions<T = any, D = T> {
392
- type?: PropType<T> | true | null;
393
- required?: boolean;
394
- default?: D | DefaultFactory<D> | null | undefined | object;
395
- validator?(value: unknown, props: Data): boolean;
396
- }
397
- export type PropType<T> = PropConstructor<T> | PropConstructor<T>[];
398
- type PropConstructor<T = any> = {
399
- new (...args: any[]): T & {};
400
- } | {
401
- (): T;
402
- } | PropMethod<T>;
403
- type PropMethod<T, TConstructor = any> = [T] extends [
404
- ((...args: any) => any) | undefined
405
- ] ? {
406
- new (): TConstructor;
407
- (): T;
408
- readonly prototype: TConstructor;
409
- } : never;
410
- type RequiredKeys<T> = {
411
- [K in keyof T]: T[K] extends {
412
- required: true;
413
- } | {
414
- default: any;
415
- } | BooleanConstructor | {
416
- type: BooleanConstructor;
417
- } ? T[K] extends {
418
- default: undefined | (() => undefined);
419
- } ? never : K : never;
420
- }[keyof T];
421
- type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
422
- type DefaultKeys<T> = {
423
- [K in keyof T]: T[K] extends {
424
- default: any;
425
- } | BooleanConstructor | {
426
- type: BooleanConstructor;
427
- } ? T[K] extends {
428
- type: BooleanConstructor;
429
- required: true;
430
- } ? never : K : never;
431
- }[keyof T];
432
- type InferPropType<T> = [T] extends [null] ? any : [T] extends [{
433
- type: null | true;
434
- }] ? any : [T] extends [ObjectConstructor | {
435
- type: ObjectConstructor;
436
- }] ? Record<string, any> : [T] extends [BooleanConstructor | {
437
- type: BooleanConstructor;
438
- }] ? boolean : [T] extends [DateConstructor | {
439
- type: DateConstructor;
440
- }] ? Date : [T] extends [(infer U)[] | {
441
- type: (infer U)[];
442
- }] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T;
443
- /**
444
- * Extract prop types from a runtime props options object.
445
- * The extracted types are **internal** - i.e. the resolved props received by
446
- * the component.
447
- * - Boolean props are always present
448
- * - Props with default values are always present
449
- *
450
- * To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
451
- */
452
- export type ExtractPropTypes<O> = {
453
- [K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>;
454
- } & {
455
- [K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
456
- };
457
- type PublicRequiredKeys<T> = {
458
- [K in keyof T]: T[K] extends {
459
- required: true;
460
- } ? K : never;
461
- }[keyof T];
462
- type PublicOptionalKeys<T> = Exclude<keyof T, PublicRequiredKeys<T>>;
463
- /**
464
- * Extract prop types from a runtime props options object.
465
- * The extracted types are **public** - i.e. the expected props that can be
466
- * passed to component.
467
- */
468
- export type ExtractPublicPropTypes<O> = {
469
- [K in keyof Pick<O, PublicRequiredKeys<O>>]: InferPropType<O[K]>;
470
- } & {
471
- [K in keyof Pick<O, PublicOptionalKeys<O>>]?: InferPropType<O[K]>;
472
- };
473
- export type ExtractDefaultPropTypes<O> = O extends object ? {
474
- [K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
475
- } : {};
476
-
477
- /**
478
- Runtime helper for applying directives to a vnode. Example usage:
479
-
480
- const comp = resolveComponent('comp')
481
- const foo = resolveDirective('foo')
482
- const bar = resolveDirective('bar')
483
-
484
- return withDirectives(h(comp), [
485
- [foo, this.x],
486
- [bar, this.y]
487
- ])
488
- */
489
-
490
- export interface DirectiveBinding<V = any> {
491
- instance: ComponentPublicInstance | null;
492
- value: V;
493
- oldValue: V | null;
494
- arg?: string;
495
- modifiers: DirectiveModifiers;
496
- dir: ObjectDirective<any, V>;
497
- }
498
- export type DirectiveHook<T = any, Prev = VNode<any, T> | null, V = any> = (el: T, binding: DirectiveBinding<V>, vnode: VNode<any, T>, prevVNode: Prev) => void;
499
- type SSRDirectiveHook = (binding: DirectiveBinding, vnode: VNode) => Data | undefined;
500
- export interface ObjectDirective<T = any, V = any> {
501
- created?: DirectiveHook<T, null, V>;
502
- beforeMount?: DirectiveHook<T, null, V>;
503
- mounted?: DirectiveHook<T, null, V>;
504
- beforeUpdate?: DirectiveHook<T, VNode<any, T>, V>;
505
- updated?: DirectiveHook<T, VNode<any, T>, V>;
506
- beforeUnmount?: DirectiveHook<T, null, V>;
507
- unmounted?: DirectiveHook<T, null, V>;
508
- getSSRProps?: SSRDirectiveHook;
509
- deep?: boolean;
510
- }
511
- export type FunctionDirective<T = any, V = any> = DirectiveHook<T, any, V>;
512
- export type Directive<T = any, V = any> = ObjectDirective<T, V> | FunctionDirective<T, V>;
513
- type DirectiveModifiers = Record<string, boolean>;
514
- export type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, string] | [Directive | undefined, any, string, DirectiveModifiers]>;
515
- /**
516
- * Adds directives to a VNode.
517
- */
518
- export declare function withDirectives<T extends VNode>(vnode: T, directives: DirectiveArguments): T;
738
+ };
739
+ export declare function onActivated(hook: Function, target?: ComponentInternalInstance | null): void;
740
+ export declare function onDeactivated(hook: Function, target?: ComponentInternalInstance | null): void;
741
+
742
+ export declare const onBeforeMount: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
743
+ export declare const onMounted: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
744
+ export declare const onBeforeUpdate: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
745
+ export declare const onUpdated: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
746
+ export declare const onBeforeUnmount: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
747
+ export declare const onUnmounted: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
748
+ export declare const onServerPrefetch: (hook: () => any, target?: ComponentInternalInstance | null) => false | Function | undefined;
749
+ type DebuggerHook = (e: DebuggerEvent) => void;
750
+ export declare const onRenderTriggered: (hook: DebuggerHook, target?: ComponentInternalInstance | null) => false | Function | undefined;
751
+ export declare const onRenderTracked: (hook: DebuggerHook, target?: ComponentInternalInstance | null) => false | Function | undefined;
752
+ type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
753
+ export declare function onErrorCaptured<TError = Error>(hook: ErrorCapturedHook<TError>, target?: ComponentInternalInstance | null): void;
519
754
 
520
755
  declare enum DeprecationTypes$1 {
521
756
  GLOBAL_MOUNT = "GLOBAL_MOUNT",
@@ -585,17 +820,17 @@ declare function configureCompat(config: CompatConfig): void;
585
820
  export interface ComponentCustomOptions {
586
821
  }
587
822
  export type RenderFunction = () => VNodeChild;
588
- export interface ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}> extends LegacyOptions<Props, D, C, M, Mixin, Extends, I, II>, ComponentInternalOptions, ComponentCustomOptions {
823
+ export interface ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions> extends LegacyOptions<Props, D, C, M, Mixin, Extends, I, II, Provide>, ComponentInternalOptions, ComponentCustomOptions {
589
824
  setup?: (this: void, props: LooseRequired<Props & Prettify<UnwrapMixinsType<IntersectionMixin<Mixin> & IntersectionMixin<Extends>, 'P'>>>, ctx: SetupContext<E, S>) => Promise<RawBindings> | RawBindings | RenderFunction | void;
590
825
  name?: string;
591
826
  template?: string | object;
592
827
  render?: Function;
593
- components?: Record<string, Component>;
594
- directives?: Record<string, Directive>;
828
+ components?: LC & Record<string, Component>;
829
+ directives?: Directives & Record<string, Directive>;
595
830
  inheritAttrs?: boolean;
596
831
  emits?: (E | EE[]) & ThisType<void>;
597
832
  slots?: S;
598
- expose?: string[];
833
+ expose?: Exposed[];
599
834
  serverPrefetch?(): void | Promise<any>;
600
835
  compilerOptions?: RuntimeCompilerOptions;
601
836
  call?: (this: unknown, ...args: unknown[]) => never;
@@ -613,19 +848,8 @@ export interface RuntimeCompilerOptions {
613
848
  comments?: boolean;
614
849
  delimiters?: [string, string];
615
850
  }
616
- export type ComponentOptionsWithoutProps<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, PE = Props & EmitsToProps<E>> = ComponentOptionsBase<PE, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S> & {
617
- props?: undefined;
618
- } & ThisType<CreateComponentPublicInstance<PE, RawBindings, D, C, M, Mixin, Extends, E, PE, {}, false, I, S>>;
619
- export type ComponentOptionsWithArrayProps<PropNames extends string = string, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, Props = Prettify<Readonly<{
620
- [key in PropNames]?: any;
621
- } & EmitsToProps<E>>>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S> & {
622
- props: PropNames[];
623
- } & ThisType<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, {}, false, I, S>>;
624
- export type ComponentOptionsWithObjectProps<PropsOptions = ComponentObjectPropsOptions, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, Props = Prettify<Readonly<ExtractPropTypes<PropsOptions> & EmitsToProps<E>>>, Defaults = ExtractDefaultPropTypes<PropsOptions>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S> & {
625
- props: PropsOptions & ThisType<void>;
626
- } & ThisType<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, Defaults, false, I, S>>;
627
- export type ComponentOptions<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = any, M extends MethodOptions = any, Mixin extends ComponentOptionsMixin = any, Extends extends ComponentOptionsMixin = any, E extends EmitsOptions = any, S extends SlotsType = any> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, string, S> & ThisType<CreateComponentPublicInstance<{}, RawBindings, D, C, M, Mixin, Extends, E, Readonly<Props>>>;
628
- export type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any>;
851
+ export type ComponentOptions<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = any, M extends MethodOptions = any, Mixin extends ComponentOptionsMixin = any, Extends extends ComponentOptionsMixin = any, E extends EmitsOptions = any, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S, LC, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<{}, RawBindings, D, C, M, Mixin, Extends, E, Readonly<Props>, Defaults, false, I, S, LC, Directives>>;
852
+ export type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
629
853
  export type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
630
854
  export interface MethodOptions {
631
855
  [key: string]: Function;
@@ -653,14 +877,14 @@ type InjectToObject<T extends ComponentInjectOptions> = T extends string[] ? {
653
877
  } : T extends ObjectInjectOptions ? {
654
878
  [K in keyof T]?: unknown;
655
879
  } : never;
656
- interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, I extends ComponentInjectOptions, II extends string> {
880
+ interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, I extends ComponentInjectOptions, II extends string, Provide extends ComponentProvideOptions = ComponentProvideOptions> {
657
881
  compatConfig?: CompatConfig;
658
882
  [key: string]: any;
659
- data?: (this: CreateComponentPublicInstance<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstance<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D;
883
+ data?: (this: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D;
660
884
  computed?: C;
661
885
  methods?: M;
662
886
  watch?: ComponentWatchOptions;
663
- provide?: ComponentProvideOptions;
887
+ provide?: Provide;
664
888
  inject?: I | II[];
665
889
  filters?: Record<string, Function>;
666
890
  mixins?: Mixin[];
@@ -726,6 +950,34 @@ type OptionTypesType<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M e
726
950
  M: M;
727
951
  Defaults: Defaults;
728
952
  };
953
+ /**
954
+ * @deprecated
955
+ */
956
+ export type ComponentOptionsWithoutProps<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, TE extends ComponentTypeEmits = {}, ResolvedEmits extends EmitsOptions = {} extends E ? TypeEmitsToOptions<TE> : E, PE = Props & EmitsToProps<ResolvedEmits>> = ComponentOptionsBase<PE, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S, LC, Directives, Exposed, Provide> & {
957
+ props?: never;
958
+ /**
959
+ * @private for language-tools use only
960
+ */
961
+ __typeProps?: Props;
962
+ /**
963
+ * @private for language-tools use only
964
+ */
965
+ __typeEmits?: TE;
966
+ } & ThisType<CreateComponentPublicInstanceWithMixins<PE, RawBindings, D, C, M, Mixin, Extends, ResolvedEmits, EE, {}, false, I, S, LC, Directives, Exposed>>;
967
+ /**
968
+ * @deprecated
969
+ */
970
+ export type ComponentOptionsWithArrayProps<PropNames extends string = string, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, Props = Prettify<Readonly<{
971
+ [key in PropNames]?: any;
972
+ } & EmitsToProps<E>>>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S, LC, Directives, Exposed, Provide> & {
973
+ props: PropNames[];
974
+ } & ThisType<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, {}, false, I, S, LC, Directives, Exposed>>;
975
+ /**
976
+ * @deprecated
977
+ */
978
+ export type ComponentOptionsWithObjectProps<PropsOptions = ComponentObjectPropsOptions, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, Props = Prettify<Readonly<ExtractPropTypes<PropsOptions> & EmitsToProps<E>>>, Defaults = ExtractDefaultPropTypes<PropsOptions>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S, LC, Directives, Exposed, Provide> & {
979
+ props: PropsOptions & ThisType<void>;
980
+ } & ThisType<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, Defaults, false, I, S, LC, Directives>>;
729
981
 
730
982
  export interface InjectionKey<T> extends Symbol {
731
983
  }
@@ -742,8 +994,8 @@ export declare function hasInjectionContext(): boolean;
742
994
 
743
995
  export type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
744
996
  type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
745
- 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;
746
- export type DefineSetupFnComponent<P extends Record<string, any>, E extends EmitsOptions = {}, S extends SlotsType = SlotsType, Props = P & EmitsToProps<E>, PP = PublicProps> = new (props: Props & PP) => CreateComponentPublicInstance<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, E, PP, {}, false, {}, S>;
997
+ 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 = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, MakeDefaultsOptional extends boolean = true> = ComponentPublicInstanceConstructor<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, PP & Props, Defaults, MakeDefaultsOptional, {}, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, Provide> & PP;
998
+ export type DefineSetupFnComponent<P extends Record<string, any>, E extends EmitsOptions = {}, S extends SlotsType = SlotsType, Props = P & EmitsToProps<E>, PP = PublicProps> = new (props: Props & PP) => CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, E, PP, {}, false, {}, S>;
747
999
  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'> & {
748
1000
  props?: (keyof Props)[];
749
1001
  emits?: E | EE[];
@@ -754,11 +1006,20 @@ export declare function defineComponent<Props extends Record<string, any>, E ext
754
1006
  emits?: E | EE[];
755
1007
  slots?: S;
756
1008
  }): DefineSetupFnComponent<Props, E, S>;
757
- 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>;
758
- 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<{
759
- [key in PropNames]?: any;
760
- }>>(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>;
761
- 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>;
1009
+ export declare function defineComponent<TypeProps, RuntimePropsOptions extends ComponentObjectPropsOptions = ComponentObjectPropsOptions, RuntimePropsKeys extends string = string, TypeEmits extends ComponentTypeEmits = {}, RuntimeEmitsOptions extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Data = {}, SetupBindings = {}, Computed extends ComputedOptions = {}, Methods extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, InjectOptions extends ComponentInjectOptions = {}, InjectKeys extends string = string, Slots extends SlotsType = {}, LocalComponents extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, ResolvedEmits extends EmitsOptions = {} extends RuntimeEmitsOptions ? TypeEmitsToOptions<TypeEmits> : RuntimeEmitsOptions, InferredProps = unknown extends TypeProps ? string extends RuntimePropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : {
1010
+ [key in RuntimePropsKeys]?: any;
1011
+ } : TypeProps, ResolvedProps = Readonly<InferredProps & EmitsToProps<ResolvedEmits>>>(options: {
1012
+ props?: (RuntimePropsOptions & ThisType<void>) | RuntimePropsKeys[];
1013
+ /**
1014
+ * @private for language-tools use only
1015
+ */
1016
+ __typeProps?: TypeProps;
1017
+ /**
1018
+ * @private for language-tools use only
1019
+ */
1020
+ __typeEmits?: TypeEmits;
1021
+ } & ComponentOptionsBase<ResolvedProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, RuntimeEmitsKeys, {}, // Defaults
1022
+ InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<ResolvedProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, ResolvedEmits, RuntimeEmitsKeys, {}, false, InjectOptions, Slots, LocalComponents, Directives, Exposed>>): DefineComponent<InferredProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, ResolvedEmits, RuntimeEmitsKeys, PublicProps, ResolvedProps, ExtractDefaultPropTypes<RuntimePropsOptions>, Slots, LocalComponents, Directives, Exposed, Provide, unknown extends TypeProps ? true : false>;
762
1023
 
763
1024
  export interface App<HostElement = any> {
764
1025
  version: string;
@@ -767,11 +1028,12 @@ export interface App<HostElement = any> {
767
1028
  use<Options>(plugin: Plugin<Options>, options: Options): this;
768
1029
  mixin(mixin: ComponentOptions): this;
769
1030
  component(name: string): Component | undefined;
770
- component(name: string, component: Component | DefineComponent): this;
1031
+ component<T extends Component | DefineComponent>(name: string, component: T): this;
771
1032
  directive<T = any, V = any>(name: string): Directive<T, V> | undefined;
772
1033
  directive<T = any, V = any>(name: string, directive: Directive<T, V>): this;
773
1034
  mount(rootContainer: HostElement | string, isHydrate?: boolean, namespace?: boolean | ElementNamespace): ComponentPublicInstance;
774
1035
  unmount(): void;
1036
+ onUnmount(cb: () => void): void;
775
1037
  provide<T>(key: InjectionKey<T> | string, value: T): this;
776
1038
  /**
777
1039
  * Runs a function with the app as active instance. This allows using of `inject()` within the function to get access
@@ -1036,6 +1298,44 @@ export type ComponentInstance<T> = T extends {
1036
1298
  */
1037
1299
  export interface ComponentCustomProps {
1038
1300
  }
1301
+ /**
1302
+ * For globally defined Directives
1303
+ * Here is an example of adding a directive `VTooltip` as global directive:
1304
+ *
1305
+ * @example
1306
+ * ```ts
1307
+ * import VTooltip from 'v-tooltip'
1308
+ *
1309
+ * declare module '@vue/runtime-core' {
1310
+ * interface GlobalDirectives {
1311
+ * VTooltip
1312
+ * }
1313
+ * }
1314
+ * ```
1315
+ */
1316
+ export interface GlobalDirectives extends Record<string, Directive> {
1317
+ }
1318
+ /**
1319
+ * For globally defined Components
1320
+ * Here is an example of adding a component `RouterView` as global component:
1321
+ *
1322
+ * @example
1323
+ * ```ts
1324
+ * import { RouterView } from 'vue-router'
1325
+ *
1326
+ * declare module '@vue/runtime-core' {
1327
+ * interface GlobalComponents {
1328
+ * RouterView
1329
+ * }
1330
+ * }
1331
+ * ```
1332
+ */
1333
+ export interface GlobalComponents extends Record<string, Component> {
1334
+ Teleport: DefineComponent<TeleportProps>;
1335
+ Suspense: DefineComponent<SuspenseProps>;
1336
+ KeepAlive: DefineComponent<KeepAliveProps>;
1337
+ BaseTransition: DefineComponent<BaseTransitionProps>;
1338
+ }
1039
1339
  /**
1040
1340
  * Default allowed non-declared props on component in TSX
1041
1341
  */
@@ -1112,9 +1412,13 @@ export interface ComponentInternalInstance {
1112
1412
  */
1113
1413
  effect: ReactiveEffect;
1114
1414
  /**
1115
- * Bound effect runner to be passed to schedulers
1415
+ * Force update render effect
1416
+ */
1417
+ update: () => void;
1418
+ /**
1419
+ * Render effect job to be passed to scheduler (checks if dirty)
1116
1420
  */
1117
- update: SchedulerJob;
1421
+ job: SchedulerJob;
1118
1422
  proxy: ComponentPublicInstance | null;
1119
1423
  exposed: Record<string, any> | null;
1120
1424
  exposeProxy: Record<string, any> | null;
@@ -1181,201 +1485,6 @@ export declare function defineAsyncComponent<T extends Component = {
1181
1485
  new (): ComponentPublicInstance;
1182
1486
  }>(source: AsyncComponentLoader<T> | AsyncComponentOptions<T>): T;
1183
1487
 
1184
- /**
1185
- * Vue `<script setup>` compiler macro for declaring component props. The
1186
- * expected argument is the same as the component `props` option.
1187
- *
1188
- * Example runtime declaration:
1189
- * ```js
1190
- * // using Array syntax
1191
- * const props = defineProps(['foo', 'bar'])
1192
- * // using Object syntax
1193
- * const props = defineProps({
1194
- * foo: String,
1195
- * bar: {
1196
- * type: Number,
1197
- * required: true
1198
- * }
1199
- * })
1200
- * ```
1201
- *
1202
- * Equivalent type-based declaration:
1203
- * ```ts
1204
- * // will be compiled into equivalent runtime declarations
1205
- * const props = defineProps<{
1206
- * foo?: string
1207
- * bar: number
1208
- * }>()
1209
- * ```
1210
- *
1211
- * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
1212
- *
1213
- * This is only usable inside `<script setup>`, is compiled away in the
1214
- * output and should **not** be actually called at runtime.
1215
- */
1216
- export declare function defineProps<PropNames extends string = string>(props: PropNames[]): Prettify<Readonly<{
1217
- [key in PropNames]?: any;
1218
- }>>;
1219
- export declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
1220
- export declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
1221
- export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
1222
- readonly [K in BKeys]-?: boolean;
1223
- };
1224
- type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
1225
- /**
1226
- * Vue `<script setup>` compiler macro for declaring a component's emitted
1227
- * events. The expected argument is the same as the component `emits` option.
1228
- *
1229
- * Example runtime declaration:
1230
- * ```js
1231
- * const emit = defineEmits(['change', 'update'])
1232
- * ```
1233
- *
1234
- * Example type-based declaration:
1235
- * ```ts
1236
- * const emit = defineEmits<{
1237
- * // <eventName>: <expected arguments>
1238
- * change: []
1239
- * update: [value: string] // named tuple syntax
1240
- * }>()
1241
- *
1242
- * emit('change')
1243
- * emit('update', 1)
1244
- * ```
1245
- *
1246
- * This is only usable inside `<script setup>`, is compiled away in the
1247
- * output and should **not** be actually called at runtime.
1248
- *
1249
- * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
1250
- */
1251
- export declare function defineEmits<EE extends string = string>(emitOptions: EE[]): EmitFn<EE[]>;
1252
- export declare function defineEmits<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E>;
1253
- export declare function defineEmits<T extends ((...args: any[]) => any) | Record<string, any[]>>(): T extends (...args: any[]) => any ? T : ShortEmits<T>;
1254
- type RecordToUnion<T extends Record<string, any>> = T[keyof T];
1255
- type ShortEmits<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
1256
- [K in keyof T]: (evt: K, ...args: T[K]) => void;
1257
- }>>;
1258
- /**
1259
- * Vue `<script setup>` compiler macro for declaring a component's exposed
1260
- * instance properties when it is accessed by a parent component via template
1261
- * refs.
1262
- *
1263
- * `<script setup>` components are closed by default - i.e. variables inside
1264
- * the `<script setup>` scope is not exposed to parent unless explicitly exposed
1265
- * via `defineExpose`.
1266
- *
1267
- * This is only usable inside `<script setup>`, is compiled away in the
1268
- * output and should **not** be actually called at runtime.
1269
- *
1270
- * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
1271
- */
1272
- export declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
1273
- /**
1274
- * Vue `<script setup>` compiler macro for declaring a component's additional
1275
- * options. This should be used only for options that cannot be expressed via
1276
- * Composition API - e.g. `inheritAttrs`.
1277
- *
1278
- * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
1279
- */
1280
- export declare function defineOptions<RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin>(options?: ComponentOptionsWithoutProps<{}, RawBindings, D, C, M, Mixin, Extends> & {
1281
- emits?: undefined;
1282
- expose?: undefined;
1283
- slots?: undefined;
1284
- }): void;
1285
- export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
1286
- export type ModelRef<T, M extends string | number | symbol = string> = Ref<T> & [
1287
- ModelRef<T, M>,
1288
- Record<M, true | undefined>
1289
- ];
1290
- type DefineModelOptions<T = any> = {
1291
- get?: (v: T) => any;
1292
- set?: (v: T) => any;
1293
- };
1294
- /**
1295
- * Vue `<script setup>` compiler macro for declaring a
1296
- * two-way binding prop that can be consumed via `v-model` from the parent
1297
- * component. This will declare a prop with the same name and a corresponding
1298
- * `update:propName` event.
1299
- *
1300
- * If the first argument is a string, it will be used as the prop name;
1301
- * Otherwise the prop name will default to "modelValue". In both cases, you
1302
- * can also pass an additional object which will be used as the prop's options.
1303
- *
1304
- * The returned ref behaves differently depending on whether the parent
1305
- * provided the corresponding v-model props or not:
1306
- * - If yes, the returned ref's value will always be in sync with the parent
1307
- * prop.
1308
- * - If not, the returned ref will behave like a normal local ref.
1309
- *
1310
- * @example
1311
- * ```ts
1312
- * // default model (consumed via `v-model`)
1313
- * const modelValue = defineModel<string>()
1314
- * modelValue.value = "hello"
1315
- *
1316
- * // default model with options
1317
- * const modelValue = defineModel<string>({ required: true })
1318
- *
1319
- * // with specified name (consumed via `v-model:count`)
1320
- * const count = defineModel<number>('count')
1321
- * count.value++
1322
- *
1323
- * // with specified name and default value
1324
- * const count = defineModel<number>('count', { default: 0 })
1325
- * ```
1326
- */
1327
- export declare function defineModel<T, M extends string | number | symbol = string>(options: {
1328
- required: true;
1329
- } & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
1330
- export declare function defineModel<T, M extends string | number | symbol = string>(options: {
1331
- default: any;
1332
- } & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
1333
- export declare function defineModel<T, M extends string | number | symbol = string>(options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
1334
- export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
1335
- required: true;
1336
- } & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
1337
- export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
1338
- default: any;
1339
- } & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
1340
- export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
1341
- type NotUndefined<T> = T extends undefined ? never : T;
1342
- type MappedOmit<T, K extends keyof any> = {
1343
- [P in keyof T as P extends K ? never : P]: T[P];
1344
- };
1345
- type InferDefaults<T> = {
1346
- [K in keyof T]?: InferDefault<T, T[K]>;
1347
- };
1348
- type NativeType = null | number | string | boolean | symbol | Function;
1349
- type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
1350
- type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Readonly<MappedOmit<T, keyof Defaults>> & {
1351
- readonly [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? T[K] : NotUndefined<T[K]> : never;
1352
- } & {
1353
- readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
1354
- };
1355
- /**
1356
- * Vue `<script setup>` compiler macro for providing props default values when
1357
- * using type-based `defineProps` declaration.
1358
- *
1359
- * Example usage:
1360
- * ```ts
1361
- * withDefaults(defineProps<{
1362
- * size?: number
1363
- * labels?: string[]
1364
- * }>(), {
1365
- * size: 3,
1366
- * labels: () => ['default label']
1367
- * })
1368
- * ```
1369
- *
1370
- * This is only usable inside `<script setup>`, is compiled away in the output
1371
- * and should **not** be actually called at runtime.
1372
- *
1373
- * @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
1374
- */
1375
- export declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
1376
- export declare function useSlots(): SetupContext['slots'];
1377
- export declare function useAttrs(): SetupContext['attrs'];
1378
-
1379
1488
  export declare function useModel<M extends string | number | symbol, T extends Record<string, any>, K extends keyof T>(props: T, name: K, options?: DefineModelOptions<T[K]>): ModelRef<T[K], M>;
1380
1489
 
1381
1490
  type RawProps = VNodeProps & {
@@ -1438,7 +1547,8 @@ export declare enum ErrorCodes {
1438
1547
  APP_WARN_HANDLER = 11,
1439
1548
  FUNCTION_REF = 12,
1440
1549
  ASYNC_COMPONENT_LOADER = 13,
1441
- SCHEDULER = 14
1550
+ SCHEDULER = 14,
1551
+ APP_UNMOUNT_CLEANUP = 15
1442
1552
  }
1443
1553
  type ErrorTypes = LifecycleHooks | ErrorCodes;
1444
1554
  export declare function callWithErrorHandling(fn: Function, instance: ComponentInternalInstance | null, type: ErrorTypes, args?: unknown[]): any;
@@ -1651,6 +1761,18 @@ declare module '@vue/reactivity' {
1651
1761
  export declare const DeprecationTypes: typeof DeprecationTypes$1;
1652
1762
 
1653
1763
  export { createBaseVNode as createElementVNode, };
1764
+ // Note: this file is auto concatenated to the end of the bundled d.ts during
1765
+ // build.
1766
+
1767
+ declare module '@vue/runtime-core' {
1768
+ export interface GlobalComponents {
1769
+ Teleport: DefineComponent<TeleportProps>
1770
+ Suspense: DefineComponent<SuspenseProps>
1771
+ KeepAlive: DefineComponent<KeepAliveProps>
1772
+ BaseTransition: DefineComponent<BaseTransitionProps>
1773
+ }
1774
+ }
1775
+
1654
1776
  // Note: this file is auto concatenated to the end of the bundled d.ts during
1655
1777
  // build.
1656
1778
  type _defineProps = typeof defineProps