@vueuse/components 10.2.1 → 10.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.iife.js CHANGED
@@ -134,9 +134,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
134
134
  });
135
135
 
136
136
  function unrefElement(elRef) {
137
- var _a;
138
137
  const plain = shared.toValue(elRef);
139
- return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
138
+ return plain?.$el ?? plain;
140
139
  }
141
140
 
142
141
  const defaultWindow = shared.isClient ? window : void 0;
@@ -197,6 +196,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
197
196
  if (shared.isIOS && !_iOSWorkaround) {
198
197
  _iOSWorkaround = true;
199
198
  Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", shared.noop));
199
+ window.document.documentElement.addEventListener("click", shared.noop);
200
200
  }
201
201
  let shouldListen = true;
202
202
  const shouldIgnore = (event) => {
@@ -230,9 +230,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
230
230
  }, { passive: true }),
231
231
  detectIframe && useEventListener(window, "blur", (event) => {
232
232
  setTimeout(() => {
233
- var _a;
234
233
  const el = unrefElement(target);
235
- if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement)))
234
+ if (window.document.activeElement?.tagName === "IFRAME" && !el?.contains(window.document.activeElement))
236
235
  handler(event);
237
236
  }, 0);
238
237
  })
@@ -302,42 +301,25 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
302
301
  return useEventListener(target, eventName, listener, passive);
303
302
  }
304
303
 
305
- var __defProp$e = Object.defineProperty;
306
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
307
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
308
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
309
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
310
- var __spreadValues$e = (a, b) => {
311
- for (var prop in b || (b = {}))
312
- if (__hasOwnProp$g.call(b, prop))
313
- __defNormalProp$e(a, prop, b[prop]);
314
- if (__getOwnPropSymbols$g)
315
- for (var prop of __getOwnPropSymbols$g(b)) {
316
- if (__propIsEnum$g.call(b, prop))
317
- __defNormalProp$e(a, prop, b[prop]);
318
- }
319
- return a;
320
- };
321
304
  const vOnKeyStroke = {
322
305
  [shared.directiveHooks.mounted](el, binding) {
323
- var _a, _b;
324
- const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
306
+ const keys = binding.arg?.split(",") ?? true;
325
307
  if (typeof binding.value === "function") {
326
308
  onKeyStroke(keys, binding.value, {
327
309
  target: el
328
310
  });
329
311
  } else {
330
312
  const [handler, options] = binding.value;
331
- onKeyStroke(keys, handler, __spreadValues$e({
332
- target: el
333
- }, options));
313
+ onKeyStroke(keys, handler, {
314
+ target: el,
315
+ ...options
316
+ });
334
317
  }
335
318
  }
336
319
  };
337
320
 
338
321
  const DEFAULT_DELAY = 500;
339
322
  function onLongPress(target, handler, options) {
340
- var _a, _b;
341
323
  const elementRef = vueDemi.computed(() => unrefElement(target));
342
324
  let timeout;
343
325
  function clear() {
@@ -347,26 +329,24 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
347
329
  }
348
330
  }
349
331
  function onDown(ev) {
350
- var _a2, _b2, _c, _d;
351
- if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
332
+ if (options?.modifiers?.self && ev.target !== elementRef.value)
352
333
  return;
353
334
  clear();
354
- if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
335
+ if (options?.modifiers?.prevent)
355
336
  ev.preventDefault();
356
- if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
337
+ if (options?.modifiers?.stop)
357
338
  ev.stopPropagation();
358
339
  timeout = setTimeout(
359
340
  () => handler(ev),
360
- (_d = options == null ? void 0 : options.delay) != null ? _d : DEFAULT_DELAY
341
+ options?.delay ?? DEFAULT_DELAY
361
342
  );
362
343
  }
363
344
  const listenerOptions = {
364
- capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
365
- once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
345
+ capture: options?.modifiers?.capture,
346
+ once: options?.modifiers?.once
366
347
  };
367
348
  useEventListener(elementRef, "pointerdown", onDown, listenerOptions);
368
- useEventListener(elementRef, "pointerup", clear, listenerOptions);
369
- useEventListener(elementRef, "pointerleave", clear, listenerOptions);
349
+ useEventListener(elementRef, ["pointerup", "pointerleave"], clear, listenerOptions);
370
350
  }
371
351
 
372
352
  const OnLongPress = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
@@ -449,22 +429,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
449
429
  return rawInit == null ? "any" : rawInit instanceof Set ? "set" : rawInit instanceof Map ? "map" : rawInit instanceof Date ? "date" : typeof rawInit === "boolean" ? "boolean" : typeof rawInit === "string" ? "string" : typeof rawInit === "object" ? "object" : !Number.isNaN(rawInit) ? "number" : "any";
450
430
  }
451
431
 
