@vueuse/components 12.3.0 → 12.4.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.mjs CHANGED
@@ -18,12 +18,12 @@ const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
18
18
  }
19
19
  });
20
20
 
21
- const defaultWindow = isClient ? window : void 0;
21
+ const defaultWindow = isClient ? window : undefined;
22
22
 
23
23
  function unrefElement(elRef) {
24
24
  var _a;
25
25
  const plain = toValue(elRef);
26
- return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
26
+ return (_a = plain == null ? undefined : plain.$el) != null ? _a : plain;
27
27
  }
28
28
 
29
29
  function useEventListener(...args) {
@@ -140,11 +140,11 @@ function onClickOutside(target, handler, options = {}) {
140
140
  setTimeout(() => {
141
141
  var _a;
142
142
  const el = unrefElement(target);
143
- if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement))) {
143
+ if (((_a = window.document.activeElement) == null ? undefined : _a.tagName) === "IFRAME" && !(el == null ? undefined : el.contains(window.document.activeElement))) {
144
144
  handler(event);
145
145
  }
146
146
  }, 0);
147
- })
147
+ }, { passive: true })
148
148
  ].filter(Boolean);
149
149
  const stop = () => cleanup.forEach((fn) => fn());
150
150
  return stop;
@@ -214,7 +214,7 @@ function onKeyStroke(...args) {
214
214
  const vOnKeyStroke = {
215
215
  mounted(el, binding) {
216
216
  var _a, _b;
217
- const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
217
+ const keys = (_b = (_a = binding.arg) == null ? undefined : _a.split(",")) != null ? _b : true;
218
218
  if (typeof binding.value === "function") {
219
219
  onKeyStroke(keys, binding.value, {
220
220
  target: el
@@ -241,23 +241,23 @@ function onLongPress(target, handler, options) {
241
241
  function clear() {
242
242
  if (timeout) {
243
243
  clearTimeout(timeout);
244
- timeout = void 0;
244
+ timeout = undefined;
245
245
  }
246
- posStart = void 0;
247
- startTimestamp = void 0;
246
+ posStart = undefined;
247
+ startTimestamp = undefined;
248
248
  hasLongPressed = false;
249
249
  }
250
250
  function onRelease(ev) {
251
251
  var _a2, _b2, _c;
252
252
  const [_startTimestamp, _posStart, _hasLongPressed] = [startTimestamp, posStart, hasLongPressed];
253
253
  clear();
254
- if (!(options == null ? void 0 : options.onMouseUp) || !_posStart || !_startTimestamp)
254
+ if (!(options == null ? undefined : options.onMouseUp) || !_posStart || !_startTimestamp)
255
255
  return;
256
- if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
256
+ if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)
257
257
  return;
258
- if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
258
+ if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)
259
259
  ev.preventDefault();
260
- if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
260
+ if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)
261
261
  ev.stopPropagation();
262
262
  const dx = ev.x - _posStart.x;
263
263
  const dy = ev.y - _posStart.y;
@@ -266,12 +266,12 @@ function onLongPress(target, handler, options) {
266
266
  }
267
267
  function onDown(ev) {
268
268
  var _a2, _b2, _c, _d;
269
- if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
269
+ if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)
270
270
  return;
271
271
  clear();
272
- if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
272
+ if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)
273
273
  ev.preventDefault();
274
- if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
274
+ if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)
275
275
  ev.stopPropagation();
276
276
  posStart = {
277
277
  x: ev.x,
@@ -283,28 +283,28 @@ function onLongPress(target, handler, options) {
283
283
  hasLongPressed = true;
284
284
  handler(ev);
285
285
  },
286
- (_d = options == null ? void 0 : options.delay) != null ? _d : DEFAULT_DELAY
286
+ (_d = options == null ? undefined : options.delay) != null ? _d : DEFAULT_DELAY
287
287
  );
288
288
  }
289
289
  function onMove(ev) {
290
290
  var _a2, _b2, _c, _d;
291
- if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
291
+ if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)
292
292
  return;
293
- if (!posStart || (options == null ? void 0 : options.distanceThreshold) === false)
293
+ if (!posStart || (options == null ? undefined : options.distanceThreshold) === false)
294
294
  return;
295
- if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
295
+ if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)
296
296
  ev.preventDefault();
297
- if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
297
+ if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)
298
298
  ev.stopPropagation();
