@vueuse/components 10.11.0 → 11.0.0-beta.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/index.cjs CHANGED
@@ -467,8 +467,10 @@ function useStorage(key, defaults, storage, options = {}) {
467
467
  );
468
468
  if (window && listenToStorageChanges) {
469
469
  shared.tryOnMounted(() => {
470
- useEventListener(window, "storage", update);
471
- useEventListener(window, customStorageEventName, updateFromCustomEvent);
470
+ if (storage instanceof Storage)
471
+ useEventListener(window, "storage", update);
472
+ else
473
+ useEventListener(window, customStorageEventName, updateFromCustomEvent);
472
474
  if (initOnMounted)
473
475
  update();
474
476
  });
@@ -476,7 +478,7 @@ function useStorage(key, defaults, storage, options = {}) {
476
478
  if (!initOnMounted)
477
479
  update();
478
480
  function dispatchWriteEvent(oldValue, newValue) {
479
- if (window) {
481
+ if (window && !(storage instanceof Storage)) {
480
482
  window.dispatchEvent(new CustomEvent(customStorageEventName, {
481
483
  detail: {
482
484
  key,
@@ -609,6 +611,7 @@ function usePreferredDark(options) {
609
611
  return useMediaQuery("(prefers-color-scheme: dark)", options);
610
612
  }
611
613
 
614
+ const CSS_DISABLE_TRANS = "*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";
612
615
  function useColorMode(options = {}) {
613
616
  const {
614
617
  selector = "html",
@@ -638,23 +641,36 @@ function useColorMode(options = {}) {
638
641
  const el = typeof selector2 === "string" ? window == null ? void 0 : window.document.querySelector(selector2) : unrefElement(selector2);
639
642
  if (!el)
640
643
  return;
641
- let style;
642
- if (disableTransition) {
643
- style = window.document.createElement("style");
644
- const styleString = "*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";
645
- style.appendChild(document.createTextNode(styleString));
646
- window.document.head.appendChild(style);
647
- }
644
+ const classesToAdd = /* @__PURE__ */ new Set();
645
+ const classesToRemove = /* @__PURE__ */ new Set();
646
+ let attributeToChange = null;
648
647
  if (attribute2 === "class") {
649
648
  const current = value.split(/\s/g);
650
649
  Object.values(modes).flatMap((i) => (i || "").split(/\s/g)).filter(Boolean).forEach((v) => {
651
650
  if (current.includes(v))
652
- el.classList.add(v);
651
+ classesToAdd.add(v);
653
652
  else
654
- el.classList.remove(v);
653
+ classesToRemove.add(v);
655
654
  });
656
655
  } else {
657
- el.setAttribute(attribute2, value);
656
+ attributeToChange = { key: attribute2, value };
657
+ }
658
+ if (classesToAdd.size === 0 && classesToRemove.size === 0 && attributeToChange === null)
659
+ return;
660
+ let style;
661
+ if (disableTransition) {
662
+ style = window.document.createElement("style");
663
+ style.appendChild(document.createTextNode(CSS_DISABLE_TRANS));
664
+ window.document.head.appendChild(style);
665
+ }
666
+ for (const c of classesToAdd) {
667
+ el.classList.add(c);
668
+ }
669
+ for (const c of classesToRemove) {
670
+ el.classList.remove(c);
671
+ }
672
+ if (attributeToChange) {
673
+ el.setAttribute(attributeToChange.key, attributeToChange.value);
658
674
  }
659
675
  if (disableTransition) {
660
676
  window.getComputedStyle(style).opacity;
@@ -798,7 +814,8 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
798
814
  "onStart",
799
815
  "onMove",
800
816
  "onEnd",
801
- "disabled"
817
+ "disabled",
818
+ "buttons"
802
819
  ],
803
820
  setup(props, { slots }) {
804
821
  const target = vueDemi.ref();
@@ -876,9 +893,14 @@ function useElementHover(el, options = {}) {
876
893
 
877
894
  const vElementHover = {
878
895
  [shared.directiveHooks.mounted](el, binding) {
879
- if (typeof binding.value === "function") {
896
+ const value = binding.value;
897
+ if (typeof value === "function") {
880
898
  const isHovered = useElementHover(el);
881
- vueDemi.watch(isHovered, (v) => binding.value(v));
899
+ vueDemi.watch(isHovered, (v) => value(v));
900
+ } else {
901
+ const [handler, options] = value;
902
+ const isHovered = useElementHover(el, options);
903
+ vueDemi.watch(isHovered, (v) => handler(v));
882
904
  }
883
905
  }
884
906
  };
@@ -906,15 +928,20 @@ function useResizeObserver(target, callback, options = {}) {
906
928
  observer = void 0;
907
929
  }
908
930
  };
909
- const targets = vueDemi.computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
931
+ const targets = vueDemi.computed(() => {
932
+ const _targets = shared.toValue(target);
933
+ return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
934
+ });
910
935
  const stopWatch = vueDemi.watch(
911
936
  targets,
912
937
  (els) => {
913
938
  cleanup();
914
939
  if (isSupported.value && window) {
915
940
  observer = new ResizeObserver(callback);
916
- for (const _el of els)
917
- _el && observer.observe(_el, observerOptions);
941
+ for (const _el of els) {
942
+ if (_el)
943
+ observer.observe(_el, observerOptions);
944
+ }
918
945
  }
919
946
  },
920
947
  { immediate: true, flush: "post" }
@@ -1016,7 +1043,7 @@ function useIntersectionObserver(target, callback, options = {}) {
1016
1043
  const {
1017
1044
  root,
1018
1045
  rootMargin = "0px",
1019
- threshold = 0.1,
1046
+ threshold = 0,
1020
1047
  window = defaultWindow,
1021
1048
  immediate = true
1022
1049
  } = options;
@@ -1505,7 +1532,10 @@ function useInfiniteScroll(element, onLoadMore, options = {}) {
1505
1532
  { immediate: true }
1506
1533
  );
1507
1534
  return {
1508
- isLoading
1535
+ isLoading,
1536
+ reset() {
1537
+ vueDemi.nextTick(() => checkAndLoad());
1538
+ }
1509
1539
  };
1510
1540
  }
1511
1541
 
@@ -1768,6 +1798,15 @@ const UsePreferredReducedMotion = /* @__PURE__ */ /* #__PURE__ */ vueDemi.define
1768
1798
  }
1769
1799
  });
1770
1800
 
1801
+ const vResizeObserver = {
1802
+ [shared.directiveHooks.mounted](el, binding) {
1803
+ if (typeof binding.value === "function")
1804
+ useResizeObserver(el, binding.value);
1805
+ else
1806
+ useResizeObserver(el, ...binding.value);
1807
+ }
1808
+ };
1809
+
1771
1810
  function useMutationObserver(target, callback, options = {}) {
1772
1811
  const { window = defaultWindow, ...mutationOptions } = options;
1773
1812
  let observer;
@@ -1798,8 +1837,8 @@ function useMutationObserver(target, callback, options = {}) {
1798
1837
  return observer == null ? void 0 : observer.takeRecords();
1799
1838
  };
1800
1839
  const stop = () => {
1801
- cleanup();
1802
1840
  stopWatch();
1841
+ cleanup();
1803
1842
  };
1804
1843
  shared.tryOnScopeDispose(stop);
1805
1844
  return {
@@ -1810,7 +1849,7 @@ function useMutationObserver(target, callback, options = {}) {
1810
1849
  }
1811
1850
 
1812
1851
  function useCssVar(prop, target, options = {}) {
1813
- const { window = defaultWindow, initialValue = "", observe = false } = options;
1852
+ const { window = defaultWindow, initialValue, observe = false } = options;
1814
1853
  const variable = vueDemi.ref(initialValue);
1815
1854
  const elRef = vueDemi.computed(() => {
1816
1855
  var _a;
@@ -1820,7 +1859,7 @@ function useCssVar(prop, target, options = {}) {
1820
1859
  var _a;
1821
1860
  const key = shared.toValue(prop);
1822
1861
  const el = shared.toValue(elRef);
1823
- if (el && window) {
1862
+ if (el && window && key) {
1824
1863
  const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
1825
1864
  variable.value = value || initialValue;
1826
1865
  }
@@ -1833,15 +1872,24 @@ function useCssVar(prop, target, options = {}) {
1833
1872
  }
1834
1873
  vueDemi.watch(
1835
1874
  [elRef, () => shared.toValue(prop)],
1836
- updateCssVar,
1875
+ (_, old) => {
1876
+ if (old[0] && old[1] && window)
1877
+ window.getComputedStyle(old[0]).removeProperty(old[1]);
1878
+ updateCssVar();
1879
+ },
1837
1880
  { immediate: true }
1838
1881
  );
1839
1882
  vueDemi.watch(
1840
1883
  variable,
1841
1884
  (val) => {
1842
1885
  var _a;
1843
- if ((_a = elRef.value) == null ? void 0 : _a.style)
1844
- elRef.value.style.setProperty(shared.toValue(prop), val);
1886
+ const raw_prop = shared.toValue(prop);
1887
+ if (((_a = elRef.value) == null ? void 0 : _a.style) && raw_prop) {
1888
+ if (val == null)
1889
+ elRef.value.style.removeProperty(raw_prop);
1890
+ else
1891
+ elRef.value.style.setProperty(raw_prop, val);
1892
+ }
1845
1893
  }
1846
1894
  );
1847
1895
  return variable;
@@ -2015,7 +2063,8 @@ function useScrollLock(element, initialState = false) {
2015
2063
  const el = resolveElement(shared.toValue(element));
2016
2064
  if (!el || !isLocked.value)
2017
2065
  return;
2018
- shared.isIOS && (stopTouchMoveListener == null ? void 0 : stopTouchMoveListener());
2066
+ if (shared.isIOS)
2067
+ stopTouchMoveListener == null ? void 0 : stopTouchMoveListener();
2019
2068
  el.style.overflow = initialOverflow;
2020
2069
  elInitialOverflow.delete(el);
2021
2070
  isLocked.value = false;
@@ -2028,7 +2077,8 @@ function useScrollLock(element, initialState = false) {
2028
2077
  set(v) {
2029
2078
  if (v)
2030
2079
  lock();
2031
- else unlock();
2080
+ else
2081
+ unlock();
2032
2082
  }
2033
2083
  });
2034
2084
  }
@@ -2169,5 +2219,6 @@ exports.vIntersectionObserver = vIntersectionObserver;
2169
2219
  exports.vOnClickOutside = vOnClickOutside;
2170
2220
  exports.vOnKeyStroke = vOnKeyStroke;
2171
2221
  exports.vOnLongPress = vOnLongPress;
2222
+ exports.vResizeObserver = vResizeObserver;
2172
2223
  exports.vScroll = vScroll;
2173
2224
  exports.vScrollLock = vScrollLock;
package/index.d.cts CHANGED
@@ -13,7 +13,7 @@ interface RenderableComponent {
13
13
  *
14
14
  * @default 'div'
15
15
  */
16
- as?: Object | string;
16
+ as?: object | string;
17
17
  }
18
18
 
19
19
  type VueInstance = ComponentPublicInstance;
@@ -63,9 +63,9 @@ interface OnKeyStrokeOptions {
63
63
  dedupe?: MaybeRefOrGetter<boolean>;
64
64
  }
65
65
 
66
- type BindingValueFunction$7 = (event: KeyboardEvent) => void;
67
- type BindingValueArray$6 = [BindingValueFunction$7, OnKeyStrokeOptions];
68
- declare const vOnKeyStroke: ObjectDirective<HTMLElement, BindingValueFunction$7 | BindingValueArray$6>;
66
+ type BindingValueFunction$8 = (event: KeyboardEvent) => void;
67
+ type BindingValueArray$7 = [BindingValueFunction$8, OnKeyStrokeOptions];
68
+ declare const vOnKeyStroke: ObjectDirective<HTMLElement, BindingValueFunction$8 | BindingValueArray$7>;
69
69
 
70
70
  interface OnLongPressOptions {
71
71
  /**
@@ -102,12 +102,12 @@ interface OnLongPressProps extends RenderableComponent {
102
102
  }
103
103
  declare const OnLongPress: vue_demi.DefineComponent<OnLongPressProps, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<OnLongPressProps>, {}, {}>;
104
104
 
105
- type BindingValueFunction$6 = (evt: PointerEvent) => void;
106
- type BindingValueArray$5 = [
107
- BindingValueFunction$6,
105
+ type BindingValueFunction$7 = (evt: PointerEvent) => void;
106
+ type BindingValueArray$6 = [
107
+ BindingValueFunction$7,
108
108
  OnLongPressOptions
109
109
  ];
110
- declare const vOnLongPress: ObjectDirective<HTMLElement, BindingValueFunction$6 | BindingValueArray$5>;
110
+ declare const vOnLongPress: ObjectDirective<HTMLElement, BindingValueFunction$7 | BindingValueArray$6>;
111
111
 
112
112
  declare const UseActiveElement: vue_demi.DefineComponent<{}, () => vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
113
113
  [key: string]: any;
@@ -295,6 +295,18 @@ interface UseDraggableProps extends UseDraggableOptions, RenderableComponent {
295
295
  }
296
296
  declare const UseDraggable: vue_demi.DefineComponent<UseDraggableProps, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<UseDraggableProps>, {}, {}>;
297
297
 
298
+ interface ResizeObserverSize {
299
+ readonly inlineSize: number;
300
+ readonly blockSize: number;
301
+ }
302
+ interface ResizeObserverEntry {
303
+ readonly target: Element;
304
+ readonly contentRect: DOMRectReadOnly;
305
+ readonly borderBoxSize?: ReadonlyArray<ResizeObserverSize>;
306
+ readonly contentBoxSize?: ReadonlyArray<ResizeObserverSize>;
307
+ readonly devicePixelContentBoxSize?: ReadonlyArray<ResizeObserverSize>;
308
+ }
309
+ type ResizeObserverCallback = (entries: ReadonlyArray<ResizeObserverEntry>, observer: ResizeObserver) => void;
298
310
  interface UseResizeObserverOptions extends ConfigurableWindow {
299
311
  /**
300
312
  * Sets which box model the observer will observe changes to. Possible values
@@ -304,11 +316,22 @@ interface UseResizeObserverOptions extends ConfigurableWindow {
304
316
  */
305
317
  box?: ResizeObserverBoxOptions;
306
318
  }
319
+ declare class ResizeObserver {
320
+ constructor(callback: ResizeObserverCallback);
321
+ disconnect(): void;
322
+ observe(target: Element, options?: UseResizeObserverOptions): void;
323
+ unobserve(target: Element): void;
324
+ }
307
325
 
308
326
  declare const UseElementBounding: vue_demi.DefineComponent<UseResizeObserverOptions & RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<UseResizeObserverOptions & RenderableComponent>, {}, {}>;
309
327
 
310
- type BindingValueFunction$5 = (state: boolean) => void;
311
- declare const vElementHover: ObjectDirective<HTMLElement, BindingValueFunction$5>;
328
+ interface UseElementHoverOptions extends ConfigurableWindow {
329
+ delayEnter?: number;
330
+ delayLeave?: number;
331
+ }
332
+
333
+ type BindingValueFunction$6 = (state: boolean) => void;
334
+ declare const vElementHover: ObjectDirective<HTMLElement, BindingValueFunction$6 | [handler: BindingValueFunction$6, options: UseElementHoverOptions]>;
312
335
 
313
336
  declare const UseElementSize: vue_demi.DefineComponent<ElementSize$1 & UseResizeObserverOptions & RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<ElementSize$1 & UseResizeObserverOptions & RenderableComponent>, {}, {}>;
314
337
 
@@ -328,10 +351,10 @@ declare function useElementSize(target: MaybeComputedElementRef, initialSize?: E
328
351
  };
329
352
 
330
353
  type RemoveFirstFromTuple<T extends any[]> = T['length'] extends 0 ? undefined : (((...b: T) => void) extends (a: any, ...b: infer I) => void ? I : []);
331
- type BindingValueFunction$4 = (size: ElementSize) => void;
354
+ type BindingValueFunction$5 = (size: ElementSize) => void;
332
355
  type VElementSizeOptions = RemoveFirstFromTuple<Parameters<typeof useElementSize>>;
333
- type BindingValueArray$4 = [BindingValueFunction$4, ...VElementSizeOptions];
334
- declare const vElementSize: ObjectDirective<HTMLElement, BindingValueFunction$4 | BindingValueArray$4>;
356
+ type BindingValueArray$5 = [BindingValueFunction$5, ...VElementSizeOptions];
357
+ declare const vElementSize: ObjectDirective<HTMLElement, BindingValueFunction$5 | BindingValueArray$5>;
335
358
 
336
359
  declare const UseElementVisibility: vue_demi.DefineComponent<RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<RenderableComponent>, {}, {}>;
337
360
 
@@ -352,6 +375,7 @@ interface UseIntersectionObserverOptions extends ConfigurableWindow {
352
375
  rootMargin?: string;
353
376
  /**
354
377
  * Either a single number or an array of numbers between 0.0 and 1.
378
+ * @default 0
355
379
  */
356
380
  threshold?: number | number[];
357
381
  }
@@ -360,9 +384,9 @@ interface UseElementVisibilityOptions extends ConfigurableWindow, Pick<UseInters
360
384
  scrollTarget?: MaybeRefOrGetter<HTMLElement | undefined | null>;
361
385
  }
362
386
 
363
- type BindingValueFunction$3 = (state: boolean) => void;
364
- type BindingValueArray$3 = [BindingValueFunction$3, UseElementVisibilityOptions];
365
- declare const vElementVisibility: ObjectDirective<HTMLElement, BindingValueFunction$3 | BindingValueArray$3>;
387
+ type BindingValueFunction$4 = (state: boolean) => void;
388
+ type BindingValueArray$4 = [BindingValueFunction$4, UseElementVisibilityOptions];
389
+ declare const vElementVisibility: ObjectDirective<HTMLElement, BindingValueFunction$4 | BindingValueArray$4>;
366
390
 
367
391
  declare const UseEyeDropper: vue_demi.DefineComponent<{
368
392
  sRGBHex: StringConstructor;
@@ -518,15 +542,16 @@ interface UseInfiniteScrollOptions<T extends InfiniteScrollElement = InfiniteScr
518
542
  */
519
543
  declare function useInfiniteScroll<T extends InfiniteScrollElement>(element: MaybeRefOrGetter<T>, onLoadMore: (state: UnwrapNestedRefs<ReturnType<typeof useScroll>>) => Awaitable<void>, options?: UseInfiniteScrollOptions<T>): {
520
544
  isLoading: vue_demi.ComputedRef<boolean>;
545
+ reset(): void;
521
546
  };
522
547
 
523
- type BindingValueFunction$2 = Parameters<typeof useInfiniteScroll>[1];
524
- type BindingValueArray$2 = [BindingValueFunction$2, UseInfiniteScrollOptions];
525
- declare const vInfiniteScroll: ObjectDirective<HTMLElement, BindingValueFunction$2 | BindingValueArray$2>;
548
+ type BindingValueFunction$3 = Parameters<typeof useInfiniteScroll>[1];
549
+ type BindingValueArray$3 = [BindingValueFunction$3, UseInfiniteScrollOptions];
550
+ declare const vInfiniteScroll: ObjectDirective<HTMLElement, BindingValueFunction$3 | BindingValueArray$3>;
526
551
 
527
- type BindingValueFunction$1 = IntersectionObserverCallback;
528
- type BindingValueArray$1 = [BindingValueFunction$1, UseIntersectionObserverOptions];
529
- declare const vIntersectionObserver: ObjectDirective<HTMLElement, BindingValueFunction$1 | BindingValueArray$1>;
552
+ type BindingValueFunction$2 = IntersectionObserverCallback;
553
+ type BindingValueArray$2 = [BindingValueFunction$2, UseIntersectionObserverOptions];
554
+ declare const vIntersectionObserver: ObjectDirective<HTMLElement, BindingValueFunction$2 | BindingValueArray$2>;
530
555
 
531
556
  declare const UseMouse: vue_demi.DefineComponent<UseMouseOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<UseMouseOptions>, {}, {}>;
532
557
 
@@ -594,9 +619,9 @@ declare const UsePageLeave: vue_demi.DefineComponent<{}, () => vue_demi.VNode<vu
594
619
  }>[] | undefined, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<vue_demi.ExtractPropTypes<{}>>, {}, {}>;
595
620
 
596
621
  declare const UsePointer: vue_demi.DefineComponent<Omit<UsePointerOptions, "target"> & {
597
- target: 'window' | 'self';
622
+ target: "window" | "self";
598
623
  }, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<Omit<UsePointerOptions, "target"> & {
599
- target: 'window' | 'self';
624
+ target: "window" | "self";
600
625
  }>, {}, {}>;
601
626
 
602
627
  declare const UsePointerLock: vue_demi.DefineComponent<RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<RenderableComponent>, {}, {}>;
@@ -621,6 +646,10 @@ declare const UsePreferredReducedMotion: vue_demi.DefineComponent<{}, () => vue_
621
646
  [key: string]: any;
622
647
  }>[] | undefined, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<vue_demi.ExtractPropTypes<{}>>, {}, {}>;
623
648
 
649
+ type BindingValueFunction$1 = ResizeObserverCallback;
650
+ type BindingValueArray$1 = [BindingValueFunction$1, UseResizeObserverOptions];
651
+ declare const vResizeObserver: ObjectDirective<HTMLElement, BindingValueFunction$1 | BindingValueArray$1>;
652
+
624
653
  declare const UseScreenSafeArea: vue_demi.DefineComponent<{
625
654
  top: BooleanConstructor;
626
655
  right: BooleanConstructor;
@@ -681,4 +710,4 @@ declare const UseWindowFocus: vue_demi.DefineComponent<{}, () => vue_demi.VNode<
681
710
 
682
711
  declare const UseWindowSize: vue_demi.DefineComponent<UseWindowSizeOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<UseWindowSizeOptions>, {}, {}>;
683
712
 
684
- 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, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, type UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
713
+ 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, 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 };
package/index.d.mts CHANGED
@@ -13,7 +13,7 @@ interface RenderableComponent {
13
13
  *
14
14
  * @default 'div'
15
15
  */
16
- as?: Object | string;
16
+ as?: object | string;
17
17
  }
18
18
 
19
19
  type VueInstance = ComponentPublicInstance;
@@ -63,9 +63,9 @@ interface OnKeyStrokeOptions {
63
63
  dedupe?: MaybeRefOrGetter<boolean>;
64
64
  }
65
65
 
66
- type BindingValueFunction$7 = (event: KeyboardEvent) => void;
67
- type BindingValueArray$6 = [BindingValueFunction$7, OnKeyStrokeOptions];
68
- declare const vOnKeyStroke: ObjectDirective<HTMLElement, BindingValueFunction$7 | BindingValueArray$6>;
66
+ type BindingValueFunction$8 = (event: KeyboardEvent) => void;
67
+ type BindingValueArray$7 = [BindingValueFunction$8, OnKeyStrokeOptions];
68
+ declare const vOnKeyStroke: ObjectDirective<HTMLElement, BindingValueFunction$8 | BindingValueArray$7>;
69
69
 
70
70
  interface OnLongPressOptions {
71
71
  /**
@@ -102,12 +102,12 @@ interface OnLongPressProps extends RenderableComponent {
102
102
  }
103
103
  declare const OnLongPress: vue_demi.DefineComponent<OnLongPressProps, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<OnLongPressProps>, {}, {}>;
104
104
 
105
- type BindingValueFunction$6 = (evt: PointerEvent) => void;
106
- type BindingValueArray$5 = [
107
- BindingValueFunction$6,
105
+ type BindingValueFunction$7 = (evt: PointerEvent) => void;
106
+ type BindingValueArray$6 = [
107
+ BindingValueFunction$7,
108
108
  OnLongPressOptions
109
109
  ];
110
- declare const vOnLongPress: ObjectDirective<HTMLElement, BindingValueFunction$6 | BindingValueArray$5>;
110
+ declare const vOnLongPress: ObjectDirective<HTMLElement, BindingValueFunction$7 | BindingValueArray$6>;
111
111
 
112
112
  declare const UseActiveElement: vue_demi.DefineComponent<{}, () => vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
113
113
  [key: string]: any;
@@ -295,6 +295,18 @@ interface UseDraggableProps extends UseDraggableOptions, RenderableComponent {
295
295
  }
296
296
  declare const UseDraggable: vue_demi.DefineComponent<UseDraggableProps, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<UseDraggableProps>, {}, {}>;
297
297
 
298
+ interface ResizeObserverSize {
299
+ readonly inlineSize: number;
300
+ readonly blockSize: number;
301
+ }
302
+ interface ResizeObserverEntry {
303
+ readonly target: Element;
304
+ readonly contentRect: DOMRectReadOnly;
305
+ readonly borderBoxSize?: ReadonlyArray<ResizeObserverSize>;
306
+ readonly contentBoxSize?: ReadonlyArray<ResizeObserverSize>;
307
+ readonly devicePixelContentBoxSize?: ReadonlyArray<ResizeObserverSize>;
308
+ }
309
+ type ResizeObserverCallback = (entries: ReadonlyArray<ResizeObserverEntry>, observer: ResizeObserver) => void;
298
310
  interface UseResizeObserverOptions extends ConfigurableWindow {
299
311
  /**
300
312
  * Sets which box model the observer will observe changes to. Possible values
@@ -304,11 +316,22 @@ interface UseResizeObserverOptions extends ConfigurableWindow {
304
316
  */
305
317
  box?: ResizeObserverBoxOptions;
306
318
  }
319
+ declare class ResizeObserver {
320
+ constructor(callback: ResizeObserverCallback);
321
+ disconnect(): void;
322
+ observe(target: Element, options?: UseResizeObserverOptions): void;
323
+ unobserve(target: Element): void;
324
+ }
307
325
 
308
326
  declare const UseElementBounding: vue_demi.DefineComponent<UseResizeObserverOptions & RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<UseResizeObserverOptions & RenderableComponent>, {}, {}>;
309
327
 
310
- type BindingValueFunction$5 = (state: boolean) => void;
311
- declare const vElementHover: ObjectDirective<HTMLElement, BindingValueFunction$5>;
328
+ interface UseElementHoverOptions extends ConfigurableWindow {
329
+ delayEnter?: number;
330
+ delayLeave?: number;
331
+ }
332
+
333
+ type BindingValueFunction$6 = (state: boolean) => void;
334
+ declare const vElementHover: ObjectDirective<HTMLElement, BindingValueFunction$6 | [handler: BindingValueFunction$6, options: UseElementHoverOptions]>;
312
335
 
313
336
  declare const UseElementSize: vue_demi.DefineComponent<ElementSize$1 & UseResizeObserverOptions & RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<ElementSize$1 & UseResizeObserverOptions & RenderableComponent>, {}, {}>;
314
337
 
@@ -328,10 +351,10 @@ declare function useElementSize(target: MaybeComputedElementRef, initialSize?: E
328
351
  };
329
352
 
330
353
  type RemoveFirstFromTuple<T extends any[]> = T['length'] extends 0 ? undefined : (((...b: T) => void) extends (a: any, ...b: infer I) => void ? I : []);
331
- type BindingValueFunction$4 = (size: ElementSize) => void;
354
+ type BindingValueFunction$5 = (size: ElementSize) => void;
332
355
  type VElementSizeOptions = RemoveFirstFromTuple<Parameters<typeof useElementSize>>;
333
- type BindingValueArray$4 = [BindingValueFunction$4, ...VElementSizeOptions];
334
- declare const vElementSize: ObjectDirective<HTMLElement, BindingValueFunction$4 | BindingValueArray$4>;
356
+ type BindingValueArray$5 = [BindingValueFunction$5, ...VElementSizeOptions];
357
+ declare const vElementSize: ObjectDirective<HTMLElement, BindingValueFunction$5 | BindingValueArray$5>;
335
358
 
336
359
  declare const UseElementVisibility: vue_demi.DefineComponent<RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<RenderableComponent>, {}, {}>;
337
360
 
@@ -352,6 +375,7 @@ interface UseIntersectionObserverOptions extends ConfigurableWindow {
352
375
  rootMargin?: string;
353
376
  /**
354
377
  * Either a single number or an array of numbers between 0.0 and 1.
378
+ * @default 0
355
379
  */
356
380
  threshold?: number | number[];
357
381
  }
@@ -360,9 +384,9 @@ interface UseElementVisibilityOptions extends ConfigurableWindow, Pick<UseInters
360
384
  scrollTarget?: MaybeRefOrGetter<HTMLElement | undefined | null>;
361
385
  }
362
386
 
363
- type BindingValueFunction$3 = (state: boolean) => void;
364
- type BindingValueArray$3 = [BindingValueFunction$3, UseElementVisibilityOptions];
365
- declare const vElementVisibility: ObjectDirective<HTMLElement, BindingValueFunction$3 | BindingValueArray$3>;
387
+ type BindingValueFunction$4 = (state: boolean) => void;
388
+ type BindingValueArray$4 = [BindingValueFunction$4, UseElementVisibilityOptions];
389
+ declare const vElementVisibility: ObjectDirective<HTMLElement, BindingValueFunction$4 | BindingValueArray$4>;
366
390
 
367
391
  declare const UseEyeDropper: vue_demi.DefineComponent<{
368
392
  sRGBHex: StringConstructor;
@@ -518,15 +542,16 @@ interface UseInfiniteScrollOptions<T extends InfiniteScrollElement = InfiniteScr
518
542
  */
519
543
  declare function useInfiniteScroll<T extends InfiniteScrollElement>(element: MaybeRefOrGetter<T>, onLoadMore: (state: UnwrapNestedRefs<ReturnType<typeof useScroll>>) => Awaitable<void>, options?: UseInfiniteScrollOptions<T>): {
520
544
  isLoading: vue_demi.ComputedRef<boolean>;
545
+ reset(): void;
521
546
  };
522
547
 
523
- type BindingValueFunction$2 = Parameters<typeof useInfiniteScroll>[1];
524
- type BindingValueArray$2 = [BindingValueFunction$2, UseInfiniteScrollOptions];
525
- declare const vInfiniteScroll: ObjectDirective<HTMLElement, BindingValueFunction$2 | BindingValueArray$2>;
548
+ type BindingValueFunction$3 = Parameters<typeof useInfiniteScroll>[1];
549
+ type BindingValueArray$3 = [BindingValueFunction$3, UseInfiniteScrollOptions];
550
+ declare const vInfiniteScroll: ObjectDirective<HTMLElement, BindingValueFunction$3 | BindingValueArray$3>;
526
551
 
527
- type BindingValueFunction$1 = IntersectionObserverCallback;
528
- type BindingValueArray$1 = [BindingValueFunction$1, UseIntersectionObserverOptions];
529
- declare const vIntersectionObserver: ObjectDirective<HTMLElement, BindingValueFunction$1 | BindingValueArray$1>;
552
+ type BindingValueFunction$2 = IntersectionObserverCallback;
553
+ type BindingValueArray$2 = [BindingValueFunction$2, UseIntersectionObserverOptions];
554
+ declare const vIntersectionObserver: ObjectDirective<HTMLElement, BindingValueFunction$2 | BindingValueArray$2>;
530
555
 
531
556
  declare const UseMouse: vue_demi.DefineComponent<UseMouseOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<UseMouseOptions>, {}, {}>;
532
557
 
@@ -594,9 +619,9 @@ declare const UsePageLeave: vue_demi.DefineComponent<{}, () => vue_demi.VNode<vu
594
619
  }>[] | undefined, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<vue_demi.ExtractPropTypes<{}>>, {}, {}>;
595
620
 
596
621
  declare const UsePointer: vue_demi.DefineComponent<Omit<UsePointerOptions, "target"> & {
597
- target: 'window' | 'self';
622
+ target: "window" | "self";
598
623
  }, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<Omit<UsePointerOptions, "target"> & {
599
- target: 'window' | 'self';
624
+ target: "window" | "self";
600
625
  }>, {}, {}>;
601
626
 
602
627
  declare const UsePointerLock: vue_demi.DefineComponent<RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<RenderableComponent>, {}, {}>;
@@ -621,6 +646,10 @@ declare const UsePreferredReducedMotion: vue_demi.DefineComponent<{}, () => vue_
621
646
  [key: string]: any;
622
647
  }>[] | undefined, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<vue_demi.ExtractPropTypes<{}>>, {}, {}>;
623
648
 
649
+ type BindingValueFunction$1 = ResizeObserverCallback;
650
+ type BindingValueArray$1 = [BindingValueFunction$1, UseResizeObserverOptions];
651
+ declare const vResizeObserver: ObjectDirective<HTMLElement, BindingValueFunction$1 | BindingValueArray$1>;
652
+
624
653
  declare const UseScreenSafeArea: vue_demi.DefineComponent<{
625
654
  top: BooleanConstructor;
626
655
  right: BooleanConstructor;
@@ -681,4 +710,4 @@ declare const UseWindowFocus: vue_demi.DefineComponent<{}, () => vue_demi.VNode<
681
710
 
682
711
  declare const UseWindowSize: vue_demi.DefineComponent<UseWindowSizeOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<UseWindowSizeOptions>, {}, {}>;
683
712
 
684
- 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, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, type UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
713
+ 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, 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 };