@vueuse/shared 7.7.1 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,5 +1,76 @@
1
1
  import * as vue_demi from 'vue-demi';
2
- import { Ref, WatchOptions, WatchSource, ComputedRef, WatchCallback, WatchStopHandle, WatchOptionsBase, ShallowUnwrapRef as ShallowUnwrapRef$1, UnwrapRef, ToRefs } from 'vue-demi';
2
+ import { WatchOptionsBase, Ref, WatchSource, ComputedRef, ShallowUnwrapRef as ShallowUnwrapRef$1, WatchOptions, UnwrapRef, ToRefs, WatchCallback, WatchStopHandle } from 'vue-demi';
3
+ import { MaybeRef as MaybeRef$1 } from '@vueuse/shared';
4
+
5
+ declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<Ref<T>>;
6
+
7
+ /**
8
+ * Explicitly define the deps of computed.
9
+ *
10
+ * @param source
11
+ * @param fn
12
+ */
13
+ declare function computedWithControl<T, S>(source: WatchSource<S>, fn: () => T): ComputedRef<T>;
14
+
15
+ /**
16
+ * The source code for this function was inspired by vue-apollo's `useEventHook` util
17
+ * https://github.com/vuejs/vue-apollo/blob/v4/packages/vue-apollo-composable/src/util/useEventHook.ts
18
+ */
19
+ declare type EventHookOn<T = any> = (fn: (param: T) => void) => {
20
+ off: () => void;
21
+ };
22
+ declare type EventHookOff<T = any> = (fn: (param: T) => void) => void;
23
+ declare type EventHookTrigger<T = any> = (param: T) => void;
24
+ interface EventHook<T = any> {
25
+ on: EventHookOn<T>;
26
+ off: EventHookOff<T>;
27
+ trigger: EventHookTrigger<T>;
28
+ }
29
+ /**
30
+ * Utility for creating event hooks
31
+ *
32
+ * @see https://vueuse.org/createEventHook
33
+ */
34
+ declare function createEventHook<T = any>(): EventHook<T>;
35
+
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
+ /**
46
+ * Make a composable function usable with multiple Vue instances.
47
+ *
48
+ * @see https://vueuse.org/createSharedComposable
49
+ */
50
+ declare function createSharedComposable<Fn extends ((...args: any[]) => any)>(composable: Fn): Fn;
51
+
52
+ interface ExtendRefOptions<Unwrap extends boolean = boolean> {
53
+ /**
54
+ * Is the extends properties enumerable
55
+ *
56
+ * @default false
57
+ */
58
+ enumerable?: boolean;
59
+ /**
60
+ * Unwrap for Ref properties
61
+ *
62
+ * @default true
63
+ */
64
+ unwrap?: Unwrap;
65
+ }
66
+ /**
67
+ * Overlad 1: Unwrap set to false
68
+ */
69
+ declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions<false>>(ref: R, extend: Extend, options?: Options): ShallowUnwrapRef$1<Extend> & R;
70
+ /**
71
+ * Overlad 2: Unwrap unset or set to true
72
+ */
73
+ declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
3
74
 
4
75
  declare const isClient: boolean;
5
76
  declare const isDef: <T = any>(val?: T | undefined) => val is T;
@@ -207,86 +278,37 @@ declare function increaseWithUnit(target: string | number, delta: number): strin
207
278
  declare function objectPick<O, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Pick<O, T>;
208
279
 
209
280
  /**
210
- * `AND` conditions for refs.
211
- *
212
- * @see https://vueuse.org/and
281
+ * Shorthand for accessing `ref.value`
213
282
  */
214
- declare function and(...args: MaybeRef<any>[]): ComputedRef<boolean>;
283
+ declare function get<T>(ref: MaybeRef<T>): T;
284
+ declare function get<T, K extends keyof T>(ref: MaybeRef<T>, key: K): T[K];
215
285
 
216
- /**
217
- * Two-way refs synchronization.
218
- *
219
- * @param a
220
- * @param b
221
- */
222
- declare function biSyncRef<R extends Ref<any>>(a: R, b: R): () => void;
286
+ declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>;
287
+ declare function isDefined<T>(v: ComputedRef<T>): v is ComputedRef<Exclude<T, null | undefined>>;
288
+ declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>;
223
289
 
