zhi-device
Advanced tools
Comparing version 0.7.3 to 0.8.0
@@ -1,4 +0,4 @@ | ||
var g = Object.defineProperty; | ||
var P = (a, e, t) => e in a ? g(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t; | ||
var r = (a, e, t) => (P(a, typeof e != "symbol" ? e + "" : e, t), t); | ||
var P = Object.defineProperty; | ||
var g = (n, e, t) => e in n ? P(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t; | ||
var s = (n, e, t) => (g(n, typeof e != "symbol" ? e + "" : e, t), t); | ||
const u = class { | ||
@@ -14,17 +14,17 @@ /** | ||
/** | ||
* 是否在浏览器环境 | ||
* 是否在Node环境 | ||
*/ | ||
r(i, "isNode", typeof process < "u"), /** | ||
s(i, "isNode", typeof process < "u" && process.versions != null && process.versions.node != null), /** | ||
* 是否在浏览器环境 | ||
*/ | ||
r(i, "isInBrowser", typeof window < "u"), /** | ||
s(i, "isInBrowser", typeof window < "u" && typeof document < "u"), /** | ||
* 浏览器路径分隔符 | ||
*/ | ||
r(i, "BrowserSeperator", "/"), /** | ||
s(i, "BrowserSeparator", "/"), /** | ||
* 是否是Electron环境 | ||
*/ | ||
r(i, "isElectron", () => !u.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** | ||
s(i, "isElectron", () => !u.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : typeof process < "u" && process.versions != null && process.versions.electron != null), /** | ||
* 是否有Node环境,目前包括 Electron 和 Node | ||
*/ | ||
r(i, "hasNodeEnv", () => u.isElectron() || u.isNode), /** | ||
s(i, "hasNodeEnv", () => u.isElectron() || u.isNode), /** | ||
* 获取url参数 | ||
@@ -34,8 +34,8 @@ * | ||
*/ | ||
r(i, "getQueryString", (e) => { | ||
s(i, "getQueryString", (e) => { | ||
if (!u.isInBrowser) | ||
return ""; | ||
const n = window.location.search.substring(1).split("&"); | ||
for (let s = 0; s < n.length; s++) { | ||
const c = n[s].split("="); | ||
const a = window.location.search.substring(1).split("&"); | ||
for (let r = 0; r < a.length; r++) { | ||
const c = a[r].split("="); | ||
if (c[0] === e) | ||
@@ -62,9 +62,9 @@ return c[1]; | ||
*/ | ||
r(i, "replaceUrlParam", (e, t, n) => { | ||
n == null && (n = ""); | ||
const s = new RegExp("\\b(" + t + "=).*?(&|#|$)"); | ||
if (e.search(s) >= 0) | ||
return e.replace(s, "$1" + n + "$2"); | ||
s(i, "replaceUrlParam", (e, t, a) => { | ||
a == null && (a = ""); | ||
const r = new RegExp("\\b(" + t + "=).*?(&|#|$)"); | ||
if (e.search(r) >= 0) | ||
return e.replace(r, "$1" + a + "$2"); | ||
const [c, d] = e.split("#"), [y, b] = c.split("?"), l = new URLSearchParams(b); | ||
l.set(t, n); | ||
l.set(t, a); | ||
const m = l.toString(), f = y + (m ? "?" + m : ""); | ||
@@ -79,9 +79,9 @@ return d ? f + "#" + d : f; | ||
*/ | ||
r(i, "setUrlParameter", (e, t, n) => { | ||
s(i, "setUrlParameter", (e, t, a) => { | ||
if (e.includes(t)) | ||
return u.replaceUrlParam(e, t, n); | ||
const s = e.split("#"); | ||
let c = s[0]; | ||
const d = s[1]; | ||
return c.includes("?") ? c += `&${t}=${n}` : c += `?${t}=${n}`, d && (c += "#" + d), c; | ||
return u.replaceUrlParam(e, t, a); | ||
const r = e.split("#"); | ||
let c = r[0]; | ||
const d = r[1]; | ||
return c.includes("?") ? c += `&${t}=${a}` : c += `?${t}=${a}`, d && (c += "#" + d), c; | ||
}), /** | ||
@@ -93,7 +93,7 @@ * 重新加载指定tab | ||
*/ | ||
r(i, "reloadTabPage", (e, t = 200) => { | ||
s(i, "reloadTabPage", (e, t = 200) => { | ||
setTimeout(function() { | ||
if (u.isInBrowser) { | ||
const n = window.location.href; | ||
window.location.href = u.setUrlParameter(n, "tab", e); | ||
const a = window.location.href; | ||
window.location.href = u.setUrlParameter(a, "tab", e); | ||
} | ||
@@ -104,3 +104,3 @@ }, t); | ||
*/ | ||
r(i, "reloadPage", () => { | ||
s(i, "reloadPage", () => { | ||
setTimeout(function() { | ||
@@ -115,3 +115,3 @@ u.isInBrowser && window.location.reload(); | ||
*/ | ||
r(i, "reloadPageWithMessageCallback", (e, t) => { | ||
s(i, "reloadPageWithMessageCallback", (e, t) => { | ||
t && t(e), setTimeout(function() { | ||
@@ -121,3 +121,3 @@ u.isInBrowser && window.location.reload(); | ||
}); | ||
var o = /* @__PURE__ */ ((a) => (a.BasePathType_Appearance = "Appearance", a.BasePathType_Data = "Data", a.BasePathType_Themes = "Themes", a.BasePathType_ZhiTheme = "ZhiTheme", a.BasePathType_None = "None", a))(o || {}); | ||
var o = /* @__PURE__ */ ((n) => (n.BasePathType_Appearance = "Appearance", n.BasePathType_Data = "Data", n.BasePathType_Themes = "Themes", n.BasePathType_ZhiTheme = "ZhiTheme", n.BasePathType_None = "None", n))(o || {}); | ||
const h = class { | ||
@@ -150,15 +150,15 @@ /** | ||
static async importJs(e, t) { | ||
let n = e; | ||
let a = e; | ||
switch (t) { | ||
case o.BasePathType_Appearance: | ||
n = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); | ||
a = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); | ||
break; | ||
case o.BasePathType_Data: | ||
n = this.browserJoinPath(this.siyuanDataRelativePath(), e); | ||
a = this.browserJoinPath(this.siyuanDataRelativePath(), e); | ||
break; | ||
case o.BasePathType_Themes: | ||
n = this.browserJoinPath(this.siyuanThemeRelativePath(), e); | ||
a = this.browserJoinPath(this.siyuanThemeRelativePath(), e); | ||
break; | ||
case o.BasePathType_ZhiTheme: | ||
n = this.browserJoinPath(this.zhiThemeRelativePath(), e); | ||
a = this.browserJoinPath(this.zhiThemeRelativePath(), e); | ||
break; | ||
@@ -168,7 +168,7 @@ default: | ||
} | ||
const { default: s } = await import( | ||
const { default: r } = await import( | ||
/* @vite-ignore */ | ||
n | ||
a | ||
); | ||
return s; | ||
return r; | ||
} | ||
@@ -260,3 +260,3 @@ /** | ||
static browserJoinPath(...e) { | ||
return e.join(i.BrowserSeperator); | ||
return e.join(i.BrowserSeparator); | ||
} | ||
@@ -343,7 +343,7 @@ /** | ||
}; | ||
let w = h; | ||
let p = h; | ||
/** | ||
* 思源笔记iframe挂件环境 | ||
*/ | ||
r(w, "isInSiyuanWidget", () => i.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** | ||
s(p, "isInSiyuanWidget", () => i.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** | ||
* 思源笔记新窗口 | ||
@@ -356,3 +356,3 @@ * | ||
*/ | ||
r(w, "isInSiyuanNewWin", () => !i.isInBrowser || !i.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= | ||
s(p, "isInSiyuanNewWin", () => !i.isInBrowser || !i.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= | ||
// require start | ||
@@ -367,19 +367,19 @@ // ========================= | ||
*/ | ||
r(w, "requireLib", (e, t = !0, n = o.BasePathType_None) => { | ||
s(p, "requireLib", (e, t = !0, a = o.BasePathType_None) => { | ||
if (!i.hasNodeEnv()) | ||
throw new Error("require ony works on node env"); | ||
let s = e; | ||
let r = e; | ||
if (!t) | ||
switch (n) { | ||
switch (a) { | ||
case o.BasePathType_Appearance: | ||
s = h.joinPath(h.siyuanAppearancePath(), e); | ||
r = h.joinPath(h.siyuanAppearancePath(), e); | ||
break; | ||
case o.BasePathType_Data: | ||
s = h.joinPath(h.siyuanDataPath(), e); | ||
r = h.joinPath(h.siyuanDataPath(), e); | ||
break; | ||
case o.BasePathType_Themes: | ||
s = h.joinPath(h.siyuanAppearancePath(), "themes", e); | ||
r = h.joinPath(h.siyuanAppearancePath(), "themes", e); | ||
break; | ||
case o.BasePathType_ZhiTheme: | ||
s = h.joinPath(h.siyuanAppearancePath(), "themes", "zhi", e); | ||
r = h.joinPath(h.siyuanAppearancePath(), "themes", "zhi", e); | ||
break; | ||
@@ -391,5 +391,5 @@ default: | ||
if (!c) | ||
return require(s); | ||
return require(r); | ||
if (typeof c.require < "u") | ||
return c.require(s); | ||
return c.require(r); | ||
}), /** | ||
@@ -400,3 +400,3 @@ * 引入依赖,以 data 的基本路径为准 | ||
*/ | ||
r(w, "requireAppearanceLib", (e) => h.requireLib(e, !1, o.BasePathType_Appearance)), /** | ||
s(p, "requireAppearanceLib", (e) => h.requireLib(e, !1, o.BasePathType_Appearance)), /** | ||
* 引入依赖,以 data 的基本路径为准 | ||
@@ -406,3 +406,3 @@ * | ||
*/ | ||
r(w, "requireDataLib", (e) => h.requireLib(e, !1, o.BasePathType_Data)), /** | ||
s(p, "requireDataLib", (e) => h.requireLib(e, !1, o.BasePathType_Data)), /** | ||
* 引入依赖,以 theme 的基本路径为准 | ||
@@ -412,3 +412,3 @@ * | ||
*/ | ||
r(w, "requireThemesLib", (e) => h.requireLib(e, !1, o.BasePathType_Themes)), /** | ||
s(p, "requireThemesLib", (e) => h.requireLib(e, !1, o.BasePathType_Themes)), /** | ||
* 引入依赖,以 ZhiTheme 的基本路径为准 | ||
@@ -418,5 +418,5 @@ * | ||
*/ | ||
r(w, "requireZhiThemeLib", (e) => h.requireLib(e, !1, o.BasePathType_ZhiTheme)); | ||
var p = /* @__PURE__ */ ((a) => (a.DeviceType_Mobile_Device = "Mobile", a.DeviceType_Siyuan_Widget = "Siyuan_Widget", a.DeviceType_Siyuan_NewWin = "Siyuan_NewWindow", a.DeviceType_Siyuan_MainWin = "Siyuan_MainWindow", a.DeviceType_Siyuan_Browser = "Siyuan_Browser", a.DeviceType_Chrome_Extension = "Chrome_Extension", a.DeviceType_Chrome_Browser = "Chrome_Browser", a.DeviceType_Node = "Node", a))(p || {}); | ||
class v { | ||
s(p, "requireZhiThemeLib", (e) => h.requireLib(e, !1, o.BasePathType_ZhiTheme)); | ||
var w = /* @__PURE__ */ ((n) => (n.DeviceType_Mobile_Device = "Mobile", n.DeviceType_Siyuan_Widget = "Siyuan_Widget", n.DeviceType_Siyuan_NewWin = "Siyuan_NewWindow", n.DeviceType_Siyuan_MainWin = "Siyuan_MainWindow", n.DeviceType_Siyuan_Browser = "Siyuan_Browser", n.DeviceType_Chrome_Extension = "Chrome_Extension", n.DeviceType_Chrome_Browser = "Chrome_Browser", n.DeviceType_Node = "Node", n))(w || {}); | ||
class T { | ||
/** | ||
@@ -426,3 +426,3 @@ * 获取当前设备 | ||
static getDevice() { | ||
return this.detectMobileDevice() ? p.DeviceType_Mobile_Device : w.isInSiyuanWidget() ? p.DeviceType_Siyuan_Widget : w.isInSiyuanNewWin() ? p.DeviceType_Siyuan_NewWin : i.isElectron() ? p.DeviceType_Siyuan_MainWin : w.isInSiyuanBrowser() ? p.DeviceType_Siyuan_Browser : i.isInChromeExtension() ? p.DeviceType_Chrome_Extension : i.isNode ? p.DeviceType_Node : p.DeviceType_Chrome_Browser; | ||
return this.detectMobileDevice() ? w.DeviceType_Mobile_Device : p.isInSiyuanWidget() ? w.DeviceType_Siyuan_Widget : p.isInSiyuanNewWin() ? w.DeviceType_Siyuan_NewWin : i.isElectron() ? w.DeviceType_Siyuan_MainWin : p.isInSiyuanBrowser() ? w.DeviceType_Siyuan_Browser : i.isInChromeExtension() ? w.DeviceType_Chrome_Extension : i.isNode ? w.DeviceType_Node : w.DeviceType_Chrome_Browser; | ||
} | ||
@@ -447,5 +447,5 @@ /** | ||
i as BrowserUtil, | ||
v as DeviceDetection, | ||
p as DeviceTypeEnum, | ||
w as SiyuanDevice | ||
T as DeviceDetection, | ||
w as DeviceTypeEnum, | ||
p as SiyuanDevice | ||
}; |
@@ -1,4 +0,4 @@ | ||
var g = Object.defineProperty; | ||
var P = (a, e, t) => e in a ? g(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t; | ||
var r = (a, e, t) => (P(a, typeof e != "symbol" ? e + "" : e, t), t); | ||
var P = Object.defineProperty; | ||
var g = (n, e, t) => e in n ? P(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t; | ||
var s = (n, e, t) => (g(n, typeof e != "symbol" ? e + "" : e, t), t); | ||
const u = class { | ||
@@ -14,17 +14,17 @@ /** | ||
/** | ||
* 是否在浏览器环境 | ||
* 是否在Node环境 | ||
*/ | ||
r(i, "isNode", typeof process < "u"), /** | ||
s(i, "isNode", typeof process < "u" && process.versions != null && process.versions.node != null), /** | ||
* 是否在浏览器环境 | ||
*/ | ||
r(i, "isInBrowser", typeof window < "u"), /** | ||
s(i, "isInBrowser", typeof window < "u" && typeof document < "u"), /** | ||
* 浏览器路径分隔符 | ||
*/ | ||
r(i, "BrowserSeperator", "/"), /** | ||
s(i, "BrowserSeparator", "/"), /** | ||
* 是否是Electron环境 | ||
*/ | ||
r(i, "isElectron", () => !u.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** | ||
s(i, "isElectron", () => !u.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : typeof process < "u" && process.versions != null && process.versions.electron != null), /** | ||
* 是否有Node环境,目前包括 Electron 和 Node | ||
*/ | ||
r(i, "hasNodeEnv", () => u.isElectron() || u.isNode), /** | ||
s(i, "hasNodeEnv", () => u.isElectron() || u.isNode), /** | ||
* 获取url参数 | ||
@@ -34,8 +34,8 @@ * | ||
*/ | ||
r(i, "getQueryString", (e) => { | ||
s(i, "getQueryString", (e) => { | ||
if (!u.isInBrowser) | ||
return ""; | ||
const n = window.location.search.substring(1).split("&"); | ||
for (let s = 0; s < n.length; s++) { | ||
const c = n[s].split("="); | ||
const a = window.location.search.substring(1).split("&"); | ||
for (let r = 0; r < a.length; r++) { | ||
const c = a[r].split("="); | ||
if (c[0] === e) | ||
@@ -62,9 +62,9 @@ return c[1]; | ||
*/ | ||
r(i, "replaceUrlParam", (e, t, n) => { | ||
n == null && (n = ""); | ||
const s = new RegExp("\\b(" + t + "=).*?(&|#|$)"); | ||
if (e.search(s) >= 0) | ||
return e.replace(s, "$1" + n + "$2"); | ||
s(i, "replaceUrlParam", (e, t, a) => { | ||
a == null && (a = ""); | ||
const r = new RegExp("\\b(" + t + "=).*?(&|#|$)"); | ||
if (e.search(r) >= 0) | ||
return e.replace(r, "$1" + a + "$2"); | ||
const [c, d] = e.split("#"), [y, b] = c.split("?"), l = new URLSearchParams(b); | ||
l.set(t, n); | ||
l.set(t, a); | ||
const m = l.toString(), f = y + (m ? "?" + m : ""); | ||
@@ -79,9 +79,9 @@ return d ? f + "#" + d : f; | ||
*/ | ||
r(i, "setUrlParameter", (e, t, n) => { | ||
s(i, "setUrlParameter", (e, t, a) => { | ||
if (e.includes(t)) | ||
return u.replaceUrlParam(e, t, n); | ||
const s = e.split("#"); | ||
let c = s[0]; | ||
const d = s[1]; | ||
return c.includes("?") ? c += `&${t}=${n}` : c += `?${t}=${n}`, d && (c += "#" + d), c; | ||
return u.replaceUrlParam(e, t, a); | ||
const r = e.split("#"); | ||
let c = r[0]; | ||
const d = r[1]; | ||
return c.includes("?") ? c += `&${t}=${a}` : c += `?${t}=${a}`, d && (c += "#" + d), c; | ||
}), /** | ||
@@ -93,7 +93,7 @@ * 重新加载指定tab | ||
*/ | ||
r(i, "reloadTabPage", (e, t = 200) => { | ||
s(i, "reloadTabPage", (e, t = 200) => { | ||
setTimeout(function() { | ||
if (u.isInBrowser) { | ||
const n = window.location.href; | ||
window.location.href = u.setUrlParameter(n, "tab", e); | ||
const a = window.location.href; | ||
window.location.href = u.setUrlParameter(a, "tab", e); | ||
} | ||
@@ -104,3 +104,3 @@ }, t); | ||
*/ | ||
r(i, "reloadPage", () => { | ||
s(i, "reloadPage", () => { | ||
setTimeout(function() { | ||
@@ -115,3 +115,3 @@ u.isInBrowser && window.location.reload(); | ||
*/ | ||
r(i, "reloadPageWithMessageCallback", (e, t) => { | ||
s(i, "reloadPageWithMessageCallback", (e, t) => { | ||
t && t(e), setTimeout(function() { | ||
@@ -121,3 +121,3 @@ u.isInBrowser && window.location.reload(); | ||
}); | ||
var o = /* @__PURE__ */ ((a) => (a.BasePathType_Appearance = "Appearance", a.BasePathType_Data = "Data", a.BasePathType_Themes = "Themes", a.BasePathType_ZhiTheme = "ZhiTheme", a.BasePathType_None = "None", a))(o || {}); | ||
var o = /* @__PURE__ */ ((n) => (n.BasePathType_Appearance = "Appearance", n.BasePathType_Data = "Data", n.BasePathType_Themes = "Themes", n.BasePathType_ZhiTheme = "ZhiTheme", n.BasePathType_None = "None", n))(o || {}); | ||
const h = class { | ||
@@ -150,15 +150,15 @@ /** | ||
static async importJs(e, t) { | ||
let n = e; | ||
let a = e; | ||
switch (t) { | ||
case o.BasePathType_Appearance: | ||
n = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); | ||
a = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); | ||
break; | ||
case o.BasePathType_Data: | ||
n = this.browserJoinPath(this.siyuanDataRelativePath(), e); | ||
a = this.browserJoinPath(this.siyuanDataRelativePath(), e); | ||
break; | ||
case o.BasePathType_Themes: | ||
n = this.browserJoinPath(this.siyuanThemeRelativePath(), e); | ||
a = this.browserJoinPath(this.siyuanThemeRelativePath(), e); | ||
break; | ||
case o.BasePathType_ZhiTheme: | ||
n = this.browserJoinPath(this.zhiThemeRelativePath(), e); | ||
a = this.browserJoinPath(this.zhiThemeRelativePath(), e); | ||
break; | ||
@@ -168,7 +168,7 @@ default: | ||
} | ||
const { default: s } = await import( | ||
const { default: r } = await import( | ||
/* @vite-ignore */ | ||
n | ||
a | ||
); | ||
return s; | ||
return r; | ||
} | ||
@@ -260,3 +260,3 @@ /** | ||
static browserJoinPath(...e) { | ||
return e.join(i.BrowserSeperator); | ||
return e.join(i.BrowserSeparator); | ||
} | ||
@@ -343,7 +343,7 @@ /** | ||
}; | ||
let w = h; | ||
let p = h; | ||
/** | ||
* 思源笔记iframe挂件环境 | ||
*/ | ||
r(w, "isInSiyuanWidget", () => i.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** | ||
s(p, "isInSiyuanWidget", () => i.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** | ||
* 思源笔记新窗口 | ||
@@ -356,3 +356,3 @@ * | ||
*/ | ||
r(w, "isInSiyuanNewWin", () => !i.isInBrowser || !i.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= | ||
s(p, "isInSiyuanNewWin", () => !i.isInBrowser || !i.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= | ||
// require start | ||
@@ -367,19 +367,19 @@ // ========================= | ||
*/ | ||
r(w, "requireLib", (e, t = !0, n = o.BasePathType_None) => { | ||
s(p, "requireLib", (e, t = !0, a = o.BasePathType_None) => { | ||
if (!i.hasNodeEnv()) | ||
throw new Error("require ony works on node env"); | ||
let s = e; | ||
let r = e; | ||
if (!t) | ||
switch (n) { | ||
switch (a) { | ||
case o.BasePathType_Appearance: | ||
s = h.joinPath(h.siyuanAppearancePath(), e); | ||
r = h.joinPath(h.siyuanAppearancePath(), e); | ||
break; | ||
case o.BasePathType_Data: | ||
s = h.joinPath(h.siyuanDataPath(), e); | ||
r = h.joinPath(h.siyuanDataPath(), e); | ||
break; | ||
case o.BasePathType_Themes: | ||
s = h.joinPath(h.siyuanAppearancePath(), "themes", e); | ||
r = h.joinPath(h.siyuanAppearancePath(), "themes", e); | ||
break; | ||
case o.BasePathType_ZhiTheme: | ||
s = h.joinPath(h.siyuanAppearancePath(), "themes", "zhi", e); | ||
r = h.joinPath(h.siyuanAppearancePath(), "themes", "zhi", e); | ||
break; | ||
@@ -391,5 +391,5 @@ default: | ||
if (!c) | ||
return require(s); | ||
return require(r); | ||
if (typeof c.require < "u") | ||
return c.require(s); | ||
return c.require(r); | ||
}), /** | ||
@@ -400,3 +400,3 @@ * 引入依赖,以 data 的基本路径为准 | ||
*/ | ||
r(w, "requireAppearanceLib", (e) => h.requireLib(e, !1, o.BasePathType_Appearance)), /** | ||
s(p, "requireAppearanceLib", (e) => h.requireLib(e, !1, o.BasePathType_Appearance)), /** | ||
* 引入依赖,以 data 的基本路径为准 | ||
@@ -406,3 +406,3 @@ * | ||
*/ | ||
r(w, "requireDataLib", (e) => h.requireLib(e, !1, o.BasePathType_Data)), /** | ||
s(p, "requireDataLib", (e) => h.requireLib(e, !1, o.BasePathType_Data)), /** | ||
* 引入依赖,以 theme 的基本路径为准 | ||
@@ -412,3 +412,3 @@ * | ||
*/ | ||
r(w, "requireThemesLib", (e) => h.requireLib(e, !1, o.BasePathType_Themes)), /** | ||
s(p, "requireThemesLib", (e) => h.requireLib(e, !1, o.BasePathType_Themes)), /** | ||
* 引入依赖,以 ZhiTheme 的基本路径为准 | ||
@@ -418,5 +418,5 @@ * | ||
*/ | ||
r(w, "requireZhiThemeLib", (e) => h.requireLib(e, !1, o.BasePathType_ZhiTheme)); | ||
var p = /* @__PURE__ */ ((a) => (a.DeviceType_Mobile_Device = "Mobile", a.DeviceType_Siyuan_Widget = "Siyuan_Widget", a.DeviceType_Siyuan_NewWin = "Siyuan_NewWindow", a.DeviceType_Siyuan_MainWin = "Siyuan_MainWindow", a.DeviceType_Siyuan_Browser = "Siyuan_Browser", a.DeviceType_Chrome_Extension = "Chrome_Extension", a.DeviceType_Chrome_Browser = "Chrome_Browser", a.DeviceType_Node = "Node", a))(p || {}); | ||
class v { | ||
s(p, "requireZhiThemeLib", (e) => h.requireLib(e, !1, o.BasePathType_ZhiTheme)); | ||
var w = /* @__PURE__ */ ((n) => (n.DeviceType_Mobile_Device = "Mobile", n.DeviceType_Siyuan_Widget = "Siyuan_Widget", n.DeviceType_Siyuan_NewWin = "Siyuan_NewWindow", n.DeviceType_Siyuan_MainWin = "Siyuan_MainWindow", n.DeviceType_Siyuan_Browser = "Siyuan_Browser", n.DeviceType_Chrome_Extension = "Chrome_Extension", n.DeviceType_Chrome_Browser = "Chrome_Browser", n.DeviceType_Node = "Node", n))(w || {}); | ||
class T { | ||
/** | ||
@@ -426,3 +426,3 @@ * 获取当前设备 | ||
static getDevice() { | ||
return this.detectMobileDevice() ? p.DeviceType_Mobile_Device : w.isInSiyuanWidget() ? p.DeviceType_Siyuan_Widget : w.isInSiyuanNewWin() ? p.DeviceType_Siyuan_NewWin : i.isElectron() ? p.DeviceType_Siyuan_MainWin : w.isInSiyuanBrowser() ? p.DeviceType_Siyuan_Browser : i.isInChromeExtension() ? p.DeviceType_Chrome_Extension : i.isNode ? p.DeviceType_Node : p.DeviceType_Chrome_Browser; | ||
return this.detectMobileDevice() ? w.DeviceType_Mobile_Device : p.isInSiyuanWidget() ? w.DeviceType_Siyuan_Widget : p.isInSiyuanNewWin() ? w.DeviceType_Siyuan_NewWin : i.isElectron() ? w.DeviceType_Siyuan_MainWin : p.isInSiyuanBrowser() ? w.DeviceType_Siyuan_Browser : i.isInChromeExtension() ? w.DeviceType_Chrome_Extension : i.isNode ? w.DeviceType_Node : w.DeviceType_Chrome_Browser; | ||
} | ||
@@ -447,5 +447,5 @@ /** | ||
i as BrowserUtil, | ||
v as DeviceDetection, | ||
p as DeviceTypeEnum, | ||
w as SiyuanDevice | ||
T as DeviceDetection, | ||
w as DeviceTypeEnum, | ||
p as SiyuanDevice | ||
}; |
@@ -10,3 +10,3 @@ /** | ||
/** | ||
* 是否在浏览器环境 | ||
* 是否在Node环境 | ||
*/ | ||
@@ -21,3 +21,3 @@ static isNode: boolean; | ||
*/ | ||
static BrowserSeperator: string; | ||
static BrowserSeparator: string; | ||
/** | ||
@@ -24,0 +24,0 @@ * 是否是Electron环境 |
{ | ||
"name": "zhi-device", | ||
"version": "0.7.3", | ||
"version": "0.8.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
{ | ||
"name": "zhi-device", | ||
"version": "0.7.3", | ||
"version": "0.8.0", | ||
"type": "module", | ||
@@ -25,4 +25,4 @@ "main": "./dist/index.js", | ||
"@terwer/eslint-config-custom": "1.2.0", | ||
"@terwer/vite-config-custom": "0.6.0", | ||
"@terwer/tsconfig": "1.0.0" | ||
"@terwer/tsconfig": "1.0.0", | ||
"@terwer/vite-config-custom": "0.6.3" | ||
}, | ||
@@ -29,0 +29,0 @@ "scripts": { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
44271
0