runtime-core.d.ts 92 KB

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