@vueuse/components 12.3.0 → 12.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +76 -70
- package/index.iife.js +76 -70
- package/index.iife.min.js +1 -1
- package/index.mjs +76 -70
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -20,12 +20,12 @@ const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
const defaultWindow = shared.isClient ? window :
|
|
23
|
+
const defaultWindow = shared.isClient ? window : undefined;
|
|
24
24
|
|
|
25
25
|
function unrefElement(elRef) {
|
|
26
26
|
var _a;
|
|
27
27
|
const plain = vue.toValue(elRef);
|
|
28
|
-
return (_a = plain == null ?
|
|
28
|
+
return (_a = plain == null ? undefined : plain.$el) != null ? _a : plain;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function useEventListener(...args) {
|
|
@@ -142,11 +142,11 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
142
142
|
setTimeout(() => {
|
|
143
143
|
var _a;
|
|
144
144
|
const el = unrefElement(target);
|
|
145
|
-
if (((_a = window.document.activeElement) == null ?
|
|
145
|
+
if (((_a = window.document.activeElement) == null ? undefined : _a.tagName) === "IFRAME" && !(el == null ? undefined : el.contains(window.document.activeElement))) {
|
|
146
146
|
handler(event);
|
|
147
147
|
}
|
|
148
148
|
}, 0);
|
|
149
|
-
})
|
|
149
|
+
}, { passive: true })
|
|
150
150
|
].filter(Boolean);
|
|
151
151
|
const stop = () => cleanup.forEach((fn) => fn());
|
|
152
152
|
return stop;
|
|
@@ -216,7 +216,7 @@ function onKeyStroke(...args) {
|
|
|
216
216
|
const vOnKeyStroke = {
|
|
217
217
|
mounted(el, binding) {
|
|
218
218
|
var _a, _b;
|
|
219
|
-
const keys = (_b = (_a = binding.arg) == null ?
|
|
219
|
+
const keys = (_b = (_a = binding.arg) == null ? undefined : _a.split(",")) != null ? _b : true;
|
|
220
220
|
if (typeof binding.value === "function") {
|
|
221
221
|
onKeyStroke(keys, binding.value, {
|
|
222
222
|
target: el
|
|
@@ -243,23 +243,23 @@ function onLongPress(target, handler, options) {
|
|
|
243
243
|
function clear() {
|
|
244
244
|
if (timeout) {
|
|
245
245
|
clearTimeout(timeout);
|
|
246
|
-
timeout =
|
|
246
|
+
timeout = undefined;
|
|
247
247
|
}
|
|
248
|
-
posStart =
|
|
249
|
-
startTimestamp =
|
|
248
|
+
posStart = undefined;
|
|
249
|
+
startTimestamp = undefined;
|
|
250
250
|
hasLongPressed = false;
|
|
251
251
|
}
|
|
252
252
|
function onRelease(ev) {
|
|
253
253
|
var _a2, _b2, _c;
|
|
254
254
|
const [_startTimestamp, _posStart, _hasLongPressed] = [startTimestamp, posStart, hasLongPressed];
|
|
255
255
|
clear();
|
|
256
|
-
if (!(options == null ?
|
|
256
|
+
if (!(options == null ? undefined : options.onMouseUp) || !_posStart || !_startTimestamp)
|
|
257
257
|
return;
|
|
258
|
-
if (((_a2 = options == null ?
|
|
258
|
+
if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)
|
|
259
259
|
return;
|
|
260
|
-
if ((_b2 = options == null ?
|
|
260
|
+
if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)
|
|
261
261
|
ev.preventDefault();
|
|
262
|
-
if ((_c = options == null ?
|
|
262
|
+
if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)
|
|
263
263
|
ev.stopPropagation();
|
|
264
264
|
const dx = ev.x - _posStart.x;
|
|
265
265
|
const dy = ev.y - _posStart.y;
|
|
@@ -268,12 +268,12 @@ function onLongPress(target, handler, options) {
|
|
|
268
268
|
}
|
|
269
269
|
function onDown(ev) {
|
|
270
270
|
var _a2, _b2, _c, _d;
|
|
271
|
-
if (((_a2 = options == null ?
|
|
271
|
+
if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)
|
|
272
272
|
return;
|
|
273
273
|
clear();
|
|
274
|
-
if ((_b2 = options == null ?
|
|
274
|
+
if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)
|
|
275
275
|
ev.preventDefault();
|
|
276
|
-
if ((_c = options == null ?
|
|
276
|
+
if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)
|
|
277
277
|
ev.stopPropagation();
|
|
278
278
|
posStart = {
|
|
279
279
|
x: ev.x,
|
|
@@ -285,28 +285,28 @@ function onLongPress(target, handler, options) {
|
|
|
285
285
|
hasLongPressed = true;
|
|
286
286
|
handler(ev);
|
|
287
287
|
},
|
|
288
|
-
(_d = options == null ?
|
|
288
|
+
(_d = options == null ? undefined : options.delay) != null ? _d : DEFAULT_DELAY
|
|
289
289
|
);
|
|
290
290
|
}
|
|
291
291
|
function onMove(ev) {
|
|
292
292
|
var _a2, _b2, _c, _d;
|
|
293
|
-
if (((_a2 = options == null ?
|
|
293
|
+
if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)
|
|
294
294
|
return;
|
|
295
|
-
if (!posStart || (options == null ?
|
|
295
|
+
if (!posStart || (options == null ? undefined : options.distanceThreshold) === false)
|
|
296
296
|
return;
|
|
297
|
-
if ((_b2 = options == null ?
|
|
297
|
+
if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)
|
|
298
298
|
ev.preventDefault();
|
|
299
|
-
if ((_c = options == null ?
|
|
299
|
+
if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)
|
|
300
300
|
ev.stopPropagation();
|
|
301
301
|
const dx = ev.x - posStart.x;
|
|
302
302
|
const dy = ev.y - posStart.y;
|
|
303
303
|
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
304
|
-
if (distance >= ((_d = options == null ?
|
|
304
|
+
if (distance >= ((_d = options == null ? undefined : options.distanceThreshold) != null ? _d : DEFAULT_THRESHOLD))
|
|
305
305
|
clear();
|
|
306
306
|
}
|
|
307
307
|
const listenerOptions = {
|
|
308
|
-
capture: (_a = options == null ?
|
|
309
|
-
once: (_b = options == null ?
|
|
308
|
+
capture: (_a = options == null ? undefined : options.modifiers) == null ? undefined : _a.capture,
|
|
309
|
+
once: (_b = options == null ? undefined : options.modifiers) == null ? undefined : _b.once
|
|
310
310
|
};
|
|
311
311
|
const cleanup = [
|
|
312
312
|
useEventListener(elementRef, "pointerdown", onDown, listenerOptions),
|
|
@@ -394,7 +394,7 @@ const UseClipboard = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
|
394
394
|
const data = vue.reactive(core.useClipboard(props));
|
|
395
395
|
return () => {
|
|
396
396
|
var _a;
|
|
397
|
-
return (_a = slots.default) == null ?
|
|
397
|
+
return (_a = slots.default) == null ? undefined : _a.call(slots, data);
|
|
398
398
|
};
|
|
399
399
|
}
|
|
400
400
|
});
|
|
@@ -414,7 +414,7 @@ function getSSRHandler(key, fallback) {
|
|
|
414
414
|
const ssrWidthSymbol = Symbol("vueuse-ssr-width");
|
|
415
415
|
function useSSRWidth() {
|
|
416
416
|
const ssrWidth = vue.hasInjectionContext() ? shared.injectLocal(ssrWidthSymbol, null) : null;
|
|
417
|
-
return typeof ssrWidth === "number" ? ssrWidth :
|
|
417
|
+
return typeof ssrWidth === "number" ? ssrWidth : undefined;
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
function useMounted() {
|
|
@@ -485,7 +485,7 @@ function useMediaQuery(query, options = {}) {
|
|
|
485
485
|
shared.tryOnScopeDispose(() => {
|
|
486
486
|
stopWatch();
|
|
487
487
|
cleanup();
|
|
488
|
-
mediaQuery =
|
|
488
|
+
mediaQuery = undefined;
|
|
489
489
|
});
|
|
490
490
|
return vue.computed(() => matches.value);
|
|
491
491
|
}
|
|
@@ -550,6 +550,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
550
550
|
initOnMounted
|
|
551
551
|
} = options;
|
|
552
552
|
const data = (shallow ? vue.shallowRef : vue.ref)(typeof defaults === "function" ? defaults() : defaults);
|
|
553
|
+
const keyComputed = vue.computed(() => vue.toValue(key));
|
|
553
554
|
if (!storage) {
|
|
554
555
|
try {
|
|
555
556
|
storage = getSSRHandler("getDefaultStorage", () => {
|
|
@@ -570,10 +571,11 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
570
571
|
() => write(data.value),
|
|
571
572
|
{ flush, deep, eventFilter }
|
|
572
573
|
);
|
|
574
|
+
vue.watch(keyComputed, () => update(), { flush });
|
|
573
575
|
if (window && listenToStorageChanges) {
|
|
574
576
|
shared.tryOnMounted(() => {
|
|
575
577
|
if (storage instanceof Storage)
|
|
576
|
-
useEventListener(window, "storage", update);
|
|
578
|
+
useEventListener(window, "storage", update, { passive: true });
|
|
577
579
|
else
|
|
578
580
|
useEventListener(window, customStorageEventName, updateFromCustomEvent);
|
|
579
581
|
if (initOnMounted)
|
|
@@ -585,7 +587,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
585
587
|
function dispatchWriteEvent(oldValue, newValue) {
|
|
586
588
|
if (window) {
|
|
587
589
|
const payload = {
|
|
588
|
-
key,
|
|
590
|
+
key: keyComputed.value,
|
|
589
591
|
oldValue,
|
|
590
592
|
newValue,
|
|
591
593
|
storageArea: storage
|
|
@@ -597,14 +599,14 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
597
599
|
}
|
|
598
600
|
function write(v) {
|
|
599
601
|
try {
|
|
600
|
-
const oldValue = storage.getItem(
|
|
602
|
+
const oldValue = storage.getItem(keyComputed.value);
|
|
601
603
|
if (v == null) {
|
|
602
604
|
dispatchWriteEvent(oldValue, null);
|
|
603
|
-
storage.removeItem(
|
|
605
|
+
storage.removeItem(keyComputed.value);
|
|
604
606
|
} else {
|
|
605
607
|
const serialized = serializer.write(v);
|
|
606
608
|
if (oldValue !== serialized) {
|
|
607
|
-
storage.setItem(
|
|
609
|
+
storage.setItem(keyComputed.value, serialized);
|
|
608
610
|
dispatchWriteEvent(oldValue, serialized);
|
|
609
611
|
}
|
|
610
612
|
}
|
|
@@ -613,10 +615,10 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
613
615
|
}
|
|
614
616
|
}
|
|
615
617
|
function read(event) {
|
|
616
|
-
const rawValue = event ? event.newValue : storage.getItem(
|
|
618
|
+
const rawValue = event ? event.newValue : storage.getItem(keyComputed.value);
|
|
617
619
|
if (rawValue == null) {
|
|
618
620
|
if (writeDefaults && rawInit != null)
|
|
619
|
-
storage.setItem(
|
|
621
|
+
storage.setItem(keyComputed.value, serializer.write(rawInit));
|
|
620
622
|
return rawInit;
|
|
621
623
|
} else if (!event && mergeDefaults) {
|
|
622
624
|
const value = serializer.read(rawValue);
|
|
@@ -638,7 +640,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
638
640
|
data.value = rawInit;
|
|
639
641
|
return;
|
|
640
642
|
}
|
|
641
|
-
if (event && event.key !==
|
|
643
|
+
if (event && event.key !== keyComputed.value)
|
|
642
644
|
return;
|
|
643
645
|
pauseWatch();
|
|
644
646
|
try {
|
|
@@ -686,7 +688,7 @@ function useColorMode(options = {}) {
|
|
|
686
688
|
const updateHTMLAttrs = getSSRHandler(
|
|
687
689
|
"updateHTMLAttrs",
|
|
688
690
|
(selector2, attribute2, value) => {
|
|
689
|
-
const el = typeof selector2 === "string" ? window == null ?
|
|
691
|
+
const el = typeof selector2 === "string" ? window == null ? undefined : window.document.querySelector(selector2) : unrefElement(selector2);
|
|
690
692
|
if (!el)
|
|
691
693
|
return;
|
|
692
694
|
const classesToAdd = /* @__PURE__ */ new Set();
|
|
@@ -870,18 +872,18 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
|
870
872
|
});
|
|
871
873
|
const containerElement = vue.computed(() => {
|
|
872
874
|
var _a;
|
|
873
|
-
return (_a = props.containerElement) != null ? _a :
|
|
875
|
+
return (_a = props.containerElement) != null ? _a : undefined;
|
|
874
876
|
});
|
|
875
877
|
const disabled = vue.computed(() => !!props.disabled);
|
|
876
878
|
const storageValue = props.storageKey && core.useStorage(
|
|
877
879
|
props.storageKey,
|
|
878
880
|
vue.toValue(props.initialValue) || { x: 0, y: 0 },
|
|
879
|
-
core.isClient ? props.storageType === "session" ? sessionStorage : localStorage :
|
|
881
|
+
core.isClient ? props.storageType === "session" ? sessionStorage : localStorage : undefined
|
|
880
882
|
);
|
|
881
883
|
const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
|
|
882
884
|
const onEnd = (position, event) => {
|
|
883
885
|
var _a;
|
|
884
|
-
(_a = props.onEnd) == null ?
|
|
886
|
+
(_a = props.onEnd) == null ? undefined : _a.call(props, position, event);
|
|
885
887
|
if (!storageValue)
|
|
886
888
|
return;
|
|
887
889
|
storageValue.value.x = position.x;
|
|
@@ -922,7 +924,7 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
922
924
|
const cleanup = () => {
|
|
923
925
|
if (observer) {
|
|
924
926
|
observer.disconnect();
|
|
925
|
-
observer =
|
|
927
|
+
observer = undefined;
|
|
926
928
|
}
|
|
927
929
|
};
|
|
928
930
|
const targets = vue.computed(() => {
|
|
@@ -942,7 +944,7 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
942
944
|
{ immediate: true, flush: "post" }
|
|
943
945
|
);
|
|
944
946
|
const takeRecords = () => {
|
|
945
|
-
return observer == null ?
|
|
947
|
+
return observer == null ? undefined : observer.takeRecords();
|
|
946
948
|
};
|
|
947
949
|
const stop = () => {
|
|
948
950
|
stopWatch();
|
|
@@ -963,7 +965,7 @@ function useResizeObserver(target, callback, options = {}) {
|
|
|
963
965
|
const cleanup = () => {
|
|
964
966
|
if (observer) {
|
|
965
967
|
observer.disconnect();
|
|
966
|
-
observer =
|
|
968
|
+
observer = undefined;
|
|
967
969
|
}
|
|
968
970
|
};
|
|
969
971
|
const targets = vue.computed(() => {
|
|
@@ -1088,14 +1090,14 @@ const vElementBounding = {
|
|
|
1088
1090
|
function onElementRemoval(target, callback, options = {}) {
|
|
1089
1091
|
const {
|
|
1090
1092
|
window = defaultWindow,
|
|
1091
|
-
document = window == null ?
|
|
1093
|
+
document = window == null ? undefined : window.document,
|
|
1092
1094
|
flush = "sync"
|
|
1093
1095
|
} = options;
|
|
1094
1096
|
if (!window || !document)
|
|
1095
1097
|
return shared.noop;
|
|
1096
1098
|
let stopFn;
|
|
1097
1099
|
const cleanupAndUpdate = (fn) => {
|
|
1098
|
-
stopFn == null ?
|
|
1100
|
+
stopFn == null ? undefined : stopFn();
|
|
1099
1101
|
stopFn = fn;
|
|
1100
1102
|
};
|
|
1101
1103
|
const stopWatch = vue.watchEffect(() => {
|
|
@@ -1139,7 +1141,7 @@ function useElementHover(el, options = {}) {
|
|
|
1139
1141
|
const delay = entering ? delayEnter : delayLeave;
|
|
1140
1142
|
if (timer) {
|
|
1141
1143
|
clearTimeout(timer);
|
|
1142
|
-
timer =
|
|
1144
|
+
timer = undefined;
|
|
1143
1145
|
}
|
|
1144
1146
|
if (delay)
|
|
1145
1147
|
timer = setTimeout(() => isHovered.value = entering, delay);
|
|
@@ -1190,7 +1192,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
1190
1192
|
const { window = defaultWindow, box = "content-box" } = options;
|
|
1191
1193
|
const isSVG = vue.computed(() => {
|
|
1192
1194
|
var _a, _b;
|
|
1193
|
-
return (_b = (_a = unrefElement(target)) == null ?
|
|
1195
|
+
return (_b = (_a = unrefElement(target)) == null ? undefined : _a.namespaceURI) == null ? undefined : _b.includes("svg");
|
|
1194
1196
|
});
|
|
1195
1197
|
const width = vue.ref(initialSize.width);
|
|
1196
1198
|
const height = vue.ref(initialSize.height);
|
|
@@ -1246,7 +1248,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
1246
1248
|
const vElementSize = {
|
|
1247
1249
|
mounted(el, binding) {
|
|
1248
1250
|
var _a;
|
|
1249
|
-
const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ?
|
|
1251
|
+
const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? undefined : _a[0];
|
|
1250
1252
|
const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
|
|
1251
1253
|
const { width, height } = useElementSize(el, ...options);
|
|
1252
1254
|
vue.watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
|
|
@@ -1436,11 +1438,11 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1436
1438
|
const state = shallow ? vue.shallowRef(initialState) : vue.ref(initialState);
|
|
1437
1439
|
const isReady = vue.ref(false);
|
|
1438
1440
|
const isLoading = vue.ref(false);
|
|
1439
|
-
const error = vue.shallowRef(
|
|
1441
|
+
const error = vue.shallowRef(undefined);
|
|
1440
1442
|
async function execute(delay2 = 0, ...args) {
|
|
1441
1443
|
if (resetOnExecute)
|
|
1442
1444
|
state.value = initialState;
|
|
1443
|
-
error.value =
|
|
1445
|
+
error.value = undefined;
|
|
1444
1446
|
isReady.value = false;
|
|
1445
1447
|
isLoading.value = true;
|
|
1446
1448
|
if (delay2 > 0)
|
|
@@ -1461,8 +1463,9 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1461
1463
|
}
|
|
1462
1464
|
return state.value;
|
|
1463
1465
|
}
|
|
1464
|
-
if (immediate)
|
|
1466
|
+
if (immediate) {
|
|
1465
1467
|
execute(delay);
|
|
1468
|
+
}
|
|
1466
1469
|
const shell = {
|
|
1467
1470
|
state,
|
|
1468
1471
|
isReady,
|
|
@@ -1519,7 +1522,7 @@ async function loadImage(options) {
|
|
|
1519
1522
|
function useImage(options, asyncStateOptions = {}) {
|
|
1520
1523
|
const state = useAsyncState(
|
|
1521
1524
|
() => loadImage(vue.toValue(options)),
|
|
1522
|
-
|
|
1525
|
+
undefined,
|
|
1523
1526
|
{
|
|
1524
1527
|
resetOnExecute: true,
|
|
1525
1528
|
...asyncStateOptions
|
|
@@ -1604,7 +1607,7 @@ function useScroll(element, options = {}) {
|
|
|
1604
1607
|
return internalX.value;
|
|
1605
1608
|
},
|
|
1606
1609
|
set(x2) {
|
|
1607
|
-
scrollTo(x2,
|
|
1610
|
+
scrollTo(x2, undefined);
|
|
1608
1611
|
}
|
|
1609
1612
|
});
|
|
1610
1613
|
const y = vue.computed({
|
|
@@ -1612,7 +1615,7 @@ function useScroll(element, options = {}) {
|
|
|
1612
1615
|
return internalY.value;
|
|
1613
1616
|
},
|
|
1614
1617
|
set(y2) {
|
|
1615
|
-
scrollTo(
|
|
1618
|
+
scrollTo(undefined, y2);
|
|
1616
1619
|
}
|
|
1617
1620
|
});
|
|
1618
1621
|
function scrollTo(_x, _y) {
|
|
@@ -1622,12 +1625,12 @@ function useScroll(element, options = {}) {
|
|
|
1622
1625
|
const _element = vue.toValue(element);
|
|
1623
1626
|
if (!_element)
|
|
1624
1627
|
return;
|
|
1625
|
-
(_c = _element instanceof Document ? window.document.body : _element) == null ?
|
|
1628
|
+
(_c = _element instanceof Document ? window.document.body : _element) == null ? undefined : _c.scrollTo({
|
|
1626
1629
|
top: (_a = vue.toValue(_y)) != null ? _a : y.value,
|
|
1627
1630
|
left: (_b = vue.toValue(_x)) != null ? _b : x.value,
|
|
1628
1631
|
behavior: vue.toValue(behavior)
|
|
1629
1632
|
});
|
|
1630
|
-
const scrollContainer = ((_d = _element == null ?
|
|
1633
|
+
const scrollContainer = ((_d = _element == null ? undefined : _element.document) == null ? undefined : _d.documentElement) || (_element == null ? undefined : _element.documentElement) || _element;
|
|
1631
1634
|
if (x != null)
|
|
1632
1635
|
internalX.value = scrollContainer.scrollLeft;
|
|
1633
1636
|
if (y != null)
|
|
@@ -1661,7 +1664,7 @@ function useScroll(element, options = {}) {
|
|
|
1661
1664
|
var _a;
|
|
1662
1665
|
if (!window)
|
|
1663
1666
|
return;
|
|
1664
|
-
const el = ((_a = target == null ?
|
|
1667
|
+
const el = ((_a = target == null ? undefined : target.document) == null ? undefined : _a.documentElement) || (target == null ? undefined : target.documentElement) || unrefElement(target);
|
|
1665
1668
|
const { display, flexDirection, direction } = getComputedStyle(el);
|
|
1666
1669
|
const directionMultipler = direction === "rtl" ? -1 : 1;
|
|
1667
1670
|
const scrollLeft = el.scrollLeft;
|
|
@@ -1907,7 +1910,7 @@ function useMouse(options = {}) {
|
|
|
1907
1910
|
useEventListener(target, "touchend", reset, listenerOptions);
|
|
1908
1911
|
}
|
|
1909
1912
|
if (scroll && type === "page")
|
|
1910
|
-
useEventListener(window, "scroll", scrollHandlerWrapper,
|
|
1913
|
+
useEventListener(window, "scroll", scrollHandlerWrapper, listenerOptions);
|
|
1911
1914
|
}
|
|
1912
1915
|
return {
|
|
1913
1916
|
x,
|
|
@@ -1923,7 +1926,7 @@ function useMouseInElement(target, options = {}) {
|
|
|
1923
1926
|
} = options;
|
|
1924
1927
|
const type = options.type || "page";
|
|
1925
1928
|
const { x, y, sourceType } = useMouse(options);
|
|
1926
|
-
const targetRef = vue.ref(target != null ? target : window == null ?
|
|
1929
|
+
const targetRef = vue.ref(target != null ? target : window == null ? undefined : window.document.body);
|
|
1927
1930
|
const elementX = vue.ref(0);
|
|
1928
1931
|
const elementY = vue.ref(0);
|
|
1929
1932
|
const elementPositionX = vue.ref(0);
|
|
@@ -1960,9 +1963,12 @@ function useMouseInElement(target, options = {}) {
|
|
|
1960
1963
|
},
|
|
1961
1964
|
{ immediate: true }
|
|
1962
1965
|
);
|
|
1963
|
-
useEventListener(
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
+
useEventListener(
|
|
1967
|
+
document,
|
|
1968
|
+
"mouseleave",
|
|
1969
|
+
() => isOutside.value = true,
|
|
1970
|
+
{ passive: true }
|
|
1971
|
+
);
|
|
1966
1972
|
}
|
|
1967
1973
|
return {
|
|
1968
1974
|
x,
|
|
@@ -2058,17 +2064,17 @@ const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent(
|
|
|
2058
2064
|
...props,
|
|
2059
2065
|
onPageChange(...args) {
|
|
2060
2066
|
var _a;
|
|
2061
|
-
(_a = props.onPageChange) == null ?
|
|
2067
|
+
(_a = props.onPageChange) == null ? undefined : _a.call(props, ...args);
|
|
2062
2068
|
emit("page-change", ...args);
|
|
2063
2069
|
},
|
|
2064
2070
|
onPageSizeChange(...args) {
|
|
2065
2071
|
var _a;
|
|
2066
|
-
(_a = props.onPageSizeChange) == null ?
|
|
2072
|
+
(_a = props.onPageSizeChange) == null ? undefined : _a.call(props, ...args);
|
|
2067
2073
|
emit("page-size-change", ...args);
|
|
2068
2074
|
},
|
|
2069
2075
|
onPageCountChange(...args) {
|
|
2070
2076
|
var _a;
|
|
2071
|
-
(_a = props.onPageCountChange) == null ?
|
|
2077
|
+
(_a = props.onPageCountChange) == null ? undefined : _a.call(props, ...args);
|
|
2072
2078
|
emit("page-count-change", ...args);
|
|
2073
2079
|
}
|
|
2074
2080
|
}));
|
|
@@ -2230,14 +2236,14 @@ function useCssVar(prop, target, options = {}) {
|
|
|
2230
2236
|
const variable = vue.ref(initialValue);
|
|
2231
2237
|
const elRef = vue.computed(() => {
|
|
2232
2238
|
var _a;
|
|
2233
|
-
return unrefElement(target) || ((_a = window == null ?
|
|
2239
|
+
return unrefElement(target) || ((_a = window == null ? undefined : window.document) == null ? undefined : _a.documentElement);
|
|
2234
2240
|
});
|
|
2235
2241
|
function updateCssVar() {
|
|
2236
2242
|
var _a;
|
|
2237
2243
|
const key = vue.toValue(prop);
|
|
2238
2244
|
const el = vue.toValue(elRef);
|
|
2239
2245
|
if (el && window && key) {
|
|
2240
|
-
const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ?
|
|
2246
|
+
const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? undefined : _a.trim();
|
|
2241
2247
|
variable.value = value || initialValue;
|
|
2242
2248
|
}
|
|
2243
2249
|
}
|
|
@@ -2261,7 +2267,7 @@ function useCssVar(prop, target, options = {}) {
|
|
|
2261
2267
|
(val) => {
|
|
2262
2268
|
var _a;
|
|
2263
2269
|
const raw_prop = vue.toValue(prop);
|
|
2264
|
-
if (((_a = elRef.value) == null ?
|
|
2270
|
+
if (((_a = elRef.value) == null ? undefined : _a.style) && raw_prop) {
|
|
2265
2271
|
if (val == null)
|
|
2266
2272
|
elRef.value.style.removeProperty(raw_prop);
|
|
2267
2273
|
else
|
|
@@ -2291,7 +2297,7 @@ function useScreenSafeArea() {
|
|
|
2291
2297
|
bottomCssVar.value = "env(safe-area-inset-bottom, 0px)";
|
|
2292
2298
|
leftCssVar.value = "env(safe-area-inset-left, 0px)";
|
|
2293
2299
|
update();
|
|
2294
|
-
useEventListener("resize", shared.useDebounceFn(update));
|
|
2300
|
+
useEventListener("resize", shared.useDebounceFn(update), { passive: true });
|
|
2295
2301
|
}
|
|
2296
2302
|
function update() {
|
|
2297
2303
|
top.value = getValue(topVarName);
|
|
@@ -2363,12 +2369,12 @@ const vScroll = {
|
|
|
2363
2369
|
...options,
|
|
2364
2370
|
onScroll(e) {
|
|
2365
2371
|
var _a;
|
|
2366
|
-
(_a = options.onScroll) == null ?
|
|
2372
|
+
(_a = options.onScroll) == null ? undefined : _a.call(options, e);
|
|
2367
2373
|
handler(state);
|
|
2368
2374
|
},
|
|
2369
2375
|
onStop(e) {
|
|
2370
2376
|
var _a;
|
|
2371
|
-
(_a = options.onStop) == null ?
|
|
2377
|
+
(_a = options.onStop) == null ? undefined : _a.call(options, e);
|
|
2372
2378
|
handler(state);
|
|
2373
2379
|
}
|
|
2374
2380
|
});
|
|
@@ -2441,7 +2447,7 @@ function useScrollLock(element, initialState = false) {
|
|
|
2441
2447
|
if (!el || !isLocked.value)
|
|
2442
2448
|
return;
|
|
2443
2449
|
if (shared.isIOS)
|
|
2444
|
-
stopTouchMoveListener == null ?
|
|
2450
|
+
stopTouchMoveListener == null ? undefined : stopTouchMoveListener();
|
|
2445
2451
|
el.style.overflow = initialOverflow;
|
|
2446
2452
|
elInitialOverflow.delete(el);
|
|
2447
2453
|
isLocked.value = false;
|