299
299
  const dx = ev.x - posStart.x;
300
300
  const dy = ev.y - posStart.y;
301
301
  const distance = Math.sqrt(dx * dx + dy * dy);
302
- if (distance >= ((_d = options == null ? void 0 : options.distanceThreshold) != null ? _d : DEFAULT_THRESHOLD))
302
+ if (distance >= ((_d = options == null ? undefined : options.distanceThreshold) != null ? _d : DEFAULT_THRESHOLD))
303
303
  clear();
304
304
  }
305
305
  const listenerOptions = {
306
- capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
307
- once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
306
+ capture: (_a = options == null ? undefined : options.modifiers) == null ? undefined : _a.capture,
307
+ once: (_b = options == null ? undefined : options.modifiers) == null ? undefined : _b.once
308
308
  };
309
309
  const cleanup = [
310
310
  useEventListener(elementRef, "pointerdown", onDown, listenerOptions),
@@ -392,7 +392,7 @@ const UseClipboard = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
392
392
  const data = reactive(useClipboard(props));
393
393
  return () => {
394
394
  var _a;
395
- return (_a = slots.default) == null ? void 0 : _a.call(slots, data);
395
+ return (_a = slots.default) == null ? undefined : _a.call(slots, data);
396
396
  };
397
397
  }
398
398
  });
