diff --git a/docs/ui-redesign-audit-2026-07-21.md b/docs/ui-redesign-audit-2026-07-21.md new file mode 100644 index 0000000..55d64ee --- /dev/null +++ b/docs/ui-redesign-audit-2026-07-21.md @@ -0,0 +1,83 @@ +# ImageStudio 前端 UI 审计 + +日期:2026-07-21 +范围:`frontend/standalone-web` 工作台、共享 API 类型、导航与 Gallery 页面 +方法:Impeccable `audit` 技术检查、源码静态审计、基线 typecheck/build/contract tests + +## 项目盘点 + +### 技术栈与入口 + +- Vue 3 Composition API + TypeScript + Vite 6。 +- 独立 Web 入口:`frontend/standalone-web/src/main.ts` → `App.vue`。 +- AstrBot 插件页入口:`frontend/plugin-page/src/main.ts`,通过 `astrbot-page-bridge` 注入后复用 `standalone-web/src/App.vue`。 +- API 统一入口:`frontend/shared/api/client.ts`;路径常量集中在 `frontend/shared/api/endpoints.ts`,基础路径为 `/api/v1/plugins/extensions/astrbot_plugin_imagestudio`。 +- 当前无 Vue Router;页面切换由 `activeNav` + URL 查询参数 `view` / `module` / `materialView` / `profile` 维护,并使用 `history.replaceState`。 + +### 页面与主要组件 + +- 工作台页面:overview、generate、queue、performance、gallery、profiles、materials、settings、logs。 +- 主要页面组件:`GalleryPage.vue`、`ProfilesPage.vue`、`AdvancedMaterialImportPage.vue`、`SettingsPage.vue`、`BackupPage.vue`、`LogsPage.vue`。 +- 主要复用组件:`AppNavigationRail.vue`、`StateCard.vue`、`EmptyState.vue`、`MetricCardGrid.vue`、多个 Dialog/Drawer 组件。 +- 复杂业务子域:workflow、profiles、materials;多数页面仍由 `App.vue` 组合和持有状态。 + +### 不能改变的契约 + +- 不改变导航 key、module 映射、URL 查询参数语义及插件页/独立 Web 双入口。 +- 不改变 `frontend/shared/api/endpoints.ts` 中的 endpoint 名称、HTTP 方法、请求体字段和响应类型。 +- 不改变 `frontend/shared/types/**` 的数据结构,尤其是 image、job、workflow、profile、material、settings、storage 相关类型。 +- 不改变生成、队列、图库批量操作、工作流轮次/分支、角色卡、素材识别、设置备份与日志的现有交互语义。 +- 不删除 AstrBot plugin page bridge、媒体签名/载荷流程、后端连接状态与错误恢复路径。 + +## Audit Health Score + +| 维度 | 分数 | 关键发现 | +|---|---:|---| +| Accessibility | 2/4 | 已有语义按钮、`aria-current`、`aria-pressed`、状态 live region;但部分表单控件缺少显式 label,图片预览/弹层焦点管理与键盘闭环需要统一验证。 | +| Performance | 2/4 | 生产构建可用;`App.vue` 单文件约 22k 行、Web JS gzip 约 211.5 kB,且存在 `transition: width`、`transition: max-height` 等布局属性动画。 | +| Theming | 2/4 | 有 dark/light 变量和主色持久化;但 tokens 集中在 `App.vue`,大量页面级颜色/阴影/渐变仍混杂,主题边界难以复用。 | +| Responsive Design | 2/4 | Gallery 等页面有 1180/900/560 断点;工作台整体仍依赖 244px rail、宽 topbar 与多列面板,窄桌面窗口存在拥挤/溢出风险。 | +| Anti-Patterns | 2/4 | 本地 detector 命中布局属性动画、圆角元素厚边、侧边/顶部强调条、占位图片检测;背景网格、玻璃模糊和多层渐变也提高了视觉噪声。 | +| **Total** | **10/20** | **Acceptable:功能基础稳定,但需要有边界的结构化 UI 重构。** | + +## Anti-Patterns Verdict + +**部分通过,仍有明显 AI/模板化痕迹。** 具体包括:工作台背景的装饰性网格、多个 surface 的渐变与 blur、状态卡片的顶部强调条、导航 active 状态的侧边强调、圆角 + 宽阴影组合,以及大单体 App 文件导致的重复视觉词汇难以治理。它们不是功能阻塞,但会让工具界面显得“装饰先于任务”。 + +## 问题清单与优先级 + +### P0 Blocking + +- 当前没有确认到会阻塞主要任务完成的 P0 UI 问题。基线功能检查全部通过。 + +### P1 Major + +- **P1-01:工作台壳层与业务页面耦合过重**:`frontend/standalone-web/src/App.vue` 约 22k 行,同时承载导航、数据加载、弹层、生成器、队列、图库、素材与设置。影响:任何视觉调整都容易触碰业务状态,回归面大。 +- **P1-02:桌面窄窗口的结构风险**:导航 rail、sticky topbar、双栏工作区和多个固定最小宽度并存,约 1024–1280px 宽度下容易造成操作区压缩、横向滚动或首屏信息层级失衡。 +- **P1-03:主题 token 没有形成可复用层**:核心变量主要位于 `App.vue` 的全局 style,页面组件继续直接组合 `var(--panel)`、`var(--border)`、颜色混合和阴影。影响:dark/light 与未来页面统一成本高。 +- **P1-04:交互状态覆盖不均**:部分按钮有 disabled/hover/focus,弹层、批量操作、加载、空态、错误态的状态表达不完全统一;需要以组件级状态矩阵补齐。 +- **P1-05:可访问性需专项修复**:`GalleryPage.vue` 搜索框和批量 checkbox 等控件依赖邻近文本,部分复杂弹层/预览需要确认 focus return、Escape、焦点陷阱与可读名称;不能只依赖视觉状态。 +- **P1-06:性能边界**:`App.vue` 产生单一大 JS/CSS 包,构建已给出超过 500 kB 的 chunk 警告;本轮不改业务加载策略,但应避免新增全局样式和重型运行时依赖。 + +### P2 Minor + +- **P2-01:视觉节奏不一致**:8/10/12/14/16/18/22/24 等间距和 7/8/10/12 等圆角并存,需抽取有限的 spacing/radius scale。 +- **P2-02:装饰噪声偏高**:背景网格、渐变、backdrop-filter 在多个层级重复,降低任务区域的对比度和层级清晰度。 +- **P2-03:状态色与表面色混用**:good/warn/bad/idle 的 border、背景、顶部条规则分散在多个选择器,需集中到语义状态 tokens。 +- **P2-04:图库卡片信息密度不稳定**:grid/list/inspector 三种模式的操作按钮、选中态和媒体占比不完全一致,批量操作区在窄桌面易成为第二工具栏。 +- **P2-05:部分过渡动画直接改变布局属性**:检测命中 `transition: width` 与 `transition: max-height`;应优先改为 transform/opacity 或 grid 行过渡。 +- **P2-06:图片替代文本规则不统一**:多数业务图片有 alt,但预览/通知缩略图存在空 alt 或依赖上下文的情况,需要区分装饰图与内容图。 + +## 正向发现 + +- 业务 API 与类型文件集中,页面重构可以保持数据契约不变。 +- 导航、状态卡、空态、预览对话框已有复用组件,不需要推倒重来。 +- Gallery 已具备搜索、筛选、grid/list、批量操作、预览、错误和 loading 路径,适合作为第一批页面。 +- 基线 `npm.cmd run typecheck`、`npm.cmd run build:web`、`npm.cmd run test:contracts` 均通过。 + +## 来源与边界 + +- 本地源码:`frontend/standalone-web/src/App.vue`、`frontend/standalone-web/src/features/gallery/GalleryPage.vue`、`frontend/standalone-web/src/components/AppNavigationRail.vue`、`frontend/shared/api/client.ts`、`frontend/shared/api/endpoints.ts`、`frontend/shared/types/**`。 +- 本地配置:`frontend/package.json`、`frontend/standalone-web/vite.config.ts`、`frontend/plugin-page/vite.config.ts`。 +- Impeccable 本地 detector:命中 5 项静态提示,未替代人工审计。 +- 未使用外部网络资料;本次目标是对现有仓库实现做代码级审计。 diff --git a/docs/ui-redesign-development-queue-2026-07-21.md b/docs/ui-redesign-development-queue-2026-07-21.md new file mode 100644 index 0000000..b96704b --- /dev/null +++ b/docs/ui-redesign-development-queue-2026-07-21.md @@ -0,0 +1,164 @@ +# ImageStudio UI 重构后续开发队列 + +日期:2026-07-21 +基线分支:`codex/ui-redesign-gallery` +范围:仅覆盖本轮 UI 重构尚未完成的事项;不包含后端功能新增。 + +## 当前结论 + +- 已完成:共享视觉 token、工作台壳层、主要页面统一 surface/间距/圆角/状态/focus、Gallery 首批重构、桌面横向溢出修复、静态 detector 检查。 +- 尚未完成:真实 AstrBot 后端数据验收、逐页深度视觉精修、完整键盘/焦点审计、多个桌面尺寸验证、性能拆包、提交与发布收口。 +- 当前分支仍有未提交源码和文档改动;主支未修改。 + +## P0:交付阻断项 + +### Q0-01 真实 AstrBot 后端联调 + +**目标**:在真实 plugin-page bridge 和后端 API 下验证 UI,不再只依赖 preview mode。 +**涉及**:`frontend/plugin-page/src/main.ts`、`frontend/shared/api/client.ts`、所有主要页面。 +**验收**: + +- plugin-page 能加载真实 bootstrap、dashboard、profiles、images、jobs、settings、logs。 +- 后端未连接、401、超时、空数据、部分数据错误状态均有可读反馈。 +- 真实媒体签名、预览、刷新和批量操作不出现空白或死状态。 + +### Q0-02 保护当前未提交改动并完成分支交付 + +**目标**:确认 `GalleryPage.vue` 原有改动与本轮改动的归属,完成 diff review、提交和 PR。 +**验收**: + +- `git diff --check` 通过。 +- 无构建产物污染 `web/` 或 `pages/imagestudio/`。 +- 用户确认后创建 commit/PR;未确认前不合并主支。 + +## P1:发布前必须完成 + +### Q1-01 逐页深度视觉精修 + +当前统一主要通过共享 CSS 层完成,以下页面还需要逐页检查内容层级、密度和操作优先级: + +- Overview:指标条、监控摘要、队列摘要、最近图片之间的层级和密度。 +- Generate:预览区、提示词输入、模型选择、生成操作和结果信息的空间分配。 +- Queue:过滤、任务状态、进度、详情和批量操作的优先级。 +- Performance:指标、趋势/明细、空态和失败态。 +- Profiles:master/detail/wardrobe 三栏在有数据、无数据和 sealed 状态下的层级。 +- Materials:导入、识别、确认、筛选、详情和空态。 +- Settings:section 导航、配置编辑、保存/校验/回滚状态。 +- Logs:筛选、日志列表、错误状态和长文本换行。 +- Workflow:节点流、轮次、分支、候选图、审查 dialog、素材 drawer。 + +**验收**:每页保留现有功能,并有明确的主操作、次操作、危险操作和恢复路径。 + +### Q1-02 完整可访问性审计 + +**涉及**:所有 `*.vue` 页面和 Dialog/Drawer 组件。 +**任务**: + +- 为搜索、筛选、checkbox、select、textarea、icon-only button 补齐稳定 label。 +- 验证 Tab 顺序、Enter/Space、Escape、焦点回收和 dialog focus trap。 +- 检查 heading 层级、landmark、`aria-current`、`aria-expanded`、`aria-selected`、`aria-live`。 +- 检查真实图片 alt、装饰图空 alt、加载/失败图片的替代内容。 +- 使用键盘完成 Gallery 批量操作、Profiles 选择、Workflow 节点操作和 Settings 保存。 + +**验收**:关键路径不依赖鼠标;焦点在 dark/light 两主题下可见。 + +### Q1-03 多尺寸响应式验收 + +**必须验证尺寸**: + +- 1024×768:窄桌面,检查 rail、topbar、双栏/三栏区域。 +- 1280×800:常见桌面工作区。 +- 1440×900:宽桌面,检查内容是否过度拉伸。 +- 1600×900:超宽窗口,检查 max-width 和阅读线长。 + +**验收**:无横向溢出;sticky topbar/rail 不遮挡内容;批量工具栏和 dialog 不被裁切。 + +### Q1-04 状态矩阵补齐 + +为每个主要页面记录并验证:default、hover、focus、active/selected、disabled、loading、empty、error、success、backend disconnected。 +重点组件:按钮、tabs、filters、cards、dialogs、drawers、图片预览、表单保存栏。 + +## P2:质量和维护性 + +### Q2-01 视觉回归测试 + +- 为 9 个主要 view 建立最小 Playwright/浏览器 smoke test。 +- 固定至少一组 dark/light 截图或 DOM 断言。 +- 断言 `scrollWidth === clientWidth`、页面标题、主要 landmark 和关键操作存在。 +- 将真实 backend 不可用场景纳入 preview-mode regression。 + +### Q2-02 前端拆包与性能优化 + +**现状**:Web JS gzip 约 211.6 kB,Vite 报告单 chunk 超过 500 kB。 +**任务**: + +- 评估按页面动态导入 Generate、Profiles、Materials、Settings、Workflow。 +- 保证 plugin-page bridge 首屏和 `App.vue` 的 URL 参数恢复不受影响。 +- 避免新增 UI 运行时依赖;对大图片列表保持懒加载和稳定的媒体 URL。 +- 对生成预览、Workflow 候选图和 Materials grid 做渲染数量边界检查。 + +**验收**:构建 chunk 警告下降或有明确的保留理由;交互没有新增延迟。 + +### Q2-03 样式边界整理 + +- 将 `App.vue` 中新增的全局 override 按壳层、页面、组件拆到可定位样式文件。 +- 避免继续增长 22k 行级别的单体 `App.vue`。 +- 保留 `tokens.css` 作为唯一视觉 token 来源,减少页面内直接写颜色/圆角/阴影。 +- 清理重复的局部样式和已被全局层覆盖的旧规则。 + +### Q2-04 主题和对比度验证 + +- 验证 dark/light 下正文、placeholder、disabled、warning、danger、success 的对比度。 +- 复核用户自定义 primary/accent 颜色的极端值,避免 focus 和文字失去对比度。 +- 记录至少一组自动化 contrast 检查结果。 + +## P3:可选增强 + +### Q3-01 设计文档和组件清单 + +- 为 token、button、input、surface、status、dialog、empty state 建立简短使用约定。 +- 在 `docs/` 维护页面状态矩阵和可复用组件清单。 + +### Q3-02 真实数据密度优化 + +- 用真实 profiles、materials、images、jobs、logs 数据压测长标题、长 prompt、长错误消息。 +- 检查分页/滚动/虚拟化需求,避免只在空数据预览态下看起来稳定。 + +### Q3-03 发布前人工验收 + +- 在 AstrBot plugin page 中完成一次完整生成、图库复用、角色选择、素材导入、设置保存、日志查看流程。 +- 记录阻塞项、截图和最终版本信息。 + +## 推荐执行顺序 + +1. `Q0-01` 真实后端联调。 +2. `Q1-01` 逐页深度视觉精修。 +3. `Q1-02` 可访问性审计与修复。 +4. `Q1-03` 四种桌面尺寸验收。 +5. `Q1-04` 状态矩阵补齐。 +6. `Q2-01` 回归测试。 +7. `Q2-02` 拆包优化。 +8. `Q2-03` 样式边界整理。 +9. `Q2-04` 主题对比度验证。 +10. `Q0-02` 最终 diff review、commit 和 PR。 +11. `Q3-03` 真实插件页发布前验收。 + +## 暂不列入本队列 + +- 后端 API 新功能。 +- 多租户权限链、持久 Worker、数据库迁移等后端架构事项。 +- 更换 Vue/Vite/TypeScript 或引入新的 UI 框架。 + + +## Execution update (2026-07-21) + +- Q0-01: source-level bridge/error/preview paths validated; live AstrBot host acceptance remains pending. +- Q1-01: shared visual layer, page-level surface hierarchy, action states, and overview narrow-desktop override completed; all nine views smoke-tested. +- Q1-02: stable search/workbench/status labels added; image preview dialog now traps focus and restores focus; existing confirmation dialog trap retained. +- Q1-03: 1024x768, 1280x800, 1440x900, and 1600x900 passed across all nine views with no horizontal overflow. +- Q1-04: state matrix recorded in docs/ui-redesign-state-matrix-2026-07-21.md. +- Q2-01: added frontend/tests/ui-redesign-smoke.test.mjs and frontend/tests/ui-theme-contract.test.mjs; 7 UI contract tests pass. +- Q2-02: page and workflow components use defineAsyncComponent; production chunks are split and the largest JS chunk is below the prior warning threshold. +- Q2-03: new workbench overrides moved from App.vue into frontend/standalone-web/src/styles/workbench.css. +- Q2-04: dark/light token contrast checks added; measured text pair ratios are 16.40, 7.52, 15.14, and 4.59. +- Q0-02: diff review, build-artifact cleanup, full validation, commit, and PR are the remaining delivery actions. diff --git a/docs/ui-redesign-final-check-2026-07-21.md b/docs/ui-redesign-final-check-2026-07-21.md new file mode 100644 index 0000000..c43e0e7 --- /dev/null +++ b/docs/ui-redesign-final-check-2026-07-21.md @@ -0,0 +1,54 @@ +# ImageStudio 全页面 UI 统一性检查 + +日期:2026-07-21 +分支:`codex/ui-redesign-gallery` + +## 覆盖范围 + +- 工作台壳层、导航 rail、topbar、主题和全局状态。 +- Overview、Generate、Queue、Performance、Gallery、Profiles、Materials、Settings、Logs。 +- Workflow 子组件、Profiles 子面板、Settings 子面板、Dialogs/Drawers。 +- 独立 Web 与 AstrBot plugin-page 两个 Vite 入口。 + +## 统一规则 + +- 视觉 token:`frontend/standalone-web/src/styles/tokens.css`。 +- 统一 surface:`var(--panel)` / `var(--panel-muted)`,默认取消装饰性宽阴影。 +- 统一形状:小控件 6–8px,页面 surface 10px,状态 pill 使用 999px。 +- 统一间距:4/8/12/16/20/24px。 +- 统一 focus:主色 3px focus ring,表单和按钮保留键盘可见焦点。 +- 统一状态:good/warn/bad/idle 使用语义边框和背景,不再依赖顶部/侧边粗色条。 +- 统一动效:保留必要状态反馈;移除布局属性过渡,支持 `prefers-reduced-motion`。 +- 统一响应式:修复 1265px 桌面窗口下 Overview/Gallery 横向溢出,9 个主要 view 均通过 smoke test。 + +## 结果 + +- Impeccable detector:0 条命中。 +- 浏览器 smoke test:`overview`、`generate`、`queue`、`performance`、`images`、`profiles`、`materials`、`settings`、`logs` 均成功加载。 +- 桌面窗口检查:`scrollWidth === clientWidth`,未发现横向溢出。 +- plugin-page bridge 入口与独立 Web 入口均可构建。 + +## 验证命令 + +- `npm.cmd run typecheck` +- `npm.cmd run test:contracts`:19/19 通过 +- `npm.cmd run build:web` +- `npm.cmd run build:plugin` +- `node C:\Users\Administrator\.agents\skills\impeccable\scripts\detect.mjs --json frontend/standalone-web/src/App.vue frontend/standalone-web/src/components frontend/standalone-web/src/features` + +## 已知遗留 + +- Web JS gzip 仍约 211.6 kB,构建保留 Vite 的大 chunk 警告;这是后续代码拆分/动态导入工作,不在本轮视觉重构中处理。 +- 未连接真实 AstrBot 后端,因此 smoke test 验证的是前端预览态、路由切换和布局,不替代真实 API/插件页数据联调。 + + +## Final execution evidence + +- Browser smoke: 36 checks across 9 views and 4 desktop sizes; all passed with scrollWidth equal to clientWidth. +- Frontend UI tests: 7/7 passed. +- Contract tests: 25/25 passed. +- Typecheck: passed. +- Plugin build: passed. +- Standalone build: passed. +- Generated web/pages artifacts were removed from the working tree after validation. +- Live AstrBot plugin-page acceptance is explicitly pending and documented in docs/ui-redesign-integration-validation-2026-07-21.md. diff --git a/docs/ui-redesign-integration-validation-2026-07-21.md b/docs/ui-redesign-integration-validation-2026-07-21.md new file mode 100644 index 0000000..72b8b54 --- /dev/null +++ b/docs/ui-redesign-integration-validation-2026-07-21.md @@ -0,0 +1,31 @@ +# UI Integration Validation + +Date: 2026-07-21 +Branch: codex/ui-redesign-gallery + +## Local checks + +- Plugin bridge source keeps ready/context handshake, GET/POST request routing, timeout handling, JSON-safe payload cloning, and error unwrapping. +- Direct API base remains /api/v1/plugins/extensions/astrbot_plugin_imagestudio. +- Plugin-page production build passed. +- Standalone-web production build passed. +- No local AstrBot host was available on the checked ports; no real bootstrap or signed-media response was claimed. + +## Checked failure paths + +- Direct transport reports network_unreachable when the API is unavailable. +- HTML/non-JSON responses are converted to invalid_api_response with a bounded preview. +- 401/HTTP failures remain ApiClientError values and are surfaced through the backend connection banner. +- Preview mode is explicit and write actions are blocked until a connected backend with write permission is present. +- Media URLs use the plugin bridge signing path instead of unauthenticated direct img requests. + +## Required host acceptance + +Run the following in an AstrBot plugin page with a real session: + +1. Load ui/bootstrap, dashboard, profiles, images, jobs, settings, logs. +2. Verify signed image preview, refresh, batch selection, retry/cancel, settings save, and log filtering. +3. Verify 401, timeout, empty data, partial data, and backend restart recovery. +4. Record AstrBot version, ImageStudio plugin version, and screenshots. + +Status: source-level integration is ready; live host acceptance is pending because no AstrBot plugin host is running in this workspace. diff --git a/docs/ui-redesign-plan-2026-07-21.md b/docs/ui-redesign-plan-2026-07-21.md new file mode 100644 index 0000000..3938d62 --- /dev/null +++ b/docs/ui-redesign-plan-2026-07-21.md @@ -0,0 +1,77 @@ +# ImageStudio 桌面端 UI 重构方案 + +日期:2026-07-21 +分支:`codex/ui-redesign-gallery` +原则:保留业务逻辑、路由查询参数、API 与数据结构;先改一个页面,再扩展共享视觉层。 + +## 设计方向 + +ImageStudio 是桌面端创作工具,不采用营销网站的 hero、宣传卡片或装饰性动效。视觉方向为“安静的工作台”:冷中性背景、单一主色作为动作/选中/状态强调,内容区保持高对比和稳定密度;圆角、阴影、渐变只服务层级,不作为装饰。 + +## P0:先保证安全边界 + +本项目当前没有已确认的 P0 UI 阻塞项。P0 阶段只包含保护措施: + +- 保留现有 URL 参数:`view`、`module`、`materialView`、`profile`。 +- 保留 plugin-page bridge、API endpoint、shared types 和现有事件 emit。 +- 每批修改前后运行 `npm.cmd run typecheck`、`npm.cmd run build:web`,并运行 `npm.cmd run test:contracts`。 +- 不删除当前工作树已有的 `GalleryPage.vue` 未提交修改;本分支在其基础上继续。 + +## P1:首批桌面端可用性重构 + +### P1-01 只重构 Gallery 页面 + +目标文件: + +- `frontend/standalone-web/src/features/gallery/GalleryPage.vue` +- 必要时复用而不改逻辑:`frontend/standalone-web/src/components/ImagePreviewDialog.vue`、`frontend/standalone-web/src/components/EmptyState.vue`、`frontend/standalone-web/src/components/StateCard.vue` +- 契约测试:`frontend/tests/production-data-boundary.test.mjs` 与图库相关测试 + +实施内容: + +- 保持 props、emits、筛选值、批量 action、endpoint 调用和预览行为不变。 +- 重排为稳定的桌面工作区:页面标题/主操作 → 搜索筛选 → 结果区 + inspector;减少重复 surface。 +- 统一按钮、输入框、筛选 tabs、选中态、禁用态、loading、error、empty 状态。 +- 让 grid/list 在 1024px–1440px 桌面宽度下优先保持主要内容可读,inspector 只在有选择时占据空间。 +- 为搜索、批量选择、卡片操作和图片预览补齐可见 focus、名称、Escape/关闭路径检查。 +- 不新增依赖,不引入营销式动画;保留现有 reduced-motion 规则并覆盖新过渡。 + +### P1-02 抽取最小共享视觉 token + +候选文件: + +- 新增 `frontend/standalone-web/src/styles/tokens.css` 或现有入口可接受的等价 token 文件。 +- 调整 `frontend/standalone-web/src/App.vue` 的全局工作台变量接入 token。 + +范围:颜色角色、spacing、radius、border、shadow、focus ring、motion duration、z-index;只抽取已经在现有 UI 中出现的语义,不改变默认主题含义。 + +## P2:扩展一致性 + +- `frontend/standalone-web/src/components/AppNavigationRail.vue`:统一 active/hover/focus/compact rail,不改变导航 key 或 pin 行为。 +- `frontend/standalone-web/src/features/profiles/ProfilesPage.vue`、`ProfileMasterPane.vue`、`ProfileDetailPane.vue`、`ProfileWardrobePane.vue`:应用同一 surface、表单和状态矩阵。 +- `frontend/standalone-web/src/features/materials/AdvancedMaterialImportPage.vue`:统一导入步骤、loading/error/empty 和内容密度。 +- `frontend/standalone-web/src/features/settings/SettingsPage.vue` 与 settings panels:统一 section、保存/校验/回滚状态。 +- `frontend/standalone-web/src/features/workflow/*.vue`:只做视觉层和焦点/状态修复,不改变 workflow route、round、branch、review API。 +- `frontend/standalone-web/src/features/logs/LogsPage.vue` 与 queue/performance 区块:统一状态色、表格/列表密度和窄桌面布局。 + +## P2:技术收口 + +- 将 `App.vue` 的局部视觉规则迁移到可定位的页面/组件样式,降低后续回归风险;不在第一批做大规模逻辑拆分。 +- 评估路由页面的动态导入,但只有在不影响 plugin-page bridge 和首屏加载契约时才实施。 +- 将布局属性过渡替换为 transform/opacity 或明确的 grid track 过渡。 +- 统一图片 loading/失败/alt 规则,并复核对话框 focus return。 + +## 交付顺序与验证门 + +1. Gallery 页面视觉与交互状态;通过 typecheck、build:web、contract tests。 +2. Gallery 桌面窗口验证:1280×800、1440×900、1024×768;检查横向溢出、sticky 区域、键盘焦点和空/错/加载状态。 +3. 共享 tokens 接入;再次跑同一验证门,并确认 plugin build 不受影响。 +4. 导航、profiles、materials、settings、workflow、logs/queue 分批推进,每批单独验证。 +5. 最后一轮执行 Impeccable `polish`:桌面窗口、溢出、状态、可访问性与设计一致性。 + +## 明确不做 + +- 不重写后端、不改 API endpoint、不迁移数据结构。 +- 不更换 Vue/Vite/TypeScript 技术栈。 +- 不引入新的 UI 框架或图标依赖。 +- 不添加不必要的全屏动画、营销式 hero、装饰性玻璃卡片或渐变文字。 diff --git a/docs/ui-redesign-state-matrix-2026-07-21.md b/docs/ui-redesign-state-matrix-2026-07-21.md new file mode 100644 index 0000000..215768e --- /dev/null +++ b/docs/ui-redesign-state-matrix-2026-07-21.md @@ -0,0 +1,30 @@ +# UI State Matrix + +Date: 2026-07-21 +Branch: codex/ui-redesign-gallery + +## Coverage + +| Area | default | hover | focus | selected | disabled | loading | empty | error | success | disconnected | +|---|---|---|---|---|---|---|---|---|---|---| +| Navigation rail | yes | yes | yes | aria-current=page | n/a | n/a | n/a | n/a | n/a | yes | +| Generate composer | yes | yes | yes | mode button | yes | submit text | preview empty | inline error | result card | write blocked | +| Queue | yes | yes | yes | filter/task | action disabled | refresh text | empty state | task error | completed status | read-only | +| Gallery | yes | yes | yes | card/batch | batch disabled | media loading | empty state | media fallback | selection feedback | read-only | +| Profiles | yes | yes | yes | profile/tab | sealed/read-only | pane loading | empty pane | inline error | saved state | read-only | +| Materials | yes | yes | yes | filter/category | permission disabled | operation busy | empty state | action error | operation message | read-only | +| Settings | yes | yes | yes | section/tab | permission disabled | save/reload | missing schema | validation error | saved message | read-only | +| Logs | yes | yes | yes | filter | refresh disabled | load text | empty state | error state | refreshed state | unavailable | +| Workflow | yes | yes | yes | node/candidate | sealed/locked | task progress | candidate empty | node error | adopted state | read-only | + +## Keyboard paths + +- Global search: focus, ArrowUp/ArrowDown, Enter, Escape. +- Navigation and tabs: Tab, Enter, Space, aria-current/aria-pressed. +- Confirm dialog: Escape, Tab loop, focus return. +- Image preview dialog: Escape, Tab loop, focus return, zoom controls. +- Backend banner: retry is keyboard reachable and status is aria-live. + +## Notes + +The matrix is backed by shared states in App.vue and feature components. Real backend disconnected states are represented by the existing preview/error/blocked paths; live plugin-host acceptance remains a deployment-bound check. diff --git a/frontend/package.json b/frontend/package.json index 20c6e43..2f904fa 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,7 +10,8 @@ "build:web": "vite build --config standalone-web/vite.config.ts", "build": "npm run build:plugin && npm run build:web", "typecheck": "vue-tsc --noEmit", - "test:contracts": "node --test tests/*.test.mjs" + "test:contracts": "node --test tests/*.test.mjs", + "test:ui": "node --test tests/ui-redesign-smoke.test.mjs tests/ui-theme-contract.test.mjs" }, "dependencies": { "@vitejs/plugin-vue": "^5.2.0", @@ -23,4 +24,3 @@ }, "devDependencies": {} } - diff --git a/frontend/standalone-web/src/App.vue b/frontend/standalone-web/src/App.vue index fb5369d..b581812 100644 --- a/frontend/standalone-web/src/App.vue +++ b/frontend/standalone-web/src/App.vue @@ -1,5 +1,7 @@