@vueuse/components 7.7.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +522 -99
- package/index.d.ts +167 -19
- package/index.iife.js +522 -99
- package/index.iife.min.js +1 -1
- package/index.mjs +515 -101
- package/package.json +9 -9
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vue_demi from 'vue-demi';
|
|
2
|
-
import { FunctionDirective, Ref, UnwrapNestedRefs, ComputedRef } from 'vue-demi';
|
|
3
|
-
import { ConfigurableEventFilter, ConfigurableFlush
|
|
4
|
-
import { UseDarkOptions, UseDevicesListOptions, UseDraggableOptions, ElementSize, GeolocationOptions, IdleOptions, MouseOptions, MouseInElementOptions, MousePressedOptions, UseNowOptions, MaybeRef, UsePointerOptions, UseTimeAgoOptions, TimestampOptions, UseVirtualListOptions, WindowSizeOptions } from '@vueuse/core';
|
|
2
|
+
import { FunctionDirective, Ref, ComponentPublicInstance, UnwrapNestedRefs, ComputedRef } from 'vue-demi';
|
|
3
|
+
import { MaybeRef, ConfigurableEventFilter, ConfigurableFlush } from '@vueuse/shared';
|
|
4
|
+
import { UseDarkOptions, UseDevicesListOptions, UseDraggableOptions, ElementSize as ElementSize$1, GeolocationOptions, IdleOptions, MouseOptions, MouseInElementOptions, MousePressedOptions, UseNowOptions, MaybeRef as MaybeRef$1, UsePointerOptions, UseTimeAgoOptions, TimestampOptions, UseVirtualListOptions, WindowSizeOptions } from '@vueuse/core';
|
|
5
5
|
|
|
6
6
|
interface ConfigurableWindow {
|
|
7
7
|
window?: Window;
|
|
@@ -18,10 +18,18 @@ interface RenderableComponent {
|
|
|
18
18
|
|
|
19
19
|
declare const OnClickOutside: vue_demi.DefineComponent<RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, vue_demi.EmitsOptions, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<RenderableComponent>, {}>;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
declare const vOnClickOutside: FunctionDirective<any, (evt: PointerEvent) => void>;
|
|
22
|
+
|
|
23
|
+
declare type KeyStrokeEventName = 'keydown' | 'keypress' | 'keyup';
|
|
24
|
+
interface KeyStrokeOptions {
|
|
25
|
+
eventName?: KeyStrokeEventName;
|
|
26
|
+
target?: MaybeRef<EventTarget>;
|
|
27
|
+
passive?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare type BindingValueFunction$6 = (event: KeyboardEvent) => void;
|
|
31
|
+
declare type BindingValueArray$5 = [BindingValueFunction$6, KeyStrokeOptions];
|
|
32
|
+
declare const vOnKeyStroke: FunctionDirective<HTMLElement, BindingValueFunction$6 | BindingValueArray$5>;
|
|
25
33
|
|
|
26
34
|
interface OnLongPressOptions {
|
|
27
35
|
/**
|
|
@@ -37,12 +45,12 @@ interface OnLongPressProps extends RenderableComponent {
|
|
|
37
45
|
}
|
|
38
46
|
declare const OnLongPress: vue_demi.DefineComponent<OnLongPressProps, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, vue_demi.EmitsOptions, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<OnLongPressProps>, {}>;
|
|
39
47
|
|
|
40
|
-
declare type BindingValueFunction = (evt: PointerEvent) => void;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
declare const
|
|
48
|
+
declare type BindingValueFunction$5 = (evt: PointerEvent) => void;
|
|
49
|
+
declare type BindingValueArray$4 = [
|
|
50
|
+
BindingValueFunction$5,
|
|
51
|
+
OnLongPressOptions
|
|
52
|
+
];
|
|
53
|
+
declare const vOnLongPress: FunctionDirective<HTMLElement, BindingValueFunction$5 | BindingValueArray$4>;
|
|
46
54
|
|
|
47
55
|
declare const UseActiveElement: vue_demi.DefineComponent<{}, () => vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
|
|
48
56
|
[key: string]: any;
|
|
@@ -186,6 +194,9 @@ interface UseDraggableProps extends UseDraggableOptions, RenderableComponent {
|
|
|
186
194
|
}
|
|
187
195
|
declare const UseDraggable: vue_demi.DefineComponent<UseDraggableProps, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, vue_demi.EmitsOptions, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<UseDraggableProps>, {}>;
|
|
188
196
|
|
|
197
|
+
declare type VueInstance = ComponentPublicInstance;
|
|
198
|
+
declare type MaybeElementRef = MaybeRef<HTMLElement | SVGElement | VueInstance | undefined | null>;
|
|
199
|
+
|
|
189
200
|
interface ResizeObserverOptions extends ConfigurableWindow {
|
|
190
201
|
/**
|
|
191
202
|
* Sets which box model the observer will observe changes to. Possible values
|
|
@@ -198,7 +209,33 @@ interface ResizeObserverOptions extends ConfigurableWindow {
|
|
|
198
209
|
|
|
199
210
|
declare const UseElementBounding: vue_demi.DefineComponent<ResizeObserverOptions & RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, vue_demi.EmitsOptions, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<ResizeObserverOptions & RenderableComponent>, {}>;
|
|
200
211
|
|
|
201
|
-
declare
|
|
212
|
+
declare type BindingValueFunction$4 = (state: boolean) => void;
|
|
213
|
+
declare const vElementHover: FunctionDirective<HTMLElement, BindingValueFunction$4>;
|
|
214
|
+
|
|
215
|
+
declare const UseElementSize: vue_demi.DefineComponent<ElementSize$1 & ResizeObserverOptions & RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, vue_demi.EmitsOptions, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<ElementSize$1 & ResizeObserverOptions & RenderableComponent>, {}>;
|
|
216
|
+
|
|
217
|
+
interface ElementSize {
|
|
218
|
+
width: number;
|
|
219
|
+
height: number;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Reactive size of an HTML element.
|
|
223
|
+
*
|
|
224
|
+
* @see https://vueuse.org/useElementSize
|
|
225
|
+
* @param target
|
|
226
|
+
* @param callback
|
|
227
|
+
* @param options
|
|
228
|
+
*/
|
|
229
|
+
declare function useElementSize(target: MaybeElementRef, initialSize?: ElementSize, options?: ResizeObserverOptions): {
|
|
230
|
+
width: vue_demi.Ref<number>;
|
|
231
|
+
height: vue_demi.Ref<number>;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
declare type RemoveFirstFromTuple<T extends any[]> = T['length'] extends 0 ? undefined : (((...b: T) => void) extends (a: any, ...b: infer I) => void ? I : []);
|
|
235
|
+
declare type BindingValueFunction$3 = (size: ElementSize) => void;
|
|
236
|
+
declare type VElementSizeOptions = RemoveFirstFromTuple<Parameters<typeof useElementSize>>;
|
|
237
|
+
declare type BindingValueArray$3 = [BindingValueFunction$3, ...VElementSizeOptions];
|
|
238
|
+
declare const vElementSize: FunctionDirective<HTMLElement, BindingValueFunction$3 | BindingValueArray$3>;
|
|
202
239
|
|
|
203
240
|
declare const UseElementVisibility: vue_demi.DefineComponent<RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, vue_demi.EmitsOptions, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<RenderableComponent>, {}>;
|
|
204
241
|
|
|
@@ -220,6 +257,111 @@ declare const UseIdle: vue_demi.DefineComponent<IdleOptions & {
|
|
|
220
257
|
timeout: number;
|
|
221
258
|
}>, {}>;
|
|
222
259
|
|
|
260
|
+
interface UseScrollOptions {
|
|
261
|
+
/**
|
|
262
|
+
* Throttle time for scroll event, it’s disabled by default.
|
|
263
|
+
*
|
|
264
|
+
* @default 0
|
|
265
|
+
*/
|
|
266
|
+
throttle?: number;
|
|
267
|
+
/**
|
|
268
|
+
* The check time when scrolling ends.
|
|
269
|
+
* This configuration will be setting to (throttle + idle) when the `throttle` is configured.
|
|
270
|
+
*
|
|
271
|
+
* @default 200
|
|
272
|
+
*/
|
|
273
|
+
idle?: number;
|
|
274
|
+
/**
|
|
275
|
+
* Offset arrived states by x pixels
|
|
276
|
+
*
|
|
277
|
+
*/
|
|
278
|
+
offset?: {
|
|
279
|
+
left?: number;
|
|
280
|
+
right?: number;
|
|
281
|
+
top?: number;
|
|
282
|
+
bottom?: number;
|
|
283
|
+
};
|
|
284
|
+
/**
|
|
285
|
+
* Trigger it when scrolling.
|
|
286
|
+
*
|
|
287
|
+
*/
|
|
288
|
+
onScroll?: (e: Event) => void;
|
|
289
|
+
/**
|
|
290
|
+
* Trigger it when scrolling ends.
|
|
291
|
+
*
|
|
292
|
+
*/
|
|
293
|
+
onStop?: (e: Event) => void;
|
|
294
|
+
/**
|
|
295
|
+
* Listener options for scroll event.
|
|
296
|
+
*
|
|
297
|
+
* @default {capture: false, passive: true}
|
|
298
|
+
*/
|
|
299
|
+
eventListenerOptions?: boolean | AddEventListenerOptions;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Reactive scroll.
|
|
303
|
+
*
|
|
304
|
+
* @see https://vueuse.org/useScroll
|
|
305
|
+
* @param element
|
|
306
|
+
* @param options
|
|
307
|
+
*/
|
|
308
|
+
declare function useScroll(element: MaybeRef<HTMLElement | SVGElement | Window | Document | null | undefined>, options?: UseScrollOptions): {
|
|
309
|
+
x: vue_demi.Ref<number>;
|
|
310
|
+
y: vue_demi.Ref<number>;
|
|
311
|
+
isScrolling: vue_demi.Ref<boolean>;
|
|
312
|
+
arrivedState: {
|
|
313
|
+
left: boolean;
|
|
314
|
+
right: boolean;
|
|
315
|
+
top: boolean;
|
|
316
|
+
bottom: boolean;
|
|
317
|
+
};
|
|
318
|
+
directions: {
|
|
319
|
+
left: boolean;
|
|
320
|
+
right: boolean;
|
|
321
|
+
top: boolean;
|
|
322
|
+
bottom: boolean;
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
declare type UseScrollReturn = ReturnType<typeof useScroll>;
|
|
326
|
+
|
|
327
|
+
interface UseInfiniteScrollOptions extends UseScrollOptions {
|
|
328
|
+
/**
|
|
329
|
+
* The minimum distance between the bottom of the element and the bottom of the viewport
|
|
330
|
+
*
|
|
331
|
+
* @default 0
|
|
332
|
+
*/
|
|
333
|
+
distance?: number;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Reactive infinite scroll.
|
|
337
|
+
*
|
|
338
|
+
* @see https://vueuse.org/useInfiniteScroll
|
|
339
|
+
*/
|
|
340
|
+
declare function useInfiniteScroll(element: MaybeRef<HTMLElement | SVGElement | Window | Document | null | undefined>, onLoadMore: (state: UnwrapNestedRefs<ReturnType<typeof useScroll>>) => void, options?: UseInfiniteScrollOptions): void;
|
|
341
|
+
|
|
342
|
+
declare type BindingValueFunction$2 = Parameters<typeof useInfiniteScroll>[1];
|
|
343
|
+
declare type BindingValueArray$2 = [BindingValueFunction$2, UseInfiniteScrollOptions];
|
|
344
|
+
declare const vInfiniteScroll: FunctionDirective<HTMLElement, BindingValueFunction$2 | BindingValueArray$2>;
|
|
345
|
+
|
|
346
|
+
interface IntersectionObserverOptions extends ConfigurableWindow {
|
|
347
|
+
/**
|
|
348
|
+
* The Element or Document whose bounds are used as the bounding box when testing for intersection.
|
|
349
|
+
*/
|
|
350
|
+
root?: MaybeElementRef;
|
|
351
|
+
/**
|
|
352
|
+
* A string which specifies a set of offsets to add to the root's bounding_box when calculating intersections.
|
|
353
|
+
*/
|
|
354
|
+
rootMargin?: string;
|
|
355
|
+
/**
|
|
356
|
+
* Either a single number or an array of numbers between 0.0 and 1.
|
|
357
|
+
*/
|
|
358
|
+
threshold?: number | number[];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
declare type BindingValueFunction$1 = IntersectionObserverCallback;
|
|
362
|
+
declare type BindingValueArray$1 = [BindingValueFunction$1, IntersectionObserverOptions];
|
|
363
|
+
declare const vIntersectionObserver: FunctionDirective<HTMLElement, BindingValueFunction$1 | BindingValueArray$1>;
|
|
364
|
+
|
|
223
365
|
declare const UseMouse: vue_demi.DefineComponent<MouseOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, vue_demi.EmitsOptions, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<MouseOptions>, {}>;
|
|
224
366
|
|
|
225
367
|
declare const UseMouseInElement: vue_demi.DefineComponent<MouseInElementOptions & RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, vue_demi.EmitsOptions, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<MouseInElementOptions & RenderableComponent>, {}>;
|
|
@@ -236,17 +378,17 @@ interface UseOffsetPaginationOptions {
|
|
|
236
378
|
/**
|
|
237
379
|
* Total number of items.
|
|
238
380
|
*/
|
|
239
|
-
total?: MaybeRef<number>;
|
|
381
|
+
total?: MaybeRef$1<number>;
|
|
240
382
|
/**
|
|
241
383
|
* The number of items to display per page.
|
|
242
384
|
* @default 10
|
|
243
385
|
*/
|
|
244
|
-
pageSize?: MaybeRef<number>;
|
|
386
|
+
pageSize?: MaybeRef$1<number>;
|
|
245
387
|
/**
|
|
246
388
|
* The current page number.
|
|
247
389
|
* @default 1
|
|
248
390
|
*/
|
|
249
|
-
page?: MaybeRef<number>;
|
|
391
|
+
page?: MaybeRef$1<number>;
|
|
250
392
|
/**
|
|
251
393
|
* Callback when the `page` change.
|
|
252
394
|
*/
|
|
@@ -317,8 +459,14 @@ declare const UseScreenSafeArea: vue_demi.DefineComponent<{
|
|
|
317
459
|
bottom: boolean;
|
|
318
460
|
}>;
|
|
319
461
|
|
|
462
|
+
declare type BindingValueFunction = (state: UseScrollReturn) => void;
|
|
463
|
+
declare type BindingValueArray = [BindingValueFunction, UseScrollOptions];
|
|
464
|
+
declare const vScroll: FunctionDirective<HTMLElement, BindingValueFunction | BindingValueArray>;
|
|
465
|
+
|
|
466
|
+
declare const vScrollLock: FunctionDirective<HTMLElement, boolean>;
|
|
467
|
+
|
|
320
468
|
interface UseTimeAgoComponentOptions extends Omit<UseTimeAgoOptions<true>, 'controls'> {
|
|
321
|
-
time: MaybeRef
|
|
469
|
+
time: MaybeRef<Date | number | string>;
|
|
322
470
|
}
|
|
323
471
|
declare const UseTimeAgo: vue_demi.DefineComponent<UseTimeAgoComponentOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, vue_demi.EmitsOptions, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<UseTimeAgoComponentOptions>, {}>;
|
|
324
472
|
|
|
@@ -352,4 +500,4 @@ declare const UseWindowFocus: vue_demi.DefineComponent<{}, () => vue_demi.VNode<
|
|
|
352
500
|
|
|
353
501
|
declare const UseWindowSize: vue_demi.DefineComponent<WindowSizeOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, vue_demi.EmitsOptions, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<WindowSizeOptions>, {}>;
|
|
354
502
|
|
|
355
|
-
export { OnClickOutside, OnLongPress, OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePreferredColorScheme, UsePreferredDark, UsePreferredLanguages, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, UseVirtualListProps, UseWindowFocus, UseWindowSize, VOnClickOutside, VOnLongPress };
|
|
503
|
+
export { OnClickOutside, OnLongPress, OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePreferredColorScheme, UsePreferredDark, UsePreferredLanguages, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
|