@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.iife.js CHANGED
@@ -21,7 +21,7 @@
21
21
 
22
22
  function unrefElement(elRef) {
23
23
  var _a;
24
- const plain = shared.toValue(elRef);
24
+ const plain = vue.toValue(elRef);
25
25
  return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
26
26
  }
27
27
 
@@ -38,10 +38,8 @@
38
38
  }
39
39
  if (!target)
40
40
  return shared.noop;
41
- if (!Array.isArray(events))
42
- events = [events];
43
- if (!Array.isArray(listeners))
44
- listeners = [listeners];
41
+ events = shared.toArray(events);
42
+ listeners = shared.toArray(listeners);
45
43
  const cleanups = [];
46
44
  const cleanup = () => {
47
45
  cleanups.forEach((fn) => fn());
@@ -52,7 +50,7 @@
52
50
  return () => el.removeEventListener(event, listener, options2);
53
51
  };
54
52
  const stopWatch = vue.watch(
55
- () => [unrefElement(target), shared.toValue(options)],
53
+ () => [unrefElement(target), vue.toValue(options)],
56
54
  ([el, options2]) => {
57
55
  cleanup();
58
56
  if (!el)
@@ -86,7 +84,7 @@
86
84
  }
87
85
  let shouldListen = true;
88
86
  const shouldIgnore = (event) => {
89
- return shared.toValue(ignore).some((target2) => {
87
+ return vue.toValue(ignore).some((target2) => {
90
88
  if (typeof target2 === "string") {
91
89
  return Array.from(window.document.querySelectorAll(target2)).some((el) => el === event.target || event.composedPath().includes(el));
92
90
  } else {
@@ -96,11 +94,11 @@
96
94
  });
97
95
  };
98
96
  function hasMultipleRoots(target2) {
99
- const vm = shared.toValue(target2);
97
+ const vm = vue.toValue(target2);
100
98
  return vm && vm.$.subTree.shapeFlag === 16;
101
99
  }
102
100
  function checkMultipleRoots(target2, event) {
103
- const vm = shared.toValue(target2);
101
+ const vm = vue.toValue(target2);
104
102
  const children = vm.$.subTree && vm.$.subTree.children;
105
103
  if (children == null || !Array.isArray(children))
106
104
  return false;
@@ -204,7 +202,7 @@
204
202
  } = options;
205
203
  const predicate = createKeyPredicate(key);
206
204
  const listener = (e) => {
207
- if (e.repeat && shared.toValue(dedupe))
205
+ if (e.repeat && vue.toValue(dedupe))
208
206
  return;
209
207
  if (predicate(e))
210
208
  handler(e);
@@ -455,7 +453,7 @@
455
453
  const stopWatch = vue.watchEffect(() => {
456
454
  if (ssrSupport.value) {
457
455
  ssrSupport.value = !isSupported.value;
458
- const queryStrings = shared.toValue(query).split(",");
456
+ const queryStrings = vue.toValue(query).split(",");
459
457
  matches.value = queryStrings.some((queryString) => {
460
458
  const not = queryString.includes("not all");
461
459
  const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
@@ -474,7 +472,7 @@
474
472
  if (!isSupported.value)
475
473
  return;
476
474
  cleanup();
477
- mediaQuery = window.matchMedia(shared.toValue(query));
475
+ mediaQuery = window.matchMedia(vue.toValue(query));
478
476
  if ("addEventListener" in mediaQuery)
479
477
  mediaQuery.addEventListener("change", handler);
480
478
  else
@@ -561,7 +559,7 @@
561
559
  }
562
560
  if (!storage)
563
561
  return data;
564
- const rawInit = shared.toValue(defaults);
562
+ const rawInit = vue.toValue(defaults);
565
563
  const type = guessSerializerType(rawInit);
566
564
  const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];
567
565
  const { pause: pauseWatch, resume: resumeWatch } = shared.pausableWatch(
@@ -874,7 +872,7 @@
874
872
  const disabled = vue.computed(() => !!props.disabled);
875
873
  const storageValue = props.storageKey && core.useStorage(
876
874
  props.storageKey,
877
- shared.toValue(props.initialValue) || { x: 0, y: 0 },
875
+ vue.toValue(props.initialValue) || { x: 0, y: 0 },
878
876
  core.isClient ? props.storageType === "session" ? sessionStorage : localStorage : void 0
879
877
  );
880
878
  const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
@@ -914,10 +912,222 @@
914
912
  }
915
913
  });
916
914
 
915
+ function useMutationObserver(target, callback, options = {}) {
916
+ const { window = defaultWindow, ...mutationOptions } = options;
917
+ let observer;
918
+ const isSupported = useSupported(() => window && "MutationObserver" in window);
919
+ const cleanup = () => {
920
+ if (observer) {
921
+ observer.disconnect();
922
+ observer = void 0;
923
+ }
924
+ };
925
+ const targets = vue.computed(() => {
926
+ const value = vue.toValue(target);
927
+ const items = shared.toArray(value).map(unrefElement).filter(shared.notNullish);
928
+ return new Set(items);
929
+ });
930
+ const stopWatch = vue.watch(
931
+ () => targets.value,
932
+ (targets2) => {
933
+ cleanup();
934
+ if (isSupported.value && targets2.size) {
935
+ observer = new MutationObserver(callback);
936
+ targets2.forEach((el) => observer.observe(el, mutationOptions));
937
+ }
938
+ },
939
+ { immediate: true, flush: "post" }
940
+ );
941
+ const takeRecords = () => {
942
+ return observer == null ? void 0 : observer.takeRecords();
943
+ };
944
+ const stop = () => {
945
+ stopWatch();
946
+ cleanup();
947
+ };
948
+ shared.tryOnScopeDispose(stop);
949
+ return {
950
+ isSupported,
951
+ stop,
952
+ takeRecords
953
+ };
954
+ }
955
+
956
+ function useResizeObserver(target, callback, options = {}) {
957
+ const { window = defaultWindow, ...observerOptions } = options;
958
+ let observer;
959
+ const isSupported = useSupported(() => window && "ResizeObserver" in window);
960
+ const cleanup = () => {
961
+ if (observer) {
962
+ observer.disconnect();
963
+ observer = void 0;
964
+ }
965
+ };
966
+ const targets = vue.computed(() => {
967
+ const _targets = vue.toValue(target);
968
+ return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
969
+ });
970
+ const stopWatch = vue.watch(
971
+ targets,
972
+ (els) => {
973
+ cleanup();
974
+ if (isSupported.value && window) {
975
+ observer = new ResizeObserver(callback);
976
+ for (const _el of els) {
977
+ if (_el)
978
+ observer.observe(_el, observerOptions);
979
+ }
980
+ }
981
+ },
982
+ { immediate: true, flush: "post" }
983
+ );
984
+ const stop = () => {
985
+ cleanup();
986
+ stopWatch();
987
+ };
988
+ shared.tryOnScopeDispose(stop);
989
+ return {
990
+ isSupported,
991
+ stop
992
+ };
993
+ }
994
+
995
+ function useElementBounding(target, options = {}) {
996
+ const {
997
+ reset = true,
998
+ windowResize = true,
999
+ windowScroll = true,
1000
+ immediate = true,
1001
+ updateTiming = "sync"
1002
+ } = options;
1003
+ const height = vue.ref(0);
1004
+ const bottom = vue.ref(0);
1005
+ const left = vue.ref(0);
1006
+ const right = vue.ref(0);
1007
+ const top = vue.ref(0);
1008
+ const width = vue.ref(0);
1009
+ const x = vue.ref(0);
1010
+ const y = vue.ref(0);
1011
+ function recalculate() {
1012
+ const el = unrefElement(target);
1013
+ if (!el) {
1014
+ if (reset) {
1015
+ height.value = 0;
1016
+ bottom.value = 0;
1017
+ left.value = 0;
1018
+ right.value = 0;
1019
+ top.value = 0;
1020
+ width.value = 0;
1021
+ x.value = 0;
1022
+ y.value = 0;
1023
+ }
1024
+ return;
1025
+ }
1026
+ const rect = el.getBoundingClientRect();
1027
+ height.value = rect.height;
1028
+ bottom.value = rect.bottom;
1029
+ left.value = rect.left;
1030
+ right.value = rect.right;
1031
+ top.value = rect.top;
1032
+ width.value = rect.width;
1033
+ x.value = rect.x;
1034
+ y.value = rect.y;
1035
+ }
1036
+ function update() {
1037
+ if (updateTiming === "sync")
1038
+ recalculate();
1039
+ else if (updateTiming === "next-frame")
1040
+ requestAnimationFrame(() => recalculate());
1041
+ }
1042
+ useResizeObserver(target, update);
1043
+ vue.watch(() => unrefElement(target), (ele) => !ele && update());
1044
+ useMutationObserver(target, update, {
1045
+ attributeFilter: ["style", "class"]
1046
+ });
1047
+ if (windowScroll)
1048
+ useEventListener("scroll", update, { capture: true, passive: true });
1049
+ if (windowResize)
1050
+ useEventListener("resize", update, { passive: true });
1051
+ shared.tryOnMounted(() => {
1052
+ if (immediate)
1053
+ update();
1054
+ });
1055
+ return {
1056
+ height,
1057
+ bottom,
1058
+ left,
1059
+ right,
1060
+ top,
1061
+ width,
1062
+ x,
1063
+ y,
1064
+ update
1065
+ };
1066
+ }
1067
+
1068
+ const vElementBounding = {
1069
+ mounted(el, binding) {
1070
+ const [handler, options] = typeof binding.value === "function" ? [binding.value, {}] : binding.value;
1071
+ const {
1072
+ height,
1073
+ bottom,
1074
+ left,
1075
+ right,
1076
+ top,
1077
+ width,
1078
+ x,
1079
+ y
1080
+ } = useElementBounding(el, options);
1081
+ vue.watch([height, bottom, left, right, top, width, x, y], () => handler({ height, bottom, left, right, top, width, x, y }));
1082
+ }
1083
+ };
1084
+
1085
+ function onElementRemoval(target, callback, options = {}) {
1086
+ const {
1087
+ window = defaultWindow,
1088
+ document = window == null ? void 0 : window.document,
1089
+ flush = "sync"
1090
+ } = options;
1091
+ if (!window || !document)
1092
+ return shared.noop;
1093
+ let stopFn;
1094
+ const cleanupAndUpdate = (fn) => {
1095
+ stopFn == null ? void 0 : stopFn();
1096
+ stopFn = fn;
1097
+ };
1098
+ const stopWatch = vue.watchEffect(() => {
1099
+ const el = unrefElement(target);
1100
+ if (el) {
1101
+ const { stop } = useMutationObserver(
1102
+ document,
1103
+ (mutationsList) => {
1104
+ const targetRemoved = mutationsList.map((mutation) => [...mutation.removedNodes]).flat().some((node) => node === el || node.contains(el));
1105
+ if (targetRemoved) {
1106
+ callback(mutationsList);
1107
+ }
1108
+ },
1109
+ {
1110
+ window,
1111
+ childList: true,
1112
+ subtree: true
1113
+ }
1114
+ );
1115
+ cleanupAndUpdate(stop);
1116
+ }
1117
+ }, { flush });
1118
+ const stopHandle = () => {
1119
+ stopWatch();
1120
+ cleanupAndUpdate();
1121
+ };
1122
+ shared.tryOnScopeDispose(stopHandle);
1123
+ return stopHandle;
1124
+ }
1125
+
917
1126
  function useElementHover(el, options = {}) {
918
1127
  const {
919
1128
  delayEnter = 0,
920
1129
  delayLeave = 0,
1130
+ triggerOnRemoval = false,
921
1131
  window = defaultWindow
922
1132
  } = options;
923
1133
  const isHovered = vue.ref(false);
@@ -937,6 +1147,12 @@
937
1147
  return isHovered;
938
1148
  useEventListener(el, "mouseenter", () => toggle(true), { passive: true });
939
1149
  useEventListener(el, "mouseleave", () => toggle(false), { passive: true });
1150
+ if (triggerOnRemoval) {
1151
+ onElementRemoval(
1152
+ vue.computed(() => unrefElement(el)),
1153
+ () => toggle(false)
1154
+ );
1155
+ }
940
1156
  return isHovered;
941
1157
  }
942
1158
 
@@ -967,45 +1183,6 @@
967
1183
  }
968
1184
  });
969
1185
 
970
- function useResizeObserver(target, callback, options = {}) {
971
- const { window = defaultWindow, ...observerOptions } = options;
972
- let observer;
973
- const isSupported = useSupported(() => window && "ResizeObserver" in window);
974
- const cleanup = () => {
975
- if (observer) {
976
- observer.disconnect();
977
- observer = void 0;
978
- }
979
- };
980
- const targets = vue.computed(() => {
981
- const _targets = shared.toValue(target);
982
- return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
983
- });
984
- const stopWatch = vue.watch(
985
- targets,
986
- (els) => {
987
- cleanup();
988
- if (isSupported.value && window) {
989
- observer = new ResizeObserver(callback);
990
- for (const _el of els) {
991
- if (_el)
992
- observer.observe(_el, observerOptions);
993
- }
994
- }
995
- },
996
- { immediate: true, flush: "post" }
997
- );
998
- const stop = () => {
999
- cleanup();
1000
- stopWatch();
1001
- };
1002
- shared.tryOnScopeDispose(stop);
1003
- return {
1004
- isSupported,
1005
- stop
1006
- };
1007
- }
1008
-
1009
1186
  function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
1010
1187
  const { window = defaultWindow, box = "content-box" } = options;
1011
1188
  const isSVG = vue.computed(() => {
@@ -1027,7 +1204,7 @@
1027
1204
  }
1028
1205
  } else {
1029
1206
  if (boxSize) {
1030
- const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
1207
+ const formatBoxSize = shared.toArray(boxSize);
1031
1208
  width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
1032
1209
  height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
1033
1210
  } else {
@@ -1098,8 +1275,8 @@
1098
1275
  } = options;
1099
1276
  const isSupported = useSupported(() => window && "IntersectionObserver" in window);
1100
1277
  const targets = vue.computed(() => {
1101
- const _target = shared.toValue(target);
1102
- return (Array.isArray(_target) ? _target : [_target]).map(unrefElement).filter(shared.notNullish);
1278
+ const _target = vue.toValue(target);
1279
+ return shared.toArray(_target).map(unrefElement).filter(shared.notNullish);
1103
1280
  });
1104
1281
  let cleanup = shared.noop;
1105
1282
  const isActive = vue.ref(immediate);
@@ -1172,7 +1349,7 @@
1172
1349
  root: scrollTarget,
1173
1350
  window,
1174
1351
  threshold,
1175
- rootMargin: shared.toValue(rootMargin)
1352
+ rootMargin: vue.toValue(rootMargin)
1176
1353
  }
1177
1354
  );
1178
1355
  return elementIsVisible;
@@ -1338,7 +1515,7 @@
1338
1515
  }
1339
1516
  function useImage(options, asyncStateOptions = {}) {
1340
1517
  const state = useAsyncState(
1341
- () => loadImage(shared.toValue(options)),
1518
+ () => loadImage(vue.toValue(options)),
1342
1519
  void 0,
1343
1520
  {
1344
1521
  resetOnExecute: true,
@@ -1346,7 +1523,7 @@
1346
1523
  }
1347
1524
  );
1348
1525
  vue.watch(
1349
- () => shared.toValue(options),
1526
+ () => vue.toValue(options),
1350
1527
  () => state.execute(asyncStateOptions.delay),
1351
1528
  { deep: true }
1352
1529
  );
@@ -1439,13 +1616,13 @@
1439
1616
  var _a, _b, _c, _d;
1440
1617
  if (!window)
1441
1618
  return;
1442
- const _element = shared.toValue(element);
1619
+ const _element = vue.toValue(element);
1443
1620
  if (!_element)
1444
1621
  return;
1445
1622
  (_c = _element instanceof Document ? window.document.body : _element) == null ? void 0 : _c.scrollTo({
1446
- top: (_a = shared.toValue(_y)) != null ? _a : y.value,
1447
- left: (_b = shared.toValue(_x)) != null ? _b : x.value,
1448
- behavior: shared.toValue(behavior)
1623
+ top: (_a = vue.toValue(_y)) != null ? _a : y.value,
1624
+ left: (_b = vue.toValue(_x)) != null ? _b : x.value,
1625
+ behavior: vue.toValue(behavior)
1449
1626
  });
1450
1627
  const scrollContainer = ((_d = _element == null ? void 0 : _element.document) == null ? void 0 : _d.documentElement) || (_element == null ? void 0 : _element.documentElement) || _element;
1451
1628
  if (x != null)
@@ -1531,7 +1708,7 @@
1531
1708
  );
1532
1709
  shared.tryOnMounted(() => {
1533
1710
  try {
1534
- const _element = shared.toValue(element);
1711
+ const _element = vue.toValue(element);
1535
1712
  if (!_element)
1536
1713
  return;
1537
1714
  setArrivedState(_element);
@@ -1552,7 +1729,7 @@
1552
1729
  arrivedState,
1553
1730
  directions,
1554
1731
  measure() {
1555
- const _element = shared.toValue(element);
1732
+ const _element = vue.toValue(element);
1556
1733
  if (window && _element)
1557
1734
  setArrivedState(_element);
1558
1735
  }
@@ -1579,7 +1756,7 @@
1579
1756
  const promise = vue.ref();
1580
1757
  const isLoading = vue.computed(() => !!promise.value);
1581
1758
  const observedElement = vue.computed(() => {
1582
- return resolveElement(shared.toValue(element));
1759
+ return resolveElement(vue.toValue(element));
1583
1760
  });
1584
1761
  const isElementVisible = useElementVisibility(observedElement);
1585
1762
  function checkAndLoad() {
@@ -1657,6 +1834,156 @@
1657
1834
  }
1658
1835
  });
1659
1836
 
1837
+ const UseMouseBuiltinExtractors = {
1838
+ page: (event) => [event.pageX, event.pageY],
1839
+ client: (event) => [event.clientX, event.clientY],
1840
+ screen: (event) => [event.screenX, event.screenY],
1841
+ movement: (event) => event instanceof Touch ? null : [event.movementX, event.movementY]
1842
+ };
1843
+ function useMouse(options = {}) {
1844
+ const {
1845
+ type = "page",
1846
+ touch = true,
1847
+ resetOnTouchEnds = false,
1848
+ initialValue = { x: 0, y: 0 },
1849
+ window = defaultWindow,
1850
+ target = window,
1851
+ scroll = true,
1852
+ eventFilter
1853
+ } = options;
1854
+ let _prevMouseEvent = null;
1855
+ let _prevScrollX = 0;
1856
+ let _prevScrollY = 0;
1857
+ const x = vue.ref(initialValue.x);
1858
+ const y = vue.ref(initialValue.y);
1859
+ const sourceType = vue.ref(null);
1860
+ const extractor = typeof type === "function" ? type : UseMouseBuiltinExtractors[type];
1861
+ const mouseHandler = (event) => {
1862
+ const result = extractor(event);
1863
+ _prevMouseEvent = event;
1864
+ if (result) {
1865
+ [x.value, y.value] = result;
1866
+ sourceType.value = "mouse";
1867
+ }
1868
+ if (window) {
1869
+ _prevScrollX = window.scrollX;
1870
+ _prevScrollY = window.scrollY;
1871
+ }
1872
+ };
1873
+ const touchHandler = (event) => {
1874
+ if (event.touches.length > 0) {
1875
+ const result = extractor(event.touches[0]);
1876
+ if (result) {
1877
+ [x.value, y.value] = result;
1878
+ sourceType.value = "touch";
1879
+ }
1880
+ }
1881
+ };
1882
+ const scrollHandler = () => {
1883
+ if (!_prevMouseEvent || !window)
1884
+ return;
1885
+ const pos = extractor(_prevMouseEvent);
1886
+ if (_prevMouseEvent instanceof MouseEvent && pos) {
1887
+ x.value = pos[0] + window.scrollX - _prevScrollX;
1888
+ y.value = pos[1] + window.scrollY - _prevScrollY;
1889
+ }
1890
+ };
1891
+ const reset = () => {
1892
+ x.value = initialValue.x;
1893
+ y.value = initialValue.y;
1894
+ };
1895
+ const mouseHandlerWrapper = eventFilter ? (event) => eventFilter(() => mouseHandler(event), {}) : (event) => mouseHandler(event);
1896
+ const touchHandlerWrapper = eventFilter ? (event) => eventFilter(() => touchHandler(event), {}) : (event) => touchHandler(event);
1897
+ const scrollHandlerWrapper = eventFilter ? () => eventFilter(() => scrollHandler(), {}) : () => scrollHandler();
1898
+ if (target) {
1899
+ const listenerOptions = { passive: true };
1900
+ useEventListener(target, ["mousemove", "dragover"], mouseHandlerWrapper, listenerOptions);
1901
+ if (touch && type !== "movement") {
1902
+ useEventListener(target, ["touchstart", "touchmove"], touchHandlerWrapper, listenerOptions);
1903
+ if (resetOnTouchEnds)
1904
+ useEventListener(target, "touchend", reset, listenerOptions);
1905
+ }
1906
+ if (scroll && type === "page")
1907
+ useEventListener(window, "scroll", scrollHandlerWrapper, { passive: true });
1908
+ }
1909
+ return {
1910
+ x,
1911
+ y,
1912
+ sourceType
1913
+ };
1914
+ }
1915
+
1916
+ function useMouseInElement(target, options = {}) {
1917
+ const {
1918
+ handleOutside = true,
1919
+ window = defaultWindow
1920
+ } = options;
1921
+ const type = options.type || "page";
1922
+ const { x, y, sourceType } = useMouse(options);
1923
+ const targetRef = vue.ref(target != null ? target : window == null ? void 0 : window.document.body);
1924
+ const elementX = vue.ref(0);
1925
+ const elementY = vue.ref(0);
1926
+ const elementPositionX = vue.ref(0);
1927
+ const elementPositionY = vue.ref(0);
1928
+ const elementHeight = vue.ref(0);
1929
+ const elementWidth = vue.ref(0);
1930
+ const isOutside = vue.ref(true);
1931
+ let stop = () => {
1932
+ };
1933
+ if (window) {
1934
+ stop = vue.watch(
1935
+ [targetRef, x, y],
1936
+ () => {
1937
+ const el = unrefElement(targetRef);
1938
+ if (!el || !(el instanceof Element))
1939
+ return;
1940
+ const {
1941
+ left,
1942
+ top,
1943
+ width,
1944
+ height
1945
+ } = el.getBoundingClientRect();
1946
+ elementPositionX.value = left + (type === "page" ? window.pageXOffset : 0);
1947
+ elementPositionY.value = top + (type === "page" ? window.pageYOffset : 0);
1948
+ elementHeight.value = height;
1949
+ elementWidth.value = width;
1950
+ const elX = x.value - elementPositionX.value;
1951
+ const elY = y.value - elementPositionY.value;
1952
+ isOutside.value = width === 0 || height === 0 || elX < 0 || elY < 0 || elX > width || elY > height;
1953
+ if (handleOutside || !isOutside.value) {
1954
+ elementX.value = elX;
1955
+ elementY.value = elY;
1956
+ }
1957
+ },
1958
+ { immediate: true }
1959
+ );
1960
+ useEventListener(document, "mouseleave", () => {
1961
+ isOutside.value = true;
1962
+ });
1963
+ }
1964
+ return {
1965
+ x,
1966
+ y,
1967
+ sourceType,
1968
+ elementX,
1969
+ elementY,
1970
+ elementPositionX,
1971
+ elementPositionY,
1972
+ elementHeight,
1973
+ elementWidth,
1974
+ isOutside,
1975
+ stop
1976
+ };
1977
+ }
1978
+
1979
+ const vMouseInElement = {
1980
+ mounted(el, binding) {
1981
+ const [handler, options] = typeof binding.value === "function" ? [binding.value, {}] : binding.value;
1982
+ const state = shared.reactiveOmit(vue.reactive(useMouseInElement(el, options)), "stop");
1983
+ vue.watch(state, (val) => handler(val));
1984
+ }
1985
+ };
1986
+
1660
1987
  const UseMousePressed = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
1661
1988
  name: "UseMousePressed",
1662
1989
  props: ["touch", "initialValue", "as"],
@@ -1895,47 +2222,6 @@
1895
2222
  }
1896
2223
  };
