@vueuse/shared 14.2.1 → 14.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/dist/index.d.ts +125 -100
- package/dist/index.iife.js +459 -497
- package/dist/index.iife.min.js +1 -1
- package/dist/index.js +140 -155
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
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";
|
|
3
|
-
|
|
1
|
+
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";
|
|
4
2
|
//#region computedEager/index.d.ts
|
|
5
3
|
type ComputedEagerOptions = WatchOptionsBase;
|
|
6
4
|
type ComputedEagerReturn<T = any> = Readonly<ShallowRef<T>>;
|
|
@@ -36,6 +34,17 @@ declare function computedWithControl<T>(source: WatchSource | MultiWatchSources$
|
|
|
36
34
|
/** @deprecated use `computedWithControl` instead */
|
|
37
35
|
declare const controlledComputed: typeof computedWithControl;
|
|
38
36
|
//#endregion
|
|
37
|
+
//#region createDisposableDirective/index.d.ts
|
|
38
|
+
type originDirective<H, V, A> = FunctionDirective<H, V, string, A> | ObjectDirective<H, V, string, A>;
|
|
39
|
+
/**
|
|
40
|
+
* Utility for authoring disposable directives. Reactive effects created within `mounted` directive hook will be tracked and automatically disposed when directive is unmounted.
|
|
41
|
+
*
|
|
42
|
+
* @see https://vueuse.org/createDisposableDirective
|
|
43
|
+
*
|
|
44
|
+
* @__NO_SIDE_EFFECTS__
|
|
45
|
+
*/
|
|
46
|
+
declare function createDisposableDirective<H extends HTMLElement, V, A = any>(origin?: originDirective<H, V, A>): originDirective<H, V, A>;
|
|
47
|
+
//#endregion
|
|
39
48
|
//#region utils/types.d.ts
|
|
40
49
|
/**
|
|
41
50
|
* Void function
|
|
@@ -62,7 +71,7 @@ type ReadonlyRefOrGetter<T> = ComputedRef<T> | (() => T);
|
|
|
62
71
|
* UnwrapRef<DeepMaybeRef<T>> === T
|
|
63
72
|
* ```
|
|
64
73
|
*/
|
|
65
|
-
type DeepMaybeRef<T> = T extends Ref<infer V> ? MaybeRef<V> : T extends Array<any> | object ? { [K in keyof T]: DeepMaybeRef<T[K]
|
|
74
|
+
type DeepMaybeRef<T> = T extends Ref<infer V> ? MaybeRef<V> : T extends Array<any> | object ? { [K in keyof T]: DeepMaybeRef<T[K]>; } : MaybeRef<T>;
|
|
66
75
|
type Arrayable<T> = T[] | T;
|
|
67
76
|
/**
|
|
68
77
|
* Infers the element type of an array
|
|
@@ -125,9 +134,9 @@ interface ConfigurableFlushSync {
|
|
|
125
134
|
*/
|
|
126
135
|
flush?: WatchOptionFlush;
|
|
127
136
|
}
|
|
128
|
-
type MapSources<T> = { [K in keyof T]: T[K] extends WatchSource<infer V> ? V : never };
|
|
129
|
-
type MapOldSources<T, Immediate> = { [K in keyof T]: T[K] extends WatchSource<infer V> ? Immediate extends true ? V | undefined : V : never };
|
|
130
|
-
type Mutable<T> = { -readonly [P in keyof T]: T[P] };
|
|
137
|
+
type MapSources<T> = { [K in keyof T]: T[K] extends WatchSource<infer V> ? V : never; };
|
|
138
|
+
type MapOldSources<T, Immediate> = { [K in keyof T]: T[K] extends WatchSource<infer V> ? Immediate extends true ? V | undefined : V : never; };
|
|
139
|
+
type Mutable<T> = { -readonly [P in keyof T]: T[P]; };
|
|
131
140
|
type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
|
|
132
141
|
/**
|
|
133
142
|
* will return `true` if `T` is `any`, or `false` otherwise
|
|
@@ -170,6 +179,12 @@ interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
|
|
|
170
179
|
thisArg: This;
|
|
171
180
|
}
|
|
172
181
|
type EventFilter<Args extends any[] = any[], This = any, Invoke extends AnyFn = AnyFn> = (invoke: Invoke, options: FunctionWrapperOptions<Args, This>) => ReturnType<Invoke> | Promisify<ReturnType<Invoke>>;
|
|
182
|
+
interface CancelableEventFilter<Args extends any[] = any[], This = any, Invoke extends AnyFn = AnyFn> {
|
|
183
|
+
(invoke: Invoke, options: FunctionWrapperOptions<Args, This>): ReturnType<Invoke> | Promisify<ReturnType<Invoke>>;
|
|
184
|
+
cancel: () => void;
|
|
185
|
+
flush: () => void;
|
|
186
|
+
readonly isPending: Readonly<Ref<boolean>>;
|
|
187
|
+
}
|
|
173
188
|
interface ConfigurableEventFilter {
|
|
174
189
|
/**
|
|
175
190
|
* Filter for if events should to be received.
|
|
@@ -191,15 +206,21 @@ interface DebounceFilterOptions {
|
|
|
191
206
|
*/
|
|
192
207
|
rejectOnCancel?: boolean;
|
|
193
208
|
}
|
|
209
|
+
type CancelablePromisifyFn<T extends AnyFn> = PromisifyFn<T> & {
|
|
210
|
+
cancel: () => void;
|
|
211
|
+
flush: () => void;
|
|
212
|
+
readonly isPending: Readonly<Ref<boolean>>;
|
|
213
|
+
};
|
|
194
214
|
/**
|
|
195
215
|
* @internal
|
|
196
216
|
*/
|
|
197
|
-
declare function createFilterWrapper<T extends AnyFn>(filter:
|
|
217
|
+
declare function createFilterWrapper<T extends AnyFn>(filter: CancelableEventFilter, fn: T): CancelablePromisifyFn<T>;
|
|
218
|
+
declare function createFilterWrapper<T extends AnyFn>(filter: EventFilter, fn: T): PromisifyFn<T>;
|
|
198
219
|
declare const bypassFilter: EventFilter;
|
|
199
220
|
/**
|
|
200
221
|
* Create an EventFilter that debounce the events
|
|
201
222
|
*/
|
|
202
|
-
declare function debounceFilter(ms: MaybeRefOrGetter<number>, options?: DebounceFilterOptions):
|
|
223
|
+
declare function debounceFilter(ms: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): CancelableEventFilter;
|
|
203
224
|
interface ThrottleFilterOptions {
|
|
204
225
|
/**
|
|
205
226
|
* The maximum time allowed to be delayed before it's invoked.
|
|
@@ -304,7 +325,7 @@ declare const timestamp: () => number;
|
|
|
304
325
|
declare const clamp: (n: number, min: number, max: number) => number;
|
|
305
326
|
declare const noop: () => void;
|
|
306
327
|
declare const rand: (min: number, max: number) => number;
|
|
307
|
-
declare const hasOwn: <T extends object, K
|
|
328
|
+
declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
|
|
308
329
|
declare const isIOS: boolean;
|
|
309
330
|
//#endregion
|
|
310
331
|
//#region utils/port.d.ts
|
|
@@ -315,7 +336,7 @@ declare const camelize: (str: string) => string;
|
|
|
315
336
|
declare function getLifeCycleTarget(target?: ComponentInternalInstance | null): ComponentInternalInstance | null;
|
|
316
337
|
//#endregion
|
|
317
338
|
//#region createGlobalState/index.d.ts
|
|
318
|
-
type CreateGlobalStateReturn<Fn
|
|
339
|
+
type CreateGlobalStateReturn<Fn extends AnyFn = AnyFn> = Fn;
|
|
319
340
|
/**
|
|
320
341
|
* Keep states in the global scope to be reusable across Vue instances.
|
|
321
342
|
*
|
|
@@ -324,23 +345,23 @@ type CreateGlobalStateReturn<Fn$1 extends AnyFn = AnyFn> = Fn$1;
|
|
|
324
345
|
*
|
|
325
346
|
* @__NO_SIDE_EFFECTS__
|
|
326
347
|
*/
|
|
327
|
-
declare function createGlobalState<Fn
|
|
348
|
+
declare function createGlobalState<Fn extends AnyFn>(stateFactory: Fn): CreateGlobalStateReturn<Fn>;
|
|
328
349
|
//#endregion
|
|
329
350
|
//#region createInjectionState/index.d.ts
|
|
330
|
-
type CreateInjectionStateReturn<Arguments extends Array<any>,
|
|
351
|
+
type CreateInjectionStateReturn<Arguments extends Array<any>, ProvideReturn, InjectReturn> = Readonly<[
|
|
331
352
|
/**
|
|
332
353
|
* Call this function in a provider component to create and provide the state.
|
|
333
354
|
*
|
|
334
355
|
* @param args Arguments passed to the composable
|
|
335
356
|
* @returns The state returned by the composable
|
|
336
357
|
*/
|
|
337
|
-
useProvidingState: (...args: Arguments) =>
|
|
358
|
+
useProvidingState: (...args: Arguments) => ProvideReturn,
|
|
338
359
|
/**
|
|
339
360
|
* Call this function in a consumer component to inject the state.
|
|
340
361
|
*
|
|
341
362
|
* @returns The injected state, or `undefined` if not provided and no default value was set.
|
|
342
363
|
*/
|
|
343
|
-
useInjectedState: () =>
|
|
364
|
+
useInjectedState: () => InjectReturn]>;
|
|
344
365
|
interface CreateInjectionStateOptions<Return> {
|
|
345
366
|
/**
|
|
346
367
|
* Custom injectionKey for InjectionState
|
|
@@ -358,7 +379,10 @@ interface CreateInjectionStateOptions<Return> {
|
|
|
358
379
|
*
|
|
359
380
|
* @__NO_SIDE_EFFECTS__
|
|
360
381
|
*/
|
|
361
|
-
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options
|
|
382
|
+
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options: {
|
|
383
|
+
defaultValue: Return;
|
|
384
|
+
} & CreateInjectionStateOptions<Return>): CreateInjectionStateReturn<Arguments, Return, Return>;
|
|
385
|
+
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options?: CreateInjectionStateOptions<Return>): CreateInjectionStateReturn<Arguments, Return, Return | undefined>;
|
|
362
386
|
//#endregion
|
|
363
387
|
//#region createRef/index.d.ts
|
|
364
388
|
type CreateRefReturn<T = any, D extends boolean = false> = ShallowOrDeepRef<T, D>;
|
|
@@ -389,7 +413,7 @@ type SharedComposableReturn<T extends AnyFn = AnyFn> = T;
|
|
|
389
413
|
*
|
|
390
414
|
* @__NO_SIDE_EFFECTS__
|
|
391
415
|
*/
|
|
392
|
-
declare function createSharedComposable<Fn
|
|
416
|
+
declare function createSharedComposable<Fn extends AnyFn>(composable: Fn): SharedComposableReturn<Fn>;
|
|
393
417
|
//#endregion
|
|
394
418
|
//#region extendRef/index.d.ts
|
|
395
419
|
type ExtendRefReturn<T = any> = Ref<T>;
|
|
@@ -410,18 +434,18 @@ interface ExtendRefOptions<Unwrap extends boolean = boolean> {
|
|
|
410
434
|
/**
|
|
411
435
|
* Overload 1: Unwrap set to false
|
|
412
436
|
*/
|
|
413
|
-
declare function extendRef<R
|
|
437
|
+
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
438
|
/**
|
|
415
439
|
* Overload 2: Unwrap unset or set to true
|
|
416
440
|
*/
|
|
417
|
-
declare function extendRef<R
|
|
441
|
+
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
|
|
418
442
|
//#endregion
|
|
419
443
|
//#region get/index.d.ts
|
|
420
444
|
/**
|
|
421
445
|
* Shorthand for accessing `ref.value`
|
|
422
446
|
*/
|
|
423
447
|
declare function get<T>(ref: MaybeRef<T>): T;
|
|
424
|
-
declare function get<T, K
|
|
448
|
+
declare function get<T, K extends keyof T>(ref: MaybeRef<T>, key: K): T[K];
|
|
425
449
|
//#endregion
|
|
426
450
|
//#region injectLocal/index.d.ts
|
|
427
451
|
/**
|
|
@@ -444,7 +468,7 @@ declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>
|
|
|
444
468
|
declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>;
|
|
445
469
|
//#endregion
|
|
446
470
|
//#region makeDestructurable/index.d.ts
|
|
447
|
-
declare function makeDestructurable<T extends Record<string, unknown>, A
|
|
471
|
+
declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: A): T & A;
|
|
448
472
|
//#endregion
|
|
449
473
|
//#region provideLocal/map.d.ts
|
|
450
474
|
type LocalProvidedKey<T> = InjectionKey<T> | string | number;
|
|
@@ -460,11 +484,11 @@ type ProvideLocalReturn = void;
|
|
|
460
484
|
* const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
|
|
461
485
|
* ```
|
|
462
486
|
*/
|
|
463
|
-
declare function provideLocal<T, K
|
|
487
|
+
declare function provideLocal<T, K = LocalProvidedKey<T>>(key: K, value: K extends InjectionKey<infer V> ? V : T): ProvideLocalReturn;
|
|
464
488
|
//#endregion
|
|
465
489
|
//#region reactify/index.d.ts
|
|
466
|
-
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]
|
|
467
|
-
type ReactifyReturn<T extends AnyFn = AnyFn, K
|
|
490
|
+
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;
|
|
491
|
+
type ReactifyReturn<T extends AnyFn = AnyFn, K extends boolean = true> = Reactified<T, K>;
|
|
468
492
|
interface ReactifyOptions<T extends boolean> {
|
|
469
493
|
/**
|
|
470
494
|
* Accept passing a function as a reactive getter
|
|
@@ -483,13 +507,13 @@ interface ReactifyOptions<T extends boolean> {
|
|
|
483
507
|
*
|
|
484
508
|
* @__NO_SIDE_EFFECTS__
|
|
485
509
|
*/
|
|
486
|
-
declare function reactify<T extends AnyFn, K
|
|
510
|
+
declare function reactify<T extends AnyFn, K extends boolean = true>(fn: T, options?: ReactifyOptions<K>): ReactifyReturn<T, K>;
|
|
487
511
|
/** @deprecated use `reactify` instead */
|
|
488
512
|
declare const createReactiveFn: typeof reactify;
|
|
489
513
|
//#endregion
|
|
490
514
|
//#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
|
|
515
|
+
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]; };
|
|
516
|
+
type ReactifyObjectReturn<T, Keys extends keyof T, S extends boolean = true> = ReactifyNested<T, Keys, S>;
|
|
493
517
|
interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
|
|
494
518
|
/**
|
|
495
519
|
* Includes names from Object.getOwnPropertyNames
|
|
@@ -504,7 +528,7 @@ interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
|
|
|
504
528
|
* @__NO_SIDE_EFFECTS__
|
|
505
529
|
*/
|
|
506
530
|
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
|
|
531
|
+
declare function reactifyObject<T extends object, S extends boolean = true>(obj: T, options?: ReactifyObjectOptions<S>): ReactifyObjectReturn<T, keyof T, S>;
|
|
508
532
|
//#endregion
|
|
509
533
|
//#region reactiveComputed/index.d.ts
|
|
510
534
|
type ReactiveComputedReturn<T extends object> = UnwrapNestedRefs<T>;
|
|
@@ -514,15 +538,15 @@ type ReactiveComputedReturn<T extends object> = UnwrapNestedRefs<T>;
|
|
|
514
538
|
declare function reactiveComputed<T extends object>(fn: ComputedGetter<T>): ReactiveComputedReturn<T>;
|
|
515
539
|
//#endregion
|
|
516
540
|
//#region reactiveOmit/index.d.ts
|
|
517
|
-
type ReactiveOmitReturn<T extends object, K
|
|
541
|
+
type ReactiveOmitReturn<T extends object, K extends keyof T | undefined = undefined> = [K] extends [undefined] ? Partial<T> : Omit<T, Extract<K, keyof T>>;
|
|
518
542
|
type ReactiveOmitPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
519
|
-
declare function reactiveOmit<T extends object, K
|
|
543
|
+
declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): ReactiveOmitReturn<T, K>;
|
|
520
544
|
declare function reactiveOmit<T extends object>(obj: T, predicate: ReactiveOmitPredicate<T>): ReactiveOmitReturn<T>;
|
|
521
545
|
//#endregion
|
|
522
546
|
//#region reactivePick/index.d.ts
|
|
523
|
-
type ReactivePickReturn<T extends object, K
|
|
547
|
+
type ReactivePickReturn<T extends object, K extends keyof T> = { [S in K]: UnwrapRef<T[S]>; };
|
|
524
548
|
type ReactivePickPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
525
|
-
declare function reactivePick<T extends object, K
|
|
549
|
+
declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): ReactivePickReturn<T, K>;
|
|
526
550
|
declare function reactivePick<T extends object>(obj: T, predicate: ReactivePickPredicate<T>): ReactivePickReturn<T, keyof T>;
|
|
527
551
|
//#endregion
|
|
528
552
|
//#region refAutoReset/index.d.ts
|
|
@@ -614,63 +638,63 @@ interface ControlledRefOptions<T> {
|
|
|
614
638
|
*
|
|
615
639
|
* @__NO_SIDE_EFFECTS__
|
|
616
640
|
*/
|
|
617
|
-
declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>):
|
|
641
|
+
declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>): {
|
|
618
642
|
get: (tracking?: boolean) => T;
|
|
619
643
|
set: (value: T, triggering?: boolean) => void;
|
|
620
644
|
untrackedGet: () => T;
|
|
621
645
|
silentSet: (v: T) => void;
|
|
622
646
|
peek: () => T;
|
|
623
647
|
lay: (v: T) => void;
|
|
624
|
-
}
|
|
648
|
+
} & import("vue").Ref<T, T>;
|
|
625
649
|
/** @deprecated use `refWithControl` instead */
|
|
626
650
|
declare const controlledRef: typeof refWithControl;
|
|
627
651
|
//#endregion
|
|
628
652
|
//#region set/index.d.ts
|
|
629
653
|
declare function set<T>(ref: Ref<T>, value: T): void;
|
|
630
|
-
declare function set<O extends object, K
|
|
654
|
+
declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
|
|
631
655
|
//#endregion
|
|
632
656
|
//#region syncRef/index.d.ts
|
|
633
657
|
type Direction = 'ltr' | 'rtl' | 'both';
|
|
634
|
-
type SpecificFieldPartial<T, K
|
|
658
|
+
type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
|
|
635
659
|
/**
|
|
636
660
|
* A = B
|
|
637
661
|
*/
|
|
638
|
-
type Equal<A
|
|
662
|
+
type Equal<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
|
|
639
663
|
/**
|
|
640
664
|
* A ∩ B ≠ ∅
|
|
641
665
|
*/
|
|
642
|
-
type IntersectButNotEqual<A
|
|
666
|
+
type IntersectButNotEqual<A, B> = Equal<A, B> extends true ? false : A & B extends never ? false : true;
|
|
643
667
|
/**
|
|
644
668
|
* A ⊆ B
|
|
645
669
|
*/
|
|
646
|
-
type IncludeButNotEqual<A
|
|
670
|
+
type IncludeButNotEqual<A, B> = Equal<A, B> extends true ? false : A extends B ? true : false;
|
|
647
671
|
/**
|
|
648
672
|
* A ∩ B = ∅
|
|
649
673
|
*/
|
|
650
|
-
type NotIntersect<A
|
|
651
|
-
interface EqualType<D extends Direction, L, R
|
|
652
|
-
transform?: SpecificFieldPartial<Pick<Transform<L, R
|
|
674
|
+
type NotIntersect<A, B> = Equal<A, B> extends true ? false : A & B extends never ? true : false;
|
|
675
|
+
interface EqualType<D extends Direction, L, R, O extends keyof Transform<L, R> = D extends 'both' ? 'ltr' | 'rtl' : D> {
|
|
676
|
+
transform?: SpecificFieldPartial<Pick<Transform<L, R>, O>, O>;
|
|
653
677
|
}
|
|
654
|
-
type StrictIncludeMap<IncludeType extends 'LR' | 'RL', D extends Exclude<Direction, 'both'>, L, R
|
|
655
|
-
transform?: SpecificFieldPartial<Pick<Transform<L, R
|
|
678
|
+
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 ? {
|
|
679
|
+
transform?: SpecificFieldPartial<Pick<Transform<L, R>, D>, D>;
|
|
656
680
|
} : {
|
|
657
|
-
transform: Pick<Transform<L, R
|
|
681
|
+
transform: Pick<Transform<L, R>, D>;
|
|
658
682
|
};
|
|
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
|
|
683
|
+
type StrictIncludeType<IncludeType extends 'LR' | 'RL', D extends Direction, L, R> = D extends 'both' ? {
|
|
684
|
+
transform: SpecificFieldPartial<Transform<L, R>, IncludeType extends 'LR' ? 'ltr' : 'rtl'>;
|
|
685
|
+
} : D extends Exclude<Direction, 'both'> ? StrictIncludeMap<IncludeType, D, L, R> : never;
|
|
686
|
+
type IntersectButNotEqualType<D extends Direction, L, R> = D extends 'both' ? {
|
|
687
|
+
transform: Transform<L, R>;
|
|
664
688
|
} : D extends Exclude<Direction, 'both'> ? {
|
|
665
|
-
transform: Pick<Transform<L, R
|
|
689
|
+
transform: Pick<Transform<L, R>, D>;
|
|
666
690
|
} : never;
|
|
667
|
-
type NotIntersectType<D extends Direction, L, R
|
|
668
|
-
interface Transform<L, R
|
|
669
|
-
ltr: (left: L) => R
|
|
670
|
-
rtl: (right: R
|
|
691
|
+
type NotIntersectType<D extends Direction, L, R> = IntersectButNotEqualType<D, L, R>;
|
|
692
|
+
interface Transform<L, R> {
|
|
693
|
+
ltr: (left: L) => R;
|
|
694
|
+
rtl: (right: R) => L;
|
|
671
695
|
}
|
|
672
|
-
type TransformType<D extends Direction, L, R
|
|
673
|
-
type SyncRefOptions<L, R
|
|
696
|
+
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;
|
|
697
|
+
type SyncRefOptions<L, R, D extends Direction> = ConfigurableFlushSync & {
|
|
674
698
|
/**
|
|
675
699
|
* Watch deeply
|
|
676
700
|
*
|
|
@@ -689,7 +713,7 @@ type SyncRefOptions<L, R$1, D extends Direction> = ConfigurableFlushSync & {
|
|
|
689
713
|
* @default 'both'
|
|
690
714
|
*/
|
|
691
715
|
direction?: D;
|
|
692
|
-
} & TransformType<D, L, R
|
|
716
|
+
} & TransformType<D, L, R>;
|
|
693
717
|
/**
|
|
694
718
|
* Two-way refs synchronization.
|
|
695
719
|
* From the set theory perspective to restrict the option's type
|
|
@@ -699,7 +723,7 @@ type SyncRefOptions<L, R$1, D extends Direction> = ConfigurableFlushSync & {
|
|
|
699
723
|
* 3. L ⊆ R
|
|
700
724
|
* 4. L ∩ R = ∅
|
|
701
725
|
*/
|
|
702
|
-
declare function syncRef<L, R
|
|
726
|
+
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
727
|
//#endregion
|
|
704
728
|
//#region syncRefs/index.d.ts
|
|
705
729
|
interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
@@ -722,7 +746,7 @@ interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
|
722
746
|
* @param source source ref
|
|
723
747
|
* @param targets
|
|
724
748
|
*/
|
|
725
|
-
declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions):
|
|
749
|
+
declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions): import("vue").WatchHandle;
|
|
726
750
|
//#endregion
|
|
727
751
|
//#region toReactive/index.d.ts
|
|
728
752
|
/**
|
|
@@ -741,8 +765,8 @@ declare function toRef<T>(r: () => T): Readonly<Ref<T>>;
|
|
|
741
765
|
declare function toRef<T>(r: ComputedRef<T>): ComputedRef<T>;
|
|
742
766
|
declare function toRef<T>(r: MaybeRefOrGetter<T>): Ref<T>;
|
|
743
767
|
declare function toRef<T>(r: T): Ref<T>;
|
|
744
|
-
declare function toRef<T extends object, K
|
|
745
|
-
declare function toRef<T extends object, K
|
|
768
|
+
declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
|
769
|
+
declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
|
|
746
770
|
//#endregion
|
|
747
771
|
//#region toRefs/index.d.ts
|
|
748
772
|
interface ToRefsOptions {
|
|
@@ -831,14 +855,14 @@ interface UntilToMatchOptions extends ConfigurableFlushSync {
|
|
|
831
855
|
deep?: WatchOptions['deep'];
|
|
832
856
|
}
|
|
833
857
|
interface UntilBaseInstance<T, Not extends boolean = false> {
|
|
834
|
-
toMatch: (<U
|
|
858
|
+
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
859
|
changed: (options?: UntilToMatchOptions) => Promise<T>;
|
|
836
860
|
changedTimes: (n?: number, options?: UntilToMatchOptions) => Promise<T>;
|
|
837
861
|
}
|
|
838
862
|
type Falsy = false | void | null | undefined | 0 | 0n | '';
|
|
839
863
|
interface UntilValueInstance<T, Not extends boolean = false> extends UntilBaseInstance<T, Not> {
|
|
840
864
|
readonly not: UntilValueInstance<T, Not extends true ? false : true>;
|
|
841
|
-
toBe: <P
|
|
865
|
+
toBe: <P = T>(value: MaybeRefOrGetter<P>, options?: UntilToMatchOptions) => Not extends true ? Promise<T> : Promise<P>;
|
|
842
866
|
toBeTruthy: (options?: UntilToMatchOptions) => Not extends true ? Promise<T & Falsy> : Promise<Exclude<T, Falsy>>;
|
|
843
867
|
toBeNull: (options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, null>> : Promise<null>;
|
|
844
868
|
toBeUndefined: (options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, undefined>> : Promise<undefined>;
|
|
@@ -906,7 +930,7 @@ type UseArrayFilterReturn<T = any> = ComputedRef<T[]>;
|
|
|
906
930
|
*
|
|
907
931
|
* @__NO_SIDE_EFFECTS__
|
|
908
932
|
*/
|
|
909
|
-
declare function useArrayFilter<T, S
|
|
933
|
+
declare function useArrayFilter<T, S extends T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => element is S): UseArrayFilterReturn<S>;
|
|
910
934
|
declare function useArrayFilter<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => unknown): UseArrayFilterReturn<T>;
|
|
911
935
|
//#endregion
|
|
912
936
|
//#region useArrayFind/index.d.ts
|
|
@@ -955,10 +979,10 @@ type UseArrayFindLastReturn<T = any> = ComputedRef<T | undefined>;
|
|
|
955
979
|
declare function useArrayFindLast<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): UseArrayFindLastReturn<T>;
|
|
956
980
|
//#endregion
|
|
957
981
|
//#region useArrayIncludes/index.d.ts
|
|
958
|
-
type UseArrayIncludesComparatorFn<T, V
|
|
959
|
-
interface UseArrayIncludesOptions<T, V
|
|
982
|
+
type UseArrayIncludesComparatorFn<T, V> = ((element: T, value: V, index: number, array: MaybeRefOrGetter<T>[]) => boolean);
|
|
983
|
+
interface UseArrayIncludesOptions<T, V> {
|
|
960
984
|
fromIndex?: number;
|
|
961
|
-
comparator?: UseArrayIncludesComparatorFn<T, V
|
|
985
|
+
comparator?: UseArrayIncludesComparatorFn<T, V> | keyof T;
|
|
962
986
|
}
|
|
963
987
|
type UseArrayIncludesReturn = ComputedRef<boolean>;
|
|
964
988
|
/**
|
|
@@ -970,9 +994,9 @@ type UseArrayIncludesReturn = ComputedRef<boolean>;
|
|
|
970
994
|
*
|
|
971
995
|
* @__NO_SIDE_EFFECTS__
|
|
972
996
|
*/
|
|
973
|
-
declare function useArrayIncludes<T, V
|
|
974
|
-
declare function useArrayIncludes<T, V
|
|
975
|
-
declare function useArrayIncludes<T, V
|
|
997
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: UseArrayIncludesComparatorFn<T, V>): UseArrayIncludesReturn;
|
|
998
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: keyof T): UseArrayIncludesReturn;
|
|
999
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, options?: UseArrayIncludesOptions<T, V>): UseArrayIncludesReturn;
|
|
976
1000
|
//#endregion
|
|
977
1001
|
//#region useArrayJoin/index.d.ts
|
|
978
1002
|
type UseArrayJoinReturn = ComputedRef<string>;
|
|
@@ -1002,10 +1026,10 @@ type UseArrayMapReturn<T = any> = ComputedRef<T[]>;
|
|
|
1002
1026
|
*
|
|
1003
1027
|
* @__NO_SIDE_EFFECTS__
|
|
1004
1028
|
*/
|
|
1005
|
-
declare function useArrayMap<T, U
|
|
1029
|
+
declare function useArrayMap<T, U = T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => U): UseArrayMapReturn<U>;
|
|
1006
1030
|
//#endregion
|
|
1007
1031
|
//#region useArrayReduce/index.d.ts
|
|
1008
|
-
type UseArrayReducer<PV, CV, R
|
|
1032
|
+
type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
|
|
1009
1033
|
type UseArrayReduceReturn<T = any> = ComputedRef<T>;
|
|
1010
1034
|
/**
|
|
1011
1035
|
* Reactive `Array.reduce`
|
|
@@ -1031,7 +1055,7 @@ declare function useArrayReduce<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>
|
|
|
1031
1055
|
*
|
|
1032
1056
|
* @__NO_SIDE_EFFECTS__
|
|
1033
1057
|
*/
|
|
1034
|
-
declare function useArrayReduce<T, U
|
|
1058
|
+
declare function useArrayReduce<T, U>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeRefOrGetter<U>): UseArrayReduceReturn<U>;
|
|
1035
1059
|
//#endregion
|
|
1036
1060
|
//#region useArraySome/index.d.ts
|
|
1037
1061
|
type UseArraySomeReturn = ComputedRef<boolean>;
|
|
@@ -1106,7 +1130,7 @@ interface UseCounterReturn {
|
|
|
1106
1130
|
* @param options
|
|
1107
1131
|
*/
|
|
1108
1132
|
declare function useCounter(initialValue?: MaybeRef<number>, options?: UseCounterOptions): {
|
|
1109
|
-
count: Readonly<Ref<number, number> |
|
|
1133
|
+
count: Readonly<Ref<number, number> | import("vue").ShallowRef<number, number> | import("vue").WritableComputedRef<number, number>>;
|
|
1110
1134
|
inc: (delta?: number) => number;
|
|
1111
1135
|
dec: (delta?: number) => number;
|
|
1112
1136
|
get: () => number;
|
|
@@ -1145,7 +1169,7 @@ type UseDateFormatReturn = ComputedRef<string>;
|
|
|
1145
1169
|
declare function useDateFormat(date: MaybeRefOrGetter<DateLike>, formatStr?: MaybeRefOrGetter<string>, options?: UseDateFormatOptions): UseDateFormatReturn;
|
|
1146
1170
|
//#endregion
|
|
1147
1171
|
//#region useDebounceFn/index.d.ts
|
|
1148
|
-
type UseDebounceFnReturn<T extends FunctionArgs> =
|
|
1172
|
+
type UseDebounceFnReturn<T extends FunctionArgs> = CancelablePromisifyFn<T>;
|
|
1149
1173
|
/**
|
|
1150
1174
|
* Debounce execution of a function.
|
|
1151
1175
|
*
|
|
@@ -1154,9 +1178,7 @@ type UseDebounceFnReturn<T extends FunctionArgs> = PromisifyFn<T>;
|
|
|
1154
1178
|
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
1155
1179
|
* @param options Options
|
|
1156
1180
|
*
|
|
1157
|
-
* @return A new,
|
|
1158
|
-
*
|
|
1159
|
-
* @__NO_SIDE_EFFECTS__
|
|
1181
|
+
* @return A new, debounced, function with isPending, cancel, and flush properties.
|
|
1160
1182
|
*/
|
|
1161
1183
|
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): UseDebounceFnReturn<T>;
|
|
1162
1184
|
//#endregion
|
|
@@ -1354,26 +1376,26 @@ declare function useToString(value: MaybeRefOrGetter<unknown>): ComputedRef<stri
|
|
|
1354
1376
|
//#region useToggle/index.d.ts
|
|
1355
1377
|
type ToggleFn = (value?: boolean) => void;
|
|
1356
1378
|
type UseToggleReturn = [ShallowRef<boolean>, ToggleFn] | ToggleFn;
|
|
1357
|
-
interface UseToggleOptions<Truthy, Falsy
|
|
1379
|
+
interface UseToggleOptions<Truthy, Falsy> {
|
|
1358
1380
|
truthyValue?: MaybeRefOrGetter<Truthy>;
|
|
1359
|
-
falsyValue?: MaybeRefOrGetter<Falsy
|
|
1381
|
+
falsyValue?: MaybeRefOrGetter<Falsy>;
|
|
1360
1382
|
}
|
|
1361
|
-
declare function useToggle<Truthy, Falsy
|
|
1362
|
-
declare function useToggle<Truthy = true, Falsy
|
|
1383
|
+
declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(initialValue: Ref<T>, options?: UseToggleOptions<Truthy, Falsy>): (value?: T) => T;
|
|
1384
|
+
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [ShallowRef<T>, (value?: T) => T];
|
|
1363
1385
|
//#endregion
|
|
1364
1386
|
//#region watchArray/index.d.ts
|
|
1365
|
-
declare type WatchArrayCallback<V
|
|
1387
|
+
declare type WatchArrayCallback<V = any, OV = any> = (value: V, oldValue: OV, added: V, removed: OV, onCleanup: (cleanupFn: () => void) => void) => any;
|
|
1366
1388
|
/**
|
|
1367
1389
|
* Watch for an array with additions and removals.
|
|
1368
1390
|
*
|
|
1369
1391
|
* @see https://vueuse.org/watchArray
|
|
1370
1392
|
*/
|
|
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>):
|
|
1393
|
+
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>): import("vue").WatchHandle;
|
|
1372
1394
|
//#endregion
|
|
1373
1395
|
//#region watchWithFilter/index.d.ts
|
|
1374
1396
|
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
1397
|
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;
|
|
1398
|
+
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
1399
|
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
1400
|
//#endregion
|
|
1379
1401
|
//#region watchAtMost/index.d.ts
|
|
@@ -1386,22 +1408,23 @@ interface WatchAtMostReturn {
|
|
|
1386
1408
|
resume: () => void;
|
|
1387
1409
|
count: ShallowRef<number>;
|
|
1388
1410
|
}
|
|
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
1411
|
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;
|
|
1412
|
+
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;
|
|
1413
|
+
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
1414
|
//#endregion
|
|
1392
1415
|
//#region watchDebounced/index.d.ts
|
|
1393
1416
|
interface WatchDebouncedOptions<Immediate> extends WatchOptions<Immediate>, DebounceFilterOptions {
|
|
1394
1417
|
debounce?: MaybeRefOrGetter<number>;
|
|
1395
1418
|
}
|
|
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
1419
|
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;
|
|
1420
|
+
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
1421
|
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
1422
|
/** @deprecated use `watchDebounced` instead */
|
|
1400
1423
|
declare const debouncedWatch: typeof watchDebounced;
|
|
1401
1424
|
//#endregion
|
|
1402
1425
|
//#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
1426
|
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;
|
|
1427
|
+
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
1428
|
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
1429
|
//#endregion
|
|
1407
1430
|
//#region watchIgnorable/index.d.ts
|
|
@@ -1412,20 +1435,20 @@ interface WatchIgnorableReturn {
|
|
|
1412
1435
|
ignorePrevAsyncUpdates: IgnoredPrevAsyncUpdates;
|
|
1413
1436
|
stop: WatchStopHandle;
|
|
1414
1437
|
}
|
|
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
1438
|
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;
|
|
1439
|
+
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
1440
|
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
1441
|
/** @deprecated use `watchIgnorable` instead */
|
|
1419
1442
|
declare const ignorableWatch: typeof watchIgnorable;
|
|
1420
1443
|
//#endregion
|
|
1421
1444
|
//#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
1445
|
declare function watchImmediate<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchHandle;
|
|
1446
|
+
declare function watchImmediate<T extends Readonly<MultiWatchSources$1>>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchHandle;
|
|
1424
1447
|
declare function watchImmediate<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchHandle;
|
|
1425
1448
|
//#endregion
|
|
1426
1449
|
//#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
1450
|
declare function watchOnce<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'once'>): WatchHandle;
|
|
1451
|
+
declare function watchOnce<T extends Readonly<MultiWatchSources$1>>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>, options?: Omit<WatchOptions<true>, 'once'>): WatchHandle;
|
|
1429
1452
|
declare function watchOnce<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'once'>): WatchHandle;
|
|
1430
1453
|
//#endregion
|
|
1431
1454
|
//#region watchPausable/index.d.ts
|
|
@@ -1434,10 +1457,10 @@ interface WatchPausableReturn extends Pausable {
|
|
|
1434
1457
|
}
|
|
1435
1458
|
type WatchPausableOptions<Immediate> = WatchWithFilterOptions<Immediate> & PausableFilterOptions;
|
|
1436
1459
|
/** @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
1460
|
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
1461
|
/** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
|
|
1462
|
+
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;
|
|
1463
|
+
/** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
|
|
1441
1464
|
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
1465
|
/** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
|
|
1443
1466
|
declare const pausableWatch: typeof watchPausable;
|
|
@@ -1448,8 +1471,8 @@ interface WatchThrottledOptions<Immediate> extends WatchOptions<Immediate> {
|
|
|
1448
1471
|
trailing?: boolean;
|
|
1449
1472
|
leading?: boolean;
|
|
1450
1473
|
}
|
|
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
1474
|
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;
|
|
1475
|
+
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
1476
|
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
1477
|
/** @deprecated use `watchThrottled` instead */
|
|
1455
1478
|
declare const throttledWatch: typeof watchThrottled;
|
|
@@ -1460,13 +1483,14 @@ interface WatchTriggerableReturn<FnReturnT = void> extends WatchIgnorableReturn
|
|
|
1460
1483
|
trigger: () => FnReturnT;
|
|
1461
1484
|
}
|
|
1462
1485
|
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>;
|
|
1486
|
+
type WatchTriggerableCallback<V = any, OV = any, R = void> = (value: V, oldValue: OV, onCleanup: OnCleanup) => R;
|
|
1465
1487
|
declare function watchTriggerable<T, FnReturnT>(source: WatchSource<T>, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1488
|
+
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
1489
|
declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1467
1490
|
//#endregion
|
|
1468
1491
|
//#region whenever/index.d.ts
|
|
1469
|
-
|
|
1492
|
+
type Truthy<T> = T extends false | null | undefined ? never : T;
|
|
1493
|
+
interface WheneverOptions<Immediate = boolean> extends WatchOptions<Immediate> {
|
|
1470
1494
|
/**
|
|
1471
1495
|
* Only trigger once when the condition is met
|
|
1472
1496
|
*
|
|
@@ -1481,6 +1505,7 @@ interface WheneverOptions extends WatchOptions {
|
|
|
1481
1505
|
*
|
|
1482
1506
|
* @see https://vueuse.org/whenever
|
|
1483
1507
|
*/
|
|
1484
|
-
declare function whenever<T>(source: WatchSource<T
|
|
1508
|
+
declare function whenever<T>(source: WatchSource<T>, cb: WatchCallback<Truthy<T>, T | undefined>, options?: WheneverOptions<true>): WatchHandle;
|
|
1509
|
+
declare function whenever<T>(source: WatchSource<T>, cb: WatchCallback<Truthy<T>, T>, options?: WheneverOptions<false>): WatchHandle;
|
|
1485
1510
|
//#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 };
|
|
1511
|
+
export { AnyFn, ArgumentsType, Arrayable, Awaitable, Awaited, CancelableEventFilter, CancelablePromisifyFn, 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 };
|