@vueuse/components 10.4.1 → 10.6.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 +73 -37
- package/index.d.cts +13 -5
- package/index.d.mts +13 -5
- package/index.d.ts +13 -5
- package/index.iife.js +73 -37
- package/index.iife.min.js +1 -1
- package/index.mjs +75 -40
- package/package.json +4 -4
package/index.cjs
CHANGED
|
@@ -114,8 +114,7 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
114
114
|
useEventListener(window, "click", listener, { passive: true, capture }),
|
|
115
115
|
useEventListener(window, "pointerdown", (e) => {
|
|
116
116
|
const el = unrefElement(target);
|
|
117
|
-
|
|
118
|
-
shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
|
|
117
|
+
shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));
|
|
119
118
|
}, { passive: true }),
|
|
120
119
|
detectIframe && useEventListener(window, "blur", (event) => {
|
|
121
120
|
setTimeout(() => {
|
|
@@ -238,8 +237,12 @@ function onLongPress(target, handler, options) {
|
|
|
238
237
|
capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
|
|
239
238
|
once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
|
|
240
239
|
};
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
const cleanup = [
|
|
241
|
+
useEventListener(elementRef, "pointerdown", onDown, listenerOptions),
|
|
242
|
+
useEventListener(elementRef, ["pointerup", "pointerleave"], clear, listenerOptions)
|
|
243
|
+
].filter(Boolean);
|
|
244
|
+
const stop = () => cleanup.forEach((fn) => fn());
|
|
245
|
+
return stop;
|
|
243
246
|
}
|
|
244
247
|
|
|
245
248
|
const OnLongPress = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
@@ -306,6 +309,24 @@ const UseBrowserLocation = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineCompone
|
|
|
306
309
|
}
|
|
307
310
|
});
|
|
308
311
|
|
|
312
|
+
const UseClipboard = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
313
|
+
name: "UseClipboard",
|
|
314
|
+
props: [
|
|
315
|
+
"source",
|
|
316
|
+
"read",
|
|
317
|
+
"navigator",
|
|
318
|
+
"copiedDuring",
|
|
319
|
+
"legacy"
|
|
320
|
+
],
|
|
321
|
+
setup(props, { slots }) {
|
|
322
|
+
const data = vueDemi.reactive(core.useClipboard(props));
|
|
323
|
+
return () => {
|
|
324
|
+
var _a;
|
|
325
|
+
return (_a = slots.default) == null ? void 0 : _a.call(slots, data);
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
|
|
309
330
|
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
310
331
|
const globalKey = "__vueuse_ssr_handlers__";
|
|
311
332
|
const handlers = /* @__PURE__ */ getHandlers();
|
|
@@ -370,9 +391,10 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
370
391
|
eventFilter,
|
|
371
392
|
onError = (e) => {
|
|
372
393
|
console.error(e);
|
|
373
|
-
}
|
|
394
|
+
},
|
|
395
|
+
initOnMounted
|
|
374
396
|
} = options;
|
|
375
|
-
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(defaults);
|
|
397
|
+
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(typeof defaults === "function" ? defaults() : defaults);
|
|
376
398
|
if (!storage) {
|
|
377
399
|
try {
|
|
378
400
|
storage = getSSRHandler("getDefaultStorage", () => {
|
|
@@ -394,10 +416,15 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
394
416
|
{ flush, deep, eventFilter }
|
|
395
417
|
);
|
|
396
418
|
if (window && listenToStorageChanges) {
|
|
397
|
-
|
|
398
|
-
|
|
419
|
+
shared.tryOnMounted(() => {
|
|
420
|
+
useEventListener(window, "storage", update);
|
|
421
|
+
useEventListener(window, customStorageEventName, updateFromCustomEvent);
|
|
422
|
+
if (initOnMounted)
|
|
423
|
+
update();
|
|
424
|
+
});
|
|
399
425
|
}
|
|
400
|
-
|
|
426
|
+
if (!initOnMounted)
|
|
427
|
+
update();
|
|
401
428
|
return data;
|
|
402
429
|
function write(v) {
|
|
403
430
|
try {
|
|
@@ -549,9 +576,7 @@ function useColorMode(options = {}) {
|
|
|
549
576
|
const preferredDark = usePreferredDark({ window });
|
|
550
577
|
const system = vueDemi.computed(() => preferredDark.value ? "dark" : "light");
|
|
551
578
|
const store = storageRef || (storageKey == null ? shared.toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));
|
|
552
|
-
const state = vueDemi.computed(
|
|
553
|
-
() => store.value === "auto" ? system.value : store.value
|
|
554
|
-
);
|
|
579
|
+
const state = vueDemi.computed(() => store.value === "auto" ? system.value : store.value);
|
|
555
580
|
const updateHTMLAttrs = getSSRHandler(
|
|
556
581
|
"updateHTMLAttrs",
|
|
557
582
|
(selector2, attribute2, value) => {
|
|
@@ -823,9 +848,7 @@ function useResizeObserver(target, callback, options = {}) {
|
|
|
823
848
|
observer = void 0;
|
|
824
849
|
}
|
|
825
850
|
};
|
|
826
|
-
const targets = vueDemi.computed(
|
|
827
|
-
() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]
|
|
828
|
-
);
|
|
851
|
+
const targets = vueDemi.computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
|
|
829
852
|
const stopWatch = vueDemi.watch(
|
|
830
853
|
targets,
|
|
831
854
|
(els) => {
|
|
@@ -857,7 +880,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
857
880
|
});
|
|
858
881
|
const width = vueDemi.ref(initialSize.width);
|
|
859
882
|
const height = vueDemi.ref(initialSize.height);
|
|
860
|
-
useResizeObserver(
|
|
883
|
+
const { stop: stop1 } = useResizeObserver(
|
|
861
884
|
target,
|
|
862
885
|
([entry]) => {
|
|
863
886
|
const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
|
|
@@ -881,16 +904,28 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
881
904
|
},
|
|
882
905
|
options
|
|
883
906
|
);
|
|
884
|
-
|
|
907
|
+
shared.tryOnMounted(() => {
|
|
908
|
+
const ele = unrefElement(target);
|
|
909
|
+
if (ele) {
|
|
910
|
+
width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width;
|
|
911
|
+
height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
const stop2 = vueDemi.watch(
|
|
885
915
|
() => unrefElement(target),
|
|
886
916
|
(ele) => {
|
|
887
917
|
width.value = ele ? initialSize.width : 0;
|
|
888
918
|
height.value = ele ? initialSize.height : 0;
|
|
889
919
|
}
|
|
890
920
|
);
|
|
921
|
+
function stop() {
|
|
922
|
+
stop1();
|
|
923
|
+
stop2();
|
|
924
|
+
}
|
|
891
925
|
return {
|
|
892
926
|
width,
|
|
893
|
-
height
|
|
927
|
+
height,
|
|
928
|
+
stop
|
|
894
929
|
};
|
|
895
930
|
}
|
|
896
931
|
|
|
@@ -978,7 +1013,8 @@ function useIntersectionObserver(target, callback, options = {}) {
|
|
|
978
1013
|
};
|
|
979
1014
|
}
|
|
980
1015
|
|
|
981
|
-
function useElementVisibility(element,
|
|
1016
|
+
function useElementVisibility(element, options = {}) {
|
|
1017
|
+
const { window = defaultWindow, scrollTarget } = options;
|
|
982
1018
|
const elementIsVisible = vueDemi.ref(false);
|
|
983
1019
|
useIntersectionObserver(
|
|
984
1020
|
element,
|
|
@@ -1310,6 +1346,9 @@ function useScroll(element, options = {}) {
|
|
|
1310
1346
|
throttle ? shared.useThrottleFn(onScrollHandler, throttle, true, false) : onScrollHandler,
|
|
1311
1347
|
eventListenerOptions
|
|
1312
1348
|
);
|
|
1349
|
+
shared.tryOnMounted(() => {
|
|
1350
|
+
setArrivedState(shared.toValue(element));
|
|
1351
|
+
});
|
|
1313
1352
|
useEventListener(
|
|
1314
1353
|
element,
|
|
1315
1354
|
"scrollend",
|
|
@@ -1668,6 +1707,9 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1668
1707
|
},
|
|
1669
1708
|
{ immediate: true }
|
|
1670
1709
|
);
|
|
1710
|
+
const takeRecords = () => {
|
|
1711
|
+
return observer == null ? void 0 : observer.takeRecords();
|
|
1712
|
+
};
|
|
1671
1713
|
const stop = () => {
|
|
1672
1714
|
cleanup();
|
|
1673
1715
|
stopWatch();
|
|
@@ -1675,7 +1717,8 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1675
1717
|
shared.tryOnScopeDispose(stop);
|
|
1676
1718
|
return {
|
|
1677
1719
|
isSupported,
|
|
1678
|
-
stop
|
|
1720
|
+
stop,
|
|
1721
|
+
takeRecords
|
|
1679
1722
|
};
|
|
1680
1723
|
}
|
|
1681
1724
|
|
|
@@ -1843,6 +1886,7 @@ function preventDefault(rawEvent) {
|
|
|
1843
1886
|
e.preventDefault();
|
|
1844
1887
|
return false;
|
|
1845
1888
|
}
|
|
1889
|
+
const elInitialOverflow = /* @__PURE__ */ new WeakMap();
|
|
1846
1890
|
function useScrollLock(element, initialState = false) {
|
|
1847
1891
|
const isLocked = vueDemi.ref(initialState);
|
|
1848
1892
|
let stopTouchMoveListener = null;
|
|
@@ -1851,7 +1895,8 @@ function useScrollLock(element, initialState = false) {
|
|
|
1851
1895
|
const target = resolveElement(shared.toValue(el));
|
|
1852
1896
|
if (target) {
|
|
1853
1897
|
const ele = target;
|
|
1854
|
-
|
|
1898
|
+
if (!elInitialOverflow.get(ele))
|
|
1899
|
+
elInitialOverflow.set(ele, initialOverflow);
|
|
1855
1900
|
if (isLocked.value)
|
|
1856
1901
|
ele.style.overflow = "hidden";
|
|
1857
1902
|
}
|
|
@@ -1876,11 +1921,13 @@ function useScrollLock(element, initialState = false) {
|
|
|
1876
1921
|
isLocked.value = true;
|
|
1877
1922
|
};
|
|
1878
1923
|
const unlock = () => {
|
|
1924
|
+
var _a;
|
|
1879
1925
|
const el = resolveElement(shared.toValue(element));
|
|
1880
1926
|
if (!el || !isLocked.value)
|
|
1881
1927
|
return;
|
|
1882
1928
|
shared.isIOS && (stopTouchMoveListener == null ? void 0 : stopTouchMoveListener());
|
|
1883
|
-
el.style.overflow =
|
|
1929
|
+
el.style.overflow = (_a = elInitialOverflow.get(el)) != null ? _a : "";
|
|
1930
|
+
elInitialOverflow.delete(el);
|
|
1884
1931
|
isLocked.value = false;
|
|
1885
1932
|
};
|
|
1886
1933
|
shared.tryOnScopeDispose(unlock);
|
|
@@ -1947,21 +1994,9 @@ const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1947
1994
|
const { list, containerProps, wrapperProps, scrollTo } = core.useVirtualList(listRef, props.options);
|
|
1948
1995
|
expose({ scrollTo });
|
|
1949
1996
|
typeof containerProps.style === "object" && !Array.isArray(containerProps.style) && (containerProps.style.height = props.height || "300px");
|
|
1950
|
-
return () => vueDemi.h(
|
|
1951
|
-
"div",
|
|
1952
|
-
|
|
1953
|
-
[
|
|
1954
|
-
vueDemi.h(
|
|
1955
|
-
"div",
|
|
1956
|
-
{ ...wrapperProps.value },
|
|
1957
|
-
list.value.map((item) => vueDemi.h(
|
|
1958
|
-
"div",
|
|
1959
|
-
{ style: { overFlow: "hidden", height: item.height } },
|
|
1960
|
-
slots.default ? slots.default(item) : "Please set content!"
|
|
1961
|
-
))
|
|
1962
|
-
)
|
|
1963
|
-
]
|
|
1964
|
-
);
|
|
1997
|
+
return () => vueDemi.h("div", { ...containerProps }, [
|
|
1998
|
+
vueDemi.h("div", { ...wrapperProps.value }, list.value.map((item) => vueDemi.h("div", { style: { overFlow: "hidden", height: item.height } }, slots.default ? slots.default(item) : "Please set content!")))
|
|
1999
|
+
]);
|
|
1965
2000
|
}
|
|
1966
2001
|
});
|
|
1967
2002
|
|
|
@@ -1995,6 +2030,7 @@ exports.OnLongPress = OnLongPress;
|
|
|
1995
2030
|
exports.UseActiveElement = UseActiveElement;
|
|
1996
2031
|
exports.UseBattery = UseBattery;
|
|
1997
2032
|
exports.UseBrowserLocation = UseBrowserLocation;
|
|
2033
|
+
exports.UseClipboard = UseClipboard;
|
|
1998
2034
|
exports.UseColorMode = UseColorMode;
|
|
1999
2035
|
exports.UseDark = UseDark;
|
|
2000
2036
|
exports.UseDeviceMotion = UseDeviceMotion;
|
package/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vue_demi from 'vue-demi';
|
|
2
2
|
import { ComponentPublicInstance, ObjectDirective, Ref, UnwrapNestedRefs, ComputedRef, FunctionDirective } from 'vue-demi';
|
|
3
3
|
import { MaybeRef, MaybeRefOrGetter, ConfigurableEventFilter, ConfigurableFlush, Awaitable } from '@vueuse/shared';
|
|
4
|
-
import { UseDarkOptions, UseDevicesListOptions, UseDraggableOptions, ElementSize as ElementSize$1, UseGeolocationOptions, UseIdleOptions, UseMouseOptions, MouseInElementOptions, MousePressedOptions, UseNowOptions, UsePointerOptions, UseTimeAgoOptions, UseTimestampOptions, UseVirtualListOptions, UseWindowSizeOptions } from '@vueuse/core';
|
|
4
|
+
import { UseClipboardOptions, UseDarkOptions, UseDevicesListOptions, UseDraggableOptions, ElementSize as ElementSize$1, UseGeolocationOptions, UseIdleOptions, UseMouseOptions, MouseInElementOptions, MousePressedOptions, UseNowOptions, UsePointerOptions, UseTimeAgoOptions, UseTimestampOptions, UseVirtualListOptions, UseWindowSizeOptions } from '@vueuse/core';
|
|
5
5
|
|
|
6
6
|
interface ConfigurableWindow {
|
|
7
7
|
window?: Window;
|
|
@@ -108,6 +108,10 @@ declare const UseBrowserLocation: vue_demi.DefineComponent<{}, () => vue_demi.VN
|
|
|
108
108
|
[key: string]: any;
|
|
109
109
|
}>[] | undefined, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<vue_demi.ExtractPropTypes<{}>>, {}, {}>;
|
|
110
110
|
|
|
111
|
+
interface UseClipboardProps<Source = string> extends UseClipboardOptions<Source> {
|
|
112
|
+
}
|
|
113
|
+
declare const UseClipboard: vue_demi.DefineComponent<UseClipboardProps<string>, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<UseClipboardProps<string>>, {}, {}>;
|
|
114
|
+
|
|
111
115
|
interface StorageLike {
|
|
112
116
|
getItem(key: string): string | null;
|
|
113
117
|
setItem(key: string, value: string): void;
|
|
@@ -162,6 +166,12 @@ interface UseStorageOptions<T> extends ConfigurableEventFilter, ConfigurableWind
|
|
|
162
166
|
* @default false
|
|
163
167
|
*/
|
|
164
168
|
shallow?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Wait for the component to be mounted before reading the storage.
|
|
171
|
+
*
|
|
172
|
+
* @default false
|
|
173
|
+
*/
|
|
174
|
+
initOnMounted?: boolean;
|
|
165
175
|
}
|
|
166
176
|
|
|
167
177
|
type BasicColorMode = 'light' | 'dark';
|
|
@@ -297,13 +307,11 @@ interface ElementSize {
|
|
|
297
307
|
* Reactive size of an HTML element.
|
|
298
308
|
*
|
|
299
309
|
* @see https://vueuse.org/useElementSize
|
|
300
|
-
* @param target
|
|
301
|
-
* @param callback
|
|
302
|
-
* @param options
|
|
303
310
|
*/
|
|
304
311
|
declare function useElementSize(target: MaybeComputedElementRef, initialSize?: ElementSize, options?: UseResizeObserverOptions): {
|
|
305
312
|
width: vue_demi.Ref<number>;
|
|
306
313
|
height: vue_demi.Ref<number>;
|
|
314
|
+
stop: () => void;
|
|
307
315
|
};
|
|
308
316
|
|
|
309
317
|
type RemoveFirstFromTuple<T extends any[]> = T['length'] extends 0 ? undefined : (((...b: T) => void) extends (a: any, ...b: infer I) => void ? I : []);
|
|
@@ -647,4 +655,4 @@ declare const UseWindowFocus: vue_demi.DefineComponent<{}, () => vue_demi.VNode<
|
|
|
647
655
|
|
|
648
656
|
declare const UseWindowSize: vue_demi.DefineComponent<UseWindowSizeOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<UseWindowSizeOptions>, {}, {}>;
|
|
649
657
|
|
|
650
|
-
export { OnClickOutside, type OnClickOutsideProps, OnLongPress, type OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, type UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, type UseObjectUrlProps, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, type UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
|
|
658
|
+
export { OnClickOutside, type OnClickOutsideProps, OnLongPress, type OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, type UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, type UseObjectUrlProps, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, type UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
|
package/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vue_demi from 'vue-demi';
|
|
2
2
|
import { ComponentPublicInstance, ObjectDirective, Ref, UnwrapNestedRefs, ComputedRef, FunctionDirective } from 'vue-demi';
|
|
3
3
|
import { MaybeRef, MaybeRefOrGetter, ConfigurableEventFilter, ConfigurableFlush, Awaitable } from '@vueuse/shared';
|
|
4
|
-
import { UseDarkOptions, UseDevicesListOptions, UseDraggableOptions, ElementSize as ElementSize$1, UseGeolocationOptions, UseIdleOptions, UseMouseOptions, MouseInElementOptions, MousePressedOptions, UseNowOptions, UsePointerOptions, UseTimeAgoOptions, UseTimestampOptions, UseVirtualListOptions, UseWindowSizeOptions } from '@vueuse/core';
|
|
4
|
+
import { UseClipboardOptions, UseDarkOptions, UseDevicesListOptions, UseDraggableOptions, ElementSize as ElementSize$1, UseGeolocationOptions, UseIdleOptions, UseMouseOptions, MouseInElementOptions, MousePressedOptions, UseNowOptions, UsePointerOptions, UseTimeAgoOptions, UseTimestampOptions, UseVirtualListOptions, UseWindowSizeOptions } from '@vueuse/core';
|
|
5
5
|
|
|
6
6
|
interface ConfigurableWindow {
|
|
7
7
|
window?: Window;
|
|
@@ -108,6 +108,10 @@ declare const UseBrowserLocation: vue_demi.DefineComponent<{}, () => vue_demi.VN
|
|
|
108
108
|
[key: string]: any;
|
|
109
109
|
}>[] | undefined, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<vue_demi.ExtractPropTypes<{}>>, {}, {}>;
|
|
110
110
|
|
|
111
|
+
interface UseClipboardProps<Source = string> extends UseClipboardOptions<Source> {
|
|
112
|
+
}
|
|
113
|
+
declare const UseClipboard: vue_demi.DefineComponent<UseClipboardProps<string>, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<UseClipboardProps<string>>, {}, {}>;
|
|
114
|
+
|
|
111
115
|
interface StorageLike {
|
|
112
116
|
getItem(key: string): string | null;
|
|
113
117
|
setItem(key: string, value: string): void;
|
|
@@ -162,6 +166,12 @@ interface UseStorageOptions<T> extends ConfigurableEventFilter, ConfigurableWind
|
|
|
162
166
|
* @default false
|
|
163
167
|
*/
|
|
164
168
|
shallow?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Wait for the component to be mounted before reading the storage.
|
|
171
|
+
*
|
|
172
|
+
* @default false
|
|
173
|
+
*/
|
|
174
|
+
initOnMounted?: boolean;
|
|
165
175
|
}
|
|
166
176
|
|
|
167
177
|
type BasicColorMode = 'light' | 'dark';
|
|
@@ -297,13 +307,11 @@ interface ElementSize {
|
|
|
297
307
|
* Reactive size of an HTML element.
|
|
298
308
|
*
|
|
299
309
|
* @see https://vueuse.org/useElementSize
|
|
300
|
-
* @param target
|
|
301
|
-
* @param callback
|
|
302
|
-
* @param options
|
|
303
310
|
*/
|
|
304
311
|
declare function useElementSize(target: MaybeComputedElementRef, initialSize?: ElementSize, options?: UseResizeObserverOptions): {
|
|
305
312
|
width: vue_demi.Ref<number>;
|
|
306
313
|
height: vue_demi.Ref<number>;
|
|
314
|
+
stop: () => void;
|
|
307
315
|
};
|
|
308
316
|
|
|
309
317
|
type RemoveFirstFromTuple<T extends any[]> = T['length'] extends 0 ? undefined : (((...b: T) => void) extends (a: any, ...b: infer I) => void ? I : []);
|
|
@@ -647,4 +655,4 @@ declare const UseWindowFocus: vue_demi.DefineComponent<{}, () => vue_demi.VNode<
|
|
|
647
655
|
|
|
648
656
|
declare const UseWindowSize: vue_demi.DefineComponent<UseWindowSizeOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<UseWindowSizeOptions>, {}, {}>;
|
|
649
657
|
|
|
650
|
-
export { OnClickOutside, type OnClickOutsideProps, OnLongPress, type OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, type UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, type UseObjectUrlProps, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, type UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
|
|
658
|
+
export { OnClickOutside, type OnClickOutsideProps, OnLongPress, type OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, type UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, type UseObjectUrlProps, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, type UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vue_demi from 'vue-demi';
|
|
2
2
|
import { ComponentPublicInstance, ObjectDirective, Ref, UnwrapNestedRefs, ComputedRef, FunctionDirective } from 'vue-demi';
|
|
3
3
|
import { MaybeRef, MaybeRefOrGetter, ConfigurableEventFilter, ConfigurableFlush, Awaitable } from '@vueuse/shared';
|
|
4
|
-
import { UseDarkOptions, UseDevicesListOptions, UseDraggableOptions, ElementSize as ElementSize$1, UseGeolocationOptions, UseIdleOptions, UseMouseOptions, MouseInElementOptions, MousePressedOptions, UseNowOptions, UsePointerOptions, UseTimeAgoOptions, UseTimestampOptions, UseVirtualListOptions, UseWindowSizeOptions } from '@vueuse/core';
|
|
4
|
+
import { UseClipboardOptions, UseDarkOptions, UseDevicesListOptions, UseDraggableOptions, ElementSize as ElementSize$1, UseGeolocationOptions, UseIdleOptions, UseMouseOptions, MouseInElementOptions, MousePressedOptions, UseNowOptions, UsePointerOptions, UseTimeAgoOptions, UseTimestampOptions, UseVirtualListOptions, UseWindowSizeOptions } from '@vueuse/core';
|
|
5
5
|
|
|
6
6
|
interface ConfigurableWindow {
|
|
7
7
|
window?: Window;
|
|
@@ -108,6 +108,10 @@ declare const UseBrowserLocation: vue_demi.DefineComponent<{}, () => vue_demi.VN
|
|
|
108
108
|
[key: string]: any;
|
|
109
109
|
}>[] | undefined, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<vue_demi.ExtractPropTypes<{}>>, {}, {}>;
|
|
110
110
|
|
|
111
|
+
interface UseClipboardProps<Source = string> extends UseClipboardOptions<Source> {
|
|
112
|
+
}
|
|
113
|
+
declare const UseClipboard: vue_demi.DefineComponent<UseClipboardProps<string>, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<UseClipboardProps<string>>, {}, {}>;
|
|
114
|
+
|
|
111
115
|
interface StorageLike {
|
|
112
116
|
getItem(key: string): string | null;
|
|
113
117
|
setItem(key: string, value: string): void;
|
|
@@ -162,6 +166,12 @@ interface UseStorageOptions<T> extends ConfigurableEventFilter, ConfigurableWind
|
|
|
162
166
|
* @default false
|
|
163
167
|
*/
|
|
164
168
|
shallow?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Wait for the component to be mounted before reading the storage.
|
|
171
|
+
*
|
|
172
|
+
* @default false
|
|
173
|
+
*/
|
|
174
|
+
initOnMounted?: boolean;
|
|
165
175
|
}
|
|
166
176
|
|
|
167
177
|
type BasicColorMode = 'light' | 'dark';
|
|
@@ -297,13 +307,11 @@ interface ElementSize {
|
|
|
297
307
|
* Reactive size of an HTML element.
|
|
298
308
|
*
|
|
299
309
|
* @see https://vueuse.org/useElementSize
|
|
300
|
-
* @param target
|
|
301
|
-
* @param callback
|
|
302
|
-
* @param options
|
|
303
310
|
*/
|
|
304
311
|
declare function useElementSize(target: MaybeComputedElementRef, initialSize?: ElementSize, options?: UseResizeObserverOptions): {
|
|
305
312
|
width: vue_demi.Ref<number>;
|
|
306
313
|
height: vue_demi.Ref<number>;
|
|
314
|
+
stop: () => void;
|
|
307
315
|
};
|
|
308
316
|
|
|
309
317
|
type RemoveFirstFromTuple<T extends any[]> = T['length'] extends 0 ? undefined : (((...b: T) => void) extends (a: any, ...b: infer I) => void ? I : []);
|
|
@@ -647,4 +655,4 @@ declare const UseWindowFocus: vue_demi.DefineComponent<{}, () => vue_demi.VNode<
|
|
|
647
655
|
|
|
648
656
|
declare const UseWindowSize: vue_demi.DefineComponent<UseWindowSizeOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<UseWindowSizeOptions>, {}, {}>;
|
|
649
657
|
|
|
650
|
-
export { OnClickOutside, type OnClickOutsideProps, OnLongPress, type OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, type UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, type UseObjectUrlProps, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, type UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
|
|
658
|
+
export { OnClickOutside, type OnClickOutsideProps, OnLongPress, type OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, type UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, type UseObjectUrlProps, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, type UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
|
package/index.iife.js
CHANGED
|
@@ -227,8 +227,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
227
227
|
useEventListener(window, "click", listener, { passive: true, capture }),
|
|
228
228
|
useEventListener(window, "pointerdown", (e) => {
|
|
229
229
|
const el = unrefElement(target);
|
|
230
|
-
|
|
231
|
-
shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
|
|
230
|
+
shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));
|
|
232
231
|
}, { passive: true }),
|
|
233
232
|
detectIframe && useEventListener(window, "blur", (event) => {
|
|
234
233
|
setTimeout(() => {
|
|
@@ -351,8 +350,12 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
351
350
|
capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
|
|
352
351
|
once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
|
|
353
352
|
};
|
|
354
|
-
|
|
355
|
-
|
|
353
|
+
const cleanup = [
|
|
354
|
+
useEventListener(elementRef, "pointerdown", onDown, listenerOptions),
|
|
355
|
+
useEventListener(elementRef, ["pointerup", "pointerleave"], clear, listenerOptions)
|
|
356
|
+
].filter(Boolean);
|
|
357
|
+
const stop = () => cleanup.forEach((fn) => fn());
|
|
358
|
+
return stop;
|
|
356
359
|
}
|
|
357
360
|
|
|
358
361
|
const OnLongPress = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
@@ -419,6 +422,24 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
419
422
|
}
|
|
420
423
|
});
|
|
421
424
|
|
|
425
|
+
const UseClipboard = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
426
|
+
name: "UseClipboard",
|
|
427
|
+
props: [
|
|
428
|
+
"source",
|
|
429
|
+
"read",
|
|
430
|
+
"navigator",
|
|
431
|
+
"copiedDuring",
|
|
432
|
+
"legacy"
|
|
433
|
+
],
|
|
434
|
+
setup(props, { slots }) {
|
|
435
|
+
const data = vueDemi.reactive(core.useClipboard(props));
|
|
436
|
+
return () => {
|
|
437
|
+
var _a;
|
|
438
|
+
return (_a = slots.default) == null ? void 0 : _a.call(slots, data);
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
|
|
422
443
|
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
423
444
|
const globalKey = "__vueuse_ssr_handlers__";
|
|
424
445
|
const handlers = /* @__PURE__ */ getHandlers();
|
|
@@ -483,9 +504,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
483
504
|
eventFilter,
|
|
484
505
|
onError = (e) => {
|
|
485
506
|
console.error(e);
|
|
486
|
-
}
|
|
507
|
+
},
|
|
508
|
+
initOnMounted
|
|
487
509
|
} = options;
|
|
488
|
-
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(defaults);
|
|
510
|
+
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(typeof defaults === "function" ? defaults() : defaults);
|
|
489
511
|
if (!storage) {
|
|
490
512
|
try {
|
|
491
513
|
storage = getSSRHandler("getDefaultStorage", () => {
|
|
@@ -507,10 +529,15 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
507
529
|
{ flush, deep, eventFilter }
|
|
508
530
|
);
|
|
509
531
|
if (window && listenToStorageChanges) {
|
|
510
|
-
|
|
511
|
-
|
|
532
|
+
shared.tryOnMounted(() => {
|
|
533
|
+
useEventListener(window, "storage", update);
|
|
534
|
+
useEventListener(window, customStorageEventName, updateFromCustomEvent);
|
|
535
|
+
if (initOnMounted)
|
|
536
|
+
update();
|
|
537
|
+
});
|
|
512
538
|
}
|
|
513
|
-
|
|
539
|
+
if (!initOnMounted)
|
|
540
|
+
update();
|
|
514
541
|
return data;
|
|
515
542
|
function write(v) {
|
|
516
543
|
try {
|
|
@@ -662,9 +689,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
662
689
|
const preferredDark = usePreferredDark({ window });
|
|
663
690
|
const system = vueDemi.computed(() => preferredDark.value ? "dark" : "light");
|
|
664
691
|
const store = storageRef || (storageKey == null ? shared.toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));
|
|
665
|
-
const state = vueDemi.computed(
|
|
666
|
-
() => store.value === "auto" ? system.value : store.value
|
|
667
|
-
);
|
|
692
|
+
const state = vueDemi.computed(() => store.value === "auto" ? system.value : store.value);
|
|
668
693
|
const updateHTMLAttrs = getSSRHandler(
|
|
669
694
|
"updateHTMLAttrs",
|
|
670
695
|
(selector2, attribute2, value) => {
|
|
@@ -936,9 +961,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
936
961
|
observer = void 0;
|
|
937
962
|
}
|
|
938
963
|
};
|
|
939
|
-
const targets = vueDemi.computed(
|
|
940
|
-
() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]
|
|
941
|
-
);
|
|
964
|
+
const targets = vueDemi.computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
|
|
942
965
|
const stopWatch = vueDemi.watch(
|
|
943
966
|
targets,
|
|
944
967
|
(els) => {
|
|
@@ -970,7 +993,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
970
993
|
});
|
|
971
994
|
const width = vueDemi.ref(initialSize.width);
|
|
972
995
|
const height = vueDemi.ref(initialSize.height);
|
|
973
|
-
useResizeObserver(
|
|
996
|
+
const { stop: stop1 } = useResizeObserver(
|
|
974
997
|
target,
|
|
975
998
|
([entry]) => {
|
|
976
999
|
const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
|
|
@@ -994,16 +1017,28 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
994
1017
|
},
|
|
995
1018
|
options
|
|
996
1019
|
);
|
|
997
|
-
|
|
1020
|
+
shared.tryOnMounted(() => {
|
|
1021
|
+
const ele = unrefElement(target);
|
|
1022
|
+
if (ele) {
|
|
1023
|
+
width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width;
|
|
1024
|
+
height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
const stop2 = vueDemi.watch(
|
|
998
1028
|
() => unrefElement(target),
|
|
999
1029
|
(ele) => {
|
|
1000
1030
|
width.value = ele ? initialSize.width : 0;
|
|
1001
1031
|
height.value = ele ? initialSize.height : 0;
|
|
1002
1032
|
}
|
|
1003
1033
|
);
|
|
1034
|
+
function stop() {
|
|
1035
|
+
stop1();
|
|
1036
|
+
stop2();
|
|
1037
|
+
}
|
|
1004
1038
|
return {
|
|
1005
1039
|
width,
|
|
1006
|
-
height
|
|
1040
|
+
height,
|
|
1041
|
+
stop
|
|
1007
1042
|
};
|
|
1008
1043
|
}
|
|
1009
1044
|
|
|
@@ -1091,7 +1126,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1091
1126
|
};
|
|
1092
1127
|
}
|
|
1093
1128
|
|
|
1094
|
-
function useElementVisibility(element,
|
|
1129
|
+
function useElementVisibility(element, options = {}) {
|
|
1130
|
+
const { window = defaultWindow, scrollTarget } = options;
|
|
1095
1131
|
const elementIsVisible = vueDemi.ref(false);
|
|
1096
1132
|
useIntersectionObserver(
|
|
1097
1133
|
element,
|
|
@@ -1423,6 +1459,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1423
1459
|
throttle ? shared.useThrottleFn(onScrollHandler, throttle, true, false) : onScrollHandler,
|
|
1424
1460
|
eventListenerOptions
|
|
1425
1461
|
);
|
|
1462
|
+
shared.tryOnMounted(() => {
|
|
1463
|
+
setArrivedState(shared.toValue(element));
|
|
1464
|
+
});
|
|
1426
1465
|
useEventListener(
|
|
1427
1466
|
element,
|
|
1428
1467
|
"scrollend",
|
|
@@ -1781,6 +1820,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1781
1820
|
},
|
|
1782
1821
|
{ immediate: true }
|
|
1783
1822
|
);
|
|
1823
|
+
const takeRecords = () => {
|
|
1824
|
+
return observer == null ? void 0 : observer.takeRecords();
|
|
1825
|
+
};
|
|
1784
1826
|
const stop = () => {
|
|
1785
1827
|
cleanup();
|
|
1786
1828
|
stopWatch();
|
|
@@ -1788,7 +1830,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1788
1830
|
shared.tryOnScopeDispose(stop);
|
|
1789
1831
|
return {
|
|
1790
1832
|
isSupported,
|
|
1791
|
-
stop
|
|
1833
|
+
stop,
|
|
1834
|
+
takeRecords
|
|
1792
1835
|
};
|
|
1793
1836
|
}
|
|
1794
1837
|
|
|
@@ -1956,6 +1999,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1956
1999
|
e.preventDefault();
|
|
1957
2000
|
return false;
|
|
1958
2001
|
}
|
|
2002
|
+
const elInitialOverflow = /* @__PURE__ */ new WeakMap();
|
|
1959
2003
|
function useScrollLock(element, initialState = false) {
|
|
1960
2004
|
const isLocked = vueDemi.ref(initialState);
|
|
1961
2005
|
let stopTouchMoveListener = null;
|
|
@@ -1964,7 +2008,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1964
2008
|
const target = resolveElement(shared.toValue(el));
|
|
1965
2009
|
if (target) {
|
|
1966
2010
|
const ele = target;
|
|
1967
|
-
|
|
2011
|
+
if (!elInitialOverflow.get(ele))
|
|
2012
|
+
elInitialOverflow.set(ele, initialOverflow);
|
|
1968
2013
|
if (isLocked.value)
|
|
1969
2014
|
ele.style.overflow = "hidden";
|
|
1970
2015
|
}
|
|
@@ -1989,11 +2034,13 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1989
2034
|
isLocked.value = true;
|
|
1990
2035
|
};
|
|
1991
2036
|
const unlock = () => {
|
|
2037
|
+
var _a;
|
|
1992
2038
|
const el = resolveElement(shared.toValue(element));
|
|
1993
2039
|
if (!el || !isLocked.value)
|
|
1994
2040
|
return;
|
|
1995
2041
|
shared.isIOS && (stopTouchMoveListener == null ? void 0 : stopTouchMoveListener());
|
|
1996
|
-
el.style.overflow =
|
|
2042
|
+
el.style.overflow = (_a = elInitialOverflow.get(el)) != null ? _a : "";
|
|
2043
|
+
elInitialOverflow.delete(el);
|
|
1997
2044
|
isLocked.value = false;
|
|
1998
2045
|
};
|
|
1999
2046
|
shared.tryOnScopeDispose(unlock);
|
|
@@ -2060,21 +2107,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
2060
2107
|
const { list, containerProps, wrapperProps, scrollTo } = core.useVirtualList(listRef, props.options);
|
|
2061
2108
|
expose({ scrollTo });
|
|
2062
2109
|
typeof containerProps.style === "object" && !Array.isArray(containerProps.style) && (containerProps.style.height = props.height || "300px");
|
|
2063
|
-
return () => vueDemi.h(
|
|
2064
|
-
"div",
|
|
2065
|
-
|
|
2066
|
-
[
|
|
2067
|
-
vueDemi.h(
|
|
2068
|
-
"div",
|
|
2069
|
-
{ ...wrapperProps.value },
|
|
2070
|
-
list.value.map((item) => vueDemi.h(
|
|
2071
|
-
"div",
|
|
2072
|
-
{ style: { overFlow: "hidden", height: item.height } },
|
|
2073
|
-
slots.default ? slots.default(item) : "Please set content!"
|
|
2074
|
-
))
|
|
2075
|
-
)
|
|
2076
|
-
]
|
|
2077
|
-
);
|
|
2110
|
+
return () => vueDemi.h("div", { ...containerProps }, [
|
|
2111
|
+
vueDemi.h("div", { ...wrapperProps.value }, list.value.map((item) => vueDemi.h("div", { style: { overFlow: "hidden", height: item.height } }, slots.default ? slots.default(item) : "Please set content!")))
|
|
2112
|
+
]);
|
|
2078
2113
|
}
|
|
2079
2114
|
});
|
|
2080
2115
|
|
|
@@ -2108,6 +2143,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
2108
2143
|
exports.UseActiveElement = UseActiveElement;
|
|
2109
2144
|
exports.UseBattery = UseBattery;
|
|
2110
2145
|
exports.UseBrowserLocation = UseBrowserLocation;
|
|
2146
|
+
exports.UseClipboard = UseClipboard;
|
|
2111
2147
|
exports.UseColorMode = UseColorMode;
|
|
2112
2148
|
exports.UseDark = UseDark;
|
|
2113
2149
|
exports.UseDeviceMotion = UseDeviceMotion;
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(s,o,m){if(s.install)return s;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),s;if(o.version.slice(0,4)==="2.7."){let U=function(S,L){var T,W={},B={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(N,I){return W[N]=I,this},directive:function(N,I){return I?(o.directive(N,I),B):o.directive(N)},mount:function(N,I){return T||(T=new o(Object.assign({propsData:L},S,{provide:Object.assign(W,S.provide)})),T.$mount(N,I),T)},unmount:function(){T&&(T.$destroy(),T=void 0)}};return B};var x=U;for(var u in o)s[u]=o[u];s.isVue2=!0,s.isVue3=!1,s.install=function(){},s.Vue=o,s.Vue2=o,s.version=o.version,s.warn=o.util.warn,s.hasInjectionContext=()=>!!s.getCurrentInstance(),s.createApp=U}else if(o.version.slice(0,2)==="2.")if(m){for(var u in m)s[u]=m[u];s.isVue2=!0,s.isVue3=!1,s.install=function(){},s.Vue=o,s.Vue2=o,s.version=o.version,s.hasInjectionContext=()=>!!s.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var u in o)s[u]=o[u];s.isVue2=!1,s.isVue3=!0,s.install=function(){},s.Vue=o,s.Vue2=void 0,s.version=o.version,s.set=function(U,S,L){return Array.isArray(U)?(U.length=Math.max(U.length,S),U.splice(S,1,L),L):(U[S]=L,L)},s.del=function(U,S){if(Array.isArray(U)){U.splice(S,1);return}delete U[S]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return s}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(s,o,m,u){"use strict";const x=o.defineComponent({name:"OnClickOutside",props:["as","options"],emits:["trigger"],setup(e,{slots:t,emit:n}){const r=o.ref();return m.onClickOutside(r,a=>{n("trigger",a)},e.options),()=>{if(t.default)return o.h(e.as||"div",{ref:r},t.default())}}});function U(e){var t;const n=u.toValue(e);return(t=n?.$el)!=null?t:n}const S=u.isClient?window:void 0;function L(...e){let t,n,r,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,r,a]=e,t=S):[t,n,r,a]=e,!t)return u.noop;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const i=[],l=()=>{i.forEach(d=>d()),i.length=0},c=(d,v,g,w)=>(d.addEventListener(v,g,w),()=>d.removeEventListener(v,g,w)),f=o.watch(()=>[U(t),u.toValue(a)],([d,v])=>{if(l(),!d)return;const g=u.isObject(v)?{...v}:v;i.push(...n.flatMap(w=>r.map(y=>c(d,w,y,g))))},{immediate:!0,flush:"post"}),p=()=>{f(),l()};return u.tryOnScopeDispose(p),p}let T=!1;function W(e,t,n={}){const{window:r=S,ignore:a=[],capture:i=!0,detectIframe:l=!1}=n;if(!r)return;u.isIOS&&!T&&(T=!0,Array.from(r.document.body.children).forEach(g=>g.addEventListener("click",u.noop)),r.document.documentElement.addEventListener("click",u.noop));let c=!0;const f=g=>a.some(w=>{if(typeof w=="string")return Array.from(r.document.querySelectorAll(w)).some(y=>y===g.target||g.composedPath().includes(y));{const y=U(w);return y&&(g.target===y||g.composedPath().includes(y))}}),d=[L(r,"click",g=>{const w=U(e);if(!(!w||w===g.target||g.composedPath().includes(w))){if(g.detail===0&&(c=!f(g)),!c){c=!0;return}t(g)}},{passive:!0,capture:i}),L(r,"pointerdown",g=>{const w=U(e);w&&(c=!g.composedPath().includes(w)&&!f(g))},{passive:!0}),l&&L(r,"blur",g=>{setTimeout(()=>{var w;const y=U(e);((w=r.document.activeElement)==null?void 0:w.tagName)==="IFRAME"&&!y?.contains(r.document.activeElement)&&t(g)},0)})].filter(Boolean);return()=>d.forEach(g=>g())}const B={[u.directiveHooks.mounted](e,t){const n=!t.modifiers.bubble;if(typeof t.value=="function")e.__onClickOutside_stop=W(e,t.value,{capture:n});else{const[r,a]=t.value;e.__onClickOutside_stop=W(e,r,Object.assign({capture:n},a))}},[u.directiveHooks.unmounted](e){e.__onClickOutside_stop()}};function N(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function I(...e){let t,n,r={};e.length===3?(t=e[0],n=e[1],r=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],r=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:a=S,eventName:i="keydown",passive:l=!1,dedupe:c=!1}=r,f=N(t);return L(a,i,d=>{d.repeat&&u.toValue(c)||f(d)&&n(d)},l)}const de={[u.directiveHooks.mounted](e,t){var n,r;const a=(r=(n=t.arg)==null?void 0:n.split(","))!=null?r:!0;if(typeof t.value=="function")I(a,t.value,{target:e});else{const[i,l]=t.value;I(a,i,{target:e,...l})}}},pe=500;function $(e,t,n){var r,a;const i=o.computed(()=>U(e));let l;function c(){l&&(clearTimeout(l),l=void 0)}function f(d){var v,g,w,y;(v=n?.modifiers)!=null&&v.self&&d.target!==i.value||(c(),(g=n?.modifiers)!=null&&g.prevent&&d.preventDefault(),(w=n?.modifiers)!=null&&w.stop&&d.stopPropagation(),l=setTimeout(()=>t(d),(y=n?.delay)!=null?y:pe))}const p={capture:(r=n?.modifiers)==null?void 0:r.capture,once:(a=n?.modifiers)==null?void 0:a.once};L(i,"pointerdown",f,p),L(i,["pointerup","pointerleave"],c,p)}const ve=o.defineComponent({name:"OnLongPress",props:["as","options"],emits:["trigger"],setup(e,{slots:t,emit:n}){const r=o.ref();return $(r,a=>{n("trigger",a)},e.options),()=>{if(t.default)return o.h(e.as||"div",{ref:r},t.default())}}}),Z={[u.directiveHooks.mounted](e,t){typeof t.value=="function"?$(e,t.value,{modifiers:t.modifiers}):$(e,...t.value)}},ge=o.defineComponent({name:"UseActiveElement",setup(e,{slots:t}){const n=o.reactive({element:m.useActiveElement()});return()=>{if(t.default)return t.default(n)}}}),me=o.defineComponent({name:"UseBattery",setup(e,{slots:t}){const n=o.reactive(m.useBattery(e));return()=>{if(t.default)return t.default(n)}}}),he=o.defineComponent({name:"UseBrowserLocation",setup(e,{slots:t}){const n=o.reactive(m.useBrowserLocation());return()=>{if(t.default)return t.default(n)}}}),j=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},F="__vueuse_ssr_handlers__",ye=we();function we(){return F in j||(j[F]=j[F]||{}),j[F]}function D(e,t){return ye[e]||t}function Ue(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"?"object":Number.isNaN(e)?"any":"number"}const be={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},ee="vueuse-storage";function Se(e,t,n,r={}){var a;const{flush:i="pre",deep:l=!0,listenToStorageChanges:c=!0,writeDefaults:f=!0,mergeDefaults:p=!1,shallow:d,window:v=S,eventFilter:g,onError:w=h=>{console.error(h)}}=r,y=(d?o.shallowRef:o.ref)(t);if(!n)try{n=D("getDefaultStorage",()=>{var h;return(h=S)==null?void 0:h.localStorage})()}catch(h){w(h)}if(!n)return y;const O=u.toValue(t),k=Ue(O),b=(a=r.serializer)!=null?a:be[k],{pause:M,resume:z}=u.pausableWatch(y,()=>E(y.value),{flush:i,deep:l,eventFilter:g});return v&&c&&(L(v,"storage",_),L(v,ee,C)),_(),y;function E(h){try{if(h==null)n.removeItem(e);else{const P=b.write(h),A=n.getItem(e);A!==P&&(n.setItem(e,P),v&&v.dispatchEvent(new CustomEvent(ee,{detail:{key:e,oldValue:A,newValue:P,storageArea:n}})))}}catch(P){w(P)}}function V(h){const P=h?h.newValue:n.getItem(e);if(P==null)return f&&O!==null&&n.setItem(e,b.write(O)),O;if(!h&&p){const A=b.read(P);return typeof p=="function"?p(A,O):k==="object"&&!Array.isArray(A)?{...O,...A}:A}else return typeof P!="string"?P:b.read(P)}function C(h){_(h.detail)}function _(h){if(!(h&&h.storageArea!==n)){if(h&&h.key==null){y.value=O;return}if(!(h&&h.key!==e)){M();try{h?.newValue!==b.write(y.value)&&(y.value=V(h))}catch(P){w(P)}finally{h?o.nextTick(z):z()}}}}}function Ce(){const e=o.ref(!1);return o.getCurrentInstance()&&o.onMounted(()=>{e.value=!0}),e}function K(e){const t=Ce();return o.computed(()=>(t.value,!!e()))}function Oe(e,t={}){const{window:n=S}=t,r=K(()=>n&&"matchMedia"in n&&typeof n.matchMedia=="function");let a;const i=o.ref(!1),l=p=>{i.value=p.matches},c=()=>{a&&("removeEventListener"in a?a.removeEventListener("change",l):a.removeListener(l))},f=o.watchEffect(()=>{r.value&&(c(),a=n.matchMedia(u.toValue(e)),"addEventListener"in a?a.addEventListener("change",l):a.addListener(l),i.value=a.matches)});return u.tryOnScopeDispose(()=>{f(),c(),a=void 0}),i}function Ee(e){return Oe("(prefers-color-scheme: dark)",e)}function Pe(e={}){const{selector:t="html",attribute:n="class",initialValue:r="auto",window:a=S,storage:i,storageKey:l="vueuse-color-scheme",listenToStorageChanges:c=!0,storageRef:f,emitAuto:p,disableTransition:d=!0}=e,v={auto:"",light:"light",dark:"dark",...e.modes||{}},g=Ee({window:a}),w=o.computed(()=>g.value?"dark":"light"),y=f||(l==null?u.toRef(r):Se(l,r,i,{window:a,listenToStorageChanges:c})),O=o.computed(()=>y.value==="auto"?w.value:y.value),k=D("updateHTMLAttrs",(E,V,C)=>{const _=typeof E=="string"?a?.document.querySelector(E):U(E);if(!_)return;let h;if(d){h=a.document.createElement("style");const P="*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";h.appendChild(document.createTextNode(P)),a.document.head.appendChild(h)}if(V==="class"){const P=C.split(/\s/g);Object.values(v).flatMap(A=>(A||"").split(/\s/g)).filter(Boolean).forEach(A=>{P.includes(A)?_.classList.add(A):_.classList.remove(A)})}else _.setAttribute(V,C);d&&(a.getComputedStyle(h).opacity,document.head.removeChild(h))});function b(E){var V;k(t,n,(V=v[E])!=null?V:E)}function M(E){e.onChanged?e.onChanged(E,b):b(E)}o.watch(O,M,{flush:"post",immediate:!0}),u.tryOnMounted(()=>M(O.value));const z=o.computed({get(){return p?y.value:O.value},set(E){y.value=E}});try{return Object.assign(z,{store:y,system:w,state:O})}catch{return z}}const Le=o.defineComponent({name:"UseColorMode",props:["selector","attribute","modes","onChanged","storageKey","storage","emitAuto"],setup(e,{slots:t}){const n=Pe(e),r=o.reactive({mode:n,system:n.system,store:n.store});return()=>{if(t.default)return t.default(r)}}}),ke=o.defineComponent({name:"UseDark",props:["selector","attribute","valueDark","valueLight","onChanged","storageKey","storage"],setup(e,{slots:t}){const n=m.useDark(e),r=o.reactive({isDark:n,toggleDark:u.useToggle(n)});return()=>{if(t.default)return t.default(r)}}}),Ae=o.defineComponent({name:"UseDeviceMotion",setup(e,{slots:t}){const n=o.reactive(m.useDeviceMotion());return()=>{if(t.default)return t.default(n)}}}),_e=o.defineComponent({name:"UseDeviceOrientation",setup(e,{slots:t}){const n=o.reactive(m.useDeviceOrientation());return()=>{if(t.default)return t.default(n)}}}),Me=o.defineComponent({name:"UseDevicePixelRatio",setup(e,{slots:t}){const n=o.reactive({pixelRatio:m.useDevicePixelRatio()});return()=>{if(t.default)return t.default(n)}}}),Te=o.defineComponent({name:"UseDevicesList",props:["onUpdated","requestPermissions","constraints"],setup(e,{slots:t}){const n=o.reactive(m.useDevicesList(e));return()=>{if(t.default)return t.default(n)}}}),Ve=o.defineComponent({name:"UseDocumentVisibility",setup(e,{slots:t}){const n=o.reactive({visibility:m.useDocumentVisibility()});return()=>{if(t.default)return t.default(n)}}}),Ie=o.defineComponent({name:"UseDraggable",props:["storageKey","storageType","initialValue","exact","preventDefault","stopPropagation","pointerTypes","as","handle","axis","onStart","onMove","onEnd"],setup(e,{slots:t}){const n=o.ref(),r=o.computed(()=>{var f;return(f=e.handle)!=null?f:n.value}),a=e.storageKey&&m.useStorage(e.storageKey,u.toValue(e.initialValue)||{x:0,y:0},m.isClient?e.storageType==="session"?sessionStorage:localStorage:void 0),i=a||e.initialValue||{x:0,y:0},l=(f,p)=>{var d;(d=e.onEnd)==null||d.call(e,f,p),a&&(a.value.x=f.x,a.value.y=f.y)},c=o.reactive(m.useDraggable(n,{...e,handle:r,initialValue:i,onEnd:l}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n,style:`touch-action:none;${c.style}`},t.default(c))}}}),ze=o.defineComponent({name:"UseElementBounding",props:["box","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(m.useElementBounding(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function Re(e,t={}){const{delayEnter:n=0,delayLeave:r=0,window:a=S}=t,i=o.ref(!1);let l;const c=f=>{const p=f?n:r;l&&(clearTimeout(l),l=void 0),p?l=setTimeout(()=>i.value=f,p):i.value=f};return a&&(L(e,"mouseenter",()=>c(!0),{passive:!0}),L(e,"mouseleave",()=>c(!1),{passive:!0})),i}const Ne={[u.directiveHooks.mounted](e,t){if(typeof t.value=="function"){const n=Re(e);o.watch(n,r=>t.value(r))}}},He=o.defineComponent({name:"UseElementSize",props:["width","height","box","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(m.useElementSize(n,{width:e.width,height:e.height},{box:e.box}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function We(e,t,n={}){const{window:r=S,...a}=n;let i;const l=K(()=>r&&"ResizeObserver"in r),c=()=>{i&&(i.disconnect(),i=void 0)},f=o.computed(()=>Array.isArray(e)?e.map(v=>U(v)):[U(e)]),p=o.watch(f,v=>{if(c(),l.value&&r){i=new ResizeObserver(t);for(const g of v)g&&i.observe(g,a)}},{immediate:!0,flush:"post",deep:!0}),d=()=>{c(),p()};return u.tryOnScopeDispose(d),{isSupported:l,stop:d}}function Be(e,t={width:0,height:0},n={}){const{window:r=S,box:a="content-box"}=n,i=o.computed(()=>{var f,p;return(p=(f=U(e))==null?void 0:f.namespaceURI)==null?void 0:p.includes("svg")}),l=o.ref(t.width),c=o.ref(t.height);return We(e,([f])=>{const p=a==="border-box"?f.borderBoxSize:a==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(r&&i.value){const d=U(e);if(d){const v=r.getComputedStyle(d);l.value=Number.parseFloat(v.width),c.value=Number.parseFloat(v.height)}}else if(p){const d=Array.isArray(p)?p:[p];l.value=d.reduce((v,{inlineSize:g})=>v+g,0),c.value=d.reduce((v,{blockSize:g})=>v+g,0)}else l.value=f.contentRect.width,c.value=f.contentRect.height},n),o.watch(()=>U(e),f=>{l.value=f?t.width:0,c.value=f?t.height:0}),{width:l,height:c}}const je={[u.directiveHooks.mounted](e,t){var n;const r=typeof t.value=="function"?t.value:(n=t.value)==null?void 0:n[0],a=typeof t.value=="function"?[]:t.value.slice(1),{width:i,height:l}=Be(e,...a);o.watch([i,l],([c,f])=>r({width:c,height:f}))}},Fe=o.defineComponent({name:"UseElementVisibility",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive({isVisible:m.useElementVisibility(n)});return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function X(e,t,n={}){const{root:r,rootMargin:a="0px",threshold:i=.1,window:l=S,immediate:c=!0}=n,f=K(()=>l&&"IntersectionObserver"in l),p=o.computed(()=>{const y=u.toValue(e);return(Array.isArray(y)?y:[y]).map(U).filter(u.notNullish)});let d=u.noop;const v=o.ref(c),g=f.value?o.watch(()=>[p.value,U(r),v.value],([y,O])=>{if(d(),!v.value||!y.length)return;const k=new IntersectionObserver(t,{root:U(O),rootMargin:a,threshold:i});y.forEach(b=>b&&k.observe(b)),d=()=>{k.disconnect(),d=u.noop}},{immediate:c,flush:"post"}):u.noop,w=()=>{d(),g(),v.value=!1};return u.tryOnScopeDispose(w),{isSupported:f,isActive:v,pause(){d(),v.value=!1},resume(){v.value=!0},stop:w}}function q(e,{window:t=S,scrollTarget:n}={}){const r=o.ref(!1);return X(e,([{isIntersecting:a}])=>{r.value=a},{root:n,window:t,threshold:0}),r}const Ke={[u.directiveHooks.mounted](e,t){if(typeof t.value=="function"){const n=t.value,r=q(e);o.watch(r,a=>n(a),{immediate:!0})}else{const[n,r]=t.value,a=q(e,r);o.watch(a,i=>n(i),{immediate:!0})}}},Ge=o.defineComponent({name:"UseEyeDropper",props:{sRGBHex:String},setup(e,{slots:t}){const n=o.reactive(m.useEyeDropper());return()=>{if(t.default)return t.default(n)}}}),Je=o.defineComponent({name:"UseFullscreen",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(m.useFullscreen(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),Ye=o.defineComponent({name:"UseGeolocation",props:["enableHighAccuracy","maximumAge","timeout","navigator"],setup(e,{slots:t}){const n=o.reactive(m.useGeolocation(e));return()=>{if(t.default)return t.default(n)}}}),$e=o.defineComponent({name:"UseIdle",props:["timeout","events","listenForVisibilityChange","initialState"],setup(e,{slots:t}){const n=o.reactive(m.useIdle(e.timeout,e));return()=>{if(t.default)return t.default(n)}}});function Xe(e,t,n){const{immediate:r=!0,delay:a=0,onError:i=u.noop,onSuccess:l=u.noop,resetOnExecute:c=!0,shallow:f=!0,throwError:p}=n??{},d=f?o.shallowRef(t):o.ref(t),v=o.ref(!1),g=o.ref(!1),w=o.shallowRef(void 0);async function y(b=0,...M){c&&(d.value=t),w.value=void 0,v.value=!1,g.value=!0,b>0&&await u.promiseTimeout(b);const z=typeof e=="function"?e(...M):e;try{const E=await z;d.value=E,v.value=!0,l(E)}catch(E){if(w.value=E,i(E),p)throw E}finally{g.value=!1}return d.value}r&&y(a);const O={state:d,isReady:v,isLoading:g,error:w,execute:y};function k(){return new Promise((b,M)=>{u.until(g).toBe(!1).then(()=>b(O)).catch(M)})}return{...O,then(b,M){return k().then(b,M)}}}async function qe(e){return new Promise((t,n)=>{const r=new Image,{src:a,srcset:i,sizes:l,class:c,loading:f,crossorigin:p,referrerPolicy:d}=e;r.src=a,i&&(r.srcset=i),l&&(r.sizes=l),c&&(r.className=c),f&&(r.loading=f),p&&(r.crossOrigin=p),d&&(r.referrerPolicy=d),r.onload=()=>t(r),r.onerror=n})}function Qe(e,t={}){const n=Xe(()=>qe(u.toValue(e)),void 0,{resetOnExecute:!0,...t});return o.watch(()=>u.toValue(e),()=>n.execute(t.delay),{deep:!0}),n}const xe=o.defineComponent({name:"UseImage",props:["src","srcset","sizes","as","alt","class","loading","crossorigin","referrerPolicy"],setup(e,{slots:t}){const n=o.reactive(Qe(e));return()=>n.isLoading&&t.loading?t.loading(n):n.error&&t.error?t.error(n.error):t.default?t.default(n):o.h(e.as||"img",e)}}),te=1;function Q(e,t={}){const{throttle:n=0,idle:r=200,onStop:a=u.noop,onScroll:i=u.noop,offset:l={left:0,right:0,top:0,bottom:0},eventListenerOptions:c={capture:!1,passive:!0},behavior:f="auto",window:p=S}=t,d=o.ref(0),v=o.ref(0),g=o.computed({get(){return d.value},set(C){y(C,void 0)}}),w=o.computed({get(){return v.value},set(C){y(void 0,C)}});function y(C,_){var h,P,A;if(!p)return;const R=u.toValue(e);R&&((A=R instanceof Document?p.document.body:R)==null||A.scrollTo({top:(h=u.toValue(_))!=null?h:w.value,left:(P=u.toValue(C))!=null?P:g.value,behavior:u.toValue(f)}))}const O=o.ref(!1),k=o.reactive({left:!0,right:!1,top:!0,bottom:!1}),b=o.reactive({left:!1,right:!1,top:!1,bottom:!1}),M=C=>{O.value&&(O.value=!1,b.left=!1,b.right=!1,b.top=!1,b.bottom=!1,a(C))},z=u.useDebounceFn(M,n+r),E=C=>{var _;if(!p)return;const h=C.document?C.document.documentElement:(_=C.documentElement)!=null?_:C,{display:P,flexDirection:A}=getComputedStyle(h),R=h.scrollLeft;b.left=R<d.value,b.right=R>d.value;const le=Math.abs(R)<=0+(l.left||0),ue=Math.abs(R)+h.clientWidth>=h.scrollWidth-(l.right||0)-te;P==="flex"&&A==="row-reverse"?(k.left=ue,k.right=le):(k.left=le,k.right=ue),d.value=R;let H=h.scrollTop;C===p.document&&!H&&(H=p.document.body.scrollTop),b.top=H<v.value,b.bottom=H>v.value;const ce=Math.abs(H)<=0+(l.top||0),fe=Math.abs(H)+h.clientHeight>=h.scrollHeight-(l.bottom||0)-te;P==="flex"&&A==="column-reverse"?(k.top=fe,k.bottom=ce):(k.top=ce,k.bottom=fe),v.value=H},V=C=>{var _;if(!p)return;const h=(_=C.target.documentElement)!=null?_:C.target;E(h),O.value=!0,z(C),i(C)};return L(e,"scroll",n?u.useThrottleFn(V,n,!0,!1):V,c),L(e,"scrollend",M,c),{x:g,y:w,isScrolling:O,arrivedState:k,directions:b,measure(){const C=u.toValue(e);p&&C&&E(C)}}}function G(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}function ne(e,t,n={}){var r;const{direction:a="bottom",interval:i=100}=n,l=o.reactive(Q(e,{...n,offset:{[a]:(r=n.distance)!=null?r:0,...n.offset}})),c=o.ref(),f=o.computed(()=>!!c.value),p=o.computed(()=>G(u.toValue(e))),d=q(p);function v(){if(l.measure(),!p.value||!d.value)return;const{scrollHeight:g,clientHeight:w,scrollWidth:y,clientWidth:O}=p.value,k=a==="bottom"||a==="top"?g<=w:y<=O;(l.arrivedState[a]||k)&&(c.value||(c.value=Promise.all([t(l),new Promise(b=>setTimeout(b,i))]).finally(()=>{c.value=null,o.nextTick(()=>v())})))}return o.watch(()=>[l.arrivedState[a],d.value],v,{immediate:!0}),{isLoading:f}}const Ze={[u.directiveHooks.mounted](e,t){typeof t.value=="function"?ne(e,t.value):ne(e,...t.value)}},De={[u.directiveHooks.mounted](e,t){typeof t.value=="function"?X(e,t.value):X(e,...t.value)}},et=o.defineComponent({name:"UseMouse",props:["touch","resetOnTouchEnds","initialValue"],setup(e,{slots:t}){const n=o.reactive(m.useMouse(e));return()=>{if(t.default)return t.default(n)}}}),tt=o.defineComponent({name:"UseMouseElement",props:["handleOutside","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(m.useMouseInElement(n,e));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),nt=o.defineComponent({name:"UseMousePressed",props:["touch","initialValue","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(m.useMousePressed({...e,target:n}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),ot=o.defineComponent({name:"UseNetwork",setup(e,{slots:t}){const n=o.reactive(m.useNetwork());return()=>{if(t.default)return t.default(n)}}}),rt=o.defineComponent({name:"UseNow",props:["interval"],setup(e,{slots:t}){const n=o.reactive(m.useNow({...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),at=o.defineComponent({name:"UseObjectUrl",props:["object"],setup(e,{slots:t}){const n=u.toRef(e,"object"),r=m.useObjectUrl(n);return()=>{if(t.default&&r.value)return t.default(r)}}}),st=o.defineComponent({name:"UseOffsetPagination",props:["total","page","pageSize","onPageChange","onPageSizeChange","onPageCountChange"],emits:["page-change","page-size-change","page-count-change"],setup(e,{slots:t,emit:n}){const r=o.reactive(m.useOffsetPagination({...e,onPageChange(...a){var i;(i=e.onPageChange)==null||i.call(e,...a),n("page-change",...a)},onPageSizeChange(...a){var i;(i=e.onPageSizeChange)==null||i.call(e,...a),n("page-size-change",...a)},onPageCountChange(...a){var i;(i=e.onPageCountChange)==null||i.call(e,...a),n("page-count-change",...a)}}));return()=>{if(t.default)return t.default(r)}}}),it=o.defineComponent({name:"UseOnline",setup(e,{slots:t}){const n=o.reactive({isOnline:m.useOnline()});return()=>{if(t.default)return t.default(n)}}}),lt=o.defineComponent({name:"UsePageLeave",setup(e,{slots:t}){const n=o.reactive({isLeft:m.usePageLeave()});return()=>{if(t.default)return t.default(n)}}}),ut=o.defineComponent({name:"UsePointer",props:["pointerTypes","initialValue","target"],setup(e,{slots:t}){const n=o.ref(null),r=o.reactive(m.usePointer({...e,target:e.target==="self"?n:S}));return()=>{if(t.default)return t.default(r,{ref:n})}}}),ct=o.defineComponent({name:"UsePointerLock",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(m.usePointerLock(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),ft=o.defineComponent({name:"UsePreferredColorScheme",setup(e,{slots:t}){const n=o.reactive({colorScheme:m.usePreferredColorScheme()});return()=>{if(t.default)return t.default(n)}}}),dt=o.defineComponent({name:"UsePreferredContrast",setup(e,{slots:t}){const n=o.reactive({contrast:m.usePreferredContrast()});return()=>{if(t.default)return t.default(n)}}}),pt=o.defineComponent({name:"UsePreferredDark",setup(e,{slots:t}){const n=o.reactive({prefersDark:m.usePreferredDark()});return()=>{if(t.default)return t.default(n)}}}),vt=o.defineComponent({name:"UsePreferredLanguages",setup(e,{slots:t}){const n=o.reactive({languages:m.usePreferredLanguages()});return()=>{if(t.default)return t.default(n)}}}),gt=o.defineComponent({name:"UsePreferredReducedMotion",setup(e,{slots:t}){const n=o.reactive({motion:m.usePreferredReducedMotion()});return()=>{if(t.default)return t.default(n)}}});function mt(e,t,n={}){const{window:r=S,...a}=n;let i;const l=K(()=>r&&"MutationObserver"in r),c=()=>{i&&(i.disconnect(),i=void 0)},f=o.watch(()=>U(e),d=>{c(),l.value&&r&&d&&(i=new MutationObserver(t),i.observe(d,a))},{immediate:!0}),p=()=>{c(),f()};return u.tryOnScopeDispose(p),{isSupported:l,stop:p}}function J(e,t,n={}){const{window:r=S,initialValue:a="",observe:i=!1}=n,l=o.ref(a),c=o.computed(()=>{var p;return U(t)||((p=r?.document)==null?void 0:p.documentElement)});function f(){var p;const d=u.toValue(e),v=u.toValue(c);if(v&&r){const g=(p=r.getComputedStyle(v).getPropertyValue(d))==null?void 0:p.trim();l.value=g||a}}return i&&mt(c,f,{attributeFilter:["style","class"],window:r}),o.watch([c,()=>u.toValue(e)],f,{immediate:!0}),o.watch(l,p=>{var d;(d=c.value)!=null&&d.style&&c.value.style.setProperty(u.toValue(e),p)}),l}const oe="--vueuse-safe-area-top",re="--vueuse-safe-area-right",ae="--vueuse-safe-area-bottom",se="--vueuse-safe-area-left";function ht(){const e=o.ref(""),t=o.ref(""),n=o.ref(""),r=o.ref("");if(u.isClient){const i=J(oe),l=J(re),c=J(ae),f=J(se);i.value="env(safe-area-inset-top, 0px)",l.value="env(safe-area-inset-right, 0px)",c.value="env(safe-area-inset-bottom, 0px)",f.value="env(safe-area-inset-left, 0px)",a(),L("resize",u.useDebounceFn(a))}function a(){e.value=Y(oe),t.value=Y(re),n.value=Y(ae),r.value=Y(se)}return{top:e,right:t,bottom:n,left:r,update:a}}function Y(e){return getComputedStyle(document.documentElement).getPropertyValue(e)}const yt=o.defineComponent({name:"UseScreenSafeArea",props:{top:Boolean,right:Boolean,bottom:Boolean,left:Boolean},setup(e,{slots:t}){const{top:n,right:r,bottom:a,left:i}=ht();return()=>{if(t.default)return o.h("div",{style:{paddingTop:e.top?n.value:"",paddingRight:e.right?r.value:"",paddingBottom:e.bottom?a.value:"",paddingLeft:e.left?i.value:"",boxSizing:"border-box",maxHeight:"100vh",maxWidth:"100vw",overflow:"auto"}},t.default())}}}),wt={[u.directiveHooks.mounted](e,t){if(typeof t.value=="function"){const n=t.value,r=Q(e,{onScroll(){n(r)},onStop(){n(r)}})}else{const[n,r]=t.value,a=Q(e,{...r,onScroll(i){var l;(l=r.onScroll)==null||l.call(r,i),n(a)},onStop(i){var l;(l=r.onStop)==null||l.call(r,i),n(a)}})}}};function ie(e){const t=window.getComputedStyle(e);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&e.clientWidth<e.scrollWidth||t.overflowY==="auto"&&e.clientHeight<e.scrollHeight)return!0;{const n=e.parentNode;return!n||n.tagName==="BODY"?!1:ie(n)}}function Ut(e){const t=e||window.event,n=t.target;return ie(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}function bt(e,t=!1){const n=o.ref(t);let r=null,a;o.watch(u.toRef(e),c=>{const f=G(u.toValue(c));if(f){const p=f;a=p.style.overflow,n.value&&(p.style.overflow="hidden")}},{immediate:!0});const i=()=>{const c=G(u.toValue(e));!c||n.value||(u.isIOS&&(r=L(c,"touchmove",f=>{Ut(f)},{passive:!1})),c.style.overflow="hidden",n.value=!0)},l=()=>{const c=G(u.toValue(e));!c||!n.value||(u.isIOS&&r?.(),c.style.overflow=a,n.value=!1)};return u.tryOnScopeDispose(l),o.computed({get(){return n.value},set(c){c?i():l()}})}function St(){let e=!1;const t=o.ref(!1);return(n,r)=>{if(t.value=r.value,e)return;e=!0;const a=bt(n,r.value);o.watch(t,i=>a.value=i)}}const Ct=St(),Ot=o.defineComponent({name:"UseTimeAgo",props:["time","updateInterval","max","fullDateFormatter","messages","showSecond"],setup(e,{slots:t}){const n=o.reactive(m.useTimeAgo(()=>e.time,{...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),Et=o.defineComponent({name:"UseTimestamp",props:["immediate","interval","offset"],setup(e,{slots:t}){const n=o.reactive(m.useTimestamp({...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),Pt=o.defineComponent({name:"UseVirtualList",props:["list","options","height"],setup(e,{slots:t,expose:n}){const{list:r}=o.toRefs(e),{list:a,containerProps:i,wrapperProps:l,scrollTo:c}=m.useVirtualList(r,e.options);return n({scrollTo:c}),typeof i.style=="object"&&!Array.isArray(i.style)&&(i.style.height=e.height||"300px"),()=>o.h("div",{...i},[o.h("div",{...l.value},a.value.map(f=>o.h("div",{style:{overFlow:"hidden",height:f.height}},t.default?t.default(f):"Please set content!")))])}}),Lt=o.defineComponent({name:"UseWindowFocus",setup(e,{slots:t}){const n=o.reactive({focused:m.useWindowFocus()});return()=>{if(t.default)return t.default(n)}}}),kt=o.defineComponent({name:"UseWindowSize",props:["initialWidth","initialHeight"],setup(e,{slots:t}){const n=o.reactive(m.useWindowSize(e));return()=>{if(t.default)return t.default(n)}}});s.OnClickOutside=x,s.OnLongPress=ve,s.UseActiveElement=ge,s.UseBattery=me,s.UseBrowserLocation=he,s.UseColorMode=Le,s.UseDark=ke,s.UseDeviceMotion=Ae,s.UseDeviceOrientation=_e,s.UseDevicePixelRatio=Me,s.UseDevicesList=Te,s.UseDocumentVisibility=Ve,s.UseDraggable=Ie,s.UseElementBounding=ze,s.UseElementSize=He,s.UseElementVisibility=Fe,s.UseEyeDropper=Ge,s.UseFullscreen=Je,s.UseGeolocation=Ye,s.UseIdle=$e,s.UseImage=xe,s.UseMouse=et,s.UseMouseInElement=tt,s.UseMousePressed=nt,s.UseNetwork=ot,s.UseNow=rt,s.UseObjectUrl=at,s.UseOffsetPagination=st,s.UseOnline=it,s.UsePageLeave=lt,s.UsePointer=ut,s.UsePointerLock=ct,s.UsePreferredColorScheme=ft,s.UsePreferredContrast=dt,s.UsePreferredDark=pt,s.UsePreferredLanguages=vt,s.UsePreferredReducedMotion=gt,s.UseScreenSafeArea=yt,s.UseTimeAgo=Ot,s.UseTimestamp=Et,s.UseVirtualList=Pt,s.UseWindowFocus=Lt,s.UseWindowSize=kt,s.VOnClickOutside=B,s.VOnLongPress=Z,s.vElementHover=Ne,s.vElementSize=je,s.vElementVisibility=Ke,s.vInfiniteScroll=Ze,s.vIntersectionObserver=De,s.vOnClickOutside=B,s.vOnKeyStroke=de,s.vOnLongPress=Z,s.vScroll=wt,s.vScrollLock=Ct})(this.VueUse=this.VueUse||{},VueDemi,VueUse,VueUse);
|
|
1
|
+
var VueDemi=function(s,o,h){if(s.install)return s;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),s;if(o.version.slice(0,4)==="2.7."){let U=function(O,_){var V,W={},B={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(H,R){return W[H]=R,this},directive:function(H,R){return R?(o.directive(H,R),B):o.directive(H)},mount:function(H,R){return V||(V=new o(Object.assign({propsData:_},O,{provide:Object.assign(W,O.provide)})),V.$mount(H,R),V)},unmount:function(){V&&(V.$destroy(),V=void 0)}};return B};var x=U;for(var u in o)s[u]=o[u];s.isVue2=!0,s.isVue3=!1,s.install=function(){},s.Vue=o,s.Vue2=o,s.version=o.version,s.warn=o.util.warn,s.hasInjectionContext=()=>!!s.getCurrentInstance(),s.createApp=U}else if(o.version.slice(0,2)==="2.")if(h){for(var u in h)s[u]=h[u];s.isVue2=!0,s.isVue3=!1,s.install=function(){},s.Vue=o,s.Vue2=o,s.version=o.version,s.hasInjectionContext=()=>!!s.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var u in o)s[u]=o[u];s.isVue2=!1,s.isVue3=!0,s.install=function(){},s.Vue=o,s.Vue2=void 0,s.version=o.version,s.set=function(U,O,_){return Array.isArray(U)?(U.length=Math.max(U.length,O),U.splice(O,1,_),_):(U[O]=_,_)},s.del=function(U,O){if(Array.isArray(U)){U.splice(O,1);return}delete U[O]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return s}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(s,o,h,u){"use strict";const x=o.defineComponent({name:"OnClickOutside",props:["as","options"],emits:["trigger"],setup(e,{slots:t,emit:n}){const r=o.ref();return h.onClickOutside(r,a=>{n("trigger",a)},e.options),()=>{if(t.default)return o.h(e.as||"div",{ref:r},t.default())}}});function U(e){var t;const n=u.toValue(e);return(t=n?.$el)!=null?t:n}const O=u.isClient?window:void 0;function _(...e){let t,n,r,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,r,a]=e,t=O):[t,n,r,a]=e,!t)return u.noop;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const i=[],l=()=>{i.forEach(v=>v()),i.length=0},c=(v,f,p,m)=>(v.addEventListener(f,p,m),()=>v.removeEventListener(f,p,m)),d=o.watch(()=>[U(t),u.toValue(a)],([v,f])=>{if(l(),!v)return;const p=u.isObject(f)?{...f}:f;i.push(...n.flatMap(m=>r.map(y=>c(v,m,y,p))))},{immediate:!0,flush:"post"}),g=()=>{d(),l()};return u.tryOnScopeDispose(g),g}let V=!1;function W(e,t,n={}){const{window:r=O,ignore:a=[],capture:i=!0,detectIframe:l=!1}=n;if(!r)return;u.isIOS&&!V&&(V=!0,Array.from(r.document.body.children).forEach(p=>p.addEventListener("click",u.noop)),r.document.documentElement.addEventListener("click",u.noop));let c=!0;const d=p=>a.some(m=>{if(typeof m=="string")return Array.from(r.document.querySelectorAll(m)).some(y=>y===p.target||p.composedPath().includes(y));{const y=U(m);return y&&(p.target===y||p.composedPath().includes(y))}}),v=[_(r,"click",p=>{const m=U(e);if(!(!m||m===p.target||p.composedPath().includes(m))){if(p.detail===0&&(c=!d(p)),!c){c=!0;return}t(p)}},{passive:!0,capture:i}),_(r,"pointerdown",p=>{const m=U(e);c=!d(p)&&!!(m&&!p.composedPath().includes(m))},{passive:!0}),l&&_(r,"blur",p=>{setTimeout(()=>{var m;const y=U(e);((m=r.document.activeElement)==null?void 0:m.tagName)==="IFRAME"&&!y?.contains(r.document.activeElement)&&t(p)},0)})].filter(Boolean);return()=>v.forEach(p=>p())}const B={[u.directiveHooks.mounted](e,t){const n=!t.modifiers.bubble;if(typeof t.value=="function")e.__onClickOutside_stop=W(e,t.value,{capture:n});else{const[r,a]=t.value;e.__onClickOutside_stop=W(e,r,Object.assign({capture:n},a))}},[u.directiveHooks.unmounted](e){e.__onClickOutside_stop()}};function H(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function R(...e){let t,n,r={};e.length===3?(t=e[0],n=e[1],r=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],r=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:a=O,eventName:i="keydown",passive:l=!1,dedupe:c=!1}=r,d=H(t);return _(a,i,v=>{v.repeat&&u.toValue(c)||d(v)&&n(v)},l)}const pe={[u.directiveHooks.mounted](e,t){var n,r;const a=(r=(n=t.arg)==null?void 0:n.split(","))!=null?r:!0;if(typeof t.value=="function")R(a,t.value,{target:e});else{const[i,l]=t.value;R(a,i,{target:e,...l})}}},ve=500;function X(e,t,n){var r,a;const i=o.computed(()=>U(e));let l;function c(){l&&(clearTimeout(l),l=void 0)}function d(p){var m,y,b,C;(m=n?.modifiers)!=null&&m.self&&p.target!==i.value||(c(),(y=n?.modifiers)!=null&&y.prevent&&p.preventDefault(),(b=n?.modifiers)!=null&&b.stop&&p.stopPropagation(),l=setTimeout(()=>t(p),(C=n?.delay)!=null?C:ve))}const g={capture:(r=n?.modifiers)==null?void 0:r.capture,once:(a=n?.modifiers)==null?void 0:a.once},v=[_(i,"pointerdown",d,g),_(i,["pointerup","pointerleave"],c,g)].filter(Boolean);return()=>v.forEach(p=>p())}const ge=o.defineComponent({name:"OnLongPress",props:["as","options"],emits:["trigger"],setup(e,{slots:t,emit:n}){const r=o.ref();return X(r,a=>{n("trigger",a)},e.options),()=>{if(t.default)return o.h(e.as||"div",{ref:r},t.default())}}}),D={[u.directiveHooks.mounted](e,t){typeof t.value=="function"?X(e,t.value,{modifiers:t.modifiers}):X(e,...t.value)}},he=o.defineComponent({name:"UseActiveElement",setup(e,{slots:t}){const n=o.reactive({element:h.useActiveElement()});return()=>{if(t.default)return t.default(n)}}}),me=o.defineComponent({name:"UseBattery",setup(e,{slots:t}){const n=o.reactive(h.useBattery(e));return()=>{if(t.default)return t.default(n)}}}),ye=o.defineComponent({name:"UseBrowserLocation",setup(e,{slots:t}){const n=o.reactive(h.useBrowserLocation());return()=>{if(t.default)return t.default(n)}}}),we=o.defineComponent({name:"UseClipboard",props:["source","read","navigator","copiedDuring","legacy"],setup(e,{slots:t}){const n=o.reactive(h.useClipboard(e));return()=>{var r;return(r=t.default)==null?void 0:r.call(t,n)}}}),j=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},F="__vueuse_ssr_handlers__",Ue=be();function be(){return F in j||(j[F]=j[F]||{}),j[F]}function ee(e,t){return Ue[e]||t}function Ce(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"?"object":Number.isNaN(e)?"any":"number"}const Se={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},te="vueuse-storage";function Oe(e,t,n,r={}){var a;const{flush:i="pre",deep:l=!0,listenToStorageChanges:c=!0,writeDefaults:d=!0,mergeDefaults:g=!1,shallow:v,window:f=O,eventFilter:p,onError:m=w=>{console.error(w)},initOnMounted:y}=r,b=(v?o.shallowRef:o.ref)(typeof t=="function"?t():t);if(!n)try{n=ee("getDefaultStorage",()=>{var w;return(w=O)==null?void 0:w.localStorage})()}catch(w){m(w)}if(!n)return b;const C=u.toValue(t),S=Ce(C),A=(a=r.serializer)!=null?a:Se[S],{pause:z,resume:E}=u.pausableWatch(b,()=>I(b.value),{flush:i,deep:l,eventFilter:p});return f&&c&&u.tryOnMounted(()=>{_(f,"storage",k),_(f,te,T),y&&k()}),y||k(),b;function I(w){try{if(w==null)n.removeItem(e);else{const L=A.write(w),M=n.getItem(e);M!==L&&(n.setItem(e,L),f&&f.dispatchEvent(new CustomEvent(te,{detail:{key:e,oldValue:M,newValue:L,storageArea:n}})))}}catch(L){m(L)}}function P(w){const L=w?w.newValue:n.getItem(e);if(L==null)return d&&C!==null&&n.setItem(e,A.write(C)),C;if(!w&&g){const M=A.read(L);return typeof g=="function"?g(M,C):S==="object"&&!Array.isArray(M)?{...C,...M}:M}else return typeof L!="string"?L:A.read(L)}function T(w){k(w.detail)}function k(w){if(!(w&&w.storageArea!==n)){if(w&&w.key==null){b.value=C;return}if(!(w&&w.key!==e)){z();try{w?.newValue!==A.write(b.value)&&(b.value=P(w))}catch(L){m(L)}finally{w?o.nextTick(E):E()}}}}}function Ee(){const e=o.ref(!1);return o.getCurrentInstance()&&o.onMounted(()=>{e.value=!0}),e}function K(e){const t=Ee();return o.computed(()=>(t.value,!!e()))}function Pe(e,t={}){const{window:n=O}=t,r=K(()=>n&&"matchMedia"in n&&typeof n.matchMedia=="function");let a;const i=o.ref(!1),l=g=>{i.value=g.matches},c=()=>{a&&("removeEventListener"in a?a.removeEventListener("change",l):a.removeListener(l))},d=o.watchEffect(()=>{r.value&&(c(),a=n.matchMedia(u.toValue(e)),"addEventListener"in a?a.addEventListener("change",l):a.addListener(l),i.value=a.matches)});return u.tryOnScopeDispose(()=>{d(),c(),a=void 0}),i}function Le(e){return Pe("(prefers-color-scheme: dark)",e)}function ke(e={}){const{selector:t="html",attribute:n="class",initialValue:r="auto",window:a=O,storage:i,storageKey:l="vueuse-color-scheme",listenToStorageChanges:c=!0,storageRef:d,emitAuto:g,disableTransition:v=!0}=e,f={auto:"",light:"light",dark:"dark",...e.modes||{}},p=Le({window:a}),m=o.computed(()=>p.value?"dark":"light"),y=d||(l==null?u.toRef(r):Oe(l,r,i,{window:a,listenToStorageChanges:c})),b=o.computed(()=>y.value==="auto"?m.value:y.value),C=ee("updateHTMLAttrs",(E,I,P)=>{const T=typeof E=="string"?a?.document.querySelector(E):U(E);if(!T)return;let k;if(v){k=a.document.createElement("style");const w="*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";k.appendChild(document.createTextNode(w)),a.document.head.appendChild(k)}if(I==="class"){const w=P.split(/\s/g);Object.values(f).flatMap(L=>(L||"").split(/\s/g)).filter(Boolean).forEach(L=>{w.includes(L)?T.classList.add(L):T.classList.remove(L)})}else T.setAttribute(I,P);v&&(a.getComputedStyle(k).opacity,document.head.removeChild(k))});function S(E){var I;C(t,n,(I=f[E])!=null?I:E)}function A(E){e.onChanged?e.onChanged(E,S):S(E)}o.watch(b,A,{flush:"post",immediate:!0}),u.tryOnMounted(()=>A(b.value));const z=o.computed({get(){return g?y.value:b.value},set(E){y.value=E}});try{return Object.assign(z,{store:y,system:m,state:b})}catch{return z}}const _e=o.defineComponent({name:"UseColorMode",props:["selector","attribute","modes","onChanged","storageKey","storage","emitAuto"],setup(e,{slots:t}){const n=ke(e),r=o.reactive({mode:n,system:n.system,store:n.store});return()=>{if(t.default)return t.default(r)}}}),Ae=o.defineComponent({name:"UseDark",props:["selector","attribute","valueDark","valueLight","onChanged","storageKey","storage"],setup(e,{slots:t}){const n=h.useDark(e),r=o.reactive({isDark:n,toggleDark:u.useToggle(n)});return()=>{if(t.default)return t.default(r)}}}),Me=o.defineComponent({name:"UseDeviceMotion",setup(e,{slots:t}){const n=o.reactive(h.useDeviceMotion());return()=>{if(t.default)return t.default(n)}}}),Te=o.defineComponent({name:"UseDeviceOrientation",setup(e,{slots:t}){const n=o.reactive(h.useDeviceOrientation());return()=>{if(t.default)return t.default(n)}}}),Ve=o.defineComponent({name:"UseDevicePixelRatio",setup(e,{slots:t}){const n=o.reactive({pixelRatio:h.useDevicePixelRatio()});return()=>{if(t.default)return t.default(n)}}}),Ie=o.defineComponent({name:"UseDevicesList",props:["onUpdated","requestPermissions","constraints"],setup(e,{slots:t}){const n=o.reactive(h.useDevicesList(e));return()=>{if(t.default)return t.default(n)}}}),Re=o.defineComponent({name:"UseDocumentVisibility",setup(e,{slots:t}){const n=o.reactive({visibility:h.useDocumentVisibility()});return()=>{if(t.default)return t.default(n)}}}),He=o.defineComponent({name:"UseDraggable",props:["storageKey","storageType","initialValue","exact","preventDefault","stopPropagation","pointerTypes","as","handle","axis","onStart","onMove","onEnd"],setup(e,{slots:t}){const n=o.ref(),r=o.computed(()=>{var d;return(d=e.handle)!=null?d:n.value}),a=e.storageKey&&h.useStorage(e.storageKey,u.toValue(e.initialValue)||{x:0,y:0},h.isClient?e.storageType==="session"?sessionStorage:localStorage:void 0),i=a||e.initialValue||{x:0,y:0},l=(d,g)=>{var v;(v=e.onEnd)==null||v.call(e,d,g),a&&(a.value.x=d.x,a.value.y=d.y)},c=o.reactive(h.useDraggable(n,{...e,handle:r,initialValue:i,onEnd:l}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n,style:`touch-action:none;${c.style}`},t.default(c))}}}),ze=o.defineComponent({name:"UseElementBounding",props:["box","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(h.useElementBounding(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function Ne(e,t={}){const{delayEnter:n=0,delayLeave:r=0,window:a=O}=t,i=o.ref(!1);let l;const c=d=>{const g=d?n:r;l&&(clearTimeout(l),l=void 0),g?l=setTimeout(()=>i.value=d,g):i.value=d};return a&&(_(e,"mouseenter",()=>c(!0),{passive:!0}),_(e,"mouseleave",()=>c(!1),{passive:!0})),i}const We={[u.directiveHooks.mounted](e,t){if(typeof t.value=="function"){const n=Ne(e);o.watch(n,r=>t.value(r))}}},Be=o.defineComponent({name:"UseElementSize",props:["width","height","box","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(h.useElementSize(n,{width:e.width,height:e.height},{box:e.box}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function je(e,t,n={}){const{window:r=O,...a}=n;let i;const l=K(()=>r&&"ResizeObserver"in r),c=()=>{i&&(i.disconnect(),i=void 0)},d=o.computed(()=>Array.isArray(e)?e.map(f=>U(f)):[U(e)]),g=o.watch(d,f=>{if(c(),l.value&&r){i=new ResizeObserver(t);for(const p of f)p&&i.observe(p,a)}},{immediate:!0,flush:"post",deep:!0}),v=()=>{c(),g()};return u.tryOnScopeDispose(v),{isSupported:l,stop:v}}function Fe(e,t={width:0,height:0},n={}){const{window:r=O,box:a="content-box"}=n,i=o.computed(()=>{var f,p;return(p=(f=U(e))==null?void 0:f.namespaceURI)==null?void 0:p.includes("svg")}),l=o.ref(t.width),c=o.ref(t.height),{stop:d}=je(e,([f])=>{const p=a==="border-box"?f.borderBoxSize:a==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(r&&i.value){const m=U(e);if(m){const y=r.getComputedStyle(m);l.value=Number.parseFloat(y.width),c.value=Number.parseFloat(y.height)}}else if(p){const m=Array.isArray(p)?p:[p];l.value=m.reduce((y,{inlineSize:b})=>y+b,0),c.value=m.reduce((y,{blockSize:b})=>y+b,0)}else l.value=f.contentRect.width,c.value=f.contentRect.height},n);u.tryOnMounted(()=>{const f=U(e);f&&(l.value="offsetWidth"in f?f.offsetWidth:t.width,c.value="offsetHeight"in f?f.offsetHeight:t.height)});const g=o.watch(()=>U(e),f=>{l.value=f?t.width:0,c.value=f?t.height:0});function v(){d(),g()}return{width:l,height:c,stop:v}}const Ke={[u.directiveHooks.mounted](e,t){var n;const r=typeof t.value=="function"?t.value:(n=t.value)==null?void 0:n[0],a=typeof t.value=="function"?[]:t.value.slice(1),{width:i,height:l}=Fe(e,...a);o.watch([i,l],([c,d])=>r({width:c,height:d}))}},Ge=o.defineComponent({name:"UseElementVisibility",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive({isVisible:h.useElementVisibility(n)});return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function q(e,t,n={}){const{root:r,rootMargin:a="0px",threshold:i=.1,window:l=O,immediate:c=!0}=n,d=K(()=>l&&"IntersectionObserver"in l),g=o.computed(()=>{const y=u.toValue(e);return(Array.isArray(y)?y:[y]).map(U).filter(u.notNullish)});let v=u.noop;const f=o.ref(c),p=d.value?o.watch(()=>[g.value,U(r),f.value],([y,b])=>{if(v(),!f.value||!y.length)return;const C=new IntersectionObserver(t,{root:U(b),rootMargin:a,threshold:i});y.forEach(S=>S&&C.observe(S)),v=()=>{C.disconnect(),v=u.noop}},{immediate:c,flush:"post"}):u.noop,m=()=>{v(),p(),f.value=!1};return u.tryOnScopeDispose(m),{isSupported:d,isActive:f,pause(){v(),f.value=!1},resume(){f.value=!0},stop:m}}function Q(e,t={}){const{window:n=O,scrollTarget:r}=t,a=o.ref(!1);return q(e,([{isIntersecting:i}])=>{a.value=i},{root:r,window:n,threshold:0}),a}const Je={[u.directiveHooks.mounted](e,t){if(typeof t.value=="function"){const n=t.value,r=Q(e);o.watch(r,a=>n(a),{immediate:!0})}else{const[n,r]=t.value,a=Q(e,r);o.watch(a,i=>n(i),{immediate:!0})}}},Ye=o.defineComponent({name:"UseEyeDropper",props:{sRGBHex:String},setup(e,{slots:t}){const n=o.reactive(h.useEyeDropper());return()=>{if(t.default)return t.default(n)}}}),$e=o.defineComponent({name:"UseFullscreen",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(h.useFullscreen(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),Xe=o.defineComponent({name:"UseGeolocation",props:["enableHighAccuracy","maximumAge","timeout","navigator"],setup(e,{slots:t}){const n=o.reactive(h.useGeolocation(e));return()=>{if(t.default)return t.default(n)}}}),qe=o.defineComponent({name:"UseIdle",props:["timeout","events","listenForVisibilityChange","initialState"],setup(e,{slots:t}){const n=o.reactive(h.useIdle(e.timeout,e));return()=>{if(t.default)return t.default(n)}}});function Qe(e,t,n){const{immediate:r=!0,delay:a=0,onError:i=u.noop,onSuccess:l=u.noop,resetOnExecute:c=!0,shallow:d=!0,throwError:g}=n??{},v=d?o.shallowRef(t):o.ref(t),f=o.ref(!1),p=o.ref(!1),m=o.shallowRef(void 0);async function y(S=0,...A){c&&(v.value=t),m.value=void 0,f.value=!1,p.value=!0,S>0&&await u.promiseTimeout(S);const z=typeof e=="function"?e(...A):e;try{const E=await z;v.value=E,f.value=!0,l(E)}catch(E){if(m.value=E,i(E),g)throw E}finally{p.value=!1}return v.value}r&&y(a);const b={state:v,isReady:f,isLoading:p,error:m,execute:y};function C(){return new Promise((S,A)=>{u.until(p).toBe(!1).then(()=>S(b)).catch(A)})}return{...b,then(S,A){return C().then(S,A)}}}async function Ze(e){return new Promise((t,n)=>{const r=new Image,{src:a,srcset:i,sizes:l,class:c,loading:d,crossorigin:g,referrerPolicy:v}=e;r.src=a,i&&(r.srcset=i),l&&(r.sizes=l),c&&(r.className=c),d&&(r.loading=d),g&&(r.crossOrigin=g),v&&(r.referrerPolicy=v),r.onload=()=>t(r),r.onerror=n})}function xe(e,t={}){const n=Qe(()=>Ze(u.toValue(e)),void 0,{resetOnExecute:!0,...t});return o.watch(()=>u.toValue(e),()=>n.execute(t.delay),{deep:!0}),n}const De=o.defineComponent({name:"UseImage",props:["src","srcset","sizes","as","alt","class","loading","crossorigin","referrerPolicy"],setup(e,{slots:t}){const n=o.reactive(xe(e));return()=>n.isLoading&&t.loading?t.loading(n):n.error&&t.error?t.error(n.error):t.default?t.default(n):o.h(e.as||"img",e)}}),ne=1;function Z(e,t={}){const{throttle:n=0,idle:r=200,onStop:a=u.noop,onScroll:i=u.noop,offset:l={left:0,right:0,top:0,bottom:0},eventListenerOptions:c={capture:!1,passive:!0},behavior:d="auto",window:g=O}=t,v=o.ref(0),f=o.ref(0),p=o.computed({get(){return v.value},set(P){y(P,void 0)}}),m=o.computed({get(){return f.value},set(P){y(void 0,P)}});function y(P,T){var k,w,L;if(!g)return;const M=u.toValue(e);M&&((L=M instanceof Document?g.document.body:M)==null||L.scrollTo({top:(k=u.toValue(T))!=null?k:m.value,left:(w=u.toValue(P))!=null?w:p.value,behavior:u.toValue(d)}))}const b=o.ref(!1),C=o.reactive({left:!0,right:!1,top:!0,bottom:!1}),S=o.reactive({left:!1,right:!1,top:!1,bottom:!1}),A=P=>{b.value&&(b.value=!1,S.left=!1,S.right=!1,S.top=!1,S.bottom=!1,a(P))},z=u.useDebounceFn(A,n+r),E=P=>{var T;if(!g)return;const k=P.document?P.document.documentElement:(T=P.documentElement)!=null?T:P,{display:w,flexDirection:L}=getComputedStyle(k),M=k.scrollLeft;S.left=M<v.value,S.right=M>v.value;const ue=Math.abs(M)<=0+(l.left||0),ce=Math.abs(M)+k.clientWidth>=k.scrollWidth-(l.right||0)-ne;w==="flex"&&L==="row-reverse"?(C.left=ce,C.right=ue):(C.left=ue,C.right=ce),v.value=M;let N=k.scrollTop;P===g.document&&!N&&(N=g.document.body.scrollTop),S.top=N<f.value,S.bottom=N>f.value;const fe=Math.abs(N)<=0+(l.top||0),de=Math.abs(N)+k.clientHeight>=k.scrollHeight-(l.bottom||0)-ne;w==="flex"&&L==="column-reverse"?(C.top=de,C.bottom=fe):(C.top=fe,C.bottom=de),f.value=N},I=P=>{var T;if(!g)return;const k=(T=P.target.documentElement)!=null?T:P.target;E(k),b.value=!0,z(P),i(P)};return _(e,"scroll",n?u.useThrottleFn(I,n,!0,!1):I,c),u.tryOnMounted(()=>{E(u.toValue(e))}),_(e,"scrollend",A,c),{x:p,y:m,isScrolling:b,arrivedState:C,directions:S,measure(){const P=u.toValue(e);g&&P&&E(P)}}}function G(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}function oe(e,t,n={}){var r;const{direction:a="bottom",interval:i=100}=n,l=o.reactive(Z(e,{...n,offset:{[a]:(r=n.distance)!=null?r:0,...n.offset}})),c=o.ref(),d=o.computed(()=>!!c.value),g=o.computed(()=>G(u.toValue(e))),v=Q(g);function f(){if(l.measure(),!g.value||!v.value)return;const{scrollHeight:p,clientHeight:m,scrollWidth:y,clientWidth:b}=g.value,C=a==="bottom"||a==="top"?p<=m:y<=b;(l.arrivedState[a]||C)&&(c.value||(c.value=Promise.all([t(l),new Promise(S=>setTimeout(S,i))]).finally(()=>{c.value=null,o.nextTick(()=>f())})))}return o.watch(()=>[l.arrivedState[a],v.value],f,{immediate:!0}),{isLoading:d}}const et={[u.directiveHooks.mounted](e,t){typeof t.value=="function"?oe(e,t.value):oe(e,...t.value)}},tt={[u.directiveHooks.mounted](e,t){typeof t.value=="function"?q(e,t.value):q(e,...t.value)}},nt=o.defineComponent({name:"UseMouse",props:["touch","resetOnTouchEnds","initialValue"],setup(e,{slots:t}){const n=o.reactive(h.useMouse(e));return()=>{if(t.default)return t.default(n)}}}),ot=o.defineComponent({name:"UseMouseElement",props:["handleOutside","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(h.useMouseInElement(n,e));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),rt=o.defineComponent({name:"UseMousePressed",props:["touch","initialValue","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(h.useMousePressed({...e,target:n}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),at=o.defineComponent({name:"UseNetwork",setup(e,{slots:t}){const n=o.reactive(h.useNetwork());return()=>{if(t.default)return t.default(n)}}}),st=o.defineComponent({name:"UseNow",props:["interval"],setup(e,{slots:t}){const n=o.reactive(h.useNow({...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),it=o.defineComponent({name:"UseObjectUrl",props:["object"],setup(e,{slots:t}){const n=u.toRef(e,"object"),r=h.useObjectUrl(n);return()=>{if(t.default&&r.value)return t.default(r)}}}),lt=o.defineComponent({name:"UseOffsetPagination",props:["total","page","pageSize","onPageChange","onPageSizeChange","onPageCountChange"],emits:["page-change","page-size-change","page-count-change"],setup(e,{slots:t,emit:n}){const r=o.reactive(h.useOffsetPagination({...e,onPageChange(...a){var i;(i=e.onPageChange)==null||i.call(e,...a),n("page-change",...a)},onPageSizeChange(...a){var i;(i=e.onPageSizeChange)==null||i.call(e,...a),n("page-size-change",...a)},onPageCountChange(...a){var i;(i=e.onPageCountChange)==null||i.call(e,...a),n("page-count-change",...a)}}));return()=>{if(t.default)return t.default(r)}}}),ut=o.defineComponent({name:"UseOnline",setup(e,{slots:t}){const n=o.reactive({isOnline:h.useOnline()});return()=>{if(t.default)return t.default(n)}}}),ct=o.defineComponent({name:"UsePageLeave",setup(e,{slots:t}){const n=o.reactive({isLeft:h.usePageLeave()});return()=>{if(t.default)return t.default(n)}}}),ft=o.defineComponent({name:"UsePointer",props:["pointerTypes","initialValue","target"],setup(e,{slots:t}){const n=o.ref(null),r=o.reactive(h.usePointer({...e,target:e.target==="self"?n:O}));return()=>{if(t.default)return t.default(r,{ref:n})}}}),dt=o.defineComponent({name:"UsePointerLock",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(h.usePointerLock(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),pt=o.defineComponent({name:"UsePreferredColorScheme",setup(e,{slots:t}){const n=o.reactive({colorScheme:h.usePreferredColorScheme()});return()=>{if(t.default)return t.default(n)}}}),vt=o.defineComponent({name:"UsePreferredContrast",setup(e,{slots:t}){const n=o.reactive({contrast:h.usePreferredContrast()});return()=>{if(t.default)return t.default(n)}}}),gt=o.defineComponent({name:"UsePreferredDark",setup(e,{slots:t}){const n=o.reactive({prefersDark:h.usePreferredDark()});return()=>{if(t.default)return t.default(n)}}}),ht=o.defineComponent({name:"UsePreferredLanguages",setup(e,{slots:t}){const n=o.reactive({languages:h.usePreferredLanguages()});return()=>{if(t.default)return t.default(n)}}}),mt=o.defineComponent({name:"UsePreferredReducedMotion",setup(e,{slots:t}){const n=o.reactive({motion:h.usePreferredReducedMotion()});return()=>{if(t.default)return t.default(n)}}});function yt(e,t,n={}){const{window:r=O,...a}=n;let i;const l=K(()=>r&&"MutationObserver"in r),c=()=>{i&&(i.disconnect(),i=void 0)},d=o.watch(()=>U(e),f=>{c(),l.value&&r&&f&&(i=new MutationObserver(t),i.observe(f,a))},{immediate:!0}),g=()=>i?.takeRecords(),v=()=>{c(),d()};return u.tryOnScopeDispose(v),{isSupported:l,stop:v,takeRecords:g}}function J(e,t,n={}){const{window:r=O,initialValue:a="",observe:i=!1}=n,l=o.ref(a),c=o.computed(()=>{var g;return U(t)||((g=r?.document)==null?void 0:g.documentElement)});function d(){var g;const v=u.toValue(e),f=u.toValue(c);if(f&&r){const p=(g=r.getComputedStyle(f).getPropertyValue(v))==null?void 0:g.trim();l.value=p||a}}return i&&yt(c,d,{attributeFilter:["style","class"],window:r}),o.watch([c,()=>u.toValue(e)],d,{immediate:!0}),o.watch(l,g=>{var v;(v=c.value)!=null&&v.style&&c.value.style.setProperty(u.toValue(e),g)}),l}const re="--vueuse-safe-area-top",ae="--vueuse-safe-area-right",se="--vueuse-safe-area-bottom",ie="--vueuse-safe-area-left";function wt(){const e=o.ref(""),t=o.ref(""),n=o.ref(""),r=o.ref("");if(u.isClient){const i=J(re),l=J(ae),c=J(se),d=J(ie);i.value="env(safe-area-inset-top, 0px)",l.value="env(safe-area-inset-right, 0px)",c.value="env(safe-area-inset-bottom, 0px)",d.value="env(safe-area-inset-left, 0px)",a(),_("resize",u.useDebounceFn(a))}function a(){e.value=Y(re),t.value=Y(ae),n.value=Y(se),r.value=Y(ie)}return{top:e,right:t,bottom:n,left:r,update:a}}function Y(e){return getComputedStyle(document.documentElement).getPropertyValue(e)}const Ut=o.defineComponent({name:"UseScreenSafeArea",props:{top:Boolean,right:Boolean,bottom:Boolean,left:Boolean},setup(e,{slots:t}){const{top:n,right:r,bottom:a,left:i}=wt();return()=>{if(t.default)return o.h("div",{style:{paddingTop:e.top?n.value:"",paddingRight:e.right?r.value:"",paddingBottom:e.bottom?a.value:"",paddingLeft:e.left?i.value:"",boxSizing:"border-box",maxHeight:"100vh",maxWidth:"100vw",overflow:"auto"}},t.default())}}}),bt={[u.directiveHooks.mounted](e,t){if(typeof t.value=="function"){const n=t.value,r=Z(e,{onScroll(){n(r)},onStop(){n(r)}})}else{const[n,r]=t.value,a=Z(e,{...r,onScroll(i){var l;(l=r.onScroll)==null||l.call(r,i),n(a)},onStop(i){var l;(l=r.onStop)==null||l.call(r,i),n(a)}})}}};function le(e){const t=window.getComputedStyle(e);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&e.clientWidth<e.scrollWidth||t.overflowY==="auto"&&e.clientHeight<e.scrollHeight)return!0;{const n=e.parentNode;return!n||n.tagName==="BODY"?!1:le(n)}}function Ct(e){const t=e||window.event,n=t.target;return le(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}const $=new WeakMap;function St(e,t=!1){const n=o.ref(t);let r=null,a;o.watch(u.toRef(e),c=>{const d=G(u.toValue(c));if(d){const g=d;$.get(g)||$.set(g,a),n.value&&(g.style.overflow="hidden")}},{immediate:!0});const i=()=>{const c=G(u.toValue(e));!c||n.value||(u.isIOS&&(r=_(c,"touchmove",d=>{Ct(d)},{passive:!1})),c.style.overflow="hidden",n.value=!0)},l=()=>{var c;const d=G(u.toValue(e));!d||!n.value||(u.isIOS&&r?.(),d.style.overflow=(c=$.get(d))!=null?c:"",$.delete(d),n.value=!1)};return u.tryOnScopeDispose(l),o.computed({get(){return n.value},set(c){c?i():l()}})}function Ot(){let e=!1;const t=o.ref(!1);return(n,r)=>{if(t.value=r.value,e)return;e=!0;const a=St(n,r.value);o.watch(t,i=>a.value=i)}}const Et=Ot(),Pt=o.defineComponent({name:"UseTimeAgo",props:["time","updateInterval","max","fullDateFormatter","messages","showSecond"],setup(e,{slots:t}){const n=o.reactive(h.useTimeAgo(()=>e.time,{...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),Lt=o.defineComponent({name:"UseTimestamp",props:["immediate","interval","offset"],setup(e,{slots:t}){const n=o.reactive(h.useTimestamp({...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),kt=o.defineComponent({name:"UseVirtualList",props:["list","options","height"],setup(e,{slots:t,expose:n}){const{list:r}=o.toRefs(e),{list:a,containerProps:i,wrapperProps:l,scrollTo:c}=h.useVirtualList(r,e.options);return n({scrollTo:c}),typeof i.style=="object"&&!Array.isArray(i.style)&&(i.style.height=e.height||"300px"),()=>o.h("div",{...i},[o.h("div",{...l.value},a.value.map(d=>o.h("div",{style:{overFlow:"hidden",height:d.height}},t.default?t.default(d):"Please set content!")))])}}),_t=o.defineComponent({name:"UseWindowFocus",setup(e,{slots:t}){const n=o.reactive({focused:h.useWindowFocus()});return()=>{if(t.default)return t.default(n)}}}),At=o.defineComponent({name:"UseWindowSize",props:["initialWidth","initialHeight"],setup(e,{slots:t}){const n=o.reactive(h.useWindowSize(e));return()=>{if(t.default)return t.default(n)}}});s.OnClickOutside=x,s.OnLongPress=ge,s.UseActiveElement=he,s.UseBattery=me,s.UseBrowserLocation=ye,s.UseClipboard=we,s.UseColorMode=_e,s.UseDark=Ae,s.UseDeviceMotion=Me,s.UseDeviceOrientation=Te,s.UseDevicePixelRatio=Ve,s.UseDevicesList=Ie,s.UseDocumentVisibility=Re,s.UseDraggable=He,s.UseElementBounding=ze,s.UseElementSize=Be,s.UseElementVisibility=Ge,s.UseEyeDropper=Ye,s.UseFullscreen=$e,s.UseGeolocation=Xe,s.UseIdle=qe,s.UseImage=De,s.UseMouse=nt,s.UseMouseInElement=ot,s.UseMousePressed=rt,s.UseNetwork=at,s.UseNow=st,s.UseObjectUrl=it,s.UseOffsetPagination=lt,s.UseOnline=ut,s.UsePageLeave=ct,s.UsePointer=ft,s.UsePointerLock=dt,s.UsePreferredColorScheme=pt,s.UsePreferredContrast=vt,s.UsePreferredDark=gt,s.UsePreferredLanguages=ht,s.UsePreferredReducedMotion=mt,s.UseScreenSafeArea=Ut,s.UseTimeAgo=Pt,s.UseTimestamp=Lt,s.UseVirtualList=kt,s.UseWindowFocus=_t,s.UseWindowSize=At,s.VOnClickOutside=B,s.VOnLongPress=D,s.vElementHover=We,s.vElementSize=Ke,s.vElementVisibility=Je,s.vInfiniteScroll=et,s.vIntersectionObserver=tt,s.vOnClickOutside=B,s.vOnKeyStroke=pe,s.vOnLongPress=D,s.vScroll=bt,s.vScrollLock=Et})(this.VueUse=this.VueUse||{},VueDemi,VueUse,VueUse);
|
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, h, watch, computed, reactive, shallowRef, nextTick, getCurrentInstance, onMounted, watchEffect, toRefs } from 'vue-demi';
|
|
2
|
-
import { onClickOutside as onClickOutside$1, useActiveElement, useBattery, useBrowserLocation, useDark, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDocumentVisibility, useStorage as useStorage$1, isClient as isClient$1, useDraggable, useElementBounding, useElementSize as useElementSize$1, useElementVisibility as useElementVisibility$1, useEyeDropper, useFullscreen, useGeolocation, useIdle, useMouse, useMouseInElement, useMousePressed, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, usePointer, usePointerLock, usePreferredColorScheme, usePreferredContrast, usePreferredDark as usePreferredDark$1, usePreferredLanguages, usePreferredReducedMotion, useTimeAgo, useTimestamp, useVirtualList, useWindowFocus, useWindowSize } from '@vueuse/core';
|
|
3
|
-
import { toValue, isClient, noop, isObject, tryOnScopeDispose, isIOS, directiveHooks, pausableWatch,
|
|
2
|
+
import { onClickOutside as onClickOutside$1, useActiveElement, useBattery, useBrowserLocation, useClipboard, useDark, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDocumentVisibility, useStorage as useStorage$1, isClient as isClient$1, useDraggable, useElementBounding, useElementSize as useElementSize$1, useElementVisibility as useElementVisibility$1, useEyeDropper, useFullscreen, useGeolocation, useIdle, useMouse, useMouseInElement, useMousePressed, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, usePointer, usePointerLock, usePreferredColorScheme, usePreferredContrast, usePreferredDark as usePreferredDark$1, usePreferredLanguages, usePreferredReducedMotion, useTimeAgo, useTimestamp, useVirtualList, useWindowFocus, useWindowSize } from '@vueuse/core';
|
|
3
|
+
import { toValue, isClient, noop, isObject, tryOnScopeDispose, isIOS, directiveHooks, pausableWatch, tryOnMounted, toRef, useToggle, notNullish, promiseTimeout, until, useDebounceFn, useThrottleFn } from '@vueuse/shared';
|
|
4
4
|
|
|
5
5
|
const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
6
6
|
name: "OnClickOutside",
|
|
@@ -112,8 +112,7 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
112
112
|
useEventListener(window, "click", listener, { passive: true, capture }),
|
|
113
113
|
useEventListener(window, "pointerdown", (e) => {
|
|
114
114
|
const el = unrefElement(target);
|
|
115
|
-
|
|
116
|
-
shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
|
|
115
|
+
shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));
|
|
117
116
|
}, { passive: true }),
|
|
118
117
|
detectIframe && useEventListener(window, "blur", (event) => {
|
|
119
118
|
setTimeout(() => {
|
|
@@ -236,8 +235,12 @@ function onLongPress(target, handler, options) {
|
|
|
236
235
|
capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
|
|
237
236
|
once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
|
|
238
237
|
};
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
const cleanup = [
|
|
239
|
+
useEventListener(elementRef, "pointerdown", onDown, listenerOptions),
|
|
240
|
+
useEventListener(elementRef, ["pointerup", "pointerleave"], clear, listenerOptions)
|
|
241
|
+
].filter(Boolean);
|
|
242
|
+
const stop = () => cleanup.forEach((fn) => fn());
|
|
243
|
+
return stop;
|
|
241
244
|
}
|
|
242
245
|
|
|
243
246
|
const OnLongPress = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
@@ -304,6 +307,24 @@ const UseBrowserLocation = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
304
307
|
}
|
|
305
308
|
});
|
|
306
309
|
|
|
310
|
+
const UseClipboard = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
311
|
+
name: "UseClipboard",
|
|
312
|
+
props: [
|
|
313
|
+
"source",
|
|
314
|
+
"read",
|
|
315
|
+
"navigator",
|
|
316
|
+
"copiedDuring",
|
|
317
|
+
"legacy"
|
|
318
|
+
],
|
|
319
|
+
setup(props, { slots }) {
|
|
320
|
+
const data = reactive(useClipboard(props));
|
|
321
|
+
return () => {
|
|
322
|
+
var _a;
|
|
323
|
+
return (_a = slots.default) == null ? void 0 : _a.call(slots, data);
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
|
|
307
328
|
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
308
329
|
const globalKey = "__vueuse_ssr_handlers__";
|
|
309
330
|
const handlers = /* @__PURE__ */ getHandlers();
|
|
@@ -368,9 +389,10 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
368
389
|
eventFilter,
|
|
369
390
|
onError = (e) => {
|
|
370
391
|
console.error(e);
|
|
371
|
-
}
|
|
392
|
+
},
|
|
393
|
+
initOnMounted
|
|
372
394
|
} = options;
|
|
373
|
-
const data = (shallow ? shallowRef : ref)(defaults);
|
|
395
|
+
const data = (shallow ? shallowRef : ref)(typeof defaults === "function" ? defaults() : defaults);
|
|
374
396
|
if (!storage) {
|
|
375
397
|
try {
|
|
376
398
|
storage = getSSRHandler("getDefaultStorage", () => {
|
|
@@ -392,10 +414,15 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
392
414
|
{ flush, deep, eventFilter }
|
|
393
415
|
);
|
|
394
416
|
if (window && listenToStorageChanges) {
|
|
395
|
-
|
|
396
|
-
|
|
417
|
+
tryOnMounted(() => {
|
|
418
|
+
useEventListener(window, "storage", update);
|
|
419
|
+
useEventListener(window, customStorageEventName, updateFromCustomEvent);
|
|
420
|
+
if (initOnMounted)
|
|
421
|
+
update();
|
|
422
|
+
});
|
|
397
423
|
}
|
|
398
|
-
|
|
424
|
+
if (!initOnMounted)
|
|
425
|
+
update();
|
|
399
426
|
return data;
|
|
400
427
|
function write(v) {
|
|
401
428
|
try {
|
|
@@ -547,9 +574,7 @@ function useColorMode(options = {}) {
|
|
|
547
574
|
const preferredDark = usePreferredDark({ window });
|
|
548
575
|
const system = computed(() => preferredDark.value ? "dark" : "light");
|
|
549
576
|
const store = storageRef || (storageKey == null ? toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));
|
|
550
|
-
const state = computed(
|
|
551
|
-
() => store.value === "auto" ? system.value : store.value
|
|
552
|
-
);
|
|
577
|
+
const state = computed(() => store.value === "auto" ? system.value : store.value);
|
|
553
578
|
const updateHTMLAttrs = getSSRHandler(
|
|
554
579
|
"updateHTMLAttrs",
|
|
555
580
|
(selector2, attribute2, value) => {
|
|
@@ -821,9 +846,7 @@ function useResizeObserver(target, callback, options = {}) {
|
|
|
821
846
|
observer = void 0;
|
|
822
847
|
}
|
|
823
848
|
};
|
|
824
|
-
const targets = computed(
|
|
825
|
-
() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]
|
|
826
|
-
);
|
|
849
|
+
const targets = computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
|
|
827
850
|
const stopWatch = watch(
|
|
828
851
|
targets,
|
|
829
852
|
(els) => {
|
|
@@ -855,7 +878,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
855
878
|
});
|
|
856
879
|
const width = ref(initialSize.width);
|
|
857
880
|
const height = ref(initialSize.height);
|
|
858
|
-
useResizeObserver(
|
|
881
|
+
const { stop: stop1 } = useResizeObserver(
|
|
859
882
|
target,
|
|
860
883
|
([entry]) => {
|
|
861
884
|
const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
|
|
@@ -879,16 +902,28 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
879
902
|
},
|
|
880
903
|
options
|
|
881
904
|
);
|
|
882
|
-
|
|
905
|
+
tryOnMounted(() => {
|
|
906
|
+
const ele = unrefElement(target);
|
|
907
|
+
if (ele) {
|
|
908
|
+
width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width;
|
|
909
|
+
height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
const stop2 = watch(
|
|
883
913
|
() => unrefElement(target),
|
|
884
914
|
(ele) => {
|
|
885
915
|
width.value = ele ? initialSize.width : 0;
|
|
886
916
|
height.value = ele ? initialSize.height : 0;
|
|
887
917
|
}
|
|
888
918
|
);
|
|
919
|
+
function stop() {
|
|
920
|
+
stop1();
|
|
921
|
+
stop2();
|
|
922
|
+
}
|
|
889
923
|
return {
|
|
890
924
|
width,
|
|
891
|
-
height
|
|
925
|
+
height,
|
|
926
|
+
stop
|
|
892
927
|
};
|
|
893
928
|
}
|
|
894
929
|
|
|
@@ -976,7 +1011,8 @@ function useIntersectionObserver(target, callback, options = {}) {
|
|
|
976
1011
|
};
|
|
977
1012
|
}
|
|
978
1013
|
|
|
979
|
-
function useElementVisibility(element,
|
|
1014
|
+
function useElementVisibility(element, options = {}) {
|
|
1015
|
+
const { window = defaultWindow, scrollTarget } = options;
|
|
980
1016
|
const elementIsVisible = ref(false);
|
|
981
1017
|
useIntersectionObserver(
|
|
982
1018
|
element,
|
|
@@ -1308,6 +1344,9 @@ function useScroll(element, options = {}) {
|
|
|
1308
1344
|
throttle ? useThrottleFn(onScrollHandler, throttle, true, false) : onScrollHandler,
|
|
1309
1345
|
eventListenerOptions
|
|
1310
1346
|
);
|
|
1347
|
+
tryOnMounted(() => {
|
|
1348
|
+
setArrivedState(toValue(element));
|
|
1349
|
+
});
|
|
1311
1350
|
useEventListener(
|
|
1312
1351
|
element,
|
|
1313
1352
|
"scrollend",
|
|
@@ -1666,6 +1705,9 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1666
1705
|
},
|
|
1667
1706
|
{ immediate: true }
|
|
1668
1707
|
);
|
|
1708
|
+
const takeRecords = () => {
|
|
1709
|
+
return observer == null ? void 0 : observer.takeRecords();
|
|
1710
|
+
};
|
|
1669
1711
|
const stop = () => {
|
|
1670
1712
|
cleanup();
|
|
1671
1713
|
stopWatch();
|
|
@@ -1673,7 +1715,8 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1673
1715
|
tryOnScopeDispose(stop);
|
|
1674
1716
|
return {
|
|
1675
1717
|
isSupported,
|
|
1676
|
-
stop
|
|
1718
|
+
stop,
|
|
1719
|
+
takeRecords
|
|
1677
1720
|
};
|
|
1678
1721
|
}
|
|
1679
1722
|
|
|
@@ -1841,6 +1884,7 @@ function preventDefault(rawEvent) {
|
|
|
1841
1884
|
e.preventDefault();
|
|
1842
1885
|
return false;
|
|
1843
1886
|
}
|
|
1887
|
+
const elInitialOverflow = /* @__PURE__ */ new WeakMap();
|
|
1844
1888
|
function useScrollLock(element, initialState = false) {
|
|
1845
1889
|
const isLocked = ref(initialState);
|
|
1846
1890
|
let stopTouchMoveListener = null;
|
|
@@ -1849,7 +1893,8 @@ function useScrollLock(element, initialState = false) {
|
|
|
1849
1893
|
const target = resolveElement(toValue(el));
|
|
1850
1894
|
if (target) {
|
|
1851
1895
|
const ele = target;
|
|
1852
|
-
|
|
1896
|
+
if (!elInitialOverflow.get(ele))
|
|
1897
|
+
elInitialOverflow.set(ele, initialOverflow);
|
|
1853
1898
|
if (isLocked.value)
|
|
1854
1899
|
ele.style.overflow = "hidden";
|
|
1855
1900
|
}
|
|
@@ -1874,11 +1919,13 @@ function useScrollLock(element, initialState = false) {
|
|
|
1874
1919
|
isLocked.value = true;
|
|
1875
1920
|
};
|
|
1876
1921
|
const unlock = () => {
|
|
1922
|
+
var _a;
|
|
1877
1923
|
const el = resolveElement(toValue(element));
|
|
1878
1924
|
if (!el || !isLocked.value)
|
|
1879
1925
|
return;
|
|
1880
1926
|
isIOS && (stopTouchMoveListener == null ? void 0 : stopTouchMoveListener());
|
|
1881
|
-
el.style.overflow =
|
|
1927
|
+
el.style.overflow = (_a = elInitialOverflow.get(el)) != null ? _a : "";
|
|
1928
|
+
elInitialOverflow.delete(el);
|
|
1882
1929
|
isLocked.value = false;
|
|
1883
1930
|
};
|
|
1884
1931
|
tryOnScopeDispose(unlock);
|
|
@@ -1945,21 +1992,9 @@ const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1945
1992
|
const { list, containerProps, wrapperProps, scrollTo } = useVirtualList(listRef, props.options);
|
|
1946
1993
|
expose({ scrollTo });
|
|
1947
1994
|
typeof containerProps.style === "object" && !Array.isArray(containerProps.style) && (containerProps.style.height = props.height || "300px");
|
|
1948
|
-
return () => h(
|
|
1949
|
-
"div",
|
|
1950
|
-
|
|
1951
|
-
[
|
|
1952
|
-
h(
|
|
1953
|
-
"div",
|
|
1954
|
-
{ ...wrapperProps.value },
|
|
1955
|
-
list.value.map((item) => h(
|
|
1956
|
-
"div",
|
|
1957
|
-
{ style: { overFlow: "hidden", height: item.height } },
|
|
1958
|
-
slots.default ? slots.default(item) : "Please set content!"
|
|
1959
|
-
))
|
|
1960
|
-
)
|
|
1961
|
-
]
|
|
1962
|
-
);
|
|
1995
|
+
return () => h("div", { ...containerProps }, [
|
|
1996
|
+
h("div", { ...wrapperProps.value }, list.value.map((item) => h("div", { style: { overFlow: "hidden", height: item.height } }, slots.default ? slots.default(item) : "Please set content!")))
|
|
1997
|
+
]);
|
|
1963
1998
|
}
|
|
1964
1999
|
});
|
|
1965
2000
|
|
|
@@ -1988,4 +2023,4 @@ const UseWindowSize = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1988
2023
|
}
|
|
1989
2024
|
});
|
|
1990
2025
|
|
|
1991
|
-
export { OnClickOutside, OnLongPress, UseActiveElement, UseBattery, UseBrowserLocation, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
|
|
2026
|
+
export { OnClickOutside, OnLongPress, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/components",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.6.0",
|
|
4
4
|
"description": "Renderless components for VueUse",
|
|
5
5
|
"author": "Jacob Clevenger<https://github.com/wheatjs>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"jsdelivr": "./index.iife.min.js",
|
|
33
33
|
"types": "./index.d.cts",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vueuse/core": "10.
|
|
36
|
-
"@vueuse/shared": "10.
|
|
37
|
-
"vue-demi": ">=0.14.
|
|
35
|
+
"@vueuse/core": "10.6.0",
|
|
36
|
+
"@vueuse/shared": "10.6.0",
|
|
37
|
+
"vue-demi": ">=0.14.6"
|
|
38
38
|
}
|
|
39
39
|
}
|