index.d.ts 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511
  1. import { ComponentInternalInstance, ComputedGetter, ComputedRef, FunctionDirective, InjectionKey, MaybeRef, MaybeRefOrGetter, MultiWatchSources, MultiWatchSources as MultiWatchSources$1, ObjectDirective, Ref, ShallowRef, ShallowUnwrapRef as ShallowUnwrapRef$1, ToRef, ToRefs, UnwrapNestedRefs, UnwrapRef, WatchCallback, WatchHandle, WatchOptions, WatchOptionsBase, WatchSource, WatchStopHandle, WritableComputedOptions, WritableComputedRef, getCurrentInstance, inject } from "vue";
  2. //#region computedEager/index.d.ts
  3. type ComputedEagerOptions = WatchOptionsBase;
  4. type ComputedEagerReturn<T = any> = Readonly<ShallowRef<T>>;
  5. /**
  6. *
  7. * @deprecated This function will be removed in future version.
  8. *
  9. * Note: If you are using Vue 3.4+, you can straight use computed instead.
  10. * Because in Vue 3.4+, if computed new value does not change,
  11. * computed, effect, watch, watchEffect, render dependencies will not be triggered.
  12. * refer: https://github.com/vuejs/core/pull/5912
  13. *
  14. * @param fn effect function
  15. * @param options WatchOptionsBase
  16. * @returns readonly shallowRef
  17. */
  18. declare function computedEager<T>(fn: () => T, options?: ComputedEagerOptions): ComputedEagerReturn<T>;
  19. /** @deprecated use `computedEager` instead */
  20. declare const eagerComputed: typeof computedEager;
  21. //#endregion
  22. //#region computedWithControl/index.d.ts
  23. interface ComputedWithControlRefExtra {
  24. /**
  25. * Force update the computed value.
  26. */
  27. trigger: () => void;
  28. }
  29. interface ComputedRefWithControl<T> extends ComputedRef<T>, ComputedWithControlRefExtra {}
  30. interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, ComputedWithControlRefExtra {}
  31. type ComputedWithControlRef<T = any> = ComputedRefWithControl<T> | WritableComputedRefWithControl<T>;
  32. declare function computedWithControl<T>(source: WatchSource | MultiWatchSources$1, fn: ComputedGetter<T>, options?: WatchOptions): ComputedRefWithControl<T>;
  33. declare function computedWithControl<T>(source: WatchSource | MultiWatchSources$1, fn: WritableComputedOptions<T>, options?: WatchOptions): WritableComputedRefWithControl<T>;
  34. /** @deprecated use `computedWithControl` instead */
  35. declare const controlledComputed: typeof computedWithControl;
  36. //#endregion
  37. //#region createDisposableDirective/index.d.ts
  38. type originDirective<H, V, A> = FunctionDirective<H, V, string, A> | ObjectDirective<H, V, string, A>;
  39. /**
  40. * Utility for authoring disposable directives. Reactive effects created within `mounted` directive hook will be tracked and automatically disposed when directive is unmounted.
  41. *
  42. * @see https://vueuse.org/createDisposableDirective
  43. *
  44. * @__NO_SIDE_EFFECTS__
  45. */
  46. declare function createDisposableDirective<H extends HTMLElement, V, A = any>(origin?: originDirective<H, V, A>): originDirective<H, V, A>;
  47. //#endregion
  48. //#region utils/types.d.ts
  49. /**
  50. * Void function
  51. */
  52. type Fn = () => void;
  53. /**
  54. * Any function
  55. */
  56. type AnyFn = (...args: any[]) => any;
  57. /**
  58. * A ref that allow to set null or undefined
  59. */
  60. type RemovableRef<T> = Ref<T, T | null | undefined>;
  61. /**
  62. * Maybe it's a computed ref, or a readonly value, or a getter function
  63. */
  64. type ReadonlyRefOrGetter<T> = ComputedRef<T> | (() => T);
  65. /**
  66. * Make all the nested attributes of an object or array to MaybeRef<T>
  67. *
  68. * Good for accepting options that will be wrapped with `reactive` or `ref`
  69. *
  70. * ```ts
  71. * UnwrapRef<DeepMaybeRef<T>> === T
  72. * ```
  73. */
  74. type DeepMaybeRef<T> = T extends Ref<infer V> ? MaybeRef<V> : T extends Array<any> | object ? { [K in keyof T]: DeepMaybeRef<T[K]>; } : MaybeRef<T>;
  75. type Arrayable<T> = T[] | T;
  76. /**
  77. * Infers the element type of an array
  78. */
  79. type ElementOf<T> = T extends (infer E)[] ? E : never;
  80. type ShallowUnwrapRef<T> = T extends Ref<infer P> ? P : T;
  81. type Awaitable<T> = Promise<T> | T;
  82. type ArgumentsType<T> = T extends ((...args: infer U) => any) ? U : never;
  83. /**
  84. * Compatible with versions below TypeScript 4.5 Awaited
  85. */
  86. type Awaited<T> = T extends null | undefined ? T : T extends object & {
  87. then: (onfulfilled: infer F, ...args: infer _) => any;
  88. } ? F extends ((value: infer V, ...args: infer _) => any) ? Awaited<V> : never : T;
  89. type Promisify<T> = Promise<Awaited<T>>;
  90. type PromisifyFn<T extends AnyFn> = (...args: ArgumentsType<T>) => Promisify<ReturnType<T>>;
  91. interface Pausable {
  92. /**
  93. * A ref indicate whether a pausable instance is active
  94. */
  95. readonly isActive: Readonly<ShallowRef<boolean>>;
  96. /**
  97. * Temporary pause the effect from executing
  98. */
  99. pause: Fn;
  100. /**
  101. * Resume the effects
  102. */
  103. resume: Fn;
  104. }
  105. interface Stoppable<StartFnArgs extends any[] = any[]> {
  106. /**
  107. * A ref indicate whether a stoppable instance is executing
  108. */
  109. readonly isPending: Readonly<Ref<boolean>>;
  110. /**
  111. * Stop the effect from executing
  112. */
  113. stop: Fn;
  114. /**
  115. * Start the effects
  116. */
  117. start: (...args: StartFnArgs) => void;
  118. }
  119. type WatchOptionFlush = WatchOptions['flush'];
  120. interface ConfigurableFlush {
  121. /**
  122. * Timing for monitoring changes, refer to WatchOptions for more details
  123. *
  124. * @default 'pre'
  125. */
  126. flush?: WatchOptionFlush;
  127. }
  128. interface ConfigurableFlushSync {
  129. /**
  130. * Timing for monitoring changes, refer to WatchOptions for more details.
  131. * Unlike `watch()`, the default is set to `sync`
  132. *
  133. * @default 'sync'
  134. */
  135. flush?: WatchOptionFlush;
  136. }
  137. type MapSources<T> = { [K in keyof T]: T[K] extends WatchSource<infer V> ? V : never; };
  138. type MapOldSources<T, Immediate> = { [K in keyof T]: T[K] extends WatchSource<infer V> ? Immediate extends true ? V | undefined : V : never; };
  139. type Mutable<T> = { -readonly [P in keyof T]: T[P]; };
  140. type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
  141. /**
  142. * will return `true` if `T` is `any`, or `false` otherwise
  143. */
  144. type IsAny<T> = IfAny<T, true, false>;
  145. /**
  146. * Universal timer handle that works in both browser and Node.js environments
  147. */
  148. type TimerHandle = ReturnType<typeof setTimeout> | undefined;
  149. type InstanceProxy = NonNullable<NonNullable<ReturnType<typeof getCurrentInstance>>['proxy']>;
  150. //#endregion
  151. //#region createEventHook/index.d.ts
  152. type Callback<T> = IsAny<T> extends true ? (...param: any) => void : ([T] extends [void] ? (...param: unknown[]) => void : [T] extends [any[]] ? (...param: T) => void : (...param: [T, ...unknown[]]) => void);
  153. type EventHookOn<T = any> = (fn: Callback<T>) => {
  154. off: () => void;
  155. };
  156. type EventHookOff<T = any> = (fn: Callback<T>) => void;
  157. type EventHookTrigger<T = any> = (...param: Parameters<Callback<T>>) => Promise<unknown[]>;
  158. interface EventHook<T = any> {
  159. on: EventHookOn<T>;
  160. off: EventHookOff<T>;
  161. trigger: EventHookTrigger<T>;
  162. clear: () => void;
  163. }
  164. type EventHookReturn<T> = EventHook<T>;
  165. /**
  166. * Utility for creating event hooks
  167. *
  168. * @see https://vueuse.org/createEventHook
  169. *
  170. * @__NO_SIDE_EFFECTS__
  171. */
  172. declare function createEventHook<T = any>(): EventHookReturn<T>;
  173. //#endregion
  174. //#region utils/filters.d.ts
  175. type FunctionArgs<Args extends any[] = any[], Return = unknown> = (...args: Args) => Return;
  176. interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
  177. fn: FunctionArgs<Args, This>;
  178. args: Args;
  179. thisArg: This;
  180. }
  181. type EventFilter<Args extends any[] = any[], This = any, Invoke extends AnyFn = AnyFn> = (invoke: Invoke, options: FunctionWrapperOptions<Args, This>) => ReturnType<Invoke> | Promisify<ReturnType<Invoke>>;
  182. interface CancelableEventFilter<Args extends any[] = any[], This = any, Invoke extends AnyFn = AnyFn> {
  183. (invoke: Invoke, options: FunctionWrapperOptions<Args, This>): ReturnType<Invoke> | Promisify<ReturnType<Invoke>>;
  184. cancel: () => void;
  185. flush: () => void;
  186. readonly isPending: Readonly<Ref<boolean>>;
  187. }
  188. interface ConfigurableEventFilter {
  189. /**
  190. * Filter for if events should to be received.
  191. *
  192. * @see https://vueuse.org/guide/config.html#event-filters
  193. */
  194. eventFilter?: EventFilter;
  195. }
  196. interface DebounceFilterOptions {
  197. /**
  198. * The maximum time allowed to be delayed before it's invoked.
  199. * In milliseconds.
  200. */
  201. maxWait?: MaybeRefOrGetter<number>;
  202. /**
  203. * Whether to reject the last call if it's been cancel.
  204. *
  205. * @default false
  206. */
  207. rejectOnCancel?: boolean;
  208. }
  209. type CancelablePromisifyFn<T extends AnyFn> = PromisifyFn<T> & {
  210. cancel: () => void;
  211. flush: () => void;
  212. readonly isPending: Readonly<Ref<boolean>>;
  213. };
  214. /**
  215. * @internal
  216. */
  217. declare function createFilterWrapper<T extends AnyFn>(filter: CancelableEventFilter, fn: T): CancelablePromisifyFn<T>;
  218. declare function createFilterWrapper<T extends AnyFn>(filter: EventFilter, fn: T): PromisifyFn<T>;
  219. declare const bypassFilter: EventFilter;
  220. /**
  221. * Create an EventFilter that debounce the events
  222. */
  223. declare function debounceFilter(ms: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): CancelableEventFilter;
  224. interface ThrottleFilterOptions {
  225. /**
  226. * The maximum time allowed to be delayed before it's invoked.
  227. */
  228. delay: MaybeRefOrGetter<number>;
  229. /**
  230. * Whether to invoke on the trailing edge of the timeout.
  231. */
  232. trailing?: boolean;
  233. /**
  234. * Whether to invoke on the leading edge of the timeout.
  235. */
  236. leading?: boolean;
  237. /**
  238. * Whether to reject the last call if it's been cancel.
  239. */
  240. rejectOnCancel?: boolean;
  241. }
  242. /**
  243. * Create an EventFilter that throttle the events
  244. */
  245. declare function throttleFilter(ms: MaybeRefOrGetter<number>, trailing?: boolean, leading?: boolean, rejectOnCancel?: boolean): EventFilter;
  246. declare function throttleFilter(options: ThrottleFilterOptions): EventFilter;
  247. interface PausableFilterOptions {
  248. /**
  249. * The initial state
  250. *
  251. * @default 'active'
  252. */
  253. initialState?: 'active' | 'paused';
  254. }
  255. /**
  256. * EventFilter that gives extra controls to pause and resume the filter
  257. *
  258. * @param extendFilter Extra filter to apply when the PausableFilter is active, default to none
  259. * @param options Options to configure the filter
  260. */
  261. declare function pausableFilter(extendFilter?: EventFilter, options?: PausableFilterOptions): Pausable & {
  262. eventFilter: EventFilter;
  263. };
  264. //#endregion
  265. //#region utils/general.d.ts
  266. declare function promiseTimeout(ms: number, throwOnTimeout?: boolean, reason?: string): Promise<void>;
  267. declare function identity<T>(arg: T): T;
  268. interface SingletonPromiseReturn<T> {
  269. (): Promise<T>;
  270. /**
  271. * Reset current staled promise.
  272. * await it to have proper shutdown.
  273. */
  274. reset: () => Promise<void>;
  275. }
  276. /**
  277. * Create singleton promise function
  278. *
  279. * @example
  280. * ```
  281. * const promise = createSingletonPromise(async () => { ... })
  282. *
  283. * await promise()
  284. * await promise() // all of them will be bind to a single promise instance
  285. * await promise() // and be resolved together
  286. * ```
  287. */
  288. declare function createSingletonPromise<T>(fn: () => Promise<T>): SingletonPromiseReturn<T>;
  289. declare function invoke<T>(fn: () => T): T;
  290. declare function containsProp(obj: object, ...props: string[]): boolean;
  291. /**
  292. * Increase string a value with unit
  293. *
  294. * @example '2px' + 1 = '3px'
  295. * @example '15em' + (-2) = '13em'
  296. */
  297. declare function increaseWithUnit(target: number, delta: number): number;
  298. declare function increaseWithUnit(target: string, delta: number): string;
  299. declare function increaseWithUnit(target: string | number, delta: number): string | number;
  300. /**
  301. * Get a px value for SSR use, do not rely on this method outside of SSR as REM unit is assumed at 16px, which might not be the case on the client
  302. */
  303. declare function pxValue(px: string): number;
  304. /**
  305. * Create a new subset object by giving keys
  306. */
  307. declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Pick<O, T>;
  308. /**
  309. * Create a new subset object by omit giving keys
  310. */
  311. declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
  312. declare function objectEntries<T extends object>(obj: T): Array<[keyof T, T[keyof T]]>;
  313. declare function toArray<T>(value: T | readonly T[]): readonly T[];
  314. declare function toArray<T>(value: T | T[]): T[];
  315. //#endregion
  316. //#region utils/is.d.ts
  317. declare const isClient: boolean;
  318. declare const isWorker: boolean;
  319. declare const isDef: <T = any>(val?: T) => val is T;
  320. declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
  321. declare const assert: (condition: boolean, ...infos: any[]) => void;
  322. declare const isObject: (val: any) => val is object;
  323. declare const now: () => number;
  324. declare const timestamp: () => number;
  325. declare const clamp: (n: number, min: number, max: number) => number;
  326. declare const noop: () => void;
  327. declare const rand: (min: number, max: number) => number;
  328. declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
  329. declare const isIOS: boolean;
  330. //#endregion
  331. //#region utils/port.d.ts
  332. declare const hyphenate: (str: string) => string;
  333. declare const camelize: (str: string) => string;
  334. //#endregion
  335. //#region utils/vue.d.ts
  336. declare function getLifeCycleTarget(target?: ComponentInternalInstance | null): ComponentInternalInstance | null;
  337. //#endregion
  338. //#region createGlobalState/index.d.ts
  339. type CreateGlobalStateReturn<Fn extends AnyFn = AnyFn> = Fn;
  340. /**
  341. * Keep states in the global scope to be reusable across Vue instances.
  342. *
  343. * @see https://vueuse.org/createGlobalState
  344. * @param stateFactory A factory function to create the state
  345. *
  346. * @__NO_SIDE_EFFECTS__
  347. */
  348. declare function createGlobalState<Fn extends AnyFn>(stateFactory: Fn): CreateGlobalStateReturn<Fn>;
  349. //#endregion
  350. //#region createInjectionState/index.d.ts
  351. type CreateInjectionStateReturn<Arguments extends Array<any>, ProvideReturn, InjectReturn> = Readonly<[
  352. /**
  353. * Call this function in a provider component to create and provide the state.
  354. *
  355. * @param args Arguments passed to the composable
  356. * @returns The state returned by the composable
  357. */
  358. useProvidingState: (...args: Arguments) => ProvideReturn,
  359. /**
  360. * Call this function in a consumer component to inject the state.
  361. *
  362. * @returns The injected state, or `undefined` if not provided and no default value was set.
  363. */
  364. useInjectedState: () => InjectReturn]>;
  365. interface CreateInjectionStateOptions<Return> {
  366. /**
  367. * Custom injectionKey for InjectionState
  368. */
  369. injectionKey?: string | InjectionKey<Return>;
  370. /**
  371. * Default value for the InjectionState
  372. */
  373. defaultValue?: Return;
  374. }
  375. /**
  376. * Create global state that can be injected into components.
  377. *
  378. * @see https://vueuse.org/createInjectionState
  379. *
  380. * @__NO_SIDE_EFFECTS__
  381. */
  382. declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options: {
  383. defaultValue: Return;
  384. } & CreateInjectionStateOptions<Return>): CreateInjectionStateReturn<Arguments, Return, Return>;
  385. declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options?: CreateInjectionStateOptions<Return>): CreateInjectionStateReturn<Arguments, Return, Return | undefined>;
  386. //#endregion
  387. //#region createRef/index.d.ts
  388. type CreateRefReturn<T = any, D extends boolean = false> = ShallowOrDeepRef<T, D>;
  389. type ShallowOrDeepRef<T = any, D extends boolean = false> = D extends true ? Ref<T> : ShallowRef<T>;
  390. /**
  391. * Returns a `deepRef` or `shallowRef` depending on the `deep` param.
  392. *
  393. * @example createRef(1) // ShallowRef<number>
  394. * @example createRef(1, false) // ShallowRef<number>
  395. * @example createRef(1, true) // Ref<number>
  396. * @example createRef("string") // ShallowRef<string>
  397. * @example createRef<"A"|"B">("A", true) // Ref<"A"|"B">
  398. *
  399. * @param value
  400. * @param deep
  401. * @returns the `deepRef` or `shallowRef`
  402. *
  403. * @__NO_SIDE_EFFECTS__
  404. */
  405. declare function createRef<T = any, D extends boolean = false>(value: T, deep?: D): CreateRefReturn<T, D>;
  406. //#endregion
  407. //#region createSharedComposable/index.d.ts
  408. type SharedComposableReturn<T extends AnyFn = AnyFn> = T;
  409. /**
  410. * Make a composable function usable with multiple Vue instances.
  411. *
  412. * @see https://vueuse.org/createSharedComposable
  413. *
  414. * @__NO_SIDE_EFFECTS__
  415. */
  416. declare function createSharedComposable<Fn extends AnyFn>(composable: Fn): SharedComposableReturn<Fn>;
  417. //#endregion
  418. //#region extendRef/index.d.ts
  419. type ExtendRefReturn<T = any> = Ref<T>;
  420. interface ExtendRefOptions<Unwrap extends boolean = boolean> {
  421. /**
  422. * Is the extends properties enumerable
  423. *
  424. * @default false
  425. */
  426. enumerable?: boolean;
  427. /**
  428. * Unwrap for Ref properties
  429. *
  430. * @default true
  431. */
  432. unwrap?: Unwrap;
  433. }
  434. /**
  435. * Overload 1: Unwrap set to false
  436. */
  437. declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions<false>>(ref: R, extend: Extend, options?: Options): ShallowUnwrapRef$1<Extend> & R;
  438. /**
  439. * Overload 2: Unwrap unset or set to true
  440. */
  441. declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
  442. //#endregion
  443. //#region get/index.d.ts
  444. /**
  445. * Shorthand for accessing `ref.value`
  446. */
  447. declare function get<T>(ref: MaybeRef<T>): T;
  448. declare function get<T, K extends keyof T>(ref: MaybeRef<T>, key: K): T[K];
  449. //#endregion
  450. //#region injectLocal/index.d.ts
  451. /**
  452. * On the basis of `inject`, it is allowed to directly call inject to obtain the value after call provide in the same component.
  453. *
  454. * @example
  455. * ```ts
  456. * injectLocal('MyInjectionKey', 1)
  457. * const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
  458. * ```
  459. *
  460. * @NO_SIDE_EFFECTS
  461. */
  462. declare const injectLocal: typeof inject;
  463. //#endregion
  464. //#region isDefined/index.d.ts
  465. type IsDefinedReturn = boolean;
  466. declare function isDefined<T>(v: ComputedRef<T>): v is ComputedRef<Exclude<T, null | undefined>>;
  467. declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>;
  468. declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>;
  469. //#endregion
  470. //#region makeDestructurable/index.d.ts
  471. declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: A): T & A;
  472. //#endregion
  473. //#region provideLocal/map.d.ts
  474. type LocalProvidedKey<T> = InjectionKey<T> | string | number;
  475. //#endregion
  476. //#region provideLocal/index.d.ts
  477. type ProvideLocalReturn = void;
  478. /**
  479. * On the basis of `provide`, it is allowed to directly call inject to obtain the value after call provide in the same component.
  480. *
  481. * @example
  482. * ```ts
  483. * provideLocal('MyInjectionKey', 1)
  484. * const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
  485. * ```
  486. */
  487. declare function provideLocal<T, K = LocalProvidedKey<T>>(key: K, value: K extends InjectionKey<infer V> ? V : T): ProvideLocalReturn;
  488. //#endregion
  489. //#region reactify/index.d.ts
  490. type Reactified<T, Computed extends boolean> = T extends ((...args: infer A) => infer R) ? (...args: { [K in keyof A]: Computed extends true ? MaybeRefOrGetter<A[K]> : MaybeRef<A[K]>; }) => ComputedRef<R> : never;
  491. type ReactifyReturn<T extends AnyFn = AnyFn, K extends boolean = true> = Reactified<T, K>;
  492. interface ReactifyOptions<T extends boolean> {
  493. /**
  494. * Accept passing a function as a reactive getter
  495. *
  496. * @default true
  497. */
  498. computedGetter?: T;
  499. }
  500. /**
  501. * Converts plain function into a reactive function.
  502. * The converted function accepts refs as it's arguments
  503. * and returns a ComputedRef, with proper typing.
  504. *
  505. * @param fn - Source function
  506. * @param options - Options
  507. *
  508. * @__NO_SIDE_EFFECTS__
  509. */
  510. declare function reactify<T extends AnyFn, K extends boolean = true>(fn: T, options?: ReactifyOptions<K>): ReactifyReturn<T, K>;
  511. /** @deprecated use `reactify` instead */
  512. declare const createReactiveFn: typeof reactify;
  513. //#endregion
  514. //#region reactifyObject/index.d.ts
  515. type ReactifyNested<T, Keys extends keyof T = keyof T, S extends boolean = true> = { [K in Keys]: T[K] extends AnyFn ? Reactified<T[K], S> : T[K]; };
  516. type ReactifyObjectReturn<T, Keys extends keyof T, S extends boolean = true> = ReactifyNested<T, Keys, S>;
  517. interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
  518. /**
  519. * Includes names from Object.getOwnPropertyNames
  520. *
  521. * @default true
  522. */
  523. includeOwnProperties?: boolean;
  524. }
  525. /**
  526. * Apply `reactify` to an object
  527. *
  528. * @__NO_SIDE_EFFECTS__
  529. */
  530. declare function reactifyObject<T extends object, Keys extends keyof T>(obj: T, keys?: (keyof T)[]): ReactifyObjectReturn<T, Keys, true>;
  531. declare function reactifyObject<T extends object, S extends boolean = true>(obj: T, options?: ReactifyObjectOptions<S>): ReactifyObjectReturn<T, keyof T, S>;
  532. //#endregion
  533. //#region reactiveComputed/index.d.ts
  534. type ReactiveComputedReturn<T extends object> = UnwrapNestedRefs<T>;
  535. /**
  536. * Computed reactive object.
  537. */
  538. declare function reactiveComputed<T extends object>(fn: ComputedGetter<T>): ReactiveComputedReturn<T>;
  539. //#endregion
  540. //#region reactiveOmit/index.d.ts
  541. type ReactiveOmitReturn<T extends object, K extends keyof T | undefined = undefined> = [K] extends [undefined] ? Partial<T> : Omit<T, Extract<K, keyof T>>;
  542. type ReactiveOmitPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
  543. declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): ReactiveOmitReturn<T, K>;
  544. declare function reactiveOmit<T extends object>(obj: T, predicate: ReactiveOmitPredicate<T>): ReactiveOmitReturn<T>;
  545. //#endregion
  546. //#region reactivePick/index.d.ts
  547. type ReactivePickReturn<T extends object, K extends keyof T> = { [S in K]: UnwrapRef<T[S]>; };
  548. type ReactivePickPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
  549. declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): ReactivePickReturn<T, K>;
  550. declare function reactivePick<T extends object>(obj: T, predicate: ReactivePickPredicate<T>): ReactivePickReturn<T, keyof T>;
  551. //#endregion
  552. //#region refAutoReset/index.d.ts
  553. type RefAutoResetReturn<T = any> = Ref<T>;
  554. /**
  555. * Create a ref which will be reset to the default value after some time.
  556. *
  557. * @see https://vueuse.org/refAutoReset
  558. * @param defaultValue The value which will be set.
  559. * @param afterMs A zero-or-greater delay in milliseconds.
  560. */
  561. declare function refAutoReset<T>(defaultValue: MaybeRefOrGetter<T>, afterMs?: MaybeRefOrGetter<number>): RefAutoResetReturn<T>;
  562. /** @deprecated use `refAutoReset` instead */
  563. declare const autoResetRef: typeof refAutoReset;
  564. //#endregion
  565. //#region refDebounced/index.d.ts
  566. type RefDebouncedReturn<T = any> = Readonly<Ref<T>>;
  567. /**
  568. * Debounce updates of a ref.
  569. *
  570. * @return A new debounced ref.
  571. */
  572. declare function refDebounced<T>(value: Ref<T>, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): RefDebouncedReturn<T>;
  573. /** @deprecated use `refDebounced` instead */
  574. declare const debouncedRef: typeof refDebounced;
  575. /** @deprecated use `refDebounced` instead */
  576. declare const useDebounce: typeof refDebounced;
  577. //#endregion
  578. //#region refDefault/index.d.ts
  579. /**
  580. * Apply default value to a ref.
  581. *
  582. * @__NO_SIDE_EFFECTS__
  583. */
  584. declare function refDefault<T>(source: Ref<T | undefined | null>, defaultValue: T): Ref<T>;
  585. //#endregion
  586. //#region refManualReset/index.d.ts
  587. /**
  588. * Define the shape of a ref that supports manual reset functionality.
  589. *
  590. * This interface extends the standard `Ref` type from Vue and adds a `reset` method.
  591. * The `reset` method allows the ref to be manually reset to its default value.
  592. */
  593. interface ManualResetRefReturn<T> extends Ref<T> {
  594. reset: Fn;
  595. }
  596. /**
  597. * Create a ref with manual reset functionality.
  598. *
  599. * @see https://vueuse.org/refManualReset
  600. * @param defaultValue The value which will be set.
  601. */
  602. declare function refManualReset<T>(defaultValue: MaybeRefOrGetter<T>): ManualResetRefReturn<T>;
  603. //#endregion
  604. //#region refThrottled/index.d.ts
  605. type RefThrottledReturn<T = any> = Ref<T>;
  606. /**
  607. * Throttle execution of a function. Especially useful for rate limiting
  608. * execution of handlers on events like resize and scroll.
  609. *
  610. * @param value Ref value to be watched with throttle effect
  611. * @param delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
  612. * @param trailing if true, update the value again after the delay time is up
  613. * @param leading if true, update the value on the leading edge of the ms timeout
  614. */
  615. declare function refThrottled<T = any>(value: Ref<T>, delay?: number, trailing?: boolean, leading?: boolean): RefThrottledReturn<T>;
  616. /** @deprecated use `refThrottled` instead */
  617. declare const throttledRef: typeof refThrottled;
  618. /** @deprecated use `refThrottled` instead */
  619. declare const useThrottle: typeof refThrottled;
  620. //#endregion
  621. //#region refWithControl/index.d.ts
  622. interface ControlledRefOptions<T> {
  623. /**
  624. * Callback function before the ref changing.
  625. *
  626. * Returning `false` to dismiss the change.
  627. */
  628. onBeforeChange?: (value: T, oldValue: T) => void | boolean;
  629. /**
  630. * Callback function after the ref changed
  631. *
  632. * This happens synchronously, with less overhead compare to `watch`
  633. */
  634. onChanged?: (value: T, oldValue: T) => void;
  635. }
  636. /**
  637. * Fine-grained controls over ref and its reactivity.
  638. *
  639. * @__NO_SIDE_EFFECTS__
  640. */
  641. declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>): {
  642. get: (tracking?: boolean) => T;
  643. set: (value: T, triggering?: boolean) => void;
  644. untrackedGet: () => T;
  645. silentSet: (v: T) => void;
  646. peek: () => T;
  647. lay: (v: T) => void;
  648. } & import("vue").Ref<T, T>;
  649. /** @deprecated use `refWithControl` instead */
  650. declare const controlledRef: typeof refWithControl;
  651. //#endregion
  652. //#region set/index.d.ts
  653. declare function set<T>(ref: Ref<T>, value: T): void;
  654. declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
  655. //#endregion
  656. //#region syncRef/index.d.ts
  657. type Direction = 'ltr' | 'rtl' | 'both';
  658. type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
  659. /**
  660. * A = B
  661. */
  662. type Equal<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
  663. /**
  664. * A ∩ B ≠ ∅
  665. */
  666. type IntersectButNotEqual<A, B> = Equal<A, B> extends true ? false : A & B extends never ? false : true;
  667. /**
  668. * A ⊆ B
  669. */
  670. type IncludeButNotEqual<A, B> = Equal<A, B> extends true ? false : A extends B ? true : false;
  671. /**
  672. * A ∩ B = ∅
  673. */
  674. type NotIntersect<A, B> = Equal<A, B> extends true ? false : A & B extends never ? true : false;
  675. interface EqualType<D extends Direction, L, R, O extends keyof Transform<L, R> = D extends 'both' ? 'ltr' | 'rtl' : D> {
  676. transform?: SpecificFieldPartial<Pick<Transform<L, R>, O>, O>;
  677. }
  678. type StrictIncludeMap<IncludeType extends 'LR' | 'RL', D extends Exclude<Direction, 'both'>, L, R> = (Equal<[IncludeType, D], ['LR', 'ltr']> & Equal<[IncludeType, D], ['RL', 'rtl']>) extends true ? {
  679. transform?: SpecificFieldPartial<Pick<Transform<L, R>, D>, D>;
  680. } : {
  681. transform: Pick<Transform<L, R>, D>;
  682. };
  683. type StrictIncludeType<IncludeType extends 'LR' | 'RL', D extends Direction, L, R> = D extends 'both' ? {
  684. transform: SpecificFieldPartial<Transform<L, R>, IncludeType extends 'LR' ? 'ltr' : 'rtl'>;
  685. } : D extends Exclude<Direction, 'both'> ? StrictIncludeMap<IncludeType, D, L, R> : never;
  686. type IntersectButNotEqualType<D extends Direction, L, R> = D extends 'both' ? {
  687. transform: Transform<L, R>;
  688. } : D extends Exclude<Direction, 'both'> ? {
  689. transform: Pick<Transform<L, R>, D>;
  690. } : never;
  691. type NotIntersectType<D extends Direction, L, R> = IntersectButNotEqualType<D, L, R>;
  692. interface Transform<L, R> {
  693. ltr: (left: L) => R;
  694. rtl: (right: R) => L;
  695. }
  696. type TransformType<D extends Direction, L, R> = Equal<L, R> extends true ? EqualType<D, L, R> : IncludeButNotEqual<L, R> extends true ? StrictIncludeType<'LR', D, L, R> : IncludeButNotEqual<R, L> extends true ? StrictIncludeType<'RL', D, L, R> : IntersectButNotEqual<L, R> extends true ? IntersectButNotEqualType<D, L, R> : NotIntersect<L, R> extends true ? NotIntersectType<D, L, R> : never;
  697. type SyncRefOptions<L, R, D extends Direction> = ConfigurableFlushSync & {
  698. /**
  699. * Watch deeply
  700. *
  701. * @default false
  702. */
  703. deep?: boolean;
  704. /**
  705. * Sync values immediately
  706. *
  707. * @default true
  708. */
  709. immediate?: boolean;
  710. /**
  711. * Direction of syncing. Value will be redefined if you define syncConvertors
  712. *
  713. * @default 'both'
  714. */
  715. direction?: D;
  716. } & TransformType<D, L, R>;
  717. /**
  718. * Two-way refs synchronization.
  719. * From the set theory perspective to restrict the option's type
  720. * Check in the following order:
  721. * 1. L = R
  722. * 2. L ∩ R ≠ ∅
  723. * 3. L ⊆ R
  724. * 4. L ∩ R = ∅
  725. */
  726. declare function syncRef<L, R, D extends Direction = 'both'>(left: Ref<L>, right: Ref<R>, ...[options]: Equal<L, R> extends true ? [options?: SyncRefOptions<L, R, D>] : [options: SyncRefOptions<L, R, D>]): () => void;
  727. //#endregion
  728. //#region syncRefs/index.d.ts
  729. interface SyncRefsOptions extends ConfigurableFlushSync {
  730. /**
  731. * Watch deeply
  732. *
  733. * @default false
  734. */
  735. deep?: boolean;
  736. /**
  737. * Sync values immediately
  738. *
  739. * @default true
  740. */
  741. immediate?: boolean;
  742. }
  743. /**
  744. * Keep target ref(s) in sync with the source ref
  745. *
  746. * @param source source ref
  747. * @param targets
  748. */
  749. declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions): import("vue").WatchHandle;
  750. //#endregion
  751. //#region toReactive/index.d.ts
  752. /**
  753. * Converts ref to reactive.
  754. *
  755. * @see https://vueuse.org/toReactive
  756. * @param objectRef A ref of object
  757. */
  758. declare function toReactive<T extends object>(objectRef: MaybeRef<T>): UnwrapNestedRefs<T>;
  759. //#endregion
  760. //#region toRef/index.d.ts
  761. /**
  762. * Normalize value/ref/getter to `ref` or `computed`.
  763. */
  764. declare function toRef<T>(r: () => T): Readonly<Ref<T>>;
  765. declare function toRef<T>(r: ComputedRef<T>): ComputedRef<T>;
  766. declare function toRef<T>(r: MaybeRefOrGetter<T>): Ref<T>;
  767. declare function toRef<T>(r: T): Ref<T>;
  768. declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
  769. declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
  770. //#endregion
  771. //#region toRefs/index.d.ts
  772. interface ToRefsOptions {
  773. /**
  774. * Replace the original ref with a copy on property update.
  775. *
  776. * @default true
  777. */
  778. replaceRef?: MaybeRefOrGetter<boolean>;
  779. }
  780. /**
  781. * Extended `toRefs` that also accepts refs of an object.
  782. *
  783. * @see https://vueuse.org/toRefs
  784. * @param objectRef A ref or normal object or array.
  785. * @param options Options
  786. */
  787. declare function toRefs<T extends object>(objectRef: MaybeRef<T>, options?: ToRefsOptions): ToRefs<T>;
  788. //#endregion
  789. //#region tryOnBeforeMount/index.d.ts
  790. /**
  791. * Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function
  792. *
  793. * @param fn
  794. * @param sync if set to false, it will run in the nextTick() of Vue
  795. * @param target
  796. */
  797. declare function tryOnBeforeMount(fn: Fn, sync?: boolean, target?: ComponentInternalInstance | null): void;
  798. //#endregion
  799. //#region tryOnBeforeUnmount/index.d.ts
  800. /**
  801. * Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
  802. *
  803. * @param fn
  804. * @param target
  805. */
  806. declare function tryOnBeforeUnmount(fn: Fn, target?: ComponentInternalInstance | null): void;
  807. //#endregion
  808. //#region tryOnMounted/index.d.ts
  809. /**
  810. * Call onMounted() if it's inside a component lifecycle, if not, just call the function
  811. *
  812. * @param fn
  813. * @param sync if set to false, it will run in the nextTick() of Vue
  814. * @param target
  815. */
  816. declare function tryOnMounted(fn: Fn, sync?: boolean, target?: ComponentInternalInstance | null): void;
  817. //#endregion
  818. //#region tryOnScopeDispose/index.d.ts
  819. /**
  820. * Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
  821. *
  822. * @param fn
  823. */
  824. declare function tryOnScopeDispose(fn: Fn, failSilently?: boolean): boolean;
  825. //#endregion
  826. //#region tryOnUnmounted/index.d.ts
  827. /**
  828. * Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
  829. *
  830. * @param fn
  831. * @param target
  832. */
  833. declare function tryOnUnmounted(fn: Fn, target?: ComponentInternalInstance | null): void;
  834. //#endregion
  835. //#region until/index.d.ts
  836. interface UntilToMatchOptions extends ConfigurableFlushSync {
  837. /**
  838. * Milliseconds timeout for promise to resolve/reject if the when condition does not meet.
  839. * 0 for never timed out
  840. *
  841. * @default 0
  842. */
  843. timeout?: number;
  844. /**
  845. * Reject the promise when timeout
  846. *
  847. * @default false
  848. */
  849. throwOnTimeout?: boolean;
  850. /**
  851. * `deep` option for internal watch
  852. *
  853. * @default 'false'
  854. */
  855. deep?: WatchOptions['deep'];
  856. }
  857. interface UntilBaseInstance<T, Not extends boolean = false> {
  858. toMatch: (<U extends T = T>(condition: (v: T) => v is U, options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, U>> : Promise<U>) & ((condition: (v: T) => boolean, options?: UntilToMatchOptions) => Promise<T>);
  859. changed: (options?: UntilToMatchOptions) => Promise<T>;
  860. changedTimes: (n?: number, options?: UntilToMatchOptions) => Promise<T>;
  861. }
  862. type Falsy = false | void | null | undefined | 0 | 0n | '';
  863. interface UntilValueInstance<T, Not extends boolean = false> extends UntilBaseInstance<T, Not> {
  864. readonly not: UntilValueInstance<T, Not extends true ? false : true>;
  865. toBe: <P = T>(value: MaybeRefOrGetter<P>, options?: UntilToMatchOptions) => Not extends true ? Promise<T> : Promise<P>;
  866. toBeTruthy: (options?: UntilToMatchOptions) => Not extends true ? Promise<T & Falsy> : Promise<Exclude<T, Falsy>>;
  867. toBeNull: (options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, null>> : Promise<null>;
  868. toBeUndefined: (options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, undefined>> : Promise<undefined>;
  869. toBeNaN: (options?: UntilToMatchOptions) => Promise<T>;
  870. }
  871. interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
  872. readonly not: UntilArrayInstance<T>;
  873. toContains: (value: MaybeRefOrGetter<ElementOf<ShallowUnwrapRef<T>>>, options?: UntilToMatchOptions) => Promise<T>;
  874. }
  875. /**
  876. * Promised one-time watch for changes
  877. *
  878. * @see https://vueuse.org/until
  879. * @example
  880. * ```
  881. * const { count } = useCounter()
  882. *
  883. * await until(count).toMatch(v => v > 7)
  884. *
  885. * alert('Counter is now larger than 7!')
  886. * ```
  887. */
  888. declare function until<T extends unknown[]>(r: WatchSource<T> | MaybeRefOrGetter<T>): UntilArrayInstance<T>;
  889. declare function until<T>(r: WatchSource<T> | MaybeRefOrGetter<T>): UntilValueInstance<T>;
  890. //#endregion
  891. //#region useArrayDifference/index.d.ts
  892. interface UseArrayDifferenceOptions {
  893. /**
  894. * Returns asymmetric difference
  895. *
  896. * @see https://en.wikipedia.org/wiki/Symmetric_difference
  897. * @default false
  898. */
  899. symmetric?: boolean;
  900. }
  901. type UseArrayDifferenceReturn<T = any> = ComputedRef<T[]>;
  902. declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, key?: keyof T, options?: UseArrayDifferenceOptions): UseArrayDifferenceReturn<T>;
  903. declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, compareFn?: (value: T, othVal: T) => boolean, options?: UseArrayDifferenceOptions): UseArrayDifferenceReturn<T>;
  904. //#endregion
  905. //#region useArrayEvery/index.d.ts
  906. type UseArrayEveryReturn = ComputedRef<boolean>;
  907. /**
  908. * Reactive `Array.every`
  909. *
  910. * @see https://vueuse.org/useArrayEvery
  911. * @param list - the array was called upon.
  912. * @param fn - a function to test each element.
  913. *
  914. * @returns **true** if the `fn` function returns a **truthy** value for every element from the array. Otherwise, **false**.
  915. *
  916. * @__NO_SIDE_EFFECTS__
  917. */
  918. declare function useArrayEvery<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): UseArrayEveryReturn;
  919. //#endregion
  920. //#region useArrayFilter/index.d.ts
  921. type UseArrayFilterReturn<T = any> = ComputedRef<T[]>;
  922. /**
  923. * Reactive `Array.filter`
  924. *
  925. * @see https://vueuse.org/useArrayFilter
  926. * @param list - the array was called upon.
  927. * @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
  928. *
  929. * @returns a shallow copy of a portion of the given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned.
  930. *
  931. * @__NO_SIDE_EFFECTS__
  932. */
  933. declare function useArrayFilter<T, S extends T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => element is S): UseArrayFilterReturn<S>;
  934. declare function useArrayFilter<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => unknown): UseArrayFilterReturn<T>;
  935. //#endregion
  936. //#region useArrayFind/index.d.ts
  937. type UseArrayFindReturn<T = any> = ComputedRef<T | undefined>;
  938. /**
  939. * Reactive `Array.find`
  940. *
  941. * @see https://vueuse.org/useArrayFind
  942. * @param list - the array was called upon.
  943. * @param fn - a function to test each element.
  944. *
  945. * @returns the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
  946. *
  947. * @__NO_SIDE_EFFECTS__
  948. */
  949. declare function useArrayFind<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): UseArrayFindReturn<T>;
  950. //#endregion
  951. //#region useArrayFindIndex/index.d.ts
  952. type UseArrayFindIndexReturn = ComputedRef<number>;
  953. /**
  954. * Reactive `Array.findIndex`
  955. *
  956. * @see https://vueuse.org/useArrayFindIndex
  957. * @param list - the array was called upon.
  958. * @param fn - a function to test each element.
  959. *
  960. * @returns the index of the first element in the array that passes the test. Otherwise, "-1".
  961. *
  962. * @__NO_SIDE_EFFECTS__
  963. */
  964. declare function useArrayFindIndex<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): UseArrayFindIndexReturn;
  965. //#endregion
  966. //#region useArrayFindLast/index.d.ts
  967. type UseArrayFindLastReturn<T = any> = ComputedRef<T | undefined>;
  968. /**
  969. * Reactive `Array.findLast`
  970. *
  971. * @see https://vueuse.org/useArrayFindLast
  972. * @param list - the array was called upon.
  973. * @param fn - a function to test each element.
  974. *
  975. * @returns the last element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
  976. *
  977. * @__NO_SIDE_EFFECTS__
  978. */
  979. declare function useArrayFindLast<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): UseArrayFindLastReturn<T>;
  980. //#endregion
  981. //#region useArrayIncludes/index.d.ts
  982. type UseArrayIncludesComparatorFn<T, V> = ((element: T, value: V, index: number, array: MaybeRefOrGetter<T>[]) => boolean);
  983. interface UseArrayIncludesOptions<T, V> {
  984. fromIndex?: number;
  985. comparator?: UseArrayIncludesComparatorFn<T, V> | keyof T;
  986. }
  987. type UseArrayIncludesReturn = ComputedRef<boolean>;
  988. /**
  989. * Reactive `Array.includes`
  990. *
  991. * @see https://vueuse.org/useArrayIncludes
  992. *
  993. * @returns true if the `value` is found in the array. Otherwise, false.
  994. *
  995. * @__NO_SIDE_EFFECTS__
  996. */
  997. declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: UseArrayIncludesComparatorFn<T, V>): UseArrayIncludesReturn;
  998. declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: keyof T): UseArrayIncludesReturn;
  999. declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, options?: UseArrayIncludesOptions<T, V>): UseArrayIncludesReturn;
  1000. //#endregion
  1001. //#region useArrayJoin/index.d.ts
  1002. type UseArrayJoinReturn = ComputedRef<string>;
  1003. /**
  1004. * Reactive `Array.join`
  1005. *
  1006. * @see https://vueuse.org/useArrayJoin
  1007. * @param list - the array was called upon.
  1008. * @param separator - a string to separate each pair of adjacent elements of the array. If omitted, the array elements are separated with a comma (",").
  1009. *
  1010. * @returns a string with all array elements joined. If arr.length is 0, the empty string is returned.
  1011. *
  1012. * @__NO_SIDE_EFFECTS__
  1013. */
  1014. declare function useArrayJoin(list: MaybeRefOrGetter<MaybeRefOrGetter<any>[]>, separator?: MaybeRefOrGetter<string>): UseArrayJoinReturn;
  1015. //#endregion
  1016. //#region useArrayMap/index.d.ts
  1017. type UseArrayMapReturn<T = any> = ComputedRef<T[]>;
  1018. /**
  1019. * Reactive `Array.map`
  1020. *
  1021. * @see https://vueuse.org/useArrayMap
  1022. * @param list - the array was called upon.
  1023. * @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
  1024. *
  1025. * @returns a new array with each element being the result of the callback function.
  1026. *
  1027. * @__NO_SIDE_EFFECTS__
  1028. */
  1029. declare function useArrayMap<T, U = T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => U): UseArrayMapReturn<U>;
  1030. //#endregion
  1031. //#region useArrayReduce/index.d.ts
  1032. type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
  1033. type UseArrayReduceReturn<T = any> = ComputedRef<T>;
  1034. /**
  1035. * Reactive `Array.reduce`
  1036. *
  1037. * @see https://vueuse.org/useArrayReduce
  1038. * @param list - the array was called upon.
  1039. * @param reducer - a "reducer" function.
  1040. *
  1041. * @returns the value that results from running the "reducer" callback function to completion over the entire array.
  1042. *
  1043. * @__NO_SIDE_EFFECTS__
  1044. */
  1045. declare function useArrayReduce<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, reducer: UseArrayReducer<T, T, T>): UseArrayReduceReturn<T>;
  1046. /**
  1047. * Reactive `Array.reduce`
  1048. *
  1049. * @see https://vueuse.org/useArrayReduce
  1050. * @param list - the array was called upon.
  1051. * @param reducer - a "reducer" function.
  1052. * @param initialValue - a value to be initialized the first time when the callback is called.
  1053. *
  1054. * @returns the value that results from running the "reducer" callback function to completion over the entire array.
  1055. *
  1056. * @__NO_SIDE_EFFECTS__
  1057. */
  1058. declare function useArrayReduce<T, U>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeRefOrGetter<U>): UseArrayReduceReturn<U>;
  1059. //#endregion
  1060. //#region useArraySome/index.d.ts
  1061. type UseArraySomeReturn = ComputedRef<boolean>;
  1062. /**
  1063. * Reactive `Array.some`
  1064. *
  1065. * @see https://vueuse.org/useArraySome
  1066. * @param list - the array was called upon.
  1067. * @param fn - a function to test each element.
  1068. *
  1069. * @returns **true** if the `fn` function returns a **truthy** value for any element from the array. Otherwise, **false**.
  1070. *
  1071. * @__NO_SIDE_EFFECTS__
  1072. */
  1073. declare function useArraySome<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): UseArraySomeReturn;
  1074. //#endregion
  1075. //#region useArrayUnique/index.d.ts
  1076. type UseArrayUniqueReturn<T = any> = ComputedRef<T[]>;
  1077. /**
  1078. * reactive unique array
  1079. * @see https://vueuse.org/useArrayUnique
  1080. * @param list - the array was called upon.
  1081. * @param compareFn
  1082. * @returns A computed ref that returns a unique array of items.
  1083. *
  1084. * @__NO_SIDE_EFFECTS__
  1085. */
  1086. declare function useArrayUnique<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, compareFn?: (a: T, b: T, array: T[]) => boolean): UseArrayUniqueReturn<T>;
  1087. //#endregion
  1088. //#region useCounter/index.d.ts
  1089. interface UseCounterOptions {
  1090. min?: number;
  1091. max?: number;
  1092. }
  1093. interface UseCounterReturn {
  1094. /**
  1095. * The current value of the counter.
  1096. */
  1097. readonly count: Readonly<Ref<number>>;
  1098. /**
  1099. * Increment the counter.
  1100. *
  1101. * @param {number} [delta=1] The number to increment.
  1102. */
  1103. inc: (delta?: number) => void;
  1104. /**
  1105. * Decrement the counter.
  1106. *
  1107. * @param {number} [delta=1] The number to decrement.
  1108. */
  1109. dec: (delta?: number) => void;
  1110. /**
  1111. * Get the current value of the counter.
  1112. */
  1113. get: () => number;
  1114. /**
  1115. * Set the counter to a new value.
  1116. *
  1117. * @param val The new value of the counter.
  1118. */
  1119. set: (val: number) => void;
  1120. /**
  1121. * Reset the counter to an initial value.
  1122. */
  1123. reset: (val?: number) => number;
  1124. }
  1125. /**
  1126. * Basic counter with utility functions.
  1127. *
  1128. * @see https://vueuse.org/useCounter
  1129. * @param [initialValue]
  1130. * @param options
  1131. */
  1132. declare function useCounter(initialValue?: MaybeRef<number>, options?: UseCounterOptions): {
  1133. count: Readonly<Ref<number, number> | import("vue").ShallowRef<number, number> | import("vue").WritableComputedRef<number, number>>;
  1134. inc: (delta?: number) => number;
  1135. dec: (delta?: number) => number;
  1136. get: () => number;
  1137. set: (val: number) => number;
  1138. reset: (val?: number) => number;
  1139. };
  1140. //#endregion
  1141. //#region useDateFormat/index.d.ts
  1142. type DateLike = Date | number | string | undefined;
  1143. interface UseDateFormatOptions {
  1144. /**
  1145. * The locale(s) to used for dd/ddd/dddd/MMM/MMMM format
  1146. *
  1147. * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
  1148. */
  1149. locales?: MaybeRefOrGetter<Intl.LocalesArgument>;
  1150. /**
  1151. * A custom function to re-modify the way to display meridiem
  1152. *
  1153. */
  1154. customMeridiem?: (hours: number, minutes: number, isLowercase?: boolean, hasPeriod?: boolean) => string;
  1155. }
  1156. declare function formatDate(date: Date, formatStr: string, options?: UseDateFormatOptions): string;
  1157. declare function normalizeDate(date: DateLike): Date;
  1158. type UseDateFormatReturn = ComputedRef<string>;
  1159. /**
  1160. * Get the formatted date according to the string of tokens passed in.
  1161. *
  1162. * @see https://vueuse.org/useDateFormat
  1163. * @param date - The date to format, can either be a `Date` object, a timestamp, or a string
  1164. * @param formatStr - The combination of tokens to format the date
  1165. * @param options - UseDateFormatOptions
  1166. *
  1167. * @__NO_SIDE_EFFECTS__
  1168. */
  1169. declare function useDateFormat(date: MaybeRefOrGetter<DateLike>, formatStr?: MaybeRefOrGetter<string>, options?: UseDateFormatOptions): UseDateFormatReturn;
  1170. //#endregion
  1171. //#region useDebounceFn/index.d.ts
  1172. type UseDebounceFnReturn<T extends FunctionArgs> = CancelablePromisifyFn<T>;
  1173. /**
  1174. * Debounce execution of a function.
  1175. *
  1176. * @see https://vueuse.org/useDebounceFn
  1177. * @param fn A function to be executed after delay milliseconds debounced.
  1178. * @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
  1179. * @param options Options
  1180. *
  1181. * @return A new, debounced, function with isPending, cancel, and flush properties.
  1182. */
  1183. declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): UseDebounceFnReturn<T>;
  1184. //#endregion
  1185. //#region useInterval/index.d.ts
  1186. interface UseIntervalOptions<Controls extends boolean> {
  1187. /**
  1188. * Expose more controls
  1189. *
  1190. * @default false
  1191. */
  1192. controls?: Controls;
  1193. /**
  1194. * Execute the update immediately on calling
  1195. *
  1196. * @default true
  1197. */
  1198. immediate?: boolean;
  1199. /**
  1200. * Callback on every interval
  1201. */
  1202. callback?: (count: number) => void;
  1203. }
  1204. interface UseIntervalControls {
  1205. counter: ShallowRef<number>;
  1206. reset: () => void;
  1207. }
  1208. type UseIntervalReturn = Readonly<ShallowRef<number>> | Readonly<UseIntervalControls & Pausable>;
  1209. /**
  1210. * Reactive counter increases on every interval
  1211. *
  1212. * @see https://vueuse.org/useInterval
  1213. * @param interval
  1214. * @param options
  1215. */
  1216. declare function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): Readonly<ShallowRef<number>>;
  1217. declare function useInterval(interval: MaybeRefOrGetter<number>, options: UseIntervalOptions<true>): Readonly<UseIntervalControls & Pausable>;
  1218. //#endregion
  1219. //#region useIntervalFn/index.d.ts
  1220. interface UseIntervalFnOptions {
  1221. /**
  1222. * Start the timer immediately
  1223. *
  1224. * @default true
  1225. */
  1226. immediate?: boolean;
  1227. /**
  1228. * Execute the callback immediately after calling `resume`
  1229. *
  1230. * @default false
  1231. */
  1232. immediateCallback?: boolean;
  1233. }
  1234. type UseIntervalFnReturn = Pausable;
  1235. /**
  1236. * Wrapper for `setInterval` with controls
  1237. *
  1238. * @see https://vueuse.org/useIntervalFn
  1239. * @param cb
  1240. * @param interval
  1241. * @param options
  1242. */
  1243. declare function useIntervalFn(cb: Fn, interval?: MaybeRefOrGetter<number>, options?: UseIntervalFnOptions): UseIntervalFnReturn;
  1244. //#endregion
  1245. //#region useLastChanged/index.d.ts
  1246. interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends number | null | undefined = undefined> extends WatchOptions<Immediate> {
  1247. initialValue?: InitialValue;
  1248. }
  1249. type UseLastChangedReturn = Readonly<ShallowRef<number | null>> | Readonly<ShallowRef<number>>;
  1250. /**
  1251. * Records the timestamp of the last change
  1252. *
  1253. * @see https://vueuse.org/useLastChanged
  1254. */
  1255. declare function useLastChanged(source: WatchSource, options?: UseLastChangedOptions<false>): Readonly<ShallowRef<number | null>>;
  1256. declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<true> | UseLastChangedOptions<boolean, number>): Readonly<ShallowRef<number>>;
  1257. //#endregion
  1258. //#region useThrottleFn/index.d.ts
  1259. /**
  1260. * Throttle execution of a function. Especially useful for rate limiting
  1261. * execution of handlers on events like resize and scroll.
  1262. *
  1263. * @param fn A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
  1264. * to `callback` when the throttled-function is executed.
  1265. * @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
  1266. * (default value: 200)
  1267. *
  1268. * @param [trailing] if true, call fn again after the time is up (default value: true)
  1269. *
  1270. * @param [leading] if true, call fn on the leading edge of the ms timeout (default value: true)
  1271. *
  1272. * @param [rejectOnCancel] if true, reject the last call if it's been cancel (default value: false)
  1273. *
  1274. * @return A new, throttled, function.
  1275. *
  1276. * @__NO_SIDE_EFFECTS__
  1277. */
  1278. declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, trailing?: boolean, leading?: boolean, rejectOnCancel?: boolean): PromisifyFn<T>;
  1279. //#endregion
  1280. //#region useTimeoutFn/index.d.ts
  1281. interface UseTimeoutFnOptions {
  1282. /**
  1283. * Start the timer immediately
  1284. *
  1285. * @default true
  1286. */
  1287. immediate?: boolean;
  1288. /**
  1289. * Execute the callback immediately after calling `start`
  1290. *
  1291. * @default false
  1292. */
  1293. immediateCallback?: boolean;
  1294. }
  1295. type UseTimeoutFnReturn<CallbackFn extends AnyFn> = Stoppable<Parameters<CallbackFn> | []>;
  1296. /**
  1297. * Wrapper for `setTimeout` with controls.
  1298. *
  1299. * @param cb
  1300. * @param interval
  1301. * @param options
  1302. */
  1303. declare function useTimeoutFn<CallbackFn extends AnyFn>(cb: CallbackFn, interval: MaybeRefOrGetter<number>, options?: UseTimeoutFnOptions): UseTimeoutFnReturn<CallbackFn>;
  1304. //#endregion
  1305. //#region useTimeout/index.d.ts
  1306. interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOptions {
  1307. /**
  1308. * Expose more controls
  1309. *
  1310. * @default false
  1311. */
  1312. controls?: Controls;
  1313. /**
  1314. * Callback on timeout
  1315. */
  1316. callback?: Fn;
  1317. }
  1318. type UseTimeoutReturn = ComputedRef<boolean> | {
  1319. readonly ready: ComputedRef<boolean>;
  1320. } & Stoppable;
  1321. /**
  1322. * @deprecated use UseTimeoutReturn instead
  1323. */
  1324. type UseTimoutReturn = UseTimeoutReturn;
  1325. /**
  1326. * Update value after a given time with controls.
  1327. *
  1328. * @see {@link https://vueuse.org/useTimeout}
  1329. * @param interval
  1330. * @param options
  1331. */
  1332. declare function useTimeout(interval?: MaybeRefOrGetter<number>, options?: UseTimeoutOptions<false>): ComputedRef<boolean>;
  1333. declare function useTimeout(interval: MaybeRefOrGetter<number>, options: UseTimeoutOptions<true>): {
  1334. ready: ComputedRef<boolean>;
  1335. } & Stoppable;
  1336. //#endregion
  1337. //#region useToNumber/index.d.ts
  1338. interface UseToNumberOptions {
  1339. /**
  1340. * Method to use to convert the value to a number.
  1341. *
  1342. * Or a custom function for the conversion.
  1343. *
  1344. * @default 'parseFloat'
  1345. */
  1346. method?: 'parseFloat' | 'parseInt' | ((value: string | number) => number);
  1347. /**
  1348. * The base in mathematical numeral systems passed to `parseInt`.
  1349. * Only works with `method: 'parseInt'`
  1350. */
  1351. radix?: number;
  1352. /**
  1353. * Replace NaN with zero
  1354. *
  1355. * @default false
  1356. */
  1357. nanToZero?: boolean;
  1358. }
  1359. /**
  1360. * Reactively convert a string ref to number.
  1361. *
  1362. * @__NO_SIDE_EFFECTS__
  1363. */
  1364. declare function useToNumber(value: MaybeRefOrGetter<number | string>, options?: UseToNumberOptions): ComputedRef<number>;
  1365. //#endregion
  1366. //#region useToString/index.d.ts
  1367. /**
  1368. * Reactively convert a ref to string.
  1369. *
  1370. * @see https://vueuse.org/useToString
  1371. *
  1372. * @__NO_SIDE_EFFECTS__
  1373. */
  1374. declare function useToString(value: MaybeRefOrGetter<unknown>): ComputedRef<string>;
  1375. //#endregion
  1376. //#region useToggle/index.d.ts
  1377. type ToggleFn = (value?: boolean) => void;
  1378. type UseToggleReturn = [ShallowRef<boolean>, ToggleFn] | ToggleFn;
  1379. interface UseToggleOptions<Truthy, Falsy> {
  1380. truthyValue?: MaybeRefOrGetter<Truthy>;
  1381. falsyValue?: MaybeRefOrGetter<Falsy>;
  1382. }
  1383. declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(initialValue: Ref<T>, options?: UseToggleOptions<Truthy, Falsy>): (value?: T) => T;
  1384. declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [ShallowRef<T>, (value?: T) => T];
  1385. //#endregion
  1386. //#region watchArray/index.d.ts
  1387. declare type WatchArrayCallback<V = any, OV = any> = (value: V, oldValue: OV, added: V, removed: OV, onCleanup: (cleanupFn: () => void) => void) => any;
  1388. /**
  1389. * Watch for an array with additions and removals.
  1390. *
  1391. * @see https://vueuse.org/watchArray
  1392. */
  1393. declare function watchArray<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T[]> | T[], cb: WatchArrayCallback<T[], Immediate extends true ? T[] | undefined : T[]>, options?: WatchOptions<Immediate>): import("vue").WatchHandle;
  1394. //#endregion
  1395. //#region watchWithFilter/index.d.ts
  1396. interface WatchWithFilterOptions<Immediate> extends WatchOptions<Immediate>, ConfigurableEventFilter {}
  1397. declare function watchWithFilter<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchHandle;
  1398. declare function watchWithFilter<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchHandle;
  1399. declare function watchWithFilter<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchHandle;
  1400. //#endregion
  1401. //#region watchAtMost/index.d.ts
  1402. interface WatchAtMostOptions<Immediate> extends WatchWithFilterOptions<Immediate> {
  1403. count: MaybeRefOrGetter<number>;
  1404. }
  1405. interface WatchAtMostReturn {
  1406. stop: WatchStopHandle;
  1407. pause: () => void;
  1408. resume: () => void;
  1409. count: ShallowRef<number>;
  1410. }
  1411. declare function watchAtMost<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
  1412. declare function watchAtMost<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
  1413. declare function watchAtMost<T extends object, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
  1414. //#endregion
  1415. //#region watchDebounced/index.d.ts
  1416. interface WatchDebouncedOptions<Immediate> extends WatchOptions<Immediate>, DebounceFilterOptions {
  1417. debounce?: MaybeRefOrGetter<number>;
  1418. }
  1419. declare function watchDebounced<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchDebouncedOptions<Immediate>): WatchHandle;
  1420. declare function watchDebounced<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchDebouncedOptions<Immediate>): WatchHandle;
  1421. declare function watchDebounced<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchDebouncedOptions<Immediate>): WatchHandle;
  1422. /** @deprecated use `watchDebounced` instead */
  1423. declare const debouncedWatch: typeof watchDebounced;
  1424. //#endregion
  1425. //#region watchDeep/index.d.ts
  1426. declare function watchDeep<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: Omit<WatchOptions<Immediate>, 'deep'>): WatchHandle;
  1427. declare function watchDeep<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: Omit<WatchOptions<Immediate>, 'deep'>): WatchHandle;
  1428. declare function watchDeep<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: Omit<WatchOptions<Immediate>, 'deep'>): WatchHandle;
  1429. //#endregion
  1430. //#region watchIgnorable/index.d.ts
  1431. type IgnoredUpdater = (updater: () => void) => void;
  1432. type IgnoredPrevAsyncUpdates = () => void;
  1433. interface WatchIgnorableReturn {
  1434. ignoreUpdates: IgnoredUpdater;
  1435. ignorePrevAsyncUpdates: IgnoredPrevAsyncUpdates;
  1436. stop: WatchStopHandle;
  1437. }
  1438. declare function watchIgnorable<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn;
  1439. declare function watchIgnorable<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn;
  1440. declare function watchIgnorable<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn;
  1441. /** @deprecated use `watchIgnorable` instead */
  1442. declare const ignorableWatch: typeof watchIgnorable;
  1443. //#endregion
  1444. //#region watchImmediate/index.d.ts
  1445. declare function watchImmediate<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchHandle;
  1446. declare function watchImmediate<T extends Readonly<MultiWatchSources$1>>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchHandle;
  1447. declare function watchImmediate<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchHandle;
  1448. //#endregion
  1449. //#region watchOnce/index.d.ts
  1450. declare function watchOnce<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'once'>): WatchHandle;
  1451. declare function watchOnce<T extends Readonly<MultiWatchSources$1>>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>, options?: Omit<WatchOptions<true>, 'once'>): WatchHandle;
  1452. declare function watchOnce<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'once'>): WatchHandle;
  1453. //#endregion
  1454. //#region watchPausable/index.d.ts
  1455. interface WatchPausableReturn extends Pausable {
  1456. stop: WatchStopHandle;
  1457. }
  1458. type WatchPausableOptions<Immediate> = WatchWithFilterOptions<Immediate> & PausableFilterOptions;
  1459. /** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
  1460. declare function watchPausable<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
  1461. /** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
  1462. declare function watchPausable<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
  1463. /** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
  1464. declare function watchPausable<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
  1465. /** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
  1466. declare const pausableWatch: typeof watchPausable;
  1467. //#endregion
  1468. //#region watchThrottled/index.d.ts
  1469. interface WatchThrottledOptions<Immediate> extends WatchOptions<Immediate> {
  1470. throttle?: MaybeRefOrGetter<number>;
  1471. trailing?: boolean;
  1472. leading?: boolean;
  1473. }
  1474. declare function watchThrottled<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchThrottledOptions<Immediate>): WatchHandle;
  1475. declare function watchThrottled<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchThrottledOptions<Immediate>): WatchHandle;
  1476. declare function watchThrottled<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchThrottledOptions<Immediate>): WatchHandle;
  1477. /** @deprecated use `watchThrottled` instead */
  1478. declare const throttledWatch: typeof watchThrottled;
  1479. //#endregion
  1480. //#region watchTriggerable/index.d.ts
  1481. interface WatchTriggerableReturn<FnReturnT = void> extends WatchIgnorableReturn {
  1482. /** Execute `WatchCallback` immediately */
  1483. trigger: () => FnReturnT;
  1484. }
  1485. type OnCleanup = (cleanupFn: () => void) => void;
  1486. type WatchTriggerableCallback<V = any, OV = any, R = void> = (value: V, oldValue: OV, onCleanup: OnCleanup) => R;
  1487. declare function watchTriggerable<T, FnReturnT>(source: WatchSource<T>, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
  1488. declare function watchTriggerable<T extends Readonly<MultiWatchSources$1>, FnReturnT>(sources: [...T], cb: WatchTriggerableCallback<MapSources<T>, MapOldSources<T, true>, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
  1489. declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
  1490. //#endregion
  1491. //#region whenever/index.d.ts
  1492. type Truthy<T> = T extends false | null | undefined ? never : T;
  1493. interface WheneverOptions<Immediate = boolean> extends WatchOptions<Immediate> {
  1494. /**
  1495. * Only trigger once when the condition is met
  1496. *
  1497. * Override the `once` option in `WatchOptions`
  1498. *
  1499. * @default false
  1500. */
  1501. once?: boolean;
  1502. }
  1503. /**
  1504. * Shorthand for watching value to be truthy
  1505. *
  1506. * @see https://vueuse.org/whenever
  1507. */
  1508. declare function whenever<T>(source: WatchSource<T>, cb: WatchCallback<Truthy<T>, T | undefined>, options?: WheneverOptions<true>): WatchHandle;
  1509. declare function whenever<T>(source: WatchSource<T>, cb: WatchCallback<Truthy<T>, T>, options?: WheneverOptions<false>): WatchHandle;
  1510. //#endregion
  1511. export { AnyFn, ArgumentsType, Arrayable, Awaitable, Awaited, CancelableEventFilter, CancelablePromisifyFn, ComputedEagerOptions, ComputedEagerReturn, ComputedRefWithControl, ComputedWithControlRef, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, CreateInjectionStateOptions, CreateInjectionStateReturn, CreateRefReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookReturn, EventHookTrigger, ExtendRefOptions, ExtendRefReturn, Fn, FunctionArgs, FunctionWrapperOptions, IfAny, IgnoredPrevAsyncUpdates, IgnoredUpdater, InstanceProxy, IsAny, IsDefinedReturn, ManualResetRefReturn, MapOldSources, MapSources, type MultiWatchSources, Mutable, Pausable, PausableFilterOptions, Promisify, PromisifyFn, ProvideLocalReturn, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyObjectReturn, ReactifyOptions, ReactifyReturn, ReactiveComputedReturn, ReactiveOmitPredicate, ReactiveOmitReturn, ReactivePickPredicate, ReactivePickReturn, ReadonlyRefOrGetter, RefAutoResetReturn, RefDebouncedReturn, RefThrottledReturn, RemovableRef, ShallowOrDeepRef, ShallowUnwrapRef, SharedComposableReturn, SingletonPromiseReturn, Stoppable, SyncRefOptions, SyncRefsOptions, ThrottleFilterOptions, TimerHandle, ToRefsOptions, ToggleFn, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayDifferenceOptions, UseArrayDifferenceReturn, UseArrayEveryReturn, UseArrayFilterReturn, UseArrayFindIndexReturn, UseArrayFindLastReturn, UseArrayFindReturn, UseArrayIncludesComparatorFn, UseArrayIncludesOptions, UseArrayIncludesReturn, UseArrayJoinReturn, UseArrayMapReturn, UseArrayReduceReturn, UseArrayReducer, UseArraySomeReturn, UseArrayUniqueReturn, UseCounterOptions, UseCounterReturn, UseDateFormatOptions, UseDateFormatReturn, UseDebounceFnReturn, UseIntervalControls, UseIntervalFnOptions, UseIntervalFnReturn, UseIntervalOptions, UseIntervalReturn, UseLastChangedOptions, UseLastChangedReturn, UseTimeoutFnOptions, UseTimeoutFnReturn, UseTimeoutOptions, UseTimeoutReturn, UseTimoutReturn, UseToNumberOptions, UseToggleOptions, UseToggleReturn, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchOptionFlush, WatchPausableOptions, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WheneverOptions, WritableComputedRefWithControl, assert, autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, controlledComputed, controlledRef, createDisposableDirective, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, createReactiveFn, createRef, createSharedComposable, createSingletonPromise, debounceFilter, debouncedRef, debouncedWatch, eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, pausableWatch, promiseTimeout, provideLocal, pxValue, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refManualReset, refThrottled, refWithControl, set, syncRef, syncRefs, throttleFilter, throttledRef, throttledWatch, timestamp, toArray, toReactive, toRef, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };