From 6bffa6477eca0834bb8f5db59c26ccb2278b7a3e Mon Sep 17 00:00:00 2001 From: wangheng Date: Thu, 3 Dec 2026 16:17:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=E8=BE=B9=E7=BC=98=E7=BB=86=E6=9D=A1?= =?UTF-8?q?=E5=9C=A8=20DS=20Bot=20=E5=85=A8=E5=B1=8F=E9=A1=B5=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E8=A7=81=20(v0.5.3-local.12)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 现象:DS Bot 全屏页里工作台入口(左缘细条)看不到,切回经典布局才可见。 1. 层级:细条 z-index 65 被宿主全屏页容器盖住 → 提到 2147483000, 面板 2147483001;细条默认底色与右边框对比度提高。 2. fixed 包含块:祖先带 transform / perspective / filter / contain 时, position: fixed 的参照系从视口变成该祖先,细条整体偏移甚至移出可视区。 新增 fixedOrigin() 测出包含块原点,edgeLeft 换算为相对坐标, 并夹到 [0, 视口宽-12];无常规侧栏时贴包含块左缘。 3. 自诊断:挂载 800ms 后细条宽高为 0 时 console.warn 输出左侧位置与 最多 8 层祖先的 display / transform,便于定位宿主槽位被隐藏的情况。 验证:npm run pack 全绿(含 edge-panel 4 组回归),双资产同源 6a18b101…。 --- 01_content/dsh.plugin.json | 2 +- 01_content/lib/client.js | 56 ++++++++++++++++++++++++++---- 01_content/lib/index.js | 2 +- 01_content/package.json | 2 +- 01_content/src/client/index.tsx | 61 +++++++++++++++++++++++++++++++-- 01_content/src/client/styles.ts | 4 +-- 02_process/LOCAL-CHANGES.md | 16 +++++++-- README.md | 12 +++---- 8 files changed, 132 insertions(+), 23 deletions(-) diff --git a/01_content/dsh.plugin.json b/01_content/dsh.plugin.json index e8be4ec..c1c593e 100644 --- a/01_content/dsh.plugin.json +++ b/01_content/dsh.plugin.json @@ -1,7 +1,7 @@ { "name": "dsh-worktable", "description": "工作台:DSH 侧边栏的 agent 级项目容器,收纳如 TravelAtlas 等自装项目", - "version": "0.5.3-local.11", + "version": "0.5.3-local.12", "entry": { "name": "dsh-worktable", "inject": [] diff --git a/01_content/lib/client.js b/01_content/lib/client.js index f61b561..5255ec1 100644 --- a/01_content/lib/client.js +++ b/01_content/lib/client.js @@ -8432,10 +8432,10 @@ var css = xterm_default + "\n" + [ ".dsh-wt_manageRowSub{margin-left:20px}", // 停靠态:左缘细条 + 滑出面板 ".dsh-wt_edgeAnchor{width:0;height:0;overflow:hidden;flex:none}", - ".dsh-wt_edgeStrip{position:fixed;top:0;bottom:0;width:12px;z-index:65;display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.07));border-right:1px solid transparent;transition:background .15s,border-color .15s}", + ".dsh-wt_edgeStrip{position:fixed;top:0;bottom:0;width:12px;z-index:2147483000;display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.14));border-right:1px solid var(--dsw-alias-border-l1,rgba(125,125,125,.18));transition:background .15s,border-color .15s}", ".dsh-wt_edgeStrip:hover,.dsh-wt_edgeStripOn{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05));border-right-color:var(--dsw-alias-border-l1,#262b36)}", ".dsh-wt_edgeStripGlyph{font-size:11px;line-height:1;color:var(--dsw-alias-label-tertiary,#6e7683);user-select:none;-webkit-user-select:none}", - ".dsh-wt_edgePanelWrap{position:fixed;top:0;bottom:0;width:250px;z-index:66;transform:translateX(-100%);transition:transform .18s ease;box-shadow:14px 0 30px rgba(0,0,0,.18)}", + ".dsh-wt_edgePanelWrap{position:fixed;top:0;bottom:0;width:250px;z-index:2147483001;transform:translateX(-100%);transition:transform .18s ease;box-shadow:14px 0 30px rgba(0,0,0,.18)}", ".dsh-wt_edgePanelWrapOn{transform:translateX(0)}", ".dsh-wt_edgePanel{position:absolute;inset:0;box-sizing:border-box;padding:10px 10px 14px;background:var(--dsw-alias-bg-base,#0b0e14);border-right:1px solid var(--dsw-alias-border-l2,#3a4150);overflow-y:auto;overscroll-behavior:contain}", ".dsh-wt_edgeHandle{position:absolute;right:0;top:50%;transform:translateY(-50%);width:17px;height:64px;display:flex;align-items:center;justify-content:center;padding:0;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-right:none;border-radius:8px 0 0 8px;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.10));color:var(--dsw-alias-state-accent-primary,#4f8ef7);font-size:13px;line-height:1;cursor:pointer;box-shadow:-4px 0 10px rgba(0,0,0,.14)}", @@ -9233,7 +9233,7 @@ var CHANGELOG_V030 = `\u66F4\u65B0\u516C\u544A \xB7 v0.5.1 \u30103.1 \u6587\u5B57\u4E0E\u7EC6\u8282\u6253\u78E8\u3011\u5168\u5C40\u5B57\u4F53\u4E0E\u5B57\u53F7\u7EDF\u4E00\u4F18\u5316\u3001\u4E0B\u62C9\u9762\u677F\u73BB\u7483\u5316\u4E0E\u5BF9\u9F50\u3001\u83DC\u5355\u70B9\u9009\u540E\u4FDD\u6301\u6253\u5F00\u4FBF\u4E8E\u8FDE\u7EED\u9884\u89C8\u3001\u6309\u94AE\u63CF\u8FB9\u4E0E\u60AC\u505C\u53CD\u9988\u7B49\u4EA4\u4E92\u7EC6\u8282\uFF1B\u540C\u65F6\u4FEE\u590D\u4E86\u591A\u9879\u4F53\u9A8C\u95EE\u9898\uFF08\u7167\u7247\u4E0A\u4F20\u6E05\u6670\u5EA6\u3001\u80CC\u666F\u7F51\u683C\u7EBF\u5728\u7167\u7247\u6A21\u5F0F\u4E0B\u4E0D\u751F\u6548\u3001\u6D45\u8272\u4E3B\u9898\u4E0B\u5DE5\u4F5C\u72B6\u6001\u5149\u6548\u4E0D\u53EF\u89C1\u7B49\uFF09\u3002`; // src/client/updateCheck.ts -var LOCAL_VERSION = false ? "dev" : "0.5.3-local.11"; +var LOCAL_VERSION = false ? "dev" : "0.5.3-local.12"; var UPDATE_API = "/api/worktable/update-check"; var K_UPDATE_CHECK = "dsh.worktable.updateCheck.v1"; var K_LAST_CHECK = "dsh.worktable.lastUpdateCheck.v1"; @@ -21962,6 +21962,7 @@ function WorktableSection(props) { const bottomInsetRef = (0, import_react3.useRef)(0); const [floatGeo, setFloatGeo] = (0, import_react3.useState)(null); const [edgeLeft, setEdgeLeft] = (0, import_react3.useState)(64); + const stripRef = (0, import_react3.useRef)(null); const [edgeOpen, setEdgeOpen] = (0, import_react3.useState)(false); const [edgeDismissed, setEdgeDismissed] = (0, import_react3.useState)(false); const edgeCloseTimer = (0, import_react3.useRef)(null); @@ -22349,10 +22350,28 @@ function WorktableSection(props) { }; } }, [wide, measureRailRect]); + const fixedOrigin = (0, import_react3.useCallback)(() => { + let el = rootRef.current?.parentElement ?? null; + while (el && el !== document.body && el !== document.documentElement) { + const cs = getComputedStyle(el); + const transform = cs.transform && cs.transform !== "none"; + const perspective = cs.perspective && cs.perspective !== "none"; + const filter = cs.filter && cs.filter !== "none"; + const contain = /paint|layout|strict|content/i.test(cs.contain || ""); + if (transform || perspective || filter || contain) { + const r = el.getBoundingClientRect(); + return { left: r.left + el.scrollLeft, top: r.top + el.scrollTop }; + } + el = el.parentElement; + } + return { left: 0, top: 0 }; + }, []); const measureFloatGeo = (0, import_react3.useCallback)(() => { + const origin = fixedOrigin(); const sidebar = findSidebar(rootRef.current); if (!sidebar) { setFloatGeo({ left: 14, width: null }); + setEdgeLeft(Math.round(Math.max(0, -origin.left))); return; } const rect = sidebar.getBoundingClientRect(); @@ -22364,22 +22383,29 @@ function WorktableSection(props) { setSidebarRight(Math.round(rect.right)); setEdgeLeft((() => { let el = rootRef.current; + let viewportLeft = null; while (el) { if (typeof el.className === "string" && /footerActions|footArea/i.test(el.className)) { const r = el.getBoundingClientRect(); - if (r.width > 120) return Math.max(0, Math.round(r.left) - 8); + if (r.width > 120) { + viewportLeft = Math.round(r.left) - 8; + break; + } break; } el = el.parentElement; } - return Math.max(0, Math.round(rect.left)); + const base2 = viewportLeft ?? Math.round(rect.left); + const relative = base2 - Math.round(origin.left); + const maxLeft = Math.max(0, (typeof window !== "undefined" ? window.innerWidth : 1280) - 12); + return Math.min(maxLeft, Math.max(0, relative)); })()); if (width > 0) { setFloatGeo({ left: Math.round(rect.left + padLeft + margin), width: Math.round(width) }); } else { setFloatGeo({ left: 14, width: null }); } - }, []); + }, [fixedOrigin]); (0, import_react3.useLayoutEffect)(() => { measureFloatGeo(); const sidebar = findSidebar(rootRef.current); @@ -23316,6 +23342,23 @@ function WorktableSection(props) { }, [cancelEdgeClose]); (0, import_react3.useEffect)(() => () => cancelEdgeClose(), [cancelEdgeClose]); const anyPopupOpen = addOpen || viewOptionsOpen || customOpen || requestDelete != null || iconPick != null || bindPick != null || viewPickFor != null || consoleBind != null; + (0, import_react3.useEffect)(() => { + const id = window.setTimeout(() => { + const el = stripRef.current; + if (!el) return; + const r = el.getBoundingClientRect(); + if (r.width > 0 && r.height > 0) return; + let chain = []; + let node = el.parentElement; + while (node && node !== document.body && chain.length < 8) { + const cs = getComputedStyle(node); + chain.push(node.tagName.toLowerCase() + "." + (node.className || "") + ":display=" + cs.display + ",transform=" + cs.transform); + node = node.parentElement; + } + console.warn("[dsh-worktable] \u8FB9\u7F18\u7EC6\u6761\u4E0D\u53EF\u89C1\uFF08\u5BBD\u9AD8\u4E3A 0 \u6216\u88AB\u9690\u85CF\uFF09", { left: el.style.left, rect: { w: r.width, h: r.height }, chain }); + }, 800); + return () => window.clearTimeout(id); + }, []); const edgeVisible = view.edgeAutoHide === false ? !edgeDismissed : edgeOpen || anyPopupOpen; const isFloat = float != null; const floatStyle = isFloat ? { @@ -24303,6 +24346,7 @@ function WorktableSection(props) { /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( "div", { + ref: stripRef, className: "dsh-wt_edgeStrip" + (edgeVisible ? " dsh-wt_edgeStripOn" : ""), style: { left: edgeLeft }, role: "button", diff --git a/01_content/lib/index.js b/01_content/lib/index.js index a846db5..aaf56f6 100644 --- a/01_content/lib/index.js +++ b/01_content/lib/index.js @@ -382,7 +382,7 @@ function resolveDshHomeSafe() { cachedDshHome = baseDshHome(); return cachedDshHome; } -var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.11"; +var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.12"; var name = "dsh-worktable"; var inject = ["webServer", "sessions"]; var HEALTH_PATH = "/api/worktable/health"; diff --git a/01_content/package.json b/01_content/package.json index 24b07d7..be907f9 100644 --- a/01_content/package.json +++ b/01_content/package.json @@ -1,7 +1,7 @@ { "name": "dsh-worktable", "description": "工作台 Worktable:DeepSeek Harness 侧边栏的 agent 级项目容器(应用抽屉)", - "version": "0.5.3-local.11", + "version": "0.5.3-local.12", "repository": { "type": "git", "url": "https://github.com/Aisland-SJL/dsh-worktable.git", diff --git a/01_content/src/client/index.tsx b/01_content/src/client/index.tsx index d674f2b..c044222 100644 --- a/01_content/src/client/index.tsx +++ b/01_content/src/client/index.tsx @@ -1248,6 +1248,7 @@ function WorktableSection(props: any) { // 细条常驻左缘;hover 展开面板,移开延迟 180ms 收回(防抖动); // 任何弹窗打开期间保持展开;「自动隐藏」关掉后常开,可手动点 « 收成细条。 const [edgeLeft, setEdgeLeft] = useState(64) + const stripRef = useRef(null) const [edgeOpen, setEdgeOpen] = useState(false) const [edgeDismissed, setEdgeDismissed] = useState(false) const edgeCloseTimer = useRef(null) @@ -1627,10 +1628,37 @@ function WorktableSection(props: any) { // dockWidth = sidebar 宽 − paddingLeft − paddingRight − 40(每边内缩 20) // left = sidebar 左边缘视口坐标 + paddingLeft + 20 // 降级:找不到 sidebar 或宽度 ≤0 → left 固定 14px,宽度不设内联(交 CSS min/max 处理) + /** + * position:fixed 的包含块原点。 + * 任何祖先带 transform / perspective / filter / contain(paint|layout|strict|content) + * 都会把 fixed 的参照系从视口改成该祖先 —— DS Bot 等全屏页面常带 transform, + * 直接用视口坐标会让细条和面板整体偏移甚至移出可视区。 + * 这里返回该包含块的实际原点(视口坐标),供调用方把期望坐标换算成相对值。 + */ + const fixedOrigin = useCallback((): { left: number; top: number } => { + let el: HTMLElement | null = rootRef.current?.parentElement ?? null + while (el && el !== document.body && el !== document.documentElement) { + const cs = getComputedStyle(el) + const transform = cs.transform && cs.transform !== 'none' + const perspective = cs.perspective && cs.perspective !== 'none' + const filter = cs.filter && cs.filter !== 'none' + const contain = /paint|layout|strict|content/i.test(cs.contain || '') + if (transform || perspective || filter || contain) { + const r = el.getBoundingClientRect() + return { left: r.left + el.scrollLeft, top: r.top + el.scrollTop } + } + el = el.parentElement + } + return { left: 0, top: 0 } + }, []) + const measureFloatGeo = useCallback(() => { + const origin = fixedOrigin() const sidebar = findSidebar(rootRef.current) if (!sidebar) { + // 宿主没有常规侧栏(如 DS Bot 全屏页):细条贴包含块左缘,保证入口可见 setFloatGeo({ left: 14, width: null }) + setEdgeLeft(Math.round(Math.max(0, -origin.left))) return } const rect = sidebar.getBoundingClientRect() @@ -1643,24 +1671,30 @@ function WorktableSection(props: any) { // 细条贴左缘:优先从 footerActions/footArea 容器实测左缘 − 栏内边距 8; // 链断裂时回退实测侧栏左缘(webview 内浅色栏左缘即原生 rail 右缘,xiaoquai 为 0)。 // 旧兜底 64 会在隐藏态留出 64px 残带。 + // 结果再减去 fixed 包含块原点,换算成相对定位祖先的坐标。 setEdgeLeft((() => { let el: HTMLElement | null = rootRef.current + let viewportLeft: number | null = null while (el) { if (typeof el.className === 'string' && /footerActions|footArea/i.test(el.className)) { const r = el.getBoundingClientRect() - if (r.width > 120) return Math.max(0, Math.round(r.left) - 8) + if (r.width > 120) { viewportLeft = Math.round(r.left) - 8; break } break } el = el.parentElement } - return Math.max(0, Math.round(rect.left)) + const base = viewportLeft ?? Math.round(rect.left) + const relative = base - Math.round(origin.left) + // 夹到 [0, 视口宽 - 12]:定位祖先尺寸异常时不至于把细条推出可视区 + const maxLeft = Math.max(0, (typeof window !== 'undefined' ? window.innerWidth : 1280) - 12) + return Math.min(maxLeft, Math.max(0, relative)) })()) if (width > 0) { setFloatGeo({ left: Math.round(rect.left + padLeft + margin), width: Math.round(width) }) } else { setFloatGeo({ left: 14, width: null }) } - }, []) + }, [fixedOrigin]) useLayoutEffect(() => { measureFloatGeo() @@ -2627,6 +2661,26 @@ function buildCustomLayoutPrompt(req: string): string { const anyPopupOpen = addOpen || viewOptionsOpen || customOpen || requestDelete != null || iconPick != null || bindPick != null || viewPickFor != null || consoleBind != null + // 边缘面板可见性自诊断:宿主把 footer 槽位 display:none / 祖先带 transform 时, + // fixed 细条可能整块不渲染。只在不可见时 warn 一次,便于现场定位。 + useEffect(() => { + const id = window.setTimeout(() => { + const el = stripRef.current + if (!el) return + const r = el.getBoundingClientRect() + if (r.width > 0 && r.height > 0) return + let chain: string[] = [] + let node: HTMLElement | null = el.parentElement + while (node && node !== document.body && chain.length < 8) { + const cs = getComputedStyle(node) + chain.push(node.tagName.toLowerCase() + '.' + (node.className || '') + ':display=' + cs.display + ',transform=' + cs.transform) + node = node.parentElement + } + console.warn('[dsh-worktable] 边缘细条不可见(宽高为 0 或被隐藏)', { left: el.style.left, rect: { w: r.width, h: r.height }, chain }) + }, 800) + return () => window.clearTimeout(id) + }, []) + /** 自动隐藏模式看 hover 状态;常开模式看是否被手动收起 */ const edgeVisible = view.edgeAutoHide === false ? !edgeDismissed : (edgeOpen || anyPopupOpen) @@ -3466,6 +3520,7 @@ function buildCustomLayoutPrompt(req: string): string { <>
每条标注日期、动机、落点与验证方式。改动在 `01_content/src/`,经 `npm run build` > 产出 `lib/`;发布物由 `npm run pack`(`01_content/release-prep.mjs`)生成。 -当前版本:**0.5.3-local.11**(2026-12-03) -产物:`01_content/dist/v0.5.3-local.11/dsh-worktable.tgz`,487469 字节, -sha256 `faed38898653babef117897eb0249f655f00aea433a82f5fe4fb2efb036bffe1` +当前版本:**0.5.3-local.12**(2026-12-03) +产物:`01_content/dist/v0.5.3-local.12/dsh-worktable.tgz`,488199 字节, +sha256 `6a18b10171c1ebbbe3bf081ab50f8715c5a4d681286dbc323c1f4158719299bb` --- @@ -64,6 +64,16 @@ sha256 `faed38898653babef117897eb0249f655f00aea433a82f5fe4fb2efb036bffe1` **回归**:`04_test/edge-panel.test.mjs`(已纳入 `npm run pack` 的兼容回归),覆盖 默认自动隐藏、设置开关持久化、固定常开 + « 收起、浮动态不受影响 4 组场景。 +**0.5.3-local.12 修正(2026-12-03):DS Bot 界面看不到入口** + +现象:DS Bot 全屏页里边缘细条不可见,切回经典布局才看得到。 + +两个原因都修了: +1. **层级**:细条 被宿主全屏页的容器盖住 → 提到 (面板 ),并加大细条默认底色/边框对比度。 +2. **fixed 包含块**:祖先带 时, 的参照系会从视口变成该祖先,导致整体偏移甚至移出可视区。新增 测出该祖先原点, 换算成相对坐标,并夹到 ;找不到常规侧栏时细条贴包含块左缘。 + +诊断:挂载 800ms 后若细条宽高为 0, 打印左侧位置与最多 8 层祖先的 ,便于定位「槽位被 display:none」这类宿主侧问题。 + --- ## 三、孤儿路由防护(0.5.3-local.5,2026-12-02) diff --git a/README.md b/README.md index 0810866..e5d2a80 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > ## 📦 本仓库是内部补丁分发仓,不是上游源码仓 > -> 上游: | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.11`)。 +> 上游: | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.12`)。 > 下面从「Screenshots」开始的全部内容是上游 README 原文;本地改动逐条记录见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md)。 ### 要不要装 @@ -16,16 +16,16 @@ ### 安装 -当前版本 **v0.5.3-local.11**: +当前版本 **v0.5.3-local.12**: ```bash -dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.11/dsh-worktable.tgz" +dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.12/dsh-worktable.tgz" ``` - **桌面端:先完全退出 Slark,再执行命令**,装完手动重开;不要在宿主运行时安装。 - `--profile web` 按你自己的 profile 名字改。 -- 资产 `dsh-worktable.tgz`,487469 字节,sha256: - `faed38898653babef117897eb0249f655f00aea433a82f5fe4fb2efb036bffe1` +- 资产 `dsh-worktable.tgz`,488199 字节,sha256: + `6a18b10171c1ebbbe3bf081ab50f8715c5a4d681286dbc323c1f4158719299bb` (下载后可 `Get-FileHash dsh-worktable.tgz -Algorithm SHA256` 核对) - 声明兼容的 DSH 版本:`0.2.0-rc.2` / `0.2.1-rc.3` / `0.2.1-rc.5` / `0.2.2-alpha.2`。 宿主不在这个列表里时,安装会被兼容性检查直接拒绝并回滚。 @@ -50,7 +50,7 @@ dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/r ### 升级与回退 -- 装上 `0.5.3-local.11` 后,插件不会提示升级到 0.5.1。 +- 装上 `0.5.3-local.12` 后,插件不会提示升级到 0.5.1。 - 上游发布 0.5.2 及以上时插件会提示升级;**一旦升级就回到没有补丁的状态**,重启又会丢数据。新版本需要把补丁重新合并(改动清单见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md))。 - 回退官方版: ```bash -- 2.54.0