refactor(FR-3078): use antd tokens directly, shrink the :root --token-* bridge#7800
refactor(FR-3078): use antd tokens directly, shrink the :root --token-* bridge#7800yomybaby wants to merge 1 commit into
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Coverage Report for backend-ai-ui-coverage (./packages/backend.ai-ui)
File Coverage
|
||||||||||||||||||||||||||||||||||||||
Coverage Report for react-coverage (./react)
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Pull request overview
This PR reduces reliance on the legacy :root { --token-* } CSS-variable bridge by migrating in-React styling from var(--token-*) to Ant Design v6 tokens directly, while keeping a minimal :root bridge for the few remaining out-of-tree CSS consumers.
Changes:
- Replaced in-tree
var(--token-*)usages withtoken.*/theme.*in several React components and global styles. - Shrunk the
CSSTokenVariables:rootbridge to a minimal set of color tokens needed by out-of-tree CSS. - Removed the unused
--theme-logo-urlbridge output and its supporting plumbing.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| react/src/components/SettingList.tsx | Removes reliance on an unset CSS variable for active tab font-weight (keeps effective behavior). |
| react/src/components/MainLayout/MainLayout.tsx | Updates scrollbar global styles to use theme tokens directly; minimizes :root --token-* bridge. |
| react/src/components/FolderCreateModalV2.tsx | Migrates modal form padding from var(--token-*) to token.* values. |
| react/src/components/FolderCreateModal.tsx | Migrates modal form padding from var(--token-*) to token.* values. |
| react/src/components/BAIBoard.tsx | Migrates board placeholder styling from CSS variables to token.* values. |
| packages/backend.ai-ui/src/components/BAIModal.tsx | Replaces var(--token-colorBorder, ...) usage with direct token.colorBorder. |
…-* bridge
The custom `:root { --token-*: ... }` bridge mirrored the whole antd token
set so CSS could read tokens via var(). antd's native cssVar can't replace
it for OUT-OF-TREE CSS (resources/webui.css styles `body`, outside antd's
class-scoped `--ant-*` vars), but almost every consumer is IN-TREE.
- Migrate all in-tree consumers (BAIBoard, FolderCreateModal[V2], SettingList,
BAIModal, MainLayout scrollbar) from `var(--token-X)` to the antd token
directly — createStyles/createGlobalStyle already expose `token`/`theme`.
- SettingList's `var(--token-fontWeightSuperStrong, 700)` referenced a
non-antd token that was never set, so it always rendered 700 — inline it.
- Shrink CSSTokenVariables from the full-token loop to the only 4 tokens
resources/webui.css actually reads (colorPrimary, colorBgBase,
colorBgContainer, colorBorder), and drop the dead `--theme-logo-url`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
faaf182 to
b52e15e
Compare
f9ad31b to
04b06d0
Compare

Resolves #7798 (FR-3078)
Follow-up to #7799. Migrates in-tree
var(--token-*)consumers to the antd token directly and shrinks the:rootCSS-variable bridge.Why the bridge can't just be deleted
antd v6 native cssVar (
--ant-*) is class-scoped, not:root— in@ant-design/cssinjs/util/css-variables.jsthe selector ends in.{cssVarKey}, applied only inside the React tree. So out-of-tree CSS (resources/webui.cssstylesbody) cannot read--ant-*. The:root--token-*bridge therefore stays — but only for the tokens that out-of-tree CSS actually needs.Changes
BAIBoard,FolderCreateModal/V2,SettingList,BAIModal) fromvar(--token-X)→ antdtoken/themedirectly (createStyles/createGlobalStylealready expose them). (TheMainLayoutscrollbar's invalid multi-fallbackvar()was fixed directly in the parent refactor(FR-3077): replace direct <style> elements with nonce-safe styling #7799, so it carries novar(--token-*)by the time this PR applies.)SettingList'svar(--token-fontWeightSuperStrong, 700)referenced a non-antd token that was never set, so it always rendered700→ inlined.CSSTokenVariablesfrom the full-token loop to the only 4 tokensresources/webui.cssreads (colorPrimary,colorBgBase,colorBgContainer,colorBorder); drop the dead--theme-logo-url(no consumer anywhere).No in-tree
var(--token-*)remains; behavior preserved.Verification
scripts/verify.sh→=== ALL PASS ===.🤖 Generated with Claude Code