runtime-core.d.ts 90 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831
  1. import { computed as computed$1, Ref, OnCleanup, WatchStopHandle, ShallowUnwrapRef, UnwrapNestedRefs, DebuggerEvent, ComputedGetter, WritableComputedOptions, WatchCallback, ReactiveEffect, DebuggerOptions, WatchEffect, WatchHandle, WatchSource, ReactiveMarker, ShallowRef, WatchErrorCodes, reactive } from '@vue/reactivity';
  2. export { ComputedGetter, ComputedRef, ComputedSetter, CustomRefFactory, DebuggerEvent, DebuggerEventExtraInfo, DebuggerOptions, DeepReadonly, EffectScheduler, EffectScope, MaybeRef, MaybeRefOrGetter, Raw, Reactive, ReactiveEffect, ReactiveEffectOptions, ReactiveEffectRunner, ReactiveFlags, Ref, ShallowReactive, ShallowRef, ShallowUnwrapRef, ToRef, ToRefs, TrackOpTypes, TriggerOpTypes, UnwrapNestedRefs, UnwrapRef, WatchCallback, WatchEffect, WatchHandle, WatchSource, WatchStopHandle, WritableComputedOptions, WritableComputedRef, customRef, effect, effectScope, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, onWatcherCleanup, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
  3. import { IfAny, Prettify, LooseRequired, UnionToIntersection, OverloadParameters } from '@vue/shared';
  4. export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
  5. export declare const computed: typeof computed$1;
  6. export type Slot<T extends any = any> = (...args: IfAny<T, any[], [T] | (T extends undefined ? [] : never)>) => VNode[];
  7. type InternalSlots = {
  8. [name: string]: Slot | undefined;
  9. };
  10. export type Slots = Readonly<InternalSlots>;
  11. declare const SlotSymbol: unique symbol;
  12. export type SlotsType<T extends Record<string, any> = Record<string, any>> = {
  13. [SlotSymbol]?: T;
  14. };
  15. type StrictUnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<T> & T;
  16. type UnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<Prettify<{
  17. [K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? T[K] : Slot<T[K]>;
  18. }>>;
  19. type RawSlots = {
  20. [name: string]: unknown;
  21. $stable?: boolean;
  22. };
  23. declare enum SchedulerJobFlags {
  24. QUEUED = 1,
  25. PRE = 2,
  26. /**
  27. * Indicates whether the effect is allowed to recursively trigger itself
  28. * when managed by the scheduler.
  29. *
  30. * By default, a job cannot trigger itself because some built-in method calls,
  31. * e.g. Array.prototype.push actually performs reads as well (#1740) which
  32. * can lead to confusing infinite loops.
  33. * The allowed cases are component update functions and watch callbacks.
  34. * Component update functions may update child component props, which in turn
  35. * trigger flush: "pre" watch callbacks that mutates state that the parent
  36. * relies on (#1801). Watch callbacks doesn't track its dependencies so if it
  37. * triggers itself again, it's likely intentional and it is the user's
  38. * responsibility to perform recursive state mutation that eventually
  39. * stabilizes (#1727).
  40. */
  41. ALLOW_RECURSE = 4,
  42. DISPOSED = 8
  43. }
  44. interface SchedulerJob extends Function {
  45. id?: number;
  46. /**
  47. * flags can technically be undefined, but it can still be used in bitwise
  48. * operations just like 0.
  49. */
  50. flags?: SchedulerJobFlags;
  51. /**
  52. * Attached by renderer.ts when setting up a component's render effect
  53. * Used to obtain component information when reporting max recursive updates.
  54. */
  55. i?: ComponentInternalInstance;
  56. }
  57. type SchedulerJobs = SchedulerJob | SchedulerJob[];
  58. export declare function nextTick<T = void, R = void>(this: T, fn?: (this: T) => R): Promise<Awaited<R>>;
  59. export declare function queuePostFlushCb(cb: SchedulerJobs): void;
  60. export type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
  61. export type ComponentObjectPropsOptions<P = Data> = {
  62. [K in keyof P]: Prop<P[K]> | null;
  63. };
  64. export type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
  65. type DefaultFactory<T> = (props: Data) => T | null | undefined;
  66. interface PropOptions<T = any, D = T> {
  67. type?: PropType<T> | true | null;
  68. required?: boolean;
  69. default?: D | DefaultFactory<D> | null | undefined | object;
  70. validator?(value: unknown, props: Data): boolean;
  71. }
  72. export type PropType<T> = PropConstructor<T> | (PropConstructor<T> | null)[];
  73. type PropConstructor<T = any> = {
  74. new (...args: any[]): T & {};
  75. } | {
  76. (): T;
  77. } | PropMethod<T>;
  78. type PropMethod<T, TConstructor = any> = [T] extends [
  79. ((...args: any) => any) | undefined
  80. ] ? {
  81. new (): TConstructor;
  82. (): T;
  83. readonly prototype: TConstructor;
  84. } : never;
  85. type RequiredKeys<T> = {
  86. [K in keyof T]: T[K] extends {
  87. required: true;
  88. } | {
  89. default: any;
  90. } | BooleanConstructor | {
  91. type: BooleanConstructor;
  92. } ? T[K] extends {
  93. default: undefined | (() => undefined);
  94. } ? never : K : never;
  95. }[keyof T];
  96. type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
  97. type DefaultKeys<T> = {
  98. [K in keyof T]: T[K] extends {
  99. default: any;
  100. } | BooleanConstructor | {
  101. type: BooleanConstructor;
  102. } ? T[K] extends {
  103. type: BooleanConstructor;
  104. required: true;
  105. } ? never : K : never;
  106. }[keyof T];
  107. type InferPropType<T, NullAsAny = true> = [T] extends [null] ? NullAsAny extends true ? any : null : [T] extends [{
  108. type: null | true;
  109. }] ? any : [T] extends [ObjectConstructor | {
  110. type: ObjectConstructor;
  111. }] ? Record<string, any> : [T] extends [BooleanConstructor | {
  112. type: BooleanConstructor;
  113. }] ? boolean : [T] extends [DateConstructor | {
  114. type: DateConstructor;
  115. }] ? Date : [T] extends [(infer U)[] | {
  116. type: (infer U)[];
  117. }] ? 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;
  118. /**
  119. * Extract prop types from a runtime props options object.
  120. * The extracted types are **internal** - i.e. the resolved props received by
  121. * the component.
  122. * - Boolean props are always present
  123. * - Props with default values are always present
  124. *
  125. * To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
  126. */
  127. export type ExtractPropTypes<O> = {
  128. [K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>;
  129. } & {
  130. [K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
  131. };
  132. type PublicRequiredKeys<T> = {
  133. [K in keyof T]: T[K] extends {
  134. required: true;
  135. } ? K : never;
  136. }[keyof T];
  137. type PublicOptionalKeys<T> = Exclude<keyof T, PublicRequiredKeys<T>>;
  138. /**
  139. * Extract prop types from a runtime props options object.
  140. * The extracted types are **public** - i.e. the expected props that can be
  141. * passed to component.
  142. */
  143. export type ExtractPublicPropTypes<O> = {
  144. [K in keyof Pick<O, PublicRequiredKeys<O>>]: InferPropType<O[K]>;
  145. } & {
  146. [K in keyof Pick<O, PublicOptionalKeys<O>>]?: InferPropType<O[K]>;
  147. };
  148. export type ExtractDefaultPropTypes<O> = O extends object ? {
  149. [K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
  150. } : {};
  151. /**
  152. * Vue `<script setup>` compiler macro for declaring component props. The
  153. * expected argument is the same as the component `props` option.
  154. *
  155. * Example runtime declaration:
  156. * ```js
  157. * // using Array syntax
  158. * const props = defineProps(['foo', 'bar'])
  159. * // using Object syntax
  160. * const props = defineProps({
  161. * foo: String,
  162. * bar: {
  163. * type: Number,
  164. * required: true
  165. * }
  166. * })
  167. * ```
  168. *
  169. * Equivalent type-based declaration:
  170. * ```ts
  171. * // will be compiled into equivalent runtime declarations
  172. * const props = defineProps<{
  173. * foo?: string
  174. * bar: number
  175. * }>()
  176. * ```
  177. *
  178. * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
  179. *
  180. * This is only usable inside `<script setup>`, is compiled away in the
  181. * output and should **not** be actually called at runtime.
  182. */
  183. export declare function defineProps<PropNames extends string = string>(props: PropNames[]): Prettify<Readonly<{
  184. [key in PropNames]?: any;
  185. }>>;
  186. export declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
  187. export declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
  188. export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
  189. readonly [K in BKeys]-?: boolean;
  190. };
  191. type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
  192. /**
  193. * Vue `<script setup>` compiler macro for declaring a component's emitted
  194. * events. The expected argument is the same as the component `emits` option.
  195. *
  196. * Example runtime declaration:
  197. * ```js
  198. * const emit = defineEmits(['change', 'update'])
  199. * ```
  200. *
  201. * Example type-based declaration:
  202. * ```ts
  203. * const emit = defineEmits<{
  204. * // <eventName>: <expected arguments>
  205. * change: []
  206. * update: [value: number] // named tuple syntax
  207. * }>()
  208. *
  209. * emit('change')
  210. * emit('update', 1)
  211. * ```
  212. *
  213. * This is only usable inside `<script setup>`, is compiled away in the
  214. * output and should **not** be actually called at runtime.
  215. *
  216. * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
  217. */
  218. export declare function defineEmits<EE extends string = string>(emitOptions: EE[]): EmitFn<EE[]>;
  219. export declare function defineEmits<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E>;
  220. export declare function defineEmits<T extends ComponentTypeEmits>(): T extends (...args: any[]) => any ? T : ShortEmits<T>;
  221. export type ComponentTypeEmits = ((...args: any[]) => any) | Record<string, any[]>;
  222. type RecordToUnion<T extends Record<string, any>> = T[keyof T];
  223. type ShortEmits<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
  224. [K in keyof T]: (evt: K, ...args: T[K]) => void;
  225. }>>;
  226. /**
  227. * Vue `<script setup>` compiler macro for declaring a component's exposed
  228. * instance properties when it is accessed by a parent component via template
  229. * refs.
  230. *
  231. * `<script setup>` components are closed by default - i.e. variables inside
  232. * the `<script setup>` scope is not exposed to parent unless explicitly exposed
  233. * via `defineExpose`.
  234. *
  235. * This is only usable inside `<script setup>`, is compiled away in the
  236. * output and should **not** be actually called at runtime.
  237. *
  238. * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
  239. */
  240. export declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
  241. /**
  242. * Vue `<script setup>` compiler macro for declaring a component's additional
  243. * options. This should be used only for options that cannot be expressed via
  244. * Composition API - e.g. `inheritAttrs`.
  245. *
  246. * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
  247. */
  248. 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, {}> & {
  249. /**
  250. * props should be defined via defineProps().
  251. */
  252. props?: never;
  253. /**
  254. * emits should be defined via defineEmits().
  255. */
  256. emits?: never;
  257. /**
  258. * expose should be defined via defineExpose().
  259. */
  260. expose?: never;
  261. /**
  262. * slots should be defined via defineSlots().
  263. */
  264. slots?: never;
  265. }): void;
  266. export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
  267. export type ModelRef<T, M extends PropertyKey = string, G = T, S = T> = Ref<G, S> & [
  268. ModelRef<T, M, G, S>,
  269. Record<M, true | undefined>
  270. ];
  271. type DefineModelOptions<T = any, G = T, S = T> = {
  272. get?: (v: T) => G;
  273. set?: (v: S) => any;
  274. };
  275. /**
  276. * Vue `<script setup>` compiler macro for declaring a
  277. * two-way binding prop that can be consumed via `v-model` from the parent
  278. * component. This will declare a prop with the same name and a corresponding
  279. * `update:propName` event.
  280. *
  281. * If the first argument is a string, it will be used as the prop name;
  282. * Otherwise the prop name will default to "modelValue". In both cases, you
  283. * can also pass an additional object which will be used as the prop's options.
  284. *
  285. * The returned ref behaves differently depending on whether the parent
  286. * provided the corresponding v-model props or not:
  287. * - If yes, the returned ref's value will always be in sync with the parent
  288. * prop.
  289. * - If not, the returned ref will behave like a normal local ref.
  290. *
  291. * @example
  292. * ```ts
  293. * // default model (consumed via `v-model`)
  294. * const modelValue = defineModel<string>()
  295. * modelValue.value = "hello"
  296. *
  297. * // default model with options
  298. * const modelValue = defineModel<string>({ required: true })
  299. *
  300. * // with specified name (consumed via `v-model:count`)
  301. * const count = defineModel<number>('count')
  302. * count.value++
  303. *
  304. * // with specified name and default value
  305. * const count = defineModel<number>('count', { default: 0 })
  306. * ```
  307. */
  308. export declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(options: ({
  309. default: any;
  310. } | {
  311. required: true;
  312. }) & PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T, M, G, S>;
  313. export declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(options?: PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T | undefined, M, G | undefined, S | undefined>;
  314. export declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(name: string, options: ({
  315. default: any;
  316. } | {
  317. required: true;
  318. }) & PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T, M, G, S>;
  319. export declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(name: string, options?: PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T | undefined, M, G | undefined, S | undefined>;
  320. type NotUndefined<T> = T extends undefined ? never : T;
  321. type MappedOmit<T, K extends keyof any> = {
  322. [P in keyof T as P extends K ? never : P]: T[P];
  323. };
  324. type InferDefaults<T> = {
  325. [K in keyof T]?: InferDefault<T, T[K]>;
  326. };
  327. type NativeType = null | number | string | boolean | symbol | Function;
  328. type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
  329. type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Readonly<MappedOmit<T, keyof Defaults>> & {
  330. readonly [K in keyof Defaults as K extends keyof T ? K : never]-?: K extends keyof T ? Defaults[K] extends undefined ? IfAny<Defaults[K], NotUndefined<T[K]>, T[K]> : NotUndefined<T[K]> : never;
  331. } & {
  332. readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
  333. };
  334. /**
  335. * Vue `<script setup>` compiler macro for providing props default values when
  336. * using type-based `defineProps` declaration.
  337. *
  338. * Example usage:
  339. * ```ts
  340. * withDefaults(defineProps<{
  341. * size?: number
  342. * labels?: string[]
  343. * }>(), {
  344. * size: 3,
  345. * labels: () => ['default label']
  346. * })
  347. * ```
  348. *
  349. * This is only usable inside `<script setup>`, is compiled away in the output
  350. * and should **not** be actually called at runtime.
  351. *
  352. * @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
  353. */
  354. export declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
  355. export declare function useSlots(): SetupContext['slots'];
  356. export declare function useAttrs(): SetupContext['attrs'];
  357. export type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
  358. export type EmitsOptions = ObjectEmitsOptions | string[];
  359. export type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> = T extends string[] ? {
  360. [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any;
  361. } : T extends ObjectEmitsOptions ? {
  362. [K in string & keyof T as `on${Capitalize<K>}`]?: (...args: T[K] extends (...args: infer P) => any ? P : T[K] extends null ? any[] : never) => any;
  363. } : {};
  364. type TypeEmitsToOptions<T extends ComponentTypeEmits> = {
  365. [K in keyof T & string]: T[K] extends [...args: infer Args] ? (...args: Args) => any : () => any;
  366. } & (T extends (...args: any[]) => any ? ParametersToFns<OverloadParameters<T>> : {});
  367. type ParametersToFns<T extends any[]> = {
  368. [K in T[0]]: K extends `${infer C}` ? (...args: T extends [C, ...infer Args] ? Args : never) => any : never;
  369. };
  370. export type ShortEmitsToObject<E> = E extends Record<string, any[]> ? {
  371. [K in keyof E]: (...args: E[K]) => any;
  372. } : E;
  373. export 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<{
  374. [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;
  375. }[Event]>;
  376. /**
  377. Runtime helper for applying directives to a vnode. Example usage:
  378. const comp = resolveComponent('comp')
  379. const foo = resolveDirective('foo')
  380. const bar = resolveDirective('bar')
  381. return withDirectives(h(comp), [
  382. [foo, this.x],
  383. [bar, this.y]
  384. ])
  385. */
  386. export interface DirectiveBinding<Value = any, Modifiers extends string = string, Arg extends string = string> {
  387. instance: ComponentPublicInstance | Record<string, any> | null;
  388. value: Value;
  389. oldValue: Value | null;
  390. arg?: Arg;
  391. modifiers: DirectiveModifiers<Modifiers>;
  392. dir: ObjectDirective<any, Value>;
  393. }
  394. 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;
  395. type SSRDirectiveHook<Value = any, Modifiers extends string = string, Arg extends string = string> = (binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode) => Data | undefined;
  396. export interface ObjectDirective<HostElement = any, Value = any, Modifiers extends string = string, Arg extends string = string> {
  397. created?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
  398. beforeMount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
  399. mounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
  400. beforeUpdate?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
  401. updated?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
  402. beforeUnmount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
  403. unmounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
  404. getSSRProps?: SSRDirectiveHook<Value, Modifiers, Arg>;
  405. deep?: boolean;
  406. }
  407. export type FunctionDirective<HostElement = any, V = any, Modifiers extends string = string, Arg extends string = string> = DirectiveHook<HostElement, any, V, Modifiers, Arg>;
  408. 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>;
  409. type DirectiveModifiers<K extends string = string> = Record<K, boolean>;
  410. export type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, string] | [Directive | undefined, any, string | undefined, DirectiveModifiers]>;
  411. /**
  412. * Adds directives to a VNode.
  413. */
  414. export declare function withDirectives<T extends VNode>(vnode: T, directives: DirectiveArguments): T;
  415. /**
  416. * Custom properties added to component instances in any way and can be accessed through `this`
  417. *
  418. * @example
  419. * Here is an example of adding a property `$router` to every component instance:
  420. * ```ts
  421. * import { createApp } from 'vue'
  422. * import { Router, createRouter } from 'vue-router'
  423. *
  424. * declare module 'vue' {
  425. * interface ComponentCustomProperties {
  426. * $router: Router
  427. * }
  428. * }
  429. *
  430. * // effectively adding the router to every component instance
  431. * const app = createApp({})
  432. * const router = createRouter()
  433. * app.config.globalProperties.$router = router
  434. *
  435. * const vm = app.mount('#app')
  436. * // we can access the router from the instance
  437. * vm.$router.push('/')
  438. * ```
  439. */
  440. export interface ComponentCustomProperties {
  441. }
  442. type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin ? ComponentOptionsMixin extends T ? true : false : false;
  443. 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;
  444. type ExtractMixin<T> = {
  445. Mixin: MixinToOptionTypes<T>;
  446. }[T extends ComponentOptionsMixin ? 'Mixin' : never];
  447. type IntersectionMixin<T> = IsDefaultMixinComponent<T> extends true ? OptionTypesType : UnionToIntersection<ExtractMixin<T>>;
  448. type UnwrapMixinsType<T, Type extends OptionTypesKeys> = T extends OptionTypesType ? T[Type] : never;
  449. type EnsureNonVoid<T> = T extends void ? {} : T;
  450. type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props, RawBindings, D, C, M> = ComponentPublicInstance<any>, Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions> = {
  451. __isFragment?: never;
  452. __isTeleport?: never;
  453. __isSuspense?: never;
  454. new (...args: any[]): T;
  455. };
  456. /**
  457. * @deprecated This is no longer used internally, but exported and relied on by
  458. * existing library types generated by vue-tsc.
  459. */
  460. 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>;
  461. /**
  462. * This is the same as `CreateComponentPublicInstance` but adds local components,
  463. * global directives, exposed, and provide inference.
  464. * It changes the arguments order so that we don't need to repeat mixin
  465. * inference everywhere internally, but it has to be a new type to avoid
  466. * breaking types that relies on previous arguments order (#10842)
  467. */
  468. 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, TypeRefs extends Data = {}, TypeEl extends Element = any, 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, TypeRefs, TypeEl>;
  469. type ExposedKeys<T, Exposed extends string & keyof T> = '' extends Exposed ? T : Pick<T, Exposed>;
  470. export type ComponentPublicInstance<P = {}, // props type extracted from props option
  471. B = {}, // raw bindings returned from setup()
  472. D = {}, // return from data()
  473. C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = {}, 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 = '', TypeRefs extends Data = {}, TypeEl extends Element = any> = {
  474. $: ComponentInternalInstance;
  475. $data: D;
  476. $props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
  477. $attrs: Data;
  478. $refs: Data & TypeRefs;
  479. $slots: UnwrapSlotsType<S>;
  480. $root: ComponentPublicInstance | null;
  481. $parent: ComponentPublicInstance | null;
  482. $host: Element | null;
  483. $emit: EmitFn<E>;
  484. $el: TypeEl;
  485. $options: Options & MergedComponentOptionsOverride;
  486. $forceUpdate: () => void;
  487. $nextTick: typeof nextTick;
  488. $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, OnCleanup]) => any : (...args: [any, any, OnCleanup]) => any, options?: WatchOptions): WatchStopHandle;
  489. } & ExposedKeys<IfAny<P, P, Readonly<Defaults> & Omit<P, keyof ShallowUnwrapRef<B> | keyof Defaults>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>, Exposed>;
  490. declare enum LifecycleHooks {
  491. BEFORE_CREATE = "bc",
  492. CREATED = "c",
  493. BEFORE_MOUNT = "bm",
  494. MOUNTED = "m",
  495. BEFORE_UPDATE = "bu",
  496. UPDATED = "u",
  497. BEFORE_UNMOUNT = "bum",
  498. UNMOUNTED = "um",
  499. DEACTIVATED = "da",
  500. ACTIVATED = "a",
  501. RENDER_TRIGGERED = "rtg",
  502. RENDER_TRACKED = "rtc",
  503. ERROR_CAPTURED = "ec",
  504. SERVER_PREFETCH = "sp"
  505. }
  506. export interface SuspenseProps {
  507. onResolve?: () => void;
  508. onPending?: () => void;
  509. onFallback?: () => void;
  510. timeout?: string | number;
  511. /**
  512. * Allow suspense to be captured by parent suspense
  513. *
  514. * @default false
  515. */
  516. suspensible?: boolean;
  517. }
  518. declare const SuspenseImpl: {
  519. name: string;
  520. __isSuspense: boolean;
  521. 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;
  522. hydrate: typeof hydrateSuspense;
  523. normalize: typeof normalizeSuspenseChildren;
  524. };
  525. export declare const Suspense: {
  526. __isSuspense: true;
  527. new (): {
  528. $props: VNodeProps & SuspenseProps;
  529. $slots: {
  530. default(): VNode[];
  531. fallback(): VNode[];
  532. };
  533. };
  534. };
  535. export interface SuspenseBoundary {
  536. vnode: VNode<RendererNode, RendererElement, SuspenseProps>;
  537. parent: SuspenseBoundary | null;
  538. parentComponent: ComponentInternalInstance | null;
  539. namespace: ElementNamespace;
  540. container: RendererElement;
  541. hiddenContainer: RendererElement;
  542. activeBranch: VNode | null;
  543. pendingBranch: VNode | null;
  544. deps: number;
  545. pendingId: number;
  546. timeout: number;
  547. isInFallback: boolean;
  548. isHydrating: boolean;
  549. isUnmounted: boolean;
  550. effects: Function[];
  551. resolve(force?: boolean, sync?: boolean): void;
  552. fallback(fallbackVNode: VNode): void;
  553. move(container: RendererElement, anchor: RendererNode | null, type: MoveType): void;
  554. next(): RendererNode | null;
  555. registerDep(instance: ComponentInternalInstance, setupRenderEffect: SetupRenderEffectFn, optimized: boolean): void;
  556. unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void;
  557. }
  558. 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;
  559. declare function normalizeSuspenseChildren(vnode: VNode): void;
  560. export type RootHydrateFunction = (vnode: VNode<Node, Element>, container: (Element | ShadowRoot) & {
  561. _vnode?: VNode;
  562. }) => void;
  563. type Hook<T = () => void> = T | T[];
  564. export interface BaseTransitionProps<HostElement = RendererElement> {
  565. mode?: 'in-out' | 'out-in' | 'default';
  566. appear?: boolean;
  567. persisted?: boolean;
  568. onBeforeEnter?: Hook<(el: HostElement) => void>;
  569. onEnter?: Hook<(el: HostElement, done: () => void) => void>;
  570. onAfterEnter?: Hook<(el: HostElement) => void>;
  571. onEnterCancelled?: Hook<(el: HostElement) => void>;
  572. onBeforeLeave?: Hook<(el: HostElement) => void>;
  573. onLeave?: Hook<(el: HostElement, done: () => void) => void>;
  574. onAfterLeave?: Hook<(el: HostElement) => void>;
  575. onLeaveCancelled?: Hook<(el: HostElement) => void>;
  576. onBeforeAppear?: Hook<(el: HostElement) => void>;
  577. onAppear?: Hook<(el: HostElement, done: () => void) => void>;
  578. onAfterAppear?: Hook<(el: HostElement) => void>;
  579. onAppearCancelled?: Hook<(el: HostElement) => void>;
  580. }
  581. export interface TransitionHooks<HostElement = RendererElement> {
  582. mode: BaseTransitionProps['mode'];
  583. persisted: boolean;
  584. beforeEnter(el: HostElement): void;
  585. enter(el: HostElement): void;
  586. leave(el: HostElement, remove: () => void): void;
  587. clone(vnode: VNode): TransitionHooks<HostElement>;
  588. afterLeave?(): void;
  589. delayLeave?(el: HostElement, earlyRemove: () => void, delayedLeave: () => void): void;
  590. delayedLeave?(): void;
  591. }
  592. export interface TransitionState {
  593. isMounted: boolean;
  594. isLeaving: boolean;
  595. isUnmounting: boolean;
  596. leavingVNodes: Map<any, Record<string, VNode>>;
  597. }
  598. export declare function useTransitionState(): TransitionState;
  599. export declare const BaseTransitionPropsValidators: Record<string, any>;
  600. export declare const BaseTransition: {
  601. new (): {
  602. $props: BaseTransitionProps<any>;
  603. $slots: {
  604. default(): VNode[];
  605. };
  606. };
  607. };
  608. export declare function resolveTransitionHooks(vnode: VNode, props: BaseTransitionProps<any>, state: TransitionState, instance: ComponentInternalInstance, postClone?: (hooks: TransitionHooks) => void): TransitionHooks;
  609. export declare function setTransitionHooks(vnode: VNode, hooks: TransitionHooks): void;
  610. export declare function getTransitionRawChildren(children: VNode[], keepComment?: boolean, parentKey?: VNode['key']): VNode[];
  611. export interface Renderer<HostElement = RendererElement> {
  612. render: RootRenderFunction<HostElement>;
  613. createApp: CreateAppFunction<HostElement>;
  614. }
  615. export interface HydrationRenderer extends Renderer<Element | ShadowRoot> {
  616. hydrate: RootHydrateFunction;
  617. }
  618. export type ElementNamespace = 'svg' | 'mathml' | undefined;
  619. export type RootRenderFunction<HostElement = RendererElement> = (vnode: VNode | null, container: HostElement, namespace?: ElementNamespace) => void;
  620. export interface RendererOptions<HostNode = RendererNode, HostElement = RendererElement> {
  621. patchProp(el: HostElement, key: string, prevValue: any, nextValue: any, namespace?: ElementNamespace, parentComponent?: ComponentInternalInstance | null): void;
  622. insert(el: HostNode, parent: HostElement, anchor?: HostNode | null): void;
  623. remove(el: HostNode): void;
  624. createElement(type: string, namespace?: ElementNamespace, isCustomizedBuiltIn?: string, vnodeProps?: (VNodeProps & {
  625. [key: string]: any;
  626. }) | null): HostElement;
  627. createText(text: string): HostNode;
  628. createComment(text: string): HostNode;
  629. setText(node: HostNode, text: string): void;
  630. setElementText(node: HostElement, text: string): void;
  631. parentNode(node: HostNode): HostElement | null;
  632. nextSibling(node: HostNode): HostNode | null;
  633. querySelector?(selector: string): HostElement | null;
  634. setScopeId?(el: HostElement, id: string): void;
  635. cloneNode?(node: HostNode): HostNode;
  636. insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, namespace: ElementNamespace, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode];
  637. }
  638. export interface RendererNode {
  639. [key: string | symbol]: any;
  640. }
  641. export interface RendererElement extends RendererNode {
  642. }
  643. interface RendererInternals<HostNode = RendererNode, HostElement = RendererElement> {
  644. p: PatchFn;
  645. um: UnmountFn;
  646. r: RemoveFn;
  647. m: MoveFn;
  648. mt: MountComponentFn;
  649. mc: MountChildrenFn;
  650. pc: PatchChildrenFn;
  651. pbc: PatchBlockChildrenFn;
  652. n: NextFn;
  653. o: RendererOptions<HostNode, HostElement>;
  654. }
  655. type PatchFn = (n1: VNode | null, // null means this is a mount
  656. n2: VNode, container: RendererElement, anchor?: RendererNode | null, parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, namespace?: ElementNamespace, slotScopeIds?: string[] | null, optimized?: boolean) => void;
  657. 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;
  658. 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;
  659. type PatchBlockChildrenFn = (oldChildren: VNode[], newChildren: VNode[], fallbackContainer: RendererElement, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null) => void;
  660. type MoveFn = (vnode: VNode, container: RendererElement, anchor: RendererNode | null, type: MoveType, parentSuspense?: SuspenseBoundary | null) => void;
  661. type NextFn = (vnode: VNode) => RendererNode | null;
  662. type UnmountFn = (vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean) => void;
  663. type RemoveFn = (vnode: VNode) => void;
  664. type MountComponentFn = (initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
  665. type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
  666. declare enum MoveType {
  667. ENTER = 0,
  668. LEAVE = 1,
  669. REORDER = 2
  670. }
  671. /**
  672. * The createRenderer function accepts two generic arguments:
  673. * HostNode and HostElement, corresponding to Node and Element types in the
  674. * host environment. For example, for runtime-dom, HostNode would be the DOM
  675. * `Node` interface and HostElement would be the DOM `Element` interface.
  676. *
  677. * Custom renderers can pass in the platform specific types like this:
  678. *
  679. * ``` js
  680. * const { render, createApp } = createRenderer<Node, Element>({
  681. * patchProp,
  682. * ...nodeOps
  683. * })
  684. * ```
  685. */
  686. export declare function createRenderer<HostNode = RendererNode, HostElement = RendererElement>(options: RendererOptions<HostNode, HostElement>): Renderer<HostElement>;
  687. export declare function createHydrationRenderer(options: RendererOptions<Node, Element>): HydrationRenderer;
  688. type MatchPattern = string | RegExp | (string | RegExp)[];
  689. export interface KeepAliveProps {
  690. include?: MatchPattern;
  691. exclude?: MatchPattern;
  692. max?: number | string;
  693. }
  694. export declare const KeepAlive: {
  695. __isKeepAlive: true;
  696. new (): {
  697. $props: VNodeProps & KeepAliveProps;
  698. $slots: {
  699. default(): VNode[];
  700. };
  701. };
  702. };
  703. export declare function onActivated(hook: Function, target?: ComponentInternalInstance | null): void;
  704. export declare function onDeactivated(hook: Function, target?: ComponentInternalInstance | null): void;
  705. type CreateHook<T = any> = (hook: T, target?: ComponentInternalInstance | null) => void;
  706. export declare const onBeforeMount: CreateHook;
  707. export declare const onMounted: CreateHook;
  708. export declare const onBeforeUpdate: CreateHook;
  709. export declare const onUpdated: CreateHook;
  710. export declare const onBeforeUnmount: CreateHook;
  711. export declare const onUnmounted: CreateHook;
  712. export declare const onServerPrefetch: CreateHook;
  713. type DebuggerHook = (e: DebuggerEvent) => void;
  714. export declare const onRenderTriggered: CreateHook<DebuggerHook>;
  715. export declare const onRenderTracked: CreateHook<DebuggerHook>;
  716. type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
  717. export declare function onErrorCaptured<TError = Error>(hook: ErrorCapturedHook<TError>, target?: ComponentInternalInstance | null): void;
  718. declare enum DeprecationTypes$1 {
  719. GLOBAL_MOUNT = "GLOBAL_MOUNT",
  720. GLOBAL_MOUNT_CONTAINER = "GLOBAL_MOUNT_CONTAINER",
  721. GLOBAL_EXTEND = "GLOBAL_EXTEND",
  722. GLOBAL_PROTOTYPE = "GLOBAL_PROTOTYPE",
  723. GLOBAL_SET = "GLOBAL_SET",
  724. GLOBAL_DELETE = "GLOBAL_DELETE",
  725. GLOBAL_OBSERVABLE = "GLOBAL_OBSERVABLE",
  726. GLOBAL_PRIVATE_UTIL = "GLOBAL_PRIVATE_UTIL",
  727. CONFIG_SILENT = "CONFIG_SILENT",
  728. CONFIG_DEVTOOLS = "CONFIG_DEVTOOLS",
  729. CONFIG_KEY_CODES = "CONFIG_KEY_CODES",
  730. CONFIG_PRODUCTION_TIP = "CONFIG_PRODUCTION_TIP",
  731. CONFIG_IGNORED_ELEMENTS = "CONFIG_IGNORED_ELEMENTS",
  732. CONFIG_WHITESPACE = "CONFIG_WHITESPACE",
  733. CONFIG_OPTION_MERGE_STRATS = "CONFIG_OPTION_MERGE_STRATS",
  734. INSTANCE_SET = "INSTANCE_SET",
  735. INSTANCE_DELETE = "INSTANCE_DELETE",
  736. INSTANCE_DESTROY = "INSTANCE_DESTROY",
  737. INSTANCE_EVENT_EMITTER = "INSTANCE_EVENT_EMITTER",
  738. INSTANCE_EVENT_HOOKS = "INSTANCE_EVENT_HOOKS",
  739. INSTANCE_CHILDREN = "INSTANCE_CHILDREN",
  740. INSTANCE_LISTENERS = "INSTANCE_LISTENERS",
  741. INSTANCE_SCOPED_SLOTS = "INSTANCE_SCOPED_SLOTS",
  742. INSTANCE_ATTRS_CLASS_STYLE = "INSTANCE_ATTRS_CLASS_STYLE",
  743. OPTIONS_DATA_FN = "OPTIONS_DATA_FN",
  744. OPTIONS_DATA_MERGE = "OPTIONS_DATA_MERGE",
  745. OPTIONS_BEFORE_DESTROY = "OPTIONS_BEFORE_DESTROY",
  746. OPTIONS_DESTROYED = "OPTIONS_DESTROYED",
  747. WATCH_ARRAY = "WATCH_ARRAY",
  748. PROPS_DEFAULT_THIS = "PROPS_DEFAULT_THIS",
  749. V_ON_KEYCODE_MODIFIER = "V_ON_KEYCODE_MODIFIER",
  750. CUSTOM_DIR = "CUSTOM_DIR",
  751. ATTR_FALSE_VALUE = "ATTR_FALSE_VALUE",
  752. ATTR_ENUMERATED_COERCION = "ATTR_ENUMERATED_COERCION",
  753. TRANSITION_CLASSES = "TRANSITION_CLASSES",
  754. TRANSITION_GROUP_ROOT = "TRANSITION_GROUP_ROOT",
  755. COMPONENT_ASYNC = "COMPONENT_ASYNC",
  756. COMPONENT_FUNCTIONAL = "COMPONENT_FUNCTIONAL",
  757. COMPONENT_V_MODEL = "COMPONENT_V_MODEL",
  758. RENDER_FUNCTION = "RENDER_FUNCTION",
  759. FILTERS = "FILTERS",
  760. PRIVATE_APIS = "PRIVATE_APIS"
  761. }
  762. type CompatConfig = Partial<Record<DeprecationTypes$1, boolean | 'suppress-warning'>> & {
  763. MODE?: 2 | 3 | ((comp: Component | null) => 2 | 3);
  764. };
  765. declare function configureCompat(config: CompatConfig): void;
  766. /**
  767. * Interface for declaring custom options.
  768. *
  769. * @example
  770. * ```ts
  771. * declare module 'vue' {
  772. * interface ComponentCustomOptions {
  773. * beforeRouteUpdate?(
  774. * to: Route,
  775. * from: Route,
  776. * next: () => void
  777. * ): void
  778. * }
  779. * }
  780. * ```
  781. */
  782. export interface ComponentCustomOptions {
  783. }
  784. export type RenderFunction = () => VNodeChild;
  785. 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 {
  786. setup?: (this: void, props: LooseRequired<Props & Prettify<UnwrapMixinsType<IntersectionMixin<Mixin> & IntersectionMixin<Extends>, 'P'>>>, ctx: SetupContext<E, S>) => Promise<RawBindings> | RawBindings | RenderFunction | void;
  787. name?: string;
  788. template?: string | object;
  789. render?: Function;
  790. components?: LC & Record<string, Component>;
  791. directives?: Directives & Record<string, Directive>;
  792. inheritAttrs?: boolean;
  793. emits?: (E | EE[]) & ThisType<void>;
  794. slots?: S;
  795. expose?: Exposed[];
  796. serverPrefetch?(): void | Promise<any>;
  797. compilerOptions?: RuntimeCompilerOptions;
  798. call?: (this: unknown, ...args: unknown[]) => never;
  799. __isFragment?: never;
  800. __isTeleport?: never;
  801. __isSuspense?: never;
  802. __defaults?: Defaults;
  803. }
  804. /**
  805. * Subset of compiler options that makes sense for the runtime.
  806. */
  807. export interface RuntimeCompilerOptions {
  808. isCustomElement?: (tag: string) => boolean;
  809. whitespace?: 'preserve' | 'condense';
  810. comments?: boolean;
  811. delimiters?: [string, string];
  812. }
  813. 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>>;
  814. export type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
  815. export type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
  816. export interface MethodOptions {
  817. [key: string]: Function;
  818. }
  819. type ExtractComputedReturns<T extends any> = {
  820. [key in keyof T]: T[key] extends {
  821. get: (...args: any[]) => infer TReturn;
  822. } ? TReturn : T[key] extends (...args: any[]) => infer TReturn ? TReturn : never;
  823. };
  824. type ObjectWatchOptionItem = {
  825. handler: WatchCallback | string;
  826. } & WatchOptions;
  827. type WatchOptionItem = string | WatchCallback | ObjectWatchOptionItem;
  828. type ComponentWatchOptionItem = WatchOptionItem | WatchOptionItem[];
  829. type ComponentWatchOptions = Record<string, ComponentWatchOptionItem>;
  830. export type ComponentProvideOptions = ObjectProvideOptions | Function;
  831. type ObjectProvideOptions = Record<string | symbol, unknown>;
  832. export type ComponentInjectOptions = string[] | ObjectInjectOptions;
  833. type ObjectInjectOptions = Record<string | symbol, string | symbol | {
  834. from?: string | symbol;
  835. default?: unknown;
  836. }>;
  837. type InjectToObject<T extends ComponentInjectOptions> = T extends string[] ? {
  838. [K in T[number]]?: unknown;
  839. } : T extends ObjectInjectOptions ? {
  840. [K in keyof T]?: unknown;
  841. } : never;
  842. 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> {
  843. compatConfig?: CompatConfig;
  844. [key: string]: any;
  845. data?: (this: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D;
  846. computed?: C;
  847. methods?: M;
  848. watch?: ComponentWatchOptions;
  849. provide?: Provide;
  850. inject?: I | II[];
  851. filters?: Record<string, Function>;
  852. mixins?: Mixin[];
  853. extends?: Extends;
  854. beforeCreate?(): void;
  855. created?(): void;
  856. beforeMount?(): void;
  857. mounted?(): void;
  858. beforeUpdate?(): void;
  859. updated?(): void;
  860. activated?(): void;
  861. deactivated?(): void;
  862. /** @deprecated use `beforeUnmount` instead */
  863. beforeDestroy?(): void;
  864. beforeUnmount?(): void;
  865. /** @deprecated use `unmounted` instead */
  866. destroyed?(): void;
  867. unmounted?(): void;
  868. renderTracked?: DebuggerHook;
  869. renderTriggered?: DebuggerHook;
  870. errorCaptured?: ErrorCapturedHook;
  871. /**
  872. * runtime compile only
  873. * @deprecated use `compilerOptions.delimiters` instead.
  874. */
  875. delimiters?: [string, string];
  876. /**
  877. * #3468
  878. *
  879. * type-only, used to assist Mixin's type inference,
  880. * typescript will try to simplify the inferred `Mixin` type,
  881. * with the `__differentiator`, typescript won't be able to combine different mixins,
  882. * because the `__differentiator` will be different
  883. */
  884. __differentiator?: keyof D | keyof C | keyof M;
  885. }
  886. type MergedHook<T = () => void> = T | T[];
  887. type MergedComponentOptionsOverride = {
  888. beforeCreate?: MergedHook;
  889. created?: MergedHook;
  890. beforeMount?: MergedHook;
  891. mounted?: MergedHook;
  892. beforeUpdate?: MergedHook;
  893. updated?: MergedHook;
  894. activated?: MergedHook;
  895. deactivated?: MergedHook;
  896. /** @deprecated use `beforeUnmount` instead */
  897. beforeDestroy?: MergedHook;
  898. beforeUnmount?: MergedHook;
  899. /** @deprecated use `unmounted` instead */
  900. destroyed?: MergedHook;
  901. unmounted?: MergedHook;
  902. renderTracked?: MergedHook<DebuggerHook>;
  903. renderTriggered?: MergedHook<DebuggerHook>;
  904. errorCaptured?: MergedHook<ErrorCapturedHook>;
  905. };
  906. type OptionTypesKeys = 'P' | 'B' | 'D' | 'C' | 'M' | 'Defaults';
  907. type OptionTypesType<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Defaults = {}> = {
  908. P: P;
  909. B: B;
  910. D: D;
  911. C: C;
  912. M: M;
  913. Defaults: Defaults;
  914. };
  915. /**
  916. * @deprecated
  917. */
  918. 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> & {
  919. props?: never;
  920. /**
  921. * @private for language-tools use only
  922. */
  923. __typeProps?: Props;
  924. /**
  925. * @private for language-tools use only
  926. */
  927. __typeEmits?: TE;
  928. } & ThisType<CreateComponentPublicInstanceWithMixins<PE, RawBindings, D, C, M, Mixin, Extends, ResolvedEmits, EE, {}, false, I, S, LC, Directives, Exposed>>;
  929. /**
  930. * @deprecated
  931. */
  932. 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<{
  933. [key in PropNames]?: any;
  934. } & EmitsToProps<E>>>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S, LC, Directives, Exposed, Provide> & {
  935. props: PropNames[];
  936. } & ThisType<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, {}, false, I, S, LC, Directives, Exposed>>;
  937. /**
  938. * @deprecated
  939. */
  940. 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>> & Readonly<EmitsToProps<E>>>, Defaults = ExtractDefaultPropTypes<PropsOptions>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S, LC, Directives, Exposed, Provide> & {
  941. props: PropsOptions & ThisType<void>;
  942. } & ThisType<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, Defaults, false, I, S, LC, Directives>>;
  943. interface InjectionConstraint<T> {
  944. }
  945. export type InjectionKey<T> = symbol & InjectionConstraint<T>;
  946. export declare function provide<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): void;
  947. export declare function inject<T>(key: InjectionKey<T> | string): T | undefined;
  948. export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T, treatDefaultAsFactory?: false): T;
  949. export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T | (() => T), treatDefaultAsFactory: true): T;
  950. /**
  951. * Returns true if `inject()` can be used without warning about being called in the wrong place (e.g. outside of
  952. * setup()). This is used by libraries that want to use `inject()` internally without triggering a warning to the end
  953. * user. One example is `useRoute()` in `vue-router`.
  954. */
  955. export declare function hasInjectionContext(): boolean;
  956. export type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
  957. type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
  958. 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, TypeRefs extends Record<string, unknown> = {}, TypeEl extends Element = any> = ComponentPublicInstanceConstructor<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, PP & Props, Defaults, MakeDefaultsOptional, {}, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, TypeRefs, TypeEl>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, Provide> & PP;
  959. 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>;
  960. type ToResolvedProps<Props, Emits extends EmitsOptions> = Readonly<Props> & Readonly<EmitsToProps<Emits>>;
  961. 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'> & {
  962. props?: (keyof Props)[];
  963. emits?: E | EE[];
  964. slots?: S;
  965. }): DefineSetupFnComponent<Props, E, S>;
  966. 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'> & {
  967. props?: ComponentObjectPropsOptions<Props>;
  968. emits?: E | EE[];
  969. slots?: S;
  970. }): DefineSetupFnComponent<Props, E, S>;
  971. 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> : {
  972. [key in RuntimePropsKeys]?: any;
  973. } : TypeProps, TypeRefs extends Record<string, unknown> = {}, TypeEl extends Element = any>(options: {
  974. props?: (RuntimePropsOptions & ThisType<void>) | RuntimePropsKeys[];
  975. /**
  976. * @private for language-tools use only
  977. */
  978. __typeProps?: TypeProps;
  979. /**
  980. * @private for language-tools use only
  981. */
  982. __typeEmits?: TypeEmits;
  983. /**
  984. * @private for language-tools use only
  985. */
  986. __typeRefs?: TypeRefs;
  987. /**
  988. * @private for language-tools use only
  989. */
  990. __typeEl?: TypeEl;
  991. } & ComponentOptionsBase<ToResolvedProps<InferredProps, ResolvedEmits>, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, RuntimeEmitsKeys, {}, // Defaults
  992. InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<ToResolvedProps<InferredProps, ResolvedEmits>, 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, ToResolvedProps<InferredProps, ResolvedEmits>, ExtractDefaultPropTypes<RuntimePropsOptions>, Slots, LocalComponents, Directives, Exposed, Provide, unknown extends TypeProps ? true : false, TypeRefs, TypeEl>;
  993. export interface App<HostElement = any> {
  994. version: string;
  995. config: AppConfig;
  996. use<Options extends unknown[]>(plugin: Plugin<Options>, ...options: Options): this;
  997. use<Options>(plugin: Plugin<Options>, options: Options): this;
  998. mixin(mixin: ComponentOptions): this;
  999. component(name: string): Component | undefined;
  1000. component<T extends Component | DefineComponent>(name: string, component: T): this;
  1001. directive<T = any, V = any>(name: string): Directive<T, V> | undefined;
  1002. directive<T = any, V = any>(name: string, directive: Directive<T, V>): this;
  1003. mount(rootContainer: HostElement | string,
  1004. /**
  1005. * @internal
  1006. */
  1007. isHydrate?: boolean,
  1008. /**
  1009. * @internal
  1010. */
  1011. namespace?: boolean | ElementNamespace,
  1012. /**
  1013. * @internal
  1014. */
  1015. vnode?: VNode): ComponentPublicInstance;
  1016. unmount(): void;
  1017. onUnmount(cb: () => void): void;
  1018. provide<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): this;
  1019. /**
  1020. * Runs a function with the app as active instance. This allows using of `inject()` within the function to get access
  1021. * to variables provided via `app.provide()`.
  1022. *
  1023. * @param fn - function to run with the app as active instance
  1024. */
  1025. runWithContext<T>(fn: () => T): T;
  1026. _uid: number;
  1027. _component: ConcreteComponent;
  1028. _props: Data | null;
  1029. _container: HostElement | null;
  1030. _context: AppContext;
  1031. _instance: ComponentInternalInstance | null;
  1032. /**
  1033. * v2 compat only
  1034. */
  1035. filter?(name: string): Function | undefined;
  1036. filter?(name: string, filter: Function): this;
  1037. }
  1038. export type OptionMergeFunction = (to: unknown, from: unknown) => any;
  1039. export interface AppConfig {
  1040. readonly isNativeTag: (tag: string) => boolean;
  1041. performance: boolean;
  1042. optionMergeStrategies: Record<string, OptionMergeFunction>;
  1043. globalProperties: ComponentCustomProperties & Record<string, any>;
  1044. errorHandler?: (err: unknown, instance: ComponentPublicInstance | null, info: string) => void;
  1045. warnHandler?: (msg: string, instance: ComponentPublicInstance | null, trace: string) => void;
  1046. /**
  1047. * Options to pass to `@vue/compiler-dom`.
  1048. * Only supported in runtime compiler build.
  1049. */
  1050. compilerOptions: RuntimeCompilerOptions;
  1051. /**
  1052. * @deprecated use config.compilerOptions.isCustomElement
  1053. */
  1054. isCustomElement?: (tag: string) => boolean;
  1055. /**
  1056. * TODO document for 3.5
  1057. * Enable warnings for computed getters that recursively trigger itself.
  1058. */
  1059. warnRecursiveComputed?: boolean;
  1060. /**
  1061. * Whether to throw unhandled errors in production.
  1062. * Default is `false` to avoid crashing on any error (and only logs it)
  1063. * But in some cases, e.g. SSR, throwing might be more desirable.
  1064. */
  1065. throwUnhandledErrorInProduction?: boolean;
  1066. /**
  1067. * Prefix for all useId() calls within this app
  1068. */
  1069. idPrefix?: string;
  1070. }
  1071. export interface AppContext {
  1072. app: App;
  1073. config: AppConfig;
  1074. mixins: ComponentOptions[];
  1075. components: Record<string, Component>;
  1076. directives: Record<string, Directive>;
  1077. provides: Record<string | symbol, any>;
  1078. }
  1079. type PluginInstallFunction<Options = any[]> = Options extends unknown[] ? (app: App, ...options: Options) => any : (app: App, options: Options) => any;
  1080. export type ObjectPlugin<Options = any[]> = {
  1081. install: PluginInstallFunction<Options>;
  1082. };
  1083. export type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> & Partial<ObjectPlugin<Options>>;
  1084. export type Plugin<Options = any[]> = FunctionPlugin<Options> | ObjectPlugin<Options>;
  1085. export type CreateAppFunction<HostElement> = (rootComponent: Component, rootProps?: Data | null) => App<HostElement>;
  1086. type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>;
  1087. export interface TeleportProps {
  1088. to: string | RendererElement | null | undefined;
  1089. disabled?: boolean;
  1090. defer?: boolean;
  1091. }
  1092. declare const TeleportImpl: {
  1093. name: string;
  1094. __isTeleport: boolean;
  1095. 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;
  1096. remove(vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, { um: unmount, o: { remove: hostRemove } }: RendererInternals, doRemove: boolean): void;
  1097. move: typeof moveTeleport;
  1098. hydrate: typeof hydrateTeleport;
  1099. };
  1100. declare enum TeleportMoveTypes {
  1101. TARGET_CHANGE = 0,
  1102. TOGGLE = 1,// enable / disable
  1103. REORDER = 2
  1104. }
  1105. declare function moveTeleport(vnode: VNode, container: RendererElement, parentAnchor: RendererNode | null, { o: { insert }, m: move }: RendererInternals, moveType?: TeleportMoveTypes): void;
  1106. declare function hydrateTeleport(node: Node, vnode: TeleportVNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean, { o: { nextSibling, parentNode, querySelector, insert, createText }, }: RendererInternals<Node, Element>, hydrateChildren: (node: Node | null, vnode: VNode, container: Element, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
  1107. export declare const Teleport: {
  1108. __isTeleport: true;
  1109. new (): {
  1110. $props: VNodeProps & TeleportProps;
  1111. $slots: {
  1112. default(): VNode[];
  1113. };
  1114. };
  1115. };
  1116. /**
  1117. * @private
  1118. */
  1119. export declare function resolveComponent(name: string, maybeSelfReference?: boolean): ConcreteComponent | string;
  1120. declare const NULL_DYNAMIC_COMPONENT: unique symbol;
  1121. /**
  1122. * @private
  1123. */
  1124. export declare function resolveDynamicComponent(component: unknown): VNodeTypes;
  1125. /**
  1126. * @private
  1127. */
  1128. export declare function resolveDirective(name: string): Directive | undefined;
  1129. export declare const Fragment: {
  1130. __isFragment: true;
  1131. new (): {
  1132. $props: VNodeProps;
  1133. };
  1134. };
  1135. export declare const Text: unique symbol;
  1136. export declare const Comment: unique symbol;
  1137. export declare const Static: unique symbol;
  1138. export type VNodeTypes = string | VNode | Component | typeof Text | typeof Static | typeof Comment | typeof Fragment | typeof Teleport | typeof TeleportImpl | typeof Suspense | typeof SuspenseImpl;
  1139. export type VNodeRef = string | Ref | ((ref: Element | ComponentPublicInstance | null, refs: Record<string, any>) => void);
  1140. type VNodeNormalizedRefAtom = {
  1141. /**
  1142. * component instance
  1143. */
  1144. i: ComponentInternalInstance;
  1145. /**
  1146. * Actual ref
  1147. */
  1148. r: VNodeRef;
  1149. /**
  1150. * setup ref key
  1151. */
  1152. k?: string;
  1153. /**
  1154. * refInFor marker
  1155. */
  1156. f?: boolean;
  1157. };
  1158. type VNodeNormalizedRef = VNodeNormalizedRefAtom | VNodeNormalizedRefAtom[];
  1159. type VNodeMountHook = (vnode: VNode) => void;
  1160. type VNodeUpdateHook = (vnode: VNode, oldVNode: VNode) => void;
  1161. export type VNodeProps = {
  1162. key?: PropertyKey;
  1163. ref?: VNodeRef;
  1164. ref_for?: boolean;
  1165. ref_key?: string;
  1166. onVnodeBeforeMount?: VNodeMountHook | VNodeMountHook[];
  1167. onVnodeMounted?: VNodeMountHook | VNodeMountHook[];
  1168. onVnodeBeforeUpdate?: VNodeUpdateHook | VNodeUpdateHook[];
  1169. onVnodeUpdated?: VNodeUpdateHook | VNodeUpdateHook[];
  1170. onVnodeBeforeUnmount?: VNodeMountHook | VNodeMountHook[];
  1171. onVnodeUnmounted?: VNodeMountHook | VNodeMountHook[];
  1172. };
  1173. type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void;
  1174. export type VNodeArrayChildren = Array<VNodeArrayChildren | VNodeChildAtom>;
  1175. export type VNodeChild = VNodeChildAtom | VNodeArrayChildren;
  1176. export type VNodeNormalizedChildren = string | VNodeArrayChildren | RawSlots | null;
  1177. export interface VNode<HostNode = RendererNode, HostElement = RendererElement, ExtraProps = {
  1178. [key: string]: any;
  1179. }> {
  1180. type: VNodeTypes;
  1181. props: (VNodeProps & ExtraProps) | null;
  1182. key: PropertyKey | null;
  1183. ref: VNodeNormalizedRef | null;
  1184. /**
  1185. * SFC only. This is assigned on vnode creation using currentScopeId
  1186. * which is set alongside currentRenderingInstance.
  1187. */
  1188. scopeId: string | null;
  1189. children: VNodeNormalizedChildren;
  1190. component: ComponentInternalInstance | null;
  1191. dirs: DirectiveBinding[] | null;
  1192. transition: TransitionHooks<HostElement> | null;
  1193. el: HostNode | null;
  1194. anchor: HostNode | null;
  1195. target: HostElement | null;
  1196. targetStart: HostNode | null;
  1197. targetAnchor: HostNode | null;
  1198. suspense: SuspenseBoundary | null;
  1199. shapeFlag: number;
  1200. patchFlag: number;
  1201. appContext: AppContext | null;
  1202. }
  1203. /**
  1204. * Open a block.
  1205. * This must be called before `createBlock`. It cannot be part of `createBlock`
  1206. * because the children of the block are evaluated before `createBlock` itself
  1207. * is called. The generated code typically looks like this:
  1208. *
  1209. * ```js
  1210. * function render() {
  1211. * return (openBlock(),createBlock('div', null, [...]))
  1212. * }
  1213. * ```
  1214. * disableTracking is true when creating a v-for fragment block, since a v-for
  1215. * fragment always diffs its children.
  1216. *
  1217. * @private
  1218. */
  1219. export declare function openBlock(disableTracking?: boolean): void;
  1220. /**
  1221. * Block tracking sometimes needs to be disabled, for example during the
  1222. * creation of a tree that needs to be cached by v-once. The compiler generates
  1223. * code like this:
  1224. *
  1225. * ``` js
  1226. * _cache[1] || (
  1227. * setBlockTracking(-1),
  1228. * _cache[1] = createVNode(...),
  1229. * setBlockTracking(1),
  1230. * _cache[1]
  1231. * )
  1232. * ```
  1233. *
  1234. * @private
  1235. */
  1236. export declare function setBlockTracking(value: number): void;
  1237. /**
  1238. * @private
  1239. */
  1240. export declare function createElementBlock(type: string | typeof Fragment, props?: Record<string, any> | null, children?: any, patchFlag?: number, dynamicProps?: string[], shapeFlag?: number): VNode;
  1241. /**
  1242. * Create a block root vnode. Takes the same exact arguments as `createVNode`.
  1243. * A block root keeps track of dynamic nodes within the block in the
  1244. * `dynamicChildren` array.
  1245. *
  1246. * @private
  1247. */
  1248. export declare function createBlock(type: VNodeTypes | ClassComponent, props?: Record<string, any> | null, children?: any, patchFlag?: number, dynamicProps?: string[]): VNode;
  1249. export declare function isVNode(value: any): value is VNode;
  1250. declare let vnodeArgsTransformer: ((args: Parameters<typeof _createVNode>, instance: ComponentInternalInstance | null) => Parameters<typeof _createVNode>) | undefined;
  1251. /**
  1252. * Internal API for registering an arguments transform for createVNode
  1253. * used for creating stubs in the test-utils
  1254. * It is *internal* but needs to be exposed for test-utils to pick up proper
  1255. * typings
  1256. */
  1257. export declare function transformVNodeArgs(transformer?: typeof vnodeArgsTransformer): void;
  1258. export declare function createBaseVNode(type: VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT, props?: (Data & VNodeProps) | null, children?: unknown, patchFlag?: number, dynamicProps?: string[] | null, shapeFlag?: number, isBlockNode?: boolean, needFullChildrenNormalization?: boolean): VNode;
  1259. export declare const createVNode: typeof _createVNode;
  1260. declare function _createVNode(type: VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT, props?: (Data & VNodeProps) | null, children?: unknown, patchFlag?: number, dynamicProps?: string[] | null, isBlockNode?: boolean): VNode;
  1261. export declare function guardReactiveProps(props: (Data & VNodeProps) | null): (Data & VNodeProps) | null;
  1262. export declare function cloneVNode<T, U>(vnode: VNode<T, U>, extraProps?: (Data & VNodeProps) | null, mergeRef?: boolean, cloneTransition?: boolean): VNode<T, U>;
  1263. /**
  1264. * @private
  1265. */
  1266. export declare function createTextVNode(text?: string, flag?: number): VNode;
  1267. /**
  1268. * @private
  1269. */
  1270. export declare function createStaticVNode(content: string, numberOfNodes: number): VNode;
  1271. /**
  1272. * @private
  1273. */
  1274. export declare function createCommentVNode(text?: string, asBlock?: boolean): VNode;
  1275. export declare function mergeProps(...args: (Data & VNodeProps)[]): Data;
  1276. type Data = Record<string, unknown>;
  1277. /**
  1278. * Public utility type for extracting the instance type of a component.
  1279. * Works with all valid component definition types. This is intended to replace
  1280. * the usage of `InstanceType<typeof Comp>` which only works for
  1281. * constructor-based component definition types.
  1282. *
  1283. * @example
  1284. * ```ts
  1285. * const MyComp = { ... }
  1286. * declare const instance: ComponentInstance<typeof MyComp>
  1287. * ```
  1288. */
  1289. export type ComponentInstance<T> = T extends {
  1290. new (): ComponentPublicInstance;
  1291. } ? 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;
  1292. /**
  1293. * For extending allowed non-declared props on components in TSX
  1294. */
  1295. export interface ComponentCustomProps {
  1296. }
  1297. /**
  1298. * For globally defined Directives
  1299. * Here is an example of adding a directive `VTooltip` as global directive:
  1300. *
  1301. * @example
  1302. * ```ts
  1303. * import VTooltip from 'v-tooltip'
  1304. *
  1305. * declare module '@vue/runtime-core' {
  1306. * interface GlobalDirectives {
  1307. * VTooltip
  1308. * }
  1309. * }
  1310. * ```
  1311. */
  1312. export interface GlobalDirectives {
  1313. }
  1314. /**
  1315. * For globally defined Components
  1316. * Here is an example of adding a component `RouterView` as global component:
  1317. *
  1318. * @example
  1319. * ```ts
  1320. * import { RouterView } from 'vue-router'
  1321. *
  1322. * declare module '@vue/runtime-core' {
  1323. * interface GlobalComponents {
  1324. * RouterView
  1325. * }
  1326. * }
  1327. * ```
  1328. */
  1329. export interface GlobalComponents {
  1330. Teleport: DefineComponent<TeleportProps>;
  1331. Suspense: DefineComponent<SuspenseProps>;
  1332. KeepAlive: DefineComponent<KeepAliveProps>;
  1333. BaseTransition: DefineComponent<BaseTransitionProps>;
  1334. }
  1335. /**
  1336. * Default allowed non-declared props on component in TSX
  1337. */
  1338. export interface AllowedComponentProps {
  1339. class?: unknown;
  1340. style?: unknown;
  1341. }
  1342. interface ComponentInternalOptions {
  1343. /**
  1344. * Compat build only, for bailing out of certain compatibility behavior
  1345. */
  1346. __isBuiltIn?: boolean;
  1347. /**
  1348. * This one should be exposed so that devtools can make use of it
  1349. */
  1350. __file?: string;
  1351. /**
  1352. * name inferred from filename
  1353. */
  1354. __name?: string;
  1355. }
  1356. export interface FunctionalComponent<P = {}, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any, EE extends EmitsOptions = ShortEmitsToObject<E>> extends ComponentInternalOptions {
  1357. (props: P & EmitsToProps<EE>, ctx: Omit<SetupContext<EE, IfAny<S, {}, SlotsType<S>>>, 'expose'>): any;
  1358. props?: ComponentPropsOptions<P>;
  1359. emits?: EE | (keyof EE)[];
  1360. slots?: IfAny<S, Slots, SlotsType<S>>;
  1361. inheritAttrs?: boolean;
  1362. displayName?: string;
  1363. compatConfig?: CompatConfig;
  1364. }
  1365. interface ClassComponent {
  1366. new (...args: any[]): ComponentPublicInstance<any, any, any, any, any>;
  1367. __vccOpts: ComponentOptions;
  1368. }
  1369. /**
  1370. * Concrete component type matches its actual value: it's either an options
  1371. * object, or a function. Use this where the code expects to work with actual
  1372. * values, e.g. checking if its a function or not. This is mostly for internal
  1373. * implementation code.
  1374. */
  1375. 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>;
  1376. /**
  1377. * A type used in public APIs where a component type is expected.
  1378. * The constructor type is an artificial type returned by defineComponent().
  1379. */
  1380. 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>;
  1381. export type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends any ? {
  1382. attrs: Data;
  1383. slots: UnwrapSlotsType<S>;
  1384. emit: EmitFn<E>;
  1385. expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
  1386. } : never;
  1387. /**
  1388. * We expose a subset of properties on the internal instance as they are
  1389. * useful for advanced external libraries and tools.
  1390. */
  1391. export interface ComponentInternalInstance {
  1392. uid: number;
  1393. type: ConcreteComponent;
  1394. parent: ComponentInternalInstance | null;
  1395. root: ComponentInternalInstance;
  1396. appContext: AppContext;
  1397. /**
  1398. * Vnode representing this component in its parent's vdom tree
  1399. */
  1400. vnode: VNode;
  1401. /**
  1402. * Root vnode of this component's own vdom tree
  1403. */
  1404. subTree: VNode;
  1405. /**
  1406. * Render effect instance
  1407. */
  1408. effect: ReactiveEffect;
  1409. /**
  1410. * Force update render effect
  1411. */
  1412. update: () => void;
  1413. /**
  1414. * Render effect job to be passed to scheduler (checks if dirty)
  1415. */
  1416. job: SchedulerJob;
  1417. proxy: ComponentPublicInstance | null;
  1418. exposed: Record<string, any> | null;
  1419. exposeProxy: Record<string, any> | null;
  1420. data: Data;
  1421. props: Data;
  1422. attrs: Data;
  1423. slots: InternalSlots;
  1424. refs: Data;
  1425. emit: EmitFn;
  1426. isMounted: boolean;
  1427. isUnmounted: boolean;
  1428. isDeactivated: boolean;
  1429. }
  1430. export declare const getCurrentInstance: () => ComponentInternalInstance | null;
  1431. /**
  1432. * For runtime-dom to register the compiler.
  1433. * Note the exported method uses any to avoid d.ts relying on the compiler types.
  1434. */
  1435. export declare function registerRuntimeCompiler(_compile: any): void;
  1436. export declare const isRuntimeOnly: () => boolean;
  1437. export interface ComponentCustomElementInterface {
  1438. }
  1439. type MaybeUndefined<T, I> = I extends true ? T | undefined : T;
  1440. type MapSources<T, Immediate> = {
  1441. [K in keyof T]: T[K] extends WatchSource<infer V> ? MaybeUndefined<V, Immediate> : T[K] extends object ? MaybeUndefined<T[K], Immediate> : never;
  1442. };
  1443. export interface WatchEffectOptions extends DebuggerOptions {
  1444. flush?: 'pre' | 'post' | 'sync';
  1445. }
  1446. export interface WatchOptions<Immediate = boolean> extends WatchEffectOptions {
  1447. immediate?: Immediate;
  1448. deep?: boolean | number;
  1449. once?: boolean;
  1450. }
  1451. export declare function watchEffect(effect: WatchEffect, options?: WatchEffectOptions): WatchHandle;
  1452. export declare function watchPostEffect(effect: WatchEffect, options?: DebuggerOptions): WatchHandle;
  1453. export declare function watchSyncEffect(effect: WatchEffect, options?: DebuggerOptions): WatchHandle;
  1454. export type MultiWatchSources = (WatchSource<unknown> | object)[];
  1455. export declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchHandle;
  1456. export declare function watch<T extends Readonly<MultiWatchSources>, Immediate extends Readonly<boolean> = false>(sources: readonly [...T] | T, cb: [T] extends [ReactiveMarker] ? WatchCallback<T, MaybeUndefined<T, Immediate>> : WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchHandle;
  1457. export declare function watch<T extends MultiWatchSources, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchHandle;
  1458. export declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchHandle;
  1459. /**
  1460. * A lazy hydration strategy for async components.
  1461. * @param hydrate - call this to perform the actual hydration.
  1462. * @param forEachElement - iterate through the root elements of the component's
  1463. * non-hydrated DOM, accounting for possible fragments.
  1464. * @returns a teardown function to be called if the async component is unmounted
  1465. * before it is hydrated. This can be used to e.g. remove DOM event
  1466. * listeners.
  1467. */
  1468. export type HydrationStrategy = (hydrate: () => void, forEachElement: (cb: (el: Element) => any) => void) => (() => void) | void;
  1469. export type HydrationStrategyFactory<Options> = (options?: Options) => HydrationStrategy;
  1470. export declare const hydrateOnIdle: HydrationStrategyFactory<number>;
  1471. export declare const hydrateOnVisible: HydrationStrategyFactory<IntersectionObserverInit>;
  1472. export declare const hydrateOnMediaQuery: HydrationStrategyFactory<string>;
  1473. export declare const hydrateOnInteraction: HydrationStrategyFactory<keyof HTMLElementEventMap | Array<keyof HTMLElementEventMap>>;
  1474. type AsyncComponentResolveResult<T = Component> = T | {
  1475. default: T;
  1476. };
  1477. export type AsyncComponentLoader<T = any> = () => Promise<AsyncComponentResolveResult<T>>;
  1478. export interface AsyncComponentOptions<T = any> {
  1479. loader: AsyncComponentLoader<T>;
  1480. loadingComponent?: Component;
  1481. errorComponent?: Component;
  1482. delay?: number;
  1483. timeout?: number;
  1484. suspensible?: boolean;
  1485. hydrate?: HydrationStrategy;
  1486. onError?: (error: Error, retry: () => void, fail: () => void, attempts: number) => any;
  1487. }
  1488. /*! #__NO_SIDE_EFFECTS__ */
  1489. export declare function defineAsyncComponent<T extends Component = {
  1490. new (): ComponentPublicInstance;
  1491. }>(source: AsyncComponentLoader<T> | AsyncComponentOptions<T>): T;
  1492. export declare function useModel<M extends PropertyKey, T extends Record<string, any>, K extends keyof T, G = T[K], S = T[K]>(props: T, name: K, options?: DefineModelOptions<T[K], G, S>): ModelRef<T[K], M, G, S>;
  1493. export declare function useTemplateRef<T = unknown, Keys extends string = string>(key: Keys): Readonly<ShallowRef<T | null>>;
  1494. export declare function useId(): string | undefined;
  1495. type RawProps = VNodeProps & {
  1496. __v_isVNode?: never;
  1497. [Symbol.iterator]?: never;
  1498. } & Record<string, any>;
  1499. type RawChildren = string | number | boolean | VNode | VNodeArrayChildren | (() => any);
  1500. interface Constructor<P = any> {
  1501. __isFragment?: never;
  1502. __isTeleport?: never;
  1503. __isSuspense?: never;
  1504. new (...args: any[]): {
  1505. $props: P;
  1506. };
  1507. }
  1508. type HTMLElementEventHandler = {
  1509. [K in keyof HTMLElementEventMap as `on${Capitalize<K>}`]?: (ev: HTMLElementEventMap[K]) => any;
  1510. };
  1511. export declare function h<K extends keyof HTMLElementTagNameMap>(type: K, children?: RawChildren): VNode;
  1512. export declare function h<K extends keyof HTMLElementTagNameMap>(type: K, props?: (RawProps & HTMLElementEventHandler) | null, children?: RawChildren | RawSlots): VNode;
  1513. export declare function h(type: string, children?: RawChildren): VNode;
  1514. export declare function h(type: string, props?: RawProps | null, children?: RawChildren | RawSlots): VNode;
  1515. export declare function h(type: typeof Text | typeof Comment, children?: string | number | boolean): VNode;
  1516. export declare function h(type: typeof Text | typeof Comment, props?: null, children?: string | number | boolean): VNode;
  1517. export declare function h(type: typeof Fragment, children?: VNodeArrayChildren): VNode;
  1518. export declare function h(type: typeof Fragment, props?: RawProps | null, children?: VNodeArrayChildren): VNode;
  1519. export declare function h(type: typeof Teleport, props: RawProps & TeleportProps, children: RawChildren | RawSlots): VNode;
  1520. export declare function h(type: typeof Suspense, children?: RawChildren): VNode;
  1521. export declare function h(type: typeof Suspense, props?: (RawProps & SuspenseProps) | null, children?: RawChildren | RawSlots): VNode;
  1522. export declare function h<P, E extends EmitsOptions = {}, S extends Record<string, any> = any>(type: FunctionalComponent<P, any, S, any>, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren | IfAny<S, RawSlots, S>): VNode;
  1523. export declare function h(type: Component, children?: RawChildren): VNode;
  1524. export declare function h<P>(type: ConcreteComponent | string, children?: RawChildren): VNode;
  1525. export declare function h<P>(type: ConcreteComponent<P> | string, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren): VNode;
  1526. export declare function h<P>(type: Component<P>, props?: (RawProps & P) | null, children?: RawChildren | RawSlots): VNode;
  1527. export declare function h<P>(type: ComponentOptions<P>, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren | RawSlots): VNode;
  1528. export declare function h(type: Constructor, children?: RawChildren): VNode;
  1529. export declare function h<P>(type: Constructor<P>, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren | RawSlots): VNode;
  1530. export declare function h(type: DefineComponent, children?: RawChildren): VNode;
  1531. export declare function h<P>(type: DefineComponent<P>, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren | RawSlots): VNode;
  1532. export declare function h(type: string | Component, children?: RawChildren): VNode;
  1533. export declare function h<P>(type: string | Component<P>, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren | RawSlots): VNode;
  1534. export declare const ssrContextKey: unique symbol;
  1535. export declare const useSSRContext: <T = Record<string, any>>() => T | undefined;
  1536. declare function warn$1(msg: string, ...args: any[]): void;
  1537. export declare enum ErrorCodes {
  1538. SETUP_FUNCTION = 0,
  1539. RENDER_FUNCTION = 1,
  1540. NATIVE_EVENT_HANDLER = 5,
  1541. COMPONENT_EVENT_HANDLER = 6,
  1542. VNODE_HOOK = 7,
  1543. DIRECTIVE_HOOK = 8,
  1544. TRANSITION_HOOK = 9,
  1545. APP_ERROR_HANDLER = 10,
  1546. APP_WARN_HANDLER = 11,
  1547. FUNCTION_REF = 12,
  1548. ASYNC_COMPONENT_LOADER = 13,
  1549. SCHEDULER = 14,
  1550. COMPONENT_UPDATE = 15,
  1551. APP_UNMOUNT_CLEANUP = 16
  1552. }
  1553. type ErrorTypes = LifecycleHooks | ErrorCodes | WatchErrorCodes;
  1554. export declare function callWithErrorHandling(fn: Function, instance: ComponentInternalInstance | null | undefined, type: ErrorTypes, args?: unknown[]): any;
  1555. export declare function callWithAsyncErrorHandling(fn: Function | Function[], instance: ComponentInternalInstance | null, type: ErrorTypes, args?: unknown[]): any;
  1556. export declare function handleError(err: unknown, instance: ComponentInternalInstance | null | undefined, type: ErrorTypes, throwInDev?: boolean): void;
  1557. export declare function initCustomFormatter(): void;
  1558. interface AppRecord {
  1559. id: number;
  1560. app: App;
  1561. version: string;
  1562. types: Record<string, string | Symbol>;
  1563. }
  1564. interface DevtoolsHook {
  1565. enabled?: boolean;
  1566. emit: (event: string, ...payload: any[]) => void;
  1567. on: (event: string, handler: Function) => void;
  1568. once: (event: string, handler: Function) => void;
  1569. off: (event: string, handler: Function) => void;
  1570. appRecords: AppRecord[];
  1571. /**
  1572. * Added at https://github.com/vuejs/devtools/commit/f2ad51eea789006ab66942e5a27c0f0986a257f9
  1573. * Returns whether the arg was buffered or not
  1574. */
  1575. cleanupBuffer?: (matchArg: unknown) => boolean;
  1576. }
  1577. declare function setDevtoolsHook$1(hook: DevtoolsHook, target: any): void;
  1578. type HMRComponent = ComponentOptions | ClassComponent;
  1579. export interface HMRRuntime {
  1580. createRecord: typeof createRecord;
  1581. rerender: typeof rerender;
  1582. reload: typeof reload;
  1583. }
  1584. declare function createRecord(id: string, initialDef: HMRComponent): boolean;
  1585. declare function rerender(id: string, newRender?: Function): void;
  1586. declare function reload(id: string, newComp: HMRComponent): void;
  1587. /**
  1588. * Set scope id when creating hoisted vnodes.
  1589. * @private compiler helper
  1590. */
  1591. export declare function pushScopeId(id: string | null): void;
  1592. /**
  1593. * Technically we no longer need this after 3.0.8 but we need to keep the same
  1594. * API for backwards compat w/ code generated by compilers.
  1595. * @private
  1596. */
  1597. export declare function popScopeId(): void;
  1598. /**
  1599. * Only for backwards compat
  1600. * @private
  1601. */
  1602. export declare const withScopeId: (_id: string) => typeof withCtx;
  1603. /**
  1604. * Wrap a slot function to memoize current rendering instance
  1605. * @private compiler helper
  1606. */
  1607. export declare function withCtx(fn: Function, ctx?: ComponentInternalInstance | null, isNonScopedSlot?: boolean): Function;
  1608. /**
  1609. * v-for string
  1610. * @private
  1611. */
  1612. export declare function renderList(source: string, renderItem: (value: string, index: number) => VNodeChild): VNodeChild[];
  1613. /**
  1614. * v-for number
  1615. */
  1616. export declare function renderList(source: number, renderItem: (value: number, index: number) => VNodeChild): VNodeChild[];
  1617. /**
  1618. * v-for array
  1619. */
  1620. export declare function renderList<T>(source: T[], renderItem: (value: T, index: number) => VNodeChild): VNodeChild[];
  1621. /**
  1622. * v-for iterable
  1623. */
  1624. export declare function renderList<T>(source: Iterable<T>, renderItem: (value: T, index: number) => VNodeChild): VNodeChild[];
  1625. /**
  1626. * v-for object
  1627. */
  1628. export declare function renderList<T>(source: T, renderItem: <K extends keyof T>(value: T[K], key: string, index: number) => VNodeChild): VNodeChild[];
  1629. /**
  1630. * For prefixing keys in v-on="obj" with "on"
  1631. * @private
  1632. */
  1633. export declare function toHandlers(obj: Record<string, any>, preserveCaseIfNecessary?: boolean): Record<string, any>;
  1634. /**
  1635. * Compiler runtime helper for rendering `<slot/>`
  1636. * @private
  1637. */
  1638. export declare function renderSlot(slots: Slots, name: string, props?: Data, fallback?: () => VNodeArrayChildren, noSlotted?: boolean): VNode;
  1639. type SSRSlot = (...args: any[]) => VNode[] | undefined;
  1640. interface CompiledSlotDescriptor {
  1641. name: string;
  1642. fn: SSRSlot;
  1643. key?: string;
  1644. }
  1645. /**
  1646. * Compiler runtime helper for creating dynamic slots object
  1647. * @private
  1648. */
  1649. export declare function createSlots(slots: Record<string, SSRSlot>, dynamicSlots: (CompiledSlotDescriptor | CompiledSlotDescriptor[] | undefined)[]): Record<string, SSRSlot>;
  1650. export declare function withMemo(memo: any[], render: () => VNode<any, any>, cache: any[], index: number): VNode<any, any>;
  1651. export declare function isMemoSame(cached: VNode, memo: any[]): boolean;
  1652. export type LegacyConfig = {
  1653. /**
  1654. * @deprecated `config.silent` option has been removed
  1655. */
  1656. silent?: boolean;
  1657. /**
  1658. * @deprecated use __VUE_PROD_DEVTOOLS__ compile-time feature flag instead
  1659. * https://github.com/vuejs/core/tree/main/packages/vue#bundler-build-feature-flags
  1660. */
  1661. devtools?: boolean;
  1662. /**
  1663. * @deprecated use `config.isCustomElement` instead
  1664. * https://v3-migration.vuejs.org/breaking-changes/global-api.html#config-ignoredelements-is-now-config-iscustomelement
  1665. */
  1666. ignoredElements?: (string | RegExp)[];
  1667. /**
  1668. * @deprecated
  1669. * https://v3-migration.vuejs.org/breaking-changes/keycode-modifiers.html
  1670. */
  1671. keyCodes?: Record<string, number | number[]>;
  1672. /**
  1673. * @deprecated
  1674. * https://v3-migration.vuejs.org/breaking-changes/global-api.html#config-productiontip-removed
  1675. */
  1676. productionTip?: boolean;
  1677. };
  1678. type LegacyPublicInstance = ComponentPublicInstance & LegacyPublicProperties;
  1679. interface LegacyPublicProperties {
  1680. $set<T extends Record<keyof any, any>, K extends keyof T>(target: T, key: K, value: T[K]): void;
  1681. $delete<T extends Record<keyof any, any>, K extends keyof T>(target: T, key: K): void;
  1682. $mount(el?: string | Element): this;
  1683. $destroy(): void;
  1684. $scopedSlots: Slots;
  1685. $on(event: string | string[], fn: Function): this;
  1686. $once(event: string, fn: Function): this;
  1687. $off(event?: string | string[], fn?: Function): this;
  1688. $children: LegacyPublicProperties[];
  1689. $listeners: Record<string, Function | Function[]>;
  1690. }
  1691. /**
  1692. * @deprecated the default `Vue` export has been removed in Vue 3. The type for
  1693. * the default export is provided only for migration purposes. Please use
  1694. * named imports instead - e.g. `import { createApp } from 'vue'`.
  1695. */
  1696. export type CompatVue = Pick<App, 'version' | 'component' | 'directive'> & {
  1697. configureCompat: typeof configureCompat;
  1698. new (options?: ComponentOptions): LegacyPublicInstance;
  1699. version: string;
  1700. config: AppConfig & LegacyConfig;
  1701. nextTick: typeof nextTick;
  1702. use<Options extends unknown[]>(plugin: Plugin<Options>, ...options: Options): CompatVue;
  1703. use<Options>(plugin: Plugin<Options>, options: Options): CompatVue;
  1704. mixin(mixin: ComponentOptions): CompatVue;
  1705. component(name: string): Component | undefined;
  1706. component(name: string, component: Component): CompatVue;
  1707. directive<T = any, V = any>(name: string): Directive<T, V> | undefined;
  1708. directive<T = any, V = any>(name: string, directive: Directive<T, V>): CompatVue;
  1709. compile(template: string): RenderFunction;
  1710. /**
  1711. * @deprecated Vue 3 no longer supports extending constructors.
  1712. */
  1713. extend: (options?: ComponentOptions) => CompatVue;
  1714. /**
  1715. * @deprecated Vue 3 no longer needs set() for adding new properties.
  1716. */
  1717. set(target: any, key: PropertyKey, value: any): void;
  1718. /**
  1719. * @deprecated Vue 3 no longer needs delete() for property deletions.
  1720. */
  1721. delete(target: any, key: PropertyKey): void;
  1722. /**
  1723. * @deprecated use `reactive` instead.
  1724. */
  1725. observable: typeof reactive;
  1726. /**
  1727. * @deprecated filters have been removed from Vue 3.
  1728. */
  1729. filter(name: string, arg?: any): null;
  1730. };
  1731. export declare const version: string;
  1732. export declare const warn: typeof warn$1;
  1733. export declare const devtools: DevtoolsHook;
  1734. export declare const setDevtoolsHook: typeof setDevtoolsHook$1;
  1735. declare module '@vue/reactivity' {
  1736. interface RefUnwrapBailTypes {
  1737. runtimeCoreBailTypes: VNode | {
  1738. $: ComponentInternalInstance;
  1739. };
  1740. }
  1741. }
  1742. export declare const DeprecationTypes: typeof DeprecationTypes$1;
  1743. export { type WatchEffectOptions as WatchOptionsBase, createBaseVNode as createElementVNode, };
  1744. // Note: this file is auto concatenated to the end of the bundled d.ts during
  1745. // build.
  1746. declare module '@vue/runtime-core' {
  1747. export interface GlobalComponents {
  1748. Teleport: DefineComponent<TeleportProps>
  1749. Suspense: DefineComponent<SuspenseProps>
  1750. KeepAlive: DefineComponent<KeepAliveProps>
  1751. BaseTransition: DefineComponent<BaseTransitionProps>
  1752. }
  1753. }
  1754. // Note: this file is auto concatenated to the end of the bundled d.ts during
  1755. // build.
  1756. type _defineProps = typeof defineProps
  1757. type _defineEmits = typeof defineEmits
  1758. type _defineExpose = typeof defineExpose
  1759. type _defineOptions = typeof defineOptions
  1760. type _defineSlots = typeof defineSlots
  1761. type _defineModel = typeof defineModel
  1762. type _withDefaults = typeof withDefaults
  1763. declare global {
  1764. const defineProps: _defineProps
  1765. const defineEmits: _defineEmits
  1766. const defineExpose: _defineExpose
  1767. const defineOptions: _defineOptions
  1768. const defineSlots: _defineSlots
  1769. const defineModel: _defineModel
  1770. const withDefaults: _withDefaults
  1771. }