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