@vueuse/shared 14.2.0 → 14.3.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/dist/index.d.ts +105 -88
- package/dist/index.iife.js +414 -490
- package/dist/index.iife.min.js +1 -1
- package/dist/index.js +94 -147
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { ComponentInternalInstance, ComputedGetter, ComputedRef, InjectionKey, MaybeRef, MaybeRefOrGetter, MultiWatchSources, MultiWatchSources as MultiWatchSources$1, Ref, ShallowRef, ShallowUnwrapRef as ShallowUnwrapRef$1, ToRef, ToRefs, UnwrapNestedRefs, UnwrapRef, WatchCallback, WatchHandle, WatchOptions, WatchOptionsBase, WatchSource, WatchStopHandle, WritableComputedOptions, WritableComputedRef, getCurrentInstance, inject } from "vue";
|
|
1
|
+
import * as _$vue from "vue";
|
|
2
|
+
import { ComponentInternalInstance, ComputedGetter, ComputedRef, FunctionDirective, InjectionKey, MaybeRef, MaybeRefOrGetter, MultiWatchSources, MultiWatchSources as MultiWatchSources$1, ObjectDirective, Ref, ShallowRef, ShallowUnwrapRef as ShallowUnwrapRef$1, ToRef, ToRefs, UnwrapNestedRefs, UnwrapRef, WatchCallback, WatchHandle, WatchOptions, WatchOptionsBase, WatchSource, WatchStopHandle, WritableComputedOptions, WritableComputedRef, getCurrentInstance, inject } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region computedEager/index.d.ts
|
|
5
5
|
type ComputedEagerOptions = WatchOptionsBase;
|
|
@@ -36,6 +36,17 @@ declare function computedWithControl<T>(source: WatchSource | MultiWatchSources$
|
|
|
36
36
|
/** @deprecated use `computedWithControl` instead */
|
|
37
37
|
declare const controlledComputed: typeof computedWithControl;
|
|
38
38
|
//#endregion
|
|
39
|
+
//#region createDisposableDirective/index.d.ts
|
|
40
|
+
type originDirective<H, V, A> = FunctionDirective<H, V, string, A> | ObjectDirective<H, V, string, A>;
|
|
41
|
+
/**
|
|
42
|
+
* Utility for authoring disposable directives. Reactive effects created within `mounted` directive hook will be tracked and automatically disposed when directive is unmounted.
|
|
43
|
+
*
|
|
44
|
+
* @see https://vueuse.org/createDisposableDirective
|
|
45
|
+
*
|
|
46
|
+
* @__NO_SIDE_EFFECTS__
|
|
47
|
+
*/
|
|
48
|
+
declare function createDisposableDirective<H extends HTMLElement, V, A = any>(origin?: originDirective<H, V, A>): originDirective<H, V, A>;
|
|
49
|
+
//#endregion
|
|
39
50
|
//#region utils/types.d.ts
|
|
40
51
|
/**
|
|
41
52
|
* Void function
|
|
@@ -304,7 +315,7 @@ declare const timestamp: () => number;
|
|
|
304
315
|
declare const clamp: (n: number, min: number, max: number) => number;
|
|
305
316
|
declare const noop: () => void;
|
|
306
317
|
declare const rand: (min: number, max: number) => number;
|
|
307
|
-
declare const hasOwn: <T extends object, K
|
|
318
|
+
declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
|
|
308
319
|
declare const isIOS: boolean;
|
|
309
320
|
//#endregion
|
|
310
321
|
//#region utils/port.d.ts
|
|
@@ -315,7 +326,7 @@ declare const camelize: (str: string) => string;
|
|
|
315
326
|
declare function getLifeCycleTarget(target?: ComponentInternalInstance | null): ComponentInternalInstance | null;
|
|
316
327
|
//#endregion
|
|
317
328
|
//#region createGlobalState/index.d.ts
|
|
318
|
-
type CreateGlobalStateReturn<Fn
|
|
329
|
+
type CreateGlobalStateReturn<Fn extends AnyFn = AnyFn> = Fn;
|
|
319
330
|
/**
|
|
320
331
|
* Keep states in the global scope to be reusable across Vue instances.
|
|
321
332
|
*
|
|
@@ -324,23 +335,23 @@ type CreateGlobalStateReturn<Fn$1 extends AnyFn = AnyFn> = Fn$1;
|
|
|
324
335
|
*
|
|
325
336
|
* @__NO_SIDE_EFFECTS__
|
|
326
337
|
*/
|
|
327
|
-
declare function createGlobalState<Fn
|
|
338
|
+
declare function createGlobalState<Fn extends AnyFn>(stateFactory: Fn): CreateGlobalStateReturn<Fn>;
|
|
328
339
|
//#endregion
|
|
329
340
|
//#region createInjectionState/index.d.ts
|
|
330
|
-
type CreateInjectionStateReturn<Arguments extends Array<any>,
|
|
341
|
+
type CreateInjectionStateReturn<Arguments extends Array<any>, ProvideReturn, InjectReturn> = Readonly<[
|
|
331
342
|
/**
|
|
332
343
|
* Call this function in a provider component to create and provide the state.
|
|
333
344
|
*
|
|
334
345
|
* @param args Arguments passed to the composable
|
|
335
346
|
* @returns The state returned by the composable
|
|
336
347
|
*/
|
|
337
|
-
useProvidingState: (...args: Arguments) =>
|
|
348
|
+
useProvidingState: (...args: Arguments) => ProvideReturn,
|
|
338
349
|
/**
|
|
339
350
|
* Call this function in a consumer component to inject the state.
|
|
340
351
|
*
|
|
341
352
|
* @returns The injected state, or `undefined` if not provided and no default value was set.
|
|
342
353
|
*/
|
|
343
|
-
useInjectedState: () =>
|
|
354
|
+
useInjectedState: () => InjectReturn]>;
|
|
344
355
|
interface CreateInjectionStateOptions<Return> {
|
|
345
356
|
/**
|
|
346
357
|
* Custom injectionKey for InjectionState
|
|
@@ -358,7 +369,10 @@ interface CreateInjectionStateOptions<Return> {
|
|
|
358
369
|
*
|
|
359
370
|
* @__NO_SIDE_EFFECTS__
|
|
360
371
|
*/
|
|
361
|
-
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options
|
|
372
|
+
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options: {
|
|
373
|
+
defaultValue: Return;
|
|
374
|
+
} & CreateInjectionStateOptions<Return>): CreateInjectionStateReturn<Arguments, Return, Return>;
|
|
375
|
+
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options?: CreateInjectionStateOptions<Return>): CreateInjectionStateReturn<Arguments, Return, Return | undefined>;
|
|
362
376
|
//#endregion
|
|
363
377
|
//#region createRef/index.d.ts
|
|
364
378
|
type CreateRefReturn<T = any, D extends boolean = false> = ShallowOrDeepRef<T, D>;
|
|
@@ -389,7 +403,7 @@ type SharedComposableReturn<T extends AnyFn = AnyFn> = T;
|
|
|
389
403
|
*
|
|
390
404
|
* @__NO_SIDE_EFFECTS__
|
|
391
405
|
*/
|
|
392
|
-
declare function createSharedComposable<Fn
|
|
406
|
+
declare function createSharedComposable<Fn extends AnyFn>(composable: Fn): SharedComposableReturn<Fn>;
|
|
393
407
|
//#endregion
|
|
394
408
|
//#region extendRef/index.d.ts
|
|
395
409
|
type ExtendRefReturn<T = any> = Ref<T>;
|
|
@@ -410,18 +424,18 @@ interface ExtendRefOptions<Unwrap extends boolean = boolean> {
|
|
|
410
424
|
/**
|
|
411
425
|
* Overload 1: Unwrap set to false
|
|
412
426
|
*/
|
|
413
|
-
declare function extendRef<R
|
|
427
|
+
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions<false>>(ref: R, extend: Extend, options?: Options): ShallowUnwrapRef$1<Extend> & R;
|
|
414
428
|
/**
|
|
415
429
|
* Overload 2: Unwrap unset or set to true
|
|
416
430
|
*/
|
|
417
|
-
declare function extendRef<R
|
|
431
|
+
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
|
|
418
432
|
//#endregion
|
|
419
433
|
//#region get/index.d.ts
|
|
420
434
|
/**
|
|
421
435
|
* Shorthand for accessing `ref.value`
|
|
422
436
|
*/
|
|
423
437
|
declare function get<T>(ref: MaybeRef<T>): T;
|
|
424
|
-
declare function get<T, K
|
|
438
|
+
declare function get<T, K extends keyof T>(ref: MaybeRef<T>, key: K): T[K];
|
|
425
439
|
//#endregion
|
|
426
440
|
//#region injectLocal/index.d.ts
|
|
427
441
|
/**
|
|
@@ -444,7 +458,7 @@ declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>
|
|
|
444
458
|
declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>;
|
|
445
459
|
//#endregion
|
|
446
460
|
//#region makeDestructurable/index.d.ts
|
|
447
|
-
declare function makeDestructurable<T extends Record<string, unknown>, A
|
|
461
|
+
declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: A): T & A;
|
|
448
462
|
//#endregion
|
|
449
463
|
//#region provideLocal/map.d.ts
|
|
450
464
|
type LocalProvidedKey<T> = InjectionKey<T> | string | number;
|
|
@@ -460,11 +474,11 @@ type ProvideLocalReturn = void;
|
|
|
460
474
|
* const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
|
|
461
475
|
* ```
|
|
462
476
|
*/
|
|
463
|
-
declare function provideLocal<T, K
|
|
477
|
+
declare function provideLocal<T, K = LocalProvidedKey<T>>(key: K, value: K extends InjectionKey<infer V> ? V : T): ProvideLocalReturn;
|
|
464
478
|
//#endregion
|
|
465
479
|
//#region reactify/index.d.ts
|
|
466
480
|
type Reactified<T, Computed extends boolean> = T extends ((...args: infer A) => infer R) ? (...args: { [K in keyof A]: Computed extends true ? MaybeRefOrGetter<A[K]> : MaybeRef<A[K]> }) => ComputedRef<R> : never;
|
|
467
|
-
type ReactifyReturn<T extends AnyFn = AnyFn, K
|
|
481
|
+
type ReactifyReturn<T extends AnyFn = AnyFn, K extends boolean = true> = Reactified<T, K>;
|
|
468
482
|
interface ReactifyOptions<T extends boolean> {
|
|
469
483
|
/**
|
|
470
484
|
* Accept passing a function as a reactive getter
|
|
@@ -483,13 +497,13 @@ interface ReactifyOptions<T extends boolean> {
|
|
|
483
497
|
*
|
|
484
498
|
* @__NO_SIDE_EFFECTS__
|
|
485
499
|
*/
|
|
486
|
-
declare function reactify<T extends AnyFn, K
|
|
500
|
+
declare function reactify<T extends AnyFn, K extends boolean = true>(fn: T, options?: ReactifyOptions<K>): ReactifyReturn<T, K>;
|
|
487
501
|
/** @deprecated use `reactify` instead */
|
|
488
502
|
declare const createReactiveFn: typeof reactify;
|
|
489
503
|
//#endregion
|
|
490
504
|
//#region reactifyObject/index.d.ts
|
|
491
|
-
type ReactifyNested<T, Keys extends keyof T = keyof T, S
|
|
492
|
-
type ReactifyObjectReturn<T, Keys extends keyof T, S
|
|
505
|
+
type ReactifyNested<T, Keys extends keyof T = keyof T, S extends boolean = true> = { [K in Keys]: T[K] extends AnyFn ? Reactified<T[K], S> : T[K] };
|
|
506
|
+
type ReactifyObjectReturn<T, Keys extends keyof T, S extends boolean = true> = ReactifyNested<T, Keys, S>;
|
|
493
507
|
interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
|
|
494
508
|
/**
|
|
495
509
|
* Includes names from Object.getOwnPropertyNames
|
|
@@ -504,7 +518,7 @@ interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
|
|
|
504
518
|
* @__NO_SIDE_EFFECTS__
|
|
505
519
|
*/
|
|
506
520
|
declare function reactifyObject<T extends object, Keys extends keyof T>(obj: T, keys?: (keyof T)[]): ReactifyObjectReturn<T, Keys, true>;
|
|
507
|
-
declare function reactifyObject<T extends object, S
|
|
521
|
+
declare function reactifyObject<T extends object, S extends boolean = true>(obj: T, options?: ReactifyObjectOptions<S>): ReactifyObjectReturn<T, keyof T, S>;
|
|
508
522
|
//#endregion
|
|
509
523
|
//#region reactiveComputed/index.d.ts
|
|
510
524
|
type ReactiveComputedReturn<T extends object> = UnwrapNestedRefs<T>;
|
|
@@ -514,15 +528,15 @@ type ReactiveComputedReturn<T extends object> = UnwrapNestedRefs<T>;
|
|
|
514
528
|
declare function reactiveComputed<T extends object>(fn: ComputedGetter<T>): ReactiveComputedReturn<T>;
|
|
515
529
|
//#endregion
|
|
516
530
|
//#region reactiveOmit/index.d.ts
|
|
517
|
-
type ReactiveOmitReturn<T extends object, K
|
|
531
|
+
type ReactiveOmitReturn<T extends object, K extends keyof T | undefined = undefined> = [K] extends [undefined] ? Partial<T> : Omit<T, Extract<K, keyof T>>;
|
|
518
532
|
type ReactiveOmitPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
519
|
-
declare function reactiveOmit<T extends object, K
|
|
533
|
+
declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): ReactiveOmitReturn<T, K>;
|
|
520
534
|
declare function reactiveOmit<T extends object>(obj: T, predicate: ReactiveOmitPredicate<T>): ReactiveOmitReturn<T>;
|
|
521
535
|
//#endregion
|
|
522
536
|
//#region reactivePick/index.d.ts
|
|
523
|
-
type ReactivePickReturn<T extends object, K
|
|
537
|
+
type ReactivePickReturn<T extends object, K extends keyof T> = { [S in K]: UnwrapRef<T[S]> };
|
|
524
538
|
type ReactivePickPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
525
|
-
declare function reactivePick<T extends object, K
|
|
539
|
+
declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): ReactivePickReturn<T, K>;
|
|
526
540
|
declare function reactivePick<T extends object>(obj: T, predicate: ReactivePickPredicate<T>): ReactivePickReturn<T, keyof T>;
|
|
527
541
|
//#endregion
|
|
528
542
|
//#region refAutoReset/index.d.ts
|
|
@@ -614,63 +628,63 @@ interface ControlledRefOptions<T> {
|
|
|
614
628
|
*
|
|
615
629
|
* @__NO_SIDE_EFFECTS__
|
|
616
630
|
*/
|
|
617
|
-
declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>):
|
|
631
|
+
declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>): {
|
|
618
632
|
get: (tracking?: boolean) => T;
|
|
619
633
|
set: (value: T, triggering?: boolean) => void;
|
|
620
634
|
untrackedGet: () => T;
|
|
621
635
|
silentSet: (v: T) => void;
|
|
622
636
|
peek: () => T;
|
|
623
637
|
lay: (v: T) => void;
|
|
624
|
-
}
|
|
638
|
+
} & _$vue.Ref<T, T>;
|
|
625
639
|
/** @deprecated use `refWithControl` instead */
|
|
626
640
|
declare const controlledRef: typeof refWithControl;
|
|
627
641
|
//#endregion
|
|
628
642
|
//#region set/index.d.ts
|
|
629
643
|
declare function set<T>(ref: Ref<T>, value: T): void;
|
|
630
|
-
declare function set<O extends object, K
|
|
644
|
+
declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
|
|
631
645
|
//#endregion
|
|
632
646
|
//#region syncRef/index.d.ts
|
|
633
647
|
type Direction = 'ltr' | 'rtl' | 'both';
|
|
634
|
-
type SpecificFieldPartial<T, K
|
|
648
|
+
type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
|
|
635
649
|
/**
|
|
636
650
|
* A = B
|
|
637
651
|
*/
|
|
638
|
-
type Equal<A
|
|
652
|
+
type Equal<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
|
|
639
653
|
/**
|
|
640
654
|
* A ∩ B ≠ ∅
|
|
641
655
|
*/
|
|
642
|
-
type IntersectButNotEqual<A
|
|
656
|
+
type IntersectButNotEqual<A, B> = Equal<A, B> extends true ? false : A & B extends never ? false : true;
|
|
643
657
|
/**
|
|
644
658
|
* A ⊆ B
|
|
645
659
|
*/
|
|
646
|
-
type IncludeButNotEqual<A
|
|
660
|
+
type IncludeButNotEqual<A, B> = Equal<A, B> extends true ? false : A extends B ? true : false;
|
|
647
661
|
/**
|
|
648
662
|
* A ∩ B = ∅
|
|
649
663
|
*/
|
|
650
|
-
type NotIntersect<A
|
|
651
|
-
interface EqualType<D extends Direction, L, R
|
|
652
|
-
transform?: SpecificFieldPartial<Pick<Transform<L, R
|
|
664
|
+
type NotIntersect<A, B> = Equal<A, B> extends true ? false : A & B extends never ? true : false;
|
|
665
|
+
interface EqualType<D extends Direction, L, R, O extends keyof Transform<L, R> = (D extends 'both' ? 'ltr' | 'rtl' : D)> {
|
|
666
|
+
transform?: SpecificFieldPartial<Pick<Transform<L, R>, O>, O>;
|
|
653
667
|
}
|
|
654
|
-
type StrictIncludeMap<IncludeType extends 'LR' | 'RL', D extends Exclude<Direction, 'both'>, L, R
|
|
655
|
-
transform?: SpecificFieldPartial<Pick<Transform<L, R
|
|
668
|
+
type StrictIncludeMap<IncludeType extends 'LR' | 'RL', D extends Exclude<Direction, 'both'>, L, R> = (Equal<[IncludeType, D], ['LR', 'ltr']> & Equal<[IncludeType, D], ['RL', 'rtl']>) extends true ? {
|
|
669
|
+
transform?: SpecificFieldPartial<Pick<Transform<L, R>, D>, D>;
|
|
656
670
|
} : {
|
|
657
|
-
transform: Pick<Transform<L, R
|
|
671
|
+
transform: Pick<Transform<L, R>, D>;
|
|
658
672
|
};
|
|
659
|
-
type StrictIncludeType<IncludeType extends 'LR' | 'RL', D extends Direction, L, R
|
|
660
|
-
transform: SpecificFieldPartial<Transform<L, R
|
|
661
|
-
} : D extends Exclude<Direction, 'both'> ? StrictIncludeMap<IncludeType, D, L, R
|
|
662
|
-
type IntersectButNotEqualType<D extends Direction, L, R
|
|
663
|
-
transform: Transform<L, R
|
|
673
|
+
type StrictIncludeType<IncludeType extends 'LR' | 'RL', D extends Direction, L, R> = D extends 'both' ? {
|
|
674
|
+
transform: SpecificFieldPartial<Transform<L, R>, IncludeType extends 'LR' ? 'ltr' : 'rtl'>;
|
|
675
|
+
} : D extends Exclude<Direction, 'both'> ? StrictIncludeMap<IncludeType, D, L, R> : never;
|
|
676
|
+
type IntersectButNotEqualType<D extends Direction, L, R> = D extends 'both' ? {
|
|
677
|
+
transform: Transform<L, R>;
|
|
664
678
|
} : D extends Exclude<Direction, 'both'> ? {
|
|
665
|
-
transform: Pick<Transform<L, R
|
|
679
|
+
transform: Pick<Transform<L, R>, D>;
|
|
666
680
|
} : never;
|
|
667
|
-
type NotIntersectType<D extends Direction, L, R
|
|
668
|
-
interface Transform<L, R
|
|
669
|
-
ltr: (left: L) => R
|
|
670
|
-
rtl: (right: R
|
|
681
|
+
type NotIntersectType<D extends Direction, L, R> = IntersectButNotEqualType<D, L, R>;
|
|
682
|
+
interface Transform<L, R> {
|
|
683
|
+
ltr: (left: L) => R;
|
|
684
|
+
rtl: (right: R) => L;
|
|
671
685
|
}
|
|
672
|
-
type TransformType<D extends Direction, L, R
|
|
673
|
-
type SyncRefOptions<L, R
|
|
686
|
+
type TransformType<D extends Direction, L, R> = Equal<L, R> extends true ? EqualType<D, L, R> : IncludeButNotEqual<L, R> extends true ? StrictIncludeType<'LR', D, L, R> : IncludeButNotEqual<R, L> extends true ? StrictIncludeType<'RL', D, L, R> : IntersectButNotEqual<L, R> extends true ? IntersectButNotEqualType<D, L, R> : NotIntersect<L, R> extends true ? NotIntersectType<D, L, R> : never;
|
|
687
|
+
type SyncRefOptions<L, R, D extends Direction> = ConfigurableFlushSync & {
|
|
674
688
|
/**
|
|
675
689
|
* Watch deeply
|
|
676
690
|
*
|
|
@@ -689,7 +703,7 @@ type SyncRefOptions<L, R$1, D extends Direction> = ConfigurableFlushSync & {
|
|
|
689
703
|
* @default 'both'
|
|
690
704
|
*/
|
|
691
705
|
direction?: D;
|
|
692
|
-
} & TransformType<D, L, R
|
|
706
|
+
} & TransformType<D, L, R>;
|
|
693
707
|
/**
|
|
694
708
|
* Two-way refs synchronization.
|
|
695
709
|
* From the set theory perspective to restrict the option's type
|
|
@@ -699,7 +713,7 @@ type SyncRefOptions<L, R$1, D extends Direction> = ConfigurableFlushSync & {
|
|
|
699
713
|
* 3. L ⊆ R
|
|
700
714
|
* 4. L ∩ R = ∅
|
|
701
715
|
*/
|
|
702
|
-
declare function syncRef<L, R
|
|
716
|
+
declare function syncRef<L, R, D extends Direction = 'both'>(left: Ref<L>, right: Ref<R>, ...[options]: Equal<L, R> extends true ? [options?: SyncRefOptions<L, R, D>] : [options: SyncRefOptions<L, R, D>]): () => void;
|
|
703
717
|
//#endregion
|
|
704
718
|
//#region syncRefs/index.d.ts
|
|
705
719
|
interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
@@ -722,7 +736,7 @@ interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
|
722
736
|
* @param source source ref
|
|
723
737
|
* @param targets
|
|
724
738
|
*/
|
|
725
|
-
declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions):
|
|
739
|
+
declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions): _$vue.WatchHandle;
|
|
726
740
|
//#endregion
|
|
727
741
|
//#region toReactive/index.d.ts
|
|
728
742
|
/**
|
|
@@ -741,8 +755,8 @@ declare function toRef<T>(r: () => T): Readonly<Ref<T>>;
|
|
|
741
755
|
declare function toRef<T>(r: ComputedRef<T>): ComputedRef<T>;
|
|
742
756
|
declare function toRef<T>(r: MaybeRefOrGetter<T>): Ref<T>;
|
|
743
757
|
declare function toRef<T>(r: T): Ref<T>;
|
|
744
|
-
declare function toRef<T extends object, K
|
|
745
|
-
declare function toRef<T extends object, K
|
|
758
|
+
declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
|
759
|
+
declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
|
|
746
760
|
//#endregion
|
|
747
761
|
//#region toRefs/index.d.ts
|
|
748
762
|
interface ToRefsOptions {
|
|
@@ -831,14 +845,14 @@ interface UntilToMatchOptions extends ConfigurableFlushSync {
|
|
|
831
845
|
deep?: WatchOptions['deep'];
|
|
832
846
|
}
|
|
833
847
|
interface UntilBaseInstance<T, Not extends boolean = false> {
|
|
834
|
-
toMatch: (<U
|
|
848
|
+
toMatch: (<U extends T = T>(condition: (v: T) => v is U, options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, U>> : Promise<U>) & ((condition: (v: T) => boolean, options?: UntilToMatchOptions) => Promise<T>);
|
|
835
849
|
changed: (options?: UntilToMatchOptions) => Promise<T>;
|
|
836
850
|
changedTimes: (n?: number, options?: UntilToMatchOptions) => Promise<T>;
|
|
837
851
|
}
|
|
838
852
|
type Falsy = false | void | null | undefined | 0 | 0n | '';
|
|
839
853
|
interface UntilValueInstance<T, Not extends boolean = false> extends UntilBaseInstance<T, Not> {
|
|
840
854
|
readonly not: UntilValueInstance<T, Not extends true ? false : true>;
|
|
841
|
-
toBe: <P
|
|
855
|
+
toBe: <P = T>(value: MaybeRefOrGetter<P>, options?: UntilToMatchOptions) => Not extends true ? Promise<T> : Promise<P>;
|
|
842
856
|
toBeTruthy: (options?: UntilToMatchOptions) => Not extends true ? Promise<T & Falsy> : Promise<Exclude<T, Falsy>>;
|
|
843
857
|
toBeNull: (options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, null>> : Promise<null>;
|
|
844
858
|
toBeUndefined: (options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, undefined>> : Promise<undefined>;
|
|
@@ -906,7 +920,7 @@ type UseArrayFilterReturn<T = any> = ComputedRef<T[]>;
|
|
|
906
920
|
*
|
|
907
921
|
* @__NO_SIDE_EFFECTS__
|
|
908
922
|
*/
|
|
909
|
-
declare function useArrayFilter<T, S
|
|
923
|
+
declare function useArrayFilter<T, S extends T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => element is S): UseArrayFilterReturn<S>;
|
|
910
924
|
declare function useArrayFilter<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => unknown): UseArrayFilterReturn<T>;
|
|
911
925
|
//#endregion
|
|
912
926
|
//#region useArrayFind/index.d.ts
|
|
@@ -955,10 +969,10 @@ type UseArrayFindLastReturn<T = any> = ComputedRef<T | undefined>;
|
|
|
955
969
|
declare function useArrayFindLast<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): UseArrayFindLastReturn<T>;
|
|
956
970
|
//#endregion
|
|
957
971
|
//#region useArrayIncludes/index.d.ts
|
|
958
|
-
type UseArrayIncludesComparatorFn<T, V
|
|
959
|
-
interface UseArrayIncludesOptions<T, V
|
|
972
|
+
type UseArrayIncludesComparatorFn<T, V> = ((element: T, value: V, index: number, array: MaybeRefOrGetter<T>[]) => boolean);
|
|
973
|
+
interface UseArrayIncludesOptions<T, V> {
|
|
960
974
|
fromIndex?: number;
|
|
961
|
-
comparator?: UseArrayIncludesComparatorFn<T, V
|
|
975
|
+
comparator?: UseArrayIncludesComparatorFn<T, V> | keyof T;
|
|
962
976
|
}
|
|
963
977
|
type UseArrayIncludesReturn = ComputedRef<boolean>;
|
|
964
978
|
/**
|
|
@@ -970,9 +984,9 @@ type UseArrayIncludesReturn = ComputedRef<boolean>;
|
|
|
970
984
|
*
|
|
971
985
|
* @__NO_SIDE_EFFECTS__
|
|
972
986
|
*/
|
|
973
|
-
declare function useArrayIncludes<T, V
|
|
974
|
-
declare function useArrayIncludes<T, V
|
|
975
|
-
declare function useArrayIncludes<T, V
|
|
987
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: UseArrayIncludesComparatorFn<T, V>): UseArrayIncludesReturn;
|
|
988
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: keyof T): UseArrayIncludesReturn;
|
|
989
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, options?: UseArrayIncludesOptions<T, V>): UseArrayIncludesReturn;
|
|
976
990
|
//#endregion
|
|
977
991
|
//#region useArrayJoin/index.d.ts
|
|
978
992
|
type UseArrayJoinReturn = ComputedRef<string>;
|
|
@@ -1002,10 +1016,10 @@ type UseArrayMapReturn<T = any> = ComputedRef<T[]>;
|
|
|
1002
1016
|
*
|
|
1003
1017
|
* @__NO_SIDE_EFFECTS__
|
|
1004
1018
|
*/
|
|
1005
|
-
declare function useArrayMap<T, U
|
|
1019
|
+
declare function useArrayMap<T, U = T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => U): UseArrayMapReturn<U>;
|
|
1006
1020
|
//#endregion
|
|
1007
1021
|
//#region useArrayReduce/index.d.ts
|
|
1008
|
-
type UseArrayReducer<PV, CV, R
|
|
1022
|
+
type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
|
|
1009
1023
|
type UseArrayReduceReturn<T = any> = ComputedRef<T>;
|
|
1010
1024
|
/**
|
|
1011
1025
|
* Reactive `Array.reduce`
|
|
@@ -1031,7 +1045,7 @@ declare function useArrayReduce<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>
|
|
|
1031
1045
|
*
|
|
1032
1046
|
* @__NO_SIDE_EFFECTS__
|
|
1033
1047
|
*/
|
|
1034
|
-
declare function useArrayReduce<T, U
|
|
1048
|
+
declare function useArrayReduce<T, U>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeRefOrGetter<U>): UseArrayReduceReturn<U>;
|
|
1035
1049
|
//#endregion
|
|
1036
1050
|
//#region useArraySome/index.d.ts
|
|
1037
1051
|
type UseArraySomeReturn = ComputedRef<boolean>;
|
|
@@ -1106,7 +1120,7 @@ interface UseCounterReturn {
|
|
|
1106
1120
|
* @param options
|
|
1107
1121
|
*/
|
|
1108
1122
|
declare function useCounter(initialValue?: MaybeRef<number>, options?: UseCounterOptions): {
|
|
1109
|
-
count: Readonly<Ref<number, number> |
|
|
1123
|
+
count: Readonly<Ref<number, number> | _$vue.ShallowRef<number, number> | _$vue.WritableComputedRef<number, number>>;
|
|
1110
1124
|
inc: (delta?: number) => number;
|
|
1111
1125
|
dec: (delta?: number) => number;
|
|
1112
1126
|
get: () => number;
|
|
@@ -1354,26 +1368,26 @@ declare function useToString(value: MaybeRefOrGetter<unknown>): ComputedRef<stri
|
|
|
1354
1368
|
//#region useToggle/index.d.ts
|
|
1355
1369
|
type ToggleFn = (value?: boolean) => void;
|
|
1356
1370
|
type UseToggleReturn = [ShallowRef<boolean>, ToggleFn] | ToggleFn;
|
|
1357
|
-
interface UseToggleOptions<Truthy, Falsy
|
|
1371
|
+
interface UseToggleOptions<Truthy, Falsy> {
|
|
1358
1372
|
truthyValue?: MaybeRefOrGetter<Truthy>;
|
|
1359
|
-
falsyValue?: MaybeRefOrGetter<Falsy
|
|
1373
|
+
falsyValue?: MaybeRefOrGetter<Falsy>;
|
|
1360
1374
|
}
|
|
1361
|
-
declare function useToggle<Truthy, Falsy
|
|
1362
|
-
declare function useToggle<Truthy = true, Falsy
|
|
1375
|
+
declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(initialValue: Ref<T>, options?: UseToggleOptions<Truthy, Falsy>): (value?: T) => T;
|
|
1376
|
+
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [ShallowRef<T>, (value?: T) => T];
|
|
1363
1377
|
//#endregion
|
|
1364
1378
|
//#region watchArray/index.d.ts
|
|
1365
|
-
declare type WatchArrayCallback<V
|
|
1379
|
+
declare type WatchArrayCallback<V = any, OV = any> = (value: V, oldValue: OV, added: V, removed: OV, onCleanup: (cleanupFn: () => void) => void) => any;
|
|
1366
1380
|
/**
|
|
1367
1381
|
* Watch for an array with additions and removals.
|
|
1368
1382
|
*
|
|
1369
1383
|
* @see https://vueuse.org/watchArray
|
|
1370
1384
|
*/
|
|
1371
|
-
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>):
|
|
1385
|
+
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.WatchHandle;
|
|
1372
1386
|
//#endregion
|
|
1373
1387
|
//#region watchWithFilter/index.d.ts
|
|
1374
1388
|
interface WatchWithFilterOptions<Immediate> extends WatchOptions<Immediate>, ConfigurableEventFilter {}
|
|
1375
|
-
declare function watchWithFilter<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchHandle;
|
|
1376
1389
|
declare function watchWithFilter<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchHandle;
|
|
1390
|
+
declare function watchWithFilter<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchHandle;
|
|
1377
1391
|
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>): WatchHandle;
|
|
1378
1392
|
//#endregion
|
|
1379
1393
|
//#region watchAtMost/index.d.ts
|
|
@@ -1386,22 +1400,23 @@ interface WatchAtMostReturn {
|
|
|
1386
1400
|
resume: () => void;
|
|
1387
1401
|
count: ShallowRef<number>;
|
|
1388
1402
|
}
|
|
1389
|
-
declare function watchAtMost<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
|
|
1390
1403
|
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;
|
|
1404
|
+
declare function watchAtMost<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
|
|
1405
|
+
declare function watchAtMost<T extends object, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
|
|
1391
1406
|
//#endregion
|
|
1392
1407
|
//#region watchDebounced/index.d.ts
|
|
1393
1408
|
interface WatchDebouncedOptions<Immediate> extends WatchOptions<Immediate>, DebounceFilterOptions {
|
|
1394
1409
|
debounce?: MaybeRefOrGetter<number>;
|
|
1395
1410
|
}
|
|
1396
|
-
declare function watchDebounced<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchDebouncedOptions<Immediate>): WatchHandle;
|
|
1397
1411
|
declare function watchDebounced<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchDebouncedOptions<Immediate>): WatchHandle;
|
|
1412
|
+
declare function watchDebounced<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchDebouncedOptions<Immediate>): WatchHandle;
|
|
1398
1413
|
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>): WatchHandle;
|
|
1399
1414
|
/** @deprecated use `watchDebounced` instead */
|
|
1400
1415
|
declare const debouncedWatch: typeof watchDebounced;
|
|
1401
1416
|
//#endregion
|
|
1402
1417
|
//#region watchDeep/index.d.ts
|
|
1403
|
-
declare function watchDeep<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: Omit<WatchOptions<Immediate>, 'deep'>): WatchHandle;
|
|
1404
1418
|
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'>): WatchHandle;
|
|
1419
|
+
declare function watchDeep<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: Omit<WatchOptions<Immediate>, 'deep'>): WatchHandle;
|
|
1405
1420
|
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'>): WatchHandle;
|
|
1406
1421
|
//#endregion
|
|
1407
1422
|
//#region watchIgnorable/index.d.ts
|
|
@@ -1412,20 +1427,20 @@ interface WatchIgnorableReturn {
|
|
|
1412
1427
|
ignorePrevAsyncUpdates: IgnoredPrevAsyncUpdates;
|
|
1413
1428
|
stop: WatchStopHandle;
|
|
1414
1429
|
}
|
|
1415
|
-
declare function watchIgnorable<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn;
|
|
1416
1430
|
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;
|
|
1431
|
+
declare function watchIgnorable<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn;
|
|
1417
1432
|
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;
|
|
1418
1433
|
/** @deprecated use `watchIgnorable` instead */
|
|
1419
1434
|
declare const ignorableWatch: typeof watchIgnorable;
|
|
1420
1435
|
//#endregion
|
|
1421
1436
|
//#region watchImmediate/index.d.ts
|
|
1422
|
-
declare function watchImmediate<T extends Readonly<MultiWatchSources$1>>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchHandle;
|
|
1423
1437
|
declare function watchImmediate<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchHandle;
|
|
1438
|
+
declare function watchImmediate<T extends Readonly<MultiWatchSources$1>>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchHandle;
|
|
1424
1439
|
declare function watchImmediate<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchHandle;
|
|
1425
1440
|
//#endregion
|
|
1426
1441
|
//#region watchOnce/index.d.ts
|
|
1427
|
-
declare function watchOnce<T extends Readonly<MultiWatchSources$1>>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>, options?: Omit<WatchOptions<true>, 'once'>): WatchHandle;
|
|
1428
1442
|
declare function watchOnce<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'once'>): WatchHandle;
|
|
1443
|
+
declare function watchOnce<T extends Readonly<MultiWatchSources$1>>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>, options?: Omit<WatchOptions<true>, 'once'>): WatchHandle;
|
|
1429
1444
|
declare function watchOnce<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'once'>): WatchHandle;
|
|
1430
1445
|
//#endregion
|
|
1431
1446
|
//#region watchPausable/index.d.ts
|
|
@@ -1434,10 +1449,10 @@ interface WatchPausableReturn extends Pausable {
|
|
|
1434
1449
|
}
|
|
1435
1450
|
type WatchPausableOptions<Immediate> = WatchWithFilterOptions<Immediate> & PausableFilterOptions;
|
|
1436
1451
|
/** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
|
|
1437
|
-
declare function watchPausable<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
|
|
1438
|
-
/** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
|
|
1439
1452
|
declare function watchPausable<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
|
|
1440
1453
|
/** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
|
|
1454
|
+
declare function watchPausable<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
|
|
1455
|
+
/** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
|
|
1441
1456
|
declare function watchPausable<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
|
|
1442
1457
|
/** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
|
|
1443
1458
|
declare const pausableWatch: typeof watchPausable;
|
|
@@ -1448,8 +1463,8 @@ interface WatchThrottledOptions<Immediate> extends WatchOptions<Immediate> {
|
|
|
1448
1463
|
trailing?: boolean;
|
|
1449
1464
|
leading?: boolean;
|
|
1450
1465
|
}
|
|
1451
|
-
declare function watchThrottled<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchThrottledOptions<Immediate>): WatchHandle;
|
|
1452
1466
|
declare function watchThrottled<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchThrottledOptions<Immediate>): WatchHandle;
|
|
1467
|
+
declare function watchThrottled<T extends Readonly<MultiWatchSources$1>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchThrottledOptions<Immediate>): WatchHandle;
|
|
1453
1468
|
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>): WatchHandle;
|
|
1454
1469
|
/** @deprecated use `watchThrottled` instead */
|
|
1455
1470
|
declare const throttledWatch: typeof watchThrottled;
|
|
@@ -1460,13 +1475,14 @@ interface WatchTriggerableReturn<FnReturnT = void> extends WatchIgnorableReturn
|
|
|
1460
1475
|
trigger: () => FnReturnT;
|
|
1461
1476
|
}
|
|
1462
1477
|
type OnCleanup = (cleanupFn: () => void) => void;
|
|
1463
|
-
type WatchTriggerableCallback<V
|
|
1464
|
-
declare function watchTriggerable<T extends Readonly<MultiWatchSources$1>, FnReturnT>(sources: [...T], cb: WatchTriggerableCallback<MapSources<T>, MapOldSources<T, true>, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1478
|
+
type WatchTriggerableCallback<V = any, OV = any, R = void> = (value: V, oldValue: OV, onCleanup: OnCleanup) => R;
|
|
1465
1479
|
declare function watchTriggerable<T, FnReturnT>(source: WatchSource<T>, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1480
|
+
declare function watchTriggerable<T extends Readonly<MultiWatchSources$1>, FnReturnT>(sources: [...T], cb: WatchTriggerableCallback<MapSources<T>, MapOldSources<T, true>, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1466
1481
|
declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1467
1482
|
//#endregion
|
|
1468
1483
|
//#region whenever/index.d.ts
|
|
1469
|
-
|
|
1484
|
+
type Truthy<T> = T extends false | null | undefined ? never : T;
|
|
1485
|
+
interface WheneverOptions<Immediate = boolean> extends WatchOptions<Immediate> {
|
|
1470
1486
|
/**
|
|
1471
1487
|
* Only trigger once when the condition is met
|
|
1472
1488
|
*
|
|
@@ -1481,6 +1497,7 @@ interface WheneverOptions extends WatchOptions {
|
|
|
1481
1497
|
*
|
|
1482
1498
|
* @see https://vueuse.org/whenever
|
|
1483
1499
|
*/
|
|
1484
|
-
declare function whenever<T>(source: WatchSource<T
|
|
1500
|
+
declare function whenever<T>(source: WatchSource<T>, cb: WatchCallback<Truthy<T>, T | undefined>, options?: WheneverOptions<true>): WatchHandle;
|
|
1501
|
+
declare function whenever<T>(source: WatchSource<T>, cb: WatchCallback<Truthy<T>, T>, options?: WheneverOptions<false>): WatchHandle;
|
|
1485
1502
|
//#endregion
|
|
1486
|
-
export { AnyFn, ArgumentsType, Arrayable, Awaitable, Awaited, ComputedEagerOptions, ComputedEagerReturn, ComputedRefWithControl, ComputedWithControlRef, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, CreateInjectionStateOptions, CreateInjectionStateReturn, CreateRefReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookReturn, EventHookTrigger, ExtendRefOptions, ExtendRefReturn, Fn, FunctionArgs, FunctionWrapperOptions, IfAny, IgnoredPrevAsyncUpdates, IgnoredUpdater, InstanceProxy, IsAny, IsDefinedReturn, ManualResetRefReturn, MapOldSources, MapSources, type MultiWatchSources, Mutable, Pausable, PausableFilterOptions, Promisify, PromisifyFn, ProvideLocalReturn, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyObjectReturn, ReactifyOptions, ReactifyReturn, ReactiveComputedReturn, ReactiveOmitPredicate, ReactiveOmitReturn, ReactivePickPredicate, ReactivePickReturn, ReadonlyRefOrGetter, RefAutoResetReturn, RefDebouncedReturn, RefThrottledReturn, RemovableRef, ShallowOrDeepRef, ShallowUnwrapRef, SharedComposableReturn, SingletonPromiseReturn, Stoppable, SyncRefOptions, SyncRefsOptions, ThrottleFilterOptions, TimerHandle, ToRefsOptions, ToggleFn, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayDifferenceOptions, UseArrayDifferenceReturn, UseArrayEveryReturn, UseArrayFilterReturn, UseArrayFindIndexReturn, UseArrayFindLastReturn, UseArrayFindReturn, UseArrayIncludesComparatorFn, UseArrayIncludesOptions, UseArrayIncludesReturn, UseArrayJoinReturn, UseArrayMapReturn, UseArrayReduceReturn, UseArrayReducer, UseArraySomeReturn, UseArrayUniqueReturn, UseCounterOptions, UseCounterReturn, UseDateFormatOptions, UseDateFormatReturn, UseDebounceFnReturn, UseIntervalControls, UseIntervalFnOptions, UseIntervalFnReturn, UseIntervalOptions, UseIntervalReturn, UseLastChangedOptions, UseLastChangedReturn, UseTimeoutFnOptions, UseTimeoutFnReturn, UseTimeoutOptions, UseTimeoutReturn, UseTimoutReturn, UseToNumberOptions, UseToggleOptions, UseToggleReturn, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchOptionFlush, WatchPausableOptions, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WheneverOptions, WritableComputedRefWithControl, assert, autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, createReactiveFn, createRef, createSharedComposable, createSingletonPromise, debounceFilter, debouncedRef, debouncedWatch, eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, pausableWatch, promiseTimeout, provideLocal, pxValue, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refManualReset, refThrottled, refWithControl, set, syncRef, syncRefs, throttleFilter, throttledRef, throttledWatch, timestamp, toArray, toReactive, toRef, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|
|
1503
|
+
export { AnyFn, ArgumentsType, Arrayable, Awaitable, Awaited, ComputedEagerOptions, ComputedEagerReturn, ComputedRefWithControl, ComputedWithControlRef, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, CreateInjectionStateOptions, CreateInjectionStateReturn, CreateRefReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookReturn, EventHookTrigger, ExtendRefOptions, ExtendRefReturn, Fn, FunctionArgs, FunctionWrapperOptions, IfAny, IgnoredPrevAsyncUpdates, IgnoredUpdater, InstanceProxy, IsAny, IsDefinedReturn, ManualResetRefReturn, MapOldSources, MapSources, type MultiWatchSources, Mutable, Pausable, PausableFilterOptions, Promisify, PromisifyFn, ProvideLocalReturn, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyObjectReturn, ReactifyOptions, ReactifyReturn, ReactiveComputedReturn, ReactiveOmitPredicate, ReactiveOmitReturn, ReactivePickPredicate, ReactivePickReturn, ReadonlyRefOrGetter, RefAutoResetReturn, RefDebouncedReturn, RefThrottledReturn, RemovableRef, ShallowOrDeepRef, ShallowUnwrapRef, SharedComposableReturn, SingletonPromiseReturn, Stoppable, SyncRefOptions, SyncRefsOptions, ThrottleFilterOptions, TimerHandle, ToRefsOptions, ToggleFn, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayDifferenceOptions, UseArrayDifferenceReturn, UseArrayEveryReturn, UseArrayFilterReturn, UseArrayFindIndexReturn, UseArrayFindLastReturn, UseArrayFindReturn, UseArrayIncludesComparatorFn, UseArrayIncludesOptions, UseArrayIncludesReturn, UseArrayJoinReturn, UseArrayMapReturn, UseArrayReduceReturn, UseArrayReducer, UseArraySomeReturn, UseArrayUniqueReturn, UseCounterOptions, UseCounterReturn, UseDateFormatOptions, UseDateFormatReturn, UseDebounceFnReturn, UseIntervalControls, UseIntervalFnOptions, UseIntervalFnReturn, UseIntervalOptions, UseIntervalReturn, UseLastChangedOptions, UseLastChangedReturn, UseTimeoutFnOptions, UseTimeoutFnReturn, UseTimeoutOptions, UseTimeoutReturn, UseTimoutReturn, UseToNumberOptions, UseToggleOptions, UseToggleReturn, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchOptionFlush, WatchPausableOptions, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WheneverOptions, WritableComputedRefWithControl, assert, autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, controlledComputed, controlledRef, createDisposableDirective, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, createReactiveFn, createRef, createSharedComposable, createSingletonPromise, debounceFilter, debouncedRef, debouncedWatch, eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, pausableWatch, promiseTimeout, provideLocal, pxValue, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refManualReset, refThrottled, refWithControl, set, syncRef, syncRefs, throttleFilter, throttledRef, throttledWatch, timestamp, toArray, toReactive, toRef, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|