@vueuse/components 11.2.0 → 12.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +205 -194
- package/index.d.cts +2 -2
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.iife.js +206 -322
- package/index.iife.min.js +1 -1
- package/index.mjs +30 -19
- package/package.json +4 -4
package/index.cjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@vueuse/core');
|
|
4
|
-
var
|
|
4
|
+
var vue = require('vue');
|
|
5
5
|
var shared = require('@vueuse/shared');
|
|
6
6
|
|
|
7
|
-
const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */
|
|
7
|
+
const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
8
8
|
name: "OnClickOutside",
|
|
9
9
|
props: ["as", "options"],
|
|
10
10
|
emits: ["trigger"],
|
|
11
11
|
setup(props, { slots, emit }) {
|
|
12
|
-
const target =
|
|
12
|
+
const target = vue.ref();
|
|
13
13
|
core.onClickOutside(target, (e) => {
|
|
14
14
|
emit("trigger", e);
|
|
15
15
|
}, props.options);
|
|
16
16
|
return () => {
|
|
17
17
|
if (slots.default)
|
|
18
|
-
return
|
|
18
|
+
return vue.h(props.as || "div", { ref: target }, slots.default());
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
});
|
|
@@ -54,7 +54,7 @@ function useEventListener(...args) {
|
|
|
54
54
|
el.addEventListener(event, listener, options2);
|
|
55
55
|
return () => el.removeEventListener(event, listener, options2);
|
|
56
56
|
};
|
|
57
|
-
const stopWatch =
|
|
57
|
+
const stopWatch = vue.watch(
|
|
58
58
|
() => [unrefElement(target), shared.toValue(options)],
|
|
59
59
|
([el, options2]) => {
|
|
60
60
|
cleanup();
|
|
@@ -98,8 +98,23 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
|
+
function hasMultipleRoots(target2) {
|
|
102
|
+
const vm = shared.toValue(target2);
|
|
103
|
+
return vm && vm.$.subTree.shapeFlag === 16;
|
|
104
|
+
}
|
|
105
|
+
function checkMultipleRoots(target2, event) {
|
|
106
|
+
const vm = shared.toValue(target2);
|
|
107
|
+
const children = vm.$.subTree && vm.$.subTree.children;
|
|
108
|
+
if (children == null || !Array.isArray(children))
|
|
109
|
+
return false;
|
|
110
|
+
return children.some((child) => child.el === event.target || event.composedPath().includes(child.el));
|
|
111
|
+
}
|
|
101
112
|
const listener = (event) => {
|
|
102
113
|
const el = unrefElement(target);
|
|
114
|
+
if (event.target == null)
|
|
115
|
+
return;
|
|
116
|
+
if (!(el instanceof Element) && hasMultipleRoots(target) && checkMultipleRoots(target, event))
|
|
117
|
+
return;
|
|
103
118
|
if (!el || el === event.target || event.composedPath().includes(el))
|
|
104
119
|
return;
|
|
105
120
|
if (event.detail === 0)
|
|
@@ -140,7 +155,7 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
140
155
|
}
|
|
141
156
|
|
|
142
157
|
const vOnClickOutside = {
|
|
143
|
-
|
|
158
|
+
mounted(el, binding) {
|
|
144
159
|
const capture = !binding.modifiers.bubble;
|
|
145
160
|
if (typeof binding.value === "function") {
|
|
146
161
|
el.__onClickOutside_stop = onClickOutside(el, binding.value, { capture });
|
|
@@ -149,7 +164,7 @@ const vOnClickOutside = {
|
|
|
149
164
|
el.__onClickOutside_stop = onClickOutside(el, handler, Object.assign({ capture }, options));
|
|
150
165
|
}
|
|
151
166
|
},
|
|
152
|
-
|
|
167
|
+
unmounted(el) {
|
|
153
168
|
el.__onClickOutside_stop();
|
|
154
169
|
}
|
|
155
170
|
};
|
|
@@ -201,7 +216,7 @@ function onKeyStroke(...args) {
|
|
|
201
216
|
}
|
|
202
217
|
|
|
203
218
|
const vOnKeyStroke = {
|
|
204
|
-
|
|
219
|
+
mounted(el, binding) {
|
|
205
220
|
var _a, _b;
|
|
206
221
|
const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
|
|
207
222
|
if (typeof binding.value === "function") {
|
|
@@ -222,7 +237,7 @@ const DEFAULT_DELAY = 500;
|
|
|
222
237
|
const DEFAULT_THRESHOLD = 10;
|
|
223
238
|
function onLongPress(target, handler, options) {
|
|
224
239
|
var _a, _b;
|
|
225
|
-
const elementRef =
|
|
240
|
+
const elementRef = vue.computed(() => unrefElement(target));
|
|
226
241
|
let timeout;
|
|
227
242
|
let posStart;
|
|
228
243
|
let startTimestamp;
|
|
@@ -304,12 +319,12 @@ function onLongPress(target, handler, options) {
|
|
|
304
319
|
return stop;
|
|
305
320
|
}
|
|
306
321
|
|
|
307
|
-
const OnLongPress = /* @__PURE__ */ /* #__PURE__ */
|
|
322
|
+
const OnLongPress = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
308
323
|
name: "OnLongPress",
|
|
309
324
|
props: ["as", "options"],
|
|
310
325
|
emits: ["trigger"],
|
|
311
326
|
setup(props, { slots, emit }) {
|
|
312
|
-
const target =
|
|
327
|
+
const target = vue.ref();
|
|
313
328
|
onLongPress(
|
|
314
329
|
target,
|
|
315
330
|
(e) => {
|
|
@@ -319,13 +334,13 @@ const OnLongPress = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
319
334
|
);
|
|
320
335
|
return () => {
|
|
321
336
|
if (slots.default)
|
|
322
|
-
return
|
|
337
|
+
return vue.h(props.as || "div", { ref: target }, slots.default());
|
|
323
338
|
};
|
|
324
339
|
}
|
|
325
340
|
});
|
|
326
341
|
|
|
327
342
|
const vOnLongPress = {
|
|
328
|
-
|
|
343
|
+
mounted(el, binding) {
|
|
329
344
|
if (typeof binding.value === "function")
|
|
330
345
|
onLongPress(el, binding.value, { modifiers: binding.modifiers });
|
|
331
346
|
else
|
|
@@ -333,10 +348,10 @@ const vOnLongPress = {
|
|
|
333
348
|
}
|
|
334
349
|
};
|
|
335
350
|
|
|
336
|
-
const UseActiveElement = /* @__PURE__ */ /* #__PURE__ */
|
|
351
|
+
const UseActiveElement = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
337
352
|
name: "UseActiveElement",
|
|
338
353
|
setup(props, { slots }) {
|
|
339
|
-
const data =
|
|
354
|
+
const data = vue.reactive({
|
|
340
355
|
element: core.useActiveElement()
|
|
341
356
|
});
|
|
342
357
|
return () => {
|
|
@@ -346,10 +361,10 @@ const UseActiveElement = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent
|
|
|
346
361
|
}
|
|
347
362
|
});
|
|
348
363
|
|
|
349
|
-
const UseBattery = /* @__PURE__ */ /* #__PURE__ */
|
|
364
|
+
const UseBattery = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
350
365
|
name: "UseBattery",
|
|
351
366
|
setup(props, { slots }) {
|
|
352
|
-
const data =
|
|
367
|
+
const data = vue.reactive(core.useBattery(props));
|
|
353
368
|
return () => {
|
|
354
369
|
if (slots.default)
|
|
355
370
|
return slots.default(data);
|
|
@@ -357,10 +372,10 @@ const UseBattery = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
357
372
|
}
|
|
358
373
|
});
|
|
359
374
|
|
|
360
|
-
const UseBrowserLocation = /* @__PURE__ */ /* #__PURE__ */
|
|
375
|
+
const UseBrowserLocation = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
361
376
|
name: "UseBrowserLocation",
|
|
362
377
|
setup(props, { slots }) {
|
|
363
|
-
const data =
|
|
378
|
+
const data = vue.reactive(core.useBrowserLocation());
|
|
364
379
|
return () => {
|
|
365
380
|
if (slots.default)
|
|
366
381
|
return slots.default(data);
|
|
@@ -368,7 +383,7 @@ const UseBrowserLocation = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineCompone
|
|
|
368
383
|
}
|
|
369
384
|
});
|
|
370
385
|
|
|
371
|
-
const UseClipboard = /* @__PURE__ */ /* #__PURE__ */
|
|
386
|
+
const UseClipboard = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
372
387
|
name: "UseClipboard",
|
|
373
388
|
props: [
|
|
374
389
|
"source",
|
|
@@ -378,7 +393,7 @@ const UseClipboard = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
378
393
|
"legacy"
|
|
379
394
|
],
|
|
380
395
|
setup(props, { slots }) {
|
|
381
|
-
const data =
|
|
396
|
+
const data = vue.reactive(core.useClipboard(props));
|
|
382
397
|
return () => {
|
|
383
398
|
var _a;
|
|
384
399
|
return (_a = slots.default) == null ? void 0 : _a.call(slots, data);
|
|
@@ -399,19 +414,19 @@ function getSSRHandler(key, fallback) {
|
|
|
399
414
|
}
|
|
400
415
|
|
|
401
416
|
function useMounted() {
|
|
402
|
-
const isMounted =
|
|
403
|
-
const instance =
|
|
417
|
+
const isMounted = vue.ref(false);
|
|
418
|
+
const instance = vue.getCurrentInstance();
|
|
404
419
|
if (instance) {
|
|
405
|
-
|
|
420
|
+
vue.onMounted(() => {
|
|
406
421
|
isMounted.value = true;
|
|
407
|
-
},
|
|
422
|
+
}, instance);
|
|
408
423
|
}
|
|
409
424
|
return isMounted;
|
|
410
425
|
}
|
|
411
426
|
|
|
412
427
|
function useSupported(callback) {
|
|
413
428
|
const isMounted = useMounted();
|
|
414
|
-
return
|
|
429
|
+
return vue.computed(() => {
|
|
415
430
|
isMounted.value;
|
|
416
431
|
return Boolean(callback());
|
|
417
432
|
});
|
|
@@ -421,7 +436,7 @@ function useMediaQuery(query, options = {}) {
|
|
|
421
436
|
const { window = defaultWindow } = options;
|
|
422
437
|
const isSupported = useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function");
|
|
423
438
|
let mediaQuery;
|
|
424
|
-
const matches =
|
|
439
|
+
const matches = vue.ref(false);
|
|
425
440
|
const handler = (event) => {
|
|
426
441
|
matches.value = event.matches;
|
|
427
442
|
};
|
|
@@ -433,7 +448,7 @@ function useMediaQuery(query, options = {}) {
|
|
|
433
448
|
else
|
|
434
449
|
mediaQuery.removeListener(handler);
|
|
435
450
|
};
|
|
436
|
-
const stopWatch =
|
|
451
|
+
const stopWatch = vue.watchEffect(() => {
|
|
437
452
|
if (!isSupported.value)
|
|
438
453
|
return;
|
|
439
454
|
cleanup();
|
|
@@ -511,7 +526,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
511
526
|
},
|
|
512
527
|
initOnMounted
|
|
513
528
|
} = options;
|
|
514
|
-
const data = (shallow ?
|
|
529
|
+
const data = (shallow ? vue.shallowRef : vue.ref)(typeof defaults === "function" ? defaults() : defaults);
|
|
515
530
|
if (!storage) {
|
|
516
531
|
try {
|
|
517
532
|
storage = getSSRHandler("getDefaultStorage", () => {
|
|
@@ -610,7 +625,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
610
625
|
onError(e);
|
|
611
626
|
} finally {
|
|
612
627
|
if (event)
|
|
613
|
-
|
|
628
|
+
vue.nextTick(resumeWatch);
|
|
614
629
|
else
|
|
615
630
|
resumeWatch();
|
|
616
631
|
}
|
|
@@ -642,9 +657,9 @@ function useColorMode(options = {}) {
|
|
|
642
657
|
...options.modes || {}
|
|
643
658
|
};
|
|
644
659
|
const preferredDark = usePreferredDark({ window });
|
|
645
|
-
const system =
|
|
660
|
+
const system = vue.computed(() => preferredDark.value ? "dark" : "light");
|
|
646
661
|
const store = storageRef || (storageKey == null ? shared.toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));
|
|
647
|
-
const state =
|
|
662
|
+
const state = vue.computed(() => store.value === "auto" ? system.value : store.value);
|
|
648
663
|
const updateHTMLAttrs = getSSRHandler(
|
|
649
664
|
"updateHTMLAttrs",
|
|
650
665
|
(selector2, attribute2, value) => {
|
|
@@ -698,9 +713,9 @@ function useColorMode(options = {}) {
|
|
|
698
713
|
else
|
|
699
714
|
defaultOnChanged(mode);
|
|
700
715
|
}
|
|
701
|
-
|
|
716
|
+
vue.watch(state, onChanged, { flush: "post", immediate: true });
|
|
702
717
|
shared.tryOnMounted(() => onChanged(state.value));
|
|
703
|
-
const auto =
|
|
718
|
+
const auto = vue.computed({
|
|
704
719
|
get() {
|
|
705
720
|
return emitAuto ? store.value : state.value;
|
|
706
721
|
},
|
|
@@ -708,19 +723,15 @@ function useColorMode(options = {}) {
|
|
|
708
723
|
store.value = v;
|
|
709
724
|
}
|
|
710
725
|
});
|
|
711
|
-
|
|
712
|
-
return Object.assign(auto, { store, system, state });
|
|
713
|
-
} catch (e) {
|
|
714
|
-
return auto;
|
|
715
|
-
}
|
|
726
|
+
return Object.assign(auto, { store, system, state });
|
|
716
727
|
}
|
|
717
728
|
|
|
718
|
-
const UseColorMode = /* @__PURE__ */ /* #__PURE__ */
|
|
729
|
+
const UseColorMode = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
719
730
|
name: "UseColorMode",
|
|
720
731
|
props: ["selector", "attribute", "modes", "onChanged", "storageKey", "storage", "emitAuto"],
|
|
721
732
|
setup(props, { slots }) {
|
|
722
733
|
const mode = useColorMode(props);
|
|
723
|
-
const data =
|
|
734
|
+
const data = vue.reactive({
|
|
724
735
|
mode,
|
|
725
736
|
system: mode.system,
|
|
726
737
|
store: mode.store
|
|
@@ -732,12 +743,12 @@ const UseColorMode = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
732
743
|
}
|
|
733
744
|
});
|
|
734
745
|
|
|
735
|
-
const UseDark = /* @__PURE__ */ /* #__PURE__ */
|
|
746
|
+
const UseDark = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
736
747
|
name: "UseDark",
|
|
737
748
|
props: ["selector", "attribute", "valueDark", "valueLight", "onChanged", "storageKey", "storage"],
|
|
738
749
|
setup(props, { slots }) {
|
|
739
750
|
const isDark = core.useDark(props);
|
|
740
|
-
const data =
|
|
751
|
+
const data = vue.reactive({
|
|
741
752
|
isDark,
|
|
742
753
|
toggleDark: shared.useToggle(isDark)
|
|
743
754
|
});
|
|
@@ -748,10 +759,10 @@ const UseDark = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
748
759
|
}
|
|
749
760
|
});
|
|
750
761
|
|
|
751
|
-
const UseDeviceMotion = /* @__PURE__ */ /* #__PURE__ */
|
|
762
|
+
const UseDeviceMotion = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
752
763
|
name: "UseDeviceMotion",
|
|
753
764
|
setup(props, { slots }) {
|
|
754
|
-
const data =
|
|
765
|
+
const data = vue.reactive(core.useDeviceMotion());
|
|
755
766
|
return () => {
|
|
756
767
|
if (slots.default)
|
|
757
768
|
return slots.default(data);
|
|
@@ -759,10 +770,10 @@ const UseDeviceMotion = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent(
|
|
|
759
770
|
}
|
|
760
771
|
});
|
|
761
772
|
|
|
762
|
-
const UseDeviceOrientation = /* @__PURE__ */ /* #__PURE__ */
|
|
773
|
+
const UseDeviceOrientation = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
763
774
|
name: "UseDeviceOrientation",
|
|
764
775
|
setup(props, { slots }) {
|
|
765
|
-
const data =
|
|
776
|
+
const data = vue.reactive(core.useDeviceOrientation());
|
|
766
777
|
return () => {
|
|
767
778
|
if (slots.default)
|
|
768
779
|
return slots.default(data);
|
|
@@ -770,10 +781,10 @@ const UseDeviceOrientation = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineCompo
|
|
|
770
781
|
}
|
|
771
782
|
});
|
|
772
783
|
|
|
773
|
-
const UseDevicePixelRatio = /* @__PURE__ */ /* #__PURE__ */
|
|
784
|
+
const UseDevicePixelRatio = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
774
785
|
name: "UseDevicePixelRatio",
|
|
775
786
|
setup(props, { slots }) {
|
|
776
|
-
const data =
|
|
787
|
+
const data = vue.reactive({
|
|
777
788
|
pixelRatio: core.useDevicePixelRatio()
|
|
778
789
|
});
|
|
779
790
|
return () => {
|
|
@@ -783,11 +794,11 @@ const UseDevicePixelRatio = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineCompon
|
|
|
783
794
|
}
|
|
784
795
|
});
|
|
785
796
|
|
|
786
|
-
const UseDevicesList = /* @__PURE__ */ /* #__PURE__ */
|
|
797
|
+
const UseDevicesList = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
787
798
|
name: "UseDevicesList",
|
|
788
799
|
props: ["onUpdated", "requestPermissions", "constraints"],
|
|
789
800
|
setup(props, { slots }) {
|
|
790
|
-
const data =
|
|
801
|
+
const data = vue.reactive(core.useDevicesList(props));
|
|
791
802
|
return () => {
|
|
792
803
|
if (slots.default)
|
|
793
804
|
return slots.default(data);
|
|
@@ -795,10 +806,10 @@ const UseDevicesList = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
795
806
|
}
|
|
796
807
|
});
|
|
797
808
|
|
|
798
|
-
const UseDocumentVisibility = /* @__PURE__ */ /* #__PURE__ */
|
|
809
|
+
const UseDocumentVisibility = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
799
810
|
name: "UseDocumentVisibility",
|
|
800
811
|
setup(props, { slots }) {
|
|
801
|
-
const data =
|
|
812
|
+
const data = vue.reactive({
|
|
802
813
|
visibility: core.useDocumentVisibility()
|
|
803
814
|
});
|
|
804
815
|
return () => {
|
|
@@ -808,7 +819,7 @@ const UseDocumentVisibility = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComp
|
|
|
808
819
|
}
|
|
809
820
|
});
|
|
810
821
|
|
|
811
|
-
const UseDraggable = /* @__PURE__ */ /* #__PURE__ */
|
|
822
|
+
const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
812
823
|
name: "UseDraggable",
|
|
813
824
|
props: [
|
|
814
825
|
"storageKey",
|
|
@@ -829,16 +840,16 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
829
840
|
"containerElement"
|
|
830
841
|
],
|
|
831
842
|
setup(props, { slots }) {
|
|
832
|
-
const target =
|
|
833
|
-
const handle =
|
|
843
|
+
const target = vue.ref();
|
|
844
|
+
const handle = vue.computed(() => {
|
|
834
845
|
var _a;
|
|
835
846
|
return (_a = props.handle) != null ? _a : target.value;
|
|
836
847
|
});
|
|
837
|
-
const containerElement =
|
|
848
|
+
const containerElement = vue.computed(() => {
|
|
838
849
|
var _a;
|
|
839
850
|
return (_a = props.containerElement) != null ? _a : void 0;
|
|
840
851
|
});
|
|
841
|
-
const disabled =
|
|
852
|
+
const disabled = vue.computed(() => !!props.disabled);
|
|
842
853
|
const storageValue = props.storageKey && core.useStorage(
|
|
843
854
|
props.storageKey,
|
|
844
855
|
shared.toValue(props.initialValue) || { x: 0, y: 0 },
|
|
@@ -853,7 +864,7 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
853
864
|
storageValue.value.x = position.x;
|
|
854
865
|
storageValue.value.y = position.y;
|
|
855
866
|
};
|
|
856
|
-
const data =
|
|
867
|
+
const data = vue.reactive(core.useDraggable(target, {
|
|
857
868
|
...props,
|
|
858
869
|
handle,
|
|
859
870
|
initialValue,
|
|
@@ -863,20 +874,20 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
863
874
|
}));
|
|
864
875
|
return () => {
|
|
865
876
|
if (slots.default)
|
|
866
|
-
return
|
|
877
|
+
return vue.h(props.as || "div", { ref: target, style: `touch-action:none;${data.style}` }, slots.default(data));
|
|
867
878
|
};
|
|
868
879
|
}
|
|
869
880
|
});
|
|
870
881
|
|
|
871
|
-
const UseElementBounding = /* @__PURE__ */ /* #__PURE__ */
|
|
882
|
+
const UseElementBounding = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
872
883
|
name: "UseElementBounding",
|
|
873
884
|
props: ["box", "as"],
|
|
874
885
|
setup(props, { slots }) {
|
|
875
|
-
const target =
|
|
876
|
-
const data =
|
|
886
|
+
const target = vue.ref();
|
|
887
|
+
const data = vue.reactive(core.useElementBounding(target));
|
|
877
888
|
return () => {
|
|
878
889
|
if (slots.default)
|
|
879
|
-
return
|
|
890
|
+
return vue.h(props.as || "div", { ref: target }, slots.default(data));
|
|
880
891
|
};
|
|
881
892
|
}
|
|
882
893
|
});
|
|
@@ -887,7 +898,7 @@ function useElementHover(el, options = {}) {
|
|
|
887
898
|
delayLeave = 0,
|
|
888
899
|
window = defaultWindow
|
|
889
900
|
} = options;
|
|
890
|
-
const isHovered =
|
|
901
|
+
const isHovered = vue.ref(false);
|
|
891
902
|
let timer;
|
|
892
903
|
const toggle = (entering) => {
|
|
893
904
|
const delay = entering ? delayEnter : delayLeave;
|
|
@@ -908,28 +919,28 @@ function useElementHover(el, options = {}) {
|
|
|
908
919
|
}
|
|
909
920
|
|
|
910
921
|
const vElementHover = {
|
|
911
|
-
|
|
922
|
+
mounted(el, binding) {
|
|
912
923
|
const value = binding.value;
|
|
913
924
|
if (typeof value === "function") {
|
|
914
925
|
const isHovered = useElementHover(el);
|
|
915
|
-
|
|
926
|
+
vue.watch(isHovered, (v) => value(v));
|
|
916
927
|
} else {
|
|
917
928
|
const [handler, options] = value;
|
|
918
929
|
const isHovered = useElementHover(el, options);
|
|
919
|
-
|
|
930
|
+
vue.watch(isHovered, (v) => handler(v));
|
|
920
931
|
}
|
|
921
932
|
}
|
|
922
933
|
};
|
|
923
934
|
|
|
924
|
-
const UseElementSize = /* @__PURE__ */ /* #__PURE__ */
|
|
935
|
+
const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
925
936
|
name: "UseElementSize",
|
|
926
937
|
props: ["width", "height", "box", "as"],
|
|
927
938
|
setup(props, { slots }) {
|
|
928
|
-
const target =
|
|
929
|
-
const data =
|
|
939
|
+
const target = vue.ref();
|
|
940
|
+
const data = vue.reactive(core.useElementSize(target, { width: props.width, height: props.height }, { box: props.box }));
|
|
930
941
|
return () => {
|
|
931
942
|
if (slots.default)
|
|
932
|
-
return
|
|
943
|
+
return vue.h(props.as || "div", { ref: target }, slots.default(data));
|
|
933
944
|
};
|
|
934
945
|
}
|
|
935
946
|
});
|
|
@@ -944,11 +955,11 @@ function useResizeObserver(target, callback, options = {}) {
|
|
|
944
955
|
observer = void 0;
|
|
945
956
|
}
|
|
946
957
|
};
|
|
947
|
-
const targets =
|
|
958
|
+
const targets = vue.computed(() => {
|
|
948
959
|
const _targets = shared.toValue(target);
|
|
949
960
|
return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
|
|
950
961
|
});
|
|
951
|
-
const stopWatch =
|
|
962
|
+
const stopWatch = vue.watch(
|
|
952
963
|
targets,
|
|
953
964
|
(els) => {
|
|
954
965
|
cleanup();
|
|
@@ -975,12 +986,12 @@ function useResizeObserver(target, callback, options = {}) {
|
|
|
975
986
|
|
|
976
987
|
function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
|
|
977
988
|
const { window = defaultWindow, box = "content-box" } = options;
|
|
978
|
-
const isSVG =
|
|
989
|
+
const isSVG = vue.computed(() => {
|
|
979
990
|
var _a, _b;
|
|
980
991
|
return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
|
|
981
992
|
});
|
|
982
|
-
const width =
|
|
983
|
-
const height =
|
|
993
|
+
const width = vue.ref(initialSize.width);
|
|
994
|
+
const height = vue.ref(initialSize.height);
|
|
984
995
|
const { stop: stop1 } = useResizeObserver(
|
|
985
996
|
target,
|
|
986
997
|
([entry]) => {
|
|
@@ -1012,7 +1023,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
1012
1023
|
height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
|
|
1013
1024
|
}
|
|
1014
1025
|
});
|
|
1015
|
-
const stop2 =
|
|
1026
|
+
const stop2 = vue.watch(
|
|
1016
1027
|
() => unrefElement(target),
|
|
1017
1028
|
(ele) => {
|
|
1018
1029
|
width.value = ele ? initialSize.width : 0;
|
|
@@ -1031,26 +1042,26 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
1031
1042
|
}
|
|
1032
1043
|
|
|
1033
1044
|
const vElementSize = {
|
|
1034
|
-
|
|
1045
|
+
mounted(el, binding) {
|
|
1035
1046
|
var _a;
|
|
1036
1047
|
const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? void 0 : _a[0];
|
|
1037
1048
|
const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
|
|
1038
1049
|
const { width, height } = useElementSize(el, ...options);
|
|
1039
|
-
|
|
1050
|
+
vue.watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
|
|
1040
1051
|
}
|
|
1041
1052
|
};
|
|
1042
1053
|
|
|
1043
|
-
const UseElementVisibility = /* @__PURE__ */ /* #__PURE__ */
|
|
1054
|
+
const UseElementVisibility = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1044
1055
|
name: "UseElementVisibility",
|
|
1045
1056
|
props: ["as"],
|
|
1046
1057
|
setup(props, { slots }) {
|
|
1047
|
-
const target =
|
|
1048
|
-
const data =
|
|
1058
|
+
const target = vue.ref();
|
|
1059
|
+
const data = vue.reactive({
|
|
1049
1060
|
isVisible: core.useElementVisibility(target)
|
|
1050
1061
|
});
|
|
1051
1062
|
return () => {
|
|
1052
1063
|
if (slots.default)
|
|
1053
|
-
return
|
|
1064
|
+
return vue.h(props.as || "div", { ref: target }, slots.default(data));
|
|
1054
1065
|
};
|
|
1055
1066
|
}
|
|
1056
1067
|
});
|
|
@@ -1064,13 +1075,13 @@ function useIntersectionObserver(target, callback, options = {}) {
|
|
|
1064
1075
|
immediate = true
|
|
1065
1076
|
} = options;
|
|
1066
1077
|
const isSupported = useSupported(() => window && "IntersectionObserver" in window);
|
|
1067
|
-
const targets =
|
|
1078
|
+
const targets = vue.computed(() => {
|
|
1068
1079
|
const _target = shared.toValue(target);
|
|
1069
1080
|
return (Array.isArray(_target) ? _target : [_target]).map(unrefElement).filter(shared.notNullish);
|
|
1070
1081
|
});
|
|
1071
1082
|
let cleanup = shared.noop;
|
|
1072
|
-
const isActive =
|
|
1073
|
-
const stopWatch = isSupported.value ?
|
|
1083
|
+
const isActive = vue.ref(immediate);
|
|
1084
|
+
const stopWatch = isSupported.value ? vue.watch(
|
|
1074
1085
|
() => [targets.value, unrefElement(root), isActive.value],
|
|
1075
1086
|
([targets2, root2]) => {
|
|
1076
1087
|
cleanup();
|
|
@@ -1116,7 +1127,7 @@ function useIntersectionObserver(target, callback, options = {}) {
|
|
|
1116
1127
|
|
|
1117
1128
|
function useElementVisibility(element, options = {}) {
|
|
1118
1129
|
const { window = defaultWindow, scrollTarget, threshold = 0 } = options;
|
|
1119
|
-
const elementIsVisible =
|
|
1130
|
+
const elementIsVisible = vue.ref(false);
|
|
1120
1131
|
useIntersectionObserver(
|
|
1121
1132
|
element,
|
|
1122
1133
|
(intersectionObserverEntries) => {
|
|
@@ -1140,26 +1151,26 @@ function useElementVisibility(element, options = {}) {
|
|
|
1140
1151
|
}
|
|
1141
1152
|
|
|
1142
1153
|
const vElementVisibility = {
|
|
1143
|
-
|
|
1154
|
+
mounted(el, binding) {
|
|
1144
1155
|
if (typeof binding.value === "function") {
|
|
1145
1156
|
const handler = binding.value;
|
|
1146
1157
|
const isVisible = useElementVisibility(el);
|
|
1147
|
-
|
|
1158
|
+
vue.watch(isVisible, (v) => handler(v), { immediate: true });
|
|
1148
1159
|
} else {
|
|
1149
1160
|
const [handler, options] = binding.value;
|
|
1150
1161
|
const isVisible = useElementVisibility(el, options);
|
|
1151
|
-
|
|
1162
|
+
vue.watch(isVisible, (v) => handler(v), { immediate: true });
|
|
1152
1163
|
}
|
|
1153
1164
|
}
|
|
1154
1165
|
};
|
|
1155
1166
|
|
|
1156
|
-
const UseEyeDropper = /* @__PURE__ */ /* #__PURE__ */
|
|
1167
|
+
const UseEyeDropper = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1157
1168
|
name: "UseEyeDropper",
|
|
1158
1169
|
props: {
|
|
1159
1170
|
sRGBHex: String
|
|
1160
1171
|
},
|
|
1161
1172
|
setup(props, { slots }) {
|
|
1162
|
-
const data =
|
|
1173
|
+
const data = vue.reactive(core.useEyeDropper());
|
|
1163
1174
|
return () => {
|
|
1164
1175
|
if (slots.default)
|
|
1165
1176
|
return slots.default(data);
|
|
@@ -1167,24 +1178,24 @@ const UseEyeDropper = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1167
1178
|
}
|
|
1168
1179
|
});
|
|
1169
1180
|
|
|
1170
|
-
const UseFullscreen = /* @__PURE__ */ /* #__PURE__ */
|
|
1181
|
+
const UseFullscreen = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1171
1182
|
name: "UseFullscreen",
|
|
1172
1183
|
props: ["as"],
|
|
1173
1184
|
setup(props, { slots }) {
|
|
1174
|
-
const target =
|
|
1175
|
-
const data =
|
|
1185
|
+
const target = vue.ref();
|
|
1186
|
+
const data = vue.reactive(core.useFullscreen(target));
|
|
1176
1187
|
return () => {
|
|
1177
1188
|
if (slots.default)
|
|
1178
|
-
return
|
|
1189
|
+
return vue.h(props.as || "div", { ref: target }, slots.default(data));
|
|
1179
1190
|
};
|
|
1180
1191
|
}
|
|
1181
1192
|
});
|
|
1182
1193
|
|
|
1183
|
-
const UseGeolocation = /* @__PURE__ */ /* #__PURE__ */
|
|
1194
|
+
const UseGeolocation = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1184
1195
|
name: "UseGeolocation",
|
|
1185
1196
|
props: ["enableHighAccuracy", "maximumAge", "timeout", "navigator"],
|
|
1186
1197
|
setup(props, { slots }) {
|
|
1187
|
-
const data =
|
|
1198
|
+
const data = vue.reactive(core.useGeolocation(props));
|
|
1188
1199
|
return () => {
|
|
1189
1200
|
if (slots.default)
|
|
1190
1201
|
return slots.default(data);
|
|
@@ -1192,11 +1203,11 @@ const UseGeolocation = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1192
1203
|
}
|
|
1193
1204
|
});
|
|
1194
1205
|
|
|
1195
|
-
const UseIdle = /* @__PURE__ */ /* #__PURE__ */
|
|
1206
|
+
const UseIdle = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1196
1207
|
name: "UseIdle",
|
|
1197
1208
|
props: ["timeout", "events", "listenForVisibilityChange", "initialState"],
|
|
1198
1209
|
setup(props, { slots }) {
|
|
1199
|
-
const data =
|
|
1210
|
+
const data = vue.reactive(core.useIdle(props.timeout, props));
|
|
1200
1211
|
return () => {
|
|
1201
1212
|
if (slots.default)
|
|
1202
1213
|
return slots.default(data);
|
|
@@ -1214,10 +1225,10 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1214
1225
|
shallow = true,
|
|
1215
1226
|
throwError
|
|
1216
1227
|
} = options != null ? options : {};
|
|
1217
|
-
const state = shallow ?
|
|
1218
|
-
const isReady =
|
|
1219
|
-
const isLoading =
|
|
1220
|
-
const error =
|
|
1228
|
+
const state = shallow ? vue.shallowRef(initialState) : vue.ref(initialState);
|
|
1229
|
+
const isReady = vue.ref(false);
|
|
1230
|
+
const isLoading = vue.ref(false);
|
|
1231
|
+
const error = vue.shallowRef(void 0);
|
|
1221
1232
|
async function execute(delay2 = 0, ...args) {
|
|
1222
1233
|
if (resetOnExecute)
|
|
1223
1234
|
state.value = initialState;
|
|
@@ -1294,7 +1305,7 @@ function useImage(options, asyncStateOptions = {}) {
|
|
|
1294
1305
|
...asyncStateOptions
|
|
1295
1306
|
}
|
|
1296
1307
|
);
|
|
1297
|
-
|
|
1308
|
+
vue.watch(
|
|
1298
1309
|
() => shared.toValue(options),
|
|
1299
1310
|
() => state.execute(asyncStateOptions.delay),
|
|
1300
1311
|
{ deep: true }
|
|
@@ -1302,7 +1313,7 @@ function useImage(options, asyncStateOptions = {}) {
|
|
|
1302
1313
|
return state;
|
|
1303
1314
|
}
|
|
1304
1315
|
|
|
1305
|
-
const UseImage = /* @__PURE__ */ /* #__PURE__ */
|
|
1316
|
+
const UseImage = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1306
1317
|
name: "UseImage",
|
|
1307
1318
|
props: [
|
|
1308
1319
|
"src",
|
|
@@ -1316,7 +1327,7 @@ const UseImage = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1316
1327
|
"referrerPolicy"
|
|
1317
1328
|
],
|
|
1318
1329
|
setup(props, { slots }) {
|
|
1319
|
-
const data =
|
|
1330
|
+
const data = vue.reactive(useImage(props));
|
|
1320
1331
|
return () => {
|
|
1321
1332
|
if (data.isLoading && slots.loading)
|
|
1322
1333
|
return slots.loading(data);
|
|
@@ -1324,7 +1335,7 @@ const UseImage = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1324
1335
|
return slots.error(data.error);
|
|
1325
1336
|
if (slots.default)
|
|
1326
1337
|
return slots.default(data);
|
|
1327
|
-
return
|
|
1338
|
+
return vue.h(props.as || "img", props);
|
|
1328
1339
|
};
|
|
1329
1340
|
}
|
|
1330
1341
|
});
|
|
@@ -1360,9 +1371,9 @@ function useScroll(element, options = {}) {
|
|
|
1360
1371
|
console.error(e);
|
|
1361
1372
|
}
|
|
1362
1373
|
} = options;
|
|
1363
|
-
const internalX =
|
|
1364
|
-
const internalY =
|
|
1365
|
-
const x =
|
|
1374
|
+
const internalX = vue.ref(0);
|
|
1375
|
+
const internalY = vue.ref(0);
|
|
1376
|
+
const x = vue.computed({
|
|
1366
1377
|
get() {
|
|
1367
1378
|
return internalX.value;
|
|
1368
1379
|
},
|
|
@@ -1370,7 +1381,7 @@ function useScroll(element, options = {}) {
|
|
|
1370
1381
|
scrollTo(x2, void 0);
|
|
1371
1382
|
}
|
|
1372
1383
|
});
|
|
1373
|
-
const y =
|
|
1384
|
+
const y = vue.computed({
|
|
1374
1385
|
get() {
|
|
1375
1386
|
return internalY.value;
|
|
1376
1387
|
},
|
|
@@ -1396,14 +1407,14 @@ function useScroll(element, options = {}) {
|
|
|
1396
1407
|
if (y != null)
|
|
1397
1408
|
internalY.value = scrollContainer.scrollTop;
|
|
1398
1409
|
}
|
|
1399
|
-
const isScrolling =
|
|
1400
|
-
const arrivedState =
|
|
1410
|
+
const isScrolling = vue.ref(false);
|
|
1411
|
+
const arrivedState = vue.reactive({
|
|
1401
1412
|
left: true,
|
|
1402
1413
|
right: false,
|
|
1403
1414
|
top: true,
|
|
1404
1415
|
bottom: false
|
|
1405
1416
|
});
|
|
1406
|
-
const directions =
|
|
1417
|
+
const directions = vue.reactive({
|
|
1407
1418
|
left: false,
|
|
1408
1419
|
right: false,
|
|
1409
1420
|
top: false,
|
|
@@ -1508,7 +1519,7 @@ function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
|
1508
1519
|
interval = 100,
|
|
1509
1520
|
canLoadMore = () => true
|
|
1510
1521
|
} = options;
|
|
1511
|
-
const state =
|
|
1522
|
+
const state = vue.reactive(useScroll(
|
|
1512
1523
|
element,
|
|
1513
1524
|
{
|
|
1514
1525
|
...options,
|
|
@@ -1518,9 +1529,9 @@ function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
|
1518
1529
|
}
|
|
1519
1530
|
}
|
|
1520
1531
|
));
|
|
1521
|
-
const promise =
|
|
1522
|
-
const isLoading =
|
|
1523
|
-
const observedElement =
|
|
1532
|
+
const promise = vue.ref();
|
|
1533
|
+
const isLoading = vue.computed(() => !!promise.value);
|
|
1534
|
+
const observedElement = vue.computed(() => {
|
|
1524
1535
|
return resolveElement(shared.toValue(element));
|
|
1525
1536
|
});
|
|
1526
1537
|
const isElementVisible = useElementVisibility(observedElement);
|
|
@@ -1537,12 +1548,12 @@ function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
|
1537
1548
|
new Promise((resolve) => setTimeout(resolve, interval))
|
|
1538
1549
|
]).finally(() => {
|
|
1539
1550
|
promise.value = null;
|
|
1540
|
-
|
|
1551
|
+
vue.nextTick(() => checkAndLoad());
|
|
1541
1552
|
});
|
|
1542
1553
|
}
|
|
1543
1554
|
}
|
|
1544
1555
|
}
|
|
1545
|
-
const stop =
|
|
1556
|
+
const stop = vue.watch(
|
|
1546
1557
|
() => [state.arrivedState[direction], isElementVisible.value],
|
|
1547
1558
|
checkAndLoad,
|
|
1548
1559
|
{ immediate: true }
|
|
@@ -1551,13 +1562,13 @@ function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
|
1551
1562
|
return {
|
|
1552
1563
|
isLoading,
|
|
1553
1564
|
reset() {
|
|
1554
|
-
|
|
1565
|
+
vue.nextTick(() => checkAndLoad());
|
|
1555
1566
|
}
|
|
1556
1567
|
};
|
|
1557
1568
|
}
|
|
1558
1569
|
|
|
1559
1570
|
const vInfiniteScroll = {
|
|
1560
|
-
|
|
1571
|
+
mounted(el, binding) {
|
|
1561
1572
|
if (typeof binding.value === "function")
|
|
1562
1573
|
useInfiniteScroll(el, binding.value);
|
|
1563
1574
|
else
|
|
@@ -1566,7 +1577,7 @@ const vInfiniteScroll = {
|
|
|
1566
1577
|
};
|
|
1567
1578
|
|
|
1568
1579
|
const vIntersectionObserver = {
|
|
1569
|
-
|
|
1580
|
+
mounted(el, binding) {
|
|
1570
1581
|
if (typeof binding.value === "function")
|
|
1571
1582
|
useIntersectionObserver(el, binding.value);
|
|
1572
1583
|
else
|
|
@@ -1574,11 +1585,11 @@ const vIntersectionObserver = {
|
|
|
1574
1585
|
}
|
|
1575
1586
|
};
|
|
1576
1587
|
|
|
1577
|
-
const UseMouse = /* @__PURE__ */ /* #__PURE__ */
|
|
1588
|
+
const UseMouse = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1578
1589
|
name: "UseMouse",
|
|
1579
1590
|
props: ["touch", "resetOnTouchEnds", "initialValue"],
|
|
1580
1591
|
setup(props, { slots }) {
|
|
1581
|
-
const data =
|
|
1592
|
+
const data = vue.reactive(core.useMouse(props));
|
|
1582
1593
|
return () => {
|
|
1583
1594
|
if (slots.default)
|
|
1584
1595
|
return slots.default(data);
|
|
@@ -1586,36 +1597,36 @@ const UseMouse = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1586
1597
|
}
|
|
1587
1598
|
});
|
|
1588
1599
|
|
|
1589
|
-
const UseMouseInElement = /* @__PURE__ */ /* #__PURE__ */
|
|
1600
|
+
const UseMouseInElement = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1590
1601
|
name: "UseMouseElement",
|
|
1591
1602
|
props: ["handleOutside", "as"],
|
|
1592
1603
|
setup(props, { slots }) {
|
|
1593
|
-
const target =
|
|
1594
|
-
const data =
|
|
1604
|
+
const target = vue.ref();
|
|
1605
|
+
const data = vue.reactive(core.useMouseInElement(target, props));
|
|
1595
1606
|
return () => {
|
|
1596
1607
|
if (slots.default)
|
|
1597
|
-
return
|
|
1608
|
+
return vue.h(props.as || "div", { ref: target }, slots.default(data));
|
|
1598
1609
|
};
|
|
1599
1610
|
}
|
|
1600
1611
|
});
|
|
1601
1612
|
|
|
1602
|
-
const UseMousePressed = /* @__PURE__ */ /* #__PURE__ */
|
|
1613
|
+
const UseMousePressed = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1603
1614
|
name: "UseMousePressed",
|
|
1604
1615
|
props: ["touch", "initialValue", "as"],
|
|
1605
1616
|
setup(props, { slots }) {
|
|
1606
|
-
const target =
|
|
1607
|
-
const data =
|
|
1617
|
+
const target = vue.ref();
|
|
1618
|
+
const data = vue.reactive(core.useMousePressed({ ...props, target }));
|
|
1608
1619
|
return () => {
|
|
1609
1620
|
if (slots.default)
|
|
1610
|
-
return
|
|
1621
|
+
return vue.h(props.as || "div", { ref: target }, slots.default(data));
|
|
1611
1622
|
};
|
|
1612
1623
|
}
|
|
1613
1624
|
});
|
|
1614
1625
|
|
|
1615
|
-
const UseNetwork = /* @__PURE__ */ /* #__PURE__ */
|
|
1626
|
+
const UseNetwork = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1616
1627
|
name: "UseNetwork",
|
|
1617
1628
|
setup(props, { slots }) {
|
|
1618
|
-
const data =
|
|
1629
|
+
const data = vue.reactive(core.useNetwork());
|
|
1619
1630
|
return () => {
|
|
1620
1631
|
if (slots.default)
|
|
1621
1632
|
return slots.default(data);
|
|
@@ -1623,11 +1634,11 @@ const UseNetwork = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1623
1634
|
}
|
|
1624
1635
|
});
|
|
1625
1636
|
|
|
1626
|
-
const UseNow = /* @__PURE__ */ /* #__PURE__ */
|
|
1637
|
+
const UseNow = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1627
1638
|
name: "UseNow",
|
|
1628
1639
|
props: ["interval"],
|
|
1629
1640
|
setup(props, { slots }) {
|
|
1630
|
-
const data =
|
|
1641
|
+
const data = vue.reactive(core.useNow({ ...props, controls: true }));
|
|
1631
1642
|
return () => {
|
|
1632
1643
|
if (slots.default)
|
|
1633
1644
|
return slots.default(data);
|
|
@@ -1635,7 +1646,7 @@ const UseNow = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1635
1646
|
}
|
|
1636
1647
|
});
|
|
1637
1648
|
|
|
1638
|
-
const UseObjectUrl = /* @__PURE__ */ /* #__PURE__ */
|
|
1649
|
+
const UseObjectUrl = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1639
1650
|
name: "UseObjectUrl",
|
|
1640
1651
|
props: [
|
|
1641
1652
|
"object"
|
|
@@ -1650,7 +1661,7 @@ const UseObjectUrl = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1650
1661
|
}
|
|
1651
1662
|
});
|
|
1652
1663
|
|
|
1653
|
-
const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */
|
|
1664
|
+
const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1654
1665
|
name: "UseOffsetPagination",
|
|
1655
1666
|
props: [
|
|
1656
1667
|
"total",
|
|
@@ -1666,7 +1677,7 @@ const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineCompon
|
|
|
1666
1677
|
"page-count-change"
|
|
1667
1678
|
],
|
|
1668
1679
|
setup(props, { slots, emit }) {
|
|
1669
|
-
const data =
|
|
1680
|
+
const data = vue.reactive(core.useOffsetPagination({
|
|
1670
1681
|
...props,
|
|
1671
1682
|
onPageChange(...args) {
|
|
1672
1683
|
var _a;
|
|
@@ -1691,10 +1702,10 @@ const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineCompon
|
|
|
1691
1702
|
}
|
|
1692
1703
|
});
|
|
1693
1704
|
|
|
1694
|
-
const UseOnline = /* @__PURE__ */ /* #__PURE__ */
|
|
1705
|
+
const UseOnline = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1695
1706
|
name: "UseOnline",
|
|
1696
1707
|
setup(props, { slots }) {
|
|
1697
|
-
const data =
|
|
1708
|
+
const data = vue.reactive({
|
|
1698
1709
|
isOnline: core.useOnline()
|
|
1699
1710
|
});
|
|
1700
1711
|
return () => {
|
|
@@ -1704,10 +1715,10 @@ const UseOnline = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1704
1715
|
}
|
|
1705
1716
|
});
|
|
1706
1717
|
|
|
1707
|
-
const UsePageLeave = /* @__PURE__ */ /* #__PURE__ */
|
|
1718
|
+
const UsePageLeave = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1708
1719
|
name: "UsePageLeave",
|
|
1709
1720
|
setup(props, { slots }) {
|
|
1710
|
-
const data =
|
|
1721
|
+
const data = vue.reactive({
|
|
1711
1722
|
isLeft: core.usePageLeave()
|
|
1712
1723
|
});
|
|
1713
1724
|
return () => {
|
|
@@ -1717,7 +1728,7 @@ const UsePageLeave = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1717
1728
|
}
|
|
1718
1729
|
});
|
|
1719
1730
|
|
|
1720
|
-
const UsePointer = /* @__PURE__ */ /* #__PURE__ */
|
|
1731
|
+
const UsePointer = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1721
1732
|
name: "UsePointer",
|
|
1722
1733
|
props: [
|
|
1723
1734
|
"pointerTypes",
|
|
@@ -1725,8 +1736,8 @@ const UsePointer = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1725
1736
|
"target"
|
|
1726
1737
|
],
|
|
1727
1738
|
setup(props, { slots }) {
|
|
1728
|
-
const el =
|
|
1729
|
-
const data =
|
|
1739
|
+
const el = vue.ref(null);
|
|
1740
|
+
const data = vue.reactive(core.usePointer({
|
|
1730
1741
|
...props,
|
|
1731
1742
|
target: props.target === "self" ? el : defaultWindow
|
|
1732
1743
|
}));
|
|
@@ -1737,23 +1748,23 @@ const UsePointer = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1737
1748
|
}
|
|
1738
1749
|
});
|
|
1739
1750
|
|
|
1740
|
-
const UsePointerLock = /* #__PURE__ */
|
|
1751
|
+
const UsePointerLock = /* #__PURE__ */ vue.defineComponent({
|
|
1741
1752
|
name: "UsePointerLock",
|
|
1742
1753
|
props: ["as"],
|
|
1743
1754
|
setup(props, { slots }) {
|
|
1744
|
-
const target =
|
|
1745
|
-
const data =
|
|
1755
|
+
const target = vue.ref();
|
|
1756
|
+
const data = vue.reactive(core.usePointerLock(target));
|
|
1746
1757
|
return () => {
|
|
1747
1758
|
if (slots.default)
|
|
1748
|
-
return
|
|
1759
|
+
return vue.h(props.as || "div", { ref: target }, slots.default(data));
|
|
1749
1760
|
};
|
|
1750
1761
|
}
|
|
1751
1762
|
});
|
|
1752
1763
|
|
|
1753
|
-
const UsePreferredColorScheme = /* @__PURE__ */ /* #__PURE__ */
|
|
1764
|
+
const UsePreferredColorScheme = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1754
1765
|
name: "UsePreferredColorScheme",
|
|
1755
1766
|
setup(props, { slots }) {
|
|
1756
|
-
const data =
|
|
1767
|
+
const data = vue.reactive({
|
|
1757
1768
|
colorScheme: core.usePreferredColorScheme()
|
|
1758
1769
|
});
|
|
1759
1770
|
return () => {
|
|
@@ -1763,10 +1774,10 @@ const UsePreferredColorScheme = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineCo
|
|
|
1763
1774
|
}
|
|
1764
1775
|
});
|
|
1765
1776
|
|
|
1766
|
-
const UsePreferredContrast = /* @__PURE__ */ /* #__PURE__ */
|
|
1777
|
+
const UsePreferredContrast = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1767
1778
|
name: "UsePreferredContrast",
|
|
1768
1779
|
setup(props, { slots }) {
|
|
1769
|
-
const data =
|
|
1780
|
+
const data = vue.reactive({
|
|
1770
1781
|
contrast: core.usePreferredContrast()
|
|
1771
1782
|
});
|
|
1772
1783
|
return () => {
|
|
@@ -1776,10 +1787,10 @@ const UsePreferredContrast = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineCompo
|
|
|
1776
1787
|
}
|
|
1777
1788
|
});
|
|
1778
1789
|
|
|
1779
|
-
const UsePreferredDark = /* @__PURE__ */ /* #__PURE__ */
|
|
1790
|
+
const UsePreferredDark = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1780
1791
|
name: "UsePreferredDark",
|
|
1781
1792
|
setup(props, { slots }) {
|
|
1782
|
-
const data =
|
|
1793
|
+
const data = vue.reactive({
|
|
1783
1794
|
prefersDark: core.usePreferredDark()
|
|
1784
1795
|
});
|
|
1785
1796
|
return () => {
|
|
@@ -1789,10 +1800,10 @@ const UsePreferredDark = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent
|
|
|
1789
1800
|
}
|
|
1790
1801
|
});
|
|
1791
1802
|
|
|
1792
|
-
const UsePreferredLanguages = /* @__PURE__ */ /* #__PURE__ */
|
|
1803
|
+
const UsePreferredLanguages = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1793
1804
|
name: "UsePreferredLanguages",
|
|
1794
1805
|
setup(props, { slots }) {
|
|
1795
|
-
const data =
|
|
1806
|
+
const data = vue.reactive({
|
|
1796
1807
|
languages: core.usePreferredLanguages()
|
|
1797
1808
|
});
|
|
1798
1809
|
return () => {
|
|
@@ -1802,10 +1813,10 @@ const UsePreferredLanguages = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComp
|
|
|
1802
1813
|
}
|
|
1803
1814
|
});
|
|
1804
1815
|
|
|
1805
|
-
const UsePreferredReducedMotion = /* @__PURE__ */ /* #__PURE__ */
|
|
1816
|
+
const UsePreferredReducedMotion = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1806
1817
|
name: "UsePreferredReducedMotion",
|
|
1807
1818
|
setup(props, { slots }) {
|
|
1808
|
-
const data =
|
|
1819
|
+
const data = vue.reactive({
|
|
1809
1820
|
motion: core.usePreferredReducedMotion()
|
|
1810
1821
|
});
|
|
1811
1822
|
return () => {
|
|
@@ -1816,7 +1827,7 @@ const UsePreferredReducedMotion = /* @__PURE__ */ /* #__PURE__ */ vueDemi.define
|
|
|
1816
1827
|
});
|
|
1817
1828
|
|
|
1818
1829
|
const vResizeObserver = {
|
|
1819
|
-
|
|
1830
|
+
mounted(el, binding) {
|
|
1820
1831
|
if (typeof binding.value === "function")
|
|
1821
1832
|
useResizeObserver(el, binding.value);
|
|
1822
1833
|
else
|
|
@@ -1834,12 +1845,12 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1834
1845
|
observer = void 0;
|
|
1835
1846
|
}
|
|
1836
1847
|
};
|
|
1837
|
-
const targets =
|
|
1848
|
+
const targets = vue.computed(() => {
|
|
1838
1849
|
const value = shared.toValue(target);
|
|
1839
1850
|
const items = (Array.isArray(value) ? value : [value]).map(unrefElement).filter(shared.notNullish);
|
|
1840
1851
|
return new Set(items);
|
|
1841
1852
|
});
|
|
1842
|
-
const stopWatch =
|
|
1853
|
+
const stopWatch = vue.watch(
|
|
1843
1854
|
() => targets.value,
|
|
1844
1855
|
(targets2) => {
|
|
1845
1856
|
cleanup();
|
|
@@ -1867,8 +1878,8 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1867
1878
|
|
|
1868
1879
|
function useCssVar(prop, target, options = {}) {
|
|
1869
1880
|
const { window = defaultWindow, initialValue, observe = false } = options;
|
|
1870
|
-
const variable =
|
|
1871
|
-
const elRef =
|
|
1881
|
+
const variable = vue.ref(initialValue);
|
|
1882
|
+
const elRef = vue.computed(() => {
|
|
1872
1883
|
var _a;
|
|
1873
1884
|
return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
|
|
1874
1885
|
});
|
|
@@ -1887,7 +1898,7 @@ function useCssVar(prop, target, options = {}) {
|
|
|
1887
1898
|
window
|
|
1888
1899
|
});
|
|
1889
1900
|
}
|
|
1890
|
-
|
|
1901
|
+
vue.watch(
|
|
1891
1902
|
[elRef, () => shared.toValue(prop)],
|
|
1892
1903
|
(_, old) => {
|
|
1893
1904
|
if (old[0] && old[1])
|
|
@@ -1896,7 +1907,7 @@ function useCssVar(prop, target, options = {}) {
|
|
|
1896
1907
|
},
|
|
1897
1908
|
{ immediate: true }
|
|
1898
1909
|
);
|
|
1899
|
-
|
|
1910
|
+
vue.watch(
|
|
1900
1911
|
variable,
|
|
1901
1912
|
(val) => {
|
|
1902
1913
|
var _a;
|
|
@@ -1917,10 +1928,10 @@ const rightVarName = "--vueuse-safe-area-right";
|
|
|
1917
1928
|
const bottomVarName = "--vueuse-safe-area-bottom";
|
|
1918
1929
|
const leftVarName = "--vueuse-safe-area-left";
|
|
1919
1930
|
function useScreenSafeArea() {
|
|
1920
|
-
const top =
|
|
1921
|
-
const right =
|
|
1922
|
-
const bottom =
|
|
1923
|
-
const left =
|
|
1931
|
+
const top = vue.ref("");
|
|
1932
|
+
const right = vue.ref("");
|
|
1933
|
+
const bottom = vue.ref("");
|
|
1934
|
+
const left = vue.ref("");
|
|
1924
1935
|
if (shared.isClient) {
|
|
1925
1936
|
const topCssVar = useCssVar(topVarName);
|
|
1926
1937
|
const rightCssVar = useCssVar(rightVarName);
|
|
@@ -1951,7 +1962,7 @@ function getValue(position) {
|
|
|
1951
1962
|
return getComputedStyle(document.documentElement).getPropertyValue(position);
|
|
1952
1963
|
}
|
|
1953
1964
|
|
|
1954
|
-
const UseScreenSafeArea = /* @__PURE__ */ /* #__PURE__ */
|
|
1965
|
+
const UseScreenSafeArea = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
1955
1966
|
name: "UseScreenSafeArea",
|
|
1956
1967
|
props: {
|
|
1957
1968
|
top: Boolean,
|
|
@@ -1968,7 +1979,7 @@ const UseScreenSafeArea = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponen
|
|
|
1968
1979
|
} = useScreenSafeArea();
|
|
1969
1980
|
return () => {
|
|
1970
1981
|
if (slots.default) {
|
|
1971
|
-
return
|
|
1982
|
+
return vue.h("div", {
|
|
1972
1983
|
style: {
|
|
1973
1984
|
paddingTop: props.top ? top.value : "",
|
|
1974
1985
|
paddingRight: props.right ? right.value : "",
|
|
@@ -1986,7 +1997,7 @@ const UseScreenSafeArea = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponen
|
|
|
1986
1997
|
});
|
|
1987
1998
|
|
|
1988
1999
|
const vScroll = {
|
|
1989
|
-
|
|
2000
|
+
mounted(el, binding) {
|
|
1990
2001
|
if (typeof binding.value === "function") {
|
|
1991
2002
|
const handler = binding.value;
|
|
1992
2003
|
const state = useScroll(el, {
|
|
@@ -2040,10 +2051,10 @@ function preventDefault(rawEvent) {
|
|
|
2040
2051
|
}
|
|
2041
2052
|
const elInitialOverflow = /* @__PURE__ */ new WeakMap();
|
|
2042
2053
|
function useScrollLock(element, initialState = false) {
|
|
2043
|
-
const isLocked =
|
|
2054
|
+
const isLocked = vue.ref(initialState);
|
|
2044
2055
|
let stopTouchMoveListener = null;
|
|
2045
2056
|
let initialOverflow = "";
|
|
2046
|
-
|
|
2057
|
+
vue.watch(shared.toRef(element), (el) => {
|
|
2047
2058
|
const target = resolveElement(shared.toValue(el));
|
|
2048
2059
|
if (target) {
|
|
2049
2060
|
const ele = target;
|
|
@@ -2087,7 +2098,7 @@ function useScrollLock(element, initialState = false) {
|
|
|
2087
2098
|
isLocked.value = false;
|
|
2088
2099
|
};
|
|
2089
2100
|
shared.tryOnScopeDispose(unlock);
|
|
2090
|
-
return
|
|
2101
|
+
return vue.computed({
|
|
2091
2102
|
get() {
|
|
2092
2103
|
return isLocked.value;
|
|
2093
2104
|
},
|
|
@@ -2101,23 +2112,23 @@ function useScrollLock(element, initialState = false) {
|
|
|
2101
2112
|
|
|
2102
2113
|
function onScrollLock() {
|
|
2103
2114
|
let isMounted = false;
|
|
2104
|
-
const state =
|
|
2115
|
+
const state = vue.ref(false);
|
|
2105
2116
|
return (el, binding) => {
|
|
2106
2117
|
state.value = binding.value;
|
|
2107
2118
|
if (isMounted)
|
|
2108
2119
|
return;
|
|
2109
2120
|
isMounted = true;
|
|
2110
2121
|
const isLocked = useScrollLock(el, binding.value);
|
|
2111
|
-
|
|
2122
|
+
vue.watch(state, (v) => isLocked.value = v);
|
|
2112
2123
|
};
|
|
2113
2124
|
}
|
|
2114
2125
|
const vScrollLock = onScrollLock();
|
|
2115
2126
|
|
|
2116
|
-
const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */
|
|
2127
|
+
const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
2117
2128
|
name: "UseTimeAgo",
|
|
2118
2129
|
props: ["time", "updateInterval", "max", "fullDateFormatter", "messages", "showSecond"],
|
|
2119
2130
|
setup(props, { slots }) {
|
|
2120
|
-
const data =
|
|
2131
|
+
const data = vue.reactive(core.useTimeAgo(() => props.time, { ...props, controls: true }));
|
|
2121
2132
|
return () => {
|
|
2122
2133
|
if (slots.default)
|
|
2123
2134
|
return slots.default(data);
|
|
@@ -2125,11 +2136,11 @@ const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
2125
2136
|
}
|
|
2126
2137
|
});
|
|
2127
2138
|
|
|
2128
|
-
const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */
|
|
2139
|
+
const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
2129
2140
|
name: "UseTimestamp",
|
|
2130
2141
|
props: ["immediate", "interval", "offset"],
|
|
2131
2142
|
setup(props, { slots }) {
|
|
2132
|
-
const data =
|
|
2143
|
+
const data = vue.reactive(core.useTimestamp({ ...props, controls: true }));
|
|
2133
2144
|
return () => {
|
|
2134
2145
|
if (slots.default)
|
|
2135
2146
|
return slots.default(data);
|
|
@@ -2137,7 +2148,7 @@ const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
2137
2148
|
}
|
|
2138
2149
|
});
|
|
2139
2150
|
|
|
2140
|
-
const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */
|
|
2151
|
+
const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
2141
2152
|
name: "UseVirtualList",
|
|
2142
2153
|
props: [
|
|
2143
2154
|
"list",
|
|
@@ -2145,21 +2156,21 @@ const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
2145
2156
|
"height"
|
|
2146
2157
|
],
|
|
2147
2158
|
setup(props, { slots, expose }) {
|
|
2148
|
-
const { list: listRef } =
|
|
2159
|
+
const { list: listRef } = vue.toRefs(props);
|
|
2149
2160
|
const { list, containerProps, wrapperProps, scrollTo } = core.useVirtualList(listRef, props.options);
|
|
2150
2161
|
expose({ scrollTo });
|
|
2151
2162
|
if (containerProps.style && typeof containerProps.style === "object" && !Array.isArray(containerProps.style))
|
|
2152
2163
|
containerProps.style.height = props.height || "300px";
|
|
2153
|
-
return () =>
|
|
2154
|
-
|
|
2164
|
+
return () => vue.h("div", { ...containerProps }, [
|
|
2165
|
+
vue.h("div", { ...wrapperProps.value }, list.value.map((item) => vue.h("div", { style: { overflow: "hidden", height: item.height } }, slots.default ? slots.default(item) : "Please set content!")))
|
|
2155
2166
|
]);
|
|
2156
2167
|
}
|
|
2157
2168
|
});
|
|
2158
2169
|
|
|
2159
|
-
const UseWindowFocus = /* @__PURE__ */ /* #__PURE__ */
|
|
2170
|
+
const UseWindowFocus = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
2160
2171
|
name: "UseWindowFocus",
|
|
2161
2172
|
setup(props, { slots }) {
|
|
2162
|
-
const data =
|
|
2173
|
+
const data = vue.reactive({
|
|
2163
2174
|
focused: core.useWindowFocus()
|
|
2164
2175
|
});
|
|
2165
2176
|
return () => {
|
|
@@ -2169,11 +2180,11 @@ const UseWindowFocus = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
2169
2180
|
}
|
|
2170
2181
|
});
|
|
2171
2182
|
|
|
2172
|
-
const UseWindowSize = /* @__PURE__ */ /* #__PURE__ */
|
|
2183
|
+
const UseWindowSize = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
2173
2184
|
name: "UseWindowSize",
|
|
2174
2185
|
props: ["initialWidth", "initialHeight"],
|
|
2175
2186
|
setup(props, { slots }) {
|
|
2176
|
-
const data =
|
|
2187
|
+
const data = vue.reactive(core.useWindowSize(props));
|
|
2177
2188
|
return () => {
|
|
2178
2189
|
if (slots.default)
|
|
2179
2190
|
return slots.default(data);
|