224
290
  /**
225
- * Explicitly define the deps of computed.
291
+ * `AND` conditions for refs.
226
292
  *
227
- * @param source
228
- * @param fn
293
+ * @see https://vueuse.org/logicAnd
229
294
  */
230
- declare function controlledComputed<T, S>(source: WatchSource<S>, fn: () => T): ComputedRef<T>;
295
+ declare function logicAnd(...args: MaybeRef<any>[]): ComputedRef<boolean>;
231
296
 
232
- interface ControlledRefOptions<T> {
233
- /**
234
- * Callback function before the ref changing.
235
- *
236
- * Returning `false` to dismiss the change.
237
- */
238
- onBeforeChange?: (value: T, oldValue: T) => void | boolean;
239
- /**
240
- * Callback function after the ref changed
241
- *
242
- * This happends synchronously, with less overhead compare to `watch`
243
- */
244
- onChanged?: (value: T, oldValue: T) => void;
245
- }
246
297
  /**
247
- * Explicitly define the deps of computed.
298
+ * `NOT` conditions for refs.
248
299
  *
249
- * @param source
250
- * @param fn
300
+ * @see https://vueuse.org/logicNot
251
301
  */
252
- declare function controlledRef<T>(initial: T, options?: ControlledRefOptions<T>): vue_demi.ShallowUnwrapRef<{
253
- get: (tracking?: boolean) => T;
254
- set: (value: T, triggering?: boolean) => void;
255
- untrackedGet: () => T;
256
- silentSet: (v: T) => void;
257
- peek: () => T;
258
- lay: (v: T) => void;
259
- }> & vue_demi.Ref<T>;
302
+ declare function logicNot(v: MaybeRef<any>): ComputedRef<boolean>;
260
303
 
261
304
  /**
262
- * The source code for this function was inspired by vue-apollo's `useEventHook` util
263
- * https://github.com/vuejs/vue-apollo/blob/v4/packages/vue-apollo-composable/src/util/useEventHook.ts
264
- */
265
- declare type EventHookOn<T = any> = (fn: (param: T) => void) => {
266
- off: () => void;
267
- };
268
- declare type EventHookOff<T = any> = (fn: (param: T) => void) => void;
269
- declare type EventHookTrigger<T = any> = (param: T) => void;
270
- interface EventHook<T = any> {
271
- on: EventHookOn<T>;
272
- off: EventHookOff<T>;
273
- trigger: EventHookTrigger<T>;
274
- }
275
- /**
276
- * Utility for creating event hooks
305
+ * `OR` conditions for refs.
277
306
  *
278
- * @see https://vueuse.org/createEventHook
307
+ * @see https://vueuse.org/logicOr
279
308
  */
280
- declare function createEventHook<T = any>(): EventHook<T>;
309
+ declare function logicOr(...args: MaybeRef<any>[]): ComputedRef<boolean>;
281
310
 
282
- declare type CreateGlobalStateReturn<T> = () => T;
283
- /**
284
- * Keep states in the global scope to be reusable across Vue instances.
285
- *
286
- * @see https://vueuse.org/createGlobalState
287
- * @param stateFactory A factory function to create the state
288
- */
289
- declare function createGlobalState<T>(stateFactory: () => T): CreateGlobalStateReturn<T>;
311
+ declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: A): T & A;
290
312
 
