zhi-device
Advanced tools
Comparing version 1.1.5 to 1.1.6
var P = Object.defineProperty; | ||
var g = (i, e, t) => e in i ? P(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t; | ||
var s = (i, e, t) => (g(i, typeof e != "symbol" ? e + "" : e, t), t); | ||
var g = (a, e, t) => e in a ? P(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t; | ||
var r = (a, e, t) => (g(a, typeof e != "symbol" ? e + "" : e, t), t); | ||
const u = class { | ||
@@ -16,15 +16,15 @@ /** | ||
*/ | ||
s(n, "isNode", typeof process < "u" && process.versions != null && process.versions.node != null), /** | ||
r(n, "isNode", typeof process < "u" && process.versions != null && process.versions.node != null), /** | ||
* 是否在浏览器环境 | ||
*/ | ||
s(n, "isInBrowser", typeof window < "u" && typeof document < "u"), /** | ||
r(n, "isInBrowser", typeof window < "u" && typeof document < "u"), /** | ||
* 浏览器路径分隔符 | ||
*/ | ||
s(n, "BrowserSeparator", "/"), /** | ||
r(n, "BrowserSeparator", "/"), /** | ||
* 是否是Electron环境 | ||
*/ | ||
s(n, "isElectron", () => typeof process < "u" && process.versions != null && process.versions.electron != null), /** | ||
r(n, "isElectron", () => typeof process < "u" && process.versions != null && process.versions.electron != null), /** | ||
* 是否有Node环境,目前包括 Electron 和 Node | ||
*/ | ||
s(n, "hasNodeEnv", () => u.isElectron() || u.isNode), /** | ||
r(n, "hasNodeEnv", () => u.isElectron() || u.isNode), /** | ||
* 获取url参数 | ||
@@ -34,12 +34,17 @@ * | ||
*/ | ||
s(n, "getQueryString", (e) => { | ||
r(n, "getQueryString", (e) => { | ||
if (!u.isInBrowser) | ||
return ""; | ||
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) | ||
return c[1]; | ||
const i = window.location.search.substring(1).split("&"); | ||
for (let s = 0; s < i.length; s++) { | ||
const o = i[s].split("="); | ||
if (o[0] === e) | ||
return o[1]; | ||
} | ||
return ""; | ||
}), r(n, "getHashQueryString", (e) => { | ||
if (!u.isInBrowser) | ||
return ""; | ||
const t = window.location.href, i = t.indexOf("#"), s = i === -1 ? t.length : i + 2, o = t.length, d = t.slice(s, o); | ||
return new URLSearchParams(d).get(e) ?? ""; | ||
}), /** | ||
@@ -62,10 +67,10 @@ * 替换 URL 的参数 | ||
*/ | ||
s(n, "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, a); | ||
const m = l.toString(), f = y + (m ? "?" + m : ""); | ||
r(n, "replaceUrlParam", (e, t, i) => { | ||
i == null && (i = ""); | ||
const s = new RegExp("\\b(" + t + "=).*?(&|#|$)"); | ||
if (e.search(s) >= 0) | ||
return e.replace(s, "$1" + i + "$2"); | ||
const [o, d] = e.split("#"), [l, b] = o.split("?"), m = new URLSearchParams(b); | ||
m.set(t, i); | ||
const y = m.toString(), f = l + (y ? "?" + y : ""); | ||
return d ? f + "#" + d : f; | ||
@@ -79,9 +84,9 @@ }), /** | ||
*/ | ||
s(n, "setUrlParameter", (e, t, a) => { | ||
r(n, "setUrlParameter", (e, t, i) => { | ||
if (e.includes(t)) | ||
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; | ||
return u.replaceUrlParam(e, t, i); | ||
const s = e.split("#"); | ||
let o = s[0]; | ||
const d = s[1]; | ||
return o.includes("?") ? o += `&${t}=${i}` : o += `?${t}=${i}`, d && (o += "#" + d), o; | ||
}), /** | ||
@@ -93,7 +98,7 @@ * 重新加载指定tab | ||
*/ | ||
s(n, "reloadTabPage", (e, t = 200) => { | ||
r(n, "reloadTabPage", (e, t = 200) => { | ||
setTimeout(function() { | ||
if (u.isInBrowser) { | ||
const a = window.location.href; | ||
window.location.href = u.setUrlParameter(a, "tab", e); | ||
const i = window.location.href; | ||
window.location.href = u.setUrlParameter(i, "tab", e); | ||
} | ||
@@ -104,3 +109,3 @@ }, t); | ||
*/ | ||
s(n, "reloadPage", () => { | ||
r(n, "reloadPage", () => { | ||
setTimeout(function() { | ||
@@ -115,3 +120,3 @@ u.isInBrowser && window.location.reload(); | ||
*/ | ||
s(n, "reloadPageWithMessageCallback", (e, t) => { | ||
r(n, "reloadPageWithMessageCallback", (e, t) => { | ||
t && t(e), setTimeout(function() { | ||
@@ -121,4 +126,4 @@ u.isInBrowser && window.location.reload(); | ||
}); | ||
var o = /* @__PURE__ */ ((i) => (i.BasePathType_Appearance = "Appearance", i.BasePathType_Data = "Data", i.BasePathType_Themes = "Themes", i.BasePathType_ZhiTheme = "ZhiTheme", i.BasePathType_None = "None", i))(o || {}); | ||
const h = class { | ||
var h = /* @__PURE__ */ ((a) => (a.BasePathType_Appearance = "Appearance", a.BasePathType_Data = "Data", a.BasePathType_Themes = "Themes", a.BasePathType_ZhiTheme = "ZhiTheme", a.BasePathType_None = "None", a))(h || {}); | ||
const c = class { | ||
/** | ||
@@ -150,15 +155,15 @@ * 检测是否运行在思源打开的浏览器中 | ||
static async importJs(e, t) { | ||
let a = e; | ||
let i = e; | ||
switch (t) { | ||
case o.BasePathType_Appearance: | ||
a = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); | ||
case h.BasePathType_Appearance: | ||
i = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); | ||
break; | ||
case o.BasePathType_Data: | ||
a = this.browserJoinPath(this.siyuanDataRelativePath(), e); | ||
case h.BasePathType_Data: | ||
i = this.browserJoinPath(this.siyuanDataRelativePath(), e); | ||
break; | ||
case o.BasePathType_Themes: | ||
a = this.browserJoinPath(this.siyuanThemeRelativePath(), e); | ||
case h.BasePathType_Themes: | ||
i = this.browserJoinPath(this.siyuanThemeRelativePath(), e); | ||
break; | ||
case o.BasePathType_ZhiTheme: | ||
a = this.browserJoinPath(this.zhiThemeRelativePath(), e); | ||
case h.BasePathType_ZhiTheme: | ||
i = this.browserJoinPath(this.zhiThemeRelativePath(), e); | ||
break; | ||
@@ -168,7 +173,7 @@ default: | ||
} | ||
const { default: r } = await import( | ||
const { default: s } = await import( | ||
/* @vite-ignore */ | ||
a | ||
i | ||
); | ||
return r; | ||
return s; | ||
} | ||
@@ -241,3 +246,3 @@ /** | ||
static async importZhiThemeJs(e) { | ||
return await this.importJs(e, o.BasePathType_ZhiTheme); | ||
return await this.importJs(e, h.BasePathType_ZhiTheme); | ||
} | ||
@@ -343,7 +348,7 @@ // ========================= | ||
}; | ||
let p = h; | ||
let p = c; | ||
/** | ||
* 思源笔记iframe挂件环境 | ||
*/ | ||
s(p, "isInSiyuanWidget", () => n.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** | ||
r(p, "isInSiyuanWidget", () => n.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** | ||
* 思源笔记新窗口 | ||
@@ -355,3 +360,3 @@ * | ||
*/ | ||
s(p, "isInSiyuanNewWin", () => typeof window < "u" && window.process && window.process.type === "renderer"), // ========================= | ||
r(p, "isInSiyuanNewWin", () => typeof window < "u" && window.process && window.process.type === "renderer"), // ========================= | ||
// require start | ||
@@ -366,19 +371,19 @@ // ========================= | ||
*/ | ||
s(p, "requireLib", (e, t = !0, a = o.BasePathType_None) => { | ||
r(p, "requireLib", (e, t = !0, i = h.BasePathType_None) => { | ||
if (!n.hasNodeEnv()) | ||
throw new Error("require ony works on node env"); | ||
let r = e; | ||
let s = e; | ||
if (!t) | ||
switch (a) { | ||
case o.BasePathType_Appearance: | ||
r = h.joinPath(h.siyuanAppearancePath(), e); | ||
switch (i) { | ||
case h.BasePathType_Appearance: | ||
s = c.joinPath(c.siyuanAppearancePath(), e); | ||
break; | ||
case o.BasePathType_Data: | ||
r = h.joinPath(h.siyuanDataPath(), e); | ||
case h.BasePathType_Data: | ||
s = c.joinPath(c.siyuanDataPath(), e); | ||
break; | ||
case o.BasePathType_Themes: | ||
r = h.joinPath(h.siyuanAppearancePath(), "themes", e); | ||
case h.BasePathType_Themes: | ||
s = c.joinPath(c.siyuanAppearancePath(), "themes", e); | ||
break; | ||
case o.BasePathType_ZhiTheme: | ||
r = h.joinPath(h.siyuanAppearancePath(), "themes", "zhi", e); | ||
case h.BasePathType_ZhiTheme: | ||
s = c.joinPath(c.siyuanAppearancePath(), "themes", "zhi", e); | ||
break; | ||
@@ -388,7 +393,7 @@ default: | ||
} | ||
const c = h.siyuanWindow(); | ||
if (!c) | ||
return require(r); | ||
if (typeof c.require < "u") | ||
return c.require(r); | ||
const o = c.siyuanWindow(); | ||
if (!o) | ||
return require(s); | ||
if (typeof o.require < "u") | ||
return o.require(s); | ||
}), /** | ||
@@ -399,3 +404,3 @@ * 引入依赖,以 data 的基本路径为准 | ||
*/ | ||
s(p, "requireAppearanceLib", (e) => h.requireLib(e, !1, o.BasePathType_Appearance)), /** | ||
r(p, "requireAppearanceLib", (e) => c.requireLib(e, !1, h.BasePathType_Appearance)), /** | ||
* 引入依赖,以 data 的基本路径为准 | ||
@@ -405,3 +410,3 @@ * | ||
*/ | ||
s(p, "requireDataLib", (e) => h.requireLib(e, !1, o.BasePathType_Data)), /** | ||
r(p, "requireDataLib", (e) => c.requireLib(e, !1, h.BasePathType_Data)), /** | ||
* 引入依赖,以 theme 的基本路径为准 | ||
@@ -411,3 +416,3 @@ * | ||
*/ | ||
s(p, "requireThemesLib", (e) => h.requireLib(e, !1, o.BasePathType_Themes)), /** | ||
r(p, "requireThemesLib", (e) => c.requireLib(e, !1, h.BasePathType_Themes)), /** | ||
* 引入依赖,以 ZhiTheme 的基本路径为准 | ||
@@ -417,4 +422,4 @@ * | ||
*/ | ||
s(p, "requireZhiThemeLib", (e) => h.requireLib(e, !1, o.BasePathType_ZhiTheme)); | ||
var w = /* @__PURE__ */ ((i) => (i.DeviceType_Mobile_Device = "Mobile", i.DeviceType_Siyuan_Widget = "Siyuan_Widget", i.DeviceType_Siyuan_NewWin = "Siyuan_NewWindow", i.DeviceType_Siyuan_MainWin = "Siyuan_MainWindow", i.DeviceType_Siyuan_Browser = "Siyuan_Browser", i.DeviceType_Chrome_Extension = "Chrome_Extension", i.DeviceType_Chrome_Browser = "Chrome_Browser", i.DeviceType_Node = "Node", i))(w || {}); | ||
r(p, "requireZhiThemeLib", (e) => c.requireLib(e, !1, h.BasePathType_ZhiTheme)); | ||
var w = /* @__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))(w || {}); | ||
class v { | ||
@@ -443,3 +448,3 @@ /** | ||
export { | ||
o as BasePathTypeEnum, | ||
h as BasePathTypeEnum, | ||
n as BrowserUtil, | ||
@@ -446,0 +451,0 @@ v as DeviceDetection, |
var P = Object.defineProperty; | ||
var g = (i, e, t) => e in i ? P(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t; | ||
var s = (i, e, t) => (g(i, typeof e != "symbol" ? e + "" : e, t), t); | ||
var g = (a, e, t) => e in a ? P(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t; | ||
var r = (a, e, t) => (g(a, typeof e != "symbol" ? e + "" : e, t), t); | ||
const u = class { | ||
@@ -16,15 +16,15 @@ /** | ||
*/ | ||
s(n, "isNode", typeof process < "u" && process.versions != null && process.versions.node != null), /** | ||
r(n, "isNode", typeof process < "u" && process.versions != null && process.versions.node != null), /** | ||
* 是否在浏览器环境 | ||
*/ | ||
s(n, "isInBrowser", typeof window < "u" && typeof document < "u"), /** | ||
r(n, "isInBrowser", typeof window < "u" && typeof document < "u"), /** | ||
* 浏览器路径分隔符 | ||
*/ | ||
s(n, "BrowserSeparator", "/"), /** | ||
r(n, "BrowserSeparator", "/"), /** | ||
* 是否是Electron环境 | ||
*/ | ||
s(n, "isElectron", () => typeof process < "u" && process.versions != null && process.versions.electron != null), /** | ||
r(n, "isElectron", () => typeof process < "u" && process.versions != null && process.versions.electron != null), /** | ||
* 是否有Node环境,目前包括 Electron 和 Node | ||
*/ | ||
s(n, "hasNodeEnv", () => u.isElectron() || u.isNode), /** | ||
r(n, "hasNodeEnv", () => u.isElectron() || u.isNode), /** | ||
* 获取url参数 | ||
@@ -34,12 +34,17 @@ * | ||
*/ | ||
s(n, "getQueryString", (e) => { | ||
r(n, "getQueryString", (e) => { | ||
if (!u.isInBrowser) | ||
return ""; | ||
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) | ||
return c[1]; | ||
const i = window.location.search.substring(1).split("&"); | ||
for (let s = 0; s < i.length; s++) { | ||
const o = i[s].split("="); | ||
if (o[0] === e) | ||
return o[1]; | ||
} | ||
return ""; | ||
}), r(n, "getHashQueryString", (e) => { | ||
if (!u.isInBrowser) | ||
return ""; | ||
const t = window.location.href, i = t.indexOf("#"), s = i === -1 ? t.length : i + 2, o = t.length, d = t.slice(s, o); | ||
return new URLSearchParams(d).get(e) ?? ""; | ||
}), /** | ||
@@ -62,10 +67,10 @@ * 替换 URL 的参数 | ||
*/ | ||
s(n, "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, a); | ||
const m = l.toString(), f = y + (m ? "?" + m : ""); | ||
r(n, "replaceUrlParam", (e, t, i) => { | ||
i == null && (i = ""); | ||
const s = new RegExp("\\b(" + t + "=).*?(&|#|$)"); | ||
if (e.search(s) >= 0) | ||
return e.replace(s, "$1" + i + "$2"); | ||
const [o, d] = e.split("#"), [l, b] = o.split("?"), m = new URLSearchParams(b); | ||
m.set(t, i); | ||
const y = m.toString(), f = l + (y ? "?" + y : ""); | ||
return d ? f + "#" + d : f; | ||
@@ -79,9 +84,9 @@ }), /** | ||
*/ | ||
s(n, "setUrlParameter", (e, t, a) => { | ||
r(n, "setUrlParameter", (e, t, i) => { | ||
if (e.includes(t)) | ||
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; | ||
return u.replaceUrlParam(e, t, i); | ||
const s = e.split("#"); | ||
let o = s[0]; | ||
const d = s[1]; | ||
return o.includes("?") ? o += `&${t}=${i}` : o += `?${t}=${i}`, d && (o += "#" + d), o; | ||
}), /** | ||
@@ -93,7 +98,7 @@ * 重新加载指定tab | ||
*/ | ||
s(n, "reloadTabPage", (e, t = 200) => { | ||
r(n, "reloadTabPage", (e, t = 200) => { | ||
setTimeout(function() { | ||
if (u.isInBrowser) { | ||
const a = window.location.href; | ||
window.location.href = u.setUrlParameter(a, "tab", e); | ||
const i = window.location.href; | ||
window.location.href = u.setUrlParameter(i, "tab", e); | ||
} | ||
@@ -104,3 +109,3 @@ }, t); | ||
*/ | ||
s(n, "reloadPage", () => { | ||
r(n, "reloadPage", () => { | ||
setTimeout(function() { | ||
@@ -115,3 +120,3 @@ u.isInBrowser && window.location.reload(); | ||
*/ | ||
s(n, "reloadPageWithMessageCallback", (e, t) => { | ||
r(n, "reloadPageWithMessageCallback", (e, t) => { | ||
t && t(e), setTimeout(function() { | ||
@@ -121,4 +126,4 @@ u.isInBrowser && window.location.reload(); | ||
}); | ||
var o = /* @__PURE__ */ ((i) => (i.BasePathType_Appearance = "Appearance", i.BasePathType_Data = "Data", i.BasePathType_Themes = "Themes", i.BasePathType_ZhiTheme = "ZhiTheme", i.BasePathType_None = "None", i))(o || {}); | ||
const h = class { | ||
var h = /* @__PURE__ */ ((a) => (a.BasePathType_Appearance = "Appearance", a.BasePathType_Data = "Data", a.BasePathType_Themes = "Themes", a.BasePathType_ZhiTheme = "ZhiTheme", a.BasePathType_None = "None", a))(h || {}); | ||
const c = class { | ||
/** | ||
@@ -150,15 +155,15 @@ * 检测是否运行在思源打开的浏览器中 | ||
static async importJs(e, t) { | ||
let a = e; | ||
let i = e; | ||
switch (t) { | ||
case o.BasePathType_Appearance: | ||
a = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); | ||
case h.BasePathType_Appearance: | ||
i = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); | ||
break; | ||
case o.BasePathType_Data: | ||
a = this.browserJoinPath(this.siyuanDataRelativePath(), e); | ||
case h.BasePathType_Data: | ||
i = this.browserJoinPath(this.siyuanDataRelativePath(), e); | ||
break; | ||
case o.BasePathType_Themes: | ||
a = this.browserJoinPath(this.siyuanThemeRelativePath(), e); | ||
case h.BasePathType_Themes: | ||
i = this.browserJoinPath(this.siyuanThemeRelativePath(), e); | ||
break; | ||
case o.BasePathType_ZhiTheme: | ||
a = this.browserJoinPath(this.zhiThemeRelativePath(), e); | ||
case h.BasePathType_ZhiTheme: | ||
i = this.browserJoinPath(this.zhiThemeRelativePath(), e); | ||
break; | ||
@@ -168,7 +173,7 @@ default: | ||
} | ||
const { default: r } = await import( | ||
const { default: s } = await import( | ||
/* @vite-ignore */ | ||
a | ||
i | ||
); | ||
return r; | ||
return s; | ||
} | ||
@@ -241,3 +246,3 @@ /** | ||
static async importZhiThemeJs(e) { | ||
return await this.importJs(e, o.BasePathType_ZhiTheme); | ||
return await this.importJs(e, h.BasePathType_ZhiTheme); | ||
} | ||
@@ -343,7 +348,7 @@ // ========================= | ||
}; | ||
let p = h; | ||
let p = c; | ||
/** | ||
* 思源笔记iframe挂件环境 | ||
*/ | ||
s(p, "isInSiyuanWidget", () => n.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** | ||
r(p, "isInSiyuanWidget", () => n.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** | ||
* 思源笔记新窗口 | ||
@@ -355,3 +360,3 @@ * | ||
*/ | ||
s(p, "isInSiyuanNewWin", () => typeof window < "u" && window.process && window.process.type === "renderer"), // ========================= | ||
r(p, "isInSiyuanNewWin", () => typeof window < "u" && window.process && window.process.type === "renderer"), // ========================= | ||
// require start | ||
@@ -366,19 +371,19 @@ // ========================= | ||
*/ | ||
s(p, "requireLib", (e, t = !0, a = o.BasePathType_None) => { | ||
r(p, "requireLib", (e, t = !0, i = h.BasePathType_None) => { | ||
if (!n.hasNodeEnv()) | ||
throw new Error("require ony works on node env"); | ||
let r = e; | ||
let s = e; | ||
if (!t) | ||
switch (a) { | ||
case o.BasePathType_Appearance: | ||
r = h.joinPath(h.siyuanAppearancePath(), e); | ||
switch (i) { | ||
case h.BasePathType_Appearance: | ||
s = c.joinPath(c.siyuanAppearancePath(), e); | ||
break; | ||
case o.BasePathType_Data: | ||
r = h.joinPath(h.siyuanDataPath(), e); | ||
case h.BasePathType_Data: | ||
s = c.joinPath(c.siyuanDataPath(), e); | ||
break; | ||
case o.BasePathType_Themes: | ||
r = h.joinPath(h.siyuanAppearancePath(), "themes", e); | ||
case h.BasePathType_Themes: | ||
s = c.joinPath(c.siyuanAppearancePath(), "themes", e); | ||
break; | ||
case o.BasePathType_ZhiTheme: | ||
r = h.joinPath(h.siyuanAppearancePath(), "themes", "zhi", e); | ||
case h.BasePathType_ZhiTheme: | ||
s = c.joinPath(c.siyuanAppearancePath(), "themes", "zhi", e); | ||
break; | ||
@@ -388,7 +393,7 @@ default: | ||
} | ||
const c = h.siyuanWindow(); | ||
if (!c) | ||
return require(r); | ||
if (typeof c.require < "u") | ||
return c.require(r); | ||
const o = c.siyuanWindow(); | ||
if (!o) | ||
return require(s); | ||
if (typeof o.require < "u") | ||
return o.require(s); | ||
}), /** | ||
@@ -399,3 +404,3 @@ * 引入依赖,以 data 的基本路径为准 | ||
*/ | ||
s(p, "requireAppearanceLib", (e) => h.requireLib(e, !1, o.BasePathType_Appearance)), /** | ||
r(p, "requireAppearanceLib", (e) => c.requireLib(e, !1, h.BasePathType_Appearance)), /** | ||
* 引入依赖,以 data 的基本路径为准 | ||
@@ -405,3 +410,3 @@ * | ||
*/ | ||
s(p, "requireDataLib", (e) => h.requireLib(e, !1, o.BasePathType_Data)), /** | ||
r(p, "requireDataLib", (e) => c.requireLib(e, !1, h.BasePathType_Data)), /** | ||
* 引入依赖,以 theme 的基本路径为准 | ||
@@ -411,3 +416,3 @@ * | ||
*/ | ||
s(p, "requireThemesLib", (e) => h.requireLib(e, !1, o.BasePathType_Themes)), /** | ||
r(p, "requireThemesLib", (e) => c.requireLib(e, !1, h.BasePathType_Themes)), /** | ||
* 引入依赖,以 ZhiTheme 的基本路径为准 | ||
@@ -417,4 +422,4 @@ * | ||
*/ | ||
s(p, "requireZhiThemeLib", (e) => h.requireLib(e, !1, o.BasePathType_ZhiTheme)); | ||
var w = /* @__PURE__ */ ((i) => (i.DeviceType_Mobile_Device = "Mobile", i.DeviceType_Siyuan_Widget = "Siyuan_Widget", i.DeviceType_Siyuan_NewWin = "Siyuan_NewWindow", i.DeviceType_Siyuan_MainWin = "Siyuan_MainWindow", i.DeviceType_Siyuan_Browser = "Siyuan_Browser", i.DeviceType_Chrome_Extension = "Chrome_Extension", i.DeviceType_Chrome_Browser = "Chrome_Browser", i.DeviceType_Node = "Node", i))(w || {}); | ||
r(p, "requireZhiThemeLib", (e) => c.requireLib(e, !1, h.BasePathType_ZhiTheme)); | ||
var w = /* @__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))(w || {}); | ||
class v { | ||
@@ -443,3 +448,3 @@ /** | ||
export { | ||
o as BasePathTypeEnum, | ||
h as BasePathTypeEnum, | ||
n as BrowserUtil, | ||
@@ -446,0 +451,0 @@ v as DeviceDetection, |
@@ -39,2 +39,3 @@ /** | ||
static getQueryString: (sParam: string) => string; | ||
static getHashQueryString: (sParam: string) => string; | ||
/** | ||
@@ -41,0 +42,0 @@ * 替换 URL 的参数 |
{ | ||
"name": "zhi-device", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
{ | ||
"name": "zhi-device", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"type": "module", | ||
@@ -24,5 +24,5 @@ "main": "./dist/index.js", | ||
"devDependencies": { | ||
"@terwer/eslint-config-custom": "1.3.5", | ||
"@terwer/tsconfig": "0.0.6", | ||
"@terwer/vite-config-custom": "0.7.5" | ||
"@terwer/eslint-config-custom": "1.3.6", | ||
"@terwer/vite-config-custom": "0.7.6", | ||
"@terwer/tsconfig": "0.0.7" | ||
}, | ||
@@ -29,0 +29,0 @@ "publishConfig": { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
44279
1228