@vueuse/components 8.4.2 → 8.7.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 +191 -64
- package/index.d.ts +25 -2
- package/index.iife.js +219 -65
- package/index.iife.min.js +1 -1
- package/index.mjs +191 -65
- package/package.json +21 -21
package/index.cjs
CHANGED
|
@@ -23,9 +23,8 @@ const OnClickOutside = vueDemi.defineComponent({
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
function unrefElement(elRef) {
|
|
26
|
-
var _a;
|
|
27
26
|
const plain = vueDemi.unref(elRef);
|
|
28
|
-
return
|
|
27
|
+
return plain != null && "$el" in plain ? plain.$el : plain;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
const defaultWindow = shared.isClient ? window : void 0;
|
|
@@ -90,7 +89,11 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
90
89
|
shouldListen.value = !!el && !e.composedPath().includes(el);
|
|
91
90
|
}, { passive: true }),
|
|
92
91
|
useEventListener(window, "pointerup", (e) => {
|
|
93
|
-
|
|
92
|
+
if (e.button === 0) {
|
|
93
|
+
const path = e.composedPath();
|
|
94
|
+
e.composedPath = () => path;
|
|
95
|
+
fallback = window.setTimeout(() => listener(e), 50);
|
|
96
|
+
}
|
|
94
97
|
}, { passive: true })
|
|
95
98
|
];
|
|
96
99
|
const stop = () => cleanup.forEach((fn) => fn());
|
|
@@ -132,19 +135,19 @@ function onKeyStroke(key, handler, options = {}) {
|
|
|
132
135
|
return useEventListener(target, eventName, listener, passive);
|
|
133
136
|
}
|
|
134
137
|
|
|
135
|
-
var __defProp$
|
|
136
|
-
var __getOwnPropSymbols$
|
|
137
|
-
var __hasOwnProp$
|
|
138
|
-
var __propIsEnum$
|
|
139
|
-
var __defNormalProp$
|
|
140
|
-
var __spreadValues$
|
|
138
|
+
var __defProp$c = Object.defineProperty;
|
|
139
|
+
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
140
|
+
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
141
|
+
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
142
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
143
|
+
var __spreadValues$c = (a, b) => {
|
|
141
144
|
for (var prop in b || (b = {}))
|
|
142
|
-
if (__hasOwnProp$
|
|
143
|
-
__defNormalProp$
|
|
144
|
-
if (__getOwnPropSymbols$
|
|
145
|
-
for (var prop of __getOwnPropSymbols$
|
|
146
|
-
if (__propIsEnum$
|
|
147
|
-
__defNormalProp$
|
|
145
|
+
if (__hasOwnProp$d.call(b, prop))
|
|
146
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
147
|
+
if (__getOwnPropSymbols$d)
|
|
148
|
+
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
149
|
+
if (__propIsEnum$d.call(b, prop))
|
|
150
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
148
151
|
}
|
|
149
152
|
return a;
|
|
150
153
|
};
|
|
@@ -158,7 +161,7 @@ const vOnKeyStroke = {
|
|
|
158
161
|
});
|
|
159
162
|
} else {
|
|
160
163
|
const [handler, options] = binding.value;
|
|
161
|
-
onKeyStroke(keys, handler, __spreadValues$
|
|
164
|
+
onKeyStroke(keys, handler, __spreadValues$c({
|
|
162
165
|
target: el
|
|
163
166
|
}, options));
|
|
164
167
|
}
|
|
@@ -366,10 +369,11 @@ function useStorage(key, initialValue, storage, options = {}) {
|
|
|
366
369
|
|
|
367
370
|
function useMediaQuery(query, options = {}) {
|
|
368
371
|
const { window = defaultWindow } = options;
|
|
372
|
+
const isSupported = Boolean(window && "matchMedia" in window);
|
|
369
373
|
let mediaQuery;
|
|
370
374
|
const matches = vueDemi.ref(false);
|
|
371
375
|
const update = () => {
|
|
372
|
-
if (!
|
|
376
|
+
if (!isSupported)
|
|
373
377
|
return;
|
|
374
378
|
if (!mediaQuery)
|
|
375
379
|
mediaQuery = window.matchMedia(query);
|
|
@@ -397,19 +401,19 @@ function usePreferredDark(options) {
|
|
|
397
401
|
return useMediaQuery("(prefers-color-scheme: dark)", options);
|
|
398
402
|
}
|
|
399
403
|
|
|
400
|
-
var __defProp$
|
|
401
|
-
var __getOwnPropSymbols$
|
|
402
|
-
var __hasOwnProp$
|
|
403
|
-
var __propIsEnum$
|
|
404
|
-
var __defNormalProp$
|
|
405
|
-
var __spreadValues$
|
|
404
|
+
var __defProp$b = Object.defineProperty;
|
|
405
|
+
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
406
|
+
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
407
|
+
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
408
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
409
|
+
var __spreadValues$b = (a, b) => {
|
|
406
410
|
for (var prop in b || (b = {}))
|
|
407
|
-
if (__hasOwnProp$
|
|
408
|
-
__defNormalProp$
|
|
409
|
-
if (__getOwnPropSymbols$
|
|
410
|
-
for (var prop of __getOwnPropSymbols$
|
|
411
|
-
if (__propIsEnum$
|
|
412
|
-
__defNormalProp$
|
|
411
|
+
if (__hasOwnProp$c.call(b, prop))
|
|
412
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
413
|
+
if (__getOwnPropSymbols$c)
|
|
414
|
+
for (var prop of __getOwnPropSymbols$c(b)) {
|
|
415
|
+
if (__propIsEnum$c.call(b, prop))
|
|
416
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
413
417
|
}
|
|
414
418
|
return a;
|
|
415
419
|
};
|
|
@@ -423,7 +427,7 @@ function useColorMode(options = {}) {
|
|
|
423
427
|
listenToStorageChanges = true,
|
|
424
428
|
storageRef
|
|
425
429
|
} = options;
|
|
426
|
-
const modes = __spreadValues$
|
|
430
|
+
const modes = __spreadValues$b({
|
|
427
431
|
auto: "",
|
|
428
432
|
light: "light",
|
|
429
433
|
dark: "dark"
|
|
@@ -561,21 +565,21 @@ const UseDocumentVisibility = vueDemi.defineComponent({
|
|
|
561
565
|
}
|
|
562
566
|
});
|
|
563
567
|
|
|
564
|
-
var __defProp$
|
|
568
|
+
var __defProp$a = Object.defineProperty;
|
|
565
569
|
var __defProps$8 = Object.defineProperties;
|
|
566
570
|
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
567
|
-
var __getOwnPropSymbols$
|
|
568
|
-
var __hasOwnProp$
|
|
569
|
-
var __propIsEnum$
|
|
570
|
-
var __defNormalProp$
|
|
571
|
-
var __spreadValues$
|
|
571
|
+
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
572
|
+
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
573
|
+
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
574
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
575
|
+
var __spreadValues$a = (a, b) => {
|
|
572
576
|
for (var prop in b || (b = {}))
|
|
573
|
-
if (__hasOwnProp$
|
|
574
|
-
__defNormalProp$
|
|
575
|
-
if (__getOwnPropSymbols$
|
|
576
|
-
for (var prop of __getOwnPropSymbols$
|
|
577
|
-
if (__propIsEnum$
|
|
578
|
-
__defNormalProp$
|
|
577
|
+
if (__hasOwnProp$b.call(b, prop))
|
|
578
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
579
|
+
if (__getOwnPropSymbols$b)
|
|
580
|
+
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
581
|
+
if (__propIsEnum$b.call(b, prop))
|
|
582
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
579
583
|
}
|
|
580
584
|
return a;
|
|
581
585
|
};
|
|
@@ -588,13 +592,14 @@ const UseDraggable = vueDemi.defineComponent({
|
|
|
588
592
|
"initialValue",
|
|
589
593
|
"exact",
|
|
590
594
|
"preventDefault",
|
|
595
|
+
"stopPropagation",
|
|
591
596
|
"pointerTypes",
|
|
592
597
|
"as"
|
|
593
598
|
],
|
|
594
599
|
setup(props, { slots }) {
|
|
595
600
|
const target = vueDemi.ref();
|
|
596
601
|
const initialValue = props.storageKey ? core.useStorage(props.storageKey, vueDemi.unref(props.initialValue) || { x: 0, y: 0 }, core.isClient ? props.storageType === "session" ? sessionStorage : localStorage : void 0) : props.initialValue || { x: 0, y: 0 };
|
|
597
|
-
const data = vueDemi.reactive(core.useDraggable(target, __spreadProps$8(__spreadValues$
|
|
602
|
+
const data = vueDemi.reactive(core.useDraggable(target, __spreadProps$8(__spreadValues$a({}, props), {
|
|
598
603
|
initialValue
|
|
599
604
|
})));
|
|
600
605
|
return () => {
|
|
@@ -646,17 +651,17 @@ const UseElementSize = vueDemi.defineComponent({
|
|
|
646
651
|
}
|
|
647
652
|
});
|
|
648
653
|
|
|
649
|
-
var __getOwnPropSymbols$
|
|
650
|
-
var __hasOwnProp$
|
|
651
|
-
var __propIsEnum$
|
|
654
|
+
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
655
|
+
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
656
|
+
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
652
657
|
var __objRest = (source, exclude) => {
|
|
653
658
|
var target = {};
|
|
654
659
|
for (var prop in source)
|
|
655
|
-
if (__hasOwnProp$
|
|
660
|
+
if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
656
661
|
target[prop] = source[prop];
|
|
657
|
-
if (source != null && __getOwnPropSymbols$
|
|
658
|
-
for (var prop of __getOwnPropSymbols$
|
|
659
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
662
|
+
if (source != null && __getOwnPropSymbols$a)
|
|
663
|
+
for (var prop of __getOwnPropSymbols$a(source)) {
|
|
664
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
|
|
660
665
|
target[prop] = source[prop];
|
|
661
666
|
}
|
|
662
667
|
return target;
|
|
@@ -815,6 +820,109 @@ const UseIdle = vueDemi.defineComponent({
|
|
|
815
820
|
}
|
|
816
821
|
});
|
|
817
822
|
|
|
823
|
+
function useAsyncState(promise, initialState, options) {
|
|
824
|
+
const {
|
|
825
|
+
immediate = true,
|
|
826
|
+
delay = 0,
|
|
827
|
+
onError = shared.noop,
|
|
828
|
+
resetOnExecute = true,
|
|
829
|
+
shallow = true
|
|
830
|
+
} = options != null ? options : {};
|
|
831
|
+
const state = shallow ? vueDemi.shallowRef(initialState) : vueDemi.ref(initialState);
|
|
832
|
+
const isReady = vueDemi.ref(false);
|
|
833
|
+
const isLoading = vueDemi.ref(false);
|
|
834
|
+
const error = vueDemi.ref(void 0);
|
|
835
|
+
async function execute(delay2 = 0, ...args) {
|
|
836
|
+
if (resetOnExecute)
|
|
837
|
+
state.value = initialState;
|
|
838
|
+
error.value = void 0;
|
|
839
|
+
isReady.value = false;
|
|
840
|
+
isLoading.value = true;
|
|
841
|
+
if (delay2 > 0)
|
|
842
|
+
await shared.promiseTimeout(delay2);
|
|
843
|
+
const _promise = typeof promise === "function" ? promise(...args) : promise;
|
|
844
|
+
try {
|
|
845
|
+
const data = await _promise;
|
|
846
|
+
state.value = data;
|
|
847
|
+
isReady.value = true;
|
|
848
|
+
} catch (e) {
|
|
849
|
+
error.value = e;
|
|
850
|
+
onError(e);
|
|
851
|
+
} finally {
|
|
852
|
+
isLoading.value = false;
|
|
853
|
+
}
|
|
854
|
+
return state.value;
|
|
855
|
+
}
|
|
856
|
+
if (immediate)
|
|
857
|
+
execute(delay);
|
|
858
|
+
return {
|
|
859
|
+
state,
|
|
860
|
+
isReady,
|
|
861
|
+
isLoading,
|
|
862
|
+
error,
|
|
863
|
+
execute
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
var __defProp$9 = Object.defineProperty;
|
|
868
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
869
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
870
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
871
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
872
|
+
var __spreadValues$9 = (a, b) => {
|
|
873
|
+
for (var prop in b || (b = {}))
|
|
874
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
875
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
876
|
+
if (__getOwnPropSymbols$9)
|
|
877
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
878
|
+
if (__propIsEnum$9.call(b, prop))
|
|
879
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
880
|
+
}
|
|
881
|
+
return a;
|
|
882
|
+
};
|
|
883
|
+
async function loadImage(options) {
|
|
884
|
+
return new Promise((resolve, reject) => {
|
|
885
|
+
const img = new Image();
|
|
886
|
+
const { src, srcset, sizes } = options;
|
|
887
|
+
img.src = src;
|
|
888
|
+
if (srcset)
|
|
889
|
+
img.srcset = srcset;
|
|
890
|
+
if (sizes)
|
|
891
|
+
img.sizes = sizes;
|
|
892
|
+
img.onload = () => resolve(img);
|
|
893
|
+
img.onerror = reject;
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
const useImage = (options, asyncStateOptions = {}) => {
|
|
897
|
+
const state = useAsyncState(() => loadImage(vueDemi.unref(options)), void 0, __spreadValues$9({
|
|
898
|
+
resetOnExecute: true
|
|
899
|
+
}, asyncStateOptions));
|
|
900
|
+
vueDemi.watch(() => vueDemi.unref(options), () => state.execute(asyncStateOptions.delay), { deep: true });
|
|
901
|
+
return state;
|
|
902
|
+
};
|
|
903
|
+
|
|
904
|
+
const UseImage = vueDemi.defineComponent({
|
|
905
|
+
name: "UseImage",
|
|
906
|
+
props: [
|
|
907
|
+
"src",
|
|
908
|
+
"srcset",
|
|
909
|
+
"sizes",
|
|
910
|
+
"as"
|
|
911
|
+
],
|
|
912
|
+
setup(props, { slots }) {
|
|
913
|
+
const data = vueDemi.reactive(useImage(props));
|
|
914
|
+
return () => {
|
|
915
|
+
if (data.isLoading && slots.loading)
|
|
916
|
+
return slots.loading(data);
|
|
917
|
+
else if (data.error && slots.error)
|
|
918
|
+
return slots.error(data.error);
|
|
919
|
+
if (slots.default)
|
|
920
|
+
return slots.default(data);
|
|
921
|
+
return vueDemi.h(props.as || "img", props);
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
});
|
|
925
|
+
|
|
818
926
|
function useScroll(element, options = {}) {
|
|
819
927
|
const {
|
|
820
928
|
throttle = 0,
|
|
@@ -864,7 +972,9 @@ function useScroll(element, options = {}) {
|
|
|
864
972
|
arrivedState.left = scrollLeft <= 0 + (offset.left || 0);
|
|
865
973
|
arrivedState.right = scrollLeft + eventTarget.clientWidth >= eventTarget.scrollWidth - (offset.right || 0);
|
|
866
974
|
x.value = scrollLeft;
|
|
867
|
-
|
|
975
|
+
let scrollTop = eventTarget.scrollTop;
|
|
976
|
+
if (e.target === document && !scrollTop)
|
|
977
|
+
scrollTop = document.body.scrollTop;
|
|
868
978
|
directions.top = scrollTop < y.value;
|
|
869
979
|
directions.bottom = scrollTop > y.value;
|
|
870
980
|
arrivedState.top = scrollTop <= 0 + (offset.top || 0);
|
|
@@ -905,15 +1015,31 @@ var __spreadValues$8 = (a, b) => {
|
|
|
905
1015
|
};
|
|
906
1016
|
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
907
1017
|
function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
908
|
-
var _a;
|
|
1018
|
+
var _a, _b;
|
|
1019
|
+
const direction = (_a = options.direction) != null ? _a : "bottom";
|
|
909
1020
|
const state = vueDemi.reactive(useScroll(element, __spreadProps$7(__spreadValues$8({}, options), {
|
|
910
1021
|
offset: __spreadValues$8({
|
|
911
|
-
|
|
1022
|
+
[direction]: (_b = options.distance) != null ? _b : 0
|
|
912
1023
|
}, options.offset)
|
|
913
1024
|
})));
|
|
914
|
-
vueDemi.watch(() => state.arrivedState
|
|
915
|
-
|
|
916
|
-
|
|
1025
|
+
vueDemi.watch(() => state.arrivedState[direction], async (v) => {
|
|
1026
|
+
var _a2, _b2;
|
|
1027
|
+
if (v) {
|
|
1028
|
+
const elem = vueDemi.unref(element);
|
|
1029
|
+
const previous = {
|
|
1030
|
+
height: (_a2 = elem == null ? void 0 : elem.scrollHeight) != null ? _a2 : 0,
|
|
1031
|
+
width: (_b2 = elem == null ? void 0 : elem.scrollWidth) != null ? _b2 : 0
|
|
1032
|
+
};
|
|
1033
|
+
await onLoadMore(state);
|
|
1034
|
+
if (options.preserveScrollPosition && elem) {
|
|
1035
|
+
vueDemi.nextTick(() => {
|
|
1036
|
+
elem.scrollTo({
|
|
1037
|
+
top: elem.scrollHeight - previous.height,
|
|
1038
|
+
left: elem.scrollWidth - previous.width
|
|
1039
|
+
});
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
917
1043
|
});
|
|
918
1044
|
}
|
|
919
1045
|
|
|
@@ -1234,15 +1360,17 @@ const UsePreferredLanguages = vueDemi.defineComponent({
|
|
|
1234
1360
|
}
|
|
1235
1361
|
});
|
|
1236
1362
|
|
|
1237
|
-
function useCssVar(prop, target, { window = defaultWindow } = {}) {
|
|
1238
|
-
const variable = vueDemi.ref(
|
|
1363
|
+
function useCssVar(prop, target, { window = defaultWindow, initialValue = "" } = {}) {
|
|
1364
|
+
const variable = vueDemi.ref(initialValue);
|
|
1239
1365
|
const elRef = vueDemi.computed(() => {
|
|
1240
1366
|
var _a;
|
|
1241
1367
|
return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
|
|
1242
1368
|
});
|
|
1243
1369
|
vueDemi.watch([elRef, () => vueDemi.unref(prop)], ([el, prop2]) => {
|
|
1244
|
-
if (el && window)
|
|
1245
|
-
|
|
1370
|
+
if (el && window) {
|
|
1371
|
+
const value = window.getComputedStyle(el).getPropertyValue(prop2);
|
|
1372
|
+
variable.value = value || initialValue;
|
|
1373
|
+
}
|
|
1246
1374
|
}, { immediate: true });
|
|
1247
1375
|
vueDemi.watch(variable, (val) => {
|
|
1248
1376
|
var _a;
|
|
@@ -1374,7 +1502,6 @@ const vScroll = {
|
|
|
1374
1502
|
}
|
|
1375
1503
|
};
|
|
1376
1504
|
|
|
1377
|
-
var _a, _b;
|
|
1378
1505
|
function preventDefault(rawEvent) {
|
|
1379
1506
|
const e = rawEvent || window.event;
|
|
1380
1507
|
if (e.touches.length > 1)
|
|
@@ -1383,7 +1510,6 @@ function preventDefault(rawEvent) {
|
|
|
1383
1510
|
e.preventDefault();
|
|
1384
1511
|
return false;
|
|
1385
1512
|
}
|
|
1386
|
-
const isIOS = shared.isClient && (window == null ? void 0 : window.navigator) && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.platform) && /iP(ad|hone|od)/.test((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.platform);
|
|
1387
1513
|
function useScrollLock(element, initialState = false) {
|
|
1388
1514
|
const isLocked = vueDemi.ref(initialState);
|
|
1389
1515
|
let stopTouchMoveListener = null;
|
|
@@ -1402,7 +1528,7 @@ function useScrollLock(element, initialState = false) {
|
|
|
1402
1528
|
const ele = vueDemi.unref(element);
|
|
1403
1529
|
if (!ele || isLocked.value)
|
|
1404
1530
|
return;
|
|
1405
|
-
if (isIOS) {
|
|
1531
|
+
if (shared.isIOS) {
|
|
1406
1532
|
stopTouchMoveListener = useEventListener(ele, "touchmove", preventDefault, { passive: false });
|
|
1407
1533
|
}
|
|
1408
1534
|
ele.style.overflow = "hidden";
|
|
@@ -1412,7 +1538,7 @@ function useScrollLock(element, initialState = false) {
|
|
|
1412
1538
|
const ele = vueDemi.unref(element);
|
|
1413
1539
|
if (!ele || !isLocked.value)
|
|
1414
1540
|
return;
|
|
1415
|
-
isIOS && (stopTouchMoveListener == null ? void 0 : stopTouchMoveListener());
|
|
1541
|
+
shared.isIOS && (stopTouchMoveListener == null ? void 0 : stopTouchMoveListener());
|
|
1416
1542
|
ele.style.overflow = initialOverflow;
|
|
1417
1543
|
isLocked.value = false;
|
|
1418
1544
|
};
|
|
@@ -1585,6 +1711,7 @@ exports.UseEyeDropper = UseEyeDropper;
|
|
|
1585
1711
|
exports.UseFullscreen = UseFullscreen;
|
|
1586
1712
|
exports.UseGeolocation = UseGeolocation;
|
|
1587
1713
|
exports.UseIdle = UseIdle;
|
|
1714
|
+
exports.UseImage = UseImage;
|
|
1588
1715
|
exports.UseMouse = UseMouse;
|
|
1589
1716
|
exports.UseMouseInElement = UseMouseInElement;
|
|
1590
1717
|
exports.UseMousePressed = UseMousePressed;
|
package/index.d.ts
CHANGED
|
@@ -266,6 +266,17 @@ declare const UseIdle: vue_demi.DefineComponent<IdleOptions & {
|
|
|
266
266
|
timeout: number;
|
|
267
267
|
}>, {}>;
|
|
268
268
|
|
|
269
|
+
interface UseImageOptions {
|
|
270
|
+
/** Address of the resource */
|
|
271
|
+
src: string;
|
|
272
|
+
/** Images to use in different situations, e.g., high-resolution displays, small monitors, etc. */
|
|
273
|
+
srcset?: string;
|
|
274
|
+
/** Image sizes for different page layouts */
|
|
275
|
+
sizes?: string;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
declare const UseImage: vue_demi.DefineComponent<UseImageOptions & RenderableComponent, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, vue_demi.EmitsOptions, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<UseImageOptions & RenderableComponent>, {}>;
|
|
279
|
+
|
|
269
280
|
interface UseScrollOptions {
|
|
270
281
|
/**
|
|
271
282
|
* Throttle time for scroll event, it’s disabled by default.
|
|
@@ -340,13 +351,25 @@ interface UseInfiniteScrollOptions extends UseScrollOptions {
|
|
|
340
351
|
* @default 0
|
|
341
352
|
*/
|
|
342
353
|
distance?: number;
|
|
354
|
+
/**
|
|
355
|
+
* The direction in which to listen the scroll.
|
|
356
|
+
*
|
|
357
|
+
* @default 'bottom'
|
|
358
|
+
*/
|
|
359
|
+
direction?: 'top' | 'bottom';
|
|
360
|
+
/**
|
|
361
|
+
* Whether to preserve the current scroll position when loading more items.
|
|
362
|
+
*
|
|
363
|
+
* @default false
|
|
364
|
+
*/
|
|
365
|
+
preserveScrollPosition?: boolean;
|
|
343
366
|
}
|
|
344
367
|
/**
|
|
345
368
|
* Reactive infinite scroll.
|
|
346
369
|
*
|
|
347
370
|
* @see https://vueuse.org/useInfiniteScroll
|
|
348
371
|
*/
|
|
349
|
-
declare function useInfiniteScroll(element: MaybeRef<HTMLElement | SVGElement | Window | Document | null | undefined>, onLoadMore: (state: UnwrapNestedRefs<ReturnType<typeof useScroll>>) => void
|
|
372
|
+
declare function useInfiniteScroll(element: MaybeRef<HTMLElement | SVGElement | Window | Document | null | undefined>, onLoadMore: (state: UnwrapNestedRefs<ReturnType<typeof useScroll>>) => void | Promise<void>, options?: UseInfiniteScrollOptions): void;
|
|
350
373
|
|
|
351
374
|
declare type BindingValueFunction$2 = Parameters<typeof useInfiniteScroll>[1];
|
|
352
375
|
declare type BindingValueArray$2 = [BindingValueFunction$2, UseInfiniteScrollOptions];
|
|
@@ -509,4 +532,4 @@ declare const UseWindowFocus: vue_demi.DefineComponent<{}, () => vue_demi.VNode<
|
|
|
509
532
|
|
|
510
533
|
declare const UseWindowSize: vue_demi.DefineComponent<WindowSizeOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, vue_demi.EmitsOptions, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<WindowSizeOptions>, {}>;
|
|
511
534
|
|
|
512
|
-
export { OnClickOutside, OnLongPress, OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePreferredColorScheme, UsePreferredDark, UsePreferredLanguages, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
|
|
535
|
+
export { OnClickOutside, OnLongPress, OnLongPressProps, UseActiveElement, UseBattery, UseBrowserLocation, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, UseDraggableProps, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePreferredColorScheme, UsePreferredDark, UsePreferredLanguages, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, UseVirtualListProps, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vOnClickOutside, vOnKeyStroke, vOnLongPress, vScroll, vScrollLock };
|