dsh-focus-overlay 0.4.0 → 0.6.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.
package/README.en.md CHANGED
@@ -60,6 +60,7 @@ Once in focus mode, an assistant turn no longer shows every step — it folds in
60
60
  | Plugin configuration card | A collapsible card under "Settings → Plugins → Plugin configuration": navbar toggle, open-position strategy, text-area width — persisted to `localStorage` |
61
61
  | Auto-enter focus | After a reply **completes normally**, auto-open focus at your question; abnormal endings (stop / error / max-tokens / interrupt) never fire |
62
62
  | Reply / waiting reminders | In focus, a "New reply ready + View" toast on completion; an "AI is waiting for your reply + Reply" toast on a question/approval, auto-cleared once answered |
63
+ | DSH-better-sidebar compatibility | While in focus, auto-hide its top-right panel toggle buttons and any open right/bottom panels (and release the squeezed layout); restored on exit |
63
64
 
64
65
  ## Install
65
66
 
@@ -105,6 +106,8 @@ Restart `dsh web` after install.
105
106
  3. Hover the right-side dots to preview, click to jump; a centered "↓ back to latest" button appears when you're not at the bottom.
106
107
  4. Press `Esc` or click "Exit focus" to return — the original UI is untouched.
107
108
 
109
+ > **Compatibility note**: if [DSH-better-sidebar](https://github.com/omdsh-dev/DSH-better-sidebar) is also installed, entering focus mode auto-hides its two top-right panel toggle buttons and any open right/bottom panels (releasing the squeezed layout); they're restored as they were on exit, without touching that plugin's layout state.
110
+
108
111
  ## Settings
109
112
 
110
113
  In the sidebar "Settings → Plugins → Plugin configuration", expand the "Focus Mode" card:
package/README.md CHANGED
@@ -58,6 +58,7 @@
58
58
  | 插件配置卡片 | 在「设置 → 插件 → 插件配置」中的可折叠卡片,含导航条开关、打开定位策略、文字区宽度,持久化到 `localStorage` |
59
59
  | 自动进入专注 | 回复**正常完成**后自动打开专注并定位到本轮你的提问;异常结束(停止 / 报错 / 超 token / 打断)不触发 |
60
60
  | 回复 / 等待提醒 | 专注中回复完成弹「新回复已生成 + 查看」;AI 提问 / 审批等待时弹「AI 正在等待你的回复 + 去回复」,回答完自动消失 |
61
+ | 兼容 DSH-better-sidebar | 进入专注时自动隐藏其右上角的收放面板按钮与已开启的右侧/底部面板,并释放被挤压的布局;退出专注后按原状态还原 |
61
62
 
62
63
  ## 安装
63
64
 
@@ -103,6 +104,8 @@ dsh web
103
104
  3. 右侧导航圆点可悬停预览、点击跳转;离开底部时右下出现居中的「↓ 回到最新」。
104
105
  4. 按 `Esc` 或点「退出专注」返回原界面,原位置/状态保持不变。
105
106
 
107
+ > **兼容提示**:若同时安装了 [DSH-better-sidebar](https://github.com/omdsh-dev/DSH-better-sidebar),进入专注模式会自动隐藏其右上角的两个收放面板按钮以及已开启的右侧/底部面板(并释放被挤压的布局);退出专注后按原状态恢复,不会改动该插件的面板布局。
108
+
106
109
  ## 设置
107
110
 
108
111
  侧栏「设置 → 插件 → 插件配置」中,展开「专注模式」卡片:
package/lib/client.js CHANGED
@@ -915,6 +915,15 @@ window.__ModuleLoader__.load({
915
915
  .fm-plugin-check input[type="checkbox"]{width:16px;height:16px;margin:0;cursor:pointer;accent-color:var(--dsw-alias-brand-primary,#4176e6)}
916
916
  .fm-plugin-check-label{color:var(--dsw-alias-label-primary);font-size:13px;line-height:1.5}
917
917
  .fm-plugin-range{width:100%;max-width:280px;cursor:pointer;accent-color:var(--dsw-alias-brand-primary,#4176e6)}
918
+ /* DSH-better-sidebar compatibility: its panel host (top-right toggle cluster +
919
+ right/bottom panels) is appended to document.body at z-index 40/45, above
920
+ shell.overlay's z-20 layer, so this overlay cannot cover it. Hide the host
921
+ while focus is on, and neutralize the #root layout push it applies when its
922
+ panels are open. Selectors mirror better-sidebar's own layout.css exactly. */
923
+ body[data-fm-focus] [data-dsh-panel-host]{display:none!important}
924
+ body[data-fm-focus] #root{margin-right:0!important;width:100%!important}
925
+ body[data-fm-focus] #root [data-dsh-frame] > [data-pane="conversation"],
926
+ body[data-fm-focus] #root :has(> [data-slot="conversation"]){margin-bottom:0!important}
918
927
  `;
919
928
  //#endregion
920
929
  //#region src/client/locales.ts
@@ -1029,6 +1038,18 @@ window.__ModuleLoader__.load({
1029
1038
  style.remove();
1030
1039
  };
1031
1040
  });
1041
+ ctx.effect(() => {
1042
+ const sync = () => {
1043
+ if (focusStore.get()) document.body.setAttribute("data-fm-focus", "");
1044
+ else document.body.removeAttribute("data-fm-focus");
1045
+ };
1046
+ sync();
1047
+ const unsub = focusStore.subscribe(sync);
1048
+ return () => {
1049
+ unsub();
1050
+ document.body.removeAttribute("data-fm-focus");
1051
+ };
1052
+ });
1032
1053
  ctx.effect(() => ctx.locale.register(NS, {
1033
1054
  zh,
1034
1055
  en
@@ -1111,9 +1132,9 @@ window.__ModuleLoader__.load({
1111
1132
  }, () => (0, react.createElement)(FocusToggle, { t })));
1112
1133
  ctx.slots.inject("settings.plugin.item", () => ctx.slots.register({
1113
1134
  name: "settings.plugin.item",
1135
+ key: "dsh-focus-overlay",
1114
1136
  id: "dsh-focus-overlay",
1115
- order: 1e3,
1116
- label: () => t("settings.label")
1137
+ order: 1e3
1117
1138
  }, () => (0, react.createElement)(FocusSettingsCard, { t })));
1118
1139
  }
1119
1140
  };
package/lib/index.mjs CHANGED
@@ -1,4 +1,24 @@
1
+ import z from "@deepseek-ai/schemastery";
1
2
  //#region src/index.mjs
2
- function apply() {}
3
+ /** Settings namespace owned by this plugin (must match /^[a-z][a-z0-9-]*$/). */
4
+ const NAMESPACE = "dsh-focus-overlay";
5
+ /** Durable settings schema; defaults mirror the browser localStorage DEFAULTS. */
6
+ const FocusSettingsSchema = z.object({
7
+ navbar: z.boolean().default(true),
8
+ scroll: z.union(["preserve", "bottom"]).default("preserve"),
9
+ width: z.number().default(760),
10
+ autoFocus: z.boolean().default(false)
11
+ });
12
+ function apply(ctx) {
13
+ ctx.inject(["settings"], (settingsCtx) => {
14
+ const settings = settingsCtx.settings;
15
+ if (!settings || typeof settings.register !== "function") return;
16
+ try {
17
+ settings.register(NAMESPACE, FocusSettingsSchema);
18
+ } catch (error) {
19
+ console.warn("[dsh-focus-overlay] settings namespace registration failed:", error);
20
+ }
21
+ });
22
+ }
3
23
  //#endregion
4
- export { apply as default };
24
+ export { FocusSettingsSchema, NAMESPACE, apply as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-focus-overlay",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Focus Mode for the dsh web GUI: a full-screen reading overlay that hides chrome and folds the AI tool-call flow into summaries, reusing the official Markdown / image primitives.",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",
@@ -55,5 +55,8 @@
55
55
  "type": "git",
56
56
  "url": "https://github.com/boogoo619/dsh-focus-overlay.git"
57
57
  },
58
- "license": "MIT"
58
+ "license": "MIT",
59
+ "dependencies": {
60
+ "@deepseek-ai/schemastery": "^3.18.1"
61
+ }
59
62
  }