@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.iife.js CHANGED
@@ -17,58 +17,59 @@
17
17
  }
18
18
  });
19
19
 
20
- const defaultWindow = shared.isClient ? window : void 0;
20
+ const defaultWindow = shared.isClient ? window : undefined;
21
21
 
22
22
  function unrefElement(elRef) {
23
23
  var _a;
24
24
  const plain = vue.toValue(elRef);
25
- return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
25
+ return (_a = plain == null ? undefined : plain.$el) != null ? _a : plain;
26
26
  }
27
27
 
28
28
  function useEventListener(...args) {
29
- let target;
30
- let events;
31
- let listeners;
32
- let options;
33
- if (typeof args[0] === "string" || Array.isArray(args[0])) {
34
- [events, listeners, options] = args;
35
- target = defaultWindow;
36
- } else {
37
- [target, events, listeners, options] = args;
38
- }
39
- if (!target)
40
- return shared.noop;
41
- events = shared.toArray(events);
42
- listeners = shared.toArray(listeners);
43
29
  const cleanups = [];
44
30
  const cleanup = () => {
45
31
  cleanups.forEach((fn) => fn());
46
32
  cleanups.length = 0;
47
33
  };
48
- const register = (el, event, listener, options2) => {
49
- el.addEventListener(event, listener, options2);
50
- return () => el.removeEventListener(event, listener, options2);
34
+ const register = (el, event, listener, options) => {
35
+ el.addEventListener(event, listener, options);
36
+ return () => el.removeEventListener(event, listener, options);
51
37
  };
52
- const stopWatch = vue.watch(
53
- () => [unrefElement(target), vue.toValue(options)],
54
- ([el, options2]) => {
38
+ const firstParamTargets = vue.computed(() => {
39
+ const test = shared.toArray(vue.toValue(args[0])).filter((e) => e != null);
40
+ return test.every((e) => typeof e !== "string") ? test : undefined;
41
+ });
42
+ const stopWatch = shared.watchImmediate(
43
+ () => {
44
+ var _a, _b;
45
+ return [
46
+ (_b = (_a = firstParamTargets.value) == null ? undefined : _a.map((e) => unrefElement(e))) != null ? _b : [defaultWindow].filter((e) => e != null),
47
+ shared.toArray(vue.toValue(firstParamTargets.value ? args[1] : args[0])),
48
+ shared.toArray(vue.unref(firstParamTargets.value ? args[2] : args[1])),
49
+ // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
50
+ vue.toValue(firstParamTargets.value ? args[3] : args[2])
51
+ ];
52
+ },
53
+ ([raw_targets, raw_events, raw_listeners, raw_options]) => {
55
54
  cleanup();
56
- if (!el)
55
+ if (!(raw_targets == null ? undefined : raw_targets.length) || !(raw_events == null ? undefined : raw_events.length) || !(raw_listeners == null ? undefined : raw_listeners.length))
57
56
  return;
58
- const optionsClone = shared.isObject(options2) ? { ...options2 } : options2;
57
+ const optionsClone = shared.isObject(raw_options) ? { ...raw_options } : raw_options;
59
58
  cleanups.push(
60
- ...events.flatMap((event) => {
61
- return listeners.map((listener) => register(el, event, listener, optionsClone));
62
- })
59
+ ...raw_targets.flatMap(
60
+ (el) => raw_events.flatMap(
61
+ (event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone))
62
+ )
63
+ )
63
64
  );
64
65
  },
65
- { immediate: true, flush: "post" }
66
+ { flush: "post" }
66
67
  );
67
68
  const stop = () => {
68
69
  stopWatch();
69
70
  cleanup();
70
71
  };
71
- shared.tryOnScopeDispose(stop);
72
+ shared.tryOnScopeDispose(cleanup);
72
73
  return stop;
73
74
  }
74
75
 
@@ -79,8 +80,9 @@
79
80
  return shared.noop;
80
81
  if (shared.isIOS && !_iOSWorkaround) {
81
82
  _iOSWorkaround = true;
82
- Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", shared.noop));
83
- window.document.documentElement.addEventListener("click", shared.noop);
83
+ const listenerOptions = { passive: true };
84
+ Array.from(window.document.body.children).forEach((el) => useEventListener(el, "click", shared.noop, listenerOptions));
85
+ useEventListener(window.document.documentElement, "click", shared.noop, listenerOptions);
84
86
  }
85
87
  let shouldListen = true;
86
88
  const shouldIgnore = (event) => {
@@ -139,11 +141,11 @@
139
141
  setTimeout(() => {
140
142
  var _a;
141
143
  const el = unrefElement(target);
142
- if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement))) {
144
+ if (((_a = window.document.activeElement) == null ? undefined : _a.tagName) === "IFRAME" && !(el == null ? undefined : el.contains(window.document.activeElement))) {
143
145
  handler(event);
144
146
  }
145
147
  }, 0);
146
- })
148
+ }, { passive: true })
147
149
  ].filter(Boolean);