452
- var __defProp$d = Object.defineProperty;
453
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
454
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
455
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
456
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
457
- var __spreadValues$d = (a, b) => {
458
- for (var prop in b || (b = {}))
459
- if (__hasOwnProp$f.call(b, prop))
460
- __defNormalProp$d(a, prop, b[prop]);
461
- if (__getOwnPropSymbols$f)
462
- for (var prop of __getOwnPropSymbols$f(b)) {
463
- if (__propIsEnum$f.call(b, prop))
464
- __defNormalProp$d(a, prop, b[prop]);
465
- }
466
- return a;
467
- };
468
432
  const StorageSerializers = {
469
433
  boolean: {
470
434
  read: (v) => v === "true",
@@ -501,7 +465,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
501
465
  };
502
466
  const customStorageEventName = "vueuse-storage";
503
467
  function useStorage(key, defaults, storage, options = {}) {
504
- var _a;
505
468
  const {
506
469
  flush = "pre",
507
470
  deep = true,
@@ -518,10 +481,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
518
481
  const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(defaults);
519
482
  if (!storage) {
520
483
  try {
521
- storage = getSSRHandler("getDefaultStorage", () => {
522
- var _a2;
523
- return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;
524
- })();
484
+ storage = getSSRHandler("getDefaultStorage", () => defaultWindow?.localStorage)();
525
485
  } catch (e) {
526
486
  onError(e);
527
487
  }
@@ -530,7 +490,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
530
490
  return data;
531
491
  const rawInit = shared.toValue(defaults);
532
492
  const type = guessSerializerType(rawInit);
533
- const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];
493
+ const serializer = options.serializer ?? StorageSerializers[type];
534
494
  const { pause: pauseWatch, resume: resumeWatch } = shared.pausableWatch(
535
495
  data,
536
496
  () => write(data.value),
@@ -578,7 +538,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
578
538
  if (typeof mergeDefaults === "function")
579
539
  return mergeDefaults(value, rawInit);
580
540
  else if (type === "object" && !Array.isArray(value))
581
- return __spreadValues$d(__spreadValues$d({}, rawInit), value);
541
+ return { ...rawInit, ...value };
582
542
  return value;
583
543
  } else if (typeof rawValue !== "string") {
584
544
  return rawValue;
@@ -600,7 +560,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
600
560
  return;
601
561
  pauseWatch();
602
562
  try {
603
- data.value = read(event);
563
+ if (event?.newValue !== serializer.write(data.value))
564
+ data.value = read(event);
604
565
  } catch (e) {
605
566
  onError(e);
606
567
  } finally {
@@ -635,29 +596,33 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
635
596
  const isSupported = useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function");
636
597
  let mediaQuery;
637
598
  const matches = vueDemi.ref(false);
599
+ const handler = (event) => {
600
+ matches.value = event.matches;
601
+ };
638
602
  const cleanup = () => {
639
603
  if (!mediaQuery)
640
604
  return;
641
605
  if ("removeEventListener" in mediaQuery)
642
- mediaQuery.removeEventListener("change", update);
606
+ mediaQuery.removeEventListener("change", handler);
643
607
  else
644
- mediaQuery.removeListener(update);
608
+ mediaQuery.removeListener(handler);
645
609
  };
646
- const update = () => {
610
+ const stopWatch = vueDemi.watchEffect(() => {
647
611
  if (!isSupported.value)
648
612
  return;
649
613
  cleanup();
650
- mediaQuery = window.matchMedia(shared.toRef(query).value);
651
- matches.value = !!(mediaQuery == null ? void 0 : mediaQuery.matches);
652
- if (!mediaQuery)
653
- return;
614
+ mediaQuery = window.matchMedia(shared.toValue(query));
654
615
  if ("addEventListener" in mediaQuery)
655
- mediaQuery.addEventListener("change", update);
616
+ mediaQuery.addEventListener("change", handler);
656
617
  else
657
- mediaQuery.addListener(update);
658
- };
659
- vueDemi.watchEffect(update);
660
- shared.tryOnScopeDispose(() => cleanup());
618
+ mediaQuery.addListener(handler);
619
+ matches.value = mediaQuery.matches;
620
+ });
621
+ shared.tryOnScopeDispose(() => {
622
+ stopWatch();
623
+ cleanup();
624
+ mediaQuery = void 0;
625
+ });
661
626
  return matches;
662
627
  }
663
628
 
@@ -665,22 +630,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
665
630
  return useMediaQuery("(prefers-color-scheme: dark)", options);
666
631
  }
667
632
 
668
- var __defProp$c = Object.defineProperty;
669
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
670
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
671
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
672
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
673
- var __spreadValues$c = (a, b) => {
674
- for (var prop in b || (b = {}))
675
- if (__hasOwnProp$e.call(b, prop))
676
- __defNormalProp$c(a, prop, b[prop]);
677
- if (__getOwnPropSymbols$e)
678
- for (var prop of __getOwnPropSymbols$e(b)) {
679
- if (__propIsEnum$e.call(b, prop))
680
- __defNormalProp$c(a, prop, b[prop]);
681
- }
682
- return a;
683
- };
684
633
  function useColorMode(options = {}) {
685
634
  const {
686
635
  selector = "html",
@@ -694,11 +643,12 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
694
643
  emitAuto,
695
644
  disableTransition = true
696
645
  } = options;
697
- const modes = __spreadValues$c({
646
+ const modes = {
698
647
  auto: "",
699
648
  light: "light",
700
- dark: "dark"
701
- }, options.modes || {});
649
+ dark: "dark",
650
+ ...options.modes || {}
651
+ };
702
652
  const preferredDark = usePreferredDark({ window });
703
653
  const system = vueDemi.computed(() => preferredDark.value ? "dark" : "light");
704
654
  const store = storageRef || (storageKey == null ? shared.toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));
@@ -708,7 +658,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
708
658
  const updateHTMLAttrs = getSSRHandler(
709
659
  "updateHTMLAttrs",
710
660
  (selector2, attribute2, value) => {
711
- const el = typeof selector2 === "string" ? window == null ? void 0 : window.document.querySelector(selector2) : unrefElement(selector2);
661
+ const el = typeof selector2 === "string" ? window?.document.querySelector(selector2) : unrefElement(selector2);
712
662
  if (!el)
713
663
  return;
714
664
  let style;
@@ -736,8 +686,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
736
686
  }
737
687
  );
738
688
  function defaultOnChanged(mode) {
739
- var _a;
740
- updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);
689
+ updateHTMLAttrs(selector, attribute, modes[mode] ?? mode);
741
690
  }
742
691
  function onChanged(mode) {
743
692
  if (options.onChanged)
@@ -855,25 +804,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
855
804
  }
856
805
  });
