feat(client): 设置页「手机访问」导航图标换成手机图标 - #127
Open
Fishquito7 wants to merge 2 commits into
Open
Fishquito7 wants to merge 2 commits into
Fishquito7 wants to merge 2 commits into
Conversation
DSH 0.1.x 的设置外壳把导航图标写死在 navIcon(id) 里(只认 models /
agent-presets / plugins),settings.section 的注册项也只投影 id / order /
label,没有 icon 字段可传,所以 dsh-pocket 一直显示外壳兜底的齿轮。
按社区通行做法补上:设置弹层挂载后按「自己那一行的可见文案」认行(文案走
translate('section'),locale 切换后由 MutationObserver 重新认行),给该行打
data 标记,再用一条只认该标记的样式隐藏兜底齿轮、以 CSS mask 画出 16×16
手机图标(background-color: currentColor,随主题与选中态)。标记与样式随
ctx.effect 释放一起回收。
图标按 16px 网格重新落点:设计稿描边只占机身宽 7.8%,等比缩到 16px 是
0.78px,与 DSH 图标族 1.5px 不一致,故描边统一取 1.5px;听筒与 Home 键改为
按留白落点,避免在 16px 下与机身边框糊成一条;Home 键壁厚缩到 0.53px 无法
成环,落成同直径实心点。窄屏跟随 mobile.css.ts 把图标缩到 14px。
认行判定 isOwnNavRow 是不碰 DOM 的纯函数,按仓库现有做法(nav-targets.mjs /
layout-mode.mjs)用字符串桩覆盖:非本行不命中、文案缺失不撒网、切语言后旧行
失效、图标几何留白与设计稿比例、产物是否已重新打包。
上游若给 settings.section 增加 icon 字段,client/pocket-nav-icon.mjs 可整个删掉。
client/client.js 用仓库锁定的 esbuild(npm ci)重新打包,顺带对齐了产物与依赖
锁之间的 3 处 esbuild 版本格式差异(2 行非 ASCII 转义 + 1 处箭头函数体)。
Fishquito7
marked this pull request as ready for review
September 18, 2026 11:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
设置页左侧「手机访问」的图标,从外壳兜底的齿轮换成手机图标(设计稿:圆角机身 + 顶部听筒 + 底部 Home 键)。
现在「通用设置」和「手机访问」共用同一个兜底齿轮,扫一眼分不出来。
背景:为什么不能直接给 settings.section 传个 icon
DSH 0.1.x 的设置外壳(
@deepseek-ai/dsh-client-ui-settings-general)把导航图标写死在内部的navIcon(id)里——只认models/agent-presets/plugins三个内置 id,其余一律兜底齿轮;而settings.section的注册项由外壳只投影id/order/label(见@deepseek-ai/dsh-client-ui-settings的 slots 契约与运行时 slot 清单),没有 icon 字段可传。所以插件侧目前拿不到扩展点,只能在外壳渲染出来之后自己认领那一行。做法
按社区通行做法补上(
dsh-better-sidebar、dsh-skill-mcp-panel是同样路子):[role="dialog"] nav button里按「自己那一行的可见文案」认行(文案走translate('section'),即词典里的手机访问/Phone access);data-dsh-pocket-nav-icon标记;svg,用 CSSmask画出 16×16 手机图标。颜色用background-color: currentColor,跟随主题与选中态;窄屏跟随mobile.css.ts缩到 14px。只认自己那一行,不碰外壳结构;标记与样式随
ctx.effect释放一起回收;locale 切换后由MutationObserver重新认行。样式标签按生态惯例标注data-plugin="dsh-pocket"/data-plugin-css="dsh-pocket/nav-icon",会被dsh-client-modules认作本插件的样式,参与 HMR 清理。上游若给
settings.section增加 icon 字段,client/pocket-nav-icon.mjs可整个删掉。图标为什么不能直接等比缩放
设计稿(1254px)等比缩到 16px 会丢细节,因此按 16px 网格重新落点:
机身宽高比仍按设计稿的 0.645 保留。
改动清单
client/pocket-nav-icon.mjsclient/index.jsxtest/pocket-nav-icon.test.jsclient/client.js验证
node --test test/pocket-nav-icon.test.js→ 11/11 通过npm test:合并最新main后 189 个用例,本分支失败集合与main完全一致——都是 Windows 环境下的 cloudflared/隧道相关用例(假 cloudflared 无法 spawn、一个 Linux 专用缓存用例超时),与本次改动无关;CI 的 ubuntu-latest 不受影响。__ModuleLoader__)21/21:只标记自己一行、兜底齿轮被隐藏、mask 生效且颜色跟随currentColor、切英文后旧的中文行不再命中、弹层重开重新认行、卸载后标记与样式一起回收。nav-targets.mjs/layout-mode.mjs)用字符串桩覆盖;另含图标几何(机身比例、与边框留白)、样式(断点与 14px 与mobile.css.ts对齐的防漂移断言)、以及「产物是否已重新打包」的断言。风险与说明
dsh-skill-mcp-panel、dsh-better-sidebar现状一致。文案本身改动不影响(代码跟着词典走),但若外壳将来不再按文案渲染导航,需要同步调整认行方式。client/client.js按仓库流程(node client/build.mjs)从client/源码重新打包。这个 PR 相对main是纯新增(+382 / −0),没有改动既有代码路径。