@histoire/vendors 0.13.0 → 0.13.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/dist/client/b-vue-use.js +1705 -976
- package/dist/client/b-vue.js +1 -1
- package/dist/client/node_modules/@types/web-bluetooth/index.d.ts +0 -2
- package/dist/client/node_modules/@types/web-bluetooth/package.json +3 -3
- package/dist/client/node_modules/@vueuse/core/index.d.ts +740 -524
- package/dist/client/node_modules/@vueuse/core/package.json +4 -16
- package/dist/client/node_modules/@vueuse/metadata/index.d.ts +1 -0
- package/dist/client/node_modules/@vueuse/metadata/package.json +1 -1
- package/dist/client/node_modules/@vueuse/{core/node_modules/@vueuse/shared → shared}/index.d.ts +299 -114
- package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/lib/index.d.ts +22 -0
- package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/lib/v2/index.d.ts +31 -0
- package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/lib/v2.7/index.d.ts +36 -0
- package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/lib/v3/index.d.ts +22 -0
- package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/package.json +47 -0
- package/dist/client/node_modules/@vueuse/{core/node_modules/@vueuse/shared → shared}/package.json +1 -13
- package/dist/client/vue.runtime.esm-bundler.js +1 -1
- package/package.json +2 -2
- package/rollup.config.mjs +1 -1
package/dist/client/node_modules/@vueuse/{core/node_modules/@vueuse/shared → shared}/index.d.ts
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as vue_demi from 'vue-demi';
|
|
2
2
|
import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, ShallowUnwrapRef as ShallowUnwrapRef$1, WatchOptions, UnwrapRef, ToRefs, WatchCallback, WatchStopHandle } from 'vue-demi';
|
|
3
|
-
import { MaybeRef as MaybeRef$1 } from '@vueuse/shared';
|
|
4
3
|
|
|
5
4
|
declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<Ref<T>>;
|
|
6
5
|
|
|
@@ -17,15 +16,11 @@ interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, Comp
|
|
|
17
16
|
declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: ComputedGetter<T>): ComputedRefWithControl<T>;
|
|
18
17
|
declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: WritableComputedOptions<T>): WritableComputedRefWithControl<T>;
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
* The source code for this function was inspired by vue-apollo's `useEventHook` util
|
|
22
|
-
* https://github.com/vuejs/vue-apollo/blob/v4/packages/vue-apollo-composable/src/util/useEventHook.ts
|
|
23
|
-
*/
|
|
24
|
-
declare type EventHookOn<T = any> = (fn: (param: T) => void) => {
|
|
19
|
+
type EventHookOn<T = any> = (fn: (param: T) => void) => {
|
|
25
20
|
off: () => void;
|
|
26
21
|
};
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
type EventHookOff<T = any> = (fn: (param: T) => void) => void;
|
|
23
|
+
type EventHookTrigger<T = any> = (param: T) => void;
|
|
29
24
|
interface EventHook<T = any> {
|
|
30
25
|
on: EventHookOn<T>;
|
|
31
26
|
off: EventHookOff<T>;
|
|
@@ -38,7 +33,7 @@ interface EventHook<T = any> {
|
|
|
38
33
|
*/
|
|
39
34
|
declare function createEventHook<T = any>(): EventHook<T>;
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
type CreateGlobalStateReturn<T> = () => T;
|
|
42
37
|
/**
|
|
43
38
|
* Keep states in the global scope to be reusable across Vue instances.
|
|
44
39
|
*
|
|
@@ -53,7 +48,7 @@ declare function createGlobalState<T>(stateFactory: () => T): CreateGlobalStateR
|
|
|
53
48
|
* @see https://vueuse.org/createInjectionState
|
|
54
49
|
*
|
|
55
50
|
*/
|
|
56
|
-
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return): readonly [useProvidingState: (...args: Arguments) =>
|
|
51
|
+
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return): readonly [useProvidingState: (...args: Arguments) => Return, useInjectedState: () => Return | undefined];
|
|
57
52
|
|
|
58
53
|
/**
|
|
59
54
|
* Make a composable function usable with multiple Vue instances.
|
|
@@ -77,11 +72,11 @@ interface ExtendRefOptions<Unwrap extends boolean = boolean> {
|
|
|
77
72
|
unwrap?: Unwrap;
|
|
78
73
|
}
|
|
79
74
|
/**
|
|
80
|
-
*
|
|
75
|
+
* Overload 1: Unwrap set to false
|
|
81
76
|
*/
|
|
82
77
|
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions<false>>(ref: R, extend: Extend, options?: Options): ShallowUnwrapRef$1<Extend> & R;
|
|
83
78
|
/**
|
|
84
|
-
*
|
|
79
|
+
* Overload 2: Unwrap unset or set to true
|
|
85
80
|
*/
|
|
86
81
|
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
|
|
87
82
|
|
|
@@ -100,22 +95,27 @@ declare const clamp: (n: number, min: number, max: number) => number;
|
|
|
100
95
|
declare const noop: () => void;
|
|
101
96
|
declare const rand: (min: number, max: number) => number;
|
|
102
97
|
declare const isIOS: boolean | "";
|
|
98
|
+
declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
|
|
103
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Void function
|
|
102
|
+
*/
|
|
103
|
+
type Fn = () => void;
|
|
104
104
|
/**
|
|
105
105
|
* Any function
|
|
106
106
|
*/
|
|
107
|
-
|
|
107
|
+
type AnyFn = (...args: any[]) => any;
|
|
108
108
|
/**
|
|
109
109
|
* A ref that allow to set null or undefined
|
|
110
110
|
*/
|
|
111
|
-
|
|
111
|
+
type RemovableRef<T> = Omit<Ref<T>, 'value'> & {
|
|
112
112
|
get value(): T;
|
|
113
113
|
set value(value: T | null | undefined);
|
|
114
114
|
};
|
|
115
115
|
/**
|
|
116
116
|
* @deprecated Use `RemovableRef`
|
|
117
117
|
*/
|
|
118
|
-
|
|
118
|
+
type RemoveableRef<T> = RemovableRef<T>;
|
|
119
119
|
/**
|
|
120
120
|
* Maybe it's a ref, or a plain value
|
|
121
121
|
*
|
|
@@ -123,15 +123,23 @@ declare type RemoveableRef<T> = RemovableRef<T>;
|
|
|
123
123
|
* type MaybeRef<T> = T | Ref<T>
|
|
124
124
|
* ```
|
|
125
125
|
*/
|
|
126
|
-
|
|
126
|
+
type MaybeRef<T> = T | Ref<T>;
|
|
127
127
|
/**
|
|
128
|
-
* Maybe it's a ref, or a getter function
|
|
128
|
+
* Maybe it's a ref, or a plain value, or a getter function
|
|
129
129
|
*
|
|
130
130
|
* ```ts
|
|
131
|
-
* type
|
|
131
|
+
* type MaybeComputedRef<T> = (() => T) | T | Ref<T> | ComputedRef<T>
|
|
132
132
|
* ```
|
|
133
133
|
*/
|
|
134
|
-
|
|
134
|
+
type MaybeComputedRef<T> = MaybeReadonlyRef<T> | MaybeRef<T>;
|
|
135
|
+
/**
|
|
136
|
+
* Maybe it's a computed ref, or a getter function
|
|
137
|
+
*
|
|
138
|
+
* ```ts
|
|
139
|
+
* type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>;
|
|
135
143
|
/**
|
|
136
144
|
* Make all the nested attributes of an object or array to MaybeRef<T>
|
|
137
145
|
*
|
|
@@ -141,20 +149,23 @@ declare type MaybeComputedRef<T> = T extends Function ? never : (() => T) | Mayb
|
|
|
141
149
|
* UnwrapRef<DeepMaybeRef<T>> === T
|
|
142
150
|
* ```
|
|
143
151
|
*/
|
|
144
|
-
|
|
152
|
+
type DeepMaybeRef<T> = T extends Ref<infer V> ? MaybeRef<V> : T extends Array<any> | object ? {
|
|
145
153
|
[K in keyof T]: DeepMaybeRef<T[K]>;
|
|
146
154
|
} : MaybeRef<T>;
|
|
155
|
+
type Arrayable<T> = T[] | T;
|
|
147
156
|
/**
|
|
148
157
|
* Infers the element type of an array
|
|
149
158
|
*/
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
159
|
+
type ElementOf<T> = T extends (infer E)[] ? E : never;
|
|
160
|
+
type ShallowUnwrapRef<T> = T extends Ref<infer P> ? P : T;
|
|
161
|
+
type Awaitable<T> = Promise<T> | T;
|
|
162
|
+
type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
163
|
+
type PromisifyFn<T extends AnyFn> = (...args: ArgumentsType<T>) => Promise<ReturnType<T>>;
|
|
153
164
|
interface Pausable {
|
|
154
165
|
/**
|
|
155
|
-
* A ref indicate whether a
|
|
166
|
+
* A ref indicate whether a pausable instance is active
|
|
156
167
|
*/
|
|
157
|
-
isActive: Ref<boolean
|
|
168
|
+
isActive: Readonly<Ref<boolean>>;
|
|
158
169
|
/**
|
|
159
170
|
* Temporary pause the effect from executing
|
|
160
171
|
*/
|
|
@@ -164,11 +175,11 @@ interface Pausable {
|
|
|
164
175
|
*/
|
|
165
176
|
resume: Fn;
|
|
166
177
|
}
|
|
167
|
-
interface Stoppable {
|
|
178
|
+
interface Stoppable<StartFnArgs extends any[] = any[]> {
|
|
168
179
|
/**
|
|
169
180
|
* A ref indicate whether a stoppable instance is executing
|
|
170
181
|
*/
|
|
171
|
-
isPending: Ref<boolean
|
|
182
|
+
isPending: Readonly<Ref<boolean>>;
|
|
172
183
|
/**
|
|
173
184
|
* Stop the effect from executing
|
|
174
185
|
*/
|
|
@@ -176,12 +187,12 @@ interface Stoppable {
|
|
|
176
187
|
/**
|
|
177
188
|
* Start the effects
|
|
178
189
|
*/
|
|
179
|
-
start:
|
|
190
|
+
start: (...args: StartFnArgs) => void;
|
|
180
191
|
}
|
|
181
192
|
/**
|
|
182
193
|
* @deprecated Use `Stoppable`
|
|
183
194
|
*/
|
|
184
|
-
|
|
195
|
+
type Stopable = Stoppable;
|
|
185
196
|
interface ConfigurableFlush {
|
|
186
197
|
/**
|
|
187
198
|
* Timing for monitoring changes, refer to WatchOptions for more details
|
|
@@ -199,20 +210,20 @@ interface ConfigurableFlushSync {
|
|
|
199
210
|
*/
|
|
200
211
|
flush?: WatchOptions['flush'];
|
|
201
212
|
}
|
|
202
|
-
|
|
213
|
+
type MapSources<T> = {
|
|
203
214
|
[K in keyof T]: T[K] extends WatchSource<infer V> ? V : never;
|
|
204
215
|
};
|
|
205
|
-
|
|
216
|
+
type MapOldSources<T, Immediate> = {
|
|
206
217
|
[K in keyof T]: T[K] extends WatchSource<infer V> ? Immediate extends true ? V | undefined : V : never;
|
|
207
218
|
};
|
|
208
219
|
|
|
209
|
-
|
|
220
|
+
type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
|
|
210
221
|
interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
|
|
211
222
|
fn: FunctionArgs<Args, This>;
|
|
212
223
|
args: Args;
|
|
213
224
|
thisArg: This;
|
|
214
225
|
}
|
|
215
|
-
|
|
226
|
+
type EventFilter<Args extends any[] = any[], This = any, Invoke extends AnyFn = AnyFn> = (invoke: Invoke, options: FunctionWrapperOptions<Args, This>) => ReturnType<Invoke> | Promise<ReturnType<Invoke>>;
|
|
216
227
|
interface ConfigurableEventFilter {
|
|
217
228
|
/**
|
|
218
229
|
* Filter for if events should to be received.
|
|
@@ -226,28 +237,35 @@ interface DebounceFilterOptions {
|
|
|
226
237
|
* The maximum time allowed to be delayed before it's invoked.
|
|
227
238
|
* In milliseconds.
|
|
228
239
|
*/
|
|
229
|
-
maxWait?: number
|
|
240
|
+
maxWait?: MaybeComputedRef<number>;
|
|
241
|
+
/**
|
|
242
|
+
* Whether to reject the last call if it's been cancel.
|
|
243
|
+
*
|
|
244
|
+
* @default false
|
|
245
|
+
*/
|
|
246
|
+
rejectOnCancel?: boolean;
|
|
230
247
|
}
|
|
231
248
|
/**
|
|
232
249
|
* @internal
|
|
233
250
|
*/
|
|
234
|
-
declare function createFilterWrapper<T extends
|
|
251
|
+
declare function createFilterWrapper<T extends AnyFn>(filter: EventFilter, fn: T): (this: any, ...args: ArgumentsType<T>) => Promise<ReturnType<T>>;
|
|
235
252
|
declare const bypassFilter: EventFilter;
|
|
236
253
|
/**
|
|
237
254
|
* Create an EventFilter that debounce the events
|
|
238
255
|
*
|
|
239
256
|
* @param ms
|
|
240
|
-
* @param
|
|
257
|
+
* @param options
|
|
241
258
|
*/
|
|
242
|
-
declare function debounceFilter(ms:
|
|
259
|
+
declare function debounceFilter(ms: MaybeComputedRef<number>, options?: DebounceFilterOptions): EventFilter<any[], any, AnyFn>;
|
|
243
260
|
/**
|
|
244
261
|
* Create an EventFilter that throttle the events
|
|
245
262
|
*
|
|
246
263
|
* @param ms
|
|
247
264
|
* @param [trailing=true]
|
|
248
265
|
* @param [leading=true]
|
|
266
|
+
* @param [rejectOnCancel=false]
|
|
249
267
|
*/
|
|
250
|
-
declare function throttleFilter(ms:
|
|
268
|
+
declare function throttleFilter(ms: MaybeComputedRef<number>, trailing?: boolean, leading?: boolean, rejectOnCancel?: boolean): EventFilter<any[], any, AnyFn>;
|
|
251
269
|
/**
|
|
252
270
|
* EventFilter that gives extra controls to pause and resume the filter
|
|
253
271
|
*
|
|
@@ -259,6 +277,7 @@ declare function pausableFilter(extendFilter?: EventFilter): Pausable & {
|
|
|
259
277
|
};
|
|
260
278
|
|
|
261
279
|
declare function __onlyVue3(name?: string): void;
|
|
280
|
+
declare function __onlyVue27Plus(name?: string): void;
|
|
262
281
|
declare const directiveHooks: {
|
|
263
282
|
mounted: "mounted";
|
|
264
283
|
updated: "updated";
|
|
@@ -304,7 +323,7 @@ declare function increaseWithUnit(target: string | number, delta: number): strin
|
|
|
304
323
|
*
|
|
305
324
|
* @category Object
|
|
306
325
|
*/
|
|
307
|
-
declare function objectPick<O, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Pick<O, T>;
|
|
326
|
+
declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Pick<O, T>;
|
|
308
327
|
|
|
309
328
|
/**
|
|
310
329
|
* Shorthand for accessing `ref.value`
|
|
@@ -316,32 +335,19 @@ declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>
|
|
|
316
335
|
declare function isDefined<T>(v: ComputedRef<T>): v is ComputedRef<Exclude<T, null | undefined>>;
|
|
317
336
|
declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>;
|
|
318
337
|
|
|
319
|
-
/**
|
|
320
|
-
* `AND` conditions for refs.
|
|
321
|
-
*
|
|
322
|
-
* @see https://vueuse.org/logicAnd
|
|
323
|
-
*/
|
|
324
|
-
declare function logicAnd(...args: MaybeRef<any>[]): ComputedRef<boolean>;
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* `NOT` conditions for refs.
|
|
328
|
-
*
|
|
329
|
-
* @see https://vueuse.org/logicNot
|
|
330
|
-
*/
|
|
331
|
-
declare function logicNot(v: MaybeRef<any>): ComputedRef<boolean>;
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* `OR` conditions for refs.
|
|
335
|
-
*
|
|
336
|
-
* @see https://vueuse.org/logicOr
|
|
337
|
-
*/
|
|
338
|
-
declare function logicOr(...args: MaybeRef<any>[]): ComputedRef<boolean>;
|
|
339
|
-
|
|
340
338
|
declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: A): T & A;
|
|
341
339
|
|
|
342
|
-
|
|
343
|
-
[K in keyof A]: MaybeRef<A[K]>;
|
|
340
|
+
type Reactified<T, Computed extends boolean> = T extends (...args: infer A) => infer R ? (...args: {
|
|
341
|
+
[K in keyof A]: Computed extends true ? MaybeComputedRef<A[K]> : MaybeRef<A[K]>;
|
|
344
342
|
}) => ComputedRef<R> : never;
|
|
343
|
+
interface ReactifyOptions<T extends boolean> {
|
|
344
|
+
/**
|
|
345
|
+
* Accept passing a function as a reactive getter
|
|
346
|
+
*
|
|
347
|
+
* @default true
|
|
348
|
+
*/
|
|
349
|
+
computedGetter?: T;
|
|
350
|
+
}
|
|
345
351
|
/**
|
|
346
352
|
* Converts plain function into a reactive function.
|
|
347
353
|
* The converted function accepts refs as it's arguments
|
|
@@ -349,12 +355,12 @@ declare type Reactify<T> = T extends (...args: infer A) => infer R ? (...args: {
|
|
|
349
355
|
*
|
|
350
356
|
* @param fn - Source function
|
|
351
357
|
*/
|
|
352
|
-
declare function reactify<T extends Function>(fn: T):
|
|
358
|
+
declare function reactify<T extends Function, K extends boolean = true>(fn: T, options?: ReactifyOptions<K>): Reactified<T, K>;
|
|
353
359
|
|
|
354
|
-
|
|
355
|
-
[K in Keys]: T[K] extends (...args: any[]) => any ?
|
|
360
|
+
type ReactifyNested<T, Keys extends keyof T = keyof T, S extends boolean = true> = {
|
|
361
|
+
[K in Keys]: T[K] extends (...args: any[]) => any ? Reactified<T[K], S> : T[K];
|
|
356
362
|
};
|
|
357
|
-
interface ReactifyObjectOptions {
|
|
363
|
+
interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
|
|
358
364
|
/**
|
|
359
365
|
* Includes names from Object.getOwnPropertyNames
|
|
360
366
|
*
|
|
@@ -365,8 +371,8 @@ interface ReactifyObjectOptions {
|
|
|
365
371
|
/**
|
|
366
372
|
* Apply `reactify` to an object
|
|
367
373
|
*/
|
|
368
|
-
declare function reactifyObject<T extends object, Keys extends keyof T>(obj: T, keys?: (keyof T)[]): ReactifyNested<T, Keys>;
|
|
369
|
-
declare function reactifyObject<T extends object>(obj: T, options?: ReactifyObjectOptions): ReactifyNested<T>;
|
|
374
|
+
declare function reactifyObject<T extends object, Keys extends keyof T>(obj: T, keys?: (keyof T)[]): ReactifyNested<T, Keys, true>;
|
|
375
|
+
declare function reactifyObject<T extends object, S extends boolean = true>(obj: T, options?: ReactifyObjectOptions<S>): ReactifyNested<T, keyof T, S>;
|
|
370
376
|
|
|
371
377
|
/**
|
|
372
378
|
* Computed reactive object.
|
|
@@ -376,14 +382,14 @@ declare function reactiveComputed<T extends {}>(fn: () => T): T;
|
|
|
376
382
|
/**
|
|
377
383
|
* Reactively omit fields from a reactive object
|
|
378
384
|
*
|
|
379
|
-
* @see https://vueuse.
|
|
385
|
+
* @see https://vueuse.org/reactiveOmit
|
|
380
386
|
*/
|
|
381
387
|
declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Omit<T, K>;
|
|
382
388
|
|
|
383
389
|
/**
|
|
384
390
|
* Reactively pick fields from a reactive object
|
|
385
391
|
*
|
|
386
|
-
* @see https://vueuse.
|
|
392
|
+
* @see https://vueuse.org/reactivePick
|
|
387
393
|
*/
|
|
388
394
|
declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): {
|
|
389
395
|
[S in K]: UnwrapRef<T[S]>;
|
|
@@ -396,14 +402,14 @@ declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...ke
|
|
|
396
402
|
* @param defaultValue The value which will be set.
|
|
397
403
|
* @param afterMs A zero-or-greater delay in milliseconds.
|
|
398
404
|
*/
|
|
399
|
-
declare function refAutoReset<T>(defaultValue: T, afterMs?:
|
|
405
|
+
declare function refAutoReset<T>(defaultValue: T, afterMs?: MaybeComputedRef<number>): Ref<T>;
|
|
400
406
|
|
|
401
407
|
/**
|
|
402
408
|
* Debounce updates of a ref.
|
|
403
409
|
*
|
|
404
410
|
* @return A new debounced ref.
|
|
405
411
|
*/
|
|
406
|
-
declare function refDebounced<T>(value: Ref<T>, ms?: number
|
|
412
|
+
declare function refDebounced<T>(value: Ref<T>, ms?: MaybeComputedRef<number>, options?: DebounceFilterOptions): Readonly<Ref<T>>;
|
|
407
413
|
|
|
408
414
|
/**
|
|
409
415
|
* Apply default value to a ref.
|
|
@@ -434,7 +440,7 @@ interface ControlledRefOptions<T> {
|
|
|
434
440
|
/**
|
|
435
441
|
* Callback function after the ref changed
|
|
436
442
|
*
|
|
437
|
-
* This
|
|
443
|
+
* This happens synchronously, with less overhead compare to `watch`
|
|
438
444
|
*/
|
|
439
445
|
onChanged?: (value: T, oldValue: T) => void;
|
|
440
446
|
}
|
|
@@ -462,16 +468,17 @@ declare const controlledRef: typeof refWithControl;
|
|
|
462
468
|
*/
|
|
463
469
|
declare function resolveRef<T>(r: MaybeComputedRef<T>): ComputedRef<T>;
|
|
464
470
|
declare function resolveRef<T>(r: MaybeRef<T>): Ref<T>;
|
|
471
|
+
declare function resolveRef<T>(r: T): Ref<T>;
|
|
465
472
|
|
|
466
473
|
/**
|
|
467
|
-
*
|
|
474
|
+
* Get the value of value/ref/getter.
|
|
468
475
|
*/
|
|
469
476
|
declare function resolveUnref<T>(r: MaybeComputedRef<T>): T;
|
|
470
477
|
|
|
471
478
|
declare function set<T>(ref: Ref<T>, value: T): void;
|
|
472
479
|
declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
|
|
473
480
|
|
|
474
|
-
interface SyncRefOptions extends ConfigurableFlushSync {
|
|
481
|
+
interface SyncRefOptions<L, R = L> extends ConfigurableFlushSync {
|
|
475
482
|
/**
|
|
476
483
|
* Watch deeply
|
|
477
484
|
*
|
|
@@ -485,11 +492,18 @@ interface SyncRefOptions extends ConfigurableFlushSync {
|
|
|
485
492
|
*/
|
|
486
493
|
immediate?: boolean;
|
|
487
494
|
/**
|
|
488
|
-
* Direction of syncing
|
|
495
|
+
* Direction of syncing. Value will be redefined if you define syncConvertors
|
|
489
496
|
*
|
|
490
497
|
* @default 'both'
|
|
491
498
|
*/
|
|
492
499
|
direction?: 'ltr' | 'rtl' | 'both';
|
|
500
|
+
/**
|
|
501
|
+
* Custom transform function
|
|
502
|
+
*/
|
|
503
|
+
transform?: {
|
|
504
|
+
ltr?: (left: L) => R;
|
|
505
|
+
rtl?: (right: R) => L;
|
|
506
|
+
};
|
|
493
507
|
}
|
|
494
508
|
/**
|
|
495
509
|
* Two-way refs synchronization.
|
|
@@ -497,7 +511,7 @@ interface SyncRefOptions extends ConfigurableFlushSync {
|
|
|
497
511
|
* @param left
|
|
498
512
|
* @param right
|
|
499
513
|
*/
|
|
500
|
-
declare function syncRef<R
|
|
514
|
+
declare function syncRef<L, R = L>(left: Ref<L>, right: Ref<R>, options?: SyncRefOptions<L, R>): () => void;
|
|
501
515
|
|
|
502
516
|
interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
503
517
|
/**
|
|
@@ -607,10 +621,10 @@ interface UntilBaseInstance<T, Not extends boolean = false> {
|
|
|
607
621
|
changed(options?: UntilToMatchOptions): Promise<T>;
|
|
608
622
|
changedTimes(n?: number, options?: UntilToMatchOptions): Promise<T>;
|
|
609
623
|
}
|
|
610
|
-
|
|
624
|
+
type Falsy = false | void | null | undefined | 0 | 0n | '';
|
|
611
625
|
interface UntilValueInstance<T, Not extends boolean = false> extends UntilBaseInstance<T, Not> {
|
|
612
626
|
readonly not: UntilValueInstance<T, Not extends true ? false : true>;
|
|
613
|
-
toBe<P = T>(value:
|
|
627
|
+
toBe<P = T>(value: MaybeComputedRef<P>, options?: UntilToMatchOptions): Not extends true ? Promise<T> : Promise<P>;
|
|
614
628
|
toBeTruthy(options?: UntilToMatchOptions): Not extends true ? Promise<T & Falsy> : Promise<Exclude<T, Falsy>>;
|
|
615
629
|
toBeNull(options?: UntilToMatchOptions): Not extends true ? Promise<Exclude<T, null>> : Promise<null>;
|
|
616
630
|
toBeUndefined(options?: UntilToMatchOptions): Not extends true ? Promise<Exclude<T, undefined>> : Promise<undefined>;
|
|
@@ -618,7 +632,7 @@ interface UntilValueInstance<T, Not extends boolean = false> extends UntilBaseIn
|
|
|
618
632
|
}
|
|
619
633
|
interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
|
|
620
634
|
readonly not: UntilArrayInstance<T>;
|
|
621
|
-
toContains(value:
|
|
635
|
+
toContains(value: MaybeComputedRef<ElementOf<ShallowUnwrapRef<T>>>, options?: UntilToMatchOptions): Promise<T>;
|
|
622
636
|
}
|
|
623
637
|
/**
|
|
624
638
|
* Promised one-time watch for changes
|
|
@@ -633,8 +647,116 @@ interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
|
|
|
633
647
|
* alert('Counter is now larger than 7!')
|
|
634
648
|
* ```
|
|
635
649
|
*/
|
|
636
|
-
declare function until<T extends unknown[]>(r: WatchSource<T> |
|
|
637
|
-
declare function until<T>(r: WatchSource<T> |
|
|
650
|
+
declare function until<T extends unknown[]>(r: WatchSource<T> | MaybeComputedRef<T>): UntilArrayInstance<T>;
|
|
651
|
+
declare function until<T>(r: WatchSource<T> | MaybeComputedRef<T>): UntilValueInstance<T>;
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Reactive `Array.every`
|
|
655
|
+
*
|
|
656
|
+
* @see https://vueuse.org/useArrayEvery
|
|
657
|
+
* @param {Array} list - the array was called upon.
|
|
658
|
+
* @param fn - a function to test each element.
|
|
659
|
+
*
|
|
660
|
+
* @returns {boolean} **true** if the `fn` function returns a **truthy** value for every element from the array. Otherwise, **false**.
|
|
661
|
+
*/
|
|
662
|
+
declare function useArrayEvery<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<boolean>;
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Reactive `Array.filter`
|
|
666
|
+
*
|
|
667
|
+
* @see https://vueuse.org/useArrayFilter
|
|
668
|
+
* @param {Array} list - the array was called upon.
|
|
669
|
+
* @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
|
|
670
|
+
*
|
|
671
|
+
* @returns {Array} a shallow copy of a portion of the given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned.
|
|
672
|
+
*/
|
|
673
|
+
declare function useArrayFilter<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: T[]) => boolean): ComputedRef<T[]>;
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Reactive `Array.find`
|
|
677
|
+
*
|
|
678
|
+
* @see https://vueuse.org/useArrayFind
|
|
679
|
+
* @param {Array} list - the array was called upon.
|
|
680
|
+
* @param fn - a function to test each element.
|
|
681
|
+
*
|
|
682
|
+
* @returns the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
683
|
+
*/
|
|
684
|
+
declare function useArrayFind<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => boolean): ComputedRef<T | undefined>;
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Reactive `Array.findIndex`
|
|
688
|
+
*
|
|
689
|
+
* @see https://vueuse.org/useArrayFindIndex
|
|
690
|
+
* @param {Array} list - the array was called upon.
|
|
691
|
+
* @param fn - a function to test each element.
|
|
692
|
+
*
|
|
693
|
+
* @returns {number} the index of the first element in the array that passes the test. Otherwise, "-1".
|
|
694
|
+
*/
|
|
695
|
+
declare function useArrayFindIndex<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<number>;
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Reactive `Array.join`
|
|
699
|
+
*
|
|
700
|
+
* @see https://vueuse.org/useArrayJoin
|
|
701
|
+
* @param {Array} list - the array was called upon.
|
|
702
|
+
* @param {string} separator - a string to separate each pair of adjacent elements of the array. If omitted, the array elements are separated with a comma (",").
|
|
703
|
+
*
|
|
704
|
+
* @returns {string} a string with all array elements joined. If arr.length is 0, the empty string is returned.
|
|
705
|
+
*/
|
|
706
|
+
declare function useArrayJoin(list: MaybeComputedRef<MaybeComputedRef<any>[]>, separator?: MaybeComputedRef<string>): ComputedRef<string>;
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Reactive `Array.map`
|
|
710
|
+
*
|
|
711
|
+
* @see https://vueuse.org/useArrayMap
|
|
712
|
+
* @param {Array} list - the array was called upon.
|
|
713
|
+
* @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
|
|
714
|
+
*
|
|
715
|
+
* @returns {Array} a new array with each element being the result of the callback function.
|
|
716
|
+
*/
|
|
717
|
+
declare function useArrayMap<T, U = T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: T[]) => U): ComputedRef<U[]>;
|
|
718
|
+
|
|
719
|
+
type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
|
|
720
|
+
/**
|
|
721
|
+
* Reactive `Array.reduce`
|
|
722
|
+
*
|
|
723
|
+
* @see https://vueuse.org/useArrayReduce
|
|
724
|
+
* @param {Array} list - the array was called upon.
|
|
725
|
+
* @param reducer - a "reducer" function.
|
|
726
|
+
*
|
|
727
|
+
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
728
|
+
*/
|
|
729
|
+
declare function useArrayReduce<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, reducer: UseArrayReducer<T, T, T>): ComputedRef<T>;
|
|
730
|
+
/**
|
|
731
|
+
* Reactive `Array.reduce`
|
|
732
|
+
*
|
|
733
|
+
* @see https://vueuse.org/useArrayReduce
|
|
734
|
+
* @param {Array} list - the array was called upon.
|
|
735
|
+
* @param reducer - a "reducer" function.
|
|
736
|
+
* @param initialValue - a value to be initialized the first time when the callback is called.
|
|
737
|
+
*
|
|
738
|
+
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
739
|
+
*/
|
|
740
|
+
declare function useArrayReduce<T, U>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeComputedRef<U>): ComputedRef<U>;
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Reactive `Array.some`
|
|
744
|
+
*
|
|
745
|
+
* @see https://vueuse.org/useArraySome
|
|
746
|
+
* @param {Array} list - the array was called upon.
|
|
747
|
+
* @param fn - a function to test each element.
|
|
748
|
+
*
|
|
749
|
+
* @returns {boolean} **true** if the `fn` function returns a **truthy** value for any element from the array. Otherwise, **false**.
|
|
750
|
+
*/
|
|
751
|
+
declare function useArraySome<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<boolean>;
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* reactive unique array
|
|
755
|
+
* @see https://vueuse.org/useArrayUnique
|
|
756
|
+
* @param {Array} list - the array was called upon.
|
|
757
|
+
* @returns {Array} A computed ref that returns a unique array of items.
|
|
758
|
+
*/
|
|
759
|
+
declare function useArrayUnique<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>): ComputedRef<T[]>;
|
|
638
760
|
|
|
639
761
|
interface UseCounterOptions {
|
|
640
762
|
min?: number;
|
|
@@ -656,31 +778,46 @@ declare function useCounter(initialValue?: number, options?: UseCounterOptions):
|
|
|
656
778
|
reset: (val?: number) => number;
|
|
657
779
|
};
|
|
658
780
|
|
|
659
|
-
|
|
660
|
-
|
|
781
|
+
type DateLike = Date | number | string | undefined;
|
|
782
|
+
interface UseDateFormatOptions {
|
|
783
|
+
/**
|
|
784
|
+
* The locale(s) to used for dd/ddd/dddd/MMM/MMMM format
|
|
785
|
+
*
|
|
786
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
|
|
787
|
+
*/
|
|
788
|
+
locales?: Intl.LocalesArgument;
|
|
789
|
+
/**
|
|
790
|
+
* A custom function to re-modify the way to display meridiem
|
|
791
|
+
*
|
|
792
|
+
*/
|
|
793
|
+
customMeridiem?: (hours: number, minutes: number, isLowercase?: boolean, hasPeriod?: boolean) => string;
|
|
794
|
+
}
|
|
795
|
+
declare const formatDate: (date: Date, formatStr: string, options?: UseDateFormatOptions) => string;
|
|
661
796
|
declare const normalizeDate: (date: DateLike) => Date;
|
|
662
797
|
/**
|
|
663
798
|
* Get the formatted date according to the string of tokens passed in.
|
|
664
799
|
*
|
|
665
800
|
* @see https://vueuse.org/useDateFormat
|
|
666
|
-
* @param date
|
|
667
|
-
* @param formatStr
|
|
801
|
+
* @param date - The date to format, can either be a `Date` object, a timestamp, or a string
|
|
802
|
+
* @param formatStr - The combination of tokens to format the date
|
|
803
|
+
* @param options - UseDateFormatOptions
|
|
668
804
|
*/
|
|
669
|
-
declare function useDateFormat(date:
|
|
670
|
-
|
|
805
|
+
declare function useDateFormat(date: MaybeComputedRef<DateLike>, formatStr?: MaybeComputedRef<string>, options?: UseDateFormatOptions): vue_demi.ComputedRef<string>;
|
|
806
|
+
type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
671
807
|
|
|
672
808
|
/**
|
|
673
809
|
* Debounce execution of a function.
|
|
674
810
|
*
|
|
811
|
+
* @see https://vueuse.org/useDebounceFn
|
|
675
812
|
* @param fn A function to be executed after delay milliseconds debounced.
|
|
676
813
|
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
677
814
|
* @param opts options
|
|
678
815
|
*
|
|
679
816
|
* @return A new, debounce, function.
|
|
680
817
|
*/
|
|
681
|
-
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?:
|
|
818
|
+
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeComputedRef<number>, options?: DebounceFilterOptions): PromisifyFn<T>;
|
|
682
819
|
|
|
683
|
-
interface
|
|
820
|
+
interface UseIntervalOptions<Controls extends boolean> {
|
|
684
821
|
/**
|
|
685
822
|
* Expose more controls
|
|
686
823
|
*
|
|
@@ -688,18 +825,29 @@ interface IntervalOptions<Controls extends boolean> {
|
|
|
688
825
|
*/
|
|
689
826
|
controls?: Controls;
|
|
690
827
|
/**
|
|
691
|
-
*
|
|
828
|
+
* Execute the update immediately on calling
|
|
692
829
|
*
|
|
693
830
|
* @default true
|
|
694
831
|
*/
|
|
695
832
|
immediate?: boolean;
|
|
833
|
+
/**
|
|
834
|
+
* Callback on every interval
|
|
835
|
+
*/
|
|
836
|
+
callback?: (count: number) => void;
|
|
696
837
|
}
|
|
697
|
-
|
|
698
|
-
|
|
838
|
+
/**
|
|
839
|
+
* Reactive counter increases on every interval
|
|
840
|
+
*
|
|
841
|
+
* @see https://vueuse.org/useInterval
|
|
842
|
+
* @param interval
|
|
843
|
+
* @param options
|
|
844
|
+
*/
|
|
845
|
+
declare function useInterval(interval?: MaybeComputedRef<number>, options?: UseIntervalOptions<false>): Ref<number>;
|
|
846
|
+
declare function useInterval(interval: MaybeComputedRef<number>, options: UseIntervalOptions<true>): {
|
|
699
847
|
counter: Ref<number>;
|
|
700
848
|
} & Pausable;
|
|
701
849
|
|
|
702
|
-
interface
|
|
850
|
+
interface UseIntervalFnOptions {
|
|
703
851
|
/**
|
|
704
852
|
* Start the timer immediately
|
|
705
853
|
*
|
|
@@ -720,7 +868,7 @@ interface IntervalFnOptions {
|
|
|
720
868
|
* @param interval
|
|
721
869
|
* @param options
|
|
722
870
|
*/
|
|
723
|
-
declare function useIntervalFn(cb: Fn, interval?:
|
|
871
|
+
declare function useIntervalFn(cb: Fn, interval?: MaybeComputedRef<number>, options?: UseIntervalFnOptions): Pausable;
|
|
724
872
|
|
|
725
873
|
interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends number | null | undefined = undefined> extends WatchOptions<Immediate> {
|
|
726
874
|
initialValue?: InitialValue;
|
|
@@ -742,15 +890,17 @@ declare function useLastChanged(source: WatchSource, options: UseLastChangedOpti
|
|
|
742
890
|
* to `callback` when the throttled-function is executed.
|
|
743
891
|
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
744
892
|
*
|
|
745
|
-
* @param [trailing=
|
|
893
|
+
* @param [trailing=false] if true, call fn again after the time is up
|
|
746
894
|
*
|
|
747
895
|
* @param [leading=true] if true, call fn on the leading edge of the ms timeout
|
|
748
896
|
*
|
|
897
|
+
* @param [rejectOnCancel=false] if true, reject the last call if it's been cancel
|
|
898
|
+
*
|
|
749
899
|
* @return A new, throttled, function.
|
|
750
900
|
*/
|
|
751
|
-
declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?:
|
|
901
|
+
declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?: MaybeComputedRef<number>, trailing?: boolean, leading?: boolean, rejectOnCancel?: boolean): PromisifyFn<T>;
|
|
752
902
|
|
|
753
|
-
interface
|
|
903
|
+
interface UseTimeoutFnOptions {
|
|
754
904
|
/**
|
|
755
905
|
* Start the timer immediate after calling this function
|
|
756
906
|
*
|
|
@@ -763,33 +913,68 @@ interface TimeoutFnOptions {
|
|
|
763
913
|
*
|
|
764
914
|
* @param cb
|
|
765
915
|
* @param interval
|
|
766
|
-
* @param
|
|
916
|
+
* @param options
|
|
767
917
|
*/
|
|
768
|
-
declare function useTimeoutFn
|
|
918
|
+
declare function useTimeoutFn<CallbackFn extends (...args: any[]) => any>(cb: CallbackFn, interval: MaybeComputedRef<number>, options?: UseTimeoutFnOptions): Stoppable<Parameters<CallbackFn> | []>;
|
|
769
919
|
|
|
770
|
-
interface
|
|
920
|
+
interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOptions {
|
|
771
921
|
/**
|
|
772
922
|
* Expose more controls
|
|
773
923
|
*
|
|
774
924
|
* @default false
|
|
775
925
|
*/
|
|
776
926
|
controls?: Controls;
|
|
927
|
+
/**
|
|
928
|
+
* Callback on timeout
|
|
929
|
+
*/
|
|
930
|
+
callback?: Fn;
|
|
777
931
|
}
|
|
778
932
|
/**
|
|
779
933
|
* Update value after a given time with controls.
|
|
780
934
|
*
|
|
781
935
|
* @see {@link https://vueuse.org/useTimeout}
|
|
782
936
|
* @param interval
|
|
783
|
-
* @param
|
|
937
|
+
* @param options
|
|
784
938
|
*/
|
|
785
|
-
declare function useTimeout(interval?: number, options?:
|
|
786
|
-
declare function useTimeout(interval: number, options:
|
|
939
|
+
declare function useTimeout(interval?: number, options?: UseTimeoutOptions<false>): ComputedRef<boolean>;
|
|
940
|
+
declare function useTimeout(interval: number, options: UseTimeoutOptions<true>): {
|
|
787
941
|
ready: ComputedRef<boolean>;
|
|
788
942
|
} & Stoppable;
|
|
789
943
|
|
|
944
|
+
interface UseToNumberOptions {
|
|
945
|
+
/**
|
|
946
|
+
* Method to use to convert the value to a number.
|
|
947
|
+
*
|
|
948
|
+
* @default 'parseFloat'
|
|
949
|
+
*/
|
|
950
|
+
method?: 'parseFloat' | 'parseInt';
|
|
951
|
+
/**
|
|
952
|
+
* The base in mathematical numeral systems passed to `parseInt`.
|
|
953
|
+
* Only works with `method: 'parseInt'`
|
|
954
|
+
*/
|
|
955
|
+
radix?: number;
|
|
956
|
+
/**
|
|
957
|
+
* Replace NaN with zero
|
|
958
|
+
*
|
|
959
|
+
* @default false
|
|
960
|
+
*/
|
|
961
|
+
nanToZero?: boolean;
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Computed reactive object.
|
|
965
|
+
*/
|
|
966
|
+
declare function useToNumber(value: MaybeComputedRef<number | string>, options?: UseToNumberOptions): ComputedRef<number>;
|
|
967
|
+
|
|
968
|
+
/**
|
|
969
|
+
* Reactively convert a ref to string.
|
|
970
|
+
*
|
|
971
|
+
* @see https://vueuse.org/useToString
|
|
972
|
+
*/
|
|
973
|
+
declare function useToString(value: MaybeComputedRef<unknown>): ComputedRef<string>;
|
|
974
|
+
|
|
790
975
|
interface UseToggleOptions<Truthy, Falsy> {
|
|
791
|
-
truthyValue?:
|
|
792
|
-
falsyValue?:
|
|
976
|
+
truthyValue?: MaybeComputedRef<Truthy>;
|
|
977
|
+
falsyValue?: MaybeComputedRef<Falsy>;
|
|
793
978
|
}
|
|
794
979
|
declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(initialValue: Ref<T>, options?: UseToggleOptions<Truthy, Falsy>): (value?: T) => T;
|
|
795
980
|
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [Ref<T>, (value?: T) => T];
|
|
@@ -809,7 +994,7 @@ declare function watchWithFilter<T, Immediate extends Readonly<boolean> = false>
|
|
|
809
994
|
declare function watchWithFilter<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchStopHandle;
|
|
810
995
|
|
|
811
996
|
interface WatchAtMostOptions<Immediate> extends WatchWithFilterOptions<Immediate> {
|
|
812
|
-
count:
|
|
997
|
+
count: MaybeComputedRef<number>;
|
|
813
998
|
}
|
|
814
999
|
interface WatchAtMostReturn {
|
|
815
1000
|
stop: WatchStopHandle;
|
|
@@ -819,13 +1004,13 @@ declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immedia
|
|
|
819
1004
|
declare function watchAtMost<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
|
|
820
1005
|
|
|
821
1006
|
interface WatchDebouncedOptions<Immediate> extends WatchOptions<Immediate>, DebounceFilterOptions {
|
|
822
|
-
debounce?:
|
|
1007
|
+
debounce?: MaybeComputedRef<number>;
|
|
823
1008
|
}
|
|
824
1009
|
declare function watchDebounced<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle;
|
|
825
1010
|
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;
|
|
826
1011
|
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;
|
|
827
1012
|
|
|
828
|
-
|
|
1013
|
+
type IgnoredUpdater = (updater: () => void) => void;
|
|
829
1014
|
interface WatchIgnorableReturn {
|
|
830
1015
|
ignoreUpdates: IgnoredUpdater;
|
|
831
1016
|
ignorePrevAsyncUpdates: () => void;
|
|
@@ -846,7 +1031,7 @@ declare function watchPausable<T, Immediate extends Readonly<boolean> = false>(s
|
|
|
846
1031
|
declare function watchPausable<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchPausableReturn;
|
|
847
1032
|
|
|
848
1033
|
interface WatchThrottledOptions<Immediate> extends WatchOptions<Immediate> {
|
|
849
|
-
throttle?:
|
|
1034
|
+
throttle?: MaybeComputedRef<number>;
|
|
850
1035
|
trailing?: boolean;
|
|
851
1036
|
leading?: boolean;
|
|
852
1037
|
}
|
|
@@ -858,8 +1043,8 @@ interface WatchTriggerableReturn<FnReturnT = void> extends WatchIgnorableReturn
|
|
|
858
1043
|
/** Execute `WatchCallback` immediately */
|
|
859
1044
|
trigger: () => FnReturnT;
|
|
860
1045
|
}
|
|
861
|
-
|
|
862
|
-
|
|
1046
|
+
type OnCleanup = (cleanupFn: () => void) => void;
|
|
1047
|
+
type WatchTriggerableCallback<V = any, OV = any, R = void> = (value: V, oldValue: OV, onCleanup: OnCleanup) => R;
|
|
863
1048
|
declare function watchTriggerable<T extends Readonly<WatchSource<unknown>[]>, FnReturnT>(sources: [...T], cb: WatchTriggerableCallback<MapSources<T>, MapOldSources<T, true>, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
864
1049
|
declare function watchTriggerable<T, FnReturnT>(source: WatchSource<T>, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
865
1050
|
declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
@@ -867,8 +1052,8 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
|
|
|
867
1052
|
/**
|
|
868
1053
|
* Shorthand for watching value to be truthy
|
|
869
1054
|
*
|
|
870
|
-
* @see https://vueuse.
|
|
1055
|
+
* @see https://vueuse.org/whenever
|
|
871
1056
|
*/
|
|
872
1057
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
|
|
873
1058
|
|
|
874
|
-
export { Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater,
|
|
1059
|
+
export { AnyFn, ArgumentsType, Arrayable, Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater, MapOldSources, MapSources, MaybeComputedRef, MaybeReadonlyRef, MaybeRef, Pausable, PromisifyFn, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyOptions, RemovableRef, RemoveableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stopable, Stoppable, SyncRefOptions, SyncRefsOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayReducer, UseCounterOptions, UseDateFormatOptions, UseDateFormatReturn, UseIntervalFnOptions, UseIntervalOptions, UseLastChangedOptions, UseTimeoutFnOptions, UseTimeoutOptions, UseToNumberOptions, UseToggleOptions, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WritableComputedRefWithControl, __onlyVue27Plus, __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|