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:
@@ -1,5 +1,17 @@
|
||||
//! Renders a small pill that labels a count or a state.
|
||||
//!
|
||||
//! # Examples
|
||||
//!
|
||||
//! ```no_run
|
||||
//! use ui::badge::{Badge, BadgeVariant};
|
||||
//!
|
||||
//! let unread = Badge::new("unread", "12").variant(BadgeVariant::Accent);
|
||||
//! ```
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::icons::Icon;
|
||||
use crate::theme::{ActiveTheme as _, Size, Theme};
|
||||
use gpui::prelude::FluentBuilder as _;
|
||||
use gpui::{
|
||||
AnyView, App, ElementId, Hsla, InteractiveElement as _, IntoElement, ParentElement as _,
|
||||
@@ -8,13 +20,11 @@ use gpui::{
|
||||
};
|
||||
|
||||
use crate::components::common::{StyledExt, h_flex};
|
||||
use crate::icons::Icon;
|
||||
use crate::theme::{ActiveTheme as _, Size, Theme};
|
||||
|
||||
/// The tooltip view builder gpui's `.tooltip(...)` expects.
|
||||
type TooltipBuilder = Rc<dyn Fn(&mut Window, &mut App) -> AnyView>;
|
||||
|
||||
/// How loud a badge is.
|
||||
/// The visual treatment of a [`Badge`].
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub enum BadgeVariant {
|
||||
/// The default; quiet muted fill for counts.
|
||||
@@ -82,7 +92,7 @@ pub struct Badge {
|
||||
}
|
||||
|
||||
impl Badge {
|
||||
/// Creates a badge showing `label` — a count or state word the caller formats.
|
||||
/// Creates a badge with `label`, a count or state word the caller formats.
|
||||
pub fn new<I, L>(id: I, label: L) -> Self
|
||||
where
|
||||
I: Into<ElementId>,
|
||||
@@ -98,7 +108,7 @@ impl Badge {
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets how loud the badge is.
|
||||
/// Sets the badge's [`BadgeVariant`].
|
||||
pub fn variant(mut self, variant: BadgeVariant) -> Self {
|
||||
self.variant = variant;
|
||||
self
|
||||
|
||||
Reference in New Issue
Block a user