chore: reduce component overhead (#3)

Reviewed-on: reya/gpui-native-kit#3
This commit is contained in:
2026-11-09 10:09:56 +00:00
parent 6815585528
commit 1c091db699
44 changed files with 1376 additions and 1241 deletions
+32 -2
View File
@@ -23,9 +23,39 @@ pub use system::{AccessibilityPreferences, PartialPalette, SourceKind, SystemThe
use gpui::{App, Global, Hsla, Pixels, WindowAppearance, WindowBackgroundAppearance, px};
use std::time::Duration;
/// The hairline width of the control border every button and field paints;
/// sized outside the stated metrics so control sizes match across platforms.
/// The hairline width of the control border every button and field paints.
pub const BORDER_WIDTH: Pixels = px(1.0);
/// The tallest an anchored popup's list may grow.
pub const POPUP_MAX_HEIGHT: Pixels = px(320.0);
/// The widest a tooltip may grow.
pub const TOOLTIP_MAX_WIDTH: Pixels = px(360.0);
/// How far a tooltip sits from the pointer.
pub const TOOLTIP_OFFSET: Pixels = px(1.0);
/// The caret's thickness.
pub const CARET_WIDTH: Pixels = px(1.5);
/// The IME preedit underline's thickness.
pub const UNDERLINE_WIDTH: Pixels = px(1.0);
/// How far one wheel line scrolls, as a multiple of the line height.
pub const WHEEL_LINE_HEIGHT: f32 = 20.0;
/// How far one keyboard arrow step moves a resize seam.
pub const RESIZE_KEYBOARD_STEP: Pixels = px(32.0);
/// The inset around a window's edge that starts a resize gesture.
pub const WINDOW_RESIZE_INSET: Pixels = px(4.0);
/// The pad macOS reserves for its traffic lights at a strip's leading edge.
pub const TRAFFIC_LIGHT_PAD: Pixels = px(78.0);
/// The width of a Windows caption button.
pub const WINDOWS_CAPTION_WIDTH: Pixels = px(36.0);
/// Windows paints its caption close-button hover red in every theme.
pub const WINDOWS_CLOSE_HOVER_HEX: u32 = 0xE81120FF;
/// The monospace advance estimate as a share of the text size.
pub const MONO_ADVANCE_RATIO: f32 = 0.62;
/// How much a pixel avatar's tint washes over its background.
pub const PIXEL_AVATAR_TINT_ALPHA: f32 = 0.16;
/// Pixel avatar cell lightness multipliers.
pub const PIXEL_AVATAR_LIGHT_LIFT: f32 = 1.6;
pub const PIXEL_AVATAR_LIGHT_CAP: f32 = 0.95;
pub const PIXEL_AVATAR_DARK_FACTOR: f32 = 0.45;
pub const PIXEL_AVATAR_DARK_FLOOR: f32 = 0.18;
/// Light or dark, resolved from the system appearance.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, serde::Deserialize)]