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