@vueuse/shared 14.0.0-alpha.0 → 14.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{index.d.mts → dist/index.d.ts} +614 -534
- package/dist/index.iife.js +2205 -0
- package/dist/index.iife.min.js +1 -0
- package/dist/index.js +2061 -0
- package/package.json +10 -12
- package/index.iife.js +0 -1765
- package/index.iife.min.js +0 -1
- package/index.mjs +0 -1642
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
|
+
import { ComputedGetter, ComputedRef, InjectionKey, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, ShallowUnwrapRef as ShallowUnwrapRef$1, ToRef, ToRefs, UnwrapNestedRefs, UnwrapRef, WatchCallback, WatchOptions, WatchOptionsBase, WatchSource, WatchStopHandle, WritableComputedOptions, WritableComputedRef, getCurrentInstance, inject } from "vue";
|
|
4
3
|
|
|
4
|
+
//#region computedEager/index.d.ts
|
|
5
5
|
type ComputedEagerOptions = WatchOptionsBase;
|
|
6
6
|
type ComputedEagerReturn<T = any> = Readonly<ShallowRef<T>>;
|
|
7
7
|
/**
|
|
@@ -15,25 +15,29 @@ type ComputedEagerReturn<T = any> = Readonly<ShallowRef<T>>;
|
|
|
15
15
|
* @returns readonly shallowRef
|
|
16
16
|
*/
|
|
17
17
|
declare function computedEager<T>(fn: () => T, options?: ComputedEagerOptions): ComputedEagerReturn<T>;
|
|
18
|
-
|
|
18
|
+
/** @deprecated use `computedEager` instead */
|
|
19
|
+
declare const eagerComputed: typeof computedEager;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region computedWithControl/index.d.ts
|
|
19
22
|
interface ComputedWithControlRefExtra {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
interface ComputedRefWithControl<T> extends ComputedRef<T>, ComputedWithControlRefExtra {
|
|
26
|
-
}
|
|
27
|
-
interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, ComputedWithControlRefExtra {
|
|
23
|
+
/**
|
|
24
|
+
* Force update the computed value.
|
|
25
|
+
*/
|
|
26
|
+
trigger: () => void;
|
|
28
27
|
}
|
|
28
|
+
interface ComputedRefWithControl<T> extends ComputedRef<T>, ComputedWithControlRefExtra {}
|
|
29
|
+
interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, ComputedWithControlRefExtra {}
|
|
29
30
|
type ComputedWithControlRef<T = any> = ComputedRefWithControl<T> | WritableComputedRefWithControl<T>;
|
|
30
31
|
declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: ComputedGetter<T>, options?: WatchOptions): ComputedRefWithControl<T>;
|
|
31
32
|
declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: WritableComputedOptions<T>, options?: WatchOptions): WritableComputedRefWithControl<T>;
|
|
32
|
-
|
|
33
|
+
/** @deprecated use `computedWithControl` instead */
|
|
34
|
+
declare const controlledComputed: typeof computedWithControl;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region utils/types.d.ts
|
|
33
37
|
/**
|
|
34
38
|
* Void function
|
|
35
39
|
*/
|
|
36
|
-
type Fn = () => void;
|
|
40
|
+
type Fn$1 = () => void;
|
|
37
41
|
/**
|
|
38
42
|
* Any function
|
|
39
43
|
*/
|
|
@@ -42,8 +46,8 @@ type AnyFn = (...args: any[]) => any;
|
|
|
42
46
|
* A ref that allow to set null or undefined
|
|
43
47
|
*/
|
|
44
48
|
type RemovableRef<T> = Omit<Ref<T>, 'value'> & {
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
get value(): T;
|
|
50
|
+
set value(value: T | null | undefined);
|
|
47
51
|
};
|
|
48
52
|
/**
|
|
49
53
|
* Maybe it's a computed ref, or a readonly value, or a getter function
|
|
@@ -58,9 +62,7 @@ type ReadonlyRefOrGetter<T> = ComputedRef<T> | (() => T);
|
|
|
58
62
|
* UnwrapRef<DeepMaybeRef<T>> === T
|
|
59
63
|
* ```
|
|
60
64
|
*/
|
|
61
|
-
type DeepMaybeRef<T> = T extends Ref<infer V> ? MaybeRef<V> : T extends Array<any> | object ? {
|
|
62
|
-
[K in keyof T]: DeepMaybeRef<T[K]>;
|
|
63
|
-
} : MaybeRef<T>;
|
|
65
|
+
type DeepMaybeRef<T> = T extends Ref<infer V> ? MaybeRef<V> : T extends Array<any> | object ? { [K in keyof T]: DeepMaybeRef<T[K]> } : MaybeRef<T>;
|
|
64
66
|
type Arrayable<T> = T[] | T;
|
|
65
67
|
/**
|
|
66
68
|
* Infers the element type of an array
|
|
@@ -68,70 +70,64 @@ type Arrayable<T> = T[] | T;
|
|
|
68
70
|
type ElementOf<T> = T extends (infer E)[] ? E : never;
|
|
69
71
|
type ShallowUnwrapRef<T> = T extends Ref<infer P> ? P : T;
|
|
70
72
|
type Awaitable<T> = Promise<T> | T;
|
|
71
|
-
type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
73
|
+
type ArgumentsType<T> = T extends ((...args: infer U) => any) ? U : never;
|
|
72
74
|
/**
|
|
73
75
|
* Compatible with versions below TypeScript 4.5 Awaited
|
|
74
76
|
*/
|
|
75
77
|
type Awaited<T> = T extends null | undefined ? T : T extends object & {
|
|
76
|
-
|
|
78
|
+
then: (onfulfilled: infer F, ...args: infer _) => any;
|
|
77
79
|
} ? F extends ((value: infer V, ...args: infer _) => any) ? Awaited<V> : never : T;
|
|
78
80
|
type Promisify<T> = Promise<Awaited<T>>;
|
|
79
81
|
type PromisifyFn<T extends AnyFn> = (...args: ArgumentsType<T>) => Promisify<ReturnType<T>>;
|
|
80
82
|
interface Pausable {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
/**
|
|
84
|
+
* A ref indicate whether a pausable instance is active
|
|
85
|
+
*/
|
|
86
|
+
readonly isActive: Readonly<ShallowRef<boolean>>;
|
|
87
|
+
/**
|
|
88
|
+
* Temporary pause the effect from executing
|
|
89
|
+
*/
|
|
90
|
+
pause: Fn$1;
|
|
91
|
+
/**
|
|
92
|
+
* Resume the effects
|
|
93
|
+
*/
|
|
94
|
+
resume: Fn$1;
|
|
93
95
|
}
|
|
94
96
|
interface Stoppable<StartFnArgs extends any[] = any[]> {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
97
|
+
/**
|
|
98
|
+
* A ref indicate whether a stoppable instance is executing
|
|
99
|
+
*/
|
|
100
|
+
readonly isPending: Readonly<Ref<boolean>>;
|
|
101
|
+
/**
|
|
102
|
+
* Stop the effect from executing
|
|
103
|
+
*/
|
|
104
|
+
stop: Fn$1;
|
|
105
|
+
/**
|
|
106
|
+
* Start the effects
|
|
107
|
+
*/
|
|
108
|
+
start: (...args: StartFnArgs) => void;
|
|
107
109
|
}
|
|
108
110
|
interface ConfigurableFlush {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Timing for monitoring changes, refer to WatchOptions for more details
|
|
113
|
+
*
|
|
114
|
+
* @default 'pre'
|
|
115
|
+
*/
|
|
116
|
+
flush?: WatchOptions['flush'];
|
|
115
117
|
}
|
|
116
118
|
interface ConfigurableFlushSync {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Timing for monitoring changes, refer to WatchOptions for more details.
|
|
121
|
+
* Unlike `watch()`, the default is set to `sync`
|
|
122
|
+
*
|
|
123
|
+
* @default 'sync'
|
|
124
|
+
*/
|
|
125
|
+
flush?: WatchOptions['flush'];
|
|
124
126
|
}
|
|
125
127
|
type MultiWatchSources = (WatchSource<unknown> | object)[];
|
|
126
|
-
type MapSources<T> = {
|
|
127
|
-
|
|
128
|
-
};
|
|
129
|
-
type MapOldSources<T, Immediate> = {
|
|
130
|
-
[K in keyof T]: T[K] extends WatchSource<infer V> ? Immediate extends true ? V | undefined : V : never;
|
|
131
|
-
};
|
|
132
|
-
type Mutable<T> = {
|
|
133
|
-
-readonly [P in keyof T]: T[P];
|
|
134
|
-
};
|
|
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] };
|
|
135
131
|
type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
|
|
136
132
|
/**
|
|
137
133
|
* will return `true` if `T` is `any`, or `false` otherwise
|
|
@@ -141,25 +137,20 @@ type IsAny<T> = IfAny<T, true, false>;
|
|
|
141
137
|
* Universal timer handle that works in both browser and Node.js environments
|
|
142
138
|
*/
|
|
143
139
|
type TimerHandle = ReturnType<typeof setTimeout> | undefined;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
*/
|
|
149
|
-
|
|
150
|
-
type Callback<T> = IsAny<T> extends true ? (...param: any) => void : ([
|
|
151
|
-
T
|
|
152
|
-
] extends [void] ? (...param: unknown[]) => void : [T] extends [any[]] ? (...param: T) => void : (...param: [T, ...unknown[]]) => void);
|
|
140
|
+
type InstanceProxy = NonNullable<NonNullable<ReturnType<typeof getCurrentInstance>>['proxy']>;
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region createEventHook/index.d.ts
|
|
143
|
+
type Callback<T> = IsAny<T> extends true ? (...param: any) => void : ([T] extends [void] ? (...param: unknown[]) => void : [T] extends [any[]] ? (...param: T) => void : (...param: [T, ...unknown[]]) => void);
|
|
153
144
|
type EventHookOn<T = any> = (fn: Callback<T>) => {
|
|
154
|
-
|
|
145
|
+
off: () => void;
|
|
155
146
|
};
|
|
156
147
|
type EventHookOff<T = any> = (fn: Callback<T>) => void;
|
|
157
148
|
type EventHookTrigger<T = any> = (...param: Parameters<Callback<T>>) => Promise<unknown[]>;
|
|
158
149
|
interface EventHook<T = any> {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
150
|
+
on: EventHookOn<T>;
|
|
151
|
+
off: EventHookOff<T>;
|
|
152
|
+
trigger: EventHookTrigger<T>;
|
|
153
|
+
clear: () => void;
|
|
163
154
|
}
|
|
164
155
|
type EventHookReturn<T> = EventHook<T>;
|
|
165
156
|
/**
|
|
@@ -170,34 +161,35 @@ type EventHookReturn<T> = EventHook<T>;
|
|
|
170
161
|
* @__NO_SIDE_EFFECTS__
|
|
171
162
|
*/
|
|
172
163
|
declare function createEventHook<T = any>(): EventHookReturn<T>;
|
|
173
|
-
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region utils/filters.d.ts
|
|
174
166
|
type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
|
|
175
167
|
interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
168
|
+
fn: FunctionArgs<Args, This>;
|
|
169
|
+
args: Args;
|
|
170
|
+
thisArg: This;
|
|
179
171
|
}
|
|
180
172
|
type EventFilter<Args extends any[] = any[], This = any, Invoke extends AnyFn = AnyFn> = (invoke: Invoke, options: FunctionWrapperOptions<Args, This>) => ReturnType<Invoke> | Promisify<ReturnType<Invoke>>;
|
|
181
173
|
interface ConfigurableEventFilter {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
174
|
+
/**
|
|
175
|
+
* Filter for if events should to be received.
|
|
176
|
+
*
|
|
177
|
+
* @see https://vueuse.org/guide/config.html#event-filters
|
|
178
|
+
*/
|
|
179
|
+
eventFilter?: EventFilter;
|
|
188
180
|
}
|
|
189
181
|
interface DebounceFilterOptions {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
182
|
+
/**
|
|
183
|
+
* The maximum time allowed to be delayed before it's invoked.
|
|
184
|
+
* In milliseconds.
|
|
185
|
+
*/
|
|
186
|
+
maxWait?: MaybeRefOrGetter<number>;
|
|
187
|
+
/**
|
|
188
|
+
* Whether to reject the last call if it's been cancel.
|
|
189
|
+
*
|
|
190
|
+
* @default false
|
|
191
|
+
*/
|
|
192
|
+
rejectOnCancel?: boolean;
|
|
201
193
|
}
|
|
202
194
|
/**
|
|
203
195
|
* @internal
|
|
@@ -209,22 +201,22 @@ declare const bypassFilter: EventFilter;
|
|
|
209
201
|
*/
|
|
210
202
|
declare function debounceFilter(ms: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): EventFilter<any[], any, AnyFn>;
|
|
211
203
|
interface ThrottleFilterOptions {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
204
|
+
/**
|
|
205
|
+
* The maximum time allowed to be delayed before it's invoked.
|
|
206
|
+
*/
|
|
207
|
+
delay: MaybeRefOrGetter<number>;
|
|
208
|
+
/**
|
|
209
|
+
* Whether to invoke on the trailing edge of the timeout.
|
|
210
|
+
*/
|
|
211
|
+
trailing?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Whether to invoke on the leading edge of the timeout.
|
|
214
|
+
*/
|
|
215
|
+
leading?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Whether to reject the last call if it's been cancel.
|
|
218
|
+
*/
|
|
219
|
+
rejectOnCancel?: boolean;
|
|
228
220
|
}
|
|
229
221
|
/**
|
|
230
222
|
* Create an EventFilter that throttle the events
|
|
@@ -232,12 +224,12 @@ interface ThrottleFilterOptions {
|
|
|
232
224
|
declare function throttleFilter(ms: MaybeRefOrGetter<number>, trailing?: boolean, leading?: boolean, rejectOnCancel?: boolean): EventFilter;
|
|
233
225
|
declare function throttleFilter(options: ThrottleFilterOptions): EventFilter;
|
|
234
226
|
interface PausableFilterOptions {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
227
|
+
/**
|
|
228
|
+
* The initial state
|
|
229
|
+
*
|
|
230
|
+
* @default 'active'
|
|
231
|
+
*/
|
|
232
|
+
initialState?: 'active' | 'paused';
|
|
241
233
|
}
|
|
242
234
|
/**
|
|
243
235
|
* EventFilter that gives extra controls to pause and resume the filter
|
|
@@ -246,18 +238,19 @@ interface PausableFilterOptions {
|
|
|
246
238
|
* @param options Options to configure the filter
|
|
247
239
|
*/
|
|
248
240
|
declare function pausableFilter(extendFilter?: EventFilter, options?: PausableFilterOptions): Pausable & {
|
|
249
|
-
|
|
241
|
+
eventFilter: EventFilter;
|
|
250
242
|
};
|
|
251
|
-
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region utils/general.d.ts
|
|
252
245
|
declare function promiseTimeout(ms: number, throwOnTimeout?: boolean, reason?: string): Promise<void>;
|
|
253
246
|
declare function identity<T>(arg: T): T;
|
|
254
247
|
interface SingletonPromiseReturn<T> {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
248
|
+
(): Promise<T>;
|
|
249
|
+
/**
|
|
250
|
+
* Reset current staled promise.
|
|
251
|
+
* await it to have proper shutdown.
|
|
252
|
+
*/
|
|
253
|
+
reset: () => Promise<void>;
|
|
261
254
|
}
|
|
262
255
|
/**
|
|
263
256
|
* Create singleton promise function
|
|
@@ -298,7 +291,8 @@ declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T
|
|
|
298
291
|
declare function objectEntries<T extends object>(obj: T): Array<[keyof T, T[keyof T]]>;
|
|
299
292
|
declare function toArray<T>(value: T | readonly T[]): readonly T[];
|
|
300
293
|
declare function toArray<T>(value: T | T[]): T[];
|
|
301
|
-
|
|
294
|
+
//#endregion
|
|
295
|
+
//#region utils/is.d.ts
|
|
302
296
|
declare const isClient: boolean;
|
|
303
297
|
declare const isWorker: boolean;
|
|
304
298
|
declare const isDef: <T = any>(val?: T) => val is T;
|
|
@@ -312,12 +306,15 @@ declare const noop: () => void;
|
|
|
312
306
|
declare const rand: (min: number, max: number) => number;
|
|
313
307
|
declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
|
|
314
308
|
declare const isIOS: boolean | "";
|
|
315
|
-
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region utils/port.d.ts
|
|
316
311
|
declare const hyphenate: (str: string) => string;
|
|
317
312
|
declare const camelize: (str: string) => string;
|
|
318
|
-
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region utils/vue.d.ts
|
|
319
315
|
declare function getLifeCycleTarget(target?: any): any;
|
|
320
|
-
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region createGlobalState/index.d.ts
|
|
321
318
|
type CreateGlobalStateReturn<Fn extends AnyFn = AnyFn> = Fn;
|
|
322
319
|
/**
|
|
323
320
|
* Keep states in the global scope to be reusable across Vue instances.
|
|
@@ -328,16 +325,17 @@ type CreateGlobalStateReturn<Fn extends AnyFn = AnyFn> = Fn;
|
|
|
328
325
|
* @__NO_SIDE_EFFECTS__
|
|
329
326
|
*/
|
|
330
327
|
declare function createGlobalState<Fn extends AnyFn>(stateFactory: Fn): CreateGlobalStateReturn<Fn>;
|
|
331
|
-
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region createInjectionState/index.d.ts
|
|
332
330
|
interface CreateInjectionStateOptions<Return> {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
331
|
+
/**
|
|
332
|
+
* Custom injectionKey for InjectionState
|
|
333
|
+
*/
|
|
334
|
+
injectionKey?: string | InjectionKey<Return>;
|
|
335
|
+
/**
|
|
336
|
+
* Default value for the InjectionState
|
|
337
|
+
*/
|
|
338
|
+
defaultValue?: Return;
|
|
341
339
|
}
|
|
342
340
|
/**
|
|
343
341
|
* Create global state that can be injected into components.
|
|
@@ -347,7 +345,8 @@ interface CreateInjectionStateOptions<Return> {
|
|
|
347
345
|
* @__NO_SIDE_EFFECTS__
|
|
348
346
|
*/
|
|
349
347
|
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options?: CreateInjectionStateOptions<Return>): readonly [useProvidingState: (...args: Arguments) => Return, useInjectedState: () => Return | undefined];
|
|
350
|
-
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region createRef/index.d.ts
|
|
351
350
|
type CreateRefReturn<T = any, D extends boolean = false> = ShallowOrDeepRef<T, D>;
|
|
352
351
|
type ShallowOrDeepRef<T = any, D extends boolean = false> = D extends true ? Ref<T> : ShallowRef<T>;
|
|
353
352
|
/**
|
|
@@ -366,7 +365,8 @@ type ShallowOrDeepRef<T = any, D extends boolean = false> = D extends true ? Ref
|
|
|
366
365
|
* @__NO_SIDE_EFFECTS__
|
|
367
366
|
*/
|
|
368
367
|
declare function createRef<T = any, D extends boolean = false>(value: T, deep?: D): CreateRefReturn<T, D>;
|
|
369
|
-
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region createSharedComposable/index.d.ts
|
|
370
370
|
type SharedComposableReturn<T extends AnyFn = AnyFn> = T;
|
|
371
371
|
/**
|
|
372
372
|
* Make a composable function usable with multiple Vue instances.
|
|
@@ -376,21 +376,22 @@ type SharedComposableReturn<T extends AnyFn = AnyFn> = T;
|
|
|
376
376
|
* @__NO_SIDE_EFFECTS__
|
|
377
377
|
*/
|
|
378
378
|
declare function createSharedComposable<Fn extends AnyFn>(composable: Fn): SharedComposableReturn<Fn>;
|
|
379
|
-
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region extendRef/index.d.ts
|
|
380
381
|
type ExtendRefReturn<T = any> = Ref<T>;
|
|
381
382
|
interface ExtendRefOptions<Unwrap extends boolean = boolean> {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
383
|
+
/**
|
|
384
|
+
* Is the extends properties enumerable
|
|
385
|
+
*
|
|
386
|
+
* @default false
|
|
387
|
+
*/
|
|
388
|
+
enumerable?: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* Unwrap for Ref properties
|
|
391
|
+
*
|
|
392
|
+
* @default true
|
|
393
|
+
*/
|
|
394
|
+
unwrap?: Unwrap;
|
|
394
395
|
}
|
|
395
396
|
/**
|
|
396
397
|
* Overload 1: Unwrap set to false
|
|
@@ -400,13 +401,15 @@ declare function extendRef<R extends Ref<any>, Extend extends object, Options ex
|
|
|
400
401
|
* Overload 2: Unwrap unset or set to true
|
|
401
402
|
*/
|
|
402
403
|
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
|
|
403
|
-
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region get/index.d.ts
|
|
404
406
|
/**
|
|
405
407
|
* Shorthand for accessing `ref.value`
|
|
406
408
|
*/
|
|
407
409
|
declare function get<T>(ref: MaybeRef<T>): T;
|
|
408
410
|
declare function get<T, K extends keyof T>(ref: MaybeRef<T>, key: K): T[K];
|
|
409
|
-
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region injectLocal/index.d.ts
|
|
410
413
|
/**
|
|
411
414
|
* On the basis of `inject`, it is allowed to directly call inject to obtain the value after call provide in the same component.
|
|
412
415
|
*
|
|
@@ -419,14 +422,20 @@ declare function get<T, K extends keyof T>(ref: MaybeRef<T>, key: K): T[K];
|
|
|
419
422
|
* @__NO_SIDE_EFFECTS__
|
|
420
423
|
*/
|
|
421
424
|
declare const injectLocal: typeof inject;
|
|
422
|
-
|
|
425
|
+
//#endregion
|
|
426
|
+
//#region isDefined/index.d.ts
|
|
423
427
|
type IsDefinedReturn = boolean;
|
|
424
428
|
declare function isDefined<T>(v: ComputedRef<T>): v is ComputedRef<Exclude<T, null | undefined>>;
|
|
425
429
|
declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>;
|
|
426
430
|
declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>;
|
|
427
|
-
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region makeDestructurable/index.d.ts
|
|
428
433
|
declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: A): T & A;
|
|
429
|
-
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region provideLocal/map.d.ts
|
|
436
|
+
type LocalProvidedKey<T> = InjectionKey<T> | string | number;
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region provideLocal/index.d.ts
|
|
430
439
|
type ProvideLocalReturn = void;
|
|
431
440
|
/**
|
|
432
441
|
* On the basis of `provide`, it is allowed to directly call inject to obtain the value after call provide in the same component.
|
|
@@ -437,19 +446,18 @@ type ProvideLocalReturn = void;
|
|
|
437
446
|
* const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
|
|
438
447
|
* ```
|
|
439
448
|
*/
|
|
440
|
-
declare function provideLocal<T, K =
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}) => ComputedRef<R> : never;
|
|
449
|
+
declare function provideLocal<T, K = LocalProvidedKey<T>>(key: K, value: K extends InjectionKey<infer V> ? V : T): ProvideLocalReturn;
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region reactify/index.d.ts
|
|
452
|
+
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;
|
|
445
453
|
type ReactifyReturn<T extends AnyFn = AnyFn, K extends boolean = true> = Reactified<T, K>;
|
|
446
454
|
interface ReactifyOptions<T extends boolean> {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
455
|
+
/**
|
|
456
|
+
* Accept passing a function as a reactive getter
|
|
457
|
+
*
|
|
458
|
+
* @default true
|
|
459
|
+
*/
|
|
460
|
+
computedGetter?: T;
|
|
453
461
|
}
|
|
454
462
|
/**
|
|
455
463
|
* Converts plain function into a reactive function.
|
|
@@ -462,18 +470,19 @@ interface ReactifyOptions<T extends boolean> {
|
|
|
462
470
|
* @__NO_SIDE_EFFECTS__
|
|
463
471
|
*/
|
|
464
472
|
declare function reactify<T extends AnyFn, K extends boolean = true>(fn: T, options?: ReactifyOptions<K>): ReactifyReturn<T, K>;
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
473
|
+
/** @deprecated use `reactify` instead */
|
|
474
|
+
declare const createReactiveFn: typeof reactify;
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region reactifyObject/index.d.ts
|
|
477
|
+
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] };
|
|
469
478
|
type ReactifyObjectReturn<T, Keys extends keyof T, S extends boolean = true> = ReactifyNested<T, Keys, S>;
|
|
470
479
|
interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
480
|
+
/**
|
|
481
|
+
* Includes names from Object.getOwnPropertyNames
|
|
482
|
+
*
|
|
483
|
+
* @default true
|
|
484
|
+
*/
|
|
485
|
+
includeOwnProperties?: boolean;
|
|
477
486
|
}
|
|
478
487
|
/**
|
|
479
488
|
* Apply `reactify` to an object
|
|
@@ -482,25 +491,27 @@ interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
|
|
|
482
491
|
*/
|
|
483
492
|
declare function reactifyObject<T extends object, Keys extends keyof T>(obj: T, keys?: (keyof T)[]): ReactifyObjectReturn<T, Keys, true>;
|
|
484
493
|
declare function reactifyObject<T extends object, S extends boolean = true>(obj: T, options?: ReactifyObjectOptions<S>): ReactifyObjectReturn<T, keyof T, S>;
|
|
485
|
-
|
|
494
|
+
//#endregion
|
|
495
|
+
//#region reactiveComputed/index.d.ts
|
|
486
496
|
type ReactiveComputedReturn<T extends object> = UnwrapNestedRefs<T>;
|
|
487
497
|
/**
|
|
488
498
|
* Computed reactive object.
|
|
489
499
|
*/
|
|
490
500
|
declare function reactiveComputed<T extends object>(fn: ComputedGetter<T>): ReactiveComputedReturn<T>;
|
|
491
|
-
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region reactiveOmit/index.d.ts
|
|
492
503
|
type ReactiveOmitReturn<T extends object, K extends keyof T | undefined = undefined> = [K] extends [undefined] ? Partial<T> : Omit<T, Extract<K, keyof T>>;
|
|
493
504
|
type ReactiveOmitPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
494
505
|
declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): ReactiveOmitReturn<T, K>;
|
|
495
506
|
declare function reactiveOmit<T extends object>(obj: T, predicate: ReactiveOmitPredicate<T>): ReactiveOmitReturn<T>;
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
};
|
|
507
|
+
//#endregion
|
|
508
|
+
//#region reactivePick/index.d.ts
|
|
509
|
+
type ReactivePickReturn<T extends object, K extends keyof T> = { [S in K]: UnwrapRef<T[S]> };
|
|
500
510
|
type ReactivePickPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
501
511
|
declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): ReactivePickReturn<T, K>;
|
|
502
512
|
declare function reactivePick<T extends object>(obj: T, predicate: ReactivePickPredicate<T>): ReactivePickReturn<T, keyof T>;
|
|
503
|
-
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region refAutoReset/index.d.ts
|
|
504
515
|
type RefAutoResetReturn<T = any> = Ref<T>;
|
|
505
516
|
/**
|
|
506
517
|
* Create a ref which will be reset to the default value after some time.
|
|
@@ -510,7 +521,10 @@ type RefAutoResetReturn<T = any> = Ref<T>;
|
|
|
510
521
|
* @param afterMs A zero-or-greater delay in milliseconds.
|
|
511
522
|
*/
|
|
512
523
|
declare function refAutoReset<T>(defaultValue: MaybeRefOrGetter<T>, afterMs?: MaybeRefOrGetter<number>): RefAutoResetReturn<T>;
|
|
513
|
-
|
|
524
|
+
/** @deprecated use `refAutoReset` instead */
|
|
525
|
+
declare const autoResetRef: typeof refAutoReset;
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region refDebounced/index.d.ts
|
|
514
528
|
type RefDebouncedReturn<T = any> = Readonly<Ref<T>>;
|
|
515
529
|
/**
|
|
516
530
|
* Debounce updates of a ref.
|
|
@@ -518,14 +532,38 @@ type RefDebouncedReturn<T = any> = Readonly<Ref<T>>;
|
|
|
518
532
|
* @return A new debounced ref.
|
|
519
533
|
*/
|
|
520
534
|
declare function refDebounced<T>(value: Ref<T>, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): RefDebouncedReturn<T>;
|
|
521
|
-
|
|
535
|
+
/** @deprecated use `refDebounced` instead */
|
|
536
|
+
declare const debouncedRef: typeof refDebounced;
|
|
537
|
+
/** @deprecated use `refDebounced` instead */
|
|
538
|
+
declare const useDebounce: typeof refDebounced;
|
|
539
|
+
//#endregion
|
|
540
|
+
//#region refDefault/index.d.ts
|
|
522
541
|
/**
|
|
523
542
|
* Apply default value to a ref.
|
|
524
543
|
*
|
|
525
544
|
* @__NO_SIDE_EFFECTS__
|
|
526
545
|
*/
|
|
527
546
|
declare function refDefault<T>(source: Ref<T | undefined | null>, defaultValue: T): Ref<T>;
|
|
528
|
-
|
|
547
|
+
//#endregion
|
|
548
|
+
//#region refManualReset/index.d.ts
|
|
549
|
+
/**
|
|
550
|
+
* Define the shape of a ref that supports manual reset functionality.
|
|
551
|
+
*
|
|
552
|
+
* This interface extends the standard `Ref` type from Vue and adds a `reset` method.
|
|
553
|
+
* The `reset` method allows the ref to be manually reset to its default value.
|
|
554
|
+
*/
|
|
555
|
+
interface ManualResetRefReturn<T> extends Ref<T> {
|
|
556
|
+
reset: Fn$1;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Create a ref with manual reset functionality.
|
|
560
|
+
*
|
|
561
|
+
* @see https://vueuse.org/refManualReset
|
|
562
|
+
* @param defaultValue The value which will be set.
|
|
563
|
+
*/
|
|
564
|
+
declare function refManualReset<T>(defaultValue: MaybeRefOrGetter<T>): ManualResetRefReturn<T>;
|
|
565
|
+
//#endregion
|
|
566
|
+
//#region refThrottled/index.d.ts
|
|
529
567
|
type RefThrottledReturn<T = any> = Ref<T>;
|
|
530
568
|
/**
|
|
531
569
|
* Throttle execution of a function. Especially useful for rate limiting
|
|
@@ -537,42 +575,47 @@ type RefThrottledReturn<T = any> = Ref<T>;
|
|
|
537
575
|
* @param leading if true, update the value on the leading edge of the ms timeout
|
|
538
576
|
*/
|
|
539
577
|
declare function refThrottled<T = any>(value: Ref<T>, delay?: number, trailing?: boolean, leading?: boolean): RefThrottledReturn<T>;
|
|
540
|
-
|
|
578
|
+
/** @deprecated use `refThrottled` instead */
|
|
579
|
+
declare const throttledRef: typeof refThrottled;
|
|
580
|
+
/** @deprecated use `refThrottled` instead */
|
|
581
|
+
declare const useThrottle: typeof refThrottled;
|
|
582
|
+
//#endregion
|
|
583
|
+
//#region refWithControl/index.d.ts
|
|
541
584
|
interface ControlledRefOptions<T> {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
585
|
+
/**
|
|
586
|
+
* Callback function before the ref changing.
|
|
587
|
+
*
|
|
588
|
+
* Returning `false` to dismiss the change.
|
|
589
|
+
*/
|
|
590
|
+
onBeforeChange?: (value: T, oldValue: T) => void | boolean;
|
|
591
|
+
/**
|
|
592
|
+
* Callback function after the ref changed
|
|
593
|
+
*
|
|
594
|
+
* This happens synchronously, with less overhead compare to `watch`
|
|
595
|
+
*/
|
|
596
|
+
onChanged?: (value: T, oldValue: T) => void;
|
|
554
597
|
}
|
|
555
598
|
/**
|
|
556
599
|
* Fine-grained controls over ref and its reactivity.
|
|
557
600
|
*
|
|
558
601
|
* @__NO_SIDE_EFFECTS__
|
|
559
602
|
*/
|
|
560
|
-
declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>):
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}> &
|
|
568
|
-
/**
|
|
569
|
-
* Alias for `refWithControl`
|
|
570
|
-
*/
|
|
603
|
+
declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>): vue0.ShallowUnwrapRef<{
|
|
604
|
+
get: (tracking?: boolean) => T;
|
|
605
|
+
set: (value: T, triggering?: boolean) => void;
|
|
606
|
+
untrackedGet: () => T;
|
|
607
|
+
silentSet: (v: T) => void;
|
|
608
|
+
peek: () => T;
|
|
609
|
+
lay: (v: T) => void;
|
|
610
|
+
}> & vue0.Ref<T, T>;
|
|
611
|
+
/** @deprecated use `refWithControl` instead */
|
|
571
612
|
declare const controlledRef: typeof refWithControl;
|
|
572
|
-
|
|
613
|
+
//#endregion
|
|
614
|
+
//#region set/index.d.ts
|
|
573
615
|
declare function set<T>(ref: Ref<T>, value: T): void;
|
|
574
616
|
declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
|
|
575
|
-
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region syncRef/index.d.ts
|
|
576
619
|
type Direction = 'ltr' | 'rtl' | 'both';
|
|
577
620
|
type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
|
|
578
621
|
/**
|
|
@@ -591,47 +634,47 @@ type IncludeButNotEqual<A, B> = Equal<A, B> extends true ? false : A extends B ?
|
|
|
591
634
|
* A ∩ B = ∅
|
|
592
635
|
*/
|
|
593
636
|
type NotIntersect<A, B> = Equal<A, B> extends true ? false : A & B extends never ? true : false;
|
|
594
|
-
interface EqualType<D extends Direction, L, R, O extends keyof Transform<L, R> = D extends 'both' ? 'ltr' | 'rtl' : D> {
|
|
595
|
-
|
|
637
|
+
interface EqualType<D extends Direction, L, R, O extends keyof Transform<L, R> = (D extends 'both' ? 'ltr' | 'rtl' : D)> {
|
|
638
|
+
transform?: SpecificFieldPartial<Pick<Transform<L, R>, O>, O>;
|
|
596
639
|
}
|
|
597
640
|
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 ? {
|
|
598
|
-
|
|
641
|
+
transform?: SpecificFieldPartial<Pick<Transform<L, R>, D>, D>;
|
|
599
642
|
} : {
|
|
600
|
-
|
|
643
|
+
transform: Pick<Transform<L, R>, D>;
|
|
601
644
|
};
|
|
602
645
|
type StrictIncludeType<IncludeType extends 'LR' | 'RL', D extends Direction, L, R> = D extends 'both' ? {
|
|
603
|
-
|
|
646
|
+
transform: SpecificFieldPartial<Transform<L, R>, IncludeType extends 'LR' ? 'ltr' : 'rtl'>;
|
|
604
647
|
} : D extends Exclude<Direction, 'both'> ? StrictIncludeMap<IncludeType, D, L, R> : never;
|
|
605
648
|
type IntersectButNotEqualType<D extends Direction, L, R> = D extends 'both' ? {
|
|
606
|
-
|
|
649
|
+
transform: Transform<L, R>;
|
|
607
650
|
} : D extends Exclude<Direction, 'both'> ? {
|
|
608
|
-
|
|
651
|
+
transform: Pick<Transform<L, R>, D>;
|
|
609
652
|
} : never;
|
|
610
653
|
type NotIntersectType<D extends Direction, L, R> = IntersectButNotEqualType<D, L, R>;
|
|
611
654
|
interface Transform<L, R> {
|
|
612
|
-
|
|
613
|
-
|
|
655
|
+
ltr: (left: L) => R;
|
|
656
|
+
rtl: (right: R) => L;
|
|
614
657
|
}
|
|
615
658
|
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;
|
|
616
659
|
type SyncRefOptions<L, R, D extends Direction> = ConfigurableFlushSync & {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
660
|
+
/**
|
|
661
|
+
* Watch deeply
|
|
662
|
+
*
|
|
663
|
+
* @default false
|
|
664
|
+
*/
|
|
665
|
+
deep?: boolean;
|
|
666
|
+
/**
|
|
667
|
+
* Sync values immediately
|
|
668
|
+
*
|
|
669
|
+
* @default true
|
|
670
|
+
*/
|
|
671
|
+
immediate?: boolean;
|
|
672
|
+
/**
|
|
673
|
+
* Direction of syncing. Value will be redefined if you define syncConvertors
|
|
674
|
+
*
|
|
675
|
+
* @default 'both'
|
|
676
|
+
*/
|
|
677
|
+
direction?: D;
|
|
635
678
|
} & TransformType<D, L, R>;
|
|
636
679
|
/**
|
|
637
680
|
* Two-way refs synchronization.
|
|
@@ -643,20 +686,21 @@ type SyncRefOptions<L, R, D extends Direction> = ConfigurableFlushSync & {
|
|
|
643
686
|
* 4. L ∩ R = ∅
|
|
644
687
|
*/
|
|
645
688
|
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;
|
|
646
|
-
|
|
689
|
+
//#endregion
|
|
690
|
+
//#region syncRefs/index.d.ts
|
|
647
691
|
interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
692
|
+
/**
|
|
693
|
+
* Watch deeply
|
|
694
|
+
*
|
|
695
|
+
* @default false
|
|
696
|
+
*/
|
|
697
|
+
deep?: boolean;
|
|
698
|
+
/**
|
|
699
|
+
* Sync values immediately
|
|
700
|
+
*
|
|
701
|
+
* @default true
|
|
702
|
+
*/
|
|
703
|
+
immediate?: boolean;
|
|
660
704
|
}
|
|
661
705
|
/**
|
|
662
706
|
* Keep target ref(s) in sync with the source ref
|
|
@@ -664,8 +708,9 @@ interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
|
664
708
|
* @param source source ref
|
|
665
709
|
* @param targets
|
|
666
710
|
*/
|
|
667
|
-
declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions):
|
|
668
|
-
|
|
711
|
+
declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions): vue0.WatchHandle;
|
|
712
|
+
//#endregion
|
|
713
|
+
//#region toReactive/index.d.ts
|
|
669
714
|
/**
|
|
670
715
|
* Converts ref to reactive.
|
|
671
716
|
*
|
|
@@ -673,7 +718,8 @@ declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[],
|
|
|
673
718
|
* @param objectRef A ref of object
|
|
674
719
|
*/
|
|
675
720
|
declare function toReactive<T extends object>(objectRef: MaybeRef<T>): UnwrapNestedRefs<T>;
|
|
676
|
-
|
|
721
|
+
//#endregion
|
|
722
|
+
//#region toRef/index.d.ts
|
|
677
723
|
/**
|
|
678
724
|
* Normalize value/ref/getter to `ref` or `computed`.
|
|
679
725
|
*/
|
|
@@ -683,18 +729,15 @@ declare function toRef<T>(r: MaybeRefOrGetter<T>): Ref<T>;
|
|
|
683
729
|
declare function toRef<T>(r: T): Ref<T>;
|
|
684
730
|
declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
|
685
731
|
declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
*/
|
|
689
|
-
declare const resolveRef: typeof toRef;
|
|
690
|
-
|
|
732
|
+
//#endregion
|
|
733
|
+
//#region toRefs/index.d.ts
|
|
691
734
|
interface ToRefsOptions {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
735
|
+
/**
|
|
736
|
+
* Replace the original ref with a copy on property update.
|
|
737
|
+
*
|
|
738
|
+
* @default true
|
|
739
|
+
*/
|
|
740
|
+
replaceRef?: MaybeRefOrGetter<boolean>;
|
|
698
741
|
}
|
|
699
742
|
/**
|
|
700
743
|
* Extended `toRefs` that also accepts refs of an object.
|
|
@@ -704,18 +747,8 @@ interface ToRefsOptions {
|
|
|
704
747
|
* @param options Options
|
|
705
748
|
*/
|
|
706
749
|
declare function toRefs<T extends object>(objectRef: MaybeRef<T>, options?: ToRefsOptions): ToRefs<T>;
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
* Get the value of value/ref/getter.
|
|
710
|
-
*
|
|
711
|
-
* @deprecated use `toValue` from `vue` instead
|
|
712
|
-
*/
|
|
713
|
-
declare const toValue: typeof toValue$1;
|
|
714
|
-
/**
|
|
715
|
-
* @deprecated use `toValue` instead
|
|
716
|
-
*/
|
|
717
|
-
declare const resolveUnref: typeof toValue$1;
|
|
718
|
-
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region tryOnBeforeMount/index.d.ts
|
|
719
752
|
/**
|
|
720
753
|
* Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function
|
|
721
754
|
*
|
|
@@ -723,16 +756,18 @@ declare const resolveUnref: typeof toValue$1;
|
|
|
723
756
|
* @param sync if set to false, it will run in the nextTick() of Vue
|
|
724
757
|
* @param target
|
|
725
758
|
*/
|
|
726
|
-
declare function tryOnBeforeMount(fn: Fn, sync?: boolean, target?: any): void;
|
|
727
|
-
|
|
759
|
+
declare function tryOnBeforeMount(fn: Fn$1, sync?: boolean, target?: any): void;
|
|
760
|
+
//#endregion
|
|
761
|
+
//#region tryOnBeforeUnmount/index.d.ts
|
|
728
762
|
/**
|
|
729
763
|
* Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
|
|
730
764
|
*
|
|
731
765
|
* @param fn
|
|
732
766
|
* @param target
|
|
733
767
|
*/
|
|
734
|
-
declare function tryOnBeforeUnmount(fn: Fn, target?: any): void;
|
|
735
|
-
|
|
768
|
+
declare function tryOnBeforeUnmount(fn: Fn$1, target?: any): void;
|
|
769
|
+
//#endregion
|
|
770
|
+
//#region tryOnMounted/index.d.ts
|
|
736
771
|
/**
|
|
737
772
|
* Call onMounted() if it's inside a component lifecycle, if not, just call the function
|
|
738
773
|
*
|
|
@@ -740,67 +775,70 @@ declare function tryOnBeforeUnmount(fn: Fn, target?: any): void;
|
|
|
740
775
|
* @param sync if set to false, it will run in the nextTick() of Vue
|
|
741
776
|
* @param target
|
|
742
777
|
*/
|
|
743
|
-
declare function tryOnMounted(fn: Fn, sync?: boolean, target?: any): void;
|
|
744
|
-
|
|
778
|
+
declare function tryOnMounted(fn: Fn$1, sync?: boolean, target?: any): void;
|
|
779
|
+
//#endregion
|
|
780
|
+
//#region tryOnScopeDispose/index.d.ts
|
|
745
781
|
/**
|
|
746
782
|
* Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
|
|
747
783
|
*
|
|
748
784
|
* @param fn
|
|
749
785
|
*/
|
|
750
|
-
declare function tryOnScopeDispose(fn: Fn): boolean;
|
|
751
|
-
|
|
786
|
+
declare function tryOnScopeDispose(fn: Fn$1): boolean;
|
|
787
|
+
//#endregion
|
|
788
|
+
//#region tryOnUnmounted/index.d.ts
|
|
752
789
|
/**
|
|
753
790
|
* Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
|
|
754
791
|
*
|
|
755
792
|
* @param fn
|
|
756
793
|
* @param target
|
|
757
794
|
*/
|
|
758
|
-
declare function tryOnUnmounted(fn: Fn, target?: any): void;
|
|
759
|
-
|
|
795
|
+
declare function tryOnUnmounted(fn: Fn$1, target?: any): void;
|
|
796
|
+
//#endregion
|
|
797
|
+
//#region until/index.d.ts
|
|
760
798
|
interface UntilToMatchOptions {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
799
|
+
/**
|
|
800
|
+
* Milliseconds timeout for promise to resolve/reject if the when condition does not meet.
|
|
801
|
+
* 0 for never timed out
|
|
802
|
+
*
|
|
803
|
+
* @default 0
|
|
804
|
+
*/
|
|
805
|
+
timeout?: number;
|
|
806
|
+
/**
|
|
807
|
+
* Reject the promise when timeout
|
|
808
|
+
*
|
|
809
|
+
* @default false
|
|
810
|
+
*/
|
|
811
|
+
throwOnTimeout?: boolean;
|
|
812
|
+
/**
|
|
813
|
+
* `flush` option for internal watch
|
|
814
|
+
*
|
|
815
|
+
* @default 'sync'
|
|
816
|
+
*/
|
|
817
|
+
flush?: WatchOptions['flush'];
|
|
818
|
+
/**
|
|
819
|
+
* `deep` option for internal watch
|
|
820
|
+
*
|
|
821
|
+
* @default 'false'
|
|
822
|
+
*/
|
|
823
|
+
deep?: WatchOptions['deep'];
|
|
786
824
|
}
|
|
787
825
|
interface UntilBaseInstance<T, Not extends boolean = false> {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
826
|
+
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>);
|
|
827
|
+
changed: (options?: UntilToMatchOptions) => Promise<T>;
|
|
828
|
+
changedTimes: (n?: number, options?: UntilToMatchOptions) => Promise<T>;
|
|
791
829
|
}
|
|
792
|
-
type Falsy = false | void | null | undefined | 0 | 0n | '';
|
|
830
|
+
type Falsy$1 = false | void | null | undefined | 0 | 0n | '';
|
|
793
831
|
interface UntilValueInstance<T, Not extends boolean = false> extends UntilBaseInstance<T, Not> {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
832
|
+
readonly not: UntilValueInstance<T, Not extends true ? false : true>;
|
|
833
|
+
toBe: <P = T>(value: MaybeRefOrGetter<P>, options?: UntilToMatchOptions) => Not extends true ? Promise<T> : Promise<P>;
|
|
834
|
+
toBeTruthy: (options?: UntilToMatchOptions) => Not extends true ? Promise<T & Falsy$1> : Promise<Exclude<T, Falsy$1>>;
|
|
835
|
+
toBeNull: (options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, null>> : Promise<null>;
|
|
836
|
+
toBeUndefined: (options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, undefined>> : Promise<undefined>;
|
|
837
|
+
toBeNaN: (options?: UntilToMatchOptions) => Promise<T>;
|
|
800
838
|
}
|
|
801
839
|
interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
|
|
802
|
-
|
|
803
|
-
|
|
840
|
+
readonly not: UntilArrayInstance<T>;
|
|
841
|
+
toContains: (value: MaybeRefOrGetter<ElementOf<ShallowUnwrapRef<T>>>, options?: UntilToMatchOptions) => Promise<T>;
|
|
804
842
|
}
|
|
805
843
|
/**
|
|
806
844
|
* Promised one-time watch for changes
|
|
@@ -817,20 +855,22 @@ interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
|
|
|
817
855
|
*/
|
|
818
856
|
declare function until<T extends unknown[]>(r: WatchSource<T> | MaybeRefOrGetter<T>): UntilArrayInstance<T>;
|
|
819
857
|
declare function until<T>(r: WatchSource<T> | MaybeRefOrGetter<T>): UntilValueInstance<T>;
|
|
820
|
-
|
|
858
|
+
//#endregion
|
|
859
|
+
//#region useArrayDifference/index.d.ts
|
|
821
860
|
interface UseArrayDifferenceOptions {
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
861
|
+
/**
|
|
862
|
+
* Returns asymmetric difference
|
|
863
|
+
*
|
|
864
|
+
* @see https://en.wikipedia.org/wiki/Symmetric_difference
|
|
865
|
+
* @default false
|
|
866
|
+
*/
|
|
867
|
+
symmetric?: boolean;
|
|
829
868
|
}
|
|
830
869
|
type UseArrayDifferenceReturn<T = any> = ComputedRef<T[]>;
|
|
831
870
|
declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, key?: keyof T, options?: UseArrayDifferenceOptions): UseArrayDifferenceReturn<T>;
|
|
832
871
|
declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, compareFn?: (value: T, othVal: T) => boolean, options?: UseArrayDifferenceOptions): UseArrayDifferenceReturn<T>;
|
|
833
|
-
|
|
872
|
+
//#endregion
|
|
873
|
+
//#region useArrayEvery/index.d.ts
|
|
834
874
|
type UseArrayEveryReturn = ComputedRef<boolean>;
|
|
835
875
|
/**
|
|
836
876
|
* Reactive `Array.every`
|
|
@@ -844,7 +884,8 @@ type UseArrayEveryReturn = ComputedRef<boolean>;
|
|
|
844
884
|
* @__NO_SIDE_EFFECTS__
|
|
845
885
|
*/
|
|
846
886
|
declare function useArrayEvery<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): UseArrayEveryReturn;
|
|
847
|
-
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region useArrayFilter/index.d.ts
|
|
848
889
|
type UseArrayFilterReturn<T = any> = ComputedRef<T[]>;
|
|
849
890
|
/**
|
|
850
891
|
* Reactive `Array.filter`
|
|
@@ -859,7 +900,8 @@ type UseArrayFilterReturn<T = any> = ComputedRef<T[]>;
|
|
|
859
900
|
*/
|
|
860
901
|
declare function useArrayFilter<T, S extends T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => element is S): UseArrayFilterReturn<S>;
|
|
861
902
|
declare function useArrayFilter<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => unknown): UseArrayFilterReturn<T>;
|
|
862
|
-
|
|
903
|
+
//#endregion
|
|
904
|
+
//#region useArrayFind/index.d.ts
|
|
863
905
|
type UseArrayFindReturn<T = any> = ComputedRef<T | undefined>;
|
|
864
906
|
/**
|
|
865
907
|
* Reactive `Array.find`
|
|
@@ -873,7 +915,8 @@ type UseArrayFindReturn<T = any> = ComputedRef<T | undefined>;
|
|
|
873
915
|
* @__NO_SIDE_EFFECTS__
|
|
874
916
|
*/
|
|
875
917
|
declare function useArrayFind<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): UseArrayFindReturn<T>;
|
|
876
|
-
|
|
918
|
+
//#endregion
|
|
919
|
+
//#region useArrayFindIndex/index.d.ts
|
|
877
920
|
type UseArrayFindIndexReturn = ComputedRef<number>;
|
|
878
921
|
/**
|
|
879
922
|
* Reactive `Array.findIndex`
|
|
@@ -887,7 +930,8 @@ type UseArrayFindIndexReturn = ComputedRef<number>;
|
|
|
887
930
|
* @__NO_SIDE_EFFECTS__
|
|
888
931
|
*/
|
|
889
932
|
declare function useArrayFindIndex<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): UseArrayFindIndexReturn;
|
|
890
|
-
|
|
933
|
+
//#endregion
|
|
934
|
+
//#region useArrayFindLast/index.d.ts
|
|
891
935
|
type UseArrayFindLastReturn<T = any> = ComputedRef<T | undefined>;
|
|
892
936
|
/**
|
|
893
937
|
* Reactive `Array.findLast`
|
|
@@ -901,11 +945,12 @@ type UseArrayFindLastReturn<T = any> = ComputedRef<T | undefined>;
|
|
|
901
945
|
* @__NO_SIDE_EFFECTS__
|
|
902
946
|
*/
|
|
903
947
|
declare function useArrayFindLast<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): UseArrayFindLastReturn<T>;
|
|
904
|
-
|
|
948
|
+
//#endregion
|
|
949
|
+
//#region useArrayIncludes/index.d.ts
|
|
905
950
|
type UseArrayIncludesComparatorFn<T, V> = ((element: T, value: V, index: number, array: MaybeRefOrGetter<T>[]) => boolean);
|
|
906
951
|
interface UseArrayIncludesOptions<T, V> {
|
|
907
|
-
|
|
908
|
-
|
|
952
|
+
fromIndex?: number;
|
|
953
|
+
comparator?: UseArrayIncludesComparatorFn<T, V> | keyof T;
|
|
909
954
|
}
|
|
910
955
|
type UseArrayIncludesReturn = ComputedRef<boolean>;
|
|
911
956
|
/**
|
|
@@ -920,7 +965,8 @@ type UseArrayIncludesReturn = ComputedRef<boolean>;
|
|
|
920
965
|
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: UseArrayIncludesComparatorFn<T, V>): UseArrayIncludesReturn;
|
|
921
966
|
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: keyof T): UseArrayIncludesReturn;
|
|
922
967
|
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, options?: UseArrayIncludesOptions<T, V>): UseArrayIncludesReturn;
|
|
923
|
-
|
|
968
|
+
//#endregion
|
|
969
|
+
//#region useArrayJoin/index.d.ts
|
|
924
970
|
type UseArrayJoinReturn = ComputedRef<string>;
|
|
925
971
|
/**
|
|
926
972
|
* Reactive `Array.join`
|
|
@@ -934,7 +980,8 @@ type UseArrayJoinReturn = ComputedRef<string>;
|
|
|
934
980
|
* @__NO_SIDE_EFFECTS__
|
|
935
981
|
*/
|
|
936
982
|
declare function useArrayJoin(list: MaybeRefOrGetter<MaybeRefOrGetter<any>[]>, separator?: MaybeRefOrGetter<string>): UseArrayJoinReturn;
|
|
937
|
-
|
|
983
|
+
//#endregion
|
|
984
|
+
//#region useArrayMap/index.d.ts
|
|
938
985
|
type UseArrayMapReturn<T = any> = ComputedRef<T[]>;
|
|
939
986
|
/**
|
|
940
987
|
* Reactive `Array.map`
|
|
@@ -948,7 +995,8 @@ type UseArrayMapReturn<T = any> = ComputedRef<T[]>;
|
|
|
948
995
|
* @__NO_SIDE_EFFECTS__
|
|
949
996
|
*/
|
|
950
997
|
declare function useArrayMap<T, U = T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => U): UseArrayMapReturn<U>;
|
|
951
|
-
|
|
998
|
+
//#endregion
|
|
999
|
+
//#region useArrayReduce/index.d.ts
|
|
952
1000
|
type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
|
|
953
1001
|
/**
|
|
954
1002
|
* Reactive `Array.reduce`
|
|
@@ -975,7 +1023,8 @@ declare function useArrayReduce<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>
|
|
|
975
1023
|
* @__NO_SIDE_EFFECTS__
|
|
976
1024
|
*/
|
|
977
1025
|
declare function useArrayReduce<T, U>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeRefOrGetter<U>): ComputedRef<U>;
|
|
978
|
-
|
|
1026
|
+
//#endregion
|
|
1027
|
+
//#region useArraySome/index.d.ts
|
|
979
1028
|
type UseArraySomeReturn = ComputedRef<boolean>;
|
|
980
1029
|
/**
|
|
981
1030
|
* Reactive `Array.some`
|
|
@@ -989,7 +1038,8 @@ type UseArraySomeReturn = ComputedRef<boolean>;
|
|
|
989
1038
|
* @__NO_SIDE_EFFECTS__
|
|
990
1039
|
*/
|
|
991
1040
|
declare function useArraySome<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): UseArraySomeReturn;
|
|
992
|
-
|
|
1041
|
+
//#endregion
|
|
1042
|
+
//#region useArrayUnique/index.d.ts
|
|
993
1043
|
type UseArrayUniqueReturn<T = any> = ComputedRef<T[]>;
|
|
994
1044
|
/**
|
|
995
1045
|
* reactive unique array
|
|
@@ -1001,42 +1051,43 @@ type UseArrayUniqueReturn<T = any> = ComputedRef<T[]>;
|
|
|
1001
1051
|
* @__NO_SIDE_EFFECTS__
|
|
1002
1052
|
*/
|
|
1003
1053
|
declare function useArrayUnique<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, compareFn?: (a: T, b: T, array: T[]) => boolean): UseArrayUniqueReturn<T>;
|
|
1004
|
-
|
|
1054
|
+
//#endregion
|
|
1055
|
+
//#region useCounter/index.d.ts
|
|
1005
1056
|
interface UseCounterOptions {
|
|
1006
|
-
|
|
1007
|
-
|
|
1057
|
+
min?: number;
|
|
1058
|
+
max?: number;
|
|
1008
1059
|
}
|
|
1009
1060
|
interface UseCounterReturn {
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1061
|
+
/**
|
|
1062
|
+
* The current value of the counter.
|
|
1063
|
+
*/
|
|
1064
|
+
readonly count: Readonly<Ref<number>>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Increment the counter.
|
|
1067
|
+
*
|
|
1068
|
+
* @param {number} [delta=1] The number to increment.
|
|
1069
|
+
*/
|
|
1070
|
+
inc: (delta?: number) => void;
|
|
1071
|
+
/**
|
|
1072
|
+
* Decrement the counter.
|
|
1073
|
+
*
|
|
1074
|
+
* @param {number} [delta=1] The number to decrement.
|
|
1075
|
+
*/
|
|
1076
|
+
dec: (delta?: number) => void;
|
|
1077
|
+
/**
|
|
1078
|
+
* Get the current value of the counter.
|
|
1079
|
+
*/
|
|
1080
|
+
get: () => number;
|
|
1081
|
+
/**
|
|
1082
|
+
* Set the counter to a new value.
|
|
1083
|
+
*
|
|
1084
|
+
* @param val The new value of the counter.
|
|
1085
|
+
*/
|
|
1086
|
+
set: (val: number) => void;
|
|
1087
|
+
/**
|
|
1088
|
+
* Reset the counter to an initial value.
|
|
1089
|
+
*/
|
|
1090
|
+
reset: (val?: number) => number;
|
|
1040
1091
|
}
|
|
1041
1092
|
/**
|
|
1042
1093
|
* Basic counter with utility functions.
|
|
@@ -1046,27 +1097,28 @@ interface UseCounterReturn {
|
|
|
1046
1097
|
* @param options
|
|
1047
1098
|
*/
|
|
1048
1099
|
declare function useCounter(initialValue?: MaybeRef<number>, options?: UseCounterOptions): {
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1100
|
+
count: Readonly<Ref<number, number> | vue0.ShallowRef<number, number> | vue0.WritableComputedRef<number, number>>;
|
|
1101
|
+
inc: (delta?: number) => number;
|
|
1102
|
+
dec: (delta?: number) => number;
|
|
1103
|
+
get: () => number;
|
|
1104
|
+
set: (val: number) => number;
|
|
1105
|
+
reset: (val?: number) => number;
|
|
1055
1106
|
};
|
|
1056
|
-
|
|
1107
|
+
//#endregion
|
|
1108
|
+
//#region useDateFormat/index.d.ts
|
|
1057
1109
|
type DateLike = Date | number | string | undefined;
|
|
1058
1110
|
interface UseDateFormatOptions {
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1111
|
+
/**
|
|
1112
|
+
* The locale(s) to used for dd/ddd/dddd/MMM/MMMM format
|
|
1113
|
+
*
|
|
1114
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
|
|
1115
|
+
*/
|
|
1116
|
+
locales?: MaybeRefOrGetter<Intl.LocalesArgument>;
|
|
1117
|
+
/**
|
|
1118
|
+
* A custom function to re-modify the way to display meridiem
|
|
1119
|
+
*
|
|
1120
|
+
*/
|
|
1121
|
+
customMeridiem?: (hours: number, minutes: number, isLowercase?: boolean, hasPeriod?: boolean) => string;
|
|
1070
1122
|
}
|
|
1071
1123
|
declare function formatDate(date: Date, formatStr: string, options?: UseDateFormatOptions): string;
|
|
1072
1124
|
declare function normalizeDate(date: DateLike): Date;
|
|
@@ -1082,7 +1134,8 @@ type UseDateFormatReturn = ComputedRef<string>;
|
|
|
1082
1134
|
* @__NO_SIDE_EFFECTS__
|
|
1083
1135
|
*/
|
|
1084
1136
|
declare function useDateFormat(date: MaybeRefOrGetter<DateLike>, formatStr?: MaybeRefOrGetter<string>, options?: UseDateFormatOptions): UseDateFormatReturn;
|
|
1085
|
-
|
|
1137
|
+
//#endregion
|
|
1138
|
+
//#region useDebounceFn/index.d.ts
|
|
1086
1139
|
type UseDebounceFnReturn<T extends FunctionArgs> = PromisifyFn<T>;
|
|
1087
1140
|
/**
|
|
1088
1141
|
* Debounce execution of a function.
|
|
@@ -1097,28 +1150,29 @@ type UseDebounceFnReturn<T extends FunctionArgs> = PromisifyFn<T>;
|
|
|
1097
1150
|
* @__NO_SIDE_EFFECTS__
|
|
1098
1151
|
*/
|
|
1099
1152
|
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): UseDebounceFnReturn<T>;
|
|
1100
|
-
|
|
1153
|
+
//#endregion
|
|
1154
|
+
//#region useInterval/index.d.ts
|
|
1101
1155
|
interface UseIntervalOptions<Controls extends boolean> {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1156
|
+
/**
|
|
1157
|
+
* Expose more controls
|
|
1158
|
+
*
|
|
1159
|
+
* @default false
|
|
1160
|
+
*/
|
|
1161
|
+
controls?: Controls;
|
|
1162
|
+
/**
|
|
1163
|
+
* Execute the update immediately on calling
|
|
1164
|
+
*
|
|
1165
|
+
* @default true
|
|
1166
|
+
*/
|
|
1167
|
+
immediate?: boolean;
|
|
1168
|
+
/**
|
|
1169
|
+
* Callback on every interval
|
|
1170
|
+
*/
|
|
1171
|
+
callback?: (count: number) => void;
|
|
1118
1172
|
}
|
|
1119
1173
|
interface UseIntervalControls {
|
|
1120
|
-
|
|
1121
|
-
|
|
1174
|
+
counter: ShallowRef<number>;
|
|
1175
|
+
reset: () => void;
|
|
1122
1176
|
}
|
|
1123
1177
|
type UseIntervalReturn = Readonly<ShallowRef<number>> | Readonly<UseIntervalControls & Pausable>;
|
|
1124
1178
|
/**
|
|
@@ -1130,20 +1184,21 @@ type UseIntervalReturn = Readonly<ShallowRef<number>> | Readonly<UseIntervalCont
|
|
|
1130
1184
|
*/
|
|
1131
1185
|
declare function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): Readonly<ShallowRef<number>>;
|
|
1132
1186
|
declare function useInterval(interval: MaybeRefOrGetter<number>, options: UseIntervalOptions<true>): Readonly<UseIntervalControls & Pausable>;
|
|
1133
|
-
|
|
1187
|
+
//#endregion
|
|
1188
|
+
//#region useIntervalFn/index.d.ts
|
|
1134
1189
|
interface UseIntervalFnOptions {
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1190
|
+
/**
|
|
1191
|
+
* Start the timer immediately
|
|
1192
|
+
*
|
|
1193
|
+
* @default true
|
|
1194
|
+
*/
|
|
1195
|
+
immediate?: boolean;
|
|
1196
|
+
/**
|
|
1197
|
+
* Execute the callback immediately after calling `resume`
|
|
1198
|
+
*
|
|
1199
|
+
* @default false
|
|
1200
|
+
*/
|
|
1201
|
+
immediateCallback?: boolean;
|
|
1147
1202
|
}
|
|
1148
1203
|
type UseIntervalFnReturn = Pausable;
|
|
1149
1204
|
/**
|
|
@@ -1154,10 +1209,11 @@ type UseIntervalFnReturn = Pausable;
|
|
|
1154
1209
|
* @param interval
|
|
1155
1210
|
* @param options
|
|
1156
1211
|
*/
|
|
1157
|
-
declare function useIntervalFn(cb: Fn, interval?: MaybeRefOrGetter<number>, options?: UseIntervalFnOptions): UseIntervalFnReturn;
|
|
1158
|
-
|
|
1212
|
+
declare function useIntervalFn(cb: Fn$1, interval?: MaybeRefOrGetter<number>, options?: UseIntervalFnOptions): UseIntervalFnReturn;
|
|
1213
|
+
//#endregion
|
|
1214
|
+
//#region useLastChanged/index.d.ts
|
|
1159
1215
|
interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends number | null | undefined = undefined> extends WatchOptions<Immediate> {
|
|
1160
|
-
|
|
1216
|
+
initialValue?: InitialValue;
|
|
1161
1217
|
}
|
|
1162
1218
|
type UseLastChangedReturn = Readonly<ShallowRef<number | null>> | Readonly<ShallowRef<number>>;
|
|
1163
1219
|
/**
|
|
@@ -1167,7 +1223,8 @@ type UseLastChangedReturn = Readonly<ShallowRef<number | null>> | Readonly<Shall
|
|
|
1167
1223
|
*/
|
|
1168
1224
|
declare function useLastChanged(source: WatchSource, options?: UseLastChangedOptions<false>): Readonly<ShallowRef<number | null>>;
|
|
1169
1225
|
declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<true> | UseLastChangedOptions<boolean, number>): Readonly<ShallowRef<number>>;
|
|
1170
|
-
|
|
1226
|
+
//#endregion
|
|
1227
|
+
//#region useThrottleFn/index.d.ts
|
|
1171
1228
|
/**
|
|
1172
1229
|
* Throttle execution of a function. Especially useful for rate limiting
|
|
1173
1230
|
* execution of handlers on events like resize and scroll.
|
|
@@ -1188,20 +1245,21 @@ declare function useLastChanged(source: WatchSource, options: UseLastChangedOpti
|
|
|
1188
1245
|
* @__NO_SIDE_EFFECTS__
|
|
1189
1246
|
*/
|
|
1190
1247
|
declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, trailing?: boolean, leading?: boolean, rejectOnCancel?: boolean): PromisifyFn<T>;
|
|
1191
|
-
|
|
1248
|
+
//#endregion
|
|
1249
|
+
//#region useTimeoutFn/index.d.ts
|
|
1192
1250
|
interface UseTimeoutFnOptions {
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1251
|
+
/**
|
|
1252
|
+
* Start the timer immediately
|
|
1253
|
+
*
|
|
1254
|
+
* @default true
|
|
1255
|
+
*/
|
|
1256
|
+
immediate?: boolean;
|
|
1257
|
+
/**
|
|
1258
|
+
* Execute the callback immediately after calling `start`
|
|
1259
|
+
*
|
|
1260
|
+
* @default false
|
|
1261
|
+
*/
|
|
1262
|
+
immediateCallback?: boolean;
|
|
1205
1263
|
}
|
|
1206
1264
|
type UseTimeoutFnReturn<CallbackFn extends AnyFn> = Stoppable<Parameters<CallbackFn> | []>;
|
|
1207
1265
|
/**
|
|
@@ -1212,21 +1270,22 @@ type UseTimeoutFnReturn<CallbackFn extends AnyFn> = Stoppable<Parameters<Callbac
|
|
|
1212
1270
|
* @param options
|
|
1213
1271
|
*/
|
|
1214
1272
|
declare function useTimeoutFn<CallbackFn extends AnyFn>(cb: CallbackFn, interval: MaybeRefOrGetter<number>, options?: UseTimeoutFnOptions): UseTimeoutFnReturn<CallbackFn>;
|
|
1215
|
-
|
|
1273
|
+
//#endregion
|
|
1274
|
+
//#region useTimeout/index.d.ts
|
|
1216
1275
|
interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOptions {
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1276
|
+
/**
|
|
1277
|
+
* Expose more controls
|
|
1278
|
+
*
|
|
1279
|
+
* @default false
|
|
1280
|
+
*/
|
|
1281
|
+
controls?: Controls;
|
|
1282
|
+
/**
|
|
1283
|
+
* Callback on timeout
|
|
1284
|
+
*/
|
|
1285
|
+
callback?: Fn$1;
|
|
1227
1286
|
}
|
|
1228
1287
|
type UseTimoutReturn = ComputedRef<boolean> | {
|
|
1229
|
-
|
|
1288
|
+
readonly ready: ComputedRef<boolean>;
|
|
1230
1289
|
} & Stoppable;
|
|
1231
1290
|
/**
|
|
1232
1291
|
* Update value after a given time with controls.
|
|
@@ -1237,29 +1296,30 @@ type UseTimoutReturn = ComputedRef<boolean> | {
|
|
|
1237
1296
|
*/
|
|
1238
1297
|
declare function useTimeout(interval?: MaybeRefOrGetter<number>, options?: UseTimeoutOptions<false>): ComputedRef<boolean>;
|
|
1239
1298
|
declare function useTimeout(interval: MaybeRefOrGetter<number>, options: UseTimeoutOptions<true>): {
|
|
1240
|
-
|
|
1299
|
+
ready: ComputedRef<boolean>;
|
|
1241
1300
|
} & Stoppable;
|
|
1242
|
-
|
|
1301
|
+
//#endregion
|
|
1302
|
+
//#region useToNumber/index.d.ts
|
|
1243
1303
|
interface UseToNumberOptions {
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1304
|
+
/**
|
|
1305
|
+
* Method to use to convert the value to a number.
|
|
1306
|
+
*
|
|
1307
|
+
* Or a custom function for the conversion.
|
|
1308
|
+
*
|
|
1309
|
+
* @default 'parseFloat'
|
|
1310
|
+
*/
|
|
1311
|
+
method?: 'parseFloat' | 'parseInt' | ((value: string | number) => number);
|
|
1312
|
+
/**
|
|
1313
|
+
* The base in mathematical numeral systems passed to `parseInt`.
|
|
1314
|
+
* Only works with `method: 'parseInt'`
|
|
1315
|
+
*/
|
|
1316
|
+
radix?: number;
|
|
1317
|
+
/**
|
|
1318
|
+
* Replace NaN with zero
|
|
1319
|
+
*
|
|
1320
|
+
* @default false
|
|
1321
|
+
*/
|
|
1322
|
+
nanToZero?: boolean;
|
|
1263
1323
|
}
|
|
1264
1324
|
/**
|
|
1265
1325
|
* Reactively convert a string ref to number.
|
|
@@ -1267,7 +1327,8 @@ interface UseToNumberOptions {
|
|
|
1267
1327
|
* @__NO_SIDE_EFFECTS__
|
|
1268
1328
|
*/
|
|
1269
1329
|
declare function useToNumber(value: MaybeRefOrGetter<number | string>, options?: UseToNumberOptions): ComputedRef<number>;
|
|
1270
|
-
|
|
1330
|
+
//#endregion
|
|
1331
|
+
//#region useToString/index.d.ts
|
|
1271
1332
|
/**
|
|
1272
1333
|
* Reactively convert a ref to string.
|
|
1273
1334
|
*
|
|
@@ -1276,113 +1337,132 @@ declare function useToNumber(value: MaybeRefOrGetter<number | string>, options?:
|
|
|
1276
1337
|
* @__NO_SIDE_EFFECTS__
|
|
1277
1338
|
*/
|
|
1278
1339
|
declare function useToString(value: MaybeRefOrGetter<unknown>): ComputedRef<string>;
|
|
1279
|
-
|
|
1340
|
+
//#endregion
|
|
1341
|
+
//#region useToggle/index.d.ts
|
|
1280
1342
|
type ToggleFn = (value?: boolean) => void;
|
|
1281
1343
|
type UseToggleReturn = [ShallowRef<boolean>, ToggleFn] | ToggleFn;
|
|
1282
1344
|
interface UseToggleOptions<Truthy, Falsy> {
|
|
1283
|
-
|
|
1284
|
-
|
|
1345
|
+
truthyValue?: MaybeRefOrGetter<Truthy>;
|
|
1346
|
+
falsyValue?: MaybeRefOrGetter<Falsy>;
|
|
1285
1347
|
}
|
|
1286
1348
|
declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(initialValue: Ref<T>, options?: UseToggleOptions<Truthy, Falsy>): (value?: T) => T;
|
|
1287
1349
|
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [ShallowRef<T>, (value?: T) => T];
|
|
1288
|
-
|
|
1350
|
+
//#endregion
|
|
1351
|
+
//#region watchArray/index.d.ts
|
|
1289
1352
|
declare type WatchArrayCallback<V = any, OV = any> = (value: V, oldValue: OV, added: V, removed: OV, onCleanup: (cleanupFn: () => void) => void) => any;
|
|
1290
1353
|
/**
|
|
1291
1354
|
* Watch for an array with additions and removals.
|
|
1292
1355
|
*
|
|
1293
1356
|
* @see https://vueuse.org/watchArray
|
|
1294
1357
|
*/
|
|
1295
|
-
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>):
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
}
|
|
1358
|
+
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>): vue0.WatchHandle;
|
|
1359
|
+
//#endregion
|
|
1360
|
+
//#region watchWithFilter/index.d.ts
|
|
1361
|
+
interface WatchWithFilterOptions<Immediate> extends WatchOptions<Immediate>, ConfigurableEventFilter {}
|
|
1299
1362
|
declare function watchWithFilter<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchStopHandle;
|
|
1300
1363
|
declare function watchWithFilter<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchStopHandle;
|
|
1301
1364
|
declare function watchWithFilter<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchStopHandle;
|
|
1302
|
-
|
|
1365
|
+
//#endregion
|
|
1366
|
+
//#region watchAtMost/index.d.ts
|
|
1303
1367
|
interface WatchAtMostOptions<Immediate> extends WatchWithFilterOptions<Immediate> {
|
|
1304
|
-
|
|
1368
|
+
count: MaybeRefOrGetter<number>;
|
|
1305
1369
|
}
|
|
1306
1370
|
interface WatchAtMostReturn {
|
|
1307
|
-
|
|
1308
|
-
|
|
1371
|
+
stop: WatchStopHandle;
|
|
1372
|
+
count: ShallowRef<number>;
|
|
1309
1373
|
}
|
|
1310
1374
|
declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
|
|
1311
1375
|
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;
|
|
1312
|
-
|
|
1376
|
+
//#endregion
|
|
1377
|
+
//#region watchDebounced/index.d.ts
|
|
1313
1378
|
interface WatchDebouncedOptions<Immediate> extends WatchOptions<Immediate>, DebounceFilterOptions {
|
|
1314
|
-
|
|
1379
|
+
debounce?: MaybeRefOrGetter<number>;
|
|
1315
1380
|
}
|
|
1316
1381
|
declare function watchDebounced<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle;
|
|
1317
1382
|
declare function watchDebounced<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle;
|
|
1318
1383
|
declare function watchDebounced<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle;
|
|
1319
|
-
|
|
1384
|
+
/** @deprecated use `watchDebounced` instead */
|
|
1385
|
+
declare const debouncedWatch: typeof watchDebounced;
|
|
1386
|
+
//#endregion
|
|
1387
|
+
//#region watchDeep/index.d.ts
|
|
1320
1388
|
declare function watchDeep<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: Omit<WatchOptions<Immediate>, 'deep'>): WatchStopHandle;
|
|
1321
1389
|
declare function watchDeep<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: Omit<WatchOptions<Immediate>, 'deep'>): WatchStopHandle;
|
|
1322
1390
|
declare function watchDeep<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: Omit<WatchOptions<Immediate>, 'deep'>): WatchStopHandle;
|
|
1323
|
-
|
|
1391
|
+
//#endregion
|
|
1392
|
+
//#region watchIgnorable/index.d.ts
|
|
1324
1393
|
type IgnoredUpdater = (updater: () => void) => void;
|
|
1325
1394
|
type IgnoredPrevAsyncUpdates = () => void;
|
|
1326
1395
|
interface WatchIgnorableReturn {
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1396
|
+
ignoreUpdates: IgnoredUpdater;
|
|
1397
|
+
ignorePrevAsyncUpdates: IgnoredPrevAsyncUpdates;
|
|
1398
|
+
stop: WatchStopHandle;
|
|
1330
1399
|
}
|
|
1331
1400
|
declare function watchIgnorable<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn;
|
|
1332
1401
|
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;
|
|
1333
1402
|
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;
|
|
1334
|
-
|
|
1403
|
+
/** @deprecated use `watchIgnorable` instead */
|
|
1404
|
+
declare const ignorableWatch: typeof watchIgnorable;
|
|
1405
|
+
//#endregion
|
|
1406
|
+
//#region watchImmediate/index.d.ts
|
|
1335
1407
|
declare function watchImmediate<T extends Readonly<WatchSource<unknown>[]>>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
|
|
1336
1408
|
declare function watchImmediate<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
|
|
1337
1409
|
declare function watchImmediate<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
|
|
1338
|
-
|
|
1410
|
+
//#endregion
|
|
1411
|
+
//#region watchOnce/index.d.ts
|
|
1339
1412
|
declare function watchOnce<T extends Readonly<WatchSource<unknown>[]>>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>, options?: Omit<WatchOptions<true>, 'once'>): WatchStopHandle;
|
|
1340
1413
|
declare function watchOnce<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'once'>): WatchStopHandle;
|
|
1341
1414
|
declare function watchOnce<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'once'>): WatchStopHandle;
|
|
1342
|
-
|
|
1415
|
+
//#endregion
|
|
1416
|
+
//#region watchPausable/index.d.ts
|
|
1343
1417
|
interface WatchPausableReturn extends Pausable {
|
|
1344
|
-
|
|
1418
|
+
stop: WatchStopHandle;
|
|
1345
1419
|
}
|
|
1346
1420
|
type WatchPausableOptions<Immediate> = WatchWithFilterOptions<Immediate> & PausableFilterOptions;
|
|
1347
1421
|
declare function watchPausable<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
|
|
1348
1422
|
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;
|
|
1349
1423
|
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;
|
|
1350
|
-
|
|
1424
|
+
/** @deprecated use `watchPausable` instead */
|
|
1425
|
+
declare const pausableWatch: typeof watchPausable;
|
|
1426
|
+
//#endregion
|
|
1427
|
+
//#region watchThrottled/index.d.ts
|
|
1351
1428
|
interface WatchThrottledOptions<Immediate> extends WatchOptions<Immediate> {
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1429
|
+
throttle?: MaybeRefOrGetter<number>;
|
|
1430
|
+
trailing?: boolean;
|
|
1431
|
+
leading?: boolean;
|
|
1355
1432
|
}
|
|
1356
1433
|
declare function watchThrottled<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchThrottledOptions<Immediate>): WatchStopHandle;
|
|
1357
1434
|
declare function watchThrottled<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchThrottledOptions<Immediate>): WatchStopHandle;
|
|
1358
1435
|
declare function watchThrottled<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchThrottledOptions<Immediate>): WatchStopHandle;
|
|
1359
|
-
|
|
1436
|
+
/** @deprecated use `watchThrottled` instead */
|
|
1437
|
+
declare const throttledWatch: typeof watchThrottled;
|
|
1438
|
+
//#endregion
|
|
1439
|
+
//#region watchTriggerable/index.d.ts
|
|
1360
1440
|
interface WatchTriggerableReturn<FnReturnT = void> extends WatchIgnorableReturn {
|
|
1361
|
-
|
|
1362
|
-
|
|
1441
|
+
/** Execute `WatchCallback` immediately */
|
|
1442
|
+
trigger: () => FnReturnT;
|
|
1363
1443
|
}
|
|
1364
1444
|
type OnCleanup = (cleanupFn: () => void) => void;
|
|
1365
1445
|
type WatchTriggerableCallback<V = any, OV = any, R = void> = (value: V, oldValue: OV, onCleanup: OnCleanup) => R;
|
|
1366
1446
|
declare function watchTriggerable<T extends Readonly<WatchSource<unknown>[]>, FnReturnT>(sources: [...T], cb: WatchTriggerableCallback<MapSources<T>, MapOldSources<T, true>, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1367
1447
|
declare function watchTriggerable<T, FnReturnT>(source: WatchSource<T>, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1368
1448
|
declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1369
|
-
|
|
1449
|
+
//#endregion
|
|
1450
|
+
//#region whenever/index.d.ts
|
|
1370
1451
|
interface WheneverOptions extends WatchOptions {
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1452
|
+
/**
|
|
1453
|
+
* Only trigger once when the condition is met
|
|
1454
|
+
*
|
|
1455
|
+
* Override the `once` option in `WatchOptions`
|
|
1456
|
+
*
|
|
1457
|
+
* @default false
|
|
1458
|
+
*/
|
|
1459
|
+
once?: boolean;
|
|
1379
1460
|
}
|
|
1380
1461
|
/**
|
|
1381
1462
|
* Shorthand for watching value to be truthy
|
|
1382
1463
|
*
|
|
1383
1464
|
* @see https://vueuse.org/whenever
|
|
1384
1465
|
*/
|
|
1385
|
-
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions):
|
|
1386
|
-
|
|
1387
|
-
export {
|
|
1388
|
-
export type { AnyFn, ArgumentsType, Arrayable, Awaitable, Awaited, ComputedEagerOptions, ComputedEagerReturn, ComputedRefWithControl, ComputedWithControlRef, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, CreateInjectionStateOptions, CreateRefReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookReturn, EventHookTrigger, ExtendRefOptions, ExtendRefReturn, Fn, FunctionArgs, FunctionWrapperOptions, IfAny, IgnoredPrevAsyncUpdates, IgnoredUpdater, IsAny, IsDefinedReturn, MapOldSources, MapSources, 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, UseArrayReducer, UseArraySomeReturn, UseArrayUniqueReturn, UseCounterOptions, UseCounterReturn, UseDateFormatOptions, UseDateFormatReturn, UseDebounceFnReturn, UseIntervalControls, UseIntervalFnOptions, UseIntervalFnReturn, UseIntervalOptions, UseIntervalReturn, UseLastChangedOptions, UseLastChangedReturn, UseTimeoutFnOptions, UseTimeoutFnReturn, UseTimeoutOptions, UseTimoutReturn, UseToNumberOptions, UseToggleOptions, UseToggleReturn, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableOptions, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WheneverOptions, WritableComputedRefWithControl };
|
|
1466
|
+
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue0.WatchHandle;
|
|
1467
|
+
//#endregion
|
|
1468
|
+
export { AnyFn, ArgumentsType, Arrayable, Awaitable, Awaited, ComputedEagerOptions, ComputedEagerReturn, ComputedRefWithControl, ComputedWithControlRef, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, CreateInjectionStateOptions, CreateRefReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookReturn, EventHookTrigger, ExtendRefOptions, ExtendRefReturn, Fn$1 as Fn, FunctionArgs, FunctionWrapperOptions, IfAny, IgnoredPrevAsyncUpdates, IgnoredUpdater, InstanceProxy, IsAny, IsDefinedReturn, ManualResetRefReturn, MapOldSources, MapSources, 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, UseArrayReducer, UseArraySomeReturn, UseArrayUniqueReturn, UseCounterOptions, UseCounterReturn, UseDateFormatOptions, UseDateFormatReturn, UseDebounceFnReturn, UseIntervalControls, UseIntervalFnOptions, UseIntervalFnReturn, UseIntervalOptions, UseIntervalReturn, UseLastChangedOptions, UseLastChangedReturn, UseTimeoutFnOptions, UseTimeoutFnReturn, UseTimeoutOptions, UseTimoutReturn, UseToNumberOptions, UseToggleOptions, UseToggleReturn, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, 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 };
|