index.d.ts 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039
  1. import * as vue_demi from 'vue-demi';
  2. import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, ShallowUnwrapRef as ShallowUnwrapRef$1, WatchOptions, UnwrapRef, ToRefs, WatchCallback, WatchStopHandle } from 'vue-demi';
  3. declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<Ref<T>>;
  4. interface ComputedWithControlRefExtra {
  5. /**
  6. * Force update the computed value.
  7. */
  8. trigger(): void;
  9. }
  10. interface ComputedRefWithControl<T> extends ComputedRef<T>, ComputedWithControlRefExtra {
  11. }
  12. interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, ComputedWithControlRefExtra {
  13. }
  14. declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: ComputedGetter<T>): ComputedRefWithControl<T>;
  15. declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: WritableComputedOptions<T>): WritableComputedRefWithControl<T>;
  16. /**
  17. * The source code for this function was inspired by vue-apollo's `useEventHook` util
  18. * https://github.com/vuejs/vue-apollo/blob/v4/packages/vue-apollo-composable/src/util/useEventHook.ts
  19. */
  20. declare type EventHookOn<T = any> = (fn: (param: T) => void) => {
  21. off: () => void;
  22. };
  23. declare type EventHookOff<T = any> = (fn: (param: T) => void) => void;
  24. declare type EventHookTrigger<T = any> = (param: T) => void;
  25. interface EventHook<T = any> {
  26. on: EventHookOn<T>;
  27. off: EventHookOff<T>;
  28. trigger: EventHookTrigger<T>;
  29. }
  30. /**
  31. * Utility for creating event hooks
  32. *
  33. * @see https://vueuse.org/createEventHook
  34. */
  35. declare function createEventHook<T = any>(): EventHook<T>;
  36. declare type CreateGlobalStateReturn<T> = () => T;
  37. /**
  38. * Keep states in the global scope to be reusable across Vue instances.
  39. *
  40. * @see https://vueuse.org/createGlobalState
  41. * @param stateFactory A factory function to create the state
  42. */
  43. declare function createGlobalState<T>(stateFactory: () => T): CreateGlobalStateReturn<T>;
  44. /**
  45. * Create global state that can be injected into components.
  46. *
  47. * @see https://vueuse.org/createInjectionState
  48. *
  49. */
  50. declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return): readonly [useProvidingState: (...args: Arguments) => void, useInjectedState: () => Return | undefined];
  51. /**
  52. * Make a composable function usable with multiple Vue instances.
  53. *
  54. * @see https://vueuse.org/createSharedComposable
  55. */
  56. declare function createSharedComposable<Fn extends ((...args: any[]) => any)>(composable: Fn): Fn;
  57. interface ExtendRefOptions<Unwrap extends boolean = boolean> {
  58. /**
  59. * Is the extends properties enumerable
  60. *
  61. * @default false
  62. */
  63. enumerable?: boolean;
  64. /**
  65. * Unwrap for Ref properties
  66. *
  67. * @default true
  68. */
  69. unwrap?: Unwrap;
  70. }
  71. /**
  72. * Overload 1: Unwrap set to false
  73. */
  74. declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions<false>>(ref: R, extend: Extend, options?: Options): ShallowUnwrapRef$1<Extend> & R;
  75. /**
  76. * Overload 2: Unwrap unset or set to true
  77. */
  78. declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
  79. declare const isClient: boolean;
  80. declare const isDef: <T = any>(val?: T | undefined) => val is T;
  81. declare const assert: (condition: boolean, ...infos: any[]) => void;
  82. declare const isBoolean: (val: any) => val is boolean;
  83. declare const isFunction: <T extends Function>(val: any) => val is T;
  84. declare const isNumber: (val: any) => val is number;
  85. declare const isString: (val: unknown) => val is string;
  86. declare const isObject: (val: any) => val is object;
  87. declare const isWindow: (val: any) => val is Window;
  88. declare const now: () => number;
  89. declare const timestamp: () => number;
  90. declare const clamp: (n: number, min: number, max: number) => number;
  91. declare const noop: () => void;
  92. declare const rand: (min: number, max: number) => number;
  93. declare const isIOS: boolean | "";
  94. declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
  95. /**
  96. * Any function
  97. */
  98. declare type Fn = () => void;
  99. /**
  100. * A ref that allow to set null or undefined
  101. */
  102. declare type RemovableRef<T> = Omit<Ref<T>, 'value'> & {
  103. get value(): T;
  104. set value(value: T | null | undefined);
  105. };
  106. /**
  107. * @deprecated Use `RemovableRef`
  108. */
  109. declare type RemoveableRef<T> = RemovableRef<T>;
  110. /**
  111. * Maybe it's a ref, or a plain value
  112. *
  113. * ```ts
  114. * type MaybeRef<T> = T | Ref<T>
  115. * ```
  116. */
  117. declare type MaybeRef<T> = T | Ref<T>;
  118. /**
  119. * Maybe it's a ref, or a plain value, or a getter function
  120. *
  121. * ```ts
  122. * type MaybeComputedRef<T> = (() => T) | T | Ref<T> | ComputedRef<T>
  123. * ```
  124. */
  125. declare type MaybeComputedRef<T> = MaybeReadonlyRef<T> | MaybeRef<T>;
  126. /**
  127. * Maybe it's a computed ref, or a getter function
  128. *
  129. * ```ts
  130. * type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>
  131. * ```
  132. */
  133. declare type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>;
  134. /**
  135. * Make all the nested attributes of an object or array to MaybeRef<T>
  136. *
  137. * Good for accepting options that will be wrapped with `reactive` or `ref`
  138. *
  139. * ```ts
  140. * UnwrapRef<DeepMaybeRef<T>> === T
  141. * ```
  142. */
  143. declare type DeepMaybeRef<T> = T extends Ref<infer V> ? MaybeRef<V> : T extends Array<any> | object ? {
  144. [K in keyof T]: DeepMaybeRef<T[K]>;
  145. } : MaybeRef<T>;
  146. /**
  147. * Infers the element type of an array
  148. */
  149. declare type ElementOf<T> = T extends (infer E)[] ? E : never;
  150. declare type ShallowUnwrapRef<T> = T extends Ref<infer P> ? P : T;
  151. declare type Awaitable<T> = Promise<T> | T;
  152. declare type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
  153. interface Pausable {
  154. /**
  155. * A ref indicate whether a pausable instance is active
  156. */
  157. isActive: Ref<boolean>;
  158. /**
  159. * Temporary pause the effect from executing
  160. */
  161. pause: Fn;
  162. /**
  163. * Resume the effects
  164. */
  165. resume: Fn;
  166. }
  167. interface Stoppable {
  168. /**
  169. * A ref indicate whether a stoppable instance is executing
  170. */
  171. isPending: Ref<boolean>;
  172. /**
  173. * Stop the effect from executing
  174. */
  175. stop: Fn;
  176. /**
  177. * Start the effects
  178. */
  179. start: Fn;
  180. }
  181. /**
  182. * @deprecated Use `Stoppable`
  183. */
  184. declare type Stopable = Stoppable;
  185. interface ConfigurableFlush {
  186. /**
  187. * Timing for monitoring changes, refer to WatchOptions for more details
  188. *
  189. * @default 'pre'
  190. */
  191. flush?: WatchOptions['flush'];
  192. }
  193. interface ConfigurableFlushSync {
  194. /**
  195. * Timing for monitoring changes, refer to WatchOptions for more details.
  196. * Unlike `watch()`, the default is set to `sync`
  197. *
  198. * @default 'sync'
  199. */
  200. flush?: WatchOptions['flush'];
  201. }
  202. declare type MapSources<T> = {
  203. [K in keyof T]: T[K] extends WatchSource<infer V> ? V : never;
  204. };
  205. declare type MapOldSources<T, Immediate> = {
  206. [K in keyof T]: T[K] extends WatchSource<infer V> ? Immediate extends true ? V | undefined : V : never;
  207. };
  208. declare type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
  209. interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
  210. fn: FunctionArgs<Args, This>;
  211. args: Args;
  212. thisArg: This;
  213. }
  214. declare type EventFilter<Args extends any[] = any[], This = any> = (invoke: Fn, options: FunctionWrapperOptions<Args, This>) => void;
  215. interface ConfigurableEventFilter {
  216. /**
  217. * Filter for if events should to be received.
  218. *
  219. * @see https://vueuse.org/guide/config.html#event-filters
  220. */
  221. eventFilter?: EventFilter;
  222. }
  223. interface DebounceFilterOptions {
  224. /**
  225. * The maximum time allowed to be delayed before it's invoked.
  226. * In milliseconds.
  227. */
  228. maxWait?: MaybeComputedRef<number>;
  229. }
  230. /**
  231. * @internal
  232. */
  233. declare function createFilterWrapper<T extends FunctionArgs>(filter: EventFilter, fn: T): T;
  234. declare const bypassFilter: EventFilter;
  235. /**
  236. * Create an EventFilter that debounce the events
  237. *
  238. * @param ms
  239. * @param options
  240. */
  241. declare function debounceFilter(ms: MaybeComputedRef<number>, options?: DebounceFilterOptions): EventFilter<any[], any>;
  242. /**
  243. * Create an EventFilter that throttle the events
  244. *
  245. * @param ms
  246. * @param [trailing=true]
  247. * @param [leading=true]
  248. */
  249. declare function throttleFilter(ms: MaybeComputedRef<number>, trailing?: boolean, leading?: boolean): EventFilter<any[], any>;
  250. /**
  251. * EventFilter that gives extra controls to pause and resume the filter
  252. *
  253. * @param extendFilter Extra filter to apply when the PausableFilter is active, default to none
  254. *
  255. */
  256. declare function pausableFilter(extendFilter?: EventFilter): Pausable & {
  257. eventFilter: EventFilter;
  258. };
  259. declare function __onlyVue3(name?: string): void;
  260. declare const directiveHooks: {
  261. mounted: "mounted";
  262. updated: "updated";
  263. unmounted: "unmounted";
  264. };
  265. declare function promiseTimeout(ms: number, throwOnTimeout?: boolean, reason?: string): Promise<void>;
  266. declare function identity<T>(arg: T): T;
  267. interface SingletonPromiseReturn<T> {
  268. (): Promise<T>;
  269. /**
  270. * Reset current staled promise.
  271. * await it to have proper shutdown.
  272. */
  273. reset: () => Promise<void>;
  274. }
  275. /**
  276. * Create singleton promise function
  277. *
  278. * @example
  279. * ```
  280. * const promise = createSingletonPromise(async () => { ... })
  281. *
  282. * await promise()
  283. * await promise() // all of them will be bind to a single promise instance
  284. * await promise() // and be resolved together
  285. * ```
  286. */
  287. declare function createSingletonPromise<T>(fn: () => Promise<T>): SingletonPromiseReturn<T>;
  288. declare function invoke<T>(fn: () => T): T;
  289. declare function containsProp(obj: object, ...props: string[]): boolean;
  290. /**
  291. * Increase string a value with unit
  292. *
  293. * @example '2px' + 1 = '3px'
  294. * @example '15em' + (-2) = '13em'
  295. */
  296. declare function increaseWithUnit(target: number, delta: number): number;
  297. declare function increaseWithUnit(target: string, delta: number): string;
  298. declare function increaseWithUnit(target: string | number, delta: number): string | number;
  299. /**
  300. * Create a new subset object by giving keys
  301. *
  302. * @category Object
  303. */
  304. declare function objectPick<O, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Pick<O, T>;
  305. /**
  306. * Shorthand for accessing `ref.value`
  307. */
  308. declare function get<T>(ref: MaybeRef<T>): T;
  309. declare function get<T, K extends keyof T>(ref: MaybeRef<T>, key: K): T[K];
  310. declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>;
  311. declare function isDefined<T>(v: ComputedRef<T>): v is ComputedRef<Exclude<T, null | undefined>>;
  312. declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>;
  313. declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: A): T & A;
  314. declare type Reactified<T, Computed extends boolean> = T extends (...args: infer A) => infer R ? (...args: {
  315. [K in keyof A]: Computed extends true ? MaybeComputedRef<A[K]> : MaybeRef<A[K]>;
  316. }) => ComputedRef<R> : never;
  317. interface ReactifyOptions<T extends boolean> {
  318. /**
  319. * Accept passing a function as a reactive getter
  320. *
  321. * @default true
  322. */
  323. computedGetter?: T;
  324. }
  325. /**
  326. * Converts plain function into a reactive function.
  327. * The converted function accepts refs as it's arguments
  328. * and returns a ComputedRef, with proper typing.
  329. *
  330. * @param fn - Source function
  331. */
  332. declare function reactify<T extends Function, K extends boolean = true>(fn: T, options?: ReactifyOptions<K>): Reactified<T, K>;
  333. declare type ReactifyNested<T, Keys extends keyof T = keyof T, S extends boolean = true> = {
  334. [K in Keys]: T[K] extends (...args: any[]) => any ? Reactified<T[K], S> : T[K];
  335. };
  336. interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
  337. /**
  338. * Includes names from Object.getOwnPropertyNames
  339. *
  340. * @default true
  341. */
  342. includeOwnProperties?: boolean;
  343. }
  344. /**
  345. * Apply `reactify` to an object
  346. */
  347. declare function reactifyObject<T extends object, Keys extends keyof T>(obj: T, keys?: (keyof T)[]): ReactifyNested<T, Keys, true>;
  348. declare function reactifyObject<T extends object, S extends boolean = true>(obj: T, options?: ReactifyObjectOptions<S>): ReactifyNested<T, keyof T, S>;
  349. /**
  350. * Computed reactive object.
  351. */
  352. declare function reactiveComputed<T extends {}>(fn: () => T): T;
  353. /**
  354. * Reactively omit fields from a reactive object
  355. *
  356. * @see https://vueuse.org/reactiveOmit
  357. */
  358. declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Omit<T, K>;
  359. /**
  360. * Reactively pick fields from a reactive object
  361. *
  362. * @see https://vueuse.org/reactivePick
  363. */
  364. declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): {
  365. [S in K]: UnwrapRef<T[S]>;
  366. };
  367. /**
  368. * Create a ref which will be reset to the default value after some time.
  369. *
  370. * @see https://vueuse.org/refAutoReset
  371. * @param defaultValue The value which will be set.
  372. * @param afterMs A zero-or-greater delay in milliseconds.
  373. */
  374. declare function refAutoReset<T>(defaultValue: T, afterMs?: MaybeComputedRef<number>): Ref<T>;
  375. /**
  376. * Debounce updates of a ref.
  377. *
  378. * @return A new debounced ref.
  379. */
  380. declare function refDebounced<T>(value: Ref<T>, ms?: number, options?: DebounceFilterOptions): Readonly<Ref<T>>;
  381. /**
  382. * Apply default value to a ref.
  383. *
  384. * @param source source ref
  385. * @param targets
  386. */
  387. declare function refDefault<T>(source: Ref<T | undefined | null>, defaultValue: T): Ref<T>;
  388. /**
  389. * Throttle execution of a function. Especially useful for rate limiting
  390. * execution of handlers on events like resize and scroll.
  391. *
  392. * @param value Ref value to be watched with throttle effect
  393. * @param delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
  394. * @param [trailing=true] if true, update the value again after the delay time is up
  395. * @param [leading=true] if true, update the value on the leading edge of the ms timeout
  396. */
  397. declare function refThrottled<T>(value: Ref<T>, delay?: number, trailing?: boolean, leading?: boolean): Ref<T>;
  398. interface ControlledRefOptions<T> {
  399. /**
  400. * Callback function before the ref changing.
  401. *
  402. * Returning `false` to dismiss the change.
  403. */
  404. onBeforeChange?: (value: T, oldValue: T) => void | boolean;
  405. /**
  406. * Callback function after the ref changed
  407. *
  408. * This happens synchronously, with less overhead compare to `watch`
  409. */
  410. onChanged?: (value: T, oldValue: T) => void;
  411. }
  412. /**
  413. * Explicitly define the deps of computed.
  414. *
  415. * @param source
  416. * @param fn
  417. */
  418. declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>): vue_demi.ShallowUnwrapRef<{
  419. get: (tracking?: boolean) => T;
  420. set: (value: T, triggering?: boolean) => void;
  421. untrackedGet: () => T;
  422. silentSet: (v: T) => void;
  423. peek: () => T;
  424. lay: (v: T) => void;
  425. }> & vue_demi.Ref<T>;
  426. /**
  427. * Alias for `refWithControl`
  428. */
  429. declare const controlledRef: typeof refWithControl;
  430. /**
  431. * Normalize value/ref/getter to `ref` or `computed`.
  432. */
  433. declare function resolveRef<T>(r: MaybeComputedRef<T>): ComputedRef<T>;
  434. declare function resolveRef<T>(r: MaybeRef<T>): Ref<T>;
  435. declare function resolveRef<T>(r: T): Ref<T>;
  436. /**
  437. * Normalize value/ref/getter to `ref` or `computed`.
  438. */
  439. declare function resolveUnref<T>(r: MaybeComputedRef<T>): T;
  440. declare function set<T>(ref: Ref<T>, value: T): void;
  441. declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
  442. interface SyncRefOptions<L, R = L> extends ConfigurableFlushSync {
  443. /**
  444. * Watch deeply
  445. *
  446. * @default false
  447. */
  448. deep?: boolean;
  449. /**
  450. * Sync values immediately
  451. *
  452. * @default true
  453. */
  454. immediate?: boolean;
  455. /**
  456. * Direction of syncing. Value will be redefined if you define syncConvertors
  457. *
  458. * @default 'both'
  459. */
  460. direction?: 'ltr' | 'rtl' | 'both';
  461. /**
  462. * Custom transform function
  463. */
  464. transform?: {
  465. ltr?: (left: L) => R;
  466. rtl?: (right: R) => L;
  467. };
  468. }
  469. /**
  470. * Two-way refs synchronization.
  471. *
  472. * @param left
  473. * @param right
  474. */
  475. declare function syncRef<L, R = L>(left: Ref<L>, right: Ref<R>, options?: SyncRefOptions<L, R>): () => void;
  476. interface SyncRefsOptions extends ConfigurableFlushSync {
  477. /**
  478. * Watch deeply
  479. *
  480. * @default false
  481. */
  482. deep?: boolean;
  483. /**
  484. * Sync values immediately
  485. *
  486. * @default true
  487. */
  488. immediate?: boolean;
  489. }
  490. /**
  491. * Keep target ref(s) in sync with the source ref
  492. *
  493. * @param source source ref
  494. * @param targets
  495. */
  496. declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions): vue_demi.WatchStopHandle;
  497. /**
  498. * Converts ref to reactive.
  499. *
  500. * @see https://vueuse.org/toReactive
  501. * @param objectRef A ref of object
  502. */
  503. declare function toReactive<T extends object>(objectRef: MaybeRef<T>): T;
  504. /**
  505. * Extended `toRefs` that also accepts refs of an object.
  506. *
  507. * @see https://vueuse.org/toRefs
  508. * @param objectRef A ref or normal object or array.
  509. */
  510. declare function toRefs<T extends object>(objectRef: MaybeRef<T>): ToRefs<T>;
  511. /**
  512. * Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function
  513. *
  514. * @param fn
  515. * @param sync if set to false, it will run in the nextTick() of Vue
  516. */
  517. declare function tryOnBeforeMount(fn: Fn, sync?: boolean): void;
  518. /**
  519. * Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
  520. *
  521. * @param fn
  522. */
  523. declare function tryOnBeforeUnmount(fn: Fn): void;
  524. /**
  525. * Call onMounted() if it's inside a component lifecycle, if not, just call the function
  526. *
  527. * @param fn
  528. * @param sync if set to false, it will run in the nextTick() of Vue
  529. */
  530. declare function tryOnMounted(fn: Fn, sync?: boolean): void;
  531. /**
  532. * Call onScopeDispose() if it's inside a effect scope lifecycle, if not, do nothing
  533. *
  534. * @param fn
  535. */
  536. declare function tryOnScopeDispose(fn: Fn): boolean;
  537. /**
  538. * Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
  539. *
  540. * @param fn
  541. */
  542. declare function tryOnUnmounted(fn: Fn): void;
  543. interface UntilToMatchOptions {
  544. /**
  545. * Milliseconds timeout for promise to resolve/reject if the when condition does not meet.
  546. * 0 for never timed out
  547. *
  548. * @default 0
  549. */
  550. timeout?: number;
  551. /**
  552. * Reject the promise when timeout
  553. *
  554. * @default false
  555. */
  556. throwOnTimeout?: boolean;
  557. /**
  558. * `flush` option for internal watch
  559. *
  560. * @default 'sync'
  561. */
  562. flush?: WatchOptions['flush'];
  563. /**
  564. * `deep` option for internal watch
  565. *
  566. * @default 'false'
  567. */
  568. deep?: WatchOptions['deep'];
  569. }
  570. interface UntilBaseInstance<T, Not extends boolean = false> {
  571. toMatch<U extends T = T>(condition: (v: T) => v is U, options?: UntilToMatchOptions): Not extends true ? Promise<Exclude<T, U>> : Promise<U>;
  572. toMatch(condition: (v: T) => boolean, options?: UntilToMatchOptions): Promise<T>;
  573. changed(options?: UntilToMatchOptions): Promise<T>;
  574. changedTimes(n?: number, options?: UntilToMatchOptions): Promise<T>;
  575. }
  576. declare type Falsy = false | void | null | undefined | 0 | 0n | '';
  577. interface UntilValueInstance<T, Not extends boolean = false> extends UntilBaseInstance<T, Not> {
  578. readonly not: UntilValueInstance<T, Not extends true ? false : true>;
  579. toBe<P = T>(value: MaybeComputedRef<P>, options?: UntilToMatchOptions): Not extends true ? Promise<T> : Promise<P>;
  580. toBeTruthy(options?: UntilToMatchOptions): Not extends true ? Promise<T & Falsy> : Promise<Exclude<T, Falsy>>;
  581. toBeNull(options?: UntilToMatchOptions): Not extends true ? Promise<Exclude<T, null>> : Promise<null>;
  582. toBeUndefined(options?: UntilToMatchOptions): Not extends true ? Promise<Exclude<T, undefined>> : Promise<undefined>;
  583. toBeNaN(options?: UntilToMatchOptions): Promise<T>;
  584. }
  585. interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
  586. readonly not: UntilArrayInstance<T>;
  587. toContains(value: MaybeComputedRef<ElementOf<ShallowUnwrapRef<T>>>, options?: UntilToMatchOptions): Promise<T>;
  588. }
  589. /**
  590. * Promised one-time watch for changes
  591. *
  592. * @see https://vueuse.org/until
  593. * @example
  594. * ```
  595. * const { count } = useCounter()
  596. *
  597. * await until(count).toMatch(v => v > 7)
  598. *
  599. * alert('Counter is now larger than 7!')
  600. * ```
  601. */
  602. declare function until<T extends unknown[]>(r: WatchSource<T> | MaybeComputedRef<T>): UntilArrayInstance<T>;
  603. declare function until<T>(r: WatchSource<T> | MaybeComputedRef<T>): UntilValueInstance<T>;
  604. /**
  605. * Reactive `Array.every`
  606. *
  607. * @see https://vueuse.org/useArrayEvery
  608. * @param {Array} list - the array was called upon.
  609. * @param fn - a function to test each element.
  610. *
  611. * @returns {boolean} **true** if the `fn` function returns a **truthy** value for every element from the array. Otherwise, **false**.
  612. */
  613. declare function useArrayEvery<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<boolean>;
  614. /**
  615. * Reactive `Array.filter`
  616. *
  617. * @see https://vueuse.org/useArrayFilter
  618. * @param {Array} list - the array was called upon.
  619. * @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.
  620. *
  621. * @returns {Array} 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.
  622. */
  623. declare function useArrayFilter<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: T[]) => boolean): ComputedRef<T[]>;
  624. /**
  625. * Reactive `Array.find`
  626. *
  627. * @see https://vueuse.org/useArrayFind
  628. * @param {Array} list - the array was called upon.
  629. * @param fn - a function to test each element.
  630. *
  631. * @returns the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
  632. */
  633. declare function useArrayFind<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => boolean): ComputedRef<T | undefined>;
  634. /**
  635. * Reactive `Array.findIndex`
  636. *
  637. * @see https://vueuse.org/useArrayFindIndex
  638. * @param {Array} list - the array was called upon.
  639. * @param fn - a function to test each element.
  640. *
  641. * @returns {number} the index of the first element in the array that passes the test. Otherwise, "-1".
  642. */
  643. declare function useArrayFindIndex<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<number>;
  644. /**
  645. * Reactive `Array.join`
  646. *
  647. * @see https://vueuse.org/useArrayJoin
  648. * @param {Array} list - the array was called upon.
  649. * @param {string} separator - a string to separate each pair of adjacent elements of the array. If omitted, the array elements are separated with a comma (",").
  650. *
  651. * @returns {string} a string with all array elements joined. If arr.length is 0, the empty string is returned.
  652. */
  653. declare function useArrayJoin(list: MaybeComputedRef<MaybeComputedRef<any>[]>, separator?: MaybeComputedRef<string>): ComputedRef<string>;
  654. /**
  655. * Reactive `Array.map`
  656. *
  657. * @see https://vueuse.org/useArrayMap
  658. * @param {Array} list - the array was called upon.
  659. * @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.
  660. *
  661. * @returns {Array} a new array with each element being the result of the callback function.
  662. */
  663. declare function useArrayMap<T, U = T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: T[]) => U): ComputedRef<U[]>;
  664. declare type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
  665. /**
  666. * Reactive `Array.reduce`
  667. *
  668. * @see https://vueuse.org/useArrayReduce
  669. * @param {Array} list - the array was called upon.
  670. * @param reducer - a "reducer" function.
  671. *
  672. * @returns the value that results from running the "reducer" callback function to completion over the entire array.
  673. */
  674. declare function useArrayReduce<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, reducer: UseArrayReducer<T, T, T>): ComputedRef<T>;
  675. /**
  676. * Reactive `Array.reduce`
  677. *
  678. * @see https://vueuse.org/useArrayReduce
  679. * @param {Array} list - the array was called upon.
  680. * @param reducer - a "reducer" function.
  681. * @param initialValue - a value to be initialized the first time when the callback is called.
  682. *
  683. * @returns the value that results from running the "reducer" callback function to completion over the entire array.
  684. */
  685. declare function useArrayReduce<T, U>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeComputedRef<U>): ComputedRef<U>;
  686. /**
  687. * Reactive `Array.some`
  688. *
  689. * @see https://vueuse.org/useArraySome
  690. * @param {Array} list - the array was called upon.
  691. * @param fn - a function to test each element.
  692. *
  693. * @returns {boolean} **true** if the `fn` function returns a **truthy** value for any element from the array. Otherwise, **false**.
  694. */
  695. declare function useArraySome<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<boolean>;
  696. interface UseCounterOptions {
  697. min?: number;
  698. max?: number;
  699. }
  700. /**
  701. * Basic counter with utility functions.
  702. *
  703. * @see https://vueuse.org/useCounter
  704. * @param [initialValue=0]
  705. * @param {Object} options
  706. */
  707. declare function useCounter(initialValue?: number, options?: UseCounterOptions): {
  708. count: vue_demi.Ref<number>;
  709. inc: (delta?: number) => number;
  710. dec: (delta?: number) => number;
  711. get: () => number;
  712. set: (val: number) => number;
  713. reset: (val?: number) => number;
  714. };
  715. declare type DateLike = Date | number | string | undefined;
  716. interface UseDateFormatOptions {
  717. /**
  718. * The locale(s) to used for dd/ddd/dddd/MMM/MMMM format
  719. *
  720. * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
  721. */
  722. locales?: Intl.LocalesArgument;
  723. /**
  724. * A custom function to re-modify the way to display meridiem
  725. *
  726. */
  727. customMeridiem?: (hours: number, minutes: number, isLowercase?: boolean, hasPeriod?: boolean) => string;
  728. }
  729. declare const formatDate: (date: Date, formatStr: string, options?: UseDateFormatOptions) => string;
  730. declare const normalizeDate: (date: DateLike) => Date;
  731. /**
  732. * Get the formatted date according to the string of tokens passed in.
  733. *
  734. * @see https://vueuse.org/useDateFormat
  735. * @param date - The date to format, can either be a `Date` object, a timestamp, or a string
  736. * @param formatStr - The combination of tokens to format the date
  737. * @param options - UseDateFormatOptions
  738. */
  739. declare function useDateFormat(date: MaybeComputedRef<DateLike>, formatStr?: MaybeComputedRef<string>, options?: UseDateFormatOptions): vue_demi.ComputedRef<string>;
  740. declare type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
  741. /**
  742. * Debounce execution of a function.
  743. *
  744. * @see https://vueuse.org/useDebounceFn
  745. * @param fn A function to be executed after delay milliseconds debounced.
  746. * @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
  747. * @param opts options
  748. *
  749. * @return A new, debounce, function.
  750. */
  751. declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeComputedRef<number>, options?: DebounceFilterOptions): T;
  752. interface UseIntervalOptions<Controls extends boolean> {
  753. /**
  754. * Expose more controls
  755. *
  756. * @default false
  757. */
  758. controls?: Controls;
  759. /**
  760. * Execute the update immediately on calling
  761. *
  762. * @default true
  763. */
  764. immediate?: boolean;
  765. /**
  766. * Callback on every interval
  767. */
  768. callback?: (count: number) => void;
  769. }
  770. /**
  771. * Reactive counter increases on every interval
  772. *
  773. * @see https://vueuse.org/useInterval
  774. * @param interval
  775. * @param options
  776. */
  777. declare function useInterval(interval?: MaybeComputedRef<number>, options?: UseIntervalOptions<false>): Ref<number>;
  778. declare function useInterval(interval: MaybeComputedRef<number>, options: UseIntervalOptions<true>): {
  779. counter: Ref<number>;
  780. } & Pausable;
  781. interface UseIntervalFnOptions {
  782. /**
  783. * Start the timer immediately
  784. *
  785. * @default true
  786. */
  787. immediate?: boolean;
  788. /**
  789. * Execute the callback immediate after calling this function
  790. *
  791. * @default false
  792. */
  793. immediateCallback?: boolean;
  794. }
  795. /**
  796. * Wrapper for `setInterval` with controls
  797. *
  798. * @param cb
  799. * @param interval
  800. * @param options
  801. */
  802. declare function useIntervalFn(cb: Fn, interval?: MaybeComputedRef<number>, options?: UseIntervalFnOptions): Pausable;
  803. interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends number | null | undefined = undefined> extends WatchOptions<Immediate> {
  804. initialValue?: InitialValue;
  805. }
  806. /**
  807. * Records the timestamp of the last change
  808. *
  809. * @see https://vueuse.org/useLastChanged
  810. */
  811. declare function useLastChanged(source: WatchSource, options?: UseLastChangedOptions<false>): Ref<number | null>;
  812. declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<true>): Ref<number>;
  813. declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<boolean, number>): Ref<number>;
  814. /**
  815. * Throttle execution of a function. Especially useful for rate limiting
  816. * execution of handlers on events like resize and scroll.
  817. *
  818. * @param fn A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
  819. * to `callback` when the throttled-function is executed.
  820. * @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
  821. *
  822. * @param [trailing=false] if true, call fn again after the time is up
  823. *
  824. * @param [leading=true] if true, call fn on the leading edge of the ms timeout
  825. *
  826. * @return A new, throttled, function.
  827. */
  828. declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?: MaybeComputedRef<number>, trailing?: boolean, leading?: boolean): T;
  829. interface UseTimeoutFnOptions {
  830. /**
  831. * Start the timer immediate after calling this function
  832. *
  833. * @default true
  834. */
  835. immediate?: boolean;
  836. }
  837. /**
  838. * Wrapper for `setTimeout` with controls.
  839. *
  840. * @param cb
  841. * @param interval
  842. * @param options
  843. */
  844. declare function useTimeoutFn(cb: (...args: unknown[]) => any, interval: MaybeComputedRef<number>, options?: UseTimeoutFnOptions): Stoppable;
  845. interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOptions {
  846. /**
  847. * Expose more controls
  848. *
  849. * @default false
  850. */
  851. controls?: Controls;
  852. /**
  853. * Callback on timeout
  854. */
  855. callback?: Fn;
  856. }
  857. /**
  858. * Update value after a given time with controls.
  859. *
  860. * @see {@link https://vueuse.org/useTimeout}
  861. * @param interval
  862. * @param options
  863. */
  864. declare function useTimeout(interval?: number, options?: UseTimeoutOptions<false>): ComputedRef<boolean>;
  865. declare function useTimeout(interval: number, options: UseTimeoutOptions<true>): {
  866. ready: ComputedRef<boolean>;
  867. } & Stoppable;
  868. interface UseToNumberOptions {
  869. /**
  870. * Method to use to convert the value to a number.
  871. *
  872. * @default 'parseFloat'
  873. */
  874. method?: 'parseFloat' | 'parseInt';
  875. /**
  876. * The base in mathematical numeral systems passed to `parseInt`.
  877. * Only works with `method: 'parseInt'`
  878. */
  879. radix?: number;
  880. /**
  881. * Replace NaN with zero
  882. *
  883. * @default false
  884. */
  885. nanToZero?: boolean;
  886. }
  887. /**
  888. * Computed reactive object.
  889. */
  890. declare function useToNumber(value: MaybeComputedRef<number | string>, options?: UseToNumberOptions): ComputedRef<number>;
  891. /**
  892. * Reactively convert a ref to string.
  893. *
  894. * @see https://vueuse.org/useToString
  895. */
  896. declare function useToString(value: MaybeComputedRef<unknown>): ComputedRef<string>;
  897. interface UseToggleOptions<Truthy, Falsy> {
  898. truthyValue?: MaybeComputedRef<Truthy>;
  899. falsyValue?: MaybeComputedRef<Falsy>;
  900. }
  901. declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(initialValue: Ref<T>, options?: UseToggleOptions<Truthy, Falsy>): (value?: T) => T;
  902. declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [Ref<T>, (value?: T) => T];
  903. declare type WatchArrayCallback<V = any, OV = any> = (value: V, oldValue: OV, added: V, removed: OV, onCleanup: (cleanupFn: () => void) => void) => any;
  904. /**
  905. * Watch for an array with additions and removals.
  906. *
  907. * @see https://vueuse.org/watchArray
  908. */
  909. 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>): vue_demi.WatchStopHandle;
  910. interface WatchWithFilterOptions<Immediate> extends WatchOptions<Immediate>, ConfigurableEventFilter {
  911. }
  912. declare function watchWithFilter<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchStopHandle;
  913. declare function watchWithFilter<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchStopHandle;
  914. 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>): WatchStopHandle;
  915. interface WatchAtMostOptions<Immediate> extends WatchWithFilterOptions<Immediate> {
  916. count: MaybeComputedRef<number>;
  917. }
  918. interface WatchAtMostReturn {
  919. stop: WatchStopHandle;
  920. count: Ref<number>;
  921. }
  922. declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
  923. 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;
  924. interface WatchDebouncedOptions<Immediate> extends WatchOptions<Immediate>, DebounceFilterOptions {
  925. debounce?: MaybeComputedRef<number>;
  926. }
  927. declare function watchDebounced<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle;
  928. declare function watchDebounced<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle;
  929. 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>): WatchStopHandle;
  930. declare type IgnoredUpdater = (updater: () => void) => void;
  931. interface WatchIgnorableReturn {
  932. ignoreUpdates: IgnoredUpdater;
  933. ignorePrevAsyncUpdates: () => void;
  934. stop: WatchStopHandle;
  935. }
  936. declare function watchIgnorable<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn;
  937. 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;
  938. 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;
  939. declare function watchOnce<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchOptions<Immediate>): void;
  940. declare function watchOnce<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): void;
  941. interface WatchPausableReturn extends Pausable {
  942. stop: WatchStopHandle;
  943. }
  944. declare function watchPausable<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchPausableReturn;
  945. declare function watchPausable<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchPausableReturn;
  946. declare function watchPausable<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchPausableReturn;
  947. interface WatchThrottledOptions<Immediate> extends WatchOptions<Immediate> {
  948. throttle?: MaybeComputedRef<number>;
  949. trailing?: boolean;
  950. leading?: boolean;
  951. }
  952. declare function watchThrottled<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchThrottledOptions<Immediate>): WatchStopHandle;
  953. declare function watchThrottled<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchThrottledOptions<Immediate>): WatchStopHandle;
  954. 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>): WatchStopHandle;
  955. interface WatchTriggerableReturn<FnReturnT = void> extends WatchIgnorableReturn {
  956. /** Execute `WatchCallback` immediately */
  957. trigger: () => FnReturnT;
  958. }
  959. declare type OnCleanup = (cleanupFn: () => void) => void;
  960. declare type WatchTriggerableCallback<V = any, OV = any, R = void> = (value: V, oldValue: OV, onCleanup: OnCleanup) => R;
  961. declare function watchTriggerable<T extends Readonly<WatchSource<unknown>[]>, FnReturnT>(sources: [...T], cb: WatchTriggerableCallback<MapSources<T>, MapOldSources<T, true>, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
  962. declare function watchTriggerable<T, FnReturnT>(source: WatchSource<T>, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
  963. declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
  964. /**
  965. * Shorthand for watching value to be truthy
  966. *
  967. * @see https://vueuse.org/whenever
  968. */
  969. declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
  970. export { ArgumentsType, Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater, MapOldSources, MapSources, MaybeComputedRef, MaybeReadonlyRef, MaybeRef, Pausable, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyOptions, RemovableRef, RemoveableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stopable, Stoppable, SyncRefOptions, SyncRefsOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayReducer, UseCounterOptions, UseDateFormatOptions, UseDateFormatReturn, UseIntervalFnOptions, UseIntervalOptions, UseLastChangedOptions, UseTimeoutFnOptions, UseTimeoutOptions, UseToNumberOptions, UseToggleOptions, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WritableComputedRefWithControl, __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };