@vueuse/components 12.2.0 → 12.3.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 +402 -114
- package/index.d.cts +161 -26
- package/index.d.mts +161 -26
- package/index.d.ts +161 -26
- package/index.iife.js +402 -114
- package/index.iife.min.js +1 -1
- package/index.mjs +379 -93
- package/package.json +3 -3
package/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { ComponentPublicInstance, ObjectDirective, Ref, UnwrapNestedRefs, ComputedRef, FunctionDirective } from 'vue';
|
|
2
|
+
import { ComponentPublicInstance, ObjectDirective, Ref, UnwrapNestedRefs, Reactive, ComputedRef, FunctionDirective } from 'vue';
|
|
3
3
|
import { MaybeRef, MaybeRefOrGetter, ConfigurableEventFilter, ConfigurableFlush, Awaitable } from '@vueuse/shared';
|
|
4
|
-
import { UseClipboardOptions, UseDarkOptions, UseDevicesListOptions, UseDraggableOptions, ElementSize as ElementSize$1, UseGeolocationOptions, UseIdleOptions, UseMouseOptions, MouseInElementOptions, MousePressedOptions, UseNowOptions, UsePointerOptions, UseTimeAgoOptions, UseTimestampOptions, UseVirtualListOptions, UseWindowSizeOptions } from '@vueuse/core';
|
|
4
|
+
import { UseClipboardOptions, UseDarkOptions, UseDevicesListOptions, UseDraggableOptions, ElementSize as ElementSize$1, UseGeolocationOptions, UseIdleOptions, UseMouseOptions as UseMouseOptions$1, MouseInElementOptions as MouseInElementOptions$1, MousePressedOptions, UseNowOptions, UsePointerOptions, UseTimeAgoOptions, UseTimestampOptions, UseVirtualListOptions, UseWindowSizeOptions } from '@vueuse/core';
|
|
5
5
|
|
|
6
6
|
interface ConfigurableWindow {
|
|
7
7
|
window?: Window;
|
|
@@ -34,6 +34,10 @@ type OnClickOutsideHandler<T extends {
|
|
|
34
34
|
detectIframe: false;
|
|
35
35
|
}> = (evt: T['detectIframe'] extends true ? PointerEvent | FocusEvent : PointerEvent) => void;
|
|
36
36
|
|
|
37
|
+
interface Position {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
}
|
|
37
41
|
interface RenderableComponent {
|
|
38
42
|
/**
|
|
39
43
|
* The element that the component should be rendered as
|
|
@@ -63,9 +67,9 @@ interface OnKeyStrokeOptions {
|
|
|
63
67
|
dedupe?: MaybeRefOrGetter<boolean>;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
type BindingValueFunction$
|
|
67
|
-
type BindingValueArray$
|
|
68
|
-
declare const vOnKeyStroke: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
70
|
+
type BindingValueFunction$a = (event: KeyboardEvent) => void;
|
|
71
|
+
type BindingValueArray$9 = [BindingValueFunction$a, OnKeyStrokeOptions];
|
|
72
|
+
declare const vOnKeyStroke: ObjectDirective<HTMLElement, BindingValueFunction$a | BindingValueArray$9>;
|
|
69
73
|
|
|
70
74
|
interface OnLongPressOptions {
|
|
71
75
|
/**
|
|
@@ -102,12 +106,12 @@ interface OnLongPressProps extends RenderableComponent {
|
|
|
102
106
|
}
|
|
103
107
|
declare const OnLongPress: vue.DefineComponent<OnLongPressProps, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<OnLongPressProps> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
104
108
|
|
|
105
|
-
type BindingValueFunction$
|
|
106
|
-
type BindingValueArray$
|
|
107
|
-
BindingValueFunction$
|
|
109
|
+
type BindingValueFunction$9 = (evt: PointerEvent) => void;
|
|
110
|
+
type BindingValueArray$8 = [
|
|
111
|
+
BindingValueFunction$9,
|
|
108
112
|
OnLongPressOptions
|
|
109
113
|
];
|
|
110
|
-
declare const vOnLongPress: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
114
|
+
declare const vOnLongPress: ObjectDirective<HTMLElement, BindingValueFunction$9 | BindingValueArray$8>;
|
|
111
115
|
|
|
112
116
|
declare const UseActiveElement: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
113
117
|
[key: string]: any;
|
|
@@ -325,13 +329,73 @@ declare class ResizeObserver {
|
|
|
325
329
|
|
|
326
330
|
declare const UseElementBounding: vue.DefineComponent<UseResizeObserverOptions & RenderableComponent, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<UseResizeObserverOptions & RenderableComponent> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
327
331
|
|
|
332
|
+
interface UseElementBoundingOptions {
|
|
333
|
+
/**
|
|
334
|
+
* Reset values to 0 on component unmounted
|
|
335
|
+
*
|
|
336
|
+
* @default true
|
|
337
|
+
*/
|
|
338
|
+
reset?: boolean;
|
|
339
|
+
/**
|
|
340
|
+
* Listen to window resize event
|
|
341
|
+
*
|
|
342
|
+
* @default true
|
|
343
|
+
*/
|
|
344
|
+
windowResize?: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Listen to window scroll event
|
|
347
|
+
*
|
|
348
|
+
* @default true
|
|
349
|
+
*/
|
|
350
|
+
windowScroll?: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Immediately call update on component mounted
|
|
353
|
+
*
|
|
354
|
+
* @default true
|
|
355
|
+
*/
|
|
356
|
+
immediate?: boolean;
|
|
357
|
+
/**
|
|
358
|
+
* Timing to recalculate the bounding box
|
|
359
|
+
*
|
|
360
|
+
* Setting to `next-frame` can be useful when using this together with something like {@link useBreakpoints}
|
|
361
|
+
* and therefore the layout (which influences the bounding box of the observed element) is not updated on the current tick.
|
|
362
|
+
*
|
|
363
|
+
* @default 'sync'
|
|
364
|
+
*/
|
|
365
|
+
updateTiming?: 'sync' | 'next-frame';
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Reactive bounding box of an HTML element.
|
|
369
|
+
*
|
|
370
|
+
* @see https://vueuse.org/useElementBounding
|
|
371
|
+
* @param target
|
|
372
|
+
*/
|
|
373
|
+
declare function useElementBounding(target: MaybeComputedElementRef, options?: UseElementBoundingOptions): {
|
|
374
|
+
height: vue.Ref<number, number>;
|
|
375
|
+
bottom: vue.Ref<number, number>;
|
|
376
|
+
left: vue.Ref<number, number>;
|
|
377
|
+
right: vue.Ref<number, number>;
|
|
378
|
+
top: vue.Ref<number, number>;
|
|
379
|
+
width: vue.Ref<number, number>;
|
|
380
|
+
x: vue.Ref<number, number>;
|
|
381
|
+
y: vue.Ref<number, number>;
|
|
382
|
+
update: () => void;
|
|
383
|
+
};
|
|
384
|
+
type UseElementBoundingReturn = ReturnType<typeof useElementBounding>;
|
|
385
|
+
|
|
386
|
+
type ElementBounding = Omit<UseElementBoundingReturn, 'update'>;
|
|
387
|
+
type BindingValueFunction$8 = (bounding: ElementBounding) => void;
|
|
388
|
+
type BindingValueArray$7 = [BindingValueFunction$8, UseElementBoundingOptions];
|
|
389
|
+
declare const vElementBounding: ObjectDirective<HTMLElement, BindingValueFunction$8 | BindingValueArray$7>;
|
|
390
|
+
|
|
328
391
|
interface UseElementHoverOptions extends ConfigurableWindow {
|
|
329
392
|
delayEnter?: number;
|
|
330
393
|
delayLeave?: number;
|
|
394
|
+
triggerOnRemoval?: boolean;
|
|
331
395
|
}
|
|
332
396
|
|
|
333
|
-
type BindingValueFunction$
|
|
334
|
-
declare const vElementHover: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
397
|
+
type BindingValueFunction$7 = (state: boolean) => void;
|
|
398
|
+
declare const vElementHover: ObjectDirective<HTMLElement, BindingValueFunction$7 | [handler: BindingValueFunction$7, options: UseElementHoverOptions]>;
|
|
335
399
|
|
|
336
400
|
declare const UseElementSize: vue.DefineComponent<ElementSize$1 & UseResizeObserverOptions & RenderableComponent, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<ElementSize$1 & UseResizeObserverOptions & RenderableComponent> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
337
401
|
|
|
@@ -351,10 +415,10 @@ declare function useElementSize(target: MaybeComputedElementRef, initialSize?: E
|
|
|
351
415
|
};
|
|
352
416
|
|
|
353
417
|
type RemoveFirstFromTuple<T extends any[]> = T['length'] extends 0 ? undefined : (((...b: T) => void) extends (a: any, ...b: infer I) => void ? I : []);
|
|
354
|
-
type BindingValueFunction$
|
|
418
|
+
type BindingValueFunction$6 = (size: ElementSize) => void;
|
|
355
419
|
type VElementSizeOptions = RemoveFirstFromTuple<Parameters<typeof useElementSize>>;
|
|
356
|
-
type BindingValueArray$
|
|
357
|
-
declare const vElementSize: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
420
|
+
type BindingValueArray$6 = [BindingValueFunction$6, ...VElementSizeOptions];
|
|
421
|
+
declare const vElementSize: ObjectDirective<HTMLElement, BindingValueFunction$6 | BindingValueArray$6>;
|
|
358
422
|
|
|
359
423
|
declare const UseElementVisibility: vue.DefineComponent<RenderableComponent, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<RenderableComponent> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
360
424
|
|
|
@@ -391,9 +455,9 @@ interface UseElementVisibilityOptions extends ConfigurableWindow, Pick<UseInters
|
|
|
391
455
|
scrollTarget?: MaybeRefOrGetter<HTMLElement | undefined | null>;
|
|
392
456
|
}
|
|
393
457
|
|
|
394
|
-
type BindingValueFunction$
|
|
395
|
-
type BindingValueArray$
|
|
396
|
-
declare const vElementVisibility: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
458
|
+
type BindingValueFunction$5 = (state: boolean) => void;
|
|
459
|
+
type BindingValueArray$5 = [BindingValueFunction$5, UseElementVisibilityOptions];
|
|
460
|
+
declare const vElementVisibility: ObjectDirective<HTMLElement, BindingValueFunction$5 | BindingValueArray$5>;
|
|
397
461
|
|
|
398
462
|
declare const UseEyeDropper: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
399
463
|
sRGBHex: StringConstructor;
|
|
@@ -413,6 +477,8 @@ declare const UseIdle: vue.DefineComponent<UseIdleOptions & {
|
|
|
413
477
|
timeout: number;
|
|
414
478
|
}> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
415
479
|
|
|
480
|
+
type UseMouseSourceType = 'mouse' | 'touch' | null;
|
|
481
|
+
|
|
416
482
|
interface UseImageOptions {
|
|
417
483
|
/** Address of the resource */
|
|
418
484
|
src: string;
|
|
@@ -564,17 +630,86 @@ declare function useInfiniteScroll<T extends InfiniteScrollElement>(element: May
|
|
|
564
630
|
reset(): void;
|
|
565
631
|
};
|
|
566
632
|
|
|
567
|
-
type BindingValueFunction$
|
|
568
|
-
type BindingValueArray$
|
|
569
|
-
declare const vInfiniteScroll: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
633
|
+
type BindingValueFunction$4 = Parameters<typeof useInfiniteScroll>[1];
|
|
634
|
+
type BindingValueArray$4 = [BindingValueFunction$4, UseInfiniteScrollOptions];
|
|
635
|
+
declare const vInfiniteScroll: ObjectDirective<HTMLElement, BindingValueFunction$4 | BindingValueArray$4>;
|
|
570
636
|
|
|
571
|
-
type BindingValueFunction$
|
|
572
|
-
type BindingValueArray$
|
|
573
|
-
declare const vIntersectionObserver: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
637
|
+
type BindingValueFunction$3 = IntersectionObserverCallback;
|
|
638
|
+
type BindingValueArray$3 = [BindingValueFunction$3, UseIntersectionObserverOptions];
|
|
639
|
+
declare const vIntersectionObserver: ObjectDirective<HTMLElement, BindingValueFunction$3 | BindingValueArray$3>;
|
|
574
640
|
|
|
575
|
-
declare const UseMouse: vue.DefineComponent<UseMouseOptions, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<UseMouseOptions> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
641
|
+
declare const UseMouse: vue.DefineComponent<UseMouseOptions$1, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<UseMouseOptions$1> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
642
|
+
|
|
643
|
+
declare const UseMouseInElement: vue.DefineComponent<MouseInElementOptions$1 & RenderableComponent, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<MouseInElementOptions$1 & RenderableComponent> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
644
|
+
|
|
645
|
+
type UseMouseCoordType = 'page' | 'client' | 'screen' | 'movement';
|
|
646
|
+
type UseMouseEventExtractor = (event: MouseEvent | Touch) => [x: number, y: number] | null | undefined;
|
|
647
|
+
interface UseMouseOptions extends ConfigurableWindow, ConfigurableEventFilter {
|
|
648
|
+
/**
|
|
649
|
+
* Mouse position based by page, client, screen, or relative to previous position
|
|
650
|
+
*
|
|
651
|
+
* @default 'page'
|
|
652
|
+
*/
|
|
653
|
+
type?: UseMouseCoordType | UseMouseEventExtractor;
|
|
654
|
+
/**
|
|
655
|
+
* Listen events on `target` element
|
|
656
|
+
*
|
|
657
|
+
* @default 'Window'
|
|
658
|
+
*/
|
|
659
|
+
target?: MaybeRefOrGetter<Window | EventTarget | null | undefined>;
|
|
660
|
+
/**
|
|
661
|
+
* Listen to `touchmove` events
|
|
662
|
+
*
|
|
663
|
+
* @default true
|
|
664
|
+
*/
|
|
665
|
+
touch?: boolean;
|
|
666
|
+
/**
|
|
667
|
+
* Listen to `scroll` events on window, only effective on type `page`
|
|
668
|
+
*
|
|
669
|
+
* @default true
|
|
670
|
+
*/
|
|
671
|
+
scroll?: boolean;
|
|
672
|
+
/**
|
|
673
|
+
* Reset to initial value when `touchend` event fired
|
|
674
|
+
*
|
|
675
|
+
* @default false
|
|
676
|
+
*/
|
|
677
|
+
resetOnTouchEnds?: boolean;
|
|
678
|
+
/**
|
|
679
|
+
* Initial values
|
|
680
|
+
*/
|
|
681
|
+
initialValue?: Position;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
interface MouseInElementOptions extends UseMouseOptions {
|
|
685
|
+
handleOutside?: boolean;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Reactive mouse position related to an element.
|
|
689
|
+
*
|
|
690
|
+
* @see https://vueuse.org/useMouseInElement
|
|
691
|
+
* @param target
|
|
692
|
+
* @param options
|
|
693
|
+
*/
|
|
694
|
+
declare function useMouseInElement(target?: MaybeElementRef, options?: MouseInElementOptions): {
|
|
695
|
+
x: vue.Ref<number, number>;
|
|
696
|
+
y: vue.Ref<number, number>;
|
|
697
|
+
sourceType: vue.Ref<UseMouseSourceType, UseMouseSourceType>;
|
|
698
|
+
elementX: vue.Ref<number, number>;
|
|
699
|
+
elementY: vue.Ref<number, number>;
|
|
700
|
+
elementPositionX: vue.Ref<number, number>;
|
|
701
|
+
elementPositionY: vue.Ref<number, number>;
|
|
702
|
+
elementHeight: vue.Ref<number, number>;
|
|
703
|
+
elementWidth: vue.Ref<number, number>;
|
|
704
|
+
isOutside: vue.Ref<boolean, boolean>;
|
|
705
|
+
stop: () => void;
|
|
706
|
+
};
|
|
707
|
+
type UseMouseInElementReturn = ReturnType<typeof useMouseInElement>;
|
|
576
708
|
|
|
577
|
-
|
|
709
|
+
type MouseInElement = Omit<UseMouseInElementReturn, 'stop'>;
|
|
710
|
+
type BindingValueFunction$2 = (mouse: Reactive<MouseInElement>) => void;
|
|
711
|
+
type BindingValueArray$2 = [BindingValueFunction$2, MouseInElementOptions];
|
|
712
|
+
declare const vMouseInElement: ObjectDirective<HTMLElement, BindingValueFunction$2 | BindingValueArray$2>;
|
|
578
713
|
|
|
579
714
|
declare const UseMousePressed: vue.DefineComponent<Omit<MousePressedOptions, "target"> & RenderableComponent, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<Omit<MousePressedOptions, "target"> & RenderableComponent> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
580
715
|
|
|
@@ -733,4 +868,4 @@ declare const UseWindowFocus: vue.DefineComponent<{}, () => vue.VNode<vue.Render
|
|
|
733
868
|
|
|
734
869
|
declare const UseWindowSize: vue.DefineComponent<UseWindowSizeOptions, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<UseWindowSizeOptions> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
735
870
|
|
|
736
|
-
export { OnClickOutside, type OnClickOutsideProps, OnLongPress, type OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, type UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, type UseObjectUrlProps, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UsePreferredReducedTransparency, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, type UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vResizeObserver, vScroll, vScrollLock };
|
|
871
|
+
export { OnClickOutside, type OnClickOutsideProps, OnLongPress, type OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, type UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, type UseObjectUrlProps, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UsePreferredReducedTransparency, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, type UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementBounding, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vMouseInElement, vOnClickOutside, vOnKeyStroke, vOnLongPress, vResizeObserver, vScroll, vScrollLock };
|
package/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { ComponentPublicInstance, ObjectDirective, Ref, UnwrapNestedRefs, ComputedRef, FunctionDirective } from 'vue';
|
|
2
|
+
import { ComponentPublicInstance, ObjectDirective, Ref, UnwrapNestedRefs, Reactive, ComputedRef, FunctionDirective } from 'vue';
|
|
3
3
|
import { MaybeRef, MaybeRefOrGetter, ConfigurableEventFilter, ConfigurableFlush, Awaitable } from '@vueuse/shared';
|
|
4
|
-
import { UseClipboardOptions, UseDarkOptions, UseDevicesListOptions, UseDraggableOptions, ElementSize as ElementSize$1, UseGeolocationOptions, UseIdleOptions, UseMouseOptions, MouseInElementOptions, MousePressedOptions, UseNowOptions, UsePointerOptions, UseTimeAgoOptions, UseTimestampOptions, UseVirtualListOptions, UseWindowSizeOptions } from '@vueuse/core';
|
|
4
|
+
import { UseClipboardOptions, UseDarkOptions, UseDevicesListOptions, UseDraggableOptions, ElementSize as ElementSize$1, UseGeolocationOptions, UseIdleOptions, UseMouseOptions as UseMouseOptions$1, MouseInElementOptions as MouseInElementOptions$1, MousePressedOptions, UseNowOptions, UsePointerOptions, UseTimeAgoOptions, UseTimestampOptions, UseVirtualListOptions, UseWindowSizeOptions } from '@vueuse/core';
|
|
5
5
|
|
|
6
6
|
interface ConfigurableWindow {
|
|
7
7
|
window?: Window;
|
|
@@ -34,6 +34,10 @@ type OnClickOutsideHandler<T extends {
|
|
|
34
34
|
detectIframe: false;
|
|
35
35
|
}> = (evt: T['detectIframe'] extends true ? PointerEvent | FocusEvent : PointerEvent) => void;
|
|
36
36
|
|
|
37
|
+
interface Position {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
}
|
|
37
41
|
interface RenderableComponent {
|
|
38
42
|
/**
|
|
39
43
|
* The element that the component should be rendered as
|
|
@@ -63,9 +67,9 @@ interface OnKeyStrokeOptions {
|
|
|
63
67
|
dedupe?: MaybeRefOrGetter<boolean>;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
type BindingValueFunction$
|
|
67
|
-
type BindingValueArray$
|
|
68
|
-
declare const vOnKeyStroke: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
70
|
+
type BindingValueFunction$a = (event: KeyboardEvent) => void;
|
|
71
|
+
type BindingValueArray$9 = [BindingValueFunction$a, OnKeyStrokeOptions];
|
|
72
|
+
declare const vOnKeyStroke: ObjectDirective<HTMLElement, BindingValueFunction$a | BindingValueArray$9>;
|
|
69
73
|
|
|
70
74
|
interface OnLongPressOptions {
|
|
71
75
|
/**
|
|
@@ -102,12 +106,12 @@ interface OnLongPressProps extends RenderableComponent {
|
|
|
102
106
|
}
|
|
103
107
|
declare const OnLongPress: vue.DefineComponent<OnLongPressProps, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<OnLongPressProps> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
104
108
|
|
|
105
|
-
type BindingValueFunction$
|
|
106
|
-
type BindingValueArray$
|
|
107
|
-
BindingValueFunction$
|
|
109
|
+
type BindingValueFunction$9 = (evt: PointerEvent) => void;
|
|
110
|
+
type BindingValueArray$8 = [
|
|
111
|
+
BindingValueFunction$9,
|
|
108
112
|
OnLongPressOptions
|
|
109
113
|
];
|
|
110
|
-
declare const vOnLongPress: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
114
|
+
declare const vOnLongPress: ObjectDirective<HTMLElement, BindingValueFunction$9 | BindingValueArray$8>;
|
|
111
115
|
|
|
112
116
|
declare const UseActiveElement: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
113
117
|
[key: string]: any;
|
|
@@ -325,13 +329,73 @@ declare class ResizeObserver {
|
|
|
325
329
|
|
|
326
330
|
declare const UseElementBounding: vue.DefineComponent<UseResizeObserverOptions & RenderableComponent, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<UseResizeObserverOptions & RenderableComponent> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
327
331
|
|
|
332
|
+
interface UseElementBoundingOptions {
|
|
333
|
+
/**
|
|
334
|
+
* Reset values to 0 on component unmounted
|
|
335
|
+
*
|
|
336
|
+
* @default true
|
|
337
|
+
*/
|
|
338
|
+
reset?: boolean;
|
|
339
|
+
/**
|
|
340
|
+
* Listen to window resize event
|
|
341
|
+
*
|
|
342
|
+
* @default true
|
|
343
|
+
*/
|
|
344
|
+
windowResize?: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Listen to window scroll event
|
|
347
|
+
*
|
|
348
|
+
* @default true
|
|
349
|
+
*/
|
|
350
|
+
windowScroll?: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Immediately call update on component mounted
|
|
353
|
+
*
|
|
354
|
+
* @default true
|
|
355
|
+
*/
|
|
356
|
+
immediate?: boolean;
|
|
357
|
+
/**
|
|
358
|
+
* Timing to recalculate the bounding box
|
|
359
|
+
*
|
|
360
|
+
* Setting to `next-frame` can be useful when using this together with something like {@link useBreakpoints}
|
|
361
|
+
* and therefore the layout (which influences the bounding box of the observed element) is not updated on the current tick.
|
|
362
|
+
*
|
|
363
|
+
* @default 'sync'
|
|
364
|
+
*/
|
|
365
|
+
updateTiming?: 'sync' | 'next-frame';
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Reactive bounding box of an HTML element.
|
|
369
|
+
*
|
|
370
|
+
* @see https://vueuse.org/useElementBounding
|
|
371
|
+
* @param target
|
|
372
|
+
*/
|
|
373
|
+
declare function useElementBounding(target: MaybeComputedElementRef, options?: UseElementBoundingOptions): {
|
|
374
|
+
height: vue.Ref<number, number>;
|
|
375
|
+
bottom: vue.Ref<number, number>;
|
|
376
|
+
left: vue.Ref<number, number>;
|
|
377
|
+
right: vue.Ref<number, number>;
|
|
378
|
+
top: vue.Ref<number, number>;
|
|
379
|
+
width: vue.Ref<number, number>;
|
|
380
|
+
x: vue.Ref<number, number>;
|
|
381
|
+
y: vue.Ref<number, number>;
|
|
382
|
+
update: () => void;
|
|
383
|
+
};
|
|
384
|
+
type UseElementBoundingReturn = ReturnType<typeof useElementBounding>;
|
|
385
|
+
|
|
386
|
+
type ElementBounding = Omit<UseElementBoundingReturn, 'update'>;
|
|
387
|
+
type BindingValueFunction$8 = (bounding: ElementBounding) => void;
|
|
388
|
+
type BindingValueArray$7 = [BindingValueFunction$8, UseElementBoundingOptions];
|
|
389
|
+
declare const vElementBounding: ObjectDirective<HTMLElement, BindingValueFunction$8 | BindingValueArray$7>;
|
|
390
|
+
|
|
328
391
|
interface UseElementHoverOptions extends ConfigurableWindow {
|
|
329
392
|
delayEnter?: number;
|
|
330
393
|
delayLeave?: number;
|
|
394
|
+
triggerOnRemoval?: boolean;
|
|
331
395
|
}
|
|
332
396
|
|
|
333
|
-
type BindingValueFunction$
|
|
334
|
-
declare const vElementHover: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
397
|
+
type BindingValueFunction$7 = (state: boolean) => void;
|
|
398
|
+
declare const vElementHover: ObjectDirective<HTMLElement, BindingValueFunction$7 | [handler: BindingValueFunction$7, options: UseElementHoverOptions]>;
|
|
335
399
|
|
|
336
400
|
declare const UseElementSize: vue.DefineComponent<ElementSize$1 & UseResizeObserverOptions & RenderableComponent, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<ElementSize$1 & UseResizeObserverOptions & RenderableComponent> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
337
401
|
|
|
@@ -351,10 +415,10 @@ declare function useElementSize(target: MaybeComputedElementRef, initialSize?: E
|
|
|
351
415
|
};
|
|
352
416
|
|
|
353
417
|
type RemoveFirstFromTuple<T extends any[]> = T['length'] extends 0 ? undefined : (((...b: T) => void) extends (a: any, ...b: infer I) => void ? I : []);
|
|
354
|
-
type BindingValueFunction$
|
|
418
|
+
type BindingValueFunction$6 = (size: ElementSize) => void;
|
|
355
419
|
type VElementSizeOptions = RemoveFirstFromTuple<Parameters<typeof useElementSize>>;
|
|
356
|
-
type BindingValueArray$
|
|
357
|
-
declare const vElementSize: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
420
|
+
type BindingValueArray$6 = [BindingValueFunction$6, ...VElementSizeOptions];
|
|
421
|
+
declare const vElementSize: ObjectDirective<HTMLElement, BindingValueFunction$6 | BindingValueArray$6>;
|
|
358
422
|
|
|
359
423
|
declare const UseElementVisibility: vue.DefineComponent<RenderableComponent, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<RenderableComponent> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
360
424
|
|
|
@@ -391,9 +455,9 @@ interface UseElementVisibilityOptions extends ConfigurableWindow, Pick<UseInters
|
|
|
391
455
|
scrollTarget?: MaybeRefOrGetter<HTMLElement | undefined | null>;
|
|
392
456
|
}
|
|
393
457
|
|
|
394
|
-
type BindingValueFunction$
|
|
395
|
-
type BindingValueArray$
|
|
396
|
-
declare const vElementVisibility: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
458
|
+
type BindingValueFunction$5 = (state: boolean) => void;
|
|
459
|
+
type BindingValueArray$5 = [BindingValueFunction$5, UseElementVisibilityOptions];
|
|
460
|
+
declare const vElementVisibility: ObjectDirective<HTMLElement, BindingValueFunction$5 | BindingValueArray$5>;
|
|
397
461
|
|
|
398
462
|
declare const UseEyeDropper: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
399
463
|
sRGBHex: StringConstructor;
|
|
@@ -413,6 +477,8 @@ declare const UseIdle: vue.DefineComponent<UseIdleOptions & {
|
|
|
413
477
|
timeout: number;
|
|
414
478
|
}> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
415
479
|
|
|
480
|
+
type UseMouseSourceType = 'mouse' | 'touch' | null;
|
|
481
|
+
|
|
416
482
|
interface UseImageOptions {
|
|
417
483
|
/** Address of the resource */
|
|
418
484
|
src: string;
|
|
@@ -564,17 +630,86 @@ declare function useInfiniteScroll<T extends InfiniteScrollElement>(element: May
|
|
|
564
630
|
reset(): void;
|
|
565
631
|
};
|
|
566
632
|
|
|
567
|
-
type BindingValueFunction$
|
|
568
|
-
type BindingValueArray$
|
|
569
|
-
declare const vInfiniteScroll: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
633
|
+
type BindingValueFunction$4 = Parameters<typeof useInfiniteScroll>[1];
|
|
634
|
+
type BindingValueArray$4 = [BindingValueFunction$4, UseInfiniteScrollOptions];
|
|
635
|
+
declare const vInfiniteScroll: ObjectDirective<HTMLElement, BindingValueFunction$4 | BindingValueArray$4>;
|
|
570
636
|
|
|
571
|
-
type BindingValueFunction$
|
|
572
|
-
type BindingValueArray$
|
|
573
|
-
declare const vIntersectionObserver: ObjectDirective<HTMLElement, BindingValueFunction$
|
|
637
|
+
type BindingValueFunction$3 = IntersectionObserverCallback;
|
|
638
|
+
type BindingValueArray$3 = [BindingValueFunction$3, UseIntersectionObserverOptions];
|
|
639
|
+
declare const vIntersectionObserver: ObjectDirective<HTMLElement, BindingValueFunction$3 | BindingValueArray$3>;
|
|
574
640
|
|
|
575
|
-
declare const UseMouse: vue.DefineComponent<UseMouseOptions, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<UseMouseOptions> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
641
|
+
declare const UseMouse: vue.DefineComponent<UseMouseOptions$1, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<UseMouseOptions$1> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
642
|
+
|
|
643
|
+
declare const UseMouseInElement: vue.DefineComponent<MouseInElementOptions$1 & RenderableComponent, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<MouseInElementOptions$1 & RenderableComponent> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
644
|
+
|
|
645
|
+
type UseMouseCoordType = 'page' | 'client' | 'screen' | 'movement';
|
|
646
|
+
type UseMouseEventExtractor = (event: MouseEvent | Touch) => [x: number, y: number] | null | undefined;
|
|
647
|
+
interface UseMouseOptions extends ConfigurableWindow, ConfigurableEventFilter {
|
|
648
|
+
/**
|
|
649
|
+
* Mouse position based by page, client, screen, or relative to previous position
|
|
650
|
+
*
|
|
651
|
+
* @default 'page'
|
|
652
|
+
*/
|
|
653
|
+
type?: UseMouseCoordType | UseMouseEventExtractor;
|
|
654
|
+
/**
|
|
655
|
+
* Listen events on `target` element
|
|
656
|
+
*
|
|
657
|
+
* @default 'Window'
|
|
658
|
+
*/
|
|
659
|
+
target?: MaybeRefOrGetter<Window | EventTarget | null | undefined>;
|
|
660
|
+
/**
|
|
661
|
+
* Listen to `touchmove` events
|
|
662
|
+
*
|
|
663
|
+
* @default true
|
|
664
|
+
*/
|
|
665
|
+
touch?: boolean;
|
|
666
|
+
/**
|
|
667
|
+
* Listen to `scroll` events on window, only effective on type `page`
|
|
668
|
+
*
|
|
669
|
+
* @default true
|
|
670
|
+
*/
|
|
671
|
+
scroll?: boolean;
|
|
672
|
+
/**
|
|
673
|
+
* Reset to initial value when `touchend` event fired
|
|
674
|
+
*
|
|
675
|
+
* @default false
|
|
676
|
+
*/
|
|
677
|
+
resetOnTouchEnds?: boolean;
|
|
678
|
+
/**
|
|
679
|
+
* Initial values
|
|
680
|
+
*/
|
|
681
|
+
initialValue?: Position;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
interface MouseInElementOptions extends UseMouseOptions {
|
|
685
|
+
handleOutside?: boolean;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Reactive mouse position related to an element.
|
|
689
|
+
*
|
|
690
|
+
* @see https://vueuse.org/useMouseInElement
|
|
691
|
+
* @param target
|
|
692
|
+
* @param options
|
|
693
|
+
*/
|
|
694
|
+
declare function useMouseInElement(target?: MaybeElementRef, options?: MouseInElementOptions): {
|
|
695
|
+
x: vue.Ref<number, number>;
|
|
696
|
+
y: vue.Ref<number, number>;
|
|
697
|
+
sourceType: vue.Ref<UseMouseSourceType, UseMouseSourceType>;
|
|
698
|
+
elementX: vue.Ref<number, number>;
|
|
699
|
+
elementY: vue.Ref<number, number>;
|
|
700
|
+
elementPositionX: vue.Ref<number, number>;
|
|
701
|
+
elementPositionY: vue.Ref<number, number>;
|
|
702
|
+
elementHeight: vue.Ref<number, number>;
|
|
703
|
+
elementWidth: vue.Ref<number, number>;
|
|
704
|
+
isOutside: vue.Ref<boolean, boolean>;
|
|
705
|
+
stop: () => void;
|
|
706
|
+
};
|
|
707
|
+
type UseMouseInElementReturn = ReturnType<typeof useMouseInElement>;
|
|
576
708
|
|
|
577
|
-
|
|
709
|
+
type MouseInElement = Omit<UseMouseInElementReturn, 'stop'>;
|
|
710
|
+
type BindingValueFunction$2 = (mouse: Reactive<MouseInElement>) => void;
|
|
711
|
+
type BindingValueArray$2 = [BindingValueFunction$2, MouseInElementOptions];
|
|
712
|
+
declare const vMouseInElement: ObjectDirective<HTMLElement, BindingValueFunction$2 | BindingValueArray$2>;
|
|
578
713
|
|
|
579
714
|
declare const UseMousePressed: vue.DefineComponent<Omit<MousePressedOptions, "target"> & RenderableComponent, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<Omit<MousePressedOptions, "target"> & RenderableComponent> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
580
715
|
|
|
@@ -733,4 +868,4 @@ declare const UseWindowFocus: vue.DefineComponent<{}, () => vue.VNode<vue.Render
|
|
|
733
868
|
|
|
734
869
|
declare const UseWindowSize: vue.DefineComponent<UseWindowSizeOptions, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<UseWindowSizeOptions> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
735
870
|
|
|
736
|
-
export { OnClickOutside, type OnClickOutsideProps, OnLongPress, type OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, type UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, type UseObjectUrlProps, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UsePreferredReducedTransparency, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, type UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vResizeObserver, vScroll, vScrollLock };
|
|
871
|
+
export { OnClickOutside, type OnClickOutsideProps, OnLongPress, type OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, type UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, type UseObjectUrlProps, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UsePreferredReducedTransparency, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, type UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementBounding, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vMouseInElement, vOnClickOutside, vOnKeyStroke, vOnLongPress, vResizeObserver, vScroll, vScrollLock };
|