857
806
 
858
- var __defProp$b = Object.defineProperty;
859
- var __defProps$9 = Object.defineProperties;
860
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
861
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
862
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
863
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
864
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
865
- var __spreadValues$b = (a, b) => {
866
- for (var prop in b || (b = {}))
867
- if (__hasOwnProp$d.call(b, prop))
868
- __defNormalProp$b(a, prop, b[prop]);
869
- if (__getOwnPropSymbols$d)
870
- for (var prop of __getOwnPropSymbols$d(b)) {
871
- if (__propIsEnum$d.call(b, prop))
872
- __defNormalProp$b(a, prop, b[prop]);
873
- }
874
- return a;
875
- };
876
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
877
807
  const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
878
808
  name: "UseDraggable",
879
809
  props: [
@@ -893,10 +823,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
893
823
  ],
894
824
  setup(props, { slots }) {
895
825
  const target = vueDemi.ref();
896
- const handle = vueDemi.computed(() => {
897
- var _a;
898
- return (_a = props.handle) != null ? _a : target.value;
899
- });
826
+ const handle = vueDemi.computed(() => props.handle ?? target.value);
900
827
  const storageValue = props.storageKey && core.useStorage(
901
828
  props.storageKey,
902
829
  shared.toValue(props.initialValue) || { x: 0, y: 0 },
@@ -904,18 +831,18 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
904
831
  );
905
832
  const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
906
833
  const onEnd = (position, event) => {
907
- var _a;
908
- (_a = props.onEnd) == null ? void 0 : _a.call(props, position, event);
834
+ props.onEnd?.(position, event);
909
835
  if (!storageValue)
910
836
  return;
911
837
  storageValue.value.x = position.x;
912
838
  storageValue.value.y = position.y;
913
839
  };
914
- const data = vueDemi.reactive(core.useDraggable(target, __spreadProps$9(__spreadValues$b({}, props), {
840
+ const data = vueDemi.reactive(core.useDraggable(target, {
841
+ ...props,
915
842
  handle,
916
843
  initialValue,
917
844
  onEnd
918
- })));
845
+ }));
919
846
  return () => {
920
847
  if (slots.default)
921
848
  return vueDemi.h(props.as || "div", { ref: target, style: `touch-action:none;${data.style}` }, slots.default(data));
@@ -973,7 +900,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
973
900
 
974
901
  const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
975
902
  name: "UseElementSize",
976
- props: ["width", "height", "box"],
903
+ props: ["width", "height", "box", "as"],
977
904
  setup(props, { slots }) {
978
905
  const target = vueDemi.ref();
979
906
  const data = vueDemi.reactive(core.useElementSize(target, { width: props.width, height: props.height }, { box: props.box }));
@@ -984,23 +911,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
984
911
  }
985
912
  });
986
913
 
987
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
988
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
989
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
990
- var __objRest$1 = (source, exclude) => {
991
- var target = {};
992
- for (var prop in source)
993
- if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
994
- target[prop] = source[prop];
995
- if (source != null && __getOwnPropSymbols$c)
996
- for (var prop of __getOwnPropSymbols$c(source)) {
997
- if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
998
- target[prop] = source[prop];
999
- }
1000
- return target;
1001
- };
1002
914
  function useResizeObserver(target, callback, options = {}) {
1003
- const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest$1(_a, ["window"]);
915
+ const { window = defaultWindow, ...observerOptions } = options;
1004
916
  let observer;
1005
917
  const isSupported = useSupported(() => window && "ResizeObserver" in window);
1006
918
  const cleanup = () => {
@@ -1037,10 +949,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1037
949
 
1038
950
  function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
1039
951
  const { window = defaultWindow, box = "content-box" } = options;
1040
- const isSVG = vueDemi.computed(() => {
1041
- var _a, _b;
1042
- return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
1043
- });
952
+ const isSVG = vueDemi.computed(() => unrefElement(target)?.namespaceURI?.includes("svg"));
1044
953
  const width = vueDemi.ref(initialSize.width);
1045
954
  const height = vueDemi.ref(initialSize.height);
1046
955
  useResizeObserver(
@@ -1082,8 +991,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1082
991
 
1083
992
  const vElementSize = {
1084
993
  [shared.directiveHooks.mounted](el, binding) {
1085
- var _a;
1086
- const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? void 0 : _a[0];
994
+ const handler = typeof binding.value === "function" ? binding.value : binding.value?.[0];
1087
995
  const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
1088
996
  const { width, height } = useElementSize(el, ...options);
1089
997
  vueDemi.watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
@@ -1173,7 +1081,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1173
1081
  },
1174
1082
  {
1175
1083
  root: scrollTarget,
1176
- window
1084
+ window,
1085
+ threshold: 0
1177
1086
  }
1178
1087
  );
1179
1088
  return elementIsVisible;
@@ -1244,25 +1153,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1244
1153
  }
1245
1154
  });
