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
+20 -6
View File
@@ -1,9 +1,24 @@
//! Overlay scrollbars for scroll surfaces.
//! Renders an overlay [`Scrollbar`] over a scrolled surface, driven by a
//! [`ScrollbarHandle`].
//!
//! # Examples
//!
//! ```no_run
//! use gpui::{div, ScrollHandle, InteractiveElement as _, StatefulInteractiveElement as _};
//! use ui::scrollbar::{Scrollbar, ScrollbarVisibility};
//!
//! let handle = ScrollHandle::new();
//! let content = div().id("log").overflow_y_scroll().track_scroll(&handle);
//! let bar = Scrollbar::vertical("log-bar", handle)
//! .visibility(ScrollbarVisibility::Autohide);
//! ```
use std::rc::Rc;
use std::sync::Arc;
use std::time::{Duration, Instant};
use crate::components::common::ResultLogErr as _;
use crate::theme::{ActiveTheme as _, SCROLLBAR_AUTOHIDE_DELAY, SCROLLBAR_FADE_DURATION};
use gpui::{
App, Bounds, DispatchPhase, ElementId, Entity, EntityId, IntoElement, ListState, MouseButton,
MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, RenderOnce, ScrollEvent,
@@ -11,16 +26,15 @@ use gpui::{
point,
};
use crate::theme::{ActiveTheme as _, SCROLLBAR_AUTOHIDE_DELAY, SCROLLBAR_FADE_DURATION};
use crate::utils::ResultLogErr as _;
/// When an overlay scrollbar shows.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum ScrollbarVisibility {
/// The running platform's behavior, from the theme.
#[default]
Platform,
/// Always visible.
Always,
/// Shows on activity, then fades out.
Autohide,
}
@@ -225,7 +239,7 @@ pub struct Scrollbar {
}
impl Scrollbar {
/// A vertical scrollbar named by `id`, driven by `handle`.
/// Creates a vertical scrollbar named by `id`, driven by `handle`.
pub fn vertical<I, H>(id: I, handle: H) -> Self
where
I: Into<ElementId>,
@@ -239,7 +253,7 @@ impl Scrollbar {
}
}
/// A horizontal scrollbar named by `id`, driven by `handle`.
/// Creates a horizontal scrollbar named by `id`, driven by `handle`.
pub fn horizontal<I, H>(id: I, handle: H) -> Self
where
I: Into<ElementId>,