index.d.ts 42 KB

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