runtime-core.d.ts 91 KB

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