291
313
  declare type Reactify<T> = T extends (...args: infer A) => infer R ? (...args: {
292
314
  [K in keyof A]: MaybeRef<A[K]>;
@@ -300,101 +322,6 @@ declare type Reactify<T> = T extends (...args: infer A) => infer R ? (...args: {
300
322
  */
301
323
  declare function reactify<T extends Function>(fn: T): Reactify<T>;
302
324
 
303
- /**
304
- * Make a composable function usable with multiple Vue instances.
305
- *
306
- * @see https://vueuse.org/createSharedComposable
307
- */
308
- declare function createSharedComposable<Fn extends ((...args: any[]) => any)>(composable: Fn): Fn;
309
-
310
- /**
311
- * Debounce updates of a ref.
312
- *
313
- * @return A new debounced ref.
314
- */
315
- declare function useDebounce<T>(value: Ref<T>, ms?: number, options?: DebounceFilterOptions): Readonly<Ref<T>>;
316
-
317
- interface DebouncedWatchOptions<Immediate> extends WatchOptions<Immediate> {
318
- debounce?: MaybeRef<number>;
319
- }
320
- declare function debouncedWatch<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: DebouncedWatchOptions<Immediate>): WatchStopHandle;
321
- declare function debouncedWatch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: DebouncedWatchOptions<Immediate>): WatchStopHandle;
322
- declare function debouncedWatch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: DebouncedWatchOptions<Immediate>): WatchStopHandle;
323
-
324
- declare function eagerComputed<T>(fn: () => T, options?: WatchOptionsBase): Readonly<Ref<T>>;
325
-
326
- interface ExtendRefOptions<Unwrap extends boolean = boolean> {
327
- /**
328
- * Is the extends properties enumerable
329
- *
330
- * @default false
331
- */
332
- enumerable?: boolean;
333
- /**
334
- * Unwrap for Ref properties
335
- *
336
- * @default true
337
- */
338
- unwrap?: Unwrap;
339
- }
340
- /**
341
- * Overlad 1: Unwrap set to false
342
- */
343
- declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions<false>>(ref: R, extend: Extend, options?: Options): ShallowUnwrapRef$1<Extend> & R;
344
- /**
345
- * Overlad 2: Unwrap unset or set to true
346
- */
347
- declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
348
-
349
- /**
350
- * Shorthand for accessing `ref.value`
351
- */
352
- declare function get<T>(ref: MaybeRef<T>): T;
353
- declare function get<T, K extends keyof T>(ref: MaybeRef<T>, key: K): T[K];
354
-
355
- interface WatchWithFilterOptions<Immediate> extends WatchOptions<Immediate>, ConfigurableEventFilter {
356
- }
357
- 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;
358
- 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;
359
- 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;
360
-
361
- declare type IgnoredUpdater = (updater: () => void) => void;
362
- interface IgnorableWatchReturn {
363
- ignoreUpdates: IgnoredUpdater;
364
- ignorePrevAsyncUpdates: () => void;
365
- stop: WatchStopHandle;
366
- }
367
- declare function ignorableWatch<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): IgnorableWatchReturn;
368
- declare function ignorableWatch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): IgnorableWatchReturn;
369
- declare function ignorableWatch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): IgnorableWatchReturn;
370
-
371
- declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>;
372
- declare function isDefined<T>(v: ComputedRef<T>): v is ComputedRef<Exclude<T, null | undefined>>;
373
- declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>;
374
-
375
- declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: A): T & A;
376
-
377
- /**
378
- * `NOT` conditions for refs.
379
- *
380
- * @see https://vueuse.org/not
381
- */
382
- declare function not(v: MaybeRef<any>): ComputedRef<boolean>;
383
-
384
- /**
385
- * `OR` conditions for refs.
386
- *
387
- * @see https://vueuse.org/or
388
- */
389
- declare function or(...args: MaybeRef<any>[]): ComputedRef<boolean>;
390
-
391
- interface PausableWatchReturn extends Pausable {
392
- stop: WatchStopHandle;
393
- }
394
- declare function pausableWatch<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): PausableWatchReturn;
395
- declare function pausableWatch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): PausableWatchReturn;
396
- declare function pausableWatch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): PausableWatchReturn;
397
-
398
325
  declare type ReactifyNested<T, Keys extends keyof T = keyof T> = {
399
326
  [K in Keys]: T[K] extends (...args: any[]) => any ? Reactify<T[K]> : T[K];
400
327
  };
@@ -433,6 +360,22 @@ declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...ke
433
360
  [S in K]: UnwrapRef<T[S]>;
434
361
  };
435
362
 
363
+ /**
364
+ * Create a ref which will be reset to the default value after some time.
365
+ *
366
+ * @see https://vueuse.org/refAutoReset
367
+ * @param defaultValue The value which will be set.
368
+ * @param afterMs A zero-or-greater delay in milliseconds.
369
+ */
370
+ declare function refAutoReset<T>(defaultValue: T, afterMs?: MaybeRef$1<number>): Ref<T>;
371
+
372
+ /**
373
+ * Debounce updates of a ref.
374
+ *
375
+ * @return A new debounced ref.
376
+ */
377
+ declare function refDebounced<T>(value: Ref<T>, ms?: number, options?: DebounceFilterOptions): Readonly<Ref<T>>;
378
+
436
379
  /**
437
380
  * Apply default value to a ref.
438
381
  *
@@ -441,6 +384,50 @@ declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...ke
441
384
  */
