@vueuse/components 12.3.0 → 12.5.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 CHANGED
@@ -20,58 +20,59 @@ const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
20
20
  }
21
21
  });
22
22
 
23
- const defaultWindow = shared.isClient ? window : void 0;
23
+ const defaultWindow = shared.isClient ? window : undefined;
24
24
 
25
25
  function unrefElement(elRef) {
26
26
  var _a;
27
27
  const plain = vue.toValue(elRef);
28
- return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
28
+ return (_a = plain == null ? undefined : plain.$el) != null ? _a : plain;
29
29
  }
30
30
 
31
31
  function useEventListener(...args) {
32
- let target;
33
- let events;
34
- let listeners;
35
- let options;
36
- if (typeof args[0] === "string" || Array.isArray(args[0])) {
37
- [events, listeners, options] = args;
38
- target = defaultWindow;
39
- } else {
40
- [target, events, listeners, options] = args;
41
- }
42
- if (!target)
43
- return shared.noop;
44
- events = shared.toArray(events);
45
- listeners = shared.toArray(listeners);
46
32
  const cleanups = [];
47
33
  const cleanup = () => {
48
34
  cleanups.forEach((fn) => fn());
49
35
  cleanups.length = 0;
50
36
  };
51
- const register = (el, event, listener, options2) => {
52
- el.addEventListener(event, listener, options2);
53
- return () => el.removeEventListener(event, listener, options2);
37
+ const register = (el, event, listener, options) => {
38
+ el.addEventListener(event, listener, options);
39
+ return () => el.removeEventListener(event, listener, options);
54
40
  };
55
- const stopWatch = vue.watch(
56
- () => [unrefElement(target), vue.toValue(options)],
57
- ([el, options2]) => {
41
+ const firstParamTargets = vue.computed(() => {
42
+ const test = shared.toArray(vue.toValue(args[0])).filter((e) => e != null);
43
+ return test.every((e) => typeof e !== "string") ? test : undefined;
44
+ });
45
+ const stopWatch = shared.watchImmediate(
46
+ () => {
47
+ var _a, _b;
48
+ return [
49
+ (_b = (_a = firstParamTargets.value) == null ? undefined : _a.map((e) => unrefElement(e))) != null ? _b : [defaultWindow].filter((e) => e != null),
50
+ shared.toArray(vue.toValue(firstParamTargets.value ? args[1] : args[0])),
51
+ shared.toArray(vue.unref(firstParamTargets.value ? args[2] : args[1])),
52
+ // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
53
+ vue.toValue(firstParamTargets.value ? args[3] : args[2])
54
+ ];
55
+ },
56
+ ([raw_targets, raw_events, raw_listeners, raw_options]) => {
58
57
  cleanup();
59
- if (!el)
58
+ if (!(raw_targets == null ? undefined : raw_targets.length) || !(raw_events == null ? undefined : raw_events.length) || !(raw_listeners == null ? undefined : raw_listeners.length))
60
59
  return;
61
- const optionsClone = shared.isObject(options2) ? { ...options2 } : options2;
60
+ const optionsClone = shared.isObject(raw_options) ? { ...raw_options } : raw_options;
62
61
  cleanups.push(
63
- ...events.flatMap((event) => {
64
- return listeners.map((listener) => register(el, event, listener, optionsClone));
65
- })
62
+ ...raw_targets.flatMap(
63
+ (el) => raw_events.flatMap(
64
+ (event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone))
65
+ )
66
+ )
66
67
  );
67
68
  },
68
- { immediate: true, flush: "post" }
69
+ { flush: "post" }
69
70
  );
70
71
  const stop = () => {
71
72
  stopWatch();
72
73
  cleanup();
73
74
  };
74
- shared.tryOnScopeDispose(stop);
75
+ shared.tryOnScopeDispose(cleanup);
75
76
  return stop;
76
77
  }
77
78
 
@@ -82,8 +83,9 @@ function onClickOutside(target, handler, options = {}) {
82
83
  return shared.noop;
83
84
  if (shared.isIOS && !_iOSWorkaround) {
84
85
  _iOSWorkaround = true;
85
- Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", shared.noop));
86
- window.document.documentElement.addEventListener("click", shared.noop);
86
+ const listenerOptions = { passive: true };
87
+ Array.from(window.document.body.children).forEach((el) => useEventListener(el, "click", shared.noop, listenerOptions));
88
+ useEventListener(window.document.documentElement, "click", shared.noop, listenerOptions);
87
89
  }
88
90
  let shouldListen = true;
89
91
  const shouldIgnore = (event) => {
@@ -142,11 +144,11 @@ function onClickOutside(target, handler, options = {}) {
142
144
  setTimeout(() => {
143
145
  var _a;
144
146
  const el = unrefElement(target);
145
- if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement))) {
147
+ if (((_a = window.document.activeElement) == null ? undefined : _a.tagName) === "IFRAME" && !(el == null ? undefined : el.contains(window.document.activeElement))) {
146
148
  handler(event);
147
149
  }
148
150
  }, 0);
149
- })
151
+ }, { passive: true })
150
152
  ].filter(Boolean);
