From d1a9d520ae668e2869040a7cffd5171460a93a37 Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Sun, 20 Sep 2026 18:23:46 +0800 Subject: [PATCH] fix(tasks-ui): restore the scoped preflight subset and return the page to stock shadcn Real-device report: the Tasks page "looks like it has no CSS at all, with blurry borders". Two hypotheses were falsified before the real cause surfaced: the sheet IS delivered (the chunk carries both the CSS and its injector, and the bundle route serves it) and the cascade is NOT the problem (with the real host stylesheet plus the real compiled sheet, a controlled sample keeps our padding, radius, border, background and font; host CSS-module selectors only match host nodes, and its global element rules are element-level specificity). The cause is what we deliberately excluded: PREFLIGHT is also what normalizes form controls. Measured on a plugin icon button that sets only an icon size, the UA chrome survived as padding 1px 6px, border 2px outset, background ButtonFace (#efefef) and a 13.33px system font - gray beveled buttons with a soft double border, i.e. "no CSS". - ui/theme.css: a .dsw-tasks-scoped preflight subset (zero margins/padding, border width+style, background, appearance none, inherit color/spacing, cursor rules) inside @layer base, written with :where() so it stays at (0,1,0) and utilities in the later layer still win; plus an explicit "@layer theme, base, components, utilities;" statement - layer order follows first appearance, and without it the utilities import registered utilities BEFORE base, so the reset beat rounded-md (measured: square buttons). The built chunk's order was re-checked: properties, theme, base, components, utilities. - Stock shadcn restyle: static cards carry stock shadow-xs/shadow-sm again (floating layers keep shadow-lg), body/meta text is text-sm/text-xs instead of 11-13px, status uses stock Badge variants, controls use stock Button variants and sizes, row actions appear on hover/focus while staying keyboard reachable, node cards are 176x68 with shadow-xs. - bandColsFor budgets columns at the readability floor (width / 0.78) instead of 1:1, so a 360px panel keeps two columns; FIT_MIN_SCALE moved into the layout module as GRAPH_FIT_MIN_SCALE so the fit and the column budget share one constant. - Guards: tests/ui-foundation.spec.ts pins the scoped reset declarations and the layer-order statement; tests/ui-shadows.spec.ts now allows shadow-xs and shadow-sm on static panels and bans md and above; the theme guard's inert paint rule forced the reset to spell border-width/border-style instead of the "border: 0 solid" shorthand. Verified: typecheck and lint clean; 136 files / 1505 tests; build with the core/chunk bundle guards; mount e2e 7/7 (mount 444ms, longtasks 2 of 8); the visual mirror page (real host stylesheet + real components) re-shot at 360 and 720 for graph, tree and the 77-node stress fixture. --- ...09-14-tasks-graph-workflow-teams-design.md | 23 +++++ src/client/JobsDrawer.tsx | 63 +++++++------- src/client/SubagentView.tsx | 6 +- src/client/TaskWindow.tsx | 45 +++++----- src/client/TasksGraph.tsx | 83 +++++++++---------- src/client/TasksPopovers.tsx | 32 ++++--- src/client/TasksTree.tsx | 16 ++-- src/client/TeamBoard.tsx | 70 ++++++++-------- src/client/tasks-graph-layout.ts | 20 ++++- src/client/tasks-shared.tsx | 4 +- src/client/ui/theme.css | 51 ++++++++++++ tests/tasks-graph-layout.spec.ts | 10 +++ tests/ui-foundation.spec.ts | 25 ++++++ tests/ui-shadows.spec.ts | 63 ++++++++------ 14 files changed, 318 insertions(+), 193 deletions(-) diff --git a/docs/plans/2026-09-14-tasks-graph-workflow-teams-design.md b/docs/plans/2026-09-14-tasks-graph-workflow-teams-design.md index 322ec66..13e131b 100644 --- a/docs/plans/2026-09-14-tasks-graph-workflow-teams-design.md +++ b/docs/plans/2026-09-14-tasks-graph-workflow-teams-design.md @@ -331,6 +331,29 @@ npx -y shadcn@latest add button card badge separator input textarea tooltip popo 新增的守护文件:`tests/ui-foundation.spec.ts`(入口 import 清单 / 令牌桥全表 / 级联层 / 作用域根类 / `@source`)、`tests/ui-bundle.spec.ts`(核心包与 chunk 的双向产物断言 + 体积预算)、`tests/ui-shadows.spec.ts`(静态面板零阴影)。`tests/theme.spec.ts` 追加「迁移后皮肤契约」一节:`src/client/ui/**` 与迁移文件的**颜色字面量**、**Tailwind 默认调色板类**与**未解析 `var()`** 三类回归。 +### 真机"完全没有 CSS"的根因:缺 preflight 导致表单控件保留 UA 样式(2026-09-20) + +真机反馈:任务页"看起来完全没有 CSS,边框非常模糊"。第一反应是 Tailwind 没下发或级联被宿主压过,**两个假设都被实验否掉**: + +- **样式确实下发**:chunk 里含注入代码与完整 CSS 文本,真机资源清单里 `/sidebar/bundle/tasks.js` 200;页面能看出我们的两行标题截断、Badge、ToggleGroup 等布局。 +- **级联不是根因**:用真实宿主样式表(`dsh-web-frontend` 的 index+vendor CSS)+真实编译产物做受控样本,`padding/radius/border/background/font` 全部是我们的值胜出;宿主 CSS 模块是哈希类名(`button._cfgyt_4`)只命中宿主自己的元素,全局 `button{}` 只有元素级特异性(0,0,1)压不过工具类(0,1,0)。 + +**真根因**:我们**刻意排除 preflight**(它会重绘整个宿主页面),但 preflight 同时负责**归零表单控件**。于是插件里的 `