Repository navigation
feat(native): add THEME_CSS_HOOKS slot parser, compiler, and GPUI ThemeSlot engine - #467
Merged
Merged
Conversation
…eparated background layers
This was referenced Nov 20, 2026
Merged
Open
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.
Part of #457 (Wave H4A — core CSS slot parser/compiler + GPUI
ThemeSlotengine; Wave H4B will wire all 29 UI component call sites right after this merges).Problem
Custom theme CSS in the native GPUI client previously only evaluated
:root/ sidebar custom properties, leaving all 29THEME_CSS_HOOKSselectors unmapped.Solution
apps/native/crates/core/src/themes/slots.rs+css.rs+mod.rs:ThemeSlotcovering all 29THEME_CSS_HOOKSselectors (plus::-webkit-scrollbar/::-webkit-scrollbar-thumbaliases and[data-timeline-row-kind="<kind>"]matchers).ParsedCsswith selector matching for.dark,:root:not(.dark),html.dark,@media (prefers-color-scheme: ...), comma-separated selector lists,:hover/:activepseudo-states, CSS nesting (&),!important, CSS specificity, and per-longhand cascade order.SlotStylesheet(SlotStyleSet { base, hover, active }+ kind-specifictimeline_row) with typedSlotStyleOverridecoveringdisplay: none, solid/transparent/linear-gradient/scopedvar(--theme-background-image)backgrounds, colors, borders, border radii, padding/margin/gap, dimensions, box shadows, opacity, typography, and flex layout, with safety clamps (blur <= 256px,border-width <= 64px,font-size 8..=96px, remote-fetch rejection).CssDiagnosticswithapplied_slot_ruleswhile keepingunmapped_dom_rulesstrictly counting unsupported/unrecognized rules, and exposedpalette_and_slots_for_with_cssso each theme half parses CSS once.apps/native/crates/app/src/theme/slots.rs+theme/mod.rs+workspace.rs+theme_editor.rs:Arc<SlotStylesheet>inSavedTheme,PreparedPreview, and GPUI globalActiveSlotStylesheet(zero per-frame CSS parsing, O(1) slot lookup, zero-mutation fast path on stock themes).slot_stylesheet,slot_style,apply_slot_override,refine_slot_hover,refine_slot_active,ThemeSlotExt,ThemeSlotHoverExt,ThemeSlotInteractiveExt, andtheme_slot_background_layer.workspace.rs's global background image layer behind!slot_stylesheet(cx).has_scoped_background_image()so scoped wallpaper rules do not double-paint globally.theme_editor.rsCSS footer diagnostics to showapplied_slot_rulesandunmapped_dom_rules.Verification
vp fmt --check apps/native/parity/LEDGER.md— passnode apps/native/scripts/gen-theme.ts --check— passnode apps/native/conformance/generate.ts --check— passnode --test apps/native/parity/sync.test.ts— 47 passed, 0 failedCARGO_INCREMENTAL=0 cargo clippy --manifest-path apps/native/Cargo.toml --workspace --all-targets -- -D warnings— pass (0 warnings)CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-core— 1894 passed + 8 conformance passed, 0 failedCARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-client -- --test-threads=1— 170/171 passed (1 pre-existingmcp_apps::tests::*test_server.rs:232socket-open timeout flake;crates/clientuntouched)T3_NATIVE_HOME=$(mktemp -d) CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-native -- --test-threads=1— 232 passed, 0 failedT3_NATIVE_HOME=$(mktemp -d) CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-native --features snapshot theme -- --test-threads=1— 13 passed, 0 failedCARGO_INCREMENTAL=0 cargo build --manifest-path apps/native/Cargo.toml -p t3-native— passImplemented with Antigravity (Gemini).