diff --git a/docs/external-plugin-guide.md b/docs/external-plugin-guide.md index 94523cde..e288628e 100644 --- a/docs/external-plugin-guide.md +++ b/docs/external-plugin-guide.md @@ -1071,9 +1071,9 @@ interface SettingsDescriptor { - **根锚点**:宿主 div 带 `data-dsh-better-sidebar`(append 到 body);其内**面板宿主层** `[data-dsh-panel-host]`(`fixed; inset:0; z-25; pointer-events:none; overflow:hidden+clip`,v0.13.1+),面板/开关簇 absolute 定位,免疫中间层 transform 劫持;页面级 transform 触发 `data-dsh-panel-host-degraded` 降级。`overflow` 级联是**契约**(`hidden` 兜底 + `clip` 收尾,`tests/panel-host-css.spec.ts` 守护):`hidden` 盒子仍是滚动容器,脚本滚动或浏览器 scroll-into-view 修正(焦点移入视口外区域、嵌套 iframe/工作台加载时抢焦点、面板滑出动画中 focus() 落点)会沿最近可滚祖先滚走整层——面板与开关簇集体偏离视口角(computed left/right 仍"正确",偏移藏在盒子自身 scroll offset 里);`clip` 裁剪语义相同但不产生滚动盒,任何路径都滚不动这层。皮肤作用域覆盖限定在 `[data-dsh-better-sidebar]` 内。 - **布局变量**(`` 上,面板打开时有效):`--dsh-sidebar-width` / `--dsh-sidebar-height`。右面板宽度 = AppFrame 的 `padding-right` 预留(新版 `#root [data-dsh-frame]` / rc.8 `#root > [data-slot="root"] > div` 双锚点),AppFrame border box 保持完整桌面视口宽度(Harness 以此判定桌面/窄屏布局,避免插件面板展开误入窄屏);AppFrame 的 details 拖拽手柄按同一变量向左平移贴合列边缘。底部面板仍走 centerCol `margin-bottom`;centerCol 锚点 = **JS 标注**(禁止 `nth-child`):侧栏 shell 的定位器给测得的 centerCol 节点打 `[data-dsh-center-col]` 标签(`Sidebar.tsx` locate,节点更换/HMR 时随 ref 迁移),`layout.css` 用 `#root [data-dsh-center-col]` 选中(`drag-layout.e2e.ts` 断言恰一节点且为对话槽宿主的父级——alpha.2 起 shell 把 `#root [data-slot="main.conversation"]` 解析进列并跳过 `display: contents` 祖先(`center-column.ts` 的 `CENTER_COLUMN_SELECTOR` 同时认 `main.conversation` 与 alpha.1 的 `conversation`),定位器从槽宿主向上取第一个非 `contents` 的祖先;frame 宽度与桌面 Session Log 由 `desktop-layout.e2e.ts` 断言)。 - **桌面信号与标题栏**(v0.14.1+ 四方案模型 `SidebarPrefs.titleBarScheme`,唯一决策点 `src/client/titlebar-strip.ts` 纯函数): - - 壳信号(只读,不自动触发修改):URL `dsh-desktop-mode` / `dsh-desktop-platform` / 可选 `dsh-desktop-titlebar-inset`(0–120 clamp)。 - - **strip 取值链**:⓪ `web` 方案强制 0;① `navigator.windowControlsOverlay` 真实几何(`wco.ts` 订阅 `geometrychange`,**为 0 也权威**,`visible=false` 幽灵 API 视为缺失);② URL inset;③ 壳预设 `stripFor`(仅 `preset`);④ 手动 `titleBarStripPx`(仅 `custom`);⑤ 0。驱动 `body[data-dsh-title-bar-compat]` + `--dsh-title-bar-strip`。 - - **四方案**:`auto`(默认,只信 WCO——"为某壳做的兼容在另一个壳会再坏",核心不做壳专属分支)/ `web`(强制 0)/ `preset`(`src/client/shell-presets.ts`,准入:issue/PR 提及且 GitHub ⭐>100;命中环境显示「已检测」后缀,绝不自动启用)/ `custom`(用户 CSS + 手动 px,齿轮弹窗)。 + - 壳信号(只读,不自动触发修改):URL `dsh-desktop-mode`(`compatibility` / `extended` / `advanced`)/ `dsh-desktop-platform` / 可选 `dsh-desktop-titlebar-inset`(0–120 clamp);官方 Electron 壳还会提供**客户端服务** `ctx.desktopWindow`(`mode` / `platform` / `material` / `safeAreaInsets` / `dragRegion`,见 anywhere-labs/dsh-desktop 的 `plugin-services` 文档)。插件侧以结构化镜像探测它(`src/context-types.ts` 的 `SidebarDesktopWindowService` + `src/client/desktop-env.ts` 的 `probeDesktopWindow`),**绝不写进 `dsh.client.inject`**——普通浏览器没有该服务,注入它会让整个插件 pending。 + - **strip 取值链**:⓪ `web` 方案强制 0;① **壳自带窗口契约**(`ctx.desktopWindow` 存在时以 `safeAreaInsets.top` 为权威:compatibility / extended 报 0——壳已把整个页面放在自己的 36px frame 之下,插件**不得**再让位一次;advanced 报它画进内容里的 caption 行高度,macOS 20 / win32 32);② `navigator.windowControlsOverlay` 真实几何(`wco.ts` 订阅 `geometrychange`,**为 0 也权威**,`visible=false` 幽灵 API 视为缺失);③ URL inset(**只在壳没提供上面的服务时生效**,即旧壳);④ 壳预设 `stripFor`(仅 `preset`);⑤ 手动 `titleBarStripPx`(仅 `custom`);⑥ 0。驱动 `body[data-dsh-title-bar-compat]` + `--dsh-title-bar-strip`。 + - **四方案**:`auto`(默认,保守:壳提供了 `ctx.desktopWindow` 就用壳的真实几何,否则只信 WCO——"为某壳做的兼容在另一个壳会再坏",核心不做壳专属分支)/ `web`(强制 0)/ `preset`(`src/client/shell-presets.ts`,准入:issue/PR 提及且 GitHub ⭐>100;命中环境显示「已检测」后缀,绝不自动启用)/ `custom`(用户 CSS + 手动 px,齿轮弹窗)。 - **迁移**:`titleBarScheme` 无默认值;旧文档已有值(`titleBarCompat === true` 或 `titleBarStripPx` 非 40)→ 迁 `custom`;干净文档 → `auto`。 - **用户空间 CSS**:预设/自定义 css 注入 `