runtime-core.d.ts 91 KB

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