442
385
  declare function refDefault<T>(source: Ref<T | undefined | null>, defaultValue: T): Ref<T>;
443
386
 
387
+ /**
388
+ * Throttle execution of a function. Especially useful for rate limiting
389
+ * execution of handlers on events like resize and scroll.
390
+ *
391
+ * @param value Ref value to be watched with throttle effect
392
+ * @param delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
393
+ * @param [trailing=true] if true, update the value again after the delay time is up
394
+ * @param [leading=true] if true, update the value on the leading edge of the ms timeout
395
+ */
396
+ declare function refThrottled<T>(value: Ref<T>, delay?: number, trailing?: boolean, leading?: boolean): Ref<T>;
397
+
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 happends 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
+
444
431
  declare function set<T>(ref: Ref<T>, value: T): void;
445
432
  declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
446
433
 
@@ -457,34 +444,42 @@ interface SyncRefOptions extends ConfigurableFlushSync {
457
444
  * @default true
458
445
  */
459
446
  immediate?: boolean;
447
+ /**
448
+ * Direction of syncing
449
+ *
450
+ * @default 'both'
451
+ */
452
+ direction?: 'ltr' | 'rtl' | 'both';
460
453
  }
461
454
  /**
462
- * Keep target ref(s) in sync with the source ref
455
+ * Two-way refs synchronization.
463
456
  *
464
- * @param source source ref
465
- * @param targets
457
+ * @param left
458
+ * @param right
466
459
  */
467
- declare function syncRef<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], { flush, deep, immediate, }?: SyncRefOptions): vue_demi.WatchStopHandle;
460
+ declare function syncRef<R extends Ref<any>>(left: R, right: R, options?: SyncRefOptions): () => void;
468
461
 
462
+ interface SyncRefsOptions extends ConfigurableFlushSync {
463
+ /**
464
+ * Watch deeply
465
+ *
466
+ * @default false
467
+ */
468
+ deep?: boolean;
469
+ /**
470
+ * Sync values immediately
471
+ *
472
+ * @default true
473
+ */
474
+ immediate?: boolean;
475
+ }
469
476
  /**
470
- * Throttle execution of a function. Especially useful for rate limiting
471
- * execution of handlers on events like resize and scroll.
477
+ * Keep target ref(s) in sync with the source ref
472
478
  *
473
- * @param value Ref value to be watched with throttle effect
474
- * @param delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
475
- * @param [trailing=true] if true, update the value again after the delay time is up
476
- * @param [leading=true] if true, update the value on the leading edge of the ms timeout
479
+ * @param source source ref
480
+ * @param targets
477
481
  */
478
- declare function useThrottle<T>(value: Ref<T>, delay?: number, trailing?: boolean, leading?: boolean): Ref<T>;
479
-
480
- interface ThrottledWatchOptions<Immediate> extends WatchOptions<Immediate> {
481
- throttle?: MaybeRef<number>;
482
- trailing?: boolean;
483
- leading?: boolean;
484
- }
485
- declare function throttledWatch<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: ThrottledWatchOptions<Immediate>): WatchStopHandle;
486
- declare function throttledWatch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: ThrottledWatchOptions<Immediate>): WatchStopHandle;
487
- declare function throttledWatch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: ThrottledWatchOptions<Immediate>): WatchStopHandle;
482
+ declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions): vue_demi.WatchStopHandle;
488
483
 