148
150
  const stop = () => cleanup.forEach((fn) => fn());
149
151
  return stop;
@@ -213,7 +215,7 @@
213
215
  const vOnKeyStroke = {
214
216
  mounted(el, binding) {
215
217
  var _a, _b;
216
- const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
218
+ const keys = (_b = (_a = binding.arg) == null ? undefined : _a.split(",")) != null ? _b : true;
217
219
  if (typeof binding.value === "function") {
218
220
  onKeyStroke(keys, binding.value, {
219
221
  target: el
@@ -240,23 +242,23 @@
240
242
  function clear() {
241
243
  if (timeout) {
242
244
  clearTimeout(timeout);
243
- timeout = void 0;
245
+ timeout = undefined;
244
246
  }
245
- posStart = void 0;
246
- startTimestamp = void 0;
247
+ posStart = undefined;
248
+ startTimestamp = undefined;
247
249
  hasLongPressed = false;
248
250
  }
249
251
  function onRelease(ev) {
250
252
  var _a2, _b2, _c;
251
253
  const [_startTimestamp, _posStart, _hasLongPressed] = [startTimestamp, posStart, hasLongPressed];
252
254
  clear();
253
- if (!(options == null ? void 0 : options.onMouseUp) || !_posStart || !_startTimestamp)
255
+ if (!(options == null ? undefined : options.onMouseUp) || !_posStart || !_startTimestamp)
254
256
  return;
255
- if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
257
+ if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)
256
258
  return;
257
- if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
259
+ if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)
258
260
  ev.preventDefault();
259
- if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
261
+ if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)
260
262
  ev.stopPropagation();
261
263
  const dx = ev.x - _posStart.x;
262
264
  const dy = ev.y - _posStart.y;
@@ -265,12 +267,12 @@
265
267
  }
266
268
  function onDown(ev) {
267
269
  var _a2, _b2, _c, _d;
268
- if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
270
+ if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)
269
271
  return;
270
272
  clear();
271
- if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
273
+ if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)
272
274
  ev.preventDefault();
273
- if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
275
+ if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)
274
276
  ev.stopPropagation();
275
277
  posStart = {
276
278
  x: ev.x,
@@ -282,28 +284,28 @@
282
284
  hasLongPressed = true;
283
285
  handler(ev);
284
286
  },
285
- (_d = options == null ? void 0 : options.delay) != null ? _d : DEFAULT_DELAY
287
+ (_d = options == null ? undefined : options.delay) != null ? _d : DEFAULT_DELAY
286
288
  );
287
289
  }
288
290
  function onMove(ev) {
289
291
  var _a2, _b2, _c, _d;
290
- if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
292
+ if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)
291
293
  return;
292
- if (!posStart || (options == null ? void 0 : options.distanceThreshold) === false)
294
+ if (!posStart || (options == null ? undefined : options.distanceThreshold) === false)
293
295
  return;
294
- if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
296
+ if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)
295
297
  ev.preventDefault();
296
- if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
298
+ if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)
297
299
  ev.stopPropagation();
298
300
  const dx = ev.x - posStart.x;
299
301
  const dy = ev.y - posStart.y;
300
302
  const distance = Math.sqrt(dx * dx + dy * dy);