1897
2224
 
1898
- function useMutationObserver(target, callback, options = {}) {
1899
- const { window = defaultWindow, ...mutationOptions } = options;
1900
- let observer;
1901
- const isSupported = useSupported(() => window && "MutationObserver" in window);
1902
- const cleanup = () => {
1903
- if (observer) {
1904
- observer.disconnect();
1905
- observer = void 0;
1906
- }
1907
- };
1908
- const targets = vue.computed(() => {
1909
- const value = shared.toValue(target);
1910
- const items = (Array.isArray(value) ? value : [value]).map(unrefElement).filter(shared.notNullish);
1911
- return new Set(items);
1912
- });
1913
- const stopWatch = vue.watch(
1914
- () => targets.value,
1915
- (targets2) => {
1916
- cleanup();
1917
- if (isSupported.value && targets2.size) {
1918
- observer = new MutationObserver(callback);
1919
- targets2.forEach((el) => observer.observe(el, mutationOptions));
1920
- }
1921
- },
1922
- { immediate: true, flush: "post" }
1923
- );
1924
- const takeRecords = () => {
1925
- return observer == null ? void 0 : observer.takeRecords();
1926
- };
1927
- const stop = () => {
1928
- stopWatch();
1929
- cleanup();
1930
- };
1931
- shared.tryOnScopeDispose(stop);
1932
- return {
1933
- isSupported,
1934
- stop,
1935
- takeRecords
1936
- };
1937
- }
1938
-
1939
2225
  function useCssVar(prop, target, options = {}) {
1940
2226
  const { window = defaultWindow, initialValue, observe = false } = options;
1941
2227
  const variable = vue.ref(initialValue);
@@ -1945,8 +2231,8 @@
1945
2231
  });