489
484
  /**
490
485
  * Converts ref to reactive.
@@ -611,6 +606,19 @@ declare function useCounter(initialValue?: number, options?: UseCounterOptions):
611
606
  reset: (val?: number) => number;
612
607
  };
613
608
 
609
+ declare type DateLike = Date | number | string | undefined;
610
+ declare const formatDate: (date: Date, formatStr: string) => string;
611
+ declare const normalizeDate: (date: DateLike) => Date;
612
+ /**
613
+ * Get the formatted date according to the string of tokens passed in.
614
+ *
615
+ * @see https://vueuse.org/useDateFormat
616
+ * @param date
617
+ * @param formatStr
618
+ */
619
+ declare function useDateFormat(date: MaybeRef$1<DateLike>, formatStr?: MaybeRef$1<string>): vue_demi.ComputedRef<string>;
620
+ declare type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
621
+
614
622
  /**
615
623
  * Debounce execution of a function.
616
624
  *
@@ -738,6 +746,12 @@ declare function useTimeout(interval: number, options: TimeoutOptions<true>): {
738
746
  declare function useToggle(value: Ref<boolean>): (value?: boolean) => boolean;
739
747
  declare function useToggle(initialValue?: boolean): [Ref<boolean>, (value?: boolean) => boolean];
740
748
 
749
+ interface WatchWithFilterOptions<Immediate> extends WatchOptions<Immediate>, ConfigurableEventFilter {
750
+ }
751
+ 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;
752
+ 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;
753
+ 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;
754
+
741
755
  interface WatchAtMostOptions<Immediate> extends WatchWithFilterOptions<Immediate> {
742
756
  count: MaybeRef<number>;
743
757
  }
@@ -749,10 +763,43 @@ declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immedia
749
763
  declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
750
764
  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;
751
765
 
766
+ interface WatchDebouncedOptions<Immediate> extends WatchOptions<Immediate> {
767
+ debounce?: MaybeRef<number>;
768
+ }
769
+ 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;
770
+ 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;
771
+ 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;
772
+
773
+ declare type IgnoredUpdater = (updater: () => void) => void;
774
+ interface WatchIgnorableReturn {
775
+ ignoreUpdates: IgnoredUpdater;
776
+ ignorePrevAsyncUpdates: () => void;
777
+ stop: WatchStopHandle;
778
+ }
779
+ 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;
780
+ 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;
781
+ 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;
782
+
752
783
  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;
753
784
  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;
754
785
  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;
755
786
 
787
+ interface WatchPausableReturn extends Pausable {
788
+ stop: WatchStopHandle;
789
+ }
790
+ 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;
791
+ 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;
792
+ 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;
793
+
794
+ interface WatchThrottledOptions<Immediate> extends WatchOptions<Immediate> {
795
+ throttle?: MaybeRef<number>;
796
+ trailing?: boolean;
797
+ leading?: boolean;
798
+ }
799
+ 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;
800
+ 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;
801
+ 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;
802
+
756
803
  /**
757
804
  * Shorthand for watching value to be truthy
758
805
  *
@@ -760,4 +807,4 @@ declare function watchOnce<T, Immediate extends Readonly<boolean> = false>(sourc
760
807
  */
761
808
  declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
762
809
 
763
- export { Awaitable, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DebounceFilterOptions, DebouncedWatchOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnorableWatchReturn, IgnoredUpdater, IntervalFnOptions, IntervalOptions, MapOldSources, MapSources, MaybeRef, Pausable, PausableWatchReturn, Reactify, ReactifyNested, ReactifyObjectOptions, RemovableRef, RemoveableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stopable, Stoppable, SyncRefOptions, ThrottledWatchOptions, TimeoutFnOptions, TimeoutOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseCounterOptions, UseLastChangedOptions, WatchAtMostOptions, WatchAtMostReturn, WatchWithFilterOptions, and, assert, biSyncRef, bypassFilter, clamp, containsProp, controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, useDebounce as debouncedRef, debouncedWatch, eagerComputed, extendRef, get, identity, ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isNumber, isObject, isString, isWindow, makeDestructurable, noop, not, now, objectPick, or, pausableFilter, pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refDefault, set, syncRef, throttleFilter, useThrottle as throttledRef, throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useCounter, useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToggle, watchAtMost, watchOnce, watchWithFilter, whenever };
810
+ export { Awaitable, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater, IntervalFnOptions, IntervalOptions, MapOldSources, MapSources, MaybeRef, Pausable, Reactify, ReactifyNested, ReactifyObjectOptions, RemovableRef, RemoveableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stopable, Stoppable, SyncRefOptions, SyncRefsOptions, TimeoutFnOptions, TimeoutOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseCounterOptions, UseDateFormatReturn, UseLastChangedOptions, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableReturn, WatchThrottledOptions, WatchWithFilterOptions, logicAnd as and, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, computedEager as eagerComputed, extendRef, formatDate, get, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isNumber, isObject, isString, isWindow, logicAnd, logicNot, logicOr, makeDestructurable, noop, normalizeDate, logicNot as not, now, objectPick, logicOr as or, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToggle, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchWithFilter, whenever };