Repository navigation
fix(client): 设置页开关改用宿主 Switch 组件(#108) - #109
Merged
Merged
Conversation
五个布尔设置行原先是 appearance:none 的 checkbox 加 ::after 伪元素画出的开关, 改为宿主 primitives 的 Switch(<button role="switch" aria-checked>),外观随 aria-checked 变化,与宿主其他设置页开关同源。 - 尺寸保持设计画布的 40x24、滑块 20px(原语 36x20,行程同为 16px) - 底色与滑块统一 160ms 强 ease-out 同步过渡;按压缩放 0.95,减少动效下取消 - 原语不收 id:行标题改为纯文本,开关以 aria-label 取名,点标题不再切换 - Switch 签名与样式在 0.2.1-rc.2 / 0.2.1-rc.4 / 0.2.2-alpha.2 逐字一致 - 新增 toggle-field-render 测试,测试替身补 Switch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI 的 build 检查要求 lib/ 与源码构建结果一致。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mars-Sea
added a commit
that referenced
this pull request
Oct 30, 2026
fix(client): 设置页开关尺寸回到宿主原语(#109 收尾)
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.
Closes #108
改了什么
设置页五个布尔开关(按套餐过滤模型、零数据保留、网页搜索、侧边栏额度、缓存图片卸载)原先是
appearance:none的 checkbox 加::after伪元素画出来的,现在改用宿主@deepseek-ai/dsh-client-ui-primitives的Switch:一个<button role="switch" aria-checked>,外观随aria-checked变化,与宿主其他设置页开关同源,画面与读屏读到的状态不会不一致。在原语之上
.cc-switch只做三处调整:Switchease,底色瞬切行为差异
原语不收
id,开关行标题改为纯文本,开关以aria-label取名;点标题文字不再切换开关,需点开关本身。兼容性
Switch的签名与Switch.module.css在0.2.1-rc.2、0.2.1-rc.4、0.2.2-alpha.2三版逐字一致;构建产物经已预置的 primitivesrequire()取到Switch,不新增运行时依赖。lib/client.js已随源码重新构建并提交(CI 要求两者一致)。验证
npm run typecheck、npm test(1141 通过)、npm run build通过tests/toggle-field-render.test.ts:渲染为role="switch"按钮且无 checkbox;勾选态取自暂存值(空串回落默认);点击暂存'true'/'false';只读时禁用Switch.module.css+PAGE_CSS拼独立对照页,在浏览器里核对深浅两色、点击切换、按压缩放与只读半透明🤖 Generated with Claude Code