@vueuse/components 10.2.1 → 10.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +135 -429
- package/index.d.cts +650 -0
- package/index.d.mts +650 -0
- package/index.d.ts +3 -3
- package/index.iife.js +135 -429
- package/index.iife.min.js +1 -1
- package/index.mjs +135 -429
- package/package.json +6 -7
package/index.mjs
CHANGED
|
@@ -19,9 +19,8 @@ const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
function unrefElement(elRef) {
|
|
22
|
-
var _a;
|
|
23
22
|
const plain = toValue(elRef);
|
|
24
|
-
return
|
|
23
|
+
return plain?.$el ?? plain;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
const defaultWindow = isClient ? window : void 0;
|
|
@@ -82,6 +81,7 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
82
81
|
if (isIOS && !_iOSWorkaround) {
|
|
83
82
|
_iOSWorkaround = true;
|
|
84
83
|
Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", noop));
|
|
84
|
+
window.document.documentElement.addEventListener("click", noop);
|
|
85
85
|
}
|
|
86
86
|
let shouldListen = true;
|
|
87
87
|
const shouldIgnore = (event) => {
|
|
@@ -115,9 +115,8 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
115
115
|
}, { passive: true }),
|
|
116
116
|
detectIframe && useEventListener(window, "blur", (event) => {
|
|
117
117
|
setTimeout(() => {
|
|
118
|
-
var _a;
|
|
119
118
|
const el = unrefElement(target);
|
|
120
|
-
if (
|
|
119
|
+
if (window.document.activeElement?.tagName === "IFRAME" && !el?.contains(window.document.activeElement))
|
|
121
120
|
handler(event);
|
|
122
121
|
}, 0);
|
|
123
122
|
})
|
|
@@ -187,42 +186,25 @@ function onKeyStroke(...args) {
|
|
|
187
186
|
return useEventListener(target, eventName, listener, passive);
|
|
188
187
|
}
|
|
189
188
|
|
|
190
|
-
var __defProp$e = Object.defineProperty;
|
|
191
|
-
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
|
|
192
|
-
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
|
|
193
|
-
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
|
|
194
|
-
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
195
|
-
var __spreadValues$e = (a, b) => {
|
|
196
|
-
for (var prop in b || (b = {}))
|
|
197
|
-
if (__hasOwnProp$g.call(b, prop))
|
|
198
|
-
__defNormalProp$e(a, prop, b[prop]);
|
|
199
|
-
if (__getOwnPropSymbols$g)
|
|
200
|
-
for (var prop of __getOwnPropSymbols$g(b)) {
|
|
201
|
-
if (__propIsEnum$g.call(b, prop))
|
|
202
|
-
__defNormalProp$e(a, prop, b[prop]);
|
|
203
|
-
}
|
|
204
|
-
return a;
|
|
205
|
-
};
|
|
206
189
|
const vOnKeyStroke = {
|
|
207
190
|
[directiveHooks.mounted](el, binding) {
|
|
208
|
-
|
|
209
|
-
const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
|
|
191
|
+
const keys = binding.arg?.split(",") ?? true;
|
|
210
192
|
if (typeof binding.value === "function") {
|
|
211
193
|
onKeyStroke(keys, binding.value, {
|
|
212
194
|
target: el
|
|
213
195
|
});
|
|
214
196
|
} else {
|
|
215
197
|
const [handler, options] = binding.value;
|
|
216
|
-
onKeyStroke(keys, handler,
|
|
217
|
-
target: el
|
|
218
|
-
|
|
198
|
+
onKeyStroke(keys, handler, {
|
|
199
|
+
target: el,
|
|
200
|
+
...options
|
|
201
|
+
});
|
|
219
202
|
}
|
|
220
203
|
}
|
|
221
204
|
};
|
|
222
205
|
|
|
223
206
|
const DEFAULT_DELAY = 500;
|
|
224
207
|
function onLongPress(target, handler, options) {
|
|
225
|
-
var _a, _b;
|
|
226
208
|
const elementRef = computed(() => unrefElement(target));
|
|
227
209
|
let timeout;
|
|
228
210
|
function clear() {
|
|
@@ -232,26 +214,24 @@ function onLongPress(target, handler, options) {
|
|
|
232
214
|
}
|
|
233
215
|
}
|
|
234
216
|
function onDown(ev) {
|
|
235
|
-
|
|
236
|
-
if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
|
|
217
|
+
if (options?.modifiers?.self && ev.target !== elementRef.value)
|
|
237
218
|
return;
|
|
238
219
|
clear();
|
|
239
|
-
if (
|
|
220
|
+
if (options?.modifiers?.prevent)
|
|
240
221
|
ev.preventDefault();
|
|
241
|
-
if (
|
|
222
|
+
if (options?.modifiers?.stop)
|
|
242
223
|
ev.stopPropagation();
|
|
243
224
|
timeout = setTimeout(
|
|
244
225
|
() => handler(ev),
|
|
245
|
-
|
|
226
|
+
options?.delay ?? DEFAULT_DELAY
|
|
246
227
|
);
|
|
247
228
|
}
|
|
248
229
|
const listenerOptions = {
|
|
249
|
-
capture:
|
|
250
|
-
once:
|
|
230
|
+
capture: options?.modifiers?.capture,
|
|
231
|
+
once: options?.modifiers?.once
|
|
251
232
|
};
|
|
252
233
|
useEventListener(elementRef, "pointerdown", onDown, listenerOptions);
|
|
253
|
-
useEventListener(elementRef, "pointerup", clear, listenerOptions);
|
|
254
|
-
useEventListener(elementRef, "pointerleave", clear, listenerOptions);
|
|
234
|
+
useEventListener(elementRef, ["pointerup", "pointerleave"], clear, listenerOptions);
|
|
255
235
|
}
|
|
256
236
|
|
|
257
237
|
const OnLongPress = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
@@ -334,22 +314,6 @@ function guessSerializerType(rawInit) {
|
|
|
334
314
|
return rawInit == null ? "any" : rawInit instanceof Set ? "set" : rawInit instanceof Map ? "map" : rawInit instanceof Date ? "date" : typeof rawInit === "boolean" ? "boolean" : typeof rawInit === "string" ? "string" : typeof rawInit === "object" ? "object" : !Number.isNaN(rawInit) ? "number" : "any";
|
|
335
315
|
}
|
|
336
316
|
|
|
337
|
-
var __defProp$d = Object.defineProperty;
|
|
338
|
-
var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
|
|
339
|
-
var __hasOwnProp$f = Object.prototype.hasOwnProperty;
|
|
340
|
-
var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
|
|
341
|
-
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
342
|
-
var __spreadValues$d = (a, b) => {
|
|
343
|
-
for (var prop in b || (b = {}))
|
|
344
|
-
if (__hasOwnProp$f.call(b, prop))
|
|
345
|
-
__defNormalProp$d(a, prop, b[prop]);
|
|
346
|
-
if (__getOwnPropSymbols$f)
|
|
347
|
-
for (var prop of __getOwnPropSymbols$f(b)) {
|
|
348
|
-
if (__propIsEnum$f.call(b, prop))
|
|
349
|
-
__defNormalProp$d(a, prop, b[prop]);
|
|
350
|
-
}
|
|
351
|
-
return a;
|
|
352
|
-
};
|
|
353
317
|
const StorageSerializers = {
|
|
354
318
|
boolean: {
|
|
355
319
|
read: (v) => v === "true",
|
|
@@ -386,7 +350,6 @@ const StorageSerializers = {
|
|
|
386
350
|
};
|
|
387
351
|
const customStorageEventName = "vueuse-storage";
|
|
388
352
|
function useStorage(key, defaults, storage, options = {}) {
|
|
389
|
-
var _a;
|
|
390
353
|
const {
|
|
391
354
|
flush = "pre",
|
|
392
355
|
deep = true,
|
|
@@ -403,10 +366,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
403
366
|
const data = (shallow ? shallowRef : ref)(defaults);
|
|
404
367
|
if (!storage) {
|
|
405
368
|
try {
|
|
406
|
-
storage = getSSRHandler("getDefaultStorage", () =>
|
|
407
|
-
var _a2;
|
|
408
|
-
return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;
|
|
409
|
-
})();
|
|
369
|
+
storage = getSSRHandler("getDefaultStorage", () => defaultWindow?.localStorage)();
|
|
410
370
|
} catch (e) {
|
|
411
371
|
onError(e);
|
|
412
372
|
}
|
|
@@ -415,7 +375,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
415
375
|
return data;
|
|
416
376
|
const rawInit = toValue(defaults);
|
|
417
377
|
const type = guessSerializerType(rawInit);
|
|
418
|
-
const serializer =
|
|
378
|
+
const serializer = options.serializer ?? StorageSerializers[type];
|
|
419
379
|
const { pause: pauseWatch, resume: resumeWatch } = pausableWatch(
|
|
420
380
|
data,
|
|
421
381
|
() => write(data.value),
|
|
@@ -463,7 +423,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
463
423
|
if (typeof mergeDefaults === "function")
|
|
464
424
|
return mergeDefaults(value, rawInit);
|
|
465
425
|
else if (type === "object" && !Array.isArray(value))
|
|
466
|
-
return
|
|
426
|
+
return { ...rawInit, ...value };
|
|
467
427
|
return value;
|
|
468
428
|
} else if (typeof rawValue !== "string") {
|
|
469
429
|
return rawValue;
|
|
@@ -485,7 +445,8 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
485
445
|
return;
|
|
486
446
|
pauseWatch();
|
|
487
447
|
try {
|
|
488
|
-
data.value
|
|
448
|
+
if (event?.newValue !== serializer.write(data.value))
|
|
449
|
+
data.value = read(event);
|
|
489
450
|
} catch (e) {
|
|
490
451
|
onError(e);
|
|
491
452
|
} finally {
|
|
@@ -520,29 +481,33 @@ function useMediaQuery(query, options = {}) {
|
|
|
520
481
|
const isSupported = useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function");
|
|
521
482
|
let mediaQuery;
|
|
522
483
|
const matches = ref(false);
|
|
484
|
+
const handler = (event) => {
|
|
485
|
+
matches.value = event.matches;
|
|
486
|
+
};
|
|
523
487
|
const cleanup = () => {
|
|
524
488
|
if (!mediaQuery)
|
|
525
489
|
return;
|
|
526
490
|
if ("removeEventListener" in mediaQuery)
|
|
527
|
-
mediaQuery.removeEventListener("change",
|
|
491
|
+
mediaQuery.removeEventListener("change", handler);
|
|
528
492
|
else
|
|
529
|
-
mediaQuery.removeListener(
|
|
493
|
+
mediaQuery.removeListener(handler);
|
|
530
494
|
};
|
|
531
|
-
const
|
|
495
|
+
const stopWatch = watchEffect(() => {
|
|
532
496
|
if (!isSupported.value)
|
|
533
497
|
return;
|
|
534
498
|
cleanup();
|
|
535
|
-
mediaQuery = window.matchMedia(
|
|
536
|
-
matches.value = !!(mediaQuery == null ? void 0 : mediaQuery.matches);
|
|
537
|
-
if (!mediaQuery)
|
|
538
|
-
return;
|
|
499
|
+
mediaQuery = window.matchMedia(toValue(query));
|
|
539
500
|
if ("addEventListener" in mediaQuery)
|
|
540
|
-
mediaQuery.addEventListener("change",
|
|
501
|
+
mediaQuery.addEventListener("change", handler);
|
|
541
502
|
else
|
|
542
|
-
mediaQuery.addListener(
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
tryOnScopeDispose(() =>
|
|
503
|
+
mediaQuery.addListener(handler);
|
|
504
|
+
matches.value = mediaQuery.matches;
|
|
505
|
+
});
|
|
506
|
+
tryOnScopeDispose(() => {
|
|
507
|
+
stopWatch();
|
|
508
|
+
cleanup();
|
|
509
|
+
mediaQuery = void 0;
|
|
510
|
+
});
|
|
546
511
|
return matches;
|
|
547
512
|
}
|
|
548
513
|
|
|
@@ -550,22 +515,6 @@ function usePreferredDark(options) {
|
|
|
550
515
|
return useMediaQuery("(prefers-color-scheme: dark)", options);
|
|
551
516
|
}
|
|
552
517
|
|
|
553
|
-
var __defProp$c = Object.defineProperty;
|
|
554
|
-
var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
|
|
555
|
-
var __hasOwnProp$e = Object.prototype.hasOwnProperty;
|
|
556
|
-
var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
|
|
557
|
-
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
558
|
-
var __spreadValues$c = (a, b) => {
|
|
559
|
-
for (var prop in b || (b = {}))
|
|
560
|
-
if (__hasOwnProp$e.call(b, prop))
|
|
561
|
-
__defNormalProp$c(a, prop, b[prop]);
|
|
562
|
-
if (__getOwnPropSymbols$e)
|
|
563
|
-
for (var prop of __getOwnPropSymbols$e(b)) {
|
|
564
|
-
if (__propIsEnum$e.call(b, prop))
|
|
565
|
-
__defNormalProp$c(a, prop, b[prop]);
|
|
566
|
-
}
|
|
567
|
-
return a;
|
|
568
|
-
};
|
|
569
518
|
function useColorMode(options = {}) {
|
|
570
519
|
const {
|
|
571
520
|
selector = "html",
|
|
@@ -579,11 +528,12 @@ function useColorMode(options = {}) {
|
|
|
579
528
|
emitAuto,
|
|
580
529
|
disableTransition = true
|
|
581
530
|
} = options;
|
|
582
|
-
const modes =
|
|
531
|
+
const modes = {
|
|
583
532
|
auto: "",
|
|
584
533
|
light: "light",
|
|
585
|
-
dark: "dark"
|
|
586
|
-
|
|
534
|
+
dark: "dark",
|
|
535
|
+
...options.modes || {}
|
|
536
|
+
};
|
|
587
537
|
const preferredDark = usePreferredDark({ window });
|
|
588
538
|
const system = computed(() => preferredDark.value ? "dark" : "light");
|
|
589
539
|
const store = storageRef || (storageKey == null ? toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));
|
|
@@ -593,7 +543,7 @@ function useColorMode(options = {}) {
|
|
|
593
543
|
const updateHTMLAttrs = getSSRHandler(
|
|
594
544
|
"updateHTMLAttrs",
|
|
595
545
|
(selector2, attribute2, value) => {
|
|
596
|
-
const el = typeof selector2 === "string" ? window
|
|
546
|
+
const el = typeof selector2 === "string" ? window?.document.querySelector(selector2) : unrefElement(selector2);
|
|
597
547
|
if (!el)
|
|
598
548
|
return;
|
|
599
549
|
let style;
|
|
@@ -621,8 +571,7 @@ function useColorMode(options = {}) {
|
|
|
621
571
|
}
|
|
622
572
|
);
|
|
623
573
|
function defaultOnChanged(mode) {
|
|
624
|
-
|
|
625
|
-
updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);
|
|
574
|
+
updateHTMLAttrs(selector, attribute, modes[mode] ?? mode);
|
|
626
575
|
}
|
|
627
576
|
function onChanged(mode) {
|
|
628
577
|
if (options.onChanged)
|
|
@@ -740,25 +689,6 @@ const UseDocumentVisibility = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
740
689
|
}
|
|
741
690
|
});
|
|
742
691
|
|
|
743
|
-
var __defProp$b = Object.defineProperty;
|
|
744
|
-
var __defProps$9 = Object.defineProperties;
|
|
745
|
-
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
746
|
-
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
747
|
-
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
748
|
-
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
749
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
750
|
-
var __spreadValues$b = (a, b) => {
|
|
751
|
-
for (var prop in b || (b = {}))
|
|
752
|
-
if (__hasOwnProp$d.call(b, prop))
|
|
753
|
-
__defNormalProp$b(a, prop, b[prop]);
|
|
754
|
-
if (__getOwnPropSymbols$d)
|
|
755
|
-
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
756
|
-
if (__propIsEnum$d.call(b, prop))
|
|
757
|
-
__defNormalProp$b(a, prop, b[prop]);
|
|
758
|
-
}
|
|
759
|
-
return a;
|
|
760
|
-
};
|
|
761
|
-
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
762
692
|
const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
763
693
|
name: "UseDraggable",
|
|
764
694
|
props: [
|
|
@@ -778,10 +708,7 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
778
708
|
],
|
|
779
709
|
setup(props, { slots }) {
|
|
780
710
|
const target = ref();
|
|
781
|
-
const handle = computed(() =>
|
|
782
|
-
var _a;
|
|
783
|
-
return (_a = props.handle) != null ? _a : target.value;
|
|
784
|
-
});
|
|
711
|
+
const handle = computed(() => props.handle ?? target.value);
|
|
785
712
|
const storageValue = props.storageKey && useStorage$1(
|
|
786
713
|
props.storageKey,
|
|
787
714
|
toValue(props.initialValue) || { x: 0, y: 0 },
|
|
@@ -789,18 +716,18 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
789
716
|
);
|
|
790
717
|
const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
|
|
791
718
|
const onEnd = (position, event) => {
|
|
792
|
-
|
|
793
|
-
(_a = props.onEnd) == null ? void 0 : _a.call(props, position, event);
|
|
719
|
+
props.onEnd?.(position, event);
|
|
794
720
|
if (!storageValue)
|
|
795
721
|
return;
|
|
796
722
|
storageValue.value.x = position.x;
|
|
797
723
|
storageValue.value.y = position.y;
|
|
798
724
|
};
|
|
799
|
-
const data = reactive(useDraggable(target,
|
|
725
|
+
const data = reactive(useDraggable(target, {
|
|
726
|
+
...props,
|
|
800
727
|
handle,
|
|
801
728
|
initialValue,
|
|
802
729
|
onEnd
|
|
803
|
-
}))
|
|
730
|
+
}));
|
|
804
731
|
return () => {
|
|
805
732
|
if (slots.default)
|
|
806
733
|
return h(props.as || "div", { ref: target, style: `touch-action:none;${data.style}` }, slots.default(data));
|
|
@@ -858,7 +785,7 @@ const vElementHover = {
|
|
|
858
785
|
|
|
859
786
|
const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
860
787
|
name: "UseElementSize",
|
|
861
|
-
props: ["width", "height", "box"],
|
|
788
|
+
props: ["width", "height", "box", "as"],
|
|
862
789
|
setup(props, { slots }) {
|
|
863
790
|
const target = ref();
|
|
864
791
|
const data = reactive(useElementSize$1(target, { width: props.width, height: props.height }, { box: props.box }));
|
|
@@ -869,23 +796,8 @@ const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
869
796
|
}
|
|
870
797
|
});
|
|
871
798
|
|
|
872
|
-
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
873
|
-
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
874
|
-
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
875
|
-
var __objRest$1 = (source, exclude) => {
|
|
876
|
-
var target = {};
|
|
877
|
-
for (var prop in source)
|
|
878
|
-
if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
879
|
-
target[prop] = source[prop];
|
|
880
|
-
if (source != null && __getOwnPropSymbols$c)
|
|
881
|
-
for (var prop of __getOwnPropSymbols$c(source)) {
|
|
882
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
|
|
883
|
-
target[prop] = source[prop];
|
|
884
|
-
}
|
|
885
|
-
return target;
|
|
886
|
-
};
|
|
887
799
|
function useResizeObserver(target, callback, options = {}) {
|
|
888
|
-
const
|
|
800
|
+
const { window = defaultWindow, ...observerOptions } = options;
|
|
889
801
|
let observer;
|
|
890
802
|
const isSupported = useSupported(() => window && "ResizeObserver" in window);
|
|
891
803
|
const cleanup = () => {
|
|
@@ -922,10 +834,7 @@ function useResizeObserver(target, callback, options = {}) {
|
|
|
922
834
|
|
|
923
835
|
function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
|
|
924
836
|
const { window = defaultWindow, box = "content-box" } = options;
|
|
925
|
-
const isSVG = computed(() =>
|
|
926
|
-
var _a, _b;
|
|
927
|
-
return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
|
|
928
|
-
});
|
|
837
|
+
const isSVG = computed(() => unrefElement(target)?.namespaceURI?.includes("svg"));
|
|
929
838
|
const width = ref(initialSize.width);
|
|
930
839
|
const height = ref(initialSize.height);
|
|
931
840
|
useResizeObserver(
|
|
@@ -967,8 +876,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
967
876
|
|
|
968
877
|
const vElementSize = {
|
|
969
878
|
[directiveHooks.mounted](el, binding) {
|
|
970
|
-
|
|
971
|
-
const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? void 0 : _a[0];
|
|
879
|
+
const handler = typeof binding.value === "function" ? binding.value : binding.value?.[0];
|
|
972
880
|
const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
|
|
973
881
|
const { width, height } = useElementSize(el, ...options);
|
|
974
882
|
watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
|
|
@@ -1058,7 +966,8 @@ function useElementVisibility(element, { window = defaultWindow, scrollTarget }
|
|
|
1058
966
|
},
|
|
1059
967
|
{
|
|
1060
968
|
root: scrollTarget,
|
|
1061
|
-
window
|
|
969
|
+
window,
|
|
970
|
+
threshold: 0
|
|
1062
971
|
}
|
|
1063
972
|
);
|
|
1064
973
|
return elementIsVisible;
|
|
@@ -1129,25 +1038,6 @@ const UseIdle = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1129
1038
|
}
|
|
1130
1039
|
});
|
|
1131
1040
|
|
|
1132
|
-
var __defProp$a = Object.defineProperty;
|
|
1133
|
-
var __defProps$8 = Object.defineProperties;
|
|
1134
|
-
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
1135
|
-
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
1136
|
-
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
1137
|
-
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
1138
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1139
|
-
var __spreadValues$a = (a, b) => {
|
|
1140
|
-
for (var prop in b || (b = {}))
|
|
1141
|
-
if (__hasOwnProp$b.call(b, prop))
|
|
1142
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
1143
|
-
if (__getOwnPropSymbols$b)
|
|
1144
|
-
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
1145
|
-
if (__propIsEnum$b.call(b, prop))
|
|
1146
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
1147
|
-
}
|
|
1148
|
-
return a;
|
|
1149
|
-
};
|
|
1150
|
-
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
1151
1041
|
function useAsyncState(promise, initialState, options) {
|
|
1152
1042
|
const {
|
|
1153
1043
|
immediate = true,
|
|
@@ -1157,7 +1047,7 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1157
1047
|
resetOnExecute = true,
|
|
1158
1048
|
shallow = true,
|
|
1159
1049
|
throwError
|
|
1160
|
-
} = options
|
|
1050
|
+
} = options ?? {};
|
|
1161
1051
|
const state = shallow ? shallowRef(initialState) : ref(initialState);
|
|
1162
1052
|
const isReady = ref(false);
|
|
1163
1053
|
const isLoading = ref(false);
|
|
@@ -1200,29 +1090,14 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1200
1090
|
until(isLoading).toBe(false).then(() => resolve(shell)).catch(reject);
|
|
1201
1091
|
});
|
|
1202
1092
|
}
|
|
1203
|
-
return
|
|
1093
|
+
return {
|
|
1094
|
+
...shell,
|
|
1204
1095
|
then(onFulfilled, onRejected) {
|
|
1205
1096
|
return waitUntilIsLoaded().then(onFulfilled, onRejected);
|
|
1206
1097
|
}
|
|
1207
|
-
}
|
|
1098
|
+
};
|
|
1208
1099
|
}
|
|
1209
1100
|
|
|
1210
|
-
var __defProp$9 = Object.defineProperty;
|
|
1211
|
-
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
1212
|
-
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
1213
|
-
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
1214
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1215
|
-
var __spreadValues$9 = (a, b) => {
|
|
1216
|
-
for (var prop in b || (b = {}))
|
|
1217
|
-
if (__hasOwnProp$a.call(b, prop))
|
|
1218
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
1219
|
-
if (__getOwnPropSymbols$a)
|
|
1220
|
-
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
1221
|
-
if (__propIsEnum$a.call(b, prop))
|
|
1222
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
1223
|
-
}
|
|
1224
|
-
return a;
|
|
1225
|
-
};
|
|
1226
1101
|
async function loadImage(options) {
|
|
1227
1102
|
return new Promise((resolve, reject) => {
|
|
1228
1103
|
const img = new Image();
|
|
@@ -1248,9 +1123,10 @@ function useImage(options, asyncStateOptions = {}) {
|
|
|
1248
1123
|
const state = useAsyncState(
|
|
1249
1124
|
() => loadImage(toValue(options)),
|
|
1250
1125
|
void 0,
|
|
1251
|
-
|
|
1252
|
-
resetOnExecute: true
|
|
1253
|
-
|
|
1126
|
+
{
|
|
1127
|
+
resetOnExecute: true,
|
|
1128
|
+
...asyncStateOptions
|
|
1129
|
+
}
|
|
1254
1130
|
);
|
|
1255
1131
|
watch(
|
|
1256
1132
|
() => toValue(options),
|
|
@@ -1304,7 +1180,8 @@ function useScroll(element, options = {}) {
|
|
|
1304
1180
|
capture: false,
|
|
1305
1181
|
passive: true
|
|
1306
1182
|
},
|
|
1307
|
-
behavior = "auto"
|
|
1183
|
+
behavior = "auto",
|
|
1184
|
+
window = defaultWindow
|
|
1308
1185
|
} = options;
|
|
1309
1186
|
const internalX = ref(0);
|
|
1310
1187
|
const internalY = ref(0);
|
|
@@ -1325,13 +1202,14 @@ function useScroll(element, options = {}) {
|
|
|
1325
1202
|
}
|
|
1326
1203
|
});
|
|
1327
1204
|
function scrollTo(_x, _y) {
|
|
1328
|
-
|
|
1205
|
+
if (!window)
|
|
1206
|
+
return;
|
|
1329
1207
|
const _element = toValue(element);
|
|
1330
1208
|
if (!_element)
|
|
1331
1209
|
return;
|
|
1332
|
-
(
|
|
1333
|
-
top:
|
|
1334
|
-
left:
|
|
1210
|
+
(_element instanceof Document ? window.document.body : _element)?.scrollTo({
|
|
1211
|
+
top: toValue(_y) ?? y.value,
|
|
1212
|
+
left: toValue(_x) ?? x.value,
|
|
1335
1213
|
behavior: toValue(behavior)
|
|
1336
1214
|
});
|
|
1337
1215
|
}
|
|
@@ -1360,7 +1238,9 @@ function useScroll(element, options = {}) {
|
|
|
1360
1238
|
};
|
|
1361
1239
|
const onScrollEndDebounced = useDebounceFn(onScrollEnd, throttle + idle);
|
|
1362
1240
|
const setArrivedState = (target) => {
|
|
1363
|
-
|
|
1241
|
+
if (!window)
|
|
1242
|
+
return;
|
|
1243
|
+
const el = target.document ? target.document.documentElement : target.documentElement ?? target;
|
|
1364
1244
|
const { display, flexDirection } = getComputedStyle(el);
|
|
1365
1245
|
const scrollLeft = el.scrollLeft;
|
|
1366
1246
|
directions.left = scrollLeft < internalX.value;
|
|
@@ -1376,8 +1256,8 @@ function useScroll(element, options = {}) {
|
|
|
1376
1256
|
}
|
|
1377
1257
|
internalX.value = scrollLeft;
|
|
1378
1258
|
let scrollTop = el.scrollTop;
|
|
1379
|
-
if (target === document && !scrollTop)
|
|
1380
|
-
scrollTop = document.body.scrollTop;
|
|
1259
|
+
if (target === window.document && !scrollTop)
|
|
1260
|
+
scrollTop = window.document.body.scrollTop;
|
|
1381
1261
|
directions.top = scrollTop < internalY.value;
|
|
1382
1262
|
directions.bottom = scrollTop > internalY.value;
|
|
1383
1263
|
const top = Math.abs(scrollTop) <= 0 + (offset.top || 0);
|
|
@@ -1392,7 +1272,9 @@ function useScroll(element, options = {}) {
|
|
|
1392
1272
|
internalY.value = scrollTop;
|
|
1393
1273
|
};
|
|
1394
1274
|
const onScrollHandler = (e) => {
|
|
1395
|
-
|
|
1275
|
+
if (!window)
|
|
1276
|
+
return;
|
|
1277
|
+
const eventTarget = e.target.documentElement ?? e.target;
|
|
1396
1278
|
setArrivedState(eventTarget);
|
|
1397
1279
|
isScrolling.value = true;
|
|
1398
1280
|
onScrollEndDebounced(e);
|
|
@@ -1418,53 +1300,47 @@ function useScroll(element, options = {}) {
|
|
|
1418
1300
|
directions,
|
|
1419
1301
|
measure() {
|
|
1420
1302
|
const _element = toValue(element);
|
|
1421
|
-
if (_element)
|
|
1303
|
+
if (window && _element)
|
|
1422
1304
|
setArrivedState(_element);
|
|
1423
1305
|
}
|
|
1424
1306
|
};
|
|
1425
1307
|
}
|
|
1426
1308
|
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
for (var prop in b || (b = {}))
|
|
1436
|
-
if (__hasOwnProp$9.call(b, prop))
|
|
1437
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
1438
|
-
if (__getOwnPropSymbols$9)
|
|
1439
|
-
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
1440
|
-
if (__propIsEnum$9.call(b, prop))
|
|
1441
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
1442
|
-
}
|
|
1443
|
-
return a;
|
|
1444
|
-
};
|
|
1445
|
-
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
1309
|
+
function resolveElement(el) {
|
|
1310
|
+
if (typeof Window !== "undefined" && el instanceof Window)
|
|
1311
|
+
return el.document.documentElement;
|
|
1312
|
+
if (typeof Document !== "undefined" && el instanceof Document)
|
|
1313
|
+
return el.documentElement;
|
|
1314
|
+
return el;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1446
1317
|
function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
1447
|
-
var _a;
|
|
1448
1318
|
const {
|
|
1449
1319
|
direction = "bottom",
|
|
1450
1320
|
interval = 100
|
|
1451
1321
|
} = options;
|
|
1452
1322
|
const state = reactive(useScroll(
|
|
1453
1323
|
element,
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1324
|
+
{
|
|
1325
|
+
...options,
|
|
1326
|
+
offset: {
|
|
1327
|
+
[direction]: options.distance ?? 0,
|
|
1328
|
+
...options.offset
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1459
1331
|
));
|
|
1460
1332
|
const promise = ref();
|
|
1461
1333
|
const isLoading = computed(() => !!promise.value);
|
|
1334
|
+
const observedElement = computed(() => {
|
|
1335
|
+
return resolveElement(toValue(element));
|
|
1336
|
+
});
|
|
1337
|
+
const isElementVisible = useElementVisibility(observedElement);
|
|
1462
1338
|
function checkAndLoad() {
|
|
1463
1339
|
state.measure();
|
|
1464
|
-
|
|
1465
|
-
if (!el || !el.offsetParent)
|
|
1340
|
+
if (!observedElement.value || !isElementVisible.value)
|
|
1466
1341
|
return;
|
|
1467
|
-
const
|
|
1342
|
+
const { scrollHeight, clientHeight, scrollWidth, clientWidth } = observedElement.value;
|
|
1343
|
+
const isNarrower = direction === "bottom" || direction === "top" ? scrollHeight <= clientHeight : scrollWidth <= clientWidth;
|
|
1468
1344
|
if (state.arrivedState[direction] || isNarrower) {
|
|
1469
1345
|
if (!promise.value) {
|
|
1470
1346
|
promise.value = Promise.all([
|
|
@@ -1478,7 +1354,7 @@ function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
|
1478
1354
|
}
|
|
1479
1355
|
}
|
|
1480
1356
|
watch(
|
|
1481
|
-
() => [state.arrivedState[direction],
|
|
1357
|
+
() => [state.arrivedState[direction], isElementVisible.value],
|
|
1482
1358
|
checkAndLoad,
|
|
1483
1359
|
{ immediate: true }
|
|
1484
1360
|
);
|
|
@@ -1530,31 +1406,12 @@ const UseMouseInElement = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1530
1406
|
}
|
|
1531
1407
|
});
|
|
1532
1408
|
|
|
1533
|
-
var __defProp$7 = Object.defineProperty;
|
|
1534
|
-
var __defProps$6 = Object.defineProperties;
|
|
1535
|
-
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
1536
|
-
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
1537
|
-
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
1538
|
-
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
1539
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1540
|
-
var __spreadValues$7 = (a, b) => {
|
|
1541
|
-
for (var prop in b || (b = {}))
|
|
1542
|
-
if (__hasOwnProp$8.call(b, prop))
|
|
1543
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
1544
|
-
if (__getOwnPropSymbols$8)
|
|
1545
|
-
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
1546
|
-
if (__propIsEnum$8.call(b, prop))
|
|
1547
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
1548
|
-
}
|
|
1549
|
-
return a;
|
|
1550
|
-
};
|
|
1551
|
-
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
1552
1409
|
const UseMousePressed = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1553
1410
|
name: "UseMousePressed",
|
|
1554
1411
|
props: ["touch", "initialValue", "as"],
|
|
1555
1412
|
setup(props, { slots }) {
|
|
1556
1413
|
const target = ref();
|
|
1557
|
-
const data = reactive(useMousePressed(
|
|
1414
|
+
const data = reactive(useMousePressed({ ...props, target }));
|
|
1558
1415
|
return () => {
|
|
1559
1416
|
if (slots.default)
|
|
1560
1417
|
return h(props.as || "div", { ref: target }, slots.default(data));
|
|
@@ -1573,30 +1430,11 @@ const UseNetwork = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1573
1430
|
}
|
|
1574
1431
|
});
|
|
1575
1432
|
|
|
1576
|
-
var __defProp$6 = Object.defineProperty;
|
|
1577
|
-
var __defProps$5 = Object.defineProperties;
|
|
1578
|
-
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
1579
|
-
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
1580
|
-
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
1581
|
-
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
1582
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1583
|
-
var __spreadValues$6 = (a, b) => {
|
|
1584
|
-
for (var prop in b || (b = {}))
|
|
1585
|
-
if (__hasOwnProp$7.call(b, prop))
|
|
1586
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1587
|
-
if (__getOwnPropSymbols$7)
|
|
1588
|
-
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
1589
|
-
if (__propIsEnum$7.call(b, prop))
|
|
1590
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1591
|
-
}
|
|
1592
|
-
return a;
|
|
1593
|
-
};
|
|
1594
|
-
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
1595
1433
|
const UseNow = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1596
1434
|
name: "UseNow",
|
|
1597
1435
|
props: ["interval"],
|
|
1598
1436
|
setup(props, { slots }) {
|
|
1599
|
-
const data = reactive(useNow(
|
|
1437
|
+
const data = reactive(useNow({ ...props, controls: true }));
|
|
1600
1438
|
return () => {
|
|
1601
1439
|
if (slots.default)
|
|
1602
1440
|
return slots.default(data);
|
|
@@ -1619,25 +1457,6 @@ const UseObjectUrl = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1619
1457
|
}
|
|
1620
1458
|
});
|
|
1621
1459
|
|
|
1622
|
-
var __defProp$5 = Object.defineProperty;
|
|
1623
|
-
var __defProps$4 = Object.defineProperties;
|
|
1624
|
-
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1625
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1626
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1627
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1628
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1629
|
-
var __spreadValues$5 = (a, b) => {
|
|
1630
|
-
for (var prop in b || (b = {}))
|
|
1631
|
-
if (__hasOwnProp$6.call(b, prop))
|
|
1632
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1633
|
-
if (__getOwnPropSymbols$6)
|
|
1634
|
-
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1635
|
-
if (__propIsEnum$6.call(b, prop))
|
|
1636
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1637
|
-
}
|
|
1638
|
-
return a;
|
|
1639
|
-
};
|
|
1640
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1641
1460
|
const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1642
1461
|
name: "UseOffsetPagination",
|
|
1643
1462
|
props: [
|
|
@@ -1654,23 +1473,21 @@ const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1654
1473
|
"page-count-change"
|
|
1655
1474
|
],
|
|
1656
1475
|
setup(props, { slots, emit }) {
|
|
1657
|
-
const data = reactive(useOffsetPagination(
|
|
1476
|
+
const data = reactive(useOffsetPagination({
|
|
1477
|
+
...props,
|
|
1658
1478
|
onPageChange(...args) {
|
|
1659
|
-
|
|
1660
|
-
(_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
|
|
1479
|
+
props.onPageChange?.(...args);
|
|
1661
1480
|
emit("page-change", ...args);
|
|
1662
1481
|
},
|
|
1663
1482
|
onPageSizeChange(...args) {
|
|
1664
|
-
|
|
1665
|
-
(_a = props.onPageSizeChange) == null ? void 0 : _a.call(props, ...args);
|
|
1483
|
+
props.onPageSizeChange?.(...args);
|
|
1666
1484
|
emit("page-size-change", ...args);
|
|
1667
1485
|
},
|
|
1668
1486
|
onPageCountChange(...args) {
|
|
1669
|
-
|
|
1670
|
-
(_a = props.onPageCountChange) == null ? void 0 : _a.call(props, ...args);
|
|
1487
|
+
props.onPageCountChange?.(...args);
|
|
1671
1488
|
emit("page-count-change", ...args);
|
|
1672
1489
|
}
|
|
1673
|
-
}))
|
|
1490
|
+
}));
|
|
1674
1491
|
return () => {
|
|
1675
1492
|
if (slots.default)
|
|
1676
1493
|
return slots.default(data);
|
|
@@ -1704,25 +1521,6 @@ const UsePageLeave = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1704
1521
|
}
|
|
1705
1522
|
});
|
|
1706
1523
|
|
|
1707
|
-
var __defProp$4 = Object.defineProperty;
|
|
1708
|
-
var __defProps$3 = Object.defineProperties;
|
|
1709
|
-
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1710
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1711
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1712
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1713
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1714
|
-
var __spreadValues$4 = (a, b) => {
|
|
1715
|
-
for (var prop in b || (b = {}))
|
|
1716
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
1717
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1718
|
-
if (__getOwnPropSymbols$5)
|
|
1719
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
1720
|
-
if (__propIsEnum$5.call(b, prop))
|
|
1721
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1722
|
-
}
|
|
1723
|
-
return a;
|
|
1724
|
-
};
|
|
1725
|
-
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1726
1524
|
const UsePointer = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1727
1525
|
name: "UsePointer",
|
|
1728
1526
|
props: [
|
|
@@ -1732,9 +1530,10 @@ const UsePointer = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1732
1530
|
],
|
|
1733
1531
|
setup(props, { slots }) {
|
|
1734
1532
|
const el = ref(null);
|
|
1735
|
-
const data = reactive(usePointer(
|
|
1533
|
+
const data = reactive(usePointer({
|
|
1534
|
+
...props,
|
|
1736
1535
|
target: props.target === "self" ? el : defaultWindow
|
|
1737
|
-
}))
|
|
1536
|
+
}));
|
|
1738
1537
|
return () => {
|
|
1739
1538
|
if (slots.default)
|
|
1740
1539
|
return slots.default(data, { ref: el });
|
|
@@ -1820,23 +1619,8 @@ const UsePreferredReducedMotion = /* @__PURE__ */ /* #__PURE__ */ defineComponen
|
|
|
1820
1619
|
}
|
|
1821
1620
|
});
|
|
1822
1621
|
|
|
1823
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1824
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1825
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1826
|
-
var __objRest = (source, exclude) => {
|
|
1827
|
-
var target = {};
|
|
1828
|
-
for (var prop in source)
|
|
1829
|
-
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1830
|
-
target[prop] = source[prop];
|
|
1831
|
-
if (source != null && __getOwnPropSymbols$4)
|
|
1832
|
-
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1833
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1834
|
-
target[prop] = source[prop];
|
|
1835
|
-
}
|
|
1836
|
-
return target;
|
|
1837
|
-
};
|
|
1838
1622
|
function useMutationObserver(target, callback, options = {}) {
|
|
1839
|
-
const
|
|
1623
|
+
const { window = defaultWindow, ...mutationOptions } = options;
|
|
1840
1624
|
let observer;
|
|
1841
1625
|
const isSupported = useSupported(() => window && "MutationObserver" in window);
|
|
1842
1626
|
const cleanup = () => {
|
|
@@ -1870,16 +1654,12 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1870
1654
|
function useCssVar(prop, target, options = {}) {
|
|
1871
1655
|
const { window = defaultWindow, initialValue = "", observe = false } = options;
|
|
1872
1656
|
const variable = ref(initialValue);
|
|
1873
|
-
const elRef = computed(() =>
|
|
1874
|
-
var _a;
|
|
1875
|
-
return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
|
|
1876
|
-
});
|
|
1657
|
+
const elRef = computed(() => unrefElement(target) || window?.document?.documentElement);
|
|
1877
1658
|
function updateCssVar() {
|
|
1878
|
-
var _a;
|
|
1879
1659
|
const key = toValue(prop);
|
|
1880
1660
|
const el = toValue(elRef);
|
|
1881
1661
|
if (el && window) {
|
|
1882
|
-
const value =
|
|
1662
|
+
const value = window.getComputedStyle(el).getPropertyValue(key)?.trim();
|
|
1883
1663
|
variable.value = value || initialValue;
|
|
1884
1664
|
}
|
|
1885
1665
|
}
|
|
@@ -1897,8 +1677,7 @@ function useCssVar(prop, target, options = {}) {
|
|
|
1897
1677
|
watch(
|
|
1898
1678
|
variable,
|
|
1899
1679
|
(val) => {
|
|
1900
|
-
|
|
1901
|
-
if ((_a = elRef.value) == null ? void 0 : _a.style)
|
|
1680
|
+
if (elRef.value?.style)
|
|
1902
1681
|
elRef.value.style.setProperty(toValue(prop), val);
|
|
1903
1682
|
}
|
|
1904
1683
|
);
|
|
@@ -1978,25 +1757,6 @@ const UseScreenSafeArea = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1978
1757
|
}
|
|
1979
1758
|
});
|
|
1980
1759
|
|
|
1981
|
-
var __defProp$3 = Object.defineProperty;
|
|
1982
|
-
var __defProps$2 = Object.defineProperties;
|
|
1983
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
1984
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1985
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1986
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1987
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1988
|
-
var __spreadValues$3 = (a, b) => {
|
|
1989
|
-
for (var prop in b || (b = {}))
|
|
1990
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
1991
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
1992
|
-
if (__getOwnPropSymbols$3)
|
|
1993
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1994
|
-
if (__propIsEnum$3.call(b, prop))
|
|
1995
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
1996
|
-
}
|
|
1997
|
-
return a;
|
|
1998
|
-
};
|
|
1999
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
2000
1760
|
const vScroll = {
|
|
2001
1761
|
[directiveHooks.mounted](el, binding) {
|
|
2002
1762
|
if (typeof binding.value === "function") {
|
|
@@ -2011,18 +1771,17 @@ const vScroll = {
|
|
|
2011
1771
|
});
|
|
2012
1772
|
} else {
|
|
2013
1773
|
const [handler, options] = binding.value;
|
|
2014
|
-
const state = useScroll(el,
|
|
1774
|
+
const state = useScroll(el, {
|
|
1775
|
+
...options,
|
|
2015
1776
|
onScroll(e) {
|
|
2016
|
-
|
|
2017
|
-
(_a = options.onScroll) == null ? void 0 : _a.call(options, e);
|
|
1777
|
+
options.onScroll?.(e);
|
|
2018
1778
|
handler(state);
|
|
2019
1779
|
},
|
|
2020
1780
|
onStop(e) {
|
|
2021
|
-
|
|
2022
|
-
(_a = options.onStop) == null ? void 0 : _a.call(options, e);
|
|
1781
|
+
options.onStop?.(e);
|
|
2023
1782
|
handler(state);
|
|
2024
1783
|
}
|
|
2025
|
-
})
|
|
1784
|
+
});
|
|
2026
1785
|
}
|
|
2027
1786
|
}
|
|
2028
1787
|
};
|
|
@@ -2054,8 +1813,9 @@ function useScrollLock(element, initialState = false) {
|
|
|
2054
1813
|
let stopTouchMoveListener = null;
|
|
2055
1814
|
let initialOverflow;
|
|
2056
1815
|
watch(toRef(element), (el) => {
|
|
2057
|
-
|
|
2058
|
-
|
|
1816
|
+
const target = resolveElement(toValue(el));
|
|
1817
|
+
if (target) {
|
|
1818
|
+
const ele = target;
|
|
2059
1819
|
initialOverflow = ele.style.overflow;
|
|
2060
1820
|
if (isLocked.value)
|
|
2061
1821
|
ele.style.overflow = "hidden";
|
|
@@ -2064,12 +1824,12 @@ function useScrollLock(element, initialState = false) {
|
|
|
2064
1824
|
immediate: true
|
|
2065
1825
|
});
|
|
2066
1826
|
const lock = () => {
|
|
2067
|
-
const
|
|
2068
|
-
if (!
|
|
1827
|
+
const el = resolveElement(toValue(element));
|
|
1828
|
+
if (!el || isLocked.value)
|
|
2069
1829
|
return;
|
|
2070
1830
|
if (isIOS) {
|
|
2071
1831
|
stopTouchMoveListener = useEventListener(
|
|
2072
|
-
|
|
1832
|
+
el,
|
|
2073
1833
|
"touchmove",
|
|
2074
1834
|
(e) => {
|
|
2075
1835
|
preventDefault(e);
|
|
@@ -2077,15 +1837,15 @@ function useScrollLock(element, initialState = false) {
|
|
|
2077
1837
|
{ passive: false }
|
|
2078
1838
|
);
|
|
2079
1839
|
}
|
|
2080
|
-
|
|
1840
|
+
el.style.overflow = "hidden";
|
|
2081
1841
|
isLocked.value = true;
|
|
2082
1842
|
};
|
|
2083
1843
|
const unlock = () => {
|
|
2084
|
-
const
|
|
2085
|
-
if (!
|
|
1844
|
+
const el = resolveElement(toValue(element));
|
|
1845
|
+
if (!el || !isLocked.value)
|
|
2086
1846
|
return;
|
|
2087
|
-
isIOS &&
|
|
2088
|
-
|
|
1847
|
+
isIOS && stopTouchMoveListener?.();
|
|
1848
|
+
el.style.overflow = initialOverflow;
|
|
2089
1849
|
isLocked.value = false;
|
|
2090
1850
|
};
|
|
2091
1851
|
tryOnScopeDispose(unlock);
|
|
@@ -2116,30 +1876,11 @@ function onScrollLock() {
|
|
|
2116
1876
|
}
|
|
2117
1877
|
const vScrollLock = onScrollLock();
|
|
2118
1878
|
|
|
2119
|
-
var __defProp$2 = Object.defineProperty;
|
|
2120
|
-
var __defProps$1 = Object.defineProperties;
|
|
2121
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
2122
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
2123
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
2124
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
2125
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2126
|
-
var __spreadValues$2 = (a, b) => {
|
|
2127
|
-
for (var prop in b || (b = {}))
|
|
2128
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
2129
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
2130
|
-
if (__getOwnPropSymbols$2)
|
|
2131
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
2132
|
-
if (__propIsEnum$2.call(b, prop))
|
|
2133
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
2134
|
-
}
|
|
2135
|
-
return a;
|
|
2136
|
-
};
|
|
2137
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
2138
1879
|
const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
2139
1880
|
name: "UseTimeAgo",
|
|
2140
1881
|
props: ["time", "updateInterval", "max", "fullDateFormatter", "messages", "showSecond"],
|
|
2141
1882
|
setup(props, { slots }) {
|
|
2142
|
-
const data = reactive(useTimeAgo(() => props.time,
|
|
1883
|
+
const data = reactive(useTimeAgo(() => props.time, { ...props, controls: true }));
|
|
2143
1884
|
return () => {
|
|
2144
1885
|
if (slots.default)
|
|
2145
1886
|
return slots.default(data);
|
|
@@ -2147,30 +1888,11 @@ const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
2147
1888
|
}
|
|
2148
1889
|
});
|
|
2149
1890
|
|
|
2150
|
-
var __defProp$1 = Object.defineProperty;
|
|
2151
|
-
var __defProps = Object.defineProperties;
|
|
2152
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2153
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
2154
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
2155
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
2156
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2157
|
-
var __spreadValues$1 = (a, b) => {
|
|
2158
|
-
for (var prop in b || (b = {}))
|
|
2159
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
2160
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
2161
|
-
if (__getOwnPropSymbols$1)
|
|
2162
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
2163
|
-
if (__propIsEnum$1.call(b, prop))
|
|
2164
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
2165
|
-
}
|
|
2166
|
-
return a;
|
|
2167
|
-
};
|
|
2168
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2169
1891
|
const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
2170
1892
|
name: "UseTimestamp",
|
|
2171
1893
|
props: ["immediate", "interval", "offset"],
|
|
2172
1894
|
setup(props, { slots }) {
|
|
2173
|
-
const data = reactive(useTimestamp(
|
|
1895
|
+
const data = reactive(useTimestamp({ ...props, controls: true }));
|
|
2174
1896
|
return () => {
|
|
2175
1897
|
if (slots.default)
|
|
2176
1898
|
return slots.default(data);
|
|
@@ -2178,22 +1900,6 @@ const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
2178
1900
|
}
|
|
2179
1901
|
});
|
|
2180
1902
|
|
|
2181
|
-
var __defProp = Object.defineProperty;
|
|
2182
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2183
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2184
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2185
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2186
|
-
var __spreadValues = (a, b) => {
|
|
2187
|
-
for (var prop in b || (b = {}))
|
|
2188
|
-
if (__hasOwnProp.call(b, prop))
|
|
2189
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2190
|
-
if (__getOwnPropSymbols)
|
|
2191
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
2192
|
-
if (__propIsEnum.call(b, prop))
|
|
2193
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2194
|
-
}
|
|
2195
|
-
return a;
|
|
2196
|
-
};
|
|
2197
1903
|
const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
2198
1904
|
name: "UseVirtualList",
|
|
2199
1905
|
props: [
|
|
@@ -2208,11 +1914,11 @@ const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
2208
1914
|
typeof containerProps.style === "object" && !Array.isArray(containerProps.style) && (containerProps.style.height = props.height || "300px");
|
|
2209
1915
|
return () => h(
|
|
2210
1916
|
"div",
|
|
2211
|
-
|
|
1917
|
+
{ ...containerProps },
|
|
2212
1918
|
[
|
|
2213
1919
|
h(
|
|
2214
1920
|
"div",
|
|
2215
|
-
|
|
1921
|
+
{ ...wrapperProps.value },
|
|
2216
1922
|
list.value.map((item) => h(
|
|
2217
1923
|
"div",
|
|
2218
1924
|
{ style: { overFlow: "hidden", height: item.height } },
|