@vueuse/components 10.4.0 → 10.4.1
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 +68 -35
- package/index.iife.js +68 -35
- package/index.iife.min.js +1 -1
- package/index.mjs +69 -36
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -21,8 +21,9 @@ const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
function unrefElement(elRef) {
|
|
24
|
+
var _a;
|
|
24
25
|
const plain = shared.toValue(elRef);
|
|
25
|
-
return plain
|
|
26
|
+
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
const defaultWindow = shared.isClient ? window : void 0;
|
|
@@ -59,9 +60,10 @@ function useEventListener(...args) {
|
|
|
59
60
|
cleanup();
|
|
60
61
|
if (!el)
|
|
61
62
|
return;
|
|
63
|
+
const optionsClone = shared.isObject(options2) ? { ...options2 } : options2;
|
|
62
64
|
cleanups.push(
|
|
63
65
|
...events.flatMap((event) => {
|
|
64
|
-
return listeners.map((listener) => register(el, event, listener,
|
|
66
|
+
return listeners.map((listener) => register(el, event, listener, optionsClone));
|
|
65
67
|
})
|
|
66
68
|
);
|
|
67
69
|
},
|
|
@@ -117,8 +119,9 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
117
119
|
}, { passive: true }),
|
|
118
120
|
detectIframe && useEventListener(window, "blur", (event) => {
|
|
119
121
|
setTimeout(() => {
|
|
122
|
+
var _a;
|
|
120
123
|
const el = unrefElement(target);
|
|
121
|
-
if (window.document.activeElement
|
|
124
|
+
if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement)))
|
|
122
125
|
handler(event);
|
|
123
126
|
}, 0);
|
|
124
127
|
})
|
|
@@ -190,7 +193,8 @@ function onKeyStroke(...args) {
|
|
|
190
193
|
|
|
191
194
|
const vOnKeyStroke = {
|
|
192
195
|
[shared.directiveHooks.mounted](el, binding) {
|
|
193
|
-
|
|
196
|
+
var _a, _b;
|
|
197
|
+
const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
|
|
194
198
|
if (typeof binding.value === "function") {
|
|
195
199
|
onKeyStroke(keys, binding.value, {
|
|
196
200
|
target: el
|
|
@@ -207,6 +211,7 @@ const vOnKeyStroke = {
|
|
|
207
211
|
|
|
208
212
|
const DEFAULT_DELAY = 500;
|
|
209
213
|
function onLongPress(target, handler, options) {
|
|
214
|
+
var _a, _b;
|
|
210
215
|
const elementRef = vueDemi.computed(() => unrefElement(target));
|
|
211
216
|
let timeout;
|
|
212
217
|
function clear() {
|
|
@@ -216,21 +221,22 @@ function onLongPress(target, handler, options) {
|
|
|
216
221
|
}
|
|
217
222
|
}
|
|
218
223
|
function onDown(ev) {
|
|
219
|
-
|
|
224
|
+
var _a2, _b2, _c, _d;
|
|
225
|
+
if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
|
|
220
226
|
return;
|
|
221
227
|
clear();
|
|
222
|
-
if (options
|
|
228
|
+
if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
|
|
223
229
|
ev.preventDefault();
|
|
224
|
-
if (options
|
|
230
|
+
if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
|
|
225
231
|
ev.stopPropagation();
|
|
226
232
|
timeout = setTimeout(
|
|
227
233
|
() => handler(ev),
|
|
228
|
-
options
|
|
234
|
+
(_d = options == null ? void 0 : options.delay) != null ? _d : DEFAULT_DELAY
|
|
229
235
|
);
|
|
230
236
|
}
|
|
231
237
|
const listenerOptions = {
|
|
232
|
-
capture: options
|
|
233
|
-
once: options
|
|
238
|
+
capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
|
|
239
|
+
once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
|
|
234
240
|
};
|
|
235
241
|
useEventListener(elementRef, "pointerdown", onDown, listenerOptions);
|
|
236
242
|
useEventListener(elementRef, ["pointerup", "pointerleave"], clear, listenerOptions);
|
|
@@ -352,6 +358,7 @@ const StorageSerializers = {
|
|
|
352
358
|
};
|
|
353
359
|
const customStorageEventName = "vueuse-storage";
|
|
354
360
|
function useStorage(key, defaults, storage, options = {}) {
|
|
361
|
+
var _a;
|
|
355
362
|
const {
|
|
356
363
|
flush = "pre",
|
|
357
364
|
deep = true,
|
|
@@ -368,7 +375,10 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
368
375
|
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(defaults);
|
|
369
376
|
if (!storage) {
|
|
370
377
|
try {
|
|
371
|
-
storage = getSSRHandler("getDefaultStorage", () =>
|
|
378
|
+
storage = getSSRHandler("getDefaultStorage", () => {
|
|
379
|
+
var _a2;
|
|
380
|
+
return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;
|
|
381
|
+
})();
|
|
372
382
|
} catch (e) {
|
|
373
383
|
onError(e);
|
|
374
384
|
}
|
|
@@ -377,7 +387,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
377
387
|
return data;
|
|
378
388
|
const rawInit = shared.toValue(defaults);
|
|
379
389
|
const type = guessSerializerType(rawInit);
|
|
380
|
-
const serializer = options.serializer
|
|
390
|
+
const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];
|
|
381
391
|
const { pause: pauseWatch, resume: resumeWatch } = shared.pausableWatch(
|
|
382
392
|
data,
|
|
383
393
|
() => write(data.value),
|
|
@@ -447,7 +457,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
447
457
|
return;
|
|
448
458
|
pauseWatch();
|
|
449
459
|
try {
|
|
450
|
-
if (event
|
|
460
|
+
if ((event == null ? void 0 : event.newValue) !== serializer.write(data.value))
|
|
451
461
|
data.value = read(event);
|
|
452
462
|
} catch (e) {
|
|
453
463
|
onError(e);
|
|
@@ -545,7 +555,7 @@ function useColorMode(options = {}) {
|
|
|
545
555
|
const updateHTMLAttrs = getSSRHandler(
|
|
546
556
|
"updateHTMLAttrs",
|
|
547
557
|
(selector2, attribute2, value) => {
|
|
548
|
-
const el = typeof selector2 === "string" ? window
|
|
558
|
+
const el = typeof selector2 === "string" ? window == null ? void 0 : window.document.querySelector(selector2) : unrefElement(selector2);
|
|
549
559
|
if (!el)
|
|
550
560
|
return;
|
|
551
561
|
let style;
|
|
@@ -573,7 +583,8 @@ function useColorMode(options = {}) {
|
|
|
573
583
|
}
|
|
574
584
|
);
|
|
575
585
|
function defaultOnChanged(mode) {
|
|
576
|
-
|
|
586
|
+
var _a;
|
|
587
|
+
updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);
|
|
577
588
|
}
|
|
578
589
|
function onChanged(mode) {
|
|
579
590
|
if (options.onChanged)
|
|
@@ -710,7 +721,10 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
710
721
|
],
|
|
711
722
|
setup(props, { slots }) {
|
|
712
723
|
const target = vueDemi.ref();
|
|
713
|
-
const handle = vueDemi.computed(() =>
|
|
724
|
+
const handle = vueDemi.computed(() => {
|
|
725
|
+
var _a;
|
|
726
|
+
return (_a = props.handle) != null ? _a : target.value;
|
|
727
|
+
});
|
|
714
728
|
const storageValue = props.storageKey && core.useStorage(
|
|
715
729
|
props.storageKey,
|
|
716
730
|
shared.toValue(props.initialValue) || { x: 0, y: 0 },
|
|
@@ -718,7 +732,8 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
718
732
|
);
|
|
719
733
|
const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
|
|
720
734
|
const onEnd = (position, event) => {
|
|
721
|
-
|
|
735
|
+
var _a;
|
|
736
|
+
(_a = props.onEnd) == null ? void 0 : _a.call(props, position, event);
|
|
722
737
|
if (!storageValue)
|
|
723
738
|
return;
|
|
724
739
|
storageValue.value.x = position.x;
|
|
@@ -836,7 +851,10 @@ function useResizeObserver(target, callback, options = {}) {
|
|
|
836
851
|
|
|
837
852
|
function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
|
|
838
853
|
const { window = defaultWindow, box = "content-box" } = options;
|
|
839
|
-
const isSVG = vueDemi.computed(() =>
|
|
854
|
+
const isSVG = vueDemi.computed(() => {
|
|
855
|
+
var _a, _b;
|
|
856
|
+
return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
|
|
857
|
+
});
|
|
840
858
|
const width = vueDemi.ref(initialSize.width);
|
|
841
859
|
const height = vueDemi.ref(initialSize.height);
|
|
842
860
|
useResizeObserver(
|
|
@@ -878,7 +896,8 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
878
896
|
|
|
879
897
|
const vElementSize = {
|
|
880
898
|
[shared.directiveHooks.mounted](el, binding) {
|
|
881
|
-
|
|
899
|
+
var _a;
|
|
900
|
+
const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? void 0 : _a[0];
|
|
882
901
|
const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
|
|
883
902
|
const { width, height } = useElementSize(el, ...options);
|
|
884
903
|
vueDemi.watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
|
|
@@ -1049,7 +1068,7 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1049
1068
|
resetOnExecute = true,
|
|
1050
1069
|
shallow = true,
|
|
1051
1070
|
throwError
|
|
1052
|
-
} = options
|
|
1071
|
+
} = options != null ? options : {};
|
|
1053
1072
|
const state = shallow ? vueDemi.shallowRef(initialState) : vueDemi.ref(initialState);
|
|
1054
1073
|
const isReady = vueDemi.ref(false);
|
|
1055
1074
|
const isLoading = vueDemi.ref(false);
|
|
@@ -1204,14 +1223,15 @@ function useScroll(element, options = {}) {
|
|
|
1204
1223
|
}
|
|
1205
1224
|
});
|
|
1206
1225
|
function scrollTo(_x, _y) {
|
|
1226
|
+
var _a, _b, _c;
|
|
1207
1227
|
if (!window)
|
|
1208
1228
|
return;
|
|
1209
1229
|
const _element = shared.toValue(element);
|
|
1210
1230
|
if (!_element)
|
|
1211
1231
|
return;
|
|
1212
|
-
(_element instanceof Document ? window.document.body : _element)
|
|
1213
|
-
top: shared.toValue(_y)
|
|
1214
|
-
left: shared.toValue(_x)
|
|
1232
|
+
(_c = _element instanceof Document ? window.document.body : _element) == null ? void 0 : _c.scrollTo({
|
|
1233
|
+
top: (_a = shared.toValue(_y)) != null ? _a : y.value,
|
|
1234
|
+
left: (_b = shared.toValue(_x)) != null ? _b : x.value,
|
|
1215
1235
|
behavior: shared.toValue(behavior)
|
|
1216
1236
|
});
|
|
1217
1237
|
}
|
|
@@ -1240,9 +1260,10 @@ function useScroll(element, options = {}) {
|
|
|
1240
1260
|
};
|
|
1241
1261
|
const onScrollEndDebounced = shared.useDebounceFn(onScrollEnd, throttle + idle);
|
|
1242
1262
|
const setArrivedState = (target) => {
|
|
1263
|
+
var _a;
|
|
1243
1264
|
if (!window)
|
|
1244
1265
|
return;
|
|
1245
|
-
const el = target.document ? target.document.documentElement : target.documentElement
|
|
1266
|
+
const el = target.document ? target.document.documentElement : (_a = target.documentElement) != null ? _a : target;
|
|
1246
1267
|
const { display, flexDirection } = getComputedStyle(el);
|
|
1247
1268
|
const scrollLeft = el.scrollLeft;
|
|
1248
1269
|
directions.left = scrollLeft < internalX.value;
|
|
@@ -1274,9 +1295,10 @@ function useScroll(element, options = {}) {
|
|
|
1274
1295
|
internalY.value = scrollTop;
|
|
1275
1296
|
};
|
|
1276
1297
|
const onScrollHandler = (e) => {
|
|
1298
|
+
var _a;
|
|
1277
1299
|
if (!window)
|
|
1278
1300
|
return;
|
|
1279
|
-
const eventTarget = e.target.documentElement
|
|
1301
|
+
const eventTarget = (_a = e.target.documentElement) != null ? _a : e.target;
|
|
1280
1302
|
setArrivedState(eventTarget);
|
|
1281
1303
|
isScrolling.value = true;
|
|
1282
1304
|
onScrollEndDebounced(e);
|
|
@@ -1317,6 +1339,7 @@ function resolveElement(el) {
|
|
|
1317
1339
|
}
|
|
1318
1340
|
|
|
1319
1341
|
function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
1342
|
+
var _a;
|
|
1320
1343
|
const {
|
|
1321
1344
|
direction = "bottom",
|
|
1322
1345
|
interval = 100
|
|
@@ -1326,7 +1349,7 @@ function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
|
1326
1349
|
{
|
|
1327
1350
|
...options,
|
|
1328
1351
|
offset: {
|
|
1329
|
-
[direction]: options.distance
|
|
1352
|
+
[direction]: (_a = options.distance) != null ? _a : 0,
|
|
1330
1353
|
...options.offset
|
|
1331
1354
|
}
|
|
1332
1355
|
}
|
|
@@ -1478,15 +1501,18 @@ const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineCompon
|
|
|
1478
1501
|
const data = vueDemi.reactive(core.useOffsetPagination({
|
|
1479
1502
|
...props,
|
|
1480
1503
|
onPageChange(...args) {
|
|
1481
|
-
|
|
1504
|
+
var _a;
|
|
1505
|
+
(_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
|
|
1482
1506
|
emit("page-change", ...args);
|
|
1483
1507
|
},
|
|
1484
1508
|
onPageSizeChange(...args) {
|
|
1485
|
-
|
|
1509
|
+
var _a;
|
|
1510
|
+
(_a = props.onPageSizeChange) == null ? void 0 : _a.call(props, ...args);
|
|
1486
1511
|
emit("page-size-change", ...args);
|
|
1487
1512
|
},
|
|
1488
1513
|
onPageCountChange(...args) {
|
|
1489
|
-
|
|
1514
|
+
var _a;
|
|
1515
|
+
(_a = props.onPageCountChange) == null ? void 0 : _a.call(props, ...args);
|
|
1490
1516
|
emit("page-count-change", ...args);
|
|
1491
1517
|
}
|
|
1492
1518
|
}));
|
|
@@ -1656,12 +1682,16 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1656
1682
|
function useCssVar(prop, target, options = {}) {
|
|
1657
1683
|
const { window = defaultWindow, initialValue = "", observe = false } = options;
|
|
1658
1684
|
const variable = vueDemi.ref(initialValue);
|
|
1659
|
-
const elRef = vueDemi.computed(() =>
|
|
1685
|
+
const elRef = vueDemi.computed(() => {
|
|
1686
|
+
var _a;
|
|
1687
|
+
return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
|
|
1688
|
+
});
|
|
1660
1689
|
function updateCssVar() {
|
|
1690
|
+
var _a;
|
|
1661
1691
|
const key = shared.toValue(prop);
|
|
1662
1692
|
const el = shared.toValue(elRef);
|
|
1663
1693
|
if (el && window) {
|
|
1664
|
-
const value = window.getComputedStyle(el).getPropertyValue(key)
|
|
1694
|
+
const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
|
|
1665
1695
|
variable.value = value || initialValue;
|
|
1666
1696
|
}
|
|
1667
1697
|
}
|
|
@@ -1679,7 +1709,8 @@ function useCssVar(prop, target, options = {}) {
|
|
|
1679
1709
|
vueDemi.watch(
|
|
1680
1710
|
variable,
|
|
1681
1711
|
(val) => {
|
|
1682
|
-
|
|
1712
|
+
var _a;
|
|
1713
|
+
if ((_a = elRef.value) == null ? void 0 : _a.style)
|
|
1683
1714
|
elRef.value.style.setProperty(shared.toValue(prop), val);
|
|
1684
1715
|
}
|
|
1685
1716
|
);
|
|
@@ -1776,11 +1807,13 @@ const vScroll = {
|
|
|
1776
1807
|
const state = useScroll(el, {
|
|
1777
1808
|
...options,
|
|
1778
1809
|
onScroll(e) {
|
|
1779
|
-
|
|
1810
|
+
var _a;
|
|
1811
|
+
(_a = options.onScroll) == null ? void 0 : _a.call(options, e);
|
|
1780
1812
|
handler(state);
|
|
1781
1813
|
},
|
|
1782
1814
|
onStop(e) {
|
|
1783
|
-
|
|
1815
|
+
var _a;
|
|
1816
|
+
(_a = options.onStop) == null ? void 0 : _a.call(options, e);
|
|
1784
1817
|
handler(state);
|
|
1785
1818
|
}
|
|
1786
1819
|
});
|
|
@@ -1846,7 +1879,7 @@ function useScrollLock(element, initialState = false) {
|
|
|
1846
1879
|
const el = resolveElement(shared.toValue(element));
|
|
1847
1880
|
if (!el || !isLocked.value)
|
|
1848
1881
|
return;
|
|
1849
|
-
shared.isIOS && stopTouchMoveListener
|
|
1882
|
+
shared.isIOS && (stopTouchMoveListener == null ? void 0 : stopTouchMoveListener());
|
|
1850
1883
|
el.style.overflow = initialOverflow;
|
|
1851
1884
|
isLocked.value = false;
|
|
1852
1885
|
};
|
package/index.iife.js
CHANGED
|
@@ -134,8 +134,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
function unrefElement(elRef) {
|
|
137
|
+
var _a;
|
|
137
138
|
const plain = shared.toValue(elRef);
|
|
138
|
-
return plain
|
|
139
|
+
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
const defaultWindow = shared.isClient ? window : void 0;
|
|
@@ -172,9 +173,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
172
173
|
cleanup();
|
|
173
174
|
if (!el)
|
|
174
175
|
return;
|
|
176
|
+
const optionsClone = shared.isObject(options2) ? { ...options2 } : options2;
|
|
175
177
|
cleanups.push(
|
|
176
178
|
...events.flatMap((event) => {
|
|
177
|
-
return listeners.map((listener) => register(el, event, listener,
|
|
179
|
+
return listeners.map((listener) => register(el, event, listener, optionsClone));
|
|
178
180
|
})
|
|
179
181
|
);
|
|
180
182
|
},
|
|
@@ -230,8 +232,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
230
232
|
}, { passive: true }),
|
|
231
233
|
detectIframe && useEventListener(window, "blur", (event) => {
|
|
232
234
|
setTimeout(() => {
|
|
235
|
+
var _a;
|
|
233
236
|
const el = unrefElement(target);
|
|
234
|
-
if (window.document.activeElement
|
|
237
|
+
if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement)))
|
|
235
238
|
handler(event);
|
|
236
239
|
}, 0);
|
|
237
240
|
})
|
|
@@ -303,7 +306,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
303
306
|
|
|
304
307
|
const vOnKeyStroke = {
|
|
305
308
|
[shared.directiveHooks.mounted](el, binding) {
|
|
306
|
-
|
|
309
|
+
var _a, _b;
|
|
310
|
+
const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
|
|
307
311
|
if (typeof binding.value === "function") {
|
|
308
312
|
onKeyStroke(keys, binding.value, {
|
|
309
313
|
target: el
|
|
@@ -320,6 +324,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
320
324
|
|
|
321
325
|
const DEFAULT_DELAY = 500;
|
|
322
326
|
function onLongPress(target, handler, options) {
|
|
327
|
+
var _a, _b;
|
|
323
328
|
const elementRef = vueDemi.computed(() => unrefElement(target));
|
|
324
329
|
let timeout;
|
|
325
330
|
function clear() {
|
|
@@ -329,21 +334,22 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
329
334
|
}
|
|
330
335
|
}
|
|
331
336
|
function onDown(ev) {
|
|
332
|
-
|
|
337
|
+
var _a2, _b2, _c, _d;
|
|
338
|
+
if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
|
|
333
339
|
return;
|
|
334
340
|
clear();
|
|
335
|
-
if (options
|
|
341
|
+
if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
|
|
336
342
|
ev.preventDefault();
|
|
337
|
-
if (options
|
|
343
|
+
if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
|
|
338
344
|
ev.stopPropagation();
|
|
339
345
|
timeout = setTimeout(
|
|
340
346
|
() => handler(ev),
|
|
341
|
-
options
|
|
347
|
+
(_d = options == null ? void 0 : options.delay) != null ? _d : DEFAULT_DELAY
|
|
342
348
|
);
|
|
343
349
|
}
|
|
344
350
|
const listenerOptions = {
|
|
345
|
-
capture: options
|
|
346
|
-
once: options
|
|
351
|
+
capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
|
|
352
|
+
once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
|
|
347
353
|
};
|
|
348
354
|
useEventListener(elementRef, "pointerdown", onDown, listenerOptions);
|
|
349
355
|
useEventListener(elementRef, ["pointerup", "pointerleave"], clear, listenerOptions);
|
|
@@ -465,6 +471,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
465
471
|
};
|
|
466
472
|
const customStorageEventName = "vueuse-storage";
|
|
467
473
|
function useStorage(key, defaults, storage, options = {}) {
|
|
474
|
+
var _a;
|
|
468
475
|
const {
|
|
469
476
|
flush = "pre",
|
|
470
477
|
deep = true,
|
|
@@ -481,7 +488,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
481
488
|
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(defaults);
|
|
482
489
|
if (!storage) {
|
|
483
490
|
try {
|
|
484
|
-
storage = getSSRHandler("getDefaultStorage", () =>
|
|
491
|
+
storage = getSSRHandler("getDefaultStorage", () => {
|
|
492
|
+
var _a2;
|
|
493
|
+
return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;
|
|
494
|
+
})();
|
|
485
495
|
} catch (e) {
|
|
486
496
|
onError(e);
|
|
487
497
|
}
|
|
@@ -490,7 +500,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
490
500
|
return data;
|
|
491
501
|
const rawInit = shared.toValue(defaults);
|
|
492
502
|
const type = guessSerializerType(rawInit);
|
|
493
|
-
const serializer = options.serializer
|
|
503
|
+
const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];
|
|
494
504
|
const { pause: pauseWatch, resume: resumeWatch } = shared.pausableWatch(
|
|
495
505
|
data,
|
|
496
506
|
() => write(data.value),
|
|
@@ -560,7 +570,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
560
570
|
return;
|
|
561
571
|
pauseWatch();
|
|
562
572
|
try {
|
|
563
|
-
if (event
|
|
573
|
+
if ((event == null ? void 0 : event.newValue) !== serializer.write(data.value))
|
|
564
574
|
data.value = read(event);
|
|
565
575
|
} catch (e) {
|
|
566
576
|
onError(e);
|
|
@@ -658,7 +668,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
658
668
|
const updateHTMLAttrs = getSSRHandler(
|
|
659
669
|
"updateHTMLAttrs",
|
|
660
670
|
(selector2, attribute2, value) => {
|
|
661
|
-
const el = typeof selector2 === "string" ? window
|
|
671
|
+
const el = typeof selector2 === "string" ? window == null ? void 0 : window.document.querySelector(selector2) : unrefElement(selector2);
|
|
662
672
|
if (!el)
|
|
663
673
|
return;
|
|
664
674
|
let style;
|
|
@@ -686,7 +696,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
686
696
|
}
|
|
687
697
|
);
|
|
688
698
|
function defaultOnChanged(mode) {
|
|
689
|
-
|
|
699
|
+
var _a;
|
|
700
|
+
updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);
|
|
690
701
|
}
|
|
691
702
|
function onChanged(mode) {
|
|
692
703
|
if (options.onChanged)
|
|
@@ -823,7 +834,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
823
834
|
],
|
|
824
835
|
setup(props, { slots }) {
|
|
825
836
|
const target = vueDemi.ref();
|
|
826
|
-
const handle = vueDemi.computed(() =>
|
|
837
|
+
const handle = vueDemi.computed(() => {
|
|
838
|
+
var _a;
|
|
839
|
+
return (_a = props.handle) != null ? _a : target.value;
|
|
840
|
+
});
|
|
827
841
|
const storageValue = props.storageKey && core.useStorage(
|
|
828
842
|
props.storageKey,
|
|
829
843
|
shared.toValue(props.initialValue) || { x: 0, y: 0 },
|
|
@@ -831,7 +845,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
831
845
|
);
|
|
832
846
|
const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
|
|
833
847
|
const onEnd = (position, event) => {
|
|
834
|
-
|
|
848
|
+
var _a;
|
|
849
|
+
(_a = props.onEnd) == null ? void 0 : _a.call(props, position, event);
|
|
835
850
|
if (!storageValue)
|
|
836
851
|
return;
|
|
837
852
|
storageValue.value.x = position.x;
|
|
@@ -949,7 +964,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
949
964
|
|
|
950
965
|
function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
|
|
951
966
|
const { window = defaultWindow, box = "content-box" } = options;
|
|
952
|
-
const isSVG = vueDemi.computed(() =>
|
|
967
|
+
const isSVG = vueDemi.computed(() => {
|
|
968
|
+
var _a, _b;
|
|
969
|
+
return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
|
|
970
|
+
});
|
|
953
971
|
const width = vueDemi.ref(initialSize.width);
|
|
954
972
|
const height = vueDemi.ref(initialSize.height);
|
|
955
973
|
useResizeObserver(
|
|
@@ -991,7 +1009,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
991
1009
|
|
|
992
1010
|
const vElementSize = {
|
|
993
1011
|
[shared.directiveHooks.mounted](el, binding) {
|
|
994
|
-
|
|
1012
|
+
var _a;
|
|
1013
|
+
const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? void 0 : _a[0];
|
|
995
1014
|
const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
|
|
996
1015
|
const { width, height } = useElementSize(el, ...options);
|
|
997
1016
|
vueDemi.watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
|
|
@@ -1162,7 +1181,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1162
1181
|
resetOnExecute = true,
|
|
1163
1182
|
shallow = true,
|
|
1164
1183
|
throwError
|
|
1165
|
-
} = options
|
|
1184
|
+
} = options != null ? options : {};
|
|
1166
1185
|
const state = shallow ? vueDemi.shallowRef(initialState) : vueDemi.ref(initialState);
|
|
1167
1186
|
const isReady = vueDemi.ref(false);
|
|
1168
1187
|
const isLoading = vueDemi.ref(false);
|
|
@@ -1317,14 +1336,15 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1317
1336
|
}
|
|
1318
1337
|
});
|
|
1319
1338
|
function scrollTo(_x, _y) {
|
|
1339
|
+
var _a, _b, _c;
|
|
1320
1340
|
if (!window)
|
|
1321
1341
|
return;
|
|
1322
1342
|
const _element = shared.toValue(element);
|
|
1323
1343
|
if (!_element)
|
|
1324
1344
|
return;
|
|
1325
|
-
(_element instanceof Document ? window.document.body : _element)
|
|
1326
|
-
top: shared.toValue(_y)
|
|
1327
|
-
left: shared.toValue(_x)
|
|
1345
|
+
(_c = _element instanceof Document ? window.document.body : _element) == null ? void 0 : _c.scrollTo({
|
|
1346
|
+
top: (_a = shared.toValue(_y)) != null ? _a : y.value,
|
|
1347
|
+
left: (_b = shared.toValue(_x)) != null ? _b : x.value,
|
|
1328
1348
|
behavior: shared.toValue(behavior)
|
|
1329
1349
|
});
|
|
1330
1350
|
}
|
|
@@ -1353,9 +1373,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1353
1373
|
};
|
|
1354
1374
|
const onScrollEndDebounced = shared.useDebounceFn(onScrollEnd, throttle + idle);
|
|
1355
1375
|
const setArrivedState = (target) => {
|
|
1376
|
+
var _a;
|
|
1356
1377
|
if (!window)
|
|
1357
1378
|
return;
|
|
1358
|
-
const el = target.document ? target.document.documentElement : target.documentElement
|
|
1379
|
+
const el = target.document ? target.document.documentElement : (_a = target.documentElement) != null ? _a : target;
|
|
1359
1380
|
const { display, flexDirection } = getComputedStyle(el);
|
|
1360
1381
|
const scrollLeft = el.scrollLeft;
|
|
1361
1382
|
directions.left = scrollLeft < internalX.value;
|
|
@@ -1387,9 +1408,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1387
1408
|
internalY.value = scrollTop;
|
|
1388
1409
|
};
|
|
1389
1410
|
const onScrollHandler = (e) => {
|
|
1411
|
+
var _a;
|
|
1390
1412
|
if (!window)
|
|
1391
1413
|
return;
|
|
1392
|
-
const eventTarget = e.target.documentElement
|
|
1414
|
+
const eventTarget = (_a = e.target.documentElement) != null ? _a : e.target;
|
|
1393
1415
|
setArrivedState(eventTarget);
|
|
1394
1416
|
isScrolling.value = true;
|
|
1395
1417
|
onScrollEndDebounced(e);
|
|
@@ -1430,6 +1452,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1430
1452
|
}
|
|
1431
1453
|
|
|
1432
1454
|
function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
1455
|
+
var _a;
|
|
1433
1456
|
const {
|
|
1434
1457
|
direction = "bottom",
|
|
1435
1458
|
interval = 100
|
|
@@ -1439,7 +1462,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1439
1462
|
{
|
|
1440
1463
|
...options,
|
|
1441
1464
|
offset: {
|
|
1442
|
-
[direction]: options.distance
|
|
1465
|
+
[direction]: (_a = options.distance) != null ? _a : 0,
|
|
1443
1466
|
...options.offset
|
|
1444
1467
|
}
|
|
1445
1468
|
}
|
|
@@ -1591,15 +1614,18 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1591
1614
|
const data = vueDemi.reactive(core.useOffsetPagination({
|
|
1592
1615
|
...props,
|
|
1593
1616
|
onPageChange(...args) {
|
|
1594
|
-
|
|
1617
|
+
var _a;
|
|
1618
|
+
(_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
|
|
1595
1619
|
emit("page-change", ...args);
|
|
1596
1620
|
},
|
|
1597
1621
|
onPageSizeChange(...args) {
|
|
1598
|
-
|
|
1622
|
+
var _a;
|
|
1623
|
+
(_a = props.onPageSizeChange) == null ? void 0 : _a.call(props, ...args);
|
|
1599
1624
|
emit("page-size-change", ...args);
|
|
1600
1625
|
},
|
|
1601
1626
|
onPageCountChange(...args) {
|
|
1602
|
-
|
|
1627
|
+
var _a;
|
|
1628
|
+
(_a = props.onPageCountChange) == null ? void 0 : _a.call(props, ...args);
|
|
1603
1629
|
emit("page-count-change", ...args);
|
|
1604
1630
|
}
|
|
1605
1631
|
}));
|
|
@@ -1769,12 +1795,16 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1769
1795
|
function useCssVar(prop, target, options = {}) {
|
|
1770
1796
|
const { window = defaultWindow, initialValue = "", observe = false } = options;
|
|
1771
1797
|
const variable = vueDemi.ref(initialValue);
|
|
1772
|
-
const elRef = vueDemi.computed(() =>
|
|
1798
|
+
const elRef = vueDemi.computed(() => {
|
|
1799
|
+
var _a;
|
|
1800
|
+
return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
|
|
1801
|
+
});
|
|
1773
1802
|
function updateCssVar() {
|
|
1803
|
+
var _a;
|
|
1774
1804
|
const key = shared.toValue(prop);
|
|
1775
1805
|
const el = shared.toValue(elRef);
|
|
1776
1806
|
if (el && window) {
|
|
1777
|
-
const value = window.getComputedStyle(el).getPropertyValue(key)
|
|
1807
|
+
const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
|
|
1778
1808
|
variable.value = value || initialValue;
|
|
1779
1809
|
}
|
|
1780
1810
|
}
|
|
@@ -1792,7 +1822,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1792
1822
|
vueDemi.watch(
|
|
1793
1823
|
variable,
|
|
1794
1824
|
(val) => {
|
|
1795
|
-
|
|
1825
|
+
var _a;
|
|
1826
|
+
if ((_a = elRef.value) == null ? void 0 : _a.style)
|
|
1796
1827
|
elRef.value.style.setProperty(shared.toValue(prop), val);
|
|
1797
1828
|
}
|
|
1798
1829
|
);
|
|
@@ -1889,11 +1920,13 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1889
1920
|
const state = useScroll(el, {
|
|
1890
1921
|
...options,
|
|
1891
1922
|
onScroll(e) {
|
|
1892
|
-
|
|
1923
|
+
var _a;
|
|
1924
|
+
(_a = options.onScroll) == null ? void 0 : _a.call(options, e);
|
|
1893
1925
|
handler(state);
|
|
1894
1926
|
},
|
|
1895
1927
|
onStop(e) {
|
|
1896
|
-
|
|
1928
|
+
var _a;
|
|
1929
|
+
(_a = options.onStop) == null ? void 0 : _a.call(options, e);
|
|
1897
1930
|
handler(state);
|
|
1898
1931
|
}
|
|
1899
1932
|
});
|
|
@@ -1959,7 +1992,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1959
1992
|
const el = resolveElement(shared.toValue(element));
|
|
1960
1993
|
if (!el || !isLocked.value)
|
|
1961
1994
|
return;
|
|
1962
|
-
shared.isIOS && stopTouchMoveListener
|
|
1995
|
+
shared.isIOS && (stopTouchMoveListener == null ? void 0 : stopTouchMoveListener());
|
|
1963
1996
|
el.style.overflow = initialOverflow;
|
|
1964
1997
|
isLocked.value = false;
|
|
1965
1998
|
};
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(a,o,v){if(a.install)return a;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),a;if(o.version.slice(0,4)==="2.7."){let U=function(b,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(z,I){return W[z]=I,this},directive:function(z,I){return I?(o.directive(z,I),B):o.directive(z)},mount:function(z,I){return T||(T=new o(Object.assign({propsData:L},b,{provide:Object.assign(W,b.provide)})),T.$mount(z,I),T)},unmount:function(){T&&(T.$destroy(),T=void 0)}};return B};var Q=U;for(var l in o)a[l]=o[l];a.isVue2=!0,a.isVue3=!1,a.install=function(){},a.Vue=o,a.Vue2=o,a.version=o.version,a.warn=o.util.warn,a.hasInjectionContext=()=>!!a.getCurrentInstance(),a.createApp=U}else if(o.version.slice(0,2)==="2.")if(v){for(var l in v)a[l]=v[l];a.isVue2=!0,a.isVue3=!1,a.install=function(){},a.Vue=o,a.Vue2=o,a.version=o.version,a.hasInjectionContext=()=>!!a.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 l in o)a[l]=o[l];a.isVue2=!1,a.isVue3=!0,a.install=function(){},a.Vue=o,a.Vue2=void 0,a.version=o.version,a.set=function(U,b,L){return Array.isArray(U)?(U.length=Math.max(U.length,b),U.splice(b,1,L),L):(U[b]=L,L)},a.del=function(U,b){if(Array.isArray(U)){U.splice(b,1);return}delete U[b]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return a}(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(a,o,v,l){"use strict";const Q=o.defineComponent({name:"OnClickOutside",props:["as","options"],emits:["trigger"],setup(e,{slots:t,emit:n}){const r=o.ref();return v.onClickOutside(r,s=>{n("trigger",s)},e.options),()=>{if(t.default)return o.h(e.as||"div",{ref:r},t.default())}}});function U(e){const t=l.toValue(e);return t?.$el??t}const b=l.isClient?window:void 0;function L(...e){let t,n,r,s;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,r,s]=e,t=b):[t,n,r,s]=e,!t)return l.noop;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const i=[],u=()=>{i.forEach(d=>d()),i.length=0},c=(d,m,g,h)=>(d.addEventListener(m,g,h),()=>d.removeEventListener(m,g,h)),f=o.watch(()=>[U(t),l.toValue(s)],([d,m])=>{u(),d&&i.push(...n.flatMap(g=>r.map(h=>c(d,g,h,m))))},{immediate:!0,flush:"post"}),p=()=>{f(),u()};return l.tryOnScopeDispose(p),p}let T=!1;function W(e,t,n={}){const{window:r=b,ignore:s=[],capture:i=!0,detectIframe:u=!1}=n;if(!r)return;l.isIOS&&!T&&(T=!0,Array.from(r.document.body.children).forEach(g=>g.addEventListener("click",l.noop)),r.document.documentElement.addEventListener("click",l.noop));let c=!0;const f=g=>s.some(h=>{if(typeof h=="string")return Array.from(r.document.querySelectorAll(h)).some(w=>w===g.target||g.composedPath().includes(w));{const w=U(h);return w&&(g.target===w||g.composedPath().includes(w))}}),d=[L(r,"click",g=>{const h=U(e);if(!(!h||h===g.target||g.composedPath().includes(h))){if(g.detail===0&&(c=!f(g)),!c){c=!0;return}t(g)}},{passive:!0,capture:i}),L(r,"pointerdown",g=>{const h=U(e);h&&(c=!g.composedPath().includes(h)&&!f(g))},{passive:!0}),u&&L(r,"blur",g=>{setTimeout(()=>{const h=U(e);r.document.activeElement?.tagName==="IFRAME"&&!h?.contains(r.document.activeElement)&&t(g)},0)})].filter(Boolean);return()=>d.forEach(g=>g())}const B={[l.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,s]=t.value;e.__onClickOutside_stop=W(e,r,Object.assign({capture:n},s))}},[l.directiveHooks.unmounted](e){e.__onClickOutside_stop()}};function z(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:s=b,eventName:i="keydown",passive:u=!1,dedupe:c=!1}=r,f=z(t);return L(s,i,d=>{d.repeat&&l.toValue(c)||f(d)&&n(d)},u)}const fe={[l.directiveHooks.mounted](e,t){const n=t.arg?.split(",")??!0;if(typeof t.value=="function")I(n,t.value,{target:e});else{const[r,s]=t.value;I(n,r,{target:e,...s})}}},de=500;function Y(e,t,n){const r=o.computed(()=>U(e));let s;function i(){s&&(clearTimeout(s),s=void 0)}function u(f){n?.modifiers?.self&&f.target!==r.value||(i(),n?.modifiers?.prevent&&f.preventDefault(),n?.modifiers?.stop&&f.stopPropagation(),s=setTimeout(()=>t(f),n?.delay??de))}const c={capture:n?.modifiers?.capture,once:n?.modifiers?.once};L(r,"pointerdown",u,c),L(r,["pointerup","pointerleave"],i,c)}const pe=o.defineComponent({name:"OnLongPress",props:["as","options"],emits:["trigger"],setup(e,{slots:t,emit:n}){const r=o.ref();return Y(r,s=>{n("trigger",s)},e.options),()=>{if(t.default)return o.h(e.as||"div",{ref:r},t.default())}}}),x={[l.directiveHooks.mounted](e,t){typeof t.value=="function"?Y(e,t.value,{modifiers:t.modifiers}):Y(e,...t.value)}},ge=o.defineComponent({name:"UseActiveElement",setup(e,{slots:t}){const n=o.reactive({element:v.useActiveElement()});return()=>{if(t.default)return t.default(n)}}}),ve=o.defineComponent({name:"UseBattery",setup(e,{slots:t}){const n=o.reactive(v.useBattery(e));return()=>{if(t.default)return t.default(n)}}}),me=o.defineComponent({name:"UseBrowserLocation",setup(e,{slots:t}){const n=o.reactive(v.useBrowserLocation());return()=>{if(t.default)return t.default(n)}}}),_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},j="__vueuse_ssr_handlers__",he=ye();function ye(){return j in _||(_[j]=_[j]||{}),_[j]}function Z(e,t){return he[e]||t}function we(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 Ue={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()}},D="vueuse-storage";function Se(e,t,n,r={}){const{flush:s="pre",deep:i=!0,listenToStorageChanges:u=!0,writeDefaults:c=!0,mergeDefaults:f=!1,shallow:p,window:d=b,eventFilter:m,onError:g=y=>{console.error(y)}}=r,h=(p?o.shallowRef:o.ref)(t);if(!n)try{n=Z("getDefaultStorage",()=>b?.localStorage)()}catch(y){g(y)}if(!n)return h;const w=l.toValue(t),k=we(w),O=r.serializer??Ue[k],{pause:E,resume:A}=l.pausableWatch(h,()=>R(h.value),{flush:s,deep:i,eventFilter:m});return d&&u&&(L(d,"storage",S),L(d,D,N)),S(),h;function R(y){try{if(y==null)n.removeItem(e);else{const C=O.write(y),M=n.getItem(e);M!==C&&(n.setItem(e,C),d&&d.dispatchEvent(new CustomEvent(D,{detail:{key:e,oldValue:M,newValue:C,storageArea:n}})))}}catch(C){g(C)}}function P(y){const C=y?y.newValue:n.getItem(e);if(C==null)return c&&w!==null&&n.setItem(e,O.write(w)),w;if(!y&&f){const M=O.read(C);return typeof f=="function"?f(M,w):k==="object"&&!Array.isArray(M)?{...w,...M}:M}else return typeof C!="string"?C:O.read(C)}function N(y){S(y.detail)}function S(y){if(!(y&&y.storageArea!==n)){if(y&&y.key==null){h.value=w;return}if(!(y&&y.key!==e)){E();try{y?.newValue!==O.write(h.value)&&(h.value=P(y))}catch(C){g(C)}finally{y?o.nextTick(A):A()}}}}}function be(){const e=o.ref(!1);return o.getCurrentInstance()&&o.onMounted(()=>{e.value=!0}),e}function F(e){const t=be();return o.computed(()=>(t.value,!!e()))}function Ce(e,t={}){const{window:n=b}=t,r=F(()=>n&&"matchMedia"in n&&typeof n.matchMedia=="function");let s;const i=o.ref(!1),u=p=>{i.value=p.matches},c=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",u):s.removeListener(u))},f=o.watchEffect(()=>{r.value&&(c(),s=n.matchMedia(l.toValue(e)),"addEventListener"in s?s.addEventListener("change",u):s.addListener(u),i.value=s.matches)});return l.tryOnScopeDispose(()=>{f(),c(),s=void 0}),i}function Oe(e){return Ce("(prefers-color-scheme: dark)",e)}function Ee(e={}){const{selector:t="html",attribute:n="class",initialValue:r="auto",window:s=b,storage:i,storageKey:u="vueuse-color-scheme",listenToStorageChanges:c=!0,storageRef:f,emitAuto:p,disableTransition:d=!0}=e,m={auto:"",light:"light",dark:"dark",...e.modes||{}},g=Oe({window:s}),h=o.computed(()=>g.value?"dark":"light"),w=f||(u==null?l.toRef(r):Se(u,r,i,{window:s,listenToStorageChanges:c})),k=o.computed(()=>w.value==="auto"?h.value:w.value),O=Z("updateHTMLAttrs",(P,N,S)=>{const y=typeof P=="string"?s?.document.querySelector(P):U(P);if(!y)return;let C;if(d){C=s.document.createElement("style");const M="*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";C.appendChild(document.createTextNode(M)),s.document.head.appendChild(C)}if(N==="class"){const M=S.split(/\s/g);Object.values(m).flatMap(V=>(V||"").split(/\s/g)).filter(Boolean).forEach(V=>{M.includes(V)?y.classList.add(V):y.classList.remove(V)})}else y.setAttribute(N,S);d&&(s.getComputedStyle(C).opacity,document.head.removeChild(C))});function E(P){O(t,n,m[P]??P)}function A(P){e.onChanged?e.onChanged(P,E):E(P)}o.watch(k,A,{flush:"post",immediate:!0}),l.tryOnMounted(()=>A(k.value));const R=o.computed({get(){return p?w.value:k.value},set(P){w.value=P}});try{return Object.assign(R,{store:w,system:h,state:k})}catch{return R}}const Pe=o.defineComponent({name:"UseColorMode",props:["selector","attribute","modes","onChanged","storageKey","storage","emitAuto"],setup(e,{slots:t}){const n=Ee(e),r=o.reactive({mode:n,system:n.system,store:n.store});return()=>{if(t.default)return t.default(r)}}}),Le=o.defineComponent({name:"UseDark",props:["selector","attribute","valueDark","valueLight","onChanged","storageKey","storage"],setup(e,{slots:t}){const n=v.useDark(e),r=o.reactive({isDark:n,toggleDark:l.useToggle(n)});return()=>{if(t.default)return t.default(r)}}}),ke=o.defineComponent({name:"UseDeviceMotion",setup(e,{slots:t}){const n=o.reactive(v.useDeviceMotion());return()=>{if(t.default)return t.default(n)}}}),Ae=o.defineComponent({name:"UseDeviceOrientation",setup(e,{slots:t}){const n=o.reactive(v.useDeviceOrientation());return()=>{if(t.default)return t.default(n)}}}),Me=o.defineComponent({name:"UseDevicePixelRatio",setup(e,{slots:t}){const n=o.reactive({pixelRatio:v.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(v.useDevicesList(e));return()=>{if(t.default)return t.default(n)}}}),Ve=o.defineComponent({name:"UseDocumentVisibility",setup(e,{slots:t}){const n=o.reactive({visibility:v.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(()=>e.handle??n.value),s=e.storageKey&&v.useStorage(e.storageKey,l.toValue(e.initialValue)||{x:0,y:0},v.isClient?e.storageType==="session"?sessionStorage:localStorage:void 0),i=s||e.initialValue||{x:0,y:0},u=(f,p)=>{e.onEnd?.(f,p),s&&(s.value.x=f.x,s.value.y=f.y)},c=o.reactive(v.useDraggable(n,{...e,handle:r,initialValue:i,onEnd:u}));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(v.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:s=b}=t,i=o.ref(!1);let u;const c=f=>{const p=f?n:r;u&&(clearTimeout(u),u=void 0),p?u=setTimeout(()=>i.value=f,p):i.value=f};return s&&(L(e,"mouseenter",()=>c(!0),{passive:!0}),L(e,"mouseleave",()=>c(!1),{passive:!0})),i}const Ne={[l.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(v.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=b,...s}=n;let i;const u=F(()=>r&&"ResizeObserver"in r),c=()=>{i&&(i.disconnect(),i=void 0)},f=o.computed(()=>Array.isArray(e)?e.map(m=>U(m)):[U(e)]),p=o.watch(f,m=>{if(c(),u.value&&r){i=new ResizeObserver(t);for(const g of m)g&&i.observe(g,s)}},{immediate:!0,flush:"post",deep:!0}),d=()=>{c(),p()};return l.tryOnScopeDispose(d),{isSupported:u,stop:d}}function Be(e,t={width:0,height:0},n={}){const{window:r=b,box:s="content-box"}=n,i=o.computed(()=>U(e)?.namespaceURI?.includes("svg")),u=o.ref(t.width),c=o.ref(t.height);return We(e,([f])=>{const p=s==="border-box"?f.borderBoxSize:s==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(r&&i.value){const d=U(e);if(d){const m=r.getComputedStyle(d);u.value=Number.parseFloat(m.width),c.value=Number.parseFloat(m.height)}}else if(p){const d=Array.isArray(p)?p:[p];u.value=d.reduce((m,{inlineSize:g})=>m+g,0),c.value=d.reduce((m,{blockSize:g})=>m+g,0)}else u.value=f.contentRect.width,c.value=f.contentRect.height},n),o.watch(()=>U(e),f=>{u.value=f?t.width:0,c.value=f?t.height:0}),{width:u,height:c}}const _e={[l.directiveHooks.mounted](e,t){const n=typeof t.value=="function"?t.value:t.value?.[0],r=typeof t.value=="function"?[]:t.value.slice(1),{width:s,height:i}=Be(e,...r);o.watch([s,i],([u,c])=>n({width:u,height:c}))}},je=o.defineComponent({name:"UseElementVisibility",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive({isVisible:v.useElementVisibility(n)});return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}});function $(e,t,n={}){const{root:r,rootMargin:s="0px",threshold:i=.1,window:u=b,immediate:c=!0}=n,f=F(()=>u&&"IntersectionObserver"in u),p=o.computed(()=>{const w=l.toValue(e);return(Array.isArray(w)?w:[w]).map(U).filter(l.notNullish)});let d=l.noop;const m=o.ref(c),g=f.value?o.watch(()=>[p.value,U(r),m.value],([w,k])=>{if(d(),!m.value||!w.length)return;const O=new IntersectionObserver(t,{root:U(k),rootMargin:s,threshold:i});w.forEach(E=>E&&O.observe(E)),d=()=>{O.disconnect(),d=l.noop}},{immediate:c,flush:"post"}):l.noop,h=()=>{d(),g(),m.value=!1};return l.tryOnScopeDispose(h),{isSupported:f,isActive:m,pause(){d(),m.value=!1},resume(){m.value=!0},stop:h}}function X(e,{window:t=b,scrollTarget:n}={}){const r=o.ref(!1);return $(e,([{isIntersecting:s}])=>{r.value=s},{root:n,window:t,threshold:0}),r}const Fe={[l.directiveHooks.mounted](e,t){if(typeof t.value=="function"){const n=t.value,r=X(e);o.watch(r,s=>n(s),{immediate:!0})}else{const[n,r]=t.value,s=X(e,r);o.watch(s,i=>n(i),{immediate:!0})}}},Ke=o.defineComponent({name:"UseEyeDropper",props:{sRGBHex:String},setup(e,{slots:t}){const n=o.reactive(v.useEyeDropper());return()=>{if(t.default)return t.default(n)}}}),Ge=o.defineComponent({name:"UseFullscreen",props:["as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(v.useFullscreen(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),Je=o.defineComponent({name:"UseGeolocation",props:["enableHighAccuracy","maximumAge","timeout","navigator"],setup(e,{slots:t}){const n=o.reactive(v.useGeolocation(e));return()=>{if(t.default)return t.default(n)}}}),Ye=o.defineComponent({name:"UseIdle",props:["timeout","events","listenForVisibilityChange","initialState"],setup(e,{slots:t}){const n=o.reactive(v.useIdle(e.timeout,e));return()=>{if(t.default)return t.default(n)}}});function $e(e,t,n){const{immediate:r=!0,delay:s=0,onError:i=l.noop,onSuccess:u=l.noop,resetOnExecute:c=!0,shallow:f=!0,throwError:p}=n??{},d=f?o.shallowRef(t):o.ref(t),m=o.ref(!1),g=o.ref(!1),h=o.shallowRef(void 0);async function w(E=0,...A){c&&(d.value=t),h.value=void 0,m.value=!1,g.value=!0,E>0&&await l.promiseTimeout(E);const R=typeof e=="function"?e(...A):e;try{const P=await R;d.value=P,m.value=!0,u(P)}catch(P){if(h.value=P,i(P),p)throw P}finally{g.value=!1}return d.value}r&&w(s);const k={state:d,isReady:m,isLoading:g,error:h,execute:w};function O(){return new Promise((E,A)=>{l.until(g).toBe(!1).then(()=>E(k)).catch(A)})}return{...k,then(E,A){return O().then(E,A)}}}async function Xe(e){return new Promise((t,n)=>{const r=new Image,{src:s,srcset:i,sizes:u,class:c,loading:f,crossorigin:p,referrerPolicy:d}=e;r.src=s,i&&(r.srcset=i),u&&(r.sizes=u),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=$e(()=>Xe(l.toValue(e)),void 0,{resetOnExecute:!0,...t});return o.watch(()=>l.toValue(e),()=>n.execute(t.delay),{deep:!0}),n}const Qe=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)}}),ee=1;function q(e,t={}){const{throttle:n=0,idle:r=200,onStop:s=l.noop,onScroll:i=l.noop,offset:u={left:0,right:0,top:0,bottom:0},eventListenerOptions:c={capture:!1,passive:!0},behavior:f="auto",window:p=b}=t,d=o.ref(0),m=o.ref(0),g=o.computed({get(){return d.value},set(S){w(S,void 0)}}),h=o.computed({get(){return m.value},set(S){w(void 0,S)}});function w(S,y){if(!p)return;const C=l.toValue(e);C&&(C instanceof Document?p.document.body:C)?.scrollTo({top:l.toValue(y)??h.value,left:l.toValue(S)??g.value,behavior:l.toValue(f)})}const k=o.ref(!1),O=o.reactive({left:!0,right:!1,top:!0,bottom:!1}),E=o.reactive({left:!1,right:!1,top:!1,bottom:!1}),A=S=>{k.value&&(k.value=!1,E.left=!1,E.right=!1,E.top=!1,E.bottom=!1,s(S))},R=l.useDebounceFn(A,n+r),P=S=>{if(!p)return;const y=S.document?S.document.documentElement:S.documentElement??S,{display:C,flexDirection:M}=getComputedStyle(y),V=y.scrollLeft;E.left=V<d.value,E.right=V>d.value;const ie=Math.abs(V)<=0+(u.left||0),le=Math.abs(V)+y.clientWidth>=y.scrollWidth-(u.right||0)-ee;C==="flex"&&M==="row-reverse"?(O.left=le,O.right=ie):(O.left=ie,O.right=le),d.value=V;let H=y.scrollTop;S===p.document&&!H&&(H=p.document.body.scrollTop),E.top=H<m.value,E.bottom=H>m.value;const ce=Math.abs(H)<=0+(u.top||0),ue=Math.abs(H)+y.clientHeight>=y.scrollHeight-(u.bottom||0)-ee;C==="flex"&&M==="column-reverse"?(O.top=ue,O.bottom=ce):(O.top=ce,O.bottom=ue),m.value=H},N=S=>{if(!p)return;const y=S.target.documentElement??S.target;P(y),k.value=!0,R(S),i(S)};return L(e,"scroll",n?l.useThrottleFn(N,n,!0,!1):N,c),L(e,"scrollend",A,c),{x:g,y:h,isScrolling:k,arrivedState:O,directions:E,measure(){const S=l.toValue(e);p&&S&&P(S)}}}function K(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}function te(e,t,n={}){const{direction:r="bottom",interval:s=100}=n,i=o.reactive(q(e,{...n,offset:{[r]:n.distance??0,...n.offset}})),u=o.ref(),c=o.computed(()=>!!u.value),f=o.computed(()=>K(l.toValue(e))),p=X(f);function d(){if(i.measure(),!f.value||!p.value)return;const{scrollHeight:m,clientHeight:g,scrollWidth:h,clientWidth:w}=f.value,k=r==="bottom"||r==="top"?m<=g:h<=w;(i.arrivedState[r]||k)&&(u.value||(u.value=Promise.all([t(i),new Promise(O=>setTimeout(O,s))]).finally(()=>{u.value=null,o.nextTick(()=>d())})))}return o.watch(()=>[i.arrivedState[r],p.value],d,{immediate:!0}),{isLoading:c}}const xe={[l.directiveHooks.mounted](e,t){typeof t.value=="function"?te(e,t.value):te(e,...t.value)}},Ze={[l.directiveHooks.mounted](e,t){typeof t.value=="function"?$(e,t.value):$(e,...t.value)}},De=o.defineComponent({name:"UseMouse",props:["touch","resetOnTouchEnds","initialValue"],setup(e,{slots:t}){const n=o.reactive(v.useMouse(e));return()=>{if(t.default)return t.default(n)}}}),et=o.defineComponent({name:"UseMouseElement",props:["handleOutside","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(v.useMouseInElement(n,e));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),tt=o.defineComponent({name:"UseMousePressed",props:["touch","initialValue","as"],setup(e,{slots:t}){const n=o.ref(),r=o.reactive(v.useMousePressed({...e,target:n}));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),nt=o.defineComponent({name:"UseNetwork",setup(e,{slots:t}){const n=o.reactive(v.useNetwork());return()=>{if(t.default)return t.default(n)}}}),ot=o.defineComponent({name:"UseNow",props:["interval"],setup(e,{slots:t}){const n=o.reactive(v.useNow({...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),rt=o.defineComponent({name:"UseObjectUrl",props:["object"],setup(e,{slots:t}){const n=l.toRef(e,"object"),r=v.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(v.useOffsetPagination({...e,onPageChange(...s){e.onPageChange?.(...s),n("page-change",...s)},onPageSizeChange(...s){e.onPageSizeChange?.(...s),n("page-size-change",...s)},onPageCountChange(...s){e.onPageCountChange?.(...s),n("page-count-change",...s)}}));return()=>{if(t.default)return t.default(r)}}}),at=o.defineComponent({name:"UseOnline",setup(e,{slots:t}){const n=o.reactive({isOnline:v.useOnline()});return()=>{if(t.default)return t.default(n)}}}),it=o.defineComponent({name:"UsePageLeave",setup(e,{slots:t}){const n=o.reactive({isLeft:v.usePageLeave()});return()=>{if(t.default)return t.default(n)}}}),lt=o.defineComponent({name:"UsePointer",props:["pointerTypes","initialValue","target"],setup(e,{slots:t}){const n=o.ref(null),r=o.reactive(v.usePointer({...e,target:e.target==="self"?n:b}));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(v.usePointerLock(n));return()=>{if(t.default)return o.h(e.as||"div",{ref:n},t.default(r))}}}),ut=o.defineComponent({name:"UsePreferredColorScheme",setup(e,{slots:t}){const n=o.reactive({colorScheme:v.usePreferredColorScheme()});return()=>{if(t.default)return t.default(n)}}}),ft=o.defineComponent({name:"UsePreferredContrast",setup(e,{slots:t}){const n=o.reactive({contrast:v.usePreferredContrast()});return()=>{if(t.default)return t.default(n)}}}),dt=o.defineComponent({name:"UsePreferredDark",setup(e,{slots:t}){const n=o.reactive({prefersDark:v.usePreferredDark()});return()=>{if(t.default)return t.default(n)}}}),pt=o.defineComponent({name:"UsePreferredLanguages",setup(e,{slots:t}){const n=o.reactive({languages:v.usePreferredLanguages()});return()=>{if(t.default)return t.default(n)}}}),gt=o.defineComponent({name:"UsePreferredReducedMotion",setup(e,{slots:t}){const n=o.reactive({motion:v.usePreferredReducedMotion()});return()=>{if(t.default)return t.default(n)}}});function vt(e,t,n={}){const{window:r=b,...s}=n;let i;const u=F(()=>r&&"MutationObserver"in r),c=()=>{i&&(i.disconnect(),i=void 0)},f=o.watch(()=>U(e),d=>{c(),u.value&&r&&d&&(i=new MutationObserver(t),i.observe(d,s))},{immediate:!0}),p=()=>{c(),f()};return l.tryOnScopeDispose(p),{isSupported:u,stop:p}}function G(e,t,n={}){const{window:r=b,initialValue:s="",observe:i=!1}=n,u=o.ref(s),c=o.computed(()=>U(t)||r?.document?.documentElement);function f(){const p=l.toValue(e),d=l.toValue(c);if(d&&r){const m=r.getComputedStyle(d).getPropertyValue(p)?.trim();u.value=m||s}}return i&&vt(c,f,{attributeFilter:["style","class"],window:r}),o.watch([c,()=>l.toValue(e)],f,{immediate:!0}),o.watch(u,p=>{c.value?.style&&c.value.style.setProperty(l.toValue(e),p)}),u}const ne="--vueuse-safe-area-top",oe="--vueuse-safe-area-right",re="--vueuse-safe-area-bottom",se="--vueuse-safe-area-left";function mt(){const e=o.ref(""),t=o.ref(""),n=o.ref(""),r=o.ref("");if(l.isClient){const i=G(ne),u=G(oe),c=G(re),f=G(se);i.value="env(safe-area-inset-top, 0px)",u.value="env(safe-area-inset-right, 0px)",c.value="env(safe-area-inset-bottom, 0px)",f.value="env(safe-area-inset-left, 0px)",s(),L("resize",l.useDebounceFn(s))}function s(){e.value=J(ne),t.value=J(oe),n.value=J(re),r.value=J(se)}return{top:e,right:t,bottom:n,left:r,update:s}}function J(e){return getComputedStyle(document.documentElement).getPropertyValue(e)}const ht=o.defineComponent({name:"UseScreenSafeArea",props:{top:Boolean,right:Boolean,bottom:Boolean,left:Boolean},setup(e,{slots:t}){const{top:n,right:r,bottom:s,left:i}=mt();return()=>{if(t.default)return o.h("div",{style:{paddingTop:e.top?n.value:"",paddingRight:e.right?r.value:"",paddingBottom:e.bottom?s.value:"",paddingLeft:e.left?i.value:"",boxSizing:"border-box",maxHeight:"100vh",maxWidth:"100vw",overflow:"auto"}},t.default())}}}),yt={[l.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,s=q(e,{...r,onScroll(i){r.onScroll?.(i),n(s)},onStop(i){r.onStop?.(i),n(s)}})}}};function ae(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:ae(n)}}function wt(e){const t=e||window.event,n=t.target;return ae(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}function Ut(e,t=!1){const n=o.ref(t);let r=null,s;o.watch(l.toRef(e),c=>{const f=K(l.toValue(c));if(f){const p=f;s=p.style.overflow,n.value&&(p.style.overflow="hidden")}},{immediate:!0});const i=()=>{const c=K(l.toValue(e));!c||n.value||(l.isIOS&&(r=L(c,"touchmove",f=>{wt(f)},{passive:!1})),c.style.overflow="hidden",n.value=!0)},u=()=>{const c=K(l.toValue(e));!c||!n.value||(l.isIOS&&r?.(),c.style.overflow=s,n.value=!1)};return l.tryOnScopeDispose(u),o.computed({get(){return n.value},set(c){c?i():u()}})}function St(){let e=!1;const t=o.ref(!1);return(n,r)=>{if(t.value=r.value,e)return;e=!0;const s=Ut(n,r.value);o.watch(t,i=>s.value=i)}}const bt=St(),Ct=o.defineComponent({name:"UseTimeAgo",props:["time","updateInterval","max","fullDateFormatter","messages","showSecond"],setup(e,{slots:t}){const n=o.reactive(v.useTimeAgo(()=>e.time,{...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),Ot=o.defineComponent({name:"UseTimestamp",props:["immediate","interval","offset"],setup(e,{slots:t}){const n=o.reactive(v.useTimestamp({...e,controls:!0}));return()=>{if(t.default)return t.default(n)}}}),Et=o.defineComponent({name:"UseVirtualList",props:["list","options","height"],setup(e,{slots:t,expose:n}){const{list:r}=o.toRefs(e),{list:s,containerProps:i,wrapperProps:u,scrollTo:c}=v.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",{...u.value},s.value.map(f=>o.h("div",{style:{overFlow:"hidden",height:f.height}},t.default?t.default(f):"Please set content!")))])}}),Pt=o.defineComponent({name:"UseWindowFocus",setup(e,{slots:t}){const n=o.reactive({focused:v.useWindowFocus()});return()=>{if(t.default)return t.default(n)}}}),Lt=o.defineComponent({name:"UseWindowSize",props:["initialWidth","initialHeight"],setup(e,{slots:t}){const n=o.reactive(v.useWindowSize(e));return()=>{if(t.default)return t.default(n)}}});a.OnClickOutside=Q,a.OnLongPress=pe,a.UseActiveElement=ge,a.UseBattery=ve,a.UseBrowserLocation=me,a.UseColorMode=Pe,a.UseDark=Le,a.UseDeviceMotion=ke,a.UseDeviceOrientation=Ae,a.UseDevicePixelRatio=Me,a.UseDevicesList=Te,a.UseDocumentVisibility=Ve,a.UseDraggable=Ie,a.UseElementBounding=ze,a.UseElementSize=He,a.UseElementVisibility=je,a.UseEyeDropper=Ke,a.UseFullscreen=Ge,a.UseGeolocation=Je,a.UseIdle=Ye,a.UseImage=Qe,a.UseMouse=De,a.UseMouseInElement=et,a.UseMousePressed=tt,a.UseNetwork=nt,a.UseNow=ot,a.UseObjectUrl=rt,a.UseOffsetPagination=st,a.UseOnline=at,a.UsePageLeave=it,a.UsePointer=lt,a.UsePointerLock=ct,a.UsePreferredColorScheme=ut,a.UsePreferredContrast=ft,a.UsePreferredDark=dt,a.UsePreferredLanguages=pt,a.UsePreferredReducedMotion=gt,a.UseScreenSafeArea=ht,a.UseTimeAgo=Ct,a.UseTimestamp=Ot,a.UseVirtualList=Et,a.UseWindowFocus=Pt,a.UseWindowSize=Lt,a.VOnClickOutside=B,a.VOnLongPress=x,a.vElementHover=Ne,a.vElementSize=_e,a.vElementVisibility=Fe,a.vInfiniteScroll=xe,a.vIntersectionObserver=Ze,a.vOnClickOutside=B,a.vOnKeyStroke=fe,a.vOnLongPress=x,a.vScroll=yt,a.vScrollLock=bt})(this.VueUse=this.VueUse||{},VueDemi,VueUse,VueUse);
|
|
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);
|
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
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, tryOnScopeDispose, isIOS, directiveHooks, pausableWatch, toRef, tryOnMounted, useToggle, notNullish, promiseTimeout, until, useDebounceFn, useThrottleFn } from '@vueuse/shared';
|
|
3
|
+
import { toValue, isClient, noop, isObject, tryOnScopeDispose, isIOS, directiveHooks, pausableWatch, toRef, tryOnMounted, useToggle, notNullish, promiseTimeout, until, useDebounceFn, useThrottleFn } from '@vueuse/shared';
|
|
4
4
|
|
|
5
5
|
const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
6
6
|
name: "OnClickOutside",
|
|
@@ -19,8 +19,9 @@ const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
function unrefElement(elRef) {
|
|
22
|
+
var _a;
|
|
22
23
|
const plain = toValue(elRef);
|
|
23
|
-
return plain
|
|
24
|
+
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
const defaultWindow = isClient ? window : void 0;
|
|
@@ -57,9 +58,10 @@ function useEventListener(...args) {
|
|
|
57
58
|
cleanup();
|
|
58
59
|
if (!el)
|
|
59
60
|
return;
|
|
61
|
+
const optionsClone = isObject(options2) ? { ...options2 } : options2;
|
|
60
62
|
cleanups.push(
|
|
61
63
|
...events.flatMap((event) => {
|
|
62
|
-
return listeners.map((listener) => register(el, event, listener,
|
|
64
|
+
return listeners.map((listener) => register(el, event, listener, optionsClone));
|
|
63
65
|
})
|
|
64
66
|
);
|
|
65
67
|
},
|
|
@@ -115,8 +117,9 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
115
117
|
}, { passive: true }),
|
|
116
118
|
detectIframe && useEventListener(window, "blur", (event) => {
|
|
117
119
|
setTimeout(() => {
|
|
120
|
+
var _a;
|
|
118
121
|
const el = unrefElement(target);
|
|
119
|
-
if (window.document.activeElement
|
|
122
|
+
if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement)))
|
|
120
123
|
handler(event);
|
|
121
124
|
}, 0);
|
|
122
125
|
})
|
|
@@ -188,7 +191,8 @@ function onKeyStroke(...args) {
|
|
|
188
191
|
|
|
189
192
|
const vOnKeyStroke = {
|
|
190
193
|
[directiveHooks.mounted](el, binding) {
|
|
191
|
-
|
|
194
|
+
var _a, _b;
|
|
195
|
+
const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
|
|
192
196
|
if (typeof binding.value === "function") {
|
|
193
197
|
onKeyStroke(keys, binding.value, {
|
|
194
198
|
target: el
|
|
@@ -205,6 +209,7 @@ const vOnKeyStroke = {
|
|
|
205
209
|
|
|
206
210
|
const DEFAULT_DELAY = 500;
|
|
207
211
|
function onLongPress(target, handler, options) {
|
|
212
|
+
var _a, _b;
|
|
208
213
|
const elementRef = computed(() => unrefElement(target));
|
|
209
214
|
let timeout;
|
|
210
215
|
function clear() {
|
|
@@ -214,21 +219,22 @@ function onLongPress(target, handler, options) {
|
|
|
214
219
|
}
|
|
215
220
|
}
|
|
216
221
|
function onDown(ev) {
|
|
217
|
-
|
|
222
|
+
var _a2, _b2, _c, _d;
|
|
223
|
+
if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
|
|
218
224
|
return;
|
|
219
225
|
clear();
|
|
220
|
-
if (options
|
|
226
|
+
if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
|
|
221
227
|
ev.preventDefault();
|
|
222
|
-
if (options
|
|
228
|
+
if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
|
|
223
229
|
ev.stopPropagation();
|
|
224
230
|
timeout = setTimeout(
|
|
225
231
|
() => handler(ev),
|
|
226
|
-
options
|
|
232
|
+
(_d = options == null ? void 0 : options.delay) != null ? _d : DEFAULT_DELAY
|
|
227
233
|
);
|
|
228
234
|
}
|
|
229
235
|
const listenerOptions = {
|
|
230
|
-
capture: options
|
|
231
|
-
once: options
|
|
236
|
+
capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
|
|
237
|
+
once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
|
|
232
238
|
};
|
|
233
239
|
useEventListener(elementRef, "pointerdown", onDown, listenerOptions);
|
|
234
240
|
useEventListener(elementRef, ["pointerup", "pointerleave"], clear, listenerOptions);
|
|
@@ -350,6 +356,7 @@ const StorageSerializers = {
|
|
|
350
356
|
};
|
|
351
357
|
const customStorageEventName = "vueuse-storage";
|
|
352
358
|
function useStorage(key, defaults, storage, options = {}) {
|
|
359
|
+
var _a;
|
|
353
360
|
const {
|
|
354
361
|
flush = "pre",
|
|
355
362
|
deep = true,
|
|
@@ -366,7 +373,10 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
366
373
|
const data = (shallow ? shallowRef : ref)(defaults);
|
|
367
374
|
if (!storage) {
|
|
368
375
|
try {
|
|
369
|
-
storage = getSSRHandler("getDefaultStorage", () =>
|
|
376
|
+
storage = getSSRHandler("getDefaultStorage", () => {
|
|
377
|
+
var _a2;
|
|
378
|
+
return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;
|
|
379
|
+
})();
|
|
370
380
|
} catch (e) {
|
|
371
381
|
onError(e);
|
|
372
382
|
}
|
|
@@ -375,7 +385,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
375
385
|
return data;
|
|
376
386
|
const rawInit = toValue(defaults);
|
|
377
387
|
const type = guessSerializerType(rawInit);
|
|
378
|
-
const serializer = options.serializer
|
|
388
|
+
const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];
|
|
379
389
|
const { pause: pauseWatch, resume: resumeWatch } = pausableWatch(
|
|
380
390
|
data,
|
|
381
391
|
() => write(data.value),
|
|
@@ -445,7 +455,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
445
455
|
return;
|
|
446
456
|
pauseWatch();
|
|
447
457
|
try {
|
|
448
|
-
if (event
|
|
458
|
+
if ((event == null ? void 0 : event.newValue) !== serializer.write(data.value))
|
|
449
459
|
data.value = read(event);
|
|
450
460
|
} catch (e) {
|
|
451
461
|
onError(e);
|
|
@@ -543,7 +553,7 @@ function useColorMode(options = {}) {
|
|
|
543
553
|
const updateHTMLAttrs = getSSRHandler(
|
|
544
554
|
"updateHTMLAttrs",
|
|
545
555
|
(selector2, attribute2, value) => {
|
|
546
|
-
const el = typeof selector2 === "string" ? window
|
|
556
|
+
const el = typeof selector2 === "string" ? window == null ? void 0 : window.document.querySelector(selector2) : unrefElement(selector2);
|
|
547
557
|
if (!el)
|
|
548
558
|
return;
|
|
549
559
|
let style;
|
|
@@ -571,7 +581,8 @@ function useColorMode(options = {}) {
|
|
|
571
581
|
}
|
|
572
582
|
);
|
|
573
583
|
function defaultOnChanged(mode) {
|
|
574
|
-
|
|
584
|
+
var _a;
|
|
585
|
+
updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);
|
|
575
586
|
}
|
|
576
587
|
function onChanged(mode) {
|
|
577
588
|
if (options.onChanged)
|
|
@@ -708,7 +719,10 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
708
719
|
],
|
|
709
720
|
setup(props, { slots }) {
|
|
710
721
|
const target = ref();
|
|
711
|
-
const handle = computed(() =>
|
|
722
|
+
const handle = computed(() => {
|
|
723
|
+
var _a;
|
|
724
|
+
return (_a = props.handle) != null ? _a : target.value;
|
|
725
|
+
});
|
|
712
726
|
const storageValue = props.storageKey && useStorage$1(
|
|
713
727
|
props.storageKey,
|
|
714
728
|
toValue(props.initialValue) || { x: 0, y: 0 },
|
|
@@ -716,7 +730,8 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
716
730
|
);
|
|
717
731
|
const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
|
|
718
732
|
const onEnd = (position, event) => {
|
|
719
|
-
|
|
733
|
+
var _a;
|
|
734
|
+
(_a = props.onEnd) == null ? void 0 : _a.call(props, position, event);
|
|
720
735
|
if (!storageValue)
|
|
721
736
|
return;
|
|
722
737
|
storageValue.value.x = position.x;
|
|
@@ -834,7 +849,10 @@ function useResizeObserver(target, callback, options = {}) {
|
|
|
834
849
|
|
|
835
850
|
function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
|
|
836
851
|
const { window = defaultWindow, box = "content-box" } = options;
|
|
837
|
-
const isSVG = computed(() =>
|
|
852
|
+
const isSVG = computed(() => {
|
|
853
|
+
var _a, _b;
|
|
854
|
+
return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
|
|
855
|
+
});
|
|
838
856
|
const width = ref(initialSize.width);
|
|
839
857
|
const height = ref(initialSize.height);
|
|
840
858
|
useResizeObserver(
|
|
@@ -876,7 +894,8 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
876
894
|
|
|
877
895
|
const vElementSize = {
|
|
878
896
|
[directiveHooks.mounted](el, binding) {
|
|
879
|
-
|
|
897
|
+
var _a;
|
|
898
|
+
const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? void 0 : _a[0];
|
|
880
899
|
const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
|
|
881
900
|
const { width, height } = useElementSize(el, ...options);
|
|
882
901
|
watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
|
|
@@ -1047,7 +1066,7 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1047
1066
|
resetOnExecute = true,
|
|
1048
1067
|
shallow = true,
|
|
1049
1068
|
throwError
|
|
1050
|
-
} = options
|
|
1069
|
+
} = options != null ? options : {};
|
|
1051
1070
|
const state = shallow ? shallowRef(initialState) : ref(initialState);
|
|
1052
1071
|
const isReady = ref(false);
|
|
1053
1072
|
const isLoading = ref(false);
|
|
@@ -1202,14 +1221,15 @@ function useScroll(element, options = {}) {
|
|
|
1202
1221
|
}
|
|
1203
1222
|
});
|
|
1204
1223
|
function scrollTo(_x, _y) {
|
|
1224
|
+
var _a, _b, _c;
|
|
1205
1225
|
if (!window)
|
|
1206
1226
|
return;
|
|
1207
1227
|
const _element = toValue(element);
|
|
1208
1228
|
if (!_element)
|
|
1209
1229
|
return;
|
|
1210
|
-
(_element instanceof Document ? window.document.body : _element)
|
|
1211
|
-
top: toValue(_y)
|
|
1212
|
-
left: toValue(_x)
|
|
1230
|
+
(_c = _element instanceof Document ? window.document.body : _element) == null ? void 0 : _c.scrollTo({
|
|
1231
|
+
top: (_a = toValue(_y)) != null ? _a : y.value,
|
|
1232
|
+
left: (_b = toValue(_x)) != null ? _b : x.value,
|
|
1213
1233
|
behavior: toValue(behavior)
|
|
1214
1234
|
});
|
|
1215
1235
|
}
|
|
@@ -1238,9 +1258,10 @@ function useScroll(element, options = {}) {
|
|
|
1238
1258
|
};
|
|
1239
1259
|
const onScrollEndDebounced = useDebounceFn(onScrollEnd, throttle + idle);
|
|
1240
1260
|
const setArrivedState = (target) => {
|
|
1261
|
+
var _a;
|
|
1241
1262
|
if (!window)
|
|
1242
1263
|
return;
|
|
1243
|
-
const el = target.document ? target.document.documentElement : target.documentElement
|
|
1264
|
+
const el = target.document ? target.document.documentElement : (_a = target.documentElement) != null ? _a : target;
|
|
1244
1265
|
const { display, flexDirection } = getComputedStyle(el);
|
|
1245
1266
|
const scrollLeft = el.scrollLeft;
|
|
1246
1267
|
directions.left = scrollLeft < internalX.value;
|
|
@@ -1272,9 +1293,10 @@ function useScroll(element, options = {}) {
|
|
|
1272
1293
|
internalY.value = scrollTop;
|
|
1273
1294
|
};
|
|
1274
1295
|
const onScrollHandler = (e) => {
|
|
1296
|
+
var _a;
|
|
1275
1297
|
if (!window)
|
|
1276
1298
|
return;
|
|
1277
|
-
const eventTarget = e.target.documentElement
|
|
1299
|
+
const eventTarget = (_a = e.target.documentElement) != null ? _a : e.target;
|
|
1278
1300
|
setArrivedState(eventTarget);
|
|
1279
1301
|
isScrolling.value = true;
|
|
1280
1302
|
onScrollEndDebounced(e);
|
|
@@ -1315,6 +1337,7 @@ function resolveElement(el) {
|
|
|
1315
1337
|
}
|
|
1316
1338
|
|
|
1317
1339
|
function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
1340
|
+
var _a;
|
|
1318
1341
|
const {
|
|
1319
1342
|
direction = "bottom",
|
|
1320
1343
|
interval = 100
|
|
@@ -1324,7 +1347,7 @@ function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
|
1324
1347
|
{
|
|
1325
1348
|
...options,
|
|
1326
1349
|
offset: {
|
|
1327
|
-
[direction]: options.distance
|
|
1350
|
+
[direction]: (_a = options.distance) != null ? _a : 0,
|
|
1328
1351
|
...options.offset
|
|
1329
1352
|
}
|
|
1330
1353
|
}
|
|
@@ -1476,15 +1499,18 @@ const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1476
1499
|
const data = reactive(useOffsetPagination({
|
|
1477
1500
|
...props,
|
|
1478
1501
|
onPageChange(...args) {
|
|
1479
|
-
|
|
1502
|
+
var _a;
|
|
1503
|
+
(_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
|
|
1480
1504
|
emit("page-change", ...args);
|
|
1481
1505
|
},
|
|
1482
1506
|
onPageSizeChange(...args) {
|
|
1483
|
-
|
|
1507
|
+
var _a;
|
|
1508
|
+
(_a = props.onPageSizeChange) == null ? void 0 : _a.call(props, ...args);
|
|
1484
1509
|
emit("page-size-change", ...args);
|
|
1485
1510
|
},
|
|
1486
1511
|
onPageCountChange(...args) {
|
|
1487
|
-
|
|
1512
|
+
var _a;
|
|
1513
|
+
(_a = props.onPageCountChange) == null ? void 0 : _a.call(props, ...args);
|
|
1488
1514
|
emit("page-count-change", ...args);
|
|
1489
1515
|
}
|
|
1490
1516
|
}));
|
|
@@ -1654,12 +1680,16 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1654
1680
|
function useCssVar(prop, target, options = {}) {
|
|
1655
1681
|
const { window = defaultWindow, initialValue = "", observe = false } = options;
|
|
1656
1682
|
const variable = ref(initialValue);
|
|
1657
|
-
const elRef = computed(() =>
|
|
1683
|
+
const elRef = computed(() => {
|
|
1684
|
+
var _a;
|
|
1685
|
+
return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
|
|
1686
|
+
});
|
|
1658
1687
|
function updateCssVar() {
|
|
1688
|
+
var _a;
|
|
1659
1689
|
const key = toValue(prop);
|
|
1660
1690
|
const el = toValue(elRef);
|
|
1661
1691
|
if (el && window) {
|
|
1662
|
-
const value = window.getComputedStyle(el).getPropertyValue(key)
|
|
1692
|
+
const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
|
|
1663
1693
|
variable.value = value || initialValue;
|
|
1664
1694
|
}
|
|
1665
1695
|
}
|
|
@@ -1677,7 +1707,8 @@ function useCssVar(prop, target, options = {}) {
|
|
|
1677
1707
|
watch(
|
|
1678
1708
|
variable,
|
|
1679
1709
|
(val) => {
|
|
1680
|
-
|
|
1710
|
+
var _a;
|
|
1711
|
+
if ((_a = elRef.value) == null ? void 0 : _a.style)
|
|
1681
1712
|
elRef.value.style.setProperty(toValue(prop), val);
|
|
1682
1713
|
}
|
|
1683
1714
|
);
|
|
@@ -1774,11 +1805,13 @@ const vScroll = {
|
|
|
1774
1805
|
const state = useScroll(el, {
|
|
1775
1806
|
...options,
|
|
1776
1807
|
onScroll(e) {
|
|
1777
|
-
|
|
1808
|
+
var _a;
|
|
1809
|
+
(_a = options.onScroll) == null ? void 0 : _a.call(options, e);
|
|
1778
1810
|
handler(state);
|
|
1779
1811
|
},
|
|
1780
1812
|
onStop(e) {
|
|
1781
|
-
|
|
1813
|
+
var _a;
|
|
1814
|
+
(_a = options.onStop) == null ? void 0 : _a.call(options, e);
|
|
1782
1815
|
handler(state);
|
|
1783
1816
|
}
|
|
1784
1817
|
});
|
|
@@ -1844,7 +1877,7 @@ function useScrollLock(element, initialState = false) {
|
|
|
1844
1877
|
const el = resolveElement(toValue(element));
|
|
1845
1878
|
if (!el || !isLocked.value)
|
|
1846
1879
|
return;
|
|
1847
|
-
isIOS && stopTouchMoveListener
|
|
1880
|
+
isIOS && (stopTouchMoveListener == null ? void 0 : stopTouchMoveListener());
|
|
1848
1881
|
el.style.overflow = initialOverflow;
|
|
1849
1882
|
isLocked.value = false;
|
|
1850
1883
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/components",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.1",
|
|
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.4.
|
|
36
|
-
"@vueuse/shared": "10.4.
|
|
35
|
+
"@vueuse/core": "10.4.1",
|
|
36
|
+
"@vueuse/shared": "10.4.1",
|
|
37
37
|
"vue-demi": ">=0.14.5"
|
|
38
38
|
}
|
|
39
39
|
}
|