chore: audit components

This commit is contained in:
2026-11-10 15:06:16 +07:00
parent af2177c6c8
commit 03369f501e
92 changed files with 2744 additions and 1947 deletions
+12 -9
View File
@@ -10,7 +10,9 @@ use gpui::{
SharedString, StatefulInteractiveElement as _, Styled as _, Window, canvas, deferred, div,
fill, point, px,
};
use gpui_native_theme::{ActiveTheme as _, RESIZE_KEYBOARD_STEP, Size};
use gpui_native_theme::{
ActiveTheme as _, BORDER_WIDTH, HAIRLINE_WIDTH, RESIZE_KEYBOARD_STEP, Size,
};
use gpui_native_utils::{focus_handle, focus_ring};
/// How far one keyboard arrow step moves the seam.
@@ -28,12 +30,13 @@ struct DragState {
/// A thin drag divider that resizes the adjacent region.
#[derive(IntoElement)]
#[must_use]
pub struct ResizeHandle {
id: ElementId,
/// The axis the drag moves along: a vertical seam drags horizontally.
axis: Axis,
disabled: bool,
a11y_label: Option<SharedString>,
accessibility_label: Option<SharedString>,
on_resize: Option<ResizeHandler>,
on_reset: Option<ResetHandler>,
}
@@ -48,7 +51,7 @@ impl ResizeHandle {
id: id.into(),
axis: Axis::Horizontal,
disabled: false,
a11y_label: None,
accessibility_label: None,
on_resize: None,
on_reset: None,
}
@@ -71,7 +74,7 @@ impl ResizeHandle {
where
L: Into<SharedString>,
{
self.a11y_label = Some(label.into());
self.accessibility_label = Some(label.into());
self
}
@@ -105,7 +108,7 @@ impl RenderOnce for ResizeHandle {
let straddle = -thickness / 2.0;
let label = self
.a11y_label
.accessibility_label
.clone()
.unwrap_or_else(|| SharedString::from("Resize"));
@@ -221,17 +224,17 @@ impl RenderOnce for ResizeHandle {
let line = match axis {
Axis::Horizontal => {
let x = bounds.center().x - px(0.5);
let x = bounds.center().x - HAIRLINE_WIDTH;
Bounds::from_corners(
point(x, bounds.top()),
point(x + px(1.), bounds.bottom()),
point(x + BORDER_WIDTH, bounds.bottom()),
)
}
Axis::Vertical => {
let y = bounds.center().y - px(0.5);
let y = bounds.center().y - HAIRLINE_WIDTH;
Bounds::from_corners(
point(bounds.left(), y),
point(bounds.right(), y + px(1.)),
point(bounds.right(), y + BORDER_WIDTH),
)
}
};