1246
1155
 
1247
- var __defProp$a = Object.defineProperty;
1248
- var __defProps$8 = Object.defineProperties;
1249
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
1250
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
1251
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
1252
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
1253
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1254
- var __spreadValues$a = (a, b) => {
1255
- for (var prop in b || (b = {}))
1256
- if (__hasOwnProp$b.call(b, prop))
1257
- __defNormalProp$a(a, prop, b[prop]);
1258
- if (__getOwnPropSymbols$b)
1259
- for (var prop of __getOwnPropSymbols$b(b)) {
1260
- if (__propIsEnum$b.call(b, prop))
1261
- __defNormalProp$a(a, prop, b[prop]);
1262
- }
1263
- return a;
1264
- };
1265
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
1266
1156
  function useAsyncState(promise, initialState, options) {
1267
1157
  const {
1268
1158
  immediate = true,
@@ -1272,7 +1162,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1272
1162
  resetOnExecute = true,
1273
1163
  shallow = true,
1274
1164
  throwError
1275
- } = options != null ? options : {};
1165
+ } = options ?? {};
1276
1166
  const state = shallow ? vueDemi.shallowRef(initialState) : vueDemi.ref(initialState);
1277
1167
  const isReady = vueDemi.ref(false);
1278
1168
  const isLoading = vueDemi.ref(false);
@@ -1315,29 +1205,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1315
1205
  shared.until(isLoading).toBe(false).then(() => resolve(shell)).catch(reject);
1316
1206
  });
1317
1207
  }
1318
- return __spreadProps$8(__spreadValues$a({}, shell), {
1208
+ return {
1209
+ ...shell,
1319
1210
  then(onFulfilled, onRejected) {
1320
1211
  return waitUntilIsLoaded().then(onFulfilled, onRejected);
1321
1212
  }
1322
- });
1213
+ };
1323
1214
  }
1324
1215
 
1325
- var __defProp$9 = Object.defineProperty;
1326
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
1327
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
1328
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
1329
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1330
- var __spreadValues$9 = (a, b) => {
1331
- for (var prop in b || (b = {}))
1332
- if (__hasOwnProp$a.call(b, prop))
1333
- __defNormalProp$9(a, prop, b[prop]);
1334
- if (__getOwnPropSymbols$a)
1335
- for (var prop of __getOwnPropSymbols$a(b)) {
1336
- if (__propIsEnum$a.call(b, prop))
1337
- __defNormalProp$9(a, prop, b[prop]);
1338
- }
1339
- return a;
1340
- };
1341
1216
  async function loadImage(options) {
1342
1217
  return new Promise((resolve, reject) => {
1343
1218
  const img = new Image();
@@ -1363,9 +1238,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1363
1238
  const state = useAsyncState(
1364
1239
  () => loadImage(shared.toValue(options)),
1365
1240
  void 0,
1366
- __spreadValues$9({
1367
- resetOnExecute: true
1368
- }, asyncStateOptions)
1241
+ {
1242
+ resetOnExecute: true,
1243
+ ...asyncStateOptions
1244
+ }
1369
1245
  );
1370
1246
  vueDemi.watch(
1371
1247
  () => shared.toValue(options),
@@ -1419,7 +1295,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1419
1295
  capture: false,
1420
1296
  passive: true
1421
1297
  },
1422
- behavior = "auto"
1298
+ behavior = "auto",
1299
+ window = defaultWindow
1423
1300
  } = options;
1424
1301
  const internalX = vueDemi.ref(0);
1425
1302
  const internalY = vueDemi.ref(0);
@@ -1440,13 +1317,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1440
1317
  }
1441
1318
  });
1442
1319
  function scrollTo(_x, _y) {
1443
- var _a, _b, _c;
1320
+ if (!window)
1321
+ return;
1444
1322
  const _element = shared.toValue(element);
1445
1323
  if (!_element)
1446
1324
  return;
1447
- (_c = _element instanceof Document ? document.body : _element) == null ? void 0 : _c.scrollTo({
1448
- top: (_a = shared.toValue(_y)) != null ? _a : y.value,
1449
- left: (_b = shared.toValue(_x)) != null ? _b : x.value,
1325
+ (_element instanceof Document ? window.document.body : _element)?.scrollTo({
1326
+ top: shared.toValue(_y) ?? y.value,
1327
+ left: shared.toValue(_x) ?? x.value,
1450
1328
  behavior: shared.toValue(behavior)
1451
1329
  });
1452
1330
  }
@@ -1475,7 +1353,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1475
1353
  };
1476
1354
  const onScrollEndDebounced = shared.useDebounceFn(onScrollEnd, throttle + idle);
1477
1355
  const setArrivedState = (target) => {
1478
- const el = target === window ? target.document.documentElement : target === document ? target.documentElement : target;
1356
+ if (!window)
1357
+ return;
1358
+ const el = target.document ? target.document.documentElement : target.documentElement ?? target;
1479
1359
  const { display, flexDirection } = getComputedStyle(el);
1480
1360
  const scrollLeft = el.scrollLeft;
1481
1361
  directions.left = scrollLeft < internalX.value;
@@ -1491,8 +1371,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1491
1371
  }
1492
1372
  internalX.value = scrollLeft;
1493
1373
  let scrollTop = el.scrollTop;
1494
- if (target === document && !scrollTop)
1495
- scrollTop = document.body.scrollTop;
1374
+ if (target === window.document && !scrollTop)
1375
+ scrollTop = window.document.body.scrollTop;
1496
1376
  directions.top = scrollTop < internalY.value;
1497
1377
  directions.bottom = scrollTop > internalY.value;
1498
1378
  const top = Math.abs(scrollTop) <= 0 + (offset.top || 0);
@@ -1507,7 +1387,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1507
1387
  internalY.value = scrollTop;
1508
1388
  };