151
153
  const stop = () => cleanup.forEach((fn) => fn());
152
154
  return stop;
@@ -216,7 +218,7 @@ function onKeyStroke(...args) {
216
218
  const vOnKeyStroke = {
217
219
  mounted(el, binding) {
218
220
  var _a, _b;
219
- const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
221
+ const keys = (_b = (_a = binding.arg) == null ? undefined : _a.split(",")) != null ? _b : true;
220
222
  if (typeof binding.value === "function") {
221
223
  onKeyStroke(keys, binding.value, {
222
224
  target: el
@@ -243,23 +245,23 @@ function onLongPress(target, handler, options) {
243
245
  function clear() {
244
246
  if (timeout) {
245
247
  clearTimeout(timeout);
246
- timeout = void 0;
248
+ timeout = undefined;
247
249
  }
248
- posStart = void 0;
249
- startTimestamp = void 0;
250
+ posStart = undefined;
251
+ startTimestamp = undefined;
250
252
  hasLongPressed = false;
251
253
  }
252
254
  function onRelease(ev) {
253
255
  var _a2, _b2, _c;
254
256
  const [_startTimestamp, _posStart, _hasLongPressed] = [startTimestamp, posStart, hasLongPressed];
255
257
  clear();
256
- if (!(options == null ? void 0 : options.onMouseUp) || !_posStart || !_startTimestamp)
258
+ if (!(options == null ? undefined : options.onMouseUp) || !_posStart || !_startTimestamp)
257
259
  return;
258
- if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
260
+ if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)
259
261
  return;
260
- if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
262
+ if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)
261
263
  ev.preventDefault();
262
- if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
264
+ if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)
263
265
  ev.stopPropagation();
264
266
  const dx = ev.x - _posStart.x;
265
267
  const dy = ev.y - _posStart.y;
@@ -268,12 +270,12 @@ function onLongPress(target, handler, options) {
268
270
  }
269
271
  function onDown(ev) {
270
272
  var _a2, _b2, _c, _d;
271
- if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
273
+ if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)
272
274
  return;
273
275
  clear();
274
- if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
276
+ if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)
275
277
  ev.preventDefault();
276
- if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
278
+ if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)
277
279
  ev.stopPropagation();
278
280
  posStart = {
279
281
  x: ev.x,
@@ -285,28 +287,28 @@ function onLongPress(target, handler, options) {
285
287
  hasLongPressed = true;
286
288
  handler(ev);
287
289
  },
288
- (_d = options == null ? void 0 : options.delay) != null ? _d : DEFAULT_DELAY
290
+ (_d = options == null ? undefined : options.delay) != null ? _d : DEFAULT_DELAY
289
291
  );
290
292
  }
291
293
  function onMove(ev) {
292
294
  var _a2, _b2, _c, _d;
293
- if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
295
+ if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)
294
296
  return;
295
- if (!posStart || (options == null ? void 0 : options.distanceThreshold) === false)
297
+ if (!posStart || (options == null ? undefined : options.distanceThreshold) === false)
296
298
  return;
297
- if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
299
+ if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)
298
300
  ev.preventDefault();
299
- if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
301
+ if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)
300
302
  ev.stopPropagation();
301
303
  const dx = ev.x - posStart.x;
302
304
  const dy = ev.y - posStart.y;
303
305
  const distance = Math.sqrt(dx * dx + dy * dy);
304
- if (distance >= ((_d = options == null ? void 0 : options.distanceThreshold) != null ? _d : DEFAULT_THRESHOLD))
306
+ if (distance >= ((_d = options == null ? undefined : options.distanceThreshold) != null ? _d : DEFAULT_THRESHOLD))
305
307
  clear();
