@vueuse/components 10.3.0 → 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 +99 -413
- package/index.d.cts +1 -1
- package/index.d.mts +1 -1
- package/index.d.ts +1 -1
- package/index.iife.js +99 -413
- package/index.iife.min.js +1 -1
- package/index.mjs +99 -413
- package/package.json +5 -5
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;
|
|
@@ -116,9 +115,8 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
116
115
|
}, { passive: true }),
|
|
117
116
|
detectIframe && useEventListener(window, "blur", (event) => {
|
|
118
117
|
setTimeout(() => {
|
|
119
|
-
var _a;
|
|
120
118
|
const el = unrefElement(target);
|
|
121
|
-
if (
|
|
119
|
+
if (window.document.activeElement?.tagName === "IFRAME" && !el?.contains(window.document.activeElement))
|
|
122
120
|
handler(event);
|
|
123
121
|
}, 0);
|
|
124
122
|
})
|
|
@@ -188,42 +186,25 @@ function onKeyStroke(...args) {
|
|
|
188
186
|
return useEventListener(target, eventName, listener, passive);
|
|
189
187
|
}
|
|
190
188
|
|
|
191
|
-
var __defProp$e = Object.defineProperty;
|
|
192
|
-
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
|
|
193
|
-
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
|
|
194
|
-
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
|
|
195
|
-
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
196
|
-
var __spreadValues$e = (a, b) => {
|
|
197
|
-
for (var prop in b || (b = {}))
|
|
198
|
-
if (__hasOwnProp$g.call(b, prop))
|
|
199
|
-
__defNormalProp$e(a, prop, b[prop]);
|
|
200
|
-
if (__getOwnPropSymbols$g)
|
|
201
|
-
for (var prop of __getOwnPropSymbols$g(b)) {
|
|
202
|
-
if (__propIsEnum$g.call(b, prop))
|
|
203
|
-
__defNormalProp$e(a, prop, b[prop]);
|
|
204
|
-
}
|
|
205
|
-
return a;
|
|
206
|
-
};
|
|
207
189
|
const vOnKeyStroke = {
|
|
208
190
|
[directiveHooks.mounted](el, binding) {
|
|
209
|
-
|
|
210
|
-
const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
|
|
191
|
+
const keys = binding.arg?.split(",") ?? true;
|
|
211
192
|
if (typeof binding.value === "function") {
|
|
212
193
|
onKeyStroke(keys, binding.value, {
|
|
213
194
|
target: el
|
|
214
195
|
});
|
|
215
196
|
} else {
|
|
216
197
|
const [handler, options] = binding.value;
|
|
217
|
-
onKeyStroke(keys, handler,
|
|
218
|
-
target: el
|
|
219
|
-
|
|
198
|
+
onKeyStroke(keys, handler, {
|
|
199
|
+
target: el,
|
|
200
|
+
...options
|
|
201
|
+
});
|
|
220
202
|
}
|
|
221
203
|
}
|
|
222
204
|
};
|
|
223
205
|
|
|
224
206
|
const DEFAULT_DELAY = 500;
|
|
225
207
|
function onLongPress(target, handler, options) {
|
|
226
|
-
var _a, _b;
|
|
227
208
|
const elementRef = computed(() => unrefElement(target));
|
|
228
209
|
let timeout;
|
|
229
210
|
function clear() {
|
|
@@ -233,22 +214,21 @@ function onLongPress(target, handler, options) {
|
|
|
233
214
|
}
|
|
234
215
|
}
|
|
235
216
|
function onDown(ev) {
|
|
236
|
-
|
|
237
|
-
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)
|
|
238
218
|
return;
|
|
239
219
|
clear();
|
|
240
|
-
if (
|
|
220
|
+
if (options?.modifiers?.prevent)
|
|
241
221
|
ev.preventDefault();
|
|
242
|
-
if (
|
|
222
|
+
if (options?.modifiers?.stop)
|
|
243
223
|
ev.stopPropagation();
|
|
244
224
|
timeout = setTimeout(
|
|
245
225
|
() => handler(ev),
|
|
246
|
-
|
|
226
|
+
options?.delay ?? DEFAULT_DELAY
|
|
247
227
|
);
|
|
248
228
|
}
|
|
249
229
|
const listenerOptions = {
|
|
250
|
-
capture:
|
|
251
|
-
once:
|
|
230
|
+
capture: options?.modifiers?.capture,
|
|
231
|
+
once: options?.modifiers?.once
|
|
252
232
|
};
|
|
253
233
|
useEventListener(elementRef, "pointerdown", onDown, listenerOptions);
|
|
254
234
|
useEventListener(elementRef, ["pointerup", "pointerleave"], clear, listenerOptions);
|
|
@@ -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 {
|
|
@@ -554,22 +515,6 @@ function usePreferredDark(options) {
|
|
|
554
515
|
return useMediaQuery("(prefers-color-scheme: dark)", options);
|
|
555
516
|
}
|
|
556
517
|
|
|
557
|
-
var __defProp$c = Object.defineProperty;
|
|
558
|
-
var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
|
|
559
|
-
var __hasOwnProp$e = Object.prototype.hasOwnProperty;
|
|
560
|
-
var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
|
|
561
|
-
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
562
|
-
var __spreadValues$c = (a, b) => {
|
|
563
|
-
for (var prop in b || (b = {}))
|
|
564
|
-
if (__hasOwnProp$e.call(b, prop))
|
|
565
|
-
__defNormalProp$c(a, prop, b[prop]);
|
|
566
|
-
if (__getOwnPropSymbols$e)
|
|
567
|
-
for (var prop of __getOwnPropSymbols$e(b)) {
|
|
568
|
-
if (__propIsEnum$e.call(b, prop))
|
|
569
|
-
__defNormalProp$c(a, prop, b[prop]);
|
|
570
|
-
}
|
|
571
|
-
return a;
|
|
572
|
-
};
|
|
573
518
|
function useColorMode(options = {}) {
|
|
574
519
|
const {
|
|
575
520
|
selector = "html",
|
|
@@ -583,11 +528,12 @@ function useColorMode(options = {}) {
|
|
|
583
528
|
emitAuto,
|
|
584
529
|
disableTransition = true
|
|
585
530
|
} = options;
|
|
586
|
-
const modes =
|
|
531
|
+
const modes = {
|
|
587
532
|
auto: "",
|
|
588
533
|
light: "light",
|
|
589
|
-
dark: "dark"
|
|
590
|
-
|
|
534
|
+
dark: "dark",
|
|
535
|
+
...options.modes || {}
|
|
536
|
+
};
|
|
591
537
|
const preferredDark = usePreferredDark({ window });
|
|
592
538
|
const system = computed(() => preferredDark.value ? "dark" : "light");
|
|
593
539
|
const store = storageRef || (storageKey == null ? toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));
|
|
@@ -597,7 +543,7 @@ function useColorMode(options = {}) {
|
|
|
597
543
|
const updateHTMLAttrs = getSSRHandler(
|
|
598
544
|
"updateHTMLAttrs",
|
|
599
545
|
(selector2, attribute2, value) => {
|
|
600
|
-
const el = typeof selector2 === "string" ? window
|
|
546
|
+
const el = typeof selector2 === "string" ? window?.document.querySelector(selector2) : unrefElement(selector2);
|
|
601
547
|
if (!el)
|
|
602
548
|
return;
|
|
603
549
|
let style;
|
|
@@ -625,8 +571,7 @@ function useColorMode(options = {}) {
|
|
|
625
571
|
}
|
|
626
572
|
);
|
|
627
573
|
function defaultOnChanged(mode) {
|
|
628
|
-
|
|
629
|
-
updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);
|
|
574
|
+
updateHTMLAttrs(selector, attribute, modes[mode] ?? mode);
|
|
630
575
|
}
|
|
631
576
|
function onChanged(mode) {
|
|
632
577
|
if (options.onChanged)
|
|
@@ -744,25 +689,6 @@ const UseDocumentVisibility = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
744
689
|
}
|
|
745
690
|
});
|
|
746
691
|
|
|
747
|
-
var __defProp$b = Object.defineProperty;
|
|
748
|
-
var __defProps$9 = Object.defineProperties;
|
|
749
|
-
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
750
|
-
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
751
|
-
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
752
|
-
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
753
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
754
|
-
var __spreadValues$b = (a, b) => {
|
|
755
|
-
for (var prop in b || (b = {}))
|
|
756
|
-
if (__hasOwnProp$d.call(b, prop))
|
|
757
|
-
__defNormalProp$b(a, prop, b[prop]);
|
|
758
|
-
if (__getOwnPropSymbols$d)
|
|
759
|
-
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
760
|
-
if (__propIsEnum$d.call(b, prop))
|
|
761
|
-
__defNormalProp$b(a, prop, b[prop]);
|
|
762
|
-
}
|
|
763
|
-
return a;
|
|
764
|
-
};
|
|
765
|
-
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
766
692
|
const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
767
693
|
name: "UseDraggable",
|
|
768
694
|
props: [
|
|
@@ -782,10 +708,7 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
782
708
|
],
|
|
783
709
|
setup(props, { slots }) {
|
|
784
710
|
const target = ref();
|
|
785
|
-
const handle = computed(() =>
|
|
786
|
-
var _a;
|
|
787
|
-
return (_a = props.handle) != null ? _a : target.value;
|
|
788
|
-
});
|
|
711
|
+
const handle = computed(() => props.handle ?? target.value);
|
|
789
712
|
const storageValue = props.storageKey && useStorage$1(
|
|
790
713
|
props.storageKey,
|
|
791
714
|
toValue(props.initialValue) || { x: 0, y: 0 },
|
|
@@ -793,18 +716,18 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
793
716
|
);
|
|
794
717
|
const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
|
|
795
718
|
const onEnd = (position, event) => {
|
|
796
|
-
|
|
797
|
-
(_a = props.onEnd) == null ? void 0 : _a.call(props, position, event);
|
|
719
|
+
props.onEnd?.(position, event);
|
|
798
720
|
if (!storageValue)
|
|
799
721
|
return;
|
|
800
722
|
storageValue.value.x = position.x;
|
|
801
723
|
storageValue.value.y = position.y;
|
|
802
724
|
};
|
|
803
|
-
const data = reactive(useDraggable(target,
|
|
725
|
+
const data = reactive(useDraggable(target, {
|
|
726
|
+
...props,
|
|
804
727
|
handle,
|
|
805
728
|
initialValue,
|
|
806
729
|
onEnd
|
|
807
|
-
}))
|
|
730
|
+
}));
|
|
808
731
|
return () => {
|
|
809
732
|
if (slots.default)
|
|
810
733
|
return h(props.as || "div", { ref: target, style: `touch-action:none;${data.style}` }, slots.default(data));
|
|
@@ -862,7 +785,7 @@ const vElementHover = {
|
|
|
862
785
|
|
|
863
786
|
const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
864
787
|
name: "UseElementSize",
|
|
865
|
-
props: ["width", "height", "box"],
|
|
788
|
+
props: ["width", "height", "box", "as"],
|
|
866
789
|
setup(props, { slots }) {
|
|
867
790
|
const target = ref();
|
|
868
791
|
const data = reactive(useElementSize$1(target, { width: props.width, height: props.height }, { box: props.box }));
|
|
@@ -873,23 +796,8 @@ const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
873
796
|
}
|
|
874
797
|
});
|
|
875
798
|
|
|
876
|
-
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
877
|
-
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
878
|
-
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
879
|
-
var __objRest$1 = (source, exclude) => {
|
|
880
|
-
var target = {};
|
|
881
|
-
for (var prop in source)
|
|
882
|
-
if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
883
|
-
target[prop] = source[prop];
|
|
884
|
-
if (source != null && __getOwnPropSymbols$c)
|
|
885
|
-
for (var prop of __getOwnPropSymbols$c(source)) {
|
|
886
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
|
|
887
|
-
target[prop] = source[prop];
|
|
888
|
-
}
|
|
889
|
-
return target;
|
|
890
|
-
};
|
|
891
799
|
function useResizeObserver(target, callback, options = {}) {
|
|
892
|
-
const
|
|
800
|
+
const { window = defaultWindow, ...observerOptions } = options;
|
|
893
801
|
let observer;
|
|
894
802
|
const isSupported = useSupported(() => window && "ResizeObserver" in window);
|
|
895
803
|
const cleanup = () => {
|
|
@@ -926,10 +834,7 @@ function useResizeObserver(target, callback, options = {}) {
|
|
|
926
834
|
|
|
927
835
|
function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
|
|
928
836
|
const { window = defaultWindow, box = "content-box" } = options;
|
|
929
|
-
const isSVG = computed(() =>
|
|
930
|
-
var _a, _b;
|
|
931
|
-
return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
|
|
932
|
-
});
|
|
837
|
+
const isSVG = computed(() => unrefElement(target)?.namespaceURI?.includes("svg"));
|
|
933
838
|
const width = ref(initialSize.width);
|
|
934
839
|
const height = ref(initialSize.height);
|
|
935
840
|
useResizeObserver(
|
|
@@ -971,8 +876,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
971
876
|
|
|
972
877
|
const vElementSize = {
|
|
973
878
|
[directiveHooks.mounted](el, binding) {
|
|
974
|
-
|
|
975
|
-
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];
|
|
976
880
|
const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
|
|
977
881
|
const { width, height } = useElementSize(el, ...options);
|
|
978
882
|
watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
|
|
@@ -1062,7 +966,8 @@ function useElementVisibility(element, { window = defaultWindow, scrollTarget }
|
|
|
1062
966
|
},
|
|
1063
967
|
{
|
|
1064
968
|
root: scrollTarget,
|
|
1065
|
-
window
|
|
969
|
+
window,
|
|
970
|
+
threshold: 0
|
|
1066
971
|
}
|
|
1067
972
|
);
|
|
1068
973
|
return elementIsVisible;
|
|
@@ -1133,25 +1038,6 @@ const UseIdle = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1133
1038
|
}
|
|
1134
1039
|
});
|
|
1135
1040
|
|
|
1136
|
-
var __defProp$a = Object.defineProperty;
|
|
1137
|
-
var __defProps$8 = Object.defineProperties;
|
|
1138
|
-
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
1139
|
-
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
1140
|
-
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
1141
|
-
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
1142
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1143
|
-
var __spreadValues$a = (a, b) => {
|
|
1144
|
-
for (var prop in b || (b = {}))
|
|
1145
|
-
if (__hasOwnProp$b.call(b, prop))
|
|
1146
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
1147
|
-
if (__getOwnPropSymbols$b)
|
|
1148
|
-
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
1149
|
-
if (__propIsEnum$b.call(b, prop))
|
|
1150
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
1151
|
-
}
|
|
1152
|
-
return a;
|
|
1153
|
-
};
|
|
1154
|
-
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
1155
1041
|
function useAsyncState(promise, initialState, options) {
|
|
1156
1042
|
const {
|
|
1157
1043
|
immediate = true,
|
|
@@ -1161,7 +1047,7 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1161
1047
|
resetOnExecute = true,
|
|
1162
1048
|
shallow = true,
|
|
1163
1049
|
throwError
|
|
1164
|
-
} = options
|
|
1050
|
+
} = options ?? {};
|
|
1165
1051
|
const state = shallow ? shallowRef(initialState) : ref(initialState);
|
|
1166
1052
|
const isReady = ref(false);
|
|
1167
1053
|
const isLoading = ref(false);
|
|
@@ -1204,29 +1090,14 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1204
1090
|
until(isLoading).toBe(false).then(() => resolve(shell)).catch(reject);
|
|
1205
1091
|
});
|
|
1206
1092
|
}
|
|
1207
|
-
return
|
|
1093
|
+
return {
|
|
1094
|
+
...shell,
|
|
1208
1095
|
then(onFulfilled, onRejected) {
|
|
1209
1096
|
return waitUntilIsLoaded().then(onFulfilled, onRejected);
|
|
1210
1097
|
}
|
|
1211
|
-
}
|
|
1098
|
+
};
|
|
1212
1099
|
}
|
|
1213
1100
|
|
|
1214
|
-
var __defProp$9 = Object.defineProperty;
|
|
1215
|
-
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
1216
|
-
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
1217
|
-
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
1218
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1219
|
-
var __spreadValues$9 = (a, b) => {
|
|
1220
|
-
for (var prop in b || (b = {}))
|
|
1221
|
-
if (__hasOwnProp$a.call(b, prop))
|
|
1222
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
1223
|
-
if (__getOwnPropSymbols$a)
|
|
1224
|
-
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
1225
|
-
if (__propIsEnum$a.call(b, prop))
|
|
1226
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
1227
|
-
}
|
|
1228
|
-
return a;
|
|
1229
|
-
};
|
|
1230
1101
|
async function loadImage(options) {
|
|
1231
1102
|
return new Promise((resolve, reject) => {
|
|
1232
1103
|
const img = new Image();
|
|
@@ -1252,9 +1123,10 @@ function useImage(options, asyncStateOptions = {}) {
|
|
|
1252
1123
|
const state = useAsyncState(
|
|
1253
1124
|
() => loadImage(toValue(options)),
|
|
1254
1125
|
void 0,
|
|
1255
|
-
|
|
1256
|
-
resetOnExecute: true
|
|
1257
|
-
|
|
1126
|
+
{
|
|
1127
|
+
resetOnExecute: true,
|
|
1128
|
+
...asyncStateOptions
|
|
1129
|
+
}
|
|
1258
1130
|
);
|
|
1259
1131
|
watch(
|
|
1260
1132
|
() => toValue(options),
|
|
@@ -1330,15 +1202,14 @@ function useScroll(element, options = {}) {
|
|
|
1330
1202
|
}
|
|
1331
1203
|
});
|
|
1332
1204
|
function scrollTo(_x, _y) {
|
|
1333
|
-
var _a, _b, _c;
|
|
1334
1205
|
if (!window)
|
|
1335
1206
|
return;
|
|
1336
1207
|
const _element = toValue(element);
|
|
1337
1208
|
if (!_element)
|
|
1338
1209
|
return;
|
|
1339
|
-
(
|
|
1340
|
-
top:
|
|
1341
|
-
left:
|
|
1210
|
+
(_element instanceof Document ? window.document.body : _element)?.scrollTo({
|
|
1211
|
+
top: toValue(_y) ?? y.value,
|
|
1212
|
+
left: toValue(_x) ?? x.value,
|
|
1342
1213
|
behavior: toValue(behavior)
|
|
1343
1214
|
});
|
|
1344
1215
|
}
|
|
@@ -1369,7 +1240,7 @@ function useScroll(element, options = {}) {
|
|
|
1369
1240
|
const setArrivedState = (target) => {
|
|
1370
1241
|
if (!window)
|
|
1371
1242
|
return;
|
|
1372
|
-
const el = target
|
|
1243
|
+
const el = target.document ? target.document.documentElement : target.documentElement ?? target;
|
|
1373
1244
|
const { display, flexDirection } = getComputedStyle(el);
|
|
1374
1245
|
const scrollLeft = el.scrollLeft;
|
|
1375
1246
|
directions.left = scrollLeft < internalX.value;
|
|
@@ -1403,7 +1274,7 @@ function useScroll(element, options = {}) {
|
|
|
1403
1274
|
const onScrollHandler = (e) => {
|
|
1404
1275
|
if (!window)
|
|
1405
1276
|
return;
|
|
1406
|
-
const eventTarget = e.target
|
|
1277
|
+
const eventTarget = e.target.documentElement ?? e.target;
|
|
1407
1278
|
setArrivedState(eventTarget);
|
|
1408
1279
|
isScrolling.value = true;
|
|
1409
1280
|
onScrollEndDebounced(e);
|
|
@@ -1435,48 +1306,33 @@ function useScroll(element, options = {}) {
|
|
|
1435
1306
|
};
|
|
1436
1307
|
}
|
|
1437
1308
|
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
for (var prop in b || (b = {}))
|
|
1447
|
-
if (__hasOwnProp$9.call(b, prop))
|
|
1448
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
1449
|
-
if (__getOwnPropSymbols$9)
|
|
1450
|
-
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
1451
|
-
if (__propIsEnum$9.call(b, prop))
|
|
1452
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
1453
|
-
}
|
|
1454
|
-
return a;
|
|
1455
|
-
};
|
|
1456
|
-
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
|
+
|
|
1457
1317
|
function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
1458
|
-
var _a;
|
|
1459
1318
|
const {
|
|
1460
1319
|
direction = "bottom",
|
|
1461
1320
|
interval = 100
|
|
1462
1321
|
} = options;
|
|
1463
1322
|
const state = reactive(useScroll(
|
|
1464
1323
|
element,
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1324
|
+
{
|
|
1325
|
+
...options,
|
|
1326
|
+
offset: {
|
|
1327
|
+
[direction]: options.distance ?? 0,
|
|
1328
|
+
...options.offset
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1470
1331
|
));
|
|
1471
1332
|
const promise = ref();
|
|
1472
1333
|
const isLoading = computed(() => !!promise.value);
|
|
1473
1334
|
const observedElement = computed(() => {
|
|
1474
|
-
|
|
1475
|
-
if (el instanceof Window)
|
|
1476
|
-
return window.document.documentElement;
|
|
1477
|
-
if (el instanceof Document)
|
|
1478
|
-
return document.documentElement;
|
|
1479
|
-
return el;
|
|
1335
|
+
return resolveElement(toValue(element));
|
|
1480
1336
|
});
|
|
1481
1337
|
const isElementVisible = useElementVisibility(observedElement);
|
|
1482
1338
|
function checkAndLoad() {
|
|
@@ -1550,31 +1406,12 @@ const UseMouseInElement = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1550
1406
|
}
|
|
1551
1407
|
});
|
|
1552
1408
|
|
|
1553
|
-
var __defProp$7 = Object.defineProperty;
|
|
1554
|
-
var __defProps$6 = Object.defineProperties;
|
|
1555
|
-
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
1556
|
-
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
1557
|
-
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
1558
|
-
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
1559
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1560
|
-
var __spreadValues$7 = (a, b) => {
|
|
1561
|
-
for (var prop in b || (b = {}))
|
|
1562
|
-
if (__hasOwnProp$8.call(b, prop))
|
|
1563
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
1564
|
-
if (__getOwnPropSymbols$8)
|
|
1565
|
-
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
1566
|
-
if (__propIsEnum$8.call(b, prop))
|
|
1567
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
1568
|
-
}
|
|
1569
|
-
return a;
|
|
1570
|
-
};
|
|
1571
|
-
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
1572
1409
|
const UseMousePressed = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1573
1410
|
name: "UseMousePressed",
|
|
1574
1411
|
props: ["touch", "initialValue", "as"],
|
|
1575
1412
|
setup(props, { slots }) {
|
|
1576
1413
|
const target = ref();
|
|
1577
|
-
const data = reactive(useMousePressed(
|
|
1414
|
+
const data = reactive(useMousePressed({ ...props, target }));
|
|
1578
1415
|
return () => {
|
|
1579
1416
|
if (slots.default)
|
|
1580
1417
|
return h(props.as || "div", { ref: target }, slots.default(data));
|
|
@@ -1593,30 +1430,11 @@ const UseNetwork = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1593
1430
|
}
|
|
1594
1431
|
});
|
|
1595
1432
|
|
|
1596
|
-
var __defProp$6 = Object.defineProperty;
|
|
1597
|
-
var __defProps$5 = Object.defineProperties;
|
|
1598
|
-
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
1599
|
-
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
1600
|
-
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
1601
|
-
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
1602
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1603
|
-
var __spreadValues$6 = (a, b) => {
|
|
1604
|
-
for (var prop in b || (b = {}))
|
|
1605
|
-
if (__hasOwnProp$7.call(b, prop))
|
|
1606
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1607
|
-
if (__getOwnPropSymbols$7)
|
|
1608
|
-
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
1609
|
-
if (__propIsEnum$7.call(b, prop))
|
|
1610
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1611
|
-
}
|
|
1612
|
-
return a;
|
|
1613
|
-
};
|
|
1614
|
-
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
1615
1433
|
const UseNow = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1616
1434
|
name: "UseNow",
|
|
1617
1435
|
props: ["interval"],
|
|
1618
1436
|
setup(props, { slots }) {
|
|
1619
|
-
const data = reactive(useNow(
|
|
1437
|
+
const data = reactive(useNow({ ...props, controls: true }));
|
|
1620
1438
|
return () => {
|
|
1621
1439
|
if (slots.default)
|
|
1622
1440
|
return slots.default(data);
|
|
@@ -1639,25 +1457,6 @@ const UseObjectUrl = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1639
1457
|
}
|
|
1640
1458
|
});
|
|
1641
1459
|
|
|
1642
|
-
var __defProp$5 = Object.defineProperty;
|
|
1643
|
-
var __defProps$4 = Object.defineProperties;
|
|
1644
|
-
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1645
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1646
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1647
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1648
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1649
|
-
var __spreadValues$5 = (a, b) => {
|
|
1650
|
-
for (var prop in b || (b = {}))
|
|
1651
|
-
if (__hasOwnProp$6.call(b, prop))
|
|
1652
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1653
|
-
if (__getOwnPropSymbols$6)
|
|
1654
|
-
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1655
|
-
if (__propIsEnum$6.call(b, prop))
|
|
1656
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1657
|
-
}
|
|
1658
|
-
return a;
|
|
1659
|
-
};
|
|
1660
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1661
1460
|
const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1662
1461
|
name: "UseOffsetPagination",
|
|
1663
1462
|
props: [
|
|
@@ -1674,23 +1473,21 @@ const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1674
1473
|
"page-count-change"
|
|
1675
1474
|
],
|
|
1676
1475
|
setup(props, { slots, emit }) {
|
|
1677
|
-
const data = reactive(useOffsetPagination(
|
|
1476
|
+
const data = reactive(useOffsetPagination({
|
|
1477
|
+
...props,
|
|
1678
1478
|
onPageChange(...args) {
|
|
1679
|
-
|
|
1680
|
-
(_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
|
|
1479
|
+
props.onPageChange?.(...args);
|
|
1681
1480
|
emit("page-change", ...args);
|
|
1682
1481
|
},
|
|
1683
1482
|
onPageSizeChange(...args) {
|
|
1684
|
-
|
|
1685
|
-
(_a = props.onPageSizeChange) == null ? void 0 : _a.call(props, ...args);
|
|
1483
|
+
props.onPageSizeChange?.(...args);
|
|
1686
1484
|
emit("page-size-change", ...args);
|
|
1687
1485
|
},
|
|
1688
1486
|
onPageCountChange(...args) {
|
|
1689
|
-
|
|
1690
|
-
(_a = props.onPageCountChange) == null ? void 0 : _a.call(props, ...args);
|
|
1487
|
+
props.onPageCountChange?.(...args);
|
|
1691
1488
|
emit("page-count-change", ...args);
|
|
1692
1489
|
}
|
|
1693
|
-
}))
|
|
1490
|
+
}));
|
|
1694
1491
|
return () => {
|
|
1695
1492
|
if (slots.default)
|
|
1696
1493
|
return slots.default(data);
|
|
@@ -1724,25 +1521,6 @@ const UsePageLeave = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1724
1521
|
}
|
|
1725
1522
|
});
|
|
1726
1523
|
|
|
1727
|
-
var __defProp$4 = Object.defineProperty;
|
|
1728
|
-
var __defProps$3 = Object.defineProperties;
|
|
1729
|
-
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1730
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1731
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1732
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1733
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1734
|
-
var __spreadValues$4 = (a, b) => {
|
|
1735
|
-
for (var prop in b || (b = {}))
|
|
1736
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
1737
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1738
|
-
if (__getOwnPropSymbols$5)
|
|
1739
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
1740
|
-
if (__propIsEnum$5.call(b, prop))
|
|
1741
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1742
|
-
}
|
|
1743
|
-
return a;
|
|
1744
|
-
};
|
|
1745
|
-
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1746
1524
|
const UsePointer = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1747
1525
|
name: "UsePointer",
|
|
1748
1526
|
props: [
|
|
@@ -1752,9 +1530,10 @@ const UsePointer = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1752
1530
|
],
|
|
1753
1531
|
setup(props, { slots }) {
|
|
1754
1532
|
const el = ref(null);
|
|
1755
|
-
const data = reactive(usePointer(
|
|
1533
|
+
const data = reactive(usePointer({
|
|
1534
|
+
...props,
|
|
1756
1535
|
target: props.target === "self" ? el : defaultWindow
|
|
1757
|
-
}))
|
|
1536
|
+
}));
|
|
1758
1537
|
return () => {
|
|
1759
1538
|
if (slots.default)
|
|
1760
1539
|
return slots.default(data, { ref: el });
|
|
@@ -1840,23 +1619,8 @@ const UsePreferredReducedMotion = /* @__PURE__ */ /* #__PURE__ */ defineComponen
|
|
|
1840
1619
|
}
|
|
1841
1620
|
});
|
|
1842
1621
|
|
|
1843
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1844
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1845
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1846
|
-
var __objRest = (source, exclude) => {
|
|
1847
|
-
var target = {};
|
|
1848
|
-
for (var prop in source)
|
|
1849
|
-
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1850
|
-
target[prop] = source[prop];
|
|
1851
|
-
if (source != null && __getOwnPropSymbols$4)
|
|
1852
|
-
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1853
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1854
|
-
target[prop] = source[prop];
|
|
1855
|
-
}
|
|
1856
|
-
return target;
|
|
1857
|
-
};
|
|
1858
1622
|
function useMutationObserver(target, callback, options = {}) {
|
|
1859
|
-
const
|
|
1623
|
+
const { window = defaultWindow, ...mutationOptions } = options;
|
|
1860
1624
|
let observer;
|
|
1861
1625
|
const isSupported = useSupported(() => window && "MutationObserver" in window);
|
|
1862
1626
|
const cleanup = () => {
|
|
@@ -1890,16 +1654,12 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1890
1654
|
function useCssVar(prop, target, options = {}) {
|
|
1891
1655
|
const { window = defaultWindow, initialValue = "", observe = false } = options;
|
|
1892
1656
|
const variable = ref(initialValue);
|
|
1893
|
-
const elRef = computed(() =>
|
|
1894
|
-
var _a;
|
|
1895
|
-
return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
|
|
1896
|
-
});
|
|
1657
|
+
const elRef = computed(() => unrefElement(target) || window?.document?.documentElement);
|
|
1897
1658
|
function updateCssVar() {
|
|
1898
|
-
var _a;
|
|
1899
1659
|
const key = toValue(prop);
|
|
1900
1660
|
const el = toValue(elRef);
|
|
1901
1661
|
if (el && window) {
|
|
1902
|
-
const value =
|
|
1662
|
+
const value = window.getComputedStyle(el).getPropertyValue(key)?.trim();
|
|
1903
1663
|
variable.value = value || initialValue;
|
|
1904
1664
|
}
|
|
1905
1665
|
}
|
|
@@ -1917,8 +1677,7 @@ function useCssVar(prop, target, options = {}) {
|
|
|
1917
1677
|
watch(
|
|
1918
1678
|
variable,
|
|
1919
1679
|
(val) => {
|
|
1920
|
-
|
|
1921
|
-
if ((_a = elRef.value) == null ? void 0 : _a.style)
|
|
1680
|
+
if (elRef.value?.style)
|
|
1922
1681
|
elRef.value.style.setProperty(toValue(prop), val);
|
|
1923
1682
|
}
|
|
1924
1683
|
);
|
|
@@ -1998,25 +1757,6 @@ const UseScreenSafeArea = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
1998
1757
|
}
|
|
1999
1758
|
});
|
|
2000
1759
|
|
|
2001
|
-
var __defProp$3 = Object.defineProperty;
|
|
2002
|
-
var __defProps$2 = Object.defineProperties;
|
|
2003
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
2004
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
2005
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
2006
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
2007
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2008
|
-
var __spreadValues$3 = (a, b) => {
|
|
2009
|
-
for (var prop in b || (b = {}))
|
|
2010
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
2011
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
2012
|
-
if (__getOwnPropSymbols$3)
|
|
2013
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
2014
|
-
if (__propIsEnum$3.call(b, prop))
|
|
2015
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
2016
|
-
}
|
|
2017
|
-
return a;
|
|
2018
|
-
};
|
|
2019
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
2020
1760
|
const vScroll = {
|
|
2021
1761
|
[directiveHooks.mounted](el, binding) {
|
|
2022
1762
|
if (typeof binding.value === "function") {
|
|
@@ -2031,18 +1771,17 @@ const vScroll = {
|
|
|
2031
1771
|
});
|
|
2032
1772
|
} else {
|
|
2033
1773
|
const [handler, options] = binding.value;
|
|
2034
|
-
const state = useScroll(el,
|
|
1774
|
+
const state = useScroll(el, {
|
|
1775
|
+
...options,
|
|
2035
1776
|
onScroll(e) {
|
|
2036
|
-
|
|
2037
|
-
(_a = options.onScroll) == null ? void 0 : _a.call(options, e);
|
|
1777
|
+
options.onScroll?.(e);
|
|
2038
1778
|
handler(state);
|
|
2039
1779
|
},
|
|
2040
1780
|
onStop(e) {
|
|
2041
|
-
|
|
2042
|
-
(_a = options.onStop) == null ? void 0 : _a.call(options, e);
|
|
1781
|
+
options.onStop?.(e);
|
|
2043
1782
|
handler(state);
|
|
2044
1783
|
}
|
|
2045
|
-
})
|
|
1784
|
+
});
|
|
2046
1785
|
}
|
|
2047
1786
|
}
|
|
2048
1787
|
};
|
|
@@ -2074,8 +1813,9 @@ function useScrollLock(element, initialState = false) {
|
|
|
2074
1813
|
let stopTouchMoveListener = null;
|
|
2075
1814
|
let initialOverflow;
|
|
2076
1815
|
watch(toRef(element), (el) => {
|
|
2077
|
-
|
|
2078
|
-
|
|
1816
|
+
const target = resolveElement(toValue(el));
|
|
1817
|
+
if (target) {
|
|
1818
|
+
const ele = target;
|
|
2079
1819
|
initialOverflow = ele.style.overflow;
|
|
2080
1820
|
if (isLocked.value)
|
|
2081
1821
|
ele.style.overflow = "hidden";
|
|
@@ -2084,12 +1824,12 @@ function useScrollLock(element, initialState = false) {
|
|
|
2084
1824
|
immediate: true
|
|
2085
1825
|
});
|
|
2086
1826
|
const lock = () => {
|
|
2087
|
-
const
|
|
2088
|
-
if (!
|
|
1827
|
+
const el = resolveElement(toValue(element));
|
|
1828
|
+
if (!el || isLocked.value)
|
|
2089
1829
|
return;
|
|
2090
1830
|
if (isIOS) {
|
|
2091
1831
|
stopTouchMoveListener = useEventListener(
|
|
2092
|
-
|
|
1832
|
+
el,
|
|
2093
1833
|
"touchmove",
|
|
2094
1834
|
(e) => {
|
|
2095
1835
|
preventDefault(e);
|
|
@@ -2097,15 +1837,15 @@ function useScrollLock(element, initialState = false) {
|
|
|
2097
1837
|
{ passive: false }
|
|
2098
1838
|
);
|
|
2099
1839
|
}
|
|
2100
|
-
|
|
1840
|
+
el.style.overflow = "hidden";
|
|
2101
1841
|
isLocked.value = true;
|
|
2102
1842
|
};
|
|
2103
1843
|
const unlock = () => {
|
|
2104
|
-
const
|
|
2105
|
-
if (!
|
|
1844
|
+
const el = resolveElement(toValue(element));
|
|
1845
|
+
if (!el || !isLocked.value)
|
|
2106
1846
|
return;
|
|
2107
|
-
isIOS &&
|
|
2108
|
-
|
|
1847
|
+
isIOS && stopTouchMoveListener?.();
|
|
1848
|
+
el.style.overflow = initialOverflow;
|
|
2109
1849
|
isLocked.value = false;
|
|
2110
1850
|
};
|
|
2111
1851
|
tryOnScopeDispose(unlock);
|
|
@@ -2136,30 +1876,11 @@ function onScrollLock() {
|
|
|
2136
1876
|
}
|
|
2137
1877
|
const vScrollLock = onScrollLock();
|
|
2138
1878
|
|
|
2139
|
-
var __defProp$2 = Object.defineProperty;
|
|
2140
|
-
var __defProps$1 = Object.defineProperties;
|
|
2141
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
2142
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
2143
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
2144
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
2145
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2146
|
-
var __spreadValues$2 = (a, b) => {
|
|
2147
|
-
for (var prop in b || (b = {}))
|
|
2148
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
2149
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
2150
|
-
if (__getOwnPropSymbols$2)
|
|
2151
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
2152
|
-
if (__propIsEnum$2.call(b, prop))
|
|
2153
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
2154
|
-
}
|
|
2155
|
-
return a;
|
|
2156
|
-
};
|
|
2157
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
2158
1879
|
const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
2159
1880
|
name: "UseTimeAgo",
|
|
2160
1881
|
props: ["time", "updateInterval", "max", "fullDateFormatter", "messages", "showSecond"],
|
|
2161
1882
|
setup(props, { slots }) {
|
|
2162
|
-
const data = reactive(useTimeAgo(() => props.time,
|
|
1883
|
+
const data = reactive(useTimeAgo(() => props.time, { ...props, controls: true }));
|
|
2163
1884
|
return () => {
|
|
2164
1885
|
if (slots.default)
|
|
2165
1886
|
return slots.default(data);
|
|
@@ -2167,30 +1888,11 @@ const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
2167
1888
|
}
|
|
2168
1889
|
});
|
|
2169
1890
|
|
|
2170
|
-
var __defProp$1 = Object.defineProperty;
|
|
2171
|
-
var __defProps = Object.defineProperties;
|
|
2172
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2173
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
2174
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
2175
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
2176
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2177
|
-
var __spreadValues$1 = (a, b) => {
|
|
2178
|
-
for (var prop in b || (b = {}))
|
|
2179
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
2180
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
2181
|
-
if (__getOwnPropSymbols$1)
|
|
2182
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
2183
|
-
if (__propIsEnum$1.call(b, prop))
|
|
2184
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
2185
|
-
}
|
|
2186
|
-
return a;
|
|
2187
|
-
};
|
|
2188
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2189
1891
|
const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
2190
1892
|
name: "UseTimestamp",
|
|
2191
1893
|
props: ["immediate", "interval", "offset"],
|
|
2192
1894
|
setup(props, { slots }) {
|
|
2193
|
-
const data = reactive(useTimestamp(
|
|
1895
|
+
const data = reactive(useTimestamp({ ...props, controls: true }));
|
|
2194
1896
|
return () => {
|
|
2195
1897
|
if (slots.default)
|
|
2196
1898
|
return slots.default(data);
|
|
@@ -2198,22 +1900,6 @@ const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
2198
1900
|
}
|
|
2199
1901
|
});
|
|
2200
1902
|
|
|
2201
|
-
var __defProp = Object.defineProperty;
|
|
2202
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2203
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2204
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2205
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2206
|
-
var __spreadValues = (a, b) => {
|
|
2207
|
-
for (var prop in b || (b = {}))
|
|
2208
|
-
if (__hasOwnProp.call(b, prop))
|
|
2209
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2210
|
-
if (__getOwnPropSymbols)
|
|
2211
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
2212
|
-
if (__propIsEnum.call(b, prop))
|
|
2213
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2214
|
-
}
|
|
2215
|
-
return a;
|
|
2216
|
-
};
|
|
2217
1903
|
const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
2218
1904
|
name: "UseVirtualList",
|
|
2219
1905
|
props: [
|
|
@@ -2228,11 +1914,11 @@ const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
|
2228
1914
|
typeof containerProps.style === "object" && !Array.isArray(containerProps.style) && (containerProps.style.height = props.height || "300px");
|
|
2229
1915
|
return () => h(
|
|
2230
1916
|
"div",
|
|
2231
|
-
|
|
1917
|
+
{ ...containerProps },
|
|
2232
1918
|
[
|
|
2233
1919
|
h(
|
|
2234
1920
|
"div",
|
|
2235
|
-
|
|
1921
|
+
{ ...wrapperProps.value },
|
|
2236
1922
|
list.value.map((item) => h(
|
|
2237
1923
|
"div",
|
|
2238
1924
|
{ style: { overFlow: "hidden", height: item.height } },
|