vueless 0.0.340 → 0.0.341
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed, toValue, ref } from "vue";
|
|
2
|
+
import { isSSR } from "../utils/utilHelper.js";
|
|
2
3
|
|
|
3
4
|
export const POSITION = {
|
|
4
5
|
left: "left",
|
|
@@ -50,7 +51,7 @@ export function useAutoPosition(anchorElement, targetElement, position, preferre
|
|
|
50
51
|
});
|
|
51
52
|
|
|
52
53
|
function adjustPositionY() {
|
|
53
|
-
if (
|
|
54
|
+
if (isSSR) return;
|
|
54
55
|
|
|
55
56
|
const spaceAbove = localAnchorElement.value.getBoundingClientRect().top;
|
|
56
57
|
const spaceBelow = window.innerHeight - localAnchorElement.value.getBoundingClientRect().bottom;
|
|
@@ -71,7 +72,7 @@ export function useAutoPosition(anchorElement, targetElement, position, preferre
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
function adjustPositionX() {
|
|
74
|
-
if (
|
|
75
|
+
if (isSSR) return;
|
|
75
76
|
|
|
76
77
|
const spaceRight = localAnchorElement.value.getBoundingClientRect().right;
|
|
77
78
|
const spaceLeft = window.innerWidth - localAnchorElement.value.getBoundingClientRect().left;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { onMounted, ref, watch, computed, onBeforeUnmount } from "vue";
|
|
2
|
+
import { isSSR } from "../utils/utilHelper.js";
|
|
2
3
|
|
|
3
4
|
const BREAKPOINT_NAME = {
|
|
4
5
|
xs: "xs",
|
|
@@ -48,18 +49,24 @@ export default function useBreakpoint() {
|
|
|
48
49
|
});
|
|
49
50
|
|
|
50
51
|
onMounted(() => {
|
|
52
|
+
if (isSSR) return;
|
|
53
|
+
|
|
51
54
|
windowWidth.value = window.innerWidth;
|
|
52
55
|
|
|
53
56
|
window.addEventListener("resize", resizeListener, { passive: true });
|
|
54
57
|
});
|
|
55
58
|
|
|
56
59
|
onBeforeUnmount(() => {
|
|
60
|
+
if (isSSR) return;
|
|
61
|
+
|
|
57
62
|
window.removeEventListener("resize", resizeListener, { passive: true });
|
|
58
63
|
});
|
|
59
64
|
|
|
60
65
|
watch(windowWidth, setBreakpoint, { immediate: true });
|
|
61
66
|
|
|
62
67
|
function resizeListener() {
|
|
68
|
+
if (isSSR) return;
|
|
69
|
+
|
|
63
70
|
if (timeout) {
|
|
64
71
|
window.cancelAnimationFrame(timeout);
|
|
65
72
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { onBeforeUnmount, onMounted, toValue, watch } from "vue";
|
|
2
|
+
import { isSSR } from "../utils/utilHelper.js";
|
|
2
3
|
|
|
3
4
|
export function useMutationObserver(
|
|
4
5
|
target,
|
|
5
6
|
callBack,
|
|
6
7
|
config = { childList: true, attributes: true, characterData: true },
|
|
7
8
|
) {
|
|
9
|
+
if (isSSR) return;
|
|
10
|
+
|
|
8
11
|
const observer = new MutationObserver(callBack);
|
|
9
12
|
|
|
10
13
|
onMounted(() => {
|
package/package.json
CHANGED
package/utils/utilHelper.js
CHANGED
|
@@ -65,7 +65,9 @@ export function debounce(func, wait) {
|
|
|
65
65
|
@returns {VoidFunction}
|
|
66
66
|
*/
|
|
67
67
|
export function setTitle({ title, separator = " / ", suffix = "" }) {
|
|
68
|
-
|
|
68
|
+
if (isCSR) {
|
|
69
|
+
document.title = title ? title + separator + suffix : suffix;
|
|
70
|
+
}
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
/**
|
package/utils/utilPlatform.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
1
|
+
import { isCSR } from "./utilHelper.js";
|
|
2
|
+
|
|
3
|
+
const isWindows = isCSR && checkIsWindows();
|
|
4
|
+
const isMac = isCSR && checkIsMac();
|
|
5
|
+
const isPWA = isCSR && checkIsPWA();
|
|
6
|
+
const isIOS = isCSR && checkIsIOS();
|
|
7
|
+
const isAndroid = isCSR && checkIsAndroid();
|
|
7
8
|
const isMobileApp = isPWA || isIOS || isAndroid;
|
|
8
9
|
|
|
9
10
|
function checkIsWindows() {
|
|
@@ -42,4 +43,4 @@ function getPlatform() {
|
|
|
42
43
|
return navigator.userAgentData?.platform || navigator.platform || "unknown";
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
export {
|
|
46
|
+
export { isMac, isPWA, isIOS, isAndroid, isMobileApp, isWindows };
|
package/utils/utilTheme.js
CHANGED
|
@@ -15,8 +15,11 @@ import {
|
|
|
15
15
|
GRAY_COLORS,
|
|
16
16
|
PX_IN_REM,
|
|
17
17
|
} from "../constants.js";
|
|
18
|
+
import { isSSR } from "./utilHelper.js";
|
|
18
19
|
|
|
19
20
|
export function themeInit() {
|
|
21
|
+
if (isSSR) return;
|
|
22
|
+
|
|
20
23
|
const prefersColorSchemeDark = window && window.matchMedia("(prefers-color-scheme: dark)");
|
|
21
24
|
|
|
22
25
|
setTheme({ systemDarkMode: prefersColorSchemeDark.matches });
|
|
@@ -27,6 +30,8 @@ export function themeInit() {
|
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
export function setTheme(config = {}) {
|
|
33
|
+
if (isSSR) return;
|
|
34
|
+
|
|
30
35
|
const isDarkMode = setDarkMode(config);
|
|
31
36
|
const ring = config?.ring ?? vuelessConfig?.ring ?? DEFAULT_RING;
|
|
32
37
|
const ringOffset = config?.ringOffset ?? vuelessConfig?.ringOffset ?? DEFAULT_RING_OFFSET;
|