@vueuse/components 13.8.0 → 14.0.0-alpha.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.d.mts +412 -753
- package/index.iife.js +631 -2109
- package/index.iife.min.js +1 -1
- package/index.mjs +614 -2092
- package/package.json +3 -3
package/index.mjs
CHANGED
|
@@ -1,170 +1,24 @@
|
|
|
1
|
-
import { onClickOutside
|
|
2
|
-
import { defineComponent, shallowRef, h,
|
|
3
|
-
import {
|
|
1
|
+
import { onClickOutside, onKeyStroke, onLongPress, useActiveElement, useBattery, useBrowserLocation, useClipboard, useColorMode, useDark, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDocumentVisibility, useStorage, isClient, useDraggable, useElementBounding, useElementHover, useElementSize, useElementVisibility, useEyeDropper, useFullscreen, useGeolocation, useIdle, useImage, useInfiniteScroll, useIntersectionObserver, useMouse, useMouseInElement, useMousePressed, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, usePointer, defaultWindow, usePointerLock, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePreferredReducedMotion, usePreferredReducedTransparency, useResizeObserver, useScreenSafeArea, useScroll, useScrollLock, useTimeAgo, useTimestamp, useVirtualList, useWindowFocus, useWindowSize } from '@vueuse/core';
|
|
2
|
+
import { defineComponent, shallowRef, h, reactive, computed, toValue, watch, toRefs } from 'vue';
|
|
3
|
+
import { useToggle, reactiveOmit, toRefs as toRefs$1 } from '@vueuse/shared';
|
|
4
4
|
|
|
5
|
-
const OnClickOutside = /* @__PURE__ */ defineComponent(
|
|
6
|
-
|
|
7
|
-
props: ["as", "options"],
|
|
8
|
-
emits: ["trigger"],
|
|
9
|
-
setup(props, { slots, emit }) {
|
|
5
|
+
const OnClickOutside = /* @__PURE__ */ defineComponent(
|
|
6
|
+
(props, { slots, emit }) => {
|
|
10
7
|
const target = shallowRef();
|
|
11
|
-
onClickOutside
|
|
8
|
+
onClickOutside(target, (e) => {
|
|
12
9
|
emit("trigger", e);
|
|
13
10
|
}, props.options);
|
|
14
11
|
return () => {
|
|
15
12
|
if (slots.default)
|
|
16
13
|
return h(props.as || "div", { ref: target }, slots.default());
|
|
17
14
|
};
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "OnClickOutside",
|
|
18
|
+
props: ["as", "options"],
|
|
19
|
+
emits: ["trigger"]
|
|
18
20
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const defaultWindow = isClient ? window : void 0;
|
|
22
|
-
|
|
23
|
-
function unrefElement(elRef) {
|
|
24
|
-
var _a;
|
|
25
|
-
const plain = toValue(elRef);
|
|
26
|
-
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function useEventListener(...args) {
|
|
30
|
-
const cleanups = [];
|
|
31
|
-
const cleanup = () => {
|
|
32
|
-
cleanups.forEach((fn) => fn());
|
|
33
|
-
cleanups.length = 0;
|
|
34
|
-
};
|
|
35
|
-
const register = (el, event, listener, options) => {
|
|
36
|
-
el.addEventListener(event, listener, options);
|
|
37
|
-
return () => el.removeEventListener(event, listener, options);
|
|
38
|
-
};
|
|
39
|
-
const firstParamTargets = computed(() => {
|
|
40
|
-
const test = toArray(toValue(args[0])).filter((e) => e != null);
|
|
41
|
-
return test.every((e) => typeof e !== "string") ? test : void 0;
|
|
42
|
-
});
|
|
43
|
-
const stopWatch = watchImmediate(
|
|
44
|
-
() => {
|
|
45
|
-
var _a, _b;
|
|
46
|
-
return [
|
|
47
|
-
(_b = (_a = firstParamTargets.value) == null ? void 0 : _a.map((e) => unrefElement(e))) != null ? _b : [defaultWindow].filter((e) => e != null),
|
|
48
|
-
toArray(toValue(firstParamTargets.value ? args[1] : args[0])),
|
|
49
|
-
toArray(unref(firstParamTargets.value ? args[2] : args[1])),
|
|
50
|
-
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
51
|
-
toValue(firstParamTargets.value ? args[3] : args[2])
|
|
52
|
-
];
|
|
53
|
-
},
|
|
54
|
-
([raw_targets, raw_events, raw_listeners, raw_options]) => {
|
|
55
|
-
cleanup();
|
|
56
|
-
if (!(raw_targets == null ? void 0 : raw_targets.length) || !(raw_events == null ? void 0 : raw_events.length) || !(raw_listeners == null ? void 0 : raw_listeners.length))
|
|
57
|
-
return;
|
|
58
|
-
const optionsClone = isObject(raw_options) ? { ...raw_options } : raw_options;
|
|
59
|
-
cleanups.push(
|
|
60
|
-
...raw_targets.flatMap(
|
|
61
|
-
(el) => raw_events.flatMap(
|
|
62
|
-
(event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone))
|
|
63
|
-
)
|
|
64
|
-
)
|
|
65
|
-
);
|
|
66
|
-
},
|
|
67
|
-
{ flush: "post" }
|
|
68
|
-
);
|
|
69
|
-
const stop = () => {
|
|
70
|
-
stopWatch();
|
|
71
|
-
cleanup();
|
|
72
|
-
};
|
|
73
|
-
tryOnScopeDispose(cleanup);
|
|
74
|
-
return stop;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
let _iOSWorkaround = false;
|
|
78
|
-
function onClickOutside(target, handler, options = {}) {
|
|
79
|
-
const { window = defaultWindow, ignore = [], capture = true, detectIframe = false, controls = false } = options;
|
|
80
|
-
if (!window) {
|
|
81
|
-
return controls ? { stop: noop, cancel: noop, trigger: noop } : noop;
|
|
82
|
-
}
|
|
83
|
-
if (isIOS && !_iOSWorkaround) {
|
|
84
|
-
_iOSWorkaround = true;
|
|
85
|
-
const listenerOptions = { passive: true };
|
|
86
|
-
Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", noop, listenerOptions));
|
|
87
|
-
window.document.documentElement.addEventListener("click", noop, listenerOptions);
|
|
88
|
-
}
|
|
89
|
-
let shouldListen = true;
|
|
90
|
-
const shouldIgnore = (event) => {
|
|
91
|
-
return toValue(ignore).some((target2) => {
|
|
92
|
-
if (typeof target2 === "string") {
|
|
93
|
-
return Array.from(window.document.querySelectorAll(target2)).some((el) => el === event.target || event.composedPath().includes(el));
|
|
94
|
-
} else {
|
|
95
|
-
const el = unrefElement(target2);
|
|
96
|
-
return el && (event.target === el || event.composedPath().includes(el));
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
function hasMultipleRoots(target2) {
|
|
101
|
-
const vm = toValue(target2);
|
|
102
|
-
return vm && vm.$.subTree.shapeFlag === 16;
|
|
103
|
-
}
|
|
104
|
-
function checkMultipleRoots(target2, event) {
|
|
105
|
-
const vm = toValue(target2);
|
|
106
|
-
const children = vm.$.subTree && vm.$.subTree.children;
|
|
107
|
-
if (children == null || !Array.isArray(children))
|
|
108
|
-
return false;
|
|
109
|
-
return children.some((child) => child.el === event.target || event.composedPath().includes(child.el));
|
|
110
|
-
}
|
|
111
|
-
const listener = (event) => {
|
|
112
|
-
const el = unrefElement(target);
|
|
113
|
-
if (event.target == null)
|
|
114
|
-
return;
|
|
115
|
-
if (!(el instanceof Element) && hasMultipleRoots(target) && checkMultipleRoots(target, event))
|
|
116
|
-
return;
|
|
117
|
-
if (!el || el === event.target || event.composedPath().includes(el))
|
|
118
|
-
return;
|
|
119
|
-
if ("detail" in event && event.detail === 0)
|
|
120
|
-
shouldListen = !shouldIgnore(event);
|
|
121
|
-
if (!shouldListen) {
|
|
122
|
-
shouldListen = true;
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
handler(event);
|
|
126
|
-
};
|
|
127
|
-
let isProcessingClick = false;
|
|
128
|
-
const cleanup = [
|
|
129
|
-
useEventListener(window, "click", (event) => {
|
|
130
|
-
if (!isProcessingClick) {
|
|
131
|
-
isProcessingClick = true;
|
|
132
|
-
setTimeout(() => {
|
|
133
|
-
isProcessingClick = false;
|
|
134
|
-
}, 0);
|
|
135
|
-
listener(event);
|
|
136
|
-
}
|
|
137
|
-
}, { passive: true, capture }),
|
|
138
|
-
useEventListener(window, "pointerdown", (e) => {
|
|
139
|
-
const el = unrefElement(target);
|
|
140
|
-
shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));
|
|
141
|
-
}, { passive: true }),
|
|
142
|
-
detectIframe && useEventListener(window, "blur", (event) => {
|
|
143
|
-
setTimeout(() => {
|
|
144
|
-
var _a;
|
|
145
|
-
const el = unrefElement(target);
|
|
146
|
-
if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement))) {
|
|
147
|
-
handler(event);
|
|
148
|
-
}
|
|
149
|
-
}, 0);
|
|
150
|
-
}, { passive: true })
|
|
151
|
-
].filter(Boolean);
|
|
152
|
-
const stop = () => cleanup.forEach((fn) => fn());
|
|
153
|
-
if (controls) {
|
|
154
|
-
return {
|
|
155
|
-
stop,
|
|
156
|
-
cancel: () => {
|
|
157
|
-
shouldListen = false;
|
|
158
|
-
},
|
|
159
|
-
trigger: (event) => {
|
|
160
|
-
shouldListen = true;
|
|
161
|
-
listener(event);
|
|
162
|
-
shouldListen = false;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
return stop;
|
|
167
|
-
}
|
|
21
|
+
);
|
|
168
22
|
|
|
169
23
|
const stopClickOutsideMap = /* @__PURE__ */ new WeakMap();
|
|
170
24
|
const vOnClickOutside = {
|
|
@@ -190,52 +44,6 @@ const vOnClickOutside = {
|
|
|
190
44
|
}
|
|
191
45
|
};
|
|
192
46
|
|
|
193
|
-
function createKeyPredicate(keyFilter) {
|
|
194
|
-
if (typeof keyFilter === "function")
|
|
195
|
-
return keyFilter;
|
|
196
|
-
else if (typeof keyFilter === "string")
|
|
197
|
-
return (event) => event.key === keyFilter;
|
|
198
|
-
else if (Array.isArray(keyFilter))
|
|
199
|
-
return (event) => keyFilter.includes(event.key);
|
|
200
|
-
return () => true;
|
|
201
|
-
}
|
|
202
|
-
function onKeyStroke(...args) {
|
|
203
|
-
let key;
|
|
204
|
-
let handler;
|
|
205
|
-
let options = {};
|
|
206
|
-
if (args.length === 3) {
|
|
207
|
-
key = args[0];
|
|
208
|
-
handler = args[1];
|
|
209
|
-
options = args[2];
|
|
210
|
-
} else if (args.length === 2) {
|
|
211
|
-
if (typeof args[1] === "object") {
|
|
212
|
-
key = true;
|
|
213
|
-
handler = args[0];
|
|
214
|
-
options = args[1];
|
|
215
|
-
} else {
|
|
216
|
-
key = args[0];
|
|
217
|
-
handler = args[1];
|
|
218
|
-
}
|
|
219
|
-
} else {
|
|
220
|
-
key = true;
|
|
221
|
-
handler = args[0];
|
|
222
|
-
}
|
|
223
|
-
const {
|
|
224
|
-
target = defaultWindow,
|
|
225
|
-
eventName = "keydown",
|
|
226
|
-
passive = false,
|
|
227
|
-
dedupe = false
|
|
228
|
-
} = options;
|
|
229
|
-
const predicate = createKeyPredicate(key);
|
|
230
|
-
const listener = (e) => {
|
|
231
|
-
if (e.repeat && toValue(dedupe))
|
|
232
|
-
return;
|
|
233
|
-
if (predicate(e))
|
|
234
|
-
handler(e);
|
|
235
|
-
};
|
|
236
|
-
return useEventListener(target, eventName, listener, passive);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
47
|
const vOnKeyStroke = {
|
|
240
48
|
mounted(el, binding) {
|
|
241
49
|
var _a, _b;
|
|
@@ -254,99 +62,10 @@ const vOnKeyStroke = {
|
|
|
254
62
|
}
|
|
255
63
|
};
|
|
256
64
|
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
function onLongPress(target, handler, options) {
|
|
260
|
-
var _a, _b;
|
|
261
|
-
const elementRef = computed(() => unrefElement(target));
|
|
262
|
-
let timeout;
|
|
263
|
-
let posStart;
|
|
264
|
-
let startTimestamp;
|
|
265
|
-
let hasLongPressed = false;
|
|
266
|
-
function clear() {
|
|
267
|
-
if (timeout) {
|
|
268
|
-
clearTimeout(timeout);
|
|
269
|
-
timeout = void 0;
|
|
270
|
-
}
|
|
271
|
-
posStart = void 0;
|
|
272
|
-
startTimestamp = void 0;
|
|
273
|
-
hasLongPressed = false;
|
|
274
|
-
}
|
|
275
|
-
function onRelease(ev) {
|
|
276
|
-
var _a2, _b2, _c;
|
|
277
|
-
const [_startTimestamp, _posStart, _hasLongPressed] = [startTimestamp, posStart, hasLongPressed];
|
|
278
|
-
clear();
|
|
279
|
-
if (!(options == null ? void 0 : options.onMouseUp) || !_posStart || !_startTimestamp)
|
|
280
|
-
return;
|
|
281
|
-
if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
|
|
282
|
-
return;
|
|
283
|
-
if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
|
|
284
|
-
ev.preventDefault();
|
|
285
|
-
if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
|
|
286
|
-
ev.stopPropagation();
|
|
287
|
-
const dx = ev.x - _posStart.x;
|
|
288
|
-
const dy = ev.y - _posStart.y;
|
|
289
|
-
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
290
|
-
options.onMouseUp(ev.timeStamp - _startTimestamp, distance, _hasLongPressed);
|
|
291
|
-
}
|
|
292
|
-
function onDown(ev) {
|
|
293
|
-
var _a2, _b2, _c, _d;
|
|
294
|
-
if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
|
|
295
|
-
return;
|
|
296
|
-
clear();
|
|
297
|
-
if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
|
|
298
|
-
ev.preventDefault();
|
|
299
|
-
if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
|
|
300
|
-
ev.stopPropagation();
|
|
301
|
-
posStart = {
|
|
302
|
-
x: ev.x,
|
|
303
|
-
y: ev.y
|
|
304
|
-
};
|
|
305
|
-
startTimestamp = ev.timeStamp;
|
|
306
|
-
timeout = setTimeout(
|
|
307
|
-
() => {
|
|
308
|
-
hasLongPressed = true;
|
|
309
|
-
handler(ev);
|
|
310
|
-
},
|
|
311
|
-
(_d = options == null ? void 0 : options.delay) != null ? _d : DEFAULT_DELAY
|
|
312
|
-
);
|
|
313
|
-
}
|
|
314
|
-
function onMove(ev) {
|
|
315
|
-
var _a2, _b2, _c, _d;
|
|
316
|
-
if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
|
|
317
|
-
return;
|
|
318
|
-
if (!posStart || (options == null ? void 0 : options.distanceThreshold) === false)
|
|
319
|
-
return;
|
|
320
|
-
if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
|
|
321
|
-
ev.preventDefault();
|
|
322
|
-
if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
|
|
323
|
-
ev.stopPropagation();
|
|
324
|
-
const dx = ev.x - posStart.x;
|
|
325
|
-
const dy = ev.y - posStart.y;
|
|
326
|
-
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
327
|
-
if (distance >= ((_d = options == null ? void 0 : options.distanceThreshold) != null ? _d : DEFAULT_THRESHOLD))
|
|
328
|
-
clear();
|
|
329
|
-
}
|
|
330
|
-
const listenerOptions = {
|
|
331
|
-
capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
|
|
332
|
-
once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
|
|
333
|
-
};
|
|
334
|
-
const cleanup = [
|
|
335
|
-
useEventListener(elementRef, "pointerdown", onDown, listenerOptions),
|
|
336
|
-
useEventListener(elementRef, "pointermove", onMove, listenerOptions),
|
|
337
|
-
useEventListener(elementRef, ["pointerup", "pointerleave"], onRelease, listenerOptions)
|
|
338
|
-
];
|
|
339
|
-
const stop = () => cleanup.forEach((fn) => fn());
|
|
340
|
-
return stop;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
const OnLongPress = /* @__PURE__ */ defineComponent({
|
|
344
|
-
name: "OnLongPress",
|
|
345
|
-
props: ["as", "options"],
|
|
346
|
-
emits: ["trigger"],
|
|
347
|
-
setup(props, { slots, emit }) {
|
|
65
|
+
const OnLongPress = /* @__PURE__ */ defineComponent(
|
|
66
|
+
(props, { slots, emit }) => {
|
|
348
67
|
const target = shallowRef();
|
|
349
|
-
onLongPress(
|
|
68
|
+
const data = onLongPress(
|
|
350
69
|
target,
|
|
351
70
|
(e) => {
|
|
352
71
|
emit("trigger", e);
|
|
@@ -355,10 +74,15 @@ const OnLongPress = /* @__PURE__ */ defineComponent({
|
|
|
355
74
|
);
|
|
356
75
|
return () => {
|
|
357
76
|
if (slots.default)
|
|
358
|
-
return h(props.as || "div", { ref: target }, slots.default());
|
|
77
|
+
return h(props.as || "div", { ref: target }, slots.default(data));
|
|
359
78
|
};
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "OnLongPress",
|
|
82
|
+
props: ["as", "options"],
|
|
83
|
+
emits: ["trigger"]
|
|
360
84
|
}
|
|
361
|
-
|
|
85
|
+
);
|
|
362
86
|
|
|
363
87
|
const vOnLongPress = {
|
|
364
88
|
mounted(el, binding) {
|
|
@@ -369,420 +93,77 @@ const vOnLongPress = {
|
|
|
369
93
|
}
|
|
370
94
|
};
|
|
371
95
|
|
|
372
|
-
const UseActiveElement = /* @__PURE__ */ defineComponent(
|
|
373
|
-
|
|
374
|
-
setup(props, { slots }) {
|
|
96
|
+
const UseActiveElement = /* @__PURE__ */ defineComponent(
|
|
97
|
+
(props, { slots }) => {
|
|
375
98
|
const data = reactive({
|
|
376
|
-
element: useActiveElement()
|
|
99
|
+
element: useActiveElement(props)
|
|
377
100
|
});
|
|
378
101
|
return () => {
|
|
379
102
|
if (slots.default)
|
|
380
103
|
return slots.default(data);
|
|
381
104
|
};
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "UseActiveElement",
|
|
108
|
+
props: [
|
|
109
|
+
"deep",
|
|
110
|
+
"triggerOnRemoval",
|
|
111
|
+
"window",
|
|
112
|
+
"document"
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const UseBattery = /* @__PURE__ */ defineComponent(
|
|
118
|
+
(props, { slots }) => {
|
|
388
119
|
const data = reactive(useBattery(props));
|
|
389
120
|
return () => {
|
|
390
121
|
if (slots.default)
|
|
391
122
|
return slots.default(data);
|
|
392
123
|
};
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "UseBattery",
|
|
127
|
+
props: ["navigator"]
|
|
393
128
|
}
|
|
394
|
-
|
|
129
|
+
);
|
|
395
130
|
|
|
396
|
-
const UseBrowserLocation = /* @__PURE__ */ defineComponent(
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
const data = reactive(useBrowserLocation());
|
|
131
|
+
const UseBrowserLocation = /* @__PURE__ */ defineComponent(
|
|
132
|
+
(props, { slots }) => {
|
|
133
|
+
const data = reactive(useBrowserLocation(props));
|
|
400
134
|
return () => {
|
|
401
135
|
if (slots.default)
|
|
402
136
|
return slots.default(data);
|
|
403
137
|
};
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "UseBrowserLocation",
|
|
141
|
+
props: ["window"]
|
|
404
142
|
}
|
|
405
|
-
|
|
143
|
+
);
|
|
406
144
|
|
|
407
|
-
const UseClipboard = /* @__PURE__ */ defineComponent(
|
|
408
|
-
|
|
409
|
-
props: [
|
|
410
|
-
"source",
|
|
411
|
-
"read",
|
|
412
|
-
"navigator",
|
|
413
|
-
"copiedDuring",
|
|
414
|
-
"legacy"
|
|
415
|
-
],
|
|
416
|
-
setup(props, { slots }) {
|
|
145
|
+
const UseClipboard = /* @__PURE__ */ defineComponent(
|
|
146
|
+
(props, { slots }) => {
|
|
417
147
|
const data = reactive(useClipboard(props));
|
|
418
148
|
return () => {
|
|
419
|
-
|
|
420
|
-
|
|
149
|
+
if (slots.default)
|
|
150
|
+
return slots.default(data);
|
|
421
151
|
};
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
426
|
-
const globalKey = "__vueuse_ssr_handlers__";
|
|
427
|
-
const handlers = /* @__PURE__ */ getHandlers();
|
|
428
|
-
function getHandlers() {
|
|
429
|
-
if (!(globalKey in _global))
|
|
430
|
-
_global[globalKey] = _global[globalKey] || {};
|
|
431
|
-
return _global[globalKey];
|
|
432
|
-
}
|
|
433
|
-
function getSSRHandler(key, fallback) {
|
|
434
|
-
return handlers[key] || fallback;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
const ssrWidthSymbol = Symbol("vueuse-ssr-width");
|
|
438
|
-
// @__NO_SIDE_EFFECTS__
|
|
439
|
-
function useSSRWidth() {
|
|
440
|
-
const ssrWidth = hasInjectionContext() ? injectLocal(ssrWidthSymbol, null) : null;
|
|
441
|
-
return typeof ssrWidth === "number" ? ssrWidth : void 0;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
// @__NO_SIDE_EFFECTS__
|
|
445
|
-
function useMounted() {
|
|
446
|
-
const isMounted = shallowRef(false);
|
|
447
|
-
const instance = getCurrentInstance();
|
|
448
|
-
if (instance) {
|
|
449
|
-
onMounted(() => {
|
|
450
|
-
isMounted.value = true;
|
|
451
|
-
}, instance);
|
|
452
|
-
}
|
|
453
|
-
return isMounted;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
// @__NO_SIDE_EFFECTS__
|
|
457
|
-
function useSupported(callback) {
|
|
458
|
-
const isMounted = useMounted();
|
|
459
|
-
return computed(() => {
|
|
460
|
-
isMounted.value;
|
|
461
|
-
return Boolean(callback());
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
function useMediaQuery(query, options = {}) {
|
|
466
|
-
const { window = defaultWindow, ssrWidth = useSSRWidth() } = options;
|
|
467
|
-
const isSupported = useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function");
|
|
468
|
-
const ssrSupport = shallowRef(typeof ssrWidth === "number");
|
|
469
|
-
const mediaQuery = shallowRef();
|
|
470
|
-
const matches = shallowRef(false);
|
|
471
|
-
const handler = (event) => {
|
|
472
|
-
matches.value = event.matches;
|
|
473
|
-
};
|
|
474
|
-
watchEffect(() => {
|
|
475
|
-
if (ssrSupport.value) {
|
|
476
|
-
ssrSupport.value = !isSupported.value;
|
|
477
|
-
const queryStrings = toValue(query).split(",");
|
|
478
|
-
matches.value = queryStrings.some((queryString) => {
|
|
479
|
-
const not = queryString.includes("not all");
|
|
480
|
-
const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
481
|
-
const maxWidth = queryString.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
482
|
-
let res = Boolean(minWidth || maxWidth);
|
|
483
|
-
if (minWidth && res) {
|
|
484
|
-
res = ssrWidth >= pxValue(minWidth[1]);
|
|
485
|
-
}
|
|
486
|
-
if (maxWidth && res) {
|
|
487
|
-
res = ssrWidth <= pxValue(maxWidth[1]);
|
|
488
|
-
}
|
|
489
|
-
return not ? !res : res;
|
|
490
|
-
});
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
if (!isSupported.value)
|
|
494
|
-
return;
|
|
495
|
-
mediaQuery.value = window.matchMedia(toValue(query));
|
|
496
|
-
matches.value = mediaQuery.value.matches;
|
|
497
|
-
});
|
|
498
|
-
useEventListener(mediaQuery, "change", handler, { passive: true });
|
|
499
|
-
return computed(() => matches.value);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
// @__NO_SIDE_EFFECTS__
|
|
503
|
-
function usePreferredDark(options) {
|
|
504
|
-
return useMediaQuery("(prefers-color-scheme: dark)", options);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
function guessSerializerType(rawInit) {
|
|
508
|
-
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";
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
const StorageSerializers = {
|
|
512
|
-
boolean: {
|
|
513
|
-
read: (v) => v === "true",
|
|
514
|
-
write: (v) => String(v)
|
|
515
|
-
},
|
|
516
|
-
object: {
|
|
517
|
-
read: (v) => JSON.parse(v),
|
|
518
|
-
write: (v) => JSON.stringify(v)
|
|
519
152
|
},
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
write: (v) => JSON.stringify(Array.from(v.entries()))
|
|
535
|
-
},
|
|
536
|
-
set: {
|
|
537
|
-
read: (v) => new Set(JSON.parse(v)),
|
|
538
|
-
write: (v) => JSON.stringify(Array.from(v))
|
|
539
|
-
},
|
|
540
|
-
date: {
|
|
541
|
-
read: (v) => new Date(v),
|
|
542
|
-
write: (v) => v.toISOString()
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
const customStorageEventName = "vueuse-storage";
|
|
546
|
-
function useStorage(key, defaults, storage, options = {}) {
|
|
547
|
-
var _a;
|
|
548
|
-
const {
|
|
549
|
-
flush = "pre",
|
|
550
|
-
deep = true,
|
|
551
|
-
listenToStorageChanges = true,
|
|
552
|
-
writeDefaults = true,
|
|
553
|
-
mergeDefaults = false,
|
|
554
|
-
shallow,
|
|
555
|
-
window = defaultWindow,
|
|
556
|
-
eventFilter,
|
|
557
|
-
onError = (e) => {
|
|
558
|
-
console.error(e);
|
|
559
|
-
},
|
|
560
|
-
initOnMounted
|
|
561
|
-
} = options;
|
|
562
|
-
const data = (shallow ? shallowRef : ref)(typeof defaults === "function" ? defaults() : defaults);
|
|
563
|
-
const keyComputed = computed(() => toValue(key));
|
|
564
|
-
if (!storage) {
|
|
565
|
-
try {
|
|
566
|
-
storage = getSSRHandler("getDefaultStorage", () => {
|
|
567
|
-
var _a2;
|
|
568
|
-
return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;
|
|
569
|
-
})();
|
|
570
|
-
} catch (e) {
|
|
571
|
-
onError(e);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
if (!storage)
|
|
575
|
-
return data;
|
|
576
|
-
const rawInit = toValue(defaults);
|
|
577
|
-
const type = guessSerializerType(rawInit);
|
|
578
|
-
const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];
|
|
579
|
-
const { pause: pauseWatch, resume: resumeWatch } = pausableWatch(
|
|
580
|
-
data,
|
|
581
|
-
(newValue) => write(newValue),
|
|
582
|
-
{ flush, deep, eventFilter }
|
|
583
|
-
);
|
|
584
|
-
watch(keyComputed, () => update(), { flush });
|
|
585
|
-
let firstMounted = false;
|
|
586
|
-
const onStorageEvent = (ev) => {
|
|
587
|
-
if (initOnMounted && !firstMounted) {
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
update(ev);
|
|
591
|
-
};
|
|
592
|
-
const onStorageCustomEvent = (ev) => {
|
|
593
|
-
if (initOnMounted && !firstMounted) {
|
|
594
|
-
return;
|
|
595
|
-
}
|
|
596
|
-
updateFromCustomEvent(ev);
|
|
597
|
-
};
|
|
598
|
-
if (window && listenToStorageChanges) {
|
|
599
|
-
if (storage instanceof Storage)
|
|
600
|
-
useEventListener(window, "storage", onStorageEvent, { passive: true });
|
|
601
|
-
else
|
|
602
|
-
useEventListener(window, customStorageEventName, onStorageCustomEvent);
|
|
603
|
-
}
|
|
604
|
-
if (initOnMounted) {
|
|
605
|
-
tryOnMounted(() => {
|
|
606
|
-
firstMounted = true;
|
|
607
|
-
update();
|
|
608
|
-
});
|
|
609
|
-
} else {
|
|
610
|
-
update();
|
|
611
|
-
}
|
|
612
|
-
function dispatchWriteEvent(oldValue, newValue) {
|
|
613
|
-
if (window) {
|
|
614
|
-
const payload = {
|
|
615
|
-
key: keyComputed.value,
|
|
616
|
-
oldValue,
|
|
617
|
-
newValue,
|
|
618
|
-
storageArea: storage
|
|
619
|
-
};
|
|
620
|
-
window.dispatchEvent(storage instanceof Storage ? new StorageEvent("storage", payload) : new CustomEvent(customStorageEventName, {
|
|
621
|
-
detail: payload
|
|
622
|
-
}));
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
function write(v) {
|
|
626
|
-
try {
|
|
627
|
-
const oldValue = storage.getItem(keyComputed.value);
|
|
628
|
-
if (v == null) {
|
|
629
|
-
dispatchWriteEvent(oldValue, null);
|
|
630
|
-
storage.removeItem(keyComputed.value);
|
|
631
|
-
} else {
|
|
632
|
-
const serialized = serializer.write(v);
|
|
633
|
-
if (oldValue !== serialized) {
|
|
634
|
-
storage.setItem(keyComputed.value, serialized);
|
|
635
|
-
dispatchWriteEvent(oldValue, serialized);
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
} catch (e) {
|
|
639
|
-
onError(e);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
function read(event) {
|
|
643
|
-
const rawValue = event ? event.newValue : storage.getItem(keyComputed.value);
|
|
644
|
-
if (rawValue == null) {
|
|
645
|
-
if (writeDefaults && rawInit != null)
|
|
646
|
-
storage.setItem(keyComputed.value, serializer.write(rawInit));
|
|
647
|
-
return rawInit;
|
|
648
|
-
} else if (!event && mergeDefaults) {
|
|
649
|
-
const value = serializer.read(rawValue);
|
|
650
|
-
if (typeof mergeDefaults === "function")
|
|
651
|
-
return mergeDefaults(value, rawInit);
|
|
652
|
-
else if (type === "object" && !Array.isArray(value))
|
|
653
|
-
return { ...rawInit, ...value };
|
|
654
|
-
return value;
|
|
655
|
-
} else if (typeof rawValue !== "string") {
|
|
656
|
-
return rawValue;
|
|
657
|
-
} else {
|
|
658
|
-
return serializer.read(rawValue);
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
function update(event) {
|
|
662
|
-
if (event && event.storageArea !== storage)
|
|
663
|
-
return;
|
|
664
|
-
if (event && event.key == null) {
|
|
665
|
-
data.value = rawInit;
|
|
666
|
-
return;
|
|
667
|
-
}
|
|
668
|
-
if (event && event.key !== keyComputed.value) {
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
pauseWatch();
|
|
672
|
-
try {
|
|
673
|
-
const serializedData = serializer.write(data.value);
|
|
674
|
-
if (event === void 0 || (event == null ? void 0 : event.newValue) !== serializedData) {
|
|
675
|
-
data.value = read(event);
|
|
676
|
-
}
|
|
677
|
-
} catch (e) {
|
|
678
|
-
onError(e);
|
|
679
|
-
} finally {
|
|
680
|
-
if (event)
|
|
681
|
-
nextTick(resumeWatch);
|
|
682
|
-
else
|
|
683
|
-
resumeWatch();
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
function updateFromCustomEvent(event) {
|
|
687
|
-
update(event.detail);
|
|
688
|
-
}
|
|
689
|
-
return data;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
const CSS_DISABLE_TRANS = "*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";
|
|
693
|
-
function useColorMode(options = {}) {
|
|
694
|
-
const {
|
|
695
|
-
selector = "html",
|
|
696
|
-
attribute = "class",
|
|
697
|
-
initialValue = "auto",
|
|
698
|
-
window = defaultWindow,
|
|
699
|
-
storage,
|
|
700
|
-
storageKey = "vueuse-color-scheme",
|
|
701
|
-
listenToStorageChanges = true,
|
|
702
|
-
storageRef,
|
|
703
|
-
emitAuto,
|
|
704
|
-
disableTransition = true
|
|
705
|
-
} = options;
|
|
706
|
-
const modes = {
|
|
707
|
-
auto: "",
|
|
708
|
-
light: "light",
|
|
709
|
-
dark: "dark",
|
|
710
|
-
...options.modes || {}
|
|
711
|
-
};
|
|
712
|
-
const preferredDark = usePreferredDark({ window });
|
|
713
|
-
const system = computed(() => preferredDark.value ? "dark" : "light");
|
|
714
|
-
const store = storageRef || (storageKey == null ? toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));
|
|
715
|
-
const state = computed(() => store.value === "auto" ? system.value : store.value);
|
|
716
|
-
const updateHTMLAttrs = getSSRHandler(
|
|
717
|
-
"updateHTMLAttrs",
|
|
718
|
-
(selector2, attribute2, value) => {
|
|
719
|
-
const el = typeof selector2 === "string" ? window == null ? void 0 : window.document.querySelector(selector2) : unrefElement(selector2);
|
|
720
|
-
if (!el)
|
|
721
|
-
return;
|
|
722
|
-
const classesToAdd = /* @__PURE__ */ new Set();
|
|
723
|
-
const classesToRemove = /* @__PURE__ */ new Set();
|
|
724
|
-
let attributeToChange = null;
|
|
725
|
-
if (attribute2 === "class") {
|
|
726
|
-
const current = value.split(/\s/g);
|
|
727
|
-
Object.values(modes).flatMap((i) => (i || "").split(/\s/g)).filter(Boolean).forEach((v) => {
|
|
728
|
-
if (current.includes(v))
|
|
729
|
-
classesToAdd.add(v);
|
|
730
|
-
else
|
|
731
|
-
classesToRemove.add(v);
|
|
732
|
-
});
|
|
733
|
-
} else {
|
|
734
|
-
attributeToChange = { key: attribute2, value };
|
|
735
|
-
}
|
|
736
|
-
if (classesToAdd.size === 0 && classesToRemove.size === 0 && attributeToChange === null)
|
|
737
|
-
return;
|
|
738
|
-
let style;
|
|
739
|
-
if (disableTransition) {
|
|
740
|
-
style = window.document.createElement("style");
|
|
741
|
-
style.appendChild(document.createTextNode(CSS_DISABLE_TRANS));
|
|
742
|
-
window.document.head.appendChild(style);
|
|
743
|
-
}
|
|
744
|
-
for (const c of classesToAdd) {
|
|
745
|
-
el.classList.add(c);
|
|
746
|
-
}
|
|
747
|
-
for (const c of classesToRemove) {
|
|
748
|
-
el.classList.remove(c);
|
|
749
|
-
}
|
|
750
|
-
if (attributeToChange) {
|
|
751
|
-
el.setAttribute(attributeToChange.key, attributeToChange.value);
|
|
752
|
-
}
|
|
753
|
-
if (disableTransition) {
|
|
754
|
-
window.getComputedStyle(style).opacity;
|
|
755
|
-
document.head.removeChild(style);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
);
|
|
759
|
-
function defaultOnChanged(mode) {
|
|
760
|
-
var _a;
|
|
761
|
-
updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);
|
|
762
|
-
}
|
|
763
|
-
function onChanged(mode) {
|
|
764
|
-
if (options.onChanged)
|
|
765
|
-
options.onChanged(mode, defaultOnChanged);
|
|
766
|
-
else
|
|
767
|
-
defaultOnChanged(mode);
|
|
768
|
-
}
|
|
769
|
-
watch(state, onChanged, { flush: "post", immediate: true });
|
|
770
|
-
tryOnMounted(() => onChanged(state.value));
|
|
771
|
-
const auto = computed({
|
|
772
|
-
get() {
|
|
773
|
-
return emitAuto ? store.value : state.value;
|
|
774
|
-
},
|
|
775
|
-
set(v) {
|
|
776
|
-
store.value = v;
|
|
777
|
-
}
|
|
778
|
-
});
|
|
779
|
-
return Object.assign(auto, { store, system, state });
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
const UseColorMode = /* @__PURE__ */ defineComponent({
|
|
783
|
-
name: "UseColorMode",
|
|
784
|
-
props: ["selector", "attribute", "modes", "onChanged", "storageKey", "storage", "emitAuto"],
|
|
785
|
-
setup(props, { slots }) {
|
|
153
|
+
{
|
|
154
|
+
name: "UseClipboard",
|
|
155
|
+
props: [
|
|
156
|
+
"source",
|
|
157
|
+
"read",
|
|
158
|
+
"navigator",
|
|
159
|
+
"copiedDuring",
|
|
160
|
+
"legacy"
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
const UseColorMode = /* @__PURE__ */ defineComponent(
|
|
166
|
+
(props, { slots }) => {
|
|
786
167
|
const mode = useColorMode(props);
|
|
787
168
|
const data = reactive({
|
|
788
169
|
mode,
|
|
@@ -793,13 +174,37 @@ const UseColorMode = /* @__PURE__ */ defineComponent({
|
|
|
793
174
|
if (slots.default)
|
|
794
175
|
return slots.default(data);
|
|
795
176
|
};
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: "UseColorMode",
|
|
180
|
+
props: [
|
|
181
|
+
"attribute",
|
|
182
|
+
"deep",
|
|
183
|
+
"disableTransition",
|
|
184
|
+
"emitAuto",
|
|
185
|
+
"eventFilter",
|
|
186
|
+
"flush",
|
|
187
|
+
"initOnMounted",
|
|
188
|
+
"initialValue",
|
|
189
|
+
"listenToStorageChanges",
|
|
190
|
+
"mergeDefaults",
|
|
191
|
+
"modes",
|
|
192
|
+
"onChanged",
|
|
193
|
+
"onError",
|
|
194
|
+
"selector",
|
|
195
|
+
"serializer",
|
|
196
|
+
"shallow",
|
|
197
|
+
"storage",
|
|
198
|
+
"storageKey",
|
|
199
|
+
"storageRef",
|
|
200
|
+
"window",
|
|
201
|
+
"writeDefaults"
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
const UseDark = /* @__PURE__ */ defineComponent(
|
|
207
|
+
(props, { slots }) => {
|
|
803
208
|
const isDark = useDark(props);
|
|
804
209
|
const data = reactive({
|
|
805
210
|
isDark,
|
|
@@ -809,91 +214,119 @@ const UseDark = /* @__PURE__ */ defineComponent({
|
|
|
809
214
|
if (slots.default)
|
|
810
215
|
return slots.default(data);
|
|
811
216
|
};
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: "UseDark",
|
|
220
|
+
props: [
|
|
221
|
+
"attribute",
|
|
222
|
+
"deep",
|
|
223
|
+
"disableTransition",
|
|
224
|
+
"emitAuto",
|
|
225
|
+
"eventFilter",
|
|
226
|
+
"flush",
|
|
227
|
+
"initOnMounted",
|
|
228
|
+
"initialValue",
|
|
229
|
+
"listenToStorageChanges",
|
|
230
|
+
"mergeDefaults",
|
|
231
|
+
"onChanged",
|
|
232
|
+
"onError",
|
|
233
|
+
"selector",
|
|
234
|
+
"serializer",
|
|
235
|
+
"shallow",
|
|
236
|
+
"storage",
|
|
237
|
+
"storageKey",
|
|
238
|
+
"storageRef",
|
|
239
|
+
"valueDark",
|
|
240
|
+
"valueLight",
|
|
241
|
+
"window",
|
|
242
|
+
"writeDefaults"
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
const UseDeviceMotion = /* @__PURE__ */ defineComponent(
|
|
248
|
+
(props, { slots }) => {
|
|
249
|
+
const data = useDeviceMotion(props);
|
|
819
250
|
return () => {
|
|
820
251
|
if (slots.default)
|
|
821
252
|
return slots.default(data);
|
|
822
253
|
};
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: "UseDeviceMotion",
|
|
257
|
+
props: [
|
|
258
|
+
"eventFilter",
|
|
259
|
+
"requestPermissions",
|
|
260
|
+
"window"
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
const UseDeviceOrientation = /* @__PURE__ */ defineComponent(
|
|
266
|
+
(props, { slots }) => {
|
|
267
|
+
const data = reactive(useDeviceOrientation(props));
|
|
830
268
|
return () => {
|
|
831
269
|
if (slots.default)
|
|
832
270
|
return slots.default(data);
|
|
833
271
|
};
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
name: "UseDeviceOrientation",
|
|
275
|
+
props: ["window"]
|
|
834
276
|
}
|
|
835
|
-
|
|
277
|
+
);
|
|
836
278
|
|
|
837
|
-
const UseDevicePixelRatio = /* @__PURE__ */ defineComponent(
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
const data = reactive({
|
|
841
|
-
pixelRatio: useDevicePixelRatio()
|
|
842
|
-
});
|
|
279
|
+
const UseDevicePixelRatio = /* @__PURE__ */ defineComponent(
|
|
280
|
+
(props, { slots }) => {
|
|
281
|
+
const data = reactive(useDevicePixelRatio(props));
|
|
843
282
|
return () => {
|
|
844
283
|
if (slots.default)
|
|
845
284
|
return slots.default(data);
|
|
846
285
|
};
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: "UseDevicePixelRatio",
|
|
289
|
+
props: ["window"]
|
|
847
290
|
}
|
|
848
|
-
|
|
291
|
+
);
|
|
849
292
|
|
|
850
|
-
const UseDevicesList = /* @__PURE__ */ defineComponent(
|
|
851
|
-
|
|
852
|
-
props: ["onUpdated", "requestPermissions", "constraints"],
|
|
853
|
-
setup(props, { slots }) {
|
|
293
|
+
const UseDevicesList = /* @__PURE__ */ defineComponent(
|
|
294
|
+
(props, { slots }) => {
|
|
854
295
|
const data = reactive(useDevicesList(props));
|
|
855
296
|
return () => {
|
|
856
297
|
if (slots.default)
|
|
857
298
|
return slots.default(data);
|
|
858
299
|
};
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: "UseDevicesList",
|
|
303
|
+
props: [
|
|
304
|
+
"constraints",
|
|
305
|
+
"navigator",
|
|
306
|
+
"onUpdated",
|
|
307
|
+
"requestPermissions"
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
|
|
312
|
+
const UseDocumentVisibility = /* @__PURE__ */ defineComponent(
|
|
313
|
+
(props, { slots }) => {
|
|
865
314
|
const data = reactive({
|
|
866
|
-
visibility: useDocumentVisibility()
|
|
315
|
+
visibility: useDocumentVisibility(props)
|
|
867
316
|
});
|
|
868
317
|
return () => {
|
|
869
318
|
if (slots.default)
|
|
870
319
|
return slots.default(data);
|
|
871
320
|
};
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
name: "UseDocumentVisibility",
|
|
324
|
+
props: ["document"]
|
|
872
325
|
}
|
|
873
|
-
|
|
326
|
+
);
|
|
874
327
|
|
|
875
|
-
const UseDraggable = /* @__PURE__ */ defineComponent(
|
|
876
|
-
|
|
877
|
-
props: [
|
|
878
|
-
"storageKey",
|
|
879
|
-
"storageType",
|
|
880
|
-
"initialValue",
|
|
881
|
-
"exact",
|
|
882
|
-
"preventDefault",
|
|
883
|
-
"stopPropagation",
|
|
884
|
-
"pointerTypes",
|
|
885
|
-
"as",
|
|
886
|
-
"handle",
|
|
887
|
-
"axis",
|
|
888
|
-
"onStart",
|
|
889
|
-
"onMove",
|
|
890
|
-
"onEnd",
|
|
891
|
-
"disabled",
|
|
892
|
-
"buttons",
|
|
893
|
-
"containerElement",
|
|
894
|
-
"capture"
|
|
895
|
-
],
|
|
896
|
-
setup(props, { slots }) {
|
|
328
|
+
const UseDraggable = /* @__PURE__ */ defineComponent(
|
|
329
|
+
(props, { slots }) => {
|
|
897
330
|
const target = shallowRef();
|
|
898
331
|
const handle = computed(() => {
|
|
899
332
|
var _a;
|
|
@@ -904,10 +337,10 @@ const UseDraggable = /* @__PURE__ */ defineComponent({
|
|
|
904
337
|
return (_a = props.containerElement) != null ? _a : void 0;
|
|
905
338
|
});
|
|
906
339
|
const disabled = computed(() => !!props.disabled);
|
|
907
|
-
const storageValue = props.storageKey && useStorage
|
|
340
|
+
const storageValue = props.storageKey && useStorage(
|
|
908
341
|
props.storageKey,
|
|
909
342
|
toValue(props.initialValue) || { x: 0, y: 0 },
|
|
910
|
-
isClient
|
|
343
|
+
isClient ? props.storageType === "session" ? sessionStorage : localStorage : void 0
|
|
911
344
|
);
|
|
912
345
|
const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
|
|
913
346
|
const onEnd = (position, event) => {
|
|
@@ -930,174 +363,53 @@ const UseDraggable = /* @__PURE__ */ defineComponent({
|
|
|
930
363
|
if (slots.default)
|
|
931
364
|
return h(props.as || "div", { ref: target, style: `touch-action:none;${data.style}` }, slots.default(data));
|
|
932
365
|
};
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: "UseDraggable",
|
|
369
|
+
props: [
|
|
370
|
+
"storageKey",
|
|
371
|
+
"storageType",
|
|
372
|
+
"initialValue",
|
|
373
|
+
"exact",
|
|
374
|
+
"preventDefault",
|
|
375
|
+
"stopPropagation",
|
|
376
|
+
"pointerTypes",
|
|
377
|
+
"as",
|
|
378
|
+
"handle",
|
|
379
|
+
"axis",
|
|
380
|
+
"onStart",
|
|
381
|
+
"onMove",
|
|
382
|
+
"onEnd",
|
|
383
|
+
"disabled",
|
|
384
|
+
"buttons",
|
|
385
|
+
"containerElement",
|
|
386
|
+
"capture",
|
|
387
|
+
"draggingElement"
|
|
388
|
+
]
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
|
|
392
|
+
const UseElementBounding = /* @__PURE__ */ defineComponent(
|
|
393
|
+
(props, { slots }) => {
|
|
940
394
|
const target = shallowRef();
|
|
941
|
-
const data = reactive(useElementBounding
|
|
395
|
+
const data = reactive(useElementBounding(target, props));
|
|
942
396
|
return () => {
|
|
943
397
|
if (slots.default)
|
|
944
398
|
return h(props.as || "div", { ref: target }, slots.default(data));
|
|
945
399
|
};
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
const targets = computed(() => {
|
|
960
|
-
const value = toValue(target);
|
|
961
|
-
const items = toArray(value).map(unrefElement).filter(notNullish);
|
|
962
|
-
return new Set(items);
|
|
963
|
-
});
|
|
964
|
-
const stopWatch = watch(
|
|
965
|
-
targets,
|
|
966
|
-
(newTargets) => {
|
|
967
|
-
cleanup();
|
|
968
|
-
if (isSupported.value && newTargets.size) {
|
|
969
|
-
observer = new MutationObserver(callback);
|
|
970
|
-
newTargets.forEach((el) => observer.observe(el, mutationOptions));
|
|
971
|
-
}
|
|
972
|
-
},
|
|
973
|
-
{ immediate: true, flush: "post" }
|
|
974
|
-
);
|
|
975
|
-
const takeRecords = () => {
|
|
976
|
-
return observer == null ? void 0 : observer.takeRecords();
|
|
977
|
-
};
|
|
978
|
-
const stop = () => {
|
|
979
|
-
stopWatch();
|
|
980
|
-
cleanup();
|
|
981
|
-
};
|
|
982
|
-
tryOnScopeDispose(stop);
|
|
983
|
-
return {
|
|
984
|
-
isSupported,
|
|
985
|
-
stop,
|
|
986
|
-
takeRecords
|
|
987
|
-
};
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
function useResizeObserver(target, callback, options = {}) {
|
|
991
|
-
const { window = defaultWindow, ...observerOptions } = options;
|
|
992
|
-
let observer;
|
|
993
|
-
const isSupported = useSupported(() => window && "ResizeObserver" in window);
|
|
994
|
-
const cleanup = () => {
|
|
995
|
-
if (observer) {
|
|
996
|
-
observer.disconnect();
|
|
997
|
-
observer = void 0;
|
|
998
|
-
}
|
|
999
|
-
};
|
|
1000
|
-
const targets = computed(() => {
|
|
1001
|
-
const _targets = toValue(target);
|
|
1002
|
-
return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
|
|
1003
|
-
});
|
|
1004
|
-
const stopWatch = watch(
|
|
1005
|
-
targets,
|
|
1006
|
-
(els) => {
|
|
1007
|
-
cleanup();
|
|
1008
|
-
if (isSupported.value && window) {
|
|
1009
|
-
observer = new ResizeObserver(callback);
|
|
1010
|
-
for (const _el of els) {
|
|
1011
|
-
if (_el)
|
|
1012
|
-
observer.observe(_el, observerOptions);
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
},
|
|
1016
|
-
{ immediate: true, flush: "post" }
|
|
1017
|
-
);
|
|
1018
|
-
const stop = () => {
|
|
1019
|
-
cleanup();
|
|
1020
|
-
stopWatch();
|
|
1021
|
-
};
|
|
1022
|
-
tryOnScopeDispose(stop);
|
|
1023
|
-
return {
|
|
1024
|
-
isSupported,
|
|
1025
|
-
stop
|
|
1026
|
-
};
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
function useElementBounding(target, options = {}) {
|
|
1030
|
-
const {
|
|
1031
|
-
reset = true,
|
|
1032
|
-
windowResize = true,
|
|
1033
|
-
windowScroll = true,
|
|
1034
|
-
immediate = true,
|
|
1035
|
-
updateTiming = "sync"
|
|
1036
|
-
} = options;
|
|
1037
|
-
const height = shallowRef(0);
|
|
1038
|
-
const bottom = shallowRef(0);
|
|
1039
|
-
const left = shallowRef(0);
|
|
1040
|
-
const right = shallowRef(0);
|
|
1041
|
-
const top = shallowRef(0);
|
|
1042
|
-
const width = shallowRef(0);
|
|
1043
|
-
const x = shallowRef(0);
|
|
1044
|
-
const y = shallowRef(0);
|
|
1045
|
-
function recalculate() {
|
|
1046
|
-
const el = unrefElement(target);
|
|
1047
|
-
if (!el) {
|
|
1048
|
-
if (reset) {
|
|
1049
|
-
height.value = 0;
|
|
1050
|
-
bottom.value = 0;
|
|
1051
|
-
left.value = 0;
|
|
1052
|
-
right.value = 0;
|
|
1053
|
-
top.value = 0;
|
|
1054
|
-
width.value = 0;
|
|
1055
|
-
x.value = 0;
|
|
1056
|
-
y.value = 0;
|
|
1057
|
-
}
|
|
1058
|
-
return;
|
|
1059
|
-
}
|
|
1060
|
-
const rect = el.getBoundingClientRect();
|
|
1061
|
-
height.value = rect.height;
|
|
1062
|
-
bottom.value = rect.bottom;
|
|
1063
|
-
left.value = rect.left;
|
|
1064
|
-
right.value = rect.right;
|
|
1065
|
-
top.value = rect.top;
|
|
1066
|
-
width.value = rect.width;
|
|
1067
|
-
x.value = rect.x;
|
|
1068
|
-
y.value = rect.y;
|
|
1069
|
-
}
|
|
1070
|
-
function update() {
|
|
1071
|
-
if (updateTiming === "sync")
|
|
1072
|
-
recalculate();
|
|
1073
|
-
else if (updateTiming === "next-frame")
|
|
1074
|
-
requestAnimationFrame(() => recalculate());
|
|
1075
|
-
}
|
|
1076
|
-
useResizeObserver(target, update);
|
|
1077
|
-
watch(() => unrefElement(target), (ele) => !ele && update());
|
|
1078
|
-
useMutationObserver(target, update, {
|
|
1079
|
-
attributeFilter: ["style", "class"]
|
|
1080
|
-
});
|
|
1081
|
-
if (windowScroll)
|
|
1082
|
-
useEventListener("scroll", update, { capture: true, passive: true });
|
|
1083
|
-
if (windowResize)
|
|
1084
|
-
useEventListener("resize", update, { passive: true });
|
|
1085
|
-
tryOnMounted(() => {
|
|
1086
|
-
if (immediate)
|
|
1087
|
-
update();
|
|
1088
|
-
});
|
|
1089
|
-
return {
|
|
1090
|
-
height,
|
|
1091
|
-
bottom,
|
|
1092
|
-
left,
|
|
1093
|
-
right,
|
|
1094
|
-
top,
|
|
1095
|
-
width,
|
|
1096
|
-
x,
|
|
1097
|
-
y,
|
|
1098
|
-
update
|
|
1099
|
-
};
|
|
1100
|
-
}
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: "UseElementBounding",
|
|
403
|
+
props: [
|
|
404
|
+
"as",
|
|
405
|
+
"immediate",
|
|
406
|
+
"reset",
|
|
407
|
+
"updateTiming",
|
|
408
|
+
"windowResize",
|
|
409
|
+
"windowScroll"
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
);
|
|
1101
413
|
|
|
1102
414
|
const vElementBounding = {
|
|
1103
415
|
mounted(el, binding) {
|
|
@@ -1116,80 +428,6 @@ const vElementBounding = {
|
|
|
1116
428
|
}
|
|
1117
429
|
};
|
|
1118
430
|
|
|
1119
|
-
function onElementRemoval(target, callback, options = {}) {
|
|
1120
|
-
const {
|
|
1121
|
-
window = defaultWindow,
|
|
1122
|
-
document = window == null ? void 0 : window.document,
|
|
1123
|
-
flush = "sync"
|
|
1124
|
-
} = options;
|
|
1125
|
-
if (!window || !document)
|
|
1126
|
-
return noop;
|
|
1127
|
-
let stopFn;
|
|
1128
|
-
const cleanupAndUpdate = (fn) => {
|
|
1129
|
-
stopFn == null ? void 0 : stopFn();
|
|
1130
|
-
stopFn = fn;
|
|
1131
|
-
};
|
|
1132
|
-
const stopWatch = watchEffect(() => {
|
|
1133
|
-
const el = unrefElement(target);
|
|
1134
|
-
if (el) {
|
|
1135
|
-
const { stop } = useMutationObserver(
|
|
1136
|
-
document,
|
|
1137
|
-
(mutationsList) => {
|
|
1138
|
-
const targetRemoved = mutationsList.map((mutation) => [...mutation.removedNodes]).flat().some((node) => node === el || node.contains(el));
|
|
1139
|
-
if (targetRemoved) {
|
|
1140
|
-
callback(mutationsList);
|
|
1141
|
-
}
|
|
1142
|
-
},
|
|
1143
|
-
{
|
|
1144
|
-
window,
|
|
1145
|
-
childList: true,
|
|
1146
|
-
subtree: true
|
|
1147
|
-
}
|
|
1148
|
-
);
|
|
1149
|
-
cleanupAndUpdate(stop);
|
|
1150
|
-
}
|
|
1151
|
-
}, { flush });
|
|
1152
|
-
const stopHandle = () => {
|
|
1153
|
-
stopWatch();
|
|
1154
|
-
cleanupAndUpdate();
|
|
1155
|
-
};
|
|
1156
|
-
tryOnScopeDispose(stopHandle);
|
|
1157
|
-
return stopHandle;
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
function useElementHover(el, options = {}) {
|
|
1161
|
-
const {
|
|
1162
|
-
delayEnter = 0,
|
|
1163
|
-
delayLeave = 0,
|
|
1164
|
-
triggerOnRemoval = false,
|
|
1165
|
-
window = defaultWindow
|
|
1166
|
-
} = options;
|
|
1167
|
-
const isHovered = shallowRef(false);
|
|
1168
|
-
let timer;
|
|
1169
|
-
const toggle = (entering) => {
|
|
1170
|
-
const delay = entering ? delayEnter : delayLeave;
|
|
1171
|
-
if (timer) {
|
|
1172
|
-
clearTimeout(timer);
|
|
1173
|
-
timer = void 0;
|
|
1174
|
-
}
|
|
1175
|
-
if (delay)
|
|
1176
|
-
timer = setTimeout(() => isHovered.value = entering, delay);
|
|
1177
|
-
else
|
|
1178
|
-
isHovered.value = entering;
|
|
1179
|
-
};
|
|
1180
|
-
if (!window)
|
|
1181
|
-
return isHovered;
|
|
1182
|
-
useEventListener(el, "mouseenter", () => toggle(true), { passive: true });
|
|
1183
|
-
useEventListener(el, "mouseleave", () => toggle(false), { passive: true });
|
|
1184
|
-
if (triggerOnRemoval) {
|
|
1185
|
-
onElementRemoval(
|
|
1186
|
-
computed(() => unrefElement(el)),
|
|
1187
|
-
() => toggle(false)
|
|
1188
|
-
);
|
|
1189
|
-
}
|
|
1190
|
-
return isHovered;
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
431
|
const vElementHover = {
|
|
1194
432
|
mounted(el, binding) {
|
|
1195
433
|
const value = binding.value;
|
|
@@ -1204,76 +442,31 @@ const vElementHover = {
|
|
|
1204
442
|
}
|
|
1205
443
|
};
|
|
1206
444
|
|
|
1207
|
-
const UseElementSize = /* @__PURE__ */ defineComponent(
|
|
1208
|
-
|
|
1209
|
-
props: ["width", "height", "box", "as"],
|
|
1210
|
-
setup(props, { slots }) {
|
|
445
|
+
const UseElementSize = /* @__PURE__ */ defineComponent(
|
|
446
|
+
(props, { slots }) => {
|
|
1211
447
|
var _a, _b;
|
|
1212
448
|
const target = shallowRef();
|
|
1213
|
-
const
|
|
449
|
+
const { width, height } = toRefs(props);
|
|
450
|
+
const data = reactive(useElementSize(target, { width: (_a = toValue(width)) != null ? _a : 0, height: (_b = toValue(height)) != null ? _b : 0 }, {
|
|
451
|
+
box: props.box,
|
|
452
|
+
window: props.window
|
|
453
|
+
}));
|
|
1214
454
|
return () => {
|
|
1215
455
|
if (slots.default)
|
|
1216
456
|
return h(props.as || "div", { ref: target }, slots.default(data));
|
|
1217
457
|
};
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
target,
|
|
1231
|
-
([entry]) => {
|
|
1232
|
-
const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
|
|
1233
|
-
if (window && isSVG.value) {
|
|
1234
|
-
const $elem = unrefElement(target);
|
|
1235
|
-
if ($elem) {
|
|
1236
|
-
const rect = $elem.getBoundingClientRect();
|
|
1237
|
-
width.value = rect.width;
|
|
1238
|
-
height.value = rect.height;
|
|
1239
|
-
}
|
|
1240
|
-
} else {
|
|
1241
|
-
if (boxSize) {
|
|
1242
|
-
const formatBoxSize = toArray(boxSize);
|
|
1243
|
-
width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
|
|
1244
|
-
height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
|
|
1245
|
-
} else {
|
|
1246
|
-
width.value = entry.contentRect.width;
|
|
1247
|
-
height.value = entry.contentRect.height;
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
},
|
|
1251
|
-
options
|
|
1252
|
-
);
|
|
1253
|
-
tryOnMounted(() => {
|
|
1254
|
-
const ele = unrefElement(target);
|
|
1255
|
-
if (ele) {
|
|
1256
|
-
width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width;
|
|
1257
|
-
height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
|
|
1258
|
-
}
|
|
1259
|
-
});
|
|
1260
|
-
const stop2 = watch(
|
|
1261
|
-
() => unrefElement(target),
|
|
1262
|
-
(ele) => {
|
|
1263
|
-
width.value = ele ? initialSize.width : 0;
|
|
1264
|
-
height.value = ele ? initialSize.height : 0;
|
|
1265
|
-
}
|
|
1266
|
-
);
|
|
1267
|
-
function stop() {
|
|
1268
|
-
stop1();
|
|
1269
|
-
stop2();
|
|
1270
|
-
}
|
|
1271
|
-
return {
|
|
1272
|
-
width,
|
|
1273
|
-
height,
|
|
1274
|
-
stop
|
|
1275
|
-
};
|
|
1276
|
-
}
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
name: "UseElementSize",
|
|
461
|
+
props: [
|
|
462
|
+
"as",
|
|
463
|
+
"box",
|
|
464
|
+
"height",
|
|
465
|
+
"width",
|
|
466
|
+
"window"
|
|
467
|
+
]
|
|
468
|
+
}
|
|
469
|
+
);
|
|
1277
470
|
|
|
1278
471
|
const vElementSize = {
|
|
1279
472
|
mounted(el, binding) {
|
|
@@ -1285,116 +478,29 @@ const vElementSize = {
|
|
|
1285
478
|
}
|
|
1286
479
|
};
|
|
1287
480
|
|
|
1288
|
-
const UseElementVisibility = /* @__PURE__ */ defineComponent(
|
|
1289
|
-
|
|
1290
|
-
props: ["as"],
|
|
1291
|
-
setup(props, { slots }) {
|
|
481
|
+
const UseElementVisibility = /* @__PURE__ */ defineComponent(
|
|
482
|
+
(props, { slots }) => {
|
|
1292
483
|
const target = shallowRef();
|
|
1293
484
|
const data = reactive({
|
|
1294
|
-
isVisible: useElementVisibility
|
|
485
|
+
isVisible: useElementVisibility(target, props)
|
|
1295
486
|
});
|
|
1296
487
|
return () => {
|
|
1297
488
|
if (slots.default)
|
|
1298
489
|
return h(props.as || "div", { ref: target }, slots.default(data));
|
|
1299
490
|
};
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
const _target = toValue(target);
|
|
1314
|
-
return toArray(_target).map(unrefElement).filter(notNullish);
|
|
1315
|
-
});
|
|
1316
|
-
let cleanup = noop;
|
|
1317
|
-
const isActive = shallowRef(immediate);
|
|
1318
|
-
const stopWatch = isSupported.value ? watch(
|
|
1319
|
-
() => [targets.value, unrefElement(root), isActive.value],
|
|
1320
|
-
([targets2, root2]) => {
|
|
1321
|
-
cleanup();
|
|
1322
|
-
if (!isActive.value)
|
|
1323
|
-
return;
|
|
1324
|
-
if (!targets2.length)
|
|
1325
|
-
return;
|
|
1326
|
-
const observer = new IntersectionObserver(
|
|
1327
|
-
callback,
|
|
1328
|
-
{
|
|
1329
|
-
root: unrefElement(root2),
|
|
1330
|
-
rootMargin,
|
|
1331
|
-
threshold
|
|
1332
|
-
}
|
|
1333
|
-
);
|
|
1334
|
-
targets2.forEach((el) => el && observer.observe(el));
|
|
1335
|
-
cleanup = () => {
|
|
1336
|
-
observer.disconnect();
|
|
1337
|
-
cleanup = noop;
|
|
1338
|
-
};
|
|
1339
|
-
},
|
|
1340
|
-
{ immediate, flush: "post" }
|
|
1341
|
-
) : noop;
|
|
1342
|
-
const stop = () => {
|
|
1343
|
-
cleanup();
|
|
1344
|
-
stopWatch();
|
|
1345
|
-
isActive.value = false;
|
|
1346
|
-
};
|
|
1347
|
-
tryOnScopeDispose(stop);
|
|
1348
|
-
return {
|
|
1349
|
-
isSupported,
|
|
1350
|
-
isActive,
|
|
1351
|
-
pause() {
|
|
1352
|
-
cleanup();
|
|
1353
|
-
isActive.value = false;
|
|
1354
|
-
},
|
|
1355
|
-
resume() {
|
|
1356
|
-
isActive.value = true;
|
|
1357
|
-
},
|
|
1358
|
-
stop
|
|
1359
|
-
};
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
function useElementVisibility(element, options = {}) {
|
|
1363
|
-
const {
|
|
1364
|
-
window = defaultWindow,
|
|
1365
|
-
scrollTarget,
|
|
1366
|
-
threshold = 0,
|
|
1367
|
-
rootMargin,
|
|
1368
|
-
once = false
|
|
1369
|
-
} = options;
|
|
1370
|
-
const elementIsVisible = shallowRef(false);
|
|
1371
|
-
const { stop } = useIntersectionObserver(
|
|
1372
|
-
element,
|
|
1373
|
-
(intersectionObserverEntries) => {
|
|
1374
|
-
let isIntersecting = elementIsVisible.value;
|
|
1375
|
-
let latestTime = 0;
|
|
1376
|
-
for (const entry of intersectionObserverEntries) {
|
|
1377
|
-
if (entry.time >= latestTime) {
|
|
1378
|
-
latestTime = entry.time;
|
|
1379
|
-
isIntersecting = entry.isIntersecting;
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
elementIsVisible.value = isIntersecting;
|
|
1383
|
-
if (once) {
|
|
1384
|
-
watchOnce(elementIsVisible, () => {
|
|
1385
|
-
stop();
|
|
1386
|
-
});
|
|
1387
|
-
}
|
|
1388
|
-
},
|
|
1389
|
-
{
|
|
1390
|
-
root: scrollTarget,
|
|
1391
|
-
window,
|
|
1392
|
-
threshold,
|
|
1393
|
-
rootMargin: toValue(rootMargin)
|
|
1394
|
-
}
|
|
1395
|
-
);
|
|
1396
|
-
return elementIsVisible;
|
|
1397
|
-
}
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
name: "UseElementVisibility",
|
|
494
|
+
props: [
|
|
495
|
+
"as",
|
|
496
|
+
"once",
|
|
497
|
+
"rootMargin",
|
|
498
|
+
"scrollTarget",
|
|
499
|
+
"threshold",
|
|
500
|
+
"window"
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
);
|
|
1398
504
|
|
|
1399
505
|
const vElementVisibility = {
|
|
1400
506
|
mounted(el, binding) {
|
|
@@ -1410,190 +516,82 @@ const vElementVisibility = {
|
|
|
1410
516
|
}
|
|
1411
517
|
};
|
|
1412
518
|
|
|
1413
|
-
const UseEyeDropper = /* @__PURE__ */ defineComponent(
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
sRGBHex: String
|
|
1417
|
-
},
|
|
1418
|
-
setup(props, { slots }) {
|
|
1419
|
-
const data = reactive(useEyeDropper());
|
|
519
|
+
const UseEyeDropper = /* @__PURE__ */ defineComponent(
|
|
520
|
+
(props, { slots }) => {
|
|
521
|
+
const data = reactive(useEyeDropper(props));
|
|
1420
522
|
return () => {
|
|
1421
523
|
if (slots.default)
|
|
1422
524
|
return slots.default(data);
|
|
1423
525
|
};
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
name: "UseEyeDropper",
|
|
529
|
+
props: ["initialValue"]
|
|
1424
530
|
}
|
|
1425
|
-
|
|
531
|
+
);
|
|
1426
532
|
|
|
1427
|
-
const UseFullscreen = /* @__PURE__ */ defineComponent(
|
|
1428
|
-
|
|
1429
|
-
props: ["as"],
|
|
1430
|
-
setup(props, { slots }) {
|
|
533
|
+
const UseFullscreen = /* @__PURE__ */ defineComponent(
|
|
534
|
+
(props, { slots }) => {
|
|
1431
535
|
const target = shallowRef();
|
|
1432
|
-
const data = reactive(useFullscreen(target));
|
|
536
|
+
const data = reactive(useFullscreen(target, props));
|
|
1433
537
|
return () => {
|
|
1434
538
|
if (slots.default)
|
|
1435
539
|
return h(props.as || "div", { ref: target }, slots.default(data));
|
|
1436
540
|
};
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
name: "UseFullscreen",
|
|
544
|
+
props: [
|
|
545
|
+
"as",
|
|
546
|
+
"autoExit",
|
|
547
|
+
"document"
|
|
548
|
+
]
|
|
549
|
+
}
|
|
550
|
+
);
|
|
551
|
+
|
|
552
|
+
const UseGeolocation = /* @__PURE__ */ defineComponent(
|
|
553
|
+
(props, { slots }) => {
|
|
1444
554
|
const data = reactive(useGeolocation(props));
|
|
1445
555
|
return () => {
|
|
1446
556
|
if (slots.default)
|
|
1447
557
|
return slots.default(data);
|
|
1448
558
|
};
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
name: "UseGeolocation",
|
|
562
|
+
props: [
|
|
563
|
+
"enableHighAccuracy",
|
|
564
|
+
"immediate",
|
|
565
|
+
"maximumAge",
|
|
566
|
+
"navigator",
|
|
567
|
+
"timeout"
|
|
568
|
+
]
|
|
569
|
+
}
|
|
570
|
+
);
|
|
571
|
+
|
|
572
|
+
const UseIdle = /* @__PURE__ */ defineComponent(
|
|
573
|
+
(props, { slots }) => {
|
|
1456
574
|
const data = reactive(useIdle(props.timeout, props));
|
|
1457
575
|
return () => {
|
|
1458
576
|
if (slots.default)
|
|
1459
577
|
return slots.default(data);
|
|
1460
578
|
};
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
const isLoading = shallowRef(false);
|
|
1478
|
-
const error = shallowRef(void 0);
|
|
1479
|
-
async function execute(delay2 = 0, ...args) {
|
|
1480
|
-
if (resetOnExecute)
|
|
1481
|
-
state.value = initialState;
|
|
1482
|
-
error.value = void 0;
|
|
1483
|
-
isReady.value = false;
|
|
1484
|
-
isLoading.value = true;
|
|
1485
|
-
if (delay2 > 0)
|
|
1486
|
-
await promiseTimeout(delay2);
|
|
1487
|
-
const _promise = typeof promise === "function" ? promise(...args) : promise;
|
|
1488
|
-
try {
|
|
1489
|
-
const data = await _promise;
|
|
1490
|
-
state.value = data;
|
|
1491
|
-
isReady.value = true;
|
|
1492
|
-
onSuccess(data);
|
|
1493
|
-
} catch (e) {
|
|
1494
|
-
error.value = e;
|
|
1495
|
-
onError(e);
|
|
1496
|
-
if (throwError)
|
|
1497
|
-
throw e;
|
|
1498
|
-
} finally {
|
|
1499
|
-
isLoading.value = false;
|
|
1500
|
-
}
|
|
1501
|
-
return state.value;
|
|
1502
|
-
}
|
|
1503
|
-
if (immediate) {
|
|
1504
|
-
execute(delay);
|
|
1505
|
-
}
|
|
1506
|
-
const shell = {
|
|
1507
|
-
state,
|
|
1508
|
-
isReady,
|
|
1509
|
-
isLoading,
|
|
1510
|
-
error,
|
|
1511
|
-
execute,
|
|
1512
|
-
executeImmediate: (...args) => execute(0, ...args)
|
|
1513
|
-
};
|
|
1514
|
-
function waitUntilIsLoaded() {
|
|
1515
|
-
return new Promise((resolve, reject) => {
|
|
1516
|
-
until(isLoading).toBe(false).then(() => resolve(shell)).catch(reject);
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
return {
|
|
1520
|
-
...shell,
|
|
1521
|
-
then(onFulfilled, onRejected) {
|
|
1522
|
-
return waitUntilIsLoaded().then(onFulfilled, onRejected);
|
|
1523
|
-
}
|
|
1524
|
-
};
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
async function loadImage(options) {
|
|
1528
|
-
return new Promise((resolve, reject) => {
|
|
1529
|
-
const img = new Image();
|
|
1530
|
-
const { src, srcset, sizes, class: clazz, loading, crossorigin, referrerPolicy, width, height, decoding, fetchPriority, ismap, usemap } = options;
|
|
1531
|
-
img.src = src;
|
|
1532
|
-
if (srcset != null)
|
|
1533
|
-
img.srcset = srcset;
|
|
1534
|
-
if (sizes != null)
|
|
1535
|
-
img.sizes = sizes;
|
|
1536
|
-
if (clazz != null)
|
|
1537
|
-
img.className = clazz;
|
|
1538
|
-
if (loading != null)
|
|
1539
|
-
img.loading = loading;
|
|
1540
|
-
if (crossorigin != null)
|
|
1541
|
-
img.crossOrigin = crossorigin;
|
|
1542
|
-
if (referrerPolicy != null)
|
|
1543
|
-
img.referrerPolicy = referrerPolicy;
|
|
1544
|
-
if (width != null)
|
|
1545
|
-
img.width = width;
|
|
1546
|
-
if (height != null)
|
|
1547
|
-
img.height = height;
|
|
1548
|
-
if (decoding != null)
|
|
1549
|
-
img.decoding = decoding;
|
|
1550
|
-
if (fetchPriority != null)
|
|
1551
|
-
img.fetchPriority = fetchPriority;
|
|
1552
|
-
if (ismap != null)
|
|
1553
|
-
img.isMap = ismap;
|
|
1554
|
-
if (usemap != null)
|
|
1555
|
-
img.useMap = usemap;
|
|
1556
|
-
img.onload = () => resolve(img);
|
|
1557
|
-
img.onerror = reject;
|
|
1558
|
-
});
|
|
1559
|
-
}
|
|
1560
|
-
function useImage(options, asyncStateOptions = {}) {
|
|
1561
|
-
const state = useAsyncState(
|
|
1562
|
-
() => loadImage(toValue(options)),
|
|
1563
|
-
void 0,
|
|
1564
|
-
{
|
|
1565
|
-
resetOnExecute: true,
|
|
1566
|
-
...asyncStateOptions
|
|
1567
|
-
}
|
|
1568
|
-
);
|
|
1569
|
-
watch(
|
|
1570
|
-
() => toValue(options),
|
|
1571
|
-
() => state.execute(asyncStateOptions.delay),
|
|
1572
|
-
{ deep: true }
|
|
1573
|
-
);
|
|
1574
|
-
return state;
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
const UseImage = /* @__PURE__ */ defineComponent({
|
|
1578
|
-
name: "UseImage",
|
|
1579
|
-
props: [
|
|
1580
|
-
"src",
|
|
1581
|
-
"srcset",
|
|
1582
|
-
"sizes",
|
|
1583
|
-
"as",
|
|
1584
|
-
"alt",
|
|
1585
|
-
"class",
|
|
1586
|
-
"loading",
|
|
1587
|
-
"crossorigin",
|
|
1588
|
-
"referrerPolicy",
|
|
1589
|
-
"width",
|
|
1590
|
-
"height",
|
|
1591
|
-
"decoding",
|
|
1592
|
-
"fetchPriority",
|
|
1593
|
-
"ismap",
|
|
1594
|
-
"usemap"
|
|
1595
|
-
],
|
|
1596
|
-
setup(props, { slots }) {
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
name: "UseIdle",
|
|
582
|
+
props: [
|
|
583
|
+
"eventFilter",
|
|
584
|
+
"events",
|
|
585
|
+
"initialState",
|
|
586
|
+
"listenForVisibilityChange",
|
|
587
|
+
"timeout",
|
|
588
|
+
"window"
|
|
589
|
+
]
|
|
590
|
+
}
|
|
591
|
+
);
|
|
592
|
+
|
|
593
|
+
const UseImage = /* @__PURE__ */ defineComponent(
|
|
594
|
+
(props, { slots }) => {
|
|
1597
595
|
const data = reactive(useImage(props));
|
|
1598
596
|
return () => {
|
|
1599
597
|
if (data.isLoading && slots.loading)
|
|
@@ -1604,258 +602,28 @@ const UseImage = /* @__PURE__ */ defineComponent({
|
|
|
1604
602
|
return slots.default(data);
|
|
1605
603
|
return h(props.as || "img", props);
|
|
1606
604
|
};
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
bottom: 0
|
|
1630
|
-
},
|
|
1631
|
-
observe: _observe = {
|
|
1632
|
-
mutation: false
|
|
1633
|
-
},
|
|
1634
|
-
eventListenerOptions = {
|
|
1635
|
-
capture: false,
|
|
1636
|
-
passive: true
|
|
1637
|
-
},
|
|
1638
|
-
behavior = "auto",
|
|
1639
|
-
window = defaultWindow,
|
|
1640
|
-
onError = (e) => {
|
|
1641
|
-
console.error(e);
|
|
1642
|
-
}
|
|
1643
|
-
} = options;
|
|
1644
|
-
const observe = typeof _observe === "boolean" ? {
|
|
1645
|
-
mutation: _observe
|
|
1646
|
-
} : _observe;
|
|
1647
|
-
const internalX = shallowRef(0);
|
|
1648
|
-
const internalY = shallowRef(0);
|
|
1649
|
-
const x = computed({
|
|
1650
|
-
get() {
|
|
1651
|
-
return internalX.value;
|
|
1652
|
-
},
|
|
1653
|
-
set(x2) {
|
|
1654
|
-
scrollTo(x2, void 0);
|
|
1655
|
-
}
|
|
1656
|
-
});
|
|
1657
|
-
const y = computed({
|
|
1658
|
-
get() {
|
|
1659
|
-
return internalY.value;
|
|
1660
|
-
},
|
|
1661
|
-
set(y2) {
|
|
1662
|
-
scrollTo(void 0, y2);
|
|
1663
|
-
}
|
|
1664
|
-
});
|
|
1665
|
-
function scrollTo(_x, _y) {
|
|
1666
|
-
var _a, _b, _c, _d;
|
|
1667
|
-
if (!window)
|
|
1668
|
-
return;
|
|
1669
|
-
const _element = toValue(element);
|
|
1670
|
-
if (!_element)
|
|
1671
|
-
return;
|
|
1672
|
-
(_c = _element instanceof Document ? window.document.body : _element) == null ? void 0 : _c.scrollTo({
|
|
1673
|
-
top: (_a = toValue(_y)) != null ? _a : y.value,
|
|
1674
|
-
left: (_b = toValue(_x)) != null ? _b : x.value,
|
|
1675
|
-
behavior: toValue(behavior)
|
|
1676
|
-
});
|
|
1677
|
-
const scrollContainer = ((_d = _element == null ? void 0 : _element.document) == null ? void 0 : _d.documentElement) || (_element == null ? void 0 : _element.documentElement) || _element;
|
|
1678
|
-
if (x != null)
|
|
1679
|
-
internalX.value = scrollContainer.scrollLeft;
|
|
1680
|
-
if (y != null)
|
|
1681
|
-
internalY.value = scrollContainer.scrollTop;
|
|
1682
|
-
}
|
|
1683
|
-
const isScrolling = shallowRef(false);
|
|
1684
|
-
const arrivedState = reactive({
|
|
1685
|
-
left: true,
|
|
1686
|
-
right: false,
|
|
1687
|
-
top: true,
|
|
1688
|
-
bottom: false
|
|
1689
|
-
});
|
|
1690
|
-
const directions = reactive({
|
|
1691
|
-
left: false,
|
|
1692
|
-
right: false,
|
|
1693
|
-
top: false,
|
|
1694
|
-
bottom: false
|
|
1695
|
-
});
|
|
1696
|
-
const onScrollEnd = (e) => {
|
|
1697
|
-
if (!isScrolling.value)
|
|
1698
|
-
return;
|
|
1699
|
-
isScrolling.value = false;
|
|
1700
|
-
directions.left = false;
|
|
1701
|
-
directions.right = false;
|
|
1702
|
-
directions.top = false;
|
|
1703
|
-
directions.bottom = false;
|
|
1704
|
-
onStop(e);
|
|
1705
|
-
};
|
|
1706
|
-
const onScrollEndDebounced = useDebounceFn(onScrollEnd, throttle + idle);
|
|
1707
|
-
const setArrivedState = (target) => {
|
|
1708
|
-
var _a;
|
|
1709
|
-
if (!window)
|
|
1710
|
-
return;
|
|
1711
|
-
const el = ((_a = target == null ? void 0 : target.document) == null ? void 0 : _a.documentElement) || (target == null ? void 0 : target.documentElement) || unrefElement(target);
|
|
1712
|
-
const { display, flexDirection, direction } = getComputedStyle(el);
|
|
1713
|
-
const directionMultipler = direction === "rtl" ? -1 : 1;
|
|
1714
|
-
const scrollLeft = el.scrollLeft;
|
|
1715
|
-
directions.left = scrollLeft < internalX.value;
|
|
1716
|
-
directions.right = scrollLeft > internalX.value;
|
|
1717
|
-
const left = Math.abs(scrollLeft * directionMultipler) <= (offset.left || 0);
|
|
1718
|
-
const right = Math.abs(scrollLeft * directionMultipler) + el.clientWidth >= el.scrollWidth - (offset.right || 0) - ARRIVED_STATE_THRESHOLD_PIXELS;
|
|
1719
|
-
if (display === "flex" && flexDirection === "row-reverse") {
|
|
1720
|
-
arrivedState.left = right;
|
|
1721
|
-
arrivedState.right = left;
|
|
1722
|
-
} else {
|
|
1723
|
-
arrivedState.left = left;
|
|
1724
|
-
arrivedState.right = right;
|
|
1725
|
-
}
|
|
1726
|
-
internalX.value = scrollLeft;
|
|
1727
|
-
let scrollTop = el.scrollTop;
|
|
1728
|
-
if (target === window.document && !scrollTop)
|
|
1729
|
-
scrollTop = window.document.body.scrollTop;
|
|
1730
|
-
directions.top = scrollTop < internalY.value;
|
|
1731
|
-
directions.bottom = scrollTop > internalY.value;
|
|
1732
|
-
const top = Math.abs(scrollTop) <= (offset.top || 0);
|
|
1733
|
-
const bottom = Math.abs(scrollTop) + el.clientHeight >= el.scrollHeight - (offset.bottom || 0) - ARRIVED_STATE_THRESHOLD_PIXELS;
|
|
1734
|
-
if (display === "flex" && flexDirection === "column-reverse") {
|
|
1735
|
-
arrivedState.top = bottom;
|
|
1736
|
-
arrivedState.bottom = top;
|
|
1737
|
-
} else {
|
|
1738
|
-
arrivedState.top = top;
|
|
1739
|
-
arrivedState.bottom = bottom;
|
|
1740
|
-
}
|
|
1741
|
-
internalY.value = scrollTop;
|
|
1742
|
-
};
|
|
1743
|
-
const onScrollHandler = (e) => {
|
|
1744
|
-
var _a;
|
|
1745
|
-
if (!window)
|
|
1746
|
-
return;
|
|
1747
|
-
const eventTarget = (_a = e.target.documentElement) != null ? _a : e.target;
|
|
1748
|
-
setArrivedState(eventTarget);
|
|
1749
|
-
isScrolling.value = true;
|
|
1750
|
-
onScrollEndDebounced(e);
|
|
1751
|
-
onScroll(e);
|
|
1752
|
-
};
|
|
1753
|
-
useEventListener(
|
|
1754
|
-
element,
|
|
1755
|
-
"scroll",
|
|
1756
|
-
throttle ? useThrottleFn(onScrollHandler, throttle, true, false) : onScrollHandler,
|
|
1757
|
-
eventListenerOptions
|
|
1758
|
-
);
|
|
1759
|
-
tryOnMounted(() => {
|
|
1760
|
-
try {
|
|
1761
|
-
const _element = toValue(element);
|
|
1762
|
-
if (!_element)
|
|
1763
|
-
return;
|
|
1764
|
-
setArrivedState(_element);
|
|
1765
|
-
} catch (e) {
|
|
1766
|
-
onError(e);
|
|
1767
|
-
}
|
|
1768
|
-
});
|
|
1769
|
-
if ((observe == null ? void 0 : observe.mutation) && element != null && element !== window && element !== document) {
|
|
1770
|
-
useMutationObserver(
|
|
1771
|
-
element,
|
|
1772
|
-
() => {
|
|
1773
|
-
const _element = toValue(element);
|
|
1774
|
-
if (!_element)
|
|
1775
|
-
return;
|
|
1776
|
-
setArrivedState(_element);
|
|
1777
|
-
},
|
|
1778
|
-
{
|
|
1779
|
-
attributes: true,
|
|
1780
|
-
childList: true,
|
|
1781
|
-
subtree: true
|
|
1782
|
-
}
|
|
1783
|
-
);
|
|
1784
|
-
}
|
|
1785
|
-
useEventListener(
|
|
1786
|
-
element,
|
|
1787
|
-
"scrollend",
|
|
1788
|
-
onScrollEnd,
|
|
1789
|
-
eventListenerOptions
|
|
1790
|
-
);
|
|
1791
|
-
return {
|
|
1792
|
-
x,
|
|
1793
|
-
y,
|
|
1794
|
-
isScrolling,
|
|
1795
|
-
arrivedState,
|
|
1796
|
-
directions,
|
|
1797
|
-
measure() {
|
|
1798
|
-
const _element = toValue(element);
|
|
1799
|
-
if (window && _element)
|
|
1800
|
-
setArrivedState(_element);
|
|
1801
|
-
}
|
|
1802
|
-
};
|
|
1803
|
-
}
|
|
1804
|
-
|
|
1805
|
-
function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
1806
|
-
var _a;
|
|
1807
|
-
const {
|
|
1808
|
-
direction = "bottom",
|
|
1809
|
-
interval = 100,
|
|
1810
|
-
canLoadMore = () => true
|
|
1811
|
-
} = options;
|
|
1812
|
-
const state = reactive(useScroll(
|
|
1813
|
-
element,
|
|
1814
|
-
{
|
|
1815
|
-
...options,
|
|
1816
|
-
offset: {
|
|
1817
|
-
[direction]: (_a = options.distance) != null ? _a : 0,
|
|
1818
|
-
...options.offset
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
));
|
|
1822
|
-
const promise = ref();
|
|
1823
|
-
const isLoading = computed(() => !!promise.value);
|
|
1824
|
-
const observedElement = computed(() => {
|
|
1825
|
-
return resolveElement(toValue(element));
|
|
1826
|
-
});
|
|
1827
|
-
const isElementVisible = useElementVisibility(observedElement);
|
|
1828
|
-
function checkAndLoad() {
|
|
1829
|
-
state.measure();
|
|
1830
|
-
if (!observedElement.value || !isElementVisible.value || !canLoadMore(observedElement.value))
|
|
1831
|
-
return;
|
|
1832
|
-
const { scrollHeight, clientHeight, scrollWidth, clientWidth } = observedElement.value;
|
|
1833
|
-
const isNarrower = direction === "bottom" || direction === "top" ? scrollHeight <= clientHeight : scrollWidth <= clientWidth;
|
|
1834
|
-
if (state.arrivedState[direction] || isNarrower) {
|
|
1835
|
-
if (!promise.value) {
|
|
1836
|
-
promise.value = Promise.all([
|
|
1837
|
-
onLoadMore(state),
|
|
1838
|
-
new Promise((resolve) => setTimeout(resolve, interval))
|
|
1839
|
-
]).finally(() => {
|
|
1840
|
-
promise.value = null;
|
|
1841
|
-
nextTick(() => checkAndLoad());
|
|
1842
|
-
});
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
const stop = watch(
|
|
1847
|
-
() => [state.arrivedState[direction], isElementVisible.value],
|
|
1848
|
-
checkAndLoad,
|
|
1849
|
-
{ immediate: true }
|
|
1850
|
-
);
|
|
1851
|
-
tryOnUnmounted(stop);
|
|
1852
|
-
return {
|
|
1853
|
-
isLoading,
|
|
1854
|
-
reset() {
|
|
1855
|
-
nextTick(() => checkAndLoad());
|
|
1856
|
-
}
|
|
1857
|
-
};
|
|
1858
|
-
}
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
name: "UseImage",
|
|
608
|
+
props: [
|
|
609
|
+
"alt",
|
|
610
|
+
"as",
|
|
611
|
+
"class",
|
|
612
|
+
"crossorigin",
|
|
613
|
+
"decoding",
|
|
614
|
+
"fetchPriority",
|
|
615
|
+
"height",
|
|
616
|
+
"ismap",
|
|
617
|
+
"loading",
|
|
618
|
+
"referrerPolicy",
|
|
619
|
+
"sizes",
|
|
620
|
+
"src",
|
|
621
|
+
"srcset",
|
|
622
|
+
"usemap",
|
|
623
|
+
"width"
|
|
624
|
+
]
|
|
625
|
+
}
|
|
626
|
+
);
|
|
1859
627
|
|
|
1860
628
|
const vInfiniteScroll = {
|
|
1861
629
|
mounted(el, binding) {
|
|
@@ -1875,208 +643,56 @@ const vIntersectionObserver = {
|
|
|
1875
643
|
}
|
|
1876
644
|
};
|
|
1877
645
|
|
|
1878
|
-
const UseMouse = /* @__PURE__ */ defineComponent(
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
setup(props, { slots }) {
|
|
1882
|
-
const data = reactive(useMouse$1(props));
|
|
646
|
+
const UseMouse = /* @__PURE__ */ defineComponent(
|
|
647
|
+
(props, { slots }) => {
|
|
648
|
+
const data = reactive(useMouse(props));
|
|
1883
649
|
return () => {
|
|
1884
650
|
if (slots.default)
|
|
1885
651
|
return slots.default(data);
|
|
1886
652
|
};
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
name: "UseMouse",
|
|
656
|
+
props: [
|
|
657
|
+
"eventFilter",
|
|
658
|
+
"initialValue",
|
|
659
|
+
"resetOnTouchEnds",
|
|
660
|
+
"scroll",
|
|
661
|
+
"target",
|
|
662
|
+
"touch",
|
|
663
|
+
"type",
|
|
664
|
+
"window"
|
|
665
|
+
]
|
|
666
|
+
}
|
|
667
|
+
);
|
|
668
|
+
|
|
669
|
+
const UseMouseInElement = /* @__PURE__ */ defineComponent(
|
|
670
|
+
(props, { slots }) => {
|
|
1894
671
|
const target = shallowRef();
|
|
1895
|
-
const data = reactive(useMouseInElement
|
|
672
|
+
const data = reactive(useMouseInElement(target, props));
|
|
1896
673
|
return () => {
|
|
1897
674
|
if (slots.default)
|
|
1898
675
|
return h(props.as || "div", { ref: target }, slots.default(data));
|
|
1899
676
|
};
|
|
1900
|
-
}
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
} = options;
|
|
1920
|
-
let _prevMouseEvent = null;
|
|
1921
|
-
let _prevScrollX = 0;
|
|
1922
|
-
let _prevScrollY = 0;
|
|
1923
|
-
const x = shallowRef(initialValue.x);
|
|
1924
|
-
const y = shallowRef(initialValue.y);
|
|
1925
|
-
const sourceType = shallowRef(null);
|
|
1926
|
-
const extractor = typeof type === "function" ? type : UseMouseBuiltinExtractors[type];
|
|
1927
|
-
const mouseHandler = (event) => {
|
|
1928
|
-
const result = extractor(event);
|
|
1929
|
-
_prevMouseEvent = event;
|
|
1930
|
-
if (result) {
|
|
1931
|
-
[x.value, y.value] = result;
|
|
1932
|
-
sourceType.value = "mouse";
|
|
1933
|
-
}
|
|
1934
|
-
if (window) {
|
|
1935
|
-
_prevScrollX = window.scrollX;
|
|
1936
|
-
_prevScrollY = window.scrollY;
|
|
1937
|
-
}
|
|
1938
|
-
};
|
|
1939
|
-
const touchHandler = (event) => {
|
|
1940
|
-
if (event.touches.length > 0) {
|
|
1941
|
-
const result = extractor(event.touches[0]);
|
|
1942
|
-
if (result) {
|
|
1943
|
-
[x.value, y.value] = result;
|
|
1944
|
-
sourceType.value = "touch";
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
};
|
|
1948
|
-
const scrollHandler = () => {
|
|
1949
|
-
if (!_prevMouseEvent || !window)
|
|
1950
|
-
return;
|
|
1951
|
-
const pos = extractor(_prevMouseEvent);
|
|
1952
|
-
if (_prevMouseEvent instanceof MouseEvent && pos) {
|
|
1953
|
-
x.value = pos[0] + window.scrollX - _prevScrollX;
|
|
1954
|
-
y.value = pos[1] + window.scrollY - _prevScrollY;
|
|
1955
|
-
}
|
|
1956
|
-
};
|
|
1957
|
-
const reset = () => {
|
|
1958
|
-
x.value = initialValue.x;
|
|
1959
|
-
y.value = initialValue.y;
|
|
1960
|
-
};
|
|
1961
|
-
const mouseHandlerWrapper = eventFilter ? (event) => eventFilter(() => mouseHandler(event), {}) : (event) => mouseHandler(event);
|
|
1962
|
-
const touchHandlerWrapper = eventFilter ? (event) => eventFilter(() => touchHandler(event), {}) : (event) => touchHandler(event);
|
|
1963
|
-
const scrollHandlerWrapper = eventFilter ? () => eventFilter(() => scrollHandler(), {}) : () => scrollHandler();
|
|
1964
|
-
if (target) {
|
|
1965
|
-
const listenerOptions = { passive: true };
|
|
1966
|
-
useEventListener(target, ["mousemove", "dragover"], mouseHandlerWrapper, listenerOptions);
|
|
1967
|
-
if (touch && type !== "movement") {
|
|
1968
|
-
useEventListener(target, ["touchstart", "touchmove"], touchHandlerWrapper, listenerOptions);
|
|
1969
|
-
if (resetOnTouchEnds)
|
|
1970
|
-
useEventListener(target, "touchend", reset, listenerOptions);
|
|
1971
|
-
}
|
|
1972
|
-
if (scroll && type === "page")
|
|
1973
|
-
useEventListener(window, "scroll", scrollHandlerWrapper, listenerOptions);
|
|
1974
|
-
}
|
|
1975
|
-
return {
|
|
1976
|
-
x,
|
|
1977
|
-
y,
|
|
1978
|
-
sourceType
|
|
1979
|
-
};
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
function useMouseInElement(target, options = {}) {
|
|
1983
|
-
const {
|
|
1984
|
-
windowResize = true,
|
|
1985
|
-
windowScroll = true,
|
|
1986
|
-
handleOutside = true,
|
|
1987
|
-
window = defaultWindow
|
|
1988
|
-
} = options;
|
|
1989
|
-
const type = options.type || "page";
|
|
1990
|
-
const { x, y, sourceType } = useMouse(options);
|
|
1991
|
-
const targetRef = shallowRef(target != null ? target : window == null ? void 0 : window.document.body);
|
|
1992
|
-
const elementX = shallowRef(0);
|
|
1993
|
-
const elementY = shallowRef(0);
|
|
1994
|
-
const elementPositionX = shallowRef(0);
|
|
1995
|
-
const elementPositionY = shallowRef(0);
|
|
1996
|
-
const elementHeight = shallowRef(0);
|
|
1997
|
-
const elementWidth = shallowRef(0);
|
|
1998
|
-
const isOutside = shallowRef(true);
|
|
1999
|
-
function update() {
|
|
2000
|
-
if (!window)
|
|
2001
|
-
return;
|
|
2002
|
-
const el = unrefElement(targetRef);
|
|
2003
|
-
if (!el || !(el instanceof Element))
|
|
2004
|
-
return;
|
|
2005
|
-
const {
|
|
2006
|
-
left,
|
|
2007
|
-
top,
|
|
2008
|
-
width,
|
|
2009
|
-
height
|
|
2010
|
-
} = el.getBoundingClientRect();
|
|
2011
|
-
elementPositionX.value = left + (type === "page" ? window.pageXOffset : 0);
|
|
2012
|
-
elementPositionY.value = top + (type === "page" ? window.pageYOffset : 0);
|
|
2013
|
-
elementHeight.value = height;
|
|
2014
|
-
elementWidth.value = width;
|
|
2015
|
-
const elX = x.value - elementPositionX.value;
|
|
2016
|
-
const elY = y.value - elementPositionY.value;
|
|
2017
|
-
isOutside.value = width === 0 || height === 0 || elX < 0 || elY < 0 || elX > width || elY > height;
|
|
2018
|
-
if (handleOutside || !isOutside.value) {
|
|
2019
|
-
elementX.value = elX;
|
|
2020
|
-
elementY.value = elY;
|
|
2021
|
-
}
|
|
2022
|
-
}
|
|
2023
|
-
const stopFnList = [];
|
|
2024
|
-
function stop() {
|
|
2025
|
-
stopFnList.forEach((fn) => fn());
|
|
2026
|
-
stopFnList.length = 0;
|
|
2027
|
-
}
|
|
2028
|
-
tryOnMounted(() => {
|
|
2029
|
-
update();
|
|
2030
|
-
});
|
|
2031
|
-
if (window) {
|
|
2032
|
-
const {
|
|
2033
|
-
stop: stopResizeObserver
|
|
2034
|
-
} = useResizeObserver(targetRef, update);
|
|
2035
|
-
const {
|
|
2036
|
-
stop: stopMutationObserver
|
|
2037
|
-
} = useMutationObserver(targetRef, update, {
|
|
2038
|
-
attributeFilter: ["style", "class"]
|
|
2039
|
-
});
|
|
2040
|
-
const stopWatch = watch(
|
|
2041
|
-
[targetRef, x, y],
|
|
2042
|
-
update
|
|
2043
|
-
);
|
|
2044
|
-
stopFnList.push(
|
|
2045
|
-
stopResizeObserver,
|
|
2046
|
-
stopMutationObserver,
|
|
2047
|
-
stopWatch
|
|
2048
|
-
);
|
|
2049
|
-
useEventListener(
|
|
2050
|
-
document,
|
|
2051
|
-
"mouseleave",
|
|
2052
|
-
() => isOutside.value = true,
|
|
2053
|
-
{ passive: true }
|
|
2054
|
-
);
|
|
2055
|
-
if (windowScroll) {
|
|
2056
|
-
stopFnList.push(
|
|
2057
|
-
useEventListener("scroll", update, { capture: true, passive: true })
|
|
2058
|
-
);
|
|
2059
|
-
}
|
|
2060
|
-
if (windowResize) {
|
|
2061
|
-
stopFnList.push(
|
|
2062
|
-
useEventListener("resize", update, { passive: true })
|
|
2063
|
-
);
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
return {
|
|
2067
|
-
x,
|
|
2068
|
-
y,
|
|
2069
|
-
sourceType,
|
|
2070
|
-
elementX,
|
|
2071
|
-
elementY,
|
|
2072
|
-
elementPositionX,
|
|
2073
|
-
elementPositionY,
|
|
2074
|
-
elementHeight,
|
|
2075
|
-
elementWidth,
|
|
2076
|
-
isOutside,
|
|
2077
|
-
stop
|
|
2078
|
-
};
|
|
2079
|
-
}
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
name: "UseMouseInElement",
|
|
680
|
+
props: [
|
|
681
|
+
"as",
|
|
682
|
+
"eventFilter",
|
|
683
|
+
"handleOutside",
|
|
684
|
+
"initialValue",
|
|
685
|
+
"resetOnTouchEnds",
|
|
686
|
+
"scroll",
|
|
687
|
+
"target",
|
|
688
|
+
"touch",
|
|
689
|
+
"type",
|
|
690
|
+
"window",
|
|
691
|
+
"windowResize",
|
|
692
|
+
"windowScroll"
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
);
|
|
2080
696
|
|
|
2081
697
|
const vMouseInElement = {
|
|
2082
698
|
mounted(el, binding) {
|
|
@@ -2086,75 +702,81 @@ const vMouseInElement = {
|
|
|
2086
702
|
}
|
|
2087
703
|
};
|
|
2088
704
|
|
|
2089
|
-
const UseMousePressed = /* @__PURE__ */ defineComponent(
|
|
2090
|
-
|
|
2091
|
-
props: ["touch", "initialValue", "as"],
|
|
2092
|
-
setup(props, { slots }) {
|
|
705
|
+
const UseMousePressed = /* @__PURE__ */ defineComponent(
|
|
706
|
+
(props, { slots }) => {
|
|
2093
707
|
const target = shallowRef();
|
|
2094
708
|
const data = reactive(useMousePressed({ ...props, target }));
|
|
2095
709
|
return () => {
|
|
2096
710
|
if (slots.default)
|
|
2097
711
|
return h(props.as || "div", { ref: target }, slots.default(data));
|
|
2098
712
|
};
|
|
2099
|
-
}
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
name: "UseMousePressed",
|
|
716
|
+
props: [
|
|
717
|
+
"as",
|
|
718
|
+
"capture",
|
|
719
|
+
"drag",
|
|
720
|
+
"initialValue",
|
|
721
|
+
"onPressed",
|
|
722
|
+
"onReleased",
|
|
723
|
+
"touch",
|
|
724
|
+
"window"
|
|
725
|
+
]
|
|
726
|
+
}
|
|
727
|
+
);
|
|
728
|
+
|
|
729
|
+
const UseNetwork = /* @__PURE__ */ defineComponent(
|
|
730
|
+
(props, { slots }) => {
|
|
731
|
+
const data = reactive(useNetwork(props));
|
|
2106
732
|
return () => {
|
|
2107
733
|
if (slots.default)
|
|
2108
734
|
return slots.default(data);
|
|
2109
735
|
};
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
name: "UseNetwork",
|
|
739
|
+
props: ["window"]
|
|
2110
740
|
}
|
|
2111
|
-
|
|
741
|
+
);
|
|
2112
742
|
|
|
2113
|
-
const UseNow = /* @__PURE__ */ defineComponent(
|
|
2114
|
-
|
|
2115
|
-
props: ["interval"],
|
|
2116
|
-
setup(props, { slots }) {
|
|
743
|
+
const UseNow = /* @__PURE__ */ defineComponent(
|
|
744
|
+
(props, { slots }) => {
|
|
2117
745
|
const data = reactive(useNow({ ...props, controls: true }));
|
|
2118
746
|
return () => {
|
|
2119
747
|
if (slots.default)
|
|
2120
748
|
return slots.default(data);
|
|
2121
749
|
};
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
name: "UseNow",
|
|
753
|
+
props: [
|
|
754
|
+
"immediate",
|
|
755
|
+
"interval"
|
|
756
|
+
]
|
|
757
|
+
}
|
|
758
|
+
);
|
|
759
|
+
|
|
760
|
+
const UseObjectUrl = /* @__PURE__ */ defineComponent(
|
|
761
|
+
(props, { slots }) => {
|
|
762
|
+
const { object } = toRefs$1(props);
|
|
2132
763
|
const url = useObjectUrl(object);
|
|
2133
764
|
return () => {
|
|
2134
765
|
if (slots.default && url.value)
|
|
2135
|
-
return slots.default(url);
|
|
766
|
+
return slots.default(url.value);
|
|
2136
767
|
};
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
name: "UseObjectUrl",
|
|
771
|
+
props: ["object"]
|
|
2137
772
|
}
|
|
2138
|
-
|
|
773
|
+
);
|
|
2139
774
|
|
|
2140
|
-
const UseOffsetPagination = /* @__PURE__ */ defineComponent(
|
|
2141
|
-
|
|
2142
|
-
props: [
|
|
2143
|
-
"total",
|
|
2144
|
-
"page",
|
|
2145
|
-
"pageSize",
|
|
2146
|
-
"onPageChange",
|
|
2147
|
-
"onPageSizeChange",
|
|
2148
|
-
"onPageCountChange"
|
|
2149
|
-
],
|
|
2150
|
-
emits: [
|
|
2151
|
-
"page-change",
|
|
2152
|
-
"page-size-change",
|
|
2153
|
-
"page-count-change"
|
|
2154
|
-
],
|
|
2155
|
-
setup(props, { slots, emit }) {
|
|
775
|
+
const UseOffsetPagination = /* @__PURE__ */ defineComponent(
|
|
776
|
+
(props, { slots, emit }) => {
|
|
2156
777
|
const data = reactive(useOffsetPagination({
|
|
2157
778
|
...props,
|
|
779
|
+
total: toValue(props.total) || void 0,
|
|
2158
780
|
onPageChange(...args) {
|
|
2159
781
|
var _a;
|
|
2160
782
|
(_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
|
|
@@ -2175,43 +797,54 @@ const UseOffsetPagination = /* @__PURE__ */ defineComponent({
|
|
|
2175
797
|
if (slots.default)
|
|
2176
798
|
return slots.default(data);
|
|
2177
799
|
};
|
|
2178
|
-
}
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
name: "UseOffsetPagination",
|
|
803
|
+
props: [
|
|
804
|
+
"onPageChange",
|
|
805
|
+
"onPageCountChange",
|
|
806
|
+
"onPageSizeChange",
|
|
807
|
+
"page",
|
|
808
|
+
"pageSize",
|
|
809
|
+
"total"
|
|
810
|
+
]
|
|
811
|
+
}
|
|
812
|
+
);
|
|
813
|
+
|
|
814
|
+
const UseOnline = /* @__PURE__ */ defineComponent(
|
|
815
|
+
(props, { slots }) => {
|
|
2184
816
|
const data = reactive({
|
|
2185
|
-
isOnline: useOnline()
|
|
817
|
+
isOnline: useOnline(props)
|
|
2186
818
|
});
|
|
2187
819
|
return () => {
|
|
2188
820
|
if (slots.default)
|
|
2189
821
|
return slots.default(data);
|
|
2190
822
|
};
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
name: "UseOnline",
|
|
826
|
+
props: ["window"]
|
|
2191
827
|
}
|
|
2192
|
-
|
|
828
|
+
);
|
|
2193
829
|
|
|
2194
|
-
const UsePageLeave = /* @__PURE__ */ defineComponent(
|
|
2195
|
-
|
|
2196
|
-
setup(props, { slots }) {
|
|
830
|
+
const UsePageLeave = /* @__PURE__ */ defineComponent(
|
|
831
|
+
(props, { slots }) => {
|
|
2197
832
|
const data = reactive({
|
|
2198
|
-
isLeft: usePageLeave()
|
|
833
|
+
isLeft: usePageLeave(props)
|
|
2199
834
|
});
|
|
2200
835
|
return () => {
|
|
2201
836
|
if (slots.default)
|
|
2202
837
|
return slots.default(data);
|
|
2203
838
|
};
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
name: "UsePageLeave",
|
|
842
|
+
props: ["window"]
|
|
2204
843
|
}
|
|
2205
|
-
|
|
844
|
+
);
|
|
2206
845
|
|
|
2207
|
-
const UsePointer = /* @__PURE__ */ defineComponent(
|
|
2208
|
-
|
|
2209
|
-
props: [
|
|
2210
|
-
"pointerTypes",
|
|
2211
|
-
"initialValue",
|
|
2212
|
-
"target"
|
|
2213
|
-
],
|
|
2214
|
-
setup(props, { slots }) {
|
|
846
|
+
const UsePointer = /* @__PURE__ */ defineComponent(
|
|
847
|
+
(props, { slots }) => {
|
|
2215
848
|
const el = shallowRef(null);
|
|
2216
849
|
const data = reactive(usePointer({
|
|
2217
850
|
...props,
|
|
@@ -2219,88 +852,117 @@ const UsePointer = /* @__PURE__ */ defineComponent({
|
|
|
2219
852
|
}));
|
|
2220
853
|
return () => {
|
|
2221
854
|
if (slots.default)
|
|
2222
|
-
return slots.default(data
|
|
855
|
+
return slots.default(data);
|
|
2223
856
|
};
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
name: "UsePointer",
|
|
860
|
+
props: [
|
|
861
|
+
"initialValue",
|
|
862
|
+
"pointerTypes",
|
|
863
|
+
"target",
|
|
864
|
+
"window"
|
|
865
|
+
]
|
|
866
|
+
}
|
|
867
|
+
);
|
|
868
|
+
|
|
869
|
+
const UsePointerLock = /* @__PURE__ */ defineComponent(
|
|
870
|
+
(props, { slots }) => {
|
|
2231
871
|
const target = shallowRef();
|
|
2232
872
|
const data = reactive(usePointerLock(target));
|
|
2233
873
|
return () => {
|
|
2234
874
|
if (slots.default)
|
|
2235
875
|
return h(props.as || "div", { ref: target }, slots.default(data));
|
|
2236
876
|
};
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
name: "UsePointerLock",
|
|
880
|
+
props: [
|
|
881
|
+
"as",
|
|
882
|
+
"document"
|
|
883
|
+
]
|
|
2237
884
|
}
|
|
2238
|
-
|
|
885
|
+
);
|
|
2239
886
|
|
|
2240
|
-
const UsePreferredColorScheme = /* @__PURE__ */ defineComponent(
|
|
2241
|
-
|
|
2242
|
-
setup(props, { slots }) {
|
|
887
|
+
const UsePreferredColorScheme = /* @__PURE__ */ defineComponent(
|
|
888
|
+
(props, { slots }) => {
|
|
2243
889
|
const data = reactive({
|
|
2244
|
-
colorScheme: usePreferredColorScheme()
|
|
890
|
+
colorScheme: usePreferredColorScheme(props)
|
|
2245
891
|
});
|
|
2246
892
|
return () => {
|
|
2247
893
|
if (slots.default)
|
|
2248
894
|
return slots.default(data);
|
|
2249
895
|
};
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
name: "UsePreferredColorScheme",
|
|
899
|
+
props: ["window"]
|
|
2250
900
|
}
|
|
2251
|
-
|
|
901
|
+
);
|
|
2252
902
|
|
|
2253
|
-
const UsePreferredContrast = /* @__PURE__ */ defineComponent(
|
|
2254
|
-
|
|
2255
|
-
setup(props, { slots }) {
|
|
903
|
+
const UsePreferredContrast = /* @__PURE__ */ defineComponent(
|
|
904
|
+
(props, { slots }) => {
|
|
2256
905
|
const data = reactive({
|
|
2257
|
-
contrast: usePreferredContrast()
|
|
906
|
+
contrast: usePreferredContrast(props)
|
|
2258
907
|
});
|
|
2259
908
|
return () => {
|
|
2260
909
|
if (slots.default)
|
|
2261
910
|
return slots.default(data);
|
|
2262
911
|
};
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
name: "UsePreferredContrast",
|
|
915
|
+
props: ["window"]
|
|
2263
916
|
}
|
|
2264
|
-
|
|
917
|
+
);
|
|
2265
918
|
|
|
2266
|
-
const UsePreferredDark = /* @__PURE__ */ defineComponent(
|
|
2267
|
-
|
|
2268
|
-
setup(props, { slots }) {
|
|
919
|
+
const UsePreferredDark = /* @__PURE__ */ defineComponent(
|
|
920
|
+
(props, { slots }) => {
|
|
2269
921
|
const data = reactive({
|
|
2270
|
-
prefersDark: usePreferredDark
|
|
922
|
+
prefersDark: usePreferredDark(props)
|
|
2271
923
|
});
|
|
2272
924
|
return () => {
|
|
2273
925
|
if (slots.default)
|
|
2274
926
|
return slots.default(data);
|
|
2275
927
|
};
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
name: "UsePreferredDark",
|
|
931
|
+
props: ["window"]
|
|
2276
932
|
}
|
|
2277
|
-
|
|
933
|
+
);
|
|
2278
934
|
|
|
2279
|
-
const UsePreferredLanguages = /* @__PURE__ */ defineComponent(
|
|
2280
|
-
|
|
2281
|
-
setup(props, { slots }) {
|
|
935
|
+
const UsePreferredLanguages = /* @__PURE__ */ defineComponent(
|
|
936
|
+
(props, { slots }) => {
|
|
2282
937
|
const data = reactive({
|
|
2283
|
-
languages: usePreferredLanguages()
|
|
938
|
+
languages: usePreferredLanguages(props)
|
|
2284
939
|
});
|
|
2285
940
|
return () => {
|
|
2286
941
|
if (slots.default)
|
|
2287
942
|
return slots.default(data);
|
|
2288
943
|
};
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
name: "UsePreferredLanguages",
|
|
947
|
+
props: ["window"]
|
|
2289
948
|
}
|
|
2290
|
-
|
|
949
|
+
);
|
|
2291
950
|
|
|
2292
|
-
const UsePreferredReducedMotion = /* @__PURE__ */ defineComponent(
|
|
2293
|
-
|
|
2294
|
-
setup(props, { slots }) {
|
|
951
|
+
const UsePreferredReducedMotion = /* @__PURE__ */ defineComponent(
|
|
952
|
+
(props, { slots }) => {
|
|
2295
953
|
const data = reactive({
|
|
2296
|
-
motion: usePreferredReducedMotion()
|
|
954
|
+
motion: usePreferredReducedMotion(props)
|
|
2297
955
|
});
|
|
2298
956
|
return () => {
|
|
2299
957
|
if (slots.default)
|
|
2300
958
|
return slots.default(data);
|
|
2301
959
|
};
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
name: "UsePreferredReducedMotion",
|
|
963
|
+
props: ["window"]
|
|
2302
964
|
}
|
|
2303
|
-
|
|
965
|
+
);
|
|
2304
966
|
|
|
2305
967
|
const UsePreferredReducedTransparency = /* @__PURE__ */ defineComponent({
|
|
2306
968
|
name: "UsePreferredReducedTransparency",
|
|
@@ -2324,125 +986,36 @@ const vResizeObserver = {
|
|
|
2324
986
|
}
|
|
2325
987
|
};
|
|
2326
988
|
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
const elRef = computed(() => {
|
|
2331
|
-
var _a;
|
|
2332
|
-
return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
|
|
2333
|
-
});
|
|
2334
|
-
function updateCssVar() {
|
|
2335
|
-
var _a;
|
|
2336
|
-
const key = toValue(prop);
|
|
2337
|
-
const el = toValue(elRef);
|
|
2338
|
-
if (el && window && key) {
|
|
2339
|
-
const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
|
|
2340
|
-
variable.value = value || variable.value || initialValue;
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
if (observe) {
|
|
2344
|
-
useMutationObserver(elRef, updateCssVar, {
|
|
2345
|
-
attributeFilter: ["style", "class"],
|
|
2346
|
-
window
|
|
2347
|
-
});
|
|
2348
|
-
}
|
|
2349
|
-
watch(
|
|
2350
|
-
[elRef, () => toValue(prop)],
|
|
2351
|
-
(_, old) => {
|
|
2352
|
-
if (old[0] && old[1])
|
|
2353
|
-
old[0].style.removeProperty(old[1]);
|
|
2354
|
-
updateCssVar();
|
|
2355
|
-
},
|
|
2356
|
-
{ immediate: true }
|
|
2357
|
-
);
|
|
2358
|
-
watch(
|
|
2359
|
-
[variable, elRef],
|
|
2360
|
-
([val, el]) => {
|
|
2361
|
-
const raw_prop = toValue(prop);
|
|
2362
|
-
if ((el == null ? void 0 : el.style) && raw_prop) {
|
|
2363
|
-
if (val == null)
|
|
2364
|
-
el.style.removeProperty(raw_prop);
|
|
2365
|
-
else
|
|
2366
|
-
el.style.setProperty(raw_prop, val);
|
|
2367
|
-
}
|
|
2368
|
-
},
|
|
2369
|
-
{ immediate: true }
|
|
2370
|
-
);
|
|
2371
|
-
return variable;
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
const topVarName = "--vueuse-safe-area-top";
|
|
2375
|
-
const rightVarName = "--vueuse-safe-area-right";
|
|
2376
|
-
const bottomVarName = "--vueuse-safe-area-bottom";
|
|
2377
|
-
const leftVarName = "--vueuse-safe-area-left";
|
|
2378
|
-
function useScreenSafeArea() {
|
|
2379
|
-
const top = shallowRef("");
|
|
2380
|
-
const right = shallowRef("");
|
|
2381
|
-
const bottom = shallowRef("");
|
|
2382
|
-
const left = shallowRef("");
|
|
2383
|
-
if (isClient) {
|
|
2384
|
-
const topCssVar = useCssVar(topVarName);
|
|
2385
|
-
const rightCssVar = useCssVar(rightVarName);
|
|
2386
|
-
const bottomCssVar = useCssVar(bottomVarName);
|
|
2387
|
-
const leftCssVar = useCssVar(leftVarName);
|
|
2388
|
-
topCssVar.value = "env(safe-area-inset-top, 0px)";
|
|
2389
|
-
rightCssVar.value = "env(safe-area-inset-right, 0px)";
|
|
2390
|
-
bottomCssVar.value = "env(safe-area-inset-bottom, 0px)";
|
|
2391
|
-
leftCssVar.value = "env(safe-area-inset-left, 0px)";
|
|
2392
|
-
tryOnMounted(update);
|
|
2393
|
-
useEventListener("resize", useDebounceFn(update), { passive: true });
|
|
2394
|
-
}
|
|
2395
|
-
function update() {
|
|
2396
|
-
top.value = getValue(topVarName);
|
|
2397
|
-
right.value = getValue(rightVarName);
|
|
2398
|
-
bottom.value = getValue(bottomVarName);
|
|
2399
|
-
left.value = getValue(leftVarName);
|
|
2400
|
-
}
|
|
2401
|
-
return {
|
|
2402
|
-
top,
|
|
2403
|
-
right,
|
|
2404
|
-
bottom,
|
|
2405
|
-
left,
|
|
2406
|
-
update
|
|
2407
|
-
};
|
|
2408
|
-
}
|
|
2409
|
-
function getValue(position) {
|
|
2410
|
-
return getComputedStyle(document.documentElement).getPropertyValue(position);
|
|
2411
|
-
}
|
|
2412
|
-
|
|
2413
|
-
const UseScreenSafeArea = /* @__PURE__ */ defineComponent({
|
|
2414
|
-
name: "UseScreenSafeArea",
|
|
2415
|
-
props: {
|
|
2416
|
-
top: Boolean,
|
|
2417
|
-
right: Boolean,
|
|
2418
|
-
bottom: Boolean,
|
|
2419
|
-
left: Boolean
|
|
2420
|
-
},
|
|
2421
|
-
setup(props, { slots }) {
|
|
2422
|
-
const {
|
|
2423
|
-
top,
|
|
2424
|
-
right,
|
|
2425
|
-
bottom,
|
|
2426
|
-
left
|
|
2427
|
-
} = useScreenSafeArea();
|
|
989
|
+
const UseScreenSafeArea = /* @__PURE__ */ defineComponent(
|
|
990
|
+
(props, { slots }) => {
|
|
991
|
+
const data = reactive(useScreenSafeArea());
|
|
2428
992
|
return () => {
|
|
2429
993
|
if (slots.default) {
|
|
2430
|
-
return h("div", {
|
|
994
|
+
return h(props.as || "div", {
|
|
2431
995
|
style: {
|
|
2432
|
-
paddingTop: props.top ? top
|
|
2433
|
-
paddingRight: props.right ? right
|
|
2434
|
-
paddingBottom: props.bottom ? bottom
|
|
2435
|
-
paddingLeft: props.left ? left
|
|
996
|
+
paddingTop: props.top ? data.top : "",
|
|
997
|
+
paddingRight: props.right ? data.right : "",
|
|
998
|
+
paddingBottom: props.bottom ? data.bottom : "",
|
|
999
|
+
paddingLeft: props.left ? data.left : "",
|
|
2436
1000
|
boxSizing: "border-box",
|
|
2437
1001
|
maxHeight: "100vh",
|
|
2438
1002
|
maxWidth: "100vw",
|
|
2439
1003
|
overflow: "auto"
|
|
2440
1004
|
}
|
|
2441
|
-
}, slots.default());
|
|
1005
|
+
}, slots.default(data));
|
|
2442
1006
|
}
|
|
2443
1007
|
};
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
name: "UseScreenSafeArea",
|
|
1011
|
+
props: [
|
|
1012
|
+
"top",
|
|
1013
|
+
"right",
|
|
1014
|
+
"bottom",
|
|
1015
|
+
"left"
|
|
1016
|
+
]
|
|
2444
1017
|
}
|
|
2445
|
-
|
|
1018
|
+
);
|
|
2446
1019
|
|
|
2447
1020
|
const vScroll = {
|
|
2448
1021
|
mounted(el, binding) {
|
|
@@ -2475,89 +1048,6 @@ const vScroll = {
|
|
|
2475
1048
|
}
|
|
2476
1049
|
};
|
|
2477
1050
|
|
|
2478
|
-
function checkOverflowScroll(ele) {
|
|
2479
|
-
const style = window.getComputedStyle(ele);
|
|
2480
|
-
if (style.overflowX === "scroll" || style.overflowY === "scroll" || style.overflowX === "auto" && ele.clientWidth < ele.scrollWidth || style.overflowY === "auto" && ele.clientHeight < ele.scrollHeight) {
|
|
2481
|
-
return true;
|
|
2482
|
-
} else {
|
|
2483
|
-
const parent = ele.parentNode;
|
|
2484
|
-
if (!parent || parent.tagName === "BODY")
|
|
2485
|
-
return false;
|
|
2486
|
-
return checkOverflowScroll(parent);
|
|
2487
|
-
}
|
|
2488
|
-
}
|
|
2489
|
-
function preventDefault(rawEvent) {
|
|
2490
|
-
const e = rawEvent || window.event;
|
|
2491
|
-
const _target = e.target;
|
|
2492
|
-
if (checkOverflowScroll(_target))
|
|
2493
|
-
return false;
|
|
2494
|
-
if (e.touches.length > 1)
|
|
2495
|
-
return true;
|
|
2496
|
-
if (e.preventDefault)
|
|
2497
|
-
e.preventDefault();
|
|
2498
|
-
return false;
|
|
2499
|
-
}
|
|
2500
|
-
const elInitialOverflow = /* @__PURE__ */ new WeakMap();
|
|
2501
|
-
function useScrollLock(element, initialState = false) {
|
|
2502
|
-
const isLocked = shallowRef(initialState);
|
|
2503
|
-
let stopTouchMoveListener = null;
|
|
2504
|
-
let initialOverflow = "";
|
|
2505
|
-
watch(toRef(element), (el) => {
|
|
2506
|
-
const target = resolveElement(toValue(el));
|
|
2507
|
-
if (target) {
|
|
2508
|
-
const ele = target;
|
|
2509
|
-
if (!elInitialOverflow.get(ele))
|
|
2510
|
-
elInitialOverflow.set(ele, ele.style.overflow);
|
|
2511
|
-
if (ele.style.overflow !== "hidden")
|
|
2512
|
-
initialOverflow = ele.style.overflow;
|
|
2513
|
-
if (ele.style.overflow === "hidden")
|
|
2514
|
-
return isLocked.value = true;
|
|
2515
|
-
if (isLocked.value)
|
|
2516
|
-
return ele.style.overflow = "hidden";
|
|
2517
|
-
}
|
|
2518
|
-
}, {
|
|
2519
|
-
immediate: true
|
|
2520
|
-
});
|
|
2521
|
-
const lock = () => {
|
|
2522
|
-
const el = resolveElement(toValue(element));
|
|
2523
|
-
if (!el || isLocked.value)
|
|
2524
|
-
return;
|
|
2525
|
-
if (isIOS) {
|
|
2526
|
-
stopTouchMoveListener = useEventListener(
|
|
2527
|
-
el,
|
|
2528
|
-
"touchmove",
|
|
2529
|
-
(e) => {
|
|
2530
|
-
preventDefault(e);
|
|
2531
|
-
},
|
|
2532
|
-
{ passive: false }
|
|
2533
|
-
);
|
|
2534
|
-
}
|
|
2535
|
-
el.style.overflow = "hidden";
|
|
2536
|
-
isLocked.value = true;
|
|
2537
|
-
};
|
|
2538
|
-
const unlock = () => {
|
|
2539
|
-
const el = resolveElement(toValue(element));
|
|
2540
|
-
if (!el || !isLocked.value)
|
|
2541
|
-
return;
|
|
2542
|
-
if (isIOS)
|
|
2543
|
-
stopTouchMoveListener == null ? void 0 : stopTouchMoveListener();
|
|
2544
|
-
el.style.overflow = initialOverflow;
|
|
2545
|
-
elInitialOverflow.delete(el);
|
|
2546
|
-
isLocked.value = false;
|
|
2547
|
-
};
|
|
2548
|
-
tryOnScopeDispose(unlock);
|
|
2549
|
-
return computed({
|
|
2550
|
-
get() {
|
|
2551
|
-
return isLocked.value;
|
|
2552
|
-
},
|
|
2553
|
-
set(v) {
|
|
2554
|
-
if (v)
|
|
2555
|
-
lock();
|
|
2556
|
-
else unlock();
|
|
2557
|
-
}
|
|
2558
|
-
});
|
|
2559
|
-
}
|
|
2560
|
-
|
|
2561
1051
|
function onScrollLock() {
|
|
2562
1052
|
let isMounted = false;
|
|
2563
1053
|
const state = shallowRef(false);
|
|
@@ -2572,38 +1062,50 @@ function onScrollLock() {
|
|
|
2572
1062
|
}
|
|
2573
1063
|
const vScrollLock = onScrollLock();
|
|
2574
1064
|
|
|
2575
|
-
const UseTimeAgo = /* @__PURE__ */ defineComponent(
|
|
2576
|
-
|
|
2577
|
-
props: ["time", "updateInterval", "max", "fullDateFormatter", "messages", "showSecond"],
|
|
2578
|
-
setup(props, { slots }) {
|
|
1065
|
+
const UseTimeAgo = /* @__PURE__ */ defineComponent(
|
|
1066
|
+
(props, { slots }) => {
|
|
2579
1067
|
const data = reactive(useTimeAgo(() => props.time, { ...props, controls: true }));
|
|
2580
1068
|
return () => {
|
|
2581
1069
|
if (slots.default)
|
|
2582
1070
|
return slots.default(data);
|
|
2583
1071
|
};
|
|
2584
|
-
}
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
1072
|
+
},
|
|
1073
|
+
{
|
|
1074
|
+
name: "UseTimeAgo",
|
|
1075
|
+
props: [
|
|
1076
|
+
"fullDateFormatter",
|
|
1077
|
+
"max",
|
|
1078
|
+
"messages",
|
|
1079
|
+
"rounding",
|
|
1080
|
+
"showSecond",
|
|
1081
|
+
"time",
|
|
1082
|
+
"units",
|
|
1083
|
+
"updateInterval"
|
|
1084
|
+
]
|
|
1085
|
+
}
|
|
1086
|
+
);
|
|
1087
|
+
|
|
1088
|
+
const UseTimestamp = /* @__PURE__ */ defineComponent(
|
|
1089
|
+
(props, { slots }) => {
|
|
2591
1090
|
const data = reactive(useTimestamp({ ...props, controls: true }));
|
|
2592
1091
|
return () => {
|
|
2593
1092
|
if (slots.default)
|
|
2594
1093
|
return slots.default(data);
|
|
2595
1094
|
};
|
|
2596
|
-
}
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
name: "UseTimestamp",
|
|
1098
|
+
props: [
|
|
1099
|
+
"callback",
|
|
1100
|
+
"immediate",
|
|
1101
|
+
"interval",
|
|
1102
|
+
"offset"
|
|
1103
|
+
]
|
|
1104
|
+
}
|
|
1105
|
+
);
|
|
1106
|
+
|
|
1107
|
+
const UseVirtualList = /* @__PURE__ */ defineComponent(
|
|
1108
|
+
(props, { slots, expose }) => {
|
|
2607
1109
|
const { list: listRef } = toRefs(props);
|
|
2608
1110
|
const { list, containerProps, wrapperProps, scrollTo } = useVirtualList(listRef, props.options);
|
|
2609
1111
|
expose({ scrollTo });
|
|
@@ -2612,32 +1114,52 @@ const UseVirtualList = /* @__PURE__ */ defineComponent({
|
|
|
2612
1114
|
return () => h("div", { ...containerProps }, [
|
|
2613
1115
|
h("div", { ...wrapperProps.value }, list.value.map((item) => h("div", { style: { overflow: "hidden", height: item.height } }, slots.default ? slots.default(item) : "Please set content!")))
|
|
2614
1116
|
]);
|
|
2615
|
-
}
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
name: "UseVirtualList",
|
|
1120
|
+
props: [
|
|
1121
|
+
"height",
|
|
1122
|
+
"list",
|
|
1123
|
+
"options"
|
|
1124
|
+
]
|
|
1125
|
+
}
|
|
1126
|
+
);
|
|
1127
|
+
|
|
1128
|
+
const UseWindowFocus = /* @__PURE__ */ defineComponent(
|
|
1129
|
+
(props, { slots }) => {
|
|
2621
1130
|
const data = reactive({
|
|
2622
|
-
focused: useWindowFocus()
|
|
1131
|
+
focused: useWindowFocus(props)
|
|
2623
1132
|
});
|
|
2624
1133
|
return () => {
|
|
2625
1134
|
if (slots.default)
|
|
2626
1135
|
return slots.default(data);
|
|
2627
1136
|
};
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
name: "UseWindowFocus",
|
|
1140
|
+
props: ["window"]
|
|
2628
1141
|
}
|
|
2629
|
-
|
|
1142
|
+
);
|
|
2630
1143
|
|
|
2631
|
-
const UseWindowSize = /* @__PURE__ */ defineComponent(
|
|
2632
|
-
|
|
2633
|
-
props: ["initialWidth", "initialHeight"],
|
|
2634
|
-
setup(props, { slots }) {
|
|
1144
|
+
const UseWindowSize = /* @__PURE__ */ defineComponent(
|
|
1145
|
+
(props, { slots }) => {
|
|
2635
1146
|
const data = reactive(useWindowSize(props));
|
|
2636
1147
|
return () => {
|
|
2637
1148
|
if (slots.default)
|
|
2638
1149
|
return slots.default(data);
|
|
2639
1150
|
};
|
|
2640
|
-
}
|
|
2641
|
-
|
|
1151
|
+
},
|
|
1152
|
+
{
|
|
1153
|
+
name: "UseWindowSize",
|
|
1154
|
+
props: [
|
|
1155
|
+
"includeScrollbar",
|
|
1156
|
+
"initialHeight",
|
|
1157
|
+
"initialWidth",
|
|
1158
|
+
"listenOrientation",
|
|
1159
|
+
"type",
|
|
1160
|
+
"window"
|
|
1161
|
+
]
|
|
1162
|
+
}
|
|
1163
|
+
);
|
|
2642
1164
|
|
|
2643
1165
|
export { OnClickOutside, OnLongPress, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UsePreferredReducedTransparency, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, UseWindowFocus, UseWindowSize, vOnClickOutside as VOnClickOutside, vOnLongPress as VOnLongPress, vElementBounding, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vMouseInElement, vOnClickOutside, vOnKeyStroke, vOnLongPress, vResizeObserver, vScroll, vScrollLock };
|