dsh-font-enhancer 1.1.0 → 1.2.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.
Files changed (3) hide show
  1. package/README.md +7 -11
  2. package/lib/client.js +40 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -12,18 +12,13 @@ Chinese/English font, font-size, line-height, weight, italic, and text color.
12
12
  Features **unified** global font/color overrides, **theme** save/switch, **框选
13
13
  (pick-region)** element selection, and **random** font/color generators.
14
14
 
15
- > ⚠️ **当前版本(v1.1.0)仅保证在 DSH **网页端**(浏览器访问 DSH Web GUI,默认
16
- > `http://127.0.0.1:43120`)正常生效。** 桌面端 Electron 内置窗口的样式适配仍在
17
- > 开发中(框选标记 `data-fe-reg` 只打在网页渲染的 DOM 上,桌面窗口暂时匹配不到)。
18
- > 桌面端用户请等待后续版本,或先用 `dsh plugin add dsh-font-enhancer@1.0.0` 回退到
19
- > 旧版。
15
+ > ✅ **v1.2.0 同时支持 DSH **网页端**(浏览器访问 Web GUI,默认 `http://127.0.0.1:43120`)
16
+ > 和 **桌面端**(Electron 内置窗口)。** 两端均可正常使用框选区域、字体/颜色设置
17
+ > 等全部功能。
20
18
  >
21
- > ⚠️ Current version (v1.1.0) is verified on the DSH **Web GUI** (browser access,
22
- > default `http://127.0.0.1:43120`) only. Desktop Electron window styling is still
23
- > in progress — pick-region markers (`data-fe-reg`) are only attached to the DOM
24
- > rendered in the browser, so the desktop window cannot match them yet. Desktop
25
- > users should wait for a later release, or fall back with
26
- > `dsh plugin add dsh-font-enhancer@1.0.0`.
19
+ > ✅ v1.2.0 supports both the DSH **Web GUI** (browser access, default
20
+ > `http://127.0.0.1:43120`) and the **Desktop Electron window**. All features
21
+ > work in both environments.
27
22
 
28
23
  ---
29
24
 
@@ -89,6 +84,7 @@ Or copy the folder into `node_modules/` and add the package name to the profile
89
84
  ### 版本 Versions
90
85
  | 版本 | 说明 |
91
86
  |------|------|
87
+ | `v1.2.0` | **网页端+桌面端双端可用**。修复桌面端 Electron 窗口浮球不可见问题。 |
92
88
  | `v1.1.0` | 增强版:新增框选区域(pick-region)+ 采集调试 + 随机配色。**仅网页端可用**。 |
93
89
  | `v1.0.0` | 旧版:内置区域样式 + 统一控制 + 主题。相对简单,兼容性更好。 |
94
90
 