301
- if (distance >= ((_d = options == null ? void 0 : options.distanceThreshold) != null ? _d : DEFAULT_THRESHOLD))
303
+ if (distance >= ((_d = options == null ? undefined : options.distanceThreshold) != null ? _d : DEFAULT_THRESHOLD))
302
304
  clear();
303
305
  }
304
306
  const listenerOptions = {
305
- capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
306
- once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
307
+ capture: (_a = options == null ? undefined : options.modifiers) == null ? undefined : _a.capture,
308
+ once: (_b = options == null ? undefined : options.modifiers) == null ? undefined : _b.once
307
309
  };
308
310
  const cleanup = [
309
311
  useEventListener(elementRef, "pointerdown", onDown, listenerOptions),
@@ -391,7 +393,7 @@
391
393
  const data = vue.reactive(core.useClipboard(props));
392
394
  return () => {
393
395
  var _a;
394
- return (_a = slots.default) == null ? void 0 : _a.call(slots, data);
396
+ return (_a = slots.default) == null ? undefined : _a.call(slots, data);
395
397
  };
396
398
  }
397
399
  });
@@ -411,7 +413,7 @@
411
413
  const ssrWidthSymbol = Symbol("vueuse-ssr-width");
412
414
  function useSSRWidth() {
413
415
  const ssrWidth = vue.hasInjectionContext() ? shared.injectLocal(ssrWidthSymbol, null) : null;
414
- return typeof ssrWidth === "number" ? ssrWidth : void 0;
416
+ return typeof ssrWidth === "number" ? ssrWidth : undefined;
415
417
  }
416
418
 
