runtime-core.d.ts 91 KB

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