1509
1389
  const onScrollHandler = (e) => {
1510
- const eventTarget = e.target === document ? e.target.documentElement : e.target;
1390
+ if (!window)
1391
+ return;
1392
+ const eventTarget = e.target.documentElement ?? e.target;
1511
1393
  setArrivedState(eventTarget);
1512
1394
  isScrolling.value = true;
1513
1395
  onScrollEndDebounced(e);
@@ -1533,53 +1415,47 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1533
1415
  directions,
1534
1416
  measure() {
1535
1417
  const _element = shared.toValue(element);
1536
- if (_element)
1418
+ if (window && _element)
1537
1419
  setArrivedState(_element);
1538
1420
  }
1539
1421
  };
1540
1422
  }
1541
1423
 
1542
- var __defProp$8 = Object.defineProperty;
1543
- var __defProps$7 = Object.defineProperties;
1544
- var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
1545
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
1546
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
1547
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
1548
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1549
- var __spreadValues$8 = (a, b) => {
1550
- for (var prop in b || (b = {}))
1551
- if (__hasOwnProp$9.call(b, prop))
1552
- __defNormalProp$8(a, prop, b[prop]);
1553
- if (__getOwnPropSymbols$9)
1554
- for (var prop of __getOwnPropSymbols$9(b)) {
1555
- if (__propIsEnum$9.call(b, prop))
1556
- __defNormalProp$8(a, prop, b[prop]);
1557
- }
1558
- return a;
1559
- };
1560
- var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
1424
+ function resolveElement(el) {
1425
+ if (typeof Window !== "undefined" && el instanceof Window)
1426
+ return el.document.documentElement;
1427
+ if (typeof Document !== "undefined" && el instanceof Document)
1428
+ return el.documentElement;
1429
+ return el;
1430
+ }
1431
+
1561
1432
  function useInfiniteScroll(element, onLoadMore, options = {}) {
1562
- var _a;
1563
1433
  const {
1564
1434
  direction = "bottom",
1565
1435
  interval = 100
1566
1436
  } = options;
1567
1437
  const state = vueDemi.reactive(useScroll(
1568
1438
  element,
1569
- __spreadProps$7(__spreadValues$8({}, options), {
1570
- offset: __spreadValues$8({
1571
- [direction]: (_a = options.distance) != null ? _a : 0
1572
- }, options.offset)
1573
- })
1439
+ {
1440
+ ...options,
1441
+ offset: {
1442
+ [direction]: options.distance ?? 0,
1443
+ ...options.offset
1444
+ }
1445
+ }
1574
1446
  ));
1575
1447
  const promise = vueDemi.ref();
1576
1448
  const isLoading = vueDemi.computed(() => !!promise.value);
1449
+ const observedElement = vueDemi.computed(() => {
1450
+ return resolveElement(shared.toValue(element));
1451
+ });
1452
+ const isElementVisible = useElementVisibility(observedElement);
1577
1453
  function checkAndLoad() {
1578
1454
  state.measure();
1579
- const el = shared.toValue(element);
1580
- if (!el || !el.offsetParent)
1455
+ if (!observedElement.value || !isElementVisible.value)
1581
1456
  return;
1582
- const isNarrower = direction === "bottom" || direction === "top" ? el.scrollHeight <= el.clientHeight : el.scrollWidth <= el.clientWidth;
1457
+ const { scrollHeight, clientHeight, scrollWidth, clientWidth } = observedElement.value;
1458
+ const isNarrower = direction === "bottom" || direction === "top" ? scrollHeight <= clientHeight : scrollWidth <= clientWidth;
1583
1459
  if (state.arrivedState[direction] || isNarrower) {
1584
1460
  if (!promise.value) {
1585
1461
  promise.value = Promise.all([
@@ -1593,7 +1469,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1593
1469
  }
1594
1470
  }
1595
1471
  vueDemi.watch(
1596
- () => [state.arrivedState[direction], shared.toValue(element)],
1472
+ () => [state.arrivedState[direction], isElementVisible.value],
1597
1473
  checkAndLoad,
1598
1474
  { immediate: true }
1599
1475
  );
@@ -1645,31 +1521,12 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1645
1521
  }
1646
1522
  });
1647
1523
 
1648
- var __defProp$7 = Object.defineProperty;
1649
- var __defProps$6 = Object.defineProperties;
1650
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
1651
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
1652
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
1653
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
1654
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1655
- var __spreadValues$7 = (a, b) => {
1656
- for (var prop in b || (b = {}))
1657
- if (__hasOwnProp$8.call(b, prop))
1658
- __defNormalProp$7(a, prop, b[prop]);
1659
- if (__getOwnPropSymbols$8)
1660
- for (var prop of __getOwnPropSymbols$8(b)) {
1661
- if (__propIsEnum$8.call(b, prop))
1662
- __defNormalProp$7(a, prop, b[prop]);
1663
- }
1664
- return a;
1665
- };
1666
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
1667
1524
  const UseMousePressed = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
1668
1525
  name: "UseMousePressed",
1669
1526
  props: ["touch", "initialValue", "as"],
1670
1527
  setup(props, { slots }) {
1671
1528
  const target = vueDemi.ref();
1672
- const data = vueDemi.reactive(core.useMousePressed(__spreadProps$6(__spreadValues$7({}, props), { target })));
1529
+ const data = vueDemi.reactive(core.useMousePressed({ ...props, target }));
1673
1530
  return () => {
1674
1531
  if (slots.default)
1675
1532
  return vueDemi.h(props.as || "div", { ref: target }, slots.default(data));
@@ -1688,30 +1545,11 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1688
1545
  }
1689
1546
  });
