@histoire/vendors 0.13.1 → 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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _vueuse_shared from '@vueuse/shared';
|
|
2
|
-
import { Fn, MaybeRef, Awaitable, ConfigurableEventFilter, ConfigurableFlush, RemovableRef, EventHookOn,
|
|
2
|
+
import { Fn, MaybeRef, MaybeComputedRef, Awaitable, ConfigurableEventFilter, ConfigurableFlush, RemovableRef, EventHookOn, Arrayable, MaybeReadonlyRef, UseIntervalFnOptions, Pausable, UseTimeoutFnOptions, EventHook } from '@vueuse/shared';
|
|
3
3
|
export * from '@vueuse/shared';
|
|
4
4
|
import * as vue_demi from 'vue-demi';
|
|
5
|
-
import { Ref, InjectionKey, ComputedRef, ComponentPublicInstance, UnwrapRef, WatchOptions, UnwrapNestedRefs, WatchSource, ToRefs } from 'vue-demi';
|
|
5
|
+
import { Ref, InjectionKey, ComputedRef, ComponentPublicInstance, Component, UnwrapRef, WatchOptions, UnwrapNestedRefs, WatchSource, ToRefs, StyleValue, ShallowRef } from 'vue-demi';
|
|
6
6
|
import * as vue from 'vue-demi';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -10,18 +10,26 @@ import * as vue from 'vue-demi';
|
|
|
10
10
|
*
|
|
11
11
|
* @param cancelCallback The provided callback is invoked when a re-evaluation of the computed value is triggered before the previous one finished
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
type AsyncComputedOnCancel = (cancelCallback: Fn) => void;
|
|
14
14
|
interface AsyncComputedOptions {
|
|
15
15
|
/**
|
|
16
16
|
* Should value be evaluated lazily
|
|
17
17
|
*
|
|
18
18
|
* @default false
|
|
19
19
|
*/
|
|
20
|
-
lazy?:
|
|
20
|
+
lazy?: boolean;
|
|
21
21
|
/**
|
|
22
22
|
* Ref passed to receive the updated of async evaluation
|
|
23
23
|
*/
|
|
24
24
|
evaluating?: Ref<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Use shallowRef
|
|
27
|
+
*
|
|
28
|
+
* The default value will be changed to `true` in the next major version
|
|
29
|
+
*
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
shallow?: boolean;
|
|
25
33
|
/**
|
|
26
34
|
* Callback when error is caught.
|
|
27
35
|
*/
|
|
@@ -37,9 +45,9 @@ interface AsyncComputedOptions {
|
|
|
37
45
|
*/
|
|
38
46
|
declare function computedAsync<T>(evaluationCallback: (onCancel: AsyncComputedOnCancel) => T | Promise<T>, initialState?: T, optionsOrRef?: Ref<boolean> | AsyncComputedOptions): Ref<T>;
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
type ComputedInjectGetter<T, K> = (source: T | undefined, ctx?: any) => K;
|
|
49
|
+
type ComputedInjectGetterWithDefault<T, K> = (source: T, ctx?: any) => K;
|
|
50
|
+
type ComputedInjectSetter<T> = (v: T) => void;
|
|
43
51
|
interface WritableComputedInjectOptions<T, K> {
|
|
44
52
|
get: ComputedInjectGetter<T, K>;
|
|
45
53
|
set: ComputedInjectSetter<K>;
|
|
@@ -53,7 +61,7 @@ declare function computedInject<T, K = any>(key: InjectionKey<T> | string, optio
|
|
|
53
61
|
declare function computedInject<T, K = any>(key: InjectionKey<T> | string, getter: ComputedInjectGetterWithDefault<T, K>, defaultSource: T, treatDefaultAsFactory?: false): ComputedRef<K>;
|
|
54
62
|
declare function computedInject<T, K = any>(key: InjectionKey<T> | string, options: WritableComputedInjectOptionsWithDefault<T, K>, defaultSource: T | (() => T), treatDefaultAsFactory: true): ComputedRef<K>;
|
|
55
63
|
|
|
56
|
-
|
|
64
|
+
type UnrefFn<T> = T extends (...args: infer A) => infer R ? (...args: {
|
|
57
65
|
[K in keyof A]: MaybeRef<A[K]>;
|
|
58
66
|
}) => R : never;
|
|
59
67
|
/**
|
|
@@ -62,16 +70,17 @@ declare type UnrefFn<T> = T extends (...args: infer A) => infer R ? (...args: {
|
|
|
62
70
|
*/
|
|
63
71
|
declare const createUnrefFn: <T extends Function>(fn: T) => UnrefFn<T>;
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
type VueInstance = ComponentPublicInstance;
|
|
74
|
+
type MaybeElementRef<T extends MaybeElement = MaybeElement> = MaybeRef<T>;
|
|
75
|
+
type MaybeComputedElementRef<T extends MaybeElement = MaybeElement> = MaybeComputedRef<T>;
|
|
76
|
+
type MaybeElement = HTMLElement | SVGElement | VueInstance | undefined | null;
|
|
77
|
+
type UnRefElementReturn<T extends MaybeElement = MaybeElement> = T extends VueInstance ? Exclude<MaybeElement, VueInstance> : T | undefined;
|
|
69
78
|
/**
|
|
70
79
|
* Get the dom element of a ref of element or Vue component instance
|
|
71
80
|
*
|
|
72
81
|
* @param elRef
|
|
73
82
|
*/
|
|
74
|
-
declare function unrefElement<T extends MaybeElement>(elRef:
|
|
83
|
+
declare function unrefElement<T extends MaybeElement>(elRef: MaybeComputedElementRef<T>): UnRefElementReturn<T>;
|
|
75
84
|
|
|
76
85
|
interface ConfigurableWindow {
|
|
77
86
|
window?: Window;
|
|
@@ -79,6 +88,9 @@ interface ConfigurableWindow {
|
|
|
79
88
|
interface ConfigurableDocument {
|
|
80
89
|
document?: Document;
|
|
81
90
|
}
|
|
91
|
+
interface ConfigurableDocumentOrShadowRoot {
|
|
92
|
+
document?: DocumentOrShadowRoot;
|
|
93
|
+
}
|
|
82
94
|
interface ConfigurableNavigator {
|
|
83
95
|
navigator?: Navigator;
|
|
84
96
|
}
|
|
@@ -94,7 +106,7 @@ interface OnClickOutsideOptions extends ConfigurableWindow {
|
|
|
94
106
|
/**
|
|
95
107
|
* List of elements that should not trigger the event.
|
|
96
108
|
*/
|
|
97
|
-
ignore?: MaybeElementRef[];
|
|
109
|
+
ignore?: (MaybeElementRef | string)[];
|
|
98
110
|
/**
|
|
99
111
|
* Use capturing phase for internal event listener.
|
|
100
112
|
* @default true
|
|
@@ -106,6 +118,11 @@ interface OnClickOutsideOptions extends ConfigurableWindow {
|
|
|
106
118
|
*/
|
|
107
119
|
detectIframe?: boolean;
|
|
108
120
|
}
|
|
121
|
+
type OnClickOutsideHandler<T extends {
|
|
122
|
+
detectIframe: OnClickOutsideOptions['detectIframe'];
|
|
123
|
+
} = {
|
|
124
|
+
detectIframe: false;
|
|
125
|
+
}> = (evt: T['detectIframe'] extends true ? PointerEvent | FocusEvent : PointerEvent) => void;
|
|
109
126
|
/**
|
|
110
127
|
* Listen for clicks outside of an element.
|
|
111
128
|
*
|
|
@@ -114,25 +131,27 @@ interface OnClickOutsideOptions extends ConfigurableWindow {
|
|
|
114
131
|
* @param handler
|
|
115
132
|
* @param options
|
|
116
133
|
*/
|
|
117
|
-
declare function onClickOutside<T extends OnClickOutsideOptions>(target: MaybeElementRef, handler: <
|
|
134
|
+
declare function onClickOutside<T extends OnClickOutsideOptions>(target: MaybeElementRef, handler: OnClickOutsideHandler<{
|
|
135
|
+
detectIframe: T['detectIframe'];
|
|
136
|
+
}>, options?: T): (() => void) | undefined;
|
|
118
137
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
interface
|
|
138
|
+
type KeyPredicate = (event: KeyboardEvent) => boolean;
|
|
139
|
+
type KeyFilter = true | string | string[] | KeyPredicate;
|
|
140
|
+
type KeyStrokeEventName = 'keydown' | 'keypress' | 'keyup';
|
|
141
|
+
interface OnKeyStrokeOptions {
|
|
123
142
|
eventName?: KeyStrokeEventName;
|
|
124
|
-
target?:
|
|
143
|
+
target?: MaybeComputedRef<EventTarget | null | undefined>;
|
|
125
144
|
passive?: boolean;
|
|
126
145
|
}
|
|
146
|
+
declare function onKeyStroke(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: OnKeyStrokeOptions): () => void;
|
|
147
|
+
declare function onKeyStroke(handler: (event: KeyboardEvent) => void, options?: OnKeyStrokeOptions): () => void;
|
|
127
148
|
/**
|
|
128
149
|
* Listen for keyboard keys being stroked.
|
|
129
150
|
*
|
|
130
151
|
* @see https://vueuse.org/onKeyStroke
|
|
131
|
-
* @param key
|
|
132
|
-
* @param handler
|
|
133
|
-
* @param options
|
|
134
152
|
*/
|
|
135
|
-
declare function onKeyStroke(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?:
|
|
153
|
+
declare function onKeyStroke(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: OnKeyStrokeOptions): () => void;
|
|
154
|
+
declare function onKeyStroke(handler: (event: KeyboardEvent) => void, options?: OnKeyStrokeOptions): () => void;
|
|
136
155
|
/**
|
|
137
156
|
* Listen to the keydown event of the given key.
|
|
138
157
|
*
|
|
@@ -141,7 +160,7 @@ declare function onKeyStroke(key: KeyFilter, handler: (event: KeyboardEvent) =>
|
|
|
141
160
|
* @param handler
|
|
142
161
|
* @param options
|
|
143
162
|
*/
|
|
144
|
-
declare function onKeyDown(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<
|
|
163
|
+
declare function onKeyDown(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<OnKeyStrokeOptions, 'eventName'>): () => void;
|
|
145
164
|
/**
|
|
146
165
|
* Listen to the keypress event of the given key.
|
|
147
166
|
*
|
|
@@ -150,7 +169,7 @@ declare function onKeyDown(key: KeyFilter, handler: (event: KeyboardEvent) => vo
|
|
|
150
169
|
* @param handler
|
|
151
170
|
* @param options
|
|
152
171
|
*/
|
|
153
|
-
declare function onKeyPressed(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<
|
|
172
|
+
declare function onKeyPressed(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<OnKeyStrokeOptions, 'eventName'>): () => void;
|
|
154
173
|
/**
|
|
155
174
|
* Listen to the keyup event of the given key.
|
|
156
175
|
*
|
|
@@ -159,7 +178,7 @@ declare function onKeyPressed(key: KeyFilter, handler: (event: KeyboardEvent) =>
|
|
|
159
178
|
* @param handler
|
|
160
179
|
* @param options
|
|
161
180
|
*/
|
|
162
|
-
declare function onKeyUp(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<
|
|
181
|
+
declare function onKeyUp(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<OnKeyStrokeOptions, 'eventName'>): () => void;
|
|
163
182
|
|
|
164
183
|
interface OnLongPressOptions {
|
|
165
184
|
/**
|
|
@@ -195,17 +214,19 @@ declare function onStartTyping(callback: (event: KeyboardEvent) => void, options
|
|
|
195
214
|
* @param key
|
|
196
215
|
* @param initialValue
|
|
197
216
|
*/
|
|
198
|
-
declare function templateRef<T extends HTMLElement | SVGElement | null>(key: string, initialValue?: T | null): Readonly<Ref<T>>;
|
|
217
|
+
declare function templateRef<T extends HTMLElement | SVGElement | Component | null>(key: string, initialValue?: T | null): Readonly<Ref<T>>;
|
|
199
218
|
|
|
219
|
+
interface UseActiveElementOptions extends ConfigurableWindow, ConfigurableDocumentOrShadowRoot {
|
|
220
|
+
}
|
|
200
221
|
/**
|
|
201
222
|
* Reactive `document.activeElement`
|
|
202
223
|
*
|
|
203
224
|
* @see https://vueuse.org/useActiveElement
|
|
204
225
|
* @param options
|
|
205
226
|
*/
|
|
206
|
-
declare function useActiveElement<T extends HTMLElement>(options?:
|
|
227
|
+
declare function useActiveElement<T extends HTMLElement>(options?: UseActiveElementOptions): _vueuse_shared.ComputedRefWithControl<T | null | undefined>;
|
|
207
228
|
|
|
208
|
-
|
|
229
|
+
type UseAsyncQueueTask<T> = (...args: any[]) => T | Promise<T>;
|
|
209
230
|
interface UseAsyncQueueResult<T> {
|
|
210
231
|
state: 'pending' | 'fulfilled' | 'rejected';
|
|
211
232
|
data: T | null;
|
|
@@ -253,7 +274,7 @@ interface UseAsyncStateReturn<Data, Shallow extends boolean> {
|
|
|
253
274
|
error: Ref<unknown>;
|
|
254
275
|
execute: (delay?: number, ...args: any[]) => Promise<Data>;
|
|
255
276
|
}
|
|
256
|
-
interface
|
|
277
|
+
interface UseAsyncStateOptions<Shallow extends boolean, D = any> {
|
|
257
278
|
/**
|
|
258
279
|
* Delay for executing the promise. In milliseconds.
|
|
259
280
|
*
|
|
@@ -273,6 +294,11 @@ interface AsyncStateOptions<Shallow extends boolean> {
|
|
|
273
294
|
* Callback when error is caught.
|
|
274
295
|
*/
|
|
275
296
|
onError?: (e: unknown) => void;
|
|
297
|
+
/**
|
|
298
|
+
* Callback when success is caught.
|
|
299
|
+
* @param {D} data
|
|
300
|
+
*/
|
|
301
|
+
onSuccess?: (data: D) => void;
|
|
276
302
|
/**
|
|
277
303
|
* Sets the state to initialState before executing the promise.
|
|
278
304
|
*
|
|
@@ -289,6 +315,13 @@ interface AsyncStateOptions<Shallow extends boolean> {
|
|
|
289
315
|
* @default true
|
|
290
316
|
*/
|
|
291
317
|
shallow?: Shallow;
|
|
318
|
+
/**
|
|
319
|
+
*
|
|
320
|
+
* An error is thrown when executing the execute function
|
|
321
|
+
*
|
|
322
|
+
* @default false
|
|
323
|
+
*/
|
|
324
|
+
throwError?: boolean;
|
|
292
325
|
}
|
|
293
326
|
/**
|
|
294
327
|
* Reactive async state. Will not block your setup function and will trigger changes once
|
|
@@ -299,7 +332,7 @@ interface AsyncStateOptions<Shallow extends boolean> {
|
|
|
299
332
|
* @param initialState The initial state, used until the first evaluation finishes
|
|
300
333
|
* @param options
|
|
301
334
|
*/
|
|
302
|
-
declare function useAsyncState<Data, Shallow extends boolean = true>(promise: Promise<Data> | ((...args: any[]) => Promise<Data>), initialState: Data, options?:
|
|
335
|
+
declare function useAsyncState<Data, Shallow extends boolean = true>(promise: Promise<Data> | ((...args: any[]) => Promise<Data>), initialState: Data, options?: UseAsyncStateOptions<Shallow, Data>): UseAsyncStateReturn<Data, Shallow>;
|
|
303
336
|
|
|
304
337
|
interface ToDataURLOptions {
|
|
305
338
|
/**
|
|
@@ -319,15 +352,15 @@ interface UseBase64Return {
|
|
|
319
352
|
promise: Ref<Promise<string>>;
|
|
320
353
|
execute: () => Promise<string>;
|
|
321
354
|
}
|
|
322
|
-
declare function useBase64(target:
|
|
323
|
-
declare function useBase64(target:
|
|
324
|
-
declare function useBase64(target:
|
|
325
|
-
declare function useBase64(target:
|
|
326
|
-
declare function useBase64(target:
|
|
327
|
-
declare function useBase64<T extends Record<string, unknown>>(target:
|
|
328
|
-
declare function useBase64<T extends Map<string, unknown>>(target:
|
|
329
|
-
declare function useBase64<T extends Set<unknown>>(target:
|
|
330
|
-
declare function useBase64<T>(target:
|
|
355
|
+
declare function useBase64(target: MaybeComputedRef<string>): UseBase64Return;
|
|
356
|
+
declare function useBase64(target: MaybeComputedRef<Blob>): UseBase64Return;
|
|
357
|
+
declare function useBase64(target: MaybeComputedRef<ArrayBuffer>): UseBase64Return;
|
|
358
|
+
declare function useBase64(target: MaybeComputedRef<HTMLCanvasElement>, options?: ToDataURLOptions): UseBase64Return;
|
|
359
|
+
declare function useBase64(target: MaybeComputedRef<HTMLImageElement>, options?: ToDataURLOptions): UseBase64Return;
|
|
360
|
+
declare function useBase64<T extends Record<string, unknown>>(target: MaybeComputedRef<T>, options?: UseBase64ObjectOptions<T>): UseBase64Return;
|
|
361
|
+
declare function useBase64<T extends Map<string, unknown>>(target: MaybeComputedRef<T>, options?: UseBase64ObjectOptions<T>): UseBase64Return;
|
|
362
|
+
declare function useBase64<T extends Set<unknown>>(target: MaybeComputedRef<T>, options?: UseBase64ObjectOptions<T>): UseBase64Return;
|
|
363
|
+
declare function useBase64<T>(target: MaybeComputedRef<T[]>, options?: UseBase64ObjectOptions<T[]>): UseBase64Return;
|
|
331
364
|
|
|
332
365
|
interface BatteryManager extends EventTarget {
|
|
333
366
|
charging: boolean;
|
|
@@ -342,13 +375,13 @@ interface BatteryManager extends EventTarget {
|
|
|
342
375
|
* @param options
|
|
343
376
|
*/
|
|
344
377
|
declare function useBattery({ navigator }?: ConfigurableNavigator): {
|
|
345
|
-
isSupported: boolean
|
|
378
|
+
isSupported: vue_demi.Ref<boolean>;
|
|
346
379
|
charging: vue_demi.Ref<boolean>;
|
|
347
380
|
chargingTime: vue_demi.Ref<number>;
|
|
348
381
|
dischargingTime: vue_demi.Ref<number>;
|
|
349
382
|
level: vue_demi.Ref<number>;
|
|
350
383
|
};
|
|
351
|
-
|
|
384
|
+
type UseBatteryReturn = ReturnType<typeof useBattery>;
|
|
352
385
|
|
|
353
386
|
interface UseBluetoothRequestDeviceOptions {
|
|
354
387
|
/**
|
|
@@ -384,43 +417,15 @@ interface UseBluetoothOptions extends UseBluetoothRequestDeviceOptions, Configur
|
|
|
384
417
|
*/
|
|
385
418
|
acceptAllDevices?: boolean;
|
|
386
419
|
}
|
|
387
|
-
declare function useBluetooth(options?: UseBluetoothOptions):
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
readonly name?: string | undefined;
|
|
393
|
-
readonly gatt?: {
|
|
394
|
-
readonly device: any;
|
|
395
|
-
readonly connected: boolean;
|
|
396
|
-
connect: () => Promise<BluetoothRemoteGATTServer>;
|
|
397
|
-
disconnect: () => void;
|
|
398
|
-
getPrimaryService: (service: BluetoothServiceUUID) => Promise<BluetoothRemoteGATTService>;
|
|
399
|
-
getPrimaryServices: (service?: BluetoothServiceUUID | undefined) => Promise<BluetoothRemoteGATTService[]>;
|
|
400
|
-
} | undefined;
|
|
401
|
-
readonly uuids?: string[] | undefined;
|
|
402
|
-
forget: () => Promise<void>;
|
|
403
|
-
watchAdvertisements: (options?: WatchAdvertisementsOptions | undefined) => Promise<void>;
|
|
404
|
-
unwatchAdvertisements: () => void;
|
|
405
|
-
readonly watchingAdvertisements: boolean;
|
|
406
|
-
addEventListener: {
|
|
407
|
-
(type: "gattserverdisconnected", listener: (this: BluetoothDevice, ev: Event) => any, useCapture?: boolean | undefined): void;
|
|
408
|
-
(type: "advertisementreceived", listener: (this: BluetoothDevice, ev: BluetoothAdvertisingEvent) => any, useCapture?: boolean | undefined): void;
|
|
409
|
-
(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean | undefined): void;
|
|
410
|
-
};
|
|
411
|
-
dispatchEvent: (event: Event) => boolean;
|
|
412
|
-
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => void;
|
|
413
|
-
onadvertisementreceived: (this: BluetoothDevice, ev: BluetoothAdvertisingEvent) => any;
|
|
414
|
-
ongattserverdisconnected: (this: BluetoothDevice, ev: Event) => any;
|
|
415
|
-
oncharacteristicvaluechanged: (this: BluetoothDevice, ev: Event) => any;
|
|
416
|
-
onserviceadded: (this: BluetoothDevice, ev: Event) => any;
|
|
417
|
-
onservicechanged: (this: BluetoothDevice, ev: Event) => any;
|
|
418
|
-
onserviceremoved: (this: BluetoothDevice, ev: Event) => any;
|
|
419
|
-
} | undefined>;
|
|
420
|
+
declare function useBluetooth(options?: UseBluetoothOptions): UseBluetoothReturn;
|
|
421
|
+
interface UseBluetoothReturn {
|
|
422
|
+
isSupported: Ref<boolean>;
|
|
423
|
+
isConnected: ComputedRef<boolean>;
|
|
424
|
+
device: Ref<BluetoothDevice | undefined>;
|
|
420
425
|
requestDevice: () => Promise<void>;
|
|
421
|
-
server:
|
|
422
|
-
error:
|
|
423
|
-
}
|
|
426
|
+
server: Ref<BluetoothRemoteGATTServer | undefined>;
|
|
427
|
+
error: Ref<unknown | null>;
|
|
428
|
+
}
|
|
424
429
|
|
|
425
430
|
/**
|
|
426
431
|
* Breakpoints from Tailwind V2
|
|
@@ -493,8 +498,25 @@ declare const breakpointsSematic: {
|
|
|
493
498
|
laptopL: number;
|
|
494
499
|
desktop4K: number;
|
|
495
500
|
};
|
|
501
|
+
/**
|
|
502
|
+
* Breakpoints from Master CSS
|
|
503
|
+
*
|
|
504
|
+
* @see https://docs.master.co/css/breakpoints
|
|
505
|
+
*/
|
|
506
|
+
declare const breakpointsMasterCss: {
|
|
507
|
+
'3xs': number;
|
|
508
|
+
'2xs': number;
|
|
509
|
+
xs: number;
|
|
510
|
+
sm: number;
|
|
511
|
+
md: number;
|
|
512
|
+
lg: number;
|
|
513
|
+
xl: number;
|
|
514
|
+
'2xl': number;
|
|
515
|
+
'3xl': number;
|
|
516
|
+
'4xl': number;
|
|
517
|
+
};
|
|
496
518
|
|
|
497
|
-
|
|
519
|
+
type Breakpoints<K extends string = string> = Record<K, number | string>;
|
|
498
520
|
/**
|
|
499
521
|
* Reactively viewport breakpoints
|
|
500
522
|
*
|
|
@@ -502,19 +524,27 @@ declare type Breakpoints<K extends string = string> = Record<K, number | string>
|
|
|
502
524
|
* @param options
|
|
503
525
|
*/
|
|
504
526
|
declare function useBreakpoints<K extends string>(breakpoints: Breakpoints<K>, options?: ConfigurableWindow): {
|
|
505
|
-
greater
|
|
527
|
+
greater(k: K): Ref<boolean>;
|
|
528
|
+
greaterOrEqual: (k: K) => Ref<boolean>;
|
|
506
529
|
smaller(k: K): Ref<boolean>;
|
|
530
|
+
smallerOrEqual(k: K): Ref<boolean>;
|
|
507
531
|
between(a: K, b: K): Ref<boolean>;
|
|
508
532
|
isGreater(k: K): boolean;
|
|
533
|
+
isGreaterOrEqual(k: K): boolean;
|
|
509
534
|
isSmaller(k: K): boolean;
|
|
535
|
+
isSmallerOrEqual(k: K): boolean;
|
|
510
536
|
isInBetween(a: K, b: K): boolean;
|
|
511
537
|
} & Record<K, Ref<boolean>>;
|
|
512
|
-
|
|
538
|
+
type UseBreakpointsReturn<K extends string = string> = {
|
|
513
539
|
greater: (k: K) => Ref<boolean>;
|
|
540
|
+
greaterOrEqual: (k: K) => Ref<boolean>;
|
|
514
541
|
smaller(k: K): Ref<boolean>;
|
|
542
|
+
smallerOrEqual: (k: K) => Ref<boolean>;
|
|
515
543
|
between(a: K, b: K): Ref<boolean>;
|
|
516
544
|
isGreater(k: K): boolean;
|
|
545
|
+
isGreaterOrEqual(k: K): boolean;
|
|
517
546
|
isSmaller(k: K): boolean;
|
|
547
|
+
isSmallerOrEqual(k: K): boolean;
|
|
518
548
|
isInBetween(a: K, b: K): boolean;
|
|
519
549
|
} & Record<K, Ref<boolean>>;
|
|
520
550
|
|
|
@@ -532,51 +562,16 @@ interface UseBroadcastChannelOptions extends ConfigurableWindow {
|
|
|
532
562
|
* @param options
|
|
533
563
|
*
|
|
534
564
|
*/
|
|
535
|
-
declare const useBroadcastChannel: (options: UseBroadcastChannelOptions) =>
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
565
|
+
declare const useBroadcastChannel: <D, P>(options: UseBroadcastChannelOptions) => UseBroadcastChannelReturn<D, P>;
|
|
566
|
+
interface UseBroadcastChannelReturn<D, P> {
|
|
567
|
+
isSupported: Ref<boolean>;
|
|
568
|
+
channel: Ref<BroadcastChannel | undefined>;
|
|
569
|
+
data: Ref<D>;
|
|
570
|
+
post: (data: P) => void;
|
|
540
571
|
close: () => void;
|
|
541
|
-
error:
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
readonly cancelable: boolean;
|
|
545
|
-
readonly composed: boolean;
|
|
546
|
-
readonly currentTarget: {
|
|
547
|
-
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined) => void;
|
|
548
|
-
dispatchEvent: (event: Event) => boolean;
|
|
549
|
-
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => void;
|
|
550
|
-
} | null;
|
|
551
|
-
readonly defaultPrevented: boolean;
|
|
552
|
-
readonly eventPhase: number;
|
|
553
|
-
readonly isTrusted: boolean;
|
|
554
|
-
returnValue: boolean;
|
|
555
|
-
readonly srcElement: {
|
|
556
|
-
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined) => void;
|
|
557
|
-
dispatchEvent: (event: Event) => boolean;
|
|
558
|
-
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => void;
|
|
559
|
-
} | null;
|
|
560
|
-
readonly target: {
|
|
561
|
-
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined) => void;
|
|
562
|
-
dispatchEvent: (event: Event) => boolean;
|
|
563
|
-
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => void;
|
|
564
|
-
} | null;
|
|
565
|
-
readonly timeStamp: number;
|
|
566
|
-
readonly type: string;
|
|
567
|
-
composedPath: () => EventTarget[];
|
|
568
|
-
initEvent: (type: string, bubbles?: boolean | undefined, cancelable?: boolean | undefined) => void;
|
|
569
|
-
preventDefault: () => void;
|
|
570
|
-
stopImmediatePropagation: () => void;
|
|
571
|
-
stopPropagation: () => void;
|
|
572
|
-
readonly AT_TARGET: number;
|
|
573
|
-
readonly BUBBLING_PHASE: number;
|
|
574
|
-
readonly CAPTURING_PHASE: number;
|
|
575
|
-
readonly NONE: number;
|
|
576
|
-
} | null>;
|
|
577
|
-
isClosed: vue_demi.Ref<boolean>;
|
|
578
|
-
};
|
|
579
|
-
declare type UseBroadcastChannelReturn = ReturnType<typeof useBroadcastChannel>;
|
|
572
|
+
error: Ref<Event | null>;
|
|
573
|
+
isClosed: Ref<boolean>;
|
|
574
|
+
}
|
|
580
575
|
|
|
581
576
|
interface BrowserLocationState {
|
|
582
577
|
trigger: string;
|
|
@@ -612,21 +607,11 @@ declare function useBrowserLocation({ window }?: ConfigurableWindow): vue_demi.R
|
|
|
612
607
|
protocol?: string | undefined;
|
|
613
608
|
search?: string | undefined;
|
|
614
609
|
}>;
|
|
615
|
-
|
|
610
|
+
type UseBrowserLocationReturn = ReturnType<typeof useBrowserLocation>;
|
|
616
611
|
|
|
617
612
|
declare function useCached<T>(refValue: Ref<T>, comparator?: (a: T, b: T) => boolean, watchOptions?: WatchOptions): Ref<T>;
|
|
618
613
|
|
|
619
|
-
|
|
620
|
-
* Reactively clamp a value between two other values.
|
|
621
|
-
*
|
|
622
|
-
* @see https://vueuse.org/useClamp
|
|
623
|
-
* @param value number
|
|
624
|
-
* @param min
|
|
625
|
-
* @param max
|
|
626
|
-
*/
|
|
627
|
-
declare function useClamp(value: MaybeRef<number>, min: MaybeRef<number>, max: MaybeRef<number>): Ref<number>;
|
|
628
|
-
|
|
629
|
-
interface ClipboardOptions<Source> extends ConfigurableNavigator {
|
|
614
|
+
interface UseClipboardOptions<Source> extends ConfigurableNavigator {
|
|
630
615
|
/**
|
|
631
616
|
* Enabled reading for clipboard
|
|
632
617
|
*
|
|
@@ -643,9 +628,15 @@ interface ClipboardOptions<Source> extends ConfigurableNavigator {
|
|
|
643
628
|
* @default 1500
|
|
644
629
|
*/
|
|
645
630
|
copiedDuring?: number;
|
|
631
|
+
/**
|
|
632
|
+
* Whether fallback to document.execCommand('copy') if clipboard is undefined.
|
|
633
|
+
*
|
|
634
|
+
* @default false
|
|
635
|
+
*/
|
|
636
|
+
legacy?: boolean;
|
|
646
637
|
}
|
|
647
|
-
interface
|
|
648
|
-
isSupported: boolean
|
|
638
|
+
interface UseClipboardReturn<Optional> {
|
|
639
|
+
isSupported: Ref<boolean>;
|
|
649
640
|
text: ComputedRef<string>;
|
|
650
641
|
copied: ComputedRef<boolean>;
|
|
651
642
|
copy: Optional extends true ? (text?: string) => Promise<void> : (text: string) => Promise<void>;
|
|
@@ -656,8 +647,39 @@ interface ClipboardReturn<Optional> {
|
|
|
656
647
|
* @see https://vueuse.org/useClipboard
|
|
657
648
|
* @param options
|
|
658
649
|
*/
|
|
659
|
-
declare function useClipboard(options?:
|
|
660
|
-
declare function useClipboard(options:
|
|
650
|
+
declare function useClipboard(options?: UseClipboardOptions<undefined>): UseClipboardReturn<false>;
|
|
651
|
+
declare function useClipboard(options: UseClipboardOptions<MaybeComputedRef<string>>): UseClipboardReturn<true>;
|
|
652
|
+
|
|
653
|
+
interface UseClonedOptions<T = any> extends WatchOptions {
|
|
654
|
+
/**
|
|
655
|
+
* Custom clone function.
|
|
656
|
+
*
|
|
657
|
+
* By default, it use `JSON.parse(JSON.stringify(value))` to clone.
|
|
658
|
+
*/
|
|
659
|
+
clone?: (source: T) => T;
|
|
660
|
+
/**
|
|
661
|
+
* Manually sync the ref
|
|
662
|
+
*
|
|
663
|
+
* @default false
|
|
664
|
+
*/
|
|
665
|
+
manual?: boolean;
|
|
666
|
+
}
|
|
667
|
+
interface UseClonedReturn<T> {
|
|
668
|
+
/**
|
|
669
|
+
* Cloned ref
|
|
670
|
+
*/
|
|
671
|
+
cloned: ComputedRef<T>;
|
|
672
|
+
/**
|
|
673
|
+
* Sync cloned data with source manually
|
|
674
|
+
*/
|
|
675
|
+
sync: () => void;
|
|
676
|
+
}
|
|
677
|
+
type CloneFn<F, T = F> = (x: F) => T;
|
|
678
|
+
declare function cloneFnJSON<T>(source: T): T;
|
|
679
|
+
declare function useCloned<T>(source: MaybeComputedRef<T>, options?: UseClonedOptions): {
|
|
680
|
+
cloned: vue_demi.Ref<vue_demi.UnwrapRef<T>>;
|
|
681
|
+
sync: () => void;
|
|
682
|
+
};
|
|
661
683
|
|
|
662
684
|
interface StorageLikeAsync {
|
|
663
685
|
getItem(key: string): Awaitable<string | null>;
|
|
@@ -670,7 +692,7 @@ interface StorageLike {
|
|
|
670
692
|
removeItem(key: string): void;
|
|
671
693
|
}
|
|
672
694
|
/**
|
|
673
|
-
* @
|
|
695
|
+
* @experimental The API is not finalized yet. It might not follow semver.
|
|
674
696
|
*/
|
|
675
697
|
interface SSRHandlersMap {
|
|
676
698
|
getDefaultStorage: () => StorageLike | undefined;
|
|
@@ -690,7 +712,7 @@ interface SerializerAsync<T> {
|
|
|
690
712
|
write(value: T): Awaitable<string>;
|
|
691
713
|
}
|
|
692
714
|
declare const StorageSerializers: Record<'boolean' | 'object' | 'number' | 'any' | 'string' | 'map' | 'set' | 'date', Serializer<any>>;
|
|
693
|
-
interface
|
|
715
|
+
interface UseStorageOptions<T> extends ConfigurableEventFilter, ConfigurableWindow, ConfigurableFlush {
|
|
694
716
|
/**
|
|
695
717
|
* Watch for deep changes
|
|
696
718
|
*
|
|
@@ -709,6 +731,15 @@ interface StorageOptions<T> extends ConfigurableEventFilter, ConfigurableWindow,
|
|
|
709
731
|
* @default true
|
|
710
732
|
*/
|
|
711
733
|
writeDefaults?: boolean;
|
|
734
|
+
/**
|
|
735
|
+
* Merge the default value with the value read from the storage.
|
|
736
|
+
*
|
|
737
|
+
* When setting it to true, it will perform a **shallow merge** for objects.
|
|
738
|
+
* You can pass a function to perform custom merge (e.g. deep merge), for example:
|
|
739
|
+
*
|
|
740
|
+
* @default false
|
|
741
|
+
*/
|
|
742
|
+
mergeDefaults?: boolean | ((storageValue: T, defaults: T) => T);
|
|
712
743
|
/**
|
|
713
744
|
* Custom data serialization
|
|
714
745
|
*/
|
|
@@ -726,14 +757,14 @@ interface StorageOptions<T> extends ConfigurableEventFilter, ConfigurableWindow,
|
|
|
726
757
|
*/
|
|
727
758
|
shallow?: boolean;
|
|
728
759
|
}
|
|
729
|
-
declare function useStorage(key: string,
|
|
730
|
-
declare function useStorage(key: string,
|
|
731
|
-
declare function useStorage(key: string,
|
|
732
|
-
declare function useStorage<T>(key: string,
|
|
733
|
-
declare function useStorage<T = unknown>(key: string,
|
|
760
|
+
declare function useStorage(key: string, defaults: MaybeComputedRef<string>, storage?: StorageLike, options?: UseStorageOptions<string>): RemovableRef<string>;
|
|
761
|
+
declare function useStorage(key: string, defaults: MaybeComputedRef<boolean>, storage?: StorageLike, options?: UseStorageOptions<boolean>): RemovableRef<boolean>;
|
|
762
|
+
declare function useStorage(key: string, defaults: MaybeComputedRef<number>, storage?: StorageLike, options?: UseStorageOptions<number>): RemovableRef<number>;
|
|
763
|
+
declare function useStorage<T>(key: string, defaults: MaybeComputedRef<T>, storage?: StorageLike, options?: UseStorageOptions<T>): RemovableRef<T>;
|
|
764
|
+
declare function useStorage<T = unknown>(key: string, defaults: MaybeComputedRef<null>, storage?: StorageLike, options?: UseStorageOptions<T>): RemovableRef<T>;
|
|
734
765
|
|
|
735
|
-
|
|
736
|
-
interface UseColorModeOptions<T extends string = BasicColorSchema> extends
|
|
766
|
+
type BasicColorSchema = 'light' | 'dark' | 'auto';
|
|
767
|
+
interface UseColorModeOptions<T extends string = BasicColorSchema> extends UseStorageOptions<T | BasicColorSchema> {
|
|
737
768
|
/**
|
|
738
769
|
* CSS Selector for the target element applying to
|
|
739
770
|
*
|
|
@@ -746,13 +777,19 @@ interface UseColorModeOptions<T extends string = BasicColorSchema> extends Stora
|
|
|
746
777
|
* @default 'class'
|
|
747
778
|
*/
|
|
748
779
|
attribute?: string;
|
|
780
|
+
/**
|
|
781
|
+
* The initial color mode
|
|
782
|
+
*
|
|
783
|
+
* @default 'auto'
|
|
784
|
+
*/
|
|
785
|
+
initialValue?: T | BasicColorSchema;
|
|
749
786
|
/**
|
|
750
787
|
* Prefix when adding value to the attribute
|
|
751
788
|
*/
|
|
752
789
|
modes?: Partial<Record<T | BasicColorSchema, string>>;
|
|
753
790
|
/**
|
|
754
791
|
* A custom handler for handle the updates.
|
|
755
|
-
* When specified, the default behavior will be
|
|
792
|
+
* When specified, the default behavior will be overridden.
|
|
756
793
|
*
|
|
757
794
|
* @default undefined
|
|
758
795
|
*/
|
|
@@ -795,7 +832,7 @@ interface UseColorModeOptions<T extends string = BasicColorSchema> extends Stora
|
|
|
795
832
|
*/
|
|
796
833
|
declare function useColorMode<T extends string = BasicColorSchema>(options?: UseColorModeOptions<T>): vue_demi.WritableComputedRef<BasicColorSchema | T>;
|
|
797
834
|
|
|
798
|
-
|
|
835
|
+
type UseConfirmDialogRevealResult<C, D> = {
|
|
799
836
|
data?: C;
|
|
800
837
|
isCanceled: false;
|
|
801
838
|
} | {
|
|
@@ -859,9 +896,9 @@ interface UseCssVarOptions extends ConfigurableWindow {
|
|
|
859
896
|
* @param initialValue
|
|
860
897
|
* @param options
|
|
861
898
|
*/
|
|
862
|
-
declare function useCssVar(prop:
|
|
899
|
+
declare function useCssVar(prop: MaybeComputedRef<string>, target?: MaybeElementRef, { window, initialValue }?: UseCssVarOptions): vue_demi.Ref<string>;
|
|
863
900
|
|
|
864
|
-
declare function useCurrentElement<T extends Element = Element>():
|
|
901
|
+
declare function useCurrentElement<T extends Element = Element>(): _vueuse_shared.ComputedRefWithControl<T>;
|
|
865
902
|
|
|
866
903
|
interface UseCycleListOptions<T> {
|
|
867
904
|
/**
|
|
@@ -883,12 +920,13 @@ interface UseCycleListOptions<T> {
|
|
|
883
920
|
*
|
|
884
921
|
* @see https://vueuse.org/useCycleList
|
|
885
922
|
*/
|
|
886
|
-
declare function useCycleList<T>(list: T[], options?: UseCycleListOptions<T>):
|
|
923
|
+
declare function useCycleList<T>(list: T[], options?: UseCycleListOptions<T>): UseCycleListReturn<T>;
|
|
924
|
+
interface UseCycleListReturn<T> {
|
|
887
925
|
state: Ref<T>;
|
|
888
|
-
index:
|
|
926
|
+
index: Ref<number>;
|
|
889
927
|
next: (n?: number) => T;
|
|
890
928
|
prev: (n?: number) => T;
|
|
891
|
-
}
|
|
929
|
+
}
|
|
892
930
|
|
|
893
931
|
interface UseDarkOptions extends Omit<UseColorModeOptions<BasicColorSchema>, 'modes' | 'onChanged'> {
|
|
894
932
|
/**
|
|
@@ -905,7 +943,7 @@ interface UseDarkOptions extends Omit<UseColorModeOptions<BasicColorSchema>, 'mo
|
|
|
905
943
|
valueLight?: string;
|
|
906
944
|
/**
|
|
907
945
|
* A custom handler for handle the updates.
|
|
908
|
-
* When specified, the default behavior will be
|
|
946
|
+
* When specified, the default behavior will be overridden.
|
|
909
947
|
*
|
|
910
948
|
* @default undefined
|
|
911
949
|
*/
|
|
@@ -923,7 +961,6 @@ interface UseRefHistoryRecord<T> {
|
|
|
923
961
|
snapshot: T;
|
|
924
962
|
timestamp: number;
|
|
925
963
|
}
|
|
926
|
-
declare type CloneFn<F, T = F> = (x: F) => T;
|
|
927
964
|
interface UseManualRefHistoryOptions<Raw, Serialized = Raw> {
|
|
928
965
|
/**
|
|
929
966
|
* Maximum number of history to be kept. Default to unlimited.
|
|
@@ -959,11 +996,11 @@ interface UseManualRefHistoryReturn<Raw, Serialized> {
|
|
|
959
996
|
*/
|
|
960
997
|
history: Ref<UseRefHistoryRecord<Serialized>[]>;
|
|
961
998
|
/**
|
|
962
|
-
|
|
963
|
-
|
|
999
|
+
* Last history point, source can be different if paused
|
|
1000
|
+
*/
|
|
964
1001
|
last: Ref<UseRefHistoryRecord<Serialized>>;
|
|
965
1002
|
/**
|
|
966
|
-
* Same as
|
|
1003
|
+
* Same as {@link UseManualRefHistoryReturn.history | history}
|
|
967
1004
|
*/
|
|
968
1005
|
undoStack: Ref<UseRefHistoryRecord<Serialized>[]>;
|
|
969
1006
|
/**
|
|
@@ -981,23 +1018,23 @@ interface UseManualRefHistoryReturn<Raw, Serialized> {
|
|
|
981
1018
|
/**
|
|
982
1019
|
* Undo changes
|
|
983
1020
|
*/
|
|
984
|
-
undo()
|
|
1021
|
+
undo: () => void;
|
|
985
1022
|
/**
|
|
986
1023
|
* Redo changes
|
|
987
1024
|
*/
|
|
988
|
-
redo()
|
|
1025
|
+
redo: () => void;
|
|
989
1026
|
/**
|
|
990
1027
|
* Clear all the history
|
|
991
1028
|
*/
|
|
992
|
-
clear()
|
|
1029
|
+
clear: () => void;
|
|
993
1030
|
/**
|
|
994
1031
|
* Create new a new history record
|
|
995
1032
|
*/
|
|
996
|
-
commit()
|
|
1033
|
+
commit: () => void;
|
|
997
1034
|
/**
|
|
998
|
-
* Reset ref's value with
|
|
1035
|
+
* Reset ref's value with latest history
|
|
999
1036
|
*/
|
|
1000
|
-
reset()
|
|
1037
|
+
reset: () => void;
|
|
1001
1038
|
}
|
|
1002
1039
|
/**
|
|
1003
1040
|
* Track the change history of a ref, also provides undo and redo functionality.
|
|
@@ -1046,51 +1083,11 @@ interface UseRefHistoryOptions<Raw, Serialized = Raw> extends ConfigurableEventF
|
|
|
1046
1083
|
*/
|
|
1047
1084
|
parse?: (v: Serialized) => Raw;
|
|
1048
1085
|
}
|
|
1049
|
-
interface UseRefHistoryReturn<Raw, Serialized> {
|
|
1050
|
-
/**
|
|
1051
|
-
* Bypassed tracking ref from the argument
|
|
1052
|
-
*/
|
|
1053
|
-
source: Ref<Raw>;
|
|
1054
|
-
/**
|
|
1055
|
-
* An array of history records for undo, newest comes to first
|
|
1056
|
-
*/
|
|
1057
|
-
history: Ref<UseRefHistoryRecord<Serialized>[]>;
|
|
1058
|
-
/**
|
|
1059
|
-
* Last history point, source can be different if paused
|
|
1060
|
-
*/
|
|
1061
|
-
last: Ref<UseRefHistoryRecord<Serialized>>;
|
|
1062
|
-
/**
|
|
1063
|
-
* Same as 'history'
|
|
1064
|
-
*/
|
|
1065
|
-
undoStack: Ref<UseRefHistoryRecord<Serialized>[]>;
|
|
1066
|
-
/**
|
|
1067
|
-
* Records array for redo
|
|
1068
|
-
*/
|
|
1069
|
-
redoStack: Ref<UseRefHistoryRecord<Serialized>[]>;
|
|
1086
|
+
interface UseRefHistoryReturn<Raw, Serialized> extends UseManualRefHistoryReturn<Raw, Serialized> {
|
|
1070
1087
|
/**
|
|
1071
1088
|
* A ref representing if the tracking is enabled
|
|
1072
1089
|
*/
|
|
1073
1090
|
isTracking: Ref<boolean>;
|
|
1074
|
-
/**
|
|
1075
|
-
* A ref representing if undo is possible (non empty undoStack)
|
|
1076
|
-
*/
|
|
1077
|
-
canUndo: Ref<boolean>;
|
|
1078
|
-
/**
|
|
1079
|
-
* A ref representing if redo is possible (non empty redoStack)
|
|
1080
|
-
*/
|
|
1081
|
-
canRedo: Ref<boolean>;
|
|
1082
|
-
/**
|
|
1083
|
-
* Undo changes
|
|
1084
|
-
*/
|
|
1085
|
-
undo(): void;
|
|
1086
|
-
/**
|
|
1087
|
-
* Redo changes
|
|
1088
|
-
*/
|
|
1089
|
-
redo(): void;
|
|
1090
|
-
/**
|
|
1091
|
-
* Clear all the history
|
|
1092
|
-
*/
|
|
1093
|
-
clear(): void;
|
|
1094
1091
|
/**
|
|
1095
1092
|
* Pause change tracking
|
|
1096
1093
|
*/
|
|
@@ -1101,14 +1098,6 @@ interface UseRefHistoryReturn<Raw, Serialized> {
|
|
|
1101
1098
|
* @param [commit] if true, a history record will be create after resuming
|
|
1102
1099
|
*/
|
|
1103
1100
|
resume(commit?: boolean): void;
|
|
1104
|
-
/**
|
|
1105
|
-
* Create new a new history record
|
|
1106
|
-
*/
|
|
1107
|
-
commit(): void;
|
|
1108
|
-
/**
|
|
1109
|
-
* Reset ref's value with lastest history
|
|
1110
|
-
*/
|
|
1111
|
-
reset(): void;
|
|
1112
1101
|
/**
|
|
1113
1102
|
* A sugar for auto pause and auto resuming within a function scope
|
|
1114
1103
|
*
|
|
@@ -1137,7 +1126,7 @@ declare function useRefHistory<Raw, Serialized = Raw>(source: Ref<Raw>, options?
|
|
|
1137
1126
|
* @param options
|
|
1138
1127
|
*/
|
|
1139
1128
|
declare function useDebouncedRefHistory<Raw, Serialized = Raw>(source: Ref<Raw>, options?: Omit<UseRefHistoryOptions<Raw, Serialized>, 'eventFilter'> & {
|
|
1140
|
-
debounce?:
|
|
1129
|
+
debounce?: MaybeComputedRef<number>;
|
|
1141
1130
|
}): UseRefHistoryReturn<Raw, Serialized>;
|
|
1142
1131
|
|
|
1143
1132
|
interface DeviceMotionOptions extends ConfigurableWindow, ConfigurableEventFilter {
|
|
@@ -1154,7 +1143,7 @@ declare function useDeviceMotion(options?: DeviceMotionOptions): {
|
|
|
1154
1143
|
rotationRate: Ref<DeviceMotionEventRotationRate | null>;
|
|
1155
1144
|
interval: Ref<number>;
|
|
1156
1145
|
};
|
|
1157
|
-
|
|
1146
|
+
type UseDeviceMotionReturn = ReturnType<typeof useDeviceMotion>;
|
|
1158
1147
|
|
|
1159
1148
|
/**
|
|
1160
1149
|
* Reactive DeviceOrientationEvent.
|
|
@@ -1163,13 +1152,13 @@ declare type UseDeviceMotionReturn = ReturnType<typeof useDeviceMotion>;
|
|
|
1163
1152
|
* @param options
|
|
1164
1153
|
*/
|
|
1165
1154
|
declare function useDeviceOrientation(options?: ConfigurableWindow): {
|
|
1166
|
-
isSupported: boolean
|
|
1155
|
+
isSupported: Ref<boolean>;
|
|
1167
1156
|
isAbsolute: Ref<boolean>;
|
|
1168
1157
|
alpha: Ref<number | null>;
|
|
1169
1158
|
beta: Ref<number | null>;
|
|
1170
1159
|
gamma: Ref<number | null>;
|
|
1171
1160
|
};
|
|
1172
|
-
|
|
1161
|
+
type UseDeviceOrientationReturn = ReturnType<typeof useDeviceOrientation>;
|
|
1173
1162
|
|
|
1174
1163
|
/**
|
|
1175
1164
|
* Reactively track `window.devicePixelRatio`.
|
|
@@ -1180,7 +1169,7 @@ declare type UseDeviceOrientationReturn = ReturnType<typeof useDeviceOrientation
|
|
|
1180
1169
|
declare function useDevicePixelRatio({ window, }?: ConfigurableWindow): {
|
|
1181
1170
|
pixelRatio: vue_demi.Ref<number>;
|
|
1182
1171
|
};
|
|
1183
|
-
|
|
1172
|
+
type UseDevicePixelRatioReturn = ReturnType<typeof useDevicePixelRatio>;
|
|
1184
1173
|
|
|
1185
1174
|
interface UseDevicesListOptions extends ConfigurableNavigator {
|
|
1186
1175
|
onUpdated?: (devices: MediaDeviceInfo[]) => void;
|
|
@@ -1208,10 +1197,10 @@ interface UseDevicesListReturn {
|
|
|
1208
1197
|
audioOutputs: ComputedRef<MediaDeviceInfo[]>;
|
|
1209
1198
|
permissionGranted: Ref<boolean>;
|
|
1210
1199
|
ensurePermissions: () => Promise<boolean>;
|
|
1211
|
-
isSupported: boolean
|
|
1200
|
+
isSupported: Ref<boolean>;
|
|
1212
1201
|
}
|
|
1213
1202
|
/**
|
|
1214
|
-
* Reactive `enumerateDevices` listing
|
|
1203
|
+
* Reactive `enumerateDevices` listing available input/output devices
|
|
1215
1204
|
*
|
|
1216
1205
|
* @see https://vueuse.org/useDevicesList
|
|
1217
1206
|
* @param options
|
|
@@ -1240,13 +1229,13 @@ interface UseDisplayMediaOptions extends ConfigurableNavigator {
|
|
|
1240
1229
|
* @param options
|
|
1241
1230
|
*/
|
|
1242
1231
|
declare function useDisplayMedia(options?: UseDisplayMediaOptions): {
|
|
1243
|
-
isSupported: boolean
|
|
1232
|
+
isSupported: Ref<boolean>;
|
|
1244
1233
|
stream: Ref<MediaStream | undefined>;
|
|
1245
1234
|
start: () => Promise<MediaStream | undefined>;
|
|
1246
1235
|
stop: () => void;
|
|
1247
1236
|
enabled: Ref<boolean>;
|
|
1248
1237
|
};
|
|
1249
|
-
|
|
1238
|
+
type UseDisplayMediaReturn = ReturnType<typeof useDisplayMedia>;
|
|
1250
1239
|
|
|
1251
1240
|
/**
|
|
1252
1241
|
* Reactively track `document.visibilityState`.
|
|
@@ -1254,7 +1243,7 @@ declare type UseDisplayMediaReturn = ReturnType<typeof useDisplayMedia>;
|
|
|
1254
1243
|
* @see https://vueuse.org/useDocumentVisibility
|
|
1255
1244
|
* @param options
|
|
1256
1245
|
*/
|
|
1257
|
-
declare function useDocumentVisibility({ document }?: ConfigurableDocument): Ref<
|
|
1246
|
+
declare function useDocumentVisibility({ document }?: ConfigurableDocument): Ref<DocumentVisibilityState>;
|
|
1258
1247
|
|
|
1259
1248
|
interface Position {
|
|
1260
1249
|
x: number;
|
|
@@ -1268,7 +1257,7 @@ interface RenderableComponent {
|
|
|
1268
1257
|
*/
|
|
1269
1258
|
as?: Object | string;
|
|
1270
1259
|
}
|
|
1271
|
-
|
|
1260
|
+
type PointerType = 'mouse' | 'touch' | 'pen';
|
|
1272
1261
|
|
|
1273
1262
|
interface UseDraggableOptions {
|
|
1274
1263
|
/**
|
|
@@ -1276,25 +1265,31 @@ interface UseDraggableOptions {
|
|
|
1276
1265
|
*
|
|
1277
1266
|
* @default false
|
|
1278
1267
|
*/
|
|
1279
|
-
exact?:
|
|
1268
|
+
exact?: MaybeComputedRef<boolean>;
|
|
1280
1269
|
/**
|
|
1281
1270
|
* Prevent events defaults
|
|
1282
1271
|
*
|
|
1283
1272
|
* @default false
|
|
1284
1273
|
*/
|
|
1285
|
-
preventDefault?:
|
|
1274
|
+
preventDefault?: MaybeComputedRef<boolean>;
|
|
1286
1275
|
/**
|
|
1287
1276
|
* Prevent events propagation
|
|
1288
1277
|
*
|
|
1289
1278
|
* @default false
|
|
1290
1279
|
*/
|
|
1291
|
-
stopPropagation?:
|
|
1280
|
+
stopPropagation?: MaybeComputedRef<boolean>;
|
|
1292
1281
|
/**
|
|
1293
1282
|
* Element to attach `pointermove` and `pointerup` events to.
|
|
1294
1283
|
*
|
|
1295
1284
|
* @default window
|
|
1296
1285
|
*/
|
|
1297
|
-
draggingElement?:
|
|
1286
|
+
draggingElement?: MaybeComputedRef<HTMLElement | SVGElement | Window | Document | null | undefined>;
|
|
1287
|
+
/**
|
|
1288
|
+
* Handle that triggers the drag event
|
|
1289
|
+
*
|
|
1290
|
+
* @default target
|
|
1291
|
+
*/
|
|
1292
|
+
handle?: MaybeComputedRef<HTMLElement | SVGElement | null | undefined>;
|
|
1298
1293
|
/**
|
|
1299
1294
|
* Pointer types that listen to.
|
|
1300
1295
|
*
|
|
@@ -1304,9 +1299,9 @@ interface UseDraggableOptions {
|
|
|
1304
1299
|
/**
|
|
1305
1300
|
* Initial position of the element.
|
|
1306
1301
|
*
|
|
1307
|
-
* @default { x: 0, y: 0}
|
|
1302
|
+
* @default { x: 0, y: 0 }
|
|
1308
1303
|
*/
|
|
1309
|
-
initialValue?:
|
|
1304
|
+
initialValue?: MaybeComputedRef<Position>;
|
|
1310
1305
|
/**
|
|
1311
1306
|
* Callback when the dragging starts. Return `false` to prevent dragging.
|
|
1312
1307
|
*/
|
|
@@ -1327,18 +1322,22 @@ interface UseDraggableOptions {
|
|
|
1327
1322
|
* @param target
|
|
1328
1323
|
* @param options
|
|
1329
1324
|
*/
|
|
1330
|
-
declare function useDraggable(target:
|
|
1331
|
-
position: Ref<
|
|
1325
|
+
declare function useDraggable(target: MaybeComputedRef<HTMLElement | SVGElement | null | undefined>, options?: UseDraggableOptions): {
|
|
1326
|
+
position: vue_demi.Ref<{
|
|
1327
|
+
x: number;
|
|
1328
|
+
y: number;
|
|
1329
|
+
}>;
|
|
1332
1330
|
isDragging: vue_demi.ComputedRef<boolean>;
|
|
1333
1331
|
style: vue_demi.ComputedRef<string>;
|
|
1334
|
-
x: Ref<number>;
|
|
1335
|
-
y: Ref<number>;
|
|
1332
|
+
x: vue_demi.Ref<number>;
|
|
1333
|
+
y: vue_demi.Ref<number>;
|
|
1336
1334
|
};
|
|
1335
|
+
type UseDraggableReturn = ReturnType<typeof useDraggable>;
|
|
1337
1336
|
|
|
1338
1337
|
interface UseDropZoneReturn {
|
|
1339
1338
|
isOverDropZone: Ref<boolean>;
|
|
1340
1339
|
}
|
|
1341
|
-
declare function useDropZone(target:
|
|
1340
|
+
declare function useDropZone(target: MaybeComputedRef<HTMLElement | null | undefined>, onDrop?: (files: File[] | null) => void): UseDropZoneReturn;
|
|
1342
1341
|
|
|
1343
1342
|
interface UseElementBoundingOptions {
|
|
1344
1343
|
/**
|
|
@@ -1372,7 +1371,7 @@ interface UseElementBoundingOptions {
|
|
|
1372
1371
|
* @see https://vueuse.org/useElementBounding
|
|
1373
1372
|
* @param target
|
|
1374
1373
|
*/
|
|
1375
|
-
declare function useElementBounding(target:
|
|
1374
|
+
declare function useElementBounding(target: MaybeComputedElementRef, options?: UseElementBoundingOptions): {
|
|
1376
1375
|
height: vue_demi.Ref<number>;
|
|
1377
1376
|
bottom: vue_demi.Ref<number>;
|
|
1378
1377
|
left: vue_demi.Ref<number>;
|
|
@@ -1383,11 +1382,11 @@ declare function useElementBounding(target: MaybeElementRef, options?: UseElemen
|
|
|
1383
1382
|
y: vue_demi.Ref<number>;
|
|
1384
1383
|
update: () => void;
|
|
1385
1384
|
};
|
|
1386
|
-
|
|
1385
|
+
type UseElementBoundingReturn = ReturnType<typeof useElementBounding>;
|
|
1387
1386
|
|
|
1388
|
-
interface UseElementByPointOptions {
|
|
1389
|
-
x:
|
|
1390
|
-
y:
|
|
1387
|
+
interface UseElementByPointOptions extends ConfigurableDocument {
|
|
1388
|
+
x: MaybeComputedRef<number>;
|
|
1389
|
+
y: MaybeComputedRef<number>;
|
|
1391
1390
|
}
|
|
1392
1391
|
/**
|
|
1393
1392
|
* Reactive element by point.
|
|
@@ -1396,14 +1395,14 @@ interface UseElementByPointOptions {
|
|
|
1396
1395
|
* @param options - UseElementByPointOptions
|
|
1397
1396
|
*/
|
|
1398
1397
|
declare function useElementByPoint(options: UseElementByPointOptions): {
|
|
1399
|
-
isActive: vue_demi.Ref<boolean
|
|
1398
|
+
isActive: Readonly<vue_demi.Ref<boolean>>;
|
|
1400
1399
|
pause: _vueuse_shared.Fn;
|
|
1401
1400
|
resume: _vueuse_shared.Fn;
|
|
1402
1401
|
element: vue_demi.Ref<HTMLElement | null>;
|
|
1403
1402
|
};
|
|
1404
|
-
|
|
1403
|
+
type UseElementByPointReturn = ReturnType<typeof useElementByPoint>;
|
|
1405
1404
|
|
|
1406
|
-
declare function useElementHover(el:
|
|
1405
|
+
declare function useElementHover(el: MaybeComputedRef<EventTarget | null | undefined>): Ref<boolean>;
|
|
1407
1406
|
|
|
1408
1407
|
interface ResizeObserverSize {
|
|
1409
1408
|
readonly inlineSize: number;
|
|
@@ -1416,20 +1415,20 @@ interface ResizeObserverEntry {
|
|
|
1416
1415
|
readonly contentBoxSize?: ReadonlyArray<ResizeObserverSize>;
|
|
1417
1416
|
readonly devicePixelContentBoxSize?: ReadonlyArray<ResizeObserverSize>;
|
|
1418
1417
|
}
|
|
1419
|
-
|
|
1420
|
-
interface
|
|
1418
|
+
type ResizeObserverCallback = (entries: ReadonlyArray<ResizeObserverEntry>, observer: ResizeObserver) => void;
|
|
1419
|
+
interface UseResizeObserverOptions extends ConfigurableWindow {
|
|
1421
1420
|
/**
|
|
1422
1421
|
* Sets which box model the observer will observe changes to. Possible values
|
|
1423
|
-
* are `content-box` (the default), and `
|
|
1422
|
+
* are `content-box` (the default), `border-box` and `device-pixel-content-box`.
|
|
1424
1423
|
*
|
|
1425
1424
|
* @default 'content-box'
|
|
1426
1425
|
*/
|
|
1427
|
-
box?:
|
|
1426
|
+
box?: ResizeObserverBoxOptions;
|
|
1428
1427
|
}
|
|
1429
1428
|
declare class ResizeObserver {
|
|
1430
1429
|
constructor(callback: ResizeObserverCallback);
|
|
1431
1430
|
disconnect(): void;
|
|
1432
|
-
observe(target: Element, options?:
|
|
1431
|
+
observe(target: Element, options?: UseResizeObserverOptions): void;
|
|
1433
1432
|
unobserve(target: Element): void;
|
|
1434
1433
|
}
|
|
1435
1434
|
/**
|
|
@@ -1440,11 +1439,11 @@ declare class ResizeObserver {
|
|
|
1440
1439
|
* @param callback
|
|
1441
1440
|
* @param options
|
|
1442
1441
|
*/
|
|
1443
|
-
declare function useResizeObserver(target:
|
|
1444
|
-
isSupported: boolean
|
|
1442
|
+
declare function useResizeObserver(target: MaybeComputedElementRef, callback: ResizeObserverCallback, options?: UseResizeObserverOptions): {
|
|
1443
|
+
isSupported: vue_demi.Ref<boolean>;
|
|
1445
1444
|
stop: () => void;
|
|
1446
1445
|
};
|
|
1447
|
-
|
|
1446
|
+
type UseResizeObserverReturn = ReturnType<typeof useResizeObserver>;
|
|
1448
1447
|
|
|
1449
1448
|
interface ElementSize {
|
|
1450
1449
|
width: number;
|
|
@@ -1458,14 +1457,14 @@ interface ElementSize {
|
|
|
1458
1457
|
* @param callback
|
|
1459
1458
|
* @param options
|
|
1460
1459
|
*/
|
|
1461
|
-
declare function useElementSize(target:
|
|
1460
|
+
declare function useElementSize(target: MaybeComputedElementRef, initialSize?: ElementSize, options?: UseResizeObserverOptions): {
|
|
1462
1461
|
width: vue_demi.Ref<number>;
|
|
1463
1462
|
height: vue_demi.Ref<number>;
|
|
1464
1463
|
};
|
|
1465
|
-
|
|
1464
|
+
type UseElementSizeReturn = ReturnType<typeof useElementSize>;
|
|
1466
1465
|
|
|
1467
|
-
interface
|
|
1468
|
-
scrollTarget?:
|
|
1466
|
+
interface UseElementVisibilityOptions extends ConfigurableWindow {
|
|
1467
|
+
scrollTarget?: MaybeComputedRef<HTMLElement | undefined | null>;
|
|
1469
1468
|
}
|
|
1470
1469
|
/**
|
|
1471
1470
|
* Tracks the visibility of an element within the viewport.
|
|
@@ -1474,13 +1473,13 @@ interface VisibilityScrollTargetOptions extends ConfigurableWindow {
|
|
|
1474
1473
|
* @param element
|
|
1475
1474
|
* @param options
|
|
1476
1475
|
*/
|
|
1477
|
-
declare function useElementVisibility(element:
|
|
1476
|
+
declare function useElementVisibility(element: MaybeComputedElementRef, { window, scrollTarget }?: UseElementVisibilityOptions): vue_demi.Ref<boolean>;
|
|
1478
1477
|
|
|
1479
|
-
|
|
1480
|
-
|
|
1478
|
+
type EventBusListener<T = unknown, P = any> = (event: T, payload?: P) => void;
|
|
1479
|
+
type EventBusEvents<T, P = any> = EventBusListener<T, P>[];
|
|
1481
1480
|
interface EventBusKey<T> extends Symbol {
|
|
1482
1481
|
}
|
|
1483
|
-
|
|
1482
|
+
type EventBusIdentifier<T = unknown> = EventBusKey<T> | string | number;
|
|
1484
1483
|
interface UseEventBusReturn<T, P> {
|
|
1485
1484
|
/**
|
|
1486
1485
|
* Subscribe to an event. When calling emit, the listeners will execute.
|
|
@@ -1515,8 +1514,8 @@ interface InferEventTarget<Events> {
|
|
|
1515
1514
|
addEventListener(event: Events, fn?: any, options?: any): any;
|
|
1516
1515
|
removeEventListener(event: Events, fn?: any, options?: any): any;
|
|
1517
1516
|
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1517
|
+
type WindowEventName = keyof WindowEventMap;
|
|
1518
|
+
type DocumentEventName = keyof DocumentEventMap;
|
|
1520
1519
|
interface GeneralEventListener<E = Event> {
|
|
1521
1520
|
(evt: E): void;
|
|
1522
1521
|
}
|
|
@@ -1530,7 +1529,7 @@ interface GeneralEventListener<E = Event> {
|
|
|
1530
1529
|
* @param listener
|
|
1531
1530
|
* @param options
|
|
1532
1531
|
*/
|
|
1533
|
-
declare function useEventListener<E extends keyof WindowEventMap>(event: E
|
|
1532
|
+
declare function useEventListener<E extends keyof WindowEventMap>(event: Arrayable<E>, listener: Arrayable<(this: Window, ev: WindowEventMap[E]) => any>, options?: boolean | AddEventListenerOptions): Fn;
|
|
1534
1533
|
/**
|
|
1535
1534
|
* Register using addEventListener on mounted, and removeEventListener automatically on unmounted.
|
|
1536
1535
|
*
|
|
@@ -1542,7 +1541,7 @@ declare function useEventListener<E extends keyof WindowEventMap>(event: E, list
|
|
|
1542
1541
|
* @param listener
|
|
1543
1542
|
* @param options
|
|
1544
1543
|
*/
|
|
1545
|
-
declare function useEventListener<E extends keyof WindowEventMap>(target: Window, event: E
|
|
1544
|
+
declare function useEventListener<E extends keyof WindowEventMap>(target: Window, event: Arrayable<E>, listener: Arrayable<(this: Window, ev: WindowEventMap[E]) => any>, options?: boolean | AddEventListenerOptions): Fn;
|
|
1546
1545
|
/**
|
|
1547
1546
|
* Register using addEventListener on mounted, and removeEventListener automatically on unmounted.
|
|
1548
1547
|
*
|
|
@@ -1554,7 +1553,7 @@ declare function useEventListener<E extends keyof WindowEventMap>(target: Window
|
|
|
1554
1553
|
* @param listener
|
|
1555
1554
|
* @param options
|
|
1556
1555
|
*/
|
|
1557
|
-
declare function useEventListener<E extends keyof DocumentEventMap>(target:
|
|
1556
|
+
declare function useEventListener<E extends keyof DocumentEventMap>(target: DocumentOrShadowRoot, event: Arrayable<E>, listener: Arrayable<(this: Document, ev: DocumentEventMap[E]) => any>, options?: boolean | AddEventListenerOptions): Fn;
|
|
1558
1557
|
/**
|
|
1559
1558
|
* Register using addEventListener on mounted, and removeEventListener automatically on unmounted.
|
|
1560
1559
|
*
|
|
@@ -1566,7 +1565,7 @@ declare function useEventListener<E extends keyof DocumentEventMap>(target: Docu
|
|
|
1566
1565
|
* @param listener
|
|
1567
1566
|
* @param options
|
|
1568
1567
|
*/
|
|
1569
|
-
declare function useEventListener<Names extends string, EventType = Event>(target: InferEventTarget<Names>, event: Names
|
|
1568
|
+
declare function useEventListener<Names extends string, EventType = Event>(target: InferEventTarget<Names>, event: Arrayable<Names>, listener: Arrayable<GeneralEventListener<EventType>>, options?: boolean | AddEventListenerOptions): Fn;
|
|
1570
1569
|
/**
|
|
1571
1570
|
* Register using addEventListener on mounted, and removeEventListener automatically on unmounted.
|
|
1572
1571
|
*
|
|
@@ -1578,9 +1577,9 @@ declare function useEventListener<Names extends string, EventType = Event>(targe
|
|
|
1578
1577
|
* @param listener
|
|
1579
1578
|
* @param options
|
|
1580
1579
|
*/
|
|
1581
|
-
declare function useEventListener<EventType = Event>(target:
|
|
1580
|
+
declare function useEventListener<EventType = Event>(target: MaybeComputedRef<EventTarget | null | undefined>, event: Arrayable<string>, listener: Arrayable<GeneralEventListener<EventType>>, options?: boolean | AddEventListenerOptions): Fn;
|
|
1582
1581
|
|
|
1583
|
-
|
|
1582
|
+
type UseEventSourceOptions = EventSourceInit;
|
|
1584
1583
|
/**
|
|
1585
1584
|
* Reactive wrapper for EventSource.
|
|
1586
1585
|
*
|
|
@@ -1598,7 +1597,7 @@ declare function useEventSource(url: string, events?: Array<string>, options?: U
|
|
|
1598
1597
|
error: Ref<Event | null>;
|
|
1599
1598
|
close: () => void;
|
|
1600
1599
|
};
|
|
1601
|
-
|
|
1600
|
+
type UseEventSourceReturn = ReturnType<typeof useEventSource>;
|
|
1602
1601
|
|
|
1603
1602
|
interface EyeDropperOpenOptions {
|
|
1604
1603
|
/**
|
|
@@ -1628,14 +1627,15 @@ interface UseEyeDropperOptions {
|
|
|
1628
1627
|
* @param initialValue string
|
|
1629
1628
|
*/
|
|
1630
1629
|
declare function useEyeDropper(options?: UseEyeDropperOptions): {
|
|
1631
|
-
isSupported: boolean
|
|
1630
|
+
isSupported: vue_demi.Ref<boolean>;
|
|
1632
1631
|
sRGBHex: vue_demi.Ref<string>;
|
|
1633
1632
|
open: (openOptions?: EyeDropperOpenOptions) => Promise<{
|
|
1634
1633
|
sRGBHex: string;
|
|
1635
1634
|
} | undefined>;
|
|
1636
1635
|
};
|
|
1636
|
+
type UseEyeDropperReturn = ReturnType<typeof useEyeDropper>;
|
|
1637
1637
|
|
|
1638
|
-
interface
|
|
1638
|
+
interface UseFaviconOptions extends ConfigurableDocument {
|
|
1639
1639
|
baseUrl?: string;
|
|
1640
1640
|
rel?: string;
|
|
1641
1641
|
}
|
|
@@ -1646,7 +1646,9 @@ interface FaviconOptions extends ConfigurableDocument {
|
|
|
1646
1646
|
* @param newIcon
|
|
1647
1647
|
* @param options
|
|
1648
1648
|
*/
|
|
1649
|
-
declare function useFavicon(newIcon
|
|
1649
|
+
declare function useFavicon(newIcon: MaybeReadonlyRef<string | null | undefined>, options?: UseFaviconOptions): ComputedRef<string | null | undefined>;
|
|
1650
|
+
declare function useFavicon(newIcon?: MaybeRef<string | null | undefined>, options?: UseFaviconOptions): Ref<string | null | undefined>;
|
|
1651
|
+
type UseFaviconReturn = ReturnType<typeof useFavicon>;
|
|
1650
1652
|
|
|
1651
1653
|
interface UseFetchReturn<T> {
|
|
1652
1654
|
/**
|
|
@@ -1703,18 +1705,19 @@ interface UseFetchReturn<T> {
|
|
|
1703
1705
|
*/
|
|
1704
1706
|
onFetchFinally: EventHookOn;
|
|
1705
1707
|
get(): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
|
|
1706
|
-
post(payload?:
|
|
1707
|
-
put(payload?:
|
|
1708
|
-
delete(payload?:
|
|
1709
|
-
patch(payload?:
|
|
1710
|
-
head(payload?:
|
|
1711
|
-
options(payload?:
|
|
1708
|
+
post(payload?: MaybeComputedRef<unknown>, type?: string): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
|
|
1709
|
+
put(payload?: MaybeComputedRef<unknown>, type?: string): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
|
|
1710
|
+
delete(payload?: MaybeComputedRef<unknown>, type?: string): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
|
|
1711
|
+
patch(payload?: MaybeComputedRef<unknown>, type?: string): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
|
|
1712
|
+
head(payload?: MaybeComputedRef<unknown>, type?: string): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
|
|
1713
|
+
options(payload?: MaybeComputedRef<unknown>, type?: string): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
|
|
1712
1714
|
json<JSON = any>(): UseFetchReturn<JSON> & PromiseLike<UseFetchReturn<JSON>>;
|
|
1713
1715
|
text(): UseFetchReturn<string> & PromiseLike<UseFetchReturn<string>>;
|
|
1714
1716
|
blob(): UseFetchReturn<Blob> & PromiseLike<UseFetchReturn<Blob>>;
|
|
1715
1717
|
arrayBuffer(): UseFetchReturn<ArrayBuffer> & PromiseLike<UseFetchReturn<ArrayBuffer>>;
|
|
1716
1718
|
formData(): UseFetchReturn<FormData> & PromiseLike<UseFetchReturn<FormData>>;
|
|
1717
1719
|
}
|
|
1720
|
+
type Combination = 'overwrite' | 'chain';
|
|
1718
1721
|
interface BeforeFetchContext {
|
|
1719
1722
|
/**
|
|
1720
1723
|
* The computed url of the current request
|
|
@@ -1755,7 +1758,7 @@ interface UseFetchOptions {
|
|
|
1755
1758
|
*
|
|
1756
1759
|
* @default false
|
|
1757
1760
|
*/
|
|
1758
|
-
refetch?:
|
|
1761
|
+
refetch?: MaybeComputedRef<boolean>;
|
|
1759
1762
|
/**
|
|
1760
1763
|
* Initial data before the request finished
|
|
1761
1764
|
*
|
|
@@ -1790,9 +1793,14 @@ interface UseFetchOptions {
|
|
|
1790
1793
|
}
|
|
1791
1794
|
interface CreateFetchOptions {
|
|
1792
1795
|
/**
|
|
1793
|
-
* The base URL that will be prefixed to all urls
|
|
1796
|
+
* The base URL that will be prefixed to all urls unless urls are absolute
|
|
1797
|
+
*/
|
|
1798
|
+
baseUrl?: MaybeComputedRef<string>;
|
|
1799
|
+
/**
|
|
1800
|
+
* Determine the inherit behavior for beforeFetch, afterFetch, onFetchError
|
|
1801
|
+
* @default 'chain'
|
|
1794
1802
|
*/
|
|
1795
|
-
|
|
1803
|
+
combination?: Combination;
|
|
1796
1804
|
/**
|
|
1797
1805
|
* Default Options for the useFetch function
|
|
1798
1806
|
*/
|
|
@@ -1803,9 +1811,9 @@ interface CreateFetchOptions {
|
|
|
1803
1811
|
fetchOptions?: RequestInit;
|
|
1804
1812
|
}
|
|
1805
1813
|
declare function createFetch(config?: CreateFetchOptions): typeof useFetch;
|
|
1806
|
-
declare function useFetch<T>(url:
|
|
1807
|
-
declare function useFetch<T>(url:
|
|
1808
|
-
declare function useFetch<T>(url:
|
|
1814
|
+
declare function useFetch<T>(url: MaybeComputedRef<string>): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
|
|
1815
|
+
declare function useFetch<T>(url: MaybeComputedRef<string>, useFetchOptions: UseFetchOptions): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
|
|
1816
|
+
declare function useFetch<T>(url: MaybeComputedRef<string>, options: RequestInit, useFetchOptions?: UseFetchOptions): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
|
|
1809
1817
|
|
|
1810
1818
|
interface UseFileDialogOptions extends ConfigurableDocument {
|
|
1811
1819
|
/**
|
|
@@ -1908,17 +1916,17 @@ interface FileSystemWritableFileStreamWrite {
|
|
|
1908
1916
|
* FileStream.write
|
|
1909
1917
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/write
|
|
1910
1918
|
*/
|
|
1911
|
-
|
|
1919
|
+
type FileSystemAccessWindow = Window & {
|
|
1912
1920
|
showSaveFilePicker: (options: FileSystemAccessShowSaveFileOptions) => Promise<FileSystemFileHandle>;
|
|
1913
1921
|
showOpenFilePicker: (options: FileSystemAccessShowOpenFileOptions) => Promise<FileSystemFileHandle[]>;
|
|
1914
1922
|
};
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1923
|
+
type UseFileSystemAccessCommonOptions = Pick<FileSystemAccessShowOpenFileOptions, 'types' | 'excludeAcceptAllOption'>;
|
|
1924
|
+
type UseFileSystemAccessShowSaveFileOptions = Pick<FileSystemAccessShowSaveFileOptions, 'suggestedName'>;
|
|
1925
|
+
type UseFileSystemAccessOptions = ConfigurableWindow & UseFileSystemAccessCommonOptions & {
|
|
1918
1926
|
/**
|
|
1919
1927
|
* file data type
|
|
1920
1928
|
*/
|
|
1921
|
-
dataType?:
|
|
1929
|
+
dataType?: MaybeComputedRef<'Text' | 'ArrayBuffer' | 'Blob'>;
|
|
1922
1930
|
};
|
|
1923
1931
|
/**
|
|
1924
1932
|
* Create and read and write local files.
|
|
@@ -1936,7 +1944,7 @@ declare function useFileSystemAccess(options: UseFileSystemAccessOptions & {
|
|
|
1936
1944
|
}): UseFileSystemAccessReturn<Blob>;
|
|
1937
1945
|
declare function useFileSystemAccess(options: UseFileSystemAccessOptions): UseFileSystemAccessReturn<string | ArrayBuffer | Blob>;
|
|
1938
1946
|
interface UseFileSystemAccessReturn<T = string> {
|
|
1939
|
-
isSupported: boolean
|
|
1947
|
+
isSupported: Ref<boolean>;
|
|
1940
1948
|
data: Ref<T | undefined>;
|
|
1941
1949
|
file: Ref<File | undefined>;
|
|
1942
1950
|
fileName: Ref<string>;
|
|
@@ -1974,11 +1982,11 @@ interface UseFocusReturn {
|
|
|
1974
1982
|
*/
|
|
1975
1983
|
declare function useFocus(target: MaybeElementRef, options?: UseFocusOptions): UseFocusReturn;
|
|
1976
1984
|
|
|
1977
|
-
interface
|
|
1985
|
+
interface UseFocusWithinReturn {
|
|
1978
1986
|
/**
|
|
1979
1987
|
* True if the element or any of its descendants are focused
|
|
1980
1988
|
*/
|
|
1981
|
-
focused:
|
|
1989
|
+
focused: ComputedRef<boolean>;
|
|
1982
1990
|
}
|
|
1983
1991
|
/**
|
|
1984
1992
|
* Track if focus is contained within the target element
|
|
@@ -1987,7 +1995,7 @@ interface FocusWithinReturn {
|
|
|
1987
1995
|
* @param target The target element to track
|
|
1988
1996
|
* @param options Focus within options
|
|
1989
1997
|
*/
|
|
1990
|
-
declare function useFocusWithin(target: MaybeElementRef, options?: ConfigurableWindow):
|
|
1998
|
+
declare function useFocusWithin(target: MaybeElementRef, options?: ConfigurableWindow): UseFocusWithinReturn;
|
|
1991
1999
|
|
|
1992
2000
|
interface UseFpsOptions {
|
|
1993
2001
|
/**
|
|
@@ -2014,13 +2022,13 @@ interface UseFullscreenOptions extends ConfigurableDocument {
|
|
|
2014
2022
|
* @param options
|
|
2015
2023
|
*/
|
|
2016
2024
|
declare function useFullscreen(target?: MaybeElementRef, options?: UseFullscreenOptions): {
|
|
2017
|
-
isSupported: boolean
|
|
2025
|
+
isSupported: vue_demi.Ref<boolean>;
|
|
2018
2026
|
isFullscreen: vue_demi.Ref<boolean>;
|
|
2019
2027
|
enter: () => Promise<void>;
|
|
2020
2028
|
exit: () => Promise<void>;
|
|
2021
2029
|
toggle: () => Promise<void>;
|
|
2022
2030
|
};
|
|
2023
|
-
|
|
2031
|
+
type UseFullscreenReturn = ReturnType<typeof useFullscreen>;
|
|
2024
2032
|
|
|
2025
2033
|
interface UseGamepadOptions extends ConfigurableWindow, ConfigurableNavigator {
|
|
2026
2034
|
}
|
|
@@ -2064,7 +2072,7 @@ declare function mapGamepadToXbox360Controller(gamepad: Ref<Gamepad | undefined>
|
|
|
2064
2072
|
start: GamepadButton;
|
|
2065
2073
|
} | null>;
|
|
2066
2074
|
declare function useGamepad(options?: UseGamepadOptions): {
|
|
2067
|
-
isSupported: boolean
|
|
2075
|
+
isSupported: Ref<boolean>;
|
|
2068
2076
|
onConnected: _vueuse_shared.EventHookOn<number>;
|
|
2069
2077
|
onDisconnected: _vueuse_shared.EventHookOn<number>;
|
|
2070
2078
|
gamepads: Ref<{
|
|
@@ -2085,10 +2093,12 @@ declare function useGamepad(options?: UseGamepadOptions): {
|
|
|
2085
2093
|
}[]>;
|
|
2086
2094
|
pause: _vueuse_shared.Fn;
|
|
2087
2095
|
resume: _vueuse_shared.Fn;
|
|
2088
|
-
isActive: Ref<boolean
|
|
2096
|
+
isActive: Readonly<Ref<boolean>>;
|
|
2089
2097
|
};
|
|
2098
|
+
type UseGamepadReturn = ReturnType<typeof useGamepad>;
|
|
2090
2099
|
|
|
2091
|
-
interface
|
|
2100
|
+
interface UseGeolocationOptions extends Partial<PositionOptions>, ConfigurableNavigator {
|
|
2101
|
+
immediate?: boolean;
|
|
2092
2102
|
}
|
|
2093
2103
|
/**
|
|
2094
2104
|
* Reactive Geolocation API.
|
|
@@ -2096,8 +2106,8 @@ interface GeolocationOptions extends Partial<PositionOptions>, ConfigurableNavig
|
|
|
2096
2106
|
* @see https://vueuse.org/useGeolocation
|
|
2097
2107
|
* @param options
|
|
2098
2108
|
*/
|
|
2099
|
-
declare function useGeolocation(options?:
|
|
2100
|
-
isSupported: boolean
|
|
2109
|
+
declare function useGeolocation(options?: UseGeolocationOptions): {
|
|
2110
|
+
isSupported: Ref<boolean>;
|
|
2101
2111
|
coords: Ref<GeolocationCoordinates>;
|
|
2102
2112
|
locatedAt: Ref<number | null>;
|
|
2103
2113
|
error: Ref<{
|
|
@@ -2107,10 +2117,12 @@ declare function useGeolocation(options?: GeolocationOptions): {
|
|
|
2107
2117
|
readonly POSITION_UNAVAILABLE: number;
|
|
2108
2118
|
readonly TIMEOUT: number;
|
|
2109
2119
|
} | null>;
|
|
2120
|
+
resume: () => void;
|
|
2121
|
+
pause: () => void;
|
|
2110
2122
|
};
|
|
2111
|
-
|
|
2123
|
+
type UseGeolocationReturn = ReturnType<typeof useGeolocation>;
|
|
2112
2124
|
|
|
2113
|
-
interface
|
|
2125
|
+
interface UseIdleOptions extends ConfigurableWindow, ConfigurableEventFilter {
|
|
2114
2126
|
/**
|
|
2115
2127
|
* Event names that listen to for detected user activity
|
|
2116
2128
|
*
|
|
@@ -2141,7 +2153,7 @@ interface UseIdleReturn {
|
|
|
2141
2153
|
* @param timeout default to 1 minute
|
|
2142
2154
|
* @param options IdleOptions
|
|
2143
2155
|
*/
|
|
2144
|
-
declare function useIdle(timeout?: number, options?:
|
|
2156
|
+
declare function useIdle(timeout?: number, options?: UseIdleOptions): UseIdleReturn;
|
|
2145
2157
|
|
|
2146
2158
|
interface UseImageOptions {
|
|
2147
2159
|
/** Address of the resource */
|
|
@@ -2158,7 +2170,8 @@ interface UseImageOptions {
|
|
|
2158
2170
|
* @param options Image attributes, as used in the <img> tag
|
|
2159
2171
|
* @param asyncStateOptions
|
|
2160
2172
|
*/
|
|
2161
|
-
declare const useImage: <Shallow extends true>(options:
|
|
2173
|
+
declare const useImage: <Shallow extends true>(options: MaybeComputedRef<UseImageOptions>, asyncStateOptions?: UseAsyncStateOptions<Shallow, any>) => UseAsyncStateReturn<HTMLImageElement | undefined, true>;
|
|
2174
|
+
type UseImageReturn = ReturnType<typeof useImage>;
|
|
2162
2175
|
|
|
2163
2176
|
interface UseScrollOptions {
|
|
2164
2177
|
/**
|
|
@@ -2200,6 +2213,13 @@ interface UseScrollOptions {
|
|
|
2200
2213
|
* @default {capture: false, passive: true}
|
|
2201
2214
|
*/
|
|
2202
2215
|
eventListenerOptions?: boolean | AddEventListenerOptions;
|
|
2216
|
+
/**
|
|
2217
|
+
* Optionally specify a scroll behavior of `auto` (default, not smooth scrolling) or
|
|
2218
|
+
* `smooth` (for smooth scrolling) which takes effect when changing the `x` or `y` refs.
|
|
2219
|
+
*
|
|
2220
|
+
* @default 'auto'
|
|
2221
|
+
*/
|
|
2222
|
+
behavior?: MaybeComputedRef<ScrollBehavior>;
|
|
2203
2223
|
}
|
|
2204
2224
|
/**
|
|
2205
2225
|
* Reactive scroll.
|
|
@@ -2208,9 +2228,9 @@ interface UseScrollOptions {
|
|
|
2208
2228
|
* @param element
|
|
2209
2229
|
* @param options
|
|
2210
2230
|
*/
|
|
2211
|
-
declare function useScroll(element:
|
|
2212
|
-
x: vue_demi.
|
|
2213
|
-
y: vue_demi.
|
|
2231
|
+
declare function useScroll(element: MaybeComputedRef<HTMLElement | SVGElement | Window | Document | null | undefined>, options?: UseScrollOptions): {
|
|
2232
|
+
x: vue_demi.WritableComputedRef<number>;
|
|
2233
|
+
y: vue_demi.WritableComputedRef<number>;
|
|
2214
2234
|
isScrolling: vue_demi.Ref<boolean>;
|
|
2215
2235
|
arrivedState: {
|
|
2216
2236
|
left: boolean;
|
|
@@ -2225,7 +2245,7 @@ declare function useScroll(element: MaybeRef<HTMLElement | SVGElement | Window |
|
|
|
2225
2245
|
bottom: boolean;
|
|
2226
2246
|
};
|
|
2227
2247
|
};
|
|
2228
|
-
|
|
2248
|
+
type UseScrollReturn = ReturnType<typeof useScroll>;
|
|
2229
2249
|
|
|
2230
2250
|
interface UseInfiniteScrollOptions extends UseScrollOptions {
|
|
2231
2251
|
/**
|
|
@@ -2252,9 +2272,9 @@ interface UseInfiniteScrollOptions extends UseScrollOptions {
|
|
|
2252
2272
|
*
|
|
2253
2273
|
* @see https://vueuse.org/useInfiniteScroll
|
|
2254
2274
|
*/
|
|
2255
|
-
declare function useInfiniteScroll(element:
|
|
2275
|
+
declare function useInfiniteScroll(element: MaybeComputedRef<HTMLElement | SVGElement | Window | Document | null | undefined>, onLoadMore: (state: UnwrapNestedRefs<ReturnType<typeof useScroll>>) => void | Promise<void>, options?: UseInfiniteScrollOptions): void;
|
|
2256
2276
|
|
|
2257
|
-
interface
|
|
2277
|
+
interface UseIntersectionObserverOptions extends ConfigurableWindow {
|
|
2258
2278
|
/**
|
|
2259
2279
|
* The Element or Document whose bounds are used as the bounding box when testing for intersection.
|
|
2260
2280
|
*/
|
|
@@ -2276,14 +2296,14 @@ interface IntersectionObserverOptions extends ConfigurableWindow {
|
|
|
2276
2296
|
* @param callback
|
|
2277
2297
|
* @param options
|
|
2278
2298
|
*/
|
|
2279
|
-
declare function useIntersectionObserver(target: MaybeElementRef, callback: IntersectionObserverCallback, options?:
|
|
2280
|
-
isSupported: boolean
|
|
2299
|
+
declare function useIntersectionObserver(target: MaybeElementRef, callback: IntersectionObserverCallback, options?: UseIntersectionObserverOptions): {
|
|
2300
|
+
isSupported: vue_demi.Ref<boolean>;
|
|
2281
2301
|
stop: () => void;
|
|
2282
2302
|
};
|
|
2283
|
-
|
|
2303
|
+
type UseIntersectionObserverReturn = ReturnType<typeof useIntersectionObserver>;
|
|
2284
2304
|
|
|
2285
|
-
|
|
2286
|
-
interface
|
|
2305
|
+
type KeyModifier = 'Alt' | 'AltGraph' | 'CapsLock' | 'Control' | 'Fn' | 'FnLock' | 'Meta' | 'NumLock' | 'ScrollLock' | 'Shift' | 'Symbol' | 'SymbolLock';
|
|
2306
|
+
interface UseModifierOptions<Initial> extends ConfigurableDocument {
|
|
2287
2307
|
/**
|
|
2288
2308
|
* Event names that will prompt update to modifier states
|
|
2289
2309
|
*
|
|
@@ -2297,13 +2317,14 @@ interface ModifierOptions<Initial> extends ConfigurableDocument {
|
|
|
2297
2317
|
*/
|
|
2298
2318
|
initial?: Initial;
|
|
2299
2319
|
}
|
|
2300
|
-
|
|
2320
|
+
type UseKeyModifierReturn<Initial> = Ref<Initial extends boolean ? boolean : boolean | null>;
|
|
2321
|
+
declare function useKeyModifier<Initial extends boolean | null>(modifier: KeyModifier, options?: UseModifierOptions<Initial>): UseKeyModifierReturn<Initial>;
|
|
2301
2322
|
|
|
2302
|
-
declare function useLocalStorage(key: string, initialValue:
|
|
2303
|
-
declare function useLocalStorage(key: string, initialValue:
|
|
2304
|
-
declare function useLocalStorage(key: string, initialValue:
|
|
2305
|
-
declare function useLocalStorage<T>(key: string, initialValue:
|
|
2306
|
-
declare function useLocalStorage<T = unknown>(key: string, initialValue:
|
|
2323
|
+
declare function useLocalStorage(key: string, initialValue: MaybeComputedRef<string>, options?: UseStorageOptions<string>): RemovableRef<string>;
|
|
2324
|
+
declare function useLocalStorage(key: string, initialValue: MaybeComputedRef<boolean>, options?: UseStorageOptions<boolean>): RemovableRef<boolean>;
|
|
2325
|
+
declare function useLocalStorage(key: string, initialValue: MaybeComputedRef<number>, options?: UseStorageOptions<number>): RemovableRef<number>;
|
|
2326
|
+
declare function useLocalStorage<T>(key: string, initialValue: MaybeComputedRef<T>, options?: UseStorageOptions<T>): RemovableRef<T>;
|
|
2327
|
+
declare function useLocalStorage<T = unknown>(key: string, initialValue: MaybeComputedRef<null>, options?: UseStorageOptions<T>): RemovableRef<T>;
|
|
2307
2328
|
|
|
2308
2329
|
declare const DefaultMagicKeysAliasMap: Readonly<Record<string, string>>;
|
|
2309
2330
|
|
|
@@ -2319,7 +2340,7 @@ interface UseMagicKeysOptions<Reactive extends Boolean> {
|
|
|
2319
2340
|
*
|
|
2320
2341
|
* @default window
|
|
2321
2342
|
*/
|
|
2322
|
-
target?:
|
|
2343
|
+
target?: MaybeComputedRef<EventTarget>;
|
|
2323
2344
|
/**
|
|
2324
2345
|
* Alias map for keys, all the keys should be lowercase
|
|
2325
2346
|
* { target: keycode }
|
|
@@ -2347,18 +2368,18 @@ interface MagicKeysInternal {
|
|
|
2347
2368
|
* A Set of currently pressed keys,
|
|
2348
2369
|
* Stores raw keyCodes.
|
|
2349
2370
|
*
|
|
2350
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/
|
|
2371
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
|
|
2351
2372
|
*/
|
|
2352
2373
|
current: Set<string>;
|
|
2353
2374
|
}
|
|
2354
|
-
|
|
2375
|
+
type UseMagicKeysReturn<Reactive extends Boolean> = Readonly<Omit<Reactive extends true ? Record<string, boolean> : Record<string, ComputedRef<boolean>>, keyof MagicKeysInternal> & MagicKeysInternal>;
|
|
2355
2376
|
/**
|
|
2356
2377
|
* Reactive keys pressed state, with magical keys combination support.
|
|
2357
2378
|
*
|
|
2358
2379
|
* @see https://vueuse.org/useMagicKeys
|
|
2359
2380
|
*/
|
|
2360
|
-
declare function useMagicKeys(options?: UseMagicKeysOptions<false>):
|
|
2361
|
-
declare function useMagicKeys(options: UseMagicKeysOptions<true>):
|
|
2381
|
+
declare function useMagicKeys(options?: UseMagicKeysOptions<false>): UseMagicKeysReturn<false>;
|
|
2382
|
+
declare function useMagicKeys(options: UseMagicKeysOptions<true>): UseMagicKeysReturn<true>;
|
|
2362
2383
|
|
|
2363
2384
|
/**
|
|
2364
2385
|
* Many of the jsdoc definitions here are modified version of the
|
|
@@ -2405,11 +2426,11 @@ interface UseMediaControlsOptions extends ConfigurableDocument {
|
|
|
2405
2426
|
* The source for the media, may either be a string, a `UseMediaSource` object, or a list
|
|
2406
2427
|
* of `UseMediaSource` objects.
|
|
2407
2428
|
*/
|
|
2408
|
-
src?:
|
|
2429
|
+
src?: MaybeComputedRef<string | UseMediaSource | UseMediaSource[]>;
|
|
2409
2430
|
/**
|
|
2410
2431
|
* A list of text tracks for the media
|
|
2411
2432
|
*/
|
|
2412
|
-
tracks?:
|
|
2433
|
+
tracks?: MaybeComputedRef<UseMediaTextTrackSource[]>;
|
|
2413
2434
|
}
|
|
2414
2435
|
interface UseMediaTextTrack {
|
|
2415
2436
|
/**
|
|
@@ -2563,7 +2584,7 @@ declare function useMediaControls(target: MaybeRef<HTMLMediaElement | null | und
|
|
|
2563
2584
|
isPictureInPicture: vue_demi.Ref<boolean>;
|
|
2564
2585
|
onSourceError: _vueuse_shared.EventHookOn<Event>;
|
|
2565
2586
|
};
|
|
2566
|
-
|
|
2587
|
+
type UseMediaControlsReturn = ReturnType<typeof useMediaControls>;
|
|
2567
2588
|
|
|
2568
2589
|
/**
|
|
2569
2590
|
* Reactive Media Query.
|
|
@@ -2572,9 +2593,9 @@ declare type UseMediaControlsReturn = ReturnType<typeof useMediaControls>;
|
|
|
2572
2593
|
* @param query
|
|
2573
2594
|
* @param options
|
|
2574
2595
|
*/
|
|
2575
|
-
declare function useMediaQuery(query: string
|
|
2596
|
+
declare function useMediaQuery(query: MaybeComputedRef<string>, options?: ConfigurableWindow): vue_demi.Ref<boolean>;
|
|
2576
2597
|
|
|
2577
|
-
|
|
2598
|
+
type CacheKey = any;
|
|
2578
2599
|
/**
|
|
2579
2600
|
* Custom memoize cache handler
|
|
2580
2601
|
*/
|
|
@@ -2603,7 +2624,7 @@ interface UseMemoizeCache<Key, Value> {
|
|
|
2603
2624
|
/**
|
|
2604
2625
|
* Memoized function
|
|
2605
2626
|
*/
|
|
2606
|
-
interface
|
|
2627
|
+
interface UseMemoizeReturn<Result, Args extends unknown[]> {
|
|
2607
2628
|
/**
|
|
2608
2629
|
* Get result from cache or call memoized function
|
|
2609
2630
|
*/
|
|
@@ -2629,13 +2650,14 @@ interface UseMemoizedFn<Result, Args extends unknown[]> {
|
|
|
2629
2650
|
*/
|
|
2630
2651
|
cache: UseMemoizeCache<CacheKey, Result>;
|
|
2631
2652
|
}
|
|
2653
|
+
interface UseMemoizeOptions<Result, Args extends unknown[]> {
|
|
2654
|
+
getKey?: (...args: Args) => string | number;
|
|
2655
|
+
cache?: UseMemoizeCache<CacheKey, Result>;
|
|
2656
|
+
}
|
|
2632
2657
|
/**
|
|
2633
2658
|
* Reactive function result cache based on arguments
|
|
2634
2659
|
*/
|
|
2635
|
-
declare function useMemoize<Result, Args extends unknown[]>(resolver: (...args: Args) => Result, options?:
|
|
2636
|
-
getKey?: (...args: Args) => string;
|
|
2637
|
-
cache?: UseMemoizeCache<CacheKey, Result>;
|
|
2638
|
-
}): UseMemoizedFn<Result, Args>;
|
|
2660
|
+
declare function useMemoize<Result, Args extends unknown[]>(resolver: (...args: Args) => Result, options?: UseMemoizeOptions<Result, Args>): UseMemoizeReturn<Result, Args>;
|
|
2639
2661
|
|
|
2640
2662
|
/**
|
|
2641
2663
|
* Performance.memory
|
|
@@ -2657,7 +2679,7 @@ interface MemoryInfo {
|
|
|
2657
2679
|
readonly usedJSHeapSize: number;
|
|
2658
2680
|
[Symbol.toStringTag]: 'MemoryInfo';
|
|
2659
2681
|
}
|
|
2660
|
-
interface
|
|
2682
|
+
interface UseMemoryOptions extends UseIntervalFnOptions {
|
|
2661
2683
|
interval?: number;
|
|
2662
2684
|
}
|
|
2663
2685
|
/**
|
|
@@ -2666,10 +2688,11 @@ interface MemoryOptions extends IntervalFnOptions {
|
|
|
2666
2688
|
* @see https://vueuse.org/useMemory
|
|
2667
2689
|
* @param options
|
|
2668
2690
|
*/
|
|
2669
|
-
declare function useMemory(options?:
|
|
2670
|
-
isSupported: boolean
|
|
2691
|
+
declare function useMemory(options?: UseMemoryOptions): {
|
|
2692
|
+
isSupported: vue_demi.Ref<boolean>;
|
|
2671
2693
|
memory: vue_demi.Ref<MemoryInfo | undefined>;
|
|
2672
2694
|
};
|
|
2695
|
+
type UseMemoryReturn = ReturnType<typeof useMemory>;
|
|
2673
2696
|
|
|
2674
2697
|
/**
|
|
2675
2698
|
* Mounted state in ref.
|
|
@@ -2679,13 +2702,13 @@ declare function useMemory(options?: MemoryOptions): {
|
|
|
2679
2702
|
*/
|
|
2680
2703
|
declare function useMounted(): vue_demi.Ref<boolean>;
|
|
2681
2704
|
|
|
2682
|
-
interface
|
|
2705
|
+
interface UseMouseOptions extends ConfigurableWindow, ConfigurableEventFilter {
|
|
2683
2706
|
/**
|
|
2684
|
-
* Mouse position based by page or
|
|
2707
|
+
* Mouse position based by page, client, or relative to previous position
|
|
2685
2708
|
*
|
|
2686
2709
|
* @default 'page'
|
|
2687
2710
|
*/
|
|
2688
|
-
type?: 'page' | 'client';
|
|
2711
|
+
type?: 'page' | 'client' | 'movement';
|
|
2689
2712
|
/**
|
|
2690
2713
|
* Listen to `touchmove` events
|
|
2691
2714
|
*
|
|
@@ -2703,21 +2726,21 @@ interface MouseOptions extends ConfigurableWindow, ConfigurableEventFilter {
|
|
|
2703
2726
|
*/
|
|
2704
2727
|
initialValue?: Position;
|
|
2705
2728
|
}
|
|
2706
|
-
|
|
2729
|
+
type MouseSourceType = 'mouse' | 'touch' | null;
|
|
2707
2730
|
/**
|
|
2708
2731
|
* Reactive mouse position.
|
|
2709
2732
|
*
|
|
2710
2733
|
* @see https://vueuse.org/useMouse
|
|
2711
2734
|
* @param options
|
|
2712
2735
|
*/
|
|
2713
|
-
declare function useMouse(options?:
|
|
2736
|
+
declare function useMouse(options?: UseMouseOptions): {
|
|
2714
2737
|
x: vue_demi.Ref<number>;
|
|
2715
2738
|
y: vue_demi.Ref<number>;
|
|
2716
2739
|
sourceType: vue_demi.Ref<MouseSourceType>;
|
|
2717
2740
|
};
|
|
2718
|
-
|
|
2741
|
+
type UseMouseReturn = ReturnType<typeof useMouse>;
|
|
2719
2742
|
|
|
2720
|
-
interface MouseInElementOptions extends
|
|
2743
|
+
interface MouseInElementOptions extends UseMouseOptions {
|
|
2721
2744
|
handleOutside?: boolean;
|
|
2722
2745
|
}
|
|
2723
2746
|
/**
|
|
@@ -2740,7 +2763,7 @@ declare function useMouseInElement(target?: MaybeElementRef, options?: MouseInEl
|
|
|
2740
2763
|
isOutside: vue_demi.Ref<boolean>;
|
|
2741
2764
|
stop: () => void;
|
|
2742
2765
|
};
|
|
2743
|
-
|
|
2766
|
+
type UseMouseInElementReturn = ReturnType<typeof useMouseInElement>;
|
|
2744
2767
|
|
|
2745
2768
|
interface MousePressedOptions extends ConfigurableWindow {
|
|
2746
2769
|
/**
|
|
@@ -2776,9 +2799,9 @@ declare function useMousePressed(options?: MousePressedOptions): {
|
|
|
2776
2799
|
pressed: vue_demi.Ref<boolean>;
|
|
2777
2800
|
sourceType: vue_demi.Ref<MouseSourceType>;
|
|
2778
2801
|
};
|
|
2779
|
-
|
|
2802
|
+
type UseMousePressedReturn = ReturnType<typeof useMousePressed>;
|
|
2780
2803
|
|
|
2781
|
-
interface
|
|
2804
|
+
interface UseMutationObserverOptions extends MutationObserverInit, ConfigurableWindow {
|
|
2782
2805
|
}
|
|
2783
2806
|
/**
|
|
2784
2807
|
* Watch for changes being made to the DOM tree.
|
|
@@ -2789,14 +2812,14 @@ interface MutationObserverOptions extends MutationObserverInit, ConfigurableWind
|
|
|
2789
2812
|
* @param callback
|
|
2790
2813
|
* @param options
|
|
2791
2814
|
*/
|
|
2792
|
-
declare function useMutationObserver(target: MaybeElementRef, callback: MutationCallback, options?:
|
|
2793
|
-
isSupported: boolean
|
|
2815
|
+
declare function useMutationObserver(target: MaybeElementRef, callback: MutationCallback, options?: UseMutationObserverOptions): {
|
|
2816
|
+
isSupported: vue_demi.Ref<boolean>;
|
|
2794
2817
|
stop: () => void;
|
|
2795
2818
|
};
|
|
2796
|
-
|
|
2819
|
+
type UseMutationObserverReturn = ReturnType<typeof useMutationObserver>;
|
|
2797
2820
|
|
|
2798
2821
|
interface NavigatorLanguageState {
|
|
2799
|
-
isSupported: boolean
|
|
2822
|
+
isSupported: Ref<boolean>;
|
|
2800
2823
|
/**
|
|
2801
2824
|
*
|
|
2802
2825
|
* ISO 639-1 standard Language Code
|
|
@@ -2824,12 +2847,12 @@ interface NavigatorLanguageState {
|
|
|
2824
2847
|
*
|
|
2825
2848
|
*/
|
|
2826
2849
|
declare const useNavigatorLanguage: (options?: ConfigurableWindow) => Readonly<NavigatorLanguageState>;
|
|
2827
|
-
|
|
2850
|
+
type UseNavigatorLanguageReturn = ReturnType<typeof useNavigatorLanguage>;
|
|
2828
2851
|
|
|
2829
|
-
|
|
2830
|
-
|
|
2852
|
+
type NetworkType = 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown';
|
|
2853
|
+
type NetworkEffectiveType = 'slow-2g' | '2g' | '3g' | '4g' | undefined;
|
|
2831
2854
|
interface NetworkState {
|
|
2832
|
-
isSupported: boolean
|
|
2855
|
+
isSupported: Ref<boolean>;
|
|
2833
2856
|
/**
|
|
2834
2857
|
* If the user is currently connected.
|
|
2835
2858
|
*/
|
|
@@ -2874,6 +2897,7 @@ interface NetworkState {
|
|
|
2874
2897
|
* @param options
|
|
2875
2898
|
*/
|
|
2876
2899
|
declare function useNetwork(options?: ConfigurableWindow): Readonly<NetworkState>;
|
|
2900
|
+
type UseNetworkReturn = ReturnType<typeof useNetwork>;
|
|
2877
2901
|
|
|
2878
2902
|
interface UseNowOptions<Controls extends boolean> {
|
|
2879
2903
|
/**
|
|
@@ -2899,7 +2923,7 @@ declare function useNow(options?: UseNowOptions<false>): Ref<Date>;
|
|
|
2899
2923
|
declare function useNow(options: UseNowOptions<true>): {
|
|
2900
2924
|
now: Ref<Date>;
|
|
2901
2925
|
} & Pausable;
|
|
2902
|
-
|
|
2926
|
+
type UseNowReturn = ReturnType<typeof useNow>;
|
|
2903
2927
|
|
|
2904
2928
|
/**
|
|
2905
2929
|
* Reactive URL representing an object.
|
|
@@ -2946,7 +2970,7 @@ interface UseOffsetPaginationReturn {
|
|
|
2946
2970
|
prev: () => void;
|
|
2947
2971
|
next: () => void;
|
|
2948
2972
|
}
|
|
2949
|
-
|
|
2973
|
+
type UseOffsetPaginationInfinityPageReturn = Omit<UseOffsetPaginationReturn, 'isLastPage'>;
|
|
2950
2974
|
declare function useOffsetPagination(options: Omit<UseOffsetPaginationOptions, 'total'>): UseOffsetPaginationInfinityPageReturn;
|
|
2951
2975
|
declare function useOffsetPagination(options: UseOffsetPaginationOptions): UseOffsetPaginationReturn;
|
|
2952
2976
|
|
|
@@ -2966,13 +2990,13 @@ declare function useOnline(options?: ConfigurableWindow): vue.Ref<boolean>;
|
|
|
2966
2990
|
*/
|
|
2967
2991
|
declare function usePageLeave(options?: ConfigurableWindow): vue_demi.Ref<boolean>;
|
|
2968
2992
|
|
|
2969
|
-
interface
|
|
2993
|
+
interface UseParallaxOptions extends ConfigurableWindow {
|
|
2970
2994
|
deviceOrientationTiltAdjust?: (i: number) => number;
|
|
2971
2995
|
deviceOrientationRollAdjust?: (i: number) => number;
|
|
2972
2996
|
mouseTiltAdjust?: (i: number) => number;
|
|
2973
2997
|
mouseRollAdjust?: (i: number) => number;
|
|
2974
2998
|
}
|
|
2975
|
-
interface
|
|
2999
|
+
interface UseParallaxReturn {
|
|
2976
3000
|
/**
|
|
2977
3001
|
* Roll value. Scaled to `-0.5 ~ 0.5`
|
|
2978
3002
|
*/
|
|
@@ -2993,10 +3017,10 @@ interface ParallaxReturn {
|
|
|
2993
3017
|
* @param target
|
|
2994
3018
|
* @param options
|
|
2995
3019
|
*/
|
|
2996
|
-
declare function useParallax(target: MaybeElementRef, options?:
|
|
3020
|
+
declare function useParallax(target: MaybeElementRef, options?: UseParallaxOptions): UseParallaxReturn;
|
|
2997
3021
|
|
|
2998
|
-
|
|
2999
|
-
|
|
3022
|
+
type DescriptorNamePolyfill = 'accelerometer' | 'accessibility-events' | 'ambient-light-sensor' | 'background-sync' | 'camera' | 'clipboard-read' | 'clipboard-write' | 'gyroscope' | 'magnetometer' | 'microphone' | 'notifications' | 'payment-handler' | 'persistent-storage' | 'push' | 'speaker';
|
|
3023
|
+
type GeneralPermissionDescriptor = PermissionDescriptor | {
|
|
3000
3024
|
name: DescriptorNamePolyfill;
|
|
3001
3025
|
};
|
|
3002
3026
|
interface UsePermissionOptions<Controls extends boolean> extends ConfigurableNavigator {
|
|
@@ -3007,10 +3031,10 @@ interface UsePermissionOptions<Controls extends boolean> extends ConfigurableNav
|
|
|
3007
3031
|
*/
|
|
3008
3032
|
controls?: Controls;
|
|
3009
3033
|
}
|
|
3010
|
-
|
|
3034
|
+
type UsePermissionReturn = Readonly<Ref<PermissionState | undefined>>;
|
|
3011
3035
|
interface UsePermissionReturnWithControls {
|
|
3012
3036
|
state: UsePermissionReturn;
|
|
3013
|
-
isSupported: boolean
|
|
3037
|
+
isSupported: Ref<boolean>;
|
|
3014
3038
|
query: () => Promise<PermissionStatus | undefined>;
|
|
3015
3039
|
}
|
|
3016
3040
|
/**
|
|
@@ -3066,6 +3090,35 @@ declare function usePointer(options?: UsePointerOptions): {
|
|
|
3066
3090
|
x: Ref<number>;
|
|
3067
3091
|
y: Ref<number>;
|
|
3068
3092
|
};
|
|
3093
|
+
type UsePointerReturn = ReturnType<typeof usePointer>;
|
|
3094
|
+
|
|
3095
|
+
declare global {
|
|
3096
|
+
interface PointerLockOptions {
|
|
3097
|
+
unadjustedMovement?: boolean;
|
|
3098
|
+
}
|
|
3099
|
+
interface Element {
|
|
3100
|
+
requestPointerLock(options?: PointerLockOptions): Promise<void> | void;
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
type MaybeHTMLElement = HTMLElement | undefined | null;
|
|
3104
|
+
interface UsePointerLockOptions extends ConfigurableDocument {
|
|
3105
|
+
pointerLockOptions?: PointerLockOptions;
|
|
3106
|
+
}
|
|
3107
|
+
/**
|
|
3108
|
+
* Reactive pointer lock.
|
|
3109
|
+
*
|
|
3110
|
+
* @see https://vueuse.org/usePointerLock
|
|
3111
|
+
* @param target
|
|
3112
|
+
* @param options
|
|
3113
|
+
*/
|
|
3114
|
+
declare function usePointerLock(target?: MaybeElementRef<MaybeHTMLElement>, options?: UsePointerLockOptions): {
|
|
3115
|
+
isSupported: vue_demi.Ref<boolean>;
|
|
3116
|
+
element: vue_demi.Ref<MaybeHTMLElement>;
|
|
3117
|
+
triggerElement: vue_demi.Ref<MaybeHTMLElement>;
|
|
3118
|
+
lock: (e: MaybeElementRef<MaybeHTMLElement> | Event, options?: PointerLockOptions) => Promise<HTMLElement>;
|
|
3119
|
+
unlock: () => Promise<boolean>;
|
|
3120
|
+
};
|
|
3121
|
+
type UsePointerLockReturn = ReturnType<typeof usePointerLock>;
|
|
3069
3122
|
|
|
3070
3123
|
declare enum SwipeDirection {
|
|
3071
3124
|
UP = "UP",
|
|
@@ -3074,7 +3127,7 @@ declare enum SwipeDirection {
|
|
|
3074
3127
|
LEFT = "LEFT",
|
|
3075
3128
|
NONE = "NONE"
|
|
3076
3129
|
}
|
|
3077
|
-
interface
|
|
3130
|
+
interface UseSwipeOptions extends ConfigurableWindow {
|
|
3078
3131
|
/**
|
|
3079
3132
|
* Register events as passive
|
|
3080
3133
|
*
|
|
@@ -3098,7 +3151,7 @@ interface SwipeOptions extends ConfigurableWindow {
|
|
|
3098
3151
|
*/
|
|
3099
3152
|
onSwipeEnd?: (e: TouchEvent, direction: SwipeDirection) => void;
|
|
3100
3153
|
}
|
|
3101
|
-
interface
|
|
3154
|
+
interface UseSwipeReturn {
|
|
3102
3155
|
isPassiveEventSupported: boolean;
|
|
3103
3156
|
isSwiping: Ref<boolean>;
|
|
3104
3157
|
direction: ComputedRef<SwipeDirection | null>;
|
|
@@ -3115,33 +3168,33 @@ interface SwipeReturn {
|
|
|
3115
3168
|
* @param target
|
|
3116
3169
|
* @param options
|
|
3117
3170
|
*/
|
|
3118
|
-
declare function useSwipe(target:
|
|
3171
|
+
declare function useSwipe(target: MaybeComputedRef<EventTarget | null | undefined>, options?: UseSwipeOptions): UseSwipeReturn;
|
|
3119
3172
|
|
|
3120
|
-
interface
|
|
3173
|
+
interface UsePointerSwipeOptions {
|
|
3121
3174
|
/**
|
|
3122
3175
|
* @default 50
|
|
3123
3176
|
*/
|
|
3124
3177
|
threshold?: number;
|
|
3125
3178
|
/**
|
|
3126
|
-
* Callback on swipe start
|
|
3179
|
+
* Callback on swipe start.
|
|
3127
3180
|
*/
|
|
3128
3181
|
onSwipeStart?: (e: PointerEvent) => void;
|
|
3129
3182
|
/**
|
|
3130
|
-
* Callback on swipe move
|
|
3183
|
+
* Callback on swipe move.
|
|
3131
3184
|
*/
|
|
3132
3185
|
onSwipe?: (e: PointerEvent) => void;
|
|
3133
3186
|
/**
|
|
3134
|
-
* Callback on swipe end
|
|
3187
|
+
* Callback on swipe end.
|
|
3135
3188
|
*/
|
|
3136
3189
|
onSwipeEnd?: (e: PointerEvent, direction: SwipeDirection) => void;
|
|
3137
3190
|
/**
|
|
3138
|
-
* Pointer types
|
|
3191
|
+
* Pointer types to listen to.
|
|
3139
3192
|
*
|
|
3140
3193
|
* @default ['mouse', 'touch', 'pen']
|
|
3141
3194
|
*/
|
|
3142
3195
|
pointerTypes?: PointerType[];
|
|
3143
3196
|
}
|
|
3144
|
-
interface
|
|
3197
|
+
interface UsePointerSwipeReturn {
|
|
3145
3198
|
readonly isSwiping: Ref<boolean>;
|
|
3146
3199
|
direction: Readonly<Ref<SwipeDirection | null>>;
|
|
3147
3200
|
readonly posStart: Position;
|
|
@@ -3157,9 +3210,9 @@ interface PointerSwipeReturn {
|
|
|
3157
3210
|
* @param target
|
|
3158
3211
|
* @param options
|
|
3159
3212
|
*/
|
|
3160
|
-
declare function usePointerSwipe(target:
|
|
3213
|
+
declare function usePointerSwipe(target: MaybeComputedRef<HTMLElement | null | undefined>, options?: UsePointerSwipeOptions): UsePointerSwipeReturn;
|
|
3161
3214
|
|
|
3162
|
-
|
|
3215
|
+
type ColorSchemeType = 'dark' | 'light' | 'no-preference';
|
|
3163
3216
|
/**
|
|
3164
3217
|
* Reactive prefers-color-scheme media query.
|
|
3165
3218
|
*
|
|
@@ -3168,6 +3221,15 @@ declare type ColorSchemeType = 'dark' | 'light' | 'no-preference';
|
|
|
3168
3221
|
*/
|
|
3169
3222
|
declare function usePreferredColorScheme(options?: ConfigurableWindow): vue_demi.ComputedRef<ColorSchemeType>;
|
|
3170
3223
|
|
|
3224
|
+
type ContrastType = 'more' | 'less' | 'custom' | 'no-preference';
|
|
3225
|
+
/**
|
|
3226
|
+
* Reactive prefers-contrast media query.
|
|
3227
|
+
*
|
|
3228
|
+
* @see https://vueuse.org/usePreferredContrast
|
|
3229
|
+
* @param [options]
|
|
3230
|
+
*/
|
|
3231
|
+
declare function usePreferredContrast(options?: ConfigurableWindow): vue_demi.ComputedRef<ContrastType>;
|
|
3232
|
+
|
|
3171
3233
|
/**
|
|
3172
3234
|
* Reactive dark theme preference.
|
|
3173
3235
|
*
|
|
@@ -3184,7 +3246,34 @@ declare function usePreferredDark(options?: ConfigurableWindow): vue.Ref<boolean
|
|
|
3184
3246
|
*/
|
|
3185
3247
|
declare function usePreferredLanguages(options?: ConfigurableWindow): Ref<readonly string[]>;
|
|
3186
3248
|
|
|
3187
|
-
|
|
3249
|
+
type ReducedMotionType = 'reduce' | 'no-preference';
|
|
3250
|
+
/**
|
|
3251
|
+
* Reactive prefers-reduced-motion media query.
|
|
3252
|
+
*
|
|
3253
|
+
* @see https://vueuse.org/usePreferredReducedMotion
|
|
3254
|
+
* @param [options]
|
|
3255
|
+
*/
|
|
3256
|
+
declare function usePreferredReducedMotion(options?: ConfigurableWindow): vue_demi.ComputedRef<ReducedMotionType>;
|
|
3257
|
+
|
|
3258
|
+
/**
|
|
3259
|
+
* Holds the previous value of a ref.
|
|
3260
|
+
*
|
|
3261
|
+
* @see {@link https://vueuse.org/usePrevious}
|
|
3262
|
+
*/
|
|
3263
|
+
declare function usePrevious<T>(value: MaybeComputedRef<T>): Readonly<Ref<T | undefined>>;
|
|
3264
|
+
declare function usePrevious<T>(value: MaybeComputedRef<T>, initialValue: T): Readonly<Ref<T>>;
|
|
3265
|
+
|
|
3266
|
+
interface UseRafFnCallbackArguments {
|
|
3267
|
+
/**
|
|
3268
|
+
* Time elapsed between this and the last frame.
|
|
3269
|
+
*/
|
|
3270
|
+
delta: number;
|
|
3271
|
+
/**
|
|
3272
|
+
* Time elapsed since the creation of the web page. See {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp#the_time_origin Time origin}.
|
|
3273
|
+
*/
|
|
3274
|
+
timestamp: DOMHighResTimeStamp;
|
|
3275
|
+
}
|
|
3276
|
+
interface UseRafFnOptions extends ConfigurableWindow {
|
|
3188
3277
|
/**
|
|
3189
3278
|
* Start the requestAnimationFrame loop immediately on creation
|
|
3190
3279
|
*
|
|
@@ -3199,22 +3288,21 @@ interface RafFnOptions extends ConfigurableWindow {
|
|
|
3199
3288
|
* @param fn
|
|
3200
3289
|
* @param options
|
|
3201
3290
|
*/
|
|
3202
|
-
declare function useRafFn(fn:
|
|
3291
|
+
declare function useRafFn(fn: (args: UseRafFnCallbackArguments) => void, options?: UseRafFnOptions): Pausable;
|
|
3203
3292
|
|
|
3204
3293
|
/**
|
|
3205
|
-
*
|
|
3206
3294
|
* Reactive screen orientation
|
|
3207
3295
|
*
|
|
3208
3296
|
* @see https://vueuse.org/useScreenOrientation
|
|
3209
3297
|
*/
|
|
3210
3298
|
declare const useScreenOrientation: (options?: ConfigurableWindow) => {
|
|
3211
|
-
isSupported: boolean
|
|
3299
|
+
isSupported: vue_demi.Ref<boolean>;
|
|
3212
3300
|
orientation: vue_demi.Ref<OrientationType | undefined>;
|
|
3213
3301
|
angle: vue_demi.Ref<number>;
|
|
3214
3302
|
lockOrientation: (type: OrientationLockType) => Promise<void>;
|
|
3215
3303
|
unlockOrientation: () => void;
|
|
3216
3304
|
};
|
|
3217
|
-
|
|
3305
|
+
type UseScreenOrientationReturn = ReturnType<typeof useScreenOrientation>;
|
|
3218
3306
|
|
|
3219
3307
|
/**
|
|
3220
3308
|
* Reactive `env(safe-area-inset-*)`
|
|
@@ -3272,12 +3360,12 @@ interface UseScriptTagOptions extends ConfigurableDocument {
|
|
|
3272
3360
|
* @param onLoaded
|
|
3273
3361
|
* @param options
|
|
3274
3362
|
*/
|
|
3275
|
-
declare function useScriptTag(src:
|
|
3363
|
+
declare function useScriptTag(src: MaybeComputedRef<string>, onLoaded?: (el: HTMLScriptElement) => void, options?: UseScriptTagOptions): {
|
|
3276
3364
|
scriptTag: vue_demi.Ref<HTMLScriptElement | null>;
|
|
3277
3365
|
load: (waitForScriptLoad?: boolean) => Promise<HTMLScriptElement | boolean>;
|
|
3278
3366
|
unload: () => void;
|
|
3279
3367
|
};
|
|
3280
|
-
|
|
3368
|
+
type UseScriptTagReturn = ReturnType<typeof useScriptTag>;
|
|
3281
3369
|
|
|
3282
3370
|
/**
|
|
3283
3371
|
* Lock scrolling of the element.
|
|
@@ -3285,15 +3373,15 @@ declare type UseScriptTagReturn = ReturnType<typeof useScriptTag>;
|
|
|
3285
3373
|
* @see https://vueuse.org/useScrollLock
|
|
3286
3374
|
* @param element
|
|
3287
3375
|
*/
|
|
3288
|
-
declare function useScrollLock(element:
|
|
3376
|
+
declare function useScrollLock(element: MaybeComputedRef<HTMLElement | SVGElement | Window | Document | null | undefined>, initialState?: boolean): vue_demi.WritableComputedRef<boolean>;
|
|
3289
3377
|
|
|
3290
|
-
declare function useSessionStorage(key: string, initialValue:
|
|
3291
|
-
declare function useSessionStorage(key: string, initialValue:
|
|
3292
|
-
declare function useSessionStorage(key: string, initialValue:
|
|
3293
|
-
declare function useSessionStorage<T>(key: string, initialValue:
|
|
3294
|
-
declare function useSessionStorage<T = unknown>(key: string, initialValue:
|
|
3378
|
+
declare function useSessionStorage(key: string, initialValue: MaybeComputedRef<string>, options?: UseStorageOptions<string>): RemovableRef<string>;
|
|
3379
|
+
declare function useSessionStorage(key: string, initialValue: MaybeComputedRef<boolean>, options?: UseStorageOptions<boolean>): RemovableRef<boolean>;
|
|
3380
|
+
declare function useSessionStorage(key: string, initialValue: MaybeComputedRef<number>, options?: UseStorageOptions<number>): RemovableRef<number>;
|
|
3381
|
+
declare function useSessionStorage<T>(key: string, initialValue: MaybeComputedRef<T>, options?: UseStorageOptions<T>): RemovableRef<T>;
|
|
3382
|
+
declare function useSessionStorage<T = unknown>(key: string, initialValue: MaybeComputedRef<null>, options?: UseStorageOptions<T>): RemovableRef<T>;
|
|
3295
3383
|
|
|
3296
|
-
interface
|
|
3384
|
+
interface UseShareOptions {
|
|
3297
3385
|
title?: string;
|
|
3298
3386
|
files?: File[];
|
|
3299
3387
|
text?: string;
|
|
@@ -3306,13 +3394,34 @@ interface ShareOptions {
|
|
|
3306
3394
|
* @param shareOptions
|
|
3307
3395
|
* @param options
|
|
3308
3396
|
*/
|
|
3309
|
-
declare function useShare(shareOptions?:
|
|
3310
|
-
isSupported: boolean
|
|
3311
|
-
share: (overrideOptions?:
|
|
3397
|
+
declare function useShare(shareOptions?: MaybeComputedRef<UseShareOptions>, options?: ConfigurableNavigator): {
|
|
3398
|
+
isSupported: vue.Ref<boolean>;
|
|
3399
|
+
share: (overrideOptions?: MaybeComputedRef<UseShareOptions>) => Promise<void>;
|
|
3312
3400
|
};
|
|
3313
|
-
|
|
3401
|
+
type UseShareReturn = ReturnType<typeof useShare>;
|
|
3402
|
+
|
|
3403
|
+
type UseSortedCompareFn<T = any> = (a: T, b: T) => number;
|
|
3404
|
+
type UseSortedFn<T = any> = (arr: T[], compareFn: UseSortedCompareFn<T>) => T[];
|
|
3405
|
+
interface UseSortedOptions<T = any> {
|
|
3406
|
+
/**
|
|
3407
|
+
* sort algorithm
|
|
3408
|
+
*/
|
|
3409
|
+
sortFn?: UseSortedFn<T>;
|
|
3410
|
+
/**
|
|
3411
|
+
* compare function
|
|
3412
|
+
*/
|
|
3413
|
+
compareFn?: UseSortedCompareFn<T>;
|
|
3414
|
+
/**
|
|
3415
|
+
* change the value of the source array
|
|
3416
|
+
* @default false
|
|
3417
|
+
*/
|
|
3418
|
+
dirty?: boolean;
|
|
3419
|
+
}
|
|
3420
|
+
declare function useSorted<T = any>(source: MaybeRef<T[]>, compareFn?: UseSortedCompareFn<T>): Ref<T[]>;
|
|
3421
|
+
declare function useSorted<T = any>(source: MaybeRef<T[]>, options?: UseSortedOptions<T>): Ref<T[]>;
|
|
3422
|
+
declare function useSorted<T = any>(source: MaybeRef<T[]>, compareFn?: UseSortedCompareFn<T>, options?: Omit<UseSortedOptions<T>, 'compareFn'>): Ref<T[]>;
|
|
3314
3423
|
|
|
3315
|
-
|
|
3424
|
+
type SpeechRecognitionErrorCode = 'aborted' | 'audio-capture' | 'bad-grammar' | 'language-not-supported' | 'network' | 'no-speech' | 'not-allowed' | 'service-not-allowed';
|
|
3316
3425
|
interface SpeechGrammar {
|
|
3317
3426
|
src: string;
|
|
3318
3427
|
weight: number;
|
|
@@ -3371,7 +3480,7 @@ interface SpeechRecognition extends EventTarget {
|
|
|
3371
3480
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
3372
3481
|
}
|
|
3373
3482
|
|
|
3374
|
-
interface
|
|
3483
|
+
interface UseSpeechRecognitionOptions extends ConfigurableWindow {
|
|
3375
3484
|
/**
|
|
3376
3485
|
* Controls whether continuous results are returned for each recognition, or only a single result.
|
|
3377
3486
|
*
|
|
@@ -3385,11 +3494,11 @@ interface SpeechRecognitionOptions extends ConfigurableWindow {
|
|
|
3385
3494
|
*/
|
|
3386
3495
|
interimResults?: boolean;
|
|
3387
3496
|
/**
|
|
3388
|
-
*
|
|
3497
|
+
* Language for SpeechRecognition
|
|
3389
3498
|
*
|
|
3390
3499
|
* @default 'en-US'
|
|
3391
3500
|
*/
|
|
3392
|
-
lang?:
|
|
3501
|
+
lang?: MaybeComputedRef<string>;
|
|
3393
3502
|
}
|
|
3394
3503
|
/**
|
|
3395
3504
|
* Reactive SpeechRecognition.
|
|
@@ -3398,8 +3507,8 @@ interface SpeechRecognitionOptions extends ConfigurableWindow {
|
|
|
3398
3507
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition SpeechRecognition
|
|
3399
3508
|
* @param options
|
|
3400
3509
|
*/
|
|
3401
|
-
declare function useSpeechRecognition(options?:
|
|
3402
|
-
isSupported: boolean
|
|
3510
|
+
declare function useSpeechRecognition(options?: UseSpeechRecognitionOptions): {
|
|
3511
|
+
isSupported: Ref<boolean>;
|
|
3403
3512
|
isListening: Ref<boolean>;
|
|
3404
3513
|
isFinal: Ref<boolean>;
|
|
3405
3514
|
recognition: SpeechRecognition | undefined;
|
|
@@ -3409,17 +3518,16 @@ declare function useSpeechRecognition(options?: SpeechRecognitionOptions): {
|
|
|
3409
3518
|
start: () => void;
|
|
3410
3519
|
stop: () => void;
|
|
3411
3520
|
};
|
|
3412
|
-
|
|
3521
|
+
type UseSpeechRecognitionReturn = ReturnType<typeof useSpeechRecognition>;
|
|
3413
3522
|
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
interface SpeechSynthesisOptions extends ConfigurableWindow {
|
|
3523
|
+
type UseSpeechSynthesisStatus = 'init' | 'play' | 'pause' | 'end';
|
|
3524
|
+
interface UseSpeechSynthesisOptions extends ConfigurableWindow {
|
|
3417
3525
|
/**
|
|
3418
3526
|
* Language for SpeechSynthesis
|
|
3419
3527
|
*
|
|
3420
3528
|
* @default 'en-US'
|
|
3421
3529
|
*/
|
|
3422
|
-
lang?:
|
|
3530
|
+
lang?: MaybeComputedRef<string>;
|
|
3423
3531
|
/**
|
|
3424
3532
|
* Gets and sets the pitch at which the utterance will be spoken at.
|
|
3425
3533
|
*
|
|
@@ -3435,7 +3543,7 @@ interface SpeechSynthesisOptions extends ConfigurableWindow {
|
|
|
3435
3543
|
/**
|
|
3436
3544
|
* Gets and sets the voice that will be used to speak the utterance.
|
|
3437
3545
|
*/
|
|
3438
|
-
voice?: SpeechSynthesisVoice
|
|
3546
|
+
voice?: MaybeRef<SpeechSynthesisVoice>;
|
|
3439
3547
|
/**
|
|
3440
3548
|
* Gets and sets the volume that the utterance will be spoken at.
|
|
3441
3549
|
*
|
|
@@ -3450,20 +3558,16 @@ interface SpeechSynthesisOptions extends ConfigurableWindow {
|
|
|
3450
3558
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis SpeechSynthesis
|
|
3451
3559
|
* @param options
|
|
3452
3560
|
*/
|
|
3453
|
-
declare function useSpeechSynthesis(text:
|
|
3454
|
-
isSupported: boolean
|
|
3561
|
+
declare function useSpeechSynthesis(text: MaybeComputedRef<string>, options?: UseSpeechSynthesisOptions): {
|
|
3562
|
+
isSupported: Ref<boolean>;
|
|
3455
3563
|
isPlaying: Ref<boolean>;
|
|
3456
|
-
status: Ref<
|
|
3457
|
-
voiceInfo: {
|
|
3458
|
-
lang: string;
|
|
3459
|
-
name: string;
|
|
3460
|
-
};
|
|
3564
|
+
status: Ref<UseSpeechSynthesisStatus>;
|
|
3461
3565
|
utterance: vue_demi.ComputedRef<SpeechSynthesisUtterance>;
|
|
3462
3566
|
error: Ref<SpeechSynthesisErrorEvent | undefined>;
|
|
3463
3567
|
toggle: (value?: boolean) => void;
|
|
3464
3568
|
speak: () => void;
|
|
3465
3569
|
};
|
|
3466
|
-
|
|
3570
|
+
type UseSpeechSynthesisReturn = ReturnType<typeof useSpeechSynthesis>;
|
|
3467
3571
|
|
|
3468
3572
|
interface UseStepperReturn<StepName, Steps, Step> {
|
|
3469
3573
|
/** List of steps. */
|
|
@@ -3508,17 +3612,17 @@ interface UseStepperReturn<StepName, Steps, Step> {
|
|
|
3508
3612
|
declare function useStepper<T extends string | number>(steps: MaybeRef<T[]>, initialStep?: T): UseStepperReturn<T, T[], T>;
|
|
3509
3613
|
declare function useStepper<T extends Record<string, any>>(steps: MaybeRef<T>, initialStep?: keyof T): UseStepperReturn<Exclude<keyof T, symbol>, T, T[keyof T]>;
|
|
3510
3614
|
|
|
3511
|
-
interface
|
|
3615
|
+
interface UseStorageAsyncOptions<T> extends Omit<UseStorageOptions<T>, 'serializer'> {
|
|
3512
3616
|
/**
|
|
3513
3617
|
* Custom data serialization
|
|
3514
3618
|
*/
|
|
3515
3619
|
serializer?: SerializerAsync<T>;
|
|
3516
3620
|
}
|
|
3517
|
-
declare function useStorageAsync(key: string, initialValue:
|
|
3518
|
-
declare function useStorageAsync(key: string, initialValue:
|
|
3519
|
-
declare function useStorageAsync(key: string, initialValue:
|
|
3520
|
-
declare function useStorageAsync<T>(key: string, initialValue:
|
|
3521
|
-
declare function useStorageAsync<T = unknown>(key: string, initialValue:
|
|
3621
|
+
declare function useStorageAsync(key: string, initialValue: MaybeComputedRef<string>, storage?: StorageLikeAsync, options?: UseStorageAsyncOptions<string>): RemovableRef<string>;
|
|
3622
|
+
declare function useStorageAsync(key: string, initialValue: MaybeComputedRef<boolean>, storage?: StorageLikeAsync, options?: UseStorageAsyncOptions<boolean>): RemovableRef<boolean>;
|
|
3623
|
+
declare function useStorageAsync(key: string, initialValue: MaybeComputedRef<number>, storage?: StorageLikeAsync, options?: UseStorageAsyncOptions<number>): RemovableRef<number>;
|
|
3624
|
+
declare function useStorageAsync<T>(key: string, initialValue: MaybeComputedRef<T>, storage?: StorageLikeAsync, options?: UseStorageAsyncOptions<T>): RemovableRef<T>;
|
|
3625
|
+
declare function useStorageAsync<T = unknown>(key: string, initialValue: MaybeComputedRef<null>, storage?: StorageLikeAsync, options?: UseStorageAsyncOptions<T>): RemovableRef<T>;
|
|
3522
3626
|
|
|
3523
3627
|
interface UseStyleTagOptions extends ConfigurableDocument {
|
|
3524
3628
|
/**
|
|
@@ -3562,11 +3666,41 @@ interface UseStyleTagReturn {
|
|
|
3562
3666
|
*/
|
|
3563
3667
|
declare function useStyleTag(css: MaybeRef<string>, options?: UseStyleTagOptions): UseStyleTagReturn;
|
|
3564
3668
|
|
|
3565
|
-
declare
|
|
3669
|
+
declare function useSupported(callback: () => unknown, sync?: boolean): Ref<boolean>;
|
|
3670
|
+
|
|
3671
|
+
type TemplateRefsList<T> = T[] & {
|
|
3566
3672
|
set(el: Object | null): void;
|
|
3567
3673
|
};
|
|
3568
3674
|
declare function useTemplateRefsList<T = Element>(): Readonly<Ref<Readonly<TemplateRefsList<T>>>>;
|
|
3569
3675
|
|
|
3676
|
+
type UseTextDirectionValue = 'ltr' | 'rtl' | 'auto';
|
|
3677
|
+
interface UseTextDirectionOptions extends ConfigurableDocument {
|
|
3678
|
+
/**
|
|
3679
|
+
* CSS Selector for the target element applying to
|
|
3680
|
+
*
|
|
3681
|
+
* @default 'html'
|
|
3682
|
+
*/
|
|
3683
|
+
selector?: string;
|
|
3684
|
+
/**
|
|
3685
|
+
* Observe `document.querySelector(selector)` changes using MutationObserve
|
|
3686
|
+
*
|
|
3687
|
+
* @default false
|
|
3688
|
+
*/
|
|
3689
|
+
observe?: boolean;
|
|
3690
|
+
/**
|
|
3691
|
+
* Initial value
|
|
3692
|
+
*
|
|
3693
|
+
* @default 'ltr'
|
|
3694
|
+
*/
|
|
3695
|
+
initialValue?: UseTextDirectionValue;
|
|
3696
|
+
}
|
|
3697
|
+
/**
|
|
3698
|
+
* Reactive dir of the element's text.
|
|
3699
|
+
*
|
|
3700
|
+
* @see https://vueuse.org/useTextDirection
|
|
3701
|
+
*/
|
|
3702
|
+
declare function useTextDirection(options?: UseTextDirectionOptions): vue_demi.WritableComputedRef<UseTextDirectionValue>;
|
|
3703
|
+
|
|
3570
3704
|
/**
|
|
3571
3705
|
* Reactively track user text selection based on [`Window.getSelection`](https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection).
|
|
3572
3706
|
*
|
|
@@ -3593,6 +3727,7 @@ declare function useTextSelection(options?: ConfigurableWindow): {
|
|
|
3593
3727
|
empty: () => void;
|
|
3594
3728
|
extend: (node: Node, offset?: number | undefined) => void;
|
|
3595
3729
|
getRangeAt: (index: number) => Range;
|
|
3730
|
+
modify: (alter?: string | undefined, direction?: string | undefined, granularity?: string | undefined) => void;
|
|
3596
3731
|
removeAllRanges: () => void;
|
|
3597
3732
|
removeRange: (range: Range) => void;
|
|
3598
3733
|
selectAllChildren: (node: Node) => void;
|
|
@@ -3601,7 +3736,7 @@ declare function useTextSelection(options?: ConfigurableWindow): {
|
|
|
3601
3736
|
toString: () => string;
|
|
3602
3737
|
} | null>;
|
|
3603
3738
|
};
|
|
3604
|
-
|
|
3739
|
+
type UseTextSelectionReturn = ReturnType<typeof useTextSelection>;
|
|
3605
3740
|
|
|
3606
3741
|
interface UseTextareaAutosizeOptions {
|
|
3607
3742
|
/** Textarea element to autosize. */
|
|
@@ -3618,7 +3753,13 @@ declare function useTextareaAutosize(options?: UseTextareaAutosizeOptions): {
|
|
|
3618
3753
|
input: vue_demi.Ref<string>;
|
|
3619
3754
|
triggerResize: () => void;
|
|
3620
3755
|
};
|
|
3756
|
+
type UseTextareaAutosizeReturn = ReturnType<typeof useTextareaAutosize>;
|
|
3621
3757
|
|
|
3758
|
+
type UseThrottledRefHistoryOptions<Raw, Serialized = Raw> = Omit<UseRefHistoryOptions<Raw, Serialized>, 'eventFilter'> & {
|
|
3759
|
+
throttle?: MaybeRef<number>;
|
|
3760
|
+
trailing?: boolean;
|
|
3761
|
+
};
|
|
3762
|
+
type UseThrottledRefHistoryReturn<Raw, Serialized = Raw> = UseRefHistoryReturn<Raw, Serialized>;
|
|
3622
3763
|
/**
|
|
3623
3764
|
* Shorthand for [useRefHistory](https://vueuse.org/useRefHistory) with throttled filter.
|
|
3624
3765
|
*
|
|
@@ -3626,66 +3767,84 @@ declare function useTextareaAutosize(options?: UseTextareaAutosizeOptions): {
|
|
|
3626
3767
|
* @param source
|
|
3627
3768
|
* @param options
|
|
3628
3769
|
*/
|
|
3629
|
-
declare function useThrottledRefHistory<Raw, Serialized = Raw>(source: Ref<Raw>, options?:
|
|
3630
|
-
throttle?: MaybeRef<number>;
|
|
3631
|
-
trailing?: boolean;
|
|
3632
|
-
}): UseRefHistoryReturn<Raw, Serialized>;
|
|
3770
|
+
declare function useThrottledRefHistory<Raw, Serialized = Raw>(source: Ref<Raw>, options?: UseThrottledRefHistoryOptions<Raw, Serialized>): UseThrottledRefHistoryReturn<Raw, Serialized>;
|
|
3633
3771
|
|
|
3634
|
-
|
|
3635
|
-
|
|
3772
|
+
type UseTimeAgoFormatter<T = number> = (value: T, isPast: boolean) => string;
|
|
3773
|
+
type UseTimeAgoUnitNamesDefault = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
|
|
3774
|
+
interface UseTimeAgoMessagesBuiltIn {
|
|
3636
3775
|
justNow: string;
|
|
3637
3776
|
past: string | UseTimeAgoFormatter<string>;
|
|
3638
3777
|
future: string | UseTimeAgoFormatter<string>;
|
|
3639
|
-
|
|
3640
|
-
month: string | UseTimeAgoFormatter<number>;
|
|
3641
|
-
day: string | UseTimeAgoFormatter<number>;
|
|
3642
|
-
week: string | UseTimeAgoFormatter<number>;
|
|
3643
|
-
hour: string | UseTimeAgoFormatter<number>;
|
|
3644
|
-
minute: string | UseTimeAgoFormatter<number>;
|
|
3645
|
-
second: string | UseTimeAgoFormatter<number>;
|
|
3778
|
+
invalid: string;
|
|
3646
3779
|
}
|
|
3647
|
-
|
|
3780
|
+
type UseTimeAgoMessages<UnitNames extends string = UseTimeAgoUnitNamesDefault> = UseTimeAgoMessagesBuiltIn & Record<UnitNames, string | UseTimeAgoFormatter<number>>;
|
|
3781
|
+
interface FormatTimeAgoOptions<UnitNames extends string = UseTimeAgoUnitNamesDefault> {
|
|
3648
3782
|
/**
|
|
3649
|
-
*
|
|
3783
|
+
* Maximum unit (of diff in milliseconds) to display the full date instead of relative
|
|
3650
3784
|
*
|
|
3651
|
-
* @default
|
|
3785
|
+
* @default undefined
|
|
3652
3786
|
*/
|
|
3653
|
-
|
|
3787
|
+
max?: UnitNames | number;
|
|
3654
3788
|
/**
|
|
3655
|
-
*
|
|
3789
|
+
* Formatter for full date
|
|
3790
|
+
*/
|
|
3791
|
+
fullDateFormatter?: (date: Date) => string;
|
|
3792
|
+
/**
|
|
3793
|
+
* Messages for formatting the string
|
|
3794
|
+
*/
|
|
3795
|
+
messages?: UseTimeAgoMessages<UnitNames>;
|
|
3796
|
+
/**
|
|
3797
|
+
* Minimum display time unit (default is minute)
|
|
3656
3798
|
*
|
|
3657
|
-
* @default
|
|
3799
|
+
* @default false
|
|
3658
3800
|
*/
|
|
3659
|
-
|
|
3801
|
+
showSecond?: boolean;
|
|
3660
3802
|
/**
|
|
3661
|
-
*
|
|
3803
|
+
* Rounding method to apply.
|
|
3662
3804
|
*
|
|
3663
|
-
* @default
|
|
3805
|
+
* @default 'round'
|
|
3664
3806
|
*/
|
|
3665
|
-
|
|
3807
|
+
rounding?: 'round' | 'ceil' | 'floor' | number;
|
|
3666
3808
|
/**
|
|
3667
|
-
*
|
|
3809
|
+
* Custom units
|
|
3668
3810
|
*/
|
|
3669
|
-
|
|
3811
|
+
units?: UseTimeAgoUnit<UseTimeAgoUnitNamesDefault>[];
|
|
3812
|
+
}
|
|
3813
|
+
interface UseTimeAgoOptions<Controls extends boolean, UnitNames extends string = UseTimeAgoUnitNamesDefault> extends FormatTimeAgoOptions<UnitNames> {
|
|
3814
|
+
/**
|
|
3815
|
+
* Expose more controls
|
|
3816
|
+
*
|
|
3817
|
+
* @default false
|
|
3818
|
+
*/
|
|
3819
|
+
controls?: Controls;
|
|
3670
3820
|
/**
|
|
3671
|
-
*
|
|
3821
|
+
* Intervals to update, set 0 to disable auto update
|
|
3822
|
+
*
|
|
3823
|
+
* @default 30_000
|
|
3672
3824
|
*/
|
|
3673
|
-
|
|
3825
|
+
updateInterval?: number;
|
|
3674
3826
|
}
|
|
3827
|
+
interface UseTimeAgoUnit<Unit extends string = UseTimeAgoUnitNamesDefault> {
|
|
3828
|
+
max: number;
|
|
3829
|
+
value: number;
|
|
3830
|
+
name: Unit;
|
|
3831
|
+
}
|
|
3832
|
+
type UseTimeAgoReturn<Controls extends boolean = false> = Controls extends true ? {
|
|
3833
|
+
timeAgo: ComputedRef<string>;
|
|
3834
|
+
} & Pausable : ComputedRef<string>;
|
|
3675
3835
|
/**
|
|
3676
3836
|
* Reactive time ago formatter.
|
|
3677
3837
|
*
|
|
3678
3838
|
* @see https://vueuse.org/useTimeAgo
|
|
3679
3839
|
* @param options
|
|
3680
3840
|
*/
|
|
3681
|
-
declare function useTimeAgo(time:
|
|
3682
|
-
declare function useTimeAgo(time:
|
|
3683
|
-
|
|
3684
|
-
} & Pausable;
|
|
3841
|
+
declare function useTimeAgo<UnitNames extends string = UseTimeAgoUnitNamesDefault>(time: MaybeComputedRef<Date | number | string>, options?: UseTimeAgoOptions<false, UnitNames>): UseTimeAgoReturn<false>;
|
|
3842
|
+
declare function useTimeAgo<UnitNames extends string = UseTimeAgoUnitNamesDefault>(time: MaybeComputedRef<Date | number | string>, options: UseTimeAgoOptions<true, UnitNames>): UseTimeAgoReturn<true>;
|
|
3843
|
+
declare function formatTimeAgo<UnitNames extends string = UseTimeAgoUnitNamesDefault>(from: Date, options?: FormatTimeAgoOptions<UnitNames>, now?: Date | number): string;
|
|
3685
3844
|
|
|
3686
|
-
declare function useTimeoutPoll(fn: () => Awaitable<void>, interval:
|
|
3845
|
+
declare function useTimeoutPoll(fn: () => Awaitable<void>, interval: MaybeComputedRef<number>, timeoutPollOptions?: UseTimeoutFnOptions): Pausable;
|
|
3687
3846
|
|
|
3688
|
-
interface
|
|
3847
|
+
interface UseTimestampOptions<Controls extends boolean> {
|
|
3689
3848
|
/**
|
|
3690
3849
|
* Expose more controls
|
|
3691
3850
|
*
|
|
@@ -3710,6 +3869,10 @@ interface TimestampOptions<Controls extends boolean> {
|
|
|
3710
3869
|
* @default requestAnimationFrame
|
|
3711
3870
|
*/
|
|
3712
3871
|
interval?: 'requestAnimationFrame' | number;
|
|
3872
|
+
/**
|
|
3873
|
+
* Callback on each update
|
|
3874
|
+
*/
|
|
3875
|
+
callback?: (timestamp: number) => void;
|
|
3713
3876
|
}
|
|
3714
3877
|
/**
|
|
3715
3878
|
* Reactive current timestamp.
|
|
@@ -3717,48 +3880,46 @@ interface TimestampOptions<Controls extends boolean> {
|
|
|
3717
3880
|
* @see https://vueuse.org/useTimestamp
|
|
3718
3881
|
* @param options
|
|
3719
3882
|
*/
|
|
3720
|
-
declare function useTimestamp(options?:
|
|
3721
|
-
declare function useTimestamp(options:
|
|
3883
|
+
declare function useTimestamp(options?: UseTimestampOptions<false>): Ref<number>;
|
|
3884
|
+
declare function useTimestamp(options: UseTimestampOptions<true>): {
|
|
3722
3885
|
timestamp: Ref<number>;
|
|
3723
3886
|
} & Pausable;
|
|
3724
|
-
|
|
3887
|
+
type UseTimestampReturn = ReturnType<typeof useTimestamp>;
|
|
3725
3888
|
|
|
3726
|
-
|
|
3889
|
+
type UseTitleOptionsBase = {
|
|
3727
3890
|
/**
|
|
3728
3891
|
* Observe `document.title` changes using MutationObserve
|
|
3892
|
+
* Cannot be used together with `titleTemplate` option.
|
|
3729
3893
|
*
|
|
3730
3894
|
* @default false
|
|
3731
3895
|
*/
|
|
3732
3896
|
observe?: boolean;
|
|
3897
|
+
} | {
|
|
3733
3898
|
/**
|
|
3734
3899
|
* The template string to parse the title (e.g., '%s | My Website')
|
|
3900
|
+
* Cannot be used together with `observe` option.
|
|
3735
3901
|
*
|
|
3736
3902
|
* @default '%s'
|
|
3737
3903
|
*/
|
|
3738
|
-
titleTemplate?: string;
|
|
3739
|
-
}
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
* @param newTitle
|
|
3745
|
-
* @param options
|
|
3746
|
-
*/
|
|
3747
|
-
declare function useTitle(newTitle?: MaybeRef<string | null | undefined>, options?: UseTitleOptions): vue_demi.Ref<string | null | undefined>;
|
|
3748
|
-
declare type UseTitleReturn = ReturnType<typeof useTitle>;
|
|
3904
|
+
titleTemplate?: MaybeRef<string> | ((title: string) => string);
|
|
3905
|
+
};
|
|
3906
|
+
type UseTitleOptions = ConfigurableDocument & UseTitleOptionsBase;
|
|
3907
|
+
declare function useTitle(newTitle: MaybeReadonlyRef<string | null | undefined>, options?: UseTitleOptions): ComputedRef<string | null | undefined>;
|
|
3908
|
+
declare function useTitle(newTitle?: MaybeRef<string | null | undefined>, options?: UseTitleOptions): Ref<string | null | undefined>;
|
|
3909
|
+
type UseTitleReturn = ReturnType<typeof useTitle>;
|
|
3749
3910
|
|
|
3750
3911
|
/**
|
|
3751
3912
|
* Cubic bezier points
|
|
3752
3913
|
*/
|
|
3753
|
-
|
|
3914
|
+
type CubicBezierPoints = [number, number, number, number];
|
|
3754
3915
|
/**
|
|
3755
3916
|
* Easing function
|
|
3756
3917
|
*/
|
|
3757
|
-
|
|
3918
|
+
type EasingFunction = (n: number) => number;
|
|
3758
3919
|
/**
|
|
3759
3920
|
* Transition options
|
|
3760
3921
|
*/
|
|
3761
|
-
interface
|
|
3922
|
+
interface UseTransitionOptions {
|
|
3762
3923
|
/**
|
|
3763
3924
|
* Milliseconds to wait before starting transition
|
|
3764
3925
|
*/
|
|
@@ -3789,14 +3950,16 @@ interface TransitionOptions {
|
|
|
3789
3950
|
*
|
|
3790
3951
|
* @see https://easings.net
|
|
3791
3952
|
*/
|
|
3792
|
-
declare const TransitionPresets: Record<
|
|
3793
|
-
|
|
3794
|
-
|
|
3953
|
+
declare const TransitionPresets: Record<"easeInSine" | "easeOutSine" | "easeInOutSine" | "easeInQuad" | "easeOutQuad" | "easeInOutQuad" | "easeInCubic" | "easeOutCubic" | "easeInOutCubic" | "easeInQuart" | "easeOutQuart" | "easeInOutQuart" | "easeInQuint" | "easeOutQuint" | "easeInOutQuint" | "easeInExpo" | "easeOutExpo" | "easeInOutExpo" | "easeInCirc" | "easeOutCirc" | "easeInOutCirc" | "easeInBack" | "easeOutBack" | "easeInOutBack", CubicBezierPoints> & {
|
|
3954
|
+
linear: EasingFunction;
|
|
3955
|
+
};
|
|
3956
|
+
declare function useTransition(source: Ref<number>, options?: UseTransitionOptions): ComputedRef<number>;
|
|
3957
|
+
declare function useTransition<T extends MaybeRef<number>[]>(source: [...T], options?: UseTransitionOptions): ComputedRef<{
|
|
3795
3958
|
[K in keyof T]: number;
|
|
3796
3959
|
}>;
|
|
3797
|
-
declare function useTransition<T extends Ref<number[]>>(source: T, options?:
|
|
3960
|
+
declare function useTransition<T extends Ref<number[]>>(source: T, options?: UseTransitionOptions): ComputedRef<number[]>;
|
|
3798
3961
|
|
|
3799
|
-
|
|
3962
|
+
type UrlParams = Record<string, string[] | string>;
|
|
3800
3963
|
interface UseUrlSearchParamsOptions<T> extends ConfigurableWindow {
|
|
3801
3964
|
/**
|
|
3802
3965
|
* @default true
|
|
@@ -3810,6 +3973,12 @@ interface UseUrlSearchParamsOptions<T> extends ConfigurableWindow {
|
|
|
3810
3973
|
* @default {}
|
|
3811
3974
|
*/
|
|
3812
3975
|
initialValue?: T;
|
|
3976
|
+
/**
|
|
3977
|
+
* Write back to `window.history` automatically
|
|
3978
|
+
*
|
|
3979
|
+
* @default true
|
|
3980
|
+
*/
|
|
3981
|
+
write?: boolean;
|
|
3813
3982
|
}
|
|
3814
3983
|
/**
|
|
3815
3984
|
* Reactive URLSearchParams
|
|
@@ -3858,7 +4027,7 @@ interface UseUserMediaOptions extends ConfigurableNavigator {
|
|
|
3858
4027
|
* @param options
|
|
3859
4028
|
*/
|
|
3860
4029
|
declare function useUserMedia(options?: UseUserMediaOptions): {
|
|
3861
|
-
isSupported: boolean
|
|
4030
|
+
isSupported: Ref<boolean>;
|
|
3862
4031
|
stream: Ref<MediaStream | undefined>;
|
|
3863
4032
|
start: () => Promise<MediaStream | undefined>;
|
|
3864
4033
|
stop: () => void;
|
|
@@ -3868,9 +4037,9 @@ declare function useUserMedia(options?: UseUserMediaOptions): {
|
|
|
3868
4037
|
enabled: Ref<boolean>;
|
|
3869
4038
|
autoSwitch: Ref<boolean>;
|
|
3870
4039
|
};
|
|
3871
|
-
|
|
4040
|
+
type UseUserMediaReturn = ReturnType<typeof useUserMedia>;
|
|
3872
4041
|
|
|
3873
|
-
interface
|
|
4042
|
+
interface UseVModelOptions<T> {
|
|
3874
4043
|
/**
|
|
3875
4044
|
* When passive is set to `true`, it will use `watch` to sync with props and ref.
|
|
3876
4045
|
* Instead of relying on the `v-model` or `.sync` to work.
|
|
@@ -3897,6 +4066,14 @@ interface VModelOptions<T> {
|
|
|
3897
4066
|
* @default undefined
|
|
3898
4067
|
*/
|
|
3899
4068
|
defaultValue?: T;
|
|
4069
|
+
/**
|
|
4070
|
+
* Clone the props.
|
|
4071
|
+
* Accepts a custom clone function.
|
|
4072
|
+
* When setting to `true`, it will use `JSON.parse(JSON.stringify(value))` to clone.
|
|
4073
|
+
*
|
|
4074
|
+
* @default false
|
|
4075
|
+
*/
|
|
4076
|
+
clone?: boolean | CloneFn<T>;
|
|
3900
4077
|
}
|
|
3901
4078
|
/**
|
|
3902
4079
|
* Shorthand for v-model binding, props + emit -> ref
|
|
@@ -3906,7 +4083,7 @@ interface VModelOptions<T> {
|
|
|
3906
4083
|
* @param key (default 'value' in Vue 2 and 'modelValue' in Vue 3)
|
|
3907
4084
|
* @param emit
|
|
3908
4085
|
*/
|
|
3909
|
-
declare function useVModel<P extends object, K extends keyof P, Name extends string>(props: P, key?: K, emit?: (name: Name, ...args: any[]) => void, options?:
|
|
4086
|
+
declare function useVModel<P extends object, K extends keyof P, Name extends string>(props: P, key?: K, emit?: (name: Name, ...args: any[]) => void, options?: UseVModelOptions<P[K]>): vue_demi.Ref<UnwrapRef<P[K]>> | vue_demi.WritableComputedRef<P[K]>;
|
|
3910
4087
|
|
|
3911
4088
|
/**
|
|
3912
4089
|
* Shorthand for props v-model binding. Think like `toRefs(props)` but changes will also emit out.
|
|
@@ -3915,7 +4092,7 @@ declare function useVModel<P extends object, K extends keyof P, Name extends str
|
|
|
3915
4092
|
* @param props
|
|
3916
4093
|
* @param emit
|
|
3917
4094
|
*/
|
|
3918
|
-
declare function useVModels<P extends object, Name extends string>(props: P, emit?: (name: Name, ...args: any[]) => void, options?:
|
|
4095
|
+
declare function useVModels<P extends object, Name extends string>(props: P, emit?: (name: Name, ...args: any[]) => void, options?: UseVModelOptions<any>): ToRefs<P>;
|
|
3919
4096
|
|
|
3920
4097
|
interface UseVibrateOptions extends ConfigurableNavigator {
|
|
3921
4098
|
/**
|
|
@@ -3931,7 +4108,7 @@ interface UseVibrateOptions extends ConfigurableNavigator {
|
|
|
3931
4108
|
* @default []
|
|
3932
4109
|
*
|
|
3933
4110
|
*/
|
|
3934
|
-
pattern?:
|
|
4111
|
+
pattern?: MaybeComputedRef<number[] | number>;
|
|
3935
4112
|
/**
|
|
3936
4113
|
* Interval to run a persistent vibration, in ms
|
|
3937
4114
|
*
|
|
@@ -3950,21 +4127,32 @@ interface UseVibrateOptions extends ConfigurableNavigator {
|
|
|
3950
4127
|
* @param options
|
|
3951
4128
|
*/
|
|
3952
4129
|
declare function useVibrate(options?: UseVibrateOptions): {
|
|
3953
|
-
isSupported: boolean
|
|
3954
|
-
pattern:
|
|
4130
|
+
isSupported: vue.Ref<boolean>;
|
|
4131
|
+
pattern: MaybeComputedRef<number | number[]>;
|
|
3955
4132
|
intervalControls: Pausable | undefined;
|
|
3956
4133
|
vibrate: (pattern?: number | number[]) => void;
|
|
3957
4134
|
stop: () => void;
|
|
3958
4135
|
};
|
|
3959
|
-
|
|
4136
|
+
type UseVibrateReturn = ReturnType<typeof useVibrate>;
|
|
3960
4137
|
|
|
3961
|
-
|
|
4138
|
+
type UseVirtualListItemSize = number | ((index: number) => number);
|
|
4139
|
+
interface UseHorizontalVirtualListOptions extends UseVirtualListOptionsBase {
|
|
4140
|
+
/**
|
|
4141
|
+
* item width, accept a pixel value or a function that returns the height
|
|
4142
|
+
*
|
|
4143
|
+
* @default 0
|
|
4144
|
+
*/
|
|
4145
|
+
itemWidth: UseVirtualListItemSize;
|
|
4146
|
+
}
|
|
4147
|
+
interface UseVerticalVirtualListOptions extends UseVirtualListOptionsBase {
|
|
3962
4148
|
/**
|
|
3963
4149
|
* item height, accept a pixel value or a function that returns the height
|
|
3964
4150
|
*
|
|
3965
4151
|
* @default 0
|
|
3966
4152
|
*/
|
|
3967
|
-
itemHeight:
|
|
4153
|
+
itemHeight: UseVirtualListItemSize;
|
|
4154
|
+
}
|
|
4155
|
+
interface UseVirtualListOptionsBase {
|
|
3968
4156
|
/**
|
|
3969
4157
|
* the extra buffer items outside of the view area
|
|
3970
4158
|
*
|
|
@@ -3972,46 +4160,57 @@ interface UseVirtualListOptions {
|
|
|
3972
4160
|
*/
|
|
3973
4161
|
overscan?: number;
|
|
3974
4162
|
}
|
|
4163
|
+
type UseVirtualListOptions = UseHorizontalVirtualListOptions | UseVerticalVirtualListOptions;
|
|
3975
4164
|
interface UseVirtualListItem<T> {
|
|
3976
4165
|
data: T;
|
|
3977
4166
|
index: number;
|
|
3978
4167
|
}
|
|
3979
|
-
|
|
4168
|
+
interface UseVirtualListReturn<T> {
|
|
3980
4169
|
list: Ref<UseVirtualListItem<T>[]>;
|
|
3981
4170
|
scrollTo: (index: number) => void;
|
|
3982
4171
|
containerProps: {
|
|
3983
|
-
ref: Ref<
|
|
4172
|
+
ref: Ref<HTMLElement | null>;
|
|
3984
4173
|
onScroll: () => void;
|
|
3985
|
-
style:
|
|
4174
|
+
style: StyleValue;
|
|
3986
4175
|
};
|
|
3987
|
-
wrapperProps:
|
|
4176
|
+
wrapperProps: ComputedRef<{
|
|
3988
4177
|
style: {
|
|
3989
4178
|
width: string;
|
|
3990
4179
|
height: string;
|
|
3991
4180
|
marginTop: string;
|
|
4181
|
+
} | {
|
|
4182
|
+
width: string;
|
|
4183
|
+
height: string;
|
|
4184
|
+
marginLeft: string;
|
|
4185
|
+
display: string;
|
|
3992
4186
|
};
|
|
3993
4187
|
}>;
|
|
3994
|
-
}
|
|
4188
|
+
}
|
|
4189
|
+
/**
|
|
4190
|
+
* @deprecated Please use [`vue-virtual-scroller`](https://github.com/Akryum/vue-virtual-scroller) instead.
|
|
4191
|
+
*/
|
|
4192
|
+
declare function useVirtualList<T = any>(list: MaybeRef<T[]>, options: UseVirtualListOptions): UseVirtualListReturn<T>;
|
|
3995
4193
|
|
|
3996
|
-
|
|
4194
|
+
type WakeLockType = 'screen';
|
|
3997
4195
|
interface WakeLockSentinel extends EventTarget {
|
|
3998
4196
|
type: WakeLockType;
|
|
3999
4197
|
released: boolean;
|
|
4000
4198
|
release: () => Promise<void>;
|
|
4001
4199
|
}
|
|
4200
|
+
type UseWakeLockOptions = ConfigurableNavigator & ConfigurableDocument;
|
|
4002
4201
|
/**
|
|
4003
4202
|
* Reactive Screen Wake Lock API.
|
|
4004
4203
|
*
|
|
4005
4204
|
* @see https://vueuse.org/useWakeLock
|
|
4006
4205
|
* @param options
|
|
4007
4206
|
*/
|
|
4008
|
-
declare const useWakeLock: (options?:
|
|
4009
|
-
isSupported: boolean
|
|
4207
|
+
declare const useWakeLock: (options?: UseWakeLockOptions) => {
|
|
4208
|
+
isSupported: vue_demi.Ref<boolean>;
|
|
4010
4209
|
isActive: vue_demi.Ref<boolean>;
|
|
4011
4210
|
request: (type: WakeLockType) => Promise<void>;
|
|
4012
4211
|
release: () => Promise<void>;
|
|
4013
4212
|
};
|
|
4014
|
-
|
|
4213
|
+
type UseWakeLockReturn = ReturnType<typeof useWakeLock>;
|
|
4015
4214
|
|
|
4016
4215
|
interface WebNotificationOptions {
|
|
4017
4216
|
/**
|
|
@@ -4098,7 +4297,7 @@ interface UseWebNotificationOptions extends WebNotificationOptions, Configurable
|
|
|
4098
4297
|
* @param methods of type WebNotificationMethods
|
|
4099
4298
|
*/
|
|
4100
4299
|
declare const useWebNotification: (defaultOptions?: UseWebNotificationOptions) => {
|
|
4101
|
-
isSupported: boolean
|
|
4300
|
+
isSupported: Ref<boolean>;
|
|
4102
4301
|
notification: Ref<Notification | null>;
|
|
4103
4302
|
show: (overrides?: WebNotificationOptions) => Promise<Notification | undefined>;
|
|
4104
4303
|
close: () => void;
|
|
@@ -4107,9 +4306,10 @@ declare const useWebNotification: (defaultOptions?: UseWebNotificationOptions) =
|
|
|
4107
4306
|
onError: EventHook<any>;
|
|
4108
4307
|
onClose: EventHook<any>;
|
|
4109
4308
|
};
|
|
4309
|
+
type UseWebNotificationReturn = ReturnType<typeof useWebNotification>;
|
|
4110
4310
|
|
|
4111
|
-
|
|
4112
|
-
interface
|
|
4311
|
+
type WebSocketStatus = 'OPEN' | 'CONNECTING' | 'CLOSED';
|
|
4312
|
+
interface UseWebSocketOptions {
|
|
4113
4313
|
onConnected?: (ws: WebSocket) => void;
|
|
4114
4314
|
onDisconnected?: (ws: WebSocket, event: CloseEvent) => void;
|
|
4115
4315
|
onError?: (ws: WebSocket, event: Event) => void;
|
|
@@ -4125,13 +4325,19 @@ interface WebSocketOptions {
|
|
|
4125
4325
|
*
|
|
4126
4326
|
* @default 'ping'
|
|
4127
4327
|
*/
|
|
4128
|
-
message?: string;
|
|
4328
|
+
message?: string | ArrayBuffer | Blob;
|
|
4129
4329
|
/**
|
|
4130
4330
|
* Interval, in milliseconds
|
|
4131
4331
|
*
|
|
4132
4332
|
* @default 1000
|
|
4133
4333
|
*/
|
|
4134
4334
|
interval?: number;
|
|
4335
|
+
/**
|
|
4336
|
+
* Heartbeat response timeout, in milliseconds
|
|
4337
|
+
*
|
|
4338
|
+
* @default 1000
|
|
4339
|
+
*/
|
|
4340
|
+
pongTimeout?: number;
|
|
4135
4341
|
};
|
|
4136
4342
|
/**
|
|
4137
4343
|
* Enabled auto reconnect
|
|
@@ -4177,7 +4383,7 @@ interface WebSocketOptions {
|
|
|
4177
4383
|
*/
|
|
4178
4384
|
protocols?: string[];
|
|
4179
4385
|
}
|
|
4180
|
-
interface
|
|
4386
|
+
interface UseWebSocketReturn<T> {
|
|
4181
4387
|
/**
|
|
4182
4388
|
* Reference to the latest data received via the websocket,
|
|
4183
4389
|
* can be watched to respond to incoming messages
|
|
@@ -4215,14 +4421,15 @@ interface WebSocketResult<T> {
|
|
|
4215
4421
|
* @see https://vueuse.org/useWebSocket
|
|
4216
4422
|
* @param url
|
|
4217
4423
|
*/
|
|
4218
|
-
declare function useWebSocket<Data = any>(url: string
|
|
4424
|
+
declare function useWebSocket<Data = any>(url: MaybeComputedRef<string | URL | undefined>, options?: UseWebSocketOptions): UseWebSocketReturn<Data>;
|
|
4219
4425
|
|
|
4220
4426
|
interface UseWebWorkerReturn<Data = any> {
|
|
4221
4427
|
data: Ref<Data>;
|
|
4222
4428
|
post: typeof Worker.prototype['postMessage'];
|
|
4223
4429
|
terminate: () => void;
|
|
4224
|
-
worker:
|
|
4430
|
+
worker: ShallowRef<Worker | undefined>;
|
|
4225
4431
|
}
|
|
4432
|
+
type WorkerFn = (...args: unknown[]) => Worker;
|
|
4226
4433
|
/**
|
|
4227
4434
|
* Simple Web Workers registration and communication.
|
|
4228
4435
|
*
|
|
@@ -4231,10 +4438,17 @@ interface UseWebWorkerReturn<Data = any> {
|
|
|
4231
4438
|
* @param workerOptions
|
|
4232
4439
|
* @param options
|
|
4233
4440
|
*/
|
|
4234
|
-
declare function useWebWorker<
|
|
4441
|
+
declare function useWebWorker<T = any>(url: string, workerOptions?: WorkerOptions, options?: ConfigurableWindow): UseWebWorkerReturn<T>;
|
|
4442
|
+
/**
|
|
4443
|
+
* Simple Web Workers registration and communication.
|
|
4444
|
+
*
|
|
4445
|
+
* @see https://vueuse.org/useWebWorker
|
|
4446
|
+
* @param worker
|
|
4447
|
+
*/
|
|
4448
|
+
declare function useWebWorker<T = any>(worker: Worker | WorkerFn): UseWebWorkerReturn<T>;
|
|
4235
4449
|
|
|
4236
|
-
|
|
4237
|
-
interface
|
|
4450
|
+
type WebWorkerStatus = 'PENDING' | 'SUCCESS' | 'RUNNING' | 'ERROR' | 'TIMEOUT_EXPIRED';
|
|
4451
|
+
interface UseWebWorkerOptions extends ConfigurableWindow {
|
|
4238
4452
|
/**
|
|
4239
4453
|
* Number of milliseconds before killing the worker
|
|
4240
4454
|
*
|
|
@@ -4253,12 +4467,12 @@ interface WebWorkerOptions extends ConfigurableWindow {
|
|
|
4253
4467
|
* @param fn
|
|
4254
4468
|
* @param options
|
|
4255
4469
|
*/
|
|
4256
|
-
declare const useWebWorkerFn: <T extends (...fnArgs: any[]) => any>(fn: T, options?:
|
|
4470
|
+
declare const useWebWorkerFn: <T extends (...fnArgs: any[]) => any>(fn: T, options?: UseWebWorkerOptions) => {
|
|
4257
4471
|
workerFn: (...fnArgs: Parameters<T>) => Promise<ReturnType<T>>;
|
|
4258
4472
|
workerStatus: vue_demi.Ref<WebWorkerStatus>;
|
|
4259
4473
|
workerTerminate: (status?: WebWorkerStatus) => void;
|
|
4260
4474
|
};
|
|
4261
|
-
|
|
4475
|
+
type UseWebWorkerFnReturn = ReturnType<typeof useWebWorkerFn>;
|
|
4262
4476
|
|
|
4263
4477
|
/**
|
|
4264
4478
|
* Reactively track window focus with `window.onfocus` and `window.onblur`.
|
|
@@ -4269,18 +4483,15 @@ declare type UseWebWorkerFnReturn = ReturnType<typeof useWebWorkerFn>;
|
|
|
4269
4483
|
declare function useWindowFocus({ window }?: ConfigurableWindow): Ref<boolean>;
|
|
4270
4484
|
|
|
4271
4485
|
/**
|
|
4272
|
-
*
|
|
4273
|
-
*
|
|
4274
|
-
* @see https://vueuse.org/useWindowScroll
|
|
4275
|
-
* @param options
|
|
4486
|
+
* @deprecated Please use [`usescroll`](https://vueuse.org/core/usescroll/#usescroll) instead.
|
|
4276
4487
|
*/
|
|
4277
4488
|
declare function useWindowScroll({ window }?: ConfigurableWindow): {
|
|
4278
4489
|
x: vue_demi.Ref<number>;
|
|
4279
4490
|
y: vue_demi.Ref<number>;
|
|
4280
4491
|
};
|
|
4281
|
-
|
|
4492
|
+
type UseWindowScrollReturn = ReturnType<typeof useWindowScroll>;
|
|
4282
4493
|
|
|
4283
|
-
interface
|
|
4494
|
+
interface UseWindowSizeOptions extends ConfigurableWindow {
|
|
4284
4495
|
initialWidth?: number;
|
|
4285
4496
|
initialHeight?: number;
|
|
4286
4497
|
/**
|
|
@@ -4289,6 +4500,11 @@ interface WindowSizeOptions extends ConfigurableWindow {
|
|
|
4289
4500
|
* @default true
|
|
4290
4501
|
*/
|
|
4291
4502
|
listenOrientation?: boolean;
|
|
4503
|
+
/**
|
|
4504
|
+
* Whether the scrollbar should be included in the width and height
|
|
4505
|
+
* @default true
|
|
4506
|
+
*/
|
|
4507
|
+
includeScrollbar?: boolean;
|
|
4292
4508
|
}
|
|
4293
4509
|
/**
|
|
4294
4510
|
* Reactive window size.
|
|
@@ -4296,10 +4512,10 @@ interface WindowSizeOptions extends ConfigurableWindow {
|
|
|
4296
4512
|
* @see https://vueuse.org/useWindowSize
|
|
4297
4513
|
* @param options
|
|
4298
4514
|
*/
|
|
4299
|
-
declare function useWindowSize(options?:
|
|
4515
|
+
declare function useWindowSize(options?: UseWindowSizeOptions): {
|
|
4300
4516
|
width: vue_demi.Ref<number>;
|
|
4301
4517
|
height: vue_demi.Ref<number>;
|
|
4302
4518
|
};
|
|
4303
|
-
|
|
4519
|
+
type UseWindowSizeReturn = ReturnType<typeof useWindowSize>;
|
|
4304
4520
|
|
|
4305
|
-
export { AfterFetchContext, AsyncComputedOnCancel, AsyncComputedOptions,
|
|
4521
|
+
export { AfterFetchContext, AsyncComputedOnCancel, AsyncComputedOptions, BasicColorSchema, BatteryManager, BeforeFetchContext, Breakpoints, BrowserLocationState, CloneFn, ColorSchemeType, ComputedInjectGetter, ComputedInjectGetterWithDefault, ComputedInjectSetter, ConfigurableDocument, ConfigurableDocumentOrShadowRoot, ConfigurableLocation, ConfigurableNavigator, ConfigurableWindow, ContrastType, CreateFetchOptions, CubicBezierPoints, DefaultMagicKeysAliasMap, DeviceMotionOptions, DocumentEventName, EasingFunction, ElementSize, EventBusEvents, EventBusIdentifier, EventBusKey, EventBusListener, EyeDropper, EyeDropperOpenOptions, FileSystemAccessShowOpenFileOptions, FileSystemAccessShowSaveFileOptions, FileSystemAccessWindow, FileSystemFileHandle, FormatTimeAgoOptions, GeneralEventListener, GeneralPermissionDescriptor, KeyFilter, KeyModifier, KeyPredicate, KeyStrokeEventName, MagicKeysInternal, MaybeComputedElementRef, MaybeElement, MaybeElementRef, MemoryInfo, MouseInElementOptions, MousePressedOptions, MouseSourceType, NavigatorLanguageState, NetworkEffectiveType, NetworkState, NetworkType, OnClickOutsideHandler, OnClickOutsideOptions, OnFetchErrorContext, OnKeyStrokeOptions, OnLongPressModifiers, OnLongPressOptions, PointerType, Position, ReducedMotionType, RenderableComponent, ResizeObserverCallback, ResizeObserverEntry, ResizeObserverSize, SSRHandlersMap, Serializer, SerializerAsync, StorageLike, StorageLikeAsync, StorageSerializers, SwipeDirection, TemplateRefsList, ToDataURLOptions, TransitionPresets, UnRefElementReturn, UnrefFn, UrlParams, UseActiveElementOptions, UseAsyncQueueOptions, UseAsyncQueueResult, UseAsyncQueueReturn, UseAsyncQueueTask, UseAsyncStateOptions, UseAsyncStateReturn, UseBase64ObjectOptions, UseBase64Return, UseBatteryReturn, UseBluetoothOptions, UseBluetoothRequestDeviceOptions, UseBluetoothReturn, UseBreakpointsReturn, UseBroadcastChannelOptions, UseBroadcastChannelReturn, UseBrowserLocationReturn, UseClipboardOptions, UseClipboardReturn, UseClonedOptions, UseClonedReturn, UseColorModeOptions, UseConfirmDialogReturn, UseConfirmDialogRevealResult, UseCssVarOptions, UseCycleListOptions, UseCycleListReturn, UseDarkOptions, UseDeviceMotionReturn, UseDeviceOrientationReturn, UseDevicePixelRatioReturn, UseDevicesListOptions, UseDevicesListReturn, UseDisplayMediaOptions, UseDisplayMediaReturn, UseDraggableOptions, UseDraggableReturn, UseDropZoneReturn, UseElementBoundingOptions, UseElementBoundingReturn, UseElementByPointOptions, UseElementByPointReturn, UseElementSizeReturn, UseElementVisibilityOptions, UseEventBusReturn, UseEventSourceOptions, UseEventSourceReturn, UseEyeDropperOptions, UseEyeDropperReturn, UseFaviconOptions, UseFaviconReturn, UseFetchOptions, UseFetchReturn, UseFileDialogOptions, UseFileDialogReturn, UseFileSystemAccessCommonOptions, UseFileSystemAccessOptions, UseFileSystemAccessReturn, UseFileSystemAccessShowSaveFileOptions, UseFocusOptions, UseFocusReturn, UseFocusWithinReturn, UseFpsOptions, UseFullscreenOptions, UseFullscreenReturn, UseGamepadOptions, UseGamepadReturn, UseGeolocationOptions, UseGeolocationReturn, UseHorizontalVirtualListOptions, UseIdleOptions, UseIdleReturn, UseImageOptions, UseImageReturn, UseInfiniteScrollOptions, UseIntersectionObserverOptions, UseIntersectionObserverReturn, UseKeyModifierReturn, UseMagicKeysOptions, UseMagicKeysReturn, UseManualRefHistoryOptions, UseManualRefHistoryReturn, UseMediaControlsReturn, UseMediaSource, UseMediaTextTrack, UseMediaTextTrackSource, UseMemoizeCache, UseMemoizeOptions, UseMemoizeReturn, UseMemoryOptions, UseMemoryReturn, UseModifierOptions, UseMouseInElementReturn, UseMouseOptions, UseMousePressedReturn, UseMouseReturn, UseMutationObserverOptions, UseMutationObserverReturn, UseNavigatorLanguageReturn, UseNetworkReturn, UseNowOptions, UseNowReturn, UseOffsetPaginationInfinityPageReturn, UseOffsetPaginationOptions, UseOffsetPaginationReturn, UseParallaxOptions, UseParallaxReturn, UsePermissionOptions, UsePermissionReturn, UsePermissionReturnWithControls, UsePointerLockOptions, UsePointerLockReturn, UsePointerOptions, UsePointerReturn, UsePointerState, UsePointerSwipeOptions, UsePointerSwipeReturn, UseRafFnCallbackArguments, UseRafFnOptions, UseRefHistoryOptions, UseRefHistoryRecord, UseRefHistoryReturn, UseResizeObserverOptions, UseResizeObserverReturn, UseScreenOrientationReturn, UseScriptTagOptions, UseScriptTagReturn, UseScrollOptions, UseScrollReturn, UseShareOptions, UseShareReturn, UseSortedCompareFn, UseSortedFn, UseSortedOptions, UseSpeechRecognitionOptions, UseSpeechRecognitionReturn, UseSpeechSynthesisOptions, UseSpeechSynthesisReturn, UseSpeechSynthesisStatus, UseStepperReturn, UseStorageAsyncOptions, UseStorageOptions, UseStyleTagOptions, UseStyleTagReturn, UseSwipeOptions, UseSwipeReturn, UseTextDirectionOptions, UseTextDirectionValue, UseTextSelectionReturn, UseTextareaAutosizeOptions, UseTextareaAutosizeReturn, UseThrottledRefHistoryOptions, UseThrottledRefHistoryReturn, UseTimeAgoFormatter, UseTimeAgoMessages, UseTimeAgoMessagesBuiltIn, UseTimeAgoOptions, UseTimeAgoReturn, UseTimeAgoUnit, UseTimeAgoUnitNamesDefault, UseTimestampOptions, UseTimestampReturn, UseTitleOptions, UseTitleOptionsBase, UseTitleReturn, UseTransitionOptions, UseUrlSearchParamsOptions, UseUserMediaOptions, UseUserMediaReturn, UseVModelOptions, UseVerticalVirtualListOptions, UseVibrateOptions, UseVibrateReturn, UseVirtualListItem, UseVirtualListOptions, UseVirtualListOptionsBase, UseVirtualListReturn, UseWakeLockOptions, UseWakeLockReturn, UseWebNotificationOptions, UseWebNotificationReturn, UseWebSocketOptions, UseWebSocketReturn, UseWebWorkerFnReturn, UseWebWorkerOptions, UseWebWorkerReturn, UseWindowScrollReturn, UseWindowSizeOptions, UseWindowSizeReturn, VueInstance, WakeLockSentinel, WebNotificationOptions, WebSocketStatus, WebWorkerStatus, WindowEventName, WritableComputedInjectOptions, WritableComputedInjectOptionsWithDefault, computedAsync as asyncComputed, breakpointsAntDesign, breakpointsBootstrapV5, breakpointsMasterCss, breakpointsQuasar, breakpointsSematic, breakpointsTailwind, breakpointsVuetify, cloneFnJSON, computedAsync, computedInject, createFetch, createUnrefFn, defaultDocument, defaultLocation, defaultNavigator, defaultWindow, formatTimeAgo, getSSRHandler, mapGamepadToXbox360Controller, onClickOutside, onKeyDown, onKeyPressed, onKeyStroke, onKeyUp, onLongPress, onStartTyping, setSSRHandler, templateRef, unrefElement, useActiveElement, useAsyncQueue, useAsyncState, useBase64, useBattery, useBluetooth, useBreakpoints, useBroadcastChannel, useBrowserLocation, useCached, useClipboard, useCloned, useColorMode, useConfirmDialog, useCssVar, useCurrentElement, useCycleList, useDark, useDebouncedRefHistory, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDisplayMedia, useDocumentVisibility, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementHover, useElementSize, useElementVisibility, useEventBus, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetch, useFileDialog, useFileSystemAccess, useFocus, useFocusWithin, useFps, useFullscreen, useGamepad, useGeolocation, useIdle, useImage, useInfiniteScroll, useIntersectionObserver, useKeyModifier, useLocalStorage, useMagicKeys, useManualRefHistory, useMediaControls, useMediaQuery, useMemoize, useMemory, useMounted, useMouse, useMouseInElement, useMousePressed, useMutationObserver, useNavigatorLanguage, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, useParallax, usePermission, usePointer, usePointerLock, usePointerSwipe, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePreferredReducedMotion, usePrevious, useRafFn, useRefHistory, useResizeObserver, useScreenOrientation, useScreenSafeArea, useScriptTag, useScroll, useScrollLock, useSessionStorage, useShare, useSorted, useSpeechRecognition, useSpeechSynthesis, useStepper, useStorage, useStorageAsync, useStyleTag, useSupported, useSwipe, useTemplateRefsList, useTextDirection, useTextSelection, useTextareaAutosize, useThrottledRefHistory, useTimeAgo, useTimeoutPoll, useTimestamp, useTitle, useTransition, useUrlSearchParams, useUserMedia, useVModel, useVModels, useVibrate, useVirtualList, useWakeLock, useWebNotification, useWebSocket, useWebWorker, useWebWorkerFn, useWindowFocus, useWindowScroll, useWindowSize };
|