ebfe68658e9ef4cc775fe7c9c55db6c8446aa2122d99a3517b9c7390356a08c86add3e0b77cc678859e3db207f3900225ddec0a36b1b8ae3c325d5b404e6d9 91 KB

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