417
419
  function useMounted() {
@@ -437,20 +439,12 @@
437
439
  const { window = defaultWindow, ssrWidth = useSSRWidth() } = options;
438
440
  const isSupported = useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function");
439
441
  const ssrSupport = vue.ref(typeof ssrWidth === "number");
440
- let mediaQuery;
442
+ const mediaQuery = vue.shallowRef();
441
443
  const matches = vue.ref(false);
442
444
  const handler = (event) => {
443
445
  matches.value = event.matches;
444
446
  };
445
- const cleanup = () => {
446
- if (!mediaQuery)
447
- return;
448
- if ("removeEventListener" in mediaQuery)
449
- mediaQuery.removeEventListener("change", handler);
450
- else
451
- mediaQuery.removeListener(handler);
452
- };
453
- const stopWatch = vue.watchEffect(() => {
447
+ vue.watchEffect(() => {
454
448
  if (ssrSupport.value) {
455
449
  ssrSupport.value = !isSupported.value;
456
450
  const queryStrings = vue.toValue(query).split(",");
@@ -471,19 +465,10 @@
471
465
  }
472
466
  if (!isSupported.value)
473
467
  return;
474
- cleanup();
475
- mediaQuery = window.matchMedia(vue.toValue(query));
476
- if ("addEventListener" in mediaQuery)
477
- mediaQuery.addEventListener("change", handler);
478
- else
479
- mediaQuery.addListener(handler);
480
- matches.value = mediaQuery.matches;
481
- });
482
- shared.tryOnScopeDispose(() => {
483
- stopWatch();
484
- cleanup();
485
- mediaQuery = void 0;
468
+ mediaQuery.value = window.matchMedia(vue.toValue(query));
469
+ matches.value = mediaQuery.value.matches;
486
470
  });
471
+ useEventListener(mediaQuery, "change", handler, { passive: true });
487
472
  return vue.computed(() => matches.value);
488
473
  }
489
474
 
@@ -547,6 +532,7 @@
547
532
  initOnMounted
548
533
  } = options;
549
534
  const data = (shallow ? vue.shallowRef : vue.ref)(typeof defaults === "function" ? defaults() : defaults);
535
+ const keyComputed = vue.computed(() => vue.toValue(key));
550
536
  if (!storage) {
551
537
  try {
552
538
  storage = getSSRHandler("getDefaultStorage", () => {
@@ -567,10 +553,11 @@
567
553
  () => write(data.value),
568
554
  { flush, deep, eventFilter }
569
555
  );
556
+ vue.watch(keyComputed, () => update(), { flush });
570
557
  if (window && listenToStorageChanges) {
571
558
  shared.tryOnMounted(() => {
572
559
  if (storage instanceof Storage)
573
- useEventListener(window, "storage", update);
560
+ useEventListener(window, "storage", update, { passive: true });
574
561
  else
575
562
  useEventListener(window, customStorageEventName, updateFromCustomEvent);
576
563
  if (initOnMounted)
@@ -582,7 +569,7 @@
582
569
  function dispatchWriteEvent(oldValue, newValue) {
583
570
  if (window) {
584
571
  const payload = {
585
- key,
572
+ key: keyComputed.value,
586
573
  oldValue,
587
574
  newValue,
588
575
  storageArea: storage
@@ -594,14 +581,14 @@
594
581
  }
595
582
  function write(v) {
596
583
  try {
597
- const oldValue = storage.getItem(key);
584
+ const oldValue = storage.getItem(keyComputed.value);
598
585
  if (v == null) {
599
586
  dispatchWriteEvent(oldValue, null);
600
- storage.removeItem(key);
587
+ storage.removeItem(keyComputed.value);
601
588
  } else {
602
589
  const serialized = serializer.write(v);
603
590
  if (oldValue !== serialized) {
604
- storage.setItem(key, serialized);
591
+ storage.setItem(keyComputed.value, serialized);
605
592
  dispatchWriteEvent(oldValue, serialized);
606
593
  }
607
594
  }
@@ -610,10 +597,10 @@
610
597
  }
611
598
  }
612
599
  function read(event) {
613
- const rawValue = event ? event.newValue : storage.getItem(key);
600
+ const rawValue = event ? event.newValue : storage.getItem(keyComputed.value);
614
601
  if (rawValue == null) {
615
602
  if (writeDefaults && rawInit != null)
616
- storage.setItem(key, serializer.write(rawInit));
603
+ storage.setItem(keyComputed.value, serializer.write(rawInit));
617
604
  return rawInit;
618
605
  } else if (!event && mergeDefaults) {
619
606
  const value = serializer.read(rawValue);
@@ -635,7 +622,7 @@
635
622
  data.value = rawInit;
636
623
  return;
637
624
  }
638
- if (event && event.key !== key)
625
+ if (event && event.key !== keyComputed.value)
639
626
  return;
640
627
  pauseWatch();
641
628
  try {
@@ -683,7 +670,7 @@
683
670
  const updateHTMLAttrs = getSSRHandler(
684
671
  "updateHTMLAttrs",
685
672
  (selector2, attribute2, value) => {
686
- const el = typeof selector2 === "string" ? window == null ? void 0 : window.document.querySelector(selector2) : unrefElement(selector2);
673
+ const el = typeof selector2 === "string" ? window == null ? undefined : window.document.querySelector(selector2) : unrefElement(selector2);
687
674
  if (!el)
688
675
  return;
689
676
  const classesToAdd = /* @__PURE__ */ new Set();
@@ -867,18 +854,18 @@
867
854
  });
868
855
  const containerElement = vue.computed(() => {
869
856
  var _a;
870
- return (_a = props.containerElement) != null ? _a : void 0;
857
+ return (_a = props.containerElement) != null ? _a : undefined;
871
858
  });
872
859
  const disabled = vue.computed(() => !!props.disabled);
873
860
  const storageValue = props.storageKey && core.useStorage(
874
861
  props.storageKey,
875
862
  vue.toValue(props.initialValue) || { x: 0, y: 0 },
876
- core.isClient ? props.storageType === "session" ? sessionStorage : localStorage : void 0
863
+ core.isClient ? props.storageType === "session" ? sessionStorage : localStorage : undefined
877
864
  );
878
865
  const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
879
866
  const onEnd = (position, event) => {
880
867
  var _a;
881
- (_a = props.onEnd) == null ? void 0 : _a.call(props, position, event);
868
+ (_a = props.onEnd) == null ? undefined : _a.call(props, position, event);
882
869
  if (!storageValue)
883
870
  return;
884
871
  storageValue.value.x = position.x;
@@ -919,7 +906,7 @@
919
906
  const cleanup = () => {
920
907
  if (observer) {
921
908
  observer.disconnect();
922
- observer = void 0;
909
+ observer = undefined;
923
910
  }
924
911
  };
925
912
  const targets = vue.computed(() => {
@@ -939,7 +926,7 @@
939
926
  { immediate: true, flush: "post" }
940
927
  );
941
928
  const takeRecords = () => {
942
- return observer == null ? void 0 : observer.takeRecords();
929
+ return observer == null ? undefined : observer.takeRecords();
943
930
  };
944
931
  const stop = () => {
945
932
  stopWatch();
@@ -960,7 +947,7 @@
960
947
  const cleanup = () => {
961
948
  if (observer) {
962
949
  observer.disconnect();
963
- observer = void 0;
950
+ observer = undefined;
964
951
  }
965
952
  };
966
953
  const targets = vue.computed(() => {
@@ -1085,14 +1072,14 @@
1085
1072
  function onElementRemoval(target, callback, options = {}) {
1086
1073
  const {
1087
1074
  window = defaultWindow,
1088
- document = window == null ? void 0 : window.document,
1075
+ document = window == null ? undefined : window.document,
1089
1076
  flush = "sync"
1090
1077
  } = options;
1091
1078
  if (!window || !document)
1092
1079
  return shared.noop;
1093
1080
  let stopFn;
1094
1081
  const cleanupAndUpdate = (fn) => {
1095
- stopFn == null ? void 0 : stopFn();
1082
+ stopFn == null ? undefined : stopFn();
1096
1083
  stopFn = fn;
1097
1084
  };
1098
1085
  const stopWatch = vue.watchEffect(() => {
@@ -1136,7 +1123,7 @@
1136
1123
  const delay = entering ? delayEnter : delayLeave;
1137
1124
  if (timer) {
1138
1125
  clearTimeout(timer);
1139
- timer = void 0;
1126
+ timer = undefined;
1140
1127
  }
1141
1128
  if (delay)
1142
1129
  timer = setTimeout(() => isHovered.value = entering, delay);
@@ -1187,7 +1174,7 @@
1187
1174
  const { window = defaultWindow, box = "content-box" } = options;
1188
1175
  const isSVG = vue.computed(() => {
1189
1176
  var _a, _b;
1190
- return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
1177
+ return (_b = (_a = unrefElement(target)) == null ? undefined : _a.namespaceURI) == null ? undefined : _b.includes("svg");
1191
1178
  });
1192
1179
  const width = vue.ref(initialSize.width);
1193
1180
  const height = vue.ref(initialSize.height);
@@ -1243,7 +1230,7 @@
1243
1230
  const vElementSize = {
1244
1231
  mounted(el, binding) {
1245
1232
  var _a;
1246
- const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? void 0 : _a[0];
1233
+ const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? undefined : _a[0];
1247
1234
  const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
1248
1235
  const { width, height } = useElementSize(el, ...options);
1249
1236
  vue.watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
@@ -1433,11 +1420,11 @@
1433
1420
  const state = shallow ? vue.shallowRef(initialState) : vue.ref(initialState);
1434
1421
  const isReady = vue.ref(false);
1435
1422
  const isLoading = vue.ref(false);
1436
- const error = vue.shallowRef(void 0);
1423
+ const error = vue.shallowRef(undefined);
1437
1424
  async function execute(delay2 = 0, ...args) {
1438
1425
  if (resetOnExecute)
1439
1426
  state.value = initialState;
1440
- error.value = void 0;
1427
+ error.value = undefined;
1441
1428
  isReady.value = false;
1442
1429
  isLoading.value = true;
1443
1430
  if (delay2 > 0)
@@ -1458,8 +1445,9 @@
1458
1445
  }
1459
1446
  return state.value;
1460
1447
  }
1461
- if (immediate)
1448
+ if (immediate) {
1462
1449
  execute(delay);
1450
+ }
1463
1451
  const shell = {
1464
1452
  state,
1465
1453
  isReady,
@@ -1516,7 +1504,7 @@
1516
1504
  function useImage(options, asyncStateOptions = {}) {
1517
1505
  const state = useAsyncState(
1518
1506
  () => loadImage(vue.toValue(options)),
1519
- void 0,
1507
+ undefined,
1520
1508
  {
1521
1509
  resetOnExecute: true,
1522
1510
  ...asyncStateOptions
@@ -1601,7 +1589,7 @@
1601
1589
  return internalX.value;
1602
1590
  },
1603
1591
  set(x2) {
1604
- scrollTo(x2, void 0);
1592
+ scrollTo(x2, undefined);
1605
1593
  }
1606
1594
  });
1607
1595
  const y = vue.computed({
@@ -1609,7 +1597,7 @@
1609
1597
  return internalY.value;
1610
1598
  },
1611
1599
  set(y2) {
1612
- scrollTo(void 0, y2);
1600
+ scrollTo(undefined, y2);
1613
1601
  }
1614
1602
  });
1615
1603
  function scrollTo(_x, _y) {
@@ -1619,12 +1607,12 @@
1619
1607
  const _element = vue.toValue(element);
1620
1608
  if (!_element)
1621
1609
  return;
1622
- (_c = _element instanceof Document ? window.document.body : _element) == null ? void 0 : _c.scrollTo({
1610
+ (_c = _element instanceof Document ? window.document.body : _element) == null ? undefined : _c.scrollTo({
1623
1611
  top: (_a = vue.toValue(_y)) != null ? _a : y.value,
1624
1612
  left: (_b = vue.toValue(_x)) != null ? _b : x.value,
1625
1613
  behavior: vue.toValue(behavior)
1626
1614
  });
1627
- const scrollContainer = ((_d = _element == null ? void 0 : _element.document) == null ? void 0 : _d.documentElement) || (_element == null ? void 0 : _element.documentElement) || _element;
1615
+ const scrollContainer = ((_d = _element == null ? undefined : _element.document) == null ? undefined : _d.documentElement) || (_element == null ? undefined : _element.documentElement) || _element;
1628
1616
  if (x != null)
1629
1617
  internalX.value = scrollContainer.scrollLeft;
1630
1618
  if (y != null)
@@ -1658,7 +1646,7 @@
1658
1646
  var _a;
1659
1647
  if (!window)
1660
1648
  return;
1661
- const el = ((_a = target == null ? void 0 : target.document) == null ? void 0 : _a.documentElement) || (target == null ? void 0 : target.documentElement) || unrefElement(target);
1649
+ const el = ((_a = target == null ? undefined : target.document) == null ? undefined : _a.documentElement) || (target == null ? undefined : target.documentElement) || unrefElement(target);
1662
1650
  const { display, flexDirection, direction } = getComputedStyle(el);
1663
1651
  const directionMultipler = direction === "rtl" ? -1 : 1;
1664
1652
  const scrollLeft = el.scrollLeft;
@@ -1904,7 +1892,7 @@
1904
1892
  useEventListener(target, "touchend", reset, listenerOptions);
1905
1893
  }
1906
1894
  if (scroll && type === "page")
1907
- useEventListener(window, "scroll", scrollHandlerWrapper, { passive: true });
1895
+ useEventListener(window, "scroll", scrollHandlerWrapper, listenerOptions);
1908
1896
  }
1909
1897
  return {
1910
1898
  x,
@@ -1920,7 +1908,7 @@
1920
1908
  } = options;
1921
1909
  const type = options.type || "page";
1922
1910
  const { x, y, sourceType } = useMouse(options);
1923
- const targetRef = vue.ref(target != null ? target : window == null ? void 0 : window.document.body);
1911
+ const targetRef = vue.ref(target != null ? target : window == null ? undefined : window.document.body);
1924
1912
  const elementX = vue.ref(0);
1925
1913
  const elementY = vue.ref(0);
1926
1914
  const elementPositionX = vue.ref(0);
@@ -1957,9 +1945,12 @@
1957
1945
  },
1958
1946
  { immediate: true }
1959
1947
  );
1960
- useEventListener(document, "mouseleave", () => {
1961
- isOutside.value = true;
1962
- });
1948
+ useEventListener(
1949
+ document,
1950
+ "mouseleave",
1951
+ () => isOutside.value = true,
1952
+ { passive: true }
1953
+ );
1963
1954
  }
1964
1955
  return {
1965
1956
  x,
@@ -2055,17 +2046,17 @@
2055
2046
  ...props,
2056
2047
  onPageChange(...args) {
2057
2048
  var _a;
2058
- (_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
2049
+ (_a = props.onPageChange) == null ? undefined : _a.call(props, ...args);
2059
2050
  emit("page-change", ...args);
2060
2051
  },
2061
2052
  onPageSizeChange(...args) {
2062
2053
  var _a;
2063
- (_a = props.onPageSizeChange) == null ? void 0 : _a.call(props, ...args);
2054
+ (_a = props.onPageSizeChange) == null ? undefined : _a.call(props, ...args);
2064
2055
  emit("page-size-change", ...args);
2065
2056
  },
2066
2057
  onPageCountChange(...args) {
2067
2058
  var _a;
2068
- (_a = props.onPageCountChange) == null ? void 0 : _a.call(props, ...args);
2059
+ (_a = props.onPageCountChange) == null ? undefined : _a.call(props, ...args);
2069
2060
  emit("page-count-change", ...args);
2070
2061
  }
2071
2062
  }));
@@ -2227,14 +2218,14 @@
2227
2218
  const variable = vue.ref(initialValue);
2228
2219
  const elRef = vue.computed(() => {
2229
2220
  var _a;
2230
- return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
2221
+ return unrefElement(target) || ((_a = window == null ? undefined : window.document) == null ? undefined : _a.documentElement);
2231
2222
  });
2232
2223
  function updateCssVar() {
2233
2224
  var _a;
2234
2225
  const key = vue.toValue(prop);
2235
2226
  const el = vue.toValue(elRef);
2236
2227
  if (el && window && key) {
2237
- const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
2228
+ const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? undefined : _a.trim();
2238
2229
  variable.value = value || initialValue;
2239
2230
  }
2240
2231
  }
@@ -2258,7 +2249,7 @@
2258
2249
  (val) => {
2259
2250
  var _a;
2260
2251
  const raw_prop = vue.toValue(prop);
2261
- if (((_a = elRef.value) == null ? void 0 : _a.style) && raw_prop) {
2252
+ if (((_a = elRef.value) == null ? undefined : _a.style) && raw_prop) {
2262
2253
  if (val == null)
2263
2254
  elRef.value.style.removeProperty(raw_prop);
2264
2255
  else
@@ -2288,7 +2279,7 @@
2288
2279
  bottomCssVar.value = "env(safe-area-inset-bottom, 0px)";
2289
2280
  leftCssVar.value = "env(safe-area-inset-left, 0px)";
2290
2281
  update();
2291
- useEventListener("resize", shared.useDebounceFn(update));
2282
+ useEventListener("resize", shared.useDebounceFn(update), { passive: true });
2292
2283
  }
2293
2284
  function update() {
2294
2285
  top.value = getValue(topVarName);
@@ -2360,12 +2351,12 @@
2360
2351
  ...options,
2361
2352
  onScroll(e) {
2362
2353
  var _a;
2363
- (_a = options.onScroll) == null ? void 0 : _a.call(options, e);
2354
+ (_a = options.onScroll) == null ? undefined : _a.call(options, e);
2364
2355
  handler(state);
2365
2356
  },
2366
2357
  onStop(e) {
2367
2358
  var _a;
2368
- (_a = options.onStop) == null ? void 0 : _a.call(options, e);
2359
+ (_a = options.onStop) == null ? undefined : _a.call(options, e);
2369
2360
  handler(state);
2370
2361
  }
2371
2362
  });
@@ -2438,7 +2429,7 @@
2438
2429
  if (!el || !isLocked.value)
2439
2430
  return;
2440
2431
  if (shared.isIOS)
2441
- stopTouchMoveListener == null ? void 0 : stopTouchMoveListener();
2432
+ stopTouchMoveListener == null ? undefined : stopTouchMoveListener();
2442
2433
  el.style.overflow = initialOverflow;
2443
2434
  elInitialOverflow.delete(el);
2444
2435
  isLocked.value = false;