Repository navigation
feat(theme): theme token contract and folder-based custom themes - #501
Merged
github-actions[bot] merged 1 commit intoOct 22, 2026
Merged
Conversation
- Derive token kinds, the runtime whitelist, per-kind validation and `theme.schema.json` from `src/themes/tokenContract.ts`; expose only colors, opacity, radii, border widths and shadows, and ignore size, spacing, layout and typography keys - Accept radius values up to 24px (`radiusFull` excepted) and border widths from 0 to 4px, and drop unknown or invalid tokens individually instead of rejecting the whole theme - Route buttons, switches, inputs, selects, tabs, dialogs and the shared surfaces through `--border-width`, `--card-border-width` and the radius and shadow tokens in the theme layer - Remove tokens without a consumer (`--color-accent-contrast`, `--sidebar-thumb-bg`, `--theme-overlay-hover-background`) - Add `schemaVersion`, per-folder skip reasons and field-level diagnostics to the theme picker, and keep broken JSON, invalid metadata, duplicate ids and unsupported versions as whole-file skips - Validate `icon` and `assets` as relative theme-folder paths without reading or serving the files - Load `themes/<folder>/theme.json` one level deep in Rust, skip symlinked folders and `theme.json` files plus stray JSON, and rename `fileName` to `folder` across IPC, mocks and fixtures - Localize the folder hint, skip reasons and diagnostics in all four locales - Document the file format, directory tree and themable controls in the three READMEs Validation: `bun run check`; `bun test` (991 pass, 32 skip, 4 baseline failures); `bun run build`; `cargo test --locked` (931 pass, 1 baseline failure); `node tests/theme-contract-ui.cjs`; `node tests/window-material-ui.cjs`; `node tests/theme-controls-ui.cjs`; `node tests/theme-stage2-regression-ui.cjs`.
Roomen
force-pushed
the
feat/theme-contract
branch
from
October 22, 2026 08:18
6c1ef24 to
47a8341
Compare
|
已自动合并并发布 Miaomiao Preview。 构建提交:3fa95738144b94b2a195abb3ac1d563753c9af76 下载页为滚动预览版,后续成功构建会替换安装包。 |
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.
Summary
Rebased on
miaomiaoafter #495 merged, so the branch is one commit on top of it.theme.schema.jsonfromsrc/themes/tokenContract.ts, and expose only appearance tokens: colors, opacity, corner radii, border widths and shadows. Size, spacing, layout and typography keys are ignored24px(radiusFullexcepted), border widths from0to4px,noneor comma-separated shadowsschemaVersionstill skip the whole file--border-width,--card-border-widthand the radius and shadow tokens in the theme layer, so the default 1px/1px appearance is unchanged--color-accent-contrast,--sidebar-thumb-bg,--theme-overlay-hover-background) and keep the theme overlay palette opaqueiconandassetsas relative theme-folder paths (.., absolute paths, URLs, backslashes and other extensions are dropped) without reading or serving the filesthemes/<folder>/theme.jsonone level deep in Rust, skipping symlinked folders, symlinkedtheme.jsonand stray JSON, and renamefileNametofolderacross IPC, mocks and fixturesValidation
bun run checkbun test: 1012 pass / 32 skip / 4 fail; the same 4 tests (uiLocalization 1, authFileQuotaPanel priority 2, stateControls 1) fail onmiaomiaobun run buildTMPDIR=/private/tmp/cpa-cargo-tmp cargo test --locked --manifest-path src-tauri/Cargo.toml: 931 pass / 1 fail / 9 ignored; the failure (agents::backups::tests::linked_configuration_and_backup_directories_are_rejected) also fails onmiaomiaonode tests/theme-contract-ui.cjs(new): themed border widths, radii and shadows on real controls and surfaces, and full cleanup when switching to a theme that sets none of themnode tests/window-material-ui.cjs: 14 scenariosnode tests/theme-controls-ui.cjsnode tests/theme-stage2-regression-ui.cjsnode tests/theme-ui.cjs: the custom-theme assertions pass; the script later fails on a sidebar width assertion that also fails onfeat/theme-tokensandmiaomiaoScreenshots