1690
1547
 
1691
- var __defProp$6 = Object.defineProperty;
1692
- var __defProps$5 = Object.defineProperties;
1693
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
1694
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
1695
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
1696
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
1697
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1698
- var __spreadValues$6 = (a, b) => {
1699
- for (var prop in b || (b = {}))
1700
- if (__hasOwnProp$7.call(b, prop))
1701
- __defNormalProp$6(a, prop, b[prop]);
1702
- if (__getOwnPropSymbols$7)
1703
- for (var prop of __getOwnPropSymbols$7(b)) {
1704
- if (__propIsEnum$7.call(b, prop))
1705
- __defNormalProp$6(a, prop, b[prop]);
1706
- }
1707
- return a;
1708
- };
1709
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
1710
1548
  const UseNow = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
1711
1549
  name: "UseNow",
1712
1550
  props: ["interval"],
1713
1551
  setup(props, { slots }) {
1714
- const data = vueDemi.reactive(core.useNow(__spreadProps$5(__spreadValues$6({}, props), { controls: true })));
1552
+ const data = vueDemi.reactive(core.useNow({ ...props, controls: true }));
1715
1553
  return () => {
1716
1554
  if (slots.default)
1717
1555
  return slots.default(data);
@@ -1734,25 +1572,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1734
1572
  }
1735
1573
  });
1736
1574
 
1737
- var __defProp$5 = Object.defineProperty;
1738
- var __defProps$4 = Object.defineProperties;
1739
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
1740
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
1741
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
1742
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
1743
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1744
- var __spreadValues$5 = (a, b) => {
1745
- for (var prop in b || (b = {}))
1746
- if (__hasOwnProp$6.call(b, prop))
1747
- __defNormalProp$5(a, prop, b[prop]);
1748
- if (__getOwnPropSymbols$6)
1749
- for (var prop of __getOwnPropSymbols$6(b)) {
1750
- if (__propIsEnum$6.call(b, prop))
1751
- __defNormalProp$5(a, prop, b[prop]);
1752
- }
1753
- return a;
1754
- };
1755
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
1756
1575
  const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
1757
1576
  name: "UseOffsetPagination",
1758
1577
  props: [
@@ -1769,23 +1588,21 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1769
1588
  "page-count-change"
1770
1589
  ],
1771
1590
  setup(props, { slots, emit }) {
1772
- const data = vueDemi.reactive(core.useOffsetPagination(__spreadProps$4(__spreadValues$5({}, props), {
1591
+ const data = vueDemi.reactive(core.useOffsetPagination({
1592
+ ...props,
1773
1593
  onPageChange(...args) {
1774
- var _a;
1775
- (_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
1594
+ props.onPageChange?.(...args);
1776
1595
  emit("page-change", ...args);
1777
1596
  },
1778
1597
  onPageSizeChange(...args) {
1779
- var _a;
1780
- (_a = props.onPageSizeChange) == null ? void 0 : _a.call(props, ...args);
1598
+ props.onPageSizeChange?.(...args);
1781
1599
  emit("page-size-change", ...args);
1782
1600
  },
1783
1601
  onPageCountChange(...args) {
1784
- var _a;
1785
- (_a = props.onPageCountChange) == null ? void 0 : _a.call(props, ...args);
1602
+ props.onPageCountChange?.(...args);
1786
1603
  emit("page-count-change", ...args);
1787
1604
  }
1788
- })));
1605
+ }));
1789
1606
  return () => {
1790
1607
  if (slots.default)
1791
1608
  return slots.default(data);
@@ -1819,25 +1636,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1819
1636
  }
1820
1637
  });
1821
1638
 
1822
- var __defProp$4 = Object.defineProperty;
1823
- var __defProps$3 = Object.defineProperties;
1824
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
1825
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
1826
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
1827
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
1828
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1829
- var __spreadValues$4 = (a, b) => {
1830
- for (var prop in b || (b = {}))
1831
- if (__hasOwnProp$5.call(b, prop))
1832
- __defNormalProp$4(a, prop, b[prop]);
1833
- if (__getOwnPropSymbols$5)
1834
- for (var prop of __getOwnPropSymbols$5(b)) {
1835
- if (__propIsEnum$5.call(b, prop))
1836
- __defNormalProp$4(a, prop, b[prop]);
1837
- }
1838
- return a;
1839
- };
1840
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
1841
1639
  const UsePointer = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
1842
1640
  name: "UsePointer",
1843
1641
  props: [
@@ -1847,9 +1645,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1847
1645
  ],