@@ -412,7 +412,7 @@ function getSSRHandler(key, fallback) {
412
412
  const ssrWidthSymbol = Symbol("vueuse-ssr-width");
413
413
  function useSSRWidth() {
414
414
  const ssrWidth = hasInjectionContext() ? injectLocal(ssrWidthSymbol, null) : null;
415
- return typeof ssrWidth === "number" ? ssrWidth : void 0;
415
+ return typeof ssrWidth === "number" ? ssrWidth : undefined;
416
416
  }
417
417
 
418
418
  function useMounted() {
@@ -483,7 +483,7 @@ function useMediaQuery(query, options = {}) {
483
483
  tryOnScopeDispose(() => {
484
484
  stopWatch();
485
485
  cleanup();
486
- mediaQuery = void 0;
486
+ mediaQuery = undefined;
487
487
  });
488
488
  return computed(() => matches.value);
489
489
  }
@@ -548,6 +548,7 @@ function useStorage(key, defaults, storage, options = {}) {
548
548
  initOnMounted
549
549
  } = options;
550
550
  const data = (shallow ? shallowRef : ref)(typeof defaults === "function" ? defaults() : defaults);
551
+ const keyComputed = computed(() => toValue(key));
551
552
  if (!storage) {
552
553
  try {
553
554
  storage = getSSRHandler("getDefaultStorage", () => {
@@ -568,10 +569,11 @@ function useStorage(key, defaults, storage, options = {}) {
568
569
  () => write(data.value),
569
570
  { flush, deep, eventFilter }
570
571
  );
572
+ watch(keyComputed, () => update(), { flush });
571
573
  if (window && listenToStorageChanges) {
572
574
  tryOnMounted(() => {
573
575
  if (storage instanceof Storage)
574
- useEventListener(window, "storage", update);
576
+ useEventListener(window, "storage", update, { passive: true });
575
577
  else
576
578
  useEventListener(window, customStorageEventName, updateFromCustomEvent);
577
579
  if (initOnMounted)
@@ -583,7 +585,7 @@ function useStorage(key, defaults, storage, options = {}) {
583
585
  function dispatchWriteEvent(oldValue, newValue) {
584
586
  if (window) {
585
587
  const payload = {
586
- key,
588
+ key: keyComputed.value,
587
589
  oldValue,
588
590
  newValue,
589
591
  storageArea: storage
@@ -595,14 +597,14 @@ function useStorage(key, defaults, storage, options = {}) {
595
597
  }
596
598
  function write(v) {
597
599
  try {
598
- const oldValue = storage.getItem(key);
600
+ const oldValue = storage.getItem(keyComputed.value);
599
601
  if (v == null) {
600
602
  dispatchWriteEvent(oldValue, null);
601
- storage.removeItem(key);
603
+ storage.removeItem(keyComputed.value);
602
604
  } else {
603
605
  const serialized = serializer.write(v);
604
606
  if (oldValue !== serialized) {
605
- storage.setItem(key, serialized);
607
+ storage.setItem(keyComputed.value, serialized);
606
608
  dispatchWriteEvent(oldValue, serialized);
607
609
  }
608
610
  }
@@ -611,10 +613,10 @@ function useStorage(key, defaults, storage, options = {}) {
611
613
  }
612
614
  }
613
615
  function read(event) {
614
- const rawValue = event ? event.newValue : storage.getItem(key);
616
+ const rawValue = event ? event.newValue : storage.getItem(keyComputed.value);
615
617
  if (rawValue == null) {
616
618
  if (writeDefaults && rawInit != null)
617
- storage.setItem(key, serializer.write(rawInit));
619
+ storage.setItem(keyComputed.value, serializer.write(rawInit));
618
620
  return rawInit;
619
621
  } else if (!event && mergeDefaults) {
620
622
  const value = serializer.read(rawValue);
@@ -636,7 +638,7 @@ function useStorage(key, defaults, storage, options = {}) {
636
638
  data.value = rawInit;
637
639
  return;
638
640
  }
639
- if (event && event.key !== key)
641
+ if (event && event.key !== keyComputed.value)
640
642
  return;
641
643
  pauseWatch();
642
644
  try {
@@ -684,7 +686,7 @@ function useColorMode(options = {}) {
684
686
  const updateHTMLAttrs = getSSRHandler(
685
687
  "updateHTMLAttrs",
686
688
  (selector2, attribute2, value) => {
687
- const el = typeof selector2 === "string" ? window == null ? void 0 : window.document.querySelector(selector2) : unrefElement(selector2);
689
+ const el = typeof selector2 === "string" ? window == null ? undefined : window.document.querySelector(selector2) : unrefElement(selector2);
688
690
  if (!el)
689
691
  return;
690
692
  const classesToAdd = /* @__PURE__ */ new Set();
@@ -868,18 +870,18 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
868
870
  });
869
871
  const containerElement = computed(() => {
870
872
  var _a;
871
- return (_a = props.containerElement) != null ? _a : void 0;
873
+ return (_a = props.containerElement) != null ? _a : undefined;
872
874
  });
873
875
  const disabled = computed(() => !!props.disabled);
874
876
  const storageValue = props.storageKey && useStorage$1(
875
877
  props.storageKey,
876
878
  toValue(props.initialValue) || { x: 0, y: 0 },
877
- isClient$1 ? props.storageType === "session" ? sessionStorage : localStorage : void 0
879
+ isClient$1 ? props.storageType === "session" ? sessionStorage : localStorage : undefined
878
880
  );
879
881
  const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
880
882
  const onEnd = (position, event) => {
881
883
  var _a;
882
- (_a = props.onEnd) == null ? void 0 : _a.call(props, position, event);
884
+ (_a = props.onEnd) == null ? undefined : _a.call(props, position, event);
883
885
  if (!storageValue)
884
886
  return;
885
887
  storageValue.value.x = position.x;
@@ -920,7 +922,7 @@ function useMutationObserver(target, callback, options = {}) {
920
922
  const cleanup = () => {
921
923
  if (observer) {
922
924
  observer.disconnect();
923
- observer = void 0;
925
+ observer = undefined;
924
926
  }
925
927
  };
926
928
  const targets = computed(() => {
@@ -940,7 +942,7 @@ function useMutationObserver(target, callback, options = {}) {
940
942
  { immediate: true, flush: "post" }
941
943
  );
942
944
  const takeRecords = () => {
943
- return observer == null ? void 0 : observer.takeRecords();
945
+ return observer == null ? undefined : observer.takeRecords();
944
946
  };
945
947
  const stop = () => {
946
948
  stopWatch();
@@ -961,7 +963,7 @@ function useResizeObserver(target, callback, options = {}) {
961
963
  const cleanup = () => {
962
964
  if (observer) {
963
965
  observer.disconnect();
964
- observer = void 0;
966
+ observer = undefined;
965
967
  }
966
968
  };
967
969
  const targets = computed(() => {
@@ -1086,14 +1088,14 @@ const vElementBounding = {
1086
1088
  function onElementRemoval(target, callback, options = {}) {
1087
1089
  const {
1088
1090
  window = defaultWindow,
1089
- document = window == null ? void 0 : window.document,
1091
+ document = window == null ? undefined : window.document,
1090
1092
  flush = "sync"
1091
1093
  } = options;
1092
1094
  if (!window || !document)
1093
1095
  return noop;
1094
1096
  let stopFn;
1095
1097
  const cleanupAndUpdate = (fn) => {
1096
- stopFn == null ? void 0 : stopFn();
1098
+ stopFn == null ? undefined : stopFn();
1097
1099
  stopFn = fn;
1098
1100
  };
1099
1101
  const stopWatch = watchEffect(() => {
@@ -1137,7 +1139,7 @@ function useElementHover(el, options = {}) {
1137
1139
  const delay = entering ? delayEnter : delayLeave;
1138
1140
  if (timer) {
1139
1141
  clearTimeout(timer);
1140
- timer = void 0;
1142
+ timer = undefined;
1141
1143
  }
1142
1144
  if (delay)
1143
1145
  timer = setTimeout(() => isHovered.value = entering, delay);
@@ -1188,7 +1190,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
1188
1190
  const { window = defaultWindow, box = "content-box" } = options;
1189
1191
  const isSVG = computed(() => {
1190
1192
  var _a, _b;
1191
- return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
1193
+ return (_b = (_a = unrefElement(target)) == null ? undefined : _a.namespaceURI) == null ? undefined : _b.includes("svg");
1192
1194
  });
1193
1195
  const width = ref(initialSize.width);
1194
1196
  const height = ref(initialSize.height);
@@ -1244,7 +1246,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
1244
1246
  const vElementSize = {
1245
1247
  mounted(el, binding) {
1246
1248
  var _a;
1247
- const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? void 0 : _a[0];
1249
+ const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? undefined : _a[0];
1248
1250
  const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
1249
1251
  const { width, height } = useElementSize(el, ...options);
1250
1252
  watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
@@ -1434,11 +1436,11 @@ function useAsyncState(promise, initialState, options) {
1434
1436
  const state = shallow ? shallowRef(initialState) : ref(initialState);
1435
1437
  const isReady = ref(false);
1436
1438
  const isLoading = ref(false);
1437
- const error = shallowRef(void 0);
1439
+ const error = shallowRef(undefined);
1438
1440
  async function execute(delay2 = 0, ...args) {
1439
1441
  if (resetOnExecute)
1440
1442
  state.value = initialState;
1441
- error.value = void 0;
1443
+ error.value = undefined;
1442
1444
  isReady.value = false;
1443
1445
  isLoading.value = true;
1444
1446
  if (delay2 > 0)
@@ -1459,8 +1461,9 @@ function useAsyncState(promise, initialState, options) {
1459
1461
  }
1460
1462
  return state.value;
1461
1463
  }
1462
- if (immediate)
1464
+ if (immediate) {
1463
1465
  execute(delay);
1466
+ }
1464
1467
  const shell = {
1465
1468
  state,
1466
1469
  isReady,
@@ -1517,7 +1520,7 @@ async function loadImage(options) {
1517
1520
  function useImage(options, asyncStateOptions = {}) {
1518
1521
  const state = useAsyncState(
1519
1522
  () => loadImage(toValue(options)),
1520
- void 0,
1523
+ undefined,
1521
1524
  {
1522
1525
  resetOnExecute: true,
1523
1526
  ...asyncStateOptions
@@ -1602,7 +1605,7 @@ function useScroll(element, options = {}) {
1602
1605
  return internalX.value;
1603
1606
  },
1604
1607
  set(x2) {
1605
- scrollTo(x2, void 0);
1608
+ scrollTo(x2, undefined);
1606
1609
  }
1607
1610
  });
1608
1611
  const y = computed({
@@ -1610,7 +1613,7 @@ function useScroll(element, options = {}) {
1610
1613
  return internalY.value;
1611
1614
  },
1612
1615
  set(y2) {
1613
- scrollTo(void 0, y2);
1616
+ scrollTo(undefined, y2);
1614
1617
  }
1615
1618
  });
1616
1619
  function scrollTo(_x, _y) {
@@ -1620,12 +1623,12 @@ function useScroll(element, options = {}) {
1620
1623
  const _element = toValue(element);
1621
1624
  if (!_element)
1622
1625
  return;
1623
- (_c = _element instanceof Document ? window.document.body : _element) == null ? void 0 : _c.scrollTo({
1626
+ (_c = _element instanceof Document ? window.document.body : _element) == null ? undefined : _c.scrollTo({
1624
1627
  top: (_a = toValue(_y)) != null ? _a : y.value,
1625
1628
  left: (_b = toValue(_x)) != null ? _b : x.value,
1626
1629
  behavior: toValue(behavior)
1627
1630
  });
1628
- const scrollContainer = ((_d = _element == null ? void 0 : _element.document) == null ? void 0 : _d.documentElement) || (_element == null ? void 0 : _element.documentElement) || _element;
1631
+ const scrollContainer = ((_d = _element == null ? undefined : _element.document) == null ? undefined : _d.documentElement) || (_element == null ? undefined : _element.documentElement) || _element;
1629
1632
  if (x != null)
1630
1633
  internalX.value = scrollContainer.scrollLeft;
1631
1634
  if (y != null)
@@ -1659,7 +1662,7 @@ function useScroll(element, options = {}) {
1659
1662
  var _a;
1660
1663
  if (!window)
1661
1664
  return;
1662
- const el = ((_a = target == null ? void 0 : target.document) == null ? void 0 : _a.documentElement) || (target == null ? void 0 : target.documentElement) || unrefElement(target);
1665
+ const el = ((_a = target == null ? undefined : target.document) == null ? undefined : _a.documentElement) || (target == null ? undefined : target.documentElement) || unrefElement(target);
1663
1666
  const { display, flexDirection, direction } = getComputedStyle(el);
1664
1667
  const directionMultipler = direction === "rtl" ? -1 : 1;
1665
1668
  const scrollLeft = el.scrollLeft;
@@ -1905,7 +1908,7 @@ function useMouse(options = {}) {
1905
1908
  useEventListener(target, "touchend", reset, listenerOptions);
1906
1909
  }
1907
1910
  if (scroll && type === "page")
1908
- useEventListener(window, "scroll", scrollHandlerWrapper, { passive: true });
1911
+ useEventListener(window, "scroll", scrollHandlerWrapper, listenerOptions);
1909
1912
  }
1910
1913
  return {
1911
1914
  x,
@@ -1921,7 +1924,7 @@ function useMouseInElement(target, options = {}) {
1921
1924
  } = options;
1922
1925
  const type = options.type || "page";
1923
1926
  const { x, y, sourceType } = useMouse(options);
1924
- const targetRef = ref(target != null ? target : window == null ? void 0 : window.document.body);
1927
+ const targetRef = ref(target != null ? target : window == null ? undefined : window.document.body);
1925
1928
  const elementX = ref(0);
1926
1929
  const elementY = ref(0);
1927
1930
  const elementPositionX = ref(0);
@@ -1958,9 +1961,12 @@ function useMouseInElement(target, options = {}) {
1958
1961
  },
1959
1962
  { immediate: true }
1960
1963
  );
1961
- useEventListener(document, "mouseleave", () => {
1962
- isOutside.value = true;
1963
- });
1964
+ useEventListener(
1965
+ document,
1966
+ "mouseleave",
1967
+ () => isOutside.value = true,
1968
+ { passive: true }
1969
+ );
1964
1970
  }
1965
1971
  return {
1966
1972
  x,
@@ -2056,17 +2062,17 @@ const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
2056
2062
  ...props,
2057
2063
  onPageChange(...args) {
2058
2064
  var _a;
2059
- (_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
2065
+ (_a = props.onPageChange) == null ? undefined : _a.call(props, ...args);
2060
2066
  emit("page-change", ...args);
2061
2067
  },
2062
2068
  onPageSizeChange(...args) {
2063
2069
  var _a;
2064
- (_a = props.onPageSizeChange) == null ? void 0 : _a.call(props, ...args);
2070
+ (_a = props.onPageSizeChange) == null ? undefined : _a.call(props, ...args);
2065
2071
  emit("page-size-change", ...args);
2066
2072
  },
2067
2073
  onPageCountChange(...args) {
2068
2074
  var _a;
2069
- (_a = props.onPageCountChange) == null ? void 0 : _a.call(props, ...args);
2075
+ (_a = props.onPageCountChange) == null ? undefined : _a.call(props, ...args);
2070
2076
  emit("page-count-change", ...args);
2071
2077
  }
2072
2078
  }));
@@ -2228,14 +2234,14 @@ function useCssVar(prop, target, options = {}) {
2228
2234
  const variable = ref(initialValue);
2229
2235
  const elRef = computed(() => {
2230
2236
  var _a;
2231
- return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
2237
+ return unrefElement(target) || ((_a = window == null ? undefined : window.document) == null ? undefined : _a.documentElement);
2232
2238
  });
2233
2239
  function updateCssVar() {
2234
2240
  var _a;
2235
2241
  const key = toValue(prop);
2236
2242
  const el = toValue(elRef);
2237
2243
  if (el && window && key) {
2238
- const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
2244
+ const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? undefined : _a.trim();
2239
2245
  variable.value = value || initialValue;
2240
2246
  }
2241
2247
  }
@@ -2259,7 +2265,7 @@ function useCssVar(prop, target, options = {}) {
2259
2265
  (val) => {
2260
2266
  var _a;
2261
2267
  const raw_prop = toValue(prop);
2262
- if (((_a = elRef.value) == null ? void 0 : _a.style) && raw_prop) {
2268
+ if (((_a = elRef.value) == null ? undefined : _a.style) && raw_prop) {
2263
2269
  if (val == null)
2264
2270
  elRef.value.style.removeProperty(raw_prop);
2265
2271
  else
@@ -2289,7 +2295,7 @@ function useScreenSafeArea() {
2289
2295
  bottomCssVar.value = "env(safe-area-inset-bottom, 0px)";
2290
2296
  leftCssVar.value = "env(safe-area-inset-left, 0px)";
2291
2297
  update();
2292
- useEventListener("resize", useDebounceFn(update));
2298
+ useEventListener("resize", useDebounceFn(update), { passive: true });
2293
2299
  }
2294
2300
  function update() {
2295
2301
  top.value = getValue(topVarName);
@@ -2361,12 +2367,12 @@ const vScroll = {
2361
2367
  ...options,
2362
2368
  onScroll(e) {
2363
2369
  var _a;
2364
- (_a = options.onScroll) == null ? void 0 : _a.call(options, e);
2370
+ (_a = options.onScroll) == null ? undefined : _a.call(options, e);
2365
2371
  handler(state);
2366
2372
  },
2367
2373
  onStop(e) {
2368
2374
  var _a;
2369
- (_a = options.onStop) == null ? void 0 : _a.call(options, e);
2375
+ (_a = options.onStop) == null ? undefined : _a.call(options, e);
2370
2376
  handler(state);
2371
2377
  }
2372
2378
  });
@@ -2439,7 +2445,7 @@ function useScrollLock(element, initialState = false) {
2439
2445
  if (!el || !isLocked.value)
2440
2446
  return;
2441
2447
  if (isIOS)
2442
- stopTouchMoveListener == null ? void 0 : stopTouchMoveListener();
2448
+ stopTouchMoveListener == null ? undefined : stopTouchMoveListener();
2443
2449
  el.style.overflow = initialOverflow;
2444
2450
  elInitialOverflow.delete(el);
2445
2451
  isLocked.value = false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vueuse/components",
3
3
  "type": "module",
4
- "version": "12.3.0",
4
+ "version": "12.4.0",
5
5
  "description": "Renderless components for VueUse",
6
6
  "author": "Jacob Clevenger<https://github.com/wheatjs>",
7
7
  "license": "MIT",
@@ -42,8 +42,8 @@
42
42
  ],
43
43
  "dependencies": {
44
44
  "vue": "^3.5.13",
45
- "@vueuse/core": "12.3.0",
46
- "@vueuse/shared": "12.3.0"
45
+ "@vueuse/core": "12.4.0",
46
+ "@vueuse/shared": "12.4.0"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "rollup --config=rollup.config.ts --configPlugin=rollup-plugin-esbuild"