runtime-core.d.ts 83 KB

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