Re-vendor the native UI kit at 278430d

- Upstream merged core, data, editor, and utils into a single `components` crate: `ui::button`, `ui::tabs`, `ui::code`, `ui::tree`, `ui::sidebar` are flat, and `h_flex`/`v_flex`/`StyledExt` live in `ui::common` and `ui::layout`.
- Adopts the new wrapper-less component module tree, the merged theme/icon updates, and the relocated editor grammars.
- Titlebar repo tabs use the new `TabsVariant::Titlebar` capsule sizing.
- Doc examples now import from `ui::`, so all 44 doctests compile; the clipboard sample no longer names the kit crate.
- docs/ui-gaps.md records that `ui` has no dock/view-registry API instead of the deleted `DockState`.
This commit is contained in:
2026-11-17 09:49:10 +07:00
parent 71f4ec0b6b
commit 8f96a2cc16
80 changed files with 1524 additions and 2037 deletions
+9 -29
View File
@@ -15,22 +15,26 @@ mod source;
mod system;
mod typography;
use std::time::Duration;
pub use colors::{ColorTokens, MaterialTokens};
pub use definition::ThemeDefinition;
use gpui::{
App, Global, Hsla, Pixels, SpringConfig, WindowAppearance, WindowBackgroundAppearance, hsla, px,
};
pub use ramps::{AccentShades, Oklch};
pub use resolve::{Ramps, ResolvedTheme};
pub use system::{AccessibilityPreferences, SourceKind, SystemTheme};
pub use typography::{TextRole, TypeMetrics, Typeset, Typography};
use gpui::{
App, Global, Hsla, Pixels, SpringConfig, WindowAppearance, WindowBackgroundAppearance, hsla, px,
};
use std::time::Duration;
/// The hairline width of the control border every button and field paints.
pub const BORDER_WIDTH: Pixels = px(1.0);
/// The underline and drop indicators a tab strip paints.
pub const TAB_INDICATOR_WIDTH: Pixels = px(2.0);
/// The widest a titlebar tab grows before its label fades.
pub const TAB_MAX_WIDTH: Pixels = px(240.0);
/// The narrowest a titlebar tab shrinks, keeping short labels clear of the fade.
pub const TAB_MIN_WIDTH: Pixels = px(140.0);
/// Opacity applied to disabled controls.
pub const DISABLED_OPACITY: f32 = 0.5;
/// The focus ring's ink alpha.
@@ -764,27 +768,3 @@ pub fn detected_source(cx: &App) -> &'static str {
let engine = cx.global::<ThemeEngine>();
engine.source.label()
}
#[cfg(test)]
mod tests {
use gpui::Rgba;
use super::*;
#[test]
fn the_windows_close_colors_match_the_legacy_hex() {
let hover = Hsla::from(gpui::rgba(0xE81123FF));
let pressed = hover.opacity(0.8);
for (token, expected) in [
(WINDOWS_CLOSE_HOVER, hover),
(WINDOWS_CLOSE_PRESSED, pressed),
] {
let (token, expected) = (Rgba::from(token), Rgba::from(expected));
assert!((token.r - expected.r).abs() < 1e-4);
assert!((token.g - expected.g).abs() < 1e-4);
assert!((token.b - expected.b).abs() < 1e-4);
assert!((token.a - expected.a).abs() < 1e-4);
}
assert_eq!(WINDOWS_CLOSE_FOREGROUND, gpui::white());
}
}