package/lib/client.js CHANGED
@@ -303,7 +303,7 @@ window.__ModuleLoader__.load({
303
303
  "#dsh-fe-root *{box-sizing:border-box;scrollbar-width:thin}",
304
304
  "",
305
305
  "/* ── toggle button — gem-like floating orb (max-visible) ── */",
306
- "#dsh-fe-root{position:relative;z-index:2147483647}",
306
+ "#dsh-fe-root{position:static !important;z-index:2147483647;pointer-events:none}",
307
307
  "#dsh-fe-toggle{position:fixed;left:auto;top:auto;right:18px;bottom:18px;z-index:2147483647 !important;width:54px !important;height:54px !important;border-radius:50% !important;border:0 !important;background:radial-gradient(circle at 30% 25%,rgba(255,255,255,.15),rgba(40,44,54,.95) 70%) !important;color:#eef0f4 !important;font-size:22px !important;font-weight:700 !important;cursor:grab !important;user-select:none !important;touch-action:none !important;box-shadow:0 4px 24px rgba(0,0,0,.6),inset 0 1px 0 rgba(255,255,255,.15) !important;backdrop-filter:blur(12px) !important;line-height:54px !important;text-align:center !important;display:block !important;visibility:visible !important;opacity:1 !important;transform:none !important;pointer-events:auto !important}",
308
308
  "#dsh-fe-toggle:hover{box-shadow:0 6px 32px rgba(0,0,0,.7),inset 0 1px 0 rgba(255,255,255,.2) !important;transform:scale(1.06) !important}",
309
309
  "#dsh-fe-toggle.dsh-fe-dragging{cursor:grabbing !important;transform:scale(1.12) !important;box-shadow:0 8px 40px rgba(0,0,0,.8) !important}",
@@ -1016,8 +1016,46 @@ window.__ModuleLoader__.load({
1016
1016
  // position:fixed children (the orb + panel) position against a transformed
1017
1017
  // ancestor instead of the viewport, hiding them off screen. Appending to
1018
1018
  // <html> sidesteps that so the floating orb is always visible.
1019
+ // v1.2.0: the parent #dsh-fe-root is position:static + pointer-events:none,
1020
+ // so position:fixed children stay viewport-relative in BOTH the browser
1021
+ // and the Electron desktop window.
1019
1022
  var mount = document.documentElement || document.body;
1020
- mount.appendChild(root);
1023
+ // guard against re-append (Electron window can re-run buildUI on focus)
1024
+ if (!root.parentNode) mount.appendChild(root);
1025
+ // v1.2.0 — Electron desktop window hardening: DSH Desktop renders the
1026
+ // same 43120 page in its Electron BrowserWindow, but the native window
1027
+ // chrome + zoom can offset position:fixed elements. Detect Electron and,
1028
+ // if the orb would land off-viewport, force it to an on-screen corner.
1029
+ try {
1030
+ var isElectron = /electron/i.test(navigator.userAgent) || (typeof window.process !== "undefined" && window.process.type === "renderer");
1031
+ if (isElectron) {
1032
+ var btnEl = root.querySelector("#dsh-fe-toggle");
1033
+ var panelEl = root.querySelector("#dsh-fe-panel");
1034
+ if (btnEl && panelEl) {
1035
+ // reset to safe defaults so the orb is never pushed off-screen
1036
+ btnEl.style.right = "18px";
1037
+ btnEl.style.bottom = "18px";
1038
+ btnEl.style.left = "auto";
1039
+ btnEl.style.top = "auto";
1040
+ // re-pin the panel near the orb once rendered
1041
+ var pin = function () {
1042
+ var br = btnEl.getBoundingClientRect();
1043
+ if (!br || (br.left === 0 && br.top === 0 && br.width === 0)) return;
1044
+ var pw = panelEl.offsetWidth || 348;
1045
+ var ph = panelEl.offsetHeight || 360;
1046
+ var left = Math.max(8, Math.min(window.innerWidth - pw - 8, br.left + br.width / 2 - pw / 2));
1047
+ var top = br.top - ph - 10;
1048
+ if (top < 8) top = br.bottom + 10;
1049
+ panelEl.style.left = left + "px";
1050
+ panelEl.style.top = top + "px";
1051
+ panelEl.style.right = "auto";
1052
+ panelEl.style.bottom = "auto";
1053
+ };
1054
+ setTimeout(pin, 50);
1055
+ window.addEventListener("resize", pin);
1056
+ }
1057
+ }
1058
+ } catch (e) {}
1021
1059
  try { fetch("/dsh-font-enhancer/client-alive").catch(function(){}); } catch (e) {} // DIAG-2 root appended
1022
1060
 
1023
1061
  panel = root.querySelector("#dsh-fe-panel");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-font-enhancer",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "DIY 你的 DSH 界面:按区域自定义字体/字号/颜色,支持全局统一设置、主题保存切换、框选区域、随机配色与字体。DIY your DSH UI fonts & colors: per-region font/size/color styling, pick-region element selection, unified overrides, theme save & switch, random font/color.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",