1848
1646
  setup(props, { slots }) {
1849
1647
  const el = vueDemi.ref(null);
1850
- const data = vueDemi.reactive(core.usePointer(__spreadProps$3(__spreadValues$4({}, props), {
1648
+ const data = vueDemi.reactive(core.usePointer({
1649
+ ...props,
1851
1650
  target: props.target === "self" ? el : defaultWindow
1852
- })));
1651
+ }));
1853
1652
  return () => {
1854
1653
  if (slots.default)
1855
1654
  return slots.default(data, { ref: el });
@@ -1935,23 +1734,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1935
1734
  }
1936
1735
  });
1937
1736
 
1938
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
1939
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
1940
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
1941
- var __objRest = (source, exclude) => {
1942
- var target = {};
1943
- for (var prop in source)
1944
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
1945
- target[prop] = source[prop];
1946
- if (source != null && __getOwnPropSymbols$4)
1947
- for (var prop of __getOwnPropSymbols$4(source)) {
1948
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
1949
- target[prop] = source[prop];
1950
- }
1951
- return target;
1952
- };
1953
1737
  function useMutationObserver(target, callback, options = {}) {
1954
- const _a = options, { window = defaultWindow } = _a, mutationOptions = __objRest(_a, ["window"]);
1738
+ const { window = defaultWindow, ...mutationOptions } = options;
1955
1739
  let observer;
1956
1740
  const isSupported = useSupported(() => window && "MutationObserver" in window);
1957
1741
  const cleanup = () => {
@@ -1985,16 +1769,12 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1985
1769
  function useCssVar(prop, target, options = {}) {
1986
1770
  const { window = defaultWindow, initialValue = "", observe = false } = options;
1987
1771
  const variable = vueDemi.ref(initialValue);
1988
- const elRef = vueDemi.computed(() => {
1989
- var _a;
1990
- return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
1991
- });
1772
+ const elRef = vueDemi.computed(() => unrefElement(target) || window?.document?.documentElement);
1992
1773
  function updateCssVar() {
1993
- var _a;
1994
1774
  const key = shared.toValue(prop);
1995
1775
  const el = shared.toValue(elRef);
1996
1776
  if (el && window) {
1997
- const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
1777
+ const value = window.getComputedStyle(el).getPropertyValue(key)?.trim();
1998
1778
  variable.value = value || initialValue;
1999
1779
  }
2000
1780
  }
@@ -2012,8 +1792,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
2012
1792
  vueDemi.watch(
2013
1793
  variable,
2014
1794
  (val) => {
2015
- var _a;
2016
- if ((_a = elRef.value) == null ? void 0 : _a.style)
1795
+ if (elRef.value?.style)
2017
1796
  elRef.value.style.setProperty(shared.toValue(prop), val);
2018
1797
  }
2019
1798
  );
@@ -2093,25 +1872,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
2093
1872
  }
2094
1873
  });
2095
1874
 
2096
- var __defProp$3 = Object.defineProperty;
2097
- var __defProps$2 = Object.defineProperties;
2098
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
2099
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
2100
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
2101
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
2102
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2103
- var __spreadValues$3 = (a, b) => {
2104
- for (var prop in b || (b = {}))
2105
- if (__hasOwnProp$3.call(b, prop))
2106
- __defNormalProp$3(a, prop, b[prop]);
2107
- if (__getOwnPropSymbols$3)
2108
- for (var prop of __getOwnPropSymbols$3(b)) {
2109
- if (__propIsEnum$3.call(b, prop))
2110
- __defNormalProp$3(a, prop, b[prop]);
2111
- }
2112
- return a;
2113
- };
2114
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
2115
1875
  const vScroll = {
2116
1876
  [shared.directiveHooks.mounted](el, binding) {
2117
1877
  if (typeof binding.value === "function") {
@@ -2126,18 +1886,17 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
2126
1886
  });
2127
1887
  } else {
2128
1888
  const [handler, options] = binding.value;
2129
- const state = useScroll(el, __spreadProps$2(__spreadValues$3({}, options), {
1889
+ const state = useScroll(el, {
1890
+ ...options,
2130
1891
  onScroll(e) {
2131
- var _a;
2132
- (_a = options.onScroll) == null ? void 0 : _a.call(options, e);
1892
+ options.onScroll?.(e);
2133
1893
  handler(state);
2134
1894
  },
2135
1895
  onStop(e) {
2136
- var _a;
2137
- (_a = options.onStop) == null ? void 0 : _a.call(options, e);
1896
+ options.onStop?.(e);
2138
1897
  handler(state);
2139
1898
  }
2140
- }));
1899
+ });
2141
1900
  }
2142
1901
  }
2143
1902
  };
@@ -2169,8 +1928,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
2169
1928
  let stopTouchMoveListener = null;
2170
1929
  let initialOverflow;
