adverich-kun-ui 0.1.561 → 0.1.562
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/dist/utils/_platform.js +17 -15
- package/package.json +1 -1
package/dist/utils/_platform.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { computed as i, ref as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { computed as i, ref as c } from "vue";
|
|
2
|
+
const s = typeof window < "u";
|
|
3
|
+
function f() {
|
|
4
|
+
var t, a, u, r, v;
|
|
5
|
+
if (!s)
|
|
6
|
+
return { os: "Server", osVersion: "Unknown" };
|
|
4
7
|
const l = window.navigator.userAgent;
|
|
5
|
-
let
|
|
6
|
-
return /Mac/.test(l) ? (
|
|
8
|
+
let o = "Unknown OS", d = "Unknown Version";
|
|
9
|
+
return /Mac/.test(l) ? (o = "Mac OS", d = (a = (t = l.match(/Mac OS X (\d+[\._]\d+[\._]\d+)/)) == null ? void 0 : t[1]) == null ? void 0 : a.replace(/_/g, ".")) : /iPhone|iPad|iPod/.test(l) ? (o = "iOS", d = ((u = l.match(/OS (\d+)[._](\d+)[._]?(\d+)?/)) == null ? void 0 : u.slice(1, 4).join(".")) || "Unknown") : /Windows/.test(l) ? (o = "Windows", d = (r = l.match(/Windows NT (\d+\.\d+)/)) == null ? void 0 : r[1]) : /Android/.test(l) ? (o = "Android", d = (v = l.match(/Android (\d+\.\d+)/)) == null ? void 0 : v[1]) : /Linux/.test(l) && (o = "Linux"), { os: o, osVersion: d };
|
|
7
10
|
}
|
|
8
|
-
const e =
|
|
9
|
-
() =>
|
|
11
|
+
const e = c(s ? window.innerWidth : 1024), m = c(s ? window.innerHeight : 768), w = f(), h = i(
|
|
12
|
+
() => w.os === "iOS" || w.os === "Android" || m.value > e.value
|
|
10
13
|
), n = {
|
|
11
14
|
xs: 475,
|
|
12
15
|
sm: 640,
|
|
@@ -33,16 +36,15 @@ i(() => e.value < n.lg);
|
|
|
33
36
|
i(() => e.value < n.xl);
|
|
34
37
|
i(() => e.value < n.xxl);
|
|
35
38
|
i(() => e.value < n.xxl);
|
|
36
|
-
function
|
|
37
|
-
e.value = window.innerWidth,
|
|
39
|
+
function x() {
|
|
40
|
+
s && (e.value = window.innerWidth, m.value = window.innerHeight);
|
|
38
41
|
}
|
|
39
|
-
window.addEventListener("resize",
|
|
40
|
-
window.
|
|
41
|
-
|
|
42
|
-
});
|
|
42
|
+
s && (window.addEventListener("resize", x), window.addEventListener("beforeunload", () => {
|
|
43
|
+
window.removeEventListener("resize", x);
|
|
44
|
+
}));
|
|
43
45
|
export {
|
|
44
46
|
h as isMobile,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
w as kunOS,
|
|
48
|
+
m as screenHeight,
|
|
47
49
|
e as screenWidth
|
|
48
50
|
};
|