@vueuse/shared 8.9.4 → 9.0.0-beta.2
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.cjs +87 -51
- package/index.d.ts +87 -67
- package/index.iife.js +88 -69
- package/index.iife.min.js +1 -1
- package/index.mjs +81 -47
- package/package.json +1 -13
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as vue_demi from 'vue-demi';
|
|
2
2
|
import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, ShallowUnwrapRef as ShallowUnwrapRef$1, WatchOptions, UnwrapRef, ToRefs, WatchCallback, WatchStopHandle } from 'vue-demi';
|
|
3
|
-
import {
|
|
3
|
+
import { MaybeComputedRef as MaybeComputedRef$1 } from '@vueuse/shared';
|
|
4
4
|
|
|
5
5
|
declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<Ref<T>>;
|
|
6
6
|
|
|
@@ -125,13 +125,13 @@ declare type RemoveableRef<T> = RemovableRef<T>;
|
|
|
125
125
|
*/
|
|
126
126
|
declare type MaybeRef<T> = T | Ref<T>;
|
|
127
127
|
/**
|
|
128
|
-
* Maybe it's a ref, or a getter function
|
|
128
|
+
* Maybe it's a ref, or a plain value, or a getter function
|
|
129
129
|
*
|
|
130
130
|
* ```ts
|
|
131
|
-
* type
|
|
131
|
+
* type MaybeComputedRef<T> = T | Ref<T> | (() => T)
|
|
132
132
|
* ```
|
|
133
133
|
*/
|
|
134
|
-
declare type MaybeComputedRef<T> = T extends
|
|
134
|
+
declare type MaybeComputedRef<T> = T extends () => void ? never : (() => T) | MaybeRef<T>;
|
|
135
135
|
/**
|
|
136
136
|
* Make all the nested attributes of an object or array to MaybeRef<T>
|
|
137
137
|
*
|
|
@@ -150,6 +150,7 @@ declare type DeepMaybeRef<T> = T extends Ref<infer V> ? MaybeRef<V> : T extends
|
|
|
150
150
|
declare type ElementOf<T> = T extends (infer E)[] ? E : never;
|
|
151
151
|
declare type ShallowUnwrapRef<T> = T extends Ref<infer P> ? P : T;
|
|
152
152
|
declare type Awaitable<T> = Promise<T> | T;
|
|
153
|
+
declare type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
153
154
|
interface Pausable {
|
|
154
155
|
/**
|
|
155
156
|
* A ref indicate whether a pusable instance is active
|
|
@@ -226,7 +227,7 @@ interface DebounceFilterOptions {
|
|
|
226
227
|
* The maximum time allowed to be delayed before it's invoked.
|
|
227
228
|
* In milliseconds.
|
|
228
229
|
*/
|
|
229
|
-
maxWait?: number
|
|
230
|
+
maxWait?: MaybeComputedRef<number>;
|
|
230
231
|
}
|
|
231
232
|
/**
|
|
232
233
|
* @internal
|
|
@@ -239,7 +240,7 @@ declare const bypassFilter: EventFilter;
|
|
|
239
240
|
* @param ms
|
|
240
241
|
* @param [maxWait=null]
|
|
241
242
|
*/
|
|
242
|
-
declare function debounceFilter(ms:
|
|
243
|
+
declare function debounceFilter(ms: MaybeComputedRef<number>, options?: DebounceFilterOptions): EventFilter<any[], any>;
|
|
243
244
|
/**
|
|
244
245
|
* Create an EventFilter that throttle the events
|
|
245
246
|
*
|
|
@@ -247,7 +248,7 @@ declare function debounceFilter(ms: MaybeRef<number>, options?: DebounceFilterOp
|
|
|
247
248
|
* @param [trailing=true]
|
|
248
249
|
* @param [leading=true]
|
|
249
250
|
*/
|
|
250
|
-
declare function throttleFilter(ms:
|
|
251
|
+
declare function throttleFilter(ms: MaybeComputedRef<number>, trailing?: boolean, leading?: boolean): EventFilter<any[], any>;
|
|
251
252
|
/**
|
|
252
253
|
* EventFilter that gives extra controls to pause and resume the filter
|
|
253
254
|
*
|
|
@@ -316,32 +317,19 @@ declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>
|
|
|
316
317
|
declare function isDefined<T>(v: ComputedRef<T>): v is ComputedRef<Exclude<T, null | undefined>>;
|
|
317
318
|
declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>;
|
|
318
319
|
|
|
319
|
-
/**
|
|
320
|
-
* `AND` conditions for refs.
|
|
321
|
-
*
|
|
322
|
-
* @see https://vueuse.org/logicAnd
|
|
323
|
-
*/
|
|
324
|
-
declare function logicAnd(...args: MaybeRef<any>[]): ComputedRef<boolean>;
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* `NOT` conditions for refs.
|
|
328
|
-
*
|
|
329
|
-
* @see https://vueuse.org/logicNot
|
|
330
|
-
*/
|
|
331
|
-
declare function logicNot(v: MaybeRef<any>): ComputedRef<boolean>;
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* `OR` conditions for refs.
|
|
335
|
-
*
|
|
336
|
-
* @see https://vueuse.org/logicOr
|
|
337
|
-
*/
|
|
338
|
-
declare function logicOr(...args: MaybeRef<any>[]): ComputedRef<boolean>;
|
|
339
|
-
|
|
340
320
|
declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: A): T & A;
|
|
341
321
|
|
|
342
|
-
declare type
|
|
343
|
-
[K in keyof A]: MaybeRef<A[K]>;
|
|
322
|
+
declare type Reactified<T, Computed extends boolean> = T extends (...args: infer A) => infer R ? (...args: {
|
|
323
|
+
[K in keyof A]: Computed extends true ? MaybeComputedRef<A[K]> : MaybeRef<A[K]>;
|
|
344
324
|
}) => ComputedRef<R> : never;
|
|
325
|
+
interface ReactifyOptions<T extends boolean> {
|
|
326
|
+
/**
|
|
327
|
+
* Accept passing a function as a reactive getter
|
|
328
|
+
*
|
|
329
|
+
* @default true
|
|
330
|
+
*/
|
|
331
|
+
computedGetter?: T;
|
|
332
|
+
}
|
|
345
333
|
/**
|
|
346
334
|
* Converts plain function into a reactive function.
|
|
347
335
|
* The converted function accepts refs as it's arguments
|
|
@@ -349,12 +337,12 @@ declare type Reactify<T> = T extends (...args: infer A) => infer R ? (...args: {
|
|
|
349
337
|
*
|
|
350
338
|
* @param fn - Source function
|
|
351
339
|
*/
|
|
352
|
-
declare function reactify<T extends Function>(fn: T):
|
|
340
|
+
declare function reactify<T extends Function, K extends boolean = true>(fn: T, options?: ReactifyOptions<K>): Reactified<T, K>;
|
|
353
341
|
|
|
354
|
-
declare type ReactifyNested<T, Keys extends keyof T = keyof T> = {
|
|
355
|
-
[K in Keys]: T[K] extends (...args: any[]) => any ?
|
|
342
|
+
declare type ReactifyNested<T, Keys extends keyof T = keyof T, S extends boolean = true> = {
|
|
343
|
+
[K in Keys]: T[K] extends (...args: any[]) => any ? Reactified<T[K], S> : T[K];
|
|
356
344
|
};
|
|
357
|
-
interface ReactifyObjectOptions {
|
|
345
|
+
interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
|
|
358
346
|
/**
|
|
359
347
|
* Includes names from Object.getOwnPropertyNames
|
|
360
348
|
*
|
|
@@ -365,8 +353,8 @@ interface ReactifyObjectOptions {
|
|
|
365
353
|
/**
|
|
366
354
|
* Apply `reactify` to an object
|
|
367
355
|
*/
|
|
368
|
-
declare function reactifyObject<T extends object, Keys extends keyof T>(obj: T, keys?: (keyof T)[]): ReactifyNested<T, Keys>;
|
|
369
|
-
declare function reactifyObject<T extends object>(obj: T, options?: ReactifyObjectOptions): ReactifyNested<T>;
|
|
356
|
+
declare function reactifyObject<T extends object, Keys extends keyof T>(obj: T, keys?: (keyof T)[]): ReactifyNested<T, Keys, true>;
|
|
357
|
+
declare function reactifyObject<T extends object, S extends boolean = true>(obj: T, options?: ReactifyObjectOptions<S>): ReactifyNested<T, keyof T, S>;
|
|
370
358
|
|
|
371
359
|
/**
|
|
372
360
|
* Computed reactive object.
|
|
@@ -376,14 +364,14 @@ declare function reactiveComputed<T extends {}>(fn: () => T): T;
|
|
|
376
364
|
/**
|
|
377
365
|
* Reactively omit fields from a reactive object
|
|
378
366
|
*
|
|
379
|
-
* @see https://vueuse.
|
|
367
|
+
* @see https://vueuse.org/reactiveOmit
|
|
380
368
|
*/
|
|
381
369
|
declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Omit<T, K>;
|
|
382
370
|
|
|
383
371
|
/**
|
|
384
372
|
* Reactively pick fields from a reactive object
|
|
385
373
|
*
|
|
386
|
-
* @see https://vueuse.
|
|
374
|
+
* @see https://vueuse.org/reactivePick
|
|
387
375
|
*/
|
|
388
376
|
declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): {
|
|
389
377
|
[S in K]: UnwrapRef<T[S]>;
|
|
@@ -396,7 +384,7 @@ declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...ke
|
|
|
396
384
|
* @param defaultValue The value which will be set.
|
|
397
385
|
* @param afterMs A zero-or-greater delay in milliseconds.
|
|
398
386
|
*/
|
|
399
|
-
declare function refAutoReset<T>(defaultValue: T, afterMs?:
|
|
387
|
+
declare function refAutoReset<T>(defaultValue: T, afterMs?: MaybeComputedRef$1<number>): Ref<T>;
|
|
400
388
|
|
|
401
389
|
/**
|
|
402
390
|
* Debounce updates of a ref.
|
|
@@ -462,6 +450,7 @@ declare const controlledRef: typeof refWithControl;
|
|
|
462
450
|
*/
|
|
463
451
|
declare function resolveRef<T>(r: MaybeComputedRef<T>): ComputedRef<T>;
|
|
464
452
|
declare function resolveRef<T>(r: MaybeRef<T>): Ref<T>;
|
|
453
|
+
declare function resolveRef<T>(r: T): Ref<T>;
|
|
465
454
|
|
|
466
455
|
/**
|
|
467
456
|
* Normalize value/ref/getter to `ref` or `computed`.
|
|
@@ -471,7 +460,7 @@ declare function resolveUnref<T>(r: MaybeComputedRef<T>): T;
|
|
|
471
460
|
declare function set<T>(ref: Ref<T>, value: T): void;
|
|
472
461
|
declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
|
|
473
462
|
|
|
474
|
-
interface SyncRefOptions extends ConfigurableFlushSync {
|
|
463
|
+
interface SyncRefOptions<L, R = L> extends ConfigurableFlushSync {
|
|
475
464
|
/**
|
|
476
465
|
* Watch deeply
|
|
477
466
|
*
|
|
@@ -485,11 +474,18 @@ interface SyncRefOptions extends ConfigurableFlushSync {
|
|
|
485
474
|
*/
|
|
486
475
|
immediate?: boolean;
|
|
487
476
|
/**
|
|
488
|
-
* Direction of syncing
|
|
477
|
+
* Direction of syncing. Value will be redefined if you define syncConvertors
|
|
489
478
|
*
|
|
490
479
|
* @default 'both'
|
|
491
480
|
*/
|
|
492
481
|
direction?: 'ltr' | 'rtl' | 'both';
|
|
482
|
+
/**
|
|
483
|
+
* Custom transform function
|
|
484
|
+
*/
|
|
485
|
+
transform?: {
|
|
486
|
+
ltr?: (left: L) => R;
|
|
487
|
+
rtl?: (right: R) => L;
|
|
488
|
+
};
|
|
493
489
|
}
|
|
494
490
|
/**
|
|
495
491
|
* Two-way refs synchronization.
|
|
@@ -497,7 +493,7 @@ interface SyncRefOptions extends ConfigurableFlushSync {
|
|
|
497
493
|
* @param left
|
|
498
494
|
* @param right
|
|
499
495
|
*/
|
|
500
|
-
declare function syncRef<R
|
|
496
|
+
declare function syncRef<L, R = L>(left: Ref<L>, right: Ref<R>, options?: SyncRefOptions<L, R>): () => void;
|
|
501
497
|
|
|
502
498
|
interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
503
499
|
/**
|
|
@@ -610,7 +606,7 @@ interface UntilBaseInstance<T, Not extends boolean = false> {
|
|
|
610
606
|
declare type Falsy = false | void | null | undefined | 0 | 0n | '';
|
|
611
607
|
interface UntilValueInstance<T, Not extends boolean = false> extends UntilBaseInstance<T, Not> {
|
|
612
608
|
readonly not: UntilValueInstance<T, Not extends true ? false : true>;
|
|
613
|
-
toBe<P = T>(value:
|
|
609
|
+
toBe<P = T>(value: MaybeComputedRef<P>, options?: UntilToMatchOptions): Not extends true ? Promise<T> : Promise<P>;
|
|
614
610
|
toBeTruthy(options?: UntilToMatchOptions): Not extends true ? Promise<T & Falsy> : Promise<Exclude<T, Falsy>>;
|
|
615
611
|
toBeNull(options?: UntilToMatchOptions): Not extends true ? Promise<Exclude<T, null>> : Promise<null>;
|
|
616
612
|
toBeUndefined(options?: UntilToMatchOptions): Not extends true ? Promise<Exclude<T, undefined>> : Promise<undefined>;
|
|
@@ -618,7 +614,7 @@ interface UntilValueInstance<T, Not extends boolean = false> extends UntilBaseIn
|
|
|
618
614
|
}
|
|
619
615
|
interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
|
|
620
616
|
readonly not: UntilArrayInstance<T>;
|
|
621
|
-
toContains(value:
|
|
617
|
+
toContains(value: MaybeComputedRef<ElementOf<ShallowUnwrapRef<T>>>, options?: UntilToMatchOptions): Promise<T>;
|
|
622
618
|
}
|
|
623
619
|
/**
|
|
624
620
|
* Promised one-time watch for changes
|
|
@@ -633,8 +629,26 @@ interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
|
|
|
633
629
|
* alert('Counter is now larger than 7!')
|
|
634
630
|
* ```
|
|
635
631
|
*/
|
|
636
|
-
declare function until<T extends unknown[]>(r: WatchSource<T> |
|
|
637
|
-
declare function until<T>(r: WatchSource<T> |
|
|
632
|
+
declare function until<T extends unknown[]>(r: WatchSource<T> | MaybeComputedRef<T>): UntilArrayInstance<T>;
|
|
633
|
+
declare function until<T>(r: WatchSource<T> | MaybeComputedRef<T>): UntilValueInstance<T>;
|
|
634
|
+
|
|
635
|
+
declare function useArrayEvery<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef$1<T>[]) => unknown): ComputedRef<boolean>;
|
|
636
|
+
|
|
637
|
+
declare function useArrayFilter<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, fn: (element: T, index: number, array: T[]) => boolean): ComputedRef<T[]>;
|
|
638
|
+
|
|
639
|
+
declare function useArrayFind<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef$1<T>[]) => boolean): ComputedRef<T | undefined>;
|
|
640
|
+
|
|
641
|
+
declare function useArrayFindIndex<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef$1<T>[]) => unknown): ComputedRef<number>;
|
|
642
|
+
|
|
643
|
+
declare function useArrayJoin(list: MaybeComputedRef$1<MaybeComputedRef$1<any>[]>, separator?: MaybeComputedRef$1<string>): ComputedRef<string>;
|
|
644
|
+
|
|
645
|
+
declare function useArrayMap<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, fn: (element: T, index: number, array: T[]) => T): ComputedRef<T[]>;
|
|
646
|
+
|
|
647
|
+
declare type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
|
|
648
|
+
declare function useArrayReduce<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, reducer: UseArrayReducer<T, T, T>): ComputedRef<T>;
|
|
649
|
+
declare function useArrayReduce<T, U>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeComputedRef$1<U>): ComputedRef<U>;
|
|
650
|
+
|
|
651
|
+
declare function useArraySome<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef$1<T>[]) => unknown): ComputedRef<boolean>;
|
|
638
652
|
|
|
639
653
|
interface UseCounterOptions {
|
|
640
654
|
min?: number;
|
|
@@ -666,21 +680,22 @@ declare const normalizeDate: (date: DateLike) => Date;
|
|
|
666
680
|
* @param date
|
|
667
681
|
* @param formatStr
|
|
668
682
|
*/
|
|
669
|
-
declare function useDateFormat(date:
|
|
683
|
+
declare function useDateFormat(date: MaybeComputedRef$1<DateLike>, formatStr?: MaybeComputedRef$1<string>): vue_demi.ComputedRef<string>;
|
|
670
684
|
declare type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
671
685
|
|
|
672
686
|
/**
|
|
673
687
|
* Debounce execution of a function.
|
|
674
688
|
*
|
|
689
|
+
* @see https://vueuse.org/useDebounceFn
|
|
675
690
|
* @param fn A function to be executed after delay milliseconds debounced.
|
|
676
691
|
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
677
692
|
* @param opts options
|
|
678
693
|
*
|
|
679
694
|
* @return A new, debounce, function.
|
|
680
695
|
*/
|
|
681
|
-
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?:
|
|
696
|
+
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeComputedRef$1<number>, options?: DebounceFilterOptions): T;
|
|
682
697
|
|
|
683
|
-
interface
|
|
698
|
+
interface UseIntervalOptions<Controls extends boolean> {
|
|
684
699
|
/**
|
|
685
700
|
* Expose more controls
|
|
686
701
|
*
|
|
@@ -694,12 +709,17 @@ interface IntervalOptions<Controls extends boolean> {
|
|
|
694
709
|
*/
|
|
695
710
|
immediate?: boolean;
|
|
696
711
|
}
|
|
697
|
-
|
|
698
|
-
|
|
712
|
+
/**
|
|
713
|
+
* Reactive counter increases on every interval
|
|
714
|
+
*
|
|
715
|
+
* @see https://vueuse.org/useInterval
|
|
716
|
+
*/
|
|
717
|
+
declare function useInterval(interval?: MaybeComputedRef<number>, options?: UseIntervalOptions<false>): Ref<number>;
|
|
718
|
+
declare function useInterval(interval: MaybeComputedRef<number>, options: UseIntervalOptions<true>): {
|
|
699
719
|
counter: Ref<number>;
|
|
700
720
|
} & Pausable;
|
|
701
721
|
|
|
702
|
-
interface
|
|
722
|
+
interface UseIntervalFnOptions {
|
|
703
723
|
/**
|
|
704
724
|
* Start the timer immediately
|
|
705
725
|
*
|
|
@@ -720,7 +740,7 @@ interface IntervalFnOptions {
|
|
|
720
740
|
* @param interval
|
|
721
741
|
* @param options
|
|
722
742
|
*/
|
|
723
|
-
declare function useIntervalFn(cb: Fn, interval?:
|
|
743
|
+
declare function useIntervalFn(cb: Fn, interval?: MaybeComputedRef<number>, options?: UseIntervalFnOptions): Pausable;
|
|
724
744
|
|
|
725
745
|
interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends number | null | undefined = undefined> extends WatchOptions<Immediate> {
|
|
726
746
|
initialValue?: InitialValue;
|
|
@@ -742,15 +762,15 @@ declare function useLastChanged(source: WatchSource, options: UseLastChangedOpti
|
|
|
742
762
|
* to `callback` when the throttled-function is executed.
|
|
743
763
|
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
744
764
|
*
|
|
745
|
-
* @param [trailing=
|
|
765
|
+
* @param [trailing=false] if true, call fn again after the time is up
|
|
746
766
|
*
|
|
747
767
|
* @param [leading=true] if true, call fn on the leading edge of the ms timeout
|
|
748
768
|
*
|
|
749
769
|
* @return A new, throttled, function.
|
|
750
770
|
*/
|
|
751
|
-
declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?:
|
|
771
|
+
declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?: MaybeComputedRef<number>, trailing?: boolean, leading?: boolean): T;
|
|
752
772
|
|
|
753
|
-
interface
|
|
773
|
+
interface UseTimeoutFnOptions {
|
|
754
774
|
/**
|
|
755
775
|
* Start the timer immediate after calling this function
|
|
756
776
|
*
|
|
@@ -765,9 +785,9 @@ interface TimeoutFnOptions {
|
|
|
765
785
|
* @param interval
|
|
766
786
|
* @param immediate
|
|
767
787
|
*/
|
|
768
|
-
declare function useTimeoutFn(cb: (...args: unknown[]) => any, interval:
|
|
788
|
+
declare function useTimeoutFn(cb: (...args: unknown[]) => any, interval: MaybeComputedRef$1<number>, options?: UseTimeoutFnOptions): Stoppable;
|
|
769
789
|
|
|
770
|
-
interface
|
|
790
|
+
interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOptions {
|
|
771
791
|
/**
|
|
772
792
|
* Expose more controls
|
|
773
793
|
*
|
|
@@ -782,14 +802,14 @@ interface TimeoutOptions<Controls extends boolean> extends TimeoutFnOptions {
|
|
|
782
802
|
* @param interval
|
|
783
803
|
* @param immediate
|
|
784
804
|
*/
|
|
785
|
-
declare function useTimeout(interval?: number, options?:
|
|
786
|
-
declare function useTimeout(interval: number, options:
|
|
805
|
+
declare function useTimeout(interval?: number, options?: UseTimeoutOptions<false>): ComputedRef<boolean>;
|
|
806
|
+
declare function useTimeout(interval: number, options: UseTimeoutOptions<true>): {
|
|
787
807
|
ready: ComputedRef<boolean>;
|
|
788
808
|
} & Stoppable;
|
|
789
809
|
|
|
790
810
|
interface UseToggleOptions<Truthy, Falsy> {
|
|
791
|
-
truthyValue?:
|
|
792
|
-
falsyValue?:
|
|
811
|
+
truthyValue?: MaybeComputedRef<Truthy>;
|
|
812
|
+
falsyValue?: MaybeComputedRef<Falsy>;
|
|
793
813
|
}
|
|
794
814
|
declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(initialValue: Ref<T>, options?: UseToggleOptions<Truthy, Falsy>): (value?: T) => T;
|
|
795
815
|
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [Ref<T>, (value?: T) => T];
|
|
@@ -809,7 +829,7 @@ declare function watchWithFilter<T, Immediate extends Readonly<boolean> = false>
|
|
|
809
829
|
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;
|
|
810
830
|
|
|
811
831
|
interface WatchAtMostOptions<Immediate> extends WatchWithFilterOptions<Immediate> {
|
|
812
|
-
count:
|
|
832
|
+
count: MaybeComputedRef<number>;
|
|
813
833
|
}
|
|
814
834
|
interface WatchAtMostReturn {
|
|
815
835
|
stop: WatchStopHandle;
|
|
@@ -819,7 +839,7 @@ declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immedia
|
|
|
819
839
|
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;
|
|
820
840
|
|
|
821
841
|
interface WatchDebouncedOptions<Immediate> extends WatchOptions<Immediate>, DebounceFilterOptions {
|
|
822
|
-
debounce?:
|
|
842
|
+
debounce?: MaybeComputedRef<number>;
|
|
823
843
|
}
|
|
824
844
|
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;
|
|
825
845
|
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;
|
|
@@ -846,7 +866,7 @@ declare function watchPausable<T, Immediate extends Readonly<boolean> = false>(s
|
|
|
846
866
|
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;
|
|
847
867
|
|
|
848
868
|
interface WatchThrottledOptions<Immediate> extends WatchOptions<Immediate> {
|
|
849
|
-
throttle?:
|
|
869
|
+
throttle?: MaybeComputedRef<number>;
|
|
850
870
|
trailing?: boolean;
|
|
851
871
|
leading?: boolean;
|
|
852
872
|
}
|
|
@@ -867,8 +887,8 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
|
|
|
867
887
|
/**
|
|
868
888
|
* Shorthand for watching value to be truthy
|
|
869
889
|
*
|
|
870
|
-
* @see https://vueuse.
|
|
890
|
+
* @see https://vueuse.org/whenever
|
|
871
891
|
*/
|
|
872
892
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
|
|
873
893
|
|
|
874
|
-
export { Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater,
|
|
894
|
+
export { ArgumentsType, Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater, MapOldSources, MapSources, MaybeComputedRef, MaybeRef, Pausable, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyOptions, RemovableRef, RemoveableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stopable, Stoppable, SyncRefOptions, SyncRefsOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayReducer, UseCounterOptions, UseDateFormatReturn, UseIntervalFnOptions, UseIntervalOptions, UseLastChangedOptions, UseTimeoutFnOptions, UseTimeoutOptions, UseToggleOptions, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WritableComputedRefWithControl, __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, 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, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|