2171
1930
  vueDemi.watch(shared.toRef(element), (el) => {
2172
- if (el) {
2173
- const ele = el;
1931
+ const target = resolveElement(shared.toValue(el));
1932
+ if (target) {
1933
+ const ele = target;
2174
1934
  initialOverflow = ele.style.overflow;
2175
1935
  if (isLocked.value)
2176
1936
  ele.style.overflow = "hidden";
@@ -2179,12 +1939,12 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
2179
1939
  immediate: true
2180
1940
  });
2181
1941
  const lock = () => {
2182
- const ele = shared.toValue(element);
2183
- if (!ele || isLocked.value)
1942
+ const el = resolveElement(shared.toValue(element));
1943
+ if (!el || isLocked.value)
2184
1944
  return;
2185
1945
  if (shared.isIOS) {
2186
1946
  stopTouchMoveListener = useEventListener(
2187
- ele,
1947
+ el,
2188
1948
  "touchmove",
2189
1949
  (e) => {
2190
1950
  preventDefault(e);
@@ -2192,15 +1952,15 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
2192
1952
  { passive: false }
2193
1953
  );
2194
1954
  }
2195
- ele.style.overflow = "hidden";
1955
+ el.style.overflow = "hidden";
2196
1956
  isLocked.value = true;
2197
1957
  };
2198
1958
  const unlock = () => {
2199
- const ele = shared.toValue(element);
2200
- if (!ele || !isLocked.value)
1959
+ const el = resolveElement(shared.toValue(element));
1960
+ if (!el || !isLocked.value)
2201
1961
  return;
2202
- shared.isIOS && (stopTouchMoveListener == null ? void 0 : stopTouchMoveListener());
2203
- ele.style.overflow = initialOverflow;
1962
+ shared.isIOS && stopTouchMoveListener?.();
1963
+ el.style.overflow = initialOverflow;
2204
1964
  isLocked.value = false;
2205
1965
  };
2206
1966
  shared.tryOnScopeDispose(unlock);
@@ -2231,30 +1991,11 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
2231
1991
  }
2232
1992
  const vScrollLock = onScrollLock();
2233
1993
 
2234
- var __defProp$2 = Object.defineProperty;
2235
- var __defProps$1 = Object.defineProperties;
2236
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
2237
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
2238
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
2239
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
2240
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2241
- var __spreadValues$2 = (a, b) => {
2242
- for (var prop in b || (b = {}))
2243
- if (__hasOwnProp$2.call(b, prop))
2244
- __defNormalProp$2(a, prop, b[prop]);
2245
- if (__getOwnPropSymbols$2)
2246
- for (var prop of __getOwnPropSymbols$2(b)) {
2247
- if (__propIsEnum$2.call(b, prop))
2248
- __defNormalProp$2(a, prop, b[prop]);
2249
- }
2250
- return a;
2251
- };
2252
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
2253
1994
  const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
2254
1995
  name: "UseTimeAgo",
2255
1996
  props: ["time", "updateInterval", "max", "fullDateFormatter", "messages", "showSecond"],
2256
1997
  setup(props, { slots }) {
2257
- const data = vueDemi.reactive(core.useTimeAgo(() => props.time, __spreadProps$1(__spreadValues$2({}, props), { controls: true })));
1998
+ const data = vueDemi.reactive(core.useTimeAgo(() => props.time, { ...props, controls: true }));
2258
1999
  return () => {
2259
2000
  if (slots.default)
2260
2001
  return slots.default(data);
@@ -2262,30 +2003,11 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
2262
2003
  }
2263
2004
  });
2264
2005
 
2265
- var __defProp$1 = Object.defineProperty;
2266
- var __defProps = Object.defineProperties;
2267
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2268
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
2269
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
2270
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
2271
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2272
- var __spreadValues$1 = (a, b) => {
2273
- for (var prop in b || (b = {}))
2274
- if (__hasOwnProp$1.call(b, prop))
2275
- __defNormalProp$1(a, prop, b[prop]);
2276
- if (__getOwnPropSymbols$1)
2277
- for (var prop of __getOwnPropSymbols$1(b)) {
2278
- if (__propIsEnum$1.call(b, prop))
2279
- __defNormalProp$1(a, prop, b[prop]);
2280
- }
2281
- return a;
2282
- };
2283
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
2284
2006
  const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
2285
2007
  name: "UseTimestamp",
2286
2008
  props: ["immediate", "interval", "offset"],
2287
2009
  setup(props, { slots }) {
2288
- const data = vueDemi.reactive(core.useTimestamp(__spreadProps(__spreadValues$1({}, props), { controls: true })));
2010
+ const data = vueDemi.reactive(core.useTimestamp({ ...props, controls: true }));
2289
2011
  return () => {
2290
2012
  if (slots.default)
2291
2013
  return slots.default(data);
@@ -2293,22 +2015,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
2293
2015
  }
2294
2016
  });
2295
2017
 
2296
- var __defProp = Object.defineProperty;
2297
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
2298
- var __hasOwnProp = Object.prototype.hasOwnProperty;
2299
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
2300
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2301
- var __spreadValues = (a, b) => {
2302
- for (var prop in b || (b = {}))
2303
- if (__hasOwnProp.call(b, prop))
2304
- __defNormalProp(a, prop, b[prop]);
2305
- if (__getOwnPropSymbols)
2306
- for (var prop of __getOwnPropSymbols(b)) {
2307
- if (__propIsEnum.call(b, prop))
2308
- __defNormalProp(a, prop, b[prop]);
2309
- }
2310
- return a;
2311
- };
2312
2018
  const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
2313
2019
  name: "UseVirtualList",
2314
2020
  props: [
@@ -2323,11 +2029,11 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
2323
2029
  typeof containerProps.style === "object" && !Array.isArray(containerProps.style) && (containerProps.style.height = props.height || "300px");
2324
2030
  return () => vueDemi.h(
2325
2031
  "div",
2326
- __spreadValues({}, containerProps),
2032
+ { ...containerProps },
2327
2033
  [
2328
2034
  vueDemi.h(
2329
2035
  "div",
2330
- __spreadValues({}, wrapperProps.value),
2036
+ { ...wrapperProps.value },
2331
2037
  list.value.map((item) => vueDemi.h(
2332
2038
  "div",
2333
2039
  { style: { overFlow: "hidden", height: item.height } },