1946
2232
  function updateCssVar() {
1947
2233
  var _a;
1948
- const key = shared.toValue(prop);
1949
- const el = shared.toValue(elRef);
2234
+ const key = vue.toValue(prop);
2235
+ const el = vue.toValue(elRef);
1950
2236
  if (el && window && key) {
1951
2237
  const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
1952
2238
  variable.value = value || initialValue;
@@ -1959,7 +2245,7 @@
1959
2245
  });
1960
2246
  }
1961
2247
  vue.watch(
1962
- [elRef, () => shared.toValue(prop)],
2248
+ [elRef, () => vue.toValue(prop)],
1963
2249
  (_, old) => {
1964
2250
  if (old[0] && old[1])
1965
2251
  old[0].style.removeProperty(old[1]);
@@ -1971,7 +2257,7 @@
1971
2257
  variable,
1972
2258
  (val) => {
1973
2259
  var _a;
1974
- const raw_prop = shared.toValue(prop);
2260
+ const raw_prop = vue.toValue(prop);
1975
2261
  if (((_a = elRef.value) == null ? void 0 : _a.style) && raw_prop) {
1976
2262
  if (val == null)
1977
2263
  elRef.value.style.removeProperty(raw_prop);
@@ -2115,7 +2401,7 @@
2115
2401
  let stopTouchMoveListener = null;
2116
2402
  let initialOverflow = "";
2117
2403
  vue.watch(shared.toRef(element), (el) => {
2118
- const target = resolveElement(shared.toValue(el));
2404
+ const target = resolveElement(vue.toValue(el));
2119
2405
  if (target) {
2120
2406
  const ele = target;
2121
2407
  if (!elInitialOverflow.get(ele))
@@ -2131,7 +2417,7 @@
2131
2417
  immediate: true
2132
2418
  });
2133
2419
  const lock = () => {
2134
- const el = resolveElement(shared.toValue(element));
2420
+ const el = resolveElement(vue.toValue(element));
2135
2421
  if (!el || isLocked.value)
2136
2422
  return;
2137
2423
  if (shared.isIOS) {
@@ -2148,7 +2434,7 @@
2148
2434
  isLocked.value = true;
2149
2435
  };
2150
2436
  const unlock = () => {
2151
- const el = resolveElement(shared.toValue(element));
2437
+ const el = resolveElement(vue.toValue(element));
2152
2438
  if (!el || !isLocked.value)
2153
2439
  return;
2154
2440
  if (shared.isIOS)
@@ -2299,11 +2585,13 @@
2299
2585
  exports.UseWindowSize = UseWindowSize;
2300
2586
  exports.VOnClickOutside = vOnClickOutside;
2301
2587
  exports.VOnLongPress = vOnLongPress;
2588
+ exports.vElementBounding = vElementBounding;
2302
2589
  exports.vElementHover = vElementHover;
2303
2590
  exports.vElementSize = vElementSize;
2304
2591
  exports.vElementVisibility = vElementVisibility;
2305
2592
  exports.vInfiniteScroll = vInfiniteScroll;
2306
2593
  exports.vIntersectionObserver = vIntersectionObserver;
2594
+ exports.vMouseInElement = vMouseInElement;
2307
2595
  exports.vOnClickOutside = vOnClickOutside;
2308
2596
  exports.vOnKeyStroke = vOnKeyStroke;
2309
2597
  exports.vOnLongPress = vOnLongPress;