306
308
  }
307
309
  const listenerOptions = {
308
- capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
309
- once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
310
+ capture: (_a = options == null ? undefined : options.modifiers) == null ? undefined : _a.capture,
311
+ once: (_b = options == null ? undefined : options.modifiers) == null ? undefined : _b.once
310
312
  };
311
313
  const cleanup = [
312
314
  useEventListener(elementRef, "pointerdown", onDown, listenerOptions),
@@ -394,7 +396,7 @@ const UseClipboard = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
394
396
  const data = vue.reactive(core.useClipboard(props));
395
397
  return () => {
396
398
  var _a;
397
- return (_a = slots.default) == null ? void 0 : _a.call(slots, data);
399
+ return (_a = slots.default) == null ? undefined : _a.call(slots, data);
398
400
  };
399
401
  }
400
402
  });
@@ -414,7 +416,7 @@ function getSSRHandler(key, fallback) {
414
416
  const ssrWidthSymbol = Symbol("vueuse-ssr-width");
415
417
  function useSSRWidth() {
416
418
  const ssrWidth = vue.hasInjectionContext() ? shared.injectLocal(ssrWidthSymbol, null) : null;
417
- return typeof ssrWidth === "number" ? ssrWidth : void 0;
419
+ return typeof ssrWidth === "number" ? ssrWidth : undefined;
418
420
  }
419
421
 
420
422
  function useMounted() {
@@ -440,20 +442,12 @@ function useMediaQuery(query, options = {}) {
440
442
  const { window = defaultWindow, ssrWidth = useSSRWidth() } = options;
441
443
  const isSupported = useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function");
442
444
  const ssrSupport = vue.ref(typeof ssrWidth === "number");
443
- let mediaQuery;
445
+ const mediaQuery = vue.shallowRef();
444
446
  const matches = vue.ref(false);
445
447
  const handler = (event) => {
446
448
  matches.value = event.matches;
447
449
  };
448
- const cleanup = () => {
449
- if (!mediaQuery)
450
- return;
451
- if ("removeEventListener" in mediaQuery)
452
- mediaQuery.removeEventListener("change", handler);
453
- else
454
- mediaQuery.removeListener(handler);
455
- };
456
- const stopWatch = vue.watchEffect(() => {
450
+ vue.watchEffect(() => {
457
451
  if (ssrSupport.value) {
458
452
  ssrSupport.value = !isSupported.value;
459
453
  const queryStrings = vue.toValue(query).split(",");
@@ -474,19 +468,10 @@ function useMediaQuery(query, options = {}) {
474
468
  }
475
469
  if (!isSupported.value)
476
470
  return;
477
- cleanup();
478
- mediaQuery = window.matchMedia(vue.toValue(query));
479
- if ("addEventListener" in mediaQuery)
480
- mediaQuery.addEventListener("change", handler);
481
- else
482
- mediaQuery.addListener(handler);
483
- matches.value = mediaQuery.matches;
484
- });
485
- shared.tryOnScopeDispose(() => {
486
- stopWatch();
487
- cleanup();
488
- mediaQuery = void 0;
471
+ mediaQuery.value = window.matchMedia(vue.toValue(query));
472
+ matches.value = mediaQuery.value.matches;
489
473
  });
474
+ useEventListener(mediaQuery, "change", handler, { passive: true });
490
475
  return vue.computed(() => matches.value);
491
476
  }
492
477
 
@@ -550,6 +535,7 @@ function useStorage(key, defaults, storage, options = {}) {
550
535
  initOnMounted
551
536
  } = options;
552
537
  const data = (shallow ? vue.shallowRef : vue.ref)(typeof defaults === "function" ? defaults() : defaults);
538
+ const keyComputed = vue.computed(() => vue.toValue(key));
553
539
  if (!storage) {
554
540
  try {
555
541
  storage = getSSRHandler("getDefaultStorage", () => {
@@ -570,10 +556,11 @@ function useStorage(key, defaults, storage, options = {}) {
570
556
  () => write(data.value),
571
557
  { flush, deep, eventFilter }
572
558
  );
559
+ vue.watch(keyComputed, () => update(), { flush });
573
560
  if (window && listenToStorageChanges) {
574
561
  shared.tryOnMounted(() => {
575
562
  if (storage instanceof Storage)
576
- useEventListener(window, "storage", update);
563
+ useEventListener(window, "storage", update, { passive: true });
577
564
  else
578
565
  useEventListener(window, customStorageEventName, updateFromCustomEvent);
579
566
  if (initOnMounted)
@@ -585,7 +572,7 @@ function useStorage(key, defaults, storage, options = {}) {
585
572
  function dispatchWriteEvent(oldValue, newValue) {
586
573
  if (window) {
587
574
  const payload = {
588
- key,
575
+ key: keyComputed.value,
589
576
  oldValue,
590
577
  newValue,
591
578
  storageArea: storage
@@ -597,14 +584,14 @@ function useStorage(key, defaults, storage, options = {}) {
597
584
  }
598
585
  function write(v) {
599
586
  try {
600
- const oldValue = storage.getItem(key);
587
+ const oldValue = storage.getItem(keyComputed.value);
601
588
  if (v == null) {
602
589
  dispatchWriteEvent(oldValue, null);
603
- storage.removeItem(key);
590
+ storage.removeItem(keyComputed.value);
604
591
  } else {
605
592
  const serialized = serializer.write(v);
606
593
  if (oldValue !== serialized) {
607
- storage.setItem(key, serialized);
594
+ storage.setItem(keyComputed.value, serialized);
608
595
  dispatchWriteEvent(oldValue, serialized);
609
596
  }
610
597
  }
@@ -613,10 +600,10 @@ function useStorage(key, defaults, storage, options = {}) {
613
600
  }
614
601
  }
615
602
  function read(event) {
616
- const rawValue = event ? event.newValue : storage.getItem(key);
603
+ const rawValue = event ? event.newValue : storage.getItem(keyComputed.value);
617
604
  if (rawValue == null) {
618
605
  if (writeDefaults && rawInit != null)
619
- storage.setItem(key, serializer.write(rawInit));
606
+ storage.setItem(keyComputed.value, serializer.write(rawInit));
620
607
  return rawInit;
621
608
  } else if (!event && mergeDefaults) {
622
609
  const value = serializer.read(rawValue);
@@ -638,7 +625,7 @@ function useStorage(key, defaults, storage, options = {}) {
638
625
  data.value = rawInit;
639
626
  return;
640
627
  }
641
- if (event && event.key !== key)
628
+ if (event && event.key !== keyComputed.value)
642
629
  return;
643
630
  pauseWatch();
644
631
  try {
@@ -686,7 +673,7 @@ function useColorMode(options = {}) {
686
673
  const updateHTMLAttrs = getSSRHandler(
687
674
  "updateHTMLAttrs",
688
675
  (selector2, attribute2, value) => {
689
- const el = typeof selector2 === "string" ? window == null ? void 0 : window.document.querySelector(selector2) : unrefElement(selector2);
676
+ const el = typeof selector2 === "string" ? window == null ? undefined : window.document.querySelector(selector2) : unrefElement(selector2);
690
677
  if (!el)
691
678
  return;
692
679
  const classesToAdd = /* @__PURE__ */ new Set();
@@ -870,18 +857,18 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
870
857
  });
871
858
  const containerElement = vue.computed(() => {
872
859
  var _a;
873
- return (_a = props.containerElement) != null ? _a : void 0;
860
+ return (_a = props.containerElement) != null ? _a : undefined;
874
861
  });
875
862
  const disabled = vue.computed(() => !!props.disabled);
876
863
  const storageValue = props.storageKey && core.useStorage(
877
864
  props.storageKey,
878
865
  vue.toValue(props.initialValue) || { x: 0, y: 0 },
879
- core.isClient ? props.storageType === "session" ? sessionStorage : localStorage : void 0
866
+ core.isClient ? props.storageType === "session" ? sessionStorage : localStorage : undefined
880
867
  );
881
868
  const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
882
869
  const onEnd = (position, event) => {
883
870
  var _a;
884
- (_a = props.onEnd) == null ? void 0 : _a.call(props, position, event);
871
+ (_a = props.onEnd) == null ? undefined : _a.call(props, position, event);
885
872
  if (!storageValue)
886
873
  return;
887
874
  storageValue.value.x = position.x;
@@ -922,7 +909,7 @@ function useMutationObserver(target, callback, options = {}) {
922
909
  const cleanup = () => {
923
910
  if (observer) {
924
911
  observer.disconnect();
925
- observer = void 0;
912
+ observer = undefined;
926
913
  }
927
914
  };
928
915
  const targets = vue.computed(() => {
@@ -942,7 +929,7 @@ function useMutationObserver(target, callback, options = {}) {
942
929
  { immediate: true, flush: "post" }
943
930
  );
944
931
  const takeRecords = () => {
945
- return observer == null ? void 0 : observer.takeRecords();
932
+ return observer == null ? undefined : observer.takeRecords();
946
933
  };
947
934
  const stop = () => {
948
935
  stopWatch();
@@ -963,7 +950,7 @@ function useResizeObserver(target, callback, options = {}) {
963
950
  const cleanup = () => {
964
951
  if (observer) {
965
952
  observer.disconnect();
966
- observer = void 0;
953
+ observer = undefined;
967
954
  }
968
955
  };
969
956
  const targets = vue.computed(() => {
@@ -1088,14 +1075,14 @@ const vElementBounding = {
1088
1075
  function onElementRemoval(target, callback, options = {}) {
1089
1076
  const {
1090
1077
  window = defaultWindow,
1091
- document = window == null ? void 0 : window.document,
1078
+ document = window == null ? undefined : window.document,
1092
1079
  flush = "sync"
1093
1080
  } = options;
1094
1081
  if (!window || !document)
1095
1082
  return shared.noop;
1096
1083
  let stopFn;
1097
1084
  const cleanupAndUpdate = (fn) => {
1098
- stopFn == null ? void 0 : stopFn();
1085
+ stopFn == null ? undefined : stopFn();
1099
1086
  stopFn = fn;
1100
1087
  };
1101
1088
  const stopWatch = vue.watchEffect(() => {
@@ -1139,7 +1126,7 @@ function useElementHover(el, options = {}) {
1139
1126
  const delay = entering ? delayEnter : delayLeave;
1140
1127
  if (timer) {
1141
1128
  clearTimeout(timer);
1142
- timer = void 0;
1129
+ timer = undefined;
1143
1130
  }
1144
1131
  if (delay)
1145
1132
  timer = setTimeout(() => isHovered.value = entering, delay);
@@ -1190,7 +1177,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
1190
1177
  const { window = defaultWindow, box = "content-box" } = options;
1191
1178
  const isSVG = vue.computed(() => {
1192
1179
  var _a, _b;
1193
- return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
1180
+ return (_b = (_a = unrefElement(target)) == null ? undefined : _a.namespaceURI) == null ? undefined : _b.includes("svg");
1194
1181
  });
1195
1182
  const width = vue.ref(initialSize.width);
1196
1183
  const height = vue.ref(initialSize.height);
@@ -1246,7 +1233,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
1246
1233
  const vElementSize = {
1247
1234
  mounted(el, binding) {
1248
1235
  var _a;
1249
- const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? void 0 : _a[0];
1236
+ const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? undefined : _a[0];
1250
1237
  const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
1251
1238
  const { width, height } = useElementSize(el, ...options);
1252
1239
  vue.watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
@@ -1436,11 +1423,11 @@ function useAsyncState(promise, initialState, options) {
1436
1423
  const state = shallow ? vue.shallowRef(initialState) : vue.ref(initialState);
1437
1424
  const isReady = vue.ref(false);
1438
1425
  const isLoading = vue.ref(false);
1439
- const error = vue.shallowRef(void 0);
1426
+ const error = vue.shallowRef(undefined);
1440
1427
  async function execute(delay2 = 0, ...args) {
1441
1428
  if (resetOnExecute)
1442
1429
  state.value = initialState;
1443
- error.value = void 0;
1430
+ error.value = undefined;
1444
1431
  isReady.value = false;
1445
1432
  isLoading.value = true;
1446
1433
  if (delay2 > 0)
@@ -1461,8 +1448,9 @@ function useAsyncState(promise, initialState, options) {
1461
1448
  }
1462
1449
  return state.value;
1463
1450
  }
1464
- if (immediate)
1451
+ if (immediate) {
1465
1452
  execute(delay);
1453
+ }
1466
1454
  const shell = {
1467
1455
  state,
1468
1456
  isReady,
@@ -1519,7 +1507,7 @@ async function loadImage(options) {
1519
1507
  function useImage(options, asyncStateOptions = {}) {
1520
1508
  const state = useAsyncState(
1521
1509
  () => loadImage(vue.toValue(options)),
1522
- void 0,
1510
+ undefined,
1523
1511
  {
1524
1512
  resetOnExecute: true,
1525
1513
  ...asyncStateOptions
@@ -1604,7 +1592,7 @@ function useScroll(element, options = {}) {
1604
1592
  return internalX.value;
1605
1593
  },
1606
1594
  set(x2) {
1607
- scrollTo(x2, void 0);
1595
+ scrollTo(x2, undefined);
1608
1596
  }
1609
1597
  });
1610
1598
  const y = vue.computed({
@@ -1612,7 +1600,7 @@ function useScroll(element, options = {}) {
1612
1600
  return internalY.value;
1613
1601
  },
1614
1602
  set(y2) {
1615
- scrollTo(void 0, y2);
1603
+ scrollTo(undefined, y2);
1616
1604
  }
1617
1605
  });
1618
1606
  function scrollTo(_x, _y) {
@@ -1622,12 +1610,12 @@ function useScroll(element, options = {}) {
1622
1610
  const _element = vue.toValue(element);
1623
1611
  if (!_element)
1624
1612
  return;
1625
- (_c = _element instanceof Document ? window.document.body : _element) == null ? void 0 : _c.scrollTo({
1613
+ (_c = _element instanceof Document ? window.document.body : _element) == null ? undefined : _c.scrollTo({
1626
1614
  top: (_a = vue.toValue(_y)) != null ? _a : y.value,
1627
1615
  left: (_b = vue.toValue(_x)) != null ? _b : x.value,
1628
1616
  behavior: vue.toValue(behavior)
1629
1617
  });
1630
- const scrollContainer = ((_d = _element == null ? void 0 : _element.document) == null ? void 0 : _d.documentElement) || (_element == null ? void 0 : _element.documentElement) || _element;
1618
+ const scrollContainer = ((_d = _element == null ? undefined : _element.document) == null ? undefined : _d.documentElement) || (_element == null ? undefined : _element.documentElement) || _element;
1631
1619
  if (x != null)
1632
1620
  internalX.value = scrollContainer.scrollLeft;
1633
1621
  if (y != null)
@@ -1661,7 +1649,7 @@ function useScroll(element, options = {}) {
1661
1649
  var _a;
1662
1650
  if (!window)
1663
1651
  return;
1664
- const el = ((_a = target == null ? void 0 : target.document) == null ? void 0 : _a.documentElement) || (target == null ? void 0 : target.documentElement) || unrefElement(target);
1652
+ const el = ((_a = target == null ? undefined : target.document) == null ? undefined : _a.documentElement) || (target == null ? undefined : target.documentElement) || unrefElement(target);
1665
1653
  const { display, flexDirection, direction } = getComputedStyle(el);
1666
1654
  const directionMultipler = direction === "rtl" ? -1 : 1;
1667
1655
  const scrollLeft = el.scrollLeft;
@@ -1907,7 +1895,7 @@ function useMouse(options = {}) {
1907
1895
  useEventListener(target, "touchend", reset, listenerOptions);
1908
1896
  }
1909
1897
  if (scroll && type === "page")
1910
- useEventListener(window, "scroll", scrollHandlerWrapper, { passive: true });
1898
+ useEventListener(window, "scroll", scrollHandlerWrapper, listenerOptions);
1911
1899
  }
1912
1900
  return {
1913
1901
  x,
@@ -1923,7 +1911,7 @@ function useMouseInElement(target, options = {}) {
1923
1911
  } = options;
1924
1912
  const type = options.type || "page";
1925
1913
  const { x, y, sourceType } = useMouse(options);
1926
- const targetRef = vue.ref(target != null ? target : window == null ? void 0 : window.document.body);
1914
+ const targetRef = vue.ref(target != null ? target : window == null ? undefined : window.document.body);
1927
1915
  const elementX = vue.ref(0);
1928
1916
  const elementY = vue.ref(0);
1929
1917
  const elementPositionX = vue.ref(0);
@@ -1960,9 +1948,12 @@ function useMouseInElement(target, options = {}) {
1960
1948
  },
1961
1949
  { immediate: true }
1962
1950
  );
1963
- useEventListener(document, "mouseleave", () => {
1964
- isOutside.value = true;
1965
- });
1951
+ useEventListener(
1952
+ document,
1953
+ "mouseleave",
1954
+ () => isOutside.value = true,
1955
+ { passive: true }
1956
+ );
1966
1957
  }
1967
1958
  return {
1968
1959
  x,
@@ -2058,17 +2049,17 @@ const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent(
2058
2049
  ...props,
2059
2050
  onPageChange(...args) {
2060
2051
  var _a;
2061
- (_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
2052
+ (_a = props.onPageChange) == null ? undefined : _a.call(props, ...args);
2062
2053
  emit("page-change", ...args);
2063
2054
  },
2064
2055
  onPageSizeChange(...args) {
2065
2056
  var _a;
2066
- (_a = props.onPageSizeChange) == null ? void 0 : _a.call(props, ...args);
2057
+ (_a = props.onPageSizeChange) == null ? undefined : _a.call(props, ...args);
2067
2058
  emit("page-size-change", ...args);
2068
2059
  },
2069
2060
  onPageCountChange(...args) {
2070
2061
  var _a;
2071
- (_a = props.onPageCountChange) == null ? void 0 : _a.call(props, ...args);
2062
+ (_a = props.onPageCountChange) == null ? undefined : _a.call(props, ...args);
2072
2063
  emit("page-count-change", ...args);
2073
2064
  }
2074
2065
  }));
@@ -2230,14 +2221,14 @@ function useCssVar(prop, target, options = {}) {
2230
2221
  const variable = vue.ref(initialValue);
2231
2222
  const elRef = vue.computed(() => {
2232
2223
  var _a;
2233
- return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
2224
+ return unrefElement(target) || ((_a = window == null ? undefined : window.document) == null ? undefined : _a.documentElement);
2234
2225
  });
2235
2226
  function updateCssVar() {
2236
2227
  var _a;
2237
2228
  const key = vue.toValue(prop);
2238
2229
  const el = vue.toValue(elRef);
2239
2230
  if (el && window && key) {
2240
- const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
2231
+ const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? undefined : _a.trim();
2241
2232
  variable.value = value || initialValue;
2242
2233
  }
2243
2234
  }
@@ -2261,7 +2252,7 @@ function useCssVar(prop, target, options = {}) {
2261
2252
  (val) => {
2262
2253
  var _a;
2263
2254
  const raw_prop = vue.toValue(prop);
2264
- if (((_a = elRef.value) == null ? void 0 : _a.style) && raw_prop) {
2255
+ if (((_a = elRef.value) == null ? undefined : _a.style) && raw_prop) {
2265
2256
  if (val == null)
2266
2257
  elRef.value.style.removeProperty(raw_prop);
2267
2258
  else
@@ -2291,7 +2282,7 @@ function useScreenSafeArea() {
2291
2282
  bottomCssVar.value = "env(safe-area-inset-bottom, 0px)";
2292
2283
  leftCssVar.value = "env(safe-area-inset-left, 0px)";
2293
2284
  update();
2294
- useEventListener("resize", shared.useDebounceFn(update));
2285
+ useEventListener("resize", shared.useDebounceFn(update), { passive: true });
2295
2286
  }
2296
2287
  function update() {
2297
2288
  top.value = getValue(topVarName);
@@ -2363,12 +2354,12 @@ const vScroll = {
2363
2354
  ...options,
2364
2355
  onScroll(e) {
2365
2356
  var _a;
2366
- (_a = options.onScroll) == null ? void 0 : _a.call(options, e);
2357
+ (_a = options.onScroll) == null ? undefined : _a.call(options, e);
2367
2358
  handler(state);
2368
2359
  },
2369
2360
  onStop(e) {
2370
2361
  var _a;
2371
- (_a = options.onStop) == null ? void 0 : _a.call(options, e);
2362
+ (_a = options.onStop) == null ? undefined : _a.call(options, e);
2372
2363
  handler(state);
2373
2364
  }
2374
2365
  });
@@ -2441,7 +2432,7 @@ function useScrollLock(element, initialState = false) {
2441
2432
  if (!el || !isLocked.value)
2442
2433
  return;
2443
2434
  if (shared.isIOS)
2444
- stopTouchMoveListener == null ? void 0 : stopTouchMoveListener();
2435
+ stopTouchMoveListener == null ? undefined : stopTouchMoveListener();
2445
2436
  el.style.overflow = initialOverflow;
2446
2437
  elInitialOverflow.delete(el);
2447
2438
  isLocked.value = false;