refactor(ui): unify styles, animations and shared components across Desktop, Gateway and agent-ui - #781
Closed
Loosand wants to merge 63 commits into
Closed
refactor(ui): unify styles, animations and shared components across Desktop, Gateway and agent-ui#781Loosand wants to merge 63 commits into
Loosand wants to merge 63 commits into
Conversation
- Introduced macOS DMG settings in tauri.conf.json, including custom background image and window/app positioning. - Added a new background image for the DMG installer.
…tion scripts - Added macOS DMG settings to the Makefile, including background image and volume icon configurations. - Introduced a new Python script for deterministic DMG layout, ensuring stable Finder metadata. - Created a verification script to check the integrity of the generated DMG, ensuring required files and symlinks are present. - Updated GitHub Actions workflow to install the necessary dmgbuild tool for building DMGs.
StackCairn
marked this pull request as draft
September 10, 2026 08:52
Contributor
|
PR governance checks failed — this PR has been converted to draft.
Fix the items above, then click Ready for review to re-run the checks. |
2. 减少滚动时的同步渲染 3. 减少右侧栏开关造成的重复布局 4. 合并消息高度变化通知 5. 补充测试和原版库评估记录
…idBlock and improve Markdown rendering
…abelTooltip styling
…ents with improved sorting and layout
… SkillsImportView layout for improved usability
…eadability and consistency
…and update translations for improved consistency
…improved accessibility and consistency in GlobalShortcutsSection
…izations and layout adjustments
…nsistency and usability across various UI elements
yyg-max
marked this pull request as ready for review
September 18, 2026 01:57
Loosand
marked this pull request as draft
September 18, 2026 03:22
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.
UI 重构 PR 描述草案
Summary
这次重构统一 Desktop GUI、Gateway WebUI 与共享
agent-ui的样式、动效和交互基础设施。主要目标是把可由 Tailwind 表达的业务样式放回组件,把颜色、动画和特殊视觉值集中管理,
并用共享组件或成熟库替换重复的 Switch、Tabs、复制反馈、拖拽排序和命令式 DOM 实现。
重构保留现有 MentionComposer 编辑器内核。Lexical 换核实验不在本 PR 中,避免把 IME、
Selection、历史记录、剪贴板和 mention 协议的高风险迁移混入样式与基础组件治理。
量化规模
统计基线为
main的147ad855,重构结果为refactor/ui的992db34a。源码扫描范围为
crates/agent-ui/src、crates/agent-gui/src和crates/agent-gateway/web/src。重构分支原始差异(不含本草案)为 431 个文件、19,287 行新增、17,588 行删除;
其中 10 个临时审计文档占 2,633 行,提交 PR 前会按目录约定移除。
components/ui变更 33 个文件size-*cn(...)分组icon-xs,24 处使用icon-sm,5 处删除与默认 icon 相同的覆盖motion接入 8 个生产源码文件useFlipGrid、entranceOnce、menuMotion共 354 行useVerticalListReorder替换为 207 行VerticalReorderListnavigator.clipboard.writeText+ 13 处execCommand("copy")收敛为共享边界中的各 1 处;七份 fallback 副本被合并document.createElement从 36 处降至 22 处,直接 style 写入从 105 处降至 26 处ui-color和 57 个黑白透明原语;仪表盘原始文字颜色引用从 44 处降至 1 处StatusPanel与 3 个StatusTypography展示组件,保留原生 section/p/h3/divGHK_STYLE注入及颜色双写;61/87/104 键盘布局继续共用原几何WorkspaceSftpPanel从 1,990 行降至 1,536 行最终源码不存在
rounded-999px、rounded-9999px或对应 token。固定胶囊统一使用rounded-full;8 处剩余rounded-[...]是经扫描保留的精确表达,不属于 999px 哨兵写法。标准组件与共享能力
磨砂、投影、高亮和动画覆盖,统一使用共享菜单默认值。多行布局和业务尺寸继续由调用方控制。
Switch/SwitchRoot/SwitchThumb,覆盖两个分享弹窗、Skills 设置、5 个 Provider Dialog 开关位置和 3 个资源开关消费者。两个特殊控件因语义不等价保留。
受控状态和“方向键只移动焦点,Enter/Space 激活”行为。
cmdkCommand,并保留原搜索排序、IME、Home/End、重试和打开会话逻辑。
14 个 SettingsNotice 调用、5 个 SettingsPanel/Hint 调用、2 个 SettingsSurface 和 2 个紧凑空状态。
统一生命周期、位置、更新、dismiss 与定时器清理。
lib/shared/clipboard.ts;设置页复制按钮统一反馈 hook,保留 1,200/1,500/1,600/2,000ms 四档既有反馈时间。
document.body手工创建 scrollbar 的实现,使用项目已有 6px 原生scrollbar;七个 drag/resize 入口统一 cursor、user-select、blur 和卸载恢复规则。
完整变更地图
共享基础组件
Command、RadioGroup、EmptyState、Skeleton、VerticalReorderList、Toast 系列和text-field-styles;扩展 Button、Badge、Dialog、DropdownMenu、Popover、Select、Sheet、Switch、Tabs、Tooltip、ScrollArea、NumberInput、Checkbox 等既有原语。
FormField、ChoiceCard、SettingsNotice、SettingsPanel、SettingsSurface、SettingsCopyButton和StepMarker七个设置展示组件。组件只接管重复的结构与样式,请求、校验、保存、显示条件和状态仍由页面负责。
Cron/SSH 的两个紧凑空状态以及 Cron/Agents 的两个紧凑 Badge 后续继续复用已有入口。
Skills 与 MCP 原先相同的旋转指示器不再分别维护。
Chat、会话与弹层
上下文使用量、任务进度、会话搜索、分享、mention 弹层、工作区克隆与错误/确认弹层均完成样式迁移。
LazyCollapse、MotionPopover和MotionDirectionalPanel统一折叠与瞬态弹层生命周期,删除虚拟转录行的一次性进入注册表和桌面菜单的独立动画常量。
换用共享 Tabs。分享流程的开关与脱敏单选分别换用 Switch 和 RadioGroup。
改由统一 data 状态、Tailwind 或 Motion 表达;修复模型 Popover 与分支菜单退出时 scale/translate
不在 transition-property 中导致的跳变。
设置与配置
CUA 和 Backup Sync 的字段、标签、说明、提示、选择卡片、状态 Badge 与开关逐批收口。
高级设置模型选择器保留细边框并明确去除阴影。
立体主题分开维护,保留快捷键录制、系统注册和状态优先级。
避免先提交旧分区再通过 effect 跳转。
资源卡片、批量选择和禁用态的事件隔离继续保留。
Skills、MCP 与资源管理
安装、卸载、启停、筛选、排序和批量恢复统一走同一布局动画通道。
安装/删除继续使缓存失效。移除
useDeferredValue的人为初始空列表,减少切回页面时的加载跳动。保留 6,500ms 扫描提示、常驻导入结果和 6,000ms 撤销时长。
focus:ring改为focus-visible,避免鼠标点击或预览关闭回焦时叠出第二层边框;STT 供应商选中态也移除了重复 ring。
Workbench、终端、Git 与 SFTP
document.querySelector猜测 Workbench Canvas;控制器显式暴露
canvasRef,文件拖入命中测试与 React 节点所有权一致。globalPointerStyle协调 cursor 和 user-select。每个 owner 独立释放,blur、visibilitychange 和卸载时兜底清理,避免重叠交互恢复过期样式。
ShortcutKeyboard 的低频 ResizeObserver 结果改由 React state/JSX style 输出。
useAutosizeTextarea;Web composer由宿主显式传入高度 owner ref,不再用
closest(...)查找祖先。Diff 统一使用全局 6px scrollbar。终端颜色与尺寸由
lib/terminal/theme.ts提供给 xterm API。的选择上下文保持在主面板中。
Gateway WebUI
设置同步和状态仪表盘。
base-chat.css、login.css、responsive.css、status-board.css和旧样式聚合入口;断点、高度媒体条件、触屏、安全区、伪元素和 reduced-motion 迁到实际消费者。
登录和共享历史的加载/错误/空态复用局部展示结构。
的宿主契约同步更新测试。
Desktop 宿主
原生输入右键菜单、聊天 Transcript、通知适配、图片预览和全局快捷键设置。
WebView 输入选择、粘贴权限和焦点恢复边界。
Tauri 调用、会话请求和后端协议没有改动。
工程配置与防回退
biome.json,根脚本统一格式化和 lint 三个 UI 源码目录;CI 新增shared UI typecheck/lint,并拒绝改动范围内新增 Biome warning。
tsconfig.base.json和tsconfig.node.base.json,GUI、Gateway、agent-ui 与 virtual-core继承同一严格选项;Docker WebUI 构建同步复制这两个配置,隔离 CI 安装根工作区依赖。
均已删除,没有留下额外迁移脚本。
scripts/dev-stack.mjs不再通过mise exec启动 Go、Vite 和 Tauri,改为直接调用go、当前 Node与
pnpm。这会改变开发机工具解析路径,属于需要 reviewer 明确认可的非视觉行为变化。样式架构
tokens.css、semantic-colors.css和animations.css读取主题、特殊 token 与基础关键帧;旧的两份tailwind.config.js被删除。base-chat.css、login.css、responsive.css、status-board.css,以及共享 UI的
common-*.css、transcript.css等业务样式表已删除。伪类、伪元素、data 状态、移动端断点、安全区、触屏和 reduced-motion 能由 Tailwind 表达的部分都迁到消费组件。
Streamdown portal,以及快捷键立体键盘这类无法合理挂到 React 消费节点的规则。
destructive,成功状态使用成对的success语义色。状态仪表盘、Cron、Hooks、Badge 和危险操作已接入;终端、品牌、代码高亮、分类图表仍保留专用颜色契约。
xterm 的 13px API 字号和特殊精确排版保留。
行为变化与风险
这不是纯机械重排,以下内容需要作为 PR 的重点复测项:
动画节奏会变化,筛选、排序、安装、卸载和批量操作需要肉眼判断是否自然。
明确的视觉调整。
Tauri WebView 中确认焦点、输入法和屏幕阅读器体验。
页面卸载后的定时器行为。
都应做真实页面检查。
安装删除后的失效、手动强制扫描和错误重试不会显示过期列表。
这些并非单纯换写法,应该按对应复测路径确认修复没有影响相邻交互。
dev-stack直接调用系统工具,需要在没有
mise包装的开发环境确认 Go、Node、pnpm 版本及 PATH 解析符合项目预期。新增运行时依赖为
motion@13.2.0和cmdk@1.1.1。Motion 负责折叠、弹层、布局与排序动画;cmdk 只用于会话搜索。它们会增加前端依赖和 bundle 内容,也是本 PR 最明确的库级行为变化。
自动验证
最终源码版本已完成以下检查:
pnpm lint:1,003 个源码文件通过。pnpm typecheck:ui、pnpm typecheck:gui、pnpm typecheck:webui:通过。pnpm test:gui:3,138 项通过。pnpm test:webui:718 项通过。pnpm check:ui-boundaries、样式约束与脚本测试:通过。pnpm build:gui、pnpm build:webui:通过;GUI 仍有既有的大 chunk 提示。git diff --check:通过。阶段验证还覆盖了亮暗主题、16/20px 根字号、桌面/移动端断点、普通/禁用/焦点状态、
reduced-motion,以及迁移前后的局部计算样式和 DOM 契约。夹具已在使用后删除,不属于产品代码。
人工复测路径
Desktop GUI
mention 搜索、键盘选择、IME 输入、粘贴、撤销和草稿恢复。
分享弹窗的 Switch、RadioGroup、复制链接和禁用分享。
打开/关闭/切换多个 Pane 后确认 cursor 与 user-select 恢复。
并确认系统 scrollbar 在当前平台可辨识。
过期请求切换;真实服务器路径与错误状态。
快捷键录制;逐项检查标签、说明、错误提示、开关锁定、Dropdown 和保存后的状态。
Toast 的右上、右下、底部居中位置。
Gateway WebUI
同时覆盖亮暗宿主与移动端安全区。
高度媒体条件和动画。
动效、键盘和可访问性
不应出现位移动画或长时间退出等待。
Escape、Tab 离组、Enter/Space 单次触发及禁用态。
菜单行高和状态徽标。
Screenshots / preview
该 PR 包含有意的字号、状态色、投影、动画和 scrollbar 变化